Reformat.
This commit is contained in:
parent
7d1a0473ff
commit
2755f4827e
24 changed files with 6352 additions and 6041 deletions
|
|
@ -8,101 +8,109 @@
|
|||
#include <random>
|
||||
|
||||
namespace gui {
|
||||
class Gui;
|
||||
class Gui;
|
||||
}
|
||||
|
||||
namespace character {
|
||||
enum class classe : std::uint32_t {
|
||||
Guerrier = 0,
|
||||
Prudent = 1,
|
||||
Paysan = 2,
|
||||
Debrouillard = 3,
|
||||
};
|
||||
enum class classe : std::uint8_t {
|
||||
Guerrier = 0,
|
||||
Prudent = 1,
|
||||
Paysan = 2,
|
||||
Debrouillard = 3,
|
||||
};
|
||||
|
||||
class CharacterSheet final {
|
||||
private:
|
||||
friend gui::Gui;
|
||||
class CharacterSheet final {
|
||||
private:
|
||||
friend gui::Gui;
|
||||
|
||||
friend class Controller;
|
||||
friend class Controller;
|
||||
|
||||
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
|
||||
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
|
||||
|
||||
std::string caractere{};
|
||||
std::string caractere{};
|
||||
|
||||
characteristic::Adresse adresse;
|
||||
characteristic::Adresse adresse;
|
||||
|
||||
characteristic::Endurance endurance;
|
||||
characteristic::Endurance endurance;
|
||||
|
||||
characteristic::Chance chance;
|
||||
characteristic::Chance chance;
|
||||
|
||||
characteristic::Habilete habilete;
|
||||
characteristic::Habilete habilete;
|
||||
|
||||
classe current_class{ classe::Guerrier };
|
||||
classe current_class{ classe::Guerrier };
|
||||
|
||||
std::uint32_t health_point{ 0 };
|
||||
std::uint32_t health_point{ 0 };
|
||||
|
||||
std::uint32_t armor{ 0 };
|
||||
std::uint32_t armor{ 0 };
|
||||
|
||||
std::uint32_t damage{ 0 };
|
||||
std::uint32_t damage{ 0 };
|
||||
|
||||
std::uint32_t glory{ 0 };
|
||||
std::uint32_t glory{ 0 };
|
||||
|
||||
std::uint32_t money{ 0 };
|
||||
public:
|
||||
CharacterSheet() = default;
|
||||
std::uint32_t money{ 0 };
|
||||
public:
|
||||
CharacterSheet() = default;
|
||||
|
||||
~CharacterSheet() noexcept = default;
|
||||
CharacterSheet(const CharacterSheet &sheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const std::string &get_caractere() const { return caractere; }
|
||||
CharacterSheet(CharacterSheet &&sheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Adresse &get_adresse() const { return adresse; }
|
||||
CharacterSheet &operator=(const CharacterSheet &characterSheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Endurance &get_endurance() const { return endurance; }
|
||||
CharacterSheet &operator=(CharacterSheet &&characterSheet) noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Chance &get_chance() const { return chance; }
|
||||
~CharacterSheet() noexcept = default;
|
||||
|
||||
[[nodiscard]] const characteristic::Habilete &get_habilete() const { return habilete; }
|
||||
[[nodiscard]] const std::string &get_caractere() const { return caractere; }
|
||||
|
||||
[[nodiscard]] classe get_current_class() const { return current_class; }
|
||||
[[nodiscard]] const characteristic::Adresse &get_adresse() const { return adresse; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_health_point() const { return health_point; }
|
||||
[[nodiscard]] const characteristic::Endurance &get_endurance() const { return endurance; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_armor() const { return armor; }
|
||||
[[nodiscard]] const characteristic::Chance &get_chance() const { return chance; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_damage() const { return damage; }
|
||||
[[nodiscard]] const characteristic::Habilete &get_habilete() const { return habilete; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_glory() const { return glory; }
|
||||
[[nodiscard]] classe get_current_class() const { return current_class; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_money() const { return money; }
|
||||
[[nodiscard]] std::uint32_t get_health_point() const { return health_point; }
|
||||
|
||||
friend void from_json(const json &j, CharacterSheet &billy) {
|
||||
j.at("caractere").get_to(billy.caractere);
|
||||
j.at("adresse").get_to(billy.adresse);
|
||||
j.at("endurance").get_to(billy.endurance);
|
||||
j.at("chance").get_to(billy.chance);
|
||||
j.at("habilete").get_to(billy.habilete);
|
||||
j.at("classe").get_to(billy.current_class);
|
||||
j.at("health_point").get_to(billy.health_point);
|
||||
j.at("armor").get_to(billy.armor);
|
||||
j.at("damage").get_to(billy.damage);
|
||||
j.at("glory").get_to(billy.glory);
|
||||
j.at("money").get_to(billy.money);
|
||||
}
|
||||
};
|
||||
[[nodiscard]] std::uint32_t get_armor() const { return armor; }
|
||||
|
||||
static void to_json(json &j, const CharacterSheet &billy) {
|
||||
j["caractere"] = billy.get_caractere();
|
||||
j["adresse"] = billy.get_adresse();
|
||||
j["endurance"] = billy.get_endurance();
|
||||
j["chance"] = billy.get_chance();
|
||||
j["habilete"] = billy.get_habilete();
|
||||
j["classe"] = billy.get_current_class();
|
||||
j["health_point"] = billy.get_health_point();
|
||||
j["armor"] = billy.get_armor();
|
||||
j["damage"] = billy.get_damage();
|
||||
j["glory"] = billy.get_glory();
|
||||
j["money"] = billy.get_money();
|
||||
}
|
||||
[[nodiscard]] std::uint32_t get_damage() const { return damage; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_glory() const { return glory; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_money() const { return money; }
|
||||
|
||||
friend void from_json(const json &j, CharacterSheet &billy) {
|
||||
j.at("caractere").get_to(billy.caractere);
|
||||
j.at("adresse").get_to(billy.adresse);
|
||||
j.at("endurance").get_to(billy.endurance);
|
||||
j.at("chance").get_to(billy.chance);
|
||||
j.at("habilete").get_to(billy.habilete);
|
||||
j.at("classe").get_to(billy.current_class);
|
||||
j.at("health_point").get_to(billy.health_point);
|
||||
j.at("armor").get_to(billy.armor);
|
||||
j.at("damage").get_to(billy.damage);
|
||||
j.at("glory").get_to(billy.glory);
|
||||
j.at("money").get_to(billy.money);
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const CharacterSheet &billy) {
|
||||
j["caractere"] = billy.get_caractere();
|
||||
j["adresse"] = billy.get_adresse();
|
||||
j["endurance"] = billy.get_endurance();
|
||||
j["chance"] = billy.get_chance();
|
||||
j["habilete"] = billy.get_habilete();
|
||||
j["classe"] = billy.get_current_class();
|
||||
j["health_point"] = billy.get_health_point();
|
||||
j["armor"] = billy.get_armor();
|
||||
j["damage"] = billy.get_damage();
|
||||
j["glory"] = billy.get_glory();
|
||||
j["money"] = billy.get_money();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue