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"
|
2019-10-29 10:19:25 +00:00
|
|
|
#include "../TurnChoices/BaseTurnChoice.hpp"
|
2019-10-31 11:02:23 +00:00
|
|
|
#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;
|
2019-10-31 11:02:23 +00:00
|
|
|
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;
|
2019-10-31 11:02:23 +00:00
|
|
|
|
|
|
|
ChoiceQueue* _currentTurnQueue = nullptr;
|
2019-10-17 12:33:25 +00:00
|
|
|
public:
|
|
|
|
const BattleLibrary* GetLibrary() const;
|
2019-10-29 10:19:25 +00:00
|
|
|
|
2019-11-02 12:57:43 +00:00
|
|
|
virtual bool CanUse(const BaseTurnChoice* choice);
|
2019-10-29 10:19:25 +00:00
|
|
|
virtual bool TrySetChoice(BaseTurnChoice* choice);
|
2019-10-31 11:02:23 +00:00
|
|
|
|
|
|
|
void CheckChoicesSetAndRun();
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
2019-10-17 12:33:25 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //CREATURELIB_BATTLE_HPP
|