From 060b8cc0ece2130df8d2ad61808da33ea3a2c521 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Wed, 18 Jan 2023 16:17:24 -0500 Subject: [PATCH] Decrease the duration of potion sickness to 45 seconds. Make agents more averse to incurring further stacks of potion sickness, and give villagers iced tea. --- assets/common/entity/village/alchemist.ron | 3 ++- assets/common/entity/village/blacksmith.ron | 3 ++- assets/common/entity/village/chef.ron | 3 ++- assets/common/entity/village/guard.ron | 3 ++- assets/common/entity/village/mountaineer.ron | 3 ++- assets/common/entity/village/villager.ron | 3 ++- assets/common/entity/world/traveler0.ron | 3 ++- assets/common/entity/world/traveler1.ron | 3 ++- assets/common/entity/world/traveler2.ron | 3 ++- assets/common/entity/world/traveler3.ron | 1 + assets/common/items/boss_drops/potions.ron | 2 +- assets/common/items/consumable/potion_big.ron | 2 +- assets/common/items/consumable/potion_med.ron | 2 +- assets/common/items/consumable/potion_minor.ron | 2 +- server/agent/src/action_nodes.rs | 17 +++++++++++++++-- 15 files changed, 38 insertions(+), 15 deletions(-) diff --git a/assets/common/entity/village/alchemist.ron b/assets/common/entity/village/alchemist.ron index cfeab67728..faa2aaeec6 100644 --- a/assets/common/entity/village/alchemist.ron +++ b/assets/common/entity/village/alchemist.ron @@ -18,9 +18,10 @@ )), items: [ (10, "common.items.consumable.potion_big"), + (10, "common.items.food.sunflower_icetea"), ], ), meta: [ SkillSetAsset("common.skillset.preset.rank3.fullskill"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/village/blacksmith.ron b/assets/common/entity/village/blacksmith.ron index cebb81f399..d2c33be1c2 100644 --- a/assets/common/entity/village/blacksmith.ron +++ b/assets/common/entity/village/blacksmith.ron @@ -18,9 +18,10 @@ )), items: [ (10, "common.items.consumable.potion_big"), + (10, "common.items.food.sunflower_icetea"), ], ), meta: [ SkillSetAsset("common.skillset.preset.rank3.fullskill"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/village/chef.ron b/assets/common/entity/village/chef.ron index 72015d3601..8b06e1bdc6 100644 --- a/assets/common/entity/village/chef.ron +++ b/assets/common/entity/village/chef.ron @@ -18,9 +18,10 @@ )), items: [ (10, "common.items.consumable.potion_big"), + (10, "common.items.food.sunflower_icetea"), ], ), meta: [ SkillSetAsset("common.skillset.preset.rank3.fullskill"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/village/guard.ron b/assets/common/entity/village/guard.ron index 2a7d39dc2e..0f9981409c 100644 --- a/assets/common/entity/village/guard.ron +++ b/assets/common/entity/village/guard.ron @@ -15,9 +15,10 @@ )), items: [ (25, "common.items.consumable.potion_big"), + (25, "common.items.food.sunflower_icetea"), ], ), meta: [ SkillSetAsset("common.skillset.preset.rank3.fullskill"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/village/mountaineer.ron b/assets/common/entity/village/mountaineer.ron index 84410e8300..e9f1788c73 100644 --- a/assets/common/entity/village/mountaineer.ron +++ b/assets/common/entity/village/mountaineer.ron @@ -18,7 +18,8 @@ )), items: [ (10, "common.items.consumable.potion_big"), + (10, "common.items.food.sunflower_icetea"), ], ), meta: [], -) \ No newline at end of file +) diff --git a/assets/common/entity/village/villager.ron b/assets/common/entity/village/villager.ron index 95ae84c0e2..f6078c9fe2 100644 --- a/assets/common/entity/village/villager.ron +++ b/assets/common/entity/village/villager.ron @@ -21,7 +21,8 @@ )), items: [ (10, "common.items.consumable.potion_big"), + (10, "common.items.food.sunflower_icetea"), ], ), meta: [], -) \ No newline at end of file +) diff --git a/assets/common/entity/world/traveler0.ron b/assets/common/entity/world/traveler0.ron index 296b396b6f..7a9985a9e0 100644 --- a/assets/common/entity/world/traveler0.ron +++ b/assets/common/entity/world/traveler0.ron @@ -22,9 +22,10 @@ )), items: [ (5, "common.items.consumable.potion_minor"), + (5, "common.items.food.sunflower_icetea"), ], ), meta: [ SkillSetAsset("common.skillset.preset.rank1.fullskill"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/world/traveler1.ron b/assets/common/entity/world/traveler1.ron index 52e1e68159..d0cd24dea3 100644 --- a/assets/common/entity/world/traveler1.ron +++ b/assets/common/entity/world/traveler1.ron @@ -22,9 +22,10 @@ )), items: [ (25, "common.items.consumable.potion_minor"), + (25, "common.items.food.sunflower_icetea"), ], ), meta: [ SkillSetAsset("common.skillset.preset.rank2.fullskill"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/world/traveler2.ron b/assets/common/entity/world/traveler2.ron index 92351f490a..7956a51a19 100644 --- a/assets/common/entity/world/traveler2.ron +++ b/assets/common/entity/world/traveler2.ron @@ -33,9 +33,10 @@ )), items: [ (50, "common.items.consumable.potion_med"), + (50, "common.items.food.sunflower_icetea"), ], ), meta: [ SkillSetAsset("common.skillset.preset.rank3.fullskill"), ], -) \ No newline at end of file +) diff --git a/assets/common/entity/world/traveler3.ron b/assets/common/entity/world/traveler3.ron index 36a4c3306e..c2fb9d10b8 100644 --- a/assets/common/entity/world/traveler3.ron +++ b/assets/common/entity/world/traveler3.ron @@ -33,6 +33,7 @@ )), items: [ (50, "common.items.consumable.potion_big"), + (50, "common.items.food.sunflower_icetea"), ], ), meta: [ diff --git a/assets/common/items/boss_drops/potions.ron b/assets/common/items/boss_drops/potions.ron index 4e00c902d9..94b1b89c42 100644 --- a/assets/common/items/boss_drops/potions.ron +++ b/assets/common/items/boss_drops/potions.ron @@ -19,7 +19,7 @@ ItemDef( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 60, nanos: 0, )), + duration: Some(( secs: 45, nanos: 0, )), delay: Some(( secs: 1, nanos: 0, )) ), cat_ids: [Natural], diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index e5695e0bd2..904532da5f 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -19,7 +19,7 @@ ItemDef( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 60, nanos: 0, )), + duration: Some(( secs: 45, nanos: 0, )), delay: Some(( secs: 1, nanos: 0, )) ), cat_ids: [Natural], diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index 4884c9f3c0..905d859fa5 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -19,7 +19,7 @@ ItemDef( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 60, nanos: 0, )), + duration: Some(( secs: 45, nanos: 0, )), delay: Some(( secs: 1, nanos: 0, )) ), cat_ids: [Natural], diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index 372802efc2..a032df7335 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -19,7 +19,7 @@ ItemDef( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 60, nanos: 0, )), + duration: Some(( secs: 45, nanos: 0, )), delay: Some(( secs: 1, nanos: 0, )) ), cat_ids: [Natural], diff --git a/server/agent/src/action_nodes.rs b/server/agent/src/action_nodes.rs index 2e4d036217..204d594616 100644 --- a/server/agent/src/action_nodes.rs +++ b/server/agent/src/action_nodes.rs @@ -528,12 +528,14 @@ impl<'a> AgentData<'a> { controller: &mut Controller, relaxed: bool, ) -> bool { - // Wait for potion sickness to wear off if potions are less than 20% effective. - if self.stats.map_or(1.0, |s| s.heal_multiplier) < 0.2 { + // Wait for potion sickness to wear off if potions are less than 50% effective. + let heal_multiplier = self.stats.map_or(1.0, |s| s.heal_multiplier); + if heal_multiplier < 0.5 { return false; } let healing_value = |item: &Item| { let mut value = 0.0; + let mut causes_potion_sickness = false; if let ItemKind::Consumable { kind, effects, .. } = &*item.kind() { if matches!(kind, ConsumableKind::Drink) @@ -551,11 +553,22 @@ impl<'a> AgentData<'a> { value += data.strength * data.duration.map_or(0.0, |d| d.as_secs() as f32); }, + Effect::Buff(BuffEffect { kind, .. }) + if matches!(kind, PotionSickness) => + { + causes_potion_sickness = true; + }, + _ => {}, } } } } + // Prefer non-potion sources of healing when under at least one stack of potion + // sickness, or when incurring potion sickness is unnecessary + if causes_potion_sickness && (heal_multiplier < 1.0 || relaxed) { + value *= 0.1; + } value as i32 };