From b7d75cb6151b5b43a3c467c61b2c93e877db4a00 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 6 Sep 2017 21:11:10 +0200 Subject: [PATCH] split item effects and organize sym ewram --- asm/battle_3.s | 16 +- asm/battle_4.s | 20 +- asm/battle_5.s | 2 +- asm/battle_7.s | 4 +- asm/battle_9.s | 4 +- asm/battle_controller_linkopponent.s | 10 +- asm/battle_controller_linkpartner.s | 10 +- asm/battle_controller_opponent.s | 8 +- asm/battle_controller_player.s | 18 +- asm/battle_controller_player_partner.s | 8 +- asm/battle_controller_recorded_opponent.s | 6 +- asm/battle_controller_recorded_player.s | 6 +- asm/battle_controller_safari.s | 2 +- asm/battle_controller_wally.s | 6 +- asm/battle_message.s | 4 +- asm/pokemon_3.s | 1971 +-------------------- asm/pokemon_item_effect.s | 1967 ++++++++++++++++++++ asm/recorded_battle.s | 8 +- asm/rom_8034C54.s | 12 +- asm/rom_8161F74.s | 2 +- asm/rom_817C95C.s | 2 +- asm/rom_818CFC8.s | 6 +- data/item_effect_info.inc | 2 +- ld_script.txt | 1 + src/battle_ai.c | 2 +- sym_ewram.txt | 47 +- 26 files changed, 2058 insertions(+), 2086 deletions(-) create mode 100644 asm/pokemon_item_effect.s diff --git a/asm/battle_3.s b/asm/battle_3.s index ec82b6de2..a94e60707 100644 --- a/asm/battle_3.s +++ b/asm/battle_3.s @@ -479,7 +479,7 @@ _0803FF2E: adds r6, r7, 0 muls r6, r2 str r6, [sp, 0x8] - ldr r2, =gUnknown_02024090 + ldr r2, =gBattleMons + 0xC adds r5, r6, r2 movs r6, 0 str r6, [sp, 0x10] @@ -538,7 +538,7 @@ _0803FFAC: muls r2, r0 ldr r1, [sp, 0x10] adds r0, r1, r2 - ldr r1, =gUnknown_02024090 + ldr r1, =gBattleMons + 0xC adds r0, r1 mov r12, r0 ldr r1, =gLastUsedMovesByBanks @@ -737,7 +737,7 @@ sub_8040130: @ 8040130 ldrb r0, [r0] cmp r6, r0 bge _080401B4 - ldr r7, =gUnknown_02024090 + ldr r7, =gBattleMons + 0xC mov r8, r7 _0804015A: lsls r0, r4, 24 @@ -3598,7 +3598,7 @@ b_clear_atk_up_if_hit_flag_unless_enraged: @ 8041A1C ldr r4, =gUnknown_02024274 movs r6, 0x80 lsls r6, 16 - ldr r2, =gUnknown_020240D4 + ldr r2, =gBattleMons + 0x50 _08041A32: ldr r1, [r2] adds r0, r1, 0 @@ -4545,7 +4545,7 @@ _08042388: ldrb r1, [r4] movs r0, 0x58 muls r0, r1 - ldr r1, =gUnknown_020240D0 + ldr r1, =gBattleMons + 0x4C adds r0, r1 str r0, [sp] movs r0, 0 @@ -7166,7 +7166,7 @@ _08043BFC: ldrb r1, [r4] movs r0, 0x58 muls r0, r1 - ldr r1, =gUnknown_020240D0 + ldr r1, =gBattleMons + 0x4C adds r0, r1 str r0, [sp] movs r0, 0 @@ -9315,7 +9315,7 @@ _08044EB4: movs r0, 0x58 muls r0, r7 adds r4, r0, 0x1 - ldr r5, =gUnknown_0202409C + ldr r5, =gBattleMons + 0x18 _08044EBC: bl Random lsls r0, 16 @@ -10158,7 +10158,7 @@ _0804567A: movs r0, 0x58 muls r0, r1 _0804568C: - ldr r1, =gUnknown_020240D0 + ldr r1, =gBattleMons + 0x4C adds r0, r1 str r0, [sp] movs r0, 0 diff --git a/asm/battle_4.s b/asm/battle_4.s index 1cfd47b15..d3e0c53d8 100644 --- a/asm/battle_4.s +++ b/asm/battle_4.s @@ -3958,7 +3958,7 @@ _0804823A: ldrb r1, [r5] movs r0, 0x58 muls r0, r1 - ldr r1, =gUnknown_020240AC + ldr r1, =gBattleMons + 0x28 adds r0, r1 str r0, [sp] movs r0, 0 @@ -5401,7 +5401,7 @@ _08048E64: ldrb r1, [r1] movs r0, 0x58 muls r0, r1 - ldr r1, =gUnknown_020240D0 + ldr r1, =gBattleMons + 0x4C adds r0, r1 str r0, [sp] movs r0, 0 @@ -10435,7 +10435,7 @@ _0804BA18: beq _0804BAC0 movs r0, 0x1 mov r10, r0 - ldr r0, =gUnknown_0202409C + ldr r0, =gBattleMons + 0x18 mov r9, r0 lsls r5, r1, 16 _0804BA26: @@ -10541,7 +10541,7 @@ _0804BAF8: mov r9, r5 cmp r4, 0 beq _0804BB34 - ldr r6, =gUnknown_0202409C + ldr r6, =gBattleMons + 0x18 adds r5, r2, 0 lsls r2, r1, 16 _0804BB04: @@ -11324,7 +11324,7 @@ _0804C1D8: ldr r2, =gDisableStructs ldr r5, =0xfeffffff adds r3, r0, 0 - ldr r1, =gUnknown_020240D4 + ldr r1, =gBattleMons + 0x50 _0804C1EA: ldrb r0, [r2, 0xA] cmp r0, 0 @@ -15608,13 +15608,13 @@ _0804E7AC: bne _0804E800 ldrb r0, [r6] lsls r0, 9 - ldr r1, =gUnknown_02023868 + ldr r1, =gBattleBufferB + 4 adds r0, r1 mov r12, r0 movs r2, 0 adds r4, r6, 0 movs r5, 0x58 - ldr r6, =gUnknown_020240A8 + ldr r6, =gBattleMons + 0x24 adds r7, r6, 0 subs r7, 0x18 mov r3, r12 @@ -22212,7 +22212,7 @@ _08052170: bls _08052170 movs r4, 0 ldr r7, =gBattleMoves - ldr r3, =gUnknown_02024090 + ldr r3, =gBattleMons + 0xC adds r5, r3, 0 adds r5, 0x18 _08052188: @@ -23955,7 +23955,7 @@ atkA9_sleeptalk_choose_move: @ 8053018 mov r9, r0 movs r1, 0x58 mov r8, r1 - ldr r7, =gUnknown_02024090 + ldr r7, =gBattleMons + 0xC movs r0, 0x84 lsls r0, 1 mov r10, r0 @@ -25908,7 +25908,7 @@ atkBD_copyfoestats: @ 8054134 ldr r7, =gBattlescriptCurrInstr ldr r6, =gBankAttacker movs r4, 0x58 - ldr r3, =gUnknown_0202409C + ldr r3, =gBattleMons + 0x18 ldr r5, =gBankTarget _08054142: ldrb r0, [r6] diff --git a/asm/battle_5.s b/asm/battle_5.s index 1ada4e0c6..3dd934ce4 100644 --- a/asm/battle_5.s +++ b/asm/battle_5.s @@ -555,7 +555,7 @@ _08057406: ldrb r1, [r4] movs r0, 0x58 muls r0, r1 - ldr r1, =gUnknown_020240D0 + ldr r1, =gBattleMons + 0x4C adds r0, r1 str r0, [sp] movs r0, 0 diff --git a/asm/battle_7.s b/asm/battle_7.s index 9fc2c3875..5c694b95c 100644 --- a/asm/battle_7.s +++ b/asm/battle_7.s @@ -80,7 +80,7 @@ sub_805D19C: @ 805D19C ldr r4, =gActiveBank ldrb r0, [r4] lsls r2, r0, 9 - ldr r1, =gUnknown_02023068 + ldr r1, =gBattleBufferA + 4 adds r2, r1 mov r10, r2 movs r1, 0 @@ -124,7 +124,7 @@ _0805D20E: ldrb r1, [r0] movs r0, 0x58 muls r0, r1 - ldr r1, =gUnknown_020240CC + ldr r1, =gBattleMons + 0x48 adds r0, r1 ldr r0, [r0] bl GetNatureFromPersonality diff --git a/asm/battle_9.s b/asm/battle_9.s index 3484ee157..f1811e1af 100644 --- a/asm/battle_9.s +++ b/asm/battle_9.s @@ -2367,7 +2367,7 @@ _08063F8E: bne _08063FA6 b _08064370 _08063FA6: - ldr r1, =gItemEffectInfoPointers + ldr r1, =gItemEffectTable subs r0, 0xD lsls r0, 2 adds r0, r1 @@ -2451,7 +2451,7 @@ _08064074: mov r0, r9 movs r1, 0x4 movs r2, 0x4 - bl sub_806CDDC + bl GetItemEffectParamOffset lsls r0, 24 lsrs r4, r0, 24 cmp r4, 0 diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index fc795d476..269ff82bd 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -2522,7 +2522,7 @@ sub_8065964: @ 8065964 ldr r3, =gActiveBank ldrb r0, [r3] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r4, r0, r2 adds r7, r4, 0 subs r1, r2, 0x2 @@ -5039,7 +5039,7 @@ sub_8066FF4: @ 8066FF4 ldr r5, =gActiveBank ldrb r4, [r5] lsls r4, 9 - ldr r0, =gUnknown_02023066 + ldr r0, =gBattleBufferA + 2 adds r4, r0 ldrh r0, [r4] bl BufferStringBattle @@ -5946,7 +5946,7 @@ _080677B4: adds r5, r7, 0 ldrb r0, [r5] lsls r3, r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r1, r3, r4 subs r2, r4, 0x3 adds r2, r3, r2 @@ -6177,7 +6177,7 @@ sub_80679A4: @ 80679A4 ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r1, =gUnknown_02023066 + ldr r1, =gBattleBufferA + 2 adds r0, r1 bl sub_81851A8 bl LinkOpponentBufferExecCompleted @@ -6200,7 +6200,7 @@ sub_80679D0: @ 80679D0 ldr r5, =gActiveBank ldrb r0, [r5] lsls r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r0, r4 bl sub_81851A8 ldrb r0, [r5] diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index 5916c47f4..80a846fdd 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -2063,7 +2063,7 @@ sub_814C09C: @ 814C09C ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r3, r0, r2 adds r6, r3, 0 subs r1, r2, 0x2 @@ -4348,7 +4348,7 @@ sub_814D590: @ 814D590 ldr r5, =gActiveBank ldrb r4, [r5] lsls r4, 9 - ldr r0, =gUnknown_02023066 + ldr r0, =gBattleBufferA + 2 adds r4, r0 ldrh r0, [r4] bl BufferStringBattle @@ -5341,7 +5341,7 @@ _0814DE08: strb r1, [r0] ldrb r0, [r5] lsls r3, r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r1, r3, r4 subs r2, r4, 0x3 adds r2, r3, r2 @@ -5571,7 +5571,7 @@ sub_814E014: @ 814E014 ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r1, =gUnknown_02023066 + ldr r1, =gBattleBufferA + 2 adds r0, r1 bl sub_81851A8 bl LinkPartnerBufferExecCompleted @@ -5594,7 +5594,7 @@ sub_814E040: @ 814E040 ldr r5, =gActiveBank ldrb r0, [r5] lsls r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r0, r4 bl sub_81851A8 ldr r2, =gBattleOutcome diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index e35398430..d9b1638c3 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -2672,7 +2672,7 @@ sub_8060890: @ 8060890 ldr r3, =gActiveBank ldrb r0, [r3] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r4, r0, r2 adds r7, r4, 0 subs r1, r2, 0x2 @@ -5179,7 +5179,7 @@ sub_8061F34: @ 8061F34 ldr r5, =gActiveBank ldrb r4, [r5] lsls r4, 9 - ldr r0, =gUnknown_02023066 + ldr r0, =gBattleBufferA + 2 adds r4, r0 ldrh r0, [r4] bl BufferStringBattle @@ -5252,7 +5252,7 @@ _08061FE4: ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r1, =gUnknown_02023068 + ldr r1, =gBattleBufferA + 4 adds r5, r0, r1 movs r0, 0x93 lsls r0, 3 @@ -6401,7 +6401,7 @@ _080629B4: adds r5, r7, 0 ldrb r0, [r5] lsls r3, r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r1, r3, r4 subs r2, r4, 0x3 adds r2, r3, r2 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 0e387692d..d8ee0ed34 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -856,7 +856,7 @@ sub_8057BFC: @ 8057BFC ldr r3, =gActiveBank ldrb r0, [r3] lsls r0, 9 - ldr r1, =gUnknown_02023068 + ldr r1, =gBattleBufferA + 4 adds r6, r0, r1 ldr r2, =gMain ldrh r1, [r2, 0x2C] @@ -1471,7 +1471,7 @@ _08058152: b _080584A8 _08058170: lsls r1, 9 - ldr r0, =gUnknown_02023068 + ldr r0, =gBattleBufferA + 4 adds r1, r0 mov r9, r1 ldrb r1, [r2] @@ -4332,7 +4332,7 @@ sub_8059AAC: @ 8059AAC ldr r0, =gActiveBank ldrb r1, [r0] lsls r1, 9 - ldr r3, =gUnknown_02023068 + ldr r3, =gBattleBufferA + 4 ldr r2, =gUnknown_03005D78 movs r0, 0 strb r0, [r2] @@ -4446,7 +4446,7 @@ sub_8059BB0: @ 8059BB0 ldr r5, =gActiveBank ldrb r4, [r5] lsls r4, 9 - ldr r0, =gUnknown_02023068 + ldr r0, =gBattleBufferA + 4 adds r4, r0 ldr r6, =gUnknown_02022E2C ldr r1, =gUnknown_085CCA73 @@ -5778,7 +5778,7 @@ dp01_setattr_by_ch1_for_player_pokemon: @ 805A6F4 ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r3, r0, r2 adds r6, r3, 0 subs r1, r2, 0x2 @@ -8452,7 +8452,7 @@ sub_805BF80: @ 805BF80 ldr r5, =gActiveBank ldrb r4, [r5] lsls r4, 9 - ldr r0, =gUnknown_02023066 + ldr r0, =gBattleBufferA + 2 adds r4, r0 ldrh r0, [r4] bl BufferStringBattle @@ -10030,7 +10030,7 @@ _0805CDA4: strb r1, [r0] ldrb r0, [r5] lsls r3, r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r1, r3, r4 subs r2, r4, 0x3 adds r2, r3, r2 @@ -10269,7 +10269,7 @@ dp01t_35_1_link_standby_message_and_free_vram: @ 805CFC8 ldr r5, =gActiveBank ldrb r0, [r5] lsls r0, 9 - ldr r4, =gUnknown_02023066 + ldr r4, =gBattleBufferA + 2 adds r0, r4 bl sub_81851A8 ldrb r0, [r5] @@ -10366,7 +10366,7 @@ sub_805D094: @ 805D094 ldr r5, =gActiveBank ldrb r0, [r5] lsls r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r0, r4 bl sub_81851A8 ldr r2, =gBattleOutcome diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index ef8ffd8fb..9438511e9 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -2638,7 +2638,7 @@ sub_81BC4E8: @ 81BC4E8 ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r3, r0, r2 adds r6, r3, 0 subs r1, r2, 0x2 @@ -4960,7 +4960,7 @@ sub_81BDA4C: @ 81BDA4C ldr r4, =gActiveBank ldrb r0, [r4] lsls r0, 9 - ldr r1, =gUnknown_02023066 + ldr r1, =gBattleBufferA + 2 adds r0, r1 ldrh r0, [r0] bl BufferStringBattle @@ -5010,7 +5010,7 @@ sub_81BDAC8: @ 81BDAC8 ldr r6, =gActiveBank ldrb r4, [r6] lsls r4, 9 - ldr r0, =gUnknown_02023068 + ldr r0, =gBattleBufferA + 4 adds r4, r0 movs r0, 0xF bl BattleAI_SetupAIData @@ -6074,7 +6074,7 @@ _081BE404: strb r1, [r0] ldrb r0, [r5] lsls r3, r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r1, r3, r4 subs r2, r4, 0x3 adds r2, r3, r2 diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index c8fc24c00..fd849d50f 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -2503,7 +2503,7 @@ dp01_setattr_for_opponent_pokemon: @ 8187AA8 ldr r3, =gActiveBank ldrb r0, [r3] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r4, r0, r2 adds r7, r4, 0 subs r1, r2, 0x2 @@ -4716,7 +4716,7 @@ sub_8188E90: @ 8188E90 ldr r4, =gActiveBank ldrb r0, [r4] lsls r0, 9 - ldr r1, =gUnknown_02023066 + ldr r1, =gBattleBufferA + 2 adds r0, r1 ldrh r0, [r0] bl BufferStringBattle @@ -5685,7 +5685,7 @@ _081896E4: adds r5, r7, 0 ldrb r0, [r5] lsls r3, r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r1, r3, r4 subs r2, r4, 0x3 adds r2, r3, r2 diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index ff0bf98c6..d7b0d03de 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -2439,7 +2439,7 @@ sub_818AE70: @ 818AE70 ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r3, r0, r2 adds r6, r3, 0 subs r1, r2, 0x2 @@ -4816,7 +4816,7 @@ sub_818C43C: @ 818C43C ldr r4, =gActiveBank ldrb r0, [r4] lsls r0, 9 - ldr r1, =gUnknown_02023066 + ldr r1, =gBattleBufferA + 2 adds r0, r1 ldrh r0, [r0] bl BufferStringBattle @@ -5870,7 +5870,7 @@ _0818CD60: strb r1, [r0] ldrb r0, [r5] lsls r3, r0, 9 - ldr r4, =gUnknown_02023068 + ldr r4, =gBattleBufferA + 4 adds r1, r3, r4 subs r2, r4, 0x3 adds r2, r3, r2 diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index cf916434d..67c1db71d 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -786,7 +786,7 @@ dp01t_10_6_message: @ 81599DC ldr r4, =gActiveBank ldrb r0, [r4] lsls r0, 9 - ldr r1, =gUnknown_02023066 + ldr r1, =gBattleBufferA + 2 adds r0, r1 ldrh r0, [r0] bl BufferStringBattle diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index e91f7d858..3ea81bac6 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -1925,7 +1925,7 @@ sub_8169424: @ 8169424 ldr r0, =gActiveBank ldrb r0, [r0] lsls r0, 9 - ldr r2, =gUnknown_02023067 + ldr r2, =gBattleBufferA + 3 adds r3, r0, r2 adds r6, r3, 0 subs r1, r2, 0x2 @@ -3600,7 +3600,7 @@ sub_816A3B8: @ 816A3B8 ldr r4, =gActiveBank ldrb r0, [r4] lsls r0, 9 - ldr r1, =gUnknown_02023066 + ldr r1, =gBattleBufferA + 2 adds r0, r1 ldrh r0, [r0] bl BufferStringBattle @@ -4637,7 +4637,7 @@ _0816ACA8: strb r1, [r0] ldrb r0, [r5] lsls r4, r0, 9 - ldr r3, =gUnknown_02023068 + ldr r3, =gBattleBufferA + 4 adds r1, r4, r3 subs r2, r3, 0x3 adds r2, r4, r2 diff --git a/asm/battle_message.s b/asm/battle_message.s index d6f2ef3b6..70172ac0a 100644 --- a/asm/battle_message.s +++ b/asm/battle_message.s @@ -20,7 +20,7 @@ BufferStringBattle: @ 814E0C4 mov r8, r0 ldrb r1, [r0] lsls r1, 9 - ldr r0, =gUnknown_02023068 + ldr r0, =gBattleBufferA + 4 adds r1, r0 str r1, [r4] ldr r2, =gLastUsedItem @@ -2995,7 +2995,7 @@ sub_814FBAC: @ 814FBAC ldr r0, =gActiveBank ldrb r2, [r0] lsls r1, r2, 9 - ldr r0, =gUnknown_02023068 + ldr r0, =gBattleBufferA + 4 adds r1, r0 ldr r4, =gUnknown_08D85620 ldr r0, =gUnknown_020244B0 diff --git a/asm/pokemon_3.s b/asm/pokemon_3.s index 850179fc9..f03b898d9 100644 --- a/asm/pokemon_3.s +++ b/asm/pokemon_3.s @@ -5,1963 +5,6 @@ .text - thumb_func_start ExecuteTableBasedItemEffect_ -@ bool8 ExecuteTableBasedItemEffect_(struct pokemon *mon, u16 itemId, u8 a3, u8 monMoveIndex) -ExecuteTableBasedItemEffect_: @ 806BD04 - push {r4,lr} - sub sp, 0x4 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - movs r4, 0 - str r4, [sp] - bl ExecuteTableBasedItemEffect - lsls r0, 24 - lsrs r0, 24 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end ExecuteTableBasedItemEffect_ - - thumb_func_start ExecuteTableBasedItemEffect -@ bool8 ExecuteTableBasedItemEffect(struct pokemon *mon, u16 itemId, u8 a3, u8 monMoveIndex, u8 a5) -ExecuteTableBasedItemEffect: @ 806BD28 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x44 - mov r8, r0 - ldr r0, [sp, 0x64] - lsls r1, 16 - lsrs r1, 16 - str r1, [sp, 0xC] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x10] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x18] - movs r0, 0x1 - str r0, [sp, 0x20] - movs r1, 0x6 - str r1, [sp, 0x28] - movs r2, 0 - str r2, [sp, 0x30] - movs r3, 0x4 - str r3, [sp, 0x38] - movs r5, 0 - str r5, [sp, 0x3C] - mov r0, r8 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAF - bne _0806BDBC - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806BDA8 - ldr r2, =gEnigmaBerries - ldr r0, =gUnknown_020244B8 - ldrb r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x7] - b _0806BDC4 - .pool -_0806BDA8: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003226 - adds r0, r2 - ldrb r0, [r0] - b _0806BDC4 - .pool -_0806BDBC: - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r0, 24 -_0806BDC4: - str r0, [sp, 0x34] - ldr r1, =gUnknown_0202420F - ldr r0, =gUnknown_020244B8 - ldrb r2, [r0] - strb r2, [r1] - ldr r0, =gMain - ldr r3, =0x00000439 - adds r0, r3 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _0806BE64 - ldr r0, =gActiveBank - strb r2, [r0] - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - negs r1, r0 - orrs r1, r0 - lsrs r1, 31 - str r1, [sp, 0x1C] - ldr r0, =gNoOfAllBanks - ldr r4, [sp, 0xC] - subs r4, 0xD - ldrb r0, [r0] - cmp r1, r0 - bge _0806BE70 - ldr r2, =gBattlePartyID - lsls r0, r1, 1 - adds r0, r2 - ldrh r3, [r0] - ldr r5, [sp, 0x10] - lsls r0, r5, 16 - lsrs r1, r0, 16 - adds r5, r0, 0 - cmp r3, r1 - bne _0806BE3C - ldr r0, [sp, 0x1C] - str r0, [sp, 0x38] - b _0806BE70 - .pool -_0806BE3C: - ldr r1, [sp, 0x1C] - adds r1, 0x2 - str r1, [sp, 0x1C] - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r1, r0 - bge _0806BE70 - lsls r0, r1, 1 - adds r0, r2 - ldrh r1, [r0] - lsrs r0, r5, 16 - cmp r1, r0 - bne _0806BE3C - ldr r2, [sp, 0x1C] - lsls r0, r2, 24 - lsrs r0, 24 - str r0, [sp, 0x38] - b _0806BE70 - .pool -_0806BE64: - ldr r0, =gActiveBank - strb r1, [r0] - movs r3, 0x4 - str r3, [sp, 0x38] - ldr r4, [sp, 0xC] - subs r4, 0xD -_0806BE70: - lsls r0, r4, 16 - lsrs r0, 16 - cmp r0, 0xA5 - bhi _0806BEF0 - ldr r1, =gItemEffectInfoPointers - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bne _0806BE94 - ldr r5, [sp, 0xC] - cmp r5, 0xAF - beq _0806BE9A - b _0806BEF0 - .pool -_0806BE94: - ldr r1, [sp, 0xC] - cmp r1, 0xAF - bne _0806BEF6 -_0806BE9A: - ldr r0, =gMain - ldr r2, =0x00000439 - adds r0, r2 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806BECC - ldr r0, =gActiveBank - ldrb r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - ldr r1, =gUnknown_0202440C - adds r0, r1 - b _0806BEF6 - .pool -_0806BECC: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r3, =0x00003214 - adds r3, r0, r3 - str r3, [sp, 0x24] - b _0806BEF8 - .pool -_0806BEE0: - mov r0, r8 - movs r2, 0 - ldr r3, [sp, 0x10] - bl sub_813DA40 - movs r0, 0 - bl _0806CD5C -_0806BEF0: - movs r0, 0x1 - bl _0806CD5C -_0806BEF6: - str r0, [sp, 0x24] -_0806BEF8: - movs r5, 0 - str r5, [sp, 0x1C] -_0806BEFC: - ldr r0, [sp, 0x1C] - cmp r0, 0x5 - bls _0806BF06 - bl _0806CD4C -_0806BF06: - lsls r0, 2 - ldr r1, =_0806BF14 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806BF14: - .4byte _0806BF2C - .4byte _0806BFFC - .4byte _0806C08C - .4byte _0806C120 - .4byte _0806C300 - .4byte _0806C9BE -_0806BF2C: - ldr r1, [sp, 0x24] - ldr r3, [sp, 0x1C] - adds r2, r1, r3 - ldrb r1, [r2] - movs r0, 0x80 - ands r0, r1 - adds r6, r2, 0 - cmp r0, 0 - beq _0806BF76 - ldr r0, =gMain - ldr r5, =0x00000439 - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806BF76 - ldr r0, [sp, 0x38] - cmp r0, 0x4 - beq _0806BF76 - ldr r1, =gBattleMons - movs r0, 0x58 - ldr r2, [sp, 0x38] - muls r0, r2 - adds r1, 0x50 - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0xF0 - lsls r0, 12 - ands r0, r1 - cmp r0, 0 - beq _0806BF76 - ldr r0, =0xfff0ffff - ands r1, r0 - str r1, [r2] - movs r3, 0 - str r3, [sp, 0x20] -_0806BF76: - ldrb r1, [r6] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0 - beq _0806BFA4 - ldr r1, =gBattleMons - ldr r0, =gActiveBank - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r1, 0x50 - adds r2, r0, r1 - ldr r1, [r2] - movs r3, 0x80 - lsls r3, 13 - adds r0, r1, 0 - ands r0, r3 - cmp r0, 0 - bne _0806BFA4 - orrs r1, r3 - str r1, [r2] - movs r5, 0 - str r5, [sp, 0x20] -_0806BFA4: - ldrb r0, [r6] - movs r3, 0xF - ands r3, r0 - cmp r3, 0 - bne _0806BFB2 - bl _0806CD4C -_0806BFB2: - ldr r6, =gBattleMons - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x58 - muls r0, r4 - adds r1, r0, r6 - ldrb r2, [r1, 0x19] - movs r0, 0x19 - ldrsb r0, [r1, r0] - cmp r0, 0xB - ble _0806BFCC - bl _0806CD4C -_0806BFCC: - adds r0, r2, r3 - strb r0, [r1, 0x19] - ldrb r0, [r5] - muls r0, r4 - adds r1, r0, r6 - movs r0, 0x19 - ldrsb r0, [r1, r0] - cmp r0, 0xC - bgt _0806BFE0 - b _0806C110 -_0806BFE0: - movs r0, 0xC - strb r0, [r1, 0x19] - b _0806C110 - .pool -_0806BFFC: - ldr r1, [sp, 0x24] - ldr r3, [sp, 0x1C] - adds r2, r1, r3 - ldrb r1, [r2] - movs r0, 0xF0 - ands r0, r1 - lsls r3, r0, 24 - adds r6, r2, 0 - cmp r3, 0 - beq _0806C042 - ldr r7, =gBattleMons - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x58 - muls r0, r4 - adds r1, r0, r7 - ldrb r2, [r1, 0x1A] - movs r0, 0x1A - ldrsb r0, [r1, r0] - cmp r0, 0xB - bgt _0806C042 - lsrs r0, r3, 28 - adds r0, r2, r0 - strb r0, [r1, 0x1A] - ldrb r0, [r5] - muls r0, r4 - adds r1, r0, r7 - movs r0, 0x1A - ldrsb r0, [r1, r0] - cmp r0, 0xC - ble _0806C03E - movs r0, 0xC - strb r0, [r1, 0x1A] -_0806C03E: - movs r5, 0 - str r5, [sp, 0x20] -_0806C042: - ldrb r0, [r6] - movs r3, 0xF - ands r3, r0 - cmp r3, 0 - bne _0806C050 - bl _0806CD4C -_0806C050: - ldr r6, =gBattleMons - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x58 - muls r0, r4 - adds r1, r0, r6 - ldrb r2, [r1, 0x1B] - movs r0, 0x1B - ldrsb r0, [r1, r0] - cmp r0, 0xB - ble _0806C06A - bl _0806CD4C -_0806C06A: - adds r0, r2, r3 - strb r0, [r1, 0x1B] - ldrb r0, [r5] - muls r0, r4 - adds r1, r0, r6 - movs r0, 0x1B - ldrsb r0, [r1, r0] - cmp r0, 0xC - ble _0806C110 - movs r0, 0xC - strb r0, [r1, 0x1B] - b _0806C110 - .pool -_0806C08C: - ldr r1, [sp, 0x24] - ldr r3, [sp, 0x1C] - adds r2, r1, r3 - ldrb r1, [r2] - movs r0, 0xF0 - ands r0, r1 - lsls r3, r0, 24 - adds r6, r2, 0 - cmp r3, 0 - beq _0806C0D2 - ldr r7, =gBattleMons - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x58 - muls r0, r4 - adds r1, r0, r7 - ldrb r2, [r1, 0x1E] - movs r0, 0x1E - ldrsb r0, [r1, r0] - cmp r0, 0xB - bgt _0806C0D2 - lsrs r0, r3, 28 - adds r0, r2, r0 - strb r0, [r1, 0x1E] - ldrb r0, [r5] - muls r0, r4 - adds r1, r0, r7 - movs r0, 0x1E - ldrsb r0, [r1, r0] - cmp r0, 0xC - ble _0806C0CE - movs r0, 0xC - strb r0, [r1, 0x1E] -_0806C0CE: - movs r5, 0 - str r5, [sp, 0x20] -_0806C0D2: - ldrb r0, [r6] - movs r3, 0xF - ands r3, r0 - cmp r3, 0 - bne _0806C0E0 - bl _0806CD4C -_0806C0E0: - ldr r6, =gBattleMons - ldr r5, =gActiveBank - ldrb r0, [r5] - movs r4, 0x58 - muls r0, r4 - adds r1, r0, r6 - ldrb r2, [r1, 0x1C] - movs r0, 0x1C - ldrsb r0, [r1, r0] - cmp r0, 0xB - ble _0806C0FA - bl _0806CD4C -_0806C0FA: - adds r0, r2, r3 - strb r0, [r1, 0x1C] - ldrb r0, [r5] - muls r0, r4 - adds r1, r0, r6 - movs r0, 0x1C - ldrsb r0, [r1, r0] - cmp r0, 0xC - ble _0806C110 - movs r0, 0xC - strb r0, [r1, 0x1C] -_0806C110: - movs r0, 0 - str r0, [sp, 0x20] - bl _0806CD4C - .pool -_0806C120: - ldr r1, [sp, 0x24] - ldr r3, [sp, 0x1C] - adds r2, r1, r3 - ldrb r1, [r2] - movs r0, 0x80 - ands r0, r1 - adds r6, r2, 0 - cmp r0, 0 - beq _0806C168 - ldr r5, =gSideTimers - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - bne _0806C168 - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - movs r0, 0x5 - strb r0, [r1, 0x4] - movs r5, 0 - str r5, [sp, 0x20] -_0806C168: - ldrb r1, [r6] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0806C1CA - mov r0, r8 - movs r1, 0x38 - movs r2, 0 - bl GetMonData - cmp r0, 0x64 - beq _0806C1CA - ldr r5, =gExperienceTables - mov r0, r8 - movs r1, 0x38 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - mov r0, r8 - movs r1, 0xB - movs r2, 0 - bl GetMonData - adds r4, 0x1 - lsls r4, 2 - ldr r2, =gBaseStats - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r1 - adds r4, r0 - adds r4, r5 - ldr r0, [r4] - str r0, [sp] - mov r0, r8 - movs r1, 0x19 - mov r2, sp - bl SetMonData - mov r0, r8 - bl CalculateMonStats - movs r0, 0 - str r0, [sp, 0x20] -_0806C1CA: - ldrb r1, [r6] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0806C206 - mov r0, r8 - ldr r1, [sp, 0x10] - movs r2, 0x7 - ldr r3, [sp, 0x38] - bl HealStatusConditions - lsls r0, 24 - cmp r0, 0 - bne _0806C206 - ldr r1, [sp, 0x38] - cmp r1, 0x4 - beq _0806C202 - ldr r1, =gBattleMons - movs r0, 0x58 - ldr r3, [sp, 0x38] - adds r2, r3, 0 - muls r2, r0 - adds r1, 0x50 - adds r2, r1 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] -_0806C202: - movs r5, 0 - str r5, [sp, 0x20] -_0806C206: - ldrb r1, [r6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0806C226 - ldr r2, =0x00000f88 - mov r0, r8 - ldr r1, [sp, 0x10] - ldr r3, [sp, 0x38] - bl HealStatusConditions - lsls r0, 24 - cmp r0, 0 - bne _0806C226 - movs r0, 0 - str r0, [sp, 0x20] -_0806C226: - ldrb r1, [r6] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0806C246 - mov r0, r8 - ldr r1, [sp, 0x10] - movs r2, 0x10 - ldr r3, [sp, 0x38] - bl HealStatusConditions - lsls r0, 24 - cmp r0, 0 - bne _0806C246 - movs r1, 0 - str r1, [sp, 0x20] -_0806C246: - ldrb r1, [r6] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0806C266 - mov r0, r8 - ldr r1, [sp, 0x10] - movs r2, 0x20 - ldr r3, [sp, 0x38] - bl HealStatusConditions - lsls r0, 24 - cmp r0, 0 - bne _0806C266 - movs r2, 0 - str r2, [sp, 0x20] -_0806C266: - ldrb r1, [r6] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806C286 - mov r0, r8 - ldr r1, [sp, 0x10] - movs r2, 0x40 - ldr r3, [sp, 0x38] - bl HealStatusConditions - lsls r0, 24 - cmp r0, 0 - bne _0806C286 - movs r3, 0 - str r3, [sp, 0x20] -_0806C286: - ldrb r1, [r6] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0806C294 - bl _0806CD4C -_0806C294: - ldr r0, =gMain - ldr r5, =0x00000439 - adds r0, r5 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0806C2A8 - bl _0806CD4C -_0806C2A8: - ldr r0, [sp, 0x38] - cmp r0, 0x4 - bne _0806C2B2 - bl _0806CD4C -_0806C2B2: - ldr r1, =gBattleMons - movs r0, 0x58 - ldr r2, [sp, 0x38] - muls r0, r2 - adds r1, 0x50 - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - bne _0806C2CC - bl _0806CD4C -_0806C2CC: - movs r0, 0x8 - negs r0, r0 - ands r1, r0 - str r1, [r2] - movs r3, 0 - str r3, [sp, 0x20] - bl _0806CD4C - .pool -_0806C300: - ldr r5, [sp, 0x24] - ldr r1, [sp, 0x1C] - adds r0, r5, r1 - ldrb r0, [r0] - mov r10, r0 - movs r0, 0x20 - mov r2, r10 - ands r0, r2 - cmp r0, 0 - beq _0806C3D8 - movs r0, 0xDF - ands r2, r0 - mov r10, r2 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - ldr r1, =gUnknown_08329D22 - ldr r3, [sp, 0x14] - adds r1, r3, r1 - ldrb r1, [r1] - ands r0, r1 - lsls r1, r3, 1 - lsrs r0, r1 - str r0, [sp] - adds r5, r3, 0 - adds r5, 0xD - mov r0, r8 - adds r1, r5, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - ldr r2, [sp, 0x14] - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x2C] - ldr r0, [sp] - cmp r0, 0x2 - bhi _0806C3D8 - ldr r0, [sp, 0x2C] - cmp r0, 0x4 - bls _0806C3D8 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - ldr r1, =gUnknown_08329D2A - ldr r2, [sp, 0x14] - adds r1, r2, r1 - ldrb r1, [r1] - adds r0, r1 - str r0, [sp] - mov r0, r8 - movs r1, 0x15 - mov r2, sp - bl SetMonData - mov r0, r8 - adds r1, r5, 0 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r1, [sp] - lsls r1, 24 - lsrs r1, 24 - ldr r2, [sp, 0x14] - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - ldr r3, [sp, 0x2C] - subs r0, r3 - str r0, [sp] - ldr r4, [sp, 0x14] - adds r4, 0x11 - mov r0, r8 - adds r1, r4, 0 - movs r2, 0 - bl GetMonData - ldr r1, [sp] - adds r0, r1 - str r0, [sp] - mov r0, r8 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - movs r5, 0 - str r5, [sp, 0x20] -_0806C3D8: - movs r0, 0 - str r0, [sp, 0x2C] - mov r1, r10 - cmp r1, 0 - bne _0806C3E6 - bl _0806CD4C -_0806C3E6: - movs r0, 0x1 - mov r2, r10 - ands r0, r2 - cmp r0, 0 - bne _0806C3F2 - b _0806C9AA -_0806C3F2: - ldr r3, [sp, 0x2C] - cmp r3, 0x7 - bls _0806C3FA - b _0806C9AA -_0806C3FA: - lsls r0, r3, 2 - ldr r1, =_0806C410 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806C410: - .4byte _0806C430 - .4byte _0806C430 - .4byte _0806C4DC - .4byte _0806C700 - .4byte _0806C9AA - .4byte _0806C9AA - .4byte _0806C9AA - .4byte _0806C994 -_0806C430: - mov r0, r8 - bl sub_806DC8C - lsls r0, 16 - lsrs r6, r0, 16 - ldr r5, [sp, 0x24] - ldr r1, [sp, 0x28] - adds r0, r5, r1 - ldrb r5, [r0] - ldr r0, =gUnknown_08329EC2 - ldr r2, [sp, 0x2C] - adds r0, r2, r0 - ldrb r1, [r0] - mov r0, r8 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - str r1, [sp, 0x4] - lsls r0, r5, 24 - asrs r2, r0, 24 - cmp r2, 0 - ble _0806C498 - ldr r0, =0x000001fd - cmp r6, r0 - bls _0806C466 - b _0806BEF0 -_0806C466: - adds r3, r1, 0 - cmp r3, 0x63 - ble _0806C46E - b _0806C9AA -_0806C46E: - adds r1, r3, r2 - cmp r1, 0x64 - ble _0806C484 - adds r0, r2, 0 - adds r0, 0x64 - subs r5, r0, r1 - b _0806C486 - .pool -_0806C484: - adds r5, r2, 0 -_0806C486: - adds r1, r6, r5 - movs r0, 0xFF - lsls r0, 1 - cmp r1, r0 - bls _0806C494 - adds r0, r5, r0 - subs r5, r0, r1 -_0806C494: - adds r0, r3, r5 - b _0806C4B2 -_0806C498: - cmp r1, 0 - bne _0806C4A8 - movs r3, 0x1 - str r3, [sp, 0x3C] - ldr r0, [sp, 0x28] - adds r0, 0x1 - lsls r0, 24 - b _0806C83E -_0806C4A8: - adds r0, r1, r2 - str r0, [sp, 0x4] - cmp r0, 0 - bge _0806C4B4 - movs r0, 0 -_0806C4B2: - str r0, [sp, 0x4] -_0806C4B4: - ldr r0, =gUnknown_08329EC2 - ldr r5, [sp, 0x2C] - adds r0, r5, r0 - ldrb r1, [r0] - add r2, sp, 0x4 - mov r0, r8 - bl SetMonData - mov r0, r8 - bl CalculateMonStats - ldr r0, [sp, 0x28] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x28] - b _0806C978 - .pool -_0806C4DC: - movs r0, 0x10 - mov r1, r10 - ands r0, r1 - cmp r0, 0 - beq _0806C59C - mov r0, r8 - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _0806C4FC - ldr r0, [sp, 0x28] - adds r0, 0x1 - lsls r0, 24 - b _0806C83E -_0806C4FC: - ldr r0, =gMain - ldr r2, =0x00000439 - adds r0, r2 - ldrb r1, [r0] - movs r4, 0x2 - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806C5B2 - ldr r3, [sp, 0x38] - cmp r3, 0x4 - beq _0806C55C - ldr r2, =gAbsentBankFlags - ldr r1, =gBitTable - lsls r0, r3, 2 - adds r0, r1 - ldr r1, [r0] - ldrb r0, [r2] - bics r0, r1 - strb r0, [r2] - ldr r1, =gBattlePartyID - lsls r0, r3, 1 - adds r0, r1 - ldrb r0, [r0] - bl pokemon_order_func - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, [sp, 0x38] - bl CopyPlayerPartyMonToBattleData - ldr r0, =gActiveBank - ldrb r0, [r0] - b _0806C574 - .pool -_0806C55C: - ldr r3, =gAbsentBankFlags - ldr r1, =gBitTable - ldr r2, =gActiveBank - ldrb r0, [r2] - eors r0, r4 - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldrb r0, [r3] - bics r0, r1 - strb r0, [r3] - ldrb r0, [r2] -_0806C574: - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0806C5B2 - ldr r1, =gBattleResults - ldrb r0, [r1, 0x4] - cmp r0, 0xFE - bhi _0806C5B2 - adds r0, 0x1 - strb r0, [r1, 0x4] - b _0806C5B2 - .pool -_0806C59C: - mov r0, r8 - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r0, 0 - bne _0806C5B2 - ldr r0, [sp, 0x28] - adds r0, 0x1 - lsls r0, 24 - b _0806C83E -_0806C5B2: - ldr r1, [sp, 0x28] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x28] - ldr r5, [sp, 0x24] - adds r1, r5, r1 - ldrb r1, [r1] - str r1, [sp] - adds r0, r1, 0 - cmp r0, 0xFE - beq _0806C5F4 - cmp r0, 0xFE - bhi _0806C5D4 - cmp r0, 0xFD - beq _0806C60A - b _0806C612 -_0806C5D4: - cmp r1, 0xFF - bne _0806C612 - mov r0, r8 - movs r1, 0x3A - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - mov r0, r8 - movs r1, 0x39 - movs r2, 0 - bl GetMonData - subs r4, r0 - str r4, [sp] - b _0806C612 -_0806C5F4: - mov r0, r8 - movs r1, 0x3A - movs r2, 0 - bl GetMonData - lsrs r0, 1 - str r0, [sp] - cmp r0, 0 - bne _0806C612 - movs r0, 0x1 - b _0806C610 -_0806C60A: - ldr r0, =gBattleScripting - adds r0, 0x23 - ldrb r0, [r0] -_0806C610: - str r0, [sp] -_0806C612: - mov r0, r8 - movs r1, 0x3A - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - mov r0, r8 - movs r1, 0x39 - movs r2, 0 - bl GetMonData - cmp r4, r0 - beq _0806C6F0 - ldr r0, [sp, 0x18] - cmp r0, 0 - bne _0806C6E4 - mov r0, r8 - movs r1, 0x39 - movs r2, 0 - bl GetMonData - ldr r1, [sp] - adds r0, r1 - str r0, [sp] - mov r0, r8 - movs r1, 0x3A - movs r2, 0 - bl GetMonData - ldr r1, [sp] - cmp r1, r0 - bls _0806C65E - mov r0, r8 - movs r1, 0x3A - movs r2, 0 - bl GetMonData - str r0, [sp] -_0806C65E: - mov r0, r8 - movs r1, 0x39 - mov r2, sp - bl SetMonData - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806C6EC - ldr r2, [sp, 0x38] - cmp r2, 0x4 - beq _0806C6EC - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldr r1, [sp] - strh r1, [r0, 0x28] - movs r0, 0x10 - mov r3, r10 - ands r0, r3 - cmp r0, 0 - bne _0806C6EC - ldr r4, =gActiveBank - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _0806C6EC - ldr r1, =gBattleResults - ldrb r0, [r1, 0x3] - cmp r0, 0xFE - bhi _0806C6AE - adds r0, 0x1 - strb r0, [r1, 0x3] -_0806C6AE: - ldrb r5, [r4] - add r0, sp, 0x38 - ldrb r0, [r0] - strb r0, [r4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl dp01_build_cmdbuf_x00_a_b_0 - ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution - strb r5, [r4] - b _0806C6EC - .pool -_0806C6E4: - ldr r1, =gBattleMoveDamage - ldr r0, [sp] - negs r0, r0 - str r0, [r1] -_0806C6EC: - movs r1, 0 - str r1, [sp, 0x20] -_0806C6F0: - movs r0, 0xEF - mov r2, r10 - ands r2, r0 - mov r10, r2 - b _0806C9AA - .pool -_0806C700: - movs r7, 0x2 - mov r0, r10 - ands r0, r7 - cmp r0, 0 - beq _0806C70C - b _0806C858 -_0806C70C: - movs r5, 0 - ldr r3, [sp, 0x28] - adds r3, 0x1 - str r3, [sp, 0x40] -_0806C714: - movs r0, 0x11 - adds r0, r5 - mov r9, r0 - mov r0, r8 - mov r1, r9 - movs r2, 0 - bl GetMonData - str r0, [sp] - adds r7, r5, 0 - adds r7, 0xD - mov r0, r8 - adds r1, r7, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r5, 24 - lsrs r6, r0, 24 - adds r0, r4, 0 - adds r2, r6, 0 - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - ldr r1, [sp] - cmp r1, r0 - beq _0806C832 - ldr r2, [sp, 0x24] - ldr r3, [sp, 0x28] - adds r0, r2, r3 - ldrb r0, [r0] - adds r0, r1, r0 - str r0, [sp] - mov r0, r8 - adds r1, r7, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - adds r2, r6, 0 - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - ldr r1, [sp] - cmp r1, r0 - bls _0806C7CC - mov r0, r8 - adds r1, r7, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - adds r2, r6, 0 - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] -_0806C7CC: - mov r0, r8 - mov r1, r9 - mov r2, sp - bl SetMonData - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0806C82E - ldr r2, [sp, 0x38] - cmp r2, 0x4 - beq _0806C82E - ldr r4, =gBattleMons - movs r0, 0x58 - adds r3, r2, 0 - muls r3, r0 - adds r0, r4, 0 - adds r0, 0x50 - adds r0, r3, r0 - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 14 - ands r1, r0 - cmp r1, 0 - bne _0806C82E - ldr r1, =gDisableStructs - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x18] - lsrs r1, 4 - ldr r2, =gBitTable - lsls r0, r5, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _0806C82E - adds r0, r5, r3 - adds r1, r4, 0 - adds r1, 0x24 - adds r0, r1 - ldr r1, [sp] - strb r1, [r0] -_0806C82E: - movs r3, 0 - str r3, [sp, 0x20] -_0806C832: - adds r5, 0x1 - cmp r5, 0x3 - bgt _0806C83A - b _0806C714 -_0806C83A: - ldr r5, [sp, 0x40] - lsls r0, r5, 24 -_0806C83E: - lsrs r0, 24 - str r0, [sp, 0x28] - b _0806C9AA - .pool -_0806C858: - ldr r6, [sp, 0x14] - adds r6, 0x11 - mov r0, r8 - adds r1, r6, 0 - movs r2, 0 - bl GetMonData - str r0, [sp] - ldr r5, [sp, 0x14] - adds r5, 0xD - mov r0, r8 - adds r1, r5, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - ldr r2, [sp, 0x14] - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - ldr r2, [sp] - cmp r2, r0 - bne _0806C8A0 - b _0806C9AA -_0806C8A0: - ldr r1, [sp, 0x28] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x28] - ldr r0, [sp, 0x24] - adds r1, r0, r1 - ldrb r0, [r1] - adds r0, r2, r0 - str r0, [sp] - mov r0, r8 - adds r1, r5, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - ldr r2, [sp, 0x14] - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - ldr r1, [sp] - cmp r1, r0 - bls _0806C914 - mov r0, r8 - adds r1, r5, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - ldr r2, [sp, 0x14] - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] -_0806C914: - mov r0, r8 - adds r1, r6, 0 - mov r2, sp - bl SetMonData - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _0806C978 - ldr r2, [sp, 0x38] - cmp r2, 0x4 - beq _0806C978 - ldr r4, =gBattleMons - movs r0, 0x58 - adds r3, r2, 0 - muls r3, r0 - adds r0, r4, 0 - adds r0, 0x50 - adds r0, r3, r0 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 14 - ands r0, r1 - cmp r0, 0 - bne _0806C978 - ldr r1, =gDisableStructs - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x18] - lsrs r1, 4 - ldr r2, =gBitTable - ldr r5, [sp, 0x14] - lsls r0, r5, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _0806C978 - adds r0, r5, r3 - adds r1, r4, 0 - adds r1, 0x24 - adds r0, r1 - ldr r1, [sp] - strb r1, [r0] -_0806C978: - movs r0, 0 - str r0, [sp, 0x20] - b _0806C9AA - .pool -_0806C994: - mov r0, r8 - movs r1, 0x2 - ldr r2, [sp, 0xC] - bl GetEvolutionTargetSpecies - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _0806C9AA - bl _0806BEE0 -_0806C9AA: - ldr r1, [sp, 0x2C] - adds r1, 0x1 - str r1, [sp, 0x2C] - mov r2, r10 - lsrs r2, 1 - mov r10, r2 - cmp r2, 0 - beq _0806C9BC - b _0806C3E6 -_0806C9BC: - b _0806CD4C -_0806C9BE: - ldr r3, [sp, 0x24] - ldr r5, [sp, 0x1C] - adds r0, r3, r5 - ldrb r0, [r0] - mov r10, r0 - movs r0, 0 - str r0, [sp, 0x2C] - mov r1, r10 - cmp r1, 0 - bne _0806C9D4 - b _0806CD4C -_0806C9D4: - movs r0, 0x1 - mov r2, r10 - ands r0, r2 - cmp r0, 0 - bne _0806C9E0 - b _0806CD3A -_0806C9E0: - ldr r3, [sp, 0x2C] - cmp r3, 0x7 - bls _0806C9E8 - b _0806CD3A -_0806C9E8: - lsls r0, r3, 2 - ldr r1, =_0806C9F8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0806C9F8: - .4byte _0806CA18 - .4byte _0806CA18 - .4byte _0806CA18 - .4byte _0806CA18 - .4byte _0806CAB8 - .4byte _0806CB94 - .4byte _0806CC00 - .4byte _0806CC68 -_0806CA18: - mov r0, r8 - bl sub_806DC8C - lsls r0, 16 - lsrs r6, r0, 16 - ldr r5, [sp, 0x24] - ldr r1, [sp, 0x28] - adds r0, r5, r1 - ldrb r5, [r0] - ldr r0, =gUnknown_08329EC2 - ldr r4, [sp, 0x2C] - adds r4, 0x2 - adds r0, r4, r0 - ldrb r1, [r0] - mov r0, r8 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - str r1, [sp, 0x4] - lsls r0, r5, 24 - asrs r2, r0, 24 - cmp r2, 0 - ble _0806CA84 - ldr r0, =0x000001fd - cmp r6, r0 - bls _0806CA52 - bl _0806BEF0 -_0806CA52: - adds r3, r1, 0 - cmp r3, 0x63 - ble _0806CA5A - b _0806CD3A -_0806CA5A: - adds r1, r3, r2 - cmp r1, 0x64 - ble _0806CA70 - adds r0, r2, 0 - adds r0, 0x64 - subs r5, r0, r1 - b _0806CA72 - .pool -_0806CA70: - adds r5, r2, 0 -_0806CA72: - adds r1, r6, r5 - movs r0, 0xFF - lsls r0, 1 - cmp r1, r0 - bls _0806CA80 - adds r0, r5, r0 - subs r5, r0, r1 -_0806CA80: - adds r0, r3, r5 - b _0806CA98 -_0806CA84: - cmp r1, 0 - bne _0806CA8E - movs r2, 0x1 - str r2, [sp, 0x3C] - b _0806CD30 -_0806CA8E: - adds r0, r1, r2 - str r0, [sp, 0x4] - cmp r0, 0 - bge _0806CA9A - movs r0, 0 -_0806CA98: - str r0, [sp, 0x4] -_0806CA9A: - ldr r0, =gUnknown_08329EC2 - adds r0, r4, r0 - ldrb r1, [r0] - add r2, sp, 0x4 - mov r0, r8 - bl SetMonData - mov r0, r8 - bl CalculateMonStats - movs r3, 0 - str r3, [sp, 0x20] - b _0806CD30 - .pool -_0806CAB8: - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - ldr r1, =gUnknown_08329D22 - ldr r5, [sp, 0x14] - adds r1, r5, r1 - ldrb r1, [r1] - ands r0, r1 - lsls r1, r5, 1 - lsrs r0, r1 - str r0, [sp] - adds r6, r5, 0 - adds r6, 0xD - mov r0, r8 - adds r1, r6, 0 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - ldr r2, [sp, 0x14] - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [sp] - cmp r0, 0x2 - bls _0806CB0A - b _0806CD3A -_0806CB0A: - cmp r5, 0x4 - bhi _0806CB10 - b _0806CD3A -_0806CB10: - mov r0, r8 - movs r1, 0x15 - movs r2, 0 - bl GetMonData - str r0, [sp] - ldr r1, =gUnknown_08329D26 - ldr r2, [sp, 0x14] - adds r1, r2, r1 - ldrb r2, [r1] - ands r2, r0 - str r2, [sp] - ldr r0, =gUnknown_08329D2A - ldr r3, [sp, 0x14] - adds r0, r3, r0 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - adds r2, r0 - str r2, [sp] - mov r0, r8 - movs r1, 0x15 - mov r2, sp - bl SetMonData - mov r0, r8 - adds r1, r6, 0 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r1, [sp] - lsls r1, 24 - lsrs r1, 24 - ldr r2, [sp, 0x14] - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r0, 24 - subs r0, r5 - str r0, [sp] - ldr r4, [sp, 0x14] - adds r4, 0x11 - mov r0, r8 - adds r1, r4, 0 - movs r2, 0 - bl GetMonData - ldr r1, [sp] - adds r0, r1 - str r0, [sp] - mov r0, r8 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - movs r5, 0 - str r5, [sp, 0x20] - b _0806CD3A - .pool -_0806CB94: - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - cmp r0, 0x63 - bls _0806CBA4 - b _0806CD30 -_0806CBA4: - ldr r0, [sp, 0x20] - cmp r0, 0 - beq _0806CBB2 - ldr r1, [sp, 0x3C] - cmp r1, 0 - bne _0806CBB2 - b _0806CD30 -_0806CBB2: - bl sub_806F104 - lsls r0, 24 - cmp r0, 0 - beq _0806CBBE - b _0806CD30 -_0806CBBE: - ldr r2, [sp, 0x30] - cmp r2, 0 - beq _0806CBC6 - b _0806CD30 -_0806CBC6: - ldr r3, [sp, 0x24] - ldr r5, [sp, 0x28] - adds r0, r3, r5 - ldrb r0, [r0] - str r0, [sp, 0x30] - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - adds r5, r0, 0 - str r5, [sp, 0x8] - ldr r0, [sp, 0x30] - lsls r4, r0, 24 - asrs r1, r4, 24 - cmp r1, 0 - ble _0806CCCC - ldr r2, [sp, 0x34] - cmp r2, 0x1B - bne _0806CCCC - movs r0, 0x96 - muls r0, r1 - movs r1, 0x64 - bl __divsi3 - adds r0, r5, r0 - str r0, [sp, 0x8] - adds r2, r4, 0 - b _0806CCD8 -_0806CC00: - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - cmp r0, 0x63 - bhi _0806CC10 - b _0806CD30 -_0806CC10: - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - cmp r0, 0xC7 - bls _0806CC20 - b _0806CD30 -_0806CC20: - ldr r0, [sp, 0x20] - cmp r0, 0 - beq _0806CC2E - ldr r1, [sp, 0x3C] - cmp r1, 0 - bne _0806CC2E - b _0806CD30 -_0806CC2E: - bl sub_806F104 - lsls r0, 24 - cmp r0, 0 - bne _0806CD30 - ldr r2, [sp, 0x30] - cmp r2, 0 - bne _0806CD30 - ldr r3, [sp, 0x24] - ldr r5, [sp, 0x28] - adds r0, r3, r5 - ldrb r0, [r0] - str r0, [sp, 0x30] - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - str r4, [sp, 0x8] - ldr r0, [sp, 0x30] - lsls r5, r0, 24 - asrs r1, r5, 24 - cmp r1, 0 - ble _0806CCCC - ldr r2, [sp, 0x34] - cmp r2, 0x1B - beq _0806CCBA - b _0806CCCC -_0806CC68: - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - cmp r0, 0xC7 - bls _0806CD30 - ldr r0, [sp, 0x20] - cmp r0, 0 - beq _0806CC82 - ldr r1, [sp, 0x3C] - cmp r1, 0 - beq _0806CD30 -_0806CC82: - bl sub_806F104 - lsls r0, 24 - cmp r0, 0 - bne _0806CD30 - ldr r2, [sp, 0x30] - cmp r2, 0 - bne _0806CD30 - ldr r3, [sp, 0x24] - ldr r5, [sp, 0x28] - adds r0, r3, r5 - ldrb r0, [r0] - str r0, [sp, 0x30] - mov r0, r8 - movs r1, 0x20 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - str r4, [sp, 0x8] - ldr r0, [sp, 0x30] - lsls r5, r0, 24 - asrs r1, r5, 24 - cmp r1, 0 - ble _0806CCCC - ldr r2, [sp, 0x34] - cmp r2, 0x1B - bne _0806CCCC -_0806CCBA: - movs r0, 0x96 - muls r0, r1 - movs r1, 0x64 - bl __divsi3 - adds r0, r4, r0 - str r0, [sp, 0x8] - adds r2, r5, 0 - b _0806CCD8 -_0806CCCC: - ldr r3, [sp, 0x30] - lsls r2, r3, 24 - asrs r1, r2, 24 - ldr r0, [sp, 0x8] - adds r0, r1 - str r0, [sp, 0x8] -_0806CCD8: - cmp r2, 0 - ble _0806CD0E - mov r0, r8 - movs r1, 0x26 - movs r2, 0 - bl GetMonData - cmp r0, 0xB - bne _0806CCF0 - ldr r0, [sp, 0x8] - adds r0, 0x1 - str r0, [sp, 0x8] -_0806CCF0: - mov r0, r8 - movs r1, 0x23 - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - bl sav1_map_get_name - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _0806CD0E - ldr r0, [sp, 0x8] - adds r0, 0x1 - str r0, [sp, 0x8] -_0806CD0E: - ldr r0, [sp, 0x8] - cmp r0, 0 - bge _0806CD18 - movs r0, 0 - str r0, [sp, 0x8] -_0806CD18: - ldr r0, [sp, 0x8] - cmp r0, 0xFF - ble _0806CD22 - movs r0, 0xFF - str r0, [sp, 0x8] -_0806CD22: - add r2, sp, 0x8 - mov r0, r8 - movs r1, 0x20 - bl SetMonData - movs r5, 0 - str r5, [sp, 0x20] -_0806CD30: - ldr r0, [sp, 0x28] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x28] -_0806CD3A: - ldr r0, [sp, 0x2C] - adds r0, 0x1 - str r0, [sp, 0x2C] - mov r1, r10 - lsrs r1, 1 - mov r10, r1 - cmp r1, 0 - beq _0806CD4C - b _0806C9D4 -_0806CD4C: - ldr r2, [sp, 0x1C] - adds r2, 0x1 - str r2, [sp, 0x1C] - cmp r2, 0x5 - bgt _0806CD5A - bl _0806BEFC -_0806CD5A: - ldr r0, [sp, 0x20] -_0806CD5C: - add sp, 0x44 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end ExecuteTableBasedItemEffect - thumb_func_start HealStatusConditions @ bool8 HealStatusConditions(struct pokemon *a1, int a2, u32 healMask, u8 a4) HealStatusConditions: @ 806CD6C @@ -2017,8 +60,8 @@ _0806CDD2: bx r1 thumb_func_end HealStatusConditions - thumb_func_start sub_806CDDC -sub_806CDDC: @ 806CDDC + thumb_func_start GetItemEffectParamOffset +GetItemEffectParamOffset: @ 806CDDC push {r4-r7,lr} lsls r0, 16 lsrs r3, r0, 16 @@ -2027,7 +70,7 @@ sub_806CDDC: @ 806CDDC lsls r2, 24 lsrs r5, r2, 24 movs r7, 0x6 - ldr r1, =gItemEffectInfoPointers + ldr r1, =gItemEffectTable adds r0, r3, 0 subs r0, 0xD lsls r0, 2 @@ -2050,7 +93,7 @@ _0806CE0C: lsls r0, r1, 3 subs r0, r1 lsls r0, 2 - ldr r1, =gUnknown_0202440C + ldr r1, =gEnigmaBerries + 8 adds r0, r1 _0806CE1A: mov r12, r0 @@ -2194,7 +237,7 @@ _0806CF1C: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_806CDDC + thumb_func_end GetItemEffectParamOffset thumb_func_start sub_806CF24 sub_806CF24: @ 806CF24 @@ -2245,7 +288,7 @@ sub_806CF78: @ 806CF78 lsls r0, r1, 3 subs r0, r1 lsls r0, 2 - ldr r1, =gUnknown_0202440C + ldr r1, =gEnigmaBerries + 8 adds r7, r0, r1 b _0806CFD8 .pool @@ -2257,7 +300,7 @@ _0806CFB8: b _0806CFD6 .pool _0806CFCC: - ldr r1, =gItemEffectInfoPointers + ldr r1, =gItemEffectTable subs r0, 0xD lsls r0, 2 adds r0, r1 diff --git a/asm/pokemon_item_effect.s b/asm/pokemon_item_effect.s new file mode 100644 index 000000000..76c0f22da --- /dev/null +++ b/asm/pokemon_item_effect.s @@ -0,0 +1,1967 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + + thumb_func_start ExecuteTableBasedItemEffect_ +@ bool8 ExecuteTableBasedItemEffect_(struct pokemon *mon, u16 itemId, u8 a3, u8 monMoveIndex) +ExecuteTableBasedItemEffect_: @ 806BD04 + push {r4,lr} + sub sp, 0x4 + lsls r1, 16 + lsrs r1, 16 + lsls r2, 24 + lsrs r2, 24 + lsls r3, 24 + lsrs r3, 24 + movs r4, 0 + str r4, [sp] + bl ExecuteTableBasedItemEffect + lsls r0, 24 + lsrs r0, 24 + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + thumb_func_end ExecuteTableBasedItemEffect_ + + thumb_func_start ExecuteTableBasedItemEffect +@ bool8 ExecuteTableBasedItemEffect(struct pokemon *mon, u16 itemId, u8 a3, u8 monMoveIndex, u8 a5) +ExecuteTableBasedItemEffect: @ 806BD28 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x44 + mov r8, r0 + ldr r0, [sp, 0x64] + lsls r1, 16 + lsrs r1, 16 + str r1, [sp, 0xC] + lsls r2, 24 + lsrs r2, 24 + str r2, [sp, 0x10] + lsls r3, 24 + lsrs r3, 24 + str r3, [sp, 0x14] + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x18] + movs r0, 0x1 + str r0, [sp, 0x20] + movs r1, 0x6 + str r1, [sp, 0x28] + movs r2, 0 + str r2, [sp, 0x30] + movs r3, 0x4 + str r3, [sp, 0x38] + movs r5, 0 + str r5, [sp, 0x3C] + mov r0, r8 + movs r1, 0xC + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0xAF + bne _0806BDBC + ldr r0, =gMain + ldr r1, =0x00000439 + adds r0, r1 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0806BDA8 + ldr r2, =gEnigmaBerries + ldr r0, =gUnknown_020244B8 + ldrb r1, [r0] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 2 + adds r0, r2 + ldrb r0, [r0, 0x7] + b _0806BDC4 + .pool +_0806BDA8: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r2, =0x00003226 + adds r0, r2 + ldrb r0, [r0] + b _0806BDC4 + .pool +_0806BDBC: + bl ItemId_GetHoldEffect + lsls r0, 24 + lsrs r0, 24 +_0806BDC4: + str r0, [sp, 0x34] + ldr r1, =gUnknown_0202420F + ldr r0, =gUnknown_020244B8 + ldrb r2, [r0] + strb r2, [r1] + ldr r0, =gMain + ldr r3, =0x00000439 + adds r0, r3 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + beq _0806BE64 + ldr r0, =gActiveBank + strb r2, [r0] + ldrb r0, [r0] + bl GetBankSide + lsls r0, 24 + lsrs r0, 24 + negs r1, r0 + orrs r1, r0 + lsrs r1, 31 + str r1, [sp, 0x1C] + ldr r0, =gNoOfAllBanks + ldr r4, [sp, 0xC] + subs r4, 0xD + ldrb r0, [r0] + cmp r1, r0 + bge _0806BE70 + ldr r2, =gBattlePartyID + lsls r0, r1, 1 + adds r0, r2 + ldrh r3, [r0] + ldr r5, [sp, 0x10] + lsls r0, r5, 16 + lsrs r1, r0, 16 + adds r5, r0, 0 + cmp r3, r1 + bne _0806BE3C + ldr r0, [sp, 0x1C] + str r0, [sp, 0x38] + b _0806BE70 + .pool +_0806BE3C: + ldr r1, [sp, 0x1C] + adds r1, 0x2 + str r1, [sp, 0x1C] + ldr r0, =gNoOfAllBanks + ldrb r0, [r0] + cmp r1, r0 + bge _0806BE70 + lsls r0, r1, 1 + adds r0, r2 + ldrh r1, [r0] + lsrs r0, r5, 16 + cmp r1, r0 + bne _0806BE3C + ldr r2, [sp, 0x1C] + lsls r0, r2, 24 + lsrs r0, 24 + str r0, [sp, 0x38] + b _0806BE70 + .pool +_0806BE64: + ldr r0, =gActiveBank + strb r1, [r0] + movs r3, 0x4 + str r3, [sp, 0x38] + ldr r4, [sp, 0xC] + subs r4, 0xD +_0806BE70: + lsls r0, r4, 16 + lsrs r0, 16 + cmp r0, 0xA5 + bhi _0806BEF0 + ldr r1, =gItemEffectTable + lsls r0, r4, 2 + adds r0, r1 + ldr r0, [r0] + cmp r0, 0 + bne _0806BE94 + ldr r5, [sp, 0xC] + cmp r5, 0xAF + beq _0806BE9A + b _0806BEF0 + .pool +_0806BE94: + ldr r1, [sp, 0xC] + cmp r1, 0xAF + bne _0806BEF6 +_0806BE9A: + ldr r0, =gMain + ldr r2, =0x00000439 + adds r0, r2 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0806BECC + ldr r0, =gActiveBank + ldrb r1, [r0] + lsls r0, r1, 3 + subs r0, r1 + lsls r0, 2 + ldr r1, =gEnigmaBerries + 8 + adds r0, r1 + b _0806BEF6 + .pool +_0806BECC: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r3, =0x00003214 + adds r3, r0, r3 + str r3, [sp, 0x24] + b _0806BEF8 + .pool +_0806BEE0: + mov r0, r8 + movs r2, 0 + ldr r3, [sp, 0x10] + bl sub_813DA40 + movs r0, 0 + bl _0806CD5C +_0806BEF0: + movs r0, 0x1 + bl _0806CD5C +_0806BEF6: + str r0, [sp, 0x24] +_0806BEF8: + movs r5, 0 + str r5, [sp, 0x1C] +_0806BEFC: + ldr r0, [sp, 0x1C] + cmp r0, 0x5 + bls _0806BF06 + bl _0806CD4C +_0806BF06: + lsls r0, 2 + ldr r1, =_0806BF14 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0806BF14: + .4byte _0806BF2C + .4byte _0806BFFC + .4byte _0806C08C + .4byte _0806C120 + .4byte _0806C300 + .4byte _0806C9BE +_0806BF2C: + ldr r1, [sp, 0x24] + ldr r3, [sp, 0x1C] + adds r2, r1, r3 + ldrb r1, [r2] + movs r0, 0x80 + ands r0, r1 + adds r6, r2, 0 + cmp r0, 0 + beq _0806BF76 + ldr r0, =gMain + ldr r5, =0x00000439 + adds r0, r5 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0806BF76 + ldr r0, [sp, 0x38] + cmp r0, 0x4 + beq _0806BF76 + ldr r1, =gBattleMons + movs r0, 0x58 + ldr r2, [sp, 0x38] + muls r0, r2 + adds r1, 0x50 + adds r2, r0, r1 + ldr r1, [r2] + movs r0, 0xF0 + lsls r0, 12 + ands r0, r1 + cmp r0, 0 + beq _0806BF76 + ldr r0, =0xfff0ffff + ands r1, r0 + str r1, [r2] + movs r3, 0 + str r3, [sp, 0x20] +_0806BF76: + ldrb r1, [r6] + movs r0, 0x30 + ands r0, r1 + cmp r0, 0 + beq _0806BFA4 + ldr r1, =gBattleMons + ldr r0, =gActiveBank + ldrb r2, [r0] + movs r0, 0x58 + muls r0, r2 + adds r1, 0x50 + adds r2, r0, r1 + ldr r1, [r2] + movs r3, 0x80 + lsls r3, 13 + adds r0, r1, 0 + ands r0, r3 + cmp r0, 0 + bne _0806BFA4 + orrs r1, r3 + str r1, [r2] + movs r5, 0 + str r5, [sp, 0x20] +_0806BFA4: + ldrb r0, [r6] + movs r3, 0xF + ands r3, r0 + cmp r3, 0 + bne _0806BFB2 + bl _0806CD4C +_0806BFB2: + ldr r6, =gBattleMons + ldr r5, =gActiveBank + ldrb r0, [r5] + movs r4, 0x58 + muls r0, r4 + adds r1, r0, r6 + ldrb r2, [r1, 0x19] + movs r0, 0x19 + ldrsb r0, [r1, r0] + cmp r0, 0xB + ble _0806BFCC + bl _0806CD4C +_0806BFCC: + adds r0, r2, r3 + strb r0, [r1, 0x19] + ldrb r0, [r5] + muls r0, r4 + adds r1, r0, r6 + movs r0, 0x19 + ldrsb r0, [r1, r0] + cmp r0, 0xC + bgt _0806BFE0 + b _0806C110 +_0806BFE0: + movs r0, 0xC + strb r0, [r1, 0x19] + b _0806C110 + .pool +_0806BFFC: + ldr r1, [sp, 0x24] + ldr r3, [sp, 0x1C] + adds r2, r1, r3 + ldrb r1, [r2] + movs r0, 0xF0 + ands r0, r1 + lsls r3, r0, 24 + adds r6, r2, 0 + cmp r3, 0 + beq _0806C042 + ldr r7, =gBattleMons + ldr r5, =gActiveBank + ldrb r0, [r5] + movs r4, 0x58 + muls r0, r4 + adds r1, r0, r7 + ldrb r2, [r1, 0x1A] + movs r0, 0x1A + ldrsb r0, [r1, r0] + cmp r0, 0xB + bgt _0806C042 + lsrs r0, r3, 28 + adds r0, r2, r0 + strb r0, [r1, 0x1A] + ldrb r0, [r5] + muls r0, r4 + adds r1, r0, r7 + movs r0, 0x1A + ldrsb r0, [r1, r0] + cmp r0, 0xC + ble _0806C03E + movs r0, 0xC + strb r0, [r1, 0x1A] +_0806C03E: + movs r5, 0 + str r5, [sp, 0x20] +_0806C042: + ldrb r0, [r6] + movs r3, 0xF + ands r3, r0 + cmp r3, 0 + bne _0806C050 + bl _0806CD4C +_0806C050: + ldr r6, =gBattleMons + ldr r5, =gActiveBank + ldrb r0, [r5] + movs r4, 0x58 + muls r0, r4 + adds r1, r0, r6 + ldrb r2, [r1, 0x1B] + movs r0, 0x1B + ldrsb r0, [r1, r0] + cmp r0, 0xB + ble _0806C06A + bl _0806CD4C +_0806C06A: + adds r0, r2, r3 + strb r0, [r1, 0x1B] + ldrb r0, [r5] + muls r0, r4 + adds r1, r0, r6 + movs r0, 0x1B + ldrsb r0, [r1, r0] + cmp r0, 0xC + ble _0806C110 + movs r0, 0xC + strb r0, [r1, 0x1B] + b _0806C110 + .pool +_0806C08C: + ldr r1, [sp, 0x24] + ldr r3, [sp, 0x1C] + adds r2, r1, r3 + ldrb r1, [r2] + movs r0, 0xF0 + ands r0, r1 + lsls r3, r0, 24 + adds r6, r2, 0 + cmp r3, 0 + beq _0806C0D2 + ldr r7, =gBattleMons + ldr r5, =gActiveBank + ldrb r0, [r5] + movs r4, 0x58 + muls r0, r4 + adds r1, r0, r7 + ldrb r2, [r1, 0x1E] + movs r0, 0x1E + ldrsb r0, [r1, r0] + cmp r0, 0xB + bgt _0806C0D2 + lsrs r0, r3, 28 + adds r0, r2, r0 + strb r0, [r1, 0x1E] + ldrb r0, [r5] + muls r0, r4 + adds r1, r0, r7 + movs r0, 0x1E + ldrsb r0, [r1, r0] + cmp r0, 0xC + ble _0806C0CE + movs r0, 0xC + strb r0, [r1, 0x1E] +_0806C0CE: + movs r5, 0 + str r5, [sp, 0x20] +_0806C0D2: + ldrb r0, [r6] + movs r3, 0xF + ands r3, r0 + cmp r3, 0 + bne _0806C0E0 + bl _0806CD4C +_0806C0E0: + ldr r6, =gBattleMons + ldr r5, =gActiveBank + ldrb r0, [r5] + movs r4, 0x58 + muls r0, r4 + adds r1, r0, r6 + ldrb r2, [r1, 0x1C] + movs r0, 0x1C + ldrsb r0, [r1, r0] + cmp r0, 0xB + ble _0806C0FA + bl _0806CD4C +_0806C0FA: + adds r0, r2, r3 + strb r0, [r1, 0x1C] + ldrb r0, [r5] + muls r0, r4 + adds r1, r0, r6 + movs r0, 0x1C + ldrsb r0, [r1, r0] + cmp r0, 0xC + ble _0806C110 + movs r0, 0xC + strb r0, [r1, 0x1C] +_0806C110: + movs r0, 0 + str r0, [sp, 0x20] + bl _0806CD4C + .pool +_0806C120: + ldr r1, [sp, 0x24] + ldr r3, [sp, 0x1C] + adds r2, r1, r3 + ldrb r1, [r2] + movs r0, 0x80 + ands r0, r1 + adds r6, r2, 0 + cmp r0, 0 + beq _0806C168 + ldr r5, =gSideTimers + ldr r4, =gActiveBank + ldrb r0, [r4] + bl GetBankSide + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r5 + ldrb r0, [r1, 0x4] + cmp r0, 0 + bne _0806C168 + ldrb r0, [r4] + bl GetBankSide + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 1 + adds r1, r0 + lsls r1, 2 + adds r1, r5 + movs r0, 0x5 + strb r0, [r1, 0x4] + movs r5, 0 + str r5, [sp, 0x20] +_0806C168: + ldrb r1, [r6] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _0806C1CA + mov r0, r8 + movs r1, 0x38 + movs r2, 0 + bl GetMonData + cmp r0, 0x64 + beq _0806C1CA + ldr r5, =gExperienceTables + mov r0, r8 + movs r1, 0x38 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + mov r0, r8 + movs r1, 0xB + movs r2, 0 + bl GetMonData + adds r4, 0x1 + lsls r4, 2 + ldr r2, =gBaseStats + lsls r1, r0, 3 + subs r1, r0 + lsls r1, 2 + adds r1, r2 + ldrb r1, [r1, 0x13] + movs r0, 0xCA + lsls r0, 1 + muls r0, r1 + adds r4, r0 + adds r4, r5 + ldr r0, [r4] + str r0, [sp] + mov r0, r8 + movs r1, 0x19 + mov r2, sp + bl SetMonData + mov r0, r8 + bl CalculateMonStats + movs r0, 0 + str r0, [sp, 0x20] +_0806C1CA: + ldrb r1, [r6] + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + beq _0806C206 + mov r0, r8 + ldr r1, [sp, 0x10] + movs r2, 0x7 + ldr r3, [sp, 0x38] + bl HealStatusConditions + lsls r0, 24 + cmp r0, 0 + bne _0806C206 + ldr r1, [sp, 0x38] + cmp r1, 0x4 + beq _0806C202 + ldr r1, =gBattleMons + movs r0, 0x58 + ldr r3, [sp, 0x38] + adds r2, r3, 0 + muls r2, r0 + adds r1, 0x50 + adds r2, r1 + ldr r0, [r2] + ldr r1, =0xf7ffffff + ands r0, r1 + str r0, [r2] +_0806C202: + movs r5, 0 + str r5, [sp, 0x20] +_0806C206: + ldrb r1, [r6] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _0806C226 + ldr r2, =0x00000f88 + mov r0, r8 + ldr r1, [sp, 0x10] + ldr r3, [sp, 0x38] + bl HealStatusConditions + lsls r0, 24 + cmp r0, 0 + bne _0806C226 + movs r0, 0 + str r0, [sp, 0x20] +_0806C226: + ldrb r1, [r6] + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + beq _0806C246 + mov r0, r8 + ldr r1, [sp, 0x10] + movs r2, 0x10 + ldr r3, [sp, 0x38] + bl HealStatusConditions + lsls r0, 24 + cmp r0, 0 + bne _0806C246 + movs r1, 0 + str r1, [sp, 0x20] +_0806C246: + ldrb r1, [r6] + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _0806C266 + mov r0, r8 + ldr r1, [sp, 0x10] + movs r2, 0x20 + ldr r3, [sp, 0x38] + bl HealStatusConditions + lsls r0, 24 + cmp r0, 0 + bne _0806C266 + movs r2, 0 + str r2, [sp, 0x20] +_0806C266: + ldrb r1, [r6] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0806C286 + mov r0, r8 + ldr r1, [sp, 0x10] + movs r2, 0x40 + ldr r3, [sp, 0x38] + bl HealStatusConditions + lsls r0, 24 + cmp r0, 0 + bne _0806C286 + movs r3, 0 + str r3, [sp, 0x20] +_0806C286: + ldrb r1, [r6] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0806C294 + bl _0806CD4C +_0806C294: + ldr r0, =gMain + ldr r5, =0x00000439 + adds r0, r5 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _0806C2A8 + bl _0806CD4C +_0806C2A8: + ldr r0, [sp, 0x38] + cmp r0, 0x4 + bne _0806C2B2 + bl _0806CD4C +_0806C2B2: + ldr r1, =gBattleMons + movs r0, 0x58 + ldr r2, [sp, 0x38] + muls r0, r2 + adds r1, 0x50 + adds r2, r0, r1 + ldr r1, [r2] + movs r0, 0x7 + ands r0, r1 + cmp r0, 0 + bne _0806C2CC + bl _0806CD4C +_0806C2CC: + movs r0, 0x8 + negs r0, r0 + ands r1, r0 + str r1, [r2] + movs r3, 0 + str r3, [sp, 0x20] + bl _0806CD4C + .pool +_0806C300: + ldr r5, [sp, 0x24] + ldr r1, [sp, 0x1C] + adds r0, r5, r1 + ldrb r0, [r0] + mov r10, r0 + movs r0, 0x20 + mov r2, r10 + ands r0, r2 + cmp r0, 0 + beq _0806C3D8 + movs r0, 0xDF + ands r2, r0 + mov r10, r2 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + ldr r1, =gUnknown_08329D22 + ldr r3, [sp, 0x14] + adds r1, r3, r1 + ldrb r1, [r1] + ands r0, r1 + lsls r1, r3, 1 + lsrs r0, r1 + str r0, [sp] + adds r5, r3, 0 + adds r5, 0xD + mov r0, r8 + adds r1, r5, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + ldr r2, [sp, 0x14] + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x2C] + ldr r0, [sp] + cmp r0, 0x2 + bhi _0806C3D8 + ldr r0, [sp, 0x2C] + cmp r0, 0x4 + bls _0806C3D8 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + ldr r1, =gUnknown_08329D2A + ldr r2, [sp, 0x14] + adds r1, r2, r1 + ldrb r1, [r1] + adds r0, r1 + str r0, [sp] + mov r0, r8 + movs r1, 0x15 + mov r2, sp + bl SetMonData + mov r0, r8 + adds r1, r5, 0 + movs r2, 0 + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + ldr r1, [sp] + lsls r1, 24 + lsrs r1, 24 + ldr r2, [sp, 0x14] + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + ldr r3, [sp, 0x2C] + subs r0, r3 + str r0, [sp] + ldr r4, [sp, 0x14] + adds r4, 0x11 + mov r0, r8 + adds r1, r4, 0 + movs r2, 0 + bl GetMonData + ldr r1, [sp] + adds r0, r1 + str r0, [sp] + mov r0, r8 + adds r1, r4, 0 + mov r2, sp + bl SetMonData + movs r5, 0 + str r5, [sp, 0x20] +_0806C3D8: + movs r0, 0 + str r0, [sp, 0x2C] + mov r1, r10 + cmp r1, 0 + bne _0806C3E6 + bl _0806CD4C +_0806C3E6: + movs r0, 0x1 + mov r2, r10 + ands r0, r2 + cmp r0, 0 + bne _0806C3F2 + b _0806C9AA +_0806C3F2: + ldr r3, [sp, 0x2C] + cmp r3, 0x7 + bls _0806C3FA + b _0806C9AA +_0806C3FA: + lsls r0, r3, 2 + ldr r1, =_0806C410 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0806C410: + .4byte _0806C430 + .4byte _0806C430 + .4byte _0806C4DC + .4byte _0806C700 + .4byte _0806C9AA + .4byte _0806C9AA + .4byte _0806C9AA + .4byte _0806C994 +_0806C430: + mov r0, r8 + bl sub_806DC8C + lsls r0, 16 + lsrs r6, r0, 16 + ldr r5, [sp, 0x24] + ldr r1, [sp, 0x28] + adds r0, r5, r1 + ldrb r5, [r0] + ldr r0, =gUnknown_08329EC2 + ldr r2, [sp, 0x2C] + adds r0, r2, r0 + ldrb r1, [r0] + mov r0, r8 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + str r1, [sp, 0x4] + lsls r0, r5, 24 + asrs r2, r0, 24 + cmp r2, 0 + ble _0806C498 + ldr r0, =0x000001fd + cmp r6, r0 + bls _0806C466 + b _0806BEF0 +_0806C466: + adds r3, r1, 0 + cmp r3, 0x63 + ble _0806C46E + b _0806C9AA +_0806C46E: + adds r1, r3, r2 + cmp r1, 0x64 + ble _0806C484 + adds r0, r2, 0 + adds r0, 0x64 + subs r5, r0, r1 + b _0806C486 + .pool +_0806C484: + adds r5, r2, 0 +_0806C486: + adds r1, r6, r5 + movs r0, 0xFF + lsls r0, 1 + cmp r1, r0 + bls _0806C494 + adds r0, r5, r0 + subs r5, r0, r1 +_0806C494: + adds r0, r3, r5 + b _0806C4B2 +_0806C498: + cmp r1, 0 + bne _0806C4A8 + movs r3, 0x1 + str r3, [sp, 0x3C] + ldr r0, [sp, 0x28] + adds r0, 0x1 + lsls r0, 24 + b _0806C83E +_0806C4A8: + adds r0, r1, r2 + str r0, [sp, 0x4] + cmp r0, 0 + bge _0806C4B4 + movs r0, 0 +_0806C4B2: + str r0, [sp, 0x4] +_0806C4B4: + ldr r0, =gUnknown_08329EC2 + ldr r5, [sp, 0x2C] + adds r0, r5, r0 + ldrb r1, [r0] + add r2, sp, 0x4 + mov r0, r8 + bl SetMonData + mov r0, r8 + bl CalculateMonStats + ldr r0, [sp, 0x28] + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x28] + b _0806C978 + .pool +_0806C4DC: + movs r0, 0x10 + mov r1, r10 + ands r0, r1 + cmp r0, 0 + beq _0806C59C + mov r0, r8 + movs r1, 0x39 + movs r2, 0 + bl GetMonData + cmp r0, 0 + beq _0806C4FC + ldr r0, [sp, 0x28] + adds r0, 0x1 + lsls r0, 24 + b _0806C83E +_0806C4FC: + ldr r0, =gMain + ldr r2, =0x00000439 + adds r0, r2 + ldrb r1, [r0] + movs r4, 0x2 + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0806C5B2 + ldr r3, [sp, 0x38] + cmp r3, 0x4 + beq _0806C55C + ldr r2, =gAbsentBankFlags + ldr r1, =gBitTable + lsls r0, r3, 2 + adds r0, r1 + ldr r1, [r0] + ldrb r0, [r2] + bics r0, r1 + strb r0, [r2] + ldr r1, =gBattlePartyID + lsls r0, r3, 1 + adds r0, r1 + ldrb r0, [r0] + bl pokemon_order_func + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + ldr r0, [sp, 0x38] + bl CopyPlayerPartyMonToBattleData + ldr r0, =gActiveBank + ldrb r0, [r0] + b _0806C574 + .pool +_0806C55C: + ldr r3, =gAbsentBankFlags + ldr r1, =gBitTable + ldr r2, =gActiveBank + ldrb r0, [r2] + eors r0, r4 + lsls r0, 2 + adds r0, r1 + ldr r1, [r0] + ldrb r0, [r3] + bics r0, r1 + strb r0, [r3] + ldrb r0, [r2] +_0806C574: + bl GetBankSide + lsls r0, 24 + cmp r0, 0 + bne _0806C5B2 + ldr r1, =gBattleResults + ldrb r0, [r1, 0x4] + cmp r0, 0xFE + bhi _0806C5B2 + adds r0, 0x1 + strb r0, [r1, 0x4] + b _0806C5B2 + .pool +_0806C59C: + mov r0, r8 + movs r1, 0x39 + movs r2, 0 + bl GetMonData + cmp r0, 0 + bne _0806C5B2 + ldr r0, [sp, 0x28] + adds r0, 0x1 + lsls r0, 24 + b _0806C83E +_0806C5B2: + ldr r1, [sp, 0x28] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x28] + ldr r5, [sp, 0x24] + adds r1, r5, r1 + ldrb r1, [r1] + str r1, [sp] + adds r0, r1, 0 + cmp r0, 0xFE + beq _0806C5F4 + cmp r0, 0xFE + bhi _0806C5D4 + cmp r0, 0xFD + beq _0806C60A + b _0806C612 +_0806C5D4: + cmp r1, 0xFF + bne _0806C612 + mov r0, r8 + movs r1, 0x3A + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + mov r0, r8 + movs r1, 0x39 + movs r2, 0 + bl GetMonData + subs r4, r0 + str r4, [sp] + b _0806C612 +_0806C5F4: + mov r0, r8 + movs r1, 0x3A + movs r2, 0 + bl GetMonData + lsrs r0, 1 + str r0, [sp] + cmp r0, 0 + bne _0806C612 + movs r0, 0x1 + b _0806C610 +_0806C60A: + ldr r0, =gBattleScripting + adds r0, 0x23 + ldrb r0, [r0] +_0806C610: + str r0, [sp] +_0806C612: + mov r0, r8 + movs r1, 0x3A + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + mov r0, r8 + movs r1, 0x39 + movs r2, 0 + bl GetMonData + cmp r4, r0 + beq _0806C6F0 + ldr r0, [sp, 0x18] + cmp r0, 0 + bne _0806C6E4 + mov r0, r8 + movs r1, 0x39 + movs r2, 0 + bl GetMonData + ldr r1, [sp] + adds r0, r1 + str r0, [sp] + mov r0, r8 + movs r1, 0x3A + movs r2, 0 + bl GetMonData + ldr r1, [sp] + cmp r1, r0 + bls _0806C65E + mov r0, r8 + movs r1, 0x3A + movs r2, 0 + bl GetMonData + str r0, [sp] +_0806C65E: + mov r0, r8 + movs r1, 0x39 + mov r2, sp + bl SetMonData + ldr r0, =gMain + ldr r1, =0x00000439 + adds r0, r1 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0806C6EC + ldr r2, [sp, 0x38] + cmp r2, 0x4 + beq _0806C6EC + ldr r1, =gBattleMons + movs r0, 0x58 + muls r0, r2 + adds r0, r1 + ldr r1, [sp] + strh r1, [r0, 0x28] + movs r0, 0x10 + mov r3, r10 + ands r0, r3 + cmp r0, 0 + bne _0806C6EC + ldr r4, =gActiveBank + ldrb r0, [r4] + bl GetBankSide + lsls r0, 24 + cmp r0, 0 + bne _0806C6EC + ldr r1, =gBattleResults + ldrb r0, [r1, 0x3] + cmp r0, 0xFE + bhi _0806C6AE + adds r0, 0x1 + strb r0, [r1, 0x3] +_0806C6AE: + ldrb r5, [r4] + add r0, sp, 0x38 + ldrb r0, [r0] + strb r0, [r4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + bl dp01_build_cmdbuf_x00_a_b_0 + ldrb r0, [r4] + bl dp01_battle_side_mark_buffer_for_execution + strb r5, [r4] + b _0806C6EC + .pool +_0806C6E4: + ldr r1, =gBattleMoveDamage + ldr r0, [sp] + negs r0, r0 + str r0, [r1] +_0806C6EC: + movs r1, 0 + str r1, [sp, 0x20] +_0806C6F0: + movs r0, 0xEF + mov r2, r10 + ands r2, r0 + mov r10, r2 + b _0806C9AA + .pool +_0806C700: + movs r7, 0x2 + mov r0, r10 + ands r0, r7 + cmp r0, 0 + beq _0806C70C + b _0806C858 +_0806C70C: + movs r5, 0 + ldr r3, [sp, 0x28] + adds r3, 0x1 + str r3, [sp, 0x40] +_0806C714: + movs r0, 0x11 + adds r0, r5 + mov r9, r0 + mov r0, r8 + mov r1, r9 + movs r2, 0 + bl GetMonData + str r0, [sp] + adds r7, r5, 0 + adds r7, 0xD + mov r0, r8 + adds r1, r7, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + lsls r0, r5, 24 + lsrs r6, r0, 24 + adds r0, r4, 0 + adds r2, r6, 0 + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + ldr r1, [sp] + cmp r1, r0 + beq _0806C832 + ldr r2, [sp, 0x24] + ldr r3, [sp, 0x28] + adds r0, r2, r3 + ldrb r0, [r0] + adds r0, r1, r0 + str r0, [sp] + mov r0, r8 + adds r1, r7, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + adds r2, r6, 0 + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + ldr r1, [sp] + cmp r1, r0 + bls _0806C7CC + mov r0, r8 + adds r1, r7, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + adds r2, r6, 0 + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + str r0, [sp] +_0806C7CC: + mov r0, r8 + mov r1, r9 + mov r2, sp + bl SetMonData + ldr r0, =gMain + ldr r1, =0x00000439 + adds r0, r1 + ldrb r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _0806C82E + ldr r2, [sp, 0x38] + cmp r2, 0x4 + beq _0806C82E + ldr r4, =gBattleMons + movs r0, 0x58 + adds r3, r2, 0 + muls r3, r0 + adds r0, r4, 0 + adds r0, 0x50 + adds r0, r3, r0 + ldr r1, [r0] + movs r0, 0x80 + lsls r0, 14 + ands r1, r0 + cmp r1, 0 + bne _0806C82E + ldr r1, =gDisableStructs + lsls r0, r2, 3 + subs r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r1, [r0, 0x18] + lsrs r1, 4 + ldr r2, =gBitTable + lsls r0, r5, 2 + adds r0, r2 + ldr r0, [r0] + ands r1, r0 + cmp r1, 0 + bne _0806C82E + adds r0, r5, r3 + adds r1, r4, 0 + adds r1, 0x24 + adds r0, r1 + ldr r1, [sp] + strb r1, [r0] +_0806C82E: + movs r3, 0 + str r3, [sp, 0x20] +_0806C832: + adds r5, 0x1 + cmp r5, 0x3 + bgt _0806C83A + b _0806C714 +_0806C83A: + ldr r5, [sp, 0x40] + lsls r0, r5, 24 +_0806C83E: + lsrs r0, 24 + str r0, [sp, 0x28] + b _0806C9AA + .pool +_0806C858: + ldr r6, [sp, 0x14] + adds r6, 0x11 + mov r0, r8 + adds r1, r6, 0 + movs r2, 0 + bl GetMonData + str r0, [sp] + ldr r5, [sp, 0x14] + adds r5, 0xD + mov r0, r8 + adds r1, r5, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + ldr r2, [sp, 0x14] + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + ldr r2, [sp] + cmp r2, r0 + bne _0806C8A0 + b _0806C9AA +_0806C8A0: + ldr r1, [sp, 0x28] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x28] + ldr r0, [sp, 0x24] + adds r1, r0, r1 + ldrb r0, [r1] + adds r0, r2, r0 + str r0, [sp] + mov r0, r8 + adds r1, r5, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + ldr r2, [sp, 0x14] + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + ldr r1, [sp] + cmp r1, r0 + bls _0806C914 + mov r0, r8 + adds r1, r5, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + ldr r2, [sp, 0x14] + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + str r0, [sp] +_0806C914: + mov r0, r8 + adds r1, r6, 0 + mov r2, sp + bl SetMonData + ldr r0, =gMain + ldr r1, =0x00000439 + adds r0, r1 + ldrb r1, [r0] + adds r0, r7, 0 + ands r0, r1 + cmp r0, 0 + beq _0806C978 + ldr r2, [sp, 0x38] + cmp r2, 0x4 + beq _0806C978 + ldr r4, =gBattleMons + movs r0, 0x58 + adds r3, r2, 0 + muls r3, r0 + adds r0, r4, 0 + adds r0, 0x50 + adds r0, r3, r0 + ldr r0, [r0] + movs r1, 0x80 + lsls r1, 14 + ands r0, r1 + cmp r0, 0 + bne _0806C978 + ldr r1, =gDisableStructs + lsls r0, r2, 3 + subs r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r1, [r0, 0x18] + lsrs r1, 4 + ldr r2, =gBitTable + ldr r5, [sp, 0x14] + lsls r0, r5, 2 + adds r0, r2 + ldr r0, [r0] + ands r1, r0 + cmp r1, 0 + bne _0806C978 + adds r0, r5, r3 + adds r1, r4, 0 + adds r1, 0x24 + adds r0, r1 + ldr r1, [sp] + strb r1, [r0] +_0806C978: + movs r0, 0 + str r0, [sp, 0x20] + b _0806C9AA + .pool +_0806C994: + mov r0, r8 + movs r1, 0x2 + ldr r2, [sp, 0xC] + bl GetEvolutionTargetSpecies + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, 0 + beq _0806C9AA + bl _0806BEE0 +_0806C9AA: + ldr r1, [sp, 0x2C] + adds r1, 0x1 + str r1, [sp, 0x2C] + mov r2, r10 + lsrs r2, 1 + mov r10, r2 + cmp r2, 0 + beq _0806C9BC + b _0806C3E6 +_0806C9BC: + b _0806CD4C +_0806C9BE: + ldr r3, [sp, 0x24] + ldr r5, [sp, 0x1C] + adds r0, r3, r5 + ldrb r0, [r0] + mov r10, r0 + movs r0, 0 + str r0, [sp, 0x2C] + mov r1, r10 + cmp r1, 0 + bne _0806C9D4 + b _0806CD4C +_0806C9D4: + movs r0, 0x1 + mov r2, r10 + ands r0, r2 + cmp r0, 0 + bne _0806C9E0 + b _0806CD3A +_0806C9E0: + ldr r3, [sp, 0x2C] + cmp r3, 0x7 + bls _0806C9E8 + b _0806CD3A +_0806C9E8: + lsls r0, r3, 2 + ldr r1, =_0806C9F8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0806C9F8: + .4byte _0806CA18 + .4byte _0806CA18 + .4byte _0806CA18 + .4byte _0806CA18 + .4byte _0806CAB8 + .4byte _0806CB94 + .4byte _0806CC00 + .4byte _0806CC68 +_0806CA18: + mov r0, r8 + bl sub_806DC8C + lsls r0, 16 + lsrs r6, r0, 16 + ldr r5, [sp, 0x24] + ldr r1, [sp, 0x28] + adds r0, r5, r1 + ldrb r5, [r0] + ldr r0, =gUnknown_08329EC2 + ldr r4, [sp, 0x2C] + adds r4, 0x2 + adds r0, r4, r0 + ldrb r1, [r0] + mov r0, r8 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + str r1, [sp, 0x4] + lsls r0, r5, 24 + asrs r2, r0, 24 + cmp r2, 0 + ble _0806CA84 + ldr r0, =0x000001fd + cmp r6, r0 + bls _0806CA52 + bl _0806BEF0 +_0806CA52: + adds r3, r1, 0 + cmp r3, 0x63 + ble _0806CA5A + b _0806CD3A +_0806CA5A: + adds r1, r3, r2 + cmp r1, 0x64 + ble _0806CA70 + adds r0, r2, 0 + adds r0, 0x64 + subs r5, r0, r1 + b _0806CA72 + .pool +_0806CA70: + adds r5, r2, 0 +_0806CA72: + adds r1, r6, r5 + movs r0, 0xFF + lsls r0, 1 + cmp r1, r0 + bls _0806CA80 + adds r0, r5, r0 + subs r5, r0, r1 +_0806CA80: + adds r0, r3, r5 + b _0806CA98 +_0806CA84: + cmp r1, 0 + bne _0806CA8E + movs r2, 0x1 + str r2, [sp, 0x3C] + b _0806CD30 +_0806CA8E: + adds r0, r1, r2 + str r0, [sp, 0x4] + cmp r0, 0 + bge _0806CA9A + movs r0, 0 +_0806CA98: + str r0, [sp, 0x4] +_0806CA9A: + ldr r0, =gUnknown_08329EC2 + adds r0, r4, r0 + ldrb r1, [r0] + add r2, sp, 0x4 + mov r0, r8 + bl SetMonData + mov r0, r8 + bl CalculateMonStats + movs r3, 0 + str r3, [sp, 0x20] + b _0806CD30 + .pool +_0806CAB8: + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + ldr r1, =gUnknown_08329D22 + ldr r5, [sp, 0x14] + adds r1, r5, r1 + ldrb r1, [r1] + ands r0, r1 + lsls r1, r5, 1 + lsrs r0, r1 + str r0, [sp] + adds r6, r5, 0 + adds r6, 0xD + mov r0, r8 + adds r1, r6, 0 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + ldr r2, [sp, 0x14] + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, [sp] + cmp r0, 0x2 + bls _0806CB0A + b _0806CD3A +_0806CB0A: + cmp r5, 0x4 + bhi _0806CB10 + b _0806CD3A +_0806CB10: + mov r0, r8 + movs r1, 0x15 + movs r2, 0 + bl GetMonData + str r0, [sp] + ldr r1, =gUnknown_08329D26 + ldr r2, [sp, 0x14] + adds r1, r2, r1 + ldrb r2, [r1] + ands r2, r0 + str r2, [sp] + ldr r0, =gUnknown_08329D2A + ldr r3, [sp, 0x14] + adds r0, r3, r0 + ldrb r1, [r0] + lsls r0, r1, 1 + adds r0, r1 + adds r2, r0 + str r2, [sp] + mov r0, r8 + movs r1, 0x15 + mov r2, sp + bl SetMonData + mov r0, r8 + adds r1, r6, 0 + movs r2, 0 + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + ldr r1, [sp] + lsls r1, 24 + lsrs r1, 24 + ldr r2, [sp, 0x14] + bl CalculatePPWithBonus + lsls r0, 24 + lsrs r0, 24 + subs r0, r5 + str r0, [sp] + ldr r4, [sp, 0x14] + adds r4, 0x11 + mov r0, r8 + adds r1, r4, 0 + movs r2, 0 + bl GetMonData + ldr r1, [sp] + adds r0, r1 + str r0, [sp] + mov r0, r8 + adds r1, r4, 0 + mov r2, sp + bl SetMonData + movs r5, 0 + str r5, [sp, 0x20] + b _0806CD3A + .pool +_0806CB94: + mov r0, r8 + movs r1, 0x20 + movs r2, 0 + bl GetMonData + cmp r0, 0x63 + bls _0806CBA4 + b _0806CD30 +_0806CBA4: + ldr r0, [sp, 0x20] + cmp r0, 0 + beq _0806CBB2 + ldr r1, [sp, 0x3C] + cmp r1, 0 + bne _0806CBB2 + b _0806CD30 +_0806CBB2: + bl sub_806F104 + lsls r0, 24 + cmp r0, 0 + beq _0806CBBE + b _0806CD30 +_0806CBBE: + ldr r2, [sp, 0x30] + cmp r2, 0 + beq _0806CBC6 + b _0806CD30 +_0806CBC6: + ldr r3, [sp, 0x24] + ldr r5, [sp, 0x28] + adds r0, r3, r5 + ldrb r0, [r0] + str r0, [sp, 0x30] + mov r0, r8 + movs r1, 0x20 + movs r2, 0 + bl GetMonData + adds r5, r0, 0 + str r5, [sp, 0x8] + ldr r0, [sp, 0x30] + lsls r4, r0, 24 + asrs r1, r4, 24 + cmp r1, 0 + ble _0806CCCC + ldr r2, [sp, 0x34] + cmp r2, 0x1B + bne _0806CCCC + movs r0, 0x96 + muls r0, r1 + movs r1, 0x64 + bl __divsi3 + adds r0, r5, r0 + str r0, [sp, 0x8] + adds r2, r4, 0 + b _0806CCD8 +_0806CC00: + mov r0, r8 + movs r1, 0x20 + movs r2, 0 + bl GetMonData + cmp r0, 0x63 + bhi _0806CC10 + b _0806CD30 +_0806CC10: + mov r0, r8 + movs r1, 0x20 + movs r2, 0 + bl GetMonData + cmp r0, 0xC7 + bls _0806CC20 + b _0806CD30 +_0806CC20: + ldr r0, [sp, 0x20] + cmp r0, 0 + beq _0806CC2E + ldr r1, [sp, 0x3C] + cmp r1, 0 + bne _0806CC2E + b _0806CD30 +_0806CC2E: + bl sub_806F104 + lsls r0, 24 + cmp r0, 0 + bne _0806CD30 + ldr r2, [sp, 0x30] + cmp r2, 0 + bne _0806CD30 + ldr r3, [sp, 0x24] + ldr r5, [sp, 0x28] + adds r0, r3, r5 + ldrb r0, [r0] + str r0, [sp, 0x30] + mov r0, r8 + movs r1, 0x20 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + str r4, [sp, 0x8] + ldr r0, [sp, 0x30] + lsls r5, r0, 24 + asrs r1, r5, 24 + cmp r1, 0 + ble _0806CCCC + ldr r2, [sp, 0x34] + cmp r2, 0x1B + beq _0806CCBA + b _0806CCCC +_0806CC68: + mov r0, r8 + movs r1, 0x20 + movs r2, 0 + bl GetMonData + cmp r0, 0xC7 + bls _0806CD30 + ldr r0, [sp, 0x20] + cmp r0, 0 + beq _0806CC82 + ldr r1, [sp, 0x3C] + cmp r1, 0 + beq _0806CD30 +_0806CC82: + bl sub_806F104 + lsls r0, 24 + cmp r0, 0 + bne _0806CD30 + ldr r2, [sp, 0x30] + cmp r2, 0 + bne _0806CD30 + ldr r3, [sp, 0x24] + ldr r5, [sp, 0x28] + adds r0, r3, r5 + ldrb r0, [r0] + str r0, [sp, 0x30] + mov r0, r8 + movs r1, 0x20 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + str r4, [sp, 0x8] + ldr r0, [sp, 0x30] + lsls r5, r0, 24 + asrs r1, r5, 24 + cmp r1, 0 + ble _0806CCCC + ldr r2, [sp, 0x34] + cmp r2, 0x1B + bne _0806CCCC +_0806CCBA: + movs r0, 0x96 + muls r0, r1 + movs r1, 0x64 + bl __divsi3 + adds r0, r4, r0 + str r0, [sp, 0x8] + adds r2, r5, 0 + b _0806CCD8 +_0806CCCC: + ldr r3, [sp, 0x30] + lsls r2, r3, 24 + asrs r1, r2, 24 + ldr r0, [sp, 0x8] + adds r0, r1 + str r0, [sp, 0x8] +_0806CCD8: + cmp r2, 0 + ble _0806CD0E + mov r0, r8 + movs r1, 0x26 + movs r2, 0 + bl GetMonData + cmp r0, 0xB + bne _0806CCF0 + ldr r0, [sp, 0x8] + adds r0, 0x1 + str r0, [sp, 0x8] +_0806CCF0: + mov r0, r8 + movs r1, 0x23 + movs r2, 0 + bl GetMonData + adds r4, r0, 0 + bl sav1_map_get_name + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + bne _0806CD0E + ldr r0, [sp, 0x8] + adds r0, 0x1 + str r0, [sp, 0x8] +_0806CD0E: + ldr r0, [sp, 0x8] + cmp r0, 0 + bge _0806CD18 + movs r0, 0 + str r0, [sp, 0x8] +_0806CD18: + ldr r0, [sp, 0x8] + cmp r0, 0xFF + ble _0806CD22 + movs r0, 0xFF + str r0, [sp, 0x8] +_0806CD22: + add r2, sp, 0x8 + mov r0, r8 + movs r1, 0x20 + bl SetMonData + movs r5, 0 + str r5, [sp, 0x20] +_0806CD30: + ldr r0, [sp, 0x28] + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp, 0x28] +_0806CD3A: + ldr r0, [sp, 0x2C] + adds r0, 0x1 + str r0, [sp, 0x2C] + mov r1, r10 + lsrs r1, 1 + mov r10, r1 + cmp r1, 0 + beq _0806CD4C + b _0806C9D4 +_0806CD4C: + ldr r2, [sp, 0x1C] + adds r2, 0x1 + str r2, [sp, 0x1C] + cmp r2, 0x5 + bgt _0806CD5A + bl _0806BEFC +_0806CD5A: + ldr r0, [sp, 0x20] +_0806CD5C: + add sp, 0x44 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end ExecuteTableBasedItemEffect + + .align 2, 0 @ Don't pad with nop. + \ No newline at end of file diff --git a/asm/recorded_battle.s b/asm/recorded_battle.s index 9f76ff3df..128b155d6 100644 --- a/asm/recorded_battle.s +++ b/asm/recorded_battle.s @@ -2115,7 +2115,7 @@ sub_8185FD0: @ 8185FD0 movs r3, 0 ldr r7, =gUnknown_0203CC70 adds r6, r4, 0 - ldr r5, =gUnknown_02024090 + ldr r5, =gBattleMons + 0xC movs r4, 0x58 _08186000: lsls r2, r3, 1 @@ -2192,7 +2192,7 @@ _0818608A: movs r1, 0x58 mov r0, r10 muls r0, r1 - ldr r3, =gUnknown_02024090 + ldr r3, =gBattleMons + 0xC adds r1, r0, r3 _081860AA: ldrh r0, [r1] @@ -2227,7 +2227,7 @@ _081860DE: lsls r0, r5, 1 adds r5, 0x1 adds r0, r7 - ldr r1, =gUnknown_02024090 + ldr r1, =gBattleMons + 0xC adds r3, r0, r1 lsls r0, r4, 3 mov r6, r8 @@ -2341,7 +2341,7 @@ _081861A6: adds r1, r2, r5 ldrb r0, [r4] adds r0, r7 - ldr r3, =gUnknown_020240A8 + ldr r3, =gBattleMons + 0x24 adds r0, r3 ldrb r0, [r0] strb r0, [r1] diff --git a/asm/rom_8034C54.s b/asm/rom_8034C54.s index 8cf508e34..2c72549a3 100644 --- a/asm/rom_8034C54.s +++ b/asm/rom_8034C54.s @@ -9790,7 +9790,7 @@ _0803A2D4: ldrb r7, [r7] cmp r5, r7 bge _0803A348 - ldr r0, =gUnknown_020240D4 + ldr r0, =gBattleMons + 0x50 mov r8, r0 ldr r4, =gDisableStructs ldr r3, =gStatuses3 @@ -9945,7 +9945,7 @@ _0803A430: ldrb r7, [r7] cmp r5, r7 bge _0803A490 - ldr r3, =gUnknown_020240D4 + ldr r3, =gBattleMons + 0x50 ldr r7, =gBitTable ldr r6, =gActiveBank _0803A448: @@ -11062,7 +11062,7 @@ _0803AD0E: movs r2, 0 ldr r4, =gActiveBank movs r5, 0x58 - ldr r1, =gUnknown_0202409C + ldr r1, =gBattleMons + 0x18 adds r6, r4, 0 movs r0, 0x18 negs r0, r0 @@ -15568,7 +15568,7 @@ sub_803D580: @ 803D580 beq _0803D678 ldr r7, =gProtectStructs adds r6, r5, 0 - ldr r0, =gUnknown_020240D4 + ldr r0, =gBattleMons + 0x50 mov r12, r0 ldr r1, =gDisableStructs mov r8, r1 @@ -19047,7 +19047,7 @@ _0803F6AE: ldrh r0, [r1] cmp r0, 0xC3 beq _0803F6DE - ldr r1, =gUnknown_02024090 + ldr r1, =gBattleMons + 0xC add r1, r9 _0803F6D0: adds r1, 0x2 @@ -19062,7 +19062,7 @@ _0803F6DE: beq _0803F6F4 adds r6, r2, 0 adds r0, r6, r5 - ldr r2, =gUnknown_020240A8 + ldr r2, =gBattleMons + 0x24 adds r1, r0, r2 ldrb r0, [r1] cmp r0, 0 diff --git a/asm/rom_8161F74.s b/asm/rom_8161F74.s index a822d8669..056b76f19 100644 --- a/asm/rom_8161F74.s +++ b/asm/rom_8161F74.s @@ -5381,7 +5381,7 @@ sub_8164E04: @ 8164E04 movs r2, 0 movs r5, 0xBE lsls r5, 4 - ldr r3, =gUnknown_020240B4 + ldr r3, =gBattleMons + 0x30 adds r6, r4, 0 _08164E7C: ldr r0, [r4] diff --git a/asm/rom_817C95C.s b/asm/rom_817C95C.s index a1cbcb164..68963869a 100644 --- a/asm/rom_817C95C.s +++ b/asm/rom_817C95C.s @@ -4606,7 +4606,7 @@ _0817F11A: movs r0, 0x58 adds r4, r3, 0 muls r4, r0 - ldr r5, =gUnknown_02024090 + ldr r5, =gBattleMons + 0xC adds r3, r4, r5 lsls r0, r7, 1 adds r0, r4 diff --git a/asm/rom_818CFC8.s b/asm/rom_818CFC8.s index f3b7bfabc..9afa548a0 100644 --- a/asm/rom_818CFC8.s +++ b/asm/rom_818CFC8.s @@ -78954,7 +78954,7 @@ IsHPRecoveryItem: @ 81B62D0 b _081B62F6 .pool _081B62EC: - ldr r1, =gItemEffectInfoPointers + ldr r1, =gItemEffectTable subs r0, 0xD lsls r0, 2 adds r0, r1 @@ -79858,7 +79858,7 @@ dp05_ether: @ 81B6AFC b _081B6B2A .pool _081B6B20: - ldr r1, =gItemEffectInfoPointers + ldr r1, =gItemEffectTable subs r0, 0xD lsls r0, 2 adds r0, r1 @@ -81825,7 +81825,7 @@ _081B7D00: b _081B7D20 .pool _081B7D18: - ldr r1, =gItemEffectInfoPointers + ldr r1, =gItemEffectTable lsls r0, r2, 2 adds r0, r1 ldr r4, [r0] diff --git a/data/item_effect_info.inc b/data/item_effect_info.inc index 0af148be3..adbe86619 100644 --- a/data/item_effect_info.inc +++ b/data/item_effect_info.inc @@ -658,7 +658,7 @@ gTamatoBerryItemEffectInfo:: @ 831E57F .byte 0x02 .align 2 -gItemEffectInfoPointers:: @ 831E58C +gItemEffectTable:: @ 831E58C .4byte gPotionItemEffectInfo .4byte gAntidoteItemEffectInfo .4byte gBurnHealItemEffectInfo diff --git a/ld_script.txt b/ld_script.txt index 8a6387dbc..8b686dc50 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -71,6 +71,7 @@ SECTIONS { src/calculate_base_damage.o(.text); src/pokemon_2.o(.text); asm/pokemon_2.o(.text); + asm/pokemon_item_effect.o(.text); asm/pokemon_3.o(.text); src/trig.o(.text); src/rng.o(.text); diff --git a/src/battle_ai.c b/src/battle_ai.c index 699ba5095..3172eb085 100644 --- a/src/battle_ai.c +++ b/src/battle_ai.c @@ -745,7 +745,7 @@ _08130E10:\n\ ldrb r1, [r0]\n\ movs r0, 0x58\n\ muls r0, r1\n\ - ldr r2, =gUnknown_02024090\n\ + ldr r2, =gBattleMons + 0xC\n\ adds r0, r2\n\ adds r4, r0, 0x2\n\ add r7, sp, 0x14\n\ diff --git a/sym_ewram.txt b/sym_ewram.txt index b03fe1c8f..5dabaf3a4 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -290,22 +290,10 @@ gUnknown_02023060: @ 2023060 .space 0x4 gBattleBufferA: @ 2023064 - .space 0x2 - -gUnknown_02023066: @ 2023066 - .space 0x1 - -gUnknown_02023067: @ 2023067 - .space 0x1 - -gUnknown_02023068: @ 2023068 - .space 0x7FC + .space 0x800 gBattleBufferB: @ 2023864 - .space 0x4 - -gUnknown_02023868: @ 2023868 - .space 0x7FC + .space 0x800 gActiveBank: @ 2024064 .space 0x4 @@ -335,31 +323,7 @@ gFightStateTracker: @ 2024083 .space 0x1 gBattleMons: @ 2024084 - .space 0xC - -gUnknown_02024090: @ 2024090 - .space 0xC - -gUnknown_0202409C: @ 202409C - .space 0xC - -gUnknown_020240A8: @ 20240A8 - .space 0x4 - -gUnknown_020240AC: @ 20240AC - .space 0x8 - -gUnknown_020240B4: @ 20240B4 - .space 0x18 - -gUnknown_020240CC: @ 20240CC - .space 0x4 - -gUnknown_020240D0: @ 20240D0 - .space 0x4 - -gUnknown_020240D4: @ 20240D4 - .space 0x110 + .space 0x160 gBankSpriteIds: @ 20241E4 .space 0x4 @@ -524,10 +488,7 @@ gUnknown_02024402: @ 2024402 .space 0x2 gEnigmaBerries: @ 2024404 - .space 0x8 - -gUnknown_0202440C: @ 202440C - .space 0x68 + .space 0x70 gBattleScripting: @ 2024474 .space 0x4