From 978de649034ff3c6ce4ba6e28f7c2a585429f8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 21 Aug 2021 20:05:26 +0200 Subject: [PATCH] Don't count suicides into the game score. --- .../Traits/Player/PlayerStatistics.cs | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs index b3482cf464..5e40985434 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs @@ -212,6 +212,24 @@ namespace OpenRA.Mods.Common.Traits if (self.Owner.WinState != WinState.Undefined) return; + if (includedInArmyValue) + { + playerStats.ArmyValue -= cost; + includedInArmyValue = false; + playerStats.Units[actorName].Count--; + } + + if (includedInAssetsValue) + { + playerStats.AssetsValue -= cost; + includedInAssetsValue = false; + } + + playerStats.DeathsCost += cost; + + if (e.Attacker == self) + return; + var attackerStats = e.Attacker.Owner.PlayerActor.Trait(); if (self.Info.HasTraitInfo()) { @@ -225,19 +243,6 @@ namespace OpenRA.Mods.Common.Traits } attackerStats.KillsCost += cost; - playerStats.DeathsCost += cost; - if (includedInArmyValue) - { - playerStats.ArmyValue -= cost; - includedInArmyValue = false; - playerStats.Units[actorName].Count--; - } - - if (includedInAssetsValue) - { - playerStats.AssetsValue -= cost; - includedInAssetsValue = false; - } } void INotifyCreated.Created(Actor self)