Count shield damage only for accepted hits and skip kills saved by a totem
This commit is contained in:
@@ -74,11 +74,14 @@ impl Game<'_> {
|
||||
for e in events {
|
||||
let (name, amount) = match e {
|
||||
// LivingEntity.getDamageAfterMagicAbsorb (Resistance) and
|
||||
// Player.actuallyHurt (absorption hearts), in tenths.
|
||||
// Player.actuallyHurt (absorption hearts) and
|
||||
// LivingEntity.hurtServer (the shield, only for an accepted
|
||||
// hit), in tenths.
|
||||
MotionEvent::Health(HealthEvent::Statistic { name, amount }) => {
|
||||
match *name {
|
||||
"resisted" => self.stats.custom("damage_resisted", *amount),
|
||||
"absorbed" => self.stats.custom("damage_absorbed", *amount),
|
||||
"blocked" => self.stats.custom("damage_blocked_by_shield", *amount),
|
||||
_ => {}
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -256,10 +256,12 @@ impl Game<'_> {
|
||||
// ServerPlayer.awardKillScore: the blow that kills a player.
|
||||
if hurt {
|
||||
let died = match victim {
|
||||
// A totem that fired is applied on the next tick_totem, so the
|
||||
// host is still at zero health but is not dying.
|
||||
Victim::Host => self
|
||||
.player
|
||||
.as_ref()
|
||||
.is_some_and(|p| p.health.dead_or_dying()),
|
||||
.is_some_and(|p| p.health.dead_or_dying() && !p.health.totem_used),
|
||||
Victim::Guest(conn) => host
|
||||
.hub
|
||||
.guest(conn)
|
||||
|
||||
@@ -121,13 +121,6 @@ impl Game<'_> {
|
||||
attacker: Option<u32>,
|
||||
projectile: bool,
|
||||
) {
|
||||
// LivingEntity.hurtServer: the damage the shield took, in tenths.
|
||||
if outcome.blocked > 0.0 {
|
||||
self.stats.custom(
|
||||
"damage_blocked_by_shield",
|
||||
(outcome.blocked * 10.0).round() as i32,
|
||||
);
|
||||
}
|
||||
let Some((slot, _)) = self.using else { return };
|
||||
let Some(stack) = self.stack_in(slot).cloned() else {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user