From 5461f002fe3b7f4f7a4b867823dc62c0a254b4ed Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 24 Nov 2020 17:23:29 -0600 Subject: [PATCH] Correct beam offsets used. Fix scaling damage on hammer M1. Add can_strafe function to body. --- .../common/abilities/hammer/singlestrike.ron | 2 +- common/src/comp/body.rs | 2 ++ common/src/states/basic_beam.rs | 4 +-- common/src/states/utils.rs | 2 +- common/src/sys/agent.rs | 30 +++++++++---------- voxygen/src/anim/src/quadruped_low/alpha.rs | 4 +-- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/assets/common/abilities/hammer/singlestrike.ron b/assets/common/abilities/hammer/singlestrike.ron index 5aa0377a64..1f12ee07ef 100644 --- a/assets/common/abilities/hammer/singlestrike.ron +++ b/assets/common/abilities/hammer/singlestrike.ron @@ -2,7 +2,7 @@ ComboMelee( stage_data: [( stage: 1, base_damage: 130, - max_damage: 130, + max_damage: 150, damage_increase: 10, knockback: 0.0, range: 4.5, diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index eadfc3b370..f0efe04035 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -621,6 +621,8 @@ impl Body { _ => Vec3::unit_z(), } } + + pub fn can_strafe(&self) -> bool { matches!(self, Body::Humanoid(_)) } } impl Component for Body { diff --git a/common/src/states/basic_beam.rs b/common/src/states/basic_beam.rs index 49ceb3f3be..0e468b7a86 100644 --- a/common/src/states/basic_beam.rs +++ b/common/src/states/basic_beam.rs @@ -99,8 +99,8 @@ impl CharacterBehavior for Data { }); // Gets offsets let body_offsets = Vec3::new( - data.body.radius() * 3.0 * data.inputs.look_dir.x, - data.body.radius() * 3.0 * data.inputs.look_dir.y, + (data.body.radius() + 1.0) * data.inputs.look_dir.x, + (data.body.radius() + 1.0) * data.inputs.look_dir.y, data.body.eye_height(), ) * 0.55; // Build up diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index db3d53a73f..54a7bfbd95 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -232,7 +232,7 @@ pub fn handle_forced_movement( pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, rate: f32) { // Set direction based on move direction - let ori_dir = if (update.character.is_aimed() && data.body.is_humanoid()) + let ori_dir = if (update.character.is_aimed() && data.body.can_strafe()) || update.character.is_attack() { data.inputs.look_dir.xy() diff --git a/common/src/sys/agent.rs b/common/src/sys/agent.rs index 87947b9cc1..e2b29aadaa 100644 --- a/common/src/sys/agent.rs +++ b/common/src/sys/agent.rs @@ -337,7 +337,7 @@ impl<'a> System<'a> for Sys { Bow, Staff, StoneGolemBoss, - CircleCharge { radius: u8, circle_time: u8 }, + CircleCharge { radius: u32, circle_time: u32 }, QuadLowRanged, TailSlap, QuadLowQuick, @@ -411,18 +411,18 @@ impl<'a> System<'a> for Sys { let eye_offset = body.map_or(0.0, |b| b.eye_height()); - let mut tgt_eye_offset = - bodies.get(*target).map_or(0.0, |b| b.eye_height()); - - // Special case for jumping attacks to jump at the body - // of the target and not the ground around the target - // For the ranged it is to shoot at the feet and not - // the head to get splash damage - if tactic == Tactic::QuadMedJump { - tgt_eye_offset += 1.0; - } else if matches!(tactic, Tactic::QuadLowRanged) { - tgt_eye_offset -= 1.0; - } + let tgt_eye_offset = bodies.get(*target).map_or(0.0, |b| b.eye_height()) + + // Special case for jumping attacks to jump at the body + // of the target and not the ground around the target + // For the ranged it is to shoot at the feet and not + // the head to get splash damage + if tactic == Tactic::QuadMedJump { + 1.0 + } else if matches!(tactic, Tactic::QuadLowRanged) { + -1.0 + } else { + 0.0 + }; // Hacky distance offset for ranged weapons let distance_offset = match tactic { @@ -467,7 +467,7 @@ impl<'a> System<'a> for Sys { .unwrap_or(true); if 1.0 - agent.psyche.aggro > damage && flees { if let Some(body) = body { - if body.is_humanoid() { + if body.can_strafe() { controller.actions.push(ControlAction::Unwield); } } @@ -529,7 +529,7 @@ impl<'a> System<'a> for Sys { inputs.move_z = bearing.z; } - if dist_sqrd < 16.0f32.powf(2.0) + if dist_sqrd < 16.0f32.powi(2) && thread_rng().gen::() < 0.02 { inputs.roll.set_state(true); diff --git a/voxygen/src/anim/src/quadruped_low/alpha.rs b/voxygen/src/anim/src/quadruped_low/alpha.rs index 2a92a56ae9..68b98b2304 100644 --- a/voxygen/src/anim/src/quadruped_low/alpha.rs +++ b/voxygen/src/anim/src/quadruped_low/alpha.rs @@ -25,8 +25,8 @@ impl Animation for AlphaAnimation { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.5), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(4.0), 0.0), + Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0), Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), _ => (0.0, 0.0, 0.0), };