AdventureSpellMechanics.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * AdventureSpellMechanics.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "ISpellMechanics.h"
  12. enum class ESpellCastResult
  13. {
  14. OK,
  15. CANCEL,//cast failed but it is not an error
  16. ERROR//internal error occurred
  17. };
  18. class DLL_LINKAGE AdventureSpellMechanics: public IAdventureSpellMechanics
  19. {
  20. public:
  21. AdventureSpellMechanics(CSpell * s): IAdventureSpellMechanics(s){};
  22. bool adventureCast(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override final;
  23. protected:
  24. ///actual adventure cast implementation
  25. virtual ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const;
  26. };
  27. class DLL_LINKAGE SummonBoatMechanics : public AdventureSpellMechanics
  28. {
  29. public:
  30. SummonBoatMechanics(CSpell * s): AdventureSpellMechanics(s){};
  31. protected:
  32. ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
  33. };
  34. class DLL_LINKAGE ScuttleBoatMechanics : public AdventureSpellMechanics
  35. {
  36. public:
  37. ScuttleBoatMechanics(CSpell * s): AdventureSpellMechanics(s){};
  38. protected:
  39. ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
  40. };
  41. class DLL_LINKAGE DimensionDoorMechanics : public AdventureSpellMechanics
  42. {
  43. public:
  44. DimensionDoorMechanics(CSpell * s): AdventureSpellMechanics(s){};
  45. protected:
  46. ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
  47. };
  48. class DLL_LINKAGE TownPortalMechanics : public AdventureSpellMechanics
  49. {
  50. public:
  51. TownPortalMechanics(CSpell * s): AdventureSpellMechanics(s){};
  52. protected:
  53. ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
  54. };
  55. class DLL_LINKAGE ViewMechanics : public AdventureSpellMechanics
  56. {
  57. public:
  58. ViewMechanics(CSpell * s): AdventureSpellMechanics(s){};
  59. protected:
  60. ESpellCastResult applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const override;
  61. virtual bool filterObject(const CGObjectInstance * obj, const int spellLevel) const = 0;
  62. };
  63. class DLL_LINKAGE ViewAirMechanics : public ViewMechanics
  64. {
  65. public:
  66. ViewAirMechanics(CSpell * s): ViewMechanics(s){};
  67. protected:
  68. bool filterObject(const CGObjectInstance * obj, const int spellLevel) const override;
  69. };
  70. class DLL_LINKAGE ViewEarthMechanics : public ViewMechanics
  71. {
  72. public:
  73. ViewEarthMechanics(CSpell * s): ViewMechanics(s){};
  74. protected:
  75. bool filterObject(const CGObjectInstance * obj, const int spellLevel) const override;
  76. };