mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Energy no longer regens when heal target is at full health.
This commit is contained in:
parent
07fd9ac023
commit
7e95a93434
@ -210,12 +210,15 @@ impl<'a> System<'a> for Sys {
|
||||
},
|
||||
});
|
||||
}
|
||||
if let Some(energy_mut) = beam
|
||||
.owner
|
||||
.and_then(|o| uid_allocator.retrieve_entity_internal(o.into()))
|
||||
.and_then(|o| energies.get_mut(o))
|
||||
{
|
||||
energy_mut.change_by(beam.energy_regen as i32, EnergySource::HitEnemy);
|
||||
if is_damage || stats_b.health.current() != stats_b.health.maximum() {
|
||||
if let Some(energy_mut) = beam
|
||||
.owner
|
||||
.and_then(|o| uid_allocator.retrieve_entity_internal(o.into()))
|
||||
.and_then(|o| energies.get_mut(o))
|
||||
{
|
||||
energy_mut
|
||||
.change_by(beam.energy_regen as i32, EnergySource::HitEnemy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,6 +239,7 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
/// Assumes upright cylinder
|
||||
/// See page 12 of https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.396.7952&rep=rep1&type=pdf
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn sphere_wedge_cylinder_collision(
|
||||
// Values for spherical wedge
|
||||
real_pos: Vec3<f32>,
|
||||
|
@ -148,17 +148,15 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
if damage.healthchange != 0.0 {
|
||||
if is_damage || stats_b.health.current() != stats_b.health.maximum() {
|
||||
let cause = if is_heal { HealthSource::Healing { by: Some(*uid) } } else { HealthSource::Attack { by: *uid } };
|
||||
server_emitter.emit(ServerEvent::Damage {
|
||||
uid: *uid_b,
|
||||
change: HealthChange {
|
||||
amount: damage.healthchange as i32,
|
||||
cause,
|
||||
},
|
||||
});
|
||||
attack.hit_count += 1;
|
||||
}
|
||||
let cause = if is_heal { HealthSource::Healing { by: Some(*uid) } } else { HealthSource::Attack { by: *uid } };
|
||||
server_emitter.emit(ServerEvent::Damage {
|
||||
uid: *uid_b,
|
||||
change: HealthChange {
|
||||
amount: damage.healthchange as i32,
|
||||
cause,
|
||||
},
|
||||
});
|
||||
attack.hit_count += 1;
|
||||
}
|
||||
if attack.knockback != 0.0 && damage.healthchange != 0.0 {
|
||||
let kb_dir = Dir::new((pos_b.0 - pos.0).try_normalized().unwrap_or(*ori.0));
|
||||
|
Loading…
Reference in New Issue
Block a user