Advertisement
Madotsuki

Trainer Trap

Sep 6th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.39 KB | None | 0 0
  1.  
  2.  
  3. Script started on Thu 06 Sep 2012 05:30:56 PM PDT
  4. % cat TrainerEXP.c
  5. /*  *   *   *   *
  6.  
  7. *   The Trainer Trap    *
  8.      Starrodkirby86
  9. * Helps calculate the EXP given *
  10.    by trainers & wild PKMN.
  11. *   v.0.5, 9/6/2012     *
  12.  
  13. *   *   *   *   */
  14.  
  15. #include <stdio.h> /* printf, scanf functions */
  16. #include <math.h> /* Math library. */
  17. #include <string.h> /* String functions. */
  18.  
  19. int
  20. main()
  21. {
  22.      double owner, /* 1 if wild, 1.5 if trainer's */
  23.            ot, /* 1 if ot, 1.5 if traded, 1.7 if international */
  24.          base_exp, /* Base EXP of PKMN, Lookup manually */
  25.             lucky, /* 1.5 if Lucky Egg, 1 if not */
  26.         level, /* Level of the fainted Pokemon */
  27.      participants; /* Number of Pokemon participating */
  28.  
  29.     int final_exp; /* Final EXP number */
  30.  
  31.     int name_rand; /* Name randomization. */
  32.  
  33.      char trainer[128],  /* Trainer name */
  34.           pokemon[16];  /* Pokemon name */
  35.  
  36. /* Ask for data */
  37. printf("What's this Pokemon's name?\n");
  38. scanf("%s", pokemon);
  39. printf("Enter 1 if %s is wild. Enter 1.5 if %s is owned by a Trainer.\n",pokemon,pokemon);
  40. scanf("%lf", &owner);
  41. printf("What's %s's level?\n",pokemon);
  42. scanf("%lf", &level);
  43. printf("What's %s's base EXP?\n",pokemon);
  44. scanf("%lf", &base_exp);
  45. printf("Enter 1 if your Pokemon is your own. 1.5 if traded, 1.7 if internationally traded.\n");
  46. scanf("%lf", &ot);
  47. printf("Type in 1.5 if your Pokemon is holding a Lucky Egg. Otherwise, type 1.\n");
  48. scanf("%lf", &lucky);
  49. printf("How many Pokemon participated in the battle?\n");
  50. scanf("%lf", &participants);
  51.  
  52. /* Calculations. */
  53. final_exp = ( owner * ot * base_exp * lucky * level ) / ( 7 * participants );
  54.  
  55.  
  56. if(owner == 1.5)
  57.     {
  58.         name_rand = rand(0,5);
  59.     if(rand == 0)
  60.         {strcpy(trainer, "Youngster Joey");}
  61.     else if (rand == 1)
  62.         {strcpy(trainer, "Gym Leader Brock");}
  63.     else if (rand == 2)
  64.         {strcpy(trainer, "Rival Gary");}
  65.     else if (rand == 3)
  66.         {strcpy(trainer, "Team Rocket Grunt");}
  67.     else if (rand == 4)
  68.         {strcpy(trainer, "Bug Catcher Sammy");}
  69.     else if (rand == 5)
  70.         {strcpy(trainer, "Heartbreaker Charles");}
  71.     else
  72.         {strcpy(trainer, "PKMN Trainer Cal");}
  73.     }
  74.  
  75. if(owner == 1.5)
  76.     {
  77.         printf("%s's %s gives %d EXP.\n",trainer,pokemon,final_exp);
  78.     }
  79. else
  80.     {
  81.         printf("The wild %s gives %d EXP.\n",pokemon,final_exp);
  82.     }
  83.  
  84. /* Results.
  85. printf("%s gives %d EXP.\n",pokemon,final_exp);*/
  86.  
  87. return(0);
  88.  
  89. }
  90. % exit
  91. % exit
  92.  
  93. Script done on Thu 06 Sep 2012 05:31:06 PM PDT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement