Reformat.
This commit is contained in:
parent
7d1a0473ff
commit
2755f4827e
24 changed files with 6140 additions and 5829 deletions
|
@ -7,20 +7,20 @@
|
|||
using json = nlohmann::json;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Adresse final : public Characteristic {
|
||||
public:
|
||||
Adresse() noexcept: Characteristic(1, 0, 0, 0) {}
|
||||
class Adresse final : public Characteristic {
|
||||
public:
|
||||
Adresse() noexcept: Characteristic(1, 0, 0, 0) {}
|
||||
|
||||
~Adresse() noexcept final = default;
|
||||
~Adresse() noexcept final = default;
|
||||
|
||||
friend void from_json(const json &j, Adresse &adresse) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(adresse));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Adresse &adresse) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(adresse));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Adresse &adresse) {
|
||||
to_json(j, static_cast<Characteristic>(adresse));
|
||||
}
|
||||
static void to_json(json &j, const Adresse &adresse) {
|
||||
to_json(j, static_cast<Characteristic>(adresse));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
#include "characteristic.hpp"
|
||||
|
||||
namespace character::characteristic {
|
||||
class Chance final : public Characteristic {
|
||||
public:
|
||||
Chance() noexcept: Characteristic(3, 0, 0, 0) {}
|
||||
class Chance final : public Characteristic {
|
||||
public:
|
||||
Chance() noexcept: Characteristic(3, 0, 0, 0) {}
|
||||
|
||||
~Chance() noexcept final = default;
|
||||
~Chance() noexcept final = default;
|
||||
|
||||
friend void from_json(const json &j, Chance &chance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(chance));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Chance &chance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(chance));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Chance &chance) {
|
||||
to_json(j, static_cast<Characteristic>(chance));
|
||||
}
|
||||
static void to_json(json &j, const Chance &chance) {
|
||||
to_json(j, static_cast<Characteristic>(chance));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,53 +7,56 @@
|
|||
using json = nlohmann::json;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Characteristic {
|
||||
protected:
|
||||
const std::uint32_t base{ 0 };
|
||||
std::uint32_t carac{ 0 };
|
||||
std::uint32_t materiel{ 0 };
|
||||
std::uint32_t additional{ 0 };
|
||||
class Characteristic {
|
||||
protected:
|
||||
const std::uint32_t base{ 0 };
|
||||
std::uint32_t carac{ 0 };
|
||||
std::uint32_t materiel{ 0 };
|
||||
std::uint32_t additional{ 0 };
|
||||
|
||||
public:
|
||||
Characteristic() noexcept = default;
|
||||
public:
|
||||
Characteristic() noexcept = default;
|
||||
|
||||
Characteristic(const std::uint32_t base, const std::uint32_t carac, const std::uint32_t materiel, const std::uint32_t additional) noexcept:
|
||||
base(base), carac(carac), materiel(materiel), additional(additional) {}
|
||||
Characteristic(const std::uint32_t base,
|
||||
const std::uint32_t carac,
|
||||
const std::uint32_t materiel,
|
||||
const std::uint32_t additional) noexcept:
|
||||
base(base), carac(carac), materiel(materiel), additional(additional) {}
|
||||
|
||||
Characteristic(const Characteristic &charac) noexcept = default;
|
||||
Characteristic(const Characteristic &charac) noexcept = default;
|
||||
|
||||
Characteristic &operator=(const Characteristic &charac) noexcept {
|
||||
const_cast<std::uint32_t &>(base) = charac.base;
|
||||
carac = charac.carac;
|
||||
materiel = charac.materiel;
|
||||
additional = charac.additional;
|
||||
return *this;
|
||||
}
|
||||
Characteristic &operator=(const Characteristic &charac) noexcept {
|
||||
const_cast<std::uint32_t &>(base) = charac.base;
|
||||
carac = charac.carac;
|
||||
materiel = charac.materiel;
|
||||
additional = charac.additional;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~Characteristic() noexcept = default;
|
||||
virtual ~Characteristic() noexcept = default;
|
||||
|
||||
[[nodiscard]] std::uint32_t get_base() const { return base; }
|
||||
[[nodiscard]] std::uint32_t get_base() const { return base; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
||||
[[nodiscard]] std::uint32_t get_carac() const { return carac; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_materiel() const { return materiel; }
|
||||
[[nodiscard]] std::uint32_t get_materiel() const { return materiel; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_additional() const { return additional; }
|
||||
[[nodiscard]] std::uint32_t get_additional() const { return additional; }
|
||||
|
||||
friend void from_json(const json &j, Characteristic &charac) {
|
||||
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
||||
charac.carac = j.at("carac").get<std::uint32_t>();
|
||||
charac.materiel = j.at("materiel").get<std::uint32_t>();
|
||||
charac.additional = j.at("additional").get<std::uint32_t>();
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Characteristic &charac) {
|
||||
const_cast<std::uint32_t &>(charac.base) = j.at("base").get<std::uint32_t>();
|
||||
charac.carac = j.at("carac").get<std::uint32_t>();
|
||||
charac.materiel = j.at("materiel").get<std::uint32_t>();
|
||||
charac.additional = j.at("additional").get<std::uint32_t>();
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Characteristic &charac) {
|
||||
j["base"] = charac.get_base();
|
||||
j["carac"] = charac.get_carac();
|
||||
j["materiel"] = charac.get_materiel();
|
||||
j["additional"] = charac.get_additional();
|
||||
}
|
||||
static void to_json(json &j, const Characteristic &charac) {
|
||||
j["base"] = charac.get_base();
|
||||
j["carac"] = charac.get_carac();
|
||||
j["materiel"] = charac.get_materiel();
|
||||
j["additional"] = charac.get_additional();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,22 +7,22 @@
|
|||
using json = nlohmann::json;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Endurance final : public Characteristic {
|
||||
public:
|
||||
Endurance() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
class Endurance final : public Characteristic {
|
||||
public:
|
||||
Endurance() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
|
||||
~Endurance() noexcept final = default;
|
||||
~Endurance() noexcept final = default;
|
||||
|
||||
[[nodiscard]] std::uint32_t get_max_lp() const noexcept;
|
||||
[[nodiscard]] std::uint32_t get_max_lp() const noexcept;
|
||||
|
||||
friend void from_json(const json &j, Endurance &endurance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(endurance));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Endurance &endurance) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(endurance));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Endurance &endurance) {
|
||||
to_json(j, static_cast<Characteristic>(endurance));
|
||||
}
|
||||
static void to_json(json &j, const Endurance &endurance) {
|
||||
to_json(j, static_cast<Characteristic>(endurance));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
#include "characteristic.hpp"
|
||||
|
||||
namespace character::characteristic {
|
||||
class Habilete final : public Characteristic {
|
||||
public:
|
||||
Habilete() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
class Habilete final : public Characteristic {
|
||||
public:
|
||||
Habilete() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
|
||||
~Habilete() noexcept final = default;
|
||||
~Habilete() noexcept final = default;
|
||||
|
||||
friend void from_json(const json &j, Habilete &habilete) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(habilete));
|
||||
}
|
||||
};
|
||||
friend void from_json(const json &j, Habilete &habilete) {
|
||||
nlohmann::from_json(j, static_cast<Characteristic &>(habilete));
|
||||
}
|
||||
};
|
||||
|
||||
static void to_json(json &j, const Habilete &habilete) {
|
||||
to_json(j, static_cast<Characteristic>(habilete));
|
||||
}
|
||||
static void to_json(json &j, const Habilete &habilete) {
|
||||
to_json(j, static_cast<Characteristic>(habilete));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue