Used ClangFormat style guide I'm happy with.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-11-28 12:55:22 +01:00
parent 3b685ae782
commit a8730d983f
91 changed files with 946 additions and 1121 deletions

View File

@@ -1,48 +1,39 @@
#ifndef CREATURELIB_ATTACKTURNCHOICE_HPP
#define CREATURELIB_ATTACKTURNCHOICE_HPP
#include "BaseTurnChoice.hpp"
#include "../Models/LearnedAttack.hpp"
#include "../Models/Target.hpp"
#include "BaseTurnChoice.hpp"
namespace CreatureLib::Battling{
namespace CreatureLib::Battling {
class AttackTurnChoice : public BaseTurnChoice {
LearnedAttack* _attack;
Target _target;
Script* _attackScript;
public:
AttackTurnChoice(Creature* user, LearnedAttack* attack, const Target& target)
: BaseTurnChoice(user), _attack(attack), _target(target){}
: BaseTurnChoice(user), _attack(attack), _target(target) {}
inline LearnedAttack* GetAttack() const{
return _attack;
}
inline LearnedAttack* GetAttack() const { return _attack; }
TurnChoiceKind GetKind() const override {
return TurnChoiceKind ::Attack;
}
TurnChoiceKind GetKind() const override { return TurnChoiceKind ::Attack; }
int8_t GetPriority() const{
//HOOK: Change priority
int8_t GetPriority() const {
// HOOK: Change priority
return _attack->GetAttack()->GetPriority();
}
const Target& GetTarget() const{
return _target;
}
const Target& GetTarget() const { return _target; }
Script* GetAttackScript(){
return _attackScript;
}
Script* GetAttackScript() { return _attackScript; }
protected:
void GetActiveScripts(std::vector<ScriptWrapper> &scripts) override {
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override {
scripts.emplace_back(&_attackScript);
GetUser()->GetActiveScripts(scripts);
}
};
}
#endif //CREATURELIB_ATTACKTURNCHOICE_HPP
#endif // CREATURELIB_ATTACKTURNCHOICE_HPP

View File

@@ -1,24 +1,23 @@
#ifndef CREATURELIB_BASETURNCHOICE_HPP
#define CREATURELIB_BASETURNCHOICE_HPP
#include "TurnChoiceKind.hpp"
#include "../ScriptHandling/ScriptSource.hpp"
#include "TurnChoiceKind.hpp"
namespace CreatureLib::Battling{
namespace CreatureLib::Battling {
class Creature;
class BaseTurnChoice : public ScriptSource {
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;
}
[[nodiscard]] inline Creature* GetUser() const { return _user; }
};
}
#endif //CREATURELIB_BASETURNCHOICE_HPP
#endif // CREATURELIB_BASETURNCHOICE_HPP

View File

@@ -4,19 +4,15 @@
#include "BaseTurnChoice.hpp"
namespace CreatureLib::Battling {
class PassTurnChoice : public BaseTurnChoice{
class PassTurnChoice : public BaseTurnChoice {
public:
PassTurnChoice(Creature* c) : BaseTurnChoice(c){}
PassTurnChoice(Creature* c) : BaseTurnChoice(c) {}
TurnChoiceKind GetKind() const override {
return TurnChoiceKind ::Pass;
}
TurnChoiceKind GetKind() const override { return TurnChoiceKind ::Pass; }
protected:
void GetActiveScripts(std::vector<ScriptWrapper> &scripts) override {
GetUser()->GetActiveScripts(scripts);
}
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override { GetUser()->GetActiveScripts(scripts); }
};
}
#endif //CREATURELIB_PASSTURNCHOICE_HPP
#endif // CREATURELIB_PASSTURNCHOICE_HPP

View File

@@ -4,12 +4,6 @@
#include <cstdint>
namespace CreatureLib::Battling {
enum class TurnChoiceKind : uint8_t {
Pass,
Attack,
Item,
Switch,
RunAway
};
enum class TurnChoiceKind : uint8_t { Pass, Attack, Item, Switch, RunAway };
}
#endif //CREATURELIB_TURNCHOICEKIND_HPP
#endif // CREATURELIB_TURNCHOICEKIND_HPP