1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00
vcmi/lib/spells/ISpellMechanics.h

54 lines
1.8 KiB
C
Raw Normal View History

/*
2015-02-02 12:22:19 +03:00
* ISpellMechanics.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
*
*/
2015-02-26 20:59:18 +03:00
#pragma once
#include "CSpellHandler.h"
#include "../BattleHex.h"
2015-03-09 20:07:28 +01:00
#include "../BattleState.h"
#include "../NetPacks.h"
class DLL_LINKAGE ISpellMechanics
{
public:
struct DLL_LINKAGE SpellTargetingContext
{
2015-02-26 20:59:18 +03:00
const CBattleInfoCallback * cb;
CSpell::TargetInfo ti;
ECastingMode::ECastingMode mode;
BattleHex destination;
PlayerColor casterColor;
int schoolLvl;
2015-02-26 20:59:18 +03:00
SpellTargetingContext(const CSpell * s, const CBattleInfoCallback * c, ECastingMode::ECastingMode m, PlayerColor cc, int lvl, BattleHex dest)
2014-11-13 14:35:58 +03:00
: cb(c), ti(s,lvl, m), mode(m), destination(dest), casterColor(cc), schoolLvl(lvl)
{};
2015-02-26 20:59:18 +03:00
};
public:
ISpellMechanics(CSpell * s);
2015-02-26 20:59:18 +03:00
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;
2015-03-18 17:48:32 +03:00
virtual ESpellCastProblem::ESpellCastProblem canBeCasted(const CBattleInfoCallback * cb, PlayerColor player) const = 0;
virtual ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const = 0;
2015-03-09 20:07:28 +01:00
virtual void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const = 0;
2015-02-26 20:59:18 +03:00
virtual bool adventureCast(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const = 0;
virtual void battleCast(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters) const = 0;
2014-11-25 14:58:42 +03:00
static ISpellMechanics * createMechanics(CSpell * s);
protected:
2015-02-26 20:59:18 +03:00
CSpell * owner;
};