diff --git a/common/src/comp/health.rs b/common/src/comp/health.rs index 541736c280..fde833bb31 100644 --- a/common/src/comp/health.rs +++ b/common/src/comp/health.rs @@ -107,6 +107,10 @@ impl Health { if let Some(body) = body { self.set_base_max(body.base_health() + body.base_health_increase() * level as u32); self.set_maximum(body.base_health() + body.base_health_increase() * level as u32); + self.change_by(HealthChange { + amount: body.base_health_increase() as i32, + cause: HealthSource::LevelUp, + }); } } diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index f27f8d51c4..be2e617d06 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -58,8 +58,9 @@ use crate::{ use client::Client; use common::{ - comp, + combat, comp::{ + self, item::{tool::ToolKind, ItemDesc, Quality}, skills::{Skill, SkillGroupType}, BuffKind, @@ -852,6 +853,7 @@ impl Hud { let scales = ecs.read_storage::(); let bodies = ecs.read_storage::(); let items = ecs.read_storage::(); + let loadouts = ecs.read_storage::(); let entities = ecs.entities(); let me = client.entity(); //self.input = client.read_storage::(); @@ -1274,6 +1276,7 @@ impl Hud { &bodies, &hp_floater_lists, &uids, + &loadouts, ) .join() .filter(|t| { @@ -1294,6 +1297,7 @@ impl Hud { body, hpfl, uid, + loadout, )| { // Use interpolated position if available let pos = interpolated.map_or(pos.0, |i| i.pos); @@ -1326,6 +1330,7 @@ impl Hud { health, buffs, energy, + combat_rating: combat::combat_rating(loadout, health, &stats.body_type), }); let bubble = if dist_sqr < SPEECH_BUBBLE_RANGE.powi(2) { speech_bubbles.get(uid) diff --git a/voxygen/src/hud/overhead.rs b/voxygen/src/hud/overhead.rs index ddb636f858..acd62f4e3a 100644 --- a/voxygen/src/hud/overhead.rs +++ b/voxygen/src/hud/overhead.rs @@ -64,6 +64,7 @@ pub struct Info<'a> { pub health: &'a Health, pub buffs: &'a Buffs, pub energy: Option<&'a Energy>, + pub combat_rating: f32, } /// Determines whether to show the healthbar @@ -175,6 +176,7 @@ impl<'a> Widget for Overhead<'a> { health, buffs, energy, + combat_rating, }) = self.info { // Used to set healthbar colours based on hp_percentage @@ -379,15 +381,15 @@ impl<'a> Widget for Overhead<'a> { // "Boss Factor" (?) // For players: Highest skilltree rank - let indicator_col = match health_max as u32 { - 0..=50 => QUALITY_LOW, - 51..=100 => QUALITY_COMMON, - 101..=150 => QUALITY_MODERATE, - 151..=200 => QUALITY_HIGH, - 201..=250 => QUALITY_EPIC, - 251..=300 => QUALITY_LEGENDARY, - 301..=350 => QUALITY_ARTIFACT, - 351..=9999 => QUALITY_DEBUG, + let indicator_col = match combat_rating { + x if (0.0..0.5).contains(&x) => QUALITY_LOW, + x if (0.5..1.0).contains(&x) => QUALITY_COMMON, + x if (1.0..1.5).contains(&x) => QUALITY_MODERATE, + x if (1.5..2.0).contains(&x) => QUALITY_HIGH, + x if (2.0..2.5).contains(&x) => QUALITY_EPIC, + x if (2.5..3.0).contains(&x) => QUALITY_LEGENDARY, + x if (2.0..3.5).contains(&x) => QUALITY_ARTIFACT, + x if x >= 3.5 => QUALITY_DEBUG, _ => XP_COLOR, }; Image::new(self.imgs.indicator_bubble)