No Description

battle_structs.h 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. #ifndef BATTLE_STRUCT_H_
  2. #define BATTLE_STRUCT_H_
  3. #include <types.h>
  4. struct side_affecting_hword{
  5. u16 reflect_on : 1;
  6. u16 light_screen_on : 1;
  7. u16 unkown1 : 2;
  8. u16 spikes_on : 1;
  9. u16 safeguard_on : 1;
  10. u16 unkown2 : 2;
  11. u16 mist_on : 1;
  12. u16 spikes_damage_done : 1;
  13. };
  14. extern struct side_affecting_hword side_affecting_halfword[2];
  15. struct status_main{
  16. u32 sleep : 3;
  17. u32 poison : 1;
  18. u32 burn : 1;
  19. u32 freeze : 1;
  20. u32 paralysis: 1;
  21. u32 toxic_poison : 1;
  22. u32 poison_counter : 4;
  23. };
  24. union main_status{
  25. u32 int_status;
  26. struct status_main flags;
  27. };
  28. struct protect_struct{
  29. u8 flag0_protect : 1;
  30. u8 flag0_endure : 1;
  31. u8 flag0_onlystruggle : 1;
  32. u8 flag0_helpinghand : 1;
  33. u8 flag0_bouncemove : 1;
  34. u8 flag0_stealmove : 1;
  35. u8 flag0_unknown: 1;
  36. u8 flag0_prlz_immobility: 1;
  37. u8 flag1_confusion_self_damage: 1;
  38. u8 flag1_noteffective: 1;
  39. u8 flag1_chargingturn: 1; //dive, dig etc.
  40. u8 flag1_smokeballflee: 1;
  41. u8 flag1_runaway_flee: 1;
  42. u8 flag1_used_imprisoned_move: 1;
  43. u8 flag1_love_immobility: 1;
  44. u8 flag1_used_disabled_move: 1;
  45. u8 flag2_used_taunted_move: 1;
  46. u8 flag2_unknown: 1;
  47. u8 flag2_flinch_immobility : 1;
  48. u8 flag2_notfirststrike : 1;
  49. u8 flag2_free: 4;
  50. u8 field3;
  51. u32 physical_damage;
  52. u32 special_damage;
  53. u8 counter_target;
  54. u8 mirrorcoat_target;
  55. u16 fieldE;
  56. };
  57. extern struct protect_struct battle_protect[4];
  58. #define STATUS_SLEEP 0x7
  59. #define STATUS_POISON 0x8
  60. #define STATUS_BURN 0x10
  61. #define STATUS_FREEZE 0x20
  62. #define STATUS_PARALYSIS 0x40
  63. #define STATUS_TOXIC_POISON 0x80
  64. struct flags2{
  65. u32 confusion : 3;
  66. u32 flinched : 1;
  67. u32 uproar : 3;
  68. u32 flag_x80 : 1;
  69. u32 bide : 2;
  70. u32 locked_and_confuse : 2;
  71. u32 multiple_turn_move : 1;
  72. u32 trapped_in_wrap : 3;
  73. u32 in_love : 4;
  74. u32 focus_energy : 1;
  75. u32 transformed : 1;
  76. u32 recharge : 1;
  77. u32 raged : 1;
  78. u32 substitute : 1;
  79. u32 destinny_bond : 1;
  80. u32 cant_escape : 1;
  81. u32 nightmare : 1;
  82. u32 cursed : 1;
  83. u32 foresight : 1;
  84. u32 defense_curled : 1;
  85. u32 tormented : 1;
  86. };
  87. struct iv_set
  88. {
  89. u32 iv_hp: 5;
  90. u32 iv_atk: 5;
  91. u32 iv_def: 5;
  92. u32 iv_spd: 5;
  93. u32 iv_sp_atk: 5;
  94. u32 iv_sp_def: 5;
  95. };
  96. struct battle_participant {
  97. u16 poke_species;
  98. u16 atk;
  99. u16 def;
  100. u16 spd;
  101. u16 sp_atk;
  102. u16 sp_def;
  103. u16 moves[4];
  104. struct iv_set ivs;
  105. u8 hp_buff;
  106. u8 atk_buff;
  107. u8 def_buff;
  108. u8 spd_buff;
  109. u8 sp_atk_buff;
  110. u8 sp_def_buff;
  111. u8 acc_buff;
  112. u8 evasion_buff;
  113. u8 ability_id;
  114. u8 type1;
  115. u8 type2;
  116. u8 padd;
  117. u8 current_pp[4];
  118. u16 current_hp;
  119. u8 level;
  120. u8 happiness;
  121. u16 max_hp;
  122. u16 held_item;
  123. u8 poke_name[12];
  124. u8 trainer_name[8];
  125. u32 padd2;
  126. u32 pid;
  127. union main_status status;
  128. struct flags2 status2;
  129. u32 otid;
  130. };
  131. extern struct battle_participant battle_participants[4];
  132. struct side_timer{
  133. u8 reflect_timer;
  134. u8 reflect_bank;
  135. u8 lightscreen_timer;
  136. u8 lightscreen_bank;
  137. u8 mist_timer;
  138. u8 mist_bank;
  139. u8 safeguard_timer;
  140. u8 safeguard_bank;
  141. u8 followme_timer;
  142. u8 followme_target;
  143. u8 spikes_amount;
  144. u8 fieldB;
  145. };
  146. extern struct side_timer battle_side_timers[2];
  147. struct in_battle_weather{
  148. u32 rain : 1;
  149. u32 downpour : 1;
  150. u32 permament_rain : 1;
  151. u32 sandstorm : 1;
  152. u32 permament_sandstorm : 1;
  153. u32 sun : 1;
  154. u32 permament_sun : 1;
  155. u32 hail : 1;
  156. //custom flags
  157. u32 permament_hail : 1;
  158. u32 fog : 1;
  159. u32 permament_fog : 1;
  160. u32 harsh_sun : 1;
  161. u32 heavy_rain : 1;
  162. u32 air_current : 1;
  163. };
  164. struct status_3{
  165. u32 leech_seed_hp_receiver : 2; // 2 bits
  166. u32 leech_seed : 1; //4
  167. u32 always_hits : 2; //x8 | x10
  168. u32 perish_song : 1; //x20
  169. u32 on_air : 1; //x40
  170. u32 underground : 1;//80
  171. u32 minimized : 1; //x100
  172. u32 charged_up : 1; //x200
  173. u32 rooted : 1; //x400
  174. u32 yawn : 2; //x800 || x1000
  175. u32 imprision : 1; //x2000
  176. u32 grudge : 1; //x4000
  177. u32 unkown_no_crit : 1; //x8000
  178. u32 mud_sport : 1; //x10 000
  179. u32 watersport : 1; //x20 000
  180. u32 underwater : 1; //x40 000
  181. u32 switchinlock : 1; //x80 000
  182. u32 unburden : 1; //x100 000 (previously trace)
  183. u32 phantomforce : 1; //x200 000
  184. };
  185. extern struct status_3 battle_status_3[4];
  186. union battle_weather{
  187. u32 int_bw;
  188. struct in_battle_weather flags;
  189. };
  190. extern union battle_weather battle_weather;
  191. struct mirror_move_set_per_bank
  192. {
  193. u16 moves_per_target[4];
  194. };
  195. struct battle_stuff{
  196. u8 end_turn_statetracker1; //0x0
  197. u8 end_turn_checked_bank; //0x1
  198. u8 field_2; //0x2
  199. u8 end_turn_statetracker2; //0x3
  200. u16 trapped_move[4]; //0x4 - 0xB
  201. u8 move_target[4]; //0xC - 0xF
  202. u8 field_10; //0x10
  203. u8 field_11; //0x11
  204. u8 field_12; //0x12
  205. u8 dynamic_move_type; //0x13
  206. u8 trapper[4];//0x14-0x17
  207. u8 field_18[48]; //0x18-0x47
  208. u8 pre_attacks_bank_counter; //0x48
  209. u8 field_49; //0x49
  210. u8 money_multiplier; //0x4A
  211. u8 field_4B; //0x4B
  212. u8 switch_in_ability_bank_counter; //0x4C
  213. u8 field_4D[7]; //0x4D-0x53
  214. u8 field_54; //0x54
  215. u8 field_55; //0x55
  216. u8 field_56; //0x56
  217. u8 field_57; //0x57
  218. u8 field_58[4];
  219. u8 field_5C[35];
  220. u8 castform_switch_form; //0x7F
  221. u8 chosen_move_position[4]; //0x80
  222. u8 field_84[13]; //0x84-0x90
  223. u8 absent_bank_flags_prev_turn; //0x91
  224. u8 field_92[6]; //0x92-0x97
  225. u16 mirror_moves_pbs[4]; //0x98-0x9F
  226. u8 field_A0[18]; //0xA0-0xB1
  227. u8 synchronize_effect_chooser; //0xB2
  228. u8 field_B3[5];
  229. u16 used_held_items[4]; //0xB8-0xBF
  230. u8 field_C0[8]; //0xC0-0xC7
  231. u16 choiced_move[4]; //0xC8-0xCF (checked in cmd49)
  232. u16 changed_held_items[4]; //0xD0-0xD8 (later written to battlestruct in cmd49)
  233. u8 intimidate_user; //0xD8
  234. u8 switch_in_item_bank_counter; //0xD9
  235. u8 field_DA; //0xDA
  236. u8 field_DB; //0xDB
  237. u8 field_DC; //0xDC
  238. u8 field_DD; //0xDD
  239. u8 field_DE; //0xDE
  240. u8 field_DF; //0xDF
  241. struct mirror_move_set_per_bank mirror_move_set_pbs[4]; //0xE0-0xFF
  242. u8 field_100[162]; //0x100-0x1A1
  243. u8 battle_load_weather_from_map_flag; //0x1A2
  244. u8 atk_canceller_state_tracker; //0x1A3
  245. u8 field_1A4[240]; //0x1A4-0x293
  246. u8 switchout_index[4]; //0x294-0x297
  247. u8 field_298[11];
  248. u8 field_2A3;
  249. };
  250. struct battle_stuff_struct{
  251. struct battle_stuff *ptr;
  252. };
  253. extern struct battle_stuff_struct battle_stuff_ptr;
  254. struct prop_flags{
  255. u8 makes_contact : 1;//1
  256. u8 affected_by_protect : 1;//2
  257. u8 affected_by_magic_coat : 1;//4
  258. u8 affected_by_snatch : 1;//8
  259. u8 affected_by_mirrormove :1;//x10
  260. u8 affected_by_kingsrock :1;//x20
  261. u8 raised_crit_ratio :1;//x40
  262. u8 unused_bit : 1;//x80
  263. };
  264. union move_flags{
  265. u8 int_flag;
  266. struct prop_flags flags;
  267. };
  268. struct move_info{
  269. u8 script_id;
  270. u8 base_power;
  271. u8 type;
  272. u8 accuracy;
  273. u8 pp;
  274. u8 effect_chance;
  275. u8 target;
  276. s8 priority;
  277. union move_flags move_flags;
  278. u8 arg1;
  279. u8 split;
  280. u8 arg2;
  281. };
  282. struct b_enigma_berry{
  283. u8 field0[7];
  284. u8 battle_effect_x12;
  285. u8 field8[18];
  286. u8 quality;
  287. u8 field1B;
  288. };
  289. extern struct b_enigma_berry battle_enigma_berry[4];
  290. #endif