BattleFlowProcessor.h 1.6 KB

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