mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'juliancoffee/food_rework' into 'master'
Post-potion-animation food rework See merge request veloren/veloren!2535
This commit is contained in:
commit
370e0f8f24
@ -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
|
||||
|
||||
|
@ -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: (
|
||||
|
@ -1,9 +1,9 @@
|
||||
ItemDef(
|
||||
name: "Large Potion",
|
||||
description: "",
|
||||
description: "Precious medicine.",
|
||||
kind: Consumable(
|
||||
kind: Potion,
|
||||
effect: [
|
||||
kind: Drink,
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Potion,
|
||||
data: (
|
||||
|
@ -1,9 +1,9 @@
|
||||
ItemDef(
|
||||
name: "Medium Potion",
|
||||
description: "",
|
||||
description: "Enchanted healing flask.",
|
||||
kind: Consumable(
|
||||
kind: Potion,
|
||||
effect: [
|
||||
kind: Drink,
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Potion,
|
||||
data: (
|
||||
|
@ -1,9 +1,9 @@
|
||||
ItemDef(
|
||||
name: "Minor Potion",
|
||||
description: "",
|
||||
description: "Made of apples with love.",
|
||||
kind: Consumable(
|
||||
kind: Potion,
|
||||
effect: [
|
||||
kind: Drink,
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Potion,
|
||||
data: (
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Red and juicy",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 20.0,
|
||||
duration: Some((
|
||||
secs: 20,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -2,14 +2,25 @@ ItemDef(
|
||||
name: "Mushroom Curry",
|
||||
description: "Who could say no to that?",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
kind: ComplexFood,
|
||||
effects: [
|
||||
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,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "The stick makes it easier to carry!",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 10.0,
|
||||
strength: 50.0,
|
||||
duration: Some((
|
||||
secs: 25,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -2,14 +2,14 @@ ItemDef(
|
||||
name: "Cactus Colada",
|
||||
description: "Giving you that special prickle.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
kind: Drink,
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 10.0,
|
||||
strength: 50.0,
|
||||
duration: Some((
|
||||
secs: 25,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "An orange root vegetable. They say it'll improve your vision!",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Aromatic and nutritious",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 10.0,
|
||||
strength: 15.0,
|
||||
duration: Some((
|
||||
secs: 15,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ 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: (
|
||||
strength: 10.0,
|
||||
strength: 40.0,
|
||||
duration: Some((
|
||||
secs: 20,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A daisy-like flower often used in herbal teas.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A small, yellow flower. Uses the wind to spread its seeds.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Make sure to brush your teeth after eating.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A vibrant green leafy vegetable. Lettuce make some salads!",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,7 +3,7 @@ ItemDef(
|
||||
description: "Meat. The lifeblood of mankind.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
|
@ -3,7 +3,7 @@ ItemDef(
|
||||
description: "Medium Rare.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Chunk of beastly animal meat, best after cooking.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 15.0,
|
||||
strength: 4.5,
|
||||
duration: Some((
|
||||
secs: 3,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Medium Rare.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 19.0,
|
||||
strength: 15.0,
|
||||
duration: Some((
|
||||
secs: 8,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Small hunk of beastly animal meat, best after cooking.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 9.0,
|
||||
strength: 2.5,
|
||||
duration: Some((
|
||||
secs: 3,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,7 +3,7 @@ ItemDef(
|
||||
description: "Best enjoyed with one in each hand.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Makes for a legendary meal.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 32.0,
|
||||
strength: 55.0,
|
||||
duration: Some((
|
||||
secs: 25,
|
||||
secs: 15,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "It's magificent.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 30.0,
|
||||
strength: 9.0,
|
||||
duration: Some((
|
||||
secs: 3,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A hefty drumstick.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 15.0,
|
||||
strength: 4.5,
|
||||
duration: Some((
|
||||
secs: 3,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,7 +3,7 @@ ItemDef(
|
||||
description: "A fresh cooked seafood steak.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A steak chopped from a fish, best after cooking.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 15.0,
|
||||
strength: 4.5,
|
||||
duration: Some((
|
||||
secs: 3,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,7 +3,7 @@ ItemDef(
|
||||
description: "Tastes exotic.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Peculiar bit of meat, best after cooking.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 12.0,
|
||||
strength: 3.6,
|
||||
duration: Some((
|
||||
secs: 3,
|
||||
secs: 10,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Hopefully this one is not poisonous",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Roasted mushrooms on a stick for easy carrying",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 10.0,
|
||||
strength: 40.0,
|
||||
duration: Some((
|
||||
secs: 20,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A vegetable that's made the toughest men cry.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Literally just chopped lettuce. Does this even count as a salad?",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 20.0,
|
||||
duration: Some((
|
||||
secs: 20,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A herb commonly used in tea.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -2,8 +2,8 @@ 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,
|
||||
effect: [
|
||||
kind: ComplexFood,
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Frenzied,
|
||||
data: (
|
||||
|
@ -2,14 +2,14 @@ ItemDef(
|
||||
name: "Sunflower Ice Tea",
|
||||
description: "Brewed from freshly shelled sunflower seeds",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
kind: Drink,
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 10.0,
|
||||
strength: 100.0,
|
||||
duration: Some((
|
||||
secs: 50,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "A red fruit. Not actually a vegetable.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 5.0,
|
||||
strength: 10.0,
|
||||
duration: Some((
|
||||
secs: 10,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -3,13 +3,13 @@ ItemDef(
|
||||
description: "Leafy salad with some chopped, juicy tomatoes mixed in.",
|
||||
kind: Consumable(
|
||||
kind: Food,
|
||||
effect: [
|
||||
effects: [
|
||||
Buff((
|
||||
kind: Saturation,
|
||||
data: (
|
||||
strength: 10.0,
|
||||
strength: 30.0,
|
||||
duration: Some((
|
||||
secs: 15,
|
||||
secs: 5,
|
||||
nanos: 0,
|
||||
)),
|
||||
),
|
||||
|
@ -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),
|
||||
|
@ -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
|
||||
|
@ -251,7 +251,7 @@ pub enum ItemKind {
|
||||
Glider(Glider),
|
||||
Consumable {
|
||||
kind: ConsumableKind,
|
||||
effect: Vec<Effect>,
|
||||
effects: Vec<Effect>,
|
||||
},
|
||||
Throwable {
|
||||
kind: Throwable,
|
||||
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 => {},
|
||||
|
@ -285,8 +285,8 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
|
||||
&state.ecs().read_resource::<item::MaterialStatManifest>(),
|
||||
) {
|
||||
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, .. } => {
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -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),
|
||||
|
@ -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<String> {
|
||||
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user