mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
bowser spin animation
This commit is contained in:
parent
5e9cbdf754
commit
7a23314e3b
@ -1,6 +1,6 @@
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
rustflags = [
|
||||
"-C", "link-arg=-fuse-ld=gold",
|
||||
"-C", "link-arg=-fuse-ld=mold",
|
||||
]
|
||||
|
||||
[target.x86_64-pc-windows-gnu]
|
||||
|
@ -535,6 +535,13 @@
|
||||
secondary: Simple(None, "common.abilities.custom.quadlowbasic.singlestrike"),
|
||||
abilities: [],
|
||||
),
|
||||
Custom("Rocksnapper"): (
|
||||
primary: Simple(None, "common.abilities.custom.rocksnapper.triplestrike"),
|
||||
secondary: Simple(None, "common.abilities.custom.rocksnapper.singlestrike"),
|
||||
abilities: [
|
||||
Simple(None, "common.abilities.custom.rocksnapper.dash"),
|
||||
],
|
||||
),
|
||||
Custom("Quad Low Beam"): (
|
||||
primary: Simple(None, "common.abilities.custom.quadlowbeam.lifestealbeam"),
|
||||
secondary: Simple(None, "common.abilities.custom.quadlowbreathe.triplestrike"),
|
||||
|
28
assets/common/abilities/custom/rocksnapper/dash.ron
Normal file
28
assets/common/abilities/custom/rocksnapper/dash.ron
Normal file
@ -0,0 +1,28 @@
|
||||
DashMelee(
|
||||
energy_cost: 0,
|
||||
melee_constructor: (
|
||||
kind: Bash(
|
||||
damage: 16.0,
|
||||
poise: 0.0,
|
||||
knockback: 4.0,
|
||||
energy_regen: 0.0,
|
||||
),
|
||||
scaled: Some((
|
||||
kind: Bash(
|
||||
damage: 36.0,
|
||||
poise: 8.0,
|
||||
knockback: 23.0,
|
||||
energy_regen: 0.0,
|
||||
))),
|
||||
range: 2.5,
|
||||
angle: 360.0,
|
||||
),
|
||||
energy_drain: 0,
|
||||
forward_speed: 5.0,
|
||||
buildup_duration: 1.0,
|
||||
charge_duration: 2.0,
|
||||
swing_duration: 2.0,
|
||||
recover_duration: 0.5,
|
||||
ori_modifier: 0.3,
|
||||
charge_through: true,
|
||||
)
|
25
assets/common/abilities/custom/rocksnapper/singlestrike.ron
Normal file
25
assets/common/abilities/custom/rocksnapper/singlestrike.ron
Normal file
@ -0,0 +1,25 @@
|
||||
ComboMelee2(
|
||||
strikes: [
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Bash(
|
||||
damage: 36,
|
||||
poise: 28,
|
||||
knockback: 3,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 3.0,
|
||||
angle: 90.0,
|
||||
),
|
||||
buildup_duration: 0.5,
|
||||
swing_duration: 0.2,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.5,
|
||||
movement: (
|
||||
swing: Some(Forward(0.1)),
|
||||
),
|
||||
ori_modifier: 0.6,
|
||||
),
|
||||
],
|
||||
energy_cost_per_strike: 0,
|
||||
)
|
65
assets/common/abilities/custom/rocksnapper/triplestrike.ron
Normal file
65
assets/common/abilities/custom/rocksnapper/triplestrike.ron
Normal file
@ -0,0 +1,65 @@
|
||||
ComboMelee2(
|
||||
strikes: [
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Slash(
|
||||
damage: 36,
|
||||
poise: 24,
|
||||
knockback: 3,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 4.0,
|
||||
angle: 30.0,
|
||||
),
|
||||
buildup_duration: 0.75,
|
||||
swing_duration: 0.45,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.4,
|
||||
movement: (
|
||||
swing: Some(Forward(0.4)),
|
||||
),
|
||||
ori_modifier: 0.65,
|
||||
),
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Stab(
|
||||
damage: 18,
|
||||
poise: 18,
|
||||
knockback: 15,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 3.5,
|
||||
angle: 75.0,
|
||||
),
|
||||
buildup_duration: 0.35,
|
||||
swing_duration: 0.35,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.3,
|
||||
movement: (
|
||||
swing: Some(Forward(0.2)),
|
||||
),
|
||||
ori_modifier: 0.65,
|
||||
),
|
||||
(
|
||||
melee_constructor: (
|
||||
kind: Bash(
|
||||
damage: 28,
|
||||
poise: 36,
|
||||
knockback: 3,
|
||||
energy_regen: 0,
|
||||
),
|
||||
range: 3.0,
|
||||
angle: 55.0,
|
||||
),
|
||||
buildup_duration: 0.55,
|
||||
swing_duration: 0.25,
|
||||
hit_timing: 0.5,
|
||||
recover_duration: 0.6,
|
||||
movement: (
|
||||
swing: Some(Forward(0.3)),
|
||||
),
|
||||
ori_modifier: 0.65,
|
||||
),
|
||||
],
|
||||
energy_cost_per_strike: 0,
|
||||
)
|
20
assets/common/items/npc_weapons/unique/rocksnapper.ron
Normal file
20
assets/common/items/npc_weapons/unique/rocksnapper.ron
Normal file
@ -0,0 +1,20 @@
|
||||
ItemDef(
|
||||
legacy_name: "Rocksnapper",
|
||||
legacy_description: "Rocksnapper's totally awesome legacy description",
|
||||
kind: Tool((
|
||||
kind: Natural,
|
||||
hands: Two,
|
||||
stats: (
|
||||
equip_time_secs: 0.01,
|
||||
power: 1.0,
|
||||
effect_power: 1.0,
|
||||
speed: 1.0,
|
||||
range: 1.0,
|
||||
energy_efficiency: 1.0,
|
||||
buff_strength: 1.0,
|
||||
),
|
||||
)),
|
||||
quality: Low,
|
||||
tags: [],
|
||||
ability_spec: Some(Custom("Rocksnapper")),
|
||||
)
|
@ -686,6 +686,9 @@ fn default_main_tool(body: &Body) -> Item {
|
||||
quadruped_low::Species::Driggle => Some(Item::new_from_asset_expect(
|
||||
"common.items.npc_weapons.unique.driggle",
|
||||
)),
|
||||
quadruped_low::Species::Rocksnapper => Some(Item::new_from_asset_expect(
|
||||
"common.items.npc_weapons.unique.rocksnapper",
|
||||
)),
|
||||
_ => Some(Item::new_from_asset_expect(
|
||||
"common.items.npc_weapons.unique.quadlowbasic",
|
||||
)),
|
||||
|
@ -9,7 +9,7 @@ use std::f32::consts::PI;
|
||||
pub struct DashAnimation;
|
||||
|
||||
impl Animation for DashAnimation {
|
||||
type Dependency<'a> = (f32, f32, Option<StageSection>, f32);
|
||||
type Dependency<'a> = (Option<&'a str>, f32, f32, Option<StageSection>, f32);
|
||||
type Skeleton = QuadrupedLowSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -18,14 +18,114 @@ impl Animation for DashAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_dash")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, global_time, stage_section, timer): Self::Dependency<'_>,
|
||||
(ability_id, _velocity, global_time, stage_section, timer): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
_s_a: &SkeletonAttr,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let (movement1base, chargemovementbase, movement2base, movement3) = match stage_section {
|
||||
match ability_id {
|
||||
Some("common.abilities.custom.rocksnapper.dash") => {
|
||||
let (movement1, charge, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
|
||||
Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, 1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let subtract = global_time - timer;
|
||||
let check = subtract - subtract.trunc();
|
||||
let mirror = (check - 0.5).signum();
|
||||
let twitch1 = (mirror * movement1.sqrt() * 9.5).sin();
|
||||
fn quintic(x: f32) -> f32 { x.powf(0.2) }
|
||||
let quick_movement1 = movement1.powf(0.2);
|
||||
//let quick_movement3 = movement3.powf(0.2);
|
||||
let quick_movement3 = elastic(movement3);
|
||||
next.head_upper.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.head_upper.0 + (-1.0 * quick_movement1 + quick_movement3) * 10.0,
|
||||
s_a.head_upper.1,
|
||||
);
|
||||
next.head_upper.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
|
||||
next.head_lower.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.head_lower.0 + (-1.0 * quick_movement1 + quick_movement3) * 10.0,
|
||||
s_a.head_lower.1,
|
||||
);
|
||||
next.head_lower.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
|
||||
next.foot_fl.position = Vec3::new(
|
||||
-s_a.feet_f.0 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
s_a.feet_f.1 + (-1.0 * quick_movement1 + quick_movement3) * 8.0,
|
||||
s_a.feet_f.2 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
);
|
||||
next.foot_fl.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
|
||||
next.foot_fr.position = Vec3::new(
|
||||
s_a.feet_f.0 - (quick_movement1 - quick_movement3) * 8.0,
|
||||
s_a.feet_f.1 + (-1.0 * quick_movement1 + quick_movement3) * 8.0,
|
||||
s_a.feet_f.2 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
);
|
||||
next.foot_fr.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
|
||||
next.foot_bl.position = Vec3::new(
|
||||
-s_a.feet_b.0 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
s_a.feet_b.1 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
s_a.feet_b.2 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
);
|
||||
next.foot_bl.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
|
||||
next.foot_br.position = Vec3::new(
|
||||
s_a.feet_b.0 - (quick_movement1 - quick_movement3) * 8.0,
|
||||
s_a.feet_b.1 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
s_a.feet_b.2 + (quick_movement1 - quick_movement3) * 8.0,
|
||||
);
|
||||
next.foot_br.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
|
||||
next.tail_front.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.tail_front.0 + (quick_movement1 - quick_movement3) * 20.0,
|
||||
s_a.tail_front.1,
|
||||
);
|
||||
next.tail_front.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
|
||||
next.tail_rear.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.tail_rear.0 + (quick_movement1 - quick_movement3) * 20.0,
|
||||
s_a.tail_rear.1,
|
||||
);
|
||||
next.tail_rear.scale = Vec3::one() * (1.0 - movement1 + movement3);
|
||||
|
||||
fn bounce(x: f32) -> f32 {
|
||||
if x < (1.0 / 2.75) {
|
||||
7.5625 * x.powi(2)
|
||||
} else if x < (2.0 / 2.75) {
|
||||
7.5625 * (x - (1.5 / 2.75)).powi(2) + 0.75
|
||||
} else if x < (2.5 / 2.75) {
|
||||
7.5625 * (x - (2.25 / 2.75)).powi(2) + 0.9375
|
||||
} else {
|
||||
7.5625 * (x - (2.625 / 2.75)).powi(2) + 0.984375
|
||||
}
|
||||
}
|
||||
|
||||
fn elastic(x: f32) -> f32 {
|
||||
fn f(x: f32, a: f32, b: f32) -> f32 {
|
||||
let p = 0.8;
|
||||
b + a * 2.0_f32.powf(a * 10.0 * x) * ((4.0 * PI * x) / p).cos()
|
||||
}
|
||||
f(x, -1.0, 1.0) / f(1.0, -1.0, 1.0)
|
||||
}
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
0.0,
|
||||
s_a.chest.1 - bounce(movement1) * 5.0 + elastic(movement3) * 5.0,
|
||||
);
|
||||
let smooth_end_charge = if charge < 0.5 {
|
||||
charge
|
||||
} else {
|
||||
3.0 * charge.powi(2) - 2.0 * charge.powi(3)
|
||||
};
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_z(2.0 * PI * movement1 + 4.0 * PI * charge);
|
||||
},
|
||||
_ => {
|
||||
let (movement1, chargemovementbase, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0),
|
||||
Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, 1.0, anim_time.powi(4), 0.0),
|
||||
@ -36,19 +136,21 @@ impl Animation for DashAnimation {
|
||||
let subtract = global_time - timer;
|
||||
let check = subtract - subtract.trunc();
|
||||
let mirror = (check - 0.5).signum();
|
||||
let twitch1 = (mirror * movement1base * 9.5).sin();
|
||||
let twitch1fast = (mirror * movement1base * 25.0).sin();
|
||||
let twitch1 = (mirror * movement1 * 9.5).sin();
|
||||
let twitch1fast = (mirror * movement1 * 25.0).sin();
|
||||
//let twitch3 = (mirror * movement3 * 4.0).sin();
|
||||
//let movement1 = mirror * movement1base * pullback;
|
||||
//let movement2 = mirror * movement2base * pullback;
|
||||
let movement1abs = movement1base * pullback;
|
||||
let movement2abs = movement2base * pullback;
|
||||
let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2)))
|
||||
//let movement1 = mirror * movement1 * pullback;
|
||||
//let movement2 = mirror * movement2 * pullback;
|
||||
let movement1abs = movement1 * pullback;
|
||||
let movement2abs = movement2 * pullback;
|
||||
let short = ((1.0
|
||||
/ (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2)))
|
||||
.sqrt())
|
||||
* ((anim_time * 16.0_f32 + PI * 0.25).sin())
|
||||
* chargemovementbase
|
||||
* pullback;
|
||||
let shortalt = (anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback;
|
||||
let shortalt =
|
||||
(anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback;
|
||||
|
||||
next.head_upper.orientation =
|
||||
Quaternion::rotation_x(movement1abs * 0.4 + movement2abs * 0.3)
|
||||
@ -75,7 +177,8 @@ impl Animation for DashAnimation {
|
||||
Quaternion::rotation_x(
|
||||
-0.12 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2,
|
||||
) * Quaternion::rotation_z(shortalt * 0.15 + twitch1fast * 0.3);
|
||||
|
||||
},
|
||||
}
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -3098,6 +3098,7 @@ impl FigureMgr {
|
||||
anim::quadruped_low::DashAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
ability_id,
|
||||
rel_vel.magnitude(),
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
|
Loading…
Reference in New Issue
Block a user