Summon.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Summon.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 "Effect.h"
  12. #include "../../GameConstants.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. namespace spells
  15. {
  16. namespace effects
  17. {
  18. class Summon : public Effect
  19. {
  20. public:
  21. void adjustAffectedHexes(BattleHexArray & hexes, const Mechanics * m, const Target & spellTarget) const override;
  22. void adjustTargetTypes(std::vector<TargetType> & types) const override;
  23. bool applicable(Problem & problem, const Mechanics * m) const override;
  24. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  25. EffectTarget filterTarget(const Mechanics * m, const EffectTarget & target) const override;
  26. EffectTarget transformTarget(const Mechanics * m, const Target & aimPoint, const Target & spellTarget) const override;
  27. protected:
  28. void serializeJsonEffect(JsonSerializeFormat & handler) override final;
  29. private:
  30. int32_t summonedCreatureAmount(const Mechanics * m) const;
  31. int32_t summonedCreatureHealth(const Mechanics * m, const battle::Unit * unit) const;
  32. CreatureID creature;
  33. bool permanent = false;
  34. bool exclusive = true;
  35. bool summonByHealth = false;
  36. bool summonSameUnit = false;
  37. };
  38. }
  39. }
  40. VCMI_LIB_NAMESPACE_END