mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Mindflayer now only summons minions at set thresholds of health.
This commit is contained in:
parent
5966b1541d
commit
6c611d632a
@ -2,7 +2,7 @@ BasicSummon(
|
|||||||
buildup_duration: 0.5,
|
buildup_duration: 0.5,
|
||||||
cast_duration: 1.0,
|
cast_duration: 1.0,
|
||||||
recover_duration: 0.5,
|
recover_duration: 0.5,
|
||||||
summon_amount: 2,
|
summon_amount: 6,
|
||||||
summon_info: (
|
summon_info: (
|
||||||
body: BipedSmall((
|
body: BipedSmall((
|
||||||
species: Husk,
|
species: Husk,
|
||||||
|
@ -2202,18 +2202,21 @@ impl<'a> AgentData<'a> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Tactic::Mindflayer => {
|
Tactic::Mindflayer => {
|
||||||
agent.action_timer += dt.0;
|
|
||||||
const MINDFLAYER_ATTACK_DIST: f32 = 15.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());
|
let health_fraction = self.health.map_or(0.5, |h| h.fraction());
|
||||||
if mindflayer_is_far && agent.action_timer > 5.0 / health_fraction {
|
// Extreme hack to set action_timer to 1 at start of combat
|
||||||
// Summon minions if time has passed and no one is close for other attacks. Less
|
if agent.action_timer < 0.01 && health_fraction > 0.5 {
|
||||||
// often when at low health.
|
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() {
|
if !self.char_state.is_attack() {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_input(InputKind::Ability(1)));
|
.push(ControlAction::basic_input(InputKind::Ability(1)));
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer -= MINION_SUMMON_THRESHOLD;
|
||||||
}
|
}
|
||||||
} else if mindflayer_is_far {
|
} else if mindflayer_is_far {
|
||||||
// If too far from target, blink to them.
|
// If too far from target, blink to them.
|
||||||
|
Loading…
Reference in New Issue
Block a user