Raagentreg

[Lua] TCG2 Lua

Jul 8th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.75 KB | None | 0 0
  1. --[[
  2.  
  3. Hotkeys:
  4. R: Toggle running the display
  5. D: Print your deck to the console
  6. S: Print their deck to the console if you really want??
  7.  
  8. C: Cheat your deck to have Comp Search/PP/Sneak (good for having no basics in hand)
  9. B: Cheat your deck to have all Bulbasaurs (good for having basics in hand)
  10. (These are also toggles, press it again to get your old deck back)
  11.  
  12. A: Toggle auto-advance text (good for intro)
  13.  
  14. TAStudio open only:
  15. Q/W/E: Enter your file from the Press Start screen early, easy, or 1 frame late
  16.  
  17. ]]
  18.  
  19. local nome = {"Grass_Energy","Fire_Energy","Water_Energy",
  20. "Lightning_Energy","Fighting_Energy","Psychic_Energy","Double_Colorless_Energy",
  21. "Potion_Energy","Full_Heal_Energy","Rainbow_Energy","Recycle_Energy",
  22. "Bulbasaur_LV12","Bulbasaur_LV13","Bulbasaur_LV15",
  23. "Ivysaur_LV20","Ivysaur_LV26","Dark_Ivysaur","Venusaur_LV64(CP!)","Venusaur_LV67",
  24. "Venusaur_LV67","Dark_Venusaur",
  25. "Caterpie_LV13","Metapod_LV20","Metapod_LV21","Butterfree_LV28",
  26. "Weedle_LV12","Weedle_LV15","Kakuna_LV20","Kakuna_LV23",
  27. "Beedrill_LV32","Ekans_LV10","Ekans_LV15","Arbok_LV27","Arbok_LV30","Dark_Arbok",
  28. "NidoranF_LV12","NidoranF_LV13","Nidorina_LV22","Nidorina_LV24",
  29. "Nidoqueen_LV43","NidoranM_LV20","NidoranM_LV22","Nidorino_LV23","Nidorino_LV25",
  30. "Nidoking_LV48","Zubat_LV9","Zubat_LV10","Zubat_LV12",
  31. "Golbat_LV25","Golbat_LV29","Dark_Golbat","Oddish_LV8","Oddish_LV21",
  32. "Gloom_LV22","Dark_Gloom","Vileplume_LV35","Dark_Vileplume","Paras_LV8",
  33. "Paras_LV15","Parasect_LV28","Parasect_LV29","Venonat_LV12","Venonat_LV15",
  34. "Venomoth_LV22","Venomoth_LV28","Bellsprout_LV10","Bellsprout_LV11",
  35. "Weepinbell_LV23","Weepinbell_LV28","Victreebel_LV42","Grimer_LV10","Grimer_LV17",
  36. "Muk_LV34","Dark_Muk","Exeggcute_LV14","Exeggutor_LV35",
  37. "Koffing_LV12","Koffing_LV13","Koffing_LV14","Weezing_LV26","Weezing_LV27",
  38. "Dark_Weezing","Tangela_LV8_(GB)","Tangela_LV12","Scyther_LV23","Scyther_LV25",
  39. "Pinsir_LV15","Pinsir_LV24","Charmander_LV9","Charmander_LV10","Charmander_LV12",
  40. "Charmeleon_LV32","Dark_Charmeleon","Charizard_LV76","Charizard_LV76","Dark_Charizard",
  41. "Vulpix_LV11","Vulpix_LV13","Ninetales_LV32","Ninetales_LV35_(GB)","Dark_Ninetales",
  42. "Growlithe_LV12","Growlithe_LV16","Growlithe_LV18","Arcanine_LV34_(Promo)",
  43. "Arcanine_LV35","Arcanine_LV45","Ponyta_LV8","Ponyta_LV10","Ponyta_LV15",
  44. "Rapidash_LV30","Rapidash_LV33","Dark_Rapidash","Magmar_LV18","Magmar_LV24",
  45. "Magmar_LV27","Magmar_LV31_(Fossil)",
  46. "Flareon_LV22_(GB)","Flareon_LV28_(Jungle)","Dark_Flareon","Moltres_LV35",
  47. "Moltres_LV37","Legendary_Moltres_LV40","Squirtle_LV8","Squirtle_LV14",
  48. "Squirtle_LV15","Squirtle_LV16","Wartortle_LV22","Wartortle_LV24",
  49. "Dark_Wartortle","Blastoise_LV52","Blastoise_LV52","Dark_Blastoise",
  50. "Psyduck_LV15","Psyduck_LV16","Golduck_LV27","Golduck_LV28","Dark_Golduck",
  51. "Poliwag_LV13","Poliwag_LV15","Poliwhirl_LV28","Poliwhirl_LV30","Poliwrath_LV40",
  52. "Poliwrath_LV48","Tentacool_LV10","Tentacruel_LV21",
  53. "Seel_LV10","Seel_LV12","Dewgong_LV24","Dewgong_LV42","Shellder_LV8","Shellder_LV16",
  54. "Cloyster_LV25","Krabby_LV17","Krabby_LV20","Kingler_LV27","Kingler_LV33",
  55. "Horsea_LV19","Horsea_LV20","Seadra_LV23","Seadra_LV26",
  56. "Goldeen_LV12","Seaking_LV28","Staryu_LV15","Staryu_LV17","Starmie_LV28","Dark_Starmie",
  57. "Magikarp_LV6","Magikarp_LV8","Magikarp_LV10",
  58. "Gyarados_LV41","Dark_Gyarados","Lapras_LV24","Lapras_LV31",
  59. "Vaporeon_LV29_(GB)","Vaporeon_LV42_(Jungle)","Dark_Vaporeon",
  60. "Omanyte_LV19","Omanyte_LV20","Omanyte_LV22","Omastar_LV32","Omastar_LV36",
  61. "Articuno_LV34","Articuno_LV35","Legendary_Articuno_LV37","Marill",
  62. "Pikachu_LV5","Pikachu_LV12","Pikachu_LV13","Pikachu_LV14_(Jungle)","Pikachu_LV16_(promo)",
  63. "Pikachu_LV16_(promo2)","Flying_Pikachu_LV12","Flying_Pikachu_LV12","Surfing_Pikachu_LV13",
  64. "Surfing_Pikachu_LV13","Raichu_LV32","Raichu_LV33","Raichu_LV40",
  65. "Raichu_LV45_(Fossil)","Dark_Raichu","Magnemite_LV12","Magnemite_LV13","Magnemite_LV14",
  66. "Magnemite_LV15_(GB)","Magneton_LV28","Magneton_LV30","Magneton_LV35_(Fossil)",
  67. "Dark_Magneton","Voltorb_LV8","Voltorb_LV10","Voltorb_LV13",
  68. "Electrode_LV35_(GB)","Electrode_LV42_(Jungle)","Dark_Electrode","Electabuzz_LV20_(Promo)",
  69. "Electabuzz_LV30","Electabuzz_LV35","Jolteon_LV24_(GB)","Jolteon_LV29","Dark_Jolteon",
  70. "Zapdos_LV28","Zapdos_LV40","Zapdos_LV64_(Fossil)","Legendary_Zapdos_LV68",
  71. "Sandshrew_LV12","Sandshrew_LV15","Sandslash_LV33","Sandslash_LV35",
  72. "Diglett_LV8","Diglett_LV15","Diglett_LV16","Dugtrio_LV36","Dugtrio_LV40","Dark_Dugtrio",
  73. "Mankey_LV7","Mankey_LV7","Mankey_LV14","Primeape_LV35","Dark_Primeape","Machop_LV18",
  74. "Machop_LV20","Machop_LV24","Machoke_LV24","Machoke_LV28","Machoke_LV40","Dark_Machoke",
  75. "Machamp_LV54","Machamp_LV67","Dark_Machamp","Geodude_LV15","Geodude_LV16",
  76. "Graveler_LV27","Graveler_LV28","Graveler_LV29","Golem_LV36","Golem_LV37",
  77. "Onix_LV12","Onix_LV25","Cubone_LV13","Cubone_LV14",
  78. "Marowak_LV26_(Jungle)","Marowak_LV32_(GB)","Dark_Marowak",
  79. "Hitmonlee_LV23","Hitmonlee_LV30","Hitmonchan_LV23","Hitmonchan_LV33",
  80. "Rhyhorn_LV18","Rhydon_LV37","Rhydon_LV48","Kabuto_LV9","Kabuto_LV22",
  81. "Kabutops_LV30","Aerodactlyl_LV28","Aerodactlyl_LV30",
  82. "Abra_LV8","Abra_LV10","Abra_LV14","Kadabra_LV38","Kadabra_LV39","Dark_Kadabra",
  83. "Alakazam_LV42","Alakazam_LV45","Dark_Alakazam",
  84. "Slowpoke_LV9_(Promo)","Slowpoke_LV16","Slowpoke_LV18_(Fossil)","Slowbro_LV26",
  85. "Slowbro_LV35","Dark_Slowbro","Gastly_LV8","Gastly_LV13","Gastly_LV17_(Fossil)",
  86. "Haunter_LV17_(Fossil)","Haunter_LV22","Haunter_LV25","Haunter_LV26","Dark_Haunter",
  87. "Gengar_LV38","Gengar_LV40","Dark_Gengar",
  88. "Drowzee_LV10","Drowzee_LV12","Hypno_LV30","Hypno_LV36","Dark_Hypno",
  89. "Mr.Mime_LV20","Mr.Mime_LV28","Jynx_LV18","Jynx_LV23","Jynx_LV27","Mewtwo_LV30","Mewtwo_LV53",
  90. "Mewtwo_LV54","Mewtwo_LV60_(Promo)","Mewtwo_LV60_(Promo_2)","Mewtwo_LV67",
  91. "GRs_Mewtwo","Mew_LV8_(Promo)","Mew_LV15_(CP!_Promo)","Mew_LV23",
  92. "Pidgey_LV8","Pidgey_LV10","Pidgeotto_LV36","Pidgeotto_LV38",
  93. "Pidgeot_LV38_(GB)","Pidgeot_LV40_(Jungle)","Rattata_LV9","Rattata_LV12","Rattata_LV15",
  94. "Raticate_LV41","Dark_Raticate","Spearow_LV9","Spearow_LV12",
  95. "Spearow_LV13","Fearow_LV24","Fearow_LV27","Dark_Fearow","Clefairy_LV14","Clefairy_LV15",
  96. "Clefable_LV34","Dark_Clefable",
  97. "Jigglypuff_LV12_(Promo)","Jigglypuff_LV13_(GB)","Jigglypuff_LV14_(Jungle)",
  98. "Wigglytuff_LV36","Wigglytuff_LV40","Meowth_LV10","Meowth_LV13",
  99. "Meowth_LV14_(GB)","Meowth_LV15_(Jungle)","Meowth_LV17","Persian_LV25","Dark_Persian",
  100. "Dark_Persian","Farfetch'd_LV20","Farfetch'd_LV20","Doduo_LV8",
  101. "Doduo_LV10","Dodrio_LV25","Dodrio_LV28","Lickitung_LV20","Lickitung_LV26",
  102. "Chansey_LV40","Chansey_LV55","Kangaskhan_LV36","Kangaskhan_LV38",
  103. "Kangaskhan_LV40","Tauros_LV32","Tauros_LV35","Ditto_LV19","Eevee_LV5","Eevee_LV9",
  104. "Eevee_LV12","Porygon_LV12","Porygon_LV18","Porygon_LV20","Cool_Porygon",
  105. "Snorlax_LV20","Snorlax_LV35","Hungry_Snorlax","Dratini_LV10",
  106. "Dratini_LV12","Dragonair_LV33","Dark_Dragonair","Legendary_Dragonite_LV41",
  107. "Dragonite_LV43","Dragonite_LV45","Dark_Dragonite","Togepi","Lugia",
  108. "Super_Potion","Imakuni?","Energy_Removal","Energy_Retrieval","Energy_Search",
  109. "Professor_Oak","Fossil_Excavation","Potion","Gambler","Revive","Max_Revive",
  110. "Super_Scoop_Up","Devolution_Spray","Item_Finder","Challenge!","Super_Energy_Retrieval",
  111. "Super_Energy_Removal","Moon_Stone","Defender","Gust_of_Wind","Mysterious_Fossil","Full_Heal",
  112. "Impostor_Oak's_Revenge","Impostor_Professor_Oak","Sleep!","Computer_Error!",
  113. "Computer_Search","Digger","Clefairy_Doll","Mr_Fuji","PlusPower","Switch","Scoop_Up",
  114. "Pokemon_Trader","Pokemon_Recall","Pokedex","Pokemon_Center","Pokemon_Breeder","Pokeflute",
  115. "The_Boss's_Way","Goop_Gas_Attack","Bill","Bill's_Teleporter","Bill's_Computer",
  116. "Master_Ball","Lass","Maintenance","Pokeball","Nightly_Garbage_Run","Recycle",
  117. "Rocket's_Sneak_Attack","Here_Comes_Team_Rocket!","The_Rocket's_Trap"}
  118.  
  119. --163 Computer Search
  120. --167 PP
  121. --189, 1 for rocket's trap
  122.  
  123. --C400 to C43B: IDs of deck
  124.  
  125.  
  126.  
  127. memory.usememorydomain("System Bus")
  128.  
  129. local DeckLocBegin=0xC300
  130. local MyDeckLocBegin=0xC200
  131. local DeckIDBegin=0xC480
  132. local MyDeckIDBegin=0xC400
  133. local ShuffledDeckBegin=0xC37E
  134. local MyShuffledDeckBegin=0xC27E
  135. local TopCard=0xC3BA
  136. local MyTopCard=0xC2BA
  137. --C23C: My prizes in order
  138. --C242: My hand in order
  139. --C33C: Their prizes (irrelevant)
  140. --C342: Their hand in order
  141.  
  142. --C2C8: My pokemon's health
  143.  
  144. local myDeckCards = {}
  145. local oppHand = {}
  146. local cheated = false
  147. local RNG1 = memory.readbyte(0xCAC8)
  148. local RNG2 = memory.readbyte(0xCAC9)
  149. local RNG3 = memory.readbyte(0xCACA)
  150. local initRNG1 = RNG1
  151. local initRNG2 = RNG2
  152. local initRNG3 = RNG3
  153.  
  154. --Keyboard states last frame and this frame
  155. prevks = input.get()
  156. curks = input.get()
  157.  
  158. --Should we display everything?
  159. rundisplay = true
  160. --Should we alternate A/B presses to auto-advance text?
  161. runtextskip = false
  162. lastInputWasA = true
  163.  
  164. function cheat(bulba)
  165. if (cheated == false) then
  166. cheated = true
  167. for i=0,59 do
  168. myDeckCards[i] = memory.read_s16_le(MyDeckIDBegin+(i*2))
  169. end
  170. for i=0,59 do
  171. local loc = MyDeckIDBegin + (i*2)
  172. if (bulba) then
  173. --if (i > 5) then
  174. memory.writebyte(loc,12)
  175. --else
  176. --memory.writebyte(loc,1)
  177. --end
  178. memory.writebyte(loc+1,0)
  179. else
  180. if (i > 40) then
  181. memory.writebyte(loc,187)
  182. elseif (i > 19) then
  183. memory.writebyte(loc,167)
  184. else
  185. memory.writebyte(loc,163)
  186. end
  187. memory.writebyte(loc+1,1)
  188. end
  189. end
  190. else
  191. cheated = false
  192. for i=0,59 do
  193. local loc = MyDeckIDBegin + (i*2)
  194. memory.write_s16_le(loc,myDeckCards[i])
  195. end
  196. end
  197. end
  198.  
  199. function advanceRNG()
  200. --Recreation of the code that advances RNG
  201. local temp = RNG2
  202. temp = bit.rol(temp,2)
  203. if (bit.check(temp,8)) then temp = bit.set(temp,0) end
  204. temp = bit.clear(temp,8)
  205. if (bit.check(temp,9)) then temp = bit.set(temp,1) end
  206. temp = bit.clear(temp,9)
  207. temp = bit.bxor(temp,RNG1)
  208. local carry = bit.check(temp,0)
  209.  
  210. RNG2 = bit.bxor(RNG2,RNG1)
  211.  
  212. temp = RNG3
  213. temp = bit.bxor(temp,RNG1)
  214. RNG1 = temp
  215.  
  216. RNG1 = bit.rol(RNG1,1)
  217. if (carry) then RNG1 = bit.set(RNG1,0) end
  218. carry = bit.check(RNG1,8)
  219. RNG1 = bit.clear(RNG1,8)
  220.  
  221. RNG2 = bit.rol(RNG2,1)
  222. if (carry) then RNG2 = bit.set(RNG2,0) end
  223. RNG2 = bit.clear(RNG2,8)
  224.  
  225. RNG3 = RNG3 + 1
  226. if (RNG3 == 256) then RNG3 = 0 end
  227.  
  228. return (bit.bxor(RNG2,RNG1))
  229. end
  230.  
  231. function randomSlot(size)
  232. --Get a random deck slot 0-59
  233. --This is done by multiplying the RNG value by 60, and taking the left 8 bits
  234. local rng = advanceRNG()
  235. local temp = rng * size
  236. for i=0,7 do
  237. if (bit.check(temp,i+8)) then temp = bit.set(temp,i) else temp = bit.clear(temp,i) end
  238. temp = bit.clear(temp,i+8)
  239. end
  240. return temp
  241. end
  242.  
  243. function shuffleOppHand(size)
  244. --Do 60 location swaps
  245.  
  246. oppHand = {}
  247. for i=0,size-1 do
  248. oppHand[i] = memory.readbyte(0xC342+i)
  249. end
  250. for curLoc=0,size-1 do
  251. local newLoc = randomSlot(size)
  252. local temp = oppHand[curLoc]
  253. oppHand[curLoc] = oppHand[newLoc]
  254. oppHand[newLoc] = temp
  255. end
  256. end
  257.  
  258. function startFile(delay)
  259. joypad.set({A=1})
  260. for i=0,31 do
  261. emu.frameadvance()
  262. end
  263. --print(delay)
  264. if (delay == 0) then
  265. for i=0,10 do
  266. emu.frameadvance()
  267. if (emu.islagged()) then
  268. tastudio.setplayback(emu.framecount()-2)
  269. joypad.set({A=1})
  270. break
  271. end
  272. end
  273. elseif (delay > 0) then
  274. for i=0,10 do
  275. emu.frameadvance()
  276. if (emu.islagged()) then
  277. for i=0,10 do
  278. emu.frameadvance()
  279. if (not emu.islagged()) then
  280. if (delay == 1) then tastudio.setplayback(emu.framecount()-1) end
  281. joypad.set({A=1})
  282. break
  283. end
  284. end
  285. break
  286. end
  287. end
  288. end
  289. end
  290.  
  291. while true do
  292. RNG1 = memory.readbyte(0xCAC8)
  293. RNG2 = memory.readbyte(0xCAC9)
  294. RNG3 = memory.readbyte(0xCACA)
  295. initRNG1 = RNG1
  296. initRNG2 = RNG2
  297. initRNG3 = RNG3
  298.  
  299. curks = input.get()
  300. --Write the [D]eck to a text file
  301. if (curks["D"] and not prevks["D"]) then
  302. file = io.open("deck.txt","w")
  303. local startSpot = MyDeckIDBegin
  304. for i=0,59 do
  305. print(tostring(i+1) .. ": " .. nome[memory.read_s16_le(startSpot+(i*2))])
  306. file:write(tostring(i+1) .. ": " .. nome[memory.read_s16_le(startSpot+(i*2))] .. "\r\n")
  307. end
  308. file:flush()
  309. file:close()
  310. end
  311. --[S]py on their deck? I dunno
  312. if (curks["S"] and not prevks["S"]) then
  313. file = io.open("deck.txt","w")
  314. local startSpot = DeckIDBegin
  315. for i=0,59 do
  316. print(tostring(i+1) .. ": " .. nome[memory.read_s16_le(startSpot+(i*2))])
  317. file:write(tostring(i+1) .. ": " .. nome[memory.read_s16_le(startSpot+(i*2))] .. "\r\n")
  318. end
  319. file:flush()
  320. file:close()
  321. end
  322.  
  323.  
  324.  
  325. --[R]un
  326. if (curks["R"] and not prevks["R"]) then
  327. rundisplay = not rundisplay
  328. end
  329. --[A]dvance text
  330. if (curks["A"] and not prevks["A"]) then
  331. runtextskip = not runtextskip
  332. end
  333. --[C]heat
  334. if (curks["C"] and not prevks["C"]) then
  335. cheat(false)
  336. end
  337. --[B]asics
  338. if (curks["B"] and not prevks["B"]) then
  339. cheat(true)
  340. end
  341.  
  342. if (curks["Q"] and not prevks["Q"]) then
  343. startFile(0)
  344. end
  345. if (curks["W"] and not prevks["W"]) then
  346. startFile(1)
  347. end
  348. if (curks["E"] and not prevks["E"]) then
  349. startFile(2)
  350. end
  351.  
  352. local myHandEnd = 0
  353. local handEnd = 0
  354. local prize = 0
  355. --gui.text(1,1,nome[208])
  356. if (rundisplay) then
  357. local prizesPlaced = false
  358.  
  359. for i=0,59 do
  360. --Display both hands
  361. if memory.readbyte(MyDeckLocBegin+i)==8 then prizesPlaced = true end
  362. if memory.readbyte(DeckLocBegin+i)==1 then
  363. if (nome[memory.read_s16_le(DeckIDBegin+(i*2))] ~= nil) then
  364. gui.text(241,1+12*handEnd,tostring(i+1) .. ": " .. nome[memory.read_s16_le(DeckIDBegin+(i*2))])
  365. end
  366. handEnd=handEnd+1
  367. end
  368. if memory.readbyte(MyDeckLocBegin+i)==1 then
  369. local position = 0
  370. for j=0,58 do
  371. if (memory.readbyte(0xC242+j)==i) then position = j+1 break end
  372. end
  373. if (nome[memory.read_s16_le(MyDeckIDBegin+(i*2))] ~= nil) then
  374. gui.text(1,21+12*myHandEnd,tostring(i+1) .. ": " .. nome[memory.read_s16_le(MyDeckIDBegin+(i*2))] .. "(" .. position .. ")")
  375. end
  376. myHandEnd=myHandEnd+1
  377. end
  378.  
  379. end
  380. local startSpot = memory.readbyte(TopCard)
  381. local myStartSpot = memory.readbyte(MyTopCard)
  382. --if (!prizesPlaced) maxCards = 9
  383. if (prizesPlaced == false) then
  384. local numPrizes = memory.readbyte(0xCC00)
  385. startSpot = startSpot + numPrizes
  386. myStartSpot = myStartSpot + numPrizes
  387. for i=0,numPrizes-1 do
  388.  
  389. end
  390. end
  391. for i=0,2 do
  392. --Display upcoming draws
  393. local draws = memory.readbyte(ShuffledDeckBegin + startSpot + i)
  394. if (myHandEnd > 0 and nome[memory.read_s16_le(DeckIDBegin+(draws*2))] ~= nil) then
  395. gui.text(261,6+12*handEnd,tostring(draws+1) .. ": " .. nome[memory.read_s16_le(DeckIDBegin+(draws*2))])
  396. handEnd=handEnd+1
  397. end
  398.  
  399. local draws = memory.readbyte(MyShuffledDeckBegin + myStartSpot + i)
  400. if (myHandEnd > 0 and nome[memory.read_s16_le(MyDeckIDBegin+(draws*2))] ~= nil) then
  401. gui.text(21,26+12*myHandEnd,tostring(draws+1) .. ": " .. nome[memory.read_s16_le(MyDeckIDBegin+(draws*2))])
  402. myHandEnd=myHandEnd+1
  403. end
  404.  
  405.  
  406. end
  407. for i=0,59 do
  408. --Display our prizes
  409. --C23C: My prizes in order
  410. if memory.readbyte(MyDeckLocBegin+i)==8 then
  411. local position = 0
  412. for j=0,5 do
  413. if (memory.readbyte(0xC23C+j)==i) then position = j+1 break end
  414. end
  415. if (nome[memory.read_s16_le(MyDeckIDBegin+(i*2))] ~= nil) then
  416. gui.text(41,31+12*myHandEnd,tostring(i+1) .. ": " .. nome[memory.read_s16_le(MyDeckIDBegin+(i*2))] .. "(" .. position .. ")")
  417. end
  418. myHandEnd=myHandEnd+1
  419. end
  420. end
  421.  
  422.  
  423. local ShuffledDeckBegin=0xC37E
  424. local MyShuffledDeckBegin=0xC27E
  425. local TopCard=0xC3BA
  426. local MyTopCard=0xC2BA
  427.  
  428. --Check upcoming flips, and Rocket's Trap results?
  429. gui.text(1,263,RNG1)
  430. gui.text(61,263,RNG2)
  431. gui.text(121,263,RNG3)
  432. gui.text(26,251,memory.read_u32_le(0xCAC8))
  433.  
  434.  
  435. local checkRocket = false
  436. for i=0,2 do
  437. advanceRNG()
  438. local flipRNG = bit.check(bit.bxor(RNG2,RNG1),7)
  439. if (flipRNG == true) then
  440. gui.text(1+i*60,275,"Tails")
  441. else
  442. gui.text(1+i*60,275,"Heads")
  443. if i == 0 then checkRocket = true end
  444. end
  445. end
  446. --[[ Tried to predict Rocket's Trap card grabs; This isn't how it works
  447. if (checkRocket) then
  448. RNG1 = initRNG1
  449. RNG2 = initRNG2
  450. RNG3 = initRNG3
  451. advanceRNG() --the heads coin
  452. local handSize = memory.readbyte(0xC3F4)
  453. shuffleOppHand(handSize)
  454. for i=handSize-1,handSize-3,-1 do
  455. if (i >= 0) then
  456. gui.text(200,275-(handSize-i-1)*12,((oppHand[i] + 1) .. ": " .. nome[memory.read_s16_le(DeckIDBegin+(oppHand[i]*2))]))
  457. end
  458. end
  459. --Hand shuffle
  460. --C3F4 = number of cards in opponent's hand
  461.  
  462. end]]
  463.  
  464. end
  465. if (runtextskip) then
  466. if (emu.islagged()) then
  467. lastInputWasA = not lastInputWasA
  468. end
  469. if (lastInputWasA) then
  470. joypad.set({B=1})
  471. lastInputWasA = false
  472. else
  473. joypad.set({A=1})
  474. lastInputWasA = true
  475. end
  476. end
  477. prevks = curks
  478. emu.frameadvance()
  479. end
Add Comment
Please, Sign In to add comment