CreatureLib/src/Battling/Models/Battle.hpp

48 lines
1.3 KiB
C++
Raw Normal View History

2019-10-17 12:33:25 +00:00
#ifndef CREATURELIB_BATTLE_HPP
#define CREATURELIB_BATTLE_HPP
#include <vector>
#include "BattleSide.hpp"
#include "../Library/BattleLibrary.hpp"
#include "../TurnChoices/BaseTurnChoice.hpp"
#include "../Flow/ChoiceQueue.hpp"
2019-11-02 12:57:43 +00:00
#include "Target.hpp"
2019-10-17 12:33:25 +00:00
namespace CreatureLib::Battling {
class Battle {
const BattleLibrary* _library;
uint8_t _numberOfSides;
uint8_t _creaturesPerSide;
2019-10-17 12:33:25 +00:00
std::vector<BattleSide*> _sides;
2019-10-31 11:31:31 +00:00
Core::Random _random;
ChoiceQueue* _currentTurnQueue = nullptr;
uint8_t _numberOfRecalledSlots = 0;
2019-10-17 12:33:25 +00:00
public:
[[nodiscard]] const BattleLibrary* GetLibrary() const;
2019-11-02 12:57:43 +00:00
virtual bool CanUse(const BaseTurnChoice* choice);
virtual bool TrySetChoice(BaseTurnChoice* choice);
void CheckChoicesSetAndRun();
[[nodiscard]] ChoiceQueue* GetCurrentTurnQueue() const;
2019-10-31 11:31:31 +00:00
Core::Random& GetRandom();
2019-11-02 12:57:43 +00:00
bool CreatureInField(const Creature* creature) const;
Creature* GetTarget(const Target& 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);
2019-10-17 12:33:25 +00:00
};
}
#endif //CREATURELIB_BATTLE_HPP