Mandrew

WEC 1.5

Mar 8th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.13 KB | None | 0 0
  1. /**
  2.  Wurmple Evolution Calculator
  3.  
  4.  Wurmple uses a unique method of evolution which involves performing bitwise
  5.  and modulo operations on the Pokémon's PID value. The widely-held theory on the
  6.  calculation used by the game was
  7.  
  8.     (PID & 0xFFFF % 10 <= 4) ? Silcoon : Cascoon
  9.  
  10.  but this turned out to be incorrect thanks to Pokécheck administrator Bond697's
  11.  work on the subject, who turned up the equation
  12.  
  13.     (PID >> 0x10 % 10 <= 4) ? Silcoon : Cascoon
  14.  
  15.  Several test cases with 5th generation Wurmples have lent credence to the new
  16.  equation, which this program implements in a friendly command interface. As of
  17.  11 May 2012, this program remains untested for Wurmple evolution in any games
  18.  prior to Black and White.
  19. */
  20.  
  21. #include <iostream>
  22. #include <stdint.h>
  23. using namespace std;
  24.  
  25. class EvolutionFlag {
  26. private:
  27.     unsigned char EvolutionTest;
  28.     string SilcoonOrCascoon;
  29.  
  30. public:
  31.     EvolutionFlag(uint32_t PID)
  32.     {
  33.         unsigned char EvolutionTest = (PID >> 0x10) % 0xA;
  34.         if (EvolutionTest <= 4)
  35.             SilcoonOrCascoon = "Silcoon";
  36.         else
  37.             SilcoonOrCascoon = "Cascoon";
  38.     }
  39.  
  40.     string GetEvo() {
  41.         return SilcoonOrCascoon;
  42.     }
  43. };
  44.  
  45.  
  46. int main()
  47. {
  48.     cout << "Wurmple Evolution Calculator \n";
  49.     cout << "ver. 1.5 by M.andrew 2013 \n";
  50.     cout << "Discovery of mechanism: Bond697 \n\n";
  51.  
  52.     unsigned int PIDFormat;
  53.     while (1) {
  54.         do {
  55.             PIDFormat == 0;
  56.             cout << "Which PID format?\n";
  57.             cout << "\t0 for hex\n\t1 for decimal\n\tCtrl-C at any time quits the program\n\n";
  58.             cout << "Eh? ";
  59.             while (cin >> PIDFormat)
  60.             {
  61.                 if (PIDFormat > 1)
  62.                 {
  63.                     cout << "\n***ERROR!***\nYou have entered a value besides 0 or 1.\n";
  64.                     continue;
  65.                 }
  66.             }
  67.         } while ((PIDFormat != 0) && (PIDFormat != 1));
  68.  
  69.         uint32_t WurmplePID;
  70.         switch (PIDFormat)
  71.         {
  72.             case 0:
  73.                 cout << "Specify PID of Wurmple (hex): ";
  74.                 cin >> hex >> WurmplePID;
  75.                 break;
  76.             case 1:
  77.                 cout << "Specify PID of Wurmple (dec): ";
  78.                 cin >> WurmplePID;
  79.                 break;
  80.         }
  81.  
  82.         EvolutionFlag NewEvo(WurmplePID);
  83.         cout << "\n\nFor a PID of 0x" << hex << WurmplePID <<
  84.         ", your Wurmple will evolve into " + NewEvo.GetEvo() + "!\n\n";
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment