From 2509eb8d3d4062d59f477a7fb32ea1e59d224048 Mon Sep 17 00:00:00 2001 From: horblegorble Date: Sat, 22 Jun 2024 19:41:14 +1000 Subject: [PATCH] randomised harvester's far pumpkin throw; armor and weapon drops of same tier --- .../dungeon/gnarling/chieftain.ron | 12 ++---- .../dungeon/gnarling/harvester.ron | 12 ++---- server/agent/src/attack.rs | 39 ++++++++++--------- 3 files changed, 27 insertions(+), 36 deletions(-) diff --git a/assets/common/loot_tables/dungeon/gnarling/chieftain.ron b/assets/common/loot_tables/dungeon/gnarling/chieftain.ron index 265ee22d20..7fd0df6e34 100644 --- a/assets/common/loot_tables/dungeon/gnarling/chieftain.ron +++ b/assets/common/loot_tables/dungeon/gnarling/chieftain.ron @@ -1,14 +1,8 @@ [ (1, All([ - Lottery([ - (1.0, All([ - LootTable("common.loot_tables.armor.tier-0"), - LootTable("common.loot_tables.weapons.tier-1"), - ])), - (1.0, All([ - LootTable("common.loot_tables.weapons.tier-0"), - LootTable("common.loot_tables.armor.tier-1"), - ])), + All([ + LootTable("common.loot_tables.armor.tier-1"), + LootTable("common.loot_tables.weapons.tier-1"), ]), Lottery([ (2.0, Nothing), diff --git a/assets/common/loot_tables/dungeon/gnarling/harvester.ron b/assets/common/loot_tables/dungeon/gnarling/harvester.ron index 5e2eba3efa..7fb480f62e 100644 --- a/assets/common/loot_tables/dungeon/gnarling/harvester.ron +++ b/assets/common/loot_tables/dungeon/gnarling/harvester.ron @@ -1,14 +1,8 @@ [ (1, All([ - Lottery([ - (1.0, All([ - LootTable("common.loot_tables.armor.tier-1"), - LootTable("common.loot_tables.weapons.tier-2"), - ])), - (1.0, All([ - LootTable("common.loot_tables.weapons.tier-1"), - LootTable("common.loot_tables.armor.tier-2"), - ])), + All([ + LootTable("common.loot_tables.armor.tier-2"), + LootTable("common.loot_tables.weapons.tier-2"), ]), Lottery([ (3.0, Nothing), diff --git a/server/agent/src/attack.rs b/server/agent/src/attack.rs index 7654d4ad98..e9977e3c65 100644 --- a/server/agent/src/attack.rs +++ b/server/agent/src/attack.rs @@ -4786,12 +4786,9 @@ impl<'a> AgentData<'a> { const FIREBREATH_TIME: f32 = 4.0; const FIREBREATH_SHORT_TIME: f32 = 2.5; // cutoff sooner at close range const FIREBREATH_COOLDOWN: f32 = 3.5; - const FAR_PUMPKIN_COOLDOWN: f32 = 1.0; // allows for pathing to player between throws - // const CLOSE_MIXUP_COOLDOWN: f32 = 2.5; // variation in attacks at close range - // const MID_MIXUP_COOLDOWN: f32 = 3.0; // ^ mid - - const CLOSE_MIXUP_COOLDOWN_SPAN: [f32; 2] = [1.5, 7.0]; - const MID_MIXUP_COOLDOWN_SPAN: [f32; 2] = [2.0, 6.0]; + const CLOSE_MIXUP_COOLDOWN_SPAN: [f32; 2] = [1.5, 7.0]; // variation in attacks at close range + const MID_MIXUP_COOLDOWN_SPAN: [f32; 2] = [2.0, 6.0]; // ^ mid + const FAR_PUMPKIN_COOLDOWN_SPAN: [f32; 2] = [3.6, 5.0]; // allows for pathing to player between throws // notes on cooldown values: // - scalar values are from the end of an attack // - span values are from the beginning of an attack @@ -4800,7 +4797,7 @@ impl<'a> AgentData<'a> { enum ActionStateConditions { FirstVines = 0, SecondVines, - MixupInit, + RandomInit, } // timers @@ -4814,6 +4811,7 @@ impl<'a> AgentData<'a> { enum ActionStateCounters { CloseMixupCooldown = 0, MidMixupCooldown, + FarPumpkinCooldown, } // line of sight check @@ -4831,26 +4829,24 @@ impl<'a> AgentData<'a> { // === main === - // initialise mixup cooldowns - if !agent.combat_state.conditions[ActionStateConditions::MixupInit as usize] { + // initialise randomised cooldowns + if !agent.combat_state.conditions[ActionStateConditions::RandomInit as usize] { + agent.combat_state.conditions[ActionStateConditions::RandomInit as usize] = true; agent.combat_state.counters[ActionStateCounters::CloseMixupCooldown as usize] = - midpoint(CLOSE_MIXUP_COOLDOWN_SPAN); + rng.gen_range(CLOSE_MIXUP_COOLDOWN_SPAN[0]..=CLOSE_MIXUP_COOLDOWN_SPAN[1]); agent.combat_state.counters[ActionStateCounters::MidMixupCooldown as usize] = - midpoint(MID_MIXUP_COOLDOWN_SPAN); - agent.combat_state.conditions[ActionStateConditions::MixupInit as usize] = true; + rng.gen_range(MID_MIXUP_COOLDOWN_SPAN[0]..=MID_MIXUP_COOLDOWN_SPAN[1]); + agent.combat_state.counters[ActionStateCounters::FarPumpkinCooldown as usize] = + rng.gen_range(FAR_PUMPKIN_COOLDOWN_SPAN[0]..=FAR_PUMPKIN_COOLDOWN_SPAN[1]); } // --- timers --- - // mixup timer reset is handled within attack logic + // mixup and far pumpkin timer resets are handled within attack logic match self.char_state { CharacterState::BasicBeam(_) => { // reset when using firebreath agent.combat_state.timers[ActionStateTimers::Firebreath as usize] = 0.0; }, - CharacterState::BasicRanged(_) => { - // reset when using explodingpumpkin - agent.combat_state.timers[ActionStateTimers::FarPumpkin as usize] = 0.0; - }, _ => { // increment otherwise agent.combat_state.timers[ActionStateTimers::Firebreath as usize] += read_data.dt.0; @@ -4957,10 +4953,17 @@ impl<'a> AgentData<'a> { else if attack_data.dist_sqrd < MAX_PUMPKIN_RANGE.powi(2) && line_of_sight_with_target() && agent.combat_state.timers[ActionStateTimers::FarPumpkin as usize] - > FAR_PUMPKIN_COOLDOWN + > agent.combat_state.counters[ActionStateCounters::FarPumpkinCooldown as usize] { // throw pumpkin controller.push_basic_input(InputKind::Ability(0)); + // check if pumpkin is being used + if matches!(self.char_state, CharacterState::BasicRanged(_) ) { + // reset pumpkin timer and setup new cooldown + agent.combat_state.timers[ActionStateTimers::FarPumpkin as usize] = 0.0; + agent.combat_state.counters[ActionStateCounters::FarPumpkinCooldown as usize] = + rng.gen_range(FAR_PUMPKIN_COOLDOWN_SPAN[0]..=FAR_PUMPKIN_COOLDOWN_SPAN[1]); + } } // --- movement ---