1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
AlexVinS 2017-07-16 01:53:13 +03:00
parent f1a4831813
commit 21c0c95049
2 changed files with 13 additions and 13 deletions

View File

@ -154,6 +154,14 @@ void SpellCastContext::setDamageToDisplay(const si32 value)
damageToDisplay = value;
}
void SpellCastContext::addCustomEffect(const CStack * target, ui32 effect)
{
BattleSpellCast::CustomEffect customEffect;
customEffect.effect = effect;
customEffect.stack = target->ID;
sc.customEffects.push_back(customEffect);
}
void SpellCastContext::prepareBattleLog()
{
bool displayDamage = true;
@ -806,12 +814,7 @@ void DefaultSpellMechanics::handleMagicMirror(const SpellCastEnvironment * env,
});
for(auto s : reflected)
{
BattleSpellCast::CustomEffect effect;
effect.effect = 3;
effect.stack = s->ID;
ctx.sc.customEffects.push_back(effect);
}
ctx.addCustomEffect(s, 3);
}
}
@ -839,12 +842,7 @@ void DefaultSpellMechanics::handleResistance(const SpellCastEnvironment * env, S
});
for(auto s : resisted)
{
BattleSpellCast::CustomEffect effect;
effect.effect = 78;
effect.stack = s->ID;
ctx.sc.customEffects.push_back(effect);
}
ctx.addCustomEffect(s, 78);
}
}

View File

@ -21,7 +21,6 @@ public:
const DefaultSpellMechanics * mechanics;
const SpellCastEnvironment * env;
std::vector<const CStack *> attackedCres;//must be vector, as in Chain Lightning order matters
BattleSpellCast sc;//todo: make private
StacksInjured si;
const BattleSpellCastParameters & parameters;
@ -31,9 +30,12 @@ public:
void addDamageToDisplay(const si32 value);
void setDamageToDisplay(const si32 value);
void addCustomEffect(const CStack * target, ui32 effect);
void beforeCast();
void afterCast();
private:
BattleSpellCast sc;
const CGHeroInstance * otherHero;
int spellCost;
si32 damageToDisplay;