1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Do not apply Fire Shield effect that deals 0 damage

This commit is contained in:
Ivan Savenko 2023-01-04 17:55:19 +02:00
parent 397ea90040
commit a1eaf4d9c8

View File

@ -1180,27 +1180,30 @@ void CGameHandler::makeAttack(const CStack * attacker, const CStack * defender,
//FIXME: add custom effect on actor
}
BattleStackAttacked bsa;
bsa.flags |= BattleStackAttacked::FIRE_SHIELD;
bsa.stackAttacked = attacker->ID; //invert
bsa.attackerID = defender->ID;
bsa.damageAmount = totalDamage;
attacker->prepareAttacked(bsa, getRandomGenerator());
StacksInjured pack;
pack.stacks.push_back(bsa);
sendAndApply(&pack);
// TODO: this is already implemented in Damage::describeEffect()
if (totalDamage > 0)
{
MetaString text;
text.addTxt(MetaString::GENERAL_TXT, 376);
text.addReplacement(MetaString::SPELL_NAME, SpellID::FIRE_SHIELD);
text.addReplacement(totalDamage);
blm.lines.push_back(std::move(text));
BattleStackAttacked bsa;
bsa.flags |= BattleStackAttacked::FIRE_SHIELD;
bsa.stackAttacked = attacker->ID; //invert
bsa.attackerID = defender->ID;
bsa.damageAmount = totalDamage;
attacker->prepareAttacked(bsa, getRandomGenerator());
StacksInjured pack;
pack.stacks.push_back(bsa);
sendAndApply(&pack);
// TODO: this is already implemented in Damage::describeEffect()
{
MetaString text;
text.addTxt(MetaString::GENERAL_TXT, 376);
text.addReplacement(MetaString::SPELL_NAME, SpellID::FIRE_SHIELD);
text.addReplacement(totalDamage);
blm.lines.push_back(std::move(text));
}
addGenericKilledLog(blm, attacker, bsa.killedAmount, false);
}
addGenericKilledLog(blm, attacker, bsa.killedAmount, false);
}
sendAndApply(&blm);