adjusted combo counter anim

This commit is contained in:
Monty
2021-03-05 11:12:44 +01:00
committed by Sam
parent 940b4b5de7
commit 49fcd6ee13
6 changed files with 28 additions and 22 deletions

BIN
assets/voxygen/element/icons/lifesteal.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -3249,7 +3249,7 @@ impl<'a> Widget for Diary<'a> {
// 5 1 6 // 5 1 6
// 3 0 4 // 3 0 4
// 8 2 7 // 8 2 7
Button::image(self.imgs.heal_0) Button::image(self.imgs.skill_sceptre_heal)
.w_h(74.0, 74.0) .w_h(74.0, 74.0)
.mid_top_with_margin_on(state.skills_top_l[0], 3.0) .mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip( .with_tooltip(
@ -3422,7 +3422,7 @@ impl<'a> Widget for Diary<'a> {
{ {
events.push(Event::UnlockSkill(skill)); events.push(Event::UnlockSkill(skill));
}; };
Button::image(self.imgs.heal_bomb) Button::image(self.imgs.skill_sceptre_heal)
.w_h(74.0, 74.0) .w_h(74.0, 74.0)
.mid_top_with_margin_on(state.skills_top_r[0], 3.0) .mid_top_with_margin_on(state.skills_top_r[0], 3.0)
.with_tooltip( .with_tooltip(

View File

@ -446,12 +446,13 @@ image_ids! {
// Icons // Icons
snake_arrow_0: "voxygen.element.icons.snake", snake_arrow_0: "voxygen.element.icons.snake",
heal_0: "voxygen.element.icons.heal_0", skill_sceptre_lifesteal: "voxygen.element.icons.lifesteal",
sword_whirlwind: "voxygen.element.icons.sword_whirlwind", sword_whirlwind: "voxygen.element.icons.sword_whirlwind",
heal_bomb: "voxygen.element.icons.heal_bomb", skill_sceptre_heal: "voxygen.element.icons.heal_0",
hammerleap: "voxygen.element.icons.skill_hammerleap", hammerleap: "voxygen.element.icons.skill_hammerleap",
skill_axe_leap_slash: "voxygen.element.icons.skill_axe_leap_slash", skill_axe_leap_slash: "voxygen.element.icons.skill_axe_leap_slash",
skill_bow_jump_burst: "voxygen.element.icons.skill_bow_jump_burst", skill_bow_jump_burst: "voxygen.element.icons.skill_bow_jump_burst",
skill_sceptre_aura: "voxygen.element.icons.heal_bomb",
missing_icon: "voxygen.element.icons.missing_icon_grey", missing_icon: "voxygen.element.icons.missing_icon_grey",
// Buttons // Buttons

View File

@ -585,7 +585,7 @@ impl<'a> Widget for Skillbar<'a> {
ToolKind::Hammer => self.imgs.twohhammer_m1, ToolKind::Hammer => self.imgs.twohhammer_m1,
ToolKind::Axe => self.imgs.twohaxe_m1, ToolKind::Axe => self.imgs.twohaxe_m1,
ToolKind::Bow => self.imgs.bow_m1, ToolKind::Bow => self.imgs.bow_m1,
ToolKind::Sceptre => self.imgs.heal_0, ToolKind::Sceptre => self.imgs.skill_sceptre_lifesteal,
ToolKind::Staff => self.imgs.fireball, ToolKind::Staff => self.imgs.fireball,
ToolKind::Debug => self.imgs.flyingrod_m1, ToolKind::Debug => self.imgs.flyingrod_m1,
_ => self.imgs.nothing, _ => self.imgs.nothing,
@ -632,7 +632,7 @@ impl<'a> Widget for Skillbar<'a> {
Some(ToolKind::Hammer) => self.imgs.hammergolf, Some(ToolKind::Hammer) => self.imgs.hammergolf,
Some(ToolKind::Axe) => self.imgs.axespin, Some(ToolKind::Axe) => self.imgs.axespin,
Some(ToolKind::Bow) => self.imgs.bow_m2, Some(ToolKind::Bow) => self.imgs.bow_m2,
Some(ToolKind::Sceptre) => self.imgs.heal_bomb, Some(ToolKind::Sceptre) => self.imgs.skill_sceptre_heal,
Some(ToolKind::Staff) => self.imgs.flamethrower, Some(ToolKind::Staff) => self.imgs.flamethrower,
Some(ToolKind::Debug) => self.imgs.flyingrod_m2, Some(ToolKind::Debug) => self.imgs.flyingrod_m2,
_ => self.imgs.nothing, _ => self.imgs.nothing,
@ -926,37 +926,32 @@ impl<'a> Widget for Skillbar<'a> {
let combo_txt = format!("{} Combo", combo.combo); let combo_txt = format!("{} Combo", combo.combo);
let combo_cnt = combo.combo as f32; let combo_cnt = combo.combo as f32;
let time_since_last_update = comp::combo::COMBO_DECAY_START - combo.timer; let time_since_last_update = comp::combo::COMBO_DECAY_START - combo.timer;
let alpha = (1.0 - time_since_last_update * tweak!(0.2)).min(1.0) as f32;
let fnt_col = Color::Rgba( let fnt_col = Color::Rgba(
// White -> Yellow -> Red text color gradient depending on count // White -> Yellow -> Red text color gradient depending on count
(1.0 - combo_cnt / (combo_cnt + tweak!(1.0))).max(0.79), (1.0 - combo_cnt / (combo_cnt + tweak!(20.0))).max(0.79),
(1.0 - combo_cnt / (combo_cnt + tweak!(80.0))).max(0.19), (1.0 - combo_cnt / (combo_cnt + tweak!(80.0))).max(0.19),
(1.0 - combo_cnt / (combo_cnt + tweak!(5.0))).max(0.17), (1.0 - combo_cnt / (combo_cnt + tweak!(5.0))).max(0.17),
(time_since_last_update - 8.0).min(1.0) as f32, alpha,
); );
let fnt_size = ((14.0 + combo.timer as f32 * tweak!(0.5)).min(tweak!(20.0))) as u32 let fnt_size = ((14.0 + combo.timer as f32 * tweak!(0.8)).min(tweak!(30.0))) as u32
+ if (time_since_last_update - 12.0) < 1.0 { + if (time_since_last_update) < tweak!(0.1) {
1 tweak!(2)
} else { } else {
0 0
}; // Increase size for higher counts, "flash" on update by increasing the font size by 2 }; // Increase size for higher counts, "flash" on update by increasing the font size by 2
//dbg!(combo); // Delete this before merging
Rectangle::fill_with([10.0, 10.0], color::TRANSPARENT) Rectangle::fill_with([10.0, 10.0], color::TRANSPARENT)
.middle_of(ui.window) .middle_of(ui.window)
.set(state.ids.combo_align, ui); .set(state.ids.combo_align, ui);
Text::new(combo_txt.as_str()) Text::new(combo_txt.as_str())
.mid_bottom_with_margin_on( .mid_bottom_with_margin_on(
state.ids.combo_align, state.ids.combo_align,
tweak!(-350.0) + time_since_last_update * tweak!(4.0) - 8.0, tweak!(-350.0) + time_since_last_update * tweak!(-8.0),
) )
.font_size(self.fonts.cyri.scale(fnt_size)) .font_size(self.fonts.cyri.scale(fnt_size))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba( .color(Color::Rgba(0.0, 0.0, 0.0, alpha))
0.0,
0.0,
0.0,
(time_since_last_update - 8.0).min(1.0) as f32,
))
.set(state.ids.combo_bg, ui); .set(state.ids.combo_bg, ui);
Text::new(combo_txt.as_str()) Text::new(combo_txt.as_str())
.bottom_right_with_margins_on(state.ids.combo_bg, 1.0, 1.0) .bottom_right_with_margins_on(state.ids.combo_bg, 1.0, 1.0)

View File

@ -116,6 +116,7 @@ pub enum HotbarImage {
HammerLeap, HammerLeap,
AxeLeapSlash, AxeLeapSlash,
BowJumpBurst, BowJumpBurst,
SceptreAura,
} }
type HotbarSource<'a> = ( type HotbarSource<'a> = (
@ -239,6 +240,7 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
HotbarImage::HammerLeap => vec![imgs.hammerleap], HotbarImage::HammerLeap => vec![imgs.hammerleap],
HotbarImage::AxeLeapSlash => vec![imgs.skill_axe_leap_slash], HotbarImage::AxeLeapSlash => vec![imgs.skill_axe_leap_slash],
HotbarImage::BowJumpBurst => vec![imgs.skill_bow_jump_burst], HotbarImage::BowJumpBurst => vec![imgs.skill_bow_jump_burst],
HotbarImage::SceptreAura => vec![imgs.skill_sceptre_aura],
} }
} }
} }
@ -268,6 +270,7 @@ fn hotbar_image(tool: ToolKind) -> Option<HotbarImage> {
ToolKind::Bow => Some(HotbarImage::BowJumpBurst), ToolKind::Bow => Some(HotbarImage::BowJumpBurst),
ToolKind::Debug => Some(HotbarImage::SnakeArrow), ToolKind::Debug => Some(HotbarImage::SnakeArrow),
ToolKind::Sword => Some(HotbarImage::SwordWhirlwind), ToolKind::Sword => Some(HotbarImage::SwordWhirlwind),
ToolKind::Sceptre => Some(HotbarImage::SceptreAura),
_ => None, _ => None,
} }
} }

View File

@ -107,7 +107,10 @@ fn consumable_desc(effects: &[Effect], desc: &str) -> String {
format!("Raises Maximum Health by {}", strength) format!("Raises Maximum Health by {}", strength)
}, },
BuffKind::Invulnerability => "Grants invulnerability".to_string(), BuffKind::Invulnerability => "Grants invulnerability".to_string(),
BuffKind::Bleeding | BuffKind::CampfireHeal | BuffKind::Cursed => continue, BuffKind::Bleeding
| BuffKind::CampfireHeal
| BuffKind::Cursed
| BuffKind::ProtectingWard => continue,
}; };
write!(&mut description, "\n\n{}", buff_desc).unwrap(); write!(&mut description, "\n\n{}", buff_desc).unwrap();
@ -125,7 +128,8 @@ fn consumable_desc(effects: &[Effect], desc: &str) -> String {
BuffKind::Bleeding BuffKind::Bleeding
| BuffKind::Potion | BuffKind::Potion
| BuffKind::CampfireHeal | BuffKind::CampfireHeal
| BuffKind::Cursed => continue, | BuffKind::Cursed
| BuffKind::ProtectingWard => continue,
} }
} else if let BuffKind::Saturation | BuffKind::Regeneration = buff.kind { } else if let BuffKind::Saturation | BuffKind::Regeneration = buff.kind {
"every second".to_string() "every second".to_string()