1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-30 08:57:00 +02:00
This commit is contained in:
DjWarmonger 2011-11-06 17:39:49 +00:00
parent 0f2e00c780
commit c448b61976

View File

@ -1395,18 +1395,22 @@ bool BattleInfo::battleCanFlee(int player) const
const CStack * BattleInfo::battleGetStack(THex pos, bool onlyAlive)
{
CStack * stack = NULL;
for(unsigned int g=0; g<stacks.size(); ++g)
{
if((stacks[g]->position == pos
if(stacks[g]->position == pos
|| (stacks[g]->doubleWide()
&&( (stacks[g]->attackerOwned && stacks[g]->position-1 == pos)
|| (!stacks[g]->attackerOwned && stacks[g]->position+1 == pos) )
))
&& (!onlyAlive || stacks[g]->alive())
)
return stacks[g];
) )
{
if (stacks[g]->alive())
return stacks[g]; //we prefer living stacks - there cna be only one stack on te tile, so return it imediately
else if (!onlyAlive)
stack = stacks[g]; //dead stacks are only accessible when there's no alive stack on this tile
}
}
return NULL;
return stack;
}
const CGHeroInstance * BattleInfo::battleGetOwner(const CStack * stack) const
@ -2131,7 +2135,7 @@ SpellCasting::ESpellCastProblem BattleInfo::battleIsImmune(const CGHeroInstance
break;
case 53: //haste
case 54: //slow
case 63: // Teleport
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