-
-
Save ScottLilly/946defd4ddc9f4759f2fcc467d9ad38c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void UpdatePlayerExpAndLevel(int gainedExp) | |
{ | |
double newNeededExp = this.ExperiencePoints; | |
double newMaximumHitpoints = this.MaximumHitPoints; | |
double multiplier; | |
this.ExperiencePoints += gainedExp; | |
if (this.ExperiencePoints >= this.NeededExperiencePoints) | |
{ | |
this.Level += 1; | |
if (this.Level <= 3) | |
{ | |
multiplier = 1.35; | |
} | |
else if (this.Level <= 6) | |
{ | |
multiplier = 1.25; | |
} | |
else | |
{ | |
multiplier = 1.15; | |
} | |
this.ExperiencePoints -= this.NeededExperiencePoints; | |
newNeededExp *= 1.15; | |
this.NeededExperiencePoints = (int)newNeededExp; | |
newMaximumHitpoints *= multiplier; | |
this.MaximumHitPoints = (int)newMaximumHitpoints; | |
this.CurrentHitPoints = this.MaximumHitPoints; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment