SpellTargetsEvaluator.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * SpellTargetsEvaluator.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 "../../lib/spells/BattleSpellMechanics.h"
  12. #include <vcmi/spells/Magic.h>
  13. class SpellTargetEvaluator
  14. {
  15. public:
  16. static std::vector<spells::Target> getViableTargets(const spells::Mechanics * spellMechanics);
  17. private:
  18. enum Compare
  19. {
  20. EQUAL,
  21. DIFFERENT,
  22. BETTER,
  23. WORSE
  24. };
  25. static std::vector<spells::Target> defaultLocationSpellHeuristics(const spells::Mechanics * spellMechanics);
  26. static std::vector<spells::Target> allTargetableCreatures(const spells::Mechanics * spellMechanics);
  27. static std::vector<spells::Target> theBestLocationCasts(const spells::Mechanics * spellMechanics);
  28. static Compare compareAffectedStacks(
  29. const spells::Mechanics * spellMechanics, const std::set<const CStack *> & newCast, const std::set<const CStack *> & oldCast);
  30. static Compare compareAffectedStacksSubset(
  31. const spells::Mechanics * spellMechanics, const std::set<const CStack *> & newSubset, const std::set<const CStack *> & oldSubset);
  32. static SpellTargetEvaluator::Compare reverse(Compare compare);
  33. static bool isCastHarmful(const spells::Mechanics * spellMechanics, const std::set<const CStack *> & affectedStacks);
  34. static bool canBeCastAt(const spells::Mechanics * spellMechanics, BattleHex hex);
  35. static void addIfCanBeCast(const spells::Mechanics * spellMechanics, BattleHex hex, std::vector<spells::Target> & targets);
  36. };