- Adjust Stats Diary UI to show stealth as a percentage from armor items.

- `(Max)` is also shown when stealth from items is maxed out (currently
  30%).

Notes:
- FIXME: Someone more familiar with the different armor types may want to adjust their stealths.
  - In addition, the current max stealth sum from armor is `0.3`, beyond which no stealth effect is caused.
This commit is contained in:
holychowders 2022-05-04 08:48:57 -05:00
parent e473c47bcf
commit dc9dbc30b4

View File

@ -1112,7 +1112,7 @@ impl<'a> Widget for Diary<'a> {
"Stun-Resistance",
"Crit-Power",
"Energy Reward",
"Stealth",
"Stealth (Items)",
"Weapon Power",
"Weapon Speed",
"Weapon Poise",
@ -1206,9 +1206,20 @@ impl<'a> Widget for Diary<'a> {
combat::compute_energy_reward_mod(Some(self.inventory));
format!("{:+.0}%", (energy_rew - 1.0) * 100.0)
},
"Stealth" => {
let stealth = combat::compute_stealth_coefficient(Some(self.inventory));
format!("{:.2}", stealth)
"Stealth (Items)" => {
let stealth_perception_multiplier =
combat::perception_dist_multiplier_from_stealth(
Some(self.inventory),
None,
);
let mut txt =
format!("{:+.1}%", (1.0 - stealth_perception_multiplier) * 100.0);
if combat::is_stealth_from_items_maxed(Some(self.inventory)) {
txt = format!("{} (Max)", txt);
}
txt
},
"Weapon Power" => match (main_weap_stats, off_weap_stats) {
(Some(m_stats), Some(o_stats)) => {