50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
#ifndef CREATURELIB_BATTLESIDE_HPP
|
|
#define CREATURELIB_BATTLESIDE_HPP
|
|
|
|
#include <vector>
|
|
#include "../TurnChoices/BaseTurnChoice.hpp"
|
|
#include "Creature.hpp"
|
|
|
|
namespace CreatureLib::Battling {
|
|
class BattleSide : public ScriptSource {
|
|
uint8_t _index;
|
|
uint8_t _creaturesPerSide;
|
|
std::vector<Creature*> _creatures;
|
|
std::vector<BaseTurnChoice*> _choices;
|
|
uint8_t _choicesSet = 0;
|
|
ScriptSet _volatile;
|
|
Battle* _battle;
|
|
|
|
public:
|
|
explicit BattleSide(uint8_t index, Battle* battle, uint8_t creaturesPerSide)
|
|
: _index(index), _creaturesPerSide(creaturesPerSide), _battle(battle) {
|
|
_creatures = std::vector<Creature*>(creaturesPerSide);
|
|
_choices = std::vector<BaseTurnChoice*>(creaturesPerSide);
|
|
for (size_t i = 0; i < creaturesPerSide; i++) {
|
|
_creatures[i] = nullptr;
|
|
_choices[i] = nullptr;
|
|
}
|
|
ResetChoices();
|
|
}
|
|
|
|
virtual ~BattleSide() = default;
|
|
|
|
[[nodiscard]] bool AllChoicesSet() const;
|
|
[[nodiscard]] const std::vector<BaseTurnChoice*>& GetChoices() const;
|
|
|
|
[[nodiscard]] bool AllPossibleSlotsFilled() const;
|
|
|
|
void SetChoice(BaseTurnChoice* choice);
|
|
void ResetChoices();
|
|
|
|
void SetCreature(Creature* creature, uint8_t index);
|
|
|
|
Creature* GetCreature(uint8_t index) const;
|
|
bool CreatureOnSide(const Creature* creature) const;
|
|
|
|
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) final;
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_BATTLESIDE_HPP
|