mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Initial implementation of spin attack for sword.
This commit is contained in:
parent
b0d359e29f
commit
a8e834e754
@ -106,10 +106,17 @@ pub enum CharacterAbility {
|
|||||||
base_damage: u32,
|
base_damage: u32,
|
||||||
},
|
},
|
||||||
SpinMelee {
|
SpinMelee {
|
||||||
energy_cost: u32,
|
|
||||||
buildup_duration: Duration,
|
buildup_duration: Duration,
|
||||||
|
swing_duration: Duration,
|
||||||
recover_duration: Duration,
|
recover_duration: Duration,
|
||||||
base_damage: u32,
|
base_damage: u32,
|
||||||
|
knockback: f32,
|
||||||
|
range: f32,
|
||||||
|
energy_cost: u32,
|
||||||
|
is_infinite: bool,
|
||||||
|
is_helicopter: bool,
|
||||||
|
forward_speed: f32,
|
||||||
|
num_spins: u32,
|
||||||
},
|
},
|
||||||
ChargedRanged {
|
ChargedRanged {
|
||||||
energy_cost: u32,
|
energy_cost: u32,
|
||||||
@ -402,24 +409,34 @@ impl From<&CharacterAbility> for CharacterState {
|
|||||||
base_damage: *base_damage,
|
base_damage: *base_damage,
|
||||||
}),
|
}),
|
||||||
CharacterAbility::SpinMelee {
|
CharacterAbility::SpinMelee {
|
||||||
energy_cost,
|
|
||||||
buildup_duration,
|
buildup_duration,
|
||||||
|
swing_duration,
|
||||||
recover_duration,
|
recover_duration,
|
||||||
base_damage,
|
base_damage,
|
||||||
|
knockback,
|
||||||
|
range,
|
||||||
|
energy_cost,
|
||||||
|
is_infinite,
|
||||||
|
is_helicopter,
|
||||||
|
forward_speed,
|
||||||
|
num_spins,
|
||||||
} => CharacterState::SpinMelee(spin_melee::Data {
|
} => CharacterState::SpinMelee(spin_melee::Data {
|
||||||
exhausted: false,
|
static_data: spin_melee::StaticData {
|
||||||
energy_cost: *energy_cost,
|
buildup_duration: *buildup_duration,
|
||||||
buildup_duration: *buildup_duration,
|
swing_duration: *swing_duration,
|
||||||
buildup_duration_default: *buildup_duration,
|
recover_duration: *recover_duration,
|
||||||
recover_duration: *recover_duration,
|
base_damage: *base_damage,
|
||||||
recover_duration_default: *recover_duration,
|
knockback: *knockback,
|
||||||
base_damage: *base_damage,
|
range: *range,
|
||||||
// This isn't needed for it's continuous implementation, but is left in should this
|
energy_cost: *energy_cost,
|
||||||
// skill be moved to the skillbar
|
is_infinite: *is_infinite,
|
||||||
hits_remaining: 1,
|
is_helicopter: *is_helicopter,
|
||||||
hits_remaining_default: 1, /* Should be the same value as hits_remaining, also
|
forward_speed: *forward_speed,
|
||||||
* this value can be removed if ability moved to
|
num_spins: *num_spins,
|
||||||
* skillbar */
|
},
|
||||||
|
timer: Duration::default(),
|
||||||
|
spins_remaining: *num_spins - 1,
|
||||||
|
stage_section: StageSection::Buildup,
|
||||||
}),
|
}),
|
||||||
CharacterAbility::ChargedRanged {
|
CharacterAbility::ChargedRanged {
|
||||||
energy_cost: _,
|
energy_cost: _,
|
||||||
|
@ -183,6 +183,19 @@ impl Tool {
|
|||||||
infinite_charge: true,
|
infinite_charge: true,
|
||||||
is_interruptible: true,
|
is_interruptible: true,
|
||||||
},
|
},
|
||||||
|
SpinMelee {
|
||||||
|
buildup_duration: Duration::from_millis(150),
|
||||||
|
swing_duration: Duration::from_millis(100),
|
||||||
|
recover_duration: Duration::from_millis(150),
|
||||||
|
base_damage: (100.0 * self.base_power()) as u32,
|
||||||
|
knockback: 0.0,
|
||||||
|
range: 3.5,
|
||||||
|
energy_cost: 200,
|
||||||
|
is_infinite: false,
|
||||||
|
is_helicopter: false,
|
||||||
|
forward_speed: 1.0,
|
||||||
|
num_spins: 3,
|
||||||
|
}
|
||||||
],
|
],
|
||||||
Axe(_) => vec![
|
Axe(_) => vec![
|
||||||
BasicMelee {
|
BasicMelee {
|
||||||
@ -195,10 +208,17 @@ impl Tool {
|
|||||||
max_angle: 20.0,
|
max_angle: 20.0,
|
||||||
},
|
},
|
||||||
SpinMelee {
|
SpinMelee {
|
||||||
energy_cost: 100,
|
buildup_duration: Duration::from_millis(100),
|
||||||
buildup_duration: Duration::from_millis(125),
|
swing_duration: Duration::from_millis(50),
|
||||||
recover_duration: Duration::from_millis(125),
|
recover_duration: Duration::from_millis(100),
|
||||||
base_damage: (60.0 * self.base_power()) as u32,
|
base_damage: (60.0 * self.base_power()) as u32,
|
||||||
|
knockback: 0.0,
|
||||||
|
range: 3.5,
|
||||||
|
energy_cost: 100,
|
||||||
|
is_infinite: true,
|
||||||
|
is_helicopter: true,
|
||||||
|
forward_speed: 0.0,
|
||||||
|
num_spins: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Hammer(_) => vec![
|
Hammer(_) => vec![
|
||||||
|
@ -1,131 +1,144 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{Attacking, CharacterState, EnergySource, StateUpdate},
|
comp::{Attacking, CharacterState, EnergySource, StateUpdate},
|
||||||
|
states::utils::{StageSection, *},
|
||||||
sys::character_behavior::*,
|
sys::character_behavior::*,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
|
/// Separated out to condense update portions of character state
|
||||||
pub struct Data {
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct StaticData {
|
||||||
/// How long until the state attacks
|
/// How long until the state attacks
|
||||||
pub buildup_duration: Duration,
|
pub buildup_duration: Duration,
|
||||||
/// Allows for buildup_duration to be reset to default value
|
/// How long the state is in the swing duration
|
||||||
pub buildup_duration_default: Duration,
|
pub swing_duration: Duration,
|
||||||
/// How long until state ends
|
/// How long until state ends
|
||||||
pub recover_duration: Duration,
|
pub recover_duration: Duration,
|
||||||
/// Allows for recover_duration to be reset to default value
|
|
||||||
pub recover_duration_default: Duration,
|
|
||||||
/// Base damage
|
/// Base damage
|
||||||
pub base_damage: u32,
|
pub base_damage: u32,
|
||||||
/// Whether the attack can deal more damage
|
/// Knockback
|
||||||
pub exhausted: bool,
|
pub knockback: f32,
|
||||||
/// How many hits it can do before ending
|
/// Range
|
||||||
pub hits_remaining: u32,
|
pub range: f32,
|
||||||
/// Allows for hits_remaining to be reset to default value
|
|
||||||
pub hits_remaining_default: u32,
|
|
||||||
/// Energy cost per attack
|
/// Energy cost per attack
|
||||||
pub energy_cost: u32,
|
pub energy_cost: u32,
|
||||||
|
/// Whether spin state is infinite
|
||||||
|
pub is_infinite: bool,
|
||||||
|
/// Used to maintain classic axe spin physics
|
||||||
|
pub is_helicopter: bool,
|
||||||
|
/// Used for forced forward movement
|
||||||
|
pub forward_speed: f32,
|
||||||
|
/// Number of spins
|
||||||
|
pub num_spins: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
const MOVE_SPEED: f32 = 5.0;
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct Data {
|
||||||
|
/// Struct containing data that does not change over the course of the
|
||||||
|
/// character state
|
||||||
|
pub static_data: StaticData,
|
||||||
|
/// Timer for each stage
|
||||||
|
pub timer: Duration,
|
||||||
|
/// How many spins it can do before ending
|
||||||
|
pub spins_remaining: u32,
|
||||||
|
/// What section the character stage is in
|
||||||
|
pub stage_section: StageSection,
|
||||||
|
}
|
||||||
|
|
||||||
impl CharacterBehavior for Data {
|
impl CharacterBehavior for Data {
|
||||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||||
let mut update = StateUpdate::from(data);
|
let mut update = StateUpdate::from(data);
|
||||||
|
|
||||||
if self.buildup_duration != Duration::default() {
|
if self.static_data.is_helicopter {
|
||||||
// Allows for moving
|
|
||||||
update.vel.0 =
|
update.vel.0 =
|
||||||
Vec3::new(data.inputs.move_dir.x, data.inputs.move_dir.y, 0.0) * MOVE_SPEED;
|
Vec3::new(data.inputs.move_dir.x, data.inputs.move_dir.y, 0.0) * 5.0;
|
||||||
|
} else {
|
||||||
|
handle_orientation(data, &mut update, 1.0);
|
||||||
|
forward_move(data, &mut update, 0.1, self.static_data.forward_speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.stage_section == StageSection::Buildup
|
||||||
|
&& self.timer < self.static_data.buildup_duration
|
||||||
|
{
|
||||||
|
// Build up
|
||||||
update.character = CharacterState::SpinMelee(Data {
|
update.character = CharacterState::SpinMelee(Data {
|
||||||
buildup_duration: self
|
static_data: self.static_data,
|
||||||
.buildup_duration
|
timer: self
|
||||||
.checked_sub(Duration::from_secs_f32(data.dt.0))
|
.timer
|
||||||
|
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
buildup_duration_default: self.buildup_duration_default,
|
spins_remaining: self.spins_remaining,
|
||||||
recover_duration: self.recover_duration,
|
stage_section: self.stage_section,
|
||||||
recover_duration_default: self.recover_duration_default,
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
exhausted: self.exhausted,
|
|
||||||
hits_remaining: self.hits_remaining,
|
|
||||||
hits_remaining_default: self.hits_remaining_default,
|
|
||||||
energy_cost: self.energy_cost,
|
|
||||||
});
|
});
|
||||||
} else if !self.exhausted {
|
} else if self.stage_section == StageSection::Buildup {
|
||||||
//Hit attempt
|
// Transitions to swing section of stage
|
||||||
|
update.character = CharacterState::SpinMelee(Data {
|
||||||
|
static_data: self.static_data,
|
||||||
|
timer: Duration::default(),
|
||||||
|
spins_remaining: self.spins_remaining,
|
||||||
|
stage_section: StageSection::Swing,
|
||||||
|
});
|
||||||
|
// Hit attempt
|
||||||
data.updater.insert(data.entity, Attacking {
|
data.updater.insert(data.entity, Attacking {
|
||||||
base_healthchange: -(self.base_damage as i32),
|
base_healthchange: -(self.static_data.base_damage as i32),
|
||||||
range: 3.5,
|
range: self.static_data.range,
|
||||||
max_angle: 360_f32.to_radians(),
|
max_angle: 180_f32.to_radians(),
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
knockback: 0.0,
|
knockback: self.static_data.knockback,
|
||||||
});
|
});
|
||||||
|
} else if self.stage_section == StageSection::Swing
|
||||||
update.character = CharacterState::SpinMelee(Data {
|
&& self.timer < self.static_data.swing_duration
|
||||||
buildup_duration: self.buildup_duration,
|
|
||||||
buildup_duration_default: self.buildup_duration_default,
|
|
||||||
recover_duration: self.recover_duration,
|
|
||||||
recover_duration_default: self.recover_duration_default,
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
exhausted: true,
|
|
||||||
hits_remaining: self.hits_remaining - 1,
|
|
||||||
hits_remaining_default: self.hits_remaining_default,
|
|
||||||
energy_cost: self.energy_cost,
|
|
||||||
});
|
|
||||||
} else if self.recover_duration != Duration::default() {
|
|
||||||
// Allows for moving
|
|
||||||
update.vel.0 =
|
|
||||||
Vec3::new(data.inputs.move_dir.x, data.inputs.move_dir.y, 0.0) * MOVE_SPEED;
|
|
||||||
|
|
||||||
update.character = CharacterState::SpinMelee(Data {
|
|
||||||
buildup_duration: self.buildup_duration,
|
|
||||||
buildup_duration_default: self.buildup_duration_default,
|
|
||||||
recover_duration: self
|
|
||||||
.recover_duration
|
|
||||||
.checked_sub(Duration::from_secs_f32(data.dt.0))
|
|
||||||
.unwrap_or_default(),
|
|
||||||
recover_duration_default: self.recover_duration_default,
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
exhausted: self.exhausted,
|
|
||||||
hits_remaining: self.hits_remaining,
|
|
||||||
hits_remaining_default: self.hits_remaining_default,
|
|
||||||
energy_cost: self.energy_cost,
|
|
||||||
});
|
|
||||||
} else if self.hits_remaining != 0 {
|
|
||||||
// Allows for one ability usage to have multiple hits
|
|
||||||
// This isn't needed for it's continuous implementation, but is left in should
|
|
||||||
// this skill be moved to the skillbar
|
|
||||||
update.character = CharacterState::SpinMelee(Data {
|
|
||||||
buildup_duration: self.buildup_duration_default,
|
|
||||||
buildup_duration_default: self.buildup_duration_default,
|
|
||||||
recover_duration: self.recover_duration_default,
|
|
||||||
recover_duration_default: self.recover_duration_default,
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
exhausted: false,
|
|
||||||
hits_remaining: self.hits_remaining,
|
|
||||||
hits_remaining_default: self.hits_remaining_default,
|
|
||||||
energy_cost: self.energy_cost,
|
|
||||||
});
|
|
||||||
} else if update.energy.current() >= self.energy_cost && data.inputs.secondary.is_pressed()
|
|
||||||
{
|
{
|
||||||
|
// Swings
|
||||||
update.character = CharacterState::SpinMelee(Data {
|
update.character = CharacterState::SpinMelee(Data {
|
||||||
buildup_duration: self.buildup_duration_default,
|
static_data: self.static_data,
|
||||||
buildup_duration_default: self.buildup_duration_default,
|
timer: self
|
||||||
recover_duration: self.recover_duration_default,
|
.timer
|
||||||
recover_duration_default: self.recover_duration_default,
|
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||||
base_damage: self.base_damage,
|
.unwrap_or_default(),
|
||||||
exhausted: false,
|
spins_remaining: self.spins_remaining,
|
||||||
hits_remaining: self.hits_remaining_default,
|
stage_section: self.stage_section,
|
||||||
hits_remaining_default: self.hits_remaining_default,
|
});
|
||||||
energy_cost: self.energy_cost,
|
} else if self.stage_section == StageSection::Swing {
|
||||||
|
// Transitions to recover section of stage
|
||||||
|
update.character = CharacterState::SpinMelee(Data {
|
||||||
|
static_data: self.static_data,
|
||||||
|
timer: Duration::default(),
|
||||||
|
spins_remaining: self.spins_remaining,
|
||||||
|
stage_section: StageSection::Recover,
|
||||||
|
})
|
||||||
|
} else if self.stage_section == StageSection::Recover
|
||||||
|
&& self.timer < self.static_data.recover_duration
|
||||||
|
{
|
||||||
|
// Recover
|
||||||
|
update.character = CharacterState::SpinMelee(Data {
|
||||||
|
static_data: self.static_data,
|
||||||
|
timer: self
|
||||||
|
.timer
|
||||||
|
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||||
|
.unwrap_or_default(),
|
||||||
|
spins_remaining: self.spins_remaining,
|
||||||
|
stage_section: self.stage_section,
|
||||||
|
})
|
||||||
|
} else if update.energy.current() >= self.static_data.energy_cost && (self.spins_remaining != 0 || (self.static_data.is_infinite && data.inputs.secondary.is_pressed())) {
|
||||||
|
let new_spins_remaining = if self.static_data.is_infinite {
|
||||||
|
self.spins_remaining
|
||||||
|
} else {
|
||||||
|
self.spins_remaining - 1
|
||||||
|
};
|
||||||
|
update.character = CharacterState::SpinMelee(Data {
|
||||||
|
static_data: self.static_data,
|
||||||
|
timer: Duration::default(),
|
||||||
|
spins_remaining: new_spins_remaining,
|
||||||
|
stage_section: StageSection::Buildup,
|
||||||
});
|
});
|
||||||
// Consumes energy if there's enough left and RMB is held down
|
// Consumes energy if there's enough left and RMB is held down
|
||||||
update
|
update
|
||||||
.energy
|
.energy
|
||||||
.change_by(-(self.energy_cost as i32), EnergySource::Ability);
|
.change_by(-(self.static_data.energy_cost as i32), EnergySource::Ability);
|
||||||
} else {
|
} else {
|
||||||
// Done
|
// Done
|
||||||
update.character = CharacterState::Wielding;
|
update.character = CharacterState::Wielding;
|
||||||
|
@ -2,13 +2,22 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::{
|
||||||
|
comp::item::{Hands, ToolKind},
|
||||||
|
states::utils::StageSection,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
pub struct SpinMeleeAnimation;
|
pub struct SpinMeleeAnimation;
|
||||||
|
|
||||||
impl Animation for SpinMeleeAnimation {
|
impl Animation for SpinMeleeAnimation {
|
||||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, Vec3<f32>, f64);
|
type Dependency = (
|
||||||
|
Option<ToolKind>,
|
||||||
|
Option<ToolKind>,
|
||||||
|
Vec3<f32>,
|
||||||
|
f64,
|
||||||
|
Option<StageSection>,
|
||||||
|
);
|
||||||
type Skeleton = CharacterSkeleton;
|
type Skeleton = CharacterSkeleton;
|
||||||
|
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
@ -18,7 +27,7 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, second_tool_kind, velocity, _global_time): Self::Dependency,
|
(active_tool_kind, second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
|
||||||
anim_time: f64,
|
anim_time: f64,
|
||||||
rate: &mut f32,
|
rate: &mut f32,
|
||||||
skeleton_attr: &SkeletonAttr,
|
skeleton_attr: &SkeletonAttr,
|
||||||
@ -49,61 +58,74 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
||||||
let quick = (anim_time as f32 * lab as f32 * 8.0).sin();
|
let quick = (anim_time as f32 * lab as f32 * 8.0).sin();
|
||||||
|
|
||||||
if let Some(ToolKind::Axe(_)) = active_tool_kind {
|
match active_tool_kind {
|
||||||
next.l_hand.position = Vec3::new(-0.5, 0.0, 4.0);
|
Some(ToolKind::Sword(_)) => {
|
||||||
next.l_hand.orientation = Quaternion::rotation_x(PI / 2.0)
|
if let Some(stage_section) = stage_section {
|
||||||
* Quaternion::rotation_z(0.0)
|
match stage_section {
|
||||||
* Quaternion::rotation_y(PI);
|
StageSection::Buildup => {},
|
||||||
next.l_hand.scale = Vec3::one() * 1.08;
|
StageSection::Swing => {},
|
||||||
next.r_hand.position = Vec3::new(0.5, 0.0, -2.5);
|
StageSection::Recover => {},
|
||||||
next.r_hand.orientation = Quaternion::rotation_x(PI / 2.0)
|
_ => {},
|
||||||
* Quaternion::rotation_z(0.0)
|
}
|
||||||
* Quaternion::rotation_y(0.0);
|
}
|
||||||
next.r_hand.scale = Vec3::one() * 1.06;
|
}
|
||||||
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
|
Some(ToolKind::Axe(_)) => {
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0)
|
next.l_hand.position = Vec3::new(-0.5, 0.0, 4.0);
|
||||||
* Quaternion::rotation_y(0.0)
|
next.l_hand.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0)
|
||||||
|
* Quaternion::rotation_y(PI);
|
||||||
|
next.l_hand.scale = Vec3::one() * 1.08;
|
||||||
|
next.r_hand.position = Vec3::new(0.5, 0.0, -2.5);
|
||||||
|
next.r_hand.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||||
|
* Quaternion::rotation_z(0.0)
|
||||||
|
* Quaternion::rotation_y(0.0);
|
||||||
|
next.r_hand.scale = Vec3::one() * 1.06;
|
||||||
|
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
|
||||||
|
next.main.orientation = Quaternion::rotation_x(0.0)
|
||||||
|
* Quaternion::rotation_y(0.0)
|
||||||
|
* Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
next.control.position = Vec3::new(0.0, 16.0, 3.0);
|
next.control.position = Vec3::new(0.0, 16.0, 3.0);
|
||||||
next.control.orientation = Quaternion::rotation_x(-1.4)
|
next.control.orientation = Quaternion::rotation_x(-1.4)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(1.4);
|
* Quaternion::rotation_z(1.4);
|
||||||
next.control.scale = Vec3::one();
|
next.control.scale = Vec3::one();
|
||||||
|
|
||||||
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
|
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
|
||||||
next.head.orientation = Quaternion::rotation_z(0.0)
|
next.head.orientation = Quaternion::rotation_z(0.0)
|
||||||
* Quaternion::rotation_x(-0.15)
|
* Quaternion::rotation_x(-0.15)
|
||||||
* Quaternion::rotation_y(0.08);
|
* Quaternion::rotation_y(0.08);
|
||||||
next.chest.position = Vec3::new(
|
next.chest.position = Vec3::new(
|
||||||
0.0,
|
0.0,
|
||||||
skeleton_attr.chest.0 - 3.0,
|
skeleton_attr.chest.0 - 3.0,
|
||||||
skeleton_attr.chest.1 - 2.0,
|
skeleton_attr.chest.1 - 2.0,
|
||||||
);
|
);
|
||||||
next.chest.orientation = Quaternion::rotation_z(0.0)
|
next.chest.orientation = Quaternion::rotation_z(0.0)
|
||||||
* Quaternion::rotation_x(-0.1)
|
* Quaternion::rotation_x(-0.1)
|
||||||
* Quaternion::rotation_y(0.3);
|
* Quaternion::rotation_y(0.3);
|
||||||
next.chest.scale = Vec3::one();
|
next.chest.scale = Vec3::one();
|
||||||
|
|
||||||
next.belt.position = Vec3::new(0.0, 1.0, -1.0);
|
next.belt.position = Vec3::new(0.0, 1.0, -1.0);
|
||||||
next.belt.orientation = Quaternion::rotation_z(0.0)
|
next.belt.orientation = Quaternion::rotation_z(0.0)
|
||||||
* Quaternion::rotation_x(0.4)
|
* Quaternion::rotation_x(0.4)
|
||||||
* Quaternion::rotation_y(0.0);
|
* Quaternion::rotation_y(0.0);
|
||||||
next.belt.scale = Vec3::one() * 0.98;
|
next.belt.scale = Vec3::one() * 0.98;
|
||||||
next.shorts.position = Vec3::new(0.0, 3.0, -2.5);
|
next.shorts.position = Vec3::new(0.0, 3.0, -2.5);
|
||||||
next.shorts.orientation = Quaternion::rotation_z(0.0)
|
next.shorts.orientation = Quaternion::rotation_z(0.0)
|
||||||
* Quaternion::rotation_x(0.7)
|
* Quaternion::rotation_x(0.7)
|
||||||
* Quaternion::rotation_y(0.0);
|
* Quaternion::rotation_y(0.0);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
next.torso.position = Vec3::new(
|
next.torso.position = Vec3::new(
|
||||||
-xshift * (anim_time as f32).min(0.6),
|
-xshift * (anim_time as f32).min(0.6),
|
||||||
-yshift * (anim_time as f32).min(0.6),
|
-yshift * (anim_time as f32).min(0.6),
|
||||||
0.0,
|
0.0,
|
||||||
) * skeleton_attr.scaler;
|
) * skeleton_attr.scaler;
|
||||||
next.torso.orientation = Quaternion::rotation_z(spin * -16.0)
|
next.torso.orientation = Quaternion::rotation_z(spin * -16.0)
|
||||||
* Quaternion::rotation_x(0.0)
|
* Quaternion::rotation_x(0.0)
|
||||||
* Quaternion::rotation_y(0.0);
|
* Quaternion::rotation_y(0.0);
|
||||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
}
|
}
|
||||||
if velocity.z.abs() > 0.1 {
|
if velocity.z.abs() > 0.1 {
|
||||||
next.l_foot.position =
|
next.l_foot.position =
|
||||||
|
@ -81,6 +81,8 @@ impl State {
|
|||||||
kind != "Sceptre" && kind != "SceptreVelorite"
|
kind != "Sceptre" && kind != "SceptreVelorite"
|
||||||
} else if let ToolKind::Debug(kind) = &kind.kind {
|
} else if let ToolKind::Debug(kind) = &kind.kind {
|
||||||
kind == "Boost"
|
kind == "Boost"
|
||||||
|
} else if let ToolKind::Sword(_) = &kind.kind {
|
||||||
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -803,6 +803,10 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
"\nWhirls a big fireball into the air. \nExplodes the ground \
|
"\nWhirls a big fireball into the air. \nExplodes the ground \
|
||||||
and does\na big amount of damage",
|
and does\na big amount of damage",
|
||||||
)),
|
)),
|
||||||
|
ToolKind::Sword(_) => Some((
|
||||||
|
"Whirlwind",
|
||||||
|
"\nMove forward while spinning with \n your sword."
|
||||||
|
)),
|
||||||
ToolKind::Debug(kind) => match kind.as_ref() {
|
ToolKind::Debug(kind) => match kind.as_ref() {
|
||||||
"Boost" => Some((
|
"Boost" => Some((
|
||||||
"Possessing Arrow",
|
"Possessing Arrow",
|
||||||
|
@ -25,7 +25,7 @@ use anim::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{
|
comp::{
|
||||||
item::ItemKind, Body, CharacterState, Item, Last, LightAnimation, LightEmitter, Loadout,
|
item::{ItemKind, ToolKind}, Body, CharacterState, Item, Last, LightAnimation, LightEmitter, Loadout,
|
||||||
Ori, PhysicsState, Pos, Scale, Stats, Vel,
|
Ori, PhysicsState, Pos, Scale, Stats, Vel,
|
||||||
},
|
},
|
||||||
span,
|
span,
|
||||||
@ -935,11 +935,30 @@ impl FigureMgr {
|
|||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
CharacterState::SpinMelee(_) => {
|
CharacterState::SpinMelee(s) => {
|
||||||
|
let stage_progress = match active_tool_kind {
|
||||||
|
Some(ToolKind::Sword(_)) => {
|
||||||
|
let stage_time = s.timer.as_secs_f64();
|
||||||
|
match s.stage_section {
|
||||||
|
StageSection::Buildup => {
|
||||||
|
stage_time / s.static_data.buildup_duration.as_secs_f64()
|
||||||
|
},
|
||||||
|
StageSection::Swing => {
|
||||||
|
stage_time / s.static_data.swing_duration.as_secs_f64()
|
||||||
|
},
|
||||||
|
StageSection::Recover => {
|
||||||
|
stage_time / s.static_data.recover_duration.as_secs_f64()
|
||||||
|
},
|
||||||
|
_ => 0.0,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => state.state_time
|
||||||
|
};
|
||||||
|
|
||||||
anim::character::SpinMeleeAnimation::update_skeleton(
|
anim::character::SpinMeleeAnimation::update_skeleton(
|
||||||
&target_base,
|
&target_base,
|
||||||
(active_tool_kind, second_tool_kind, vel.0, time),
|
(active_tool_kind, second_tool_kind, vel.0, time, Some(s.stage_section),),
|
||||||
state.state_time,
|
stage_progress,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user