mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix charged melee swing
This commit is contained in:
parent
6b534729be
commit
ee03304a3a
@ -130,7 +130,19 @@ impl CharacterBehavior for Data {
|
||||
}
|
||||
},
|
||||
StageSection::Swing => {
|
||||
if !self.exhausted {
|
||||
if self.timer.as_millis() as f32
|
||||
> 0.5 * self.static_data.swing_duration.as_millis() as f32
|
||||
&& !self.exhausted
|
||||
{
|
||||
// Swing
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
exhausted: true,
|
||||
..*self
|
||||
});
|
||||
let mut damage = Damage {
|
||||
source: DamageSource::Melee,
|
||||
value: self.static_data.max_damage as f32,
|
||||
@ -152,16 +164,6 @@ impl CharacterBehavior for Data {
|
||||
hit_count: 0,
|
||||
knockback: Knockback::Away(knockback),
|
||||
});
|
||||
|
||||
// Starts swinging
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
exhausted: true,
|
||||
..*self
|
||||
});
|
||||
} else if self.timer < self.static_data.swing_duration {
|
||||
// Swings
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
|
Loading…
Reference in New Issue
Block a user