fix desync due to bad FP in Combat.DoImpact

This commit is contained in:
Chris Forbes
2010-04-30 19:42:02 +12:00
parent a22aa7ccb8
commit 36fc025a86
2 changed files with 33 additions and 10 deletions

View File

@@ -176,8 +176,10 @@ namespace OpenRA
var oldState = GetDamageState();
/* apply the damage modifiers, if we have any. */
damage = (int)traits.WithInterface<IDamageModifier>().Aggregate(
(float)damage, (a, t) => t.GetDamageModifier() * a);
var modifier = (float)traits.WithInterface<IDamageModifier>()
.Select(t => t.GetDamageModifier()).Product();
damage = (int)(damage * modifier);
Health -= damage;
if (Health <= 0)
@@ -194,8 +196,8 @@ namespace OpenRA
if (Health > maxHP) Health = maxHP;
Log.Write("InflictDamage: {0} #{1} -> {2} #{3} raw={4} adj={5} hp={6}",
attacker.Info.Name, attacker.ActorID, Info.Name, ActorID, rawDamage, damage, Health);
Log.Write("InflictDamage: {0} #{1} -> {2} #{3} raw={4} adj={5} hp={6} mod={7}",
attacker.Info.Name, attacker.ActorID, Info.Name, ActorID, rawDamage, damage, Health, modifier);
var newState = GetDamageState();