mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-14 10:12:59 +02:00
64 lines
2.3 KiB
C++
64 lines
2.3 KiB
C++
/*
|
|
* CBattleActionsController.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
|
|
|
|
#include "../../lib/battle/CBattleInfoCallback.h"
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
class BattleAction;
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
class BattleInterface;
|
|
|
|
enum class MouseHoveredHexContext
|
|
{
|
|
UNOCCUPIED_HEX,
|
|
OCCUPIED_HEX
|
|
};
|
|
|
|
class BattleActionsController
|
|
{
|
|
BattleInterface * owner;
|
|
|
|
std::vector<PossiblePlayerBattleAction> possibleActions; //all actions possible to call at the moment by player
|
|
std::vector<PossiblePlayerBattleAction> localActions; //actions possible to take on hovered hex
|
|
std::vector<PossiblePlayerBattleAction> illegalActions; //these actions display message in case of illegal target
|
|
PossiblePlayerBattleAction currentAction; //action that will be performed on l-click
|
|
PossiblePlayerBattleAction selectedAction; //last action chosen (and saved) by player
|
|
PossiblePlayerBattleAction illegalAction; //most likely action that can't be performed here
|
|
|
|
bool creatureCasting; //if true, stack currently aims to cats a spell
|
|
bool spellDestSelectMode; //if true, player is choosing destination for his spell - only for GUI / console
|
|
std::shared_ptr<BattleAction> spellToCast; //spell for which player is choosing destination
|
|
const CSpell *currentSpell; //spell pointer for convenience
|
|
|
|
bool isCastingPossibleHere (const CStack *sactive, const CStack *shere, BattleHex myNumber);
|
|
bool canStackMoveHere (const CStack *sactive, BattleHex MyNumber); //TODO: move to BattleState / callback
|
|
|
|
std::vector<PossiblePlayerBattleAction> getPossibleActionsForStack (const CStack *stack); //called when stack gets its turn
|
|
void reorderPossibleActionsPriority(const CStack * stack, MouseHoveredHexContext context);
|
|
|
|
std::string currentConsoleMsg;
|
|
public:
|
|
BattleActionsController(BattleInterface * owner);
|
|
|
|
void activateStack();
|
|
void endCastingSpell(); //ends casting spell (eg. when spell has been cast or canceled)
|
|
void enterCreatureCastingMode();
|
|
|
|
SpellID selectedSpell();
|
|
bool spellcastingModeActive();
|
|
void castThisSpell(SpellID spellID); //called when player has chosen a spell from spellbook
|
|
void handleHex(BattleHex myNumber, int eventType);
|
|
|
|
};
|