1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Console texts for creature casting spells.

Fixes related to war machines in battle.
This commit is contained in:
DjWarmonger
2011-10-22 07:05:57 +00:00
parent 10fce0025a
commit 57216eea44
6 changed files with 35 additions and 8 deletions

View File

@ -2369,17 +2369,23 @@ ui32 CStack::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
si32 CStack::magicResistance() const
{
si32 magicResistance = base->magicResistance();
int auraBonus = 0;
BOOST_FOREACH (CStack * stack, base->armyObj->battle->getAdjacentCreatures(this))
si32 magicResistance;
if (base) //TODO: make war machines receive aura of magic resistance
{
magicResistance = base->magicResistance();
int auraBonus = 0;
BOOST_FOREACH (CStack * stack, base->armyObj->battle->getAdjacentCreatures(this))
{
if (stack->owner == owner)
{
amax(auraBonus, stack->valOfBonuses(Bonus::SPELL_RESISTANCE_AURA)); //max value
}
}
magicResistance += auraBonus;
amin (magicResistance, 100);
magicResistance += auraBonus;
amin (magicResistance, 100);
}
else
magicResistance = type->magicResistance();
return magicResistance;
}
@ -2792,6 +2798,11 @@ bool CStack::ableToRetaliate() const
&& !hasBonusOfType(Bonus::HYPNOTIZED);
}
std::string CStack::getName() const
{
return (count > 1) ? type->namePl : type->nameSing; //War machines can't use base
}
bool CMP_stack::operator()( const CStack* a, const CStack* b )
{
switch(phase)