Remove defenderStats look-up from UpdatePlayerStatistics
playerStats is updated on owner change, so it should always be identical to the removed defenderStats.
This commit is contained in:
@@ -235,23 +235,22 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var attackerStats = e.Attacker.Owner.PlayerActor.Trait<PlayerStatistics>();
|
var attackerStats = e.Attacker.Owner.PlayerActor.Trait<PlayerStatistics>();
|
||||||
var defenderStats = self.Owner.PlayerActor.Trait<PlayerStatistics>();
|
|
||||||
if (self.Info.HasTraitInfo<BuildingInfo>())
|
if (self.Info.HasTraitInfo<BuildingInfo>())
|
||||||
{
|
{
|
||||||
attackerStats.BuildingsKilled++;
|
attackerStats.BuildingsKilled++;
|
||||||
defenderStats.BuildingsDead++;
|
playerStats.BuildingsDead++;
|
||||||
}
|
}
|
||||||
else if (self.Info.HasTraitInfo<IPositionableInfo>())
|
else if (self.Info.HasTraitInfo<IPositionableInfo>())
|
||||||
{
|
{
|
||||||
attackerStats.UnitsKilled++;
|
attackerStats.UnitsKilled++;
|
||||||
defenderStats.UnitsDead++;
|
playerStats.UnitsDead++;
|
||||||
}
|
}
|
||||||
|
|
||||||
attackerStats.KillsCost += cost;
|
attackerStats.KillsCost += cost;
|
||||||
defenderStats.DeathsCost += cost;
|
playerStats.DeathsCost += cost;
|
||||||
if (includedInArmyValue)
|
if (includedInArmyValue)
|
||||||
{
|
{
|
||||||
defenderStats.ArmyValue -= cost;
|
playerStats.ArmyValue -= cost;
|
||||||
includedInArmyValue = false;
|
includedInArmyValue = false;
|
||||||
playerStats.Units[actorName].Count--;
|
playerStats.Units[actorName].Count--;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user