Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- #define SHINY 1;
- typedef unsigned long long u64;
- typedef unsigned int u32;
- typedef unsigned short u16;
- typedef unsigned char u8;
- u32 seed = 0;
- u32 ARNG(u32 seed);
- u32 getNature(u32 seed);
- bool isShiny(u32 seed, u32 tid, u32 sid);
- int main()
- {
- u32 nature = 0;
- u32 temp_nature = 0;
- u32 counter = 0;
- u32 seed_counter = 0;
- u32 tid = 0;
- u32 sid = 0;
- scanf_s("%x", &seed);
- scanf_s("%u", &nature);
- scanf_s("%u", &tid);
- scanf_s("%u", &sid);
- while(counter < 4)
- {
- if(isShiny(seed, tid, sid))
- {
- printf("first seed was shiny.");
- break;
- }
- seed = ARNG(seed);
- seed_counter++;
- temp_nature = getNature(seed);
- if(nature == temp_nature)
- {
- counter++;
- if(isShiny(seed, tid, sid))
- {
- printf("%u was shiny.", counter);
- break;
- }
- }
- }
- printf("%u", seed_counter);
- while(1){}
- return 0;
- }
- u32 ARNG(u32 seed)
- {
- seed = (seed * 0x6C078965) + 1;
- return seed;
- }
- u32 getNature(u32 seed)
- {
- return (seed % 25);
- }
- bool isShiny(u32 seed, u32 tid, u32 sid)
- {
- u16 hseed = seed >> 16;
- u16 lseed = seed & 0xFFFF;
- u16 xid = tid ^ sid;
- u16 xseed = hseed ^ lseed;
- u16 xshiny = xid ^ xseed;
- if(xshiny < 8)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
Advertisement