This commit is contained in:
jshipsey 2020-11-08 18:46:06 -05:00
parent edff3a75c3
commit 20efc692fd
6 changed files with 153 additions and 70 deletions

View File

@ -239,16 +239,27 @@ impl Tool {
vertical_leap_strength: 8.0,
},
],
Hammer => vec![
BasicMelee {
energy_cost: 0,
buildup_duration: Duration::from_millis(600),
swing_duration: Duration::from_millis(100),
recover_duration: Duration::from_millis(300),
base_damage: (120.0 * self.base_power()) as u32,
knockback: 0.0,
range: 3.5,
max_angle: 20.0,
Hammer(_) => vec![
ComboMelee {
stage_data: vec![combo_melee::Stage {
stage: 1,
base_damage: (80.0 * self.base_power()) as u32,
max_damage: (120.0 * self.base_power()) as u32,
damage_increase: (10.0 * self.base_power()) as u32,
knockback: 8.0,
range: 3.5,
angle: 50.0,
base_buildup_duration: Duration::from_millis(400),
base_swing_duration: Duration::from_millis(100),
base_recover_duration: Duration::from_millis(200),
forward_movement: 0.5,
}],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
},
ChargedMelee {
energy_cost: 1,
@ -468,7 +479,7 @@ impl Tool {
}),
projectile_gravity: Some(Gravity(0.5)),
projectile_speed: 40.0,
can_continue: false,
can_continue: true,
},
],
Staff => vec![
@ -516,7 +527,7 @@ impl Tool {
}),
projectile_gravity: Some(Gravity(0.3)),
projectile_speed: 60.0,
can_continue: false,
can_continue: true,
},
BasicBeam {
buildup_duration: Duration::from_millis(250),

View File

@ -37,7 +37,8 @@ pub struct Data {
pub stage_section: StageSection,
/// Whether the attack fired already
pub exhausted: bool,
/// If in buildup, whether the attack has continued form previous attack; if in recover, whether the attack will continue to a new attack
/// If in buildup, whether the attack has continued form previous attack; if
/// in recover, whether the attack will continue to a new attack
pub continue_next: bool,
}

View File

@ -150,37 +150,34 @@ impl Animation for AlphaAnimation {
);
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
next.hand_l.orientation =
Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
next.hand_r.position = Vec3::new(3.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation =
Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.head.orientation = Quaternion::rotation_z(slower * 0.03)
* Quaternion::rotation_x(slowersmooth * 0.1)
* Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06)
* Quaternion::rotation_z((slowersmooth * -0.4).max(0.0));
next.control.position = Vec3::new(s_a.hc.0 + movement1 * -13.0, s_a.hc.1, s_a.hc.2);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + movement1 * 1.5 + movement2 * -2.8)
* Quaternion::rotation_y(s_a.hc.4 + movement1 * 1.57)
* Quaternion::rotation_z(s_a.hc.5 + movement1 * -0.5);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation =
Quaternion::rotation_z(slower * 0.18 + slowersmooth * 0.15)
* Quaternion::rotation_x(0.0 + slower * 0.18 + slowersmooth * 0.15)
* Quaternion::rotation_y(slower * 0.18 + slowersmooth * 0.15);
next.belt.orientation =
Quaternion::rotation_z(slower * -0.1 + slowersmooth * -0.075)
* Quaternion::rotation_x(0.0 + slower * -0.1)
* Quaternion::rotation_y(slower * -0.1);
next.shorts.orientation =
Quaternion::rotation_z(slower * -0.1 + slowersmooth * -0.075)
* Quaternion::rotation_x(0.0 + slower * -0.1)
* Quaternion::rotation_y(slower * -0.1);
next.lantern.orientation = Quaternion::rotation_x(slower * -0.7 + 0.4)
* Quaternion::rotation_y(slower * 0.4);
next.chest.orientation = Quaternion::rotation_x(movement1 * 0.8 + movement2 * -1.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
if velocity > 0.5 {
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * -6.0, s_a.foot.2);
@ -201,11 +198,6 @@ impl Animation for AlphaAnimation {
next.foot_r.orientation = Quaternion::rotation_x(slower * 0.1)
* Quaternion::rotation_z((slower * 0.5).max(0.0));
}
next.control.position = Vec3::new(-8.0, 7.0, 1.0);
next.control.orientation = Quaternion::rotation_x(-1.5 + slower * 1.5)
* Quaternion::rotation_y(slowersmooth * 0.35 - 0.3)
* Quaternion::rotation_z(1.4 + slowersmooth * 0.2);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);

View File

@ -260,13 +260,13 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(_, _) => (-7.0, 7.0, 2.0, -0.1, 0.0, 0.0),
},
hhl: match (body.species, body.body_type) {
(_, _) => (-0.5, -1.0, 10.0, 1.57, 0.0, 0.0),
(_, _) => (-0.5, -1.0, 10.0, 4.71, 0.0, 0.0),
},
hhr: match (body.species, body.body_type) {
(_, _) => (0.0, 0.0, 0.0, 1.57, 0.0, 0.0),
(_, _) => (0.0, 0.0, 0.0, 4.71, 0.0, 0.0),
},
hc: match (body.species, body.body_type) {
(_, _) => (6.0, 7.0, 1.0, -0.3, -1.57, 0.5),
(_, _) => (6.0, 7.0, 1.0, -0.3, -1.57, 3.64),
},
sthl: match (body.species, body.body_type) {
(_, _) => (0.0, 0.0, 1.0, 1.27, 0.0, 0.0),

View File

@ -3,6 +3,7 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use std::f32::consts::PI;
pub struct ShootAnimation;
@ -56,7 +57,15 @@ impl Animation for ShootAnimation {
let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
match active_tool_kind {
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
let xmove = (movement1 as f32 * 6.0 * lab as f32 + PI).sin();
let ymove = (movement1 as f32 * 6.0 * lab as f32 + PI * (0.5)).sin();
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
@ -67,14 +76,43 @@ impl Animation for ShootAnimation {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0);
next.control.position =
Vec3::new(s_a.stc.0, s_a.stc.1 + exp * 5.0, s_a.stc.2 - exp * 5.0);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + exp * 0.4)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5 + exp * 1.5);
next.control.position = Vec3::new(
s_a.stc.0 + (xmove * 3.0 + movement1 * -4.0) * (1.0 - movement3),
s_a.stc.1 + (2.0 + ymove * 3.0 + movement2 * 3.0) * (1.0 - movement3),
s_a.stc.2,
);
next.control.orientation =
Quaternion::rotation_x(s_a.stc.3 + (movement2 * 0.6) * (1.0 - movement3))
* Quaternion::rotation_y(s_a.stc.4 + (movement1 * 0.5 + movement2 * -0.5))
* Quaternion::rotation_z(
s_a.stc.5
- (0.2 + movement1 * -0.5 + movement2 * 0.8) * (1.0 - movement3),
);
next.chest.orientation =
Quaternion::rotation_z((movement1 * 0.3 + movement2 * 0.2) * (1.0 - movement3));
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(
(movement1 * -0.2 + movement2 * -0.4) * (1.0 - movement3),
);
if speed < 0.5 {
next.belt.orientation =
Quaternion::rotation_x(0.07) * Quaternion::rotation_z(0.0);
next.shorts.orientation =
Quaternion::rotation_x(0.08) * Quaternion::rotation_z(0.0);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.5);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + 3.0, s_a.foot.2);
next.foot_r.orientation =
Quaternion::rotation_x(0.5) * Quaternion::rotation_z(0.3);
} else {
};
},
Some(ToolKind::Bow(_)) => {
let (movement1, movement2, movement3) = match stage_section {
let (movement1, movement2, _movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
@ -83,33 +121,44 @@ 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(
s_a.bhl.0 + movement2 * -5.0,
s_a.bhl.1 + movement2 * -10.0,
s_a.bhl.2 + movement2 * -7.0,
s_a.bhl.0 + movement2 * -2.0,
s_a.bhl.1 + movement2 * -6.0,
s_a.bhl.2 + movement2 * -3.0,
);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3 + movement2 * 0.5);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2 + movement2 * 5.0);
next.hold.position = Vec3::new(0.0, -1.0 + movement2 * 2.0, -5.2 + movement2 * 7.0);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0 * (1.0 - movement2);
next.control.position = Vec3::new(s_a.bc.0 + 11.0, s_a.bc.1 + 2.0, s_a.bc.2 + 8.0);
next.control.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(s_a.bc.4 - 1.25)
* Quaternion::rotation_z(s_a.bc.5 - 0.1);
next.control.orientation =
Quaternion::rotation_x(0.0 + (movement2 as f32 * 0.1).sin())
* Quaternion::rotation_y(s_a.bc.4 - 1.25)
* Quaternion::rotation_z(s_a.bc.5 - 0.2 + (movement2 as f32 * -0.2).sin());
next.chest.orientation = Quaternion::rotation_z(0.8);
next.head.position = Vec3::new(0.0 + movement1 * -2.0, s_a.head.0, s_a.head.1);
next.head.position = Vec3::new(0.0 - 2.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(movement1 * -0.8);
next.head.orientation =
Quaternion::rotation_z(-0.5 + (movement2 as f32 * 0.2).sin());
if speed < 0.5 {
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + 5.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(0.5);
next.chest.orientation =
Quaternion::rotation_z(0.8 + (movement2 as f32 * 0.1).sin());
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 - 3.0, s_a.foot.2);
next.belt.orientation = Quaternion::rotation_x(0.07)
* Quaternion::rotation_z((movement2 as f32 * -0.1).sin());
next.shorts.orientation = Quaternion::rotation_x(0.08)
* Quaternion::rotation_z((movement2 as f32 * -0.15).sin());
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.5);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + 3.0, s_a.foot.2);
next.foot_r.orientation =
Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.3);
Quaternion::rotation_x(0.5) * Quaternion::rotation_z(0.3);
} else {
};
},

View File

@ -825,6 +825,36 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::ChargedRanged(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::character::ShootAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0.magnitude(),
ori,
state.last_ori,
time,
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::BasicRanged(s) => {
let stage_time = s.timer.as_secs_f64();