Files
CreatureLib/src/Battling/Models/Battle.hpp

51 lines
1.4 KiB
C++

#ifndef CREATURELIB_BATTLE_HPP
#define CREATURELIB_BATTLE_HPP
#include <vector>
#include "../Flow/ChoiceQueue.hpp"
#include "../Library/BattleLibrary.hpp"
#include "../TurnChoices/BaseTurnChoice.hpp"
#include "BattleSide.hpp"
#include "CreatureIndex.hpp"
namespace CreatureLib::Battling {
class Battle : public ScriptSource {
const BattleLibrary* _library;
uint8_t _numberOfSides;
uint8_t _creaturesPerSide;
std::vector<BattleSide*> _sides;
Core::Random _random;
ChoiceQueue* _currentTurnQueue = nullptr;
uint8_t _numberOfRecalledSlots = 0;
ScriptSet _volatile;
public:
[[nodiscard]] const BattleLibrary* GetLibrary() const;
virtual bool CanUse(const BaseTurnChoice* choice);
virtual bool TrySetChoice(BaseTurnChoice* choice);
void CheckChoicesSetAndRun();
[[nodiscard]] ChoiceQueue* GetCurrentTurnQueue() const;
Core::Random& GetRandom();
bool CreatureInField(const Creature* creature) const;
Creature* GetTarget(const CreatureIndex& target) {
return _sides[target.GetSideIndex()]->GetCreature(target.GetCreatureIndex());
}
[[nodiscard]] bool HasRecalledSlots() const;
void ForceRecall(uint8_t side, uint8_t index);
void FillRecall(uint8_t side, uint8_t, Creature* c);
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override;
};
}
#endif // CREATURELIB_BATTLE_HPP