new param <anim-hp-bound value="true"/> for BeBuilt skill to have the animation progress bound to the HP. / fixed a nullpointer exception related to particles
This commit is contained in:
parent
8e1836220d
commit
a1ab98d4b9
|
@ -1250,8 +1250,12 @@ bool Unit::update() {
|
||||||
float speedDenominator = (speedDivider * game->getWorld()->getUpdateFps(this->getFactionIndex()));
|
float speedDenominator = (speedDivider * game->getWorld()->getUpdateFps(this->getFactionIndex()));
|
||||||
progress += (speed * diagonalFactor * heightFactor) / speedDenominator;
|
progress += (speed * diagonalFactor * heightFactor) / speedDenominator;
|
||||||
|
|
||||||
animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
|
if(currSkill->getClass() == scBeBuilt && static_cast<const BeBuiltSkillType*>(currSkill)->getAnimHpBound()==true ){
|
||||||
|
animProgress=this->getHpRatio();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
animProgress += (currSkill->getAnimSpeed() * heightFactor) / speedDenominator;
|
||||||
|
}
|
||||||
//update target
|
//update target
|
||||||
updateTarget();
|
updateTarget();
|
||||||
|
|
||||||
|
@ -2230,7 +2234,7 @@ void Unit::stopDamageParticles(bool force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(force == true || pst->getMinmaxEnabled() == false) {
|
if(force == true || ( pst !=NULL && pst->getMinmaxEnabled() == false )) {
|
||||||
damageParticleSystemsInUse.erase(foundParticleIndexType);
|
damageParticleSystemsInUse.erase(foundParticleIndexType);
|
||||||
ps->fade();
|
ps->fade();
|
||||||
damageParticleSystems.pop_back();
|
damageParticleSystems.pop_back();
|
||||||
|
|
|
@ -625,6 +625,20 @@ BeBuiltSkillType::BeBuiltSkillType(){
|
||||||
skillClass= scBeBuilt;
|
skillClass= scBeBuilt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BeBuiltSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
||||||
|
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
|
||||||
|
string parentLoader) {
|
||||||
|
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
||||||
|
|
||||||
|
if(sn->hasChild("anim-hp-bound")){
|
||||||
|
animHpBound= sn->getChild("anim-hp-bound")->getAttribute("value")->getBoolValue();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
animHpBound=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string BeBuiltSkillType::toString() const{
|
string BeBuiltSkillType::toString() const{
|
||||||
return "Be built";
|
return "Be built";
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,11 @@ public:
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
||||||
class BeBuiltSkillType: public SkillType{
|
class BeBuiltSkillType: public SkillType{
|
||||||
|
private:
|
||||||
|
bool animHpBound;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
bool getAnimHpBound() const {return animHpBound;}
|
||||||
BeBuiltSkillType();
|
BeBuiltSkillType();
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue