pokemon_app.c 44 KB

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