diff --git a/reffect/src/elements/common.rs b/reffect/src/elements/common.rs index 29310e4..7319a4f 100644 --- a/reffect/src/elements/common.rs +++ b/reffect/src/elements/common.rs @@ -5,8 +5,7 @@ use crate::{ id::Id, render::{colors, ComponentWise, RenderDebug, RenderOptions}, render_util::{ - debug_optional, helper_slider, input_pos, push_alpha_change, slider_percent, - EnumStaticVariants, Rect, + helper_slider, input_pos, push_alpha_change, slider_percent, EnumStaticVariants, Rect, }, trigger::ProgressTrigger, }; diff --git a/reffect/src/elements/icon/mod.rs b/reffect/src/elements/icon/mod.rs index 1455ce5..1e97015 100644 --- a/reffect/src/elements/icon/mod.rs +++ b/reffect/src/elements/icon/mod.rs @@ -146,7 +146,7 @@ impl Icon { // render duration text if self.duration_text { - if let Some(remain) = active.current(ProgressValue::PreferPrimary, ctx.now) { + if let Some(remain) = active.current(ProgressValue::Primary, ctx.now) { let DurationTextSettings { max_remain, scale, @@ -157,8 +157,7 @@ impl Icon { } = ctx.settings.icon.duration_text; if remain < max_remain { - let text = - active.current_text(ProgressValue::PreferPrimary, ctx.now, false); + let text = active.current_text(ProgressValue::Primary, ctx.now, false); let font_size = scale * small_size; let font_scale = font_size / ui.current_font_size(); diff --git a/reffect/src/trigger/progress/active.rs b/reffect/src/trigger/progress/active.rs index 9830b46..cac5b84 100644 --- a/reffect/src/trigger/progress/active.rs +++ b/reffect/src/trigger/progress/active.rs @@ -200,14 +200,13 @@ impl ProgressActive { Self::Fixed { current, .. } => Some(current), Self::Buff { end, .. } => (end != u32::MAX).then(|| Self::time_between(now, end)), Self::Ability { - ammo, end, ammo_end, rate, .. } => Some(Self::time_between_scaled( now, - value.pick(ammo, end, ammo_end), + value.pick(end, ammo_end), rate, )), } @@ -225,14 +224,13 @@ impl ProgressActive { } } Self::Ability { - ammo, end, ammo_end, rate, .. } => Self::duration_text(Self::time_between_scaled( now, - value.pick(ammo, end, ammo_end), + value.pick(end, ammo_end), rate, )), } @@ -244,11 +242,10 @@ impl ProgressActive { Self::Fixed { max, .. } => max, Self::Buff { duration, .. } => duration, Self::Ability { - ammo, duration, ammo_duration, .. - } => value.pick(ammo, duration, ammo_duration), + } => value.pick(duration, ammo_duration), } } @@ -264,11 +261,10 @@ impl ProgressActive { } } Self::Ability { - ammo, duration, ammo_duration, .. - } => Self::format_seconds(value.pick(ammo, duration, ammo_duration)), + } => Self::format_seconds(value.pick(duration, ammo_duration)), } } @@ -319,12 +315,12 @@ pub enum ProgressValue { } impl ProgressValue { - pub fn pick(&self, intensity: u32, primary: u32, secondary: u32) -> u32 { + pub fn pick(&self, primary: u32, secondary: u32) -> u32 { match self { Self::Primary => primary, Self::Secondary => secondary, Self::PreferPrimary => { - if intensity > 0 { + if primary > 0 { primary } else { secondary diff --git a/reffect/src/trigger/progress/source.rs b/reffect/src/trigger/progress/source.rs index 339820b..9e60be1 100644 --- a/reffect/src/trigger/progress/source.rs +++ b/reffect/src/trigger/progress/source.rs @@ -152,7 +152,7 @@ impl ProgressSource { Validation::Confirm(format!("{category} {id} is valid")) } } - Ok(SkillInfo::Ability) => Validation::Error(format!("Id {id} is an ability")), + Ok(SkillInfo::Ability { .. }) => Validation::Error(format!("Id {id} is an ability")), Err(Error::SkillNotFound) => Validation::Error(format!("Id {id} is invalid or hidden")), Err(_) => Validation::Ok, } @@ -160,7 +160,7 @@ impl ProgressSource { fn ability_validate(id: u32) -> Validation> { match Internal::get_skill_info(id) { - Ok(SkillInfo::Ability) => Validation::Confirm(format!("Ability {id} is valid")), + Ok(SkillInfo::Ability { .. }) => Validation::Confirm(format!("Ability {id} is valid")), Ok(SkillInfo::Buff { .. }) => Validation::Error(format!("Id {id} is an effect")), Err(Error::SkillNotFound) => Validation::Error(format!("Id {id} is invalid or hidden")), Err(_) => Validation::Ok, diff --git a/reffect_api/src/skill.rs b/reffect_api/src/skill.rs index 8371460..1524f12 100644 --- a/reffect_api/src/skill.rs +++ b/reffect_api/src/skill.rs @@ -4,7 +4,10 @@ use strum::{AsRefStr, Display, IntoStaticStr}; #[derive(Debug, Clone)] pub enum SkillInfo { /// Ability. - Ability, + Ability { + /// Whether the ability is an ammunition skill. + is_ammo: bool, + }, /// Buff. Buff {