1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00

and should be fixed now

This commit is contained in:
mateuszb 2011-01-18 18:54:53 +00:00
parent 98494a5e6f
commit a9c98d2b8c
3 changed files with 16 additions and 7 deletions

@ -893,7 +893,7 @@ bool CMeleeAttack::init()
int revShiftattacker = (attackingStack->attackerOwned ? -1 : 1);
int mutPos = THex::mutualPosition(attackingStackPosBeforeReturn, dest);
if(mutPos == -1 && attackedStack->doubleWide())
if(mutPos == -1 && attackingStack->doubleWide())
{
mutPos = THex::mutualPosition(attackingStackPosBeforeReturn + revShiftattacker, attackedStack->position);
}

@ -1345,11 +1345,12 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, int terrain, int terType, const
for(unsigned g=0; g<stacks.size(); ++g) //shifting positions of two-hex creatures
{
if((stacks[g]->position%17)==1 && stacks[g]->doubleWide() && stacks[g]->attackerOwned)
//we should do that for creature bank too
if(stacks[g]->doubleWide() && stacks[g]->attackerOwned)
{
stacks[g]->position += THex::RIGHT;
}
else if((stacks[g]->position%17)==15 && stacks[g]->doubleWide() && !stacks[g]->attackerOwned)
else if(stacks[g]->doubleWide() && !stacks[g]->attackerOwned)
{
stacks[g]->position += THex::LEFT;
}

@ -4897,17 +4897,20 @@ void CGameHandler::runBattle()
{
BattleAction heal;
std::vector< const CStack * > possibleStacks;
std::vector< const CStack * > possibleStacks, secondPriority;
for (int v=0; v<gs->curB->stacks.size(); ++v)
{
const CStack * cstack = gs->curB->stacks[v];
if (cstack->owner == next->owner && cstack->firstHPleft < cstack->MaxHealth() && cstack->alive()) //it's friendly and not fully healthy
{
possibleStacks.push_back(cstack);
if (cstack->hasBonusOfType(Bonus::SIEGE_WEAPON))
secondPriority.push_back(cstack);
else
possibleStacks.push_back(cstack);
}
}
if(possibleStacks.size() == 0)
if(possibleStacks.size() == 0 && secondPriority.size() == 0)
{
//nothing to heal
makeStackDoNothing(next);
@ -4917,7 +4920,12 @@ void CGameHandler::runBattle()
else
{
//heal random creature
const CStack * toBeHealed = possibleStacks[ rand()%possibleStacks.size() ];
const CStack * toBeHealed = NULL;
if (possibleStacks.size() > 0)
toBeHealed = possibleStacks[ rand()%possibleStacks.size() ];
else
toBeHealed = secondPriority[ rand()%secondPriority.size() ];
heal.actionType = BattleAction::STACK_HEAL;
heal.additionalInfo = 0;
heal.destinationTile = toBeHealed->position;