// // Created by postaron on 20/02/24. // #ifndef BILLYSHEET_BILLY_OBJECTS_HPP #define BILLYSHEET_BILLY_OBJECTS_HPP #include #include #include #include #include #include #include #include "generic_object.hpp" namespace character { class CharacterSheet; namespace characteristic{ class Characteristic; } class BillyObjects final { public: using json = nlohmann::json; using container = std::unordered_map; static constexpr std::array all_objects{ weapons::Sword, weapons::Lance, weapons::Morgenstern, weapons::Bow, equipments::Chainmail, equipments::CookingPot, equipments::PamphletTourist, equipments::MedicKit, tools::Fourche, tools::Dagger, tools::RockClimbingKit, tools::SackOfGrain, }; static constexpr std::string_view json_key{ "billy_objects" }; static std::string_view billy_object_to_string(const billyObjects &object) noexcept; static void to_json(json &j, const BillyObjects::container &billy); static void from_json(const json &j, BillyObjects::container &billy); BillyObjects() noexcept = default; ~BillyObjects() noexcept = default; [[nodiscard]] bool insert_object(CharacterSheet &sheet, const billyEnums objType) noexcept; void erase_object(CharacterSheet &sheet, const billyEnums objToErase) noexcept; [[nodiscard]] const std::plus &get_plus_operation() const { return plus; } [[nodiscard]] const std::minus &get_minus_operation() const { return minus; } static void check_dagger_conditions(const CharacterSheet &sheet, characteristic::Characteristic &localHabilete, const std::function &operation); private: std::plus plus; std::minus minus; static void change_carac(const billyObjects &arg, CharacterSheet &sheet, characteristic::Characteristic &localHabilete, characteristic::Characteristic &localAdresse, characteristic::Characteristic &localEndurance, characteristic::Characteristic &localChance, const std::function &operation) noexcept; }; } #endif //BILLYSHEET_BILLY_OBJECTS_HPP