pokemon_app.c 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275
  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_enable_queue(pokemon_fap->view_dispatcher);
  2110. view_dispatcher_set_event_callback_context(pokemon_fap->view_dispatcher, pokemon_fap);
  2111. view_dispatcher_attach_to_gui(
  2112. pokemon_fap->view_dispatcher,
  2113. (Gui*)furi_record_open(RECORD_GUI),
  2114. ViewDispatcherTypeFullscreen);
  2115. /* Set up pointers to const data tables for reference elsewhere */
  2116. pokemon_fap->pokemon_table = pokemon_table;
  2117. pokemon_fap->move_list = move_list;
  2118. pokemon_fap->type_list = type_list;
  2119. // Set up defaults
  2120. pokemon_fap->curr_pokemon = 0;
  2121. pokemon_fap->curr_stats = 0;
  2122. pokemon_fap->malveke_detected = detect_malveke();
  2123. memcpy(
  2124. &pokemon_fap->pins,
  2125. &common_pinouts[pokemon_fap->malveke_detected],
  2126. sizeof(struct gblink_pins));
  2127. // Set up trade party struct
  2128. pokemon_fap->trade_block = trade_block_alloc();
  2129. /* Update trade block struct with calculated details from initial values from trade_block_alloc() */
  2130. pokemon_trade_block_recalculate(pokemon_fap);
  2131. /* Set up gui modules used. It would be nice if these could be allocated and
  2132. * freed as needed, however, the scene manager still requires pointers that
  2133. * get set up as a part of the scene. Therefore, individual scene's exit
  2134. * callbacks cannot free the buffer.
  2135. */
  2136. pokemon_fap->text_input = text_input_alloc();
  2137. pokemon_fap->submenu = submenu_alloc();
  2138. pokemon_fap->variable_item_list = variable_item_list_alloc();
  2139. // Set up menu scene
  2140. pokemon_fap->scene_manager = scene_manager_alloc(&pokemon_scene_manager_handlers, pokemon_fap);
  2141. view_dispatcher_add_view(
  2142. pokemon_fap->view_dispatcher, AppViewMainMenu, submenu_get_view(pokemon_fap->submenu));
  2143. scene_manager_next_scene(pokemon_fap->scene_manager, MainMenuScene);
  2144. // Select Pokemon View
  2145. pokemon_fap->select_view = select_pokemon_alloc(pokemon_fap);
  2146. view_dispatcher_add_view(
  2147. pokemon_fap->view_dispatcher, AppViewSelectPokemon, pokemon_fap->select_view);
  2148. // Trade View
  2149. /* Allocates its own view and adds it to the main view_dispatcher */
  2150. pokemon_fap->trade = trade_alloc(
  2151. pokemon_fap->trade_block,
  2152. pokemon_fap->pokemon_table,
  2153. &pokemon_fap->pins,
  2154. pokemon_fap->view_dispatcher,
  2155. AppViewTrade);
  2156. return pokemon_fap;
  2157. }
  2158. void free_app(PokemonFap* pokemon_fap) {
  2159. furi_assert(pokemon_fap);
  2160. // Free views
  2161. view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewSelectPokemon);
  2162. select_pokemon_free(pokemon_fap);
  2163. /* Also removes itself from the view_dispatcher */
  2164. trade_free(pokemon_fap->view_dispatcher, AppViewTrade, pokemon_fap->trade);
  2165. view_dispatcher_remove_view(pokemon_fap->view_dispatcher, AppViewMainMenu);
  2166. view_dispatcher_free(pokemon_fap->view_dispatcher);
  2167. // Free scenes
  2168. scene_manager_free(pokemon_fap->scene_manager);
  2169. // Free gui modules
  2170. submenu_free(pokemon_fap->submenu);
  2171. text_input_free(pokemon_fap->text_input);
  2172. variable_item_list_free(pokemon_fap->variable_item_list);
  2173. // Close records
  2174. furi_record_close(RECORD_GUI);
  2175. // Free trade block
  2176. trade_block_free(pokemon_fap->trade_block);
  2177. // Free rest
  2178. free(pokemon_fap);
  2179. pokemon_fap = NULL;
  2180. }
  2181. int32_t pokemon_app(void* p) {
  2182. UNUSED(p);
  2183. Expansion* expansion = furi_record_open(RECORD_EXPANSION);
  2184. expansion_disable(expansion);
  2185. PokemonFap* pokemon_fap = pokemon_alloc();
  2186. furi_hal_light_set(LightRed, 0x00);
  2187. furi_hal_light_set(LightGreen, 0x00);
  2188. furi_hal_light_set(LightBlue, 0x00);
  2189. //switch view and run dispatcher
  2190. view_dispatcher_run(pokemon_fap->view_dispatcher);
  2191. // Free resources
  2192. free_app(pokemon_fap);
  2193. expansion_enable(expansion);
  2194. furi_record_close(RECORD_EXPANSION);
  2195. return 0;
  2196. }