Skip to content

Commit

Permalink
Prevent units from gaining more experience than MaxLevel requires
Browse files Browse the repository at this point in the history
  • Loading branch information
abcdefg30 committed Sep 23, 2018
1 parent 7d59602 commit 57f3b7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/GainsExperience.cs
Expand Up @@ -88,7 +88,7 @@ public void GiveExperience(int amount, bool silent = false)
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)
{
Expand Down

0 comments on commit 57f3b7a

Please sign in to comment.