CustomSpellMechanics.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * CustomSpellMechanics.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. #include "CDefaultSpellMechanics.h"
  13. #include "effects/Effects.h"
  14. namespace spells
  15. {
  16. class CustomSpellMechanics : public DefaultSpellMechanics
  17. {
  18. public:
  19. CustomSpellMechanics(const IBattleCast * event, std::shared_ptr<effects::Effects> e);
  20. virtual ~CustomSpellMechanics();
  21. void applyEffects(const SpellCastEnvironment * env, const Target & targets) const override;
  22. void applyIndirectEffects(const SpellCastEnvironment * env, const Target & targets) const override;
  23. void applyEffectsForced(const SpellCastEnvironment * env, const Target & targets) const override;
  24. bool canBeCast(Problem & problem) const override;
  25. bool canBeCastAt(BattleHex destination) const override;
  26. void beforeCast(vstd::RNG & rng, const Target & target, std::vector <const CStack*> & reflected) override;
  27. void applyCastEffects(const SpellCastEnvironment * env, const Target & target) const override;
  28. void cast(IBattleState * battleState, vstd::RNG & rng, const Target & target) override;
  29. std::vector<const CStack *> getAffectedStacks(BattleHex destination) const override final;
  30. std::vector<AimType> getTargetTypes() const override final;
  31. std::vector<Destination> getPossibleDestinations(size_t index, AimType aimType, const Target & current) const override final;
  32. std::vector<BattleHex> rangeInHexes(BattleHex centralHex, bool * outDroppedHexes = nullptr) const override;
  33. private:
  34. effects::Effects::EffectsToApply effectsToApply;
  35. std::shared_ptr<effects::Effects> effects;
  36. std::set<const battle::Unit *> collectTargets() const;
  37. Target transformSpellTarget(const Target & aimPoint) const;
  38. };
  39. } //namespace spells