This commit is contained in:
Pcornat 2026-02-04 16:04:08 +01:00
commit 27b3812725
Signed by: Pcornat
GPG key ID: E0326CC678A00BDD

View file

@ -80,16 +80,11 @@ namespace character {
[[nodiscard]] const BillyObjects::container &get_objects() const { return objects; } [[nodiscard]] const BillyObjects::container &get_objects() const { return objects; }
[[nodiscard]] classe get_current_class() const { [[nodiscard]] classe get_current_class() const {
if (nb_weapons >= 2) { if (nb_weapons >= 2) { return classe::Guerrier; }
return classe::Guerrier; if (nb_equipments >= 2) { return classe::Prudent; }
} else if (nb_equipments >= 2) { if (nb_tools >= 2) { return classe::Paysan; }
return classe::Prudent;
} else if (nb_tools >= 2) {
return classe::Paysan;
} else {
return classe::Debrouillard; return classe::Debrouillard;
} }
}
[[nodiscard]] std::uint32_t get_health_point() const { return health_point; } [[nodiscard]] std::uint32_t get_health_point() const { return health_point; }
@ -126,20 +121,20 @@ namespace character {
}; };
static void to_json(json &j, const CharacterSheet &billy) { static void to_json(json &j, const CharacterSheet &billy) {
j["caractere"] = billy.get_caractere(); j.emplace("caractere", billy.get_caractere());
j["adresse"] = billy.get_adresse(); j.emplace("adresse", billy.get_adresse());
j["endurance"] = billy.get_endurance(); j.emplace("endurance", billy.get_endurance());
j["chance"] = billy.get_chance(); j.emplace("chance", billy.get_chance());
j["habilete"] = billy.get_habilete(); j.emplace("habilete", billy.get_habilete());
j["classe"] = billy.get_current_class(); j.emplace("classe", billy.get_current_class());
j["health_point"] = billy.get_health_point(); j.emplace("health_point", billy.get_health_point());
j["armor"] = billy.get_armor(); j.emplace("armor", billy.get_armor());
j["damage"] = billy.get_damage(); j.emplace("damage", billy.get_damage());
j["glory"] = billy.get_glory(); j.emplace("glory", billy.get_glory());
j["money"] = billy.get_money(); j.emplace("money", billy.get_money());
j["nb_weapons"] = billy.get_nb_weapons(); j.emplace("nb_weapons", billy.get_nb_weapons());
j["nb_equipments"] = billy.get_nb_equipments(); j.emplace("nb_equipments", billy.get_nb_equipments());
j["nb_tools"] = billy.get_nb_tools(); j.emplace("nb_tools", billy.get_nb_tools());
j.emplace(std::pair{ BillyObjects::json_key, json::array() }); j.emplace(std::pair{ BillyObjects::json_key, json::array() });
BillyObjects::to_json(j.at(BillyObjects::json_key), billy.get_objects()); BillyObjects::to_json(j.at(BillyObjects::json_key), billy.get_objects());
} }