2023-08-14 19:46:42 +03:00
/*
* BattleFlowProcessor . h , part of VCMI engine
*
* Authors : listed in file AUTHORS in main folder
*
* License : GNU General Public License v2 .0 or later
* Full text of license available in license . txt file , in main folder
*
*/
# pragma once
VCMI_LIB_NAMESPACE_BEGIN
class CStack ;
struct BattleHex ;
class BattleAction ;
struct CObstacleInstance ;
VCMI_LIB_NAMESPACE_END
class CGameHandler ;
class BattleProcessor ;
2023-08-17 14:56:24 +03:00
/// Controls flow of battles - battle startup actions and switching to next stack or next round after actions
2023-08-14 19:46:42 +03:00
class BattleFlowProcessor : boost : : noncopyable
{
BattleProcessor * owner ;
CGameHandler * gameHandler ;
const CStack * getNextStack ( ) ;
2023-08-17 00:51:50 +03:00
bool rollGoodMorale ( const CStack * stack ) ;
2023-08-14 19:46:42 +03:00
bool tryMakeAutomaticAction ( const CStack * stack ) ;
void summonGuardiansHelper ( std : : vector < BattleHex > & output , const BattleHex & targetPosition , ui8 side , bool targetIsTwoHex ) ;
2023-08-17 14:56:24 +03:00
void trySummonGuardians ( const CStack * stack ) ;
2023-08-17 19:18:14 +03:00
void tryPlaceMoats ( ) ;
2023-08-17 14:56:24 +03:00
void castOpeningSpells ( ) ;
2023-08-14 19:46:42 +03:00
void activateNextStack ( ) ;
void startNextRound ( bool isFirstRound ) ;
void stackEnchantedTrigger ( const CStack * stack ) ;
2023-08-17 14:56:24 +03:00
void removeObstacle ( const CObstacleInstance & obstacle ) ;
void stackTurnTrigger ( const CStack * stack ) ;
2023-08-17 19:18:14 +03:00
void setActiveStack ( const CStack * stack ) ;
2023-08-14 19:46:42 +03:00
void makeStackDoNothing ( const CStack * next ) ;
2023-08-17 14:56:24 +03:00
bool makeAutomaticAction ( const CStack * stack , BattleAction & ba ) ; //used when action is taken by stack without volition of player (eg. unguided catapult attack)
2023-08-14 19:46:42 +03:00
public :
2023-08-17 00:51:50 +03:00
explicit BattleFlowProcessor ( BattleProcessor * owner ) ;
2023-08-14 19:46:42 +03:00
void setGameHandler ( CGameHandler * newGameHandler ) ;
void onBattleStarted ( ) ;
void onTacticsEnded ( ) ;
2023-08-17 14:56:24 +03:00
void onActionMade ( const BattleAction & ba ) ;
2023-08-14 19:46:42 +03:00
} ;