diff --git a/assets/common/abilities/unique/husk/singlestrike.ron b/assets/common/abilities/unique/husk/singlestrike.ron new file mode 100644 index 0000000000..a9b41eea6e --- /dev/null +++ b/assets/common/abilities/unique/husk/singlestrike.ron @@ -0,0 +1,25 @@ +ComboMelee( + stage_data: [ + ( + stage: 1, + base_damage: 90, + damage_increase: 0, + base_poise_damage: 30, + poise_damage_increase: 0, + knockback: 5.0, + range: 3.5, + angle: 60.0, + base_buildup_duration: 0.25, + base_swing_duration: 0.07, + base_recover_duration: 0.25, + forward_movement: 0.5, + ), + ], + initial_energy_gain: 0, + max_energy_gain: 0, + energy_increase: 0, + speed_increase: 0.0, + max_speed_increase: 0.0, + scales_from_combo: 0, + is_interruptible: false, +) diff --git a/assets/common/abilities/unique/husk/triplestrike.ron b/assets/common/abilities/unique/husk/triplestrike.ron new file mode 100644 index 0000000000..6c453419b0 --- /dev/null +++ b/assets/common/abilities/unique/husk/triplestrike.ron @@ -0,0 +1,53 @@ +ComboMelee( + stage_data: [ + ( + stage: 1, + base_damage: 120, + damage_increase: 0, + base_poise_damage: 35, + poise_damage_increase: 0, + knockback: 5.0, + range: 3.5, + angle: 30.0, + base_buildup_duration: 0.2, + base_swing_duration: 0.07, + base_recover_duration: 0.2, + forward_movement: 1.0, + ), + ( + stage: 2, + base_damage: 120, + damage_increase: 0, + base_poise_damage: 35, + poise_damage_increase: 0, + knockback: 5.0, + range: 3.5, + angle: 30.0, + base_buildup_duration: 0.22, + base_swing_duration: 0.07, + base_recover_duration: 0.2, + forward_movement: 0.0, + ), + ( + stage: 3, + base_damage: 120, + damage_increase: 0, + base_poise_damage: 35, + poise_damage_increase: 0, + knockback: 5.0, + range: 3.5, + angle: 30.0, + base_buildup_duration: 0.2, + base_swing_duration: 0.07, + base_recover_duration: 0.2, + forward_movement: 1.0, + ), + ], + initial_energy_gain: 0, + max_energy_gain: 0, + energy_increase: 0, + speed_increase: 0.0, + max_speed_increase: 0.0, + scales_from_combo: 0, + is_interruptible: false, +) diff --git a/assets/common/abilities/weapon_ability_manifest.ron b/assets/common/abilities/weapon_ability_manifest.ron index ec481c4b9c..21a39831a8 100644 --- a/assets/common/abilities/weapon_ability_manifest.ron +++ b/assets/common/abilities/weapon_ability_manifest.ron @@ -29,6 +29,11 @@ (Some(Bow(UnlockRepeater)), "common.abilities.bow.repeater"), ], ), + Unique(Husk): ( + primary: "common.abilities.unique.husk.singlestrike", + secondary: "common.abilities.unique.husk.triplestrike", + abilities: [], + ), Spear: ( primary: "common.abilities.spear.doublestrike", secondary: "common.abilities.spear.dash", diff --git a/assets/common/items/npc_weapons/unique/husk.ron b/assets/common/items/npc_weapons/unique/husk.ron new file mode 100644 index 0000000000..ba9d250c87 --- /dev/null +++ b/assets/common/items/npc_weapons/unique/husk.ron @@ -0,0 +1,18 @@ +ItemDef( + name: "Husk", + description: "testing123", + kind: Tool(( + kind: Unique(Husk), + hands: Two, + stats: Direct(( + equip_time_secs: 0.01, + power: 1.0, + poise_strength: 1.0, + speed: 1.0, + crit_chance: 0.0625, + crit_mult: 1.9142857, + )), + )), + quality: Low, + tags: [], +) \ No newline at end of file diff --git a/assets/voxygen/voxel/biped_large_central_manifest.ron b/assets/voxygen/voxel/biped_large_central_manifest.ron index 02d09ecbab..534151f37c 100644 --- a/assets/voxygen/voxel/biped_large_central_manifest.ron +++ b/assets/voxygen/voxel/biped_large_central_manifest.ron @@ -478,7 +478,7 @@ central: ("npc.mindflayer.male.torso_upper"), ), torso_lower: ( - offset: (-12.5, -10.0, -9.0), + offset: (-12.5, -10.0, -18.0), central: ("npc.mindflayer.male.torso_lower"), ), jaw: ( @@ -504,7 +504,7 @@ central: ("npc.mindflayer.male.torso_upper"), ), torso_lower: ( - offset: (-12.5, -10.0, -9.0), + offset: (-12.5, -10.0, -18.0), central: ("npc.mindflayer.male.torso_lower"), ), jaw: ( diff --git a/assets/voxygen/voxel/biped_small_armor_pants_manifest.ron b/assets/voxygen/voxel/biped_small_armor_pants_manifest.ron index 439cbb92ba..1d860c4156 100644 --- a/assets/voxygen/voxel/biped_small_armor_pants_manifest.ron +++ b/assets/voxygen/voxel/biped_small_armor_pants_manifest.ron @@ -37,7 +37,7 @@ vox_spec: ("npc.myrmidon.male.pants", (-2.5, -4.5, -1.5)), ), "Husk": ( - vox_spec: ("npc.husk.male.pants", (-5.0, -4.5, -3.0)), + vox_spec: ("npc.husk.male.pants", (-5.0, -4.5, -6.0)), ), }, )) diff --git a/assets/voxygen/voxel/biped_weapon_manifest.ron b/assets/voxygen/voxel/biped_weapon_manifest.ron index 24170e50eb..8d02ae1358 100644 --- a/assets/voxygen/voxel/biped_weapon_manifest.ron +++ b/assets/voxygen/voxel/biped_weapon_manifest.ron @@ -969,7 +969,7 @@ vox_spec: ("armor.empty", (-3.0, -3.5, 1.0)), color: None ), - "common.items.npc_weapons.unique.quadmedbasic": ( + "common.items.npc_weapons.unique.husk": ( vox_spec: ("armor.empty", (-3.0, -3.5, 1.0)), color: None ), diff --git a/common/src/comp/inventory/item/tool.rs b/common/src/comp/inventory/item/tool.rs index 8c4fa2c9f4..bc60eec199 100644 --- a/common/src/comp/inventory/item/tool.rs +++ b/common/src/comp/inventory/item/tool.rs @@ -406,6 +406,7 @@ impl assets::Compound for AbilityMap { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum UniqueKind { StoneGolemFist, + Husk, BeastClaws, WendigoMagic, TidalClaws, diff --git a/common/src/comp/inventory/loadout_builder.rs b/common/src/comp/inventory/loadout_builder.rs index b1abd86f4f..8986cf0aee 100644 --- a/common/src/comp/inventory/loadout_builder.rs +++ b/common/src/comp/inventory/loadout_builder.rs @@ -311,7 +311,7 @@ impl LoadoutBuilder { }, (biped_small::Species::Husk, _) => { main_tool = Some(Item::new_from_asset_expect( - "common.items.npc_weapons.unique.quadmedbasic", + "common.items.npc_weapons.unique.husk", )); }, _ => { diff --git a/voxygen/anim/src/biped_large/alpha.rs b/voxygen/anim/src/biped_large/alpha.rs index 56669e6937..9859ef8175 100644 --- a/voxygen/anim/src/biped_large/alpha.rs +++ b/voxygen/anim/src/biped_large/alpha.rs @@ -76,8 +76,8 @@ impl Animation for AlphaAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip); - next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip); + next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0); next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); @@ -90,8 +90,8 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6); next.control.position = Vec3::new( -3.0 + move1 * -4.0 + move2 * 5.0, - 5.0 + s_a.grip / 1.2 + move1 * -4.0 + move2 * 8.0, - -4.0 + -s_a.grip / 2.0 + move2 * -5.0, + 5.0 + s_a.grip.0 / 1.2 + move1 * -4.0 + move2 * 8.0, + -4.0 + -s_a.grip.0 / 2.0 + move2 * -5.0, ); next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.5 + move2 * -0.7); next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.7); @@ -113,8 +113,8 @@ impl Animation for AlphaAnimation { next.control.position = Vec3::new( 4.0 + move1 * -12.0 + move2 * 20.0, - (s_a.grip / 1.0) + move1 * -3.0 + move2 * 5.0, - (-s_a.grip / 0.8) + move1 * -2.0 + move2 * 8.0, + (s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * 5.0, + (-s_a.grip.0 / 0.8) + move1 * -2.0 + move2 * 8.0, ); next.head.orientation = Quaternion::rotation_x(move1 * -0.25) * Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6); @@ -138,8 +138,8 @@ impl Animation for AlphaAnimation { next.control.position = Vec3::new( 4.0 + move1 * -12.0 + move2 * 28.0, - (s_a.grip / 1.0) + move1 * -3.0 + move2 * -5.0, - (-s_a.grip / 0.8) + move1 * 2.0 + move2 * 8.0, + (s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * -5.0, + (-s_a.grip.0 / 0.8) + move1 * 2.0 + move2 * 8.0, ); next.head.orientation = Quaternion::rotation_x(move1 * -0.25) * Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6); diff --git a/voxygen/anim/src/biped_large/beam.rs b/voxygen/anim/src/biped_large/beam.rs index ae31a4121c..2dfa41e767 100644 --- a/voxygen/anim/src/biped_large/beam.rs +++ b/voxygen/anim/src/biped_large/beam.rs @@ -2,7 +2,10 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; -use common::{comp::item::ToolKind, states::utils::StageSection}; +use common::{ + comp::item::{ToolKind, UniqueKind}, + states::utils::StageSection, +}; use std::f32::consts::PI; pub struct BeamAnimation; @@ -53,23 +56,25 @@ impl Animation for BeamAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip); - next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip); + next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0); next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); match active_tool_kind { - Some(ToolKind::StaffSimple) | Some(ToolKind::Sceptre) => { + Some(ToolKind::StaffSimple) + | Some(ToolKind::Sceptre) + | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => { let (move1base, move2shake, _move2base, move3) = match stage_section { Some(StageSection::Buildup) => ( (anim_time.powf(0.25)).min(1.0), - (anim_time * 10.0 + PI).sin(), + (anim_time * 15.0 + PI).sin(), (anim_time * 10.0 + PI).sin(), 0.0, ), Some(StageSection::Cast) => ( 1.0, - (anim_time * 10.0 + PI).sin(), + (anim_time * 15.0 + PI).sin(), anim_time.powf(0.25), 0.0, ), @@ -80,14 +85,15 @@ impl Animation for BeamAnimation { let move1 = move1base * pullback; next.control_l.position = Vec3::new(-1.0, 3.0, 12.0); next.control_r.position = - Vec3::new(1.0 + move1 * 5.0, 2.0 + move1 * 1.0, 2.0 + move1 * 8.0); + Vec3::new(1.0 + move1 * 5.0, 2.0 + move1 * 1.0, 2.0 + move1 * 14.0); next.control.position = Vec3::new( - -3.0 + move1 * 5.0, - 3.0 + s_a.grip / 1.2 + move1 * 5.0 + move2shake * 1.0, - -11.0 + -s_a.grip / 2.0 + move1 * -4.0, + -3.0 + move1 * -5.0, + 3.0 + s_a.grip.0 / 1.2 + move1 * 3.0 + move2shake * 1.0, + -11.0 + -s_a.grip.0 / 2.0 + move1 * -2.0, ); - next.head.orientation = Quaternion::rotation_x(move1 * -0.2); + next.head.orientation = + Quaternion::rotation_x(move1 * -0.2) * Quaternion::rotation_y(move1 * 0.2); next.jaw.orientation = Quaternion::rotation_x(0.0); next.control_l.orientation = @@ -96,8 +102,8 @@ impl Animation for BeamAnimation { * Quaternion::rotation_y(0.5) * Quaternion::rotation_z(move1 * 1.2 + move2shake * 0.5); - next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * -0.2) - * Quaternion::rotation_y(-0.1 + move1 * -0.4); + next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * -0.1) + * Quaternion::rotation_y(-0.1 + move1 * 0.6); next.shoulder_l.position = Vec3::new( -s_a.shoulder.0, s_a.shoulder.1, diff --git a/voxygen/anim/src/biped_large/beta.rs b/voxygen/anim/src/biped_large/beta.rs index e7755fb41d..258000ff2e 100644 --- a/voxygen/anim/src/biped_large/beta.rs +++ b/voxygen/anim/src/biped_large/beta.rs @@ -75,8 +75,8 @@ impl Animation for BetaAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip); - next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip); + next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0); next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); @@ -89,8 +89,8 @@ impl Animation for BetaAnimation { * Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6); next.control.position = Vec3::new( -3.0 + move1 * -4.0 + move2 * 5.0, - 5.0 + s_a.grip / 1.2 + move1 * -4.0 + move2 * 8.0, - -4.0 + -s_a.grip / 2.0 + move2 * -5.0, + 5.0 + s_a.grip.0 / 1.2 + move1 * -4.0 + move2 * 8.0, + -4.0 + -s_a.grip.0 / 2.0 + move2 * -5.0, ); next.upper_torso.orientation = Quaternion::rotation_z(move1base * 0.5 + move2 * -0.7); @@ -114,8 +114,8 @@ impl Animation for BetaAnimation { next.control.position = Vec3::new( 4.0 + move1 * -12.0 + move2 * 20.0, - (s_a.grip / 1.0) + move1 * -3.0 + move2 * 5.0, - (-s_a.grip / 0.8) + move1 * 6.0 + move2 * 8.0, + (s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * 5.0, + (-s_a.grip.0 / 0.8) + move1 * 6.0 + move2 * 8.0, ); next.head.orientation = Quaternion::rotation_x(move1 * -0.25) * Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6); @@ -139,8 +139,8 @@ impl Animation for BetaAnimation { next.control.position = Vec3::new( 4.0 + move1 * -18.0 + move2 * 20.0, - (s_a.grip / 1.0) + move1 * -3.0 + move2 * 12.0, - (-s_a.grip / 0.8) + move1 * -2.0 + move2 * 4.0, + (s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * 12.0, + (-s_a.grip.0 / 0.8) + move1 * -2.0 + move2 * 4.0, ); next.head.orientation = Quaternion::rotation_x(move1 * -0.25) * Quaternion::rotation_z(move1 * -0.9 + move2 * 0.6); diff --git a/voxygen/anim/src/biped_large/blink.rs b/voxygen/anim/src/biped_large/blink.rs new file mode 100644 index 0000000000..6c639c5df2 --- /dev/null +++ b/voxygen/anim/src/biped_large/blink.rs @@ -0,0 +1,112 @@ +use super::{ + super::{vek::*, Animation}, + BipedLargeSkeleton, SkeletonAttr, +}; +use common::{ + comp::item::{ToolKind, UniqueKind}, + states::utils::StageSection, +}; +use std::f32::consts::PI; + +pub struct BlinkAnimation; + +impl Animation for BlinkAnimation { + type Dependency = ( + Option, + Option, + Vec3, + f32, + Option, + f32, + ); + type Skeleton = BipedLargeSkeleton; + + #[cfg(feature = "use-dyn-lib")] + const UPDATE_FN: &'static [u8] = b"biped_large_blink\0"; + + #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_blink")] + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 + fn update_skeleton_inner( + skeleton: &Self::Skeleton, + (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency, + anim_time: f32, + rate: &mut f32, + s_a: &SkeletonAttr, + ) -> Self::Skeleton { + *rate = 1.0; + let mut next = (*skeleton).clone(); + let speed = Vec2::::from(velocity).magnitude(); + + let lab: f32 = 0.65 * s_a.tempo; + let speednorm = (speed / 12.0).powf(0.4); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); + + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); + let (move1base, move2) = match stage_section { + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, anim_time.powi(4)), + _ => (0.0, 0.0), + }; + let pullback = 1.0 - move2; + let move1 = move1base * pullback; + + next.shoulder_l.position = Vec3::new( + -s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothorir * 1.0, + ); + next.shoulder_l.orientation = + Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm); + + next.shoulder_r.position = Vec3::new( + s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothoril * 1.0, + ); + next.shoulder_r.orientation = + Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm); + next.torso.orientation = Quaternion::rotation_z(0.0); + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0); + + next.hand_l.orientation = Quaternion::rotation_x(0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0); + + match active_tool_kind { + Some(ToolKind::StaffSimple) | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => { + next.head.orientation = + Quaternion::rotation_x(move1 * -0.3) * Quaternion::rotation_y(move1 * -0.1); + next.control_l.position = Vec3::new(-1.0, 3.0, 12.0); + next.control_r.position = + Vec3::new(1.0 + move1 * 12.0, 2.0 + move1 * 8.0, 2.0 + move1 * 18.0); + + next.control.position = Vec3::new( + -3.0 + move1 * -4.0, + 3.0 + s_a.grip.0 / 1.2 + move1 * -8.0, + -11.0 + -s_a.grip.0 / 2.0, + ); + + next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * -0.8) + * Quaternion::rotation_y(-0.5 + move1 * -0.0) + * Quaternion::rotation_z(move1 * 0.0); + next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.7) + * Quaternion::rotation_y(0.5 + move1 * -0.6) + * Quaternion::rotation_z(move1 * 1.5); + + next.control.orientation = + Quaternion::rotation_x(-0.2 + move1 * -0.4) * Quaternion::rotation_y(-0.1); + }, + + _ => {}, + } + next + } +} diff --git a/voxygen/anim/src/biped_large/dash.rs b/voxygen/anim/src/biped_large/dash.rs index e9d65502f5..575420797d 100644 --- a/voxygen/anim/src/biped_large/dash.rs +++ b/voxygen/anim/src/biped_large/dash.rs @@ -47,8 +47,8 @@ impl Animation for DashAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip); - next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip); + next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0); next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); @@ -88,8 +88,8 @@ impl Animation for DashAnimation { * Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6); next.control.position = Vec3::new( -3.0 + move1 * -2.0 + move2 * 2.0, - 5.0 + s_a.grip / 1.2 + move1 * -4.0 + move2 * 2.0 + move3 * 8.0, - -4.0 + -s_a.grip / 2.0 + move2 * -5.0 + move3 * 5.0, + 5.0 + s_a.grip.0 / 1.2 + move1 * -4.0 + move2 * 2.0 + move3 * 8.0, + -4.0 + -s_a.grip.0 / 2.0 + move2 * -5.0 + move3 * 5.0, ); next.upper_torso.orientation = Quaternion::rotation_x(move2 * -0.2 + move3 * 0.2) * Quaternion::rotation_z(move1 * 0.8 + move3 * -0.7); @@ -114,8 +114,8 @@ impl Animation for DashAnimation { next.control.position = Vec3::new( 4.0 + move1 * -3.0 + move3 * -5.0, - (s_a.grip / 1.0) + move1 * -1.0 + move3 * 1.0 + footrotl * 2.0, - (-s_a.grip / 0.8) + move1 * 2.0 + move3 * -3.0, + (s_a.grip.0 / 1.0) + move1 * -1.0 + move3 * 1.0 + footrotl * 2.0, + (-s_a.grip.0 / 0.8) + move1 * 2.0 + move3 * -3.0, ); next.head.orientation = Quaternion::rotation_x(move1 * -0.5 + move3 * 0.5) * Quaternion::rotation_z(move1 * 0.3 + move3 * 0.3); diff --git a/voxygen/anim/src/biped_large/mod.rs b/voxygen/anim/src/biped_large/mod.rs index f2d159f06e..d277b5dc38 100644 --- a/voxygen/anim/src/biped_large/mod.rs +++ b/voxygen/anim/src/biped_large/mod.rs @@ -1,6 +1,7 @@ pub mod alpha; pub mod beam; pub mod beta; +pub mod blink; pub mod charge; pub mod dash; pub mod equip; @@ -12,15 +13,16 @@ pub mod shockwave; pub mod shoot; pub mod spin; pub mod spinmelee; +pub mod summon; pub mod wield; // Reexports pub use self::{ - alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, charge::ChargeAnimation, - dash::DashAnimation, equip::EquipAnimation, idle::IdleAnimation, jump::JumpAnimation, - leapmelee::LeapAnimation, run::RunAnimation, shockwave::ShockwaveAnimation, - shoot::ShootAnimation, spin::SpinAnimation, spinmelee::SpinMeleeAnimation, - wield::WieldAnimation, + alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, blink::BlinkAnimation, + charge::ChargeAnimation, dash::DashAnimation, equip::EquipAnimation, idle::IdleAnimation, + jump::JumpAnimation, leapmelee::LeapAnimation, run::RunAnimation, + shockwave::ShockwaveAnimation, shoot::ShootAnimation, spin::SpinAnimation, + spinmelee::SpinMeleeAnimation, summon::SummonAnimation, wield::WieldAnimation, }; use super::{make_bone, vek::*, FigureBoneData, Skeleton}; @@ -127,7 +129,7 @@ pub struct SkeletonAttr { foot: (f32, f32, f32), scaler: f32, tempo: f32, - grip: f32, + grip: (f32, f32), shl: (f32, f32, f32, f32, f32, f32), shr: (f32, f32, f32, f32, f32, f32), sc: (f32, f32, f32, f32, f32, f32), @@ -169,7 +171,7 @@ impl Default for SkeletonAttr { foot: (0.0, 0.0, 0.0), scaler: 0.0, tempo: 0.0, - grip: 0.0, + grip: (0.0, 0.0), shl: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), shr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), sc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), @@ -259,7 +261,7 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Occultsaurok, _) => (0.0, -5.0), (Mightysaurok, _) => (0.0, -5.0), (Slysaurok, _) => (0.0, -6.0), - (Mindflayer, _) => (3.5, -19.5), + (Mindflayer, _) => (3.5, -10.0), (Minotaur, _) => (1.5, -8.5), (Tidalwarrior, _) => (0.0, -9.5), (Yeti, _) => (0.0, -6.5), @@ -343,7 +345,7 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Occultsaurok, _) => (3.5, 3.5, -10.0), (Mightysaurok, _) => (3.5, 3.5, -10.0), (Slysaurok, _) => (3.5, 3.5, -10.0), - (Mindflayer, _) => (4.5, 1.5, -7.0), + (Mindflayer, _) => (4.5, 1.5, -16.0), (Minotaur, _) => (6.0, 4.5, -17.5), (Tidalwarrior, _) => (3.5, 0.5, -10.5), (Yeti, _) => (4.5, 0.5, -12.5), @@ -380,23 +382,23 @@ impl<'a> From<&'a Body> for SkeletonAttr { _ => 1.0, }, grip: match (body.species, body.body_type) { - (Ogre, Male) => 13.0, - (Ogre, Female) => 8.0, - (Cyclops, _) => 12.0, - (Wendigo, _) => 15.0, - (Troll, _) => 12.0, - (Dullahan, _) => 15.0, - (Werewolf, _) => 13.0, - (Occultsaurok, _) => 10.0, - (Mightysaurok, _) => 10.0, - (Slysaurok, _) => 10.0, - (Mindflayer, _) => 12.0, - (Minotaur, _) => 14.0, - (Tidalwarrior, _) => 14.0, - (Yeti, _) => 12.5, - (Harvester, _) => 7.5, - (Blueoni, _) => 12.5, - (Redoni, _) => 12.5, + (Ogre, Male) => (13.0, 0.0), + (Ogre, Female) => (8.0, 0.0), + (Cyclops, _) => (12.0, 0.0), + (Wendigo, _) => (15.0, 0.0), + (Troll, _) => (12.0, 0.0), + (Dullahan, _) => (15.0, 0.0), + (Werewolf, _) => (13.0, 0.0), + (Occultsaurok, _) => (10.0, 0.0), + (Mightysaurok, _) => (10.0, 0.0), + (Slysaurok, _) => (10.0, 0.0), + (Mindflayer, _) => (12.0, 2.5), + (Minotaur, _) => (14.0, 0.0), + (Tidalwarrior, _) => (14.0, 0.0), + (Yeti, _) => (12.5, 0.0), + (Harvester, _) => (7.5, 0.0), + (Blueoni, _) => (12.5, 0.0), + (Redoni, _) => (12.5, 0.0), }, shl: match (body.species, body.body_type) { (Dullahan, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), diff --git a/voxygen/anim/src/biped_large/shoot.rs b/voxygen/anim/src/biped_large/shoot.rs index def34fd2b0..fcbed1d63f 100644 --- a/voxygen/anim/src/biped_large/shoot.rs +++ b/voxygen/anim/src/biped_large/shoot.rs @@ -82,8 +82,8 @@ impl Animation for ShootAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip); - next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip); + next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0); next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); @@ -105,8 +105,8 @@ impl Animation for ShootAnimation { next.control.position = Vec3::new( -3.0, - 3.0 + s_a.grip / 1.2 + move1 * 4.0 + move2 + move1shake * 2.0 + move2 * -2.0, - -11.0 + -s_a.grip / 2.0 + move1 * 3.0, + 3.0 + s_a.grip.0 / 1.2 + move1 * 4.0 + move2 + move1shake * 2.0 + move2 * -2.0, + -11.0 + -s_a.grip.0 / 2.0 + move1 * 3.0, ); next.head.orientation = Quaternion::rotation_x(move1 * -0.15) * Quaternion::rotation_y(move1 * 0.25) @@ -154,8 +154,8 @@ impl Animation for ShootAnimation { next.control.position = Vec3::new( -1.0 + move1 * 2.0, - 6.0 + s_a.grip / 1.2 + move1 * 7.0, - -5.0 + -s_a.grip / 2.0 + move1 * 8.0, + 6.0 + s_a.grip.0 / 1.2 + move1 * 7.0, + -5.0 + -s_a.grip.0 / 2.0 + move1 * 8.0, ); next.control_l.orientation = diff --git a/voxygen/anim/src/biped_large/spinmelee.rs b/voxygen/anim/src/biped_large/spinmelee.rs index c86c788b83..a23d58dbe2 100644 --- a/voxygen/anim/src/biped_large/spinmelee.rs +++ b/voxygen/anim/src/biped_large/spinmelee.rs @@ -2,7 +2,10 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; -use common::{comp::item::ToolKind, states::utils::StageSection}; +use common::{ + comp::item::{ToolKind, UniqueKind}, + states::utils::StageSection, +}; use std::f32::consts::PI; pub struct SpinMeleeAnimation; @@ -14,6 +17,7 @@ impl Animation for SpinMeleeAnimation { Vec3, f32, Option, + f32, ); type Skeleton = BipedLargeSkeleton; @@ -24,122 +28,97 @@ impl Animation for SpinMeleeAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section): Self::Dependency, + (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency, anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; - let lab: f32 = 1.0; - let (_movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), + let mut next = (*skeleton).clone(); + + let speed = Vec2::::from(velocity).magnitude(); + + let lab: f32 = 0.65 * s_a.tempo; + let speednorm = (speed / 12.0).powf(0.4); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); + + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); + + let (move1base, move2, move3) = match stage_section { + Some(StageSection::Buildup) => ((anim_time.powf(0.25)), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, (anim_time * 0.05).sin() - 0.05, 0.0), + Some(StageSection::Recover) => (1.0, 0.0, anim_time), _ => (0.0, 0.0, 0.0), }; - let speed = Vec2::::from(velocity).magnitude(); - let mut next = (*skeleton).clone(); - //torso movement - let xshift = if velocity.z.abs() < 0.1 { - ((anim_time - 1.1) * lab * 3.0).sin() - } else { - 0.0 - }; - let yshift = if velocity.z.abs() < 0.1 { - ((anim_time - 1.1) * lab * 3.0 + PI / 2.0).sin() - } else { - 0.0 - }; + let pullback = 1.0 - move3; + let move1 = move1base * pullback; - let spin = if anim_time < 1.1 && velocity.z.abs() < 0.1 { - 0.5 * (anim_time.powi(2)) - } else { - lab * anim_time * 0.9 - }; + next.shoulder_l.position = Vec3::new( + -s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothorir * 1.0, + ); + next.shoulder_l.orientation = + Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm); - //feet - let slowersmooth = (anim_time * lab * 4.0).sin(); - let quick = (anim_time * lab * 8.0).sin(); + next.shoulder_r.position = Vec3::new( + s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothoril * 1.0, + ); + next.shoulder_r.orientation = + Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm); + next.torso.orientation = Quaternion::rotation_z(0.0); + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0); + + next.hand_l.orientation = Quaternion::rotation_x(0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0); match active_tool_kind { - Some(ToolKind::Sword) => { - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); - - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3 - PI / 2.0 + movement3 * PI / 2.0) - * Quaternion::rotation_z(s_a.sc.5 - PI / 2.0 + movement3 * PI / 2.0); - next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0); - - next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); - next.upper_torso.orientation = Quaternion::rotation_y(0.3 + movement3 * -0.3); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_x(-0.15 + movement3 * 0.15); - next.lower_torso.orientation = Quaternion::rotation_x(0.2); - }, - Some(ToolKind::Axe) => { - next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); - next.hand_l.orientation = - Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(PI); - next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - next.main.position = Vec3::new(-0.0, -2.0, -1.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.control.position = Vec3::new(0.0, 16.0, 3.0); - next.control.orientation = - Quaternion::rotation_x(-1.4) * Quaternion::rotation_z(1.4); - - next.head.orientation = - Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(0.08); - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0 - 3.0, s_a.upper_torso.1 - 2.0); - next.upper_torso.orientation = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(-0.1) - * Quaternion::rotation_y(0.3); - - next.lower_torso.position = Vec3::new(0.0, 3.0, -2.5); - next.lower_torso.orientation = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.7) - * Quaternion::rotation_y(0.0); - next.torso.position = Vec3::new( - -xshift * anim_time.min(0.6), - -yshift * anim_time.min(0.6), - 0.0, + Some(ToolKind::StaffSimple) | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => { + next.head.orientation = Quaternion::rotation_x(move1 * -0.3 + move2 * 0.5); + next.control_l.position = Vec3::new( + -1.0 + move1 * -10.0 + move2 * -10.0, + 3.0, + 12.0 + move1 * 7.0, + ); + next.control_r.position = Vec3::new( + 1.0 + move1 * 10.0 + move2 * -10.0, + 2.0 + move1 * -0.0, + 2.0 + move1 * 15.0, ); - next.torso.orientation = Quaternion::rotation_z(spin * -16.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); - if velocity.z.abs() > 0.1 { - next.foot_l.position = Vec3::new(-s_a.foot.0, 8.0, s_a.foot.2 + 2.0); - next.foot_l.orientation = - Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0); - next.foot_r.position = Vec3::new(s_a.foot.0, 8.0, s_a.foot.2 + 2.0); - next.foot_r.orientation = Quaternion::rotation_x(1.0); - } else if speed < 0.5 { - next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2); + next.control.position = Vec3::new( + -3.0 + move1 * 3.0, + 3.0 + s_a.grip.0 / 1.2 + move1 * 18.0, + -11.0 + -s_a.grip.0 / 2.0 + move1 * 8.0, + ); - next.foot_r.position = Vec3::new(s_a.foot.0, 4.0, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2) - * Quaternion::rotation_y(-0.4); - } else { - next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2); + next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * 0.2) + * Quaternion::rotation_y(-0.5 + move1 * 0.3) + * Quaternion::rotation_z(move1 * 0.0); + next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.0) + * Quaternion::rotation_y(0.5 + move1 * -0.3) + * Quaternion::rotation_z(move2 * 1.0); - next.foot_r.position = Vec3::new(s_a.foot.0, 2.0 + quick * 6.0, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2); - }; + next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * 0.8) + * Quaternion::rotation_y(-0.1 + move1 * 0.1 + move2 * 1.0); + + next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.5); + + next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.8); + next.torso.position = Vec3::new(0.0, 0.0, move1 * 0.8); }, + _ => {}, } diff --git a/voxygen/anim/src/biped_large/summon.rs b/voxygen/anim/src/biped_large/summon.rs new file mode 100644 index 0000000000..04711738d9 --- /dev/null +++ b/voxygen/anim/src/biped_large/summon.rs @@ -0,0 +1,119 @@ +use super::{ + super::{vek::*, Animation}, + BipedLargeSkeleton, SkeletonAttr, +}; +use common::{ + comp::item::{ToolKind, UniqueKind}, + states::utils::StageSection, +}; +use std::f32::consts::PI; + +pub struct SummonAnimation; + +impl Animation for SummonAnimation { + type Dependency = ( + Option, + Option, + Vec3, + f32, + Option, + f32, + ); + type Skeleton = BipedLargeSkeleton; + + #[cfg(feature = "use-dyn-lib")] + const UPDATE_FN: &'static [u8] = b"biped_large_summon\0"; + + #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_summon")] + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 + fn update_skeleton_inner( + skeleton: &Self::Skeleton, + (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency, + anim_time: f32, + rate: &mut f32, + s_a: &SkeletonAttr, + ) -> Self::Skeleton { + *rate = 1.0; + let mut next = (*skeleton).clone(); + + let speed = Vec2::::from(velocity).magnitude(); + + let lab: f32 = 0.65 * s_a.tempo; + let speednorm = (speed / 12.0).powf(0.4); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); + + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); + + let (move1base, move2base, move3) = match stage_section { + Some(StageSection::Buildup) => ((anim_time.powf(0.5)), 0.0, 0.0), + Some(StageSection::Cast) => (1.0, (anim_time.powi(2)), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), + _ => (0.0, 0.0, 0.0), + }; + let pullback = 1.0 - move3; + let move1 = move1base * pullback; + let move2 = move2base * pullback; + + next.shoulder_l.position = Vec3::new( + -s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothorir * 1.0, + ); + next.shoulder_l.orientation = + Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm); + + next.shoulder_r.position = Vec3::new( + s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothoril * 1.0, + ); + next.shoulder_r.orientation = + Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm); + next.torso.orientation = Quaternion::rotation_z(0.0); + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0); + + next.hand_l.orientation = Quaternion::rotation_x(0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0); + + match active_tool_kind { + Some(ToolKind::StaffSimple) | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => { + next.head.orientation = Quaternion::rotation_x(0.0); + next.control_l.position = Vec3::new(-1.0, 3.0, 12.0); + next.control_r.position = Vec3::new( + 1.0 + move1 * 3.0 + move2 * 20.0, + 2.0 + move1 * -5.0 + move2 * 5.0, + 2.0 + move1 * 15.0 + move2 * 0.0, + ); + + next.control.position = Vec3::new( + -3.0 + move2 * 9.0, + 3.0 + s_a.grip.0 / 1.2 + move1 * 15.0 + move2 * 2.0, + -11.0 + -s_a.grip.0 / 2.0 + move1 * 15.0 + move2 * -12.0, + ); + + next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * 0.2) + * Quaternion::rotation_y(-0.5 + move2 * -0.4) + * Quaternion::rotation_z(move1 * 0.0); + next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.2) + * Quaternion::rotation_y(0.5 + move1 * 0.5 + move2 * 0.0) + * Quaternion::rotation_z(move1 * 0.5 + move2 * 0.8); + + next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * 1.0) + * Quaternion::rotation_y(-0.1 + move2 * -0.8); + }, + + _ => {}, + } + + next + } +} diff --git a/voxygen/anim/src/biped_large/wield.rs b/voxygen/anim/src/biped_large/wield.rs index 3e96017bea..8ba4bbabed 100644 --- a/voxygen/anim/src/biped_large/wield.rs +++ b/voxygen/anim/src/biped_large/wield.rs @@ -95,8 +95,8 @@ impl Animation for WieldAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip); - next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip); + next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0); + next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0); next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); @@ -158,8 +158,8 @@ impl Animation for WieldAnimation { next.control.position = Vec3::new( -3.0, - 5.0 + s_a.grip / 1.2, - -4.0 + -s_a.grip / 2.0 + short * -1.5, + 5.0 + s_a.grip.0 / 1.2, + -4.0 + -s_a.grip.0 / 2.0 + short * -1.5, ); next.control_l.orientation = @@ -177,8 +177,8 @@ impl Animation for WieldAnimation { next.control.position = Vec3::new( -1.0, - 6.0 + s_a.grip / 1.2, - -5.0 + -s_a.grip / 2.0 + short * -1.5, + 6.0 + s_a.grip.0 / 1.2, + -5.0 + -s_a.grip.0 / 2.0 + short * -1.5, ); next.control_l.orientation = @@ -195,8 +195,11 @@ impl Animation for WieldAnimation { next.control_l.position = Vec3::new(-1.0, 2.0, 12.0); next.control_r.position = Vec3::new(1.0, 2.0, -2.0); - next.control.position = - Vec3::new(4.0, 0.0 + s_a.grip / 1.0, -s_a.grip / 0.8 + short * -1.5); + next.control.position = Vec3::new( + 4.0, + 0.0 + s_a.grip.0 / 1.0, + -s_a.grip.0 / 0.8 + short * -1.5, + ); next.control_l.orientation = Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.0); @@ -207,14 +210,15 @@ impl Animation for WieldAnimation { next.control.orientation = Quaternion::rotation_x(-1.0 + short * 0.2) * Quaternion::rotation_y(-1.8); }, - Some(ToolKind::StaffSimple) => { + Some(ToolKind::StaffSimple) + | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => { next.control_l.position = Vec3::new(-1.0, 3.0, 12.0); next.control_r.position = Vec3::new(1.0, 2.0, 2.0); next.control.position = Vec3::new( -3.0, - 3.0 + s_a.grip / 1.2, - -11.0 + -s_a.grip / 2.0 + short * -1.5, + 3.0 + s_a.grip.0 / 1.2, + -11.0 + -s_a.grip.0 / 2.0 + short * -1.5, ); next.control_l.orientation = diff --git a/voxygen/anim/src/biped_small/alpha.rs b/voxygen/anim/src/biped_small/alpha.rs index 780a117bea..0ceb8cd59e 100644 --- a/voxygen/anim/src/biped_small/alpha.rs +++ b/voxygen/anim/src/biped_small/alpha.rs @@ -2,12 +2,16 @@ use super::{ super::{vek::*, Animation}, BipedSmallSkeleton, SkeletonAttr, }; -use common::states::utils::StageSection; +use common::{ + comp::item::{ToolKind, UniqueKind}, + states::utils::StageSection, +}; use std::f32::consts::PI; pub struct AlphaAnimation; type AlphaAnimationDependency = ( + Option, Vec3, Vec3, Vec3, @@ -30,14 +34,15 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, ( + active_tool_kind, velocity, _orientation, _last_ori, - _global_time, + global_time, _avg_vel, _acc_vel, stage_section, - _timer, + timer, ): Self::Dependency, anim_time: f32, _rate: &mut f32, @@ -59,54 +64,82 @@ impl Animation for AlphaAnimation { _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; + let subtract = global_time - timer; + let check = subtract - subtract.trunc(); + let mirror = (check - 0.5).signum(); + let move1 = move1base * pullback * mirror; + let move2 = move2base * pullback * mirror; let move1abs = move1base * pullback; let move2abs = move2base * pullback; + match active_tool_kind { + Some(ToolKind::Spear) => { + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + next.head.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * 0.3) + * Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.6) + * Quaternion::rotation_y(move1abs * 0.3 + move2abs * -0.5); + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 11.0; + next.chest.orientation = Quaternion::rotation_x(move1abs * -0.2 + move2abs * 0.3) + * Quaternion::rotation_z(move1abs * 0.5 + move2abs * -0.6); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * 0.3) - * Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.6) - * Quaternion::rotation_y(move1abs * 0.3 + move2abs * -0.5); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 11.0; - next.chest.orientation = Quaternion::rotation_x(move1abs * -0.2 + move2abs * 0.3) - * Quaternion::rotation_z(move1abs * 0.5 + move2abs * -0.6); + next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1); + next.pants.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * -0.3) + * Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.2); - next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1); - next.pants.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * -0.3) - * Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.2); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); + next.hand_l.position = Vec3::new(s_a.grip.0 * 4.0, 0.0, s_a.grip.2); + next.hand_r.position = Vec3::new(-s_a.grip.0 * 4.0, 0.0, s_a.grip.2); - next.hand_l.position = Vec3::new(s_a.grip.0 * 4.0, 0.0, s_a.grip.2); - next.hand_r.position = Vec3::new(-s_a.grip.0 * 4.0, 0.0, s_a.grip.2); + next.hand_l.orientation = Quaternion::rotation_x(0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0); - next.hand_l.orientation = Quaternion::rotation_x(0.0); - next.hand_r.orientation = Quaternion::rotation_x(0.0); + next.control_l.position = Vec3::new(1.0 - s_a.grip.0 * 2.0, 2.0, -2.0); + next.control_r.position = Vec3::new(-1.0 + s_a.grip.0 * 2.0, 2.0, 2.0); - next.control_l.position = Vec3::new(1.0 - s_a.grip.0 * 2.0, 2.0, -2.0); - next.control_r.position = Vec3::new(-1.0 + s_a.grip.0 * 2.0, 2.0, 2.0); + next.control.position = Vec3::new( + -3.0 + move1abs * -3.0 + move2abs * 5.0, + s_a.grip.2 + move1abs * -12.0 + move2abs * 17.0, + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + move2abs * 5.0, + ); - next.control.position = Vec3::new( - -3.0 + move1abs * -3.0 + move2abs * 5.0, - s_a.grip.2 + move1abs * -12.0 + move2abs * 17.0, - -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + move2abs * 5.0, - ); + next.control_l.orientation = + Quaternion::rotation_x(PI / 1.5 + move1abs * -1.5 + move2abs * 2.5) + * Quaternion::rotation_y(-0.3); + next.control_r.orientation = Quaternion::rotation_x( + PI / 1.5 + s_a.grip.0 * 0.2 + move1abs * -1.5 + move2abs * 2.5, + ) * Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2); - next.control_l.orientation = - Quaternion::rotation_x(PI / 1.5 + move1abs * -1.5 + move2abs * 2.5) - * Quaternion::rotation_y(-0.3); - next.control_r.orientation = - Quaternion::rotation_x(PI / 1.5 + s_a.grip.0 * 0.2 + move1abs * -1.5 + move2abs * 2.5) - * Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2); + next.control.orientation = + Quaternion::rotation_x(-1.35 + move1abs * -0.3 + move2abs * 0.5) + * Quaternion::rotation_z(move1abs * 1.0 + move2abs * -1.0) + * Quaternion::rotation_y(move2abs * 0.0); - next.control.orientation = Quaternion::rotation_x(-1.35 + move1abs * -0.3 + move2abs * 0.5) - * Quaternion::rotation_z(move1abs * 1.0 + move2abs * -1.0) - * Quaternion::rotation_y(move2abs * 0.0); - - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel) - * Quaternion::rotation_z(fast * 0.15 * speednormcancel); + next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); + next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel) + * Quaternion::rotation_z(fast * 0.15 * speednormcancel); + }, + Some(ToolKind::Unique(UniqueKind::Husk)) => { + next.hand_l.position = Vec3::new( + -s_a.hand.0, + s_a.hand.1 + move1abs * 3.0 + move2abs * 3.0, + s_a.hand.2 + move1abs * 1.5, + ); + next.hand_r.position = Vec3::new( + s_a.hand.0, + s_a.hand.1 + move1abs * 3.0 + move2abs * 3.0, + s_a.hand.2 + move1abs * 1.5, + ); + next.hand_l.orientation = Quaternion::rotation_x(1.7 + move1 * 1.3 + move2 * -2.4) + * Quaternion::rotation_y(-0.3 + move1abs * -0.35 + move2abs * 0.6); + next.hand_r.orientation = Quaternion::rotation_x(1.7 - move1 * 1.3 + move2 * 2.4) + * Quaternion::rotation_y(0.3 + move1abs * -0.35 + move2abs * 0.6); + next.head.orientation = Quaternion::rotation_x(move1abs * 0.1 + move2abs * -0.2) + * Quaternion::rotation_y(move1 * 0.3 + move2 * -0.4); + }, + _ => {}, + } next } } diff --git a/voxygen/anim/src/biped_small/mod.rs b/voxygen/anim/src/biped_small/mod.rs index 5f193b0bf3..69aaf62d73 100644 --- a/voxygen/anim/src/biped_small/mod.rs +++ b/voxygen/anim/src/biped_small/mod.rs @@ -133,7 +133,7 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Gnoll, _) => (0.0, 15.5), (Haniwa, _) => (0.0, 11.0), (Myrmidon, _) => (0.0, 11.0), - (Husk, _) => (0.0, 11.0), + (Husk, _) => (0.0, 13.0), }, pants: match (body.species, body.body_type) { (Gnome, _) => (0.0, -3.0), @@ -146,7 +146,7 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Gnoll, _) => (0.5, -7.5), (Haniwa, _) => (0.0, -3.5), (Myrmidon, _) => (0.0, -3.0), - (Husk, _) => (-1.0, -6.0), + (Husk, _) => (-1.0, -3.0), }, tail: match (body.species, body.body_type) { (Gnome, _) => (0.0, 0.0), diff --git a/voxygen/anim/src/biped_small/stunned.rs b/voxygen/anim/src/biped_small/stunned.rs index 1998e268f1..a6ab0e20eb 100644 --- a/voxygen/anim/src/biped_small/stunned.rs +++ b/voxygen/anim/src/biped_small/stunned.rs @@ -2,7 +2,10 @@ use super::{ super::{vek::*, Animation}, BipedSmallSkeleton, SkeletonAttr, }; -use common::{comp::item::ToolKind, states::utils::StageSection}; +use common::{ + comp::item::{ToolKind, UniqueKind}, + states::utils::StageSection, +}; use std::f32::consts::PI; pub struct StunnedAnimation; @@ -150,6 +153,15 @@ impl Animation for StunnedAnimation { * Quaternion::rotation_y(-0.2 * speednorm) * Quaternion::rotation_z(0.5); }, + Some(ToolKind::Unique(UniqueKind::Husk)) => { + next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); + next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); + + next.hand_l.orientation = + Quaternion::rotation_x(1.7) * Quaternion::rotation_y(-0.3); + next.hand_r.orientation = + Quaternion::rotation_x(1.7) * Quaternion::rotation_y(0.3); + }, _ => {}, } } else { diff --git a/voxygen/anim/src/biped_small/wield.rs b/voxygen/anim/src/biped_small/wield.rs index 73b6c4eeba..f673ff3bb0 100644 --- a/voxygen/anim/src/biped_small/wield.rs +++ b/voxygen/anim/src/biped_small/wield.rs @@ -2,7 +2,7 @@ use super::{ super::{vek::*, Animation}, BipedSmallSkeleton, SkeletonAttr, }; -use common::comp::item::ToolKind; +use common::comp::item::{ToolKind, UniqueKind}; use std::f32::consts::PI; pub struct WieldAnimation; @@ -147,6 +147,14 @@ impl Animation for WieldAnimation { * Quaternion::rotation_y(-0.2 * speednorm) * Quaternion::rotation_z(0.5); }, + Some(ToolKind::Unique(UniqueKind::Husk)) => { + next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); + next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); + + next.hand_l.orientation = + Quaternion::rotation_x(1.7) * Quaternion::rotation_y(-0.3); + next.hand_r.orientation = Quaternion::rotation_x(1.7) * Quaternion::rotation_y(0.3); + }, _ => {}, } diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 8ca381fc96..c34009b23b 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -2936,6 +2936,7 @@ impl FigureMgr { 1 => anim::biped_small::AlphaAnimation::update_skeleton( &target_base, ( + active_tool_kind, rel_vel, ori * anim::vek::Vec3::::unit_y(), state.last_ori * anim::vek::Vec3::::unit_y(), @@ -2952,6 +2953,7 @@ impl FigureMgr { _ => anim::biped_small::AlphaAnimation::update_skeleton( &target_base, ( + active_tool_kind, rel_vel, ori * anim::vek::Vec3::::unit_y(), state.last_ori * anim::vek::Vec3::::unit_y(), @@ -3600,6 +3602,36 @@ impl FigureMgr { skeleton_attr, ) }, + CharacterState::Blink(s) => { + let stage_time = s.timer.as_secs_f32(); + + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time / s.static_data.buildup_duration.as_secs_f32() + }, + StageSection::Recover => { + stage_time / s.static_data.recover_duration.as_secs_f32() + }, + + _ => 0.0, + }; + + anim::biped_large::BlinkAnimation::update_skeleton( + &target_base, + ( + active_tool_kind, + second_tool_kind, + rel_vel, + time, + Some(s.stage_section), + state.acc_vel, + ), + stage_progress, + &mut state_animation_rate, + skeleton_attr, + ) + }, + CharacterState::ChargedRanged(s) => { let stage_time = s.timer.as_secs_f32(); @@ -3734,25 +3766,19 @@ impl FigureMgr { } }, CharacterState::SpinMelee(s) => { - let stage_progress = match active_tool_kind { - Some(ToolKind::Sword) => { - let stage_time = s.timer.as_secs_f32(); - match s.stage_section { - StageSection::Buildup => { - stage_time - / s.static_data.buildup_duration.as_secs_f32() - }, - StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f32() - }, - StageSection::Recover => { - stage_time - / s.static_data.recover_duration.as_secs_f32() - }, - _ => 0.0, - } + let stage_time = s.timer.as_secs_f32(); + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time / s.static_data.buildup_duration.as_secs_f32() }, - _ => state.state_time, + + StageSection::Swing => { + stage_time / s.static_data.swing_duration.as_secs_f32() + }, + StageSection::Recover => { + stage_time / s.static_data.recover_duration.as_secs_f32() + }, + _ => 0.0, }; anim::biped_large::SpinMeleeAnimation::update_skeleton( @@ -3763,6 +3789,38 @@ impl FigureMgr { rel_vel, time, Some(s.stage_section), + state.acc_vel, + ), + stage_progress, + &mut state_animation_rate, + skeleton_attr, + ) + }, + CharacterState::BasicSummon(s) => { + let stage_time = s.timer.as_secs_f32(); + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time / s.static_data.buildup_duration.as_secs_f32() + }, + + StageSection::Cast => { + stage_time / s.static_data.cast_duration.as_secs_f32() + }, + StageSection::Recover => { + stage_time / s.static_data.recover_duration.as_secs_f32() + }, + _ => 0.0, + }; + + anim::biped_large::SummonAnimation::update_skeleton( + &target_base, + ( + active_tool_kind, + second_tool_kind, + rel_vel, + time, + Some(s.stage_section), + state.acc_vel, ), stage_progress, &mut state_animation_rate,