Fixes #1563 - Implements Quad Med Hoof tactic/attack

This commit is contained in:
Tine Jozelj 2022-12-13 21:16:48 +01:00
parent 80a4d7f134
commit e77537365f
3 changed files with 38 additions and 0 deletions

View File

@ -824,6 +824,7 @@ impl<'a> AgentData<'a> {
circle_time: 1,
},
"Quad Med Basic" => Tactic::QuadMedBasic,
"Quad Med Hoof" => Tactic::QuadMedHoof,
"Roshwalr" => Tactic::Roshwalr,
"Asp" | "Maneater" => Tactic::QuadLowRanged,
"Quad Low Breathe" | "Quad Low Beam" | "Basilisk" => {
@ -1133,6 +1134,13 @@ impl<'a> AgentData<'a> {
tgt_data,
read_data,
),
Tactic::QuadMedHoof => self.handle_quadmed_hoof_attack(
agent,
controller,
&attack_data,
tgt_data,
read_data,
),
Tactic::QuadLowBeam => self.handle_quadlow_beam_attack(
agent,
controller,

View File

@ -2342,6 +2342,35 @@ impl<'a> AgentData<'a> {
}
}
pub fn handle_quadmed_hoof_attack(
&self,
agent: &mut Agent,
controller: &mut Controller,
attack_data: &AttackData,
tgt_data: &TargetData,
read_data: &ReadData,
) {
const HOOF_ATTACK_RANGE: f32 = 1.0;
const HOOF_ATTACK_ANGLE: f32 = 50.0;
if attack_data.angle < HOOF_ATTACK_ANGLE
&& attack_data.dist_sqrd
< (HOOF_ATTACK_RANGE + self.body.map_or(0.0, |b| b.max_radius())).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
controller.push_basic_input(InputKind::Primary);
} else {
self.path_toward_target(
agent,
controller,
tgt_data.pos.0,
read_data,
Path::Full,
None,
);
}
}
pub fn handle_quadlow_beam_attack(
&self,
agent: &mut Agent,

View File

@ -114,6 +114,7 @@ pub enum Tactic {
QuadLowBeam,
QuadMedJump,
QuadMedBasic,
QuadMedHoof,
Theropod,
BirdLargeBreathe,
BirdLargeFire,