int ExperienceCalculator()
{
// Variables that store the experience for next level
constint NextExperienceUp2 = 100;
constint NextExperienceUp3 = 225;
constint NextExperienceUp4 = 400;
constint NextExperienceUp5 = 925;
constint NextExperienceUp6 = 1400;
constint NextExperienceUp7 = 2425;
constint NextExperienceUp8 = 3650;
constint NextExperienceUp9 = 5675;
constint NextExperienceUp10 = 8150;
// Variables that store the total exp at next level
constint NextExperience2 = 100;
constint NextExperience3 = 325;
constint NextExperience4 = 725;
constint NextExperience5 = 1650;
constint NextExperience6 = 3025;
constint NextExperience7 = 5475;
constint NextExperience8 = 7900;
constint NextExperience9 = 11550;
constint NextExperience10 = 19700;
// Variables that store new hit points value for next level (Base 20 + 5 per level)
constint PlayerHitPointsUp = 5;
// Variable that store new attack value for next level (Base 12 + 2 per level)
constint PlayerAttackUp = 2;
// Variable that store new defense value for next level (Base 6 + 3 per level)
constint PlayerDefenseUp = 3;
// Variable that stores new hitrate value for next level (Base 50% + 1% per level)
constint PlayerHitRateUp = 1;
cout << "Checking players level & experience stats.\n";
while (PlayerExperience >= PlayerNextExperience)
{
if (PlayerExperience >= PlayerNextExperience)
{
cout << "Leveling up player.\n";
++PlayerLevel;
PlayerHitPoints = PlayerHitPoints + PlayerHitPointsUp;
PlayerAttack = PlayerAttack + PlayerAttackUp;
PlayerDefense = PlayerDefense + PlayerDefenseUp;
PlayerHitRate = PlayerHitRate + PlayerHitRateUp;
cout << "Done leveling up player.\n";
cout << "Updating experience to next level.\n";
}
else
{
cout << "Player does not need to be leveled up.\n";
cout << "Returning to game...\n";
goto ENDEXP;
}
}
ENDEXP:
return 0;
}