Initial combo melee for axe M1

This commit is contained in:
jiminycrick 2020-10-16 00:03:01 -07:00 committed by jshipsey
parent 91502255e8
commit 33e87de17e
4 changed files with 206 additions and 58 deletions

View File

@ -174,16 +174,42 @@ impl Tool {
num_spins: 3,
},
],
Axe => 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,
Axe(_) => 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(350),
base_swing_duration: Duration::from_millis(75),
base_recover_duration: Duration::from_millis(400),
forward_movement: 0.5,
},
combo_melee::Stage {
stage: 2,
base_damage: (100.0 * self.base_power()) as u32,
max_damage: (190.0 * self.base_power()) as u32,
damage_increase: (15.0 * self.base_power()) as u32,
knockback: 12.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: Duration::from_millis(500),
base_swing_duration: Duration::from_millis(75),
base_recover_duration: Duration::from_millis(1000),
forward_movement: 0.25,
},
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
},
SpinMelee {
buildup_duration: Duration::from_millis(100),

View File

@ -102,34 +102,57 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_y(slow * -1.3)
* Quaternion::rotation_z(1.4 + slow * -0.5);
},
Some(ToolKind::Axe) => {
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.1 + axe * 0.2)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.2);
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
next.chest.orientation = Quaternion::rotation_z(0.2 + axe * 0.2);
next.belt.orientation = Quaternion::rotation_z(0.2 + axe * -0.1);
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
next.shorts.orientation = Quaternion::rotation_z(0.2 + axe * -0.2);
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
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(2.0 + axe * -7.0, 11.0, 3.0);
next.control.orientation = Quaternion::rotation_x(1.6)
* Quaternion::rotation_y(-2.0 + axe * 0.5)
* Quaternion::rotation_z(PI * 0.4);
next.lantern.orientation = Quaternion::rotation_x(0.4);
},
Some(ToolKind::Hammer) => {
if let Some(ToolKind::Axe(_)) = active_tool_kind {
next.l_hand.position = Vec3::new(-0.75, -1.0, 2.5);
next.l_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.position = Vec3::new(0.75, -1.5, -0.5);
next.r_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.r_hand.scale = Vec3::one() * 1.05; //next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.position = Vec3::new(0.0, 1.5, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
//* Quaternion::rotation_z(0.0);
* Quaternion::rotation_z(3.14);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
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, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
-9.0 + movement1 * 0.0 + movement2 * -0.2 + movement3 * 0.0,
//7.0 + movement1 * -4.0 + movement2 * 5.0 + movement3 * -1.5,
7.0 + movement1 * -4.0 + movement2 * 5.0 + movement3 * -1.5,
2.0 + movement1 * 1.0 + movement2 * -6.0 + movement3 * 4.0,
);
next.control.orientation =
//Quaternion::rotation_x(0.2 + movement1 * 0.5 + movement2 * -1.8 + movement3 * 1.6)
Quaternion::rotation_x(0.2 + movement1 * 0.3 + movement2 * -1.8 + movement3 * 1.6)
* Quaternion::rotation_y(
//-0.5 + movement1 * 0.5 + movement2 * -1.0 + movement3 * 0.8,
-0.5 + movement1 * 0.5 + movement2 * -0.7 + movement3 * 0.8,
)
* Quaternion::rotation_z(
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
);
next.control.scale = Vec3::one();
next.chest.orientation =
Quaternion::rotation_x(0.0 + movement1 * 0.4 + movement2 * -0.6 + movement3 * 0.4)
* Quaternion::rotation_y(
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
)
* Quaternion::rotation_z(
0.0 + movement1 * 1.5 + movement2 * -2.5 + movement3 * 1.5,
);
next.head.orientation =
Quaternion::rotation_z(0.0 + movement1 * -1.0 + movement2 * 2.5 + movement3 * -1.8);
};
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);

View File

@ -96,9 +96,76 @@ impl Animation for SpinAnimation {
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
next.torso.orientation = Quaternion::rotation_z(movement2 * 6.28);
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
next.l_hand.position = Vec3::new(-0.75, -1.0, 2.5);
next.l_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.position = Vec3::new(0.75, -1.5, -0.5);
next.r_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.r_hand.scale = Vec3::one() * 1.05; //next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.position = Vec3::new(0.0, 1.5, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
//* Quaternion::rotation_z(0.0);
* Quaternion::rotation_z(PI);
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, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
//-9.2 + movement1 * 0.0 + movement2.powf(2.0) * 9.0 + movement3 * 0.0,
-9.2 + movement1 * 0.0 + movement2 * 9.0 + movement3 * 0.0,
6.5 + movement1 * 0.6 + movement2 * 3.0 + movement3 * -0.0,
//1.0 + movement1 * 7.0 + movement2.powf(2.0) * -9.5 + movement3 * -0.0,
1.0 + (movement1 * 0.75 * PI).sin() * 5.0 + movement2 * -7.0 + movement3 * -0.0,
);
next.control.orientation =
//Quaternion::rotation_x(0.5 + movement1 * 1.0 + movement2 * -2.6 + movement3 * -0.0)
Quaternion::rotation_x(0.5 + (movement1 * 1.5 * PI).sin() * 1.0 + movement2 * -0.6 + movement3 * -0.0)
* Quaternion::rotation_y(
-0.2 + movement1 * 0.2 + movement2 * 0.0 + movement3 * 0.0,
)
* Quaternion::rotation_z(
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
);
next.control.scale = Vec3::one();
next.chest.orientation =
Quaternion::rotation_x(0.2 + movement1 * 0.0 + movement2 * -0.5 + movement3 * 0.0)
* Quaternion::rotation_y(
0.0 + movement1 * -0.1 + movement2 * 0.0 + movement3 * -0.0,
)
* Quaternion::rotation_z(
0.5 + movement1 * -0.6 + movement2 * 0.6 + movement3 * 0.0,
);
next.belt.orientation =
Quaternion::rotation_x(0.0 + movement1 * 0.0 + movement2 * -0.0);
next.shorts.orientation =
Quaternion::rotation_x(0.0 + movement1 * 0.0 + movement2 * -0.0);
next.head.orientation =
Quaternion::rotation_y(0.0 + movement1 * 0.0 + movement3 * -0.0)
* Quaternion::rotation_z(
-0.3 + movement1 * 0.4 + movement2 * -0.5 + movement3 * 0.0,
);
next.torso.position = Vec3::new(
0.0,
0.0,
-1.0 + 1.0 * (movement1 * 0.5 * PI).sin()
+ 1.0 * (movement2 * 0.5 * PI + 0.5 * PI).sin(),
);
next.torso.orientation =
Quaternion::rotation_z(movement1.powf(2.0) * -6.0 + movement2 * -0.7);
}
if let Some(ToolKind::Axe | ToolKind::Hammer | ToolKind::Dagger) = active_tool_kind {
if let Some( ToolKind::Hammer(_) | ToolKind::Dagger(_)) = active_tool_kind
{
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);

View File

@ -1126,27 +1126,59 @@ impl FigureMgr {
},
CharacterState::ComboMelee(s) => {
let stage_index = (s.stage - 1) as usize;
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_buildup_duration
.as_secs_f64()
let stage_progress = match active_tool_kind {
Some(ToolKind::Sword(_)) => {
let stage_time = s.timer.as_secs_f64();
//let stage_progress = match s.stage_section {
match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_buildup_duration
.as_secs_f64()
},
StageSection::Swing => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f64()
},
StageSection::Recover => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_recover_duration
.as_secs_f64()
},
_ => 0.0,
}
},
StageSection::Swing => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f64()
Some(ToolKind::Axe(_)) => {
let stage_time = s.timer.as_secs_f64();
//let stage_progress = match s.stage_section {
match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_buildup_duration
.as_secs_f64()
},
StageSection::Swing => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f64()
},
StageSection::Recover => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_recover_duration
.as_secs_f64()
},
_ => 0.0,
}
},
StageSection::Recover => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_recover_duration
.as_secs_f64()
},
_ => 0.0,
_ => state.state_time,
};
match s.stage {
1 => anim::character::AlphaAnimation::update_skeleton(