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, circle_time: 1,
}, },
"Quad Med Basic" => Tactic::QuadMedBasic, "Quad Med Basic" => Tactic::QuadMedBasic,
"Quad Med Hoof" => Tactic::QuadMedHoof,
"Roshwalr" => Tactic::Roshwalr, "Roshwalr" => Tactic::Roshwalr,
"Asp" | "Maneater" => Tactic::QuadLowRanged, "Asp" | "Maneater" => Tactic::QuadLowRanged,
"Quad Low Breathe" | "Quad Low Beam" | "Basilisk" => { "Quad Low Breathe" | "Quad Low Beam" | "Basilisk" => {
@ -1133,6 +1134,13 @@ impl<'a> AgentData<'a> {
tgt_data, tgt_data,
read_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( Tactic::QuadLowBeam => self.handle_quadlow_beam_attack(
agent, agent,
controller, 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( pub fn handle_quadlow_beam_attack(
&self, &self,
agent: &mut Agent, agent: &mut Agent,

View File

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