pokemon_app.c 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266
  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_table_get_num_from_index(const PokemonTable* table, uint8_t index) {
  1862. int i;
  1863. for(i = 0;; i++) {
  1864. if(table[i].index == index) return i;
  1865. if(table[i].name == NULL) break;
  1866. }
  1867. return 0;
  1868. }
  1869. int pokemon_named_list_get_num_elements(const NamedList* list) {
  1870. int i;
  1871. for(i = 0;; i++) {
  1872. if(list[i].name == NULL) return i;
  1873. }
  1874. }
  1875. int pokemon_named_list_get_list_pos_from_index(const NamedList* list, uint8_t index) {
  1876. int i;
  1877. for(i = 0;; i++) {
  1878. if(list[i].name == NULL) break;
  1879. if(index == list[i].index) return i;
  1880. }
  1881. /* This will return the first entry in case index is not matched.
  1882. * Could be surprising at runtime.
  1883. */
  1884. return 0;
  1885. }
  1886. const char* pokemon_named_list_get_name_from_index(const NamedList* list, uint8_t index) {
  1887. int i;
  1888. for(i = 0;; i++) {
  1889. if(list[i].name == NULL) break;
  1890. if(index == list[i].index) return list[i].name;
  1891. }
  1892. /* This will return the first entry in the case index is not matched,
  1893. * this could be confusing/problematic at runtime.
  1894. */
  1895. return list[0].name;
  1896. }
  1897. /* If dest is not NULL, a copy of the default name is written to it as well */
  1898. void pokemon_trade_block_set_default_name(char* dest, PokemonFap* pokemon_fap, size_t n) {
  1899. int i;
  1900. char buf[11];
  1901. /* Walk through the default name, toupper() each character, encode it, and
  1902. * then write that to the same position in the trade_block.
  1903. */
  1904. for(i = 0; i < 11; i++) {
  1905. pokemon_fap->trade_block->nickname[0].str[i] = pokemon_char_to_encoded(
  1906. toupper(pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon].name[i]));
  1907. buf[i] = toupper(pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon].name[i]);
  1908. }
  1909. FURI_LOG_D(TAG, "[app] Set default nickname");
  1910. if(dest != NULL) {
  1911. strncpy(dest, buf, n);
  1912. }
  1913. }
  1914. #define UINT32_TO_EXP(input, output_array) \
  1915. do { \
  1916. (output_array)[2] = (uint8_t)((input)&0xFF); \
  1917. (output_array)[1] = (uint8_t)(((input) >> 8) & 0xFF); \
  1918. (output_array)[0] = (uint8_t)(((input) >> 16) & 0xFF); \
  1919. } while(0)
  1920. void pokemon_trade_block_recalculate_stats_from_level(PokemonFap* pokemon_fap) {
  1921. struct pokemon_structure* pkmn = &pokemon_fap->trade_block->party[0];
  1922. const PokemonTable* table = &pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon];
  1923. int curr_stats = pokemon_fap->curr_stats;
  1924. uint32_t experience;
  1925. int level = pkmn->level;
  1926. uint16_t stat;
  1927. uint8_t hp_iv = 0xf;
  1928. uint8_t atk_iv = 0xf;
  1929. uint8_t def_iv = 0xf;
  1930. uint8_t spd_iv = 0xf;
  1931. uint8_t special_iv = 0xf;
  1932. /* Calculate exp */
  1933. switch(table->growth) {
  1934. case GROWTH_FAST:
  1935. // https://bulbapedia.bulbagarden.net/wiki/Experience#Fast
  1936. experience = (4 * level * level * level) / 5;
  1937. break;
  1938. case GROWTH_MEDIUM_FAST:
  1939. // https://bulbapedia.bulbagarden.net/wiki/Experience#Medium_Fast
  1940. experience = (level * level * level);
  1941. break;
  1942. case GROWTH_MEDIUM_SLOW:
  1943. // https://bulbapedia.bulbagarden.net/wiki/Experience#Medium_Slow
  1944. experience =
  1945. (((level * level * level) * 6 / 5) - (15 * level * level) + (100 * level) - 140);
  1946. break;
  1947. case GROWTH_SLOW:
  1948. // https://bulbapedia.bulbagarden.net/wiki/Experience#Slow
  1949. experience = (5 * level * level * level) / 4;
  1950. break;
  1951. default:
  1952. furi_crash("incorrect growth val");
  1953. break;
  1954. }
  1955. pkmn->level_again = level;
  1956. UINT32_TO_EXP(experience, pkmn->exp);
  1957. FURI_LOG_D(TAG, "[app] Set pkmn level %d", level);
  1958. FURI_LOG_D(TAG, "[app] Set pkmn exp %d", (int)experience);
  1959. /* Generate STATEXP */
  1960. switch(curr_stats) {
  1961. case 1:
  1962. case 4:
  1963. stat = (0xffff / 100) * level;
  1964. break;
  1965. case 2:
  1966. case 5:
  1967. stat = 0xffff;
  1968. break;
  1969. default:
  1970. stat = 0;
  1971. break;
  1972. }
  1973. FURI_LOG_D(TAG, "[app] EVs set to %d", stat);
  1974. stat = __builtin_bswap16(stat);
  1975. pkmn->hp_ev = stat;
  1976. pkmn->atk_ev = stat;
  1977. pkmn->def_ev = stat;
  1978. pkmn->spd_ev = stat;
  1979. pkmn->special_ev = stat;
  1980. /* Set up IVs */
  1981. if(curr_stats <= 2) {
  1982. atk_iv = rand() % 15;
  1983. def_iv = rand() % 15;
  1984. spd_iv = rand() % 15;
  1985. special_iv = rand() % 15;
  1986. pkmn->iv = ((atk_iv & 0x0f) << 12) | ((def_iv & 0x0f) << 8) | ((spd_iv & 0x0f) << 4) |
  1987. ((special_iv & 0x0f));
  1988. hp_iv = (pkmn->iv & 0xAA) >> 4;
  1989. }
  1990. FURI_LOG_D(
  1991. TAG,
  1992. "[app] atk_iv %d, def_iv %d, spd_iv %d, spc_iv %d, hp_iv %d",
  1993. atk_iv,
  1994. def_iv,
  1995. spd_iv,
  1996. special_iv,
  1997. hp_iv);
  1998. /* Calculate HP */
  1999. // https://bulbapedia.bulbagarden.net/wiki/Stat#Generations_I_and_II
  2000. stat = floor((((2 * (table->base_hp + hp_iv)) + floor(sqrt(pkmn->hp_ev) / 4)) * level) / 100) +
  2001. (level + 10);
  2002. FURI_LOG_D(TAG, "[app] HP set to %d", stat);
  2003. pkmn->hp = __builtin_bswap16(stat);
  2004. pkmn->max_hp = pkmn->hp;
  2005. /* Calculate ATK, DEF, SPD, SP */
  2006. /* TODO: these all use the same calculations, could put the stats in a sub-array and iterate
  2007. * through each element in order rather than having to repeat the code. IVs would also need
  2008. * to be in a similar array.
  2009. **/
  2010. // https://bulbapedia.bulbagarden.net/wiki/Stat#Generations_I_and_II
  2011. stat =
  2012. floor((((2 * (table->base_atk + atk_iv)) + floor(sqrt(pkmn->atk_ev) / 4)) * level) / 100) +
  2013. 5;
  2014. FURI_LOG_D(TAG, "[app] ATK set to %d", stat);
  2015. pkmn->atk = __builtin_bswap16(stat);
  2016. stat =
  2017. floor((((2 * (table->base_def + def_iv)) + floor(sqrt(pkmn->def_ev) / 4)) * level) / 100) +
  2018. 5;
  2019. FURI_LOG_D(TAG, "[app] DEF set to %d", stat);
  2020. pkmn->def = __builtin_bswap16(stat);
  2021. stat =
  2022. floor((((2 * (table->base_spd + spd_iv)) + floor(sqrt(pkmn->spd_ev) / 4)) * level) / 100) +
  2023. 5;
  2024. FURI_LOG_D(TAG, "[app] SPD set to %d", stat);
  2025. pkmn->spd = __builtin_bswap16(stat);
  2026. stat = floor(
  2027. (((2 * (table->base_special + special_iv)) + floor(sqrt(pkmn->special_ev) / 4)) *
  2028. level) /
  2029. 100) +
  2030. 5;
  2031. FURI_LOG_D(TAG, "[app] SPC set to %d", stat);
  2032. pkmn->special = __builtin_bswap16(stat);
  2033. }
  2034. /* Rebuild the current trade block's variables based on curr_pokemon */
  2035. void pokemon_trade_block_recalculate(PokemonFap* pokemon_fap) {
  2036. struct pokemon_structure* pkmn = &pokemon_fap->trade_block->party[0];
  2037. const PokemonTable* table = &pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon];
  2038. int i;
  2039. /* Set current pokemon to the trade structure */
  2040. pkmn->index = table->index;
  2041. pokemon_fap->trade_block->party_members[0] = table->index;
  2042. FURI_LOG_D(TAG, "[app] Set %s in trade block", table->name);
  2043. /* Set current pokemon's moves to the trade structure */
  2044. for(i = 0; i < 4; i++) {
  2045. pkmn->move[i] = table->move[i];
  2046. FURI_LOG_D(
  2047. TAG,
  2048. "[app] Set %s in trade block",
  2049. pokemon_named_list_get_name_from_index(pokemon_fap->move_list, pkmn->move[i]));
  2050. }
  2051. /* Set current pokemon's types to the trade structure */
  2052. for(i = 0; i < 2; i++) {
  2053. pkmn->type[i] = table->type[i];
  2054. FURI_LOG_D(
  2055. TAG,
  2056. "[app] Set %s in trade block",
  2057. pokemon_named_list_get_name_from_index(pokemon_fap->type_list, pkmn->type[i]));
  2058. }
  2059. pokemon_trade_block_recalculate_stats_from_level(pokemon_fap);
  2060. pokemon_trade_block_set_default_name(NULL, pokemon_fap, 0);
  2061. }
  2062. /* Allocates a chunk of memory for the trade data block and sets up some
  2063. * default values.
  2064. */
  2065. static TradeBlock* trade_block_alloc(void) {
  2066. TradeBlock* trade;
  2067. trade = malloc(sizeof(TradeBlock));
  2068. /* Clear struct to be all TERM_ bytes as the various name strings need this */
  2069. memset(trade, TERM_, sizeof(TradeBlock));
  2070. /* The party_members element needs to be 0xff for unused */
  2071. memset(trade->party_members, 0xFF, sizeof(trade->party_members));
  2072. /* Zero the main party data, TERM_ in there can cause weirdness */
  2073. memset(trade->party, 0x00, sizeof(trade->party));
  2074. /* Set our Name, the pokemon's default OT name and ID */
  2075. trade->party_cnt = 1;
  2076. /* Trainer/OT name, not to exceed 7 characters! */
  2077. pokemon_str_to_encoded_array(trade->trainer_name, "Flipper", sizeof(trade->trainer_name));
  2078. pokemon_str_to_encoded_array(trade->ot_name[0].str, "Flipper", sizeof(trade->ot_name[0].str));
  2079. /* OT trainer ID# */
  2080. trade->party[0].ot_id = __builtin_bswap16(42069);
  2081. /* Notes:
  2082. * Move pp isn't explicitly set up, should be fine
  2083. * Catch/held isn't explicitly set up, should be okay for only Gen I support now
  2084. * Status condition isn't explicity let up, would you ever want to?
  2085. */
  2086. /* Set up initial level */
  2087. trade->party[0].level = 2;
  2088. return trade;
  2089. }
  2090. static void trade_block_free(TradeBlock* trade) {
  2091. free(trade);
  2092. }
  2093. /* The MALVEKE board has an esp32 which is set to TX on the flipper's default
  2094. * UART pins. If this pin shows signs of something connected, assume a MALVEKE
  2095. * board is being used.
  2096. */
  2097. static bool detect_malveke(void) {
  2098. bool rc;
  2099. furi_hal_gpio_init(&gpio_usart_rx, GpioModeInput, GpioPullDown, GpioSpeedVeryHigh);
  2100. rc = furi_hal_gpio_read(&gpio_usart_rx);
  2101. furi_hal_gpio_init_simple(&gpio_usart_rx, GpioModeAnalog);
  2102. return rc;
  2103. }
  2104. PokemonFap* pokemon_alloc() {
  2105. PokemonFap* pokemon_fap = (PokemonFap*)malloc(sizeof(PokemonFap));
  2106. // View dispatcher
  2107. pokemon_fap->view_dispatcher = view_dispatcher_alloc();
  2108. view_dispatcher_enable_queue(pokemon_fap->view_dispatcher);
  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. PokemonFap* pokemon_fap = pokemon_alloc();
  2183. furi_hal_light_set(LightRed, 0x00);
  2184. furi_hal_light_set(LightGreen, 0x00);
  2185. furi_hal_light_set(LightBlue, 0x00);
  2186. //switch view and run dispatcher
  2187. view_dispatcher_run(pokemon_fap->view_dispatcher);
  2188. // Free resources
  2189. free_app(pokemon_fap);
  2190. return 0;
  2191. }