Prevent units from gaining more experience than MaxLevel requires

This commit is contained in:
abcdefg30
2018-09-23 21:37:46 +02:00
committed by Paul Chote
parent a86f41cd5c
commit 4298584af2

View File

@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Traits
if (amount < 0)
throw new ArgumentException("Revoking experience is not implemented.", "amount");
experience += amount;
experience = (experience + amount).Clamp(0, nextLevel[MaxLevel - 1].First);
while (Level < MaxLevel && experience >= nextLevel[Level].First)
{