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; 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() void SpellCastContext::prepareBattleLog()
{ {
bool displayDamage = true; bool displayDamage = true;
@ -806,12 +814,7 @@ void DefaultSpellMechanics::handleMagicMirror(const SpellCastEnvironment * env,
}); });
for(auto s : reflected) for(auto s : reflected)
{ ctx.addCustomEffect(s, 3);
BattleSpellCast::CustomEffect effect;
effect.effect = 3;
effect.stack = s->ID;
ctx.sc.customEffects.push_back(effect);
}
} }
} }
@ -839,12 +842,7 @@ void DefaultSpellMechanics::handleResistance(const SpellCastEnvironment * env, S
}); });
for(auto s : resisted) for(auto s : resisted)
{ ctx.addCustomEffect(s, 78);
BattleSpellCast::CustomEffect effect;
effect.effect = 78;
effect.stack = s->ID;
ctx.sc.customEffects.push_back(effect);
}
} }
} }

View File

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