Initial support for setting battle choices.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-10-29 11:19:25 +01:00
parent 3938500595
commit 99315174a8
12 changed files with 234 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
#ifndef CREATURELIB_ATTACKTURNCHOICE_HPP
#define CREATURELIB_ATTACKTURNCHOICE_HPP
#include "BaseTurnChoice.hpp"
#include "../Models/LearnedAttack.hpp"
namespace CreatureLib::Battling{
class AttackTurnChoice : public BaseTurnChoice {
LearnedAttack* _attack;
public:
AttackTurnChoice(Creature* c) : BaseTurnChoice(c){}
inline LearnedAttack* GetAttack() const{
return _attack;
}
};
}
#endif //CREATURELIB_ATTACKTURNCHOICE_HPP

View File

@@ -0,0 +1,21 @@
#ifndef CREATURELIB_BASETURNCHOICE_HPP
#define CREATURELIB_BASETURNCHOICE_HPP
#include "TurnChoiceKind.hpp"
namespace CreatureLib::Battling{
class BaseTurnChoice {
Creature* _user;
protected:
BaseTurnChoice(Creature* user) : _user(user){};
public:
virtual ~BaseTurnChoice() = default;
[[nodiscard]] virtual TurnChoiceKind GetKind() const = 0;
[[nodiscard]] inline Creature* GetUser() const{
return _user;
}
};
}
#endif //CREATURELIB_BASETURNCHOICE_HPP

View File

@@ -0,0 +1,17 @@
#ifndef CREATURELIB_PASSTURNCHOICE_HPP
#define CREATURELIB_PASSTURNCHOICE_HPP
#include "BaseTurnChoice.hpp"
namespace CreatureLib::Battling {
class PassTurnChoice : public BaseTurnChoice{
public:
PassTurnChoice(Creature* c) : BaseTurnChoice(c){}
TurnChoiceKind GetKind() const override {
return TurnChoiceKind ::Pass;
}
};
}
#endif //CREATURELIB_PASSTURNCHOICE_HPP

View File

@@ -0,0 +1,15 @@
#ifndef CREATURELIB_TURNCHOICEKIND_HPP
#define CREATURELIB_TURNCHOICEKIND_HPP
#include <cstdint>
namespace CreatureLib::Battling {
enum class TurnChoiceKind : uint8_t {
Pass,
Attack,
Item,
Switch,
RunAway
};
}
#endif //CREATURELIB_TURNCHOICEKIND_HPP