1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Extract battleStackIsImmune from battleIsImmune

This fix possible problems with rising spells as now immunty is handled on stack level not on hex level
* battleIsImmune in now protected - only used in canCastThisSpellHere
This commit is contained in:
AlexVinS
2014-05-19 13:44:38 +04:00
parent c22908651c
commit 6f65d2484b
4 changed files with 116 additions and 83 deletions

View File

@ -4050,7 +4050,7 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
}
vstd::erase_if(attackedCres,[=](const CStack * s){
return gs->curB->battleIsImmune(caster,spell,mode,s->position);
return ESpellCastProblem::OK != gs->curB->battleStackIsImmune(caster,spell,mode,s);
});
for (auto cre : attackedCres)
@ -4463,7 +4463,7 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
{
if(battleStack->owner == gs->curB->sides.at(casterSide).color) //get enemy stacks which can be affected by this spell
{
if (!gs->curB->battleIsImmune(nullptr, spell, ECastingMode::MAGIC_MIRROR, battleStack->position))
if (ESpellCastProblem::OK == gs->curB->battleStackIsImmune(nullptr, spell, ECastingMode::MAGIC_MIRROR, battleStack))
mirrorTargets.push_back(battleStack);
}
}