1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fixed missing spell effects, root cause of #1257.

This commit is contained in:
DjWarmonger 2013-04-23 09:54:57 +00:00
parent e71bace8e3
commit 0dc5a13596
4 changed files with 31 additions and 13 deletions

View File

@ -453,7 +453,8 @@
"type": "ALWAYS_MAXIMUM_DAMAGE", "type": "ALWAYS_MAXIMUM_DAMAGE",
"subtype": -1, //any attack "subtype": -1, //any attack
"valType":"INDEPENDENT_MAX", "valType":"INDEPENDENT_MAX",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[0, 0, 1, 1]
} }
], ],
"immunity":["UNDEAD"] "immunity":["UNDEAD"]
@ -472,6 +473,7 @@
"subtype": -1, //any attack "subtype": -1, //any attack
"valType": "INDEPENDENT_MAX", "valType": "INDEPENDENT_MAX",
"duration": "N_TURNS", "duration": "N_TURNS",
"values":[0, 0, 1, 1],
"ainfos":[0,0,20,20] "ainfos":[0,0,20,20]
} }
], ],
@ -490,7 +492,8 @@
"type": "PRIMARY_SKILL", "type": "PRIMARY_SKILL",
"subtype": "primSkill.attack", "subtype": "primSkill.attack",
"effectRange" : "ONLY_MELEE_FIGHT", "effectRange" : "ONLY_MELEE_FIGHT",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[3, 3, 6, 6]
} }
] ]
}, },
@ -506,7 +509,8 @@
"type": "PRIMARY_SKILL", "type": "PRIMARY_SKILL",
"subtype": "primSkill.attack", "subtype": "primSkill.attack",
"effectRange" : "ONLY_DISTANCE_FIGHT", "effectRange" : "ONLY_DISTANCE_FIGHT",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[3, 3, 6, 6]
} }
], ],
"limit":["SHOOTER"] "limit":["SHOOTER"]
@ -539,7 +543,8 @@
{ {
"type": "PRIMARY_SKILL", "type": "PRIMARY_SKILL",
"subtype": "primSkill.defence", "subtype": "primSkill.defence",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[3, 3, 6, 6]
} }
] ]
}, },
@ -571,16 +576,19 @@
{ {
"type": "PRIMARY_SKILL", "type": "PRIMARY_SKILL",
"subtype": "primSkill.attack", "subtype": "primSkill.attack",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[2, 2, 4, 4]
}, },
{ {
"type": "PRIMARY_SKILL", "type": "PRIMARY_SKILL",
"subtype": "primSkill.defence", "subtype": "primSkill.defence",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[2, 2, 4, 4]
}, },
{ {
"type": "STACKS_SPEED", "type": "STACKS_SPEED",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[2, 2, 4, 4]
} }
] ]
}, },
@ -628,7 +636,8 @@
[ [
{ {
"type": "LUCK", "type": "LUCK",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[1, 1, 2, 2]
} }
] ]
}, },
@ -659,7 +668,8 @@
[ [
{ {
"type": "STACKS_SPEED", "type": "STACKS_SPEED",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[3, 3, 5, 5]
} }
], ],
"immunity":["SIEGE_WEAPON"] "immunity":["SIEGE_WEAPON"]
@ -710,7 +720,8 @@
[ [
{ {
"type": "IN_FRENZY", "type": "IN_FRENZY",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[100, 100, 150, 200]
} }
] ]
}, },
@ -732,7 +743,8 @@
[ [
{ {
"type": "ADDITIONAL_RETALIATION", "type": "ADDITIONAL_RETALIATION",
"duration": "N_TURNS" "duration": "N_TURNS",
"values":[1, 1, 2, 2]
} }
] ]
}, },

View File

@ -253,6 +253,11 @@ void CSpell::getEffects(std::vector<Bonus>& lst, const int level) const
logGlobal->errorStream() << __FUNCTION__ << " invalid school level " << level; logGlobal->errorStream() << __FUNCTION__ << " invalid school level " << level;
return; return;
} }
if (effects.empty())
{
logGlobal->errorStream() << __FUNCTION__ << " This spell has no bonus effects! " << name;
return;
}
lst.reserve(lst.size() + effects[level].size()); lst.reserve(lst.size() + effects[level].size());
BOOST_FOREACH (Bonus *b, effects[level]) BOOST_FOREACH (Bonus *b, effects[level])

View File

@ -150,7 +150,7 @@ bool CSpell::isOffensiveSpell() const
bool CSpell::hasEffects() const bool CSpell::hasEffects() const
{ {
return !effects[0].empty(); return effects.size();
} }
const std::string& CSpell::getIconImmune() const const std::string& CSpell::getIconImmune() const

View File

@ -4517,7 +4517,8 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
pseudoBonus.val = ((val > 3) ? (val - 3) : val); pseudoBonus.val = ((val > 3) ? (val - 3) : val);
pseudoBonus.turnsRemain = 50; pseudoBonus.turnsRemain = 50;
st->stackEffectToFeature (sse.effect, pseudoBonus); st->stackEffectToFeature (sse.effect, pseudoBonus);
sendAndApply (&sse); if (sse.effect.size())
sendAndApply (&sse);
} }
} }
} }