AttackPossibility.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * AttackPossibility.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/BattleState.h"
  12. #include "../../CCallback.h"
  13. #include "common.h"
  14. struct HypotheticChangesToBattleState
  15. {
  16. std::map<const CStack *, const IBonusBearer *> bonusesOfStacks;
  17. std::map<const CStack *, int> counterAttacksLeft;
  18. };
  19. class Priorities
  20. {
  21. public:
  22. std::vector<double> resourceTypeBaseValues;
  23. std::function<double(const CStack *)> stackEvaluator;
  24. Priorities()
  25. {
  26. // range::copy(VLC->objh->resVals, std::back_inserter(resourceTypeBaseValues));
  27. stackEvaluator = [](const CStack*){ return 1.0; };
  28. }
  29. };
  30. class AttackPossibility
  31. {
  32. public:
  33. const CStack *enemy; //redundant (to attack.defender) but looks nice
  34. BattleHex tile; //tile from which we attack
  35. BattleAttackInfo attack;
  36. int damageDealt;
  37. int damageReceived; //usually by counter-attack
  38. int tacticImpact;
  39. int damageDiff() const;
  40. int attackValue() const;
  41. static AttackPossibility evaluate(const BattleAttackInfo &AttackInfo, const HypotheticChangesToBattleState &state, BattleHex hex);
  42. static Priorities * priorities;
  43. };