1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fixed #832. War machines will now be immune to a number of effects.

This commit is contained in:
DjWarmonger 2011-10-29 11:12:30 +00:00
parent a33017f9da
commit 1e45674a7c
2 changed files with 11 additions and 2 deletions

View File

@ -2122,11 +2122,20 @@ SpellCasting::ESpellCastProblem BattleInfo::battleIsImmune(const CGHeroInstance
return SpellCasting::STACK_IMMUNE_TO_SPELL; return SpellCasting::STACK_IMMUNE_TO_SPELL;
break; break;
case 24: // Death Ripple case 24: // Death Ripple
if (subject->hasBonusOfType(Bonus::SIEGE_WEAPON))
return SpellCasting::STACK_IMMUNE_TO_SPELL; //don't break here - undeads and war machines are immune, non-living are not
case 41: case 41:
case 42: //undeads are immune to bless & curse case 42: //undeads are immune to bless & curse
if (subject->hasBonusOfType(Bonus::UNDEAD)) if (subject->hasBonusOfType(Bonus::UNDEAD))
return SpellCasting::STACK_IMMUNE_TO_SPELL; return SpellCasting::STACK_IMMUNE_TO_SPELL;
break; break;
case 53: //haste
case 54: //slow
case 63: // Teleport
case 65: //clone
if (subject->hasBonusOfType(Bonus::SIEGE_WEAPON))
return SpellCasting::STACK_IMMUNE_TO_SPELL; //war machines are mmune to some spells than involve movement
break;
case 61: //Forgetfulness case 61: //Forgetfulness
if (!subject->hasBonusOfType(Bonus::SHOOTER)) if (!subject->hasBonusOfType(Bonus::SHOOTER))
return SpellCasting::STACK_IMMUNE_TO_SPELL; return SpellCasting::STACK_IMMUNE_TO_SPELL;

View File

@ -418,8 +418,8 @@ si32 IBonusBearer::magicResistance() const
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
{ {
std::stringstream cachingStr; std::stringstream cachingStr;
cachingStr << "type_" << Bonus::UNDEAD << "s_-1Otype_" << Bonus::NON_LIVING; cachingStr << "type_" << Bonus::UNDEAD << "s_-1Otype_" << Bonus::NON_LIVING << "s_-11type_" << Bonus::SIEGE_WEAPON; //I don't relaly get what string labels mean?
return(!hasBonus(Selector::type(Bonus::UNDEAD) || Selector::type(Bonus::NON_LIVING), cachingStr.str())); return(!hasBonus(Selector::type(Bonus::UNDEAD) || Selector::type(Bonus::NON_LIVING) || Selector::type(Bonus::SIEGE_WEAPON), cachingStr.str()));
} }
const TBonusListPtr IBonusBearer::getSpellBonuses() const const TBonusListPtr IBonusBearer::getSpellBonuses() const