1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Merge pull request #3624 from IvanSavenko/fix_crash

Fix crash on using heal in SPELL_AFTER_ATTACK bonus
This commit is contained in:
Ivan Savenko
2024-02-25 15:01:32 +02:00
committed by GitHub

View File

@@ -132,7 +132,8 @@ void Heal::prepareHealEffect(int64_t value, BattleUnitsChanged & pack, BattleLog
else if (unitHPgained > 0 && m->caster->getHeroCaster() == nullptr) //Show text about healed HP if healed by unit
{
MetaString healText;
auto casterUnit = dynamic_cast<const battle::Unit*>(m->caster);
auto casterUnitID = m->caster->getCasterUnitId();
auto casterUnit = m->battle()->battleGetUnitByID(casterUnitID);
healText.appendLocalString(EMetaText::GENERAL_TXT, 414);
casterUnit->addNameReplacement(healText, false);
state->addNameReplacement(healText, false);