1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

only blocking non positive spells; counterstrike

This commit is contained in:
Laserlicht 2024-09-21 23:50:35 +02:00
parent 43666ec987
commit 899d3a14a0
3 changed files with 4 additions and 3 deletions

View File

@ -794,7 +794,7 @@ DamageEstimation CBattleInfoCallback::battleEstimateDamage(const BattleAttackInf
if (!bai.defender->ableToRetaliate())
return ret;
if (bai.attacker->hasBonusOfType(BonusType::BLOCKS_RETALIATION))
if (bai.attacker->hasBonusOfType(BonusType::BLOCKS_RETALIATION) || bai.attacker->hasBonusOfType(BonusType::INVINCIBLE))
return ret;
//TODO: rewrite using boost::numeric::interval

View File

@ -231,7 +231,7 @@ bool BattleSpellMechanics::canBeCastAt(const Target & target, Problem & problem)
if(mainTarget && mainTarget == caster)
return false; // can't cast on self
if(mainTarget && mainTarget->hasBonusOfType(BonusType::INVINCIBLE))
if(mainTarget && mainTarget->hasBonusOfType(BonusType::INVINCIBLE) && !getSpell()->getPositiveness())
return false;
}

View File

@ -276,7 +276,7 @@ bool BattleActionProcessor::doAttackAction(const CBattleInfoCallback & battle, c
for (int i = 0; i < totalAttacks; ++i)
{
//first strike
if(i == 0 && firstStrike && retaliation && !stack->hasBonusOfType(BonusType::BLOCKS_RETALIATION))
if(i == 0 && firstStrike && retaliation && !stack->hasBonusOfType(BonusType::BLOCKS_RETALIATION) && !stack->hasBonusOfType(BonusType::INVINCIBLE))
{
makeAttack(battle, destinationStack, stack, 0, stack->getPosition(), true, false, true);
}
@ -303,6 +303,7 @@ bool BattleActionProcessor::doAttackAction(const CBattleInfoCallback & battle, c
//we check retaliation twice, so if it unblocked during attack it will work only on next attack
if(stack->alive()
&& !stack->hasBonusOfType(BonusType::BLOCKS_RETALIATION)
&& !stack->hasBonusOfType(BonusType::INVINCIBLE)
&& (i == 0 && !firstStrike)
&& retaliation && destinationStack->ableToRetaliate())
{