1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
mateuszb 2010-03-02 11:40:29 +00:00
parent 336b260d8a
commit c3cf16df19
2 changed files with 22 additions and 3 deletions

View File

@ -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)

View File

@ -2702,6 +2702,8 @@ std::set<CStack*> 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