BattleFlowProcessor.h 2.3 KB

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