BattleFlowProcessor.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * BattleFlowProcessor.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/BattleSide.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CStack;
  14. struct BattleHex;
  15. class BattleAction;
  16. class CBattleInfoCallback;
  17. struct CObstacleInstance;
  18. namespace battle
  19. {
  20. class Unit;
  21. }
  22. VCMI_LIB_NAMESPACE_END
  23. class CGameHandler;
  24. class BattleProcessor;
  25. /// Controls flow of battles - battle startup actions and switching to next stack or next round after actions
  26. class BattleFlowProcessor : boost::noncopyable
  27. {
  28. BattleProcessor * owner;
  29. CGameHandler * gameHandler;
  30. const CStack * getNextStack(const CBattleInfoCallback & battle);
  31. bool rollGoodMorale(const CBattleInfoCallback & battle, const CStack * stack);
  32. bool tryMakeAutomaticAction(const CBattleInfoCallback & battle, const CStack * stack);
  33. void summonGuardiansHelper(const CBattleInfoCallback & battle, std::vector<BattleHex> & output, const BattleHex & targetPosition, BattleSide side, bool targetIsTwoHex);
  34. void trySummonGuardians(const CBattleInfoCallback & battle, const CStack * stack);
  35. void tryPlaceMoats(const CBattleInfoCallback & battle);
  36. void castOpeningSpells(const CBattleInfoCallback & battle);
  37. void activateNextStack(const CBattleInfoCallback & battle);
  38. void startNextRound(const CBattleInfoCallback & battle, bool isFirstRound);
  39. void stackEnchantedTrigger(const CBattleInfoCallback & battle, const CStack * stack);
  40. void removeObstacle(const CBattleInfoCallback & battle, const CObstacleInstance & obstacle);
  41. void stackTurnTrigger(const CBattleInfoCallback & battle, const CStack * stack);
  42. void setActiveStack(const CBattleInfoCallback & battle, const battle::Unit * stack);
  43. void makeStackDoNothing(const CBattleInfoCallback & battle, const CStack * next);
  44. bool makeAutomaticAction(const CBattleInfoCallback & battle, const CStack * stack, BattleAction & ba); //used when action is taken by stack without volition of player (eg. unguided catapult attack)
  45. public:
  46. explicit BattleFlowProcessor(BattleProcessor * owner, CGameHandler * newGameHandler);
  47. void onBattleStarted(const CBattleInfoCallback & battle);
  48. void onTacticsEnded(const CBattleInfoCallback & battle);
  49. void onActionMade(const CBattleInfoCallback & battle, const BattleAction & ba);
  50. };