mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Tweaked shockwave values. Added shockwave damage type. Changed how knockback was handled in shockwaves to make negative knockback work better.
This commit is contained in:
parent
829d8a20d1
commit
f5dad20899
@ -15,6 +15,7 @@ pub enum DamageSource {
|
|||||||
Projectile,
|
Projectile,
|
||||||
Explosion,
|
Explosion,
|
||||||
Falling,
|
Falling,
|
||||||
|
Shockwave,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Damage {
|
impl Damage {
|
||||||
@ -74,6 +75,23 @@ impl Damage {
|
|||||||
self.healthchange = -10.0;
|
self.healthchange = -10.0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
DamageSource::Shockwave => {
|
||||||
|
// Critical hit
|
||||||
|
if rand::random() {
|
||||||
|
self.healthchange *= 1.2;
|
||||||
|
}
|
||||||
|
// Block
|
||||||
|
if block {
|
||||||
|
self.healthchange *= 1.0 - BLOCK_EFFICIENCY
|
||||||
|
}
|
||||||
|
// Armor
|
||||||
|
self.healthchange *= 1.0 - loadout.get_damage_reduction();
|
||||||
|
|
||||||
|
// Min damage
|
||||||
|
if self.healthchange > -10.0 {
|
||||||
|
self.healthchange = -10.0;
|
||||||
|
}
|
||||||
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,11 +118,11 @@ impl Tool {
|
|||||||
Sword(_) => vec![
|
Sword(_) => vec![
|
||||||
GroundShockwave {
|
GroundShockwave {
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: Duration::from_millis(1000),
|
buildup_duration: Duration::from_millis(500),
|
||||||
recover_duration: Duration::from_millis(2000),
|
recover_duration: Duration::from_millis(1000),
|
||||||
damage: 300,
|
damage: 500,
|
||||||
knockback: -30.0,
|
knockback: -30.0,
|
||||||
shockwave_angle: 15.0,
|
shockwave_angle: 90.0,
|
||||||
shockwave_speed: 10.0,
|
shockwave_speed: 10.0,
|
||||||
shockwave_duration: Duration::from_millis(3000),
|
shockwave_duration: Duration::from_millis(3000),
|
||||||
},
|
},
|
||||||
@ -363,20 +363,20 @@ impl Tool {
|
|||||||
vec![
|
vec![
|
||||||
BasicMelee {
|
BasicMelee {
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: Duration::from_millis(0),
|
buildup_duration: Duration::from_millis(500),
|
||||||
recover_duration: Duration::from_millis(300),
|
recover_duration: Duration::from_millis(250),
|
||||||
knockback: 20.0,
|
knockback: 25.0,
|
||||||
base_healthchange: -200,
|
base_healthchange: -200,
|
||||||
range: 10.0,
|
range: 10.0,
|
||||||
max_angle: 120.0,
|
max_angle: 120.0,
|
||||||
},
|
},
|
||||||
GroundShockwave {
|
GroundShockwave {
|
||||||
energy_cost: 0,
|
energy_cost: 0,
|
||||||
buildup_duration: Duration::from_millis(1000),
|
buildup_duration: Duration::from_millis(500),
|
||||||
recover_duration: Duration::from_millis(2000),
|
recover_duration: Duration::from_millis(1000),
|
||||||
damage: 300,
|
damage: 500,
|
||||||
knockback: -30.0,
|
knockback: -30.0,
|
||||||
shockwave_angle: 15.0,
|
shockwave_angle: 90.0,
|
||||||
shockwave_speed: 10.0,
|
shockwave_speed: 10.0,
|
||||||
shockwave_duration: Duration::from_millis(3000),
|
shockwave_duration: Duration::from_millis(3000),
|
||||||
},
|
},
|
||||||
|
@ -31,13 +31,12 @@ 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);
|
||||||
|
|
||||||
handle_move(data, &mut update, 0.7);
|
handle_move(data, &mut update, 0.05);
|
||||||
handle_jump(data, &mut update);
|
|
||||||
|
|
||||||
if self.buildup_duration != Duration::default() {
|
if self.buildup_duration != Duration::default() {
|
||||||
// Build up
|
// Build up
|
||||||
update.character = CharacterState::GroundShockwave(Data {
|
update.character = CharacterState::GroundShockwave(Data {
|
||||||
exhausted: false,
|
exhausted: self.exhausted,
|
||||||
buildup_duration: self
|
buildup_duration: self
|
||||||
.buildup_duration
|
.buildup_duration
|
||||||
.checked_sub(Duration::from_secs_f32(data.dt.0))
|
.checked_sub(Duration::from_secs_f32(data.dt.0))
|
||||||
@ -79,7 +78,7 @@ impl CharacterBehavior for Data {
|
|||||||
} else if self.recover_duration != Duration::default() {
|
} else if self.recover_duration != Duration::default() {
|
||||||
// Recovery
|
// Recovery
|
||||||
update.character = CharacterState::GroundShockwave(Data {
|
update.character = CharacterState::GroundShockwave(Data {
|
||||||
exhausted: false,
|
exhausted: self.exhausted,
|
||||||
buildup_duration: self.buildup_duration,
|
buildup_duration: self.buildup_duration,
|
||||||
recover_duration: self
|
recover_duration: self
|
||||||
.recover_duration
|
.recover_duration
|
||||||
|
@ -183,7 +183,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Weapon gives base damage
|
// Weapon gives base damage
|
||||||
let source = DamageSource::Melee;
|
let source = DamageSource::Shockwave;
|
||||||
|
|
||||||
let mut damage = Damage {
|
let mut damage = Damage {
|
||||||
healthchange: -(shockwave.damage as f32),
|
healthchange: -(shockwave.damage as f32),
|
||||||
@ -210,11 +210,19 @@ impl<'a> System<'a> for Sys {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if shockwave.knockback != 0.0 {
|
if shockwave.knockback != 0.0 {
|
||||||
local_emitter.emit(LocalEvent::ApplyForce {
|
if shockwave.knockback < 0.0 {
|
||||||
entity: b,
|
local_emitter.emit(LocalEvent::ApplyForce {
|
||||||
force: shockwave.knockback
|
entity: b,
|
||||||
* *Dir::slerp(ori.0, Dir::new(Vec3::new(0.0, 0.0, 1.0)), 0.5),
|
force: shockwave.knockback
|
||||||
});
|
* *Dir::slerp(ori.0, Dir::new(Vec3::new(0.0, 0.0, -1.0)), 0.5),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
local_emitter.emit(LocalEvent::ApplyForce {
|
||||||
|
entity: b,
|
||||||
|
force: shockwave.knockback
|
||||||
|
* *Dir::slerp(ori.0, Dir::new(Vec3::new(0.0, 0.0, 1.0)), 0.5),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user