From 642ad805a1d3f1e3e15b8b463f74b06a95eabff6 Mon Sep 17 00:00:00 2001 From: Monty Marz Date: Thu, 5 Nov 2020 21:02:54 +0100 Subject: [PATCH] potion buff --- assets/common/items/consumable/potion_big.ron | 2 +- assets/common/items/consumable/potion_med.ron | 2 +- assets/common/items/consumable/potion_minor.ron | 2 +- .../element/icons/de_buffs/buff_potion_0.png | 3 +++ assets/voxygen/i18n/en.ron | 2 ++ common/src/comp/buff.rs | 7 +++++-- voxygen/src/hud/buffs.rs | 14 ++++++++++++++ voxygen/src/hud/group.rs | 1 + voxygen/src/hud/img_ids.rs | 1 + voxygen/src/hud/overhead.rs | 1 + 10 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 assets/voxygen/element/icons/de_buffs/buff_potion_0.png diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index d5849b7926..f16bab60e6 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -5,7 +5,7 @@ ItemDef( kind: "PotionLarge", effect: [ Buff(( - kind: Saturation, + kind: Potion, data: ( strength: 1000.0, duration: Some(( diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index 081b87cdff..2c3167d58b 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -5,7 +5,7 @@ ItemDef( kind: "PotionMed", effect: [ Buff(( - kind: Saturation, + kind: Potion, data: ( strength: 700.0, duration: Some(( diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index 7794c253e1..f829d67b1e 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -5,7 +5,7 @@ ItemDef( kind: "PotionMinor", effect: [ Buff(( - kind: Saturation, + kind: Potion, data: ( strength: 500.0, duration: Some(( diff --git a/assets/voxygen/element/icons/de_buffs/buff_potion_0.png b/assets/voxygen/element/icons/de_buffs/buff_potion_0.png new file mode 100644 index 0000000000..7841b4d6ed --- /dev/null +++ b/assets/voxygen/element/icons/de_buffs/buff_potion_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e61d80856e9aa65dbc042fa4744918eb93ffac385b7850d7bcfc588438b1d095 +size 2139 diff --git a/assets/voxygen/i18n/en.ron b/assets/voxygen/i18n/en.ron index 754d19d5d2..eb88b34d47 100644 --- a/assets/voxygen/i18n/en.ron +++ b/assets/voxygen/i18n/en.ron @@ -522,6 +522,8 @@ Protection // Buffs "buff.title.heal": "Heal", "buff.desc.heal": "Gain health over time.", + "buff.title.potion": "Potion", + "buff.desc.potion": "Drinking...", "buff.title.saturation": "Saturation", "buff.desc.saturation": "Gain health over time from consumables.", // Debuffs diff --git a/common/src/comp/buff.rs b/common/src/comp/buff.rs index 0b01ac387b..605c0aa5b8 100644 --- a/common/src/comp/buff.rs +++ b/common/src/comp/buff.rs @@ -17,6 +17,8 @@ pub enum BuffKind { /// Lower a creature's max health /// Currently placeholder buff to show other stuff is possible Cursed, + // Applied when drinking a potion + Potion, } impl BuffKind { @@ -27,6 +29,7 @@ impl BuffKind { BuffKind::Saturation { .. } => true, BuffKind::Bleeding { .. } => false, BuffKind::Cursed { .. } => false, + BuffKind::Potion {..} => true, } } } @@ -124,13 +127,13 @@ impl Buff { }], data.duration, ), - BuffKind::Regeneration | BuffKind::Saturation => ( + BuffKind::Regeneration | BuffKind::Saturation | BuffKind::Potion => ( vec![BuffEffect::HealthChangeOverTime { rate: data.strength, accumulated: 0.0, }], data.duration, - ), + ), BuffKind::Cursed => ( vec![BuffEffect::MaxHealthModifier { value: -100. * data.strength, diff --git a/voxygen/src/hud/buffs.rs b/voxygen/src/hud/buffs.rs index 6e1e86f34f..da15858f8e 100644 --- a/voxygen/src/hud/buffs.rs +++ b/voxygen/src/hud/buffs.rs @@ -183,6 +183,7 @@ impl<'a> Widget for BuffsBar<'a> { let buff_img = match buff.kind { BuffKind::Regeneration { .. } => self.imgs.buff_plus_0, BuffKind::Saturation { .. } => self.imgs.buff_saturation_0, + BuffKind::Potion { .. } => self.imgs.buff_potion_0, _ => self.imgs.missing_icon, }; let buff_widget = Image::new(buff_img).w_h(20.0, 20.0); @@ -209,6 +210,9 @@ impl<'a> Widget for BuffsBar<'a> { BuffKind::Saturation { .. } => { localized_strings.get("buff.title.saturation") }, + BuffKind::Potion { .. } => { + localized_strings.get("buff.title.potion") + }, _ => localized_strings.get("buff.title.missing"), }; let remaining_time = if current_duration.is_none() { @@ -222,6 +226,9 @@ impl<'a> Widget for BuffsBar<'a> { BuffKind::Saturation { .. } => { localized_strings.get("buff.desc.saturation") }, + BuffKind::Potion { .. } => { + localized_strings.get("buff.desc.potion") + }, _ => localized_strings.get("buff.desc.missing"), }; let desc = format!("{}\n\n{}\n\n{}", desc_txt, remaining_time, click_to_remove); @@ -381,6 +388,7 @@ impl<'a> Widget for BuffsBar<'a> { BuffKind::Saturation { .. } => self.imgs.buff_saturation_0, BuffKind::Bleeding { .. } => self.imgs.debuff_bleed_0, BuffKind::Cursed { .. } => self.imgs.debuff_skull_0, + BuffKind::Potion { .. } => self.imgs.buff_potion_0, }; let buff_widget = Image::new(buff_img).w_h(40.0, 40.0); // Sort buffs into rows of 6 slots @@ -406,6 +414,9 @@ impl<'a> Widget for BuffsBar<'a> { BuffKind::Saturation { .. } => { localized_strings.get("buff.title.saturation") }, + BuffKind::Potion { .. } => { + localized_strings.get("buff.title.potion") + }, BuffKind::Bleeding { .. } => localized_strings.get("debuff.title.bleed"), _ => localized_strings.get("buff.title.missing"), }; @@ -420,6 +431,9 @@ impl<'a> Widget for BuffsBar<'a> { BuffKind::Saturation { .. } => { localized_strings.get("buff.desc.saturation") }, + BuffKind::Potion { .. } => { + localized_strings.get("buff.desc.potion") + }, BuffKind::Bleeding { .. } => localized_strings.get("debuff.desc.bleed"), _ => localized_strings.get("buff.desc.missing"), }; diff --git a/voxygen/src/hud/group.rs b/voxygen/src/hud/group.rs index 516e36046e..6e12c18fed 100644 --- a/voxygen/src/hud/group.rs +++ b/voxygen/src/hud/group.rs @@ -485,6 +485,7 @@ impl<'a> Widget for Group<'a> { BuffKind::Saturation { .. } => self.imgs.buff_saturation_0, BuffKind::Bleeding { .. } => self.imgs.debuff_bleed_0, BuffKind::Cursed { .. } => self.imgs.debuff_skull_0, + BuffKind::Potion { .. } => self.imgs.buff_potion_0, }; let buff_widget = Image::new(buff_img).w_h(15.0, 15.0); let buff_widget = if let Some(id) = prev_id { diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index fe7c495b64..48a42cd860 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -353,6 +353,7 @@ image_ids! { // Buffs buff_plus_0: "voxygen.element.icons.de_buffs.buff_plus_0", buff_saturation_0: "voxygen.element.icons.de_buffs.buff_saturation_0", + buff_potion_0: "voxygen.element.icons.de_buffs.buff_potion_0", // Debuffs debuff_skull_0: "voxygen.element.icons.de_buffs.debuff_skull_0", diff --git a/voxygen/src/hud/overhead.rs b/voxygen/src/hud/overhead.rs index 202082bf29..8d592a3501 100644 --- a/voxygen/src/hud/overhead.rs +++ b/voxygen/src/hud/overhead.rs @@ -246,6 +246,7 @@ impl<'a> Widget for Overhead<'a> { BuffKind::Saturation { .. } => self.imgs.buff_saturation_0, BuffKind::Bleeding { .. } => self.imgs.debuff_bleed_0, BuffKind::Cursed { .. } => self.imgs.debuff_skull_0, + BuffKind::Potion { .. } => self.imgs.buff_potion_0, }; let buff_widget = Image::new(buff_img).w_h(20.0, 20.0); // Sort buffs into rows of 5 slots