summaryrefslogtreecommitdiff
path: root/include/constants
diff options
context:
space:
mode:
Diffstat (limited to 'include/constants')
-rw-r--r--include/constants/battle.h371
-rw-r--r--include/constants/battle_palace.h10
-rw-r--r--include/constants/battle_script_commands.h2
-rw-r--r--include/constants/cable_club.h16
-rw-r--r--include/constants/contest.h17
-rw-r--r--include/constants/field_specials.h5
-rw-r--r--include/constants/flags.h12
-rw-r--r--include/constants/global.h4
-rw-r--r--include/constants/items.h2
-rw-r--r--include/constants/opponents.h1
-rw-r--r--include/constants/pokemon.h3
-rw-r--r--include/constants/trainers.h2
-rw-r--r--include/constants/union_room.h78
-rw-r--r--include/constants/vars.h1
14 files changed, 333 insertions, 191 deletions
diff --git a/include/constants/battle.h b/include/constants/battle.h
index 346d5d9ea..8b860e384 100644
--- a/include/constants/battle.h
+++ b/include/constants/battle.h
@@ -37,146 +37,156 @@
#define B_SIDE_PLAYER 0
#define B_SIDE_OPPONENT 1
-#define B_FLANK_LEFT 0
+#define B_FLANK_LEFT 0
#define B_FLANK_RIGHT 1
#define BIT_SIDE 1
#define BIT_FLANK 2
// Battle Type Flags
-#define BATTLE_TYPE_DOUBLE 0x0001
-#define BATTLE_TYPE_LINK 0x0002
-#define BATTLE_TYPE_IS_MASTER 0x0004 // In not-link battles, it's always set.
-#define BATTLE_TYPE_TRAINER 0x0008
-#define BATTLE_TYPE_FIRST_BATTLE 0x0010
-#define BATTLE_TYPE_20 0x0020
-#define BATTLE_TYPE_MULTI 0x0040
-#define BATTLE_TYPE_SAFARI 0x0080
-#define BATTLE_TYPE_BATTLE_TOWER 0x0100
-#define BATTLE_TYPE_WALLY_TUTORIAL 0x0200
-#define BATTLE_TYPE_ROAMER 0x0400
-#define BATTLE_TYPE_EREADER_TRAINER 0x0800
-#define BATTLE_TYPE_KYOGRE_GROUDON 0x1000
-#define BATTLE_TYPE_LEGENDARY 0x2000
-#define BATTLE_TYPE_REGI 0x4000
-#define BATTLE_TYPE_TWO_OPPONENTS 0x8000
-#define BATTLE_TYPE_DOME 0x10000
-#define BATTLE_TYPE_PALACE 0x20000
-#define BATTLE_TYPE_ARENA 0x40000
-#define BATTLE_TYPE_FACTORY 0x80000
-#define BATTLE_TYPE_PIKE 0x100000
-#define BATTLE_TYPE_PYRAMID 0x200000
-#define BATTLE_TYPE_INGAME_PARTNER 0x400000
-#define BATTLE_TYPE_x800000 0x800000
-#define BATTLE_TYPE_RECORDED 0x1000000
-#define BATTLE_TYPE_x2000000 0x2000000
-#define BATTLE_TYPE_TRAINER_HILL 0x4000000
-#define BATTLE_TYPE_SECRET_BASE 0x8000000
-#define BATTLE_TYPE_GROUDON 0x10000000
-#define BATTLE_TYPE_KYOGRE 0x20000000
-#define BATTLE_TYPE_RAYQUAZA 0x40000000
-#define BATTLE_TYPE_x80000000 0x80000000
+#define BATTLE_TYPE_DOUBLE (1 << 0)
+#define BATTLE_TYPE_LINK (1 << 1)
+#define BATTLE_TYPE_IS_MASTER (1 << 2) // In not-link battles, it's always set.
+#define BATTLE_TYPE_TRAINER (1 << 3)
+#define BATTLE_TYPE_FIRST_BATTLE (1 << 4)
+#define BATTLE_TYPE_20 (1 << 5)
+#define BATTLE_TYPE_MULTI (1 << 6)
+#define BATTLE_TYPE_SAFARI (1 << 7)
+#define BATTLE_TYPE_BATTLE_TOWER (1 << 8)
+#define BATTLE_TYPE_WALLY_TUTORIAL (1 << 9)
+#define BATTLE_TYPE_ROAMER (1 << 10)
+#define BATTLE_TYPE_EREADER_TRAINER (1 << 11)
+#define BATTLE_TYPE_KYOGRE_GROUDON (1 << 12)
+#define BATTLE_TYPE_LEGENDARY (1 << 13)
+#define BATTLE_TYPE_REGI (1 << 14)
+#define BATTLE_TYPE_TWO_OPPONENTS (1 << 15)
+#define BATTLE_TYPE_DOME (1 << 16)
+#define BATTLE_TYPE_PALACE (1 << 17)
+#define BATTLE_TYPE_ARENA (1 << 18)
+#define BATTLE_TYPE_FACTORY (1 << 19)
+#define BATTLE_TYPE_PIKE (1 << 20)
+#define BATTLE_TYPE_PYRAMID (1 << 21)
+#define BATTLE_TYPE_INGAME_PARTNER (1 << 22)
+#define BATTLE_TYPE_x800000 (1 << 23)
+#define BATTLE_TYPE_RECORDED (1 << 24)
+#define BATTLE_TYPE_x2000000 (1 << 25)
+#define BATTLE_TYPE_TRAINER_HILL (1 << 26)
+#define BATTLE_TYPE_SECRET_BASE (1 << 27)
+#define BATTLE_TYPE_GROUDON (1 << 28)
+#define BATTLE_TYPE_KYOGRE (1 << 29)
+#define BATTLE_TYPE_RAYQUAZA (1 << 30)
+#define BATTLE_TYPE_x80000000 (1 << 31)
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
// Battle Outcome defines
-#define B_OUTCOME_WON 0x1
-#define B_OUTCOME_LOST 0x2
-#define B_OUTCOME_DREW 0x3
-#define B_OUTCOME_RAN 0x4
-#define B_OUTCOME_PLAYER_TELEPORTED 0x5
-#define B_OUTCOME_MON_FLED 0x6
-#define B_OUTCOME_CAUGHT 0x7
-#define B_OUTCOME_NO_SAFARI_BALLS 0x8
-#define B_OUTCOME_FORFEITED 0x9
-#define B_OUTCOME_MON_TELEPORTED 0xA
-#define B_OUTCOME_LINK_BATTLE_RAN 0x80
+#define B_OUTCOME_WON 1
+#define B_OUTCOME_LOST 2
+#define B_OUTCOME_DREW 3
+#define B_OUTCOME_RAN 4
+#define B_OUTCOME_PLAYER_TELEPORTED 5
+#define B_OUTCOME_MON_FLED 6
+#define B_OUTCOME_CAUGHT 7
+#define B_OUTCOME_NO_SAFARI_BALLS 8
+#define B_OUTCOME_FORFEITED 9
+#define B_OUTCOME_MON_TELEPORTED 10
+#define B_OUTCOME_LINK_BATTLE_RAN (1 << 7) // 128
// Non-volatile status conditions
// These persist remain outside of battle and after switching out
-#define STATUS1_NONE 0x0
-#define STATUS1_SLEEP 0x7
-#define STATUS1_POISON 0x8
-#define STATUS1_BURN 0x10
-#define STATUS1_FREEZE 0x20
-#define STATUS1_PARALYSIS 0x40
-#define STATUS1_TOXIC_POISON 0x80
-#define STATUS1_TOXIC_COUNTER 0xF00
+#define STATUS1_NONE 0
+#define STATUS1_SLEEP (1 << 0 | 1 << 1 | 1 << 2) // First 3 bits (Number of turns to sleep)
+#define STATUS1_SLEEP_TURN(num) ((num) << 0) // Just for readability (or if rearranging statuses)
+#define STATUS1_POISON (1 << 3)
+#define STATUS1_BURN (1 << 4)
+#define STATUS1_FREEZE (1 << 5)
+#define STATUS1_PARALYSIS (1 << 6)
+#define STATUS1_TOXIC_POISON (1 << 7)
+#define STATUS1_TOXIC_COUNTER (1 << 8 | 1 << 9 | 1 << 10 | 1 << 11)
+#define STATUS1_TOXIC_TURN(num) ((num) << 8)
#define STATUS1_PSN_ANY (STATUS1_POISON | STATUS1_TOXIC_POISON)
#define STATUS1_ANY (STATUS1_SLEEP | STATUS1_POISON | STATUS1_BURN | STATUS1_FREEZE | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)
// Volatile status ailments
// These are removed after exiting the battle or switching out
-#define STATUS2_CONFUSION 0x00000007
-#define STATUS2_FLINCHED 0x00000008
-#define STATUS2_UPROAR 0x00000070
-#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
-#define STATUS2_LOCK_CONFUSE 0x00000C00
-#define STATUS2_MULTIPLETURNS 0x00001000
-#define STATUS2_WRAPPED 0x0000E000
-#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every battler
+#define STATUS2_CONFUSION (1 << 0 | 1 << 1 | 1 << 2)
+#define STATUS2_CONFUSION_TURN(num) ((num) << 0)
+#define STATUS2_FLINCHED (1 << 3)
+#define STATUS2_UPROAR (1 << 4 | 1 << 5 | 1 << 6)
+#define STATUS2_UPROAR_TURN(num) ((num) << 4)
+#define STATUS2_UNUSED (1 << 7)
+#define STATUS2_BIDE (1 << 8 | 1 << 9)
+#define STATUS2_BIDE_TURN(num) (((num) << 8) & STATUS2_BIDE)
+#define STATUS2_LOCK_CONFUSE (1 << 10 | 1 << 11) // e.g. Thrash
+#define STATUS2_LOCK_CONFUSE_TURN(num)((num) << 10)
+#define STATUS2_MULTIPLETURNS (1 << 12)
+#define STATUS2_WRAPPED (1 << 13 | 1 << 14 | 1 << 15)
+#define STATUS2_WRAPPED_TURN(num) ((num) << 13)
+#define STATUS2_INFATUATION (1 << 16 | 1 << 17 | 1 << 18 | 1 << 19) // 4 bits, one for every battler
#define STATUS2_INFATUATED_WITH(battler) (gBitTable[battler] << 16)
-#define STATUS2_FOCUS_ENERGY 0x00100000
-#define STATUS2_TRANSFORMED 0x00200000
-#define STATUS2_RECHARGE 0x00400000
-#define STATUS2_RAGE 0x00800000
-#define STATUS2_SUBSTITUTE 0x01000000
-#define STATUS2_DESTINY_BOND 0x02000000
-#define STATUS2_ESCAPE_PREVENTION 0x04000000
-#define STATUS2_NIGHTMARE 0x08000000
-#define STATUS2_CURSED 0x10000000
-#define STATUS2_FORESIGHT 0x20000000
-#define STATUS2_DEFENSE_CURL 0x40000000
-#define STATUS2_TORMENT 0x80000000
+#define STATUS2_FOCUS_ENERGY (1 << 20)
+#define STATUS2_TRANSFORMED (1 << 21)
+#define STATUS2_RECHARGE (1 << 22)
+#define STATUS2_RAGE (1 << 23)
+#define STATUS2_SUBSTITUTE (1 << 24)
+#define STATUS2_DESTINY_BOND (1 << 25)
+#define STATUS2_ESCAPE_PREVENTION (1 << 26)
+#define STATUS2_NIGHTMARE (1 << 27)
+#define STATUS2_CURSED (1 << 28)
+#define STATUS2_FORESIGHT (1 << 29)
+#define STATUS2_DEFENSE_CURL (1 << 30)
+#define STATUS2_TORMENT (1 << 31)
// Seems like per-battler statuses. Not quite sure how to categorize these
-#define STATUS3_LEECHSEED_BATTLER 0x3
-#define STATUS3_LEECHSEED 0x4
-#define STATUS3_ALWAYS_HITS 0x18 // two bits
-#define STATUS3_PERISH_SONG 0x20
-#define STATUS3_ON_AIR 0x40
-#define STATUS3_UNDERGROUND 0x80
-#define STATUS3_MINIMIZED 0x100
-#define STATUS3_ROOTED 0x400
-#define STATUS3_CHARGED_UP 0x200
-#define STATUS3_YAWN 0x1800 // two bits
-#define STATUS3_IMPRISONED_OTHERS 0x2000
-#define STATUS3_GRUDGE 0x4000
-#define STATUS3_CANT_SCORE_A_CRIT 0x8000
-#define STATUS3_MUDSPORT 0x10000
-#define STATUS3_WATERSPORT 0x20000
-#define STATUS3_UNDERWATER 0x40000
-#define STATUS3_INTIMIDATE_POKES 0x80000
-#define STATUS3_TRACE 0x100000
+#define STATUS3_LEECHSEED_BATTLER (1 << 0 | 1 << 1) // The battler to receive HP from Leech Seed
+#define STATUS3_LEECHSEED (1 << 2)
+#define STATUS3_ALWAYS_HITS (1 << 3 | 1 << 4)
+#define STATUS3_ALWAYS_HITS_TURN(num) (((num) << 3) & STATUS3_ALWAYS_HITS) // "Always Hits" is set as a 2 turn timer, i.e. next turn is the last turn when it's active
+#define STATUS3_PERISH_SONG (1 << 5)
+#define STATUS3_ON_AIR (1 << 6)
+#define STATUS3_UNDERGROUND (1 << 7)
+#define STATUS3_MINIMIZED (1 << 8)
+#define STATUS3_CHARGED_UP (1 << 9)
+#define STATUS3_ROOTED (1 << 10)
+#define STATUS3_YAWN (1 << 11 | 1 << 12) // Number of turns to sleep
+#define STATUS3_YAWN_TURN(num) (((num) << 11) & STATUS3_YAWN)
+#define STATUS3_IMPRISONED_OTHERS (1 << 13)
+#define STATUS3_GRUDGE (1 << 14)
+#define STATUS3_CANT_SCORE_A_CRIT (1 << 15)
+#define STATUS3_MUDSPORT (1 << 16)
+#define STATUS3_WATERSPORT (1 << 17)
+#define STATUS3_UNDERWATER (1 << 18)
+#define STATUS3_INTIMIDATE_POKES (1 << 19)
+#define STATUS3_TRACE (1 << 20)
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)
// Not really sure what a "hitmarker" is.
-#define HITMARKER_x10 0x00000010
-#define HITMARKER_x20 0x00000020
-#define HITMARKER_DESTINYBOND 0x00000040
-#define HITMARKER_NO_ANIMATIONS 0x00000080
-#define HITMARKER_IGNORE_SUBSTITUTE 0x00000100
-#define HITMARKER_NO_ATTACKSTRING 0x00000200
-#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400
-#define HITMARKER_NO_PPDEDUCT 0x00000800
-#define HITMARKER_SWAP_ATTACKER_TARGET 0x00001000
-#define HITMARKER_IGNORE_SAFEGUARD 0x00002000
-#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000
-#define HITMARKER_RUN 0x00008000
-#define HITMARKER_IGNORE_ON_AIR 0x00010000
-#define HITMARKER_IGNORE_UNDERGROUND 0x00020000
-#define HITMARKER_IGNORE_UNDERWATER 0x00040000
-#define HITMARKER_UNABLE_TO_USE_MOVE 0x00080000
-#define HITMARKER_x100000 0x00100000
-#define HITMARKER_x200000 0x00200000
-#define HITMARKER_x400000 0x00400000
-#define HITMARKER_x800000 0x00800000
-#define HITMARKER_GRUDGE 0x01000000
-#define HITMARKER_OBEYS 0x02000000
-#define HITMARKER_x4000000 0x04000000
-#define HITMARKER_CHARGING 0x08000000
-#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 0x1C)
-#define HITMARKER_UNK(battler) (0x10000000 << battler)
+#define HITMARKER_x10 (1 << 4)
+#define HITMARKER_x20 (1 << 5)
+#define HITMARKER_DESTINYBOND (1 << 6)
+#define HITMARKER_NO_ANIMATIONS (1 << 7)
+#define HITMARKER_IGNORE_SUBSTITUTE (1 << 8)
+#define HITMARKER_NO_ATTACKSTRING (1 << 9)
+#define HITMARKER_ATTACKSTRING_PRINTED (1 << 10)
+#define HITMARKER_NO_PPDEDUCT (1 << 11)
+#define HITMARKER_SWAP_ATTACKER_TARGET (1 << 12)
+#define HITMARKER_IGNORE_SAFEGUARD (1 << 13)
+#define HITMARKER_SYNCHRONISE_EFFECT (1 << 14)
+#define HITMARKER_RUN (1 << 15)
+#define HITMARKER_IGNORE_ON_AIR (1 << 16)
+#define HITMARKER_IGNORE_UNDERGROUND (1 << 17)
+#define HITMARKER_IGNORE_UNDERWATER (1 << 18)
+#define HITMARKER_UNABLE_TO_USE_MOVE (1 << 19)
+#define HITMARKER_x100000 (1 << 20)
+#define HITMARKER_x200000 (1 << 21)
+#define HITMARKER_x400000 (1 << 22)
+#define HITMARKER_x800000 (1 << 23)
+#define HITMARKER_GRUDGE (1 << 24)
+#define HITMARKER_OBEYS (1 << 25)
+#define HITMARKER_x4000000 (1 << 26)
+#define HITMARKER_CHARGING (1 << 27)
+#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 28)
+#define HITMARKER_FAINTED2(battler) (1 << (28 + battler))
// Per-side statuses that affect an entire party
#define SIDE_STATUS_REFLECT (1 << 0)
@@ -215,71 +225,70 @@
#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)
// Move Effects
-#define MOVE_EFFECT_SLEEP 0x1
-#define MOVE_EFFECT_POISON 0x2
-#define MOVE_EFFECT_BURN 0x3
-#define MOVE_EFFECT_FREEZE 0x4
-#define MOVE_EFFECT_PARALYSIS 0x5
-#define MOVE_EFFECT_TOXIC 0x6
-#define MOVE_EFFECT_CONFUSION 0x7
-#define MOVE_EFFECT_FLINCH 0x8
-#define MOVE_EFFECT_TRI_ATTACK 0x9
-#define MOVE_EFFECT_UPROAR 0xA
-#define MOVE_EFFECT_PAYDAY 0xB
-#define MOVE_EFFECT_CHARGING 0xC
-#define MOVE_EFFECT_WRAP 0xD
-#define MOVE_EFFECT_RECOIL_25 0xE
-#define MOVE_EFFECT_ATK_PLUS_1 0xF
-#define MOVE_EFFECT_DEF_PLUS_1 0x10
-#define MOVE_EFFECT_SPD_PLUS_1 0x11
-#define MOVE_EFFECT_SP_ATK_PLUS_1 0x12
-#define MOVE_EFFECT_SP_DEF_PLUS_1 0x13
-#define MOVE_EFFECT_ACC_PLUS_1 0x14
-#define MOVE_EFFECT_EVS_PLUS_1 0x15
-#define MOVE_EFFECT_ATK_MINUS_1 0x16
-#define MOVE_EFFECT_DEF_MINUS_1 0x17
-#define MOVE_EFFECT_SPD_MINUS_1 0x18
-#define MOVE_EFFECT_SP_ATK_MINUS_1 0x19
-#define MOVE_EFFECT_SP_DEF_MINUS_1 0x1A
-#define MOVE_EFFECT_ACC_MINUS_1 0x1B
-#define MOVE_EFFECT_EVS_MINUS_1 0x1C
-#define MOVE_EFFECT_RECHARGE 0x1D
-#define MOVE_EFFECT_RAGE 0x1E
-#define MOVE_EFFECT_STEAL_ITEM 0x1F
-#define MOVE_EFFECT_PREVENT_ESCAPE 0x20
-#define MOVE_EFFECT_NIGHTMARE 0x21
-#define MOVE_EFFECT_ALL_STATS_UP 0x22
-#define MOVE_EFFECT_RAPIDSPIN 0x23
-#define MOVE_EFFECT_REMOVE_PARALYSIS 0x24
-#define MOVE_EFFECT_ATK_DEF_DOWN 0x25
-#define MOVE_EFFECT_RECOIL_33 0x26
-#define MOVE_EFFECT_ATK_PLUS_2 0x27
-#define MOVE_EFFECT_DEF_PLUS_2 0x28
-#define MOVE_EFFECT_SPD_PLUS_2 0x29
-#define MOVE_EFFECT_SP_ATK_PLUS_2 0x2A
-#define MOVE_EFFECT_SP_DEF_PLUS_2 0x2B
-#define MOVE_EFFECT_ACC_PLUS_2 0x2C
-#define MOVE_EFFECT_EVS_PLUS_2 0x2D
-#define MOVE_EFFECT_ATK_MINUS_2 0x2E
-#define MOVE_EFFECT_DEF_MINUS_2 0x2F
-#define MOVE_EFFECT_SPD_MINUS_2 0x30
-#define MOVE_EFFECT_SP_ATK_MINUS_2 0x31
-#define MOVE_EFFECT_SP_DEF_MINUS_2 0x32
-#define MOVE_EFFECT_ACC_MINUS_2 0x33
-#define MOVE_EFFECT_EVS_MINUS_2 0x34
-#define MOVE_EFFECT_THRASH 0x35
-#define MOVE_EFFECT_KNOCK_OFF 0x36
-#define MOVE_EFFECT_NOTHING_37 0x37
-#define MOVE_EFFECT_NOTHING_38 0x38
-#define MOVE_EFFECT_NOTHING_39 0x39
-#define MOVE_EFFECT_NOTHING_3A 0x3A
-#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B
-#define MOVE_EFFECT_NOTHING_3C 0x3C
-#define MOVE_EFFECT_NOTHING_3D 0x3D
-#define MOVE_EFFECT_NOTHING_3E 0x3E
-#define MOVE_EFFECT_NOTHING_3F 0x3F
-#define MOVE_EFFECT_AFFECTS_USER 0x40
-#define MOVE_EFFECT_CERTAIN 0x80
+#define MOVE_EFFECT_SLEEP 1
+#define MOVE_EFFECT_POISON 2
+#define MOVE_EFFECT_BURN 3
+#define MOVE_EFFECT_FREEZE 4
+#define MOVE_EFFECT_PARALYSIS 5
+#define MOVE_EFFECT_TOXIC 6
+#define PRIMARY_STATUS_MOVE_EFFECT MOVE_EFFECT_TOXIC // All above move effects apply primary status
+#define MOVE_EFFECT_CONFUSION 7
+#define MOVE_EFFECT_FLINCH 8
+#define MOVE_EFFECT_TRI_ATTACK 9
+#define MOVE_EFFECT_UPROAR 10
+#define MOVE_EFFECT_PAYDAY 11
+#define MOVE_EFFECT_CHARGING 12
+#define MOVE_EFFECT_WRAP 13
+#define MOVE_EFFECT_RECOIL_25 14
+#define MOVE_EFFECT_ATK_PLUS_1 15
+#define MOVE_EFFECT_DEF_PLUS_1 16
+#define MOVE_EFFECT_SPD_PLUS_1 17
+#define MOVE_EFFECT_SP_ATK_PLUS_1 18
+#define MOVE_EFFECT_SP_DEF_PLUS_1 19
+#define MOVE_EFFECT_ACC_PLUS_1 20
+#define MOVE_EFFECT_EVS_PLUS_1 21
+#define MOVE_EFFECT_ATK_MINUS_1 22
+#define MOVE_EFFECT_DEF_MINUS_1 23
+#define MOVE_EFFECT_SPD_MINUS_1 24
+#define MOVE_EFFECT_SP_ATK_MINUS_1 25
+#define MOVE_EFFECT_SP_DEF_MINUS_1 26
+#define MOVE_EFFECT_ACC_MINUS_1 27
+#define MOVE_EFFECT_EVS_MINUS_1 28
+#define MOVE_EFFECT_RECHARGE 29
+#define MOVE_EFFECT_RAGE 30
+#define MOVE_EFFECT_STEAL_ITEM 31
+#define MOVE_EFFECT_PREVENT_ESCAPE 32
+#define MOVE_EFFECT_NIGHTMARE 33
+#define MOVE_EFFECT_ALL_STATS_UP 34
+#define MOVE_EFFECT_RAPIDSPIN 35
+#define MOVE_EFFECT_REMOVE_PARALYSIS 36
+#define MOVE_EFFECT_ATK_DEF_DOWN 37
+#define MOVE_EFFECT_RECOIL_33 38
+#define MOVE_EFFECT_ATK_PLUS_2 39
+#define MOVE_EFFECT_DEF_PLUS_2 40
+#define MOVE_EFFECT_SPD_PLUS_2 41
+#define MOVE_EFFECT_SP_ATK_PLUS_2 42
+#define MOVE_EFFECT_SP_DEF_PLUS_2 43
+#define MOVE_EFFECT_ACC_PLUS_2 44
+#define MOVE_EFFECT_EVS_PLUS_2 45
+#define MOVE_EFFECT_ATK_MINUS_2 46
+#define MOVE_EFFECT_DEF_MINUS_2 47
+#define MOVE_EFFECT_SPD_MINUS_2 48
+#define MOVE_EFFECT_SP_ATK_MINUS_2 49
+#define MOVE_EFFECT_SP_DEF_MINUS_2 50
+#define MOVE_EFFECT_ACC_MINUS_2 51
+#define MOVE_EFFECT_EVS_MINUS_2 52
+#define MOVE_EFFECT_THRASH 53
+#define MOVE_EFFECT_KNOCK_OFF 54
+#define MOVE_EFFECT_NOTHING_37 55
+#define MOVE_EFFECT_NOTHING_38 56
+#define MOVE_EFFECT_NOTHING_39 57
+#define MOVE_EFFECT_NOTHING_3A 58
+#define MOVE_EFFECT_SP_ATK_TWO_DOWN 59
+#define NUM_MOVE_EFFECTS 60
+
+#define MOVE_EFFECT_AFFECTS_USER (1 << 6) // 64
+#define MOVE_EFFECT_CERTAIN (1 << 7) // 128
// Battle terrain defines for gBattleTerrain.
#define BATTLE_TERRAIN_GRASS 0
diff --git a/include/constants/battle_palace.h b/include/constants/battle_palace.h
index db9855101..851655089 100644
--- a/include/constants/battle_palace.h
+++ b/include/constants/battle_palace.h
@@ -16,4 +16,14 @@
#define PALACE_DATA_WIN_STREAK 1
#define PALACE_DATA_WIN_STREAK_ACTIVE 2
+// Pokemon in Battle Palace have a move "group" type preference depending on nature
+#define PALACE_MOVE_GROUP_ATTACK 0
+#define PALACE_MOVE_GROUP_DEFENSE 1
+#define PALACE_MOVE_GROUP_SUPPORT 2
+
+// In palace doubles battles pokemon have a target preference depending on nature
+#define PALACE_TARGET_STRONGER 0
+#define PALACE_TARGET_WEAKER 1
+#define PALACE_TARGET_RANDOM 2
+
#endif //GUARD_CONSTANTS_BATTLE_PALACE_H
diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h
index dfcf79128..9372377c4 100644
--- a/include/constants/battle_script_commands.h
+++ b/include/constants/battle_script_commands.h
@@ -66,8 +66,10 @@
#define VARIOUS_SET_MAGIC_COAT_TARGET 1
#define VARIOUS_IS_RUNNING_IMPOSSIBLE 2
#define VARIOUS_GET_MOVE_TARGET 3
+#define VARIOUS_GET_BATTLER_FAINTED 4
#define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5
#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
+#define VARIOUS_PALACE_FLAVOR_TEXT 8
#define VARIOUS_ARENA_JUDGMENT_WINDOW 9
#define VARIOUS_ARENA_OPPONENT_MON_LOST 10
#define VARIOUS_ARENA_PLAYER_MON_LOST 11
diff --git a/include/constants/cable_club.h b/include/constants/cable_club.h
index f2aa4120c..cbdd049db 100644
--- a/include/constants/cable_club.h
+++ b/include/constants/cable_club.h
@@ -12,4 +12,20 @@
#define USING_MINIGAME 8
#define USING_BATTLE_TOWER 9
+// Return states for the group of specials that use CreateLinkupTask
+// A few also used by TryBecomeLinkLeader and TryJoinLinkGroup
+#define LINKUP_ONGOING 0
+#define LINKUP_SUCCESS 1
+#define LINKUP_SOMEONE_NOT_READY 2
+#define LINKUP_DIFF_SELECTIONS 3
+#define LINKUP_WRONG_NUM_PLAYERS 4
+#define LINKUP_FAILED 5
+#define LINKUP_CONNECTION_ERROR 6
+#define LINKUP_PLAYER_NOT_READY 7
+#define LINKUP_RETRY_ROLE_ASSIGN 8
+#define LINKUP_PARTNER_NOT_READY 9
+#define LINKUP_FAILED_CONTEST_GMODE 10
+#define LINKUP_FAILED_BATTLE_TOWER 11
+#define LINKUP_FOREIGN_GAME 12
+
#endif //GUARD_CONSTANTS_CABLE_CLUB_H
diff --git a/include/constants/contest.h b/include/constants/contest.h
index 186c56e2b..2de2866a3 100644
--- a/include/constants/contest.h
+++ b/include/constants/contest.h
@@ -29,6 +29,23 @@
#define CONTEST_CATEGORY_TOUGH 4
#define CONTEST_CATEGORIES_COUNT 5
+#define CONTEST_WINNER_ARTIST 0 // Winner shown by the artist, painting not necessarily saved
+#define CONTEST_WINNER_HALL_1 1
+#define CONTEST_WINNER_HALL_2 2
+#define CONTEST_WINNER_HALL_3 3
+#define CONTEST_WINNER_HALL_4 4
+#define CONTEST_WINNER_HALL_5 5
+#define CONTEST_WINNER_HALL_6 6
+#define NUM_CONTEST_HALL_WINNERS 6
+#define CONTEST_WINNER_7 7
+#define CONTEST_WINNER_8 8
+#define CONTEST_WINNER_MUSEUM_COOL 9
+#define CONTEST_WINNER_MUSEUM_BEAUTY 10
+#define CONTEST_WINNER_MUSEUM_CUTE 11
+#define CONTEST_WINNER_MUSEUM_SMART 12
+#define CONTEST_WINNER_MUSEUM_TOUGH 13
+// NUM_CONTEST_WINNERS in constants/global.h
+
#define CANT_ENTER_CONTEST 0
#define CAN_ENTER_CONTEST_EQUAL_RANK 1
#define CAN_ENTER_CONTEST_HIGH_RANK 2
diff --git a/include/constants/field_specials.h b/include/constants/field_specials.h
index a2dc117e4..a01151378 100644
--- a/include/constants/field_specials.h
+++ b/include/constants/field_specials.h
@@ -75,4 +75,9 @@
#define FANCLUB_MEMBER7 14
#define FANCLUB_MEMBER8 15
+#define FANCOUNTER_DEFEATED_DRAKE 0
+#define FANCOUNTER_BATTLED_AT_BASE 1
+#define FANCOUNTER_FINISHED_CONTEST 2
+#define FANCOUNTER_USED_BATTLE_TOWER 3
+
#endif // GUARD_CONSTANTS_FIELD_SPECIALS_H
diff --git a/include/constants/flags.h b/include/constants/flags.h
index 4dd18880f..e1a88283a 100644
--- a/include/constants/flags.h
+++ b/include/constants/flags.h
@@ -961,10 +961,10 @@
#define FLAG_HIDE_MT_PYRE_SUMMIT_ARCHIE 0x394
#define FLAG_HIDE_MT_PYRE_SUMMIT_TEAM_AQUA 0x395
#define FLAG_HIDE_BATTLE_TOWER_REPORTER 0x396
-#define FLAG_HIDE_ROUTE_110_RIVAL_1 0x397
+#define FLAG_HIDE_ROUTE_110_RIVAL 0x397
#define FLAG_HIDE_CHAMPIONS_ROOM_RIVAL 0x398
#define FLAG_HIDE_CHAMPIONS_ROOM_BIRCH 0x399
-#define FLAG_HIDE_ROUTE_110_RIVAL_2 0x39A
+#define FLAG_HIDE_ROUTE_110_RIVAL_ON_BIKE 0x39A
#define FLAG_HIDE_ROUTE_119_RIVAL_ON_BIKE 0x39B
#define FLAG_HIDE_AQUA_HIDEOUT_GRUNTS 0x39C
#define FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS 0x39D
@@ -1573,7 +1573,9 @@
#define FLAG_UNUSED_0x91F (SYSTEM_FLAGS + 0xBF) // Unused Flag
// Daily Flags
-#define DAILY_FLAGS_START 0x920
+// These flags are cleared once per day
+// The start and end are byte-aligned because the flags are cleared in byte increments
+#define DAILY_FLAGS_START (FLAG_UNUSED_0x91F + (8 - FLAG_UNUSED_0x91F % 8))
#define FLAG_UNUSED_0x920 (DAILY_FLAGS_START + 0x0) // Unused Flag
#define FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY (DAILY_FLAGS_START + 0x1)
#define FLAG_DAILY_SECRET_BASE (DAILY_FLAGS_START + 0x2)
@@ -1639,7 +1641,9 @@
#define FLAG_UNUSED_0x95D (DAILY_FLAGS_START + 0x3D) // Unused Flag
#define FLAG_UNUSED_0x95E (DAILY_FLAGS_START + 0x3E) // Unused Flag
#define FLAG_UNUSED_0x95F (DAILY_FLAGS_START + 0x3F) // Unused Flag
-#define DAILY_FLAGS_END FLAG_UNUSED_0x95F
+#define DAILY_FLAGS_END (FLAG_UNUSED_0x95F + (7 - FLAG_UNUSED_0x95F % 8))
+
+#define FLAGS_COUNT (DAILY_FLAGS_END + 1)
// Special Flags (Stored in EWRAM (gSpecialFlags), not in the SaveBlock)
#define SPECIAL_FLAGS_START 0x4000
diff --git a/include/constants/global.h b/include/constants/global.h
index c7063d71c..98f15e7dc 100644
--- a/include/constants/global.h
+++ b/include/constants/global.h
@@ -34,8 +34,6 @@
#define POKEBLOCKS_COUNT 40
#define OBJECT_EVENTS_COUNT 16
#define BERRY_TREES_COUNT 128
-#define FLAGS_COUNT 300
-#define VARS_COUNT 256
#define MAIL_COUNT 16
#define SECRET_BASES_COUNT 20
#define TV_SHOWS_COUNT 25
@@ -52,6 +50,8 @@
#define APPRENTICE_COUNT 4
#define APPRENTICE_MAX_QUESTIONS 9
#define MAX_REMATCH_ENTRIES 100 // only REMATCH_TABLE_ENTRIES (78) are used
+#define NUM_CONTEST_WINNERS 13
+#define UNION_ROOM_KB_ROW_COUNT 10
#define PYRAMID_BAG_ITEMS_COUNT 10
#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode.
diff --git a/include/constants/items.h b/include/constants/items.h
index fafcac8b1..ba4d3c49e 100644
--- a/include/constants/items.h
+++ b/include/constants/items.h
@@ -17,6 +17,8 @@
#define ITEM_LUXURY_BALL 11
#define ITEM_PREMIER_BALL 12
+#define LAST_BALL ITEM_PREMIER_BALL
+
// Pokemon Items
#define ITEM_POTION 13
#define ITEM_ANTIDOTE 14
diff --git a/include/constants/opponents.h b/include/constants/opponents.h
index cd35cf6b7..c9cf9239d 100644
--- a/include/constants/opponents.h
+++ b/include/constants/opponents.h
@@ -859,6 +859,7 @@
// NOTE: Because each Trainer uses a flag to determine when they are defeated, there is only space for 9 additional trainers before trainer flag space overflows
// More space can be made by shifting flags around in constants/flags.h or changing how trainer flags are handled
+// MAX_TRAINERS_COUNT can be increased but will take up additional saveblock space
#define TRAINERS_COUNT 855
#define MAX_TRAINERS_COUNT 864
diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h
index b5c60f64d..0d8fc6a57 100644
--- a/include/constants/pokemon.h
+++ b/include/constants/pokemon.h
@@ -69,6 +69,7 @@
#define NATURE_SASSY 22
#define NATURE_CAREFUL 23
#define NATURE_QUIRKY 24
+#define NUM_NATURES 25
// Pokemon Stats
#define STAT_HP 0
@@ -80,7 +81,7 @@
#define STAT_ACC 6 // Only in battles.
#define STAT_EVASION 7 // Only in battles.
-#define NUM_EV_STATS NUM_STATS - 1 // excludes HP
+#define NUM_NATURE_STATS NUM_STATS - 1 // excludes HP
#define NUM_BATTLE_STATS NUM_STATS + 2 // includes Accuracy and Evasion
// Shiny odds
diff --git a/include/constants/trainers.h b/include/constants/trainers.h
index 541b131ca..3f22c7cef 100644
--- a/include/constants/trainers.h
+++ b/include/constants/trainers.h
@@ -13,7 +13,7 @@
#define TRAINER_PLAYER 1023
#define TRAINER_SECRET_BASE 1024
#define TRAINER_LINK_OPPONENT 2048
-#define TRAINER_OPPONENT_C00 3072
+#define TRAINER_UNION_ROOM 3072
#define TRAINER_STEVEN_PARTNER 3075
#define TRAINER_PIC_HIKER 0
diff --git a/include/constants/union_room.h b/include/constants/union_room.h
index 2314f85a0..d867fb340 100644
--- a/include/constants/union_room.h
+++ b/include/constants/union_room.h
@@ -1,6 +1,60 @@
#ifndef GUARD_CONSTANTS_UNION_ROOM_H
#define GUARD_CONSTANTS_UNION_ROOM_H
+#define MAX_UNION_ROOM_PLAYERS 8
+
+#define UNION_ROOM_SPAWN_NONE 0
+#define UNION_ROOM_SPAWN_IN 1
+#define UNION_ROOM_SPAWN_OUT 2
+
+#define ACTIVITY_NONE 0
+#define ACTIVITY_BATTLE_SINGLE 1
+#define ACTIVITY_BATTLE_DOUBLE 2
+#define ACTIVITY_BATTLE_MULTI 3
+#define ACTIVITY_TRADE 4
+#define ACTIVITY_CHAT 5
+#define ACTIVITY_WONDER_CARD 6
+#define ACTIVITY_WONDER_NEWS 7
+#define ACTIVITY_CARD 8
+#define ACTIVITY_POKEMON_JUMP 9
+#define ACTIVITY_BERRY_CRUSH 10
+#define ACTIVITY_BERRY_PICK 11
+#define ACTIVITY_SEARCH 12
+#define ACTIVITY_SPIN_TRADE 13
+#define ACTIVITY_BATTLE_TOWER_OPEN 14
+#define ACTIVITY_RECORD_CORNER 15
+#define ACTIVITY_BERRY_BLENDER 16
+
+// Player response
+#define ACTIVITY_ACCEPT 17
+#define ACTIVITY_DECLINE 18
+
+#define ACTIVITY_NPCTALK 19
+#define ACTIVITY_PLYRTALK 20
+
+// Duplicate IDs?
+#define ACTIVITY_WONDER_CARD2 21
+#define ACTIVITY_WONDER_NEWS2 22
+
+#define ACTIVITY_CONTEST_COOL 23
+#define ACTIVITY_CONTEST_BEAUTY 24
+#define ACTIVITY_CONTEST_CUTE 25
+#define ACTIVITY_CONTEST_SMART 26
+#define ACTIVITY_CONTEST_TOUGH 27
+#define ACTIVITY_BATTLE_TOWER 28
+#define ACTIVITY_29 29
+
+#define IN_UNION_ROOM (1 << 6)
+
+// Used in UR_AddTextPrinterParameterized
+#define UR_COLOR_DKE_WHT_LTE 0
+#define UR_COLOR_RED_WHT_LTR 1
+#define UR_COLOR_GRN_WHT_LTG 2
+#define UR_COLOR_WHT_WHT_LTE 3
+#define UR_COLOR_WHT_DKE_LTE 4
+#define UR_COLOR_GRN_DN6_LTB 5
+#define UR_COLOR_DN5_DN6_LTB 6
+
#define LINK_GROUP_SINGLE_BATTLE 0
#define LINK_GROUP_DOUBLE_BATTLE 1
#define LINK_GROUP_MULTI_BATTLE 2
@@ -10,8 +64,8 @@
#define LINK_GROUP_BERRY_PICKING 6
#define LINK_GROUP_WONDER_CARD 7
#define LINK_GROUP_WONDER_NEWS 8
-#define LINK_GROUP_UNK_9 9
-#define LINK_GROUP_UNK_10 10
+#define LINK_GROUP_UNION_ROOM_RESUME 9
+#define LINK_GROUP_UNION_ROOM_INIT 10
#define LINK_GROUP_UNK_11 11
#define LINK_GROUP_RECORD_CORNER 12
#define LINK_GROUP_BERRY_BLENDER 13
@@ -25,4 +79,24 @@
#define LINK_GROUP_BATTLE_TOWER_OPEN 21
#define NUM_LINK_GROUP_TYPES 22
+#define UR_TRADE_MATCH 0
+#define UR_TRADE_NOTYPE 1
+#define UR_TRADE_NOEGG 2
+
+#define UR_TRADE_READY 0
+#define UR_TRADE_PLAYER_NOT_READY 1
+#define UR_TRADE_PARTNER_NOT_READY 2
+
+#define UR_INTERACT_PLAYER_1 1
+#define UR_INTERACT_PLAYER_2 2
+#define UR_INTERACT_PLAYER_3 3
+#define UR_INTERACT_PLAYER_4 4
+#define UR_INTERACT_PLAYER_5 5
+#define UR_INTERACT_PLAYER_6 6
+#define UR_INTERACT_PLAYER_7 7
+#define UR_INTERACT_PLAYER_8 8
+#define UR_INTERACT_ATTENDANT 9
+#define UR_INTERACT_UNUSED 10
+#define UR_INTERACT_START_MENU 11
+
#endif //GUARD_CONSTANTS_UNION_ROOM_H
diff --git a/include/constants/vars.h b/include/constants/vars.h
index 4a38bde81..625c37aa9 100644
--- a/include/constants/vars.h
+++ b/include/constants/vars.h
@@ -274,6 +274,7 @@
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
#define VARS_END 0x40FF
+#define VARS_COUNT (VARS_END - VARS_START + 1)
#define SPECIAL_VARS_START 0x8000
// special vars