2015-02-02 10:40:06 +02:00
|
|
|
/*
|
|
|
|
* AdventureSpellMechanics.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
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
#include "ISpellMechanics.h"
|
2015-02-26 19:59:18 +02:00
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
enum class ESpellCastResult
|
|
|
|
{
|
|
|
|
OK,
|
|
|
|
CANCEL,//cast failed but it is not an error
|
|
|
|
ERROR//internal error occurred
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE AdventureSpellMechanics: public IAdventureSpellMechanics
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AdventureSpellMechanics(CSpell * s): IAdventureSpellMechanics(s){};
|
|
|
|
|
|
|
|
bool adventureCast(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override final;
|
|
|
|
protected:
|
|
|
|
///actual adventure cast implementation
|
|
|
|
virtual ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const;
|
|
|
|
};
|
2015-03-09 20:24:45 +02:00
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
class DLL_LINKAGE SummonBoatMechanics : public AdventureSpellMechanics
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
|
|
|
public:
|
2016-09-04 07:19:28 +02:00
|
|
|
SummonBoatMechanics(CSpell * s): AdventureSpellMechanics(s){};
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
2015-04-13 05:12:23 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
|
2015-02-02 11:22:19 +02:00
|
|
|
};
|
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
class DLL_LINKAGE ScuttleBoatMechanics : public AdventureSpellMechanics
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
|
|
|
public:
|
2016-09-04 07:19:28 +02:00
|
|
|
ScuttleBoatMechanics(CSpell * s): AdventureSpellMechanics(s){};
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
2015-04-13 05:12:23 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
|
2015-02-02 11:22:19 +02:00
|
|
|
};
|
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
class DLL_LINKAGE DimensionDoorMechanics : public AdventureSpellMechanics
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2015-02-26 19:59:18 +02:00
|
|
|
public:
|
2016-09-04 07:19:28 +02:00
|
|
|
DimensionDoorMechanics(CSpell * s): AdventureSpellMechanics(s){};
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
2015-04-13 05:12:23 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
|
2015-02-02 11:22:19 +02:00
|
|
|
};
|
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
class DLL_LINKAGE TownPortalMechanics : public AdventureSpellMechanics
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2015-02-26 19:59:18 +02:00
|
|
|
public:
|
2016-09-04 07:19:28 +02:00
|
|
|
TownPortalMechanics(CSpell * s): AdventureSpellMechanics(s){};
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
2015-04-13 05:12:23 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
|
2015-02-02 11:22:19 +02:00
|
|
|
};
|
2015-02-02 14:02:27 +02:00
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
class DLL_LINKAGE ViewMechanics : public AdventureSpellMechanics
|
2015-02-02 14:02:27 +02:00
|
|
|
{
|
2015-02-26 19:59:18 +02:00
|
|
|
public:
|
2016-09-04 07:19:28 +02:00
|
|
|
ViewMechanics(CSpell * s): AdventureSpellMechanics(s){};
|
2015-02-02 14:02:27 +02:00
|
|
|
protected:
|
2015-04-13 05:12:23 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
|
2015-02-26 16:15:17 +02:00
|
|
|
virtual bool filterObject(const CGObjectInstance * obj, const int spellLevel) const = 0;
|
2015-02-02 14:02:27 +02:00
|
|
|
};
|
|
|
|
|
2015-03-09 20:24:45 +02:00
|
|
|
class DLL_LINKAGE ViewAirMechanics : public ViewMechanics
|
2015-02-02 14:02:27 +02:00
|
|
|
{
|
2015-02-26 19:59:18 +02:00
|
|
|
public:
|
|
|
|
ViewAirMechanics(CSpell * s): ViewMechanics(s){};
|
2015-02-02 14:02:27 +02:00
|
|
|
protected:
|
2015-02-26 16:15:17 +02:00
|
|
|
bool filterObject(const CGObjectInstance * obj, const int spellLevel) const override;
|
|
|
|
};
|
|
|
|
|
2015-03-09 20:24:45 +02:00
|
|
|
class DLL_LINKAGE ViewEarthMechanics : public ViewMechanics
|
2015-02-26 16:15:17 +02:00
|
|
|
{
|
2015-02-26 19:59:18 +02:00
|
|
|
public:
|
|
|
|
ViewEarthMechanics(CSpell * s): ViewMechanics(s){};
|
2015-02-26 16:15:17 +02:00
|
|
|
protected:
|
2015-02-26 19:59:18 +02:00
|
|
|
bool filterObject(const CGObjectInstance * obj, const int spellLevel) const override;
|
2015-02-02 14:02:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|