Correct rules for equipments

This commit is contained in:
Pcornat 2024-10-30 12:17:14 +01:00
parent 8429e7ff8f
commit 05782bae69
Signed by: Pcornat
GPG Key ID: E0326CC678A00BDD
2 changed files with 12 additions and 10 deletions

View File

@ -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;

View File

@ -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) {