mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fixed #1367. Removed confusing code for speed calculation.
This commit is contained in:
@@ -486,31 +486,20 @@ si32 IBonusBearer::magicResistance() const
|
|||||||
return valOfBonuses(Bonus::MAGIC_RESISTANCE);
|
return valOfBonuses(Bonus::MAGIC_RESISTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui32 CBonusSystemNode::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
|
ui32 IBonusBearer::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
|
||||||
{
|
{
|
||||||
if(hasBonus(Selector::type(Bonus::SIEGE_WEAPON).And(Selector::turns(turn)))) //war machines cannot move
|
//war machines cannot move
|
||||||
|
if(hasBonus(Selector::type(Bonus::SIEGE_WEAPON).And(Selector::turns(turn))))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int speed = valOfBonuses(Selector::type(Bonus::STACKS_SPEED).And(Selector::turns(turn)));
|
|
||||||
|
|
||||||
int percentBonus = 0;
|
|
||||||
for(const Bonus *b : getBonusList())
|
|
||||||
{
|
|
||||||
if(b->type == Bonus::STACKS_SPEED)
|
|
||||||
{
|
|
||||||
percentBonus += b->additionalInfo;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
speed = ((100 + percentBonus) * speed)/100;
|
|
||||||
|
|
||||||
//bind effect check - doesn't influence stack initiative
|
//bind effect check - doesn't influence stack initiative
|
||||||
if (useBind && getEffect (SpellID::BIND))
|
if (useBind && getEffect (SpellID::BIND))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return speed;
|
return valOfBonuses(Selector::type(Bonus::STACKS_SPEED).And(Selector::turns(turn)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
|
bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
|
||||||
|
@@ -592,6 +592,7 @@ public:
|
|||||||
ui32 MaxHealth() const; //get max HP of stack with all modifiers
|
ui32 MaxHealth() const; //get max HP of stack with all modifiers
|
||||||
bool isLiving() const; //non-undead, non-non living or alive
|
bool isLiving() const; //non-undead, non-non living or alive
|
||||||
virtual si32 magicResistance() const;
|
virtual si32 magicResistance() const;
|
||||||
|
ui32 Speed(int turn = 0, bool useBind = false) const; //get speed of creature with all modificators
|
||||||
const Bonus * getEffect(ui16 id, int turn = 0) const; //effect id (SP)
|
const Bonus * getEffect(ui16 id, int turn = 0) const; //effect id (SP)
|
||||||
ui8 howManyEffectsSet(ui16 id) const; //returns amount of effects with given id set for this stack
|
ui8 howManyEffectsSet(ui16 id) const; //returns amount of effects with given id set for this stack
|
||||||
|
|
||||||
@@ -675,9 +676,6 @@ public:
|
|||||||
virtual std::string bonusToString(const Bonus *bonus, bool description) const {return "";}; //description or bonus name
|
virtual std::string bonusToString(const Bonus *bonus, bool description) const {return "";}; //description or bonus name
|
||||||
virtual std::string nodeName() const;
|
virtual std::string nodeName() const;
|
||||||
|
|
||||||
ui32 Speed(int turn = 0, bool useBind = false) const; //get speed of creature with all modificators
|
|
||||||
//FIXME: this interface should be moved to IBonusBearer, but bonus list is required for original implementation to compile
|
|
||||||
|
|
||||||
void deserializationFix();
|
void deserializationFix();
|
||||||
void exportBonus(Bonus * b);
|
void exportBonus(Bonus * b);
|
||||||
void exportBonuses();
|
void exportBonuses();
|
||||||
|
Reference in New Issue
Block a user