From 0dc5a13596659bab91c91bb02dea4dd3d3f28759 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Tue, 23 Apr 2013 09:54:57 +0000 Subject: [PATCH] Fixed missing spell effects, root cause of #1257. --- config/spell_info.json | 34 +++++++++++++++++++++++----------- lib/CSpellHandler.cpp | 5 +++++ lib/CSpellHandler.h | 2 +- server/CGameHandler.cpp | 3 ++- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/config/spell_info.json b/config/spell_info.json index 90f54b82a..367899ff1 100644 --- a/config/spell_info.json +++ b/config/spell_info.json @@ -453,7 +453,8 @@ "type": "ALWAYS_MAXIMUM_DAMAGE", "subtype": -1, //any attack "valType":"INDEPENDENT_MAX", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[0, 0, 1, 1] } ], "immunity":["UNDEAD"] @@ -472,6 +473,7 @@ "subtype": -1, //any attack "valType": "INDEPENDENT_MAX", "duration": "N_TURNS", + "values":[0, 0, 1, 1], "ainfos":[0,0,20,20] } ], @@ -490,7 +492,8 @@ "type": "PRIMARY_SKILL", "subtype": "primSkill.attack", "effectRange" : "ONLY_MELEE_FIGHT", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[3, 3, 6, 6] } ] }, @@ -506,7 +509,8 @@ "type": "PRIMARY_SKILL", "subtype": "primSkill.attack", "effectRange" : "ONLY_DISTANCE_FIGHT", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[3, 3, 6, 6] } ], "limit":["SHOOTER"] @@ -539,7 +543,8 @@ { "type": "PRIMARY_SKILL", "subtype": "primSkill.defence", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[3, 3, 6, 6] } ] }, @@ -571,16 +576,19 @@ { "type": "PRIMARY_SKILL", "subtype": "primSkill.attack", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[2, 2, 4, 4] }, { "type": "PRIMARY_SKILL", "subtype": "primSkill.defence", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[2, 2, 4, 4] }, { "type": "STACKS_SPEED", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[2, 2, 4, 4] } ] }, @@ -628,7 +636,8 @@ [ { "type": "LUCK", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[1, 1, 2, 2] } ] }, @@ -659,7 +668,8 @@ [ { "type": "STACKS_SPEED", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[3, 3, 5, 5] } ], "immunity":["SIEGE_WEAPON"] @@ -710,7 +720,8 @@ [ { "type": "IN_FRENZY", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[100, 100, 150, 200] } ] }, @@ -732,7 +743,8 @@ [ { "type": "ADDITIONAL_RETALIATION", - "duration": "N_TURNS" + "duration": "N_TURNS", + "values":[1, 1, 2, 2] } ] }, diff --git a/lib/CSpellHandler.cpp b/lib/CSpellHandler.cpp index 958a66154..faf71c031 100644 --- a/lib/CSpellHandler.cpp +++ b/lib/CSpellHandler.cpp @@ -253,6 +253,11 @@ void CSpell::getEffects(std::vector& lst, const int level) const logGlobal->errorStream() << __FUNCTION__ << " invalid school level " << level; return; } + if (effects.empty()) + { + logGlobal->errorStream() << __FUNCTION__ << " This spell has no bonus effects! " << name; + return; + } lst.reserve(lst.size() + effects[level].size()); BOOST_FOREACH (Bonus *b, effects[level]) diff --git a/lib/CSpellHandler.h b/lib/CSpellHandler.h index 8d5e639de..536a14562 100644 --- a/lib/CSpellHandler.h +++ b/lib/CSpellHandler.h @@ -150,7 +150,7 @@ bool CSpell::isOffensiveSpell() const bool CSpell::hasEffects() const { - return !effects[0].empty(); + return effects.size(); } const std::string& CSpell::getIconImmune() const diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 506d4e3bd..387382990 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -4517,7 +4517,8 @@ void CGameHandler::stackTurnTrigger(const CStack * st) pseudoBonus.val = ((val > 3) ? (val - 3) : val); pseudoBonus.turnsRemain = 50; st->stackEffectToFeature (sse.effect, pseudoBonus); - sendAndApply (&sse); + if (sse.effect.size()) + sendAndApply (&sse); } } }