mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
remove unused timed_combo
This commit is contained in:
parent
86b0b8f644
commit
dcc9d44b1c
@ -41,11 +41,6 @@ pub enum CharacterAbility {
|
|||||||
},
|
},
|
||||||
BasicBlock,
|
BasicBlock,
|
||||||
Roll,
|
Roll,
|
||||||
TimedCombo {
|
|
||||||
buildup_duration: Duration,
|
|
||||||
recover_duration: Duration,
|
|
||||||
base_damage: u32,
|
|
||||||
},
|
|
||||||
TripleStrike {
|
TripleStrike {
|
||||||
base_damage: u32,
|
base_damage: u32,
|
||||||
needs_timing: bool,
|
needs_timing: bool,
|
||||||
@ -57,7 +52,7 @@ impl CharacterAbility {
|
|||||||
/// applicable.
|
/// applicable.
|
||||||
pub fn requirements_paid(&self, data: &JoinData, update: &mut StateUpdate) -> bool {
|
pub fn requirements_paid(&self, data: &JoinData, update: &mut StateUpdate) -> bool {
|
||||||
match self {
|
match self {
|
||||||
CharacterAbility::TimedCombo { .. } | CharacterAbility::TripleStrike { .. } => {
|
CharacterAbility::TripleStrike { .. } => {
|
||||||
data.physics.on_ground
|
data.physics.on_ground
|
||||||
&& data.body.is_humanoid()
|
&& data.body.is_humanoid()
|
||||||
&& data.inputs.look_dir.xy().magnitude_squared() > 0.01
|
&& data.inputs.look_dir.xy().magnitude_squared() > 0.01
|
||||||
@ -169,18 +164,6 @@ impl From<&CharacterAbility> for CharacterState {
|
|||||||
remaining_duration: Duration::from_millis(500),
|
remaining_duration: Duration::from_millis(500),
|
||||||
was_wielded: false, // false by default. utils might set it to true
|
was_wielded: false, // false by default. utils might set it to true
|
||||||
}),
|
}),
|
||||||
CharacterAbility::TimedCombo {
|
|
||||||
buildup_duration,
|
|
||||||
recover_duration,
|
|
||||||
base_damage,
|
|
||||||
} => CharacterState::TimedCombo(timed_combo::Data {
|
|
||||||
buildup_duration: *buildup_duration,
|
|
||||||
recover_duration: *recover_duration,
|
|
||||||
stage: 0,
|
|
||||||
stage_exhausted: false,
|
|
||||||
stage_time_active: Duration::default(),
|
|
||||||
base_damage: *base_damage,
|
|
||||||
}),
|
|
||||||
CharacterAbility::TripleStrike {
|
CharacterAbility::TripleStrike {
|
||||||
base_damage,
|
base_damage,
|
||||||
needs_timing,
|
needs_timing,
|
||||||
|
@ -56,9 +56,6 @@ pub enum CharacterState {
|
|||||||
Boost(boost::Data),
|
Boost(boost::Data),
|
||||||
/// Dash forward and then attack
|
/// Dash forward and then attack
|
||||||
DashMelee(dash_melee::Data),
|
DashMelee(dash_melee::Data),
|
||||||
/// A three-stage attack where play must click at appropriate times
|
|
||||||
/// to continue attack chain.
|
|
||||||
TimedCombo(timed_combo::Data),
|
|
||||||
/// A three-stage attack where each attack pushes player forward
|
/// A three-stage attack where each attack pushes player forward
|
||||||
/// and successive attacks increase in damage, while player holds button.
|
/// and successive attacks increase in damage, while player holds button.
|
||||||
TripleStrike(triple_strike::Data),
|
TripleStrike(triple_strike::Data),
|
||||||
@ -72,7 +69,6 @@ impl CharacterState {
|
|||||||
| CharacterState::BasicRanged(_)
|
| CharacterState::BasicRanged(_)
|
||||||
| CharacterState::DashMelee(_)
|
| CharacterState::DashMelee(_)
|
||||||
| CharacterState::TripleStrike(_)
|
| CharacterState::TripleStrike(_)
|
||||||
| CharacterState::TimedCombo(_)
|
|
||||||
| CharacterState::BasicBlock => true,
|
| CharacterState::BasicBlock => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
@ -89,7 +85,6 @@ impl CharacterState {
|
|||||||
match self {
|
match self {
|
||||||
CharacterState::BasicMelee(_)
|
CharacterState::BasicMelee(_)
|
||||||
| CharacterState::BasicRanged(_)
|
| CharacterState::BasicRanged(_)
|
||||||
| CharacterState::TimedCombo(_)
|
|
||||||
| CharacterState::DashMelee(_)
|
| CharacterState::DashMelee(_)
|
||||||
| CharacterState::TripleStrike(_) => true,
|
| CharacterState::TripleStrike(_) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -9,7 +9,6 @@ pub mod glide;
|
|||||||
pub mod idle;
|
pub mod idle;
|
||||||
pub mod roll;
|
pub mod roll;
|
||||||
pub mod sit;
|
pub mod sit;
|
||||||
pub mod timed_combo;
|
|
||||||
pub mod triple_strike;
|
pub mod triple_strike;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
pub mod wielding;
|
pub mod wielding;
|
||||||
|
@ -1,130 +0,0 @@
|
|||||||
use crate::{
|
|
||||||
comp::{Attacking, CharacterState, EnergySource, StateUpdate},
|
|
||||||
sys::character_behavior::{CharacterBehavior, JoinData},
|
|
||||||
};
|
|
||||||
use std::time::Duration;
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
|
|
||||||
pub struct Data {
|
|
||||||
/// Denotes what stage (of 3) the attack is in
|
|
||||||
pub stage: i8,
|
|
||||||
/// Whether current stage has exhausted its attack
|
|
||||||
pub stage_exhausted: bool,
|
|
||||||
/// How long state waits before it should deal damage
|
|
||||||
pub buildup_duration: Duration,
|
|
||||||
/// How long the state waits until exiting
|
|
||||||
pub recover_duration: Duration,
|
|
||||||
/// Tracks how long current stage has been active
|
|
||||||
pub stage_time_active: Duration,
|
|
||||||
/// Base damage
|
|
||||||
pub base_damage: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CharacterBehavior for Data {
|
|
||||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
|
||||||
let mut update = StateUpdate::from(data);
|
|
||||||
|
|
||||||
let new_stage_time_active = self
|
|
||||||
.stage_time_active
|
|
||||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
|
||||||
.unwrap_or(Duration::default());
|
|
||||||
|
|
||||||
if self.stage < 3 {
|
|
||||||
// Build up window
|
|
||||||
if new_stage_time_active < self.buildup_duration {
|
|
||||||
// If the player is pressing primary btn
|
|
||||||
if data.inputs.primary.is_just_pressed() {
|
|
||||||
// They failed, go back to `Wielding`
|
|
||||||
update.character = CharacterState::Wielding;
|
|
||||||
}
|
|
||||||
// Keep updating
|
|
||||||
else {
|
|
||||||
update.character = CharacterState::TimedCombo(Data {
|
|
||||||
stage: self.stage,
|
|
||||||
buildup_duration: self.buildup_duration,
|
|
||||||
recover_duration: self.recover_duration,
|
|
||||||
stage_exhausted: false,
|
|
||||||
stage_time_active: new_stage_time_active,
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hit attempt window
|
|
||||||
else if !self.stage_exhausted {
|
|
||||||
// Swing hits
|
|
||||||
data.updater.insert(data.entity, Attacking {
|
|
||||||
base_healthchange: -((self.base_damage * (self.stage as u32 + 1)) as i32),
|
|
||||||
range: 3.5,
|
|
||||||
max_angle: 75_f32.to_radians(),
|
|
||||||
applied: false,
|
|
||||||
hit_count: 0,
|
|
||||||
knockback: 0.0,
|
|
||||||
});
|
|
||||||
|
|
||||||
update.character = CharacterState::TimedCombo(Data {
|
|
||||||
stage: self.stage,
|
|
||||||
buildup_duration: self.buildup_duration,
|
|
||||||
recover_duration: self.recover_duration,
|
|
||||||
stage_exhausted: true,
|
|
||||||
stage_time_active: new_stage_time_active,
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Swing recovery window
|
|
||||||
else if new_stage_time_active
|
|
||||||
< self
|
|
||||||
.buildup_duration
|
|
||||||
.checked_add(self.recover_duration)
|
|
||||||
.unwrap_or(Duration::default())
|
|
||||||
{
|
|
||||||
// Try to transition to next stage
|
|
||||||
if data.inputs.primary.is_just_pressed() {
|
|
||||||
update.character = CharacterState::TimedCombo(Data {
|
|
||||||
stage: self.stage + 1,
|
|
||||||
buildup_duration: self.buildup_duration,
|
|
||||||
recover_duration: self.recover_duration,
|
|
||||||
stage_exhausted: true,
|
|
||||||
stage_time_active: Duration::default(),
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Player didn't click this frame
|
|
||||||
else {
|
|
||||||
// Update state
|
|
||||||
update.character = CharacterState::TimedCombo(Data {
|
|
||||||
stage: self.stage,
|
|
||||||
buildup_duration: self.buildup_duration,
|
|
||||||
recover_duration: self.recover_duration,
|
|
||||||
stage_exhausted: true,
|
|
||||||
stage_time_active: new_stage_time_active,
|
|
||||||
base_damage: self.base_damage,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Stage expired but missed transition to next stage
|
|
||||||
else {
|
|
||||||
// Back to `Wielding`
|
|
||||||
update.character = CharacterState::Wielding;
|
|
||||||
// Make sure attack component is removed
|
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Made three successful hits!
|
|
||||||
else {
|
|
||||||
println!("Success!");
|
|
||||||
// Back to `Wielding`
|
|
||||||
update.character = CharacterState::Wielding;
|
|
||||||
// Make sure attack component is removed
|
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Grant energy on successful hit
|
|
||||||
if let Some(attack) = data.attacking {
|
|
||||||
if attack.applied && attack.hit_count > 0 {
|
|
||||||
data.updater.remove::<Attacking>(data.entity);
|
|
||||||
update.energy.change_by(100, EnergySource::HitEnemy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update
|
|
||||||
}
|
|
||||||
}
|
|
@ -213,7 +213,6 @@ impl<'a> System<'a> for Sys {
|
|||||||
CharacterState::BasicRanged(data) => data.handle_event(&j, action),
|
CharacterState::BasicRanged(data) => data.handle_event(&j, action),
|
||||||
CharacterState::Boost(data) => data.handle_event(&j, action),
|
CharacterState::Boost(data) => data.handle_event(&j, action),
|
||||||
CharacterState::DashMelee(data) => data.handle_event(&j, action),
|
CharacterState::DashMelee(data) => data.handle_event(&j, action),
|
||||||
CharacterState::TimedCombo(data) => data.handle_event(&j, action),
|
|
||||||
};
|
};
|
||||||
local_emitter.append(&mut state_update.local_events);
|
local_emitter.append(&mut state_update.local_events);
|
||||||
server_emitter.append(&mut state_update.server_events);
|
server_emitter.append(&mut state_update.server_events);
|
||||||
@ -236,7 +235,6 @@ impl<'a> System<'a> for Sys {
|
|||||||
CharacterState::BasicRanged(data) => data.behavior(&j),
|
CharacterState::BasicRanged(data) => data.behavior(&j),
|
||||||
CharacterState::Boost(data) => data.behavior(&j),
|
CharacterState::Boost(data) => data.behavior(&j),
|
||||||
CharacterState::DashMelee(data) => data.behavior(&j),
|
CharacterState::DashMelee(data) => data.behavior(&j),
|
||||||
CharacterState::TimedCombo(data) => data.behavior(&j),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
local_emitter.append(&mut state_update.local_events);
|
local_emitter.append(&mut state_update.local_events);
|
||||||
|
@ -549,22 +549,6 @@ impl FigureMgr {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
CharacterState::TimedCombo(s) => match s.stage {
|
|
||||||
0 | 2 => anim::character::AlphaAnimation::update_skeleton(
|
|
||||||
&target_base,
|
|
||||||
(active_tool_kind, vel.0.magnitude(), time),
|
|
||||||
state.state_time,
|
|
||||||
&mut state_animation_rate,
|
|
||||||
skeleton_attr,
|
|
||||||
),
|
|
||||||
_ => anim::character::DashAnimation::update_skeleton(
|
|
||||||
&target_base,
|
|
||||||
(active_tool_kind, time),
|
|
||||||
state.state_time,
|
|
||||||
&mut state_animation_rate,
|
|
||||||
skeleton_attr,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
CharacterState::BasicBlock { .. } => {
|
CharacterState::BasicBlock { .. } => {
|
||||||
anim::character::BlockIdleAnimation::update_skeleton(
|
anim::character::BlockIdleAnimation::update_skeleton(
|
||||||
&CharacterSkeleton::new(),
|
&CharacterSkeleton::new(),
|
||||||
|
Loading…
Reference in New Issue
Block a user