From a73a1c272402165b0f6d021971ff893c53beb733 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Tue, 26 Apr 2011 07:57:26 +0000 Subject: [PATCH] Battle log messages for new abilities. Lots of fixes. --- client/CBattleInterface.cpp | 77 ++++++++++++++++++++++++++++++------- config/AC_desc.txt | 4 +- config/cr_abils.txt | 8 ++-- config/sp_sounds.txt | 14 +++++-- 4 files changed, 80 insertions(+), 23 deletions(-) diff --git a/client/CBattleInterface.cpp b/client/CBattleInterface.cpp index a10fc2dbd..1a4aabfb0 100644 --- a/client/CBattleInterface.cpp +++ b/client/CBattleInterface.cpp @@ -2845,6 +2845,8 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc ) //displaying message in console bool customSpell = false; + bool plural = false; //add singular / plural form of creature text if this is true + int textID = 0; if(sc->affectedCres.size() == 1) { std::string text = CGI->generaltexth->allTexts[195]; @@ -2857,35 +2859,82 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc ) { switch(sc->id) { + case 70: //Stone Gaze + customSpell = true; + plural = true; + textID = 558; + break; case 71: //Poison + customSpell = true; + plural = true; + textID = 561; + break; + case 72: //Bind + customSpell = true; + text = CGI->generaltexth->allTexts[560]; + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin(), false)->getCreature()->namePl ); + break; //Roots and vines bind the %s to the ground! + case 73: //Disease + customSpell = true; + plural = true; + textID = 553; + break; + case 74: //Paralyze + customSpell = true; + plural = true; + textID = 563; + break; + case 75: // Aging //TODO: hitpoints + customSpell = true; + plural = true; + textID = 551; + break; + case 78: //Dispell helpful spells + text = CGI->generaltexth->allTexts[555]; + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin())->type->namePl); customSpell = true; break; - //case 75: // Aging - // customSpell = true; - // break; case 79: // Death Stare customSpell = true; - if (sc->dmgToDisplay > 1) + if (sc->dmgToDisplay) { - text = CGI->generaltexth->allTexts[119]; //%d %s die under the terrible gaze of the %s. - boost::algorithm::replace_first(text, "%d", boost::lexical_cast(sc->dmgToDisplay)); - boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin(), false)->getCreature()->namePl ); + if (sc->dmgToDisplay > 1) + { + text = CGI->generaltexth->allTexts[119]; //%d %s die under the terrible gaze of the %s. + boost::algorithm::replace_first(text, "%d", boost::lexical_cast(sc->dmgToDisplay)); + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin(), false)->getCreature()->namePl ); + } + else + { + text = CGI->generaltexth->allTexts[118]; //One %s dies under the terrible gaze of the %s. + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin())->type->nameSing); + } + boost::algorithm::replace_first(text, "%s", "Creatures"); //casting stack } else - { - text = CGI->generaltexth->allTexts[118]; //One %s dies under the terrible gaze of the %s. - boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin())->type->nameSing); - } - boost::algorithm::replace_first(text, "%s", "Creatures"); //casting stack + text = ""; break; default: boost::algorithm::replace_first(text, "%s", "Creature"); //TODO: better fix } + if (plural) + { + if (curInt->cb->battleGetStackByID(*sc->affectedCres.begin())->count > 1) + { + text = CGI->generaltexth->allTexts[textID + 1]; + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin())->type->namePl); + } + else + { + text = CGI->generaltexth->allTexts[textID]; + boost::algorithm::replace_first(text, "%s", curInt->cb->battleGetStackByID(*sc->affectedCres.begin())->type->nameSing); + } + } } if (!customSpell) boost::algorithm::replace_first(text, "%s", CGI->spellh->spells[sc->id]->name); - - console->addText(text); + if (text.size()) + console->addText(text); } else { diff --git a/config/AC_desc.txt b/config/AC_desc.txt index 733c2bff3..601de56a1 100644 --- a/config/AC_desc.txt +++ b/config/AC_desc.txt @@ -68,8 +68,8 @@ 66 0 67 1 SP11_.DEF 68 1 SP02_.DEF -69 1 C05SPE0.DEF -70 2 SP02_.DEF SP10_.DEF +69 1 SP05_.DEF +70 0 71 1 SP01_.DEF 72 1 SP04_.DEF 73 1 SP03_.DEF diff --git a/config/cr_abils.txt b/config/cr_abils.txt index ce337d784..e5c2c04bc 100644 --- a/config/cr_abils.txt +++ b/config/cr_abils.txt @@ -17,11 +17,11 @@ + 17 MAGIC_RESISTANCE 40 0 0 //battle dwarf's magic resistance 40% + 20 CHANGES_SPELL_COST_FOR_ENEMY 2 0 0 //pegasus makes spell cost higher for enemy mage + 21 CHANGES_SPELL_COST_FOR_ENEMY 2 0 0 //silver pegasus makes spell cost higher for enemy mage -+ 22 SPELL_AFTER_ATTACK 72 0 100 //dendroids cast bind -+ 23 SPELL_AFTER_ATTACK 72 0 100 //dendroid guards cast bind -+ 24 SPELL_AFTER_ATTACK 62 0 20 //unicorns cast blind with 20% probability ++ 22 SPELL_AFTER_ATTACK 100 72 0 //dendroids cast bind ++ 23 SPELL_AFTER_ATTACK 100 72 0 //dendroid guards cast bind ++ 24 SPELL_AFTER_ATTACK 20 62 0 //unicorns cast blind with 20% probability + 24 SPELL_RESISTANCE_AURA 0 55 0 //unicorn -+ 25 SPELL_AFTER_ATTACK 62 0 20 //war unicorns cast blind with 20% probability ++ 25 SPELL_AFTER_ATTACK 20 62 0 //war unicorns cast blind with 20% probability + 25 SPELL_RESISTANCE_AURA 20 55 0 //war unicorn + 26 LEVEL_SPELL_IMMUNITY 3 0 0 //green dragon's spell immunity + 26 TWO_HEX_ATTACK_BREATH 0 0 0 //green dragon's breath diff --git a/config/sp_sounds.txt b/config/sp_sounds.txt index 337f389d3..4cb6569ca 100644 --- a/config/sp_sounds.txt +++ b/config/sp_sounds.txt @@ -36,22 +36,30 @@ 55 SLAYER.wav # slayer 56 FRENZY.wav # frenzy 61 FORGET.wav # forgetfulness +70 PARALYZE.wav # stone gaze - not sure +71 POISON.wav # poison +72 BIND.wav # bind +73 DISEASE.wav # +74 PARALYZE.wav # +75 AGE.wav # aging - already used (?) +76 DEATHCLD.wav # death cloud +77 LIGHTBLT.wav # thunder +78 DISPELL.wav # dispell helpful spells 79 DEATHSTR.wav # Death Stare +80 ACID.wav # Acid breath / defence piercing #BLIND.wav -#POISON.wav #CURE.wav #HYPNOTIZ.wav -#DEATHCLD.wav #DEATHBLO.wav #DRAINLIF.wav #DRGNSLAY.wav #DISGUISE.wav -#DISEASE.wav #QUIKSAND.wav #FIRESHIE.wav fireshield when cast #FIRESHLD.wav fireshield effect #ANIMDEAD.wav #ANTIMAGK.wav +