TownPortalEffect.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * TownPortalEffect.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 "AdventureSpellEffect.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CGTownInstance;
  14. class DLL_LINKAGE TownPortalEffect final : public IAdventureSpellEffect
  15. {
  16. const CSpell * owner;
  17. int movementPointsRequired;
  18. int movementPointsTaken;
  19. bool allowTownSelection;
  20. bool skipOccupiedTowns;
  21. public:
  22. TownPortalEffect(const CSpell * s, const JsonNode & config);
  23. int getMovementPointsRequired() const { return movementPointsRequired; }
  24. bool townSelectionAllowed() const { return allowTownSelection; }
  25. private:
  26. ESpellCastResult applyAdventureEffects(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const override;
  27. ESpellCastResult beginCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters, const AdventureSpellMechanics & mechanics) const override;
  28. void endCast(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const override;
  29. const CGTownInstance * findNearestTown(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters, const std::vector<const CGTownInstance *> & pool) const;
  30. std::vector<const CGTownInstance *> getPossibleTowns(SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const;
  31. };
  32. VCMI_LIB_NAMESPACE_END