mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Levling health gives you health. Added combat scaling to UI.
This commit is contained in:
parent
83fdc8806d
commit
968b66260e
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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::<comp::Scale>();
|
||||
let bodies = ecs.read_storage::<comp::Body>();
|
||||
let items = ecs.read_storage::<comp::Item>();
|
||||
let loadouts = ecs.read_storage::<comp::Loadout>();
|
||||
let entities = ecs.entities();
|
||||
let me = client.entity();
|
||||
//self.input = client.read_storage::<comp::ControllerInputs>();
|
||||
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user