Working to save and select classes
This commit is contained in:
parent
8e6f0ccc1f
commit
acc2f0ca9d
6 changed files with 54 additions and 1 deletions
|
@ -12,9 +12,17 @@ namespace gui {
|
|||
}
|
||||
|
||||
namespace character {
|
||||
enum class classe : std::uint32_t {
|
||||
Guerrier = 0,
|
||||
Prudent = 1,
|
||||
Paysan = 2,
|
||||
Debrouillard = 3,
|
||||
};
|
||||
|
||||
class CharacterSheet final {
|
||||
private:
|
||||
friend gui::Gui;
|
||||
|
||||
friend class Controller;
|
||||
|
||||
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
|
||||
|
@ -29,6 +37,8 @@ namespace character {
|
|||
|
||||
characteristic::Habilete habilete;
|
||||
|
||||
classe current_class{ classe::Guerrier };
|
||||
|
||||
std::uint32_t health_point{ 0 };
|
||||
|
||||
std::uint32_t armor{ 0 };
|
||||
|
@ -53,6 +63,8 @@ namespace character {
|
|||
|
||||
[[nodiscard]] const characteristic::Habilete &get_habilete() const { return habilete; }
|
||||
|
||||
[[nodiscard]] classe get_current_class() const { return current_class; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_health_point() const { return health_point; }
|
||||
|
||||
[[nodiscard]] std::uint32_t get_armor() const { return armor; }
|
||||
|
@ -69,6 +81,7 @@ namespace character {
|
|||
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);
|
||||
|
@ -83,6 +96,7 @@ namespace character {
|
|||
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();
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#ifndef BILLYSHEET_GUI_DATA_HPP
|
||||
#define BILLYSHEET_GUI_DATA_HPP
|
||||
|
||||
#include <string_view>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace character {
|
||||
class CharacterSheet;
|
||||
}
|
||||
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
namespace gui {
|
||||
class Window;
|
||||
|
||||
|
@ -19,6 +22,13 @@ namespace gui {
|
|||
character::CharacterSheet &billy;
|
||||
|
||||
public:
|
||||
static constexpr std::array classes{
|
||||
"Guerrier"sv,
|
||||
"Prudent"sv,
|
||||
"Paysan"sv,
|
||||
"Débrouillard"sv
|
||||
};
|
||||
|
||||
GuiData() = delete;
|
||||
|
||||
explicit GuiData(Window &wwindow, character::CharacterSheet &billy) : window(wwindow), billy(billy) { SPDLOG_DEBUG("Creating GUI Data"); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue