diff --git a/include/generic_object.hpp b/include/generic_object.hpp index d3b51a3..0d2e45d 100644 --- a/include/generic_object.hpp +++ b/include/generic_object.hpp @@ -59,7 +59,7 @@ namespace character { [[nodiscard]] virtual std::uint32_t add_damage() const noexcept = 0; - [[nodiscard]] virtual std::uint32_t add_materiel(const characteristic::characType inType) const noexcept = 0; + [[nodiscard]] virtual std::int32_t add_materiel(const characteristic::characType inType) const noexcept = 0; [[nodiscard]] virtual std::string_view to_string() const noexcept = 0; @@ -86,7 +86,7 @@ namespace character { [[nodiscard]] std::uint32_t add_damage() const noexcept final; - [[nodiscard]] std::uint32_t add_materiel(const characteristic::characType inType) const noexcept final; + [[nodiscard]] std::int32_t add_materiel(const characteristic::characType inType) const noexcept final; [[nodiscard]] std::string_view to_string() const noexcept final; @@ -112,7 +112,7 @@ namespace character { [[nodiscard]] std::uint32_t add_damage() const noexcept final; - [[nodiscard]] std::uint32_t add_materiel(const characteristic::characType inType) const noexcept final; + [[nodiscard]] std::int32_t add_materiel(const characteristic::characType inType) const noexcept final; [[nodiscard]] std::string_view to_string() const noexcept final; @@ -138,7 +138,7 @@ namespace character { [[nodiscard]] std::uint32_t add_damage() const noexcept final; - [[nodiscard]] std::uint32_t add_materiel(const characteristic::characType inType) const noexcept final; + [[nodiscard]] std::int32_t add_materiel(const characteristic::characType inType) const noexcept final; [[nodiscard]] std::string_view to_string() const noexcept final; diff --git a/src/generic_object.cpp b/src/generic_object.cpp index 00e194d..c83cccb 100644 --- a/src/generic_object.cpp +++ b/src/generic_object.cpp @@ -30,7 +30,7 @@ namespace character { std::uint32_t Weapons::add_damage() const noexcept { return type == weapons::Morgenstern ? 1 : 0; } - std::uint32_t Weapons::add_materiel(const characteristic::characType inType) const noexcept { + std::int32_t Weapons::add_materiel(const characteristic::characType inType) const noexcept { switch (type) { case weapons::Sword: if (inType == characType::Habilete) { @@ -93,12 +93,14 @@ namespace character { std::uint32_t Equipments::add_damage() const noexcept { return 0; } - std::uint32_t Equipments::add_materiel(const characteristic::characType inType) const noexcept { + std::int32_t Equipments::add_materiel(const characteristic::characType inType) const noexcept { switch (type) { case equipments::Chainmail: - return inType == characType::Habilete || - inType == characType::Adresse || - inType == characType::Endurance ? 1 : 0; + if (inType == characType::Habilete || + inType == characType::Adresse) { + return -1; + } + return inType == characType::Endurance ? 1 : 0; case equipments::CookingPot: return inType == characType::Endurance ? 2 : 0; case equipments::PamphletTourist: @@ -127,7 +129,7 @@ namespace character { std::uint32_t Tools::add_damage() const noexcept { return 0; } - std::uint32_t Tools::add_materiel(const characteristic::characType inType) const noexcept { + std::int32_t Tools::add_materiel(const characteristic::characType inType) const noexcept { switch (type) { case tools::Fourche: switch (inType) {