From 8b9316a2c67d3c04542bc97488cc73b61b8d2af2 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Wed, 30 Jun 2021 22:05:48 +0300 Subject: [PATCH 1/8] Change Mortar and Pestle crafting recipe - Make it require bowl instead of coconut --- assets/common/recipe_book.ron | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/common/recipe_book.ron b/assets/common/recipe_book.ron index d394e82db8..cb6cb55f72 100644 --- a/assets/common/recipe_book.ron +++ b/assets/common/recipe_book.ron @@ -12,7 +12,7 @@ output: ("common.items.crafting_tools.mortar_pestle", 1), inputs: [ (Item("common.items.crafting_ing.stones"), 6), - (Item("common.items.food.coconut"), 1), + (Item("common.items.crafting_ing.bowl"), 1), (Item("common.items.tool.craftsman_hammer"), 0), ], craft_sprite: Some(CraftingBench), From c538a9696c5a19121fd80b2c3d51faf5b93486a1 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Wed, 30 Jun 2021 21:34:35 +0300 Subject: [PATCH 2/8] Use Food after Buildup + Remove Saturation effect by rolling + Remove Saturation effect if interrupted with poise + Rename Potion to Drink, add ComplexFood --- common/src/comp/inventory/item/mod.rs | 3 ++- common/src/states/use_item.rs | 23 +++++++++++++++++------ common/systems/src/character_behavior.rs | 6 +++++- voxygen/anim/src/character/consume.rs | 4 ++-- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index bc1ba38f25..9e2b30e12c 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -271,8 +271,9 @@ pub enum ItemKind { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum ConsumableKind { - Potion, + Drink, Food, + ComplexFood, } impl ItemKind { diff --git a/common/src/states/use_item.rs b/common/src/states/use_item.rs index 1df7960fa5..fd0e5bbae5 100644 --- a/common/src/states/use_item.rs +++ b/common/src/states/use_item.rs @@ -51,19 +51,21 @@ impl CharacterBehavior for Data { let mut update = StateUpdate::from(data); match self.static_data.item_kind { - ItemUseKind::Consumable(ConsumableKind::Potion) => { + ItemUseKind::Consumable(ConsumableKind::Drink) => { handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, 1.0); }, - ItemUseKind::Consumable(ConsumableKind::Food) => { + ItemUseKind::Consumable(ConsumableKind::Food | ConsumableKind::ComplexFood) => { handle_orientation(data, &mut update, 0.0); handle_move(data, &mut update, 0.0); }, } let use_point = match self.static_data.item_kind { - ItemUseKind::Consumable(ConsumableKind::Potion) => UsePoint::BuildupUse, - ItemUseKind::Consumable(ConsumableKind::Food) => UsePoint::UseRecover, + ItemUseKind::Consumable(ConsumableKind::Drink | ConsumableKind::Food) => { + UsePoint::BuildupUse + }, + ItemUseKind::Consumable(ConsumableKind::ComplexFood) => UsePoint::UseRecover, }; match self.stage_section { @@ -138,11 +140,15 @@ impl CharacterBehavior for Data { handle_state_interrupt(data, &mut update, false); if matches!(update.character, CharacterState::Roll(_)) { - // Remove potion effect if left the use item state early by rolling + // Remove potion/saturation effect if left the use item state early by rolling update.server_events.push_front(ServerEvent::Buff { entity: data.entity, buff_change: BuffChange::RemoveByKind(BuffKind::Potion), }); + update.server_events.push_front(ServerEvent::Buff { + entity: data.entity, + buff_change: BuffChange::RemoveByKind(BuffKind::Saturation), + }); } update @@ -168,7 +174,7 @@ impl ItemUseKind { /// Returns (buildup, use, recover) pub fn durations(&self) -> (Duration, Duration, Duration) { match self { - Self::Consumable(ConsumableKind::Potion) => ( + Self::Consumable(ConsumableKind::Drink) => ( Duration::from_secs_f32(0.1), Duration::from_secs_f32(1.1), Duration::from_secs_f32(0.1), @@ -178,6 +184,11 @@ impl ItemUseKind { Duration::from_secs_f32(5.0), Duration::from_secs_f32(0.5), ), + Self::Consumable(ConsumableKind::ComplexFood) => ( + Duration::from_secs_f32(1.0), + Duration::from_secs_f32(5.0), + Duration::from_secs_f32(0.5), + ), } } } diff --git a/common/systems/src/character_behavior.rs b/common/systems/src/character_behavior.rs index b6915984e7..82ceccf652 100644 --- a/common/systems/src/character_behavior.rs +++ b/common/systems/src/character_behavior.rs @@ -165,13 +165,17 @@ impl<'a> System<'a> for Sys { let was_wielded = char_state.get_unchecked().is_wield(); let poise_state = poise.poise_state(); let pos = pos.0; - // Remove potion buff if knocked into poise state + // Remove potion/saturation buff if knocked into poise state if !matches!(poise_state, PoiseState::Normal) { use comp::buff::{BuffChange, BuffKind}; server_emitter.emit(ServerEvent::Buff { entity, buff_change: BuffChange::RemoveByKind(BuffKind::Potion), }); + server_emitter.emit(ServerEvent::Buff { + entity, + buff_change: BuffChange::RemoveByKind(BuffKind::Saturation), + }); } match poise_state { PoiseState::Normal => {}, diff --git a/voxygen/anim/src/character/consume.rs b/voxygen/anim/src/character/consume.rs index b76f8d5468..5b25c93bbc 100644 --- a/voxygen/anim/src/character/consume.rs +++ b/voxygen/anim/src/character/consume.rs @@ -27,7 +27,7 @@ impl Animation for ConsumeAnimation { let mut next = (*skeleton).clone(); match item_kind { - Some(ItemUseKind::Consumable(ConsumableKind::Potion)) => { + Some(ItemUseKind::Consumable(ConsumableKind::Drink)) => { let (move1, move2, move3) = match stage_section { Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), Some(StageSection::Use) => (1.0, (anim_time * 8.0).sin(), 0.0), @@ -56,7 +56,7 @@ impl Animation for ConsumeAnimation { next.hand_l.orientation = Quaternion::rotation_x(move1 * 0.8) * Quaternion::rotation_y(move1 * -0.5); }, - Some(ItemUseKind::Consumable(ConsumableKind::Food)) => { + Some(ItemUseKind::Consumable(ConsumableKind::Food | ConsumableKind::ComplexFood)) => { let (move1, move2, move3) = match stage_section { Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), Some(StageSection::Use) => (1.0, (anim_time * 12.0).sin(), 0.0), From eb61b23d0459e43cbf7b3f1ed153085d6f921638 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Wed, 30 Jun 2021 23:48:13 +0300 Subject: [PATCH 3/8] Rebalance food for new consumables changes --- assets/common/items/consumable/potion_big.ron | 2 +- assets/common/items/consumable/potion_med.ron | 2 +- assets/common/items/consumable/potion_minor.ron | 2 +- assets/common/items/food/apple.ron | 4 ++-- .../common/items/food/apple_mushroom_curry.ron | 17 ++++++++++++++--- assets/common/items/food/apple_stick.ron | 4 ++-- assets/common/items/food/cactus_colada.ron | 6 +++--- assets/common/items/food/carrot.ron | 4 ++-- assets/common/items/food/cheese.ron | 4 ++-- assets/common/items/food/coconut.ron | 4 ++-- assets/common/items/food/coltsfoot.ron | 4 ++-- assets/common/items/food/dandelion.ron | 4 ++-- assets/common/items/food/garlic.ron | 4 ++-- assets/common/items/food/lettuce.ron | 4 ++-- .../items/food/meat/beast_large_cooked.ron | 4 ++-- .../common/items/food/meat/beast_large_raw.ron | 4 ++-- .../items/food/meat/beast_small_cooked.ron | 4 ++-- .../common/items/food/meat/beast_small_raw.ron | 4 ++-- assets/common/items/food/meat/bird_cooked.ron | 4 ++-- .../items/food/meat/bird_large_cooked.ron | 4 ++-- .../common/items/food/meat/bird_large_raw.ron | 4 ++-- assets/common/items/food/meat/bird_raw.ron | 4 ++-- assets/common/items/food/meat/fish_cooked.ron | 4 ++-- assets/common/items/food/meat/fish_raw.ron | 4 ++-- assets/common/items/food/meat/tough_cooked.ron | 4 ++-- assets/common/items/food/meat/tough_raw.ron | 4 ++-- assets/common/items/food/mushroom.ron | 4 ++-- assets/common/items/food/mushroom_stick.ron | 4 ++-- assets/common/items/food/onion.ron | 4 ++-- assets/common/items/food/plainsalad.ron | 4 ++-- assets/common/items/food/sage.ron | 4 ++-- assets/common/items/food/spore_corruption.ron | 2 +- assets/common/items/food/sunflower_icetea.ron | 6 +++--- assets/common/items/food/tomato.ron | 4 ++-- assets/common/items/food/tomatosalad.ron | 4 ++-- 35 files changed, 80 insertions(+), 69 deletions(-) diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index 71cd4243a7..487206c222 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -2,7 +2,7 @@ ItemDef( name: "Large Potion", description: "", kind: Consumable( - kind: Potion, + kind: Drink, effect: [ Buff(( kind: Potion, diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index 87c127cfce..d0d64c03c3 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -2,7 +2,7 @@ ItemDef( name: "Medium Potion", description: "", kind: Consumable( - kind: Potion, + kind: Drink, effect: [ Buff(( kind: Potion, diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index a7b5706847..ea3e76debf 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -2,7 +2,7 @@ ItemDef( name: "Minor Potion", description: "", kind: Consumable( - kind: Potion, + kind: Drink, effect: [ Buff(( kind: Potion, diff --git a/assets/common/items/food/apple.ron b/assets/common/items/food/apple.ron index d6a0316865..c55d36de55 100644 --- a/assets/common/items/food/apple.ron +++ b/assets/common/items/food/apple.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 20.0, duration: Some(( - secs: 20, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/apple_mushroom_curry.ron b/assets/common/items/food/apple_mushroom_curry.ron index 16fd5924b6..078a706930 100644 --- a/assets/common/items/food/apple_mushroom_curry.ron +++ b/assets/common/items/food/apple_mushroom_curry.ron @@ -2,14 +2,25 @@ ItemDef( name: "Mushroom Curry", description: "Who could say no to that?", kind: Consumable( - kind: Food, + kind: ComplexFood, effect: [ Buff(( kind: Saturation, data: ( - strength: 15.0, + strength: 100.0, duration: Some(( - secs: 80, + secs: 5, + nanos: 0, + )), + ), + cat_ids: [Natural], + )), + Buff(( + kind: Regeneration, + data: ( + strength: 10.0, + duration: Some(( + secs: 70, nanos: 0, )), ), diff --git a/assets/common/items/food/apple_stick.ron b/assets/common/items/food/apple_stick.ron index 6ed79bafbd..d42eb216da 100644 --- a/assets/common/items/food/apple_stick.ron +++ b/assets/common/items/food/apple_stick.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 10.0, + strength: 50.0, duration: Some(( - secs: 25, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/cactus_colada.ron b/assets/common/items/food/cactus_colada.ron index 7b8711e806..9eb97fe43e 100644 --- a/assets/common/items/food/cactus_colada.ron +++ b/assets/common/items/food/cactus_colada.ron @@ -2,14 +2,14 @@ ItemDef( name: "Cactus Colada", description: "Giving you that special prickle.", kind: Consumable( - kind: Food, + kind: Drink, effect: [ Buff(( kind: Saturation, data: ( - strength: 10.0, + strength: 50.0, duration: Some(( - secs: 25, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/carrot.ron b/assets/common/items/food/carrot.ron index f0e5886d8b..38853ac127 100644 --- a/assets/common/items/food/carrot.ron +++ b/assets/common/items/food/carrot.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/cheese.ron b/assets/common/items/food/cheese.ron index 0b4c501ca5..406e048d8b 100644 --- a/assets/common/items/food/cheese.ron +++ b/assets/common/items/food/cheese.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 10.0, + strength: 30.0, duration: Some(( - secs: 15, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/coconut.ron b/assets/common/items/food/coconut.ron index 265127256f..6fcef657e0 100644 --- a/assets/common/items/food/coconut.ron +++ b/assets/common/items/food/coconut.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 10.0, + strength: 40.0, duration: Some(( - secs: 20, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/coltsfoot.ron b/assets/common/items/food/coltsfoot.ron index e802299a9e..5e30d94430 100644 --- a/assets/common/items/food/coltsfoot.ron +++ b/assets/common/items/food/coltsfoot.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/dandelion.ron b/assets/common/items/food/dandelion.ron index 339abfafdc..e6a3d334bc 100644 --- a/assets/common/items/food/dandelion.ron +++ b/assets/common/items/food/dandelion.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/garlic.ron b/assets/common/items/food/garlic.ron index 478c954146..be8493b7d5 100644 --- a/assets/common/items/food/garlic.ron +++ b/assets/common/items/food/garlic.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/lettuce.ron b/assets/common/items/food/lettuce.ron index 45bab6a156..25bee72caf 100644 --- a/assets/common/items/food/lettuce.ron +++ b/assets/common/items/food/lettuce.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_large_cooked.ron b/assets/common/items/food/meat/beast_large_cooked.ron index e464c3fa79..adcd36e952 100644 --- a/assets/common/items/food/meat/beast_large_cooked.ron +++ b/assets/common/items/food/meat/beast_large_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 25.0, + strength: 50.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_large_raw.ron b/assets/common/items/food/meat/beast_large_raw.ron index 19f6dfc974..b160ba22ba 100644 --- a/assets/common/items/food/meat/beast_large_raw.ron +++ b/assets/common/items/food/meat/beast_large_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 15.0, + strength: 9.0, duration: Some(( - secs: 3, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_small_cooked.ron b/assets/common/items/food/meat/beast_small_cooked.ron index 13833e6c5c..474caddd36 100644 --- a/assets/common/items/food/meat/beast_small_cooked.ron +++ b/assets/common/items/food/meat/beast_small_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 19.0, + strength: 30.0, duration: Some(( - secs: 8, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_small_raw.ron b/assets/common/items/food/meat/beast_small_raw.ron index 377cc90e6d..c147bc2798 100644 --- a/assets/common/items/food/meat/beast_small_raw.ron +++ b/assets/common/items/food/meat/beast_small_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 9.0, + strength: 5.0, duration: Some(( - secs: 3, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_cooked.ron b/assets/common/items/food/meat/bird_cooked.ron index bee712ce23..8aede55dc7 100644 --- a/assets/common/items/food/meat/bird_cooked.ron +++ b/assets/common/items/food/meat/bird_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 25.0, + strength: 50.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_large_cooked.ron b/assets/common/items/food/meat/bird_large_cooked.ron index d63ca774d7..00081a8730 100644 --- a/assets/common/items/food/meat/bird_large_cooked.ron +++ b/assets/common/items/food/meat/bird_large_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 32.0, + strength: 160.0, duration: Some(( - secs: 25, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_large_raw.ron b/assets/common/items/food/meat/bird_large_raw.ron index b55479245b..b54389f36e 100644 --- a/assets/common/items/food/meat/bird_large_raw.ron +++ b/assets/common/items/food/meat/bird_large_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 30.0, + strength: 18.0, duration: Some(( - secs: 3, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_raw.ron b/assets/common/items/food/meat/bird_raw.ron index 234a0c58f6..4feb3db030 100644 --- a/assets/common/items/food/meat/bird_raw.ron +++ b/assets/common/items/food/meat/bird_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 15.0, + strength: 9.0, duration: Some(( - secs: 3, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/fish_cooked.ron b/assets/common/items/food/meat/fish_cooked.ron index de01e9305c..ed4c83579a 100644 --- a/assets/common/items/food/meat/fish_cooked.ron +++ b/assets/common/items/food/meat/fish_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 25.0, + strength: 50.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/fish_raw.ron b/assets/common/items/food/meat/fish_raw.ron index a454192290..730808377f 100644 --- a/assets/common/items/food/meat/fish_raw.ron +++ b/assets/common/items/food/meat/fish_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 15.0, + strength: 9.0, duration: Some(( - secs: 3, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/tough_cooked.ron b/assets/common/items/food/meat/tough_cooked.ron index 34563112fe..b575a7f934 100644 --- a/assets/common/items/food/meat/tough_cooked.ron +++ b/assets/common/items/food/meat/tough_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 20.0, + strength: 40.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/tough_raw.ron b/assets/common/items/food/meat/tough_raw.ron index 548160e875..d9c75d0d59 100644 --- a/assets/common/items/food/meat/tough_raw.ron +++ b/assets/common/items/food/meat/tough_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 12.0, + strength: 7.2, duration: Some(( - secs: 3, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/mushroom.ron b/assets/common/items/food/mushroom.ron index e5b4f1c23f..255b04e111 100644 --- a/assets/common/items/food/mushroom.ron +++ b/assets/common/items/food/mushroom.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/mushroom_stick.ron b/assets/common/items/food/mushroom_stick.ron index ab42bf6059..f6ba282de5 100644 --- a/assets/common/items/food/mushroom_stick.ron +++ b/assets/common/items/food/mushroom_stick.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 10.0, + strength: 40.0, duration: Some(( - secs: 20, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/onion.ron b/assets/common/items/food/onion.ron index e37c5c23b1..f07d61c8ef 100644 --- a/assets/common/items/food/onion.ron +++ b/assets/common/items/food/onion.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/plainsalad.ron b/assets/common/items/food/plainsalad.ron index 514ed65d10..3693776fb1 100644 --- a/assets/common/items/food/plainsalad.ron +++ b/assets/common/items/food/plainsalad.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 20.0, duration: Some(( - secs: 20, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/sage.ron b/assets/common/items/food/sage.ron index 76535df51a..b54c851eee 100644 --- a/assets/common/items/food/sage.ron +++ b/assets/common/items/food/sage.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/spore_corruption.ron b/assets/common/items/food/spore_corruption.ron index 17ff0a7ce8..9d0e65ef5a 100644 --- a/assets/common/items/food/spore_corruption.ron +++ b/assets/common/items/food/spore_corruption.ron @@ -2,7 +2,7 @@ ItemDef( name: "Spore of Corruption", description: "You feel an evil force pulsating within.\n\nIt may be unwise to hold on to it for too long...", kind: Consumable( - kind: Food, + kind: ComplexFood, effect: [ Buff(( kind: Frenzied, diff --git a/assets/common/items/food/sunflower_icetea.ron b/assets/common/items/food/sunflower_icetea.ron index 9e30bbf2ad..6e05c847ee 100644 --- a/assets/common/items/food/sunflower_icetea.ron +++ b/assets/common/items/food/sunflower_icetea.ron @@ -2,14 +2,14 @@ ItemDef( name: "Sunflower Ice Tea", description: "Brewed from freshly shelled sunflower seeds", kind: Consumable( - kind: Food, + kind: Drink, effect: [ Buff(( kind: Saturation, data: ( - strength: 10.0, + strength: 100.0, duration: Some(( - secs: 50, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/tomato.ron b/assets/common/items/food/tomato.ron index 80da6495ef..00d8ddfc42 100644 --- a/assets/common/items/food/tomato.ron +++ b/assets/common/items/food/tomato.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 10.0, duration: Some(( - secs: 10, + secs: 5, nanos: 0, )), ), diff --git a/assets/common/items/food/tomatosalad.ron b/assets/common/items/food/tomatosalad.ron index 0842a003de..fe90256e3b 100644 --- a/assets/common/items/food/tomatosalad.ron +++ b/assets/common/items/food/tomatosalad.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 10.0, + strength: 30.0, duration: Some(( - secs: 15, + secs: 5, nanos: 0, )), ), From d4c61ae2f31bd8cd9d5f751264dcee44788b0f43 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Wed, 30 Jun 2021 23:48:30 +0300 Subject: [PATCH 4/8] (voxygen) Better support for multibuff items + change `effect` field in ItemKind::Consumable to `effects`, as it's set of effects and not single effect. --- assets/common/items/boss_drops/potions.ron | 4 +- assets/common/items/consumable/potion_big.ron | 2 +- assets/common/items/consumable/potion_med.ron | 2 +- .../common/items/consumable/potion_minor.ron | 2 +- assets/common/items/food/apple.ron | 2 +- .../items/food/apple_mushroom_curry.ron | 2 +- assets/common/items/food/apple_stick.ron | 2 +- assets/common/items/food/cactus_colada.ron | 2 +- assets/common/items/food/carrot.ron | 2 +- assets/common/items/food/cheese.ron | 2 +- assets/common/items/food/coconut.ron | 2 +- assets/common/items/food/coltsfoot.ron | 2 +- assets/common/items/food/dandelion.ron | 2 +- assets/common/items/food/garlic.ron | 2 +- assets/common/items/food/lettuce.ron | 2 +- assets/common/items/food/meat.ron | 2 +- .../items/food/meat/beast_large_cooked.ron | 2 +- .../items/food/meat/beast_large_raw.ron | 2 +- .../items/food/meat/beast_small_cooked.ron | 2 +- .../items/food/meat/beast_small_raw.ron | 2 +- assets/common/items/food/meat/bird_cooked.ron | 2 +- .../items/food/meat/bird_large_cooked.ron | 2 +- .../common/items/food/meat/bird_large_raw.ron | 2 +- assets/common/items/food/meat/bird_raw.ron | 2 +- assets/common/items/food/meat/fish_cooked.ron | 2 +- assets/common/items/food/meat/fish_raw.ron | 2 +- .../common/items/food/meat/tough_cooked.ron | 2 +- assets/common/items/food/meat/tough_raw.ron | 2 +- assets/common/items/food/mushroom.ron | 2 +- assets/common/items/food/mushroom_stick.ron | 2 +- assets/common/items/food/onion.ron | 2 +- assets/common/items/food/plainsalad.ron | 2 +- assets/common/items/food/sage.ron | 2 +- assets/common/items/food/spore_corruption.ron | 2 +- assets/common/items/food/sunflower_icetea.ron | 2 +- assets/common/items/food/tomato.ron | 2 +- assets/common/items/food/tomatosalad.ron | 2 +- common/src/comp/inventory/item/mod.rs | 2 +- common/src/comp/inventory/trade_pricing.rs | 8 +- server/src/events/inventory_manip.rs | 4 +- server/src/sys/agent.rs | 6 +- voxygen/src/hud/util.rs | 52 ++++++++--- voxygen/src/ui/widgets/item_tooltip.rs | 90 ++++++------------- 43 files changed, 119 insertions(+), 119 deletions(-) diff --git a/assets/common/items/boss_drops/potions.ron b/assets/common/items/boss_drops/potions.ron index bccc411161..d1e43691d9 100644 --- a/assets/common/items/boss_drops/potions.ron +++ b/assets/common/items/boss_drops/potions.ron @@ -2,8 +2,8 @@ ItemDef( name: "Potent Potion", description: "A potent healing potion.", kind: Consumable( - kind: Potion, - effect: [ + kind: Drink, + effects: [ Buff(( kind: Potion, data: ( diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index 487206c222..b764679cf8 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -3,7 +3,7 @@ ItemDef( description: "", kind: Consumable( kind: Drink, - effect: [ + effects: [ Buff(( kind: Potion, data: ( diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index d0d64c03c3..ab65a31465 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -3,7 +3,7 @@ ItemDef( description: "", kind: Consumable( kind: Drink, - effect: [ + effects: [ Buff(( kind: Potion, data: ( diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index ea3e76debf..f7afeb164e 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -3,7 +3,7 @@ ItemDef( description: "", kind: Consumable( kind: Drink, - effect: [ + effects: [ Buff(( kind: Potion, data: ( diff --git a/assets/common/items/food/apple.ron b/assets/common/items/food/apple.ron index c55d36de55..8ad3069011 100644 --- a/assets/common/items/food/apple.ron +++ b/assets/common/items/food/apple.ron @@ -3,7 +3,7 @@ ItemDef( description: "Red and juicy", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/apple_mushroom_curry.ron b/assets/common/items/food/apple_mushroom_curry.ron index 078a706930..f98c61d942 100644 --- a/assets/common/items/food/apple_mushroom_curry.ron +++ b/assets/common/items/food/apple_mushroom_curry.ron @@ -3,7 +3,7 @@ ItemDef( description: "Who could say no to that?", kind: Consumable( kind: ComplexFood, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/apple_stick.ron b/assets/common/items/food/apple_stick.ron index d42eb216da..c8596c90cc 100644 --- a/assets/common/items/food/apple_stick.ron +++ b/assets/common/items/food/apple_stick.ron @@ -3,7 +3,7 @@ ItemDef( description: "The stick makes it easier to carry!", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/cactus_colada.ron b/assets/common/items/food/cactus_colada.ron index 9eb97fe43e..e974721a78 100644 --- a/assets/common/items/food/cactus_colada.ron +++ b/assets/common/items/food/cactus_colada.ron @@ -3,7 +3,7 @@ ItemDef( description: "Giving you that special prickle.", kind: Consumable( kind: Drink, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/carrot.ron b/assets/common/items/food/carrot.ron index 38853ac127..96fba22146 100644 --- a/assets/common/items/food/carrot.ron +++ b/assets/common/items/food/carrot.ron @@ -3,7 +3,7 @@ ItemDef( description: "An orange root vegetable. They say it'll improve your vision!", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/cheese.ron b/assets/common/items/food/cheese.ron index 406e048d8b..ccc674a8ec 100644 --- a/assets/common/items/food/cheese.ron +++ b/assets/common/items/food/cheese.ron @@ -3,7 +3,7 @@ ItemDef( description: "Aromatic and nutritious", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/coconut.ron b/assets/common/items/food/coconut.ron index 6fcef657e0..2a161e1bf6 100644 --- a/assets/common/items/food/coconut.ron +++ b/assets/common/items/food/coconut.ron @@ -3,7 +3,7 @@ ItemDef( description: "Reliable source of water and fat.\n\nNaturally growing at the top of palm trees.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/coltsfoot.ron b/assets/common/items/food/coltsfoot.ron index 5e30d94430..5cf2795ee8 100644 --- a/assets/common/items/food/coltsfoot.ron +++ b/assets/common/items/food/coltsfoot.ron @@ -3,7 +3,7 @@ ItemDef( description: "A daisy-like flower often used in herbal teas.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/dandelion.ron b/assets/common/items/food/dandelion.ron index e6a3d334bc..7b9f7fd8e3 100644 --- a/assets/common/items/food/dandelion.ron +++ b/assets/common/items/food/dandelion.ron @@ -3,7 +3,7 @@ ItemDef( description: "A small, yellow flower. Uses the wind to spread its seeds.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/garlic.ron b/assets/common/items/food/garlic.ron index be8493b7d5..a55159d5c5 100644 --- a/assets/common/items/food/garlic.ron +++ b/assets/common/items/food/garlic.ron @@ -3,7 +3,7 @@ ItemDef( description: "Make sure to brush your teeth after eating.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/lettuce.ron b/assets/common/items/food/lettuce.ron index 25bee72caf..1d8c5a3c03 100644 --- a/assets/common/items/food/lettuce.ron +++ b/assets/common/items/food/lettuce.ron @@ -3,7 +3,7 @@ ItemDef( description: "A vibrant green leafy vegetable. Lettuce make some salads!", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat.ron b/assets/common/items/food/meat.ron index 221fb5182f..84fcd698e8 100644 --- a/assets/common/items/food/meat.ron +++ b/assets/common/items/food/meat.ron @@ -3,7 +3,7 @@ ItemDef( description: "Meat. The lifeblood of mankind.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/beast_large_cooked.ron b/assets/common/items/food/meat/beast_large_cooked.ron index adcd36e952..6e8650b15d 100644 --- a/assets/common/items/food/meat/beast_large_cooked.ron +++ b/assets/common/items/food/meat/beast_large_cooked.ron @@ -3,7 +3,7 @@ ItemDef( description: "Medium Rare.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/beast_large_raw.ron b/assets/common/items/food/meat/beast_large_raw.ron index b160ba22ba..79aea5c67c 100644 --- a/assets/common/items/food/meat/beast_large_raw.ron +++ b/assets/common/items/food/meat/beast_large_raw.ron @@ -3,7 +3,7 @@ ItemDef( description: "Chunk of beastly animal meat, best after cooking.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/beast_small_cooked.ron b/assets/common/items/food/meat/beast_small_cooked.ron index 474caddd36..7f5d04f9a9 100644 --- a/assets/common/items/food/meat/beast_small_cooked.ron +++ b/assets/common/items/food/meat/beast_small_cooked.ron @@ -3,7 +3,7 @@ ItemDef( description: "Medium Rare.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/beast_small_raw.ron b/assets/common/items/food/meat/beast_small_raw.ron index c147bc2798..7573c6f108 100644 --- a/assets/common/items/food/meat/beast_small_raw.ron +++ b/assets/common/items/food/meat/beast_small_raw.ron @@ -3,7 +3,7 @@ ItemDef( description: "Small hunk of beastly animal meat, best after cooking.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/bird_cooked.ron b/assets/common/items/food/meat/bird_cooked.ron index 8aede55dc7..34d096b5d6 100644 --- a/assets/common/items/food/meat/bird_cooked.ron +++ b/assets/common/items/food/meat/bird_cooked.ron @@ -3,7 +3,7 @@ ItemDef( description: "Best enjoyed with one in each hand.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/bird_large_cooked.ron b/assets/common/items/food/meat/bird_large_cooked.ron index 00081a8730..1f8593776f 100644 --- a/assets/common/items/food/meat/bird_large_cooked.ron +++ b/assets/common/items/food/meat/bird_large_cooked.ron @@ -3,7 +3,7 @@ ItemDef( description: "Makes for a legendary meal.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/bird_large_raw.ron b/assets/common/items/food/meat/bird_large_raw.ron index b54389f36e..7bcfb67469 100644 --- a/assets/common/items/food/meat/bird_large_raw.ron +++ b/assets/common/items/food/meat/bird_large_raw.ron @@ -3,7 +3,7 @@ ItemDef( description: "It's magificent.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/bird_raw.ron b/assets/common/items/food/meat/bird_raw.ron index 4feb3db030..0c9b0508d9 100644 --- a/assets/common/items/food/meat/bird_raw.ron +++ b/assets/common/items/food/meat/bird_raw.ron @@ -3,7 +3,7 @@ ItemDef( description: "A hefty drumstick.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/fish_cooked.ron b/assets/common/items/food/meat/fish_cooked.ron index ed4c83579a..0042d1fbf7 100644 --- a/assets/common/items/food/meat/fish_cooked.ron +++ b/assets/common/items/food/meat/fish_cooked.ron @@ -3,7 +3,7 @@ ItemDef( description: "A fresh cooked seafood steak.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/fish_raw.ron b/assets/common/items/food/meat/fish_raw.ron index 730808377f..e2dd887b82 100644 --- a/assets/common/items/food/meat/fish_raw.ron +++ b/assets/common/items/food/meat/fish_raw.ron @@ -3,7 +3,7 @@ ItemDef( description: "A steak chopped from a fish, best after cooking.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/tough_cooked.ron b/assets/common/items/food/meat/tough_cooked.ron index b575a7f934..450e673fd0 100644 --- a/assets/common/items/food/meat/tough_cooked.ron +++ b/assets/common/items/food/meat/tough_cooked.ron @@ -3,7 +3,7 @@ ItemDef( description: "Tastes exotic.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/meat/tough_raw.ron b/assets/common/items/food/meat/tough_raw.ron index d9c75d0d59..0114539484 100644 --- a/assets/common/items/food/meat/tough_raw.ron +++ b/assets/common/items/food/meat/tough_raw.ron @@ -3,7 +3,7 @@ ItemDef( description: "Peculiar bit of meat, best after cooking.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/mushroom.ron b/assets/common/items/food/mushroom.ron index 255b04e111..8d90dff0c5 100644 --- a/assets/common/items/food/mushroom.ron +++ b/assets/common/items/food/mushroom.ron @@ -3,7 +3,7 @@ ItemDef( description: "Hopefully this one is not poisonous", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/mushroom_stick.ron b/assets/common/items/food/mushroom_stick.ron index f6ba282de5..e19c0f1ef6 100644 --- a/assets/common/items/food/mushroom_stick.ron +++ b/assets/common/items/food/mushroom_stick.ron @@ -3,7 +3,7 @@ ItemDef( description: "Roasted mushrooms on a stick for easy carrying", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/onion.ron b/assets/common/items/food/onion.ron index f07d61c8ef..023a1f9f7d 100644 --- a/assets/common/items/food/onion.ron +++ b/assets/common/items/food/onion.ron @@ -3,7 +3,7 @@ ItemDef( description: "A vegetable that's made the toughest men cry.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/plainsalad.ron b/assets/common/items/food/plainsalad.ron index 3693776fb1..21f8412201 100644 --- a/assets/common/items/food/plainsalad.ron +++ b/assets/common/items/food/plainsalad.ron @@ -3,7 +3,7 @@ ItemDef( description: "Literally just chopped lettuce. Does this even count as a salad?", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/sage.ron b/assets/common/items/food/sage.ron index b54c851eee..38c46a67bf 100644 --- a/assets/common/items/food/sage.ron +++ b/assets/common/items/food/sage.ron @@ -3,7 +3,7 @@ ItemDef( description: "A herb commonly used in tea.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/spore_corruption.ron b/assets/common/items/food/spore_corruption.ron index 9d0e65ef5a..f847f81e59 100644 --- a/assets/common/items/food/spore_corruption.ron +++ b/assets/common/items/food/spore_corruption.ron @@ -3,7 +3,7 @@ ItemDef( description: "You feel an evil force pulsating within.\n\nIt may be unwise to hold on to it for too long...", kind: Consumable( kind: ComplexFood, - effect: [ + effects: [ Buff(( kind: Frenzied, data: ( diff --git a/assets/common/items/food/sunflower_icetea.ron b/assets/common/items/food/sunflower_icetea.ron index 6e05c847ee..7c74fd904a 100644 --- a/assets/common/items/food/sunflower_icetea.ron +++ b/assets/common/items/food/sunflower_icetea.ron @@ -3,7 +3,7 @@ ItemDef( description: "Brewed from freshly shelled sunflower seeds", kind: Consumable( kind: Drink, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/tomato.ron b/assets/common/items/food/tomato.ron index 00d8ddfc42..c1fde8cd6f 100644 --- a/assets/common/items/food/tomato.ron +++ b/assets/common/items/food/tomato.ron @@ -3,7 +3,7 @@ ItemDef( description: "A red fruit. Not actually a vegetable.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/assets/common/items/food/tomatosalad.ron b/assets/common/items/food/tomatosalad.ron index fe90256e3b..4bf41d8f8a 100644 --- a/assets/common/items/food/tomatosalad.ron +++ b/assets/common/items/food/tomatosalad.ron @@ -3,7 +3,7 @@ ItemDef( description: "Leafy salad with some chopped, juicy tomatoes mixed in.", kind: Consumable( kind: Food, - effect: [ + effects: [ Buff(( kind: Saturation, data: ( diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index 9e2b30e12c..7861660d60 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -251,7 +251,7 @@ pub enum ItemKind { Glider(Glider), Consumable { kind: ConsumableKind, - effect: Vec, + effects: Vec, }, Throwable { kind: Throwable, diff --git a/common/src/comp/inventory/trade_pricing.rs b/common/src/comp/inventory/trade_pricing.rs index b75f5dad26..b8ea4298ee 100644 --- a/common/src/comp/inventory/trade_pricing.rs +++ b/common/src/comp/inventory/trade_pricing.rs @@ -526,8 +526,8 @@ impl TradePricing { } }); printvec("Potions", &self.potions.entries, |i, p| { - if let ItemKind::Consumable { kind: _, effect } = &i.kind { - effect + if let ItemKind::Consumable { kind: _, effects } = &i.kind { + effects .iter() .map(|e| { if let crate::effect::Effect::Buff(b) = e { @@ -543,8 +543,8 @@ impl TradePricing { } }); printvec("Food", &self.food.entries, |i, p| { - if let ItemKind::Consumable { kind: _, effect } = &i.kind { - effect + if let ItemKind::Consumable { kind: _, effects } = &i.kind { + effects .iter() .map(|e| { if let crate::effect::Effect::Buff(b) = e { diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index c2243e9395..7a29c7caae 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -285,8 +285,8 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv &state.ecs().read_resource::(), ) { match item.kind() { - ItemKind::Consumable { effect, .. } => { - maybe_effect = Some(effect.clone()); + ItemKind::Consumable { effects, .. } => { + maybe_effect = Some(effects.clone()); Some(comp::InventoryUpdateEvent::Consumed(item.name().to_owned())) }, ItemKind::Throwable { kind, .. } => { diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index f141b59cca..f8696a0b87 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -1452,10 +1452,10 @@ impl<'a> AgentData<'a> { let mut value = 0; #[allow(clippy::single_match)] match item.kind() { - ItemKind::Consumable { effect, .. } => { - for e in effect.iter() { + ItemKind::Consumable { effects, .. } => { + for effect in effects.iter() { use BuffKind::*; - match e { + match effect { Effect::Health(HealthChange { amount, .. }) => { value += *amount; }, diff --git a/voxygen/src/hud/util.rs b/voxygen/src/hud/util.rs index 5f9f15142b..39b67f9056 100644 --- a/voxygen/src/hud/util.rs +++ b/voxygen/src/hud/util.rs @@ -4,7 +4,7 @@ use common::{ item::{ armor::{Armor, ArmorKind, Protection}, tool::{Hands, StatKind, Stats, Tool, ToolKind}, - Item, ItemKind, MaterialKind, MaterialStatManifest, ModularComponent, + Item, ItemDesc, ItemKind, MaterialKind, MaterialStatManifest, ModularComponent, }, BuffKind, }, @@ -104,10 +104,41 @@ pub fn modular_component_desc( result } -pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String { - let mut description = String::new(); +pub fn stats_count(item: &dyn ItemDesc) -> usize { + let mut count = match item.kind() { + ItemKind::Armor(armor) => { + if matches!(armor.kind, ArmorKind::Bag(_)) { + 0 + } else { + 5 + } + }, + ItemKind::Tool(_) => 4, + ItemKind::Consumable { effects, .. } => effects.len(), + ItemKind::ModularComponent { .. } => 1, + _ => 0, + }; + + let is_bag = match item.kind() { + ItemKind::Armor(armor) => matches!(armor.kind, ArmorKind::Bag(_)), + _ => false, + }; + if item.num_slots() != 0 && !is_bag { + count += 1 + } + count as usize +} + +/// Takes N `effects` and returns N effect descriptions +/// If effect isn't intended to have description, returns empty string +/// +/// FIXME: handle which effects should have description in `stats_count` +/// to not waste space in item box +pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> Vec { + let mut descriptions = Vec::new(); for effect in effects { + let mut description = String::new(); if let Effect::Buff(buff) = effect { let strength = buff.data.strength * 0.1; let dur_secs = buff.data.duration.map(|d| d.as_secs_f32()); @@ -116,13 +147,13 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String { let buff_desc = match buff.kind { BuffKind::Saturation | BuffKind::Regeneration | BuffKind::Potion => i18n .get("buff.stat.health") - .replace("{str_total}", &*format!("{:.1}", &str_total)), + .replace("{str_total}", &str_total.to_string()), BuffKind::IncreaseMaxEnergy => i18n .get("buff.stat.increase_max_stamina") - .replace("{strength}", &*format!("{:.1}", &strength)), + .replace("{strength}", &strength.to_string()), BuffKind::IncreaseMaxHealth => i18n .get("buff.stat.increase_max_health") - .replace("{strength}", &*format!("{:.1}", &strength)), + .replace("{strength}", &strength.to_string()), BuffKind::Invulnerability => i18n.get("buff.stat.invulnerability").to_string(), BuffKind::Bleeding | BuffKind::Burning @@ -133,7 +164,7 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String { | BuffKind::Frenzied | BuffKind::Frozen | BuffKind::Wet - | BuffKind::Ensnared => continue, + | BuffKind::Ensnared => "".to_owned(), }; write!(&mut description, "{}", buff_desc).unwrap(); @@ -158,19 +189,20 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String { | BuffKind::Frenzied | BuffKind::Frozen | BuffKind::Wet - | BuffKind::Ensnared => continue, + | BuffKind::Ensnared => "".to_owned(), } } else if let BuffKind::Saturation | BuffKind::Regeneration = buff.kind { i18n.get("buff.text.every_second").to_string() } else { - continue; + "".to_owned() }; write!(&mut description, " {}", dur_desc).unwrap(); } + descriptions.push(description); } - description + descriptions } // Armor diff --git a/voxygen/src/ui/widgets/item_tooltip.rs b/voxygen/src/ui/widgets/item_tooltip.rs index c1a64ed74b..656aec8519 100644 --- a/voxygen/src/ui/widgets/item_tooltip.rs +++ b/voxygen/src/ui/widgets/item_tooltip.rs @@ -427,26 +427,6 @@ impl<'a> Widget for ItemTooltip<'a> { .. } = args; - fn stats_count(item: &dyn ItemDesc) -> usize { - let is_bag = matches!(item.kind(), ItemKind::Armor(armor) if matches!(armor.kind, ArmorKind::Bag(_))); - let mut count = match item.kind() { - ItemKind::Armor(armor) => { - if matches!(armor.kind, ArmorKind::Bag(_)) { - 0 - } else { - 5 - } - }, - ItemKind::Tool(_) => 4, - ItemKind::Consumable { .. } => 1, - _ => 0, - }; - if item.num_slots() != 0 && !is_bag { - count += 1 - } - count as usize - } - let i18n = &self.localized_strings; let inventories = self.client.inventories(); @@ -503,13 +483,13 @@ impl<'a> Widget for ItemTooltip<'a> { state.update(|s| { s.ids .stats - .resize(stats_count(item), &mut ui.widget_id_generator()) + .resize(util::stats_count(item), &mut ui.widget_id_generator()) }); state.update(|s| { s.ids .diffs - .resize(stats_count(item), &mut ui.widget_id_generator()) + .resize(util::stats_count(item), &mut ui.widget_id_generator()) }); // Background image frame @@ -936,15 +916,28 @@ impl<'a> Widget for ItemTooltip<'a> { } } }, - ItemKind::Consumable { effect, .. } => { - widget::Text::new(&util::consumable_desc(effect, i18n)) - .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) - .graphics_for(id) - .parent(id) - .with_style(self.style.desc) - .color(text_color) - .down_from(state.ids.item_frame, V_PAD) - .set(state.ids.stats[0], ui); + ItemKind::Consumable { effects, .. } => { + for (i, desc) in util::consumable_desc(effects, i18n).iter().enumerate() { + if i == 0 { + widget::Text::new(desc) + .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) + .graphics_for(id) + .parent(id) + .with_style(self.style.desc) + .color(text_color) + .down_from(state.ids.item_frame, V_PAD) + .set(state.ids.stats[0], ui); + } else { + widget::Text::new(desc) + .x_align_to(state.ids.item_frame, conrod_core::position::Align::Start) + .graphics_for(id) + .parent(id) + .with_style(self.style.desc) + .color(text_color) + .down_from(state.ids.stats[i - 1], V_PAD_STATS) + .set(state.ids.stats[i], ui); + } + } }, ItemKind::ModularComponent(mc) => { widget::Text::new(&util::modular_component_desc( @@ -973,7 +966,7 @@ impl<'a> Widget for ItemTooltip<'a> { .with_style(self.style.desc) .color(conrod_core::color::GREY) .down_from( - if stats_count(item) > 0 { + if util::stats_count(item) > 0 { state.ids.stats[state.ids.stats.len() - 1] } else { state.ids.item_frame @@ -997,7 +990,7 @@ impl<'a> Widget for ItemTooltip<'a> { .down_from( if !desc.is_empty() { state.ids.desc - } else if stats_count(item) > 0 { + } else if util::stats_count(item) > 0 { state.ids.stats[state.ids.stats.len() - 1] } else { state.ids.item_frame @@ -1039,31 +1032,6 @@ impl<'a> Widget for ItemTooltip<'a> { fn default_x_dimension(&self, _ui: &Ui) -> Dimension { Dimension::Absolute(260.0) } fn default_y_dimension(&self, ui: &Ui) -> Dimension { - fn stats_count(item: &dyn ItemDesc) -> usize { - let mut count = match item.kind() { - ItemKind::Armor(armor) => { - if matches!(armor.kind, ArmorKind::Bag(_)) { - 0 - } else { - 5 - } - }, - ItemKind::Tool(_) => 4, - ItemKind::Consumable { .. } => 1, - ItemKind::ModularComponent { .. } => 1, - _ => 0, - }; - - let is_bag = match item.kind() { - ItemKind::Armor(armor) => matches!(armor.kind, ArmorKind::Bag(_)), - _ => false, - }; - if item.num_slots() != 0 && !is_bag { - count += 1 - } - count as usize - } - let item = &self.item; let (title, desc) = (item.name().to_string(), item.description().to_string()); @@ -1082,13 +1050,13 @@ impl<'a> Widget for ItemTooltip<'a> { let frame_h = ICON_SIZE[1] + V_PAD; // Stats - let stat_h = if stats_count(self.item) > 0 { + let stat_h = if util::stats_count(self.item) > 0 { widget::Text::new(&"placeholder".to_string()) .with_style(self.style.desc) .get_h(ui) .unwrap_or(0.0) - * stats_count(self.item) as f64 - + (stats_count(self.item) - 1) as f64 * V_PAD_STATS + * util::stats_count(self.item) as f64 + + (util::stats_count(self.item) - 1) as f64 * V_PAD_STATS + V_PAD } else { 0.0 From e6ed0137e8f72a2d63bc49a7062f29a456137bff Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Thu, 1 Jul 2021 01:56:07 +0300 Subject: [PATCH 5/8] Add descriptions to the potions --- assets/common/items/consumable/potion_big.ron | 2 +- assets/common/items/consumable/potion_med.ron | 2 +- assets/common/items/consumable/potion_minor.ron | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index b764679cf8..e194375023 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -1,6 +1,6 @@ ItemDef( name: "Large Potion", - description: "", + description: "Precious medicine.", kind: Consumable( kind: Drink, effects: [ diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index ab65a31465..a374857233 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -1,6 +1,6 @@ ItemDef( name: "Medium Potion", - description: "", + description: "Enchanted healing flask.", kind: Consumable( kind: Drink, effects: [ diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index f7afeb164e..d74d72ccb1 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -1,6 +1,6 @@ ItemDef( name: "Minor Potion", - description: "", + description: "Made of apples with love.", kind: Consumable( kind: Drink, effects: [ From 21d10b641b89fa8cce622b064983b4a7111c6ad9 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Thu, 1 Jul 2021 02:50:43 +0300 Subject: [PATCH 6/8] Add new food to consumables /kit --- assets/server/manifests/kits.ron | 36 ++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/assets/server/manifests/kits.ron b/assets/server/manifests/kits.ron index 2b0c8b0da2..bf3ed02c9e 100644 --- a/assets/server/manifests/kits.ron +++ b/assets/server/manifests/kits.ron @@ -7,10 +7,42 @@ ("common.items.debug.admin",1), ], "consumables": [ - ("common.items.consumable.potion_minor", 100), - ("common.items.consumable.potion_med", 100), ("common.items.consumable.potion_big", 100), + ("common.items.consumable.potion_med", 100), + ("common.items.consumable.potion_minor", 100), + ("common.items.food.apple", 100), ("common.items.food.apple_mushroom_curry", 100), + ("common.items.food.apple_stick", 100), + ("common.items.food.cactus_colada", 100), + ("common.items.food.carrot", 100), + ("common.items.food.cheese", 100), + ("common.items.food.coconut", 100), + //("common.items.food.coltsfoot", 100), + //("common.items.food.dandelion", 100), + //("common.items.food.garlic", 100), + ("common.items.food.lettuce", 100), + //("common.items.food.meat", 100), + ("common.items.food.meat.beast_large_cooked", 100), + ("common.items.food.meat.beast_large_raw", 100), + ("common.items.food.meat.beast_small_cooked", 100), + ("common.items.food.meat.beast_small_raw", 100), + ("common.items.food.meat.bird_cooked", 100), + ("common.items.food.meat.bird_large_cooked", 100), + ("common.items.food.meat.bird_large_raw", 100), + ("common.items.food.meat.bird_raw", 100), + ("common.items.food.meat.fish_cooked", 100), + ("common.items.food.meat.fish_raw", 100), + ("common.items.food.meat.tough_cooked", 100), + ("common.items.food.meat.tough_raw", 100), + ("common.items.food.mushroom", 100), + ("common.items.food.mushroom_stick", 100), + //("common.items.food.onion", 100), + ("common.items.food.plainsalad", 100), + //("common.items.food.sage", 100), + ("common.items.food.spore_corruption", 100), + ("common.items.food.sunflower_icetea", 100), + ("common.items.food.tomato", 100), + ("common.items.food.tomatosalad", 100), ], "jewellery": [ // TODO: remove duplicates and handle quantity of non-stackable items From b70e19148380e361fc7e82ea2090c4fc942b4846 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Mon, 5 Jul 2021 00:16:28 +0300 Subject: [PATCH 7/8] Bump some food duration to 10 seconds --- assets/common/items/food/cheese.ron | 4 ++-- assets/common/items/food/meat/beast_large_cooked.ron | 4 ++-- assets/common/items/food/meat/beast_large_raw.ron | 4 ++-- assets/common/items/food/meat/beast_small_cooked.ron | 4 ++-- assets/common/items/food/meat/beast_small_raw.ron | 4 ++-- assets/common/items/food/meat/bird_cooked.ron | 4 ++-- assets/common/items/food/meat/bird_large_cooked.ron | 4 ++-- assets/common/items/food/meat/bird_large_raw.ron | 4 ++-- assets/common/items/food/meat/bird_raw.ron | 4 ++-- assets/common/items/food/meat/fish_cooked.ron | 4 ++-- assets/common/items/food/meat/fish_raw.ron | 4 ++-- assets/common/items/food/meat/tough_cooked.ron | 4 ++-- assets/common/items/food/meat/tough_raw.ron | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/assets/common/items/food/cheese.ron b/assets/common/items/food/cheese.ron index ccc674a8ec..14d90da42c 100644 --- a/assets/common/items/food/cheese.ron +++ b/assets/common/items/food/cheese.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 30.0, + strength: 15.0, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_large_cooked.ron b/assets/common/items/food/meat/beast_large_cooked.ron index 6e8650b15d..7ed2859b32 100644 --- a/assets/common/items/food/meat/beast_large_cooked.ron +++ b/assets/common/items/food/meat/beast_large_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 50.0, + strength: 25.0, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_large_raw.ron b/assets/common/items/food/meat/beast_large_raw.ron index 79aea5c67c..fdba37c8fa 100644 --- a/assets/common/items/food/meat/beast_large_raw.ron +++ b/assets/common/items/food/meat/beast_large_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 9.0, + strength: 4.5, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_small_cooked.ron b/assets/common/items/food/meat/beast_small_cooked.ron index 7f5d04f9a9..a80752320a 100644 --- a/assets/common/items/food/meat/beast_small_cooked.ron +++ b/assets/common/items/food/meat/beast_small_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 30.0, + strength: 15.0, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/beast_small_raw.ron b/assets/common/items/food/meat/beast_small_raw.ron index 7573c6f108..900a9e3e91 100644 --- a/assets/common/items/food/meat/beast_small_raw.ron +++ b/assets/common/items/food/meat/beast_small_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 5.0, + strength: 2.5, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_cooked.ron b/assets/common/items/food/meat/bird_cooked.ron index 34d096b5d6..19d5988751 100644 --- a/assets/common/items/food/meat/bird_cooked.ron +++ b/assets/common/items/food/meat/bird_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 50.0, + strength: 25.0, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_large_cooked.ron b/assets/common/items/food/meat/bird_large_cooked.ron index 1f8593776f..e1cdb09299 100644 --- a/assets/common/items/food/meat/bird_large_cooked.ron +++ b/assets/common/items/food/meat/bird_large_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 160.0, + strength: 55.0, duration: Some(( - secs: 5, + secs: 15, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_large_raw.ron b/assets/common/items/food/meat/bird_large_raw.ron index 7bcfb67469..84cf93691c 100644 --- a/assets/common/items/food/meat/bird_large_raw.ron +++ b/assets/common/items/food/meat/bird_large_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 18.0, + strength: 9.0, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/bird_raw.ron b/assets/common/items/food/meat/bird_raw.ron index 0c9b0508d9..4c4ba428dd 100644 --- a/assets/common/items/food/meat/bird_raw.ron +++ b/assets/common/items/food/meat/bird_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 9.0, + strength: 4.5, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/fish_cooked.ron b/assets/common/items/food/meat/fish_cooked.ron index 0042d1fbf7..c1545af513 100644 --- a/assets/common/items/food/meat/fish_cooked.ron +++ b/assets/common/items/food/meat/fish_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 50.0, + strength: 25.0, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/fish_raw.ron b/assets/common/items/food/meat/fish_raw.ron index e2dd887b82..80c789cbfc 100644 --- a/assets/common/items/food/meat/fish_raw.ron +++ b/assets/common/items/food/meat/fish_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 9.0, + strength: 4.5, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/tough_cooked.ron b/assets/common/items/food/meat/tough_cooked.ron index 450e673fd0..8297c66909 100644 --- a/assets/common/items/food/meat/tough_cooked.ron +++ b/assets/common/items/food/meat/tough_cooked.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 40.0, + strength: 20.0, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), diff --git a/assets/common/items/food/meat/tough_raw.ron b/assets/common/items/food/meat/tough_raw.ron index 0114539484..16b837135e 100644 --- a/assets/common/items/food/meat/tough_raw.ron +++ b/assets/common/items/food/meat/tough_raw.ron @@ -7,9 +7,9 @@ ItemDef( Buff(( kind: Saturation, data: ( - strength: 7.2, + strength: 3.6, duration: Some(( - secs: 5, + secs: 10, nanos: 0, )), ), From 47aa3719654986a282418c876a058d4965039f7b Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Mon, 5 Jul 2021 00:30:16 +0300 Subject: [PATCH 8/8] Update CHANGELOG with food rework --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2acc3447d3..b2052076ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Death particles and SFX - Default keybindings were made more consistent - Adjust Yeti difficulty +- Now most of the food gives Saturation in the process of eating +- Mushroom Curry gives long-lasting Regeneration buff ### Removed