mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed shockwave and melee crit damage bypassing infinite armor. Made knockback not be applied if infinite armor.
This commit is contained in:
parent
6327dd18b6
commit
d0f068ba63
@ -36,7 +36,9 @@ impl Damage {
|
|||||||
self.healthchange *= 1.0 - damage_reduction;
|
self.healthchange *= 1.0 - damage_reduction;
|
||||||
|
|
||||||
// Critical damage applies after armor for melee
|
// Critical damage applies after armor for melee
|
||||||
|
if (damage_reduction - 1.0).abs() > f32::EPSILON {
|
||||||
self.healthchange += critdamage;
|
self.healthchange += critdamage;
|
||||||
|
}
|
||||||
|
|
||||||
// Min damage
|
// Min damage
|
||||||
if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 {
|
if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 {
|
||||||
@ -77,10 +79,11 @@ impl Damage {
|
|||||||
},
|
},
|
||||||
DamageSource::Shockwave => {
|
DamageSource::Shockwave => {
|
||||||
// Armor
|
// Armor
|
||||||
self.healthchange *= 1.0 - loadout.get_damage_reduction();
|
let damage_reduction = loadout.get_damage_reduction();
|
||||||
|
self.healthchange *= 1.0 - damage_reduction;
|
||||||
|
|
||||||
// Min damage
|
// Min damage
|
||||||
if self.healthchange > -10.0 {
|
if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 {
|
||||||
self.healthchange = -10.0;
|
self.healthchange = -10.0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -69,6 +69,7 @@ impl LoadoutBuilder {
|
|||||||
|
|
||||||
/// Builds loadout of creature when spawned
|
/// Builds loadout of creature when spawned
|
||||||
pub fn build_loadout(body: Body, alignment: Alignment, mut main_tool: Option<Item>) -> Self {
|
pub fn build_loadout(body: Body, alignment: Alignment, mut main_tool: Option<Item>) -> Self {
|
||||||
|
#![allow(clippy::single_match)] // For when this is done to more than just golems.
|
||||||
match body {
|
match body {
|
||||||
Body::Golem(golem) => match golem.species {
|
Body::Golem(golem) => match golem.species {
|
||||||
golem::Species::StoneGolem => {
|
golem::Species::StoneGolem => {
|
||||||
|
@ -59,7 +59,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
let start_time = std::time::Instant::now();
|
let start_time = std::time::Instant::now();
|
||||||
span!(_guard, "run", "combat::Sys::run");
|
span!(_guard, "run", "combat::Sys::run");
|
||||||
let mut server_emitter = server_bus.emitter();
|
let mut server_emitter = server_bus.emitter();
|
||||||
let mut local_emitter = local_bus.emitter();
|
let mut _local_emitter = local_bus.emitter();
|
||||||
// Attacks
|
// Attacks
|
||||||
for (entity, uid, pos, ori, scale_maybe, attack) in (
|
for (entity, uid, pos, ori, scale_maybe, attack) in (
|
||||||
&entities,
|
&entities,
|
||||||
@ -152,8 +152,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if attack.knockback != 0.0 && damage.healthchange != 0.0 {
|
||||||
if attack.knockback != 0.0 {
|
|
||||||
server_emitter.emit(ServerEvent::Knockback {
|
server_emitter.emit(ServerEvent::Knockback {
|
||||||
entity: b,
|
entity: b,
|
||||||
force: attack.knockback
|
force: attack.knockback
|
||||||
|
@ -209,7 +209,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if shockwave.knockback != 0.0 {
|
if shockwave.knockback != 0.0 && damage.healthchange != 0.0 {
|
||||||
if shockwave.knockback < 0.0 {
|
if shockwave.knockback < 0.0 {
|
||||||
server_emitter.emit(ServerEvent::Knockback {
|
server_emitter.emit(ServerEvent::Knockback {
|
||||||
entity: b,
|
entity: b,
|
||||||
|
@ -79,6 +79,7 @@ pub fn handle_create_npc(
|
|||||||
entity.build();
|
entity.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn handle_shoot(
|
pub fn handle_shoot(
|
||||||
server: &mut Server,
|
server: &mut Server,
|
||||||
entity: EcsEntity,
|
entity: EcsEntity,
|
||||||
|
Loading…
Reference in New Issue
Block a user