Fixed dullahan AI. Some number tweaks.

This commit is contained in:
Sam 2023-03-23 21:56:16 -04:00
parent 1298fc792b
commit f2dfaf0276
5 changed files with 63 additions and 3 deletions

View File

@ -20,7 +20,7 @@ ComboMelee2(
ori_modifier: 0.6,
),
],
energy_cost_per_strike: 40,
energy_cost_per_strike: 30,
meta: (
requirements: (stance: Some(Sword(Cleaving))),
),

View File

@ -9,7 +9,7 @@ ChargedMelee(
energy_regen: 0,
),
scaled: Some(Slash(
damage: 12,
damage: 10,
poise: 10,
knockback: 0,
energy_regen: 10,

View File

@ -829,7 +829,7 @@ impl<'a> AgentData<'a> {
if let Some(ability_spec) = item.ability_spec() {
match &*ability_spec {
AbilitySpec::Custom(spec) => match spec.as_str() {
"Oni" | "Sword Simple" => Tactic::Sword,
"Oni" | "Sword Simple" => Tactic::SwordSimple,
"Staff Simple" => Tactic::Staff,
"Simple Flying Melee" => Tactic::SimpleFlyingMelee,
"Bow Simple" | "Boreal Bow" => Tactic::Bow,
@ -1322,6 +1322,13 @@ impl<'a> AgentData<'a> {
read_data,
rng,
),
Tactic::SwordSimple => self.handle_sword_simple_attack(
agent,
controller,
&attack_data,
tgt_data,
read_data,
),
}
}

View File

@ -4212,4 +4212,55 @@ impl<'a> AgentData<'a> {
None,
);
}
pub fn handle_sword_simple_attack(
&self,
agent: &mut Agent,
controller: &mut Controller,
attack_data: &AttackData,
tgt_data: &TargetData,
read_data: &ReadData,
) {
const DASH_TIMER: usize = 0;
agent.action_state.timers[DASH_TIMER] += read_data.dt.0;
if matches!(self.char_state, CharacterState::DashMelee(s) if !matches!(s.stage_section, StageSection::Recover))
{
controller.push_basic_input(InputKind::Secondary);
} else if attack_data.in_min_range() && attack_data.angle < 45.0 {
if agent.action_state.timers[DASH_TIMER] > 2.0 {
agent.action_state.timers[DASH_TIMER] = 0.0;
}
controller.push_basic_input(InputKind::Primary);
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2)
&& self.path_toward_target(
agent,
controller,
tgt_data.pos.0,
read_data,
Path::Separate,
None,
)
&& entities_have_line_of_sight(
self.pos,
self.body,
tgt_data.pos,
tgt_data.body,
read_data,
)
&& agent.action_state.timers[DASH_TIMER] > 4.0
&& attack_data.angle < 45.0
{
controller.push_basic_input(InputKind::Secondary);
agent.action_state.timers[DASH_TIMER] = 0.0;
} else {
self.path_toward_target(
agent,
controller,
tgt_data.pos.0,
read_data,
Path::Partial,
None,
);
}
}
}

View File

@ -127,6 +127,8 @@ pub enum Tactic {
Bow,
Staff,
Sceptre,
// TODO: Remove tactic and ability spec
SwordSimple,
// Broad creature tactics
CircleCharge { radius: u32, circle_time: u32 },