Convert damage modifiers to integer percentages.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user