|
@@ -234,7 +234,11 @@ CStackWindow::ActiveSpellsSection::ActiveSpellsSection(CStackWindow * owner, int
|
|
|
spellText = CGI->generaltexth->allTexts[610]; //"%s, duration: %d rounds."
|
|
|
boost::replace_first(spellText, "%s", spell->getNameTranslated());
|
|
|
//FIXME: support permanent duration
|
|
|
- int duration = battleStack->getFirstBonus(Selector::source(BonusSource::SPELL_EFFECT, BonusSourceID(effect)))->turnsRemain;
|
|
|
+ auto spellBonuses = battleStack->getBonuses(Selector::source(BonusSource::SPELL_EFFECT, BonusSourceID(effect)));
|
|
|
+ if (spellBonuses->empty())
|
|
|
+ throw std::runtime_error("Failed to find effects for spell " + effect.toSpell()->getJsonKey());
|
|
|
+
|
|
|
+ int duration = spellBonuses->front()->duration;
|
|
|
boost::replace_first(spellText, "%d", std::to_string(duration));
|
|
|
|
|
|
spellIcons.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("SpellInt"), effect + 1, 0, firstPos.x + offset.x * printed, firstPos.y + offset.y * printed));
|