AttackPossibility.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/battle/CUnitState.h"
  12. #include "../../CCallback.h"
  13. #include "common.h"
  14. #include "StackWithBonuses.h"
  15. class AttackPossibility
  16. {
  17. public:
  18. BattleHex from; //tile from which we attack
  19. BattleHex dest; //tile which we attack
  20. BattleAttackInfo attack;
  21. std::shared_ptr<battle::CUnitState> attackerState;
  22. std::vector<std::shared_ptr<battle::CUnitState>> affectedUnits;
  23. int64_t damageDealt = 0;
  24. int64_t damageReceived = 0; //usually by counter-attack
  25. int64_t collateralDamage = 0; // friendly fire (usually by two-hex attacks)
  26. int64_t shootersBlockedDmg = 0;
  27. AttackPossibility(BattleHex from, BattleHex dest, const BattleAttackInfo & attack_);
  28. int64_t damageDiff() const;
  29. int64_t attackValue() const;
  30. static AttackPossibility evaluate(const BattleAttackInfo & attackInfo, BattleHex hex, const HypotheticBattle * state);
  31. private:
  32. static int64_t evaluateBlockedShootersDmg(const BattleAttackInfo & attackInfo, BattleHex hex, const HypotheticBattle * state);
  33. };