Fix armor level 0 (#590)

Armor items with item level 0, will have a base defense value of 0 instead of 1, and display their defense value as such in the get items screen.

Fix #245
This commit is contained in:
2025-02-09 09:36:14 -06:00
committed by GitHub
parent afa0b9d7a4
commit e81cde113c
2 changed files with 14 additions and 5 deletions

View File

@@ -143,11 +143,17 @@ std::string cItem::interesting_string() const {
case eItemType::HELM:
case eItemType::GLOVES:
case eItemType::SHIELD_2:
case eItemType::BOOTS:
sout << "Blocks " << 1 + min_defense_bonus(bonus) + sgn(protection);
sout << '-' << max(1,item_level) + max_defense_bonus(bonus) + protection;
case eItemType::BOOTS:{
short min_defense = 0;
if(item_level > 0) min_defense = 1;
min_defense += (min_defense_bonus(bonus) + sgn(protection));
short max_defense = item_level + max_defense_bonus(bonus) + protection;
sout << "Blocks " << min_defense;
if(max_defense != min_defense){
sout << '-' << max(min_defense,item_level);
}
sout << " damage";
break;
} break;
case eItemType::BOW:
case eItemType::CROSSBOW:
sout << "Bonus: +" << bonus << " to hit";