diff --git a/client/CBattleInterface.cpp b/client/CBattleInterface.cpp index db9a7f606..494e5775f 100644 --- a/client/CBattleInterface.cpp +++ b/client/CBattleInterface.cpp @@ -2651,7 +2651,14 @@ void CBattleInterface::spellCast(SpellCast * sc) if(sc->affectedCres.size() == 1) { std::string text = CGI->generaltexth->allTexts[195]; - boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetFightingHero(sc->side)->name); + if(sc->castedByHero) + { + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetFightingHero(sc->side)->name); + } + else + { + boost::algorithm::replace_first(text, "%s", "Creature"); //TODO: better fix + } boost::algorithm::replace_first(text, "%s", CGI->spellh->spells[sc->id].name); boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin(), false)->creature->namePl ); console->addText(text); @@ -2659,7 +2666,14 @@ void CBattleInterface::spellCast(SpellCast * sc) else { std::string text = CGI->generaltexth->allTexts[196]; - boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetFightingHero(sc->side)->name); + if(sc->castedByHero) + { + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetFightingHero(sc->side)->name); + } + else + { + boost::algorithm::replace_first(text, "%s", "Creature"); //TODO: better fix + } boost::algorithm::replace_first(text, "%s", CGI->spellh->spells[sc->id].name); console->addText(text); } @@ -2677,7 +2691,10 @@ void CBattleInterface::battleStacksEffectsSet(const SetStackEffect & sse) { displayEffect(CGI->spellh->spells[sse.effect.id].mainEffectAnim, curInt->cb->battleGetStackByID(*ci)->position); } - redrawBackgroundWithHexes(activeStack); + if (activeStack != -1) //it can be -1 when a creature casts effect + { + redrawBackgroundWithHexes(activeStack); + } } void CBattleInterface::castThisSpell(int spellID) diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index 88687b50f..33fa2fbfe 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -2702,6 +2702,8 @@ std::set BattleInfo::getAttackedCreatures( const CSpell * s, int skillL int BattleInfo::calculateSpellDuration(const CSpell * spell, const CGHeroInstance * caster) { + if(!caster) //TODO: something better + return 1; switch(spell->id) { case 56: //frenzy