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;
|
||||
|
||||
// Critical damage applies after armor for melee
|
||||
self.healthchange += critdamage;
|
||||
if (damage_reduction - 1.0).abs() > f32::EPSILON {
|
||||
self.healthchange += critdamage;
|
||||
}
|
||||
|
||||
// Min damage
|
||||
if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 {
|
||||
@ -77,10 +79,11 @@ impl Damage {
|
||||
},
|
||||
DamageSource::Shockwave => {
|
||||
// Armor
|
||||
self.healthchange *= 1.0 - loadout.get_damage_reduction();
|
||||
let damage_reduction = loadout.get_damage_reduction();
|
||||
self.healthchange *= 1.0 - damage_reduction;
|
||||
|
||||
// Min damage
|
||||
if self.healthchange > -10.0 {
|
||||
if (damage_reduction - 1.0).abs() > f32::EPSILON && self.healthchange > -10.0 {
|
||||
self.healthchange = -10.0;
|
||||
}
|
||||
},
|
||||
|
@ -69,6 +69,7 @@ impl LoadoutBuilder {
|
||||
|
||||
/// Builds loadout of creature when spawned
|
||||
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 {
|
||||
Body::Golem(golem) => match golem.species {
|
||||
golem::Species::StoneGolem => {
|
||||
|
@ -59,7 +59,7 @@ impl<'a> System<'a> for Sys {
|
||||
let start_time = std::time::Instant::now();
|
||||
span!(_guard, "run", "combat::Sys::run");
|
||||
let mut server_emitter = server_bus.emitter();
|
||||
let mut local_emitter = local_bus.emitter();
|
||||
let mut _local_emitter = local_bus.emitter();
|
||||
// Attacks
|
||||
for (entity, uid, pos, ori, scale_maybe, attack) in (
|
||||
&entities,
|
||||
@ -152,8 +152,7 @@ impl<'a> System<'a> for Sys {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if attack.knockback != 0.0 {
|
||||
if attack.knockback != 0.0 && damage.healthchange != 0.0 {
|
||||
server_emitter.emit(ServerEvent::Knockback {
|
||||
entity: b,
|
||||
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 {
|
||||
server_emitter.emit(ServerEvent::Knockback {
|
||||
entity: b,
|
||||
|
@ -79,6 +79,7 @@ pub fn handle_create_npc(
|
||||
entity.build();
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn handle_shoot(
|
||||
server: &mut Server,
|
||||
entity: EcsEntity,
|
||||
|
Loading…
Reference in New Issue
Block a user