// // Created by postaron on 20/02/24. // #ifndef BILLYSHEET_BILLY_OBJECTS_HPP #define BILLYSHEET_BILLY_OBJECTS_HPP #include #include #include #include #include #include #include "characteristic/characteristic.hpp" // helper type for the visitor template struct overloaded : Ts ... { using Ts::operator()...; }; template overloaded(Ts...) -> overloaded; namespace character { class CharacterSheet; enum class weapons : std::uint8_t { Sword = 0, Lance = 1, Morgenstern = 2, Bow = 3 }; enum class equipments : std::uint8_t { Chainmail = 4, CookingPot = 5, PamphletTourist = 6, MedicKit = 7 }; enum class tools : std::uint8_t { Fourche = 8, Dagger = 9, RockClimbingKit = 10, SackOfGrain = 11 }; class BillyObjects final { public: static constexpr std::size_t max_num_obj{ 3 }; using billyObject = std::variant; using container = ankerl::svector; static constexpr std::string_view json_key{ "billy_objects" }; static constexpr std::string_view sword{ "Sword" }; static constexpr std::string_view lance{ "Lance" }; static constexpr std::string_view morgenstern{ "Morgenstern" }; static constexpr std::string_view bow{ "Bow" }; static constexpr std::string_view chainmail{ "Chainmail" }; static constexpr std::string_view cooking_pot{ "Cooking pot" }; static constexpr std::string_view pamphlet_tourist{ "Touristic pamphlet" }; static constexpr std::string_view medic_kit{ "Medic kit" }; static constexpr std::string_view fourche{ "Fourche" }; static constexpr std::string_view dagger{ "Dagger" }; static constexpr std::string_view rock_climbing_kit{ "Rock climbing kit" }; static constexpr std::string_view sack_of_grain{ "Sack of grain" }; static std::string_view billy_object_to_string(const billyObject &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; void push_object(const billyObject &object, CharacterSheet &sheet) noexcept; void pop_object(CharacterSheet &sheet) noexcept; // void insert_weapon(weapons weapon, CharacterSheet &sheet) noexcept; private: std::plus plus; std::minus minus; static void change_carac_weapon(const weapons &arg, CharacterSheet &sheet, characteristic::Characteristic &localHabilete, characteristic::Characteristic &localAdresse, characteristic::Characteristic &localEndurance, const std::function &operation) noexcept; static void change_carac_equipment(const equipments &arg, CharacterSheet &sheet, characteristic::Characteristic &localHabilete, characteristic::Characteristic &localAdresse, characteristic::Characteristic &localEndurance, characteristic::Characteristic &localChance, const std::function &primary, const std::function &complement) noexcept; static void change_carac_tools(const tools &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