mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Improved mindflayer AI. Tweake some abilities.
This commit is contained in:
parent
720482d994
commit
8e4aeff705
@ -8,7 +8,7 @@ BasicBeam(
|
|||||||
max_angle: 15.0,
|
max_angle: 15.0,
|
||||||
damage_effect: Some(Buff((
|
damage_effect: Some(Buff((
|
||||||
kind: Cursed,
|
kind: Cursed,
|
||||||
dur_secs: 15.0,
|
dur_secs: 30.0,
|
||||||
strength: Value(0.5),
|
strength: Value(0.5),
|
||||||
chance: 1.0,
|
chance: 1.0,
|
||||||
))),
|
))),
|
||||||
|
@ -2,14 +2,14 @@ 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: 4,
|
summon_amount: 2,
|
||||||
summon_info: (
|
summon_info: (
|
||||||
body: QuadrupedMedium((
|
body: QuadrupedMedium((
|
||||||
species: Darkhound,
|
species: Darkhound,
|
||||||
body_type: Male,
|
body_type: Male,
|
||||||
)),
|
)),
|
||||||
scale: None,
|
scale: None,
|
||||||
health_scaling: 0,
|
health_scaling: 30,
|
||||||
loadout_config: None,
|
loadout_config: None,
|
||||||
skillset_config: None,
|
skillset_config: None,
|
||||||
),
|
),
|
||||||
|
@ -60,7 +60,7 @@ struct AgentData<'a> {
|
|||||||
light_emitter: Option<&'a LightEmitter>,
|
light_emitter: Option<&'a LightEmitter>,
|
||||||
glider_equipped: bool,
|
glider_equipped: bool,
|
||||||
is_gliding: bool,
|
is_gliding: bool,
|
||||||
health: &'a Health,
|
health: Option<&'a Health>,
|
||||||
char_state: &'a CharacterState,
|
char_state: &'a CharacterState,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
light_emitter,
|
light_emitter,
|
||||||
glider_equipped,
|
glider_equipped,
|
||||||
is_gliding,
|
is_gliding,
|
||||||
health,
|
health: read_data.healths.get(entity),
|
||||||
char_state,
|
char_state,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2206,7 +2206,10 @@ impl<'a> AgentData<'a> {
|
|||||||
agent.action_timer += dt.0;
|
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);
|
let mindflayer_is_far = dist_sqrd > MINDFLAYER_ATTACK_DIST.powi(2);
|
||||||
if mindflayer_is_far && agent.action_timer / self.health.fraction() > 5.0 {
|
let health_fraction = self.health.map_or(0.5, |h| h.fraction());
|
||||||
|
if mindflayer_is_far && agent.action_timer / health_fraction > 10.0 {
|
||||||
|
// Summon minions if time has passed and no one is close for other attacks. Less
|
||||||
|
// often when at low health.
|
||||||
if !self.char_state.is_attack() {
|
if !self.char_state.is_attack() {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
@ -2214,6 +2217,7 @@ impl<'a> AgentData<'a> {
|
|||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
}
|
}
|
||||||
} else if mindflayer_is_far {
|
} else if mindflayer_is_far {
|
||||||
|
// If too far from target, blink to them.
|
||||||
controller.actions.push(ControlAction::StartInput {
|
controller.actions.push(ControlAction::StartInput {
|
||||||
input: InputKind::Ability(0),
|
input: InputKind::Ability(0),
|
||||||
target_entity: agent
|
target_entity: agent
|
||||||
@ -2223,14 +2227,29 @@ impl<'a> AgentData<'a> {
|
|||||||
.copied(),
|
.copied(),
|
||||||
select_pos: None,
|
select_pos: None,
|
||||||
});
|
});
|
||||||
} else if self.health.fraction() < 0.5 {
|
|
||||||
controller
|
|
||||||
.actions
|
|
||||||
.push(ControlAction::basic_input(InputKind::Secondary));
|
|
||||||
} else {
|
} else {
|
||||||
controller
|
// If close to target, use either primary or secondary ability
|
||||||
.actions
|
if matches!(self.char_state, CharacterState::BasicBeam(_)) {
|
||||||
.push(ControlAction::basic_input(InputKind::Primary));
|
// If already using primary, keep using primary
|
||||||
|
controller
|
||||||
|
.actions
|
||||||
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
|
} else if matches!(self.char_state, CharacterState::SpinMelee(_)) {
|
||||||
|
// If already using secondary, keep using secondary
|
||||||
|
controller
|
||||||
|
.actions
|
||||||
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
|
} else if thread_rng().gen_bool(health_fraction.into()) {
|
||||||
|
// Else if at high health, use primary
|
||||||
|
controller
|
||||||
|
.actions
|
||||||
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
|
} else {
|
||||||
|
// Else use secondary
|
||||||
|
controller
|
||||||
|
.actions
|
||||||
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user