mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
ENCHANTER_CASTING trigger tweak
This commit is contained in:
parent
66cfc2fef9
commit
1d1519db5c
@ -87,10 +87,14 @@ void BattleSpellCastParameters::cast(const SpellCastEnvironment * env)
|
|||||||
spell->battleCast(env, *this);
|
spell->battleCast(env, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleSpellCastParameters::castIfPossible(const SpellCastEnvironment * env)
|
bool BattleSpellCastParameters::castIfPossible(const SpellCastEnvironment * env)
|
||||||
{
|
{
|
||||||
if(ESpellCastProblem::OK == cb->battleCanCastThisSpell(caster, spell, mode))
|
if(ESpellCastProblem::OK == cb->battleCanCastThisSpell(caster, spell, mode))
|
||||||
|
{
|
||||||
cast(env);
|
cast(env);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleHex BattleSpellCastParameters::getFirstDestinationHex() const
|
BattleHex BattleSpellCastParameters::getFirstDestinationHex() const
|
||||||
|
@ -57,7 +57,8 @@ public:
|
|||||||
void cast(const SpellCastEnvironment * env);
|
void cast(const SpellCastEnvironment * env);
|
||||||
|
|
||||||
///cast with silent check for permitted cast
|
///cast with silent check for permitted cast
|
||||||
void castIfPossible(const SpellCastEnvironment * env);
|
///returns true if cast was permitted
|
||||||
|
bool castIfPossible(const SpellCastEnvironment * env);
|
||||||
|
|
||||||
BattleHex getFirstDestinationHex() const;
|
BattleHex getFirstDestinationHex() const;
|
||||||
|
|
||||||
|
@ -4631,14 +4631,14 @@ void CGameHandler::stackTurnTrigger(const CStack *st)
|
|||||||
const CSpell * spell = SpellID(spellID).toSpell();
|
const CSpell * spell = SpellID(spellID).toSpell();
|
||||||
bl.remove_if([&bonus](const Bonus* b){return b==bonus.get();});
|
bl.remove_if([&bonus](const Bonus* b){return b==bonus.get();});
|
||||||
|
|
||||||
if (gs->curB->battleCanCastThisSpell(st, spell, ECastingMode::ENCHANTER_CASTING) == ESpellCastProblem::OK)
|
BattleSpellCastParameters parameters(gs->curB, st, spell);
|
||||||
{
|
parameters.spellLvl = bonus->val;
|
||||||
BattleSpellCastParameters parameters(gs->curB, st, spell);
|
parameters.effectLevel = bonus->val;//todo: recheck
|
||||||
parameters.spellLvl = bonus->val;
|
parameters.mode = ECastingMode::ENCHANTER_CASTING;
|
||||||
parameters.effectLevel = bonus->val;//todo: recheck
|
|
||||||
parameters.mode = ECastingMode::ENCHANTER_CASTING;
|
|
||||||
parameters.cast(spellEnv);
|
|
||||||
|
|
||||||
|
cast = parameters.castIfPossible(spellEnv);
|
||||||
|
if(cast)
|
||||||
|
{
|
||||||
//todo: move to mechanics
|
//todo: move to mechanics
|
||||||
BattleSetStackProperty ssp;
|
BattleSetStackProperty ssp;
|
||||||
ssp.which = BattleSetStackProperty::ENCHANTER_COUNTER;
|
ssp.which = BattleSetStackProperty::ENCHANTER_COUNTER;
|
||||||
@ -4646,8 +4646,6 @@ void CGameHandler::stackTurnTrigger(const CStack *st)
|
|||||||
ssp.val = bonus->additionalInfo; //increase cooldown counter
|
ssp.val = bonus->additionalInfo; //increase cooldown counter
|
||||||
ssp.stackID = st->ID;
|
ssp.stackID = st->ID;
|
||||||
sendAndApply(&ssp);
|
sendAndApply(&ssp);
|
||||||
|
|
||||||
cast = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user