From c23139d501c3b9c2869dbfc874cf0ce6ba7b926c Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 21 Nov 2022 22:08:11 -0500 Subject: [PATCH] Agile stance skill abilities. --- assets/common/abilities/sword/agile_feint.ron | 33 ++-- .../abilities/sword/agile_quick_draw.ron | 29 ++- common/src/states/utils.rs | 41 ++++- voxygen/anim/src/character/combomelee.rs | 170 +++++++++--------- 4 files changed, 143 insertions(+), 130 deletions(-) diff --git a/assets/common/abilities/sword/agile_feint.ron b/assets/common/abilities/sword/agile_feint.ron index dba2420527..06e8f3f985 100644 --- a/assets/common/abilities/sword/agile_feint.ron +++ b/assets/common/abilities/sword/agile_feint.ron @@ -3,7 +3,7 @@ ComboMelee2( ( melee_constructor: ( kind: Slash( - damage: 5, + damage: 12, poise: 0, knockback: 0, energy_regen: 5, @@ -11,29 +11,20 @@ ComboMelee2( range: 3.0, angle: 45.0, ), - buildup_duration: 0.15, - swing_duration: 0.05, - hit_timing: 0.5, - recover_duration: 0.1, - ori_modifier: 0.6, - ), - ( - melee_constructor: ( - kind: Slash( - damage: 10, - poise: 0, - knockback: 0, - energy_regen: 7.5, - ), - range: 3.0, - angle: 45.0, - ), - buildup_duration: 0.1, + buildup_duration: 0.2, swing_duration: 0.1, - hit_timing: 0.5, - recover_duration: 0.2, + hit_timing: 1.0, + recover_duration: 0.15, + movement: ( + buildup: Some(DirectedReverse(1.5)), + swing: Some(AntiDirectedForward(3.0)), + recover: None, + ), ori_modifier: 0.6, ), ], energy_cost_per_strike: 0, + meta: ( + init_event: Some(EnterStance(Sword(Agile))), + ), ) \ No newline at end of file diff --git a/assets/common/abilities/sword/agile_quick_draw.ron b/assets/common/abilities/sword/agile_quick_draw.ron index dba2420527..9003656242 100644 --- a/assets/common/abilities/sword/agile_quick_draw.ron +++ b/assets/common/abilities/sword/agile_quick_draw.ron @@ -3,7 +3,7 @@ ComboMelee2( ( melee_constructor: ( kind: Slash( - damage: 5, + damage: 8, poise: 0, knockback: 0, energy_regen: 5, @@ -11,29 +11,20 @@ ComboMelee2( range: 3.0, angle: 45.0, ), - buildup_duration: 0.15, + buildup_duration: 0.2, swing_duration: 0.05, hit_timing: 0.5, - recover_duration: 0.1, - ori_modifier: 0.6, - ), - ( - melee_constructor: ( - kind: Slash( - damage: 10, - poise: 0, - knockback: 0, - energy_regen: 7.5, - ), - range: 3.0, - angle: 45.0, + recover_duration: 0.05, + movement: ( + buildup: Some(Forward(2.0)), + swing: Some(Forward(2.0)), + recover: None, ), - buildup_duration: 0.1, - swing_duration: 0.1, - hit_timing: 0.5, - recover_duration: 0.2, ori_modifier: 0.6, ), ], energy_cost_per_strike: 0, + meta: ( + init_event: Some(EnterStance(Sword(Agile))), + ), ) \ No newline at end of file diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 1befc600df..5cca191e67 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -426,7 +426,7 @@ pub fn handle_forced_movement( data.body.base_accel() * block.get_traction() * block.get_friction() / FRIC_GROUND }) { update.vel.0 += - Vec2::broadcast(data.dt.0) * accel * Vec2::from(update.ori) * strength; + Vec2::broadcast(data.dt.0) * accel * Vec2::from(*data.ori) * strength; } }, ForcedMovement::Reverse(strength) => { @@ -436,7 +436,7 @@ pub fn handle_forced_movement( data.body.base_accel() * block.get_traction() * block.get_friction() / FRIC_GROUND }) { update.vel.0 += - Vec2::broadcast(data.dt.0) * accel * -Vec2::from(update.ori) * strength; + Vec2::broadcast(data.dt.0) * accel * -Vec2::from(*data.ori) * strength; } }, ForcedMovement::Sideways(strength) => { @@ -447,20 +447,49 @@ pub fn handle_forced_movement( }) { let direction = { // Left if positive, else right - let side = Vec2::from(update.ori) + let side = Vec2::from(*data.ori) .rotated_z(PI / 2.) .dot(data.inputs.move_dir) .signum(); if side > 0.0 { - Vec2::from(update.ori).rotated_z(PI / 2.) + Vec2::from(*data.ori).rotated_z(PI / 2.) } else { - -Vec2::from(update.ori).rotated_z(PI / 2.) + -Vec2::from(*data.ori).rotated_z(PI / 2.) } }; update.vel.0 += Vec2::broadcast(data.dt.0) * accel * direction * strength; } }, + ForcedMovement::DirectedReverse(strength) => { + let strength = strength * data.stats.move_speed_modifier * data.stats.friction_modifier; + if let Some(accel) = data.physics.on_ground.map(|block| { + // FRIC_GROUND temporarily used to normalize things around expected values + data.body.base_accel() * block.get_traction() * block.get_friction() / FRIC_GROUND + }) { + let direction = if Vec2::from(*data.ori).dot(data.inputs.move_dir).signum() > 0.0 { + data.inputs.move_dir.reflected(Vec2::from(*data.ori)) + } else { + data.inputs.move_dir + }.try_normalized().unwrap_or_else(|| -Vec2::from(*data.ori)); + update.vel.0 += direction * strength * accel * data.dt.0; + } + }, + ForcedMovement::AntiDirectedForward(strength) => { + let strength = strength * data.stats.move_speed_modifier * data.stats.friction_modifier; + if let Some(accel) = data.physics.on_ground.map(|block| { + // FRIC_GROUND temporarily used to normalize things around expected values + data.body.base_accel() * block.get_traction() * block.get_friction() / FRIC_GROUND + }) { + let direction = if Vec2::from(*data.ori).dot(data.inputs.move_dir).signum() < 0.0 { + data.inputs.move_dir.reflected(Vec2::from(*data.ori)) + } else { + data.inputs.move_dir + }.try_normalized().unwrap_or_else(|| Vec2::from(*data.ori)); + let direction = direction.reflected(Vec2::from(*data.ori).rotated_z(PI / 2.)); + update.vel.0 += direction * strength * accel * data.dt.0; + } + }, ForcedMovement::Leap { vertical, forward, @@ -1327,6 +1356,8 @@ pub enum ForcedMovement { Forward(f32), Reverse(f32), Sideways(f32), + DirectedReverse(f32), + AntiDirectedForward(f32), Leap { vertical: f32, forward: f32, diff --git a/voxygen/anim/src/character/combomelee.rs b/voxygen/anim/src/character/combomelee.rs index ed9bd72e6e..635ce61d8d 100644 --- a/voxygen/anim/src/character/combomelee.rs +++ b/voxygen/anim/src/character/combomelee.rs @@ -198,6 +198,91 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * -1.0, move2 * 6.0, move2 * -2.0); next.control.orientation.rotate_z(move2 * 0.4); }, + Some("common.abilities.sword.agile_quick_draw") => { + let (move1, move2) = match stage_section { + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), + Some(StageSection::Action) => (1.0, anim_time.powi(2)), + Some(StageSection::Recover) => (1.0, 1.0), + _ => (0.0, 0.0), + }; + let move1 = move1 * multi_strike_pullback; + let move2 = move2 * multi_strike_pullback; + + 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.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + 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) + * Quaternion::rotation_z(move2.signum() * -PI / 2.0); + + next.control.orientation.rotate_x(move1 * 1.6 + move2 * 0.5); + next.chest.orientation = Quaternion::rotation_z(move1 * 1.0); + next.head.orientation = Quaternion::rotation_z(move1 * -0.7); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); + next.control.position += Vec3::new(0.0, 0.0, move1 * 5.0); + + next.chest.orientation.rotate_z(move2 * -1.9); + next.head.orientation.rotate_z(move2 * 1.4); + next.belt.orientation.rotate_z(move2 * 0.6); + next.shorts.orientation.rotate_z(move2 * 1.2); + next.control.orientation.rotate_z(move2 * -3.5); + next.control.position += Vec3::new(move2 * 9.0, move2 * 4.0, 0.0); + }, + Some("common.abilities.sword.agile_feint") => { + let (move1, move2) = match stage_section { + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), + Some(StageSection::Action) => (1.0, anim_time.powi(2)), + Some(StageSection::Recover) => (1.0, 1.0), + _ => (0.0, 0.0), + }; + let move1 = move1 * multi_strike_pullback; + let move2 = move2 * multi_strike_pullback; + + 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.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + 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); + + next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0); + + // Right feint if x < 0, else left + if move_dir.x < 0.0 { + next.chest.orientation = Quaternion::rotation_z(move1 * -0.7); + next.head.orientation = Quaternion::rotation_z(move1 * 0.3); + next.shorts.orientation = Quaternion::rotation_z(move1 * 0.4); + next.belt.orientation = Quaternion::rotation_z(move1 * 0.2); + next.control.position += Vec3::new(move1 * 12.0, 0.0, 0.0); + next.control.orientation.rotate_y(move1 * 1.5); + + next.chest.orientation.rotate_z(move2 * -1.5); + next.head.orientation.rotate_z(move2 * 0.9); + next.shorts.orientation.rotate_z(move2 * 1.1); + next.belt.orientation.rotate_z(move2 * 0.5); + next.control.orientation.rotate_z(move2 * -1.5); + next.control.position += Vec3::new(move2 * 10.0, move2 * 2.0, 0.0); + } else { + next.chest.orientation = Quaternion::rotation_z(move1 * 0.7); + next.head.orientation = Quaternion::rotation_z(move1 * -0.3); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.4); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); + next.control.orientation.rotate_y(move1 * -1.5); + + next.chest.orientation.rotate_z(move2 * 1.5); + next.head.orientation.rotate_z(move2 * -0.9); + next.shorts.orientation.rotate_z(move2 * -1.1); + next.belt.orientation.rotate_z(move2 * -0.5); + next.control.orientation.rotate_z(move2 * 1.5); + next.control.position += Vec3::new(move2 * -10.0, move2 * 2.0, 0.0); + } + }, Some("common.abilities.sword.offensive_combo") => { let (move1, move2) = if strike == current_strike { match stage_section { @@ -292,40 +377,6 @@ impl Animation for ComboAnimation { _ => {}, } }, - Some("common.abilities.sword.offensive_advance") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - - 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.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - 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) - * Quaternion::rotation_z(move2.signum() * -PI / 2.0); - - next.control.orientation.rotate_x(move1 * 1.6 + move2 * 0.5); - next.chest.orientation = Quaternion::rotation_z(move1 * 1.0); - next.head.orientation = Quaternion::rotation_z(move1 * -0.7); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); - next.control.position += Vec3::new(0.0, 0.0, move1 * 5.0); - - next.chest.orientation.rotate_z(move2 * -1.9); - next.head.orientation.rotate_z(move2 * 1.4); - next.belt.orientation.rotate_z(move2 * 0.6); - next.shorts.orientation.rotate_z(move2 * 1.2); - next.control.orientation.rotate_z(move2 * -3.5); - next.control.position += Vec3::new(move2 * 9.0, move2 * 4.0, 0.0); - }, Some("common.abilities.sword.crippling_combo") => { let (move1, move2) = if strike == current_strike { match stage_section { @@ -967,57 +1018,6 @@ impl Animation for ComboAnimation { _ => {}, } }, - Some("common.abilities.sword.mobility_feint") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - - 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.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - 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); - - next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0); - - // Right feint if x > 0, else left - if move_dir.x > 0.0 { - next.chest.orientation = Quaternion::rotation_z(move1 * -0.7); - next.head.orientation = Quaternion::rotation_z(move1 * 0.3); - next.shorts.orientation = Quaternion::rotation_z(move1 * 0.4); - next.belt.orientation = Quaternion::rotation_z(move1 * 0.2); - next.control.position += Vec3::new(move1 * 12.0, 0.0, 0.0); - next.control.orientation.rotate_y(move1 * 1.5); - - next.chest.orientation.rotate_z(move2 * 1.5); - next.head.orientation.rotate_z(move2 * -0.9); - next.shorts.orientation.rotate_z(move2 * -1.1); - next.belt.orientation.rotate_z(move2 * -0.5); - next.control.orientation.rotate_z(move2 * 1.5); - next.control.position += Vec3::new(move2 * -10.0, move2 * 2.0, 0.0); - } else { - next.chest.orientation = Quaternion::rotation_z(move1 * 0.7); - next.head.orientation = Quaternion::rotation_z(move1 * -0.3); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.4); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); - next.control.orientation.rotate_y(move1 * -1.5); - - next.chest.orientation.rotate_z(move2 * -1.5); - next.head.orientation.rotate_z(move2 * 0.9); - next.shorts.orientation.rotate_z(move2 * 1.1); - next.belt.orientation.rotate_z(move2 * 0.5); - next.control.orientation.rotate_z(move2 * -1.5); - next.control.position += Vec3::new(move2 * 10.0, move2 * 2.0, 0.0); - } - }, Some("common.abilities.sword.reaching_combo") => { let (move1, move2) = if strike == current_strike { match stage_section {