mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Refactor actions for Catapult
No target -> Pass No player or no ballistics -> automatic action Else -> manual action
This commit is contained in:
parent
bd52a0d3e4
commit
b49fb7d07f
@ -5414,34 +5414,27 @@ 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
makeStackDoNothing(next);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if( next->getCreature()->idNumber == CreatureID::CATAPULT
|
||||
&& curOwner && curOwner->getSecSkillLevel(SecondarySkill::BALLISTICS) > 0)
|
||||
{
|
||||
if(curB.getAttackableBattleHexes().empty())
|
||||
{
|
||||
makeStackDoNothing(next);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user