1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-06 00:24:11 +02:00
vcmi/lib/spells/BattleSpellMechanics.h

143 lines
5.0 KiB
C
Raw Normal View History

2015-02-02 10:40:06 +02:00
/*
* BattleSpellMechanics.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-02 11:22:19 +02:00
2015-02-26 19:59:18 +02:00
#pragma once
#include "CDefaultSpellMechanics.h"
2015-02-02 11:22:19 +02:00
class DLL_LINKAGE AntimagicMechanics : public DefaultSpellMechanics
{
public:
AntimagicMechanics(CSpell * s): DefaultSpellMechanics(s){};
void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override final;
};
class DLL_LINKAGE ChainLightningMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
2015-02-26 19:59:18 +02:00
ChainLightningMechanics(CSpell * s): DefaultSpellMechanics(s){};
2015-02-02 11:22:19 +02:00
std::set<const CStack *> getAffectedStacks(SpellTargetingContext & ctx) const override;
};
class DLL_LINKAGE CloneMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
CloneMechanics(CSpell * s): DefaultSpellMechanics(s){};
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
protected:
2015-02-26 19:59:18 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
2015-02-02 11:22:19 +02:00
};
class DLL_LINKAGE CureMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
2015-02-26 19:59:18 +02:00
CureMechanics(CSpell * s): DefaultSpellMechanics(s){};
2015-02-02 11:22:19 +02:00
2015-03-09 21:07:28 +02:00
void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override final;
2015-02-26 19:59:18 +02:00
};
2015-02-02 11:22:19 +02:00
class DLL_LINKAGE DispellMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
DispellMechanics(CSpell * s): DefaultSpellMechanics(s){};
2015-04-03 00:52:20 +02:00
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
2015-04-03 02:02:16 +02:00
2015-03-09 21:07:28 +02:00
void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override final;
protected:
2015-04-03 02:02:16 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
2015-02-02 11:22:19 +02:00
};
2015-03-18 12:27:07 +02:00
class DLL_LINKAGE EarthquakeMechanics : public DefaultSpellMechanics
{
public:
EarthquakeMechanics(CSpell * s): DefaultSpellMechanics(s){};
2015-04-03 02:02:16 +02:00
ESpellCastProblem::ESpellCastProblem canBeCasted(const CBattleInfoCallback * cb, PlayerColor player) const override;
2015-03-18 12:27:07 +02:00
protected:
2015-04-03 02:02:16 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
2015-03-18 12:27:07 +02:00
};
class DLL_LINKAGE HypnotizeMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
2015-02-26 19:59:18 +02:00
HypnotizeMechanics(CSpell * s): DefaultSpellMechanics(s){};
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
};
2015-02-02 11:22:19 +02:00
class DLL_LINKAGE ObstacleMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
2015-02-26 19:59:18 +02:00
ObstacleMechanics(CSpell * s): DefaultSpellMechanics(s){};
2015-02-02 11:22:19 +02:00
protected:
2015-02-26 19:59:18 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
2015-02-02 11:22:19 +02:00
};
class DLL_LINKAGE WallMechanics : public ObstacleMechanics
2015-02-02 11:22:19 +02:00
{
public:
2015-02-26 19:59:18 +02:00
WallMechanics(CSpell * s): ObstacleMechanics(s){};
std::vector<BattleHex> rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes = nullptr) const override;
2015-02-02 11:22:19 +02:00
};
class DLL_LINKAGE RemoveObstacleMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
RemoveObstacleMechanics(CSpell * s): DefaultSpellMechanics(s){};
protected:
2015-02-26 19:59:18 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
2015-02-02 11:22:19 +02:00
};
///all rising spells
class DLL_LINKAGE RisingSpellMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
2015-02-26 19:59:18 +02:00
RisingSpellMechanics(CSpell * s): DefaultSpellMechanics(s){};
2015-02-02 11:22:19 +02:00
};
class DLL_LINKAGE SacrificeMechanics : public RisingSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
2015-02-26 19:59:18 +02:00
SacrificeMechanics(CSpell * s): RisingSpellMechanics(s){};
ESpellCastProblem::ESpellCastProblem canBeCasted(const CBattleInfoCallback * cb, PlayerColor player) const override;
2015-02-02 11:22:19 +02:00
protected:
2015-02-26 19:59:18 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
2015-02-02 11:22:19 +02:00
};
///all rising spells but SACRIFICE
class DLL_LINKAGE SpecialRisingSpellMechanics : public RisingSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
SpecialRisingSpellMechanics(CSpell * s): RisingSpellMechanics(s){};
2015-02-26 19:59:18 +02:00
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
2015-02-02 11:22:19 +02:00
};
class DLL_LINKAGE SummonMechanics : public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
SummonMechanics(CSpell * s, CreatureID cre): DefaultSpellMechanics(s), creatureToSummon(cre){};
2015-04-03 02:02:16 +02:00
ESpellCastProblem::ESpellCastProblem canBeCasted(const CBattleInfoCallback * cb, PlayerColor player) const override;
2015-02-02 11:22:19 +02:00
protected:
2015-02-26 19:59:18 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
private:
CreatureID creatureToSummon;
2015-02-02 11:22:19 +02:00
};
class DLL_LINKAGE TeleportMechanics: public DefaultSpellMechanics
2015-02-02 11:22:19 +02:00
{
public:
TeleportMechanics(CSpell * s): DefaultSpellMechanics(s){};
protected:
2015-02-26 19:59:18 +02:00
void applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override;
2015-02-02 11:22:19 +02:00
};