pokemon_app.c 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207
  1. #include <furi_hal_light.h>
  2. #include <math.h>
  3. #include <pokemon_icons.h>
  4. #include "scenes/pokemon_menu.h"
  5. #include "views/trade.h"
  6. #include "views/select_pokemon.h"
  7. #include "pokemon_app.h"
  8. #include "pokemon_char_encode.h"
  9. const PokemonTable pokemon_table[] = {
  10. /* Values for base_*, moves, etc., pulled directly from a copy of Pokemon Blue */
  11. {"Bulbasaur",
  12. &I_bulbasaur,
  13. 0x99,
  14. 0x2D,
  15. 0x31,
  16. 0x31,
  17. 0x2D,
  18. 0x41,
  19. {0x16, 0x03},
  20. {0x21, 0x2D, 0x00, 0x00},
  21. GROWTH_MEDIUM_SLOW},
  22. {"Ivysaur",
  23. &I_ivysaur,
  24. 0x09,
  25. 0x3C,
  26. 0x3E,
  27. 0x3F,
  28. 0x3C,
  29. 0x50,
  30. {0x16, 0x03},
  31. {0x21, 0x2D, 0x49, 0x00},
  32. GROWTH_MEDIUM_SLOW},
  33. {"Venusaur",
  34. &I_venusaur,
  35. 0x9A,
  36. 0x50,
  37. 0x52,
  38. 0x53,
  39. 0x50,
  40. 0x64,
  41. {0x16, 0x03},
  42. {0x21, 0x2D, 0x49, 0x16},
  43. GROWTH_MEDIUM_SLOW},
  44. {"Charmander",
  45. &I_charmander,
  46. 0xB0,
  47. 0x27,
  48. 0x34,
  49. 0x2B,
  50. 0x41,
  51. 0x32,
  52. {0x14, 0x14},
  53. {0x0A, 0x2D, 0x00, 0x00},
  54. GROWTH_MEDIUM_SLOW},
  55. {"Charmeleon",
  56. &I_charmeleon,
  57. 0xB2,
  58. 0x3A,
  59. 0x40,
  60. 0x3A,
  61. 0x50,
  62. 0x41,
  63. {0x14, 0x14},
  64. {0x0A, 0x2D, 0x34, 0x00},
  65. GROWTH_MEDIUM_SLOW},
  66. {"Charizard",
  67. &I_charizard,
  68. 0xB4,
  69. 0x4E,
  70. 0x54,
  71. 0x4E,
  72. 0x64,
  73. 0x55,
  74. {0x14, 0x02},
  75. {0x0A, 0x2D, 0x34, 0x2B},
  76. GROWTH_MEDIUM_SLOW},
  77. {"Squirtle",
  78. &I_squirtle,
  79. 0xB1,
  80. 0x2C,
  81. 0x30,
  82. 0x41,
  83. 0x2B,
  84. 0x32,
  85. {0x15, 0x15},
  86. {0x21, 0x27, 0x00, 0x00},
  87. GROWTH_MEDIUM_SLOW},
  88. {"Wartortle",
  89. &I_wartortle,
  90. 0xB3,
  91. 0x3B,
  92. 0x3F,
  93. 0x50,
  94. 0x3A,
  95. 0x41,
  96. {0x15, 0x15},
  97. {0x21, 0x27, 0x91, 0x00},
  98. GROWTH_MEDIUM_SLOW},
  99. {"Blastoise",
  100. &I_blastoise,
  101. 0x1C,
  102. 0x4F,
  103. 0x53,
  104. 0x64,
  105. 0x4E,
  106. 0x55,
  107. {0x15, 0x15},
  108. {0x21, 0x27, 0x91, 0x37},
  109. GROWTH_MEDIUM_SLOW},
  110. {"Caterpie",
  111. &I_caterpie,
  112. 0x7B,
  113. 0x2D,
  114. 0x1E,
  115. 0x23,
  116. 0x2D,
  117. 0x14,
  118. {0x07, 0x07},
  119. {0x21, 0x51, 0x00, 0x00},
  120. GROWTH_MEDIUM_FAST},
  121. {"Metapod",
  122. &I_metapod,
  123. 0x7C,
  124. 0x32,
  125. 0x14,
  126. 0x37,
  127. 0x1E,
  128. 0x19,
  129. {0x07, 0x07},
  130. {0x6A, 0x00, 0x00, 0x00},
  131. GROWTH_MEDIUM_FAST},
  132. {"Butterfree",
  133. &I_butterfree,
  134. 0x7D,
  135. 0x3C,
  136. 0x2D,
  137. 0x32,
  138. 0x46,
  139. 0x50,
  140. {0x07, 0x02},
  141. {0x5D, 0x00, 0x00, 0x00},
  142. GROWTH_MEDIUM_FAST},
  143. {"Weedle",
  144. &I_weedle,
  145. 0x70,
  146. 0x28,
  147. 0x23,
  148. 0x1E,
  149. 0x32,
  150. 0x14,
  151. {0x07, 0x03},
  152. {0x28, 0x51, 0x00, 0x00},
  153. GROWTH_MEDIUM_FAST},
  154. {"Kakuna",
  155. &I_kakuna,
  156. 0x71,
  157. 0x2D,
  158. 0x19,
  159. 0x32,
  160. 0x23,
  161. 0x19,
  162. {0x07, 0x03},
  163. {0x6A, 0x00, 0x00, 0x00},
  164. GROWTH_MEDIUM_FAST},
  165. {"Beedrill",
  166. &I_beedrill,
  167. 0x72,
  168. 0x41,
  169. 0x50,
  170. 0x28,
  171. 0x4B,
  172. 0x2D,
  173. {0x07, 0x03},
  174. {0x1F, 0x00, 0x00, 0x00},
  175. GROWTH_MEDIUM_FAST},
  176. {"Pidgey",
  177. &I_pidgey,
  178. 0x24,
  179. 0x28,
  180. 0x2D,
  181. 0x28,
  182. 0x38,
  183. 0x23,
  184. {0x00, 0x02},
  185. {0x10, 0x00, 0x00, 0x00},
  186. GROWTH_MEDIUM_SLOW},
  187. {"Pidgeotto",
  188. &I_pidgeotto,
  189. 0x96,
  190. 0x3F,
  191. 0x3C,
  192. 0x37,
  193. 0x47,
  194. 0x32,
  195. {0x00, 0x02},
  196. {0x10, 0x1C, 0x00, 0x00},
  197. GROWTH_MEDIUM_SLOW},
  198. {"Pidgeot",
  199. &I_pidgeot,
  200. 0x97,
  201. 0x53,
  202. 0x50,
  203. 0x4B,
  204. 0x5B,
  205. 0x46,
  206. {0x00, 0x02},
  207. {0x10, 0x1C, 0x62, 0x00},
  208. GROWTH_MEDIUM_SLOW},
  209. {"Rattata",
  210. &I_rattata,
  211. 0xA5,
  212. 0x1E,
  213. 0x38,
  214. 0x23,
  215. 0x48,
  216. 0x19,
  217. {0x00, 0x00},
  218. {0x21, 0x27, 0x00, 0x00},
  219. GROWTH_MEDIUM_FAST},
  220. {"Raticate",
  221. &I_raticate,
  222. 0xA6,
  223. 0x37,
  224. 0x51,
  225. 0x3C,
  226. 0x61,
  227. 0x32,
  228. {0x00, 0x00},
  229. {0x21, 0x27, 0x62, 0x00},
  230. GROWTH_MEDIUM_FAST},
  231. {"Spearow",
  232. &I_spearow,
  233. 0x05,
  234. 0x28,
  235. 0x3C,
  236. 0x1E,
  237. 0x46,
  238. 0x1F,
  239. {0x00, 0x02},
  240. {0x40, 0x2D, 0x00, 0x00},
  241. GROWTH_MEDIUM_FAST},
  242. {"Fearow",
  243. &I_fearow,
  244. 0x23,
  245. 0x41,
  246. 0x5A,
  247. 0x41,
  248. 0x64,
  249. 0x3D,
  250. {0x00, 0x02},
  251. {0x40, 0x2D, 0x2B, 0x00},
  252. GROWTH_MEDIUM_FAST},
  253. {"Ekans",
  254. &I_ekans,
  255. 0x6C,
  256. 0x23,
  257. 0x3C,
  258. 0x2C,
  259. 0x37,
  260. 0x28,
  261. {0x03, 0x03},
  262. {0x23, 0x2B, 0x00, 0x00},
  263. GROWTH_MEDIUM_FAST},
  264. {"Arbok",
  265. &I_arbok,
  266. 0x2D,
  267. 0x3C,
  268. 0x55,
  269. 0x45,
  270. 0x50,
  271. 0x41,
  272. {0x03, 0x03},
  273. {0x23, 0x2B, 0x28, 0x00},
  274. GROWTH_MEDIUM_FAST},
  275. {"Pikachu",
  276. &I_pikachu,
  277. 0x54,
  278. 0x23,
  279. 0x37,
  280. 0x1E,
  281. 0x5A,
  282. 0x32,
  283. {0x17, 0x17},
  284. {0x54, 0x2D, 0x00, 0x00},
  285. GROWTH_MEDIUM_FAST},
  286. {"Raichu",
  287. &I_raichu,
  288. 0x55,
  289. 0x3C,
  290. 0x5A,
  291. 0x37,
  292. 0x64,
  293. 0x5A,
  294. {0x17, 0x17},
  295. {0x54, 0x2D, 0x56, 0x00},
  296. GROWTH_MEDIUM_FAST},
  297. {"Sandshrew",
  298. &I_sandshrew,
  299. 0x60,
  300. 0x32,
  301. 0x4B,
  302. 0x55,
  303. 0x28,
  304. 0x1E,
  305. {0x04, 0x04},
  306. {0x0A, 0x00, 0x00, 0x00},
  307. GROWTH_MEDIUM_FAST},
  308. {"Sandslash",
  309. &I_sandslash,
  310. 0x61,
  311. 0x4B,
  312. 0x64,
  313. 0x6E,
  314. 0x41,
  315. 0x37,
  316. {0x04, 0x04},
  317. {0x0A, 0x1C, 0x00, 0x00},
  318. GROWTH_MEDIUM_FAST},
  319. {"Nidoran\200",
  320. &I_nidoranf,
  321. 0x0F,
  322. 0x37,
  323. 0x2F,
  324. 0x34,
  325. 0x29,
  326. 0x28,
  327. {0x03, 0x03},
  328. {0x2D, 0x21, 0x00, 0x00},
  329. GROWTH_MEDIUM_SLOW},
  330. {"Nidorina",
  331. &I_nidorina,
  332. 0xA8,
  333. 0x46,
  334. 0x3E,
  335. 0x43,
  336. 0x38,
  337. 0x37,
  338. {0x03, 0x03},
  339. {0x2D, 0x21, 0x0A, 0x00},
  340. GROWTH_MEDIUM_SLOW},
  341. {"Nidoqueen",
  342. &I_nidoqueen,
  343. 0x10,
  344. 0x5A,
  345. 0x52,
  346. 0x57,
  347. 0x4C,
  348. 0x4B,
  349. {0x03, 0x04},
  350. {0x21, 0x0A, 0x27, 0x22},
  351. GROWTH_MEDIUM_SLOW},
  352. {"Nidoran\201",
  353. &I_nidoranm,
  354. 0x03,
  355. 0x2E,
  356. 0x39,
  357. 0x28,
  358. 0x32,
  359. 0x28,
  360. {0x03, 0x03},
  361. {0x2B, 0x21, 0x00, 0x00},
  362. GROWTH_MEDIUM_SLOW},
  363. {"Nidorino",
  364. &I_nidorino,
  365. 0xA7,
  366. 0x3D,
  367. 0x48,
  368. 0x39,
  369. 0x41,
  370. 0x37,
  371. {0x03, 0x03},
  372. {0x2B, 0x21, 0x1E, 0x00},
  373. GROWTH_MEDIUM_SLOW},
  374. {"Nidoking",
  375. &I_nidoking,
  376. 0x07,
  377. 0x51,
  378. 0x5C,
  379. 0x4D,
  380. 0x55,
  381. 0x4B,
  382. {0x03, 0x04},
  383. {0x21, 0x1E, 0x28, 0x25},
  384. GROWTH_MEDIUM_SLOW},
  385. {"Clefairy",
  386. &I_clefairy,
  387. 0x04,
  388. 0x46,
  389. 0x2D,
  390. 0x30,
  391. 0x23,
  392. 0x3C,
  393. {0x00, 0x00},
  394. {0x01, 0x2D, 0x00, 0x00},
  395. GROWTH_FAST},
  396. {"Clefable",
  397. &I_clefable,
  398. 0x8E,
  399. 0x5F,
  400. 0x46,
  401. 0x49,
  402. 0x3C,
  403. 0x55,
  404. {0x00, 0x00},
  405. {0x2F, 0x03, 0x6B, 0x76},
  406. GROWTH_FAST},
  407. {"Vulpix",
  408. &I_vulpix,
  409. 0x52,
  410. 0x26,
  411. 0x29,
  412. 0x28,
  413. 0x41,
  414. 0x41,
  415. {0x14, 0x14},
  416. {0x34, 0x27, 0x00, 0x00},
  417. GROWTH_MEDIUM_FAST},
  418. {"Ninetales",
  419. &I_ninetales,
  420. 0x53,
  421. 0x49,
  422. 0x4C,
  423. 0x4B,
  424. 0x64,
  425. 0x64,
  426. {0x14, 0x14},
  427. {0x34, 0x27, 0x62, 0x2E},
  428. GROWTH_MEDIUM_FAST},
  429. {"Jigglypuff",
  430. &I_jigglypuff,
  431. 0x64,
  432. 0x73,
  433. 0x2D,
  434. 0x14,
  435. 0x14,
  436. 0x19,
  437. {0x00, 0x00},
  438. {0x2F, 0x00, 0x00, 0x00},
  439. GROWTH_FAST},
  440. {"Wigglytuff",
  441. &I_wigglytuff,
  442. 0x65,
  443. 0x8C,
  444. 0x46,
  445. 0x2D,
  446. 0x2D,
  447. 0x32,
  448. {0x00, 0x00},
  449. {0x2F, 0x32, 0x6F, 0x03},
  450. GROWTH_FAST},
  451. {"Zubat",
  452. &I_zubat,
  453. 0x6B,
  454. 0x28,
  455. 0x2D,
  456. 0x23,
  457. 0x37,
  458. 0x28,
  459. {0x03, 0x02},
  460. {0x8D, 0x00, 0x00, 0x00},
  461. GROWTH_MEDIUM_FAST},
  462. {"Golbat",
  463. &I_golbat,
  464. 0x82,
  465. 0x4B,
  466. 0x50,
  467. 0x46,
  468. 0x5A,
  469. 0x4B,
  470. {0x03, 0x02},
  471. {0x8D, 0x67, 0x2C, 0x00},
  472. GROWTH_MEDIUM_FAST},
  473. {"Oddish",
  474. &I_oddish,
  475. 0xB9,
  476. 0x2D,
  477. 0x32,
  478. 0x37,
  479. 0x1E,
  480. 0x4B,
  481. {0x16, 0x03},
  482. {0x47, 0x00, 0x00, 0x00},
  483. GROWTH_MEDIUM_SLOW},
  484. {"Gloom",
  485. &I_gloom,
  486. 0xBA,
  487. 0x3C,
  488. 0x41,
  489. 0x46,
  490. 0x28,
  491. 0x55,
  492. {0x16, 0x03},
  493. {0x47, 0x4D, 0x4E, 0x00},
  494. GROWTH_MEDIUM_SLOW},
  495. {"Vileplume",
  496. &I_vileplume,
  497. 0xBB,
  498. 0x4B,
  499. 0x50,
  500. 0x55,
  501. 0x32,
  502. 0x64,
  503. {0x16, 0x03},
  504. {0x4E, 0x4F, 0x33, 0x50},
  505. GROWTH_MEDIUM_SLOW},
  506. {"Paras",
  507. &I_paras,
  508. 0x6D,
  509. 0x23,
  510. 0x46,
  511. 0x37,
  512. 0x19,
  513. 0x37,
  514. {0x07, 0x16},
  515. {0x0A, 0x00, 0x00, 0x00},
  516. GROWTH_MEDIUM_FAST},
  517. {"Parasect",
  518. &I_parasect,
  519. 0x2E,
  520. 0x3C,
  521. 0x5F,
  522. 0x50,
  523. 0x1E,
  524. 0x50,
  525. {0x07, 0x16},
  526. {0x0A, 0x4E, 0x8D, 0x00},
  527. GROWTH_MEDIUM_FAST},
  528. {"Venonat",
  529. &I_venonat,
  530. 0x41,
  531. 0x3C,
  532. 0x37,
  533. 0x32,
  534. 0x2D,
  535. 0x28,
  536. {0x07, 0x03},
  537. {0x21, 0x32, 0x00, 0x00},
  538. GROWTH_MEDIUM_FAST},
  539. {"Venomoth",
  540. &I_venomoth,
  541. 0x77,
  542. 0x46,
  543. 0x41,
  544. 0x3C,
  545. 0x5A,
  546. 0x5A,
  547. {0x07, 0x03},
  548. {0x21, 0x32, 0x4D, 0x8D},
  549. GROWTH_MEDIUM_FAST},
  550. {"Diglett",
  551. &I_diglett,
  552. 0x3B,
  553. 0x0A,
  554. 0x37,
  555. 0x19,
  556. 0x5F,
  557. 0x2D,
  558. {0x04, 0x04},
  559. {0x0A, 0x00, 0x00, 0x00},
  560. GROWTH_MEDIUM_FAST},
  561. {"Dugtrio",
  562. &I_dugtrio,
  563. 0x76,
  564. 0x23,
  565. 0x50,
  566. 0x32,
  567. 0x78,
  568. 0x46,
  569. {0x04, 0x04},
  570. {0x0A, 0x2D, 0x5B, 0x00},
  571. GROWTH_MEDIUM_FAST},
  572. {"Meowth",
  573. &I_meowth,
  574. 0x4D,
  575. 0x28,
  576. 0x2D,
  577. 0x23,
  578. 0x5A,
  579. 0x28,
  580. {0x00, 0x00},
  581. {0x0A, 0x2D, 0x00, 0x00},
  582. GROWTH_MEDIUM_FAST},
  583. {"Persian",
  584. &I_persian,
  585. 0x90,
  586. 0x41,
  587. 0x46,
  588. 0x3C,
  589. 0x73,
  590. 0x41,
  591. {0x00, 0x00},
  592. {0x0A, 0x2D, 0x2C, 0x67},
  593. GROWTH_MEDIUM_FAST},
  594. {"Psyduck",
  595. &I_psyduck,
  596. 0x2F,
  597. 0x32,
  598. 0x34,
  599. 0x30,
  600. 0x37,
  601. 0x32,
  602. {0x15, 0x15},
  603. {0x0A, 0x00, 0x00, 0x00},
  604. GROWTH_MEDIUM_FAST},
  605. {"Golduck",
  606. &I_golduck,
  607. 0x80,
  608. 0x50,
  609. 0x52,
  610. 0x4E,
  611. 0x55,
  612. 0x50,
  613. {0x15, 0x15},
  614. {0x0A, 0x27, 0x32, 0x00},
  615. GROWTH_MEDIUM_FAST},
  616. {"Mankey",
  617. &I_mankey,
  618. 0x39,
  619. 0x28,
  620. 0x50,
  621. 0x23,
  622. 0x46,
  623. 0x23,
  624. {0x01, 0x01},
  625. {0x0A, 0x2B, 0x00, 0x00},
  626. GROWTH_MEDIUM_FAST},
  627. {"Primeape",
  628. &I_primeape,
  629. 0x75,
  630. 0x41,
  631. 0x69,
  632. 0x3C,
  633. 0x5F,
  634. 0x3C,
  635. {0x01, 0x01},
  636. {0x0A, 0x2B, 0x02, 0x9A},
  637. GROWTH_MEDIUM_FAST},
  638. {"Growlithe",
  639. &I_growlithe,
  640. 0x21,
  641. 0x37,
  642. 0x46,
  643. 0x2D,
  644. 0x3C,
  645. 0x32,
  646. {0x14, 0x14},
  647. {0x2C, 0x2E, 0x00, 0x00},
  648. GROWTH_SLOW},
  649. {"Arcanine",
  650. &I_arcanine,
  651. 0x14,
  652. 0x5A,
  653. 0x6E,
  654. 0x50,
  655. 0x5F,
  656. 0x50,
  657. {0x14, 0x14},
  658. {0x2E, 0x34, 0x2B, 0x24},
  659. GROWTH_SLOW},
  660. {"Poliwag",
  661. &I_poliwag,
  662. 0x47,
  663. 0x28,
  664. 0x32,
  665. 0x28,
  666. 0x5A,
  667. 0x28,
  668. {0x15, 0x15},
  669. {0x91, 0x00, 0x00, 0x00},
  670. GROWTH_MEDIUM_SLOW},
  671. {"Poliwhirl",
  672. &I_poliwhirl,
  673. 0x6E,
  674. 0x41,
  675. 0x41,
  676. 0x41,
  677. 0x5A,
  678. 0x32,
  679. {0x15, 0x15},
  680. {0x91, 0x5F, 0x37, 0x00},
  681. GROWTH_MEDIUM_SLOW},
  682. {"Poliwrath",
  683. &I_poliwrath,
  684. 0x6F,
  685. 0x5A,
  686. 0x55,
  687. 0x5F,
  688. 0x46,
  689. 0x46,
  690. {0x15, 0x01},
  691. {0x5F, 0x37, 0x03, 0x22},
  692. GROWTH_MEDIUM_SLOW},
  693. {"Abra",
  694. &I_abra,
  695. 0x94,
  696. 0x19,
  697. 0x14,
  698. 0x0F,
  699. 0x5A,
  700. 0x69,
  701. {0x18, 0x18},
  702. {0x64, 0x00, 0x00, 0x00},
  703. GROWTH_MEDIUM_SLOW},
  704. {"Kadabra",
  705. &I_kadabra,
  706. 0x26,
  707. 0x28,
  708. 0x23,
  709. 0x1E,
  710. 0x69,
  711. 0x78,
  712. {0x18, 0x18},
  713. {0x64, 0x5D, 0x32, 0x00},
  714. GROWTH_MEDIUM_SLOW},
  715. {"Alakazam",
  716. &I_alakazam,
  717. 0x95,
  718. 0x37,
  719. 0x32,
  720. 0x2D,
  721. 0x78,
  722. 0x87,
  723. {0x18, 0x18},
  724. {0x64, 0x5D, 0x32, 0x00},
  725. GROWTH_MEDIUM_SLOW},
  726. {"Machop",
  727. &I_machop,
  728. 0x6A,
  729. 0x46,
  730. 0x50,
  731. 0x32,
  732. 0x23,
  733. 0x23,
  734. {0x01, 0x01},
  735. {0x02, 0x00, 0x00, 0x00},
  736. GROWTH_MEDIUM_SLOW},
  737. {"Machoke",
  738. &I_machoke,
  739. 0x29,
  740. 0x50,
  741. 0x64,
  742. 0x46,
  743. 0x2D,
  744. 0x32,
  745. {0x01, 0x01},
  746. {0x02, 0x43, 0x2B, 0x00},
  747. GROWTH_MEDIUM_SLOW},
  748. {"Machamp",
  749. &I_machamp,
  750. 0x7E,
  751. 0x5A,
  752. 0x82,
  753. 0x50,
  754. 0x37,
  755. 0x41,
  756. {0x01, 0x01},
  757. {0x02, 0x43, 0x2B, 0x00},
  758. GROWTH_MEDIUM_SLOW},
  759. {"Bellsprout",
  760. &I_bellsprout,
  761. 0xBC,
  762. 0x32,
  763. 0x4B,
  764. 0x23,
  765. 0x28,
  766. 0x46,
  767. {0x16, 0x03},
  768. {0x16, 0x4A, 0x00, 0x00},
  769. GROWTH_MEDIUM_SLOW},
  770. {"Weepinbell",
  771. &I_weepinbell,
  772. 0xBD,
  773. 0x41,
  774. 0x5A,
  775. 0x32,
  776. 0x37,
  777. 0x55,
  778. {0x16, 0x03},
  779. {0x16, 0x4A, 0x23, 0x00},
  780. GROWTH_MEDIUM_SLOW},
  781. {"Victreebel",
  782. &I_victreebel,
  783. 0xBE,
  784. 0x50,
  785. 0x69,
  786. 0x41,
  787. 0x46,
  788. 0x64,
  789. {0x16, 0x03},
  790. {0x4F, 0x4E, 0x33, 0x4B},
  791. GROWTH_MEDIUM_SLOW},
  792. {"Tentacool",
  793. &I_tentacool,
  794. 0x18,
  795. 0x28,
  796. 0x28,
  797. 0x23,
  798. 0x46,
  799. 0x64,
  800. {0x15, 0x03},
  801. {0x33, 0x00, 0x00, 0x00},
  802. GROWTH_SLOW},
  803. {"Tentacruel",
  804. &I_tentacruel,
  805. 0x9B,
  806. 0x50,
  807. 0x46,
  808. 0x41,
  809. 0x64,
  810. 0x78,
  811. {0x15, 0x03},
  812. {0x33, 0x30, 0x23, 0x00},
  813. GROWTH_SLOW},
  814. {"Geodude",
  815. &I_geodude,
  816. 0xA9,
  817. 0x28,
  818. 0x50,
  819. 0x64,
  820. 0x14,
  821. 0x1E,
  822. {0x05, 0x04},
  823. {0x21, 0x00, 0x00, 0x00},
  824. GROWTH_MEDIUM_SLOW},
  825. {"Graveler",
  826. &I_graveler,
  827. 0x27,
  828. 0x37,
  829. 0x5F,
  830. 0x73,
  831. 0x23,
  832. 0x2D,
  833. {0x05, 0x04},
  834. {0x21, 0x6F, 0x00, 0x00},
  835. GROWTH_MEDIUM_SLOW},
  836. {"Golem",
  837. &I_golem,
  838. 0x31,
  839. 0x50,
  840. 0x6E,
  841. 0x82,
  842. 0x2D,
  843. 0x37,
  844. {0x05, 0x04},
  845. {0x21, 0x6F, 0x00, 0x00},
  846. GROWTH_MEDIUM_SLOW},
  847. {"Ponyta",
  848. &I_ponyta,
  849. 0xA3,
  850. 0x32,
  851. 0x55,
  852. 0x37,
  853. 0x5A,
  854. 0x41,
  855. {0x14, 0x14},
  856. {0x34, 0x00, 0x00, 0x00},
  857. GROWTH_MEDIUM_FAST},
  858. {"Rapidash",
  859. &I_rapidash,
  860. 0xA4,
  861. 0x41,
  862. 0x64,
  863. 0x46,
  864. 0x69,
  865. 0x50,
  866. {0x14, 0x14},
  867. {0x34, 0x27, 0x17, 0x2D},
  868. GROWTH_MEDIUM_FAST},
  869. {"Slowpoke",
  870. &I_slowpoke,
  871. 0x25,
  872. 0x5A,
  873. 0x41,
  874. 0x41,
  875. 0x0F,
  876. 0x28,
  877. {0x15, 0x18},
  878. {0x5D, 0x00, 0x00, 0x00},
  879. GROWTH_MEDIUM_FAST},
  880. {"Slowbro",
  881. &I_slowbro,
  882. 0x08,
  883. 0x5F,
  884. 0x4B,
  885. 0x6E,
  886. 0x1E,
  887. 0x50,
  888. {0x15, 0x18},
  889. {0x5D, 0x32, 0x1D, 0x00},
  890. GROWTH_MEDIUM_FAST},
  891. {"Magnemite",
  892. &I_magnemite,
  893. 0xAD,
  894. 0x19,
  895. 0x23,
  896. 0x46,
  897. 0x2D,
  898. 0x5F,
  899. {0x17, 0x17},
  900. {0x21, 0x00, 0x00, 0x00},
  901. GROWTH_MEDIUM_FAST},
  902. {"Magneton",
  903. &I_magneton,
  904. 0x36,
  905. 0x32,
  906. 0x3C,
  907. 0x5F,
  908. 0x46,
  909. 0x78,
  910. {0x17, 0x17},
  911. {0x21, 0x31, 0x54, 0x00},
  912. GROWTH_MEDIUM_FAST},
  913. {"Farfetch'd",
  914. &I_farfetchd,
  915. 0x40,
  916. 0x34,
  917. 0x41,
  918. 0x37,
  919. 0x3C,
  920. 0x3A,
  921. {0x00, 0x02},
  922. {0x40, 0x1C, 0x00, 0x00},
  923. GROWTH_MEDIUM_FAST},
  924. {"Doduo",
  925. &I_doduo,
  926. 0x46,
  927. 0x23,
  928. 0x55,
  929. 0x2D,
  930. 0x4B,
  931. 0x23,
  932. {0x00, 0x02},
  933. {0x40, 0x00, 0x00, 0x00},
  934. GROWTH_MEDIUM_FAST},
  935. {"Dodrio",
  936. &I_dodrio,
  937. 0x74,
  938. 0x3C,
  939. 0x6E,
  940. 0x46,
  941. 0x64,
  942. 0x3C,
  943. {0x00, 0x02},
  944. {0x40, 0x2D, 0x1F, 0x00},
  945. GROWTH_MEDIUM_FAST},
  946. {"Seel",
  947. &I_seel,
  948. 0x3A,
  949. 0x41,
  950. 0x2D,
  951. 0x37,
  952. 0x2D,
  953. 0x46,
  954. {0x15, 0x15},
  955. {0x1D, 0x00, 0x00, 0x00},
  956. GROWTH_MEDIUM_FAST},
  957. {"Dewgong",
  958. &I_dewgong,
  959. 0x78,
  960. 0x5A,
  961. 0x46,
  962. 0x50,
  963. 0x46,
  964. 0x5F,
  965. {0x15, 0x19},
  966. {0x1D, 0x2D, 0x3E, 0x00},
  967. GROWTH_MEDIUM_FAST},
  968. {"Grimer",
  969. &I_grimer,
  970. 0x0D,
  971. 0x50,
  972. 0x50,
  973. 0x32,
  974. 0x19,
  975. 0x28,
  976. {0x03, 0x03},
  977. {0x01, 0x32, 0x00, 0x00},
  978. GROWTH_MEDIUM_FAST},
  979. {"Muk",
  980. &I_muk,
  981. 0x88,
  982. 0x69,
  983. 0x69,
  984. 0x4B,
  985. 0x32,
  986. 0x41,
  987. {0x03, 0x03},
  988. {0x01, 0x32, 0x8B, 0x00},
  989. GROWTH_MEDIUM_FAST},
  990. {"Shellder",
  991. &I_shellder,
  992. 0x17,
  993. 0x1E,
  994. 0x41,
  995. 0x64,
  996. 0x28,
  997. 0x2D,
  998. {0x15, 0x15},
  999. {0x21, 0x6E, 0x00, 0x00},
  1000. GROWTH_SLOW},
  1001. {"Cloyster",
  1002. &I_cloyster,
  1003. 0x8B,
  1004. 0x32,
  1005. 0x5F,
  1006. 0xB4,
  1007. 0x46,
  1008. 0x55,
  1009. {0x15, 0x19},
  1010. {0x6E, 0x30, 0x80, 0x3E},
  1011. GROWTH_SLOW},
  1012. {"Gastly",
  1013. &I_gastly,
  1014. 0x19,
  1015. 0x1E,
  1016. 0x23,
  1017. 0x1E,
  1018. 0x50,
  1019. 0x64,
  1020. {0x08, 0x03},
  1021. {0x7A, 0x6D, 0x65, 0x00},
  1022. GROWTH_MEDIUM_SLOW},
  1023. {"Haunter",
  1024. &I_haunter,
  1025. 0x93,
  1026. 0x2D,
  1027. 0x32,
  1028. 0x2D,
  1029. 0x5F,
  1030. 0x73,
  1031. {0x08, 0x03},
  1032. {0x7A, 0x6D, 0x65, 0x00},
  1033. GROWTH_MEDIUM_SLOW},
  1034. {"Gengar",
  1035. &I_gengar,
  1036. 0x0E,
  1037. 0x3C,
  1038. 0x41,
  1039. 0x3C,
  1040. 0x6E,
  1041. 0x82,
  1042. {0x08, 0x03},
  1043. {0x7A, 0x6D, 0x65, 0x00},
  1044. GROWTH_MEDIUM_SLOW},
  1045. {"Onix",
  1046. &I_onix,
  1047. 0x22,
  1048. 0x23,
  1049. 0x2D,
  1050. 0xA0,
  1051. 0x46,
  1052. 0x1E,
  1053. {0x05, 0x04},
  1054. {0x21, 0x67, 0x00, 0x00},
  1055. GROWTH_MEDIUM_FAST},
  1056. {"Drowzee",
  1057. &I_drowzee,
  1058. 0x30,
  1059. 0x3C,
  1060. 0x30,
  1061. 0x2D,
  1062. 0x2A,
  1063. 0x5A,
  1064. {0x18, 0x18},
  1065. {0x01, 0x5F, 0x00, 0x00},
  1066. GROWTH_MEDIUM_FAST},
  1067. {"Hypno",
  1068. &I_hypno,
  1069. 0x81,
  1070. 0x55,
  1071. 0x49,
  1072. 0x46,
  1073. 0x43,
  1074. 0x73,
  1075. {0x18, 0x18},
  1076. {0x01, 0x5F, 0x32, 0x5D},
  1077. GROWTH_MEDIUM_FAST},
  1078. {"Krabby",
  1079. &I_krabby,
  1080. 0x4E,
  1081. 0x1E,
  1082. 0x69,
  1083. 0x5A,
  1084. 0x32,
  1085. 0x19,
  1086. {0x15, 0x15},
  1087. {0x91, 0x2B, 0x00, 0x00},
  1088. GROWTH_MEDIUM_FAST},
  1089. {"Kingler",
  1090. &I_kingler,
  1091. 0x8A,
  1092. 0x37,
  1093. 0x82,
  1094. 0x73,
  1095. 0x4B,
  1096. 0x32,
  1097. {0x15, 0x15},
  1098. {0x91, 0x2B, 0x0B, 0x00},
  1099. GROWTH_MEDIUM_FAST},
  1100. {"Voltorb",
  1101. &I_voltorb,
  1102. 0x06,
  1103. 0x28,
  1104. 0x1E,
  1105. 0x32,
  1106. 0x64,
  1107. 0x37,
  1108. {0x17, 0x17},
  1109. {0x21, 0x67, 0x00, 0x00},
  1110. GROWTH_MEDIUM_FAST},
  1111. {"Electrode",
  1112. &I_electrode,
  1113. 0x8D,
  1114. 0x3C,
  1115. 0x32,
  1116. 0x46,
  1117. 0x8C,
  1118. 0x50,
  1119. {0x17, 0x17},
  1120. {0x21, 0x67, 0x31, 0x00},
  1121. GROWTH_MEDIUM_FAST},
  1122. {"Exeggcute",
  1123. &I_exeggcute,
  1124. 0x0C,
  1125. 0x3C,
  1126. 0x28,
  1127. 0x50,
  1128. 0x28,
  1129. 0x3C,
  1130. {0x16, 0x18},
  1131. {0x8C, 0x5F, 0x00, 0x00},
  1132. GROWTH_SLOW},
  1133. {"Exeggutor",
  1134. &I_exeggutor,
  1135. 0x0A,
  1136. 0x5F,
  1137. 0x5F,
  1138. 0x55,
  1139. 0x37,
  1140. 0x7D,
  1141. {0x16, 0x18},
  1142. {0x8C, 0x5F, 0x00, 0x00},
  1143. GROWTH_SLOW},
  1144. {"Cubone",
  1145. &I_cubone,
  1146. 0x11,
  1147. 0x32,
  1148. 0x32,
  1149. 0x5F,
  1150. 0x23,
  1151. 0x28,
  1152. {0x04, 0x04},
  1153. {0x7D, 0x2D, 0x00, 0x00},
  1154. GROWTH_MEDIUM_FAST},
  1155. {"Marowak",
  1156. &I_marowak,
  1157. 0x91,
  1158. 0x3C,
  1159. 0x50,
  1160. 0x6E,
  1161. 0x2D,
  1162. 0x32,
  1163. {0x04, 0x04},
  1164. {0x7D, 0x2D, 0x2B, 0x74},
  1165. GROWTH_MEDIUM_FAST},
  1166. {"Hitmonlee",
  1167. &I_hitmonlee,
  1168. 0x2B,
  1169. 0x32,
  1170. 0x78,
  1171. 0x35,
  1172. 0x57,
  1173. 0x23,
  1174. {0x01, 0x01},
  1175. {0x18, 0x60, 0x00, 0x00},
  1176. GROWTH_MEDIUM_FAST},
  1177. {"Hitmonchan",
  1178. &I_hitmonchan,
  1179. 0x2C,
  1180. 0x32,
  1181. 0x69,
  1182. 0x4F,
  1183. 0x4C,
  1184. 0x23,
  1185. {0x01, 0x01},
  1186. {0x04, 0x61, 0x00, 0x00},
  1187. GROWTH_MEDIUM_FAST},
  1188. {"Lickitung",
  1189. &I_lickitung,
  1190. 0x0B,
  1191. 0x5A,
  1192. 0x37,
  1193. 0x4B,
  1194. 0x1E,
  1195. 0x3C,
  1196. {0x00, 0x00},
  1197. {0x23, 0x30, 0x00, 0x00},
  1198. GROWTH_MEDIUM_FAST},
  1199. {"Koffing",
  1200. &I_koffing,
  1201. 0x37,
  1202. 0x28,
  1203. 0x41,
  1204. 0x5F,
  1205. 0x23,
  1206. 0x3C,
  1207. {0x03, 0x03},
  1208. {0x21, 0x7B, 0x00, 0x00},
  1209. GROWTH_MEDIUM_FAST},
  1210. {"Weezing",
  1211. &I_weezing,
  1212. 0x8F,
  1213. 0x41,
  1214. 0x5A,
  1215. 0x78,
  1216. 0x3C,
  1217. 0x55,
  1218. {0x03, 0x03},
  1219. {0x21, 0x7B, 0x7C, 0x00},
  1220. GROWTH_MEDIUM_FAST},
  1221. {"Rhyhorn",
  1222. &I_rhyhorn,
  1223. 0x12,
  1224. 0x50,
  1225. 0x55,
  1226. 0x5F,
  1227. 0x19,
  1228. 0x1E,
  1229. {0x04, 0x05},
  1230. {0x1E, 0x00, 0x00, 0x00},
  1231. GROWTH_SLOW},
  1232. {"Rhydon",
  1233. &I_rhydon,
  1234. 0x01,
  1235. 0x69,
  1236. 0x82,
  1237. 0x78,
  1238. 0x28,
  1239. 0x2D,
  1240. {0x04, 0x05},
  1241. {0x1E, 0x17, 0x27, 0x1F},
  1242. GROWTH_SLOW},
  1243. {"Chansey",
  1244. &I_chansey,
  1245. 0x28,
  1246. 0xFA,
  1247. 0x05,
  1248. 0x05,
  1249. 0x32,
  1250. 0x69,
  1251. {0x00, 0x00},
  1252. {0x01, 0x03, 0x00, 0x00},
  1253. GROWTH_FAST},
  1254. {"Tangela",
  1255. &I_tangela,
  1256. 0x1E,
  1257. 0x41,
  1258. 0x37,
  1259. 0x73,
  1260. 0x3C,
  1261. 0x64,
  1262. {0x16, 0x16},
  1263. {0x84, 0x14, 0x00, 0x00},
  1264. GROWTH_MEDIUM_FAST},
  1265. {"Kangaskhan",
  1266. &I_kangaskhan,
  1267. 0x02,
  1268. 0x69,
  1269. 0x5F,
  1270. 0x50,
  1271. 0x5A,
  1272. 0x28,
  1273. {0x00, 0x00},
  1274. {0x04, 0x63, 0x00, 0x00},
  1275. GROWTH_MEDIUM_FAST},
  1276. {"Horsea",
  1277. &I_horsea,
  1278. 0x5C,
  1279. 0x1E,
  1280. 0x28,
  1281. 0x46,
  1282. 0x3C,
  1283. 0x46,
  1284. {0x15, 0x15},
  1285. {0x91, 0x00, 0x00, 0x00},
  1286. GROWTH_MEDIUM_FAST},
  1287. {"Seadra",
  1288. &I_seadra,
  1289. 0x5D,
  1290. 0x37,
  1291. 0x41,
  1292. 0x5F,
  1293. 0x55,
  1294. 0x5F,
  1295. {0x15, 0x15},
  1296. {0x91, 0x6C, 0x00, 0x00},
  1297. GROWTH_MEDIUM_FAST},
  1298. {"Goldeen",
  1299. &I_goldeen,
  1300. 0x9D,
  1301. 0x2D,
  1302. 0x43,
  1303. 0x3C,
  1304. 0x3F,
  1305. 0x32,
  1306. {0x15, 0x15},
  1307. {0x40, 0x27, 0x00, 0x00},
  1308. GROWTH_MEDIUM_FAST},
  1309. {"Seaking",
  1310. &I_seaking,
  1311. 0x9E,
  1312. 0x50,
  1313. 0x5C,
  1314. 0x41,
  1315. 0x44,
  1316. 0x50,
  1317. {0x15, 0x15},
  1318. {0x40, 0x27, 0x30, 0x00},
  1319. GROWTH_MEDIUM_FAST},
  1320. {"Staryu",
  1321. &I_staryu,
  1322. 0x1B,
  1323. 0x1E,
  1324. 0x2D,
  1325. 0x37,
  1326. 0x55,
  1327. 0x46,
  1328. {0x15, 0x15},
  1329. {0x21, 0x00, 0x00, 0x00},
  1330. GROWTH_SLOW},
  1331. {"Starmie",
  1332. &I_starmie,
  1333. 0x98,
  1334. 0x3C,
  1335. 0x4B,
  1336. 0x55,
  1337. 0x73,
  1338. 0x64,
  1339. {0x15, 0x18},
  1340. {0x21, 0x37, 0x6A, 0x00},
  1341. GROWTH_SLOW},
  1342. {"Mr.Mime",
  1343. &I_mr_mime,
  1344. 0x2A,
  1345. 0x28,
  1346. 0x2D,
  1347. 0x41,
  1348. 0x5A,
  1349. 0x64,
  1350. {0x18, 0x18},
  1351. {0x5D, 0x70, 0x00, 0x00},
  1352. GROWTH_MEDIUM_FAST},
  1353. {"Scyther",
  1354. &I_scyther,
  1355. 0x1A,
  1356. 0x46,
  1357. 0x6E,
  1358. 0x50,
  1359. 0x69,
  1360. 0x37,
  1361. {0x07, 0x02},
  1362. {0x62, 0x00, 0x00, 0x00},
  1363. GROWTH_MEDIUM_FAST},
  1364. {"Jynx",
  1365. &I_jynx,
  1366. 0x48,
  1367. 0x41,
  1368. 0x32,
  1369. 0x23,
  1370. 0x5F,
  1371. 0x5F,
  1372. {0x19, 0x18},
  1373. {0x01, 0x8E, 0x00, 0x00},
  1374. GROWTH_MEDIUM_FAST},
  1375. {"Electabuzz",
  1376. &I_electabuzz,
  1377. 0x35,
  1378. 0x41,
  1379. 0x53,
  1380. 0x39,
  1381. 0x69,
  1382. 0x55,
  1383. {0x17, 0x17},
  1384. {0x62, 0x2B, 0x00, 0x00},
  1385. GROWTH_MEDIUM_FAST},
  1386. {"Magmar",
  1387. &I_magmar,
  1388. 0x33,
  1389. 0x41,
  1390. 0x5F,
  1391. 0x39,
  1392. 0x5D,
  1393. 0x55,
  1394. {0x14, 0x14},
  1395. {0x34, 0x00, 0x00, 0x00},
  1396. GROWTH_MEDIUM_FAST},
  1397. {"Pinsir",
  1398. &I_pinsir,
  1399. 0x1D,
  1400. 0x41,
  1401. 0x7D,
  1402. 0x64,
  1403. 0x55,
  1404. 0x37,
  1405. {0x07, 0x07},
  1406. {0x0B, 0x00, 0x00, 0x00},
  1407. GROWTH_SLOW},
  1408. {"Tauros",
  1409. &I_tauros,
  1410. 0x3C,
  1411. 0x4B,
  1412. 0x64,
  1413. 0x5F,
  1414. 0x6E,
  1415. 0x46,
  1416. {0x00, 0x00},
  1417. {0x21, 0x00, 0x00, 0x00},
  1418. GROWTH_SLOW},
  1419. {"Magikarp",
  1420. &I_magikarp,
  1421. 0x85,
  1422. 0x14,
  1423. 0x0A,
  1424. 0x37,
  1425. 0x50,
  1426. 0x14,
  1427. {0x15, 0x15},
  1428. {0x96, 0x00, 0x00, 0x00},
  1429. GROWTH_SLOW},
  1430. {"Gyarados",
  1431. &I_gyarados,
  1432. 0x16,
  1433. 0x5F,
  1434. 0x7D,
  1435. 0x4F,
  1436. 0x51,
  1437. 0x64,
  1438. {0x15, 0x02},
  1439. {0x2C, 0x52, 0x2B, 0x38},
  1440. GROWTH_SLOW},
  1441. {"Lapras",
  1442. &I_lapras,
  1443. 0x13,
  1444. 0x82,
  1445. 0x55,
  1446. 0x50,
  1447. 0x3C,
  1448. 0x5F,
  1449. {0x15, 0x19},
  1450. {0x37, 0x2D, 0x00, 0x00},
  1451. GROWTH_SLOW},
  1452. {"Ditto",
  1453. &I_ditto,
  1454. 0x4C,
  1455. 0x30,
  1456. 0x30,
  1457. 0x30,
  1458. 0x30,
  1459. 0x30,
  1460. {0x00, 0x00},
  1461. {0x90, 0x00, 0x00, 0x00},
  1462. GROWTH_MEDIUM_FAST},
  1463. {"Eevee",
  1464. &I_eevee,
  1465. 0x66,
  1466. 0x37,
  1467. 0x37,
  1468. 0x32,
  1469. 0x37,
  1470. 0x41,
  1471. {0x00, 0x00},
  1472. {0x21, 0x1C, 0x00, 0x00},
  1473. GROWTH_MEDIUM_FAST},
  1474. {"Vaporeon",
  1475. &I_vaporeon,
  1476. 0x69,
  1477. 0x82,
  1478. 0x41,
  1479. 0x3C,
  1480. 0x41,
  1481. 0x6E,
  1482. {0x15, 0x15},
  1483. {0x21, 0x1C, 0x62, 0x37},
  1484. GROWTH_MEDIUM_FAST},
  1485. {"Jolteon",
  1486. &I_jolteon,
  1487. 0x68,
  1488. 0x41,
  1489. 0x41,
  1490. 0x3C,
  1491. 0x82,
  1492. 0x6E,
  1493. {0x17, 0x17},
  1494. {0x21, 0x1C, 0x62, 0x54},
  1495. GROWTH_MEDIUM_FAST},
  1496. {"Flareon",
  1497. &I_flareon,
  1498. 0x67,
  1499. 0x41,
  1500. 0x82,
  1501. 0x3C,
  1502. 0x41,
  1503. 0x6E,
  1504. {0x14, 0x14},
  1505. {0x21, 0x1C, 0x62, 0x34},
  1506. GROWTH_MEDIUM_FAST},
  1507. {"Porygon",
  1508. &I_porygon,
  1509. 0xAA,
  1510. 0x41,
  1511. 0x3C,
  1512. 0x46,
  1513. 0x28,
  1514. 0x4B,
  1515. {0x00, 0x00},
  1516. {0x21, 0x9F, 0xA0, 0x00},
  1517. GROWTH_MEDIUM_FAST},
  1518. {"Omanyte",
  1519. &I_omanyte,
  1520. 0x62,
  1521. 0x23,
  1522. 0x28,
  1523. 0x64,
  1524. 0x23,
  1525. 0x5A,
  1526. {0x05, 0x15},
  1527. {0x37, 0x6E, 0x00, 0x00},
  1528. GROWTH_MEDIUM_FAST},
  1529. {"Omastar",
  1530. &I_omastar,
  1531. 0x63,
  1532. 0x46,
  1533. 0x3C,
  1534. 0x7D,
  1535. 0x37,
  1536. 0x73,
  1537. {0x05, 0x15},
  1538. {0x37, 0x6E, 0x1E, 0x00},
  1539. GROWTH_MEDIUM_FAST},
  1540. {"Kabuto",
  1541. &I_kabuto,
  1542. 0x5A,
  1543. 0x1E,
  1544. 0x50,
  1545. 0x5A,
  1546. 0x37,
  1547. 0x2D,
  1548. {0x05, 0x15},
  1549. {0x0A, 0x6A, 0x00, 0x00},
  1550. GROWTH_MEDIUM_FAST},
  1551. {"Kabutops",
  1552. &I_kabutops,
  1553. 0x5B,
  1554. 0x3C,
  1555. 0x73,
  1556. 0x69,
  1557. 0x50,
  1558. 0x46,
  1559. {0x05, 0x15},
  1560. {0x0A, 0x6A, 0x47, 0x00},
  1561. GROWTH_MEDIUM_FAST},
  1562. {"Aerodactyl",
  1563. &I_aerodactyl,
  1564. 0xAB,
  1565. 0x50,
  1566. 0x69,
  1567. 0x41,
  1568. 0x82,
  1569. 0x3C,
  1570. {0x05, 0x02},
  1571. {0x11, 0x61, 0x00, 0x00},
  1572. GROWTH_SLOW},
  1573. {"Snorlax",
  1574. &I_snorlax,
  1575. 0x84,
  1576. 0xA0,
  1577. 0x6E,
  1578. 0x41,
  1579. 0x1E,
  1580. 0x41,
  1581. {0x00, 0x00},
  1582. {0x1D, 0x85, 0x9C, 0x00},
  1583. GROWTH_SLOW},
  1584. {"Articuno",
  1585. &I_articuno,
  1586. 0x4A,
  1587. 0x5A,
  1588. 0x55,
  1589. 0x64,
  1590. 0x55,
  1591. 0x7D,
  1592. {0x19, 0x02},
  1593. {0x40, 0x3A, 0x00, 0x00},
  1594. GROWTH_SLOW},
  1595. {"Zapdos",
  1596. &I_zapdos,
  1597. 0x4B,
  1598. 0x5A,
  1599. 0x5A,
  1600. 0x55,
  1601. 0x64,
  1602. 0x7D,
  1603. {0x17, 0x02},
  1604. {0x54, 0x41, 0x00, 0x00},
  1605. GROWTH_SLOW},
  1606. {"Moltres",
  1607. &I_moltres,
  1608. 0x49,
  1609. 0x5A,
  1610. 0x64,
  1611. 0x5A,
  1612. 0x5A,
  1613. 0x7D,
  1614. {0x14, 0x02},
  1615. {0x40, 0x53, 0x00, 0x00},
  1616. GROWTH_SLOW},
  1617. {"Dratini",
  1618. &I_dratini,
  1619. 0x58,
  1620. 0x29,
  1621. 0x40,
  1622. 0x2D,
  1623. 0x32,
  1624. 0x32,
  1625. {0x1A, 0x1A},
  1626. {0x23, 0x2B, 0x00, 0x00},
  1627. GROWTH_SLOW},
  1628. {"Dragonair",
  1629. &I_dragonair,
  1630. 0x59,
  1631. 0x3D,
  1632. 0x54,
  1633. 0x41,
  1634. 0x46,
  1635. 0x46,
  1636. {0x1A, 0x1A},
  1637. {0x23, 0x2B, 0x56, 0x00},
  1638. GROWTH_SLOW},
  1639. {"Dragonite",
  1640. &I_dragonite,
  1641. 0x42,
  1642. 0x5B,
  1643. 0x86,
  1644. 0x5F,
  1645. 0x50,
  1646. 0x64,
  1647. {0x1A, 0x02},
  1648. {0x23, 0x2B, 0x56, 0x61},
  1649. GROWTH_SLOW},
  1650. {"Mewtwo",
  1651. &I_mewtwo,
  1652. 0x83,
  1653. 0x6A,
  1654. 0x6E,
  1655. 0x5A,
  1656. 0x82,
  1657. 0x9A,
  1658. {0x18, 0x18},
  1659. {0x5D, 0x32, 0x81, 0x5E},
  1660. GROWTH_SLOW},
  1661. {"Mew",
  1662. &I_mew,
  1663. 0x15,
  1664. 0x64,
  1665. 0x64,
  1666. 0x64,
  1667. 0x64,
  1668. 0x64,
  1669. {0x18, 0x18},
  1670. {0x01, 0x00, 0x00, 0x00},
  1671. GROWTH_MEDIUM_SLOW},
  1672. {},
  1673. };
  1674. const NamedList move_list[] = {
  1675. {"No Move", 0x00},
  1676. {"Absorb", 0x47},
  1677. {"Acid Armor", 0x97},
  1678. {"Acid", 0x33},
  1679. {"Agility", 0x61},
  1680. {"Amnesia", 0x85},
  1681. {"Aurora Beam", 0x3E},
  1682. {"Barrage", 0x8C},
  1683. {"Barrier", 0x70},
  1684. {"Bide", 0x75},
  1685. {"Bind", 0x14},
  1686. {"Bite", 0x2C},
  1687. {"Blizzard", 0x3B},
  1688. {"Body Slam", 0x22},
  1689. {"Bone Club", 0x7D},
  1690. {"Boomerang", 0x9B},
  1691. {"Bubblebeam", 0x3D},
  1692. {"Bubble", 0x91},
  1693. {"Clamp", 0x80},
  1694. {"Comet Punch", 0x04},
  1695. {"Confuse Ray", 0x6D},
  1696. {"Confusion", 0x5D},
  1697. {"Constrict", 0x84},
  1698. {"Conversion", 0xA0},
  1699. {"Counter", 0x44},
  1700. {"Crabhammer", 0x98},
  1701. {"Cut", 0x0F},
  1702. {"Defense Curl", 0x6F},
  1703. {"Dig", 0x5B},
  1704. {"Disable", 0x32},
  1705. {"Dizzy Punch", 0x92},
  1706. {"Doubleslap", 0x03},
  1707. {"Double Kick", 0x18},
  1708. {"Double Team", 0x68},
  1709. {"Double-Edge", 0x26},
  1710. {"Dragon Rage", 0x52},
  1711. {"Dream Eater", 0x8A},
  1712. {"Drill Peck", 0x41},
  1713. {"Earthquake", 0x59},
  1714. {"Egg Bomb", 0x79},
  1715. {"Ember", 0x34},
  1716. {"Explosion", 0x99},
  1717. {"Fire Blast", 0x7E},
  1718. {"Fire Punch", 0x07},
  1719. {"Fire Spin", 0x53},
  1720. {"Fissure", 0x5A},
  1721. {"Flamethrower", 0x35},
  1722. {"Flash", 0x94},
  1723. {"Fly", 0x13},
  1724. {"Focus Energy", 0x74},
  1725. {"Fury Attack", 0x1F},
  1726. {"Fury Swipes", 0x9A},
  1727. {"Glare", 0x89},
  1728. {"Growl", 0x2D},
  1729. {"Growth", 0x4A},
  1730. {"Guillotine", 0x0C},
  1731. {"Gust", 0x10},
  1732. {"Harden", 0x6A},
  1733. {"Haze", 0x72},
  1734. {"Headbutt", 0x1D},
  1735. {"Hi Jump Kick", 0x88},
  1736. {"Horn Attack", 0x1E},
  1737. {"Horn Drill", 0x20},
  1738. {"Hydro Pump", 0x38},
  1739. {"Hyper Beam", 0x3F},
  1740. {"Hyper Fang", 0x9E},
  1741. {"Hypnosis", 0x5F},
  1742. {"Ice Beam", 0x3A},
  1743. {"Ice Punch", 0x08},
  1744. {"Jump Kick", 0x1A},
  1745. {"Karate Chop", 0x02},
  1746. {"Kinesis", 0x86},
  1747. {"Leech Life", 0x8D},
  1748. {"Leech Seed", 0x49},
  1749. {"Leer", 0x2B},
  1750. {"Lick", 0x7A},
  1751. {"Light Screen", 0x71},
  1752. {"Lovely Kiss", 0x8E},
  1753. {"Low Kick", 0x43},
  1754. {"Meditate", 0x60},
  1755. {"Mega Drain", 0x48},
  1756. {"Mega Kick", 0x19},
  1757. {"Mega Punch", 0x05},
  1758. {"Metronome", 0x76},
  1759. {"Mimic", 0x66},
  1760. {"Minimize", 0x6B},
  1761. {"Mirror Move", 0x77},
  1762. {"Mist", 0x36},
  1763. {"Night Shade", 0x65},
  1764. {"Pay Day", 0x06},
  1765. {"Peck", 0x40},
  1766. {"Petal Dance", 0x50},
  1767. {"Pin Missile", 0x2A},
  1768. {"Poisonpowder", 0x4D},
  1769. {"Poison Gas", 0x8B},
  1770. {"Poison Sting", 0x28},
  1771. {"Pound", 0x01},
  1772. {"Psybeam", 0x3C},
  1773. {"Psychic", 0x5E},
  1774. {"Psywave", 0x95},
  1775. {"Quick Attack", 0x62},
  1776. {"Rage", 0x63},
  1777. {"Razor Leaf", 0x4B},
  1778. {"Razor Wind", 0x0D},
  1779. {"Recover", 0x69},
  1780. {"Reflect", 0x73},
  1781. {"Rest", 0x9C},
  1782. {"Roar", 0x2E},
  1783. {"Rock Slide", 0x9D},
  1784. {"Rock Throw", 0x58},
  1785. {"Rolling Kick", 0x1B},
  1786. {"Sand Attack", 0x1C},
  1787. {"Scratch", 0x0A},
  1788. {"Screech", 0x67},
  1789. {"Seismic Toss", 0x45},
  1790. {"Selfdestruct", 0x78},
  1791. {"Sharpen", 0x9F},
  1792. {"Sing", 0x2F},
  1793. {"Skull Bash", 0x82},
  1794. {"Sky Attack", 0x8F},
  1795. {"Slam", 0x15},
  1796. {"Slash", 0xA3},
  1797. {"Sleep Powder", 0x4F},
  1798. {"Sludge", 0x7C},
  1799. {"Smog", 0x7B},
  1800. {"Smokescreen", 0x6C},
  1801. {"Softboiled", 0x87},
  1802. {"Solar Beam", 0x4C},
  1803. {"Sonicboom", 0x31},
  1804. {"Spike Cannon", 0x83},
  1805. {"Splash", 0x96},
  1806. {"Spore", 0x93},
  1807. {"Stomp", 0x17},
  1808. {"Strength", 0x46},
  1809. {"String Shot", 0x51},
  1810. {"Struggle", 0xA5},
  1811. {"Stun Spore", 0x4E},
  1812. {"Submission", 0x42},
  1813. {"Substitute", 0xA4},
  1814. {"Supersonic", 0x30},
  1815. {"Super Fang", 0xA2},
  1816. {"Surf", 0x39},
  1817. {"Swift", 0x81},
  1818. {"Swords Dance", 0x0E},
  1819. {"Tackle", 0x21},
  1820. {"Tail Whip", 0x27},
  1821. {"Take Down", 0x24},
  1822. {"Teleport", 0x64},
  1823. {"Thrash", 0x25},
  1824. {"Thunderbolt", 0x55},
  1825. {"Thunderpunch", 0x09},
  1826. {"Thundershock", 0x54},
  1827. {"Thunder Wave", 0x56},
  1828. {"Thunder", 0x57},
  1829. {"Toxic", 0x5C},
  1830. {"Transform", 0x90},
  1831. {"Tri Attack", 0xA1},
  1832. {"Twineedle", 0x29},
  1833. {"Vicegrip", 0x0B},
  1834. {"Vine Whip", 0x16},
  1835. {"Waterfall", 0x7F},
  1836. {"Water Gun", 0x37},
  1837. {"Whirlwind", 0x12},
  1838. {"Wing Attack", 0x11},
  1839. {"Withdraw", 0x6E},
  1840. {"Wrap", 0x23},
  1841. {},
  1842. };
  1843. const NamedList type_list[] = {
  1844. {"Bug", 0x07},
  1845. {"Dragon", 0x1A},
  1846. {"Electric", 0x17},
  1847. {"Fighting", 0x01},
  1848. {"Fire", 0x14},
  1849. {"Flying", 0x02},
  1850. {"Ghost", 0x08},
  1851. {"Grass", 0x16},
  1852. {"Ground", 0x04},
  1853. {"Ice", 0x19},
  1854. {"Normal", 0x00},
  1855. {"Poison", 0x03},
  1856. {"Psychic", 0x18},
  1857. {"Rock", 0x05},
  1858. {"Water", 0x15},
  1859. {},
  1860. };
  1861. int pokemon_named_list_get_num_elements(const NamedList* list) {
  1862. int i;
  1863. for(i = 0;; i++) {
  1864. if(list[i].name == NULL) return i;
  1865. }
  1866. /* XXX: Would be faster to do something like this, but, can't easily do
  1867. * that using the current pointers. Might be able to clean this up later?
  1868. */
  1869. //return sizeof(type_list)/sizeof(type_list[0]);
  1870. }
  1871. int pokemon_named_list_get_list_pos_from_index(const NamedList* list, uint8_t index) {
  1872. int i;
  1873. for(i = 0;; i++) {
  1874. if(list[i].name == NULL) break;
  1875. if(index == list[i].index) return i;
  1876. }
  1877. /* XXX: This will return the first entry in case index is not matched.
  1878. * Could be surprising at runtime.
  1879. */
  1880. return 0;
  1881. }
  1882. const char* pokemon_named_list_get_name_from_index(const NamedList* list, uint8_t index) {
  1883. int i;
  1884. for(i = 0;; i++) {
  1885. if(list[i].name == NULL) break;
  1886. if(index == list[i].index) return list[i].name;
  1887. }
  1888. /* XXX: This will return the first entry in the case index is not matched,
  1889. * this could be confusing/problematic at runtime.
  1890. */
  1891. return list[0].name;
  1892. }
  1893. /* If dest is not NULL, a copy of the default name is written to it as well */
  1894. void pokemon_trade_block_set_default_name(char* dest, PokemonFap* pokemon_fap, size_t n) {
  1895. int i;
  1896. char buf[11];
  1897. /* Walk through the default name, toupper() each character, encode it, and
  1898. * then write that to the same position in the trade_block.
  1899. */
  1900. /* XXX: The limit of this is hard-coded to a length of 11 at most. This may
  1901. * be a problem down the road!
  1902. */
  1903. for(i = 0; i < 11; i++) {
  1904. pokemon_fap->trade_block->nickname[0].str[i] = pokemon_char_to_encoded(
  1905. toupper(pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon].name[i]));
  1906. buf[i] = toupper(pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon].name[i]);
  1907. }
  1908. if(dest != NULL) {
  1909. strncpy(dest, buf, n);
  1910. }
  1911. }
  1912. #define UINT32_TO_EXP(input, output_array) \
  1913. do { \
  1914. (output_array)[2] = (uint8_t)((input)&0xFF); \
  1915. (output_array)[1] = (uint8_t)(((input) >> 8) & 0xFF); \
  1916. (output_array)[0] = (uint8_t)(((input) >> 16) & 0xFF); \
  1917. } while(0)
  1918. void pokemon_trade_block_recalculate_stats_from_level(PokemonFap* pokemon_fap) {
  1919. struct pokemon_structure* pkmn = &pokemon_fap->trade_block->party[0];
  1920. const PokemonTable* table = &pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon];
  1921. int curr_stats = pokemon_fap->curr_stats;
  1922. uint32_t experience;
  1923. int level = pkmn->level;
  1924. uint16_t stat;
  1925. uint8_t hp_iv = 0xf;
  1926. uint8_t atk_iv = 0xf;
  1927. uint8_t def_iv = 0xf;
  1928. uint8_t spd_iv = 0xf;
  1929. uint8_t special_iv = 0xf;
  1930. /* Calculate exp */
  1931. switch(table->growth) {
  1932. case GROWTH_FAST:
  1933. // https://bulbapedia.bulbagarden.net/wiki/Experience#Fast
  1934. experience = (4 * level * level * level) / 5;
  1935. break;
  1936. case GROWTH_MEDIUM_FAST:
  1937. // https://bulbapedia.bulbagarden.net/wiki/Experience#Medium_Fast
  1938. experience = (level * level * level);
  1939. break;
  1940. case GROWTH_MEDIUM_SLOW:
  1941. // https://bulbapedia.bulbagarden.net/wiki/Experience#Medium_Slow
  1942. experience =
  1943. (((level * level * level) * 6 / 5) - (15 * level * level) + (100 * level) - 140);
  1944. break;
  1945. case GROWTH_SLOW:
  1946. // https://bulbapedia.bulbagarden.net/wiki/Experience#Slow
  1947. experience = (5 * level * level * level) / 4;
  1948. break;
  1949. default:
  1950. furi_crash("incorrect growth val");
  1951. break;
  1952. }
  1953. pkmn->level_again = level;
  1954. UINT32_TO_EXP(experience, pkmn->exp);
  1955. /* Generate STATEXP */
  1956. switch(curr_stats) {
  1957. case 1:
  1958. case 4:
  1959. stat = (0xffff / 100) * level;
  1960. break;
  1961. case 2:
  1962. case 5:
  1963. stat = 0xffff;
  1964. break;
  1965. default:
  1966. stat = 0;
  1967. break;
  1968. }
  1969. stat = __builtin_bswap16(stat);
  1970. pkmn->hp_ev = stat;
  1971. pkmn->atk_ev = stat;
  1972. pkmn->def_ev = stat;
  1973. pkmn->spd_ev = stat;
  1974. pkmn->special_ev = stat;
  1975. /* Set up IVs */
  1976. if(curr_stats <= 2) {
  1977. atk_iv = rand() % 15;
  1978. def_iv = rand() % 15;
  1979. spd_iv = rand() % 15;
  1980. special_iv = rand() % 15;
  1981. pkmn->iv = ((atk_iv & 0x0f) << 12) | ((def_iv & 0x0f) << 8) | ((spd_iv & 0x0f) << 4) |
  1982. ((special_iv & 0x0f));
  1983. hp_iv = (pkmn->iv & 0xAA) >> 4;
  1984. }
  1985. /* Calculate HP */
  1986. // https://bulbapedia.bulbagarden.net/wiki/Stat#Generations_I_and_II
  1987. stat = floor((((2 * (table->base_hp + hp_iv)) + floor(sqrt(pkmn->hp_ev) / 4)) * level) / 100) +
  1988. (level + 10);
  1989. pkmn->hp = __builtin_bswap16(stat);
  1990. pkmn->max_hp = pkmn->hp;
  1991. /* Calculate ATK, DEF, SPD, SP */
  1992. // https://bulbapedia.bulbagarden.net/wiki/Stat#Generations_I_and_II
  1993. stat =
  1994. floor((((2 * (table->base_atk + atk_iv)) + floor(sqrt(pkmn->atk_ev) / 4)) * level) / 100) +
  1995. 5;
  1996. pkmn->atk = __builtin_bswap16(stat);
  1997. stat =
  1998. floor((((2 * (table->base_def + def_iv)) + floor(sqrt(pkmn->def_ev) / 4)) * level) / 100) +
  1999. 5;
  2000. pkmn->def = __builtin_bswap16(stat);
  2001. stat =
  2002. floor((((2 * (table->base_spd + spd_iv)) + floor(sqrt(pkmn->spd_ev) / 4)) * level) / 100) +
  2003. 5;
  2004. pkmn->spd = __builtin_bswap16(stat);
  2005. stat = floor(
  2006. (((2 * (table->base_special + special_iv)) + floor(sqrt(pkmn->special_ev) / 4)) *
  2007. level) /
  2008. 100) +
  2009. 5;
  2010. pkmn->special = __builtin_bswap16(stat);
  2011. }
  2012. /* Rebuild the current trade block's variables based on curr_pokemon */
  2013. void pokemon_trade_block_recalculate(PokemonFap* pokemon_fap) {
  2014. struct pokemon_structure* pkmn = &pokemon_fap->trade_block->party[0];
  2015. const PokemonTable* table = &pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon];
  2016. int i;
  2017. /* Set current pokemon to the trade structure */
  2018. pkmn->index = table->index;
  2019. pokemon_fap->trade_block->party_members[0] = table->index;
  2020. /* Set current pokemon's moves to the trade structure */
  2021. for(i = 0; i < 4; i++) {
  2022. pkmn->move[i] = table->move[i];
  2023. }
  2024. /* Set current pokemon's types to the trade structure */
  2025. for(i = 0; i < 2; i++) {
  2026. pkmn->type[i] = table->type[i];
  2027. }
  2028. pokemon_trade_block_recalculate_stats_from_level(pokemon_fap);
  2029. pokemon_trade_block_set_default_name(NULL, pokemon_fap, 0);
  2030. }
  2031. /* Allocates a chunk of memory for the trade data block and sets up some
  2032. * default values.
  2033. */
  2034. static TradeBlock* trade_block_alloc(void) {
  2035. TradeBlock* trade;
  2036. trade = malloc(sizeof(TradeBlock));
  2037. /* Clear struct to be all TERM_ bytes as the various name strings need this */
  2038. memset(trade, TERM_, sizeof(TradeBlock));
  2039. /* The party_members element needs to be 0xff for unused */
  2040. memset(trade->party_members, 0xFF, sizeof(trade->party_members));
  2041. /* Zero the main party data, TERM_ in there can cause weirdness */
  2042. memset(trade->party, 0x00, sizeof(trade->party));
  2043. /* Set our Name, the pokemon's default OT name and ID */
  2044. trade->party_cnt = 1;
  2045. /* Trainer/OT name, not to exceed 7 characters! */
  2046. pokemon_str_to_encoded_array(trade->trainer_name, "Flipper", sizeof(trade->trainer_name));
  2047. pokemon_str_to_encoded_array(trade->ot_name[0].str, "Flipper", sizeof(trade->ot_name[0].str));
  2048. /* OT trainer ID# */
  2049. trade->party[0].ot_id = __builtin_bswap16(42069);
  2050. /* XXX: move pp isn't explicitly set up, should be fine */
  2051. /* XXX: catch/held isn't explicitly set up, should be okay for only Gen I support now */
  2052. /* XXX: Status condition isn't explicity let up, would you ever want to? */
  2053. /* Set up initial level */
  2054. trade->party[0].level = 2;
  2055. return trade;
  2056. }
  2057. static void trade_block_free(TradeBlock* trade) {
  2058. free(trade);
  2059. }
  2060. PokemonFap* pokemon_alloc() {
  2061. PokemonFap* pokemon_fap = (PokemonFap*)malloc(sizeof(PokemonFap));
  2062. // View dispatcher
  2063. pokemon_fap->view_dispatcher = view_dispatcher_alloc();
  2064. view_dispatcher_enable_queue(pokemon_fap->view_dispatcher);
  2065. view_dispatcher_set_event_callback_context(pokemon_fap->view_dispatcher, pokemon_fap);
  2066. view_dispatcher_attach_to_gui(
  2067. pokemon_fap->view_dispatcher,
  2068. (Gui*)furi_record_open(RECORD_GUI),
  2069. ViewDispatcherTypeFullscreen);
  2070. /* Set up pointers to const data tables for reference elsewhere */
  2071. pokemon_fap->pokemon_table = pokemon_table;
  2072. pokemon_fap->move_list = move_list;
  2073. pokemon_fap->type_list = type_list;
  2074. // Set up defaults
  2075. pokemon_fap->curr_pokemon = 0;
  2076. pokemon_fap->curr_stats = 0;
  2077. // Set up trade party struct
  2078. pokemon_fap->trade_block = trade_block_alloc();
  2079. /* Update trade block struct with calculated details from initial values from trade_block_alloc() */
  2080. pokemon_trade_block_recalculate(pokemon_fap);
  2081. /* Set up gui modules used. It would be nice if these could be allocated and
  2082. * freed as needed, however, the scene manager still requires pointers that
  2083. * get set up as a part of the scene. Therefore, individual scene's exit
  2084. * callbacks cannot free the buffer.
  2085. */
  2086. pokemon_fap->text_input = text_input_alloc();
  2087. pokemon_fap->submenu = submenu_alloc();
  2088. pokemon_fap->variable_item_list = variable_item_list_alloc();
  2089. // Set up menu scene
  2090. pokemon_fap->scene_manager = scene_manager_alloc(&pokemon_scene_manager_handlers, pokemon_fap);
  2091. view_dispatcher_add_view(
  2092. pokemon_fap->view_dispatcher, AppViewMainMenu, submenu_get_view(pokemon_fap->submenu));
  2093. scene_manager_next_scene(pokemon_fap->scene_manager, MainMenuScene);
  2094. // Select Pokemon View
  2095. pokemon_fap->select_view = select_pokemon_alloc(pokemon_fap);
  2096. view_dispatcher_add_view(
  2097. pokemon_fap->view_dispatcher, AppViewSelectPokemon, pokemon_fap->select_view);
  2098. // Trade View
  2099. pokemon_fap->trade_view = trade_alloc(pokemon_fap);
  2100. view_dispatcher_add_view(pokemon_fap->view_dispatcher, AppViewTrade, pokemon_fap->trade_view);
  2101. return pokemon_fap;
  2102. }
  2103. void free_app(PokemonFap* pokemon_fap) {
  2104. furi_assert(pokemon_fap);
  2105. // Free views
  2106. view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewSelectPokemon);
  2107. select_pokemon_free(pokemon_fap);
  2108. view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewTrade);
  2109. trade_free(pokemon_fap);
  2110. view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
  2111. view_dispatcher_free(pokemon_fap->view_dispatcher);
  2112. // Free scenes
  2113. scene_manager_free(pokemon_fap->scene_manager);
  2114. // Free gui modules
  2115. submenu_free(pokemon_fap->submenu);
  2116. text_input_free(pokemon_fap->text_input);
  2117. variable_item_list_free(pokemon_fap->variable_item_list);
  2118. // Close records
  2119. furi_record_close(RECORD_GUI);
  2120. // Free trade block
  2121. trade_block_free(pokemon_fap->trade_block);
  2122. // Free rest
  2123. free(pokemon_fap);
  2124. pokemon_fap = NULL;
  2125. }
  2126. int32_t pokemon_app(void* p) {
  2127. UNUSED(p);
  2128. PokemonFap* pokemon_fap = pokemon_alloc();
  2129. furi_hal_light_set(LightRed, 0x00);
  2130. furi_hal_light_set(LightGreen, 0x00);
  2131. furi_hal_light_set(LightBlue, 0x00);
  2132. //switch view and run dispatcher
  2133. view_dispatcher_run(pokemon_fap->view_dispatcher);
  2134. // Free resources
  2135. free_app(pokemon_fap);
  2136. return 0;
  2137. }