LocationEffect.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * LocationEffect.cpp, 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. #include "StdInc.h"
  11. #include "LocationEffect.h"
  12. #include "../ISpellMechanics.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. namespace spells
  15. {
  16. namespace effects
  17. {
  18. void LocationEffect::adjustTargetTypes(std::vector<TargetType> & types) const
  19. {
  20. }
  21. void LocationEffect::adjustAffectedHexes(std::set<BattleHex> & hexes, const Mechanics * m, const Target & spellTarget) const
  22. {
  23. for(const auto & destnation : spellTarget)
  24. hexes.insert(destnation.hexValue);
  25. }
  26. EffectTarget LocationEffect::filterTarget(const Mechanics * m, const EffectTarget & target) const
  27. {
  28. EffectTarget res;
  29. vstd::copy_if(target, std::back_inserter(res), [](const Destination & d)
  30. {
  31. return !d.unitValue && (d.hexValue.isValid());
  32. });
  33. return res;
  34. }
  35. EffectTarget LocationEffect::transformTarget(const Mechanics * m, const Target & aimPoint, const Target & spellTarget) const
  36. {
  37. //by default effect covers exactly spell range
  38. return EffectTarget(spellTarget);
  39. }
  40. }
  41. }
  42. VCMI_LIB_NAMESPACE_END