diff --git a/include/character_sheet.hpp b/include/character_sheet.hpp index 09f710a..ee54cf3 100644 --- a/include/character_sheet.hpp +++ b/include/character_sheet.hpp @@ -80,15 +80,10 @@ namespace character { [[nodiscard]] const BillyObjects::container &get_objects() const { return objects; } [[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; - } + if (nb_weapons >= 2) { return classe::Guerrier; } + if (nb_equipments >= 2) { return classe::Prudent; } + if (nb_tools >= 2) { return classe::Paysan; } + return classe::Debrouillard; } [[nodiscard]] std::uint32_t get_health_point() const { return health_point; } @@ -126,24 +121,24 @@ namespace character { }; static void to_json(json &j, const CharacterSheet &billy) { - j["caractere"] = billy.get_caractere(); - j["adresse"] = billy.get_adresse(); - 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(); - 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(); + j.emplace("caractere", billy.get_caractere()); + j.emplace("adresse", billy.get_adresse()); + j.emplace("endurance", billy.get_endurance()); + j.emplace("chance", billy.get_chance()); + j.emplace("habilete", billy.get_habilete()); + j.emplace("classe", billy.get_current_class()); + j.emplace("health_point", billy.get_health_point()); + j.emplace("armor", billy.get_armor()); + j.emplace("damage", billy.get_damage()); + j.emplace("glory", billy.get_glory()); + j.emplace("money", billy.get_money()); + j.emplace("nb_weapons", billy.get_nb_weapons()); + j.emplace("nb_equipments", billy.get_nb_equipments()); + j.emplace("nb_tools", billy.get_nb_tools()); j.emplace(std::pair{ BillyObjects::json_key, json::array() }); BillyObjects::to_json(j.at(BillyObjects::json_key), billy.get_objects()); } } -#endif //BILLYSHEET_CHARACTER_SHEET_HPP \ No newline at end of file +#endif //BILLYSHEET_CHARACTER_SHEET_HPP