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
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2017-06-06 06:53:51 +02:00
|
|
|
class CGTownInstance;
|
|
|
|
|
2016-09-04 07:19:28 +02:00
|
|
|
enum class ESpellCastResult
|
|
|
|
{
|
|
|
|
OK,
|
|
|
|
CANCEL,//cast failed but it is not an error
|
2017-07-03 20:09:27 +02:00
|
|
|
PENDING,
|
2016-09-04 07:19:28 +02:00
|
|
|
ERROR//internal error occurred
|
|
|
|
};
|
|
|
|
|
2017-06-06 06:53:51 +02:00
|
|
|
class DLL_LINKAGE AdventureSpellMechanics : public IAdventureSpellMechanics
|
2016-09-04 07:19:28 +02:00
|
|
|
{
|
|
|
|
public:
|
2017-06-06 06:53:51 +02:00
|
|
|
AdventureSpellMechanics(const CSpell * s);
|
2016-09-04 07:19:28 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
bool adventureCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const override final;
|
2016-09-04 07:19:28 +02:00
|
|
|
protected:
|
|
|
|
///actual adventure cast implementation
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
virtual ESpellCastResult applyAdventureEffects(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
|
|
|
|
virtual ESpellCastResult beginCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
|
|
|
|
void performCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
|
|
|
|
void endCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters, const ESpellCastResult result) const;
|
2016-09-04 07:19:28 +02:00
|
|
|
};
|
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:
|
2017-06-06 06:53:51 +02:00
|
|
|
SummonBoatMechanics(const CSpell * s);
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(SpellCastEnvironment * env, const 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:
|
2017-06-06 06:53:51 +02:00
|
|
|
ScuttleBoatMechanics(const CSpell * s);
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(SpellCastEnvironment * env, const 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:
|
2017-06-06 06:53:51 +02:00
|
|
|
DimensionDoorMechanics(const CSpell * s);
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(SpellCastEnvironment * env, const 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:
|
2017-06-06 06:53:51 +02:00
|
|
|
TownPortalMechanics(const CSpell * s);
|
2015-02-02 11:22:19 +02:00
|
|
|
protected:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const override;
|
|
|
|
ESpellCastResult beginCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const override;
|
2017-06-06 06:53:51 +02:00
|
|
|
private:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
const CGTownInstance * findNearestTown(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters, const std::vector <const CGTownInstance*> & pool) const;
|
|
|
|
int32_t movementCost(const AdventureSpellCastParameters & parameters) const;
|
|
|
|
std::vector <const CGTownInstance*> getPossibleTowns(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
|
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:
|
2017-06-06 06:53:51 +02:00
|
|
|
ViewMechanics(const CSpell * s);
|
2015-02-02 14:02:27 +02:00
|
|
|
protected:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
ESpellCastResult applyAdventureEffects(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const override;
|
|
|
|
virtual bool filterObject(const CGObjectInstance * obj, const int32_t 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:
|
2017-06-06 06:53:51 +02:00
|
|
|
ViewAirMechanics(const CSpell * s);
|
2015-02-02 14:02:27 +02:00
|
|
|
protected:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
bool filterObject(const CGObjectInstance * obj, const int32_t spellLevel) const override;
|
2015-02-26 16:15:17 +02:00
|
|
|
};
|
|
|
|
|
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:
|
2017-06-06 06:53:51 +02:00
|
|
|
ViewEarthMechanics(const CSpell * s);
|
2015-02-26 16:15:17 +02:00
|
|
|
protected:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
bool filterObject(const CGObjectInstance * obj, const int32_t spellLevel) const override;
|
2015-02-02 14:02:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|