1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

fix modded spell effect not showing

This commit is contained in:
AlexVinS 2015-01-18 19:38:35 +03:00
parent 0acae7a708
commit a90d603c16

View File

@ -316,11 +316,18 @@ void CStackWindow::CWindowSection::createActiveSpells()
std::vector<si32> spells = battleStack->activeSpells();
for(si32 effect : spells)
{
const CSpell * sp = CGI->spellh->objects[effect];
std::string spellText;
if (effect < 77) //not all effects have graphics (for eg. Acid Breath)
//not all effects have graphics (for eg. Acid Breath)
//for modded spells iconEffect is added to SpellInt.def
const bool hasGraphics = (effect < SpellID::THUNDERBOLT) || (effect >= SpellID::AFTER_LAST);
if (hasGraphics)
{
spellText = CGI->generaltexth->allTexts[610]; //"%s, duration: %d rounds."
boost::replace_first (spellText, "%s", CGI->spellh->objects[effect]->name);
boost::replace_first (spellText, "%s", sp->name);
int duration = battleStack->getBonusLocalFirst(Selector::source(Bonus::SPELL_EFFECT,effect))->turnsRemain;
boost::replace_first (spellText, "%d", boost::lexical_cast<std::string>(duration));