Convert damage modifiers to integer percentages.

This commit is contained in:
Paul Chote
2014-08-09 21:27:37 +12:00
parent c5519a7f3b
commit 0425416ce2
11 changed files with 59 additions and 27 deletions

View File

@@ -138,5 +138,15 @@ namespace OpenRA.Traits
var cells = target.Positions.Select(p => w.Map.CellContaining(p)).Distinct();
return ExpandFootprint(cells, true);
}
public static int ApplyPercentageModifiers(int number, IEnumerable<int> percentages)
{
// See the comments of PR#6079 for a faster algorithm if this becomes a performance bottleneck
var a = (decimal)number;
foreach (var p in percentages)
a *= p / 100m;
return (int)a;
}
}
}