Serialize and deserialize.
This commit is contained in:
parent
e762ab05c6
commit
7b6eca1067
6 changed files with 96 additions and 60 deletions
|
@ -1,27 +1,28 @@
|
|||
//
|
||||
// Created by postaron on 10/01/2022.
|
||||
//
|
||||
|
||||
#ifndef BILLYSHEET_ENDURANCE_HPP
|
||||
#define BILLYSHEET_ENDURANCE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include "characteristic.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace character::characteristic {
|
||||
class Endurance final {
|
||||
private:
|
||||
const std::uint32_t base{ 2 };
|
||||
std::uint32_t carac{ 0 };
|
||||
std::uint32_t materiel{ 0 };
|
||||
std::uint32_t additional{ 0 };
|
||||
|
||||
class Endurance final : public Characteristic {
|
||||
public:
|
||||
Endurance() noexcept = default;
|
||||
Endurance() noexcept: Characteristic(2, 0, 0, 0) {};
|
||||
|
||||
~Endurance() noexcept = default;
|
||||
~Endurance() noexcept final = default;
|
||||
|
||||
[[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));
|
||||
}
|
||||
};
|
||||
|
||||
void to_json(json &j, const Endurance &endurance) {
|
||||
to_json(j, static_cast<Characteristic>(endurance));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue