mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixes #1563 - Implements Quad Med Hoof tactic/attack
This commit is contained in:
parent
80a4d7f134
commit
e77537365f
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -114,6 +114,7 @@ pub enum Tactic {
|
||||
QuadLowBeam,
|
||||
QuadMedJump,
|
||||
QuadMedBasic,
|
||||
QuadMedHoof,
|
||||
Theropod,
|
||||
BirdLargeBreathe,
|
||||
BirdLargeFire,
|
||||
|
Loading…
Reference in New Issue
Block a user