From 6c611d632a12f6d1aed6775fb060ca692ba7b553 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 24 Mar 2021 13:09:06 -0400 Subject: [PATCH] Mindflayer now only summons minions at set thresholds of health. --- .../abilities/unique/mindflayer/summonminions.ron | 2 +- server/src/sys/agent.rs | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/assets/common/abilities/unique/mindflayer/summonminions.ron b/assets/common/abilities/unique/mindflayer/summonminions.ron index 1c4b801a43..1fa5d704e5 100644 --- a/assets/common/abilities/unique/mindflayer/summonminions.ron +++ b/assets/common/abilities/unique/mindflayer/summonminions.ron @@ -2,7 +2,7 @@ BasicSummon( buildup_duration: 0.5, cast_duration: 1.0, recover_duration: 0.5, - summon_amount: 2, + summon_amount: 6, summon_info: ( body: BipedSmall(( species: Husk, diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 44a5aa1cce..7f701516cb 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -2202,18 +2202,21 @@ impl<'a> AgentData<'a> { } }, Tactic::Mindflayer => { - agent.action_timer += dt.0; const MINDFLAYER_ATTACK_DIST: f32 = 15.0; - let mindflayer_is_far = dist_sqrd > MINDFLAYER_ATTACK_DIST.powi(2); + const MINION_SUMMON_THRESHOLD: f32 = 0.25; let health_fraction = self.health.map_or(0.5, |h| h.fraction()); - if mindflayer_is_far && agent.action_timer > 5.0 / health_fraction { - // Summon minions if time has passed and no one is close for other attacks. Less - // often when at low health. + // Extreme hack to set action_timer to 1 at start of combat + if agent.action_timer < 0.01 && health_fraction > 0.5 { + agent.action_timer = 1.0 - MINION_SUMMON_THRESHOLD; + } + let mindflayer_is_far = dist_sqrd > MINDFLAYER_ATTACK_DIST.powi(2); + if agent.action_timer > health_fraction { + // Summon minions at particular thresholds of health if !self.char_state.is_attack() { controller .actions .push(ControlAction::basic_input(InputKind::Ability(1))); - agent.action_timer = 0.0; + agent.action_timer -= MINION_SUMMON_THRESHOLD; } } else if mindflayer_is_far { // If too far from target, blink to them.