All pastes #266265 Raw Edit

Something

public text v1 · immutable
·published 2006-12-03 23:22 UTC
rendered paste body
nt level(int *lvl, int *exp, int *hp, int *maxhp, int *str) { //life would be no fun without levels
    /* The way this function works is rather simple.  You need 1+current level
    total experience to reach the next one. */
    
    if (*exp > *lvl) {  //do they have enough EXP?
       (*lvl)++; (*exp) = 0; // increase their level, then reset their experience
       system("cls"); // clear the screen for the triumphant levelup screen
       printf("**************************CONGRATULATIONS!***********************\n");
       printf("You have reached level %i! You need %i experience to level again!\n\n\n",*lvl,(*lvl + 1));
       *maxhp = *maxhp + randint(5,20); // increase hp
       //next little tidbit makes it so that strength gets boosted every other level
       if (*lvl % 2 == 0) {
          *str = *str + 1;
          }
          
       *hp = *maxhp;// give a hard-earned ratio boost
       
    }
    else { //too bad they didn't level
        int i = (*lvl + 1) - (*exp);
        printf("You still need %i exp to level\n",i);
        }
}