mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
More tweaks
This commit is contained in:
parent
1ce4675df6
commit
f39e619304
@ -285,14 +285,8 @@ void DefaultSpellMechanics::battleCast(const SpellCastEnvironment * env, const B
|
||||
{
|
||||
int targetHex = (*RandomGeneratorUtil::nextItem(mirrorTargets, env->getRandomGenerator()))->position;
|
||||
|
||||
BattleSpellCastParameters mirrorParameters(parameters.cb, attackedCre, owner);
|
||||
BattleSpellCastParameters mirrorParameters(parameters, attackedCre);
|
||||
mirrorParameters.aimToHex(targetHex);
|
||||
mirrorParameters.mode = ECastingMode::MAGIC_MIRROR;
|
||||
mirrorParameters.spellLvl = parameters.spellLvl;
|
||||
mirrorParameters.effectLevel = parameters.effectLevel;
|
||||
mirrorParameters.effectPower = parameters.effectPower;
|
||||
mirrorParameters.effectValue = parameters.effectValue;
|
||||
mirrorParameters.enchantPower = parameters.enchantPower;
|
||||
mirrorParameters.cast(env);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,15 @@ BattleSpellCastParameters::BattleSpellCastParameters(const BattleInfo * cb, cons
|
||||
vstd::amax(effectValue, 0);
|
||||
}
|
||||
|
||||
BattleSpellCastParameters::BattleSpellCastParameters(const BattleSpellCastParameters & orig, const ISpellCaster * caster)
|
||||
:spell(orig.spell), cb(orig.cb), caster(caster), casterColor(caster->getOwner()), casterSide(cb->whatSide(casterColor)),
|
||||
casterHero(nullptr), mode(ECastingMode::MAGIC_MIRROR), casterStack(nullptr),
|
||||
spellLvl(orig.spellLvl), effectLevel(orig.effectLevel), effectPower(orig.effectPower), enchantPower(orig.enchantPower), effectValue(orig.effectValue)
|
||||
{
|
||||
casterStack = dynamic_cast<const CStack *>(caster);
|
||||
casterHero = dynamic_cast<const CGHeroInstance *>(caster);
|
||||
}
|
||||
|
||||
void BattleSpellCastParameters::aimToHex(const BattleHex& destination)
|
||||
{
|
||||
destinations.push_back(Destination(destination));
|
||||
|
@ -45,7 +45,12 @@ public:
|
||||
const BattleHex hexValue;
|
||||
};
|
||||
|
||||
//normal constructor
|
||||
BattleSpellCastParameters(const BattleInfo * cb, const ISpellCaster * caster, const CSpell * spell_);
|
||||
|
||||
//magic mirror constructor
|
||||
BattleSpellCastParameters(const BattleSpellCastParameters & orig, const ISpellCaster * caster);
|
||||
|
||||
void aimToHex(const BattleHex & destination);
|
||||
void aimToStack(const CStack * destination);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user