Changing characteristics to try to deal with gameplay.

It is not a definitive changes, a refactoring is going to be made in the future.
This commit is contained in:
Pcornat 2024-02-26 11:36:22 +01:00
commit cfd22179e9
Signed by: Pcornat
GPG key ID: E0326CC678A00BDD
6 changed files with 57 additions and 8 deletions

View file

@ -23,12 +23,14 @@ namespace character {
private:
friend gui::Gui;
friend class Controller;
friend class BillyObjects;
std::mt19937_64 engine{ std::random_device{ "rdseed" }() };
std::string caractere{};
//TODO: bad design pour les caractéristiques. Je dois trouver autre chose.
characteristic::Adresse adresse;
characteristic::Endurance endurance;
@ -37,8 +39,6 @@ namespace character {
characteristic::Habilete habilete;
classe current_class{ classe::Guerrier };
std::uint32_t health_point{ 0 };
std::uint32_t armor{ 0 };
@ -48,6 +48,12 @@ namespace character {
std::uint32_t glory{ 0 };
std::uint32_t money{ 0 };
std::uint32_t nb_weapons{ 0 };
std::uint32_t nb_equipments{ 0 };
std::uint32_t nb_tools{ 0 };
public:
CharacterSheet() = default;
@ -71,7 +77,17 @@ namespace character {
[[nodiscard]] const characteristic::Habilete &get_habilete() const { return habilete; }
[[nodiscard]] classe get_current_class() const { return current_class; }
[[nodiscard]] classe get_current_class() const {
if (nb_weapons >= 2) {
return classe::Guerrier;
} else if (nb_equipments >= 2) {
return classe::Prudent;
} else if (nb_tools >= 2) {
return classe::Paysan;
} else {
return classe::Debrouillard;
}
}
[[nodiscard]] std::uint32_t get_health_point() const { return health_point; }
@ -83,18 +99,26 @@ namespace character {
[[nodiscard]] std::uint32_t get_money() const { return money; }
[[nodiscard]] std::uint32_t get_nb_weapons() const { return nb_weapons; }
[[nodiscard]] std::uint32_t get_nb_equipments() const { return nb_equipments; }
[[nodiscard]] std::uint32_t get_nb_tools() const { return nb_tools; }
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);
j.at("nb_weapons").get_to(billy.nb_weapons);
j.at("nb_equipments").get_to(billy.nb_equipments);
j.at("nb_tools").get_to(billy.nb_tools);
}
};
@ -110,6 +134,9 @@ namespace character {
j["damage"] = billy.get_damage();
j["glory"] = billy.get_glory();
j["money"] = billy.get_money();
j["nb_weapons"] = billy.get_nb_weapons();
j["nb_equipments"] = billy.get_nb_equipments();
j["nb_tools"] = billy.get_nb_tools();
}
}