potion buff

This commit is contained in:
Monty Marz 2020-11-05 21:02:54 +01:00 committed by Snowram
parent 4b439e9b58
commit 642ad805a1
10 changed files with 30 additions and 5 deletions

View File

@ -5,7 +5,7 @@ ItemDef(
kind: "PotionLarge",
effect: [
Buff((
kind: Saturation,
kind: Potion,
data: (
strength: 1000.0,
duration: Some((

View File

@ -5,7 +5,7 @@ ItemDef(
kind: "PotionMed",
effect: [
Buff((
kind: Saturation,
kind: Potion,
data: (
strength: 700.0,
duration: Some((

View File

@ -5,7 +5,7 @@ ItemDef(
kind: "PotionMinor",
effect: [
Buff((
kind: Saturation,
kind: Potion,
data: (
strength: 500.0,
duration: Some((

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

Binary file not shown.

View File

@ -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

View File

@ -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,

View File

@ -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"),
};

View File

@ -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 {

View File

@ -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",

View File

@ -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