1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
vcmi/lib/SpellMechanics.h

55 lines
1.6 KiB
C
Raw Normal View History

/*
* SpellMechanics.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "CSpellHandler.h"
#include "BattleHex.h"
class DLL_LINKAGE ISpellMechanics
{
public:
struct DLL_LINKAGE SpellTargetingContext
{
const CBattleInfoCallback * cb;
CSpell::TargetInfo ti;
ECastingMode::ECastingMode mode;
BattleHex destination;
PlayerColor casterColor;
int schoolLvl;
SpellTargetingContext(const CSpell * s, const CBattleInfoCallback * c, ECastingMode::ECastingMode m, PlayerColor cc, int lvl, BattleHex dest)
2014-11-13 13:35:58 +02:00
: cb(c), ti(s,lvl, m), mode(m), destination(dest), casterColor(cc), schoolLvl(lvl)
{};
};
public:
ISpellMechanics(CSpell * s);
virtual ~ISpellMechanics(){};
virtual std::vector<BattleHex> rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes = nullptr) const = 0;
virtual std::set<const CStack *> getAffectedStacks(SpellTargetingContext & ctx) const = 0;
virtual ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const = 0;
2014-11-25 15:16:49 +02:00
//virtual bool adventureCast(const SpellCastContext & context) const = 0;
2014-11-25 15:16:49 +02:00
virtual void battleCast(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters) const = 0;
2014-11-25 13:58:42 +02:00
static ISpellMechanics * createMechanics(CSpell * s);
2014-11-25 22:59:21 +02:00
virtual void afterCast(BattleInfo * battle, const BattleSpellCast * packet) const = 0;
protected:
CSpell * owner;
};