Merge pull request #8325 from Mailaender/foundations-zero-tiles

Fixed a division through zero
This commit is contained in:
Oliver Brakmann
2015-06-14 23:04:09 +02:00

View File

@@ -52,7 +52,10 @@ namespace OpenRA.Mods.D2k.Traits
safeTiles++; safeTiles++;
} }
damageThreshold = (info.DamageThreshold * health.MaxHP + (100 - info.DamageThreshold) * safeTiles * health.MaxHP / totalTiles) / 100; if (totalTiles > 0)
damageThreshold = (info.DamageThreshold * health.MaxHP + (100 - info.DamageThreshold) * safeTiles * health.MaxHP / totalTiles) / 100;
else
damageThreshold = health.HP;
// Actors start with maximum damage applied // Actors start with maximum damage applied
var delta = health.HP - damageThreshold; var delta = health.HP - damageThreshold;