SpellMechanics.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * SpellMechanics.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 "CSpellHandler.h"
  12. class DefaultSpellMechanics: public ISpellMechanics
  13. {
  14. public:
  15. DefaultSpellMechanics(CSpell * s): ISpellMechanics(s){};
  16. std::set<const CStack *> getAffectedStacks(SpellTargetingContext & ctx) const override;
  17. ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
  18. bool adventureCast(SpellCastContext & context) const override;
  19. bool battleCast(SpellCastContext & context) const override;
  20. };
  21. class ChainLightningMechanics: public DefaultSpellMechanics
  22. {
  23. public:
  24. ChainLightningMechanics(CSpell * s): DefaultSpellMechanics(s){};
  25. };
  26. class CloneMechanics: public DefaultSpellMechanics
  27. {
  28. public:
  29. CloneMechanics(CSpell * s): DefaultSpellMechanics(s){};
  30. ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
  31. };
  32. class DispellHelpfulMechanics: public DefaultSpellMechanics
  33. {
  34. public:
  35. DispellHelpfulMechanics(CSpell * s): DefaultSpellMechanics(s){};
  36. ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
  37. };
  38. class HypnotizeMechanics: public DefaultSpellMechanics
  39. {
  40. public:
  41. HypnotizeMechanics(CSpell * s): DefaultSpellMechanics(s){};
  42. ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
  43. };
  44. ///all rising spells
  45. class RisingSpellMechanics: public DefaultSpellMechanics
  46. {
  47. public:
  48. RisingSpellMechanics(CSpell * s): DefaultSpellMechanics(s){};
  49. };
  50. ///all rising spells but SACRIFICE
  51. class SpecialRisingSpellMechanics: public RisingSpellMechanics
  52. {
  53. public:
  54. SpecialRisingSpellMechanics(CSpell * s): RisingSpellMechanics(s){};
  55. ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const override;
  56. };
  57. class SacrificeMechanics: public RisingSpellMechanics
  58. {
  59. public:
  60. SacrificeMechanics(CSpell * s): RisingSpellMechanics(s){};
  61. };