1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Few spell-related tweaks

This commit is contained in:
AlexVinS
2017-03-18 14:08:02 +03:00
parent 5da109ad30
commit 3c893a6bec
4 changed files with 17 additions and 13 deletions

View File

@@ -133,11 +133,6 @@ bool CSpell::adventureCast(const SpellCastEnvironment * env, AdventureSpellCastP
void CSpell::battleCast(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters) const
{
assert(env);
if(parameters.destinations.size()<1)
{
env->complain("Spell must have at least one destination");
return;
}
mechanics->battleCast(env, parameters);
}

View File

@@ -82,11 +82,24 @@ void BattleSpellCastParameters::aimToStack(const CStack * destination)
void BattleSpellCastParameters::cast(const SpellCastEnvironment * env)
{
if(destinations.empty())
aimToHex(BattleHex::INVALID);
spell->battleCast(env, *this);
}
void BattleSpellCastParameters::castIfPossible(const SpellCastEnvironment * env)
{
if(ESpellCastProblem::OK == cb->battleCanCastThisSpell(caster, spell, mode))
cast(env);
}
BattleHex BattleSpellCastParameters::getFirstDestinationHex() const
{
if(destinations.empty())
{
logGlobal->error("Spell have no destinations.");
return BattleHex::INVALID;
}
return destinations.at(0).hexValue;
}

View File

@@ -56,6 +56,9 @@ public:
void cast(const SpellCastEnvironment * env);
///cast with silent check for permitted cast
void castIfPossible(const SpellCastEnvironment * env);
BattleHex getFirstDestinationHex() const;
int getEffectValue() const;