diff --git a/assets/common/abilities/staff/flamethrower.ron b/assets/common/abilities/staff/flamethrower.ron index 4e0194fbe3..c3c491b94a 100644 --- a/assets/common/abilities/staff/flamethrower.ron +++ b/assets/common/abilities/staff/flamethrower.ron @@ -2,7 +2,7 @@ BasicBeam( buildup_duration: 0.25, recover_duration: 0.25, beam_duration: 1.0, - damage: 50, + damage: 35, tick_rate: 3.0, range: 20.0, max_angle: 15.0, diff --git a/assets/common/abilities/swordsimple/dash.ron b/assets/common/abilities/swordsimple/dash.ron index d9ddf8bb0a..f22e4723d2 100644 --- a/assets/common/abilities/swordsimple/dash.ron +++ b/assets/common/abilities/swordsimple/dash.ron @@ -10,10 +10,10 @@ DashMelee( angle: 45.0, energy_drain: 0, forward_speed: 4.0, - buildup_duration: 0.25, + buildup_duration: 0.6, charge_duration: 1.2, swing_duration: 0.1, - recover_duration: 0.5, + recover_duration: 0.9, charge_through: true, is_interruptible: true, ) diff --git a/assets/common/abilities/swordsimple/doublestrike.ron b/assets/common/abilities/swordsimple/doublestrike.ron index bc5178debc..bb55bd6505 100644 --- a/assets/common/abilities/swordsimple/doublestrike.ron +++ b/assets/common/abilities/swordsimple/doublestrike.ron @@ -10,7 +10,7 @@ ComboMelee( range: 3.5, angle: 50.0, base_buildup_duration: 0.4, - base_swing_duration: 0.06, + base_swing_duration: 0.08, base_recover_duration: 0.5, forward_movement: 2.5, ), @@ -23,9 +23,9 @@ ComboMelee( knockback: 12.0, range: 3.5, angle: 30.0, - base_buildup_duration: 0.5, + base_buildup_duration: 0.7, base_swing_duration: 0.1, - base_recover_duration: 0.5, + base_recover_duration: 0.7, forward_movement: 2.0, ), ], diff --git a/common/src/states/basic_aura.rs b/common/src/states/basic_aura.rs index feb0c5ba47..0a4fef7661 100644 --- a/common/src/states/basic_aura.rs +++ b/common/src/states/basic_aura.rs @@ -49,6 +49,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, 0.8); handle_jump(data, &mut update, 1.0); diff --git a/common/src/states/basic_beam.rs b/common/src/states/basic_beam.rs index ca700bf91b..aaf9dabea6 100644 --- a/common/src/states/basic_beam.rs +++ b/common/src/states/basic_beam.rs @@ -68,6 +68,7 @@ impl CharacterBehavior for Data { }, } + handle_orientation(data, &mut update, 0.6); handle_move(data, &mut update, 0.4); handle_jump(data, &mut update, 1.0); diff --git a/common/src/states/basic_ranged.rs b/common/src/states/basic_ranged.rs index 2c3b59883f..fa07e96fa0 100644 --- a/common/src/states/basic_ranged.rs +++ b/common/src/states/basic_ranged.rs @@ -42,6 +42,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, 0.3); handle_jump(data, &mut update, 1.0); diff --git a/common/src/states/blink.rs b/common/src/states/blink.rs index 884b612555..5678a46eff 100644 --- a/common/src/states/blink.rs +++ b/common/src/states/blink.rs @@ -37,6 +37,8 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); + match self.stage_section { StageSection::Buildup => { if self.timer < self.static_data.buildup_duration { diff --git a/common/src/states/charged_melee.rs b/common/src/states/charged_melee.rs index 16c55e5629..30285b964d 100644 --- a/common/src/states/charged_melee.rs +++ b/common/src/states/charged_melee.rs @@ -66,6 +66,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, 0.7); handle_jump(data, &mut update, 1.0); diff --git a/common/src/states/charged_ranged.rs b/common/src/states/charged_ranged.rs index 9f7434ae03..7d06447438 100644 --- a/common/src/states/charged_ranged.rs +++ b/common/src/states/charged_ranged.rs @@ -65,6 +65,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, self.static_data.move_speed); handle_jump(data, &mut update, 1.0); diff --git a/common/src/states/combo_melee.rs b/common/src/states/combo_melee.rs index d72b6f1b8f..5045ffbbf7 100644 --- a/common/src/states/combo_melee.rs +++ b/common/src/states/combo_melee.rs @@ -119,8 +119,8 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_orientation(data, &mut update, 0.65); handle_move(data, &mut update, 0.6); + handle_orientation(data, &mut update, 0.2); let stage_index = (self.stage - 1) as usize; diff --git a/common/src/states/equipping.rs b/common/src/states/equipping.rs index 9d4d007f25..b27da6e16e 100644 --- a/common/src/states/equipping.rs +++ b/common/src/states/equipping.rs @@ -26,6 +26,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, 1.0); handle_jump(data, &mut update, 1.0); diff --git a/common/src/states/healing_beam.rs b/common/src/states/healing_beam.rs index 23caaded52..0107412185 100644 --- a/common/src/states/healing_beam.rs +++ b/common/src/states/healing_beam.rs @@ -52,6 +52,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 0.6); handle_move(data, &mut update, 0.4); handle_jump(data, &mut update, 1.0); diff --git a/common/src/states/idle.rs b/common/src/states/idle.rs index 00f683f809..cb24b725ec 100644 --- a/common/src/states/idle.rs +++ b/common/src/states/idle.rs @@ -10,6 +10,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, 1.0); handle_jump(data, &mut update, 1.0); handle_wield(data, &mut update); diff --git a/common/src/states/roll.rs b/common/src/states/roll.rs index abbffba3bd..71e62c54bc 100644 --- a/common/src/states/roll.rs +++ b/common/src/states/roll.rs @@ -47,7 +47,7 @@ impl CharacterBehavior for Data { let mut update = StateUpdate::from(data); // Smooth orientation - handle_orientation(data, &mut update, 1.0); + handle_orientation(data, &mut update, 1.3); match self.stage_section { StageSection::Buildup => { diff --git a/common/src/states/shockwave.rs b/common/src/states/shockwave.rs index aeae37c351..640129480a 100644 --- a/common/src/states/shockwave.rs +++ b/common/src/states/shockwave.rs @@ -59,6 +59,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, self.static_data.move_efficiency); match self.stage_section { diff --git a/common/src/states/sneak.rs b/common/src/states/sneak.rs index 4016cef6cf..768dce701c 100644 --- a/common/src/states/sneak.rs +++ b/common/src/states/sneak.rs @@ -10,6 +10,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, 0.4); handle_jump(data, &mut update, 1.0); handle_wield(data, &mut update); diff --git a/common/src/states/stunned.rs b/common/src/states/stunned.rs index 64bd813515..748760d54d 100644 --- a/common/src/states/stunned.rs +++ b/common/src/states/stunned.rs @@ -36,6 +36,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(data, &mut update, self.static_data.movement_speed); match self.stage_section { diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 8cfd9e47db..ec7de76a56 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -245,8 +245,6 @@ pub fn handle_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) { /// Updates components to move player as if theyre on ground or in air #[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587 fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) { - handle_orientation(data, update, 1.0); - let accel = if data.physics.on_ground { data.body.base_accel() } else { @@ -271,8 +269,6 @@ pub fn handle_forced_movement( movement: ForcedMovement, efficiency: f32, ) { - handle_orientation(data, update, efficiency); - match movement { ForcedMovement::Forward { strength } => { if let Some(accel) = data.physics.on_ground.then_some(data.body.base_accel()) { @@ -331,8 +327,6 @@ pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, efficiency: /// Updates components to move player as if theyre swimming fn swim_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32, submersion: f32) -> bool { if let Some(force) = data.body.swim_thrust() { - handle_orientation(data, update, efficiency * 0.2); - let force = efficiency * force; let mut water_accel = force / data.mass.0; @@ -374,8 +368,6 @@ pub fn fly_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) -> b let accel = thrust / data.mass.0; - handle_orientation(data, update, efficiency); - // Elevation control match data.body { // flappy flappy diff --git a/common/src/states/wielding.rs b/common/src/states/wielding.rs index d0457f7a27..4798b44834 100644 --- a/common/src/states/wielding.rs +++ b/common/src/states/wielding.rs @@ -13,6 +13,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); + handle_orientation(data, &mut update, 1.0); handle_move(&data, &mut update, 1.0); handle_climb(&data, &mut update); attempt_input(&data, &mut update); diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 12cfe96726..3406783fd4 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -1565,6 +1565,11 @@ impl<'a> AgentData<'a> { }; let dist_sqrd = self.pos.0.distance_squared(tgt_pos.0); + let angle = self + .ori + .look_vec() + .angle_between(tgt_pos.0 - self.pos.0) + .to_degrees(); // FIXME: Retrieve actual projectile speed! // We have to assume projectiles are faster than base speed because there are @@ -1598,7 +1603,7 @@ impl<'a> AgentData<'a> { // depending on the distance from the agent to the target match tactic { Tactic::Melee => { - if dist_sqrd < min_attack_dist.powi(2) { + if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); @@ -1633,7 +1638,7 @@ impl<'a> AgentData<'a> { } }, Tactic::Axe => { - if dist_sqrd < min_attack_dist.powi(2) { + if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); if agent.action_timer > 6.0 { controller @@ -1688,7 +1693,7 @@ impl<'a> AgentData<'a> { } }, Tactic::Hammer => { - if dist_sqrd < min_attack_dist.powi(2) { + if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); if agent.action_timer > 4.0 { controller @@ -1727,7 +1732,7 @@ impl<'a> AgentData<'a> { ..self.traversal_config }, ) { - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 45.0 { controller.inputs.move_dir = bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed; if self @@ -1762,7 +1767,7 @@ impl<'a> AgentData<'a> { } }, Tactic::Sword => { - if dist_sqrd < min_attack_dist.powi(2) { + if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); if self .skill_set @@ -1796,7 +1801,7 @@ impl<'a> AgentData<'a> { if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { controller.inputs.move_dir = bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed; - if agent.action_timer > 4.0 { + if agent.action_timer > 4.0 && angle < 45.0 { controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); @@ -1853,9 +1858,11 @@ impl<'a> AgentData<'a> { self.jump_if(controller, bearing.z > 1.5); controller.inputs.move_z = bearing.z; } - controller - .actions - .push(ControlAction::basic_input(InputKind::Primary)); + if angle < 15.0 { + controller + .actions + .push(ControlAction::basic_input(InputKind::Primary)); + } } } else if dist_sqrd < MAX_CHASE_DIST.powi(2) { if let Some((bearing, speed)) = agent.chaser.chase( @@ -1868,7 +1875,7 @@ impl<'a> AgentData<'a> { ..self.traversal_config }, ) { - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 45.0 { controller.inputs.move_dir = bearing .xy() .rotated_z(thread_rng().gen_range(0.5..1.57)) @@ -1949,7 +1956,7 @@ impl<'a> AgentData<'a> { controller .actions .push(ControlAction::basic_input(InputKind::Roll)); - } else if dist_sqrd < (5.0 * min_attack_dist).powi(2) { + } else if dist_sqrd < (5.0 * min_attack_dist).powi(2) && angle < 15.0 { if agent.action_timer < 1.5 { controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) .xy() @@ -1996,7 +2003,7 @@ impl<'a> AgentData<'a> { ..self.traversal_config }, ) { - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 { controller.inputs.move_dir = bearing .xy() .rotated_z(thread_rng().gen_range(-1.57..-0.5)) @@ -2042,7 +2049,7 @@ impl<'a> AgentData<'a> { } }, Tactic::StoneGolemBoss => { - if dist_sqrd < min_attack_dist.powi(2) { + if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { // 2.0 is temporary correction factor to allow them to melee with their // large hitbox controller.inputs.move_dir = Vec2::zero(); @@ -2066,7 +2073,7 @@ impl<'a> AgentData<'a> { ..self.traversal_config }, ) { - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 45.0 { controller.inputs.move_dir = bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed; if agent.action_timer > 5.0 { @@ -2092,7 +2099,8 @@ impl<'a> AgentData<'a> { radius, circle_time, } => { - if dist_sqrd < min_attack_dist.powi(2) && thread_rng().gen_bool(0.5) { + if dist_sqrd < min_attack_dist.powi(2) && thread_rng().gen_bool(0.5) && angle < 45.0 + { controller.inputs.move_dir = Vec2::zero(); controller .actions @@ -2112,7 +2120,7 @@ impl<'a> AgentData<'a> { .try_normalized() .unwrap_or_else(Vec2::unit_y); agent.action_timer += dt.0; - } else if agent.action_timer < circle_time as f32 + 0.5 { + } else if agent.action_timer < circle_time as f32 + 0.5 && angle < 45.0 { controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); @@ -2124,7 +2132,7 @@ impl<'a> AgentData<'a> { .try_normalized() .unwrap_or_else(Vec2::unit_y); agent.action_timer += dt.0; - } else if agent.action_timer < 2.0 * circle_time as f32 + 1.0 { + } else if agent.action_timer < 2.0 * circle_time as f32 + 1.0 && angle < 45.0 { controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); @@ -2153,7 +2161,7 @@ impl<'a> AgentData<'a> { } }, Tactic::QuadLowRanged => { - if dist_sqrd < (3.0 * min_attack_dist).powi(2) { + if dist_sqrd < (3.0 * min_attack_dist).powi(2) && angle < 45.0 { controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) .xy() .try_normalized() @@ -2172,7 +2180,7 @@ impl<'a> AgentData<'a> { ..self.traversal_config }, ) { - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 { if agent.action_timer > 5.0 { agent.action_timer = 0.0; } else if agent.action_timer > 2.5 { @@ -2211,7 +2219,7 @@ impl<'a> AgentData<'a> { } }, Tactic::TailSlap => { - if dist_sqrd < (1.5 * min_attack_dist).powi(2) { + if dist_sqrd < (1.5 * min_attack_dist).powi(2) && angle < 45.0 { if agent.action_timer > 4.0 { controller .actions @@ -2254,13 +2262,14 @@ impl<'a> AgentData<'a> { } }, Tactic::QuadLowQuick => { - if dist_sqrd < (1.5 * min_attack_dist).powi(2) { + if dist_sqrd < (1.5 * min_attack_dist).powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); } else if dist_sqrd < (3.0 * min_attack_dist).powi(2) && dist_sqrd > (2.0 * min_attack_dist).powi(2) + && angle < 45.0 { controller .actions @@ -2295,12 +2304,12 @@ impl<'a> AgentData<'a> { controller.inputs.move_dir = Vec2::zero(); if agent.action_timer > 5.0 { agent.action_timer = 0.0; - } else if agent.action_timer > 2.0 { + } else if agent.action_timer > 2.0 && angle < 45.0 { controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); agent.action_timer += dt.0; - } else { + } else if angle < 45.0 { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); @@ -2327,12 +2336,12 @@ impl<'a> AgentData<'a> { } }, Tactic::QuadMedJump => { - if dist_sqrd < (1.5 * min_attack_dist).powi(2) { + if dist_sqrd < (1.5 * min_attack_dist).powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); - } else if dist_sqrd < (5.0 * min_attack_dist).powi(2) { + } else if dist_sqrd < (5.0 * min_attack_dist).powi(2) && angle < 15.0 { controller .actions .push(ControlAction::basic_input(InputKind::Ability(0))); @@ -2347,7 +2356,7 @@ impl<'a> AgentData<'a> { ..self.traversal_config }, ) { - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); @@ -2365,7 +2374,7 @@ impl<'a> AgentData<'a> { } }, Tactic::QuadMedBasic => { - if dist_sqrd < min_attack_dist.powi(2) { + if dist_sqrd < min_attack_dist.powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); if agent.action_timer < 2.0 { controller @@ -2401,12 +2410,12 @@ impl<'a> AgentData<'a> { } }, Tactic::Lavadrake | Tactic::QuadLowBeam => { - if dist_sqrd < (2.5 * min_attack_dist).powi(2) { + if dist_sqrd < (2.5 * min_attack_dist).powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); - } else if dist_sqrd < (7.0 * min_attack_dist).powi(2) { + } else if dist_sqrd < (7.0 * min_attack_dist).powi(2) && angle < 15.0 { if agent.action_timer < 2.0 { controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) .xy() @@ -2417,7 +2426,7 @@ impl<'a> AgentData<'a> { .actions .push(ControlAction::basic_input(InputKind::Primary)); agent.action_timer += dt.0; - } else if agent.action_timer < 4.0 { + } else if agent.action_timer < 4.0 && angle < 15.0 { controller.inputs.move_dir = (tgt_pos.0 - self.pos.0) .xy() .rotated_z(-0.47 * PI) @@ -2427,7 +2436,7 @@ impl<'a> AgentData<'a> { .actions .push(ControlAction::basic_input(InputKind::Primary)); agent.action_timer += dt.0; - } else if agent.action_timer < 6.0 { + } else if agent.action_timer < 6.0 && angle < 15.0 { controller .actions .push(ControlAction::basic_input(InputKind::Ability(0))); @@ -2456,7 +2465,7 @@ impl<'a> AgentData<'a> { } }, Tactic::Theropod => { - if dist_sqrd < (2.0 * min_attack_dist).powi(2) { + if dist_sqrd < (2.0 * min_attack_dist).powi(2) && angle < 45.0 { controller.inputs.move_dir = Vec2::zero(); controller .actions @@ -2482,7 +2491,7 @@ impl<'a> AgentData<'a> { } }, Tactic::Turret => { - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); @@ -2492,7 +2501,7 @@ impl<'a> AgentData<'a> { }, Tactic::FixedTurret => { controller.inputs.look_dir = self.ori.look_dir(); - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); @@ -2508,7 +2517,7 @@ impl<'a> AgentData<'a> { .try_normalized() .unwrap_or_default(), ); - if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) { + if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) && angle < 15.0 { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); @@ -2562,7 +2571,7 @@ impl<'a> AgentData<'a> { controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); - } else if thread_rng().gen_bool(health_fraction.into()) { + } else if thread_rng().gen_bool(health_fraction.into()) && angle < 30.0 { // Else if at high health, use primary controller .actions @@ -2602,6 +2611,7 @@ impl<'a> AgentData<'a> { // If random chance and can see target if thread_rng().gen_bool(0.05) && can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) + && angle < 15.0 { // Fireball controller @@ -2660,7 +2670,10 @@ impl<'a> AgentData<'a> { move_dir.xy().try_normalized().unwrap_or_else(Vec2::zero) * 2.0; controller.inputs.move_z = move_dir.z - 0.5; // If further than 4 blocks and random chance - if thread_rng().gen_bool(0.05) && dist_sqrd > (4.0 * min_attack_dist).powi(2) { + if thread_rng().gen_bool(0.05) + && dist_sqrd > (4.0 * min_attack_dist).powi(2) + && angle < 15.0 + { // Fireball controller .actions @@ -2668,7 +2681,9 @@ impl<'a> AgentData<'a> { } } // If further than 4 blocks and random chance - else if thread_rng().gen_bool(0.05) && dist_sqrd > (4.0 * min_attack_dist).powi(2) + else if thread_rng().gen_bool(0.05) + && dist_sqrd > (4.0 * min_attack_dist).powi(2) + && angle < 15.0 { // Fireball controller @@ -2715,7 +2730,7 @@ impl<'a> AgentData<'a> { controller .actions .push(ControlAction::basic_input(InputKind::Ability(0))); - } else { + } else if angle < 45.0 { // Triple strike controller .actions @@ -2731,6 +2746,7 @@ impl<'a> AgentData<'a> { if dist_sqrd > 30.0_f32.powi(2) { if thread_rng().gen_bool(0.05) && can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) + && angle < 15.0 { controller .actions @@ -2779,12 +2795,17 @@ impl<'a> AgentData<'a> { controller.inputs.move_dir = move_dir.xy().try_normalized().unwrap_or_else(Vec2::zero) * 2.0; controller.inputs.move_z = move_dir.z - 0.5; - if thread_rng().gen_bool(0.05) && dist_sqrd > (4.0 * min_attack_dist).powi(2) { + if thread_rng().gen_bool(0.05) + && dist_sqrd > (4.0 * min_attack_dist).powi(2) + && angle < 15.0 + { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); } - } else if thread_rng().gen_bool(0.05) && dist_sqrd > (4.0 * min_attack_dist).powi(2) + } else if thread_rng().gen_bool(0.05) + && dist_sqrd > (4.0 * min_attack_dist).powi(2) + && angle < 15.0 { controller .actions @@ -2816,12 +2837,12 @@ impl<'a> AgentData<'a> { self.jump_if(controller, bearing.z > 1.5); controller.inputs.move_z = bearing.z; } - } else if self.energy.current() > 600 && agent.action_timer < 3.0 { + } else if self.energy.current() > 600 && agent.action_timer < 3.0 && angle < 15.0 { controller .actions .push(ControlAction::basic_input(InputKind::Ability(0))); agent.action_timer += dt.0; - } else if agent.action_timer < 6.0 { + } else if agent.action_timer < 6.0 && angle < 45.0 { controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); diff --git a/voxygen/anim/src/character/swim.rs b/voxygen/anim/src/character/swim.rs index f0af9cee52..6556313598 100644 --- a/voxygen/anim/src/character/swim.rs +++ b/voxygen/anim/src/character/swim.rs @@ -233,8 +233,8 @@ impl Animation for SwimAnimation { next.torso.orientation = Quaternion::rotation_x( (((1.0 / switch) * PI / 2.0 + avg_vel.z * 0.12).min(1.57) - PI / 2.0) + avgspeed * avg_vel.z * -0.003, - ) * Quaternion::rotation_y(tilt * 8.0) - * Quaternion::rotation_z(tilt * 8.0); + ) * Quaternion::rotation_y(tilt * 2.0) + * Quaternion::rotation_z(tilt * 3.0); next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; match hands { (Some(Hands::One), _) => match active_tool_kind {