1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
vcmi/server/battles/BattleFlowProcessor.h
2023-08-21 17:55:49 +03:00

56 lines
1.6 KiB
C++

/*
* 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;
/// Controls flow of battles - battle startup actions and switching to next stack or next round after actions
class BattleFlowProcessor : boost::noncopyable
{
BattleProcessor * owner;
CGameHandler * gameHandler;
const CStack * getNextStack();
bool rollGoodMorale(const CStack * stack);
bool tryMakeAutomaticAction(const CStack * stack);
void summonGuardiansHelper(std::vector<BattleHex> & output, const BattleHex & targetPosition, ui8 side, bool targetIsTwoHex);
void trySummonGuardians(const CStack * stack);
void tryPlaceMoats();
void castOpeningSpells();
void activateNextStack();
void startNextRound(bool isFirstRound);
void stackEnchantedTrigger(const CStack * stack);
void removeObstacle(const CObstacleInstance & obstacle);
void stackTurnTrigger(const CStack * stack);
void setActiveStack(const CStack * stack);
void makeStackDoNothing(const CStack * next);
bool makeAutomaticAction(const CStack * stack, BattleAction & ba); //used when action is taken by stack without volition of player (eg. unguided catapult attack)
public:
explicit BattleFlowProcessor(BattleProcessor * owner);
void setGameHandler(CGameHandler * newGameHandler);
void onBattleStarted();
void onTacticsEnded();
void onActionMade(const BattleAction & ba);
};