mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Fixed crash at double attack, including #1202.
This commit is contained in:
@@ -3462,17 +3462,20 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
|||||||
|
|
||||||
for (int i = 0; i < totalAttacks; ++i)
|
for (int i = 0; i < totalAttacks; ++i)
|
||||||
{
|
{
|
||||||
if( stack &&stack->alive()) //move can cause death, eg. by walking into the moat
|
if (stack &&
|
||||||
|
stack->alive() && //move can cause death, eg. by walking into the moat
|
||||||
|
stackAtEnd->alive())
|
||||||
{
|
{
|
||||||
BattleAttack bat;
|
BattleAttack bat;
|
||||||
prepareAttack(bat, stack, stackAtEnd, distance, ba.additionalInfo);
|
prepareAttack(bat, stack, stackAtEnd, (i ? 0 : distance), ba.additionalInfo); //no distance travelled on second attack
|
||||||
|
//prepareAttack(bat, stack, stackAtEnd, 0, ba.additionalInfo);
|
||||||
handleAttackBeforeCasting(bat); //only before first attack
|
handleAttackBeforeCasting(bat); //only before first attack
|
||||||
sendAndApply(&bat);
|
sendAndApply(&bat);
|
||||||
handleAfterAttackCasting(bat);
|
handleAfterAttackCasting(bat);
|
||||||
}
|
}
|
||||||
|
|
||||||
//counterattack
|
//counterattack
|
||||||
if(!stack->hasBonusOfType(Bonus::BLOCKS_RETALIATION)
|
if (!stack->hasBonusOfType(Bonus::BLOCKS_RETALIATION)
|
||||||
&& stackAtEnd->ableToRetaliate()
|
&& stackAtEnd->ableToRetaliate()
|
||||||
&& stack->alive()) //attacker may have died (fire shield)
|
&& stack->alive()) //attacker may have died (fire shield)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user