1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
DjWarmonger 2013-07-22 10:39:11 +00:00
parent 103a75e763
commit 4fd9bcfedc
6 changed files with 37 additions and 32 deletions

View File

@ -540,7 +540,7 @@ void CCreatureWindow::showAll(SDL_Surface * to)
printLine(3, CGI->generaltexth->allTexts[199], stackNode->getMinDamage() * dmgMultiply, stackNode->getMaxDamage() * dmgMultiply, true);
printLine(4, CGI->generaltexth->allTexts[388], c->valOfBonuses(Bonus::STACK_HEALTH), stackNode->valOfBonuses(Bonus::STACK_HEALTH));
printLine(6, CGI->generaltexth->zelp[441].first, c->valOfBonuses(Bonus::STACKS_SPEED), stackNode->valOfBonuses(Bonus::STACKS_SPEED));
printLine(6, CGI->generaltexth->zelp[441].first, c->Speed(), stackNode->Speed());
for(CBonusItem* b : bonusItems)
b->showAll (to);

View File

@ -588,7 +588,8 @@
{
"type": "STACKS_SPEED",
"duration": "N_TURNS",
"values":[2, 2, 4, 4]
"values":[2, 2, 4, 4],
"ainfos":[0,0,0,0]
}
]
},
@ -669,7 +670,8 @@
{
"type": "STACKS_SPEED",
"duration": "N_TURNS",
"values":[3, 3, 5, 5]
"values":[3, 3, 5, 5],
"ainfos":[0,0,0,0]
}
],
"immunity":["SIEGE_WEAPON"]
@ -690,7 +692,8 @@
"type": "STACKS_SPEED",
"valueType": "PERCENT_TO_ALL",
"duration": "N_TURNS",
"values":[-25,-25,-50,-50]
"values":[-25,-25,-50,-50],
"ainfos":[0,0,0,0]
}
],
"immunity":["SIEGE_WEAPON"]

View File

@ -895,33 +895,6 @@ void CStack::postInit()
casts = valOfBonuses(Bonus::CASTS);
}
ui32 CStack::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
{
if(hasBonus(Selector::type(Bonus::SIEGE_WEAPON).And(Selector::turns(turn)))) //war machines cannot move
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
if (useBind && getEffect (SpellID::BIND))
{
return 0;
}
return speed;
}
ui32 CStack::level() const
{
if (base)

View File

@ -185,7 +185,6 @@ public:
bool waited(int turn = 0) const;
bool canMove(int turn = 0) const; //if stack can move
bool canBeHealed() const; //for first aid tent - only harmed stacks that are not war machines
ui32 Speed(int turn = 0, bool useBind = false) const; //get speed of creature with all modificators
ui32 level() const;
si32 magicResistance() const override; //include aura of resistance
static void stackEffectToFeature(std::vector<Bonus> & sf, const Bonus & sse);

View File

@ -486,6 +486,33 @@ si32 IBonusBearer::magicResistance() const
return valOfBonuses(Bonus::MAGIC_RESISTANCE);
}
ui32 CBonusSystemNode::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
{
if(hasBonus(Selector::type(Bonus::SIEGE_WEAPON).And(Selector::turns(turn)))) //war machines cannot move
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
if (useBind && getEffect (SpellID::BIND))
{
return 0;
}
return speed;
}
bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
{
std::stringstream cachingStr;

View File

@ -675,6 +675,9 @@ public:
virtual std::string bonusToString(const Bonus *bonus, bool description) const {return "";}; //description or bonus name
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 exportBonus(Bonus * b);
void exportBonuses();