Skip to content

Commit

Permalink
Merge pull request #116 from DavidZeni/issue/2137
Browse files Browse the repository at this point in the history
Okay, thank you for your contribution :)
  • Loading branch information
DjWarmonger authored and DjWarmonger committed Aug 29, 2015
2 parents ee08e6b + 41293ca commit a8c9727
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions server/CGameHandler.cpp
Expand Up @@ -5414,26 +5414,29 @@ void CGameHandler::runBattle()
continue;
}

if(next->getCreature()->idNumber == CreatureID::CATAPULT && (!curOwner || curOwner->getSecSkillLevel(SecondarySkill::BALLISTICS) == 0)) //catapult, hero has no ballistics
if(next->getCreature()->idNumber == CreatureID::CATAPULT)
{
const auto & attackableBattleHexes = curB.getAttackableBattleHexes();

if(!attackableBattleHexes.empty())
if(attackableBattleHexes.empty())
{
makeStackDoNothing(next);
continue;
}

if(!curOwner || curOwner->getSecSkillLevel(SecondarySkill::BALLISTICS) == 0)
{
BattleAction attack;
attack.destinationTile = *RandomGeneratorUtil::nextItem(attackableBattleHexes, gs->getRandomGenerator());
attack.destinationTile = *RandomGeneratorUtil::nextItem(attackableBattleHexes,
gs->getRandomGenerator());
attack.actionType = Battle::CATAPULT;
attack.additionalInfo = 0;
attack.side = !next->attackerOwned;
attack.stackNumber = next->ID;

makeAutomaticAction(next, attack);
continue;
}
else
{
makeStackDoNothing(next);
}
continue;
}

if(next->getCreature()->idNumber == CreatureID::FIRST_AID_TENT)
Expand Down

0 comments on commit a8c9727

Please sign in to comment.