diff --git a/assets/common/abilities/custom/arthropodbasic/singlestrike.ron b/assets/common/abilities/custom/arthropodbasic/singlestrike.ron index a224bd9390..08d9f3a31a 100644 --- a/assets/common/abilities/custom/arthropodbasic/singlestrike.ron +++ b/assets/common/abilities/custom/arthropodbasic/singlestrike.ron @@ -7,7 +7,7 @@ ComboMelee( base_poise_damage: 28, poise_damage_increase: 0, knockback: 3.0, - range: 2.7, + range: 3.0, angle: 60.0, base_buildup_duration: 0.4, base_swing_duration: 0.1, diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index fecbaabdfa..1833bcace2 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -690,8 +690,10 @@ impl Body { ), _ => false, }, - BuffKind::Ensnared => { - matches!(self, Body::BipedLarge(b) if matches!(b.species, biped_large::Species::Harvester)) + BuffKind::Ensnared => match self { + Body::BipedLarge(b) => matches!(b.species, biped_large::Species::Harvester), + Body::Arthropod(_) => true, + _ => false, }, _ => false, } diff --git a/server/src/sys/agent/attack.rs b/server/src/sys/agent/attack.rs index 6b30ecec99..9cca5f60d7 100644 --- a/server/src/sys/agent/attack.rs +++ b/server/src/sys/agent/attack.rs @@ -1690,19 +1690,15 @@ impl<'a> AgentData<'a> { read_data: &ReadData, ) { agent.action_state.timer += read_data.dt.0; - dbg!(agent.action_state.timer); - if agent.action_state.timer > 6.0 + if agent.action_state.timer > 12.0 && attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2) { controller.inputs.move_dir = Vec2::zero(); controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); - if matches!(self.char_state, CharacterState::SpriteSummon(c) if matches!(c.stage_section, StageSection::Recover)) - { // Reset timer agent.action_state.timer = 0.0; - } } else if attack_data.angle < 90.0 && attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2) { @@ -1710,7 +1706,7 @@ impl<'a> AgentData<'a> { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); - } else if attack_data.angle < 15.0 + } else if thread_rng().gen_bool(0.01) && attack_data.angle < 15.0 && attack_data.dist_sqrd < (6.0 * attack_data.min_attack_dist).powi(2) { controller @@ -1730,18 +1726,18 @@ impl<'a> AgentData<'a> { read_data: &ReadData, ) { agent.action_state.timer += read_data.dt.0; - dbg!(agent.action_state.timer); - if agent.action_state.timer > 6.0 - && attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2) + if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover)) { - controller.inputs.move_dir = Vec2::zero(); + // If already charging, keep charging if not in recover controller .actions .push(ControlAction::basic_input(InputKind::Secondary)); - if matches!(self.char_state, CharacterState::SpriteSummon(c) if matches!(c.stage_section, StageSection::Recover)) - { - // Reset timer - agent.action_state.timer = 0.0; + } else if attack_data.dist_sqrd > (5.0 * attack_data.min_attack_dist).powi(2) { + // Charges at target if they are far enough away + if attack_data.angle < 60.0 { + controller + .actions + .push(ControlAction::basic_input(InputKind::Secondary)); } } else if attack_data.angle < 90.0 && attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2) @@ -1750,12 +1746,6 @@ impl<'a> AgentData<'a> { controller .actions .push(ControlAction::basic_input(InputKind::Primary)); - } else if attack_data.angle < 15.0 - && attack_data.dist_sqrd < (6.0 * attack_data.min_attack_dist).powi(2) - { - controller - .actions - .push(ControlAction::basic_input(InputKind::Ability(0))); } else { self.path_toward_target(agent, controller, tgt_data, read_data, false, false, None); } diff --git a/voxygen/anim/src/arthropod/alpha.rs b/voxygen/anim/src/arthropod/alpha.rs index ada6b1d56e..313979691e 100644 --- a/voxygen/anim/src/arthropod/alpha.rs +++ b/voxygen/anim/src/arthropod/alpha.rs @@ -1,3 +1,5 @@ +use std::f32::consts::PI; + use super::{ super::{vek::*, Animation}, ArthropodSkeleton, SkeletonAttr, @@ -16,36 +18,49 @@ impl Animation for AlphaAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "arthropod_alpha")] fn update_skeleton_inner<'a>( skeleton: &Self::Skeleton, - (_velocity, _global_time, stage_section, _timer): Self::Dependency<'a>, + (_velocity, global_time, stage_section, timer): Self::Dependency<'a>, anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let (_movement1base, _movement2base, _movement3) = match stage_section { + let (movement1, movement2, movement3) = match stage_section { Some(StageSection::Buildup) => (anim_time.powi(2), 0.0, 0.0), Some(StageSection::Action) => (1.0, anim_time.powi(4), 0.0), Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; - //let pullback = 1.0 - movement3; - //let subtract = global_time - timer; - //let check = subtract - subtract.trunc(); - //let mirror = (check - 0.5).signum(); + let pullback = 1.0 - movement3; + let subtract = global_time - timer; + let check = subtract - subtract.trunc(); + let mirror = (check - 0.5).signum(); //let movement1 = mirror * movement1base * pullback; //let movement2 = mirror * movement2base * pullback; - //let movement1abs = movement1base * pullback; - //let movement2abs = movement2base * pullback; + let movement1abs = movement1 * pullback; + let movement2abs = movement2 * pullback; + let movement3abs = movement3 * pullback; next.chest.scale = Vec3::one() / s_a.scaler; + next.chest.orientation = Quaternion::rotation_x(movement2abs * 0.3) + * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.02); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + next.head.orientation = + Quaternion::rotation_x(movement1abs * 0.5 + movement2abs * -1.5 + movement3abs * 0.8) + * Quaternion::rotation_y(mirror * movement1abs * -0.2 + mirror * movement2abs * 0.2) + * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.02); next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); next.mandible_l.position = Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2); next.mandible_r.position = Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2); + next.mandible_l.orientation = + Quaternion::rotation_x(movement1abs * 0.5 + movement2abs * -1.5 + movement3abs * 0.8) + * Quaternion::rotation_z(movement1abs * 0.5 + movement2abs * -0.6 + movement3abs * 0.8); + next.mandible_r.orientation = + Quaternion::rotation_x(movement1abs * 0.5 + movement2abs * -1.5 + movement3abs * 0.8) + * Quaternion::rotation_z(movement1abs * -0.5 + movement2abs * 0.6 + movement3abs * -0.8); next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2); next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2); @@ -55,6 +70,10 @@ impl Animation for AlphaAnimation { next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2); next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2); + next.leg_fl.orientation = Quaternion::rotation_z(s_a.leg_ori.0 + movement1abs * 0.4 + movement2abs * -0.4 + movement3abs * 0.8) * + Quaternion::rotation_x(movement1abs * 1.0 + movement2abs * -1.8 + movement3abs * 0.8); + next.leg_fr.orientation = Quaternion::rotation_z(-s_a.leg_ori.0 + movement1abs * -0.4 + movement2abs * 0.4 + movement3abs * -0.8) * + Quaternion::rotation_x(movement1abs * 1.0 + movement2abs * -1.8 + movement3abs * 0.8); next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2); next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2); diff --git a/voxygen/anim/src/arthropod/run.rs b/voxygen/anim/src/arthropod/run.rs index a8072d0cd9..cc8207f831 100644 --- a/voxygen/anim/src/arthropod/run.rs +++ b/voxygen/anim/src/arthropod/run.rs @@ -15,16 +15,17 @@ impl Animation for RunAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "arthropod_run")] fn update_skeleton_inner<'a>( skeleton: &Self::Skeleton, - (_velocity, _orientation, _last_ori, _global_time, _avg_vel, acc_vel): Self::Dependency<'a>, + (velocity, _orientation, _last_ori, _global_time, avg_vel, acc_vel): Self::Dependency<'a>, anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - //let speed = (Vec2::::from(velocity).magnitude()).min(22.0); + let speed = (Vec2::::from(velocity).magnitude()).min(22.0); *rate = 1.0; - //let speednorm = speed / 13.0; + let speednorm = speed / 13.0; + //let canceler = (speed / 24.0).powf(0.6); //let speednorm = (speed / 13.0).powf(0.25); let mixed_vel = (acc_vel + anim_time * 6.0) * 0.8; //sets run frequency using speed, with anim_time setting a floor @@ -36,7 +37,7 @@ impl Animation for RunAnimation { // + 0.28 * ((mixed_vel * 1.0 * lab * speedmult + PI * -0.15 - // 0.5).sin()).powi(2))) //.sqrt()) - // + // // * ((mixed_vel * 1.0 * lab * speedmult + PI * -0.15 - 0.5).sin()) // * speednorm; @@ -56,9 +57,9 @@ impl Animation for RunAnimation { // * last_ori.determine_side(Vec2::zero(), ori).signum() //} else { // 0.0 - //} + //} //} * 1.3; - //let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()) * speednorm; + let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()) * speednorm; next.chest.scale = Vec3::one() / s_a.scaler; next.wing_bl.scale = Vec3::one() * 0.98; @@ -69,8 +70,8 @@ impl Animation for RunAnimation { * Quaternion::rotation_y((mixed_vel).sin().min(0.0) * 0.08) * Quaternion::rotation_z((mixed_vel + PI * 1.5).sin() * 0.08); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); - next.chest.orientation = Quaternion::rotation_x((mixed_vel).sin().max(0.0) * 0.06) + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + x_tilt); + next.chest.orientation = Quaternion::rotation_x((mixed_vel).sin().max(0.0) * 0.06 + x_tilt) * Quaternion::rotation_z((mixed_vel + PI / 2.0).sin() * 0.06); next.mandible_l.position = Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);