avoid a division through zero
This commit is contained in:
@@ -52,7 +52,10 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
safeTiles++;
|
safeTiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (totalTiles > 0)
|
||||||
damageThreshold = (info.DamageThreshold * health.MaxHP + (100 - info.DamageThreshold) * safeTiles * health.MaxHP / totalTiles) / 100;
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user