diff --git a/asm/battle_2.s b/asm/battle_2.s index dd3e6d38c..502f2bab8 100644 --- a/asm/battle_2.s +++ b/asm/battle_2.s @@ -6434,7 +6434,7 @@ _08039FDC: strb r1, [r0] ldr r2, =gBattleWeather strh r1, [r2] - ldr r1, =gUnknown_020243D0 + ldr r1, =gWishFutureKnock movs r2, 0 movs r3, 0 _0803A004: @@ -7808,7 +7808,7 @@ _0803ABD4: movs r2, 0 bl dp01_build_cmdbuf_x00_a_b_0 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldrb r0, [r5] adds r0, 0x1 strb r0, [r5] @@ -7857,7 +7857,7 @@ bc_load_battlefield: @ 803AC34 movs r0, 0 bl dp01_build_cmdbuf_x2E_a ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattleMainFunc ldr r0, =sub_803AC84 str r0, [r1] @@ -8040,7 +8040,7 @@ _0803ADCA: movs r0, 0 bl dp01_build_cmdbuf_x07_7_7_7 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803ADE4: ldr r5, =gBattleTypeFlags ldr r0, [r5] @@ -8057,7 +8057,7 @@ _0803ADE4: movs r0, 0 bl dp01_build_cmdbuf_x07_7_7_7 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803AE0A: ldrb r0, [r4] bl GetBankSide @@ -8114,7 +8114,7 @@ _0803AE96: movs r0, 0 bl dp01_build_cmdbuf_x04_4_4_4 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlePartyID ldrb r0, [r4] lsls r0, 1 @@ -8153,7 +8153,7 @@ _0803AEEA: movs r0, 0 bl dp01_build_cmdbuf_x07_7_7_7 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803AEF6: ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -8172,7 +8172,7 @@ _0803AEF6: movs r0, 0 bl dp01_build_cmdbuf_x07_7_7_7 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803AF20: ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -8282,7 +8282,7 @@ _0803AFFA: movs r2, 0x80 bl dp01_build_cmdbuf_x30_TODO ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution movs r7, 0 mov r6, r8 mov r5, sp @@ -8334,7 +8334,7 @@ _0803B072: movs r2, 0x80 bl dp01_build_cmdbuf_x30_TODO ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattleMainFunc ldr r0, =bc_battle_begin_message b _0803B10A @@ -8522,7 +8522,7 @@ _0803B20E: movs r0, 0 bl dp01_build_cmdbuf_x2F_2F_2F_2F ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803B228: ldrb r0, [r4] adds r0, 0x1 @@ -8596,7 +8596,7 @@ _0803B2B2: movs r0, 0 bl dp01_build_cmdbuf_x2F_2F_2F_2F ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, =gBattleTypeFlags ldr r0, [r0] ldr r1, =0x00008040 @@ -8793,7 +8793,7 @@ _0803B45E: movs r0, 0 bl dp01_build_cmdbuf_x2F_2F_2F_2F ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803B478: ldrb r0, [r4] adds r0, 0x1 @@ -8877,7 +8877,7 @@ _0803B51A: movs r0, 0 bl dp01_build_cmdbuf_x2F_2F_2F_2F ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, =gBattleTypeFlags ldr r0, [r0] movs r1, 0x40 @@ -8949,7 +8949,7 @@ _0803B5B2: movs r2, 0 bl dp01_build_cmdbuf_x05_a_b_c ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803B5D4: ldrb r0, [r4] adds r0, 0x1 @@ -9177,7 +9177,7 @@ _0803B79A: ldrb r1, [r0] movs r0, 0 movs r2, 0 - bl berry_effects_maybe + bl ItemBattleEffects lsls r0, 24 cmp r0, 0 beq _0803B7BC @@ -9208,7 +9208,7 @@ _0803B7DA: mov r8, r1 movs r7, 0x6 ldr r6, =gUnknown_0202421C - ldr r2, =gUnknown_02024274 + ldr r2, =gChosenMovesByBanks movs r4, 0xFF movs r3, 0 _0803B7EA: @@ -9328,7 +9328,7 @@ bc_8013B1C: @ 803B904 cmp r0, 0 bne _0803B994 ldr r1, =gBattleMainFunc - ldr r0, =sub_803B9BC + ldr r0, =BattleTurnPassed str r0, [r1] ldr r3, =gNoOfAllBanks ldr r1, =gBattleCommunication @@ -9404,8 +9404,8 @@ _0803B994: .pool thumb_func_end bc_8013B1C - thumb_func_start sub_803B9BC -sub_803B9BC: @ 803B9BC + thumb_func_start BattleTurnPassed +BattleTurnPassed: @ 803B9BC push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -9416,13 +9416,13 @@ sub_803B9BC: @ 803B9BC ldrb r0, [r0] cmp r0, 0 bne _0803B9EA - bl sub_80401D0 + bl UpdateTurnCounters lsls r0, 24 cmp r0, 0 beq _0803B9DE b _0803BB78 _0803B9DE: - bl sub_8040924 + bl TurnBasedEffects lsls r0, 24 cmp r0, 0 beq _0803B9EA @@ -9514,7 +9514,7 @@ _0803BAB2: ldr r7, =gUnknown_0202421C movs r6, 0xFF movs r5, 0 - ldr r3, =gUnknown_02024274 + ldr r3, =gChosenMovesByBanks _0803BACC: adds r1, r2, r7 ldrb r0, [r1] @@ -9586,7 +9586,7 @@ _0803BB78: pop {r0} bx r0 .pool - thumb_func_end sub_803B9BC + thumb_func_end BattleTurnPassed thumb_func_start sub_803BB88 sub_803BB88: @ 803BB88 @@ -10178,7 +10178,7 @@ _0803C0A8: .4byte _0803C6C4 .4byte _0803C4B4 _0803C0DC: - bl sub_80400C8 + bl AreAllMovesUnusable lsls r0, 24 cmp r0, 0 beq _0803C134 @@ -10223,7 +10223,7 @@ _0803C134: ldrh r2, [r0, 0x6] cmp r2, 0 beq _0803C188 - ldr r1, =gUnknown_02024274 + ldr r1, =gChosenMovesByBanks lsls r0, r4, 1 adds r0, r1 strh r2, [r0] @@ -10552,7 +10552,7 @@ _0803C410: _0803C42E: ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0803C6C4 .pool _0803C440: @@ -10596,7 +10596,7 @@ _0803C48C: movs r0, 0 bl sub_8033E6C ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0803C6C4 .pool _0803C4B4: @@ -10660,7 +10660,7 @@ _0803C532: movs r0, 0 bl dp01_build_cmdbuf_x32_32_32_32 ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution bl _0803CD70 .pool _0803C550: @@ -10813,7 +10813,7 @@ _0803C6AE: bl dp01_build_cmdbuf_x32_32_32_32 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0803CD70 .pool _0803C6C4: @@ -11083,7 +11083,7 @@ _0803C942: adds r0, r5 ldrb r0, [r0] strb r0, [r1] - ldr r0, =gUnknown_02024274 + ldr r0, =gChosenMovesByBanks ldrb r2, [r6] lsls r5, r2, 1 adds r5, r0 @@ -11299,7 +11299,7 @@ _0803CB66: ldr r4, =gActiveBank _0803CB68: ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803CB6E: ldr r0, =gBattleCommunication ldrb r1, [r4] @@ -12704,7 +12704,7 @@ _0803D71C: ldrb r0, [r1] adds r0, 0x1 strb r0, [r1] - ldr r1, =gUnknown_02024274 + ldr r1, =gChosenMovesByBanks ldrb r3, [r5] lsls r0, r3, 1 adds r0, r1 @@ -13861,7 +13861,7 @@ _0803E2DC: adds r0, r1 adds r3, 0xC adds r0, r3 - ldr r1, =gUnknown_02024274 + ldr r1, =gChosenMovesByBanks lsls r2, 1 adds r2, r1 ldrh r3, [r0] @@ -14400,7 +14400,7 @@ _0803E7EC: movs r0, 0x4 strb r0, [r1, 0x5] ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB6AD + ldr r0, =BattleScript_MoveUsedLoafingAround str r0, [r1] b _0803E824 .pool @@ -15661,7 +15661,7 @@ _0803F430: b _0803F47A .pool _0803F43C: - ldr r0, =gUnknown_0202420E + ldr r0, =gEffectBank ldrb r0, [r0] b _0803F47A .pool @@ -15674,7 +15674,7 @@ _0803F44C: b _0803F47A .pool _0803F458: - ldr r0, =gUnknown_0202420D + ldr r0, =gBank1 ldrb r0, [r0] b _0803F47A .pool @@ -15786,9 +15786,9 @@ _0803F4DE: movs r0, 0 movs r2, 0 movs r3, 0x1 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803F532: add sp, 0x4 pop {r4-r7} @@ -15933,9 +15933,9 @@ _0803F5F0: movs r0, 0 movs r2, 0 movs r3, 0x1 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803F658: add sp, 0x4 pop {r3-r5} @@ -16065,9 +16065,9 @@ _0803F6FE: movs r0, 0 movs r2, 0 movs r3, 0x1 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0803F762: add sp, 0x4 pop {r3-r5} @@ -16132,8 +16132,8 @@ _0803F7EE: .pool thumb_func_end sub_803F790 - thumb_func_start dp01_battle_side_mark_buffer_for_execution -dp01_battle_side_mark_buffer_for_execution: @ 803F800 + thumb_func_start MarkBufferBankForExecution +MarkBufferBankForExecution: @ 803F800 push {lr} lsls r0, 24 lsrs r3, r0, 24 @@ -16167,7 +16167,7 @@ _0803F844: pop {r0} bx r0 .pool - thumb_func_end dp01_battle_side_mark_buffer_for_execution + thumb_func_end MarkBufferBankForExecution thumb_func_start sub_803F850 sub_803F850: @ 803F850 @@ -16312,7 +16312,7 @@ b_std_message: @ 803F964 adds r1, r2, 0 bl dp01_build_cmdbuf_x10_TODO ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution pop {r4} pop {r0} bx r0 diff --git a/asm/battle_3.s b/asm/battle_3.s deleted file mode 100644 index f2e384c86..000000000 --- a/asm/battle_3.s +++ /dev/null @@ -1,11164 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start b_movescr_stack_push -b_movescr_stack_push: @ 803FAD8 - push {r4,lr} - ldr r1, =gBattleResources - ldr r1, [r1] - ldr r3, [r1, 0x8] - adds r4, r3, 0 - adds r4, 0x20 - ldrb r1, [r4] - adds r2, r1, 0x1 - strb r2, [r4] - lsls r1, 24 - lsrs r1, 22 - adds r3, r1 - str r0, [r3] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end b_movescr_stack_push - - thumb_func_start b_movescr_stack_push_cursor -b_movescr_stack_push_cursor: @ 803FAFC - ldr r0, =gBattleResources - ldr r0, [r0] - ldr r2, [r0, 0x8] - adds r3, r2, 0 - adds r3, 0x20 - ldrb r0, [r3] - adds r1, r0, 0x1 - strb r1, [r3] - lsls r0, 24 - lsrs r0, 22 - adds r2, r0 - ldr r0, =gBattlescriptCurrInstr - ldr r0, [r0] - str r0, [r2] - bx lr - .pool - thumb_func_end b_movescr_stack_push_cursor - - thumb_func_start b_movescr_stack_pop_cursor -b_movescr_stack_pop_cursor: @ 803FB24 - ldr r3, =gBattlescriptCurrInstr - ldr r0, =gBattleResources - ldr r0, [r0] - ldr r1, [r0, 0x8] - adds r2, r1, 0 - adds r2, 0x20 - ldrb r0, [r2] - subs r0, 0x1 - strb r0, [r2] - lsls r0, 24 - lsrs r0, 22 - adds r1, r0 - ldr r0, [r1] - str r0, [r3] - bx lr - .pool - thumb_func_end b_movescr_stack_pop_cursor - - thumb_func_start sub_803FB4C -sub_803FB4C: @ 803FB4C - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r6, 0 - ldr r2, =gBattleMons - ldr r1, =gBattleBufferB - ldr r3, =gActiveBank - ldrb r4, [r3] - lsls r0, r4, 9 - adds r1, 0x2 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 1 - movs r1, 0x58 - muls r1, r4 - adds r0, r1 - adds r2, 0xC - adds r0, r2 - ldrh r5, [r0] - ldr r1, =gBattleStruct - lsls r0, r4, 1 - adds r0, 0xC8 - ldr r1, [r1] - adds r1, r0 - mov r8, r1 - ldr r1, =gDisableStructs - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x4] - adds r7, r3, 0 - adds r3, r1, 0 - cmp r0, r5 - bne _0803FC06 - cmp r5, 0 - beq _0803FC06 - ldr r0, =gBattleScripting - strb r4, [r0, 0x17] - ldr r0, =gCurrentMove - strh r5, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0803FBF8 - ldr r1, =gUnknown_02024230 - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DAE2A - str r1, [r0] - ldr r0, =gProtectStructs - ldrb r1, [r7] - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1, 0x2] - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x2] - b _0803FC06 - .pool -_0803FBF8: - ldr r0, =gUnknown_02024220 - ldrb r1, [r7] - lsls r1, 2 - adds r1, r0 - ldr r0, =gUnknown_082DAE1F - str r0, [r1] - movs r6, 0x1 -_0803FC06: - ldr r1, =gLastUsedMovesByBanks - ldrb r2, [r7] - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r5, r0 - bne _0803FC90 - cmp r5, 0xA5 - beq _0803FC90 - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r2 - adds r1, 0x50 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bge _0803FC90 - adds r0, r2, 0 - bl CancelMultiTurnMoves - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0803FC7C - ldr r1, =gUnknown_02024230 - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB098 - str r1, [r0] - ldr r0, =gProtectStructs - ldrb r1, [r7] - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1, 0x2] - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x2] - b _0803FC8E - .pool -_0803FC7C: - ldr r1, =gUnknown_02024220 - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB089 - str r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0803FC8E: - ldr r3, =gDisableStructs -_0803FC90: - ldrb r0, [r7] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r0, [r1, 0x13] - lsls r0, 28 - cmp r0, 0 - beq _0803FD1A - ldr r0, =gBattleMoves - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _0803FD1A - ldr r0, =gCurrentMove - strh r5, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0803FD08 - ldr r1, =gUnknown_02024230 - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB0AF - str r1, [r0] - ldr r0, =gProtectStructs - ldrb r1, [r7] - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1, 0x2] - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x2] - b _0803FD1A - .pool -_0803FD08: - ldr r1, =gUnknown_02024220 - ldrb r0, [r7] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB0A0 - str r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0803FD1A: - ldr r4, =gActiveBank - ldrb r0, [r4] - adds r1, r5, 0 - bl sub_8040130 - lsls r0, 24 - cmp r0, 0 - beq _0803FD8E - ldr r0, =gCurrentMove - strh r5, [r0] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0803FD7C - ldr r1, =gUnknown_02024230 - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB185 - str r1, [r0] - ldr r0, =gProtectStructs - ldrb r1, [r4] - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1, 0x2] - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x2] - b _0803FD8E - .pool -_0803FD7C: - ldr r1, =gUnknown_02024220 - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB181 - str r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0803FD8E: - ldr r1, =gBattleMons - ldr r0, =gActiveBank - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r1, r0, r1 - ldrh r0, [r1, 0x2E] - cmp r0, 0xAF - bne _0803FDC4 - ldr r1, =gEnigmaBerries - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r4, [r0, 0x7] - b _0803FDCE - .pool -_0803FDC4: - ldrh r0, [r1, 0x2E] - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r4, r0, 24 -_0803FDCE: - ldr r2, =gStringBank - ldr r1, =gActiveBank - ldrb r0, [r1] - strb r0, [r2] - ldr r0, =gBattleMons - mov r12, r0 - adds r7, r1, 0 - cmp r4, 0x1D - bne _0803FE58 - mov r0, r8 - ldrh r1, [r0] - adds r2, r1, 0 - cmp r2, 0 - beq _0803FE58 - ldr r0, =0x0000ffff - cmp r2, r0 - beq _0803FE58 - cmp r2, r5 - beq _0803FE58 - ldr r0, =gCurrentMove - strh r1, [r0] - ldr r2, =gLastUsedItem - ldrb r1, [r7] - movs r0, 0x58 - muls r0, r1 - add r0, r12 - ldrh r0, [r0, 0x2E] - strh r0, [r2] - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 10 - ands r1, r0 - ldrb r2, [r7] - cmp r1, 0 - beq _0803FE48 - ldr r0, =gProtectStructs - lsls r1, r2, 4 - adds r1, r0 - ldrb r0, [r1, 0x2] - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x2] - b _0803FE58 - .pool -_0803FE48: - ldr r1, =gUnknown_02024220 - lsls r0, r2, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB812 - str r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0803FE58: - ldr r0, =gBattleBufferB - ldrb r3, [r7] - lsls r1, r3, 9 - adds r0, 0x2 - adds r1, r0 - movs r0, 0x58 - muls r0, r3 - ldrb r1, [r1] - adds r0, r1 - mov r1, r12 - adds r1, 0x24 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0803FEB8 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 10 - ands r0, r1 - cmp r0, 0 - beq _0803FEA8 - ldr r0, =gProtectStructs - lsls r1, r3, 4 - adds r1, r0 - ldrb r0, [r1, 0x2] - movs r2, 0x10 - orrs r0, r2 - strb r0, [r1, 0x2] - b _0803FEB8 - .pool -_0803FEA8: - ldr r1, =gUnknown_02024220 - lsls r0, r3, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB076 - str r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0803FEB8: - adds r0, r6, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_803FB4C - - thumb_func_start CheckMoveLimitations -CheckMoveLimitations: @ 803FECC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - lsls r2, 24 - lsrs r3, r2, 24 - ldr r1, =gBattleStruct - lsls r0, r7, 1 - adds r0, 0xC8 - ldr r1, [r1] - adds r1, r0 - str r1, [sp, 0x4] - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r1, r0, r1 - ldrh r0, [r1, 0x2E] - cmp r0, 0xAF - bne _0803FF1C - ldr r2, =gEnigmaBerries - lsls r1, r7, 3 - subs r0, r1, r7 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x7] - str r0, [sp] - b _0803FF2E - .pool -_0803FF1C: - ldrh r0, [r1, 0x2E] - str r3, [sp, 0x14] - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - lsls r1, r7, 3 - ldr r3, [sp, 0x14] -_0803FF2E: - ldr r0, =gStringBank - strb r7, [r0] - movs r0, 0 - mov r9, r0 - lsls r2, r7, 1 - str r2, [sp, 0xC] - ldr r5, =gDisableStructs - mov r12, r5 - ldr r0, =gBattleMons - movs r2, 0x58 - adds r6, r7, 0 - muls r6, r2 - str r6, [sp, 0x8] - ldr r2, =gBattleMons + 0xC - adds r5, r6, r2 - movs r6, 0 - str r6, [sp, 0x10] - mov r10, r0 - subs r0, r1, r7 - lsls r0, 2 - mov r8, r0 - ldr r6, =gBitTable -_0803FF5A: - ldrh r0, [r5] - cmp r0, 0 - bne _0803FF70 - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _0803FF70 - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0803FF70: - ldr r0, [sp, 0x8] - add r0, r9 - mov r1, r10 - adds r1, 0x24 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0803FF90 - movs r0, 0x2 - ands r0, r3 - cmp r0, 0 - beq _0803FF90 - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0803FF90: - mov r1, r8 - add r1, r12 - ldrh r0, [r5] - ldrh r1, [r1, 0x4] - cmp r0, r1 - bne _0803FFAC - movs r0, 0x4 - ands r0, r3 - cmp r0, 0 - beq _0803FFAC - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0803FFAC: - movs r0, 0x58 - adds r2, r7, 0 - muls r2, r0 - ldr r1, [sp, 0x10] - adds r0, r1, r2 - ldr r1, =gBattleMons + 0xC - adds r0, r1 - mov r12, r0 - ldr r1, =gLastUsedMovesByBanks - ldr r0, [sp, 0xC] - adds r1, r0, r1 - str r1, [sp, 0x18] - mov r1, r12 - ldrh r1, [r1] - mov r12, r1 - ldr r0, [sp, 0x18] - ldrh r0, [r0] - cmp r12, r0 - bne _0803FFEE - movs r0, 0x8 - ands r0, r3 - cmp r0, 0 - beq _0803FFEE - mov r0, r10 - adds r0, 0x50 - adds r0, r2, r0 - ldr r0, [r0] - cmp r0, 0 - bge _0803FFEE - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0803FFEE: - ldr r0, =gDisableStructs - add r0, r8 - ldrb r0, [r0, 0x13] - lsls r0, 28 - cmp r0, 0 - beq _0804001C - movs r0, 0x10 - ands r0, r3 - cmp r0, 0 - beq _0804001C - ldr r2, =gBattleMoves - ldrh r1, [r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1] - cmp r0, 0 - bne _0804001C - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0804001C: - ldrh r1, [r5] - adds r0, r7, 0 - str r3, [sp, 0x14] - bl sub_8040130 - lsls r0, 24 - ldr r3, [sp, 0x14] - cmp r0, 0 - beq _0804003E - movs r0, 0x20 - ands r0, r3 - cmp r0, 0 - beq _0804003E - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0804003E: - ldr r1, =gDisableStructs - mov r0, r8 - adds r2, r0, r1 - ldrb r0, [r2, 0xE] - lsls r0, 28 - mov r12, r1 - cmp r0, 0 - beq _0804005E - ldrh r0, [r2, 0x6] - ldrh r1, [r5] - cmp r0, r1 - beq _0804005E - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_0804005E: - ldr r2, [sp] - cmp r2, 0x1D - bne _08040080 - ldr r0, [sp, 0x4] - ldrh r1, [r0] - cmp r1, 0 - beq _08040080 - ldr r0, =0x0000ffff - cmp r1, r0 - beq _08040080 - ldrh r2, [r5] - cmp r1, r2 - beq _08040080 - ldr r0, [r6] - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_08040080: - adds r6, 0x4 - adds r5, 0x2 - ldr r0, [sp, 0x10] - adds r0, 0x2 - str r0, [sp, 0x10] - movs r1, 0x1 - add r9, r1 - mov r2, r9 - cmp r2, 0x3 - bgt _08040096 - b _0803FF5A -_08040096: - adds r0, r4, 0 - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end CheckMoveLimitations - - thumb_func_start sub_80400C8 -sub_80400C8: @ 80400C8 - push {r4,lr} - ldr r4, =gActiveBank - ldrb r0, [r4] - movs r1, 0 - movs r2, 0xFF - bl CheckMoveLimitations - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xF - bne _0804010C - ldr r0, =gProtectStructs - ldrb r1, [r4] - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - ldr r1, =gUnknown_02024220 - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r1, =gUnknown_082DB072 - str r1, [r0] - b _0804011E - .pool -_0804010C: - ldr r0, =gProtectStructs - ldrb r1, [r4] - lsls r1, 4 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0804011E: - movs r0, 0 - cmp r3, 0xF - bne _08040126 - movs r0, 0x1 -_08040126: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80400C8 - - thumb_func_start sub_8040130 -sub_8040130: @ 8040130 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - movs r6, 0 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r6, r0 - bge _080401B4 - ldr r7, =gBattleMons + 0xC - mov r8, r7 -_0804015A: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - adds r3, r4, 0x1 - cmp r9, r0 - beq _080401AA - ldr r1, =gStatuses3 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 6 - ands r0, r1 - cmp r0, 0 - beq _080401AA - movs r2, 0 - movs r0, 0x58 - adds r1, r4, 0 - muls r1, r0 - adds r0, r1, r7 - ldrh r0, [r0] - cmp r5, r0 - beq _080401A0 - mov r4, r8 - adds r0, r1, r4 -_08040192: - adds r0, 0x2 - adds r2, 0x1 - cmp r2, 0x3 - bgt _080401AA - ldrh r1, [r0] - cmp r5, r1 - bne _08040192 -_080401A0: - cmp r2, 0x3 - bgt _080401AA - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_080401AA: - adds r4, r3, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _0804015A -_080401B4: - adds r0, r6, 0 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8040130 - - thumb_func_start sub_80401D0 -sub_80401D0: @ 80401D0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r9, r0 - ldr r1, =gBankAttacker - mov r2, r9 - strb r2, [r1] - ldr r0, =gNoOfAllBanks - ldrb r4, [r0] - adds r6, r1, 0 - mov r10, r0 - ldr r7, =gBankTarget - ldr r3, =gBattleStruct - mov r12, r3 - cmp r9, r4 - bcs _08040224 - ldr r2, =gAbsentBankFlags - ldrb r1, [r2] - ldr r5, =gBitTable - ldr r0, [r5] - ands r1, r0 - cmp r1, 0 - beq _08040224 - adds r3, r6, 0 -_08040206: - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - lsls r0, 24 - lsrs r0, 24 - cmp r0, r4 - bcs _08040224 - ldrb r0, [r2] - ldrb r1, [r6] - lsls r1, 2 - adds r1, r5 - ldr r1, [r1] - ands r0, r1 - cmp r0, 0 - bne _08040206 -_08040224: - movs r0, 0 - strb r0, [r7] - mov r0, r10 - ldrb r4, [r0] - cmp r4, 0 - beq _0804025E - ldr r2, =gAbsentBankFlags - ldrb r1, [r2] - ldr r5, =gBitTable - ldr r0, [r5] - ands r1, r0 - cmp r1, 0 - beq _0804025E - adds r3, r7, 0 -_08040240: - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - lsls r0, 24 - lsrs r0, 24 - cmp r0, r4 - bcs _0804025E - ldrb r0, [r2] - ldrb r1, [r7] - lsls r1, 2 - adds r1, r5 - ldr r1, [r1] - ands r0, r1 - cmp r0, 0 - bne _08040240 -_0804025E: - mov r1, r12 - ldr r0, [r1] - ldrb r0, [r0, 0x3] - cmp r0, 0xA - bls _0804026A - b _080408F6 -_0804026A: - lsls r0, 2 - ldr r1, =_08040290 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08040290: - .4byte _080402BC - .4byte _08040342 - .4byte _08040408 - .4byte _080404D4 - .4byte _080405B0 - .4byte _08040668 - .4byte _0804071C - .4byte _080407A0 - .4byte _08040810 - .4byte _08040868 - .4byte _080408EC -_080402BC: - movs r5, 0 - ldr r1, =gNoOfAllBanks - mov r10, r1 - ldrb r2, [r1] - cmp r5, r2 - bge _080402D6 - ldr r2, =gTurnOrder -_080402CA: - adds r0, r5, r2 - strb r5, [r0] - adds r5, 0x1 - ldrb r3, [r1] - cmp r5, r3 - blt _080402CA -_080402D6: - movs r5, 0 - b _08040324 - .pool -_080402E4: - adds r4, r5, 0x1 - adds r6, r4, 0 - ldrb r1, [r1] - cmp r6, r1 - bge _08040322 - ldr r7, =gTurnOrder - ldr r0, =gNoOfAllBanks - mov r10, r0 - lsls r1, r5, 24 - mov r8, r1 -_080402F8: - adds r0, r5, r7 - ldrb r0, [r0] - adds r1, r4, r7 - ldrb r1, [r1] - movs r2, 0 - bl b_first_side - lsls r0, 24 - cmp r0, 0 - beq _08040318 - lsls r1, r4, 24 - lsrs r1, 24 - mov r2, r8 - lsrs r0, r2, 24 - bl sub_803CEDC -_08040318: - adds r4, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _080402F8 -_08040322: - adds r5, r6, 0 -_08040324: - mov r1, r10 - ldrb r0, [r1] - subs r0, 0x1 - cmp r5, r0 - blt _080402E4 - ldr r2, =gBattleStruct - ldr r1, [r2] - ldrb r0, [r1, 0x3] - adds r0, 0x1 - strb r0, [r1, 0x3] - ldr r0, [r2] - adds r0, 0xDB - movs r1, 0 - strb r1, [r0] - mov r12, r2 -_08040342: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bls _08040350 - b _0804062C -_08040350: - ldr r3, =gActiveBank - mov r8, r3 - movs r7, 0 - ldr r6, =gBankAttacker - ldr r5, =gBattleTextBuff1 -_0804035A: - ldr r0, [r1] - adds r0, 0xDB - ldrb r4, [r0] - ldr r2, =gSideTimers - lsls r1, r4, 1 - adds r0, r1, r4 - lsls r0, 2 - adds r2, r0, r2 - ldrb r0, [r2, 0x1] - strb r0, [r6] - mov r3, r8 - strb r0, [r3] - ldr r0, =gSideAffecting - adds r3, r1, r0 - ldrh r1, [r3] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080403BC - ldrb r0, [r2] - subs r0, 0x1 - strb r0, [r2] - movs r4, 0xFF - lsls r0, 24 - cmp r0, 0 - bne _080403BC - ldrh r0, [r3] - ldr r2, =0x0000fffe - adds r1, r2, 0 - ands r0, r1 - strh r0, [r3] - ldr r0, =gUnknown_082DACFA - bl b_call_bc_move_exec - movs r0, 0xFD - strb r0, [r5] - movs r0, 0x2 - strb r0, [r5, 0x1] - movs r0, 0x73 - strb r0, [r5, 0x2] - strb r7, [r5, 0x3] - ldrb r0, [r5, 0x4] - orrs r0, r4 - strb r0, [r5, 0x4] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080403BC: - ldr r2, =gBattleStruct - ldr r1, [r2] - adds r1, 0xDB - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - mov r12, r2 - mov r3, r9 - cmp r3, 0 - beq _080403D2 - b _080408FE -_080403D2: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bls _0804035A - b _0804062C - .pool -_08040408: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bls _08040416 - b _08040570 -_08040416: - movs r0, 0x2 - mov r10, r0 - movs r2, 0 - mov r8, r2 - ldr r7, =gBankAttacker - ldr r5, =gBattleTextBuff1 -_08040422: - ldr r0, [r1] - adds r0, 0xDB - ldrb r4, [r0] - ldr r2, =gSideTimers - lsls r1, r4, 1 - adds r0, r1, r4 - lsls r0, 2 - adds r2, r0, r2 - ldrb r0, [r2, 0x3] - strb r0, [r7] - ldr r3, =gActiveBank - strb r0, [r3] - ldr r0, =gSideAffecting - adds r3, r1, r0 - ldrh r1, [r3] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0804048A - ldrb r0, [r2, 0x2] - subs r0, 0x1 - strb r0, [r2, 0x2] - movs r6, 0xFF - lsls r0, 24 - cmp r0, 0 - bne _0804048A - ldrh r0, [r3] - ldr r2, =0x0000fffd - adds r1, r2, 0 - ands r0, r1 - strh r0, [r3] - ldr r0, =gUnknown_082DACFA - bl b_call_bc_move_exec - ldr r0, =gBattleCommunication - strb r4, [r0, 0x5] - movs r0, 0xFD - strb r0, [r5] - mov r3, r10 - strb r3, [r5, 0x1] - movs r0, 0x71 - strb r0, [r5, 0x2] - mov r0, r8 - strb r0, [r5, 0x3] - ldrb r0, [r5, 0x4] - orrs r0, r6 - strb r0, [r5, 0x4] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_0804048A: - ldr r2, =gBattleStruct - ldr r1, [r2] - adds r1, 0xDB - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - mov r12, r2 - mov r1, r9 - cmp r1, 0 - beq _080404A0 - b _080408FE -_080404A0: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bls _08040422 - b _08040570 - .pool -_080404D4: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bhi _08040570 - ldr r0, =gActiveBank - mov r10, r0 - movs r2, 0 - mov r8, r2 - ldr r7, =gBankAttacker - ldr r5, =gBattleTextBuff1 -_080404EC: - ldr r0, [r1] - adds r0, 0xDB - ldrb r4, [r0] - ldr r1, =gSideTimers - lsls r3, r4, 1 - adds r0, r3, r4 - lsls r0, 2 - adds r1, r0, r1 - ldrb r0, [r1, 0x5] - strb r0, [r7] - mov r2, r10 - strb r0, [r2] - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0804054E - subs r0, 0x1 - strb r0, [r1, 0x4] - movs r6, 0xFF - lsls r0, 24 - cmp r0, 0 - bne _0804054E - ldr r2, =gSideAffecting - adds r2, r3, r2 - ldrh r0, [r2] - ldr r3, =0x0000feff - adds r1, r3, 0 - ands r0, r1 - strh r0, [r2] - ldr r0, =gUnknown_082DACFA - bl b_call_bc_move_exec - ldr r0, =gBattleCommunication - strb r4, [r0, 0x5] - movs r0, 0xFD - strb r0, [r5] - movs r0, 0x2 - strb r0, [r5, 0x1] - movs r0, 0x36 - strb r0, [r5, 0x2] - mov r0, r8 - strb r0, [r5, 0x3] - ldrb r0, [r5, 0x4] - orrs r0, r6 - strb r0, [r5, 0x4] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_0804054E: - ldr r2, =gBattleStruct - ldr r1, [r2] - adds r1, 0xDB - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - mov r12, r2 - mov r1, r9 - cmp r1, 0 - beq _08040564 - b _080408FE -_08040564: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bls _080404EC -_08040570: - mov r2, r9 - cmp r2, 0 - beq _08040578 - b _080408FE -_08040578: - mov r3, r12 - ldr r0, [r3] - ldrb r1, [r0, 0x3] - adds r1, 0x1 - strb r1, [r0, 0x3] - ldr r0, [r3] - adds r0, 0xDB - strb r2, [r0] - b _080408F6 - .pool -_080405B0: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bhi _0804062C - ldr r6, =gActiveBank - ldr r5, =gBankAttacker -_080405C0: - ldr r0, [r1] - adds r0, 0xDB - ldrb r4, [r0] - ldr r2, =gSideTimers - lsls r1, r4, 1 - adds r0, r1, r4 - lsls r0, 2 - adds r2, r0, r2 - ldrb r0, [r2, 0x7] - strb r0, [r5] - strb r0, [r6] - ldr r0, =gSideAffecting - adds r3, r1, r0 - ldrh r1, [r3] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0804060A - ldrb r0, [r2, 0x6] - subs r0, 0x1 - strb r0, [r2, 0x6] - lsls r0, 24 - cmp r0, 0 - bne _0804060A - ldrh r0, [r3] - ldr r2, =0x0000ffdf - adds r1, r2, 0 - ands r0, r1 - strh r0, [r3] - ldr r0, =gUnknown_082DAD0B - bl b_call_bc_move_exec - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_0804060A: - ldr r2, =gBattleStruct - ldr r1, [r2] - adds r1, 0xDB - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - mov r12, r2 - mov r3, r9 - cmp r3, 0 - beq _08040620 - b _080408FE -_08040620: - mov r1, r12 - ldr r0, [r1] - adds r0, 0xDB - ldrb r0, [r0] - cmp r0, 0x1 - bls _080405C0 -_0804062C: - mov r0, r9 - cmp r0, 0 - beq _08040634 - b _080408FE -_08040634: - mov r1, r12 - ldr r0, [r1] - ldrb r1, [r0, 0x3] - adds r1, 0x1 - strb r1, [r0, 0x3] - mov r2, r12 - ldr r0, [r2] - adds r0, 0xDB - mov r3, r9 - strb r3, [r0] - b _080408F6 - .pool -_08040668: - mov r2, r12 - ldr r0, [r2] - adds r0, 0xDB - ldr r1, =gNoOfAllBanks - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bcs _080406E8 - ldr r4, =gActiveBank - ldr r5, =gTurnOrder -_0804067C: - ldr r0, [r2] - adds r0, 0xDB - ldrb r0, [r0] - adds r0, r5 - ldrb r0, [r0] - strb r0, [r4] - ldr r0, =gUnknown_020243D0 - adds r0, 0x20 - ldrb r2, [r4] - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _080406C4 - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _080406C4 - ldr r1, =gBattleMons - ldrb r2, [r4] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - beq _080406C4 - ldr r0, =gBankTarget - strb r2, [r0] - ldr r0, =gUnknown_082DB0B7 - bl b_call_bc_move_exec - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080406C4: - ldr r2, =gBattleStruct - ldr r1, [r2] - adds r1, 0xDB - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - mov r12, r2 - mov r3, r9 - cmp r3, 0 - beq _080406DA - b _080408FE -_080406DA: - ldr r0, [r2] - adds r0, 0xDB - ldr r1, =gNoOfAllBanks - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bcc _0804067C -_080406E8: - mov r0, r9 - cmp r0, 0 - beq _080406F0 - b _080408FE -_080406F0: - mov r2, r12 - ldr r1, [r2] - ldrb r0, [r1, 0x3] - adds r0, 0x1 - strb r0, [r1, 0x3] - b _080408F6 - .pool -_0804071C: - ldr r3, =gBattleWeather - ldrh r2, [r3] - movs r0, 0x7 - ands r0, r2 - cmp r0, 0 - bne _0804072A - b _080408C8 -_0804072A: - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - bne _08040776 - ldr r1, =gUnknown_020243D0 - adds r1, 0x28 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08040768 - ldr r0, =0x0000fffe - ands r0, r2 - ldr r1, =0x0000fffd - ands r0, r1 - strh r0, [r3] - ldr r1, =gBattleCommunication - movs r0, 0x2 - strb r0, [r1, 0x5] - b _08040794 - .pool -_08040768: - movs r0, 0x2 - ands r0, r2 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - bne _08040782 - b _08040790 -_08040776: - movs r0, 0x2 - ands r0, r2 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _08040790 -_08040782: - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] - b _08040794 - .pool -_08040790: - ldr r0, =gBattleCommunication - strb r1, [r0, 0x5] -_08040794: - ldr r0, =gUnknown_082DAC2C - b _080408BA - .pool -_080407A0: - ldr r3, =gBattleWeather - ldrh r2, [r3] - movs r0, 0x18 - ands r0, r2 - cmp r0, 0 - bne _080407AE - b _080408C8 -_080407AE: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - bne _080407E8 - ldr r1, =gUnknown_020243D0 - adds r1, 0x28 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _080407E8 - ldr r0, =0x0000fff7 - ands r0, r2 - strh r0, [r3] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DACC9 - b _080407EC - .pool -_080407E8: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DAC47 -_080407EC: - str r0, [r1] - adds r3, r1, 0 - ldr r1, =gBattleScripting - movs r2, 0 - movs r0, 0xC - strb r0, [r1, 0x10] - ldr r0, =gBattleCommunication - strb r2, [r0, 0x5] - b _080408B8 - .pool -_08040810: - ldr r3, =gBattleWeather - ldrh r2, [r3] - movs r0, 0x60 - ands r0, r2 - cmp r0, 0 - beq _080408C8 - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - bne _08040854 - ldr r1, =gUnknown_020243D0 - adds r1, 0x28 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _08040854 - ldr r0, =0x0000ffdf - ands r0, r2 - strh r0, [r3] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DACE0 - b _08040858 - .pool -_08040854: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DACD2 -_08040858: - str r0, [r1] - adds r3, r1, 0 - b _080408B8 - .pool -_08040868: - ldr r3, =gBattleWeather - ldrh r2, [r3] - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _080408C8 - ldr r1, =gUnknown_020243D0 - adds r1, 0x28 - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _080408A4 - ldr r0, =0x0000ff7f - ands r0, r2 - strh r0, [r3] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DACC9 - b _080408A8 - .pool -_080408A4: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DAC47 -_080408A8: - str r0, [r1] - adds r3, r1, 0 - ldr r1, =gBattleScripting - movs r0, 0xD - strb r0, [r1, 0x10] - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] -_080408B8: - ldr r0, [r3] -_080408BA: - bl b_call_bc_move_exec - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080408C8: - ldr r2, =gBattleStruct - ldr r1, [r2] - ldrb r0, [r1, 0x3] - adds r0, 0x1 - strb r0, [r1, 0x3] - mov r12, r2 - b _080408F6 - .pool -_080408EC: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080408F6: - mov r3, r9 - cmp r3, 0 - bne _080408FE - b _0804025E -_080408FE: - ldr r0, =gBattleMainFunc - ldr r1, [r0] - ldr r0, =sub_803B9BC - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80401D0 - - thumb_func_start sub_8040924 -sub_8040924: @ 8040924 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - movs r0, 0 - mov r9, r0 - ldr r2, =gHitMarker - ldr r0, [r2] - ldr r1, =0x01000020 - orrs r0, r1 - str r0, [r2] - ldr r5, =gBattleStruct - ldr r2, [r5] - ldr r0, =gNoOfAllBanks - ldrb r1, [r2, 0x1] - adds r7, r5, 0 - mov r8, r0 - ldrb r3, [r0] - cmp r1, r3 - bcc _08040954 - bl _08041338 -_08040954: - bl _0804132E - .pool -_08040968: - ldr r3, =gActiveBank - ldr r4, =gBankAttacker - ldr r1, =gTurnOrder - ldr r5, [r5] - ldrb r0, [r5, 0x1] - adds r0, r1 - ldrb r0, [r0] - strb r0, [r4] - strb r0, [r3] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r3] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - adds r6, r3, 0 - cmp r1, 0 - beq _080409B0 - ldrb r0, [r5, 0x1] - adds r0, 0x1 - strb r0, [r5, 0x1] - bl _0804131C - .pool -_080409B0: - ldrb r0, [r5] - cmp r0, 0x13 - bls _080409BA - bl _08041312 -_080409BA: - lsls r0, 2 - ldr r1, =_080409C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080409C8: - .4byte _08040A18 - .4byte _08040A78 - .4byte _08040A96 - .4byte _08040AC6 - .4byte _08040B44 - .4byte _08040B8C - .4byte _08040C0C - .4byte _08040C54 - .4byte _08040CB8 - .4byte _08040D00 - .4byte _08040E60 - .4byte _08040F7C - .4byte _08041024 - .4byte _080410E8 - .4byte _0804119C - .4byte _080411BC - .4byte _08041208 - .4byte _08041238 - .4byte _08040AAE - .4byte _08041304 -_08040A18: - ldr r1, =gStatuses3 - ldrb r3, [r6] - lsls r0, r3, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 3 - ands r0, r1 - cmp r0, 0 - bne _08040A30 - bl _080412DE -_08040A30: - ldr r0, =gBattleMons - movs r1, 0x58 - muls r1, r3 - adds r0, r1, r0 - ldrh r2, [r0, 0x28] - ldrh r5, [r0, 0x2C] - cmp r2, r5 - bne _08040A44 - bl _080412DE -_08040A44: - cmp r2, 0 - bne _08040A4C - bl _080412DE -_08040A4C: - ldr r1, =gBattleMoveDamage - ldrh r0, [r0, 0x2C] - lsrs r0, 4 - str r0, [r1] - cmp r0, 0 - bne _08040A5C - movs r0, 0x1 - str r0, [r1] -_08040A5C: - ldr r0, [r1] - negs r0, r0 - str r0, [r1] - ldr r0, =gUnknown_082DB0EE - bl _080412D0 - .pool -_08040A78: - ldrb r1, [r6] - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - bne _08040A92 - bl _080412DE -_08040A92: - bl _080412D4 -_08040A96: - ldrb r1, [r6] - movs r0, 0x1 - movs r2, 0 - bl berry_effects_maybe - lsls r0, 24 - cmp r0, 0 - bne _08040AAA - bl _080412DE -_08040AAA: - bl _080412D4 -_08040AAE: - ldrb r1, [r6] - movs r0, 0x1 - movs r2, 0x1 - bl berry_effects_maybe - lsls r0, 24 - cmp r0, 0 - bne _08040AC2 - bl _080412DE -_08040AC2: - bl _080412D4 -_08040AC6: - ldr r0, =gStatuses3 - ldrb r2, [r6] - lsls r1, r2, 2 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _08040ADC - bl _080412DE -_08040ADC: - ldr r3, =gBattleMons - movs r5, 0x3 - ands r5, r1 - movs r1, 0x58 - adds r0, r5, 0 - muls r0, r1 - adds r0, r3 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _08040AF4 - bl _080412DE -_08040AF4: - adds r0, r2, 0 - muls r0, r1 - adds r0, r3 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _08040B04 - bl _080412DE -_08040B04: - ldr r0, =gBankTarget - strb r5, [r0] - ldr r2, =gBattleMoveDamage - ldrb r0, [r6] - muls r0, r1 - adds r0, r3 - ldrh r0, [r0, 0x2C] - lsrs r0, 3 - str r0, [r2] - cmp r0, 0 - bne _08040B1E - movs r0, 0x1 - str r0, [r2] -_08040B1E: - ldr r1, =gBattleScripting - strb r5, [r1, 0x10] - ldrb r0, [r4] - strb r0, [r1, 0x11] - ldr r0, =gUnknown_082DAD15 - b _080412D0 - .pool -_08040B44: - ldr r2, =gBattleMons - ldrb r1, [r6] - movs r0, 0x58 - adds r3, r1, 0 - muls r3, r0 - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r3, r0 - ldr r0, [r0] - movs r1, 0x8 - ands r0, r1 - cmp r0, 0 - bne _08040B60 - b _080412DE -_08040B60: - adds r1, r3, r2 - ldrh r0, [r1, 0x28] - cmp r0, 0 - bne _08040B6A - b _080412DE -_08040B6A: - ldr r2, =gBattleMoveDamage - ldrh r0, [r1, 0x2C] - lsrs r0, 3 - str r0, [r2] - cmp r0, 0 - bne _08040B7A - movs r0, 0x1 - str r0, [r2] -_08040B7A: - ldr r0, =gUnknown_082DB23D - b _080412D0 - .pool -_08040B8C: - ldr r4, =gBattleMons - ldrb r0, [r6] - movs r7, 0x58 - mov r8, r7 - mov r2, r8 - muls r2, r0 - adds r3, r4, 0 - adds r3, 0x4C - adds r0, r2, r3 - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08040BAA - b _080412DE -_08040BAA: - adds r1, r2, r4 - ldrh r0, [r1, 0x28] - cmp r0, 0 - bne _08040BB4 - b _080412DE -_08040BB4: - ldr r5, =gBattleMoveDamage - ldrh r0, [r1, 0x2C] - lsrs r0, 4 - str r0, [r5] - cmp r0, 0 - bne _08040BC4 - movs r0, 0x1 - str r0, [r5] -_08040BC4: - ldrb r0, [r6] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r2, r0, r3 - ldr r1, [r2] - movs r4, 0xF0 - lsls r4, 4 - adds r0, r1, 0 - ands r0, r4 - cmp r0, r4 - beq _08040BE4 - movs r7, 0x80 - lsls r7, 1 - adds r0, r1, r7 - str r0, [r2] -_08040BE4: - ldrb r0, [r6] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r3 - ldr r0, [r0] - ands r0, r4 - lsrs r0, 8 - ldr r1, [r5] - muls r0, r1 - str r0, [r5] - ldr r0, =gUnknown_082DB23D - b _080412D0 - .pool -_08040C0C: - ldr r2, =gBattleMons - ldrb r1, [r6] - movs r0, 0x58 - adds r3, r1, 0 - muls r3, r0 - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r3, r0 - ldr r0, [r0] - movs r1, 0x10 - ands r0, r1 - cmp r0, 0 - bne _08040C28 - b _080412DE -_08040C28: - adds r1, r3, r2 - ldrh r0, [r1, 0x28] - cmp r0, 0 - bne _08040C32 - b _080412DE -_08040C32: - ldr r2, =gBattleMoveDamage - ldrh r0, [r1, 0x2C] - lsrs r0, 3 - str r0, [r2] - cmp r0, 0 - bne _08040C42 - movs r0, 0x1 - str r0, [r2] -_08040C42: - ldr r0, =gUnknown_082DB25F - b _080412D0 - .pool -_08040C54: - ldr r4, =gBattleMons - ldrb r1, [r6] - movs r0, 0x58 - muls r1, r0 - adds r0, r4, 0 - adds r0, 0x50 - adds r5, r1, r0 - ldr r2, [r5] - movs r0, 0x80 - lsls r0, 20 - ands r0, r2 - cmp r0, 0 - bne _08040C70 - b _080412DE -_08040C70: - adds r3, r1, r4 - ldrh r0, [r3, 0x28] - cmp r0, 0 - bne _08040C7A - b _080412DE -_08040C7A: - adds r0, r4, 0 - adds r0, 0x4C - adds r0, r1, r0 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - beq _08040CAC - ldr r1, =gBattleMoveDamage - ldrh r0, [r3, 0x2C] - lsrs r0, 2 - str r0, [r1] - cmp r0, 0 - bne _08040C9A - movs r0, 0x1 - str r0, [r1] -_08040C9A: - ldr r0, =gUnknown_082DB33F - b _080412D0 - .pool -_08040CAC: - ldr r0, =0xf7ffffff - ands r2, r0 - str r2, [r5] - b _080412DE - .pool -_08040CB8: - ldr r2, =gBattleMons - ldrb r1, [r6] - movs r0, 0x58 - adds r3, r1, 0 - muls r3, r0 - adds r0, r2, 0 - adds r0, 0x50 - adds r0, r3, r0 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 21 - ands r0, r1 - cmp r0, 0 - bne _08040CD6 - b _080412DE -_08040CD6: - adds r1, r3, r2 - ldrh r0, [r1, 0x28] - cmp r0, 0 - bne _08040CE0 - b _080412DE -_08040CE0: - ldr r2, =gBattleMoveDamage - ldrh r0, [r1, 0x2C] - lsrs r0, 2 - str r0, [r2] - cmp r0, 0 - bne _08040CF0 - movs r0, 0x1 - str r0, [r2] -_08040CF0: - ldr r0, =gUnknown_082DB350 - b _080412D0 - .pool -_08040D00: - ldr r3, =gBattleMons - mov r8, r3 - ldrb r0, [r6] - movs r3, 0x58 - adds r1, r0, 0 - muls r1, r3 - movs r5, 0x50 - add r5, r8 - mov r10, r5 - adds r4, r1, r5 - ldr r2, [r4] - movs r5, 0xE0 - lsls r5, 8 - adds r0, r2, 0 - ands r0, r5 - cmp r0, 0 - bne _08040D24 - b _080412DE -_08040D24: - mov r7, r8 - adds r0, r1, r7 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _08040D30 - b _080412DE -_08040D30: - ldr r1, =0xffffe000 - adds r0, r2, r1 - str r0, [r4] - ldrb r4, [r6] - adds r0, r4, 0 - muls r0, r3 - add r0, r10 - ldr r0, [r0] - ands r0, r5 - cmp r0, 0 - beq _08040DC0 - ldr r1, =gBattleScripting - ldr r0, =gBattleStruct - ldr r2, [r0] - lsls r0, r4, 1 - adds r0, r2 - ldrb r0, [r0, 0x4] - strb r0, [r1, 0x10] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r2 - ldrb r0, [r0, 0x5] - strb r0, [r1, 0x11] - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r2 - ldrb r0, [r0, 0x4] - strb r0, [r1, 0x2] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r2 - ldrb r0, [r0, 0x5] - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB30E - str r0, [r1] - ldr r2, =gBattleMoveDamage - ldrb r0, [r6] - muls r0, r3 - add r0, r8 - ldrh r0, [r0, 0x2C] - lsrs r0, 4 - str r0, [r2] - cmp r0, 0 - bne _08040DEC - movs r0, 0x1 - str r0, [r2] - b _08040DEC - .pool -_08040DC0: - ldr r2, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r2] - movs r0, 0x2 - strb r0, [r2, 0x1] - ldrb r1, [r6] - ldr r0, =gBattleStruct - ldr r3, [r0] - lsls r1, 1 - adds r1, r3 - ldrb r0, [r1, 0x4] - strb r0, [r2, 0x2] - ldrb r0, [r6] - lsls r0, 1 - adds r0, r3 - ldrb r0, [r0, 0x5] - strb r0, [r2, 0x3] - movs r0, 0xFF - strb r0, [r2, 0x4] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB320 - str r0, [r1] -_08040DEC: - ldr r0, [r1] - b _080412D0 - .pool -_08040E00: - movs r0, 0x8 - negs r0, r0 - ands r3, r0 - str r3, [r2] - ldrb r0, [r6] - mov r2, r8 - muls r2, r0 - mov r0, r10 - adds r0, 0x50 - adds r2, r0 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] - ldr r0, =gUnknown_082DB234 - bl b_call_bc_move_exec - ldr r4, =gActiveBank - ldrb r0, [r6] - strb r0, [r4] - ldrb r0, [r4] - mov r3, r8 - muls r3, r0 - adds r0, r3, 0 - add r0, r9 - str r0, [sp] - movs r0, 0 - movs r1, 0x28 - movs r2, 0 - movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs - ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution - b _08040EC8 - .pool -_08040E60: - ldr r2, =gBattleMons - ldrb r1, [r6] - movs r0, 0x58 - muls r0, r1 - adds r1, r2, 0 - adds r1, 0x50 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x70 - ands r1, r0 - adds r7, r2, 0 - cmp r1, 0 - beq _08040F6A - movs r0, 0 - strb r0, [r4] - mov r5, r8 - ldrb r0, [r5] - cmp r0, 0 - beq _08040EC8 - mov r10, r7 - adds r6, r4, 0 - movs r1, 0x58 - mov r8, r1 - movs r3, 0x4C - adds r3, r7 - mov r9, r3 - str r0, [sp, 0x4] - movs r5, 0x7 - mov r12, r5 -_08040E9A: - ldrb r4, [r6] - mov r1, r8 - muls r1, r4 - mov r0, r9 - adds r2, r1, r0 - ldr r3, [r2] - adds r0, r3, 0 - mov r5, r12 - ands r0, r5 - cmp r0, 0 - beq _08040EBA - adds r0, r1, r7 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0x2B - bne _08040E00 -_08040EBA: - adds r0, r4, 0x1 - strb r0, [r6] - lsls r0, 24 - lsrs r0, 24 - ldr r1, [sp, 0x4] - cmp r0, r1 - bcc _08040E9A -_08040EC8: - ldr r2, =gBankAttacker - ldr r1, =gNoOfAllBanks - ldrb r0, [r2] - ldrb r1, [r1] - cmp r0, r1 - beq _08040EE8 - movs r3, 0x2 - mov r9, r3 - b _08041318 - .pool -_08040EE8: - ldr r5, =gActiveBank - ldrb r0, [r5] - strb r0, [r2] - ldr r2, =gBattleMons - ldrb r0, [r5] - movs r7, 0x58 - adds r1, r0, 0 - muls r1, r7 - adds r6, r2, 0 - adds r6, 0x50 - adds r1, r6 - ldr r0, [r1] - subs r0, 0x10 - str r0, [r1] - ldrb r0, [r5] - bl sub_803F90C - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _08040F2C - ldrb r0, [r5] - bl CancelMultiTurnMoves - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] - b _08040F60 - .pool -_08040F2C: - ldrb r3, [r5] - adds r0, r3, 0 - muls r0, r7 - adds r2, r0, r6 - ldr r0, [r2] - movs r1, 0x70 - ands r0, r1 - cmp r0, 0 - beq _08040F54 - ldr r0, =gBattleCommunication - strb r4, [r0, 0x5] - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 5 - orrs r0, r1 - str r0, [r2] - b _08040F60 - .pool -_08040F54: - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] - adds r0, r3, 0 - bl CancelMultiTurnMoves -_08040F60: - ldr r0, =gUnknown_082DB2A6 - bl b_call_bc_move_exec - movs r5, 0x1 - mov r9, r5 -_08040F6A: - mov r7, r9 - cmp r7, 0x2 - bne _08040F72 - b _08041312 -_08040F72: - b _080412DE - .pool -_08040F7C: - ldr r1, =gBattleMons - ldrb r0, [r6] - movs r7, 0x58 - muls r0, r7 - adds r5, r1, 0 - adds r5, 0x50 - adds r2, r0, r5 - ldr r1, [r2] - movs r4, 0xC0 - lsls r4, 4 - adds r0, r1, 0 - ands r0, r4 - cmp r0, 0 - bne _08040F9A - b _080412DE -_08040F9A: - ldr r3, =0xfffffc00 - adds r0, r1, r3 - str r0, [r2] - ldrb r0, [r6] - bl sub_803F90C - lsls r0, 24 - cmp r0, 0 - beq _08040FBC - ldrb r0, [r6] - bl CancelMultiTurnMoves - b _080412DE - .pool -_08040FBC: - ldrb r0, [r6] - muls r0, r7 - adds r2, r0, r5 - ldr r1, [r2] - adds r0, r1, 0 - ands r0, r4 - cmp r0, 0 - beq _08040FCE - b _080412DE -_08040FCE: - movs r0, 0x80 - lsls r0, 5 - ands r0, r1 - cmp r0, 0 - bne _08040FDA - b _080412DE -_08040FDA: - ldr r0, =0xffffefff - ands r1, r0 - str r1, [r2] - ldrb r0, [r6] - muls r0, r7 - adds r0, r5 - ldr r0, [r0] - movs r4, 0x7 - ands r0, r4 - cmp r0, 0 - beq _08040FF2 - b _080412DE -_08040FF2: - ldr r1, =gBattleCommunication - movs r0, 0x47 - strb r0, [r1, 0x3] - movs r0, 0x1 - movs r1, 0 - bl sub_8048760 - ldrb r0, [r6] - muls r0, r7 - adds r0, r5 - ldr r0, [r0] - ands r0, r4 - cmp r0, 0 - bne _08041010 - b _080412D4 -_08041010: - ldr r0, =gUnknown_082DB2AF - bl b_call_bc_move_exec - b _080412D4 - .pool -_08041024: - ldr r0, =gDisableStructs - ldrb r3, [r6] - lsls r1, r3, 3 - subs r1, r3 - lsls r1, 2 - adds r5, r1, r0 - ldrb r1, [r5, 0xB] - lsls r1, 28 - adds r7, r0, 0 - cmp r1, 0 - bne _0804103C - b _080412DE -_0804103C: - movs r4, 0 - ldr r2, =gBattleMons - movs r0, 0x58 - adds r1, r3, 0 - muls r1, r0 - adds r2, 0xC - adds r1, r2 - ldrh r0, [r5, 0x4] - ldrh r1, [r1] - cmp r0, r1 - beq _0804107A - mov r12, r7 - mov r8, r2 - adds r5, r6, 0 - movs r3, 0x58 -_0804105A: - adds r4, 0x1 - cmp r4, 0x3 - bgt _0804107A - ldrb r2, [r5] - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - add r1, r12 - lsls r0, r4, 1 - muls r2, r3 - adds r0, r2 - add r0, r8 - ldrh r1, [r1, 0x4] - ldrh r0, [r0] - cmp r1, r0 - bne _0804105A -_0804107A: - cmp r4, 0x4 - bne _080410AC - ldrb r1, [r6] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0 - strh r1, [r0, 0x4] - ldrb r0, [r6] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r2, [r1, 0xB] - movs r0, 0x10 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0xB] - b _080412DE - .pool -_080410AC: - ldrb r0, [r6] - lsls r2, r0, 3 - subs r2, r0 - lsls r2, 2 - adds r2, r7 - ldrb r3, [r2, 0xB] - lsls r1, r3, 28 - lsrs r1, 28 - subs r1, 0x1 - movs r0, 0xF - ands r1, r0 - movs r0, 0x10 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0xB] - adds r2, r1, 0 - cmp r2, 0 - beq _080410D4 - b _080412DE -_080410D4: - ldrb r1, [r6] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r7 - strh r2, [r0, 0x4] - ldr r0, =gUnknown_082DAE23 - b _080412D0 - .pool -_080410E8: - ldr r3, =gDisableStructs - ldrb r1, [r6] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r2, r0, r3 - ldrb r5, [r2, 0xE] - lsls r4, r5, 28 - cmp r4, 0 - bne _080410FE - b _080412DE -_080410FE: - ldr r7, =gBattleMons - mov r8, r7 - ldrb r0, [r2, 0xC] - lsls r0, 1 - movs r7, 0x58 - muls r1, r7 - adds r0, r1 - mov r1, r8 - adds r1, 0xC - adds r0, r1 - ldrh r0, [r0] - ldrh r1, [r2, 0x6] - cmp r0, r1 - beq _0804113C - movs r0, 0 - strh r0, [r2, 0x6] - ldrb r0, [r6] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r1, 0xE] - movs r0, 0x10 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0xE] - b _080412DE - .pool -_0804113C: - lsrs r1, r4, 28 - subs r1, 0x1 - movs r0, 0xF - ands r1, r0 - movs r4, 0x10 - negs r4, r4 - adds r0, r4, 0 - ands r0, r5 - orrs r0, r1 - strb r0, [r2, 0xE] - cmp r1, 0 - beq _08041172 - ldrb r1, [r6] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r3 - muls r1, r7 - ldrb r0, [r0, 0xC] - adds r1, r0 - mov r0, r8 - adds r0, 0x24 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _08041172 - b _080412DE -_08041172: - ldrb r1, [r6] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x6] - ldrb r0, [r6] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r1, 0xE] - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0xE] - ldr r0, =gUnknown_082DAE37 - b _080412D0 - .pool -_0804119C: - ldr r0, =gStatuses3 - ldrb r1, [r6] - lsls r1, 2 - adds r1, r0 - ldr r2, [r1] - movs r0, 0x18 - ands r0, r2 - cmp r0, 0 - beq _080411B4 - adds r0, r2, 0 - subs r0, 0x8 - str r0, [r1] -_080411B4: - ldr r1, [r7] - b _080412E2 - .pool -_080411BC: - ldr r2, =gDisableStructs - ldrb r1, [r6] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r3, r0, r2 - ldrb r2, [r3, 0x12] - lsls r1, r2, 28 - cmp r1, 0 - beq _080411F6 - lsrs r1, 28 - subs r1, 0x1 - movs r0, 0xF - ands r1, r0 - movs r0, 0x10 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x12] - cmp r1, 0 - bne _080411F6 - ldr r0, =gStatuses3 - ldrb r2, [r6] - lsls r2, 2 - adds r2, r0 - ldr r0, [r2] - ldr r1, =0xfffffdff - ands r0, r1 - str r0, [r2] -_080411F6: - ldr r1, [r7] - b _080412E2 - .pool -_08041208: - ldr r2, =gDisableStructs - ldrb r1, [r6] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r3, r0, r2 - ldrb r2, [r3, 0x13] - lsls r1, r2, 28 - cmp r1, 0 - beq _0804122E - lsrs r1, 28 - subs r1, 0x1 - movs r0, 0xF - ands r1, r0 - movs r0, 0x10 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x13] -_0804122E: - ldr r1, [r7] - b _080412E2 - .pool -_08041238: - ldr r4, =gStatuses3 - ldrb r0, [r6] - lsls r0, 2 - adds r2, r0, r4 - ldr r1, [r2] - movs r3, 0xC0 - lsls r3, 5 - adds r0, r1, 0 - ands r0, r3 - cmp r0, 0 - beq _080412DE - ldr r5, =0xfffff800 - adds r0, r1, r5 - str r0, [r2] - ldrb r2, [r6] - lsls r0, r2, 2 - adds r0, r4 - ldr r0, [r0] - ands r0, r3 - cmp r0, 0 - bne _080412DE - ldr r3, =gBattleMons - movs r5, 0x58 - adds r1, r2, 0 - muls r1, r5 - adds r4, r3, 0 - adds r4, 0x4C - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _080412DE - adds r0, r1, r3 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0x48 - beq _080412DE - cmp r0, 0xF - beq _080412DE - adds r0, r2, 0 - bl sub_8050650 - lsls r0, 24 - cmp r0, 0 - bne _080412DE - ldrb r0, [r6] - bl CancelMultiTurnMoves - bl Random - ldrb r1, [r6] - adds r2, r1, 0 - muls r2, r5 - adds r2, r4 - movs r1, 0x3 - ands r1, r0 - adds r1, 0x2 - ldr r0, [r2] - orrs r0, r1 - str r0, [r2] - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - str r0, [sp] - movs r0, 0 - movs r1, 0x28 - movs r2, 0 - movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs - ldrb r0, [r6] - bl dp01_battle_side_mark_buffer_for_execution - ldr r1, =gUnknown_0202420E - ldrb r0, [r6] - strb r0, [r1] - ldr r0, =gUnknown_082DB378 -_080412D0: - bl b_call_bc_move_exec -_080412D4: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080412DE: - ldr r0, =gBattleStruct - ldr r1, [r0] -_080412E2: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08041312 - .pool -_08041304: - ldr r1, [r7] - movs r0, 0 - strb r0, [r1] - ldr r1, [r7] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] -_08041312: - mov r7, r9 - cmp r7, 0 - beq _0804131C -_08041318: - mov r0, r9 - b _08041344 -_0804131C: - ldr r5, =gBattleStruct - ldr r2, [r5] - ldr r0, =gNoOfAllBanks - ldrb r1, [r2, 0x1] - adds r7, r5, 0 - mov r8, r0 - ldrb r0, [r0] - cmp r1, r0 - bcs _08041338 -_0804132E: - ldrb r0, [r2] - cmp r0, 0x13 - bhi _08041338 - bl _08040968 -_08041338: - ldr r0, =gHitMarker - ldr r1, [r0] - ldr r2, =0xfeffffdf - ands r1, r2 - str r1, [r0] - movs r0, 0 -_08041344: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8040924 - - thumb_func_start sub_8041364 -sub_8041364: @ 8041364 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r2, =gHitMarker - ldr r0, [r2] - ldr r1, =0x01000020 - orrs r0, r1 - str r0, [r2] - ldr r1, =gBattleStruct - ldr r3, [r1] - movs r4, 0xD0 - lsls r4, 1 - adds r0, r3, r4 - ldrb r0, [r0] - mov r10, r2 - adds r6, r1, 0 - cmp r0, 0x1 - bne _0804138E - b _08041548 -_0804138E: - cmp r0, 0x1 - bgt _080413A4 - cmp r0, 0 - beq _080413AC - b _08041708 - .pool -_080413A4: - cmp r0, 0x2 - bne _080413AA - b _0804169A -_080413AA: - b _08041708 -_080413AC: - ldr r2, =0x000001a1 - adds r0, r3, r2 - ldr r1, =gNoOfAllBanks - ldrb r0, [r0] - mov r8, r1 - ldrb r7, [r1] - cmp r0, r7 - bcc _080413BE - b _08041532 -_080413BE: - ldr r4, =gActiveBank - ldr r5, =gBattleTextBuff1 - ldr r7, =gUnknown_020243D0 - movs r0, 0x18 - adds r0, r7 - mov r12, r0 -_080413CA: - ldr r0, [r6] - adds r3, r0, r2 - ldrb r0, [r3] - strb r0, [r4] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _0804140C - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - b _08041520 - .pool -_0804140C: - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - ldr r1, =gUnknown_020243D0 - ldrb r0, [r4] - adds r2, r0, r1 - ldrb r0, [r2] - mov r9, r1 - cmp r0, 0 - bne _08041422 - b _08041520 -_08041422: - subs r0, 0x1 - strb r0, [r2] - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - bne _08041520 - ldr r1, =gBattleMons - ldrb r2, [r4] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - beq _08041520 - lsls r0, r2, 1 - add r0, r12 - ldrh r0, [r0] - cmp r0, 0xF8 - bne _0804145C - ldr r0, =gBattleCommunication - strb r3, [r0, 0x5] - b _08041462 - .pool -_0804145C: - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] -_08041462: - movs r0, 0xFD - strb r0, [r5] - movs r6, 0x2 - movs r0, 0x2 - strb r0, [r5, 0x1] - ldrb r0, [r4] - lsls r0, 1 - add r0, r12 - ldrh r0, [r0] - strb r0, [r5, 0x2] - ldrb r0, [r4] - lsls r0, 1 - add r0, r12 - ldrh r0, [r0] - lsrs r0, 8 - strb r0, [r5, 0x3] - movs r0, 0xFF - strb r0, [r5, 0x4] - ldr r5, =gBankTarget - ldrb r0, [r4] - strb r0, [r5] - ldr r1, =gBankAttacker - adds r0, r7, 0x4 - ldrb r2, [r4] - adds r0, r2 - ldrb r0, [r0] - strb r0, [r1] - ldr r2, =gBattleMoveDamage - ldrb r0, [r4] - lsls r0, 2 - adds r1, r7, 0 - adds r1, 0x8 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - ldr r2, =gSpecialStatuses - ldrb r1, [r5] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r2, 0x4 - adds r0, r2 - ldr r1, =0x0000ffff - str r1, [r0] - ldr r0, =gUnknown_082DAFE4 - bl b_call_bc_move_exec - ldrb r1, [r4] - adds r0, r1, r7 - ldrb r0, [r0] - cmp r0, 0 - beq _080414CC - b _08041664 -_080414CC: - eors r1, r6 - mov r3, r9 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - beq _080414DA - b _08041664 -_080414DA: - ldrb r0, [r5] - bl GetBankIdentity - ldr r2, =gSideAffecting - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - ands r0, r1 - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - ldr r4, =0x0000ffbf - adds r2, r4, 0 - ands r1, r2 - strh r1, [r0] - b _08041664 - .pool -_08041520: - ldr r0, [r6] - ldr r2, =0x000001a1 - adds r0, r2 - ldrb r0, [r0] - mov r1, r8 - ldrb r1, [r1] - cmp r0, r1 - bcs _08041532 - b _080413CA -_08041532: - ldr r0, [r6] - movs r2, 0xD0 - lsls r2, 1 - adds r0, r2 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r6] - ldr r3, =0x000001a1 - adds r1, r0, r3 - movs r0, 0 - strb r0, [r1] -_08041548: - adds r3, r6, 0 - ldr r0, [r6] - ldr r2, =0x000001a1 - adds r0, r2 - ldr r1, =gNoOfAllBanks - ldrb r0, [r0] - mov r8, r1 - ldrb r4, [r1] - cmp r0, r4 - bcc _0804155E - b _08041684 -_0804155E: - ldr r5, =gActiveBank - ldr r4, =gBattleTextBuff1 - ldr r7, =gDisableStructs - mov r12, r7 - ldr r0, =gBankAttacker - mov r9, r0 -_0804156A: - ldr r1, =gTurnOrder - ldr r0, [r3] - adds r3, r0, r2 - ldrb r0, [r3] - adds r0, r1 - ldrb r0, [r0] - mov r1, r9 - strb r0, [r1] - strb r0, [r5] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _080415BC - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - b _08041670 - .pool -_080415BC: - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - ldr r7, =gStatuses3 - ldrb r0, [r5] - lsls r0, 2 - adds r0, r7 - ldr r0, [r0] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08041670 - movs r0, 0xFD - strb r0, [r4] - movs r0, 0x1 - strb r0, [r4, 0x1] - strb r0, [r4, 0x2] - strb r0, [r4, 0x3] - ldrb r1, [r5] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - add r0, r12 - ldrb r0, [r0, 0xF] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r4, 0x4] - movs r0, 0xFF - strb r0, [r4, 0x5] - ldrb r2, [r5] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - mov r3, r12 - adds r4, r0, r3 - ldrb r3, [r4, 0xF] - lsls r1, r3, 28 - cmp r1, 0 - bne _08041644 - lsls r2, 2 - adds r2, r7 - ldr r0, [r2] - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - str r0, [r2] - ldr r3, =gBattleMoveDamage - ldr r2, =gBattleMons - ldrb r1, [r5] - movs r0, 0x58 - muls r0, r1 - adds r0, r2 - ldrh r0, [r0, 0x28] - str r0, [r3] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DAF05 - b _0804165C - .pool -_08041644: - lsrs r1, 28 - subs r1, 0x1 - movs r0, 0xF - ands r1, r0 - movs r7, 0x10 - negs r7, r7 - adds r0, r7, 0 - ands r0, r3 - orrs r0, r1 - strb r0, [r4, 0xF] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DAF20 -_0804165C: - str r0, [r1] - ldr r0, [r1] - bl b_call_bc_move_exec -_08041664: - movs r0, 0x1 - b _08041714 - .pool -_08041670: - adds r3, r6, 0 - ldr r0, [r6] - ldr r2, =0x000001a1 - adds r0, r2 - ldrb r0, [r0] - mov r1, r8 - ldrb r1, [r1] - cmp r0, r1 - bcs _08041684 - b _0804156A -_08041684: - ldr r0, [r6] - movs r2, 0xD0 - lsls r2, 1 - adds r0, r2 - movs r1, 0x2 - strb r1, [r0] - ldr r0, [r6] - ldr r3, =0x000001a1 - adds r1, r0, r3 - movs r0, 0 - strb r0, [r1] -_0804169A: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - beq _08041708 - ldr r0, [r6] - adds r0, 0xDA - ldrb r0, [r0] - cmp r0, 0x2 - bne _08041708 - ldr r1, =gBattleMons - ldrh r0, [r1, 0x28] - cmp r0, 0 - beq _08041708 - adds r0, r1, 0 - adds r0, 0x80 - ldrh r0, [r0] - cmp r0, 0 - beq _08041708 - movs r4, 0 -_080416C6: - lsls r0, r4, 24 - lsrs r0, 24 - bl CancelMultiTurnMoves - adds r4, 0x1 - cmp r4, 0x1 - ble _080416C6 - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB8F3 - str r0, [r1] - bl b_call_bc_move_exec - ldr r0, =gBattleStruct - ldr r1, [r0] - movs r4, 0xD0 - lsls r4, 1 - adds r1, r4 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08041664 - .pool -_08041708: - mov r7, r10 - ldr r0, [r7] - ldr r1, =0xfeffffdf - ands r0, r1 - str r0, [r7] - movs r0, 0 -_08041714: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8041364 - - thumb_func_start sub_8041728 -sub_8041728: @ 8041728 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08041770 - b _08041A0A - .pool -_08041744: - ldr r0, =gUnknown_082DA7C4 - bl b_call_bc_move_exec - ldr r0, [r5] - adds r0, 0x4D - movs r1, 0x2 - b _08041764 - .pool -_08041758: - ldr r0, =gUnknown_082DA7CD - bl b_call_bc_move_exec - ldr r0, [r5] - adds r0, 0x4D - movs r1, 0x5 -_08041764: - strb r1, [r0] -_08041766: - movs r0, 0x1 - b _08041A0C - .pool -_08041770: - ldr r0, =gBattleStruct - mov r8, r0 -_08041774: - mov r1, r8 - ldr r0, [r1] - adds r0, 0x4D - ldrb r0, [r0] - cmp r0, 0x7 - bls _08041782 - b _080419FC -_08041782: - lsls r0, 2 - ldr r1, =_08041794 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08041794: - .4byte _080417B4 - .4byte _08041806 - .4byte _080418A0 - .4byte _080418E2 - .4byte _080418F6 - .4byte _08041960 - .4byte _08041994 - .4byte _080419FC -_080417B4: - mov r4, r8 - ldr r0, [r4] - adds r0, 0x4E - movs r1, 0 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x4D - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r5, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r5, r0 - bge _08041806 - ldr r6, =gAbsentBankFlags -_080417D4: - ldrb r0, [r6] - ldr r2, =gBitTable - lsls r1, r5, 2 - adds r1, r2 - ldr r4, [r1] - ands r0, r4 - cmp r0, 0 - beq _080417FC - lsls r0, r5, 24 - lsrs r0, 24 - movs r1, 0x6 - movs r2, 0x6 - bl sub_80423F4 - lsls r0, 24 - cmp r0, 0 - bne _080417FC - ldrb r0, [r6] - bics r0, r4 - strb r0, [r6] -_080417FC: - adds r5, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r5, r0 - blt _080417D4 -_08041806: - ldr r0, =gBattleStruct - mov r8, r0 - ldr r1, =gUnknown_0202420D - mov r12, r1 - ldr r2, =gBankTarget - mov r5, r8 - ldr r7, =gBattleMons - ldr r6, =gBattlePartyID -_08041816: - ldr r3, [r5] - adds r1, r3, 0 - adds r1, 0x4E - ldrb r0, [r1] - strb r0, [r2] - mov r4, r12 - strb r0, [r4] - ldrb r4, [r1] - movs r0, 0x58 - muls r0, r4 - adds r0, r7 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _0804185E - adds r0, r3, 0 - adds r0, 0xDF - ldrb r1, [r0] - ldr r3, =gBitTable - lsls r0, r4, 1 - adds r0, r6 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r3 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _0804185E - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - lsls r0, r4, 2 - adds r0, r3 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _0804185E - b _08041744 -_0804185E: - ldr r0, [r5] - adds r0, 0x4E - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - ldr r0, =gNoOfAllBanks - lsls r1, 24 - lsrs r1, 24 - ldrb r0, [r0] - cmp r1, r0 - bne _08041816 - mov r1, r8 - ldr r0, [r1] - adds r0, 0x4D - movs r1, 0x3 - strb r1, [r0] - b _080419FC - .pool -_080418A0: - ldr r0, =gUnknown_0202420D - ldrb r0, [r0] - bl sub_803F9EC - ldr r2, =gBattleStruct - ldr r1, [r2] - adds r1, 0x4E - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r1, =gNoOfAllBanks - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bne _080418D8 - ldr r0, [r2] - adds r0, 0x4D - movs r1, 0x3 - strb r1, [r0] - b _080419FA - .pool -_080418D8: - ldr r0, [r2] - adds r0, 0x4D - movs r1, 0x1 - strb r1, [r0] - b _080419FA -_080418E2: - mov r4, r8 - ldr r0, [r4] - adds r0, 0x4E - movs r1, 0 - strb r1, [r0] - ldr r1, [r4] - adds r1, 0x4D - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080418F6: - ldr r0, =gUnknown_0202420D - mov r12, r0 - ldr r7, =gBankTarget - ldr r5, =gBattleStruct - ldr r2, =gBattleMons - ldr r6, =gBitTable -_08041902: - ldr r0, [r5] - adds r4, r0, 0 - adds r4, 0x4E - ldrb r0, [r4] - strb r0, [r7] - mov r1, r12 - strb r0, [r1] - ldrb r3, [r4] - movs r0, 0x58 - muls r0, r3 - adds r0, r2 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _08041930 - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - lsls r0, r3, 2 - adds r0, r6 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08041930 - b _08041758 -_08041930: - adds r0, r3, 0x1 - strb r0, [r4] - ldr r1, =gNoOfAllBanks - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bne _08041902 - b _08041978 - .pool -_08041960: - mov r1, r8 - ldr r0, [r1] - adds r0, 0x4E - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - ldr r0, =gNoOfAllBanks - lsls r1, 24 - lsrs r1, 24 - ldrb r0, [r0] - cmp r1, r0 - bne _08041988 -_08041978: - mov r4, r8 - ldr r0, [r4] - adds r0, 0x4D - movs r1, 0x6 - strb r1, [r0] - b _080419FC - .pool -_08041988: - mov r1, r8 - ldr r0, [r1] - adds r0, 0x4D - movs r1, 0x4 - strb r1, [r0] - b _080419FC -_08041994: - movs r0, 0 - str r0, [sp] - movs r0, 0x9 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080419AE - b _08041766 -_080419AE: - str r0, [sp] - movs r0, 0xB - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - beq _080419C4 - b _08041766 -_080419C4: - movs r0, 0x1 - movs r1, 0 - movs r2, 0x1 - bl berry_effects_maybe - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080419D8 - b _08041766 -_080419D8: - str r0, [sp] - movs r0, 0x6 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - beq _080419EE - b _08041766 -_080419EE: - ldr r2, =gBattleStruct - ldr r1, [r2] - adds r1, 0x4D - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080419FA: - mov r8, r2 -_080419FC: - mov r4, r8 - ldr r0, [r4] - adds r0, 0x4D - ldrb r0, [r0] - cmp r0, 0x7 - beq _08041A0A - b _08041774 -_08041A0A: - movs r0, 0 -_08041A0C: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8041728 - - thumb_func_start b_clear_atk_up_if_hit_flag_unless_enraged -b_clear_atk_up_if_hit_flag_unless_enraged: @ 8041A1C - push {r4-r6,lr} - movs r3, 0 - ldr r0, =gNoOfAllBanks - adds r5, r0, 0 - ldrb r0, [r5] - cmp r3, r0 - bge _08041A54 - ldr r4, =gUnknown_02024274 - movs r6, 0x80 - lsls r6, 16 - ldr r2, =gBattleMons + 0x50 -_08041A32: - ldr r1, [r2] - adds r0, r1, 0 - ands r0, r6 - cmp r0, 0 - beq _08041A48 - ldrh r0, [r4] - cmp r0, 0x63 - beq _08041A48 - ldr r0, =0xff7fffff - ands r1, r0 - str r1, [r2] -_08041A48: - adds r4, 0x2 - adds r2, 0x58 - adds r3, 0x1 - ldrb r0, [r5] - cmp r3, r0 - blt _08041A32 -_08041A54: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end b_clear_atk_up_if_hit_flag_unless_enraged - - thumb_func_start sub_8041A6C -sub_8041A6C: @ 8041A6C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - movs r0, 0 - mov r9, r0 - ldr r1, =gBattleScripting + 4 - mov r10, r1 - ldr r2, =gBattleStruct - mov r8, r2 - b _08041A9A - .pool -_08041A90: - mov r3, r9 - cmp r3, 0 - beq _08041A9A - bl _08042388 -_08041A9A: - mov r4, r8 - ldr r0, [r4] - ldr r7, =0x000001a3 - adds r0, r7 - ldrb r0, [r0] - cmp r0, 0xE - bls _08041AAC - bl _08042376 -_08041AAC: - lsls r0, 2 - ldr r1, =_08041AC0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08041AC0: - .4byte _08041AFC - .4byte _08041B48 - .4byte _08041C90 - .4byte _08041D50 - .4byte _08041DC4 - .4byte _08041E40 - .4byte _08041EB8 - .4byte _08041F38 - .4byte _08041FC0 - .4byte _08042028 - .4byte _08042114 - .4byte _08042194 - .4byte _08042234 - .4byte _0804231C - .4byte _08042376 -_08041AFC: - ldr r1, =gBattleMons - ldr r3, =gBankAttacker - ldrb r2, [r3] - movs r0, 0x58 - muls r2, r0 - adds r1, 0x50 - adds r2, r1 - ldr r0, [r2] - ldr r1, =0xfdffffff - ands r0, r1 - str r0, [r2] - ldr r0, =gStatuses3 - ldrb r2, [r3] - lsls r2, 2 - adds r2, r0 - ldr r0, [r2] - ldr r1, =0xffffbfff - ands r0, r1 - str r0, [r2] - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x000001a3 - adds r1, r0, r2 - bl _08042370 - .pool -_08041B48: - ldr r7, =gBattleMons - ldr r4, =gBankAttacker - ldrb r1, [r4] - movs r5, 0x58 - adds r0, r1, 0 - muls r0, r5 - adds r6, r7, 0 - adds r6, 0x4C - adds r0, r6 - ldr r0, [r0] - movs r3, 0x7 - mov r8, r3 - ands r0, r3 - cmp r0, 0 - bne _08041B68 - b _08041C6E -_08041B68: - adds r0, r1, 0 - bl sub_8050650 - lsls r0, 24 - cmp r0, 0 - beq _08041BC8 - ldrb r0, [r4] - adds r2, r0, 0 - muls r2, r5 - adds r2, r6 - ldr r0, [r2] - movs r1, 0x8 - negs r1, r1 - ands r0, r1 - str r0, [r2] - ldrb r0, [r4] - adds r2, r0, 0 - muls r2, r5 - adds r0, r7, 0 - adds r0, 0x50 - adds r2, r0 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB220 - str r0, [r1] - movs r4, 0x2 - mov r9, r4 - b _08041C6E - .pool -_08041BC8: - ldrb r0, [r4] - adds r1, r0, 0 - muls r1, r5 - adds r0, r1, r7 - adds r0, 0x20 - ldrb r0, [r0] - movs r3, 0x1 - cmp r0, 0x30 - bne _08041BDC - movs r3, 0x2 -_08041BDC: - adds r2, r1, r6 - ldr r1, [r2] - adds r0, r1, 0 - mov r7, r8 - ands r0, r7 - cmp r0, r3 - bcs _08041BF4 - movs r0, 0x8 - negs r0, r0 - ands r1, r0 - str r1, [r2] - b _08041BF8 -_08041BF4: - subs r0, r1, r3 - str r0, [r2] -_08041BF8: - ldr r2, =gBattleMons - ldr r0, =gBankAttacker - ldrb r1, [r0] - movs r0, 0x58 - muls r1, r0 - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r1, r0 - ldr r4, [r0] - movs r0, 0x7 - ands r4, r0 - cmp r4, 0 - beq _08041C50 - ldr r0, =gCurrentMove - ldrh r0, [r0] - cmp r0, 0xAD - beq _08041C6E - cmp r0, 0xD6 - beq _08041C6E - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB213 - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - movs r0, 0x2 - mov r9, r0 - b _08041C6E - .pool -_08041C50: - adds r2, 0x50 - adds r2, r1, r2 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] - bl b_movescr_stack_push_cursor - ldr r0, =gBattleCommunication - strb r4, [r0, 0x5] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB220 - str r0, [r1] - movs r1, 0x2 - mov r9, r1 -_08041C6E: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldr r3, =0x000001a3 - adds r2, r0, r3 - b _0804216A - .pool -_08041C90: - ldr r1, =gBattleMons - ldr r7, =gBankAttacker - ldrb r0, [r7] - movs r6, 0x58 - muls r0, r6 - adds r5, r1, 0 - adds r5, 0x4C - adds r0, r5 - ldr r0, [r0] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08041D30 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x5 - bl __umodsi3 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _08041D08 - ldr r2, =gBattleMoves - ldr r0, =gCurrentMove - ldrh r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0x7D - bne _08041CD6 - b _08042162 -_08041CD6: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB26A - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 2 - orrs r0, r1 - str r0, [r2] - b _08041D28 - .pool -_08041D08: - ldrb r0, [r7] - adds r2, r0, 0 - muls r2, r6 - adds r2, r5 - ldr r0, [r2] - movs r1, 0x21 - negs r1, r1 - ands r0, r1 - str r0, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB277 - str r0, [r1] - ldr r0, =gBattleCommunication - strb r4, [r0, 0x5] -_08041D28: - movs r7, 0x2 - mov r9, r7 - ldr r0, =gBattleStruct - mov r8, r0 -_08041D30: - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x000001a3 - adds r1, r0, r2 - b _08042370 - .pool -_08041D50: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0x36 - beq _08041D66 - b _08042162 -_08041D66: - ldr r0, =gDisableStructs - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x18] - lsls r0, 31 - cmp r0, 0 - bne _08041D7A - b _08042162 -_08041D7A: - adds r0, r2, 0 - bl CancelMultiTurnMoves - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - ldr r1, =gBattleCommunication - movs r0, 0 - strb r0, [r1, 0x5] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB6AD - str r0, [r1] - ldr r2, =gBattleMoveFlags - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - b _0804215E - .pool -_08041DC4: - ldr r1, =gBattleMons - ldr r3, =gBankAttacker - ldrb r2, [r3] - movs r0, 0x58 - muls r0, r2 - adds r1, 0x50 - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x80 - lsls r0, 15 - ands r0, r1 - cmp r0, 0 - beq _08041E10 - ldr r0, =0xffbfffff - ands r1, r0 - str r1, [r2] - ldr r2, =gDisableStructs - ldrb r1, [r3] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strb r1, [r0, 0x19] - ldrb r0, [r3] - bl CancelMultiTurnMoves - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082D9462 - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - movs r7, 0x1 - mov r9, r7 -_08041E10: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldr r3, =0x000001a3 - adds r2, r0, r3 - b _0804216A - .pool -_08041E40: - ldr r1, =gBattleMons - ldr r3, =gBankAttacker - ldrb r2, [r3] - movs r0, 0x58 - muls r0, r2 - adds r1, 0x50 - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _08041E8C - movs r0, 0x9 - negs r0, r0 - ands r1, r0 - str r1, [r2] - ldr r0, =gProtectStructs - ldrb r2, [r3] - lsls r2, 4 - adds r2, r0 - ldrb r0, [r2, 0x2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x2] - ldrb r0, [r3] - bl CancelMultiTurnMoves - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB29B - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - movs r4, 0x1 - mov r9, r4 -_08041E8C: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldr r7, =0x000001a3 - adds r2, r0, r7 - b _0804216A - .pool -_08041EB8: - ldr r0, =gDisableStructs - ldr r3, =gBankAttacker - ldrb r2, [r3] - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - adds r1, r0 - ldr r0, =gCurrentMove - ldrh r1, [r1, 0x4] - ldrh r0, [r0] - cmp r1, r0 - bne _08041F04 - cmp r1, 0 - beq _08041F04 - ldr r0, =gProtectStructs - lsls r2, 4 - adds r2, r0 - ldrb r0, [r2, 0x1] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x1] - ldr r1, =gBattleScripting - ldrb r0, [r3] - strb r0, [r1, 0x17] - ldrb r0, [r3] - bl CancelMultiTurnMoves - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DAE14 - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - movs r0, 0x1 - mov r9, r0 -_08041F04: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldr r3, =0x000001a3 - adds r2, r0, r3 - b _0804216A - .pool -_08041F38: - ldr r0, =gDisableStructs - ldr r4, =gBankAttacker - ldrb r3, [r4] - lsls r1, r3, 3 - subs r1, r3 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x13] - lsls r0, 28 - cmp r0, 0 - beq _08041F8C - ldr r2, =gBattleMoves - ldr r0, =gCurrentMove - ldrh r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1] - cmp r0, 0 - bne _08041F8C - ldr r0, =gProtectStructs - lsls r2, r3, 4 - adds r2, r0 - ldrb r0, [r2, 0x2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x2] - ldrb r0, [r4] - bl CancelMultiTurnMoves - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB0A4 - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - movs r4, 0x1 - mov r9, r4 -_08041F8C: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldr r7, =0x000001a3 - adds r2, r0, r7 - b _0804216A - .pool -_08041FC0: - ldr r4, =gBankAttacker - ldrb r0, [r4] - ldr r1, =gCurrentMove - ldrh r1, [r1] - bl sub_8040130 - lsls r0, 24 - cmp r0, 0 - beq _08041FFE - ldr r0, =gProtectStructs - ldrb r2, [r4] - lsls r2, 4 - adds r2, r0 - ldrb r0, [r2, 0x1] - movs r1, 0x20 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r4] - bl CancelMultiTurnMoves - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB176 - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - movs r0, 0x1 - mov r9, r0 -_08041FFE: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldr r3, =0x000001a3 - adds r2, r0, r3 - b _0804216A - .pool -_08042028: - ldr r7, =gBattleMons - ldr r5, =gBankAttacker - ldrb r0, [r5] - movs r6, 0x58 - muls r0, r6 - adds r4, r7, 0 - adds r4, 0x50 - adds r2, r0, r4 - ldr r1, [r2] - movs r3, 0x7 - adds r0, r1, 0 - ands r0, r3 - cmp r0, 0 - beq _080420FA - subs r0, r1, 0x1 - str r0, [r2] - ldrb r0, [r5] - muls r0, r6 - adds r0, r4 - ldr r0, [r0] - ands r0, r3 - cmp r0, 0 - beq _080420E8 - bl Random - movs r1, 0x1 - movs r2, 0x1 - ands r2, r0 - cmp r2, 0 - beq _0804207C - ldr r1, =gBattleCommunication - movs r0, 0 - strb r0, [r1, 0x5] - bl b_movescr_stack_push_cursor - b _080420C6 - .pool -_0804207C: - ldr r0, =gBattleCommunication - movs r4, 0x1 - strb r1, [r0, 0x5] - ldr r1, =gBankTarget - ldrb r0, [r5] - strb r0, [r1] - ldrb r0, [r5] - adds r1, r0, 0 - muls r1, r6 - adds r1, r7 - movs r0, 0x28 - str r0, [sp] - str r2, [sp, 0x4] - ldrb r0, [r5] - str r0, [sp, 0x8] - ldrb r0, [r5] - str r0, [sp, 0xC] - adds r0, r1, 0 - movs r2, 0x1 - movs r3, 0 - bl CalculateBaseDamage - ldr r1, =gBattleMoveDamage - str r0, [r1] - ldr r0, =gProtectStructs - ldrb r1, [r5] - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1, 0x1] - orrs r0, r4 - strb r0, [r1, 0x1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] -_080420C6: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB2BD - b _080420F0 - .pool -_080420E8: - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB300 -_080420F0: - str r0, [r1] - movs r4, 0x1 - mov r9, r4 - ldr r7, =gBattleStruct - mov r8, r7 -_080420FA: - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x000001a3 - adds r1, r0, r2 - b _08042370 - .pool -_08042114: - ldr r1, =gBattleMons - ldr r4, =gBankAttacker - ldrb r2, [r4] - movs r0, 0x58 - muls r0, r2 - adds r1, 0x4C - adds r0, r1 - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08042162 - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - cmp r1, 0 - bne _08042162 - ldr r0, =gProtectStructs - ldrb r2, [r4] - lsls r2, 4 - adds r2, r0 - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB28B - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] -_0804215E: - movs r3, 0x1 - mov r9, r3 -_08042162: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldr r4, =0x000001a3 - adds r2, r0, r4 -_0804216A: - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - mov r8, r1 - b _08042376 - .pool -_08042194: - ldr r1, =gBattleMons - ldr r4, =gBankAttacker - ldrb r2, [r4] - movs r0, 0x58 - muls r0, r2 - adds r1, 0x50 - adds r0, r1 - ldr r1, [r0] - movs r0, 0xF0 - lsls r0, 12 - ands r1, r0 - cmp r1, 0 - beq _0804220E - lsrs r0, r1, 16 - bl CountTrailingZeroBits - ldr r1, =gBattleScripting - strb r0, [r1, 0x17] - bl Random - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _080421D8 - bl b_movescr_stack_push_cursor - b _08042200 - .pool -_080421D8: - ldr r0, =gUnknown_082DB334 - bl b_movescr_stack_push - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 - orrs r0, r1 - str r0, [r2] - ldr r0, =gProtectStructs - ldrb r2, [r4] - lsls r2, 4 - adds r2, r0 - ldrb r0, [r2, 0x1] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r0, [r4] - bl CancelMultiTurnMoves -_08042200: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB327 - str r0, [r1] - movs r7, 0x1 - mov r9, r7 - ldr r0, =gBattleStruct - mov r8, r0 -_0804220E: - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x000001a3 - adds r1, r0, r2 - b _08042370 - .pool -_08042234: - ldr r1, =gBattleMons - ldr r6, =gBankAttacker - ldrb r0, [r6] - movs r5, 0x58 - muls r0, r5 - adds r1, 0x50 - adds r3, r0, r1 - ldr r2, [r3] - movs r4, 0xC0 - lsls r4, 2 - adds r0, r2, 0 - ands r0, r4 - cmp r0, 0 - beq _08042306 - ldr r7, =0xffffff00 - adds r0, r2, r7 - str r0, [r3] - ldrb r2, [r6] - adds r0, r2, 0 - muls r0, r5 - adds r0, r1 - ldr r0, [r0] - ands r0, r4 - cmp r0, 0 - beq _08042280 - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DAD71 - b _08042300 - .pool -_08042280: - ldr r3, =gUnknown_020241F8 - lsls r0, r2, 2 - adds r0, r3 - ldr r0, [r0] - cmp r0, 0 - beq _080422FC - ldr r1, =gCurrentMove - movs r0, 0x75 - strh r0, [r1] - ldrb r0, [r6] - lsls r0, 2 - adds r0, r3 - ldr r0, [r0] - lsls r0, 1 - mov r1, r10 - str r0, [r1] - ldr r4, =gBankTarget - ldr r1, =gUnknown_02024288 - ldrb r0, [r6] - adds r0, r1 - ldrb r0, [r0] - strb r0, [r4] - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - ldrb r0, [r4] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _080422CA - movs r0, 0x75 - movs r1, 0x1 - bl GetMoveTarget - strb r0, [r4] -_080422CA: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DAD7C - str r0, [r1] - ldr r2, =gBattleStruct - mov r8, r2 - b _08042302 - .pool -_080422FC: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DADC4 -_08042300: - str r0, [r1] -_08042302: - movs r3, 0x1 - mov r9, r3 -_08042306: - mov r4, r8 - ldr r0, [r4] - ldr r7, =0x000001a3 - adds r1, r0, r7 - b _08042370 - .pool -_0804231C: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r1, 0x4C - adds r4, r0, r1 - ldr r3, [r4] - movs r0, 0x20 - ands r0, r3 - cmp r0, 0 - beq _08042368 - ldr r2, =gBattleMoves - ldr r0, =gCurrentMove - ldrh r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0x7D - bne _08042360 - movs r0, 0x21 - negs r0, r0 - ands r3, r0 - str r3, [r4] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB277 - str r0, [r1] - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x5] -_08042360: - movs r0, 0x2 - mov r9, r0 - ldr r1, =gBattleStruct - mov r8, r1 -_08042368: - mov r2, r8 - ldr r0, [r2] - ldr r3, =0x000001a3 - adds r1, r0, r3 -_08042370: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08042376: - mov r4, r8 - ldr r0, [r4] - ldr r7, =0x000001a3 - adds r0, r7 - ldrb r0, [r0] - cmp r0, 0xE - beq _08042388 - bl _08041A90 -_08042388: - mov r0, r9 - cmp r0, 0x2 - bne _080423B4 - ldr r4, =gActiveBank - ldr r0, =gBankAttacker - ldrb r0, [r0] - strb r0, [r4] - ldrb r1, [r4] - movs r0, 0x58 - muls r0, r1 - ldr r1, =gBattleMons + 0x4C - adds r0, r1 - str r0, [sp] - movs r0, 0 - movs r1, 0x28 - movs r2, 0 - movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs - ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution -_080423B4: - mov r0, r9 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8041A6C - - thumb_func_start sub_80423F4 -sub_80423F4: @ 80423F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08042424 - movs r0, 0 - b _080426A0 - .pool -_08042424: - movs r0, 0x80 - lsls r0, 15 - ands r0, r1 - cmp r0, 0 - beq _0804249C - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - ldr r1, =gEnemyParty - mov r8, r1 - cmp r0, 0 - bne _08042442 - ldr r2, =gPlayerParty - mov r8, r2 -_08042442: - movs r0, 0x2 - ands r0, r4 - lsls r0, 24 - lsrs r6, r0, 25 - lsls r0, r6, 1 - adds r4, r0, r6 - adds r0, r4, 0x3 - cmp r4, r0 - bge _0804248C - adds r7, r0, 0 -_08042456: - movs r0, 0x64 - muls r0, r4 - mov r1, r8 - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _08042486 - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - cmp r0, 0 - beq _08042486 - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - bne _0804248C -_08042486: - adds r4, 0x1 - cmp r4, r7 - blt _08042456 -_0804248C: - movs r1, 0 - lsls r0, r6, 1 - adds r0, r6 - b _08042556 - .pool -_0804249C: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0804256C - movs r0, 0x80 - lsls r0, 16 - ands r1, r0 - cmp r1, 0 - beq _080424E4 - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _080424D0 - ldr r2, =gPlayerParty - mov r8, r2 - adds r0, r4, 0 - bl sub_806D864 - lsls r0, 24 - lsrs r7, r0, 24 - b _08042502 - .pool -_080424D0: - ldr r0, =gEnemyParty - mov r8, r0 - movs r1, 0x1 - eors r1, r4 - negs r0, r1 - orrs r0, r1 - lsrs r6, r0, 31 - b _0804250C - .pool -_080424E4: - adds r0, r4, 0 - bl sub_806D864 - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - ldr r1, =gEnemyParty - mov r8, r1 - cmp r0, 0 - bne _08042502 - ldr r2, =gPlayerParty - mov r8, r2 -_08042502: - adds r0, r7, 0 - bl sub_806D82C - lsls r0, 24 - lsrs r6, r0, 24 -_0804250C: - lsls r0, r6, 1 - adds r4, r0, r6 - adds r1, r4, 0x3 - mov r9, r0 - cmp r4, r1 - bge _08042550 - adds r7, r1, 0 -_0804251A: - movs r0, 0x64 - muls r0, r4 - mov r1, r8 - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _0804254A - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - cmp r0, 0 - beq _0804254A - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - bne _08042550 -_0804254A: - adds r4, 0x1 - cmp r4, r7 - blt _0804251A -_08042550: - movs r1, 0 - mov r2, r9 - adds r0, r2, r6 -_08042556: - adds r0, 0x3 - cmp r4, r0 - bne _0804255E - movs r1, 0x1 -_0804255E: - adds r0, r1, 0 - b _080426A0 - .pool -_0804256C: - movs r0, 0x80 - lsls r0, 8 - ands r1, r0 - cmp r1, 0 - beq _080425DA - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080425DA - ldr r0, =gEnemyParty - mov r8, r0 - movs r6, 0x3 - cmp r4, 0x1 - bne _08042590 - movs r6, 0 -_08042590: - adds r4, r6, 0 - adds r6, r4, 0x3 - b _0804259E - .pool -_0804259C: - adds r4, 0x1 -_0804259E: - cmp r4, r6 - bge _080425D2 - movs r0, 0x64 - muls r0, r4 - mov r1, r8 - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _0804259C - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - cmp r0, 0 - beq _0804259C - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - beq _0804259C -_080425D2: - movs r0, 0 - cmp r4, r6 - bne _080426A0 - b _0804269E -_080425DA: - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08042608 - movs r0, 0x1 - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0x3 - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r6, r0, 24 - ldr r2, =gEnemyParty - mov r8, r2 - b _08042620 - .pool -_08042608: - movs r0, 0 - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0x2 - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gPlayerParty - mov r8, r0 -_08042620: - mov r1, r10 - cmp r1, 0x6 - bne _08042630 - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrb r0, [r0] - mov r10, r0 -_08042630: - mov r2, r9 - cmp r2, 0x6 - bne _08042640 - ldr r1, =gBattlePartyID - lsls r0, r6, 1 - adds r0, r1 - ldrb r0, [r0] - mov r9, r0 -_08042640: - movs r4, 0 -_08042642: - movs r0, 0x64 - muls r0, r4 - mov r1, r8 - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _08042692 - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - cmp r0, 0 - beq _08042692 - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - beq _08042692 - cmp r4, r10 - beq _08042692 - cmp r4, r9 - beq _08042692 - ldr r0, =gBattleStruct - ldr r1, [r0] - adds r0, r7, r1 - adds r0, 0x5C - ldrb r0, [r0] - cmp r4, r0 - beq _08042692 - adds r0, r6, r1 - adds r0, 0x5C - ldrb r0, [r0] - cmp r4, r0 - bne _08042698 -_08042692: - adds r4, 0x1 - cmp r4, 0x5 - ble _08042642 -_08042698: - movs r0, 0 - cmp r4, 0x6 - bne _080426A0 -_0804269E: - movs r0, 0x1 -_080426A0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80423F4 - - thumb_func_start castform_switch -castform_switch: @ 80426BC - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r6 - adds r4, r0, r1 - ldrh r1, [r4] - ldr r0, =0x00000181 - cmp r1, r0 - bne _08042760 - adds r0, r4, 0 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0x3B - bne _08042760 - ldrh r0, [r4, 0x28] - cmp r0, 0 - beq _08042760 - str r5, [sp] - movs r0, 0x13 - movs r1, 0 - movs r2, 0xD - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - bne _0804270E - str r5, [sp] - movs r0, 0x13 - movs r1, 0 - movs r2, 0x4D - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - beq _08042734 -_0804270E: - adds r2, r4, 0 - adds r2, 0x21 - ldrb r0, [r2] - cmp r0, 0 - beq _08042734 - adds r1, r4, 0 - adds r1, 0x22 - ldrb r0, [r1] - cmp r0, 0 - beq _08042734 - strb r5, [r2] - strb r5, [r1] - movs r0, 0x1 - b _08042818 - .pool -_08042734: - movs r0, 0 - str r0, [sp] - movs r0, 0x13 - movs r1, 0 - movs r2, 0xD - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _08042760 - str r0, [sp] - movs r0, 0x13 - movs r1, 0 - movs r2, 0x4D - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - beq _08042764 -_08042760: - movs r0, 0 - b _08042818 -_08042764: - ldr r1, =gBattleWeather - ldrh r0, [r1] - movs r2, 0xE7 - ands r2, r0 - adds r4, r1, 0 - cmp r2, 0 - bne _08042792 - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r6 - adds r1, r0, r1 - adds r3, r1, 0 - adds r3, 0x21 - ldrb r0, [r3] - cmp r0, 0 - beq _08042792 - adds r1, 0x22 - ldrb r0, [r1] - cmp r0, 0 - beq _08042792 - strb r2, [r3] - strb r2, [r1] - movs r5, 0x1 -_08042792: - ldrh r1, [r4] - movs r0, 0x60 - ands r0, r1 - cmp r0, 0 - beq _080427BE - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r6 - adds r1, r0, r1 - adds r2, r1, 0 - adds r2, 0x21 - ldrb r0, [r2] - cmp r0, 0xA - beq _080427BE - adds r1, 0x22 - ldrb r0, [r1] - cmp r0, 0xA - beq _080427BE - movs r0, 0xA - strb r0, [r2] - strb r0, [r1] - movs r5, 0x2 -_080427BE: - ldrh r1, [r4] - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - beq _080427EA - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r6 - adds r1, r0, r1 - adds r2, r1, 0 - adds r2, 0x21 - ldrb r0, [r2] - cmp r0, 0xB - beq _080427EA - adds r1, 0x22 - ldrb r0, [r1] - cmp r0, 0xB - beq _080427EA - movs r0, 0xB - strb r0, [r2] - strb r0, [r1] - movs r5, 0x3 -_080427EA: - ldrh r1, [r4] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08042816 - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r6 - adds r1, r0, r1 - adds r2, r1, 0 - adds r2, 0x21 - ldrb r0, [r2] - cmp r0, 0xF - beq _08042816 - adds r1, 0x22 - ldrb r0, [r1] - cmp r0, 0xF - beq _08042816 - movs r0, 0xF - strb r0, [r2] - strb r0, [r1] - movs r5, 0x4 -_08042816: - adds r0, r5, 0 -_08042818: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end castform_switch - - thumb_func_start AbilityBattleEffects -AbilityBattleEffects: @ 8042828 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - ldr r4, [sp, 0x48] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - lsrs r6, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - lsls r4, 16 - lsrs r4, 16 - movs r0, 0 - mov r9, r0 - ldr r5, =gBankAttacker - ldr r1, =gNoOfAllBanks - ldrb r0, [r5] - ldrb r1, [r1] - cmp r0, r1 - bcc _08042864 - mov r1, r10 - strb r1, [r5] -_08042864: - ldrb r0, [r5] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08042894 - ldr r1, =gBattlePartyID - ldrb r0, [r5] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - b _080428A4 - .pool -_08042894: - ldr r1, =gBattlePartyID - ldrb r0, [r5] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty -_080428A4: - adds r7, r1, r0 - ldr r5, =gBankTarget - ldr r1, =gNoOfAllBanks - ldrb r0, [r5] - ldrb r1, [r1] - cmp r0, r1 - bcc _080428B6 - mov r2, r10 - strb r2, [r5] -_080428B6: - ldrb r0, [r5] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _080428E8 - ldr r1, =gBattlePartyID - ldrb r0, [r5] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - b _080428F8 - .pool -_080428E8: - ldr r1, =gBattlePartyID - ldrb r0, [r5] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty -_080428F8: - adds r5, r1, r0 - adds r0, r7, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - adds r0, r5, 0 - movs r1, 0 - bl GetMonData - str r0, [sp, 0x14] - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0804293A - bl _0804443A -_0804293A: - mov r3, r8 - cmp r3, 0 - beq _08042958 - ldr r0, =gLastUsedAbility - strb r3, [r0] - adds r7, r0, 0 - b _0804296E - .pool -_08042958: - ldr r2, =gLastUsedAbility - ldr r1, =gBattleMons - movs r0, 0x58 - mov r5, r10 - muls r5, r0 - adds r0, r5, 0 - adds r0, r1 - adds r0, 0x20 - ldrb r0, [r0] - strb r0, [r2] - adds r7, r2, 0 -_0804296E: - cmp r4, 0 - beq _08042980 - adds r5, r4, 0 - b _08042984 - .pool -_08042980: - ldr r0, =gCurrentMove - ldrh r5, [r0] -_08042984: - ldr r1, =gBattleStruct - ldr r0, [r1] - ldrb r0, [r0, 0x13] - mov r8, r1 - cmp r0, 0 - beq _080429A0 - movs r3, 0x3F - ands r3, r0 - b _080429AC - .pool -_080429A0: - ldr r1, =gBattleMoves - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r3, [r0, 0x2] -_080429AC: - ldr r0, [sp, 0x4] - cmp r0, 0x13 - bls _080429B6 - bl _0804441E -_080429B6: - lsls r0, 2 - ldr r1, =_080429C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080429C8: - .4byte _08042A18 - .4byte _08042CDC - .4byte _08042EF8 - .4byte _08042F8C - .4byte _080431AC - .4byte _08043908 - .4byte _08043C6C - .4byte _08043CBC - .4byte _08043D40 - .4byte _08043DC4 - .4byte _08043FE4 - .4byte _08043E08 - .4byte _08044028 - .4byte _08044084 - .4byte _080440E0 - .4byte _080441DC - .4byte _08044220 - .4byte _0804427C - .4byte _080443EC - .4byte _08044196 -_08042A18: - ldr r2, =gBankAttacker - ldr r0, =gNoOfAllBanks - ldrb r1, [r2] - adds r5, r0, 0 - ldrb r3, [r5] - cmp r1, r3 - bcc _08042A2A - mov r0, r10 - strb r0, [r2] -_08042A2A: - ldrb r0, [r7] - cmp r0, 0x2D - bne _08042A32 - b _08042BA8 -_08042A32: - cmp r0, 0x2D - bgt _08042A64 - cmp r0, 0xD - bne _08042A3C - b _08042CA4 -_08042A3C: - cmp r0, 0xD - bgt _08042A54 - cmp r0, 0x2 - bne _08042A46 - b _08042B78 -_08042A46: - bl _0804441E - .pool -_08042A54: - cmp r0, 0x16 - bne _08042A5A - b _08042C08 -_08042A5A: - cmp r0, 0x24 - bne _08042A60 - b _08042C68 -_08042A60: - bl _0804441E -_08042A64: - cmp r0, 0x46 - bne _08042A6A - b _08042BD8 -_08042A6A: - cmp r0, 0x46 - bgt _08042A78 - cmp r0, 0x3B - bne _08042A74 - b _08042C3C -_08042A74: - bl _0804441E -_08042A78: - cmp r0, 0x4D - bne _08042A7E - b _08042CA4 -_08042A7E: - cmp r0, 0xFF - beq _08042A86 - bl _0804441E -_08042A86: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 17 - ands r0, r1 - cmp r0, 0 - bne _08042B4C - bl weather_get_current - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x3 - cmp r0, 0xA - bhi _08042B4C - lsls r0, 2 - ldr r1, =_08042AB4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08042AB4: - .4byte _08042AE0 - .4byte _08042B4C - .4byte _08042AE0 - .4byte _08042B4C - .4byte _08042B4C - .4byte _08042B04 - .4byte _08042B4C - .4byte _08042B4C - .4byte _08042B4C - .4byte _08042B28 - .4byte _08042AE0 -_08042AE0: - ldr r2, =gBattleWeather - ldrh r1, [r2] - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - bne _08042B4C - movs r0, 0x5 - strh r0, [r2] - ldr r1, =gBattleScripting - movs r0, 0xA - strb r0, [r1, 0x10] - mov r2, r10 - strb r2, [r1, 0x17] - b _08042B42 - .pool -_08042B04: - ldr r3, =gBattleWeather - ldrh r1, [r3] - movs r2, 0x18 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _08042B4C - strh r2, [r3] - ldr r1, =gBattleScripting - movs r0, 0xC - strb r0, [r1, 0x10] - mov r3, r10 - strb r3, [r1, 0x17] - b _08042B42 - .pool -_08042B28: - ldr r3, =gBattleWeather - ldrh r1, [r3] - movs r2, 0x60 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _08042B4C - strh r2, [r3] - ldr r1, =gBattleScripting - movs r0, 0xB - strb r0, [r1, 0x10] - mov r5, r10 - strb r5, [r1, 0x17] -_08042B42: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_08042B4C: - mov r0, r9 - cmp r0, 0 - bne _08042B56 - bl _0804443A -_08042B56: - bl weather_get_current - ldr r1, =gBattleCommunication - strb r0, [r1, 0x5] - ldr r0, =gUnknown_082DACE7 - bl b_push_move_exec - bl _0804441E - .pool -_08042B78: - ldr r2, =gBattleWeather - ldrh r1, [r2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08042B88 - bl _0804441E -_08042B88: - movs r0, 0x5 - strh r0, [r2] - ldr r0, =gUnknown_082DB430 - bl b_push_move_exec - ldr r0, =gBattleScripting - mov r1, r10 - strb r1, [r0, 0x17] - bl _080443D0 - .pool -_08042BA8: - ldr r2, =gBattleWeather - ldrh r1, [r2] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08042BB8 - bl _0804441E -_08042BB8: - movs r0, 0x18 - strh r0, [r2] - ldr r0, =gUnknown_082DB470 - bl b_push_move_exec - ldr r0, =gBattleScripting - mov r2, r10 - strb r2, [r0, 0x17] - bl _080443D0 - .pool -_08042BD8: - ldr r2, =gBattleWeather - ldrh r1, [r2] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08042BE8 - bl _0804441E -_08042BE8: - movs r0, 0x60 - strh r0, [r2] - ldr r0, =gUnknown_082DB52A - bl b_push_move_exec - ldr r0, =gBattleScripting - mov r3, r10 - strb r3, [r0, 0x17] - bl _080443D0 - .pool -_08042C08: - ldr r0, =gSpecialStatuses - mov r5, r10 - lsls r2, r5, 2 - adds r1, r2, r5 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3] - lsls r0, 28 - cmp r0, 0 - bge _08042C20 - bl _0804441E -_08042C20: - ldr r1, =gStatuses3 - adds r1, r2, r1 - ldr r0, [r1] - movs r2, 0x80 - lsls r2, 12 - orrs r0, r2 - str r0, [r1] - ldrb r0, [r3] - movs r1, 0x8 - b _08042C92 - .pool -_08042C3C: - mov r0, r10 - bl castform_switch - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - cmp r0, 0 - bne _08042C50 - bl _0804443A -_08042C50: - ldr r0, =gUnknown_082DB4A9 - bl b_push_move_exec - ldr r0, =gBattleScripting - mov r1, r10 - strb r1, [r0, 0x17] - bl _080442E2 - .pool -_08042C68: - ldr r0, =gSpecialStatuses - mov r3, r10 - lsls r2, r3, 2 - adds r1, r2, r3 - lsls r1, 2 - adds r3, r1, r0 - ldrb r0, [r3] - lsls r0, 27 - cmp r0, 0 - bge _08042C80 - bl _0804441E -_08042C80: - ldr r1, =gStatuses3 - adds r1, r2, r1 - ldr r0, [r1] - movs r2, 0x80 - lsls r2, 13 - orrs r0, r2 - str r0, [r1] - ldrb r0, [r3] - movs r1, 0x10 -_08042C92: - orrs r0, r1 - strb r0, [r3] - bl _0804441E - .pool -_08042CA4: - movs r6, 0 - ldrb r5, [r5] - cmp r6, r5 - bcc _08042CB0 - bl _0804441E -_08042CB0: - adds r0, r6, 0 - bl castform_switch - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - cmp r0, 0 - beq _08042CC4 - bl _080442D8 -_08042CC4: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r6, r0 - bcc _08042CB0 - bl _0804441E - .pool -_08042CDC: - ldr r5, =gBattleMons - mov r8, r5 - movs r0, 0x58 - mov r6, r10 - muls r6, r0 - adds r4, r6, r5 - ldrh r0, [r4, 0x28] - cmp r0, 0 - bne _08042CF2 - bl _0804441E -_08042CF2: - ldr r0, =gBankAttacker - mov r1, r10 - strb r1, [r0] - ldrb r5, [r7] - cmp r5, 0x2C - beq _08042D22 - cmp r5, 0x2C - bgt _08042D14 - cmp r5, 0x3 - bne _08042D08 - b _08042E84 -_08042D08: - bl _0804441E - .pool -_08042D14: - cmp r5, 0x36 - bne _08042D1A - b _08042ED0 -_08042D1A: - cmp r5, 0x3D - beq _08042DA0 - bl _0804441E -_08042D22: - movs r0, 0 - str r0, [sp] - movs r0, 0x13 - movs r1, 0 - movs r2, 0xD - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _08042D3E - bl _0804441E -_08042D3E: - str r0, [sp] - movs r0, 0x13 - movs r1, 0 - movs r2, 0x4D - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - beq _08042D56 - bl _0804441E -_08042D56: - ldr r0, =gBattleWeather - ldrh r1, [r0] - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - bne _08042D66 - bl _0804441E -_08042D66: - ldrh r0, [r4, 0x2C] - ldrh r2, [r4, 0x28] - cmp r0, r2 - bhi _08042D72 - bl _0804441E -_08042D72: - strb r5, [r7] - ldr r0, =gUnknown_082DB45C - bl b_push_move_exec - ldr r1, =gBattleMoveDamage - ldrh r0, [r4, 0x2C] - lsrs r0, 4 - str r0, [r1] - cmp r0, 0 - bne _08042D8A - movs r0, 0x1 - str r0, [r1] -_08042D8A: - ldr r0, [r1] - negs r0, r0 - str r0, [r1] - bl _080443D0 - .pool -_08042DA0: - mov r0, r8 - adds r0, 0x4C - adds r5, r6, r0 - ldrb r0, [r5] - cmp r0, 0 - bne _08042DB0 - bl _0804441E -_08042DB0: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _08042DCA - bl _0804441E -_08042DCA: - ldr r0, [r5] - movs r1, 0x88 - ands r0, r1 - cmp r0, 0 - beq _08042DDC - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC70 - bl StringCopy -_08042DDC: - ldr r0, [r5] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - beq _08042DEE - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC78 - bl StringCopy -_08042DEE: - ldr r0, [r5] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08042E00 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC80 - bl StringCopy -_08042E00: - ldr r0, [r5] - movs r1, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08042E12 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC88 - bl StringCopy -_08042E12: - ldr r0, [r5] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08042E24 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC90 - bl StringCopy -_08042E24: - str r4, [r5] - mov r1, r8 - adds r1, 0x50 - adds r1, r6, r1 - ldr r0, [r1] - ldr r2, =0xf7ffffff - ands r0, r2 - str r0, [r1] - ldr r0, =gBattleScripting - ldr r4, =gActiveBank - mov r3, r10 - strb r3, [r4] - strb r3, [r0, 0x17] - ldr r0, =gUnknown_082DB484 - bl b_push_move_exec - str r5, [sp] - movs r0, 0 - movs r1, 0x28 - movs r2, 0 - movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs - ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution - bl _080443D0 - .pool -_08042E84: - ldrb r2, [r4, 0x1B] - movs r0, 0x1B - ldrsb r0, [r4, r0] - cmp r0, 0xB - ble _08042E92 - bl _0804441E -_08042E92: - ldr r0, =gDisableStructs - mov r5, r10 - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x16] - cmp r0, 0x2 - bne _08042EA8 - bl _0804441E -_08042EA8: - adds r0, r2, 0x1 - movs r1, 0 - strb r0, [r4, 0x1B] - ldr r4, =gBattleScripting - movs r0, 0x11 - strb r0, [r4, 0x10] - strb r1, [r4, 0x11] - ldr r0, =gUnknown_082DB444 - bl b_push_move_exec - strb r5, [r4, 0x17] - bl _080443D0 - .pool -_08042ED0: - ldr r2, =gDisableStructs - ldrb r0, [r0] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r3, [r1, 0x18] - lsls r0, r3, 31 - lsrs r0, 31 - movs r2, 0x1 - eors r2, r0 - movs r0, 0x2 - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x18] - bl _0804441E - .pool -_08042EF8: - ldrb r0, [r7] - cmp r0, 0x2B - beq _08042F02 - bl _0804441E -_08042F02: - movs r4, 0 - ldr r0, =gUnknown_0831BCF8 - ldrh r2, [r0] - ldr r3, =0x0000ffff - adds r1, r0, 0 - cmp r2, r3 - bne _08042F14 - bl _0804441E -_08042F14: - cmp r2, r5 - beq _08042F2C - adds r2, r1, 0 -_08042F1A: - adds r2, 0x2 - adds r4, 0x1 - ldrh r0, [r2] - cmp r0, r3 - bne _08042F28 - bl _0804441E -_08042F28: - cmp r0, r5 - bne _08042F1A -_08042F2C: - lsls r0, r4, 1 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _08042F3C - bl _0804441E -_08042F3C: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r1, 0x50 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 5 - ands r0, r1 - cmp r0, 0 - beq _08042F62 - ldr r0, =gHitMarker - ldr r1, [r0] - movs r2, 0x80 - lsls r2, 4 - orrs r1, r2 - str r1, [r0] -_08042F62: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB61F - str r0, [r1] - movs r0, 0x1 - mov r9, r0 - bl _08044424 - .pool -_08042F8C: - cmp r5, 0 - bne _08042F94 - bl _0804441E -_08042F94: - ldrb r0, [r7] - cmp r0, 0xB - beq _08043004 - cmp r0, 0xB - bgt _08042FA4 - cmp r0, 0xA - beq _08042FAA - b _08043126 -_08042FA4: - cmp r0, 0x12 - beq _0804305C - b _08043126 -_08042FAA: - cmp r3, 0xD - beq _08042FB0 - b _08043126 -_08042FB0: - ldr r0, =gBattleMoves - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _08042FC2 - b _08043126 -_08042FC2: - ldr r1, =gProtectStructs - ldr r0, =gBankAttacker - ldrb r0, [r0] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsls r0, 28 - cmp r0, 0 - bge _08042FF0 - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB56F - b _08042FF4 - .pool -_08042FF0: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB56E -_08042FF4: - str r0, [r1] - movs r1, 0x1 - b _08043124 - .pool -_08043004: - cmp r3, 0xB - beq _0804300A - b _08043126 -_0804300A: - ldr r0, =gBattleMoves - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _0804301C - b _08043126 -_0804301C: - ldr r1, =gProtectStructs - ldr r0, =gBankAttacker - ldrb r0, [r0] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsls r0, 28 - cmp r0, 0 - bge _08043048 - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB56F - b _0804304C - .pool -_08043048: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB56E -_0804304C: - str r0, [r1] - movs r2, 0x1 - mov r9, r2 - b _08043126 - .pool -_0804305C: - cmp r3, 0xA - bne _08043126 - ldr r1, =gBattleMons - movs r0, 0x58 - mov r3, r10 - muls r3, r0 - adds r0, r3, 0 - adds r1, 0x4C - adds r0, r1 - ldr r0, [r0] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08043126 - ldr r2, =gBattleResources - ldr r0, [r2] - ldr r0, [r0, 0x4] - mov r5, r10 - lsls r1, r5, 2 - adds r0, r1 - ldr r3, [r0] - movs r4, 0x1 - ands r3, r4 - adds r5, r1, 0 - cmp r3, 0 - bne _080430EC - ldr r0, =gBattleCommunication - strb r3, [r0, 0x5] - ldr r1, =gProtectStructs - ldr r0, =gBankAttacker - ldrb r0, [r0] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsls r0, 28 - cmp r0, 0 - bge _080430C8 - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB5A8 - b _080430CC - .pool -_080430C8: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB5A7 -_080430CC: - str r0, [r1] - ldr r0, [r2] - ldr r1, [r0, 0x4] - adds r1, r5 - ldr r0, [r1] - movs r2, 0x1 - orrs r0, r2 - str r0, [r1] - movs r0, 0x2 - mov r9, r0 - b _08043126 - .pool -_080430EC: - ldr r0, =gBattleCommunication - strb r4, [r0, 0x5] - ldr r1, =gProtectStructs - ldr r0, =gBankAttacker - ldrb r0, [r0] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsls r0, 28 - cmp r0, 0 - bge _0804311C - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB5A8 - b _08043120 - .pool -_0804311C: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB5A7 -_08043120: - str r0, [r1] - movs r1, 0x2 -_08043124: - mov r9, r1 -_08043126: - mov r2, r9 - cmp r2, 0x1 - beq _08043130 - bl _0804441E -_08043130: - ldr r1, =gBattleMons - movs r0, 0x58 - mov r3, r10 - muls r3, r0 - adds r0, r3, 0 - adds r1, r0, r1 - ldrh r0, [r1, 0x2C] - ldrh r5, [r1, 0x28] - cmp r0, r5 - bne _0804318C - ldr r1, =gProtectStructs - ldr r0, =gBankAttacker - ldrb r0, [r0] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsls r0, 28 - cmp r0, 0 - bge _08043178 - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB592 - str r0, [r1] - bl _0804441E - .pool -_08043178: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB591 - str r0, [r1] - bl _0804441E - .pool -_0804318C: - ldr r2, =gBattleMoveDamage - ldrh r0, [r1, 0x2C] - lsrs r0, 2 - str r0, [r2] - cmp r0, 0 - bne _0804319C - mov r0, r9 - str r0, [r2] -_0804319C: - ldr r0, [r2] - negs r0, r0 - str r0, [r2] - bl _0804441E - .pool -_080431AC: - ldrb r0, [r7] - subs r0, 0x9 - cmp r0, 0x2F - bls _080431B8 - bl _0804441E -_080431B8: - lsls r0, 2 - ldr r1, =_080431C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080431C8: - .4byte _080435E4 - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _08043288 - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _08043350 - .4byte _0804441E - .4byte _0804441E - .4byte _08043410 - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _08043508 - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _080436C0 - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804441E - .4byte _0804379C -_08043288: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _08043298 - bl _0804441E -_08043298: - cmp r5, 0xA5 - bne _080432A0 - bl _0804441E -_080432A0: - ldr r0, =gBattleMoves - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _080432B4 - bl _0804441E -_080432B4: - ldr r2, =gSpecialStatuses - ldr r0, =gBankTarget - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r1, r0, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _080432DC - adds r0, r2, 0 - adds r0, 0xC - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _080432DC - bl _0804441E -_080432DC: - ldr r1, =gBattleMons - movs r0, 0x58 - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - adds r1, r0, r1 - adds r4, r1, 0 - adds r4, 0x21 - ldrb r0, [r4] - cmp r0, r3 - bne _080432F6 - bl _0804441E -_080432F6: - adds r2, r1, 0 - adds r2, 0x22 - ldrb r0, [r2] - cmp r0, r3 - bne _08043304 - bl _0804441E -_08043304: - ldrh r0, [r1, 0x28] - cmp r0, 0 - bne _0804330E - bl _0804441E -_0804330E: - strb r3, [r4] - strb r3, [r2] - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x3 - strb r0, [r1, 0x1] - strb r3, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB64D - str r0, [r1] - bl _080443D0 - .pool -_08043350: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _08043360 - bl _0804441E -_08043360: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r3, r0, r1 - ldrh r0, [r3, 0x28] - cmp r0, 0 - bne _08043376 - bl _0804441E -_08043376: - ldr r0, =gProtectStructs - lsls r1, r2, 4 - adds r1, r0 - ldrb r0, [r1, 0x1] - lsls r0, 31 - cmp r0, 0 - beq _08043388 - bl _0804441E -_08043388: - ldr r2, =gSpecialStatuses - ldr r0, =gBankTarget - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r1, r0, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _080433B0 - adds r0, r2, 0 - adds r0, 0xC - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _080433B0 - bl _0804441E -_080433B0: - ldr r1, =gBattleMoves - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _080433CA - bl _0804441E -_080433CA: - ldr r1, =gBattleMoveDamage - ldrh r0, [r3, 0x2C] - lsrs r0, 4 - str r0, [r1] - cmp r0, 0 - bne _080433D8 - str r2, [r1] -_080433D8: - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB654 - str r0, [r1] - bl _080443D0 - .pool -_08043410: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _08043420 - bl _0804441E -_08043420: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _08043436 - bl _0804441E -_08043436: - ldr r0, =gProtectStructs - lsls r1, r2, 4 - adds r1, r0 - ldrb r0, [r1, 0x1] - lsls r0, 31 - cmp r0, 0 - beq _08043448 - bl _0804441E -_08043448: - ldr r2, =gSpecialStatuses - ldr r0, =gBankTarget - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r1, r0, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043470 - adds r0, r2, 0 - adds r0, 0xC - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043470 - bl _0804441E -_08043470: - ldr r1, =gBattleMoves - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08043488 - bl _0804441E -_08043488: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - beq _080434A0 - bl _0804441E -_080434A0: - ldr r5, =gBattleCommunication - movs r4, 0x3 -_080434A4: - bl Random - ands r0, r4 - strb r0, [r5, 0x3] - cmp r0, 0 - beq _080434A4 - ldr r1, =gBattleCommunication - ldrb r0, [r1, 0x3] - cmp r0, 0x3 - bne _080434BC - adds r0, 0x2 - strb r0, [r1, 0x3] -_080434BC: - ldrb r0, [r1, 0x3] - adds r0, 0x40 - strb r0, [r1, 0x3] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB67C - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 6 - orrs r0, r1 - str r0, [r2] - bl _080443D0 - .pool -_08043508: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _08043518 - bl _0804441E -_08043518: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _0804352E - bl _0804441E -_0804352E: - ldr r0, =gProtectStructs - lsls r1, r2, 4 - adds r1, r0 - ldrb r0, [r1, 0x1] - lsls r0, 31 - cmp r0, 0 - beq _08043540 - bl _0804441E -_08043540: - ldr r2, =gSpecialStatuses - ldr r0, =gBankTarget - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r1, r0, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043568 - adds r0, r2, 0 - adds r0, 0xC - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043568 - bl _0804441E -_08043568: - ldr r1, =gBattleMoves - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08043580 - bl _0804441E -_08043580: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - beq _08043598 - bl _0804441E -_08043598: - ldr r1, =gBattleCommunication - movs r0, 0x42 - strb r0, [r1, 0x3] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB67C - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 6 - orrs r0, r1 - str r0, [r2] - bl _080443D0 - .pool -_080435E4: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _080435F4 - bl _0804441E -_080435F4: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _0804360A - bl _0804441E -_0804360A: - ldr r0, =gProtectStructs - lsls r1, r2, 4 - adds r1, r0 - ldrb r0, [r1, 0x1] - lsls r0, 31 - cmp r0, 0 - beq _0804361C - bl _0804441E -_0804361C: - ldr r2, =gSpecialStatuses - ldr r0, =gBankTarget - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r1, r0, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043644 - adds r0, r2, 0 - adds r0, 0xC - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043644 - bl _0804441E -_08043644: - ldr r1, =gBattleMoves - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0804365C - bl _0804441E -_0804365C: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - beq _08043674 - bl _0804441E -_08043674: - ldr r1, =gBattleCommunication - movs r0, 0x45 - strb r0, [r1, 0x3] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB67C - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 6 - orrs r0, r1 - str r0, [r2] - bl _080443D0 - .pool -_080436C0: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _080436D0 - bl _0804441E -_080436D0: - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _080436E6 - bl _0804441E -_080436E6: - ldr r0, =gProtectStructs - lsls r1, r2, 4 - adds r1, r0 - ldrb r0, [r1, 0x1] - lsls r0, 31 - cmp r0, 0 - beq _080436F8 - bl _0804441E -_080436F8: - ldr r1, =gBattleMoves - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08043710 - bl _0804441E -_08043710: - ldr r2, =gSpecialStatuses - ldr r0, =gBankTarget - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r1, r0, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043738 - adds r0, r2, 0 - adds r0, 0xC - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043738 - bl _0804441E -_08043738: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - beq _08043750 - bl _0804441E -_08043750: - ldr r1, =gBattleCommunication - movs r0, 0x43 - strb r0, [r1, 0x3] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB67C - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 6 - orrs r0, r1 - str r0, [r2] - bl _080443D0 - .pool -_0804379C: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _080437AC - bl _0804441E -_080437AC: - ldr r6, =gBattleMons - ldr r3, =gBankAttacker - mov r8, r3 - ldrb r1, [r3] - movs r7, 0x58 - adds r0, r1, 0 - muls r0, r7 - adds r0, r6 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _080437C6 - bl _0804441E -_080437C6: - ldr r0, =gProtectStructs - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1, 0x1] - lsls r0, 31 - cmp r0, 0 - beq _080437D8 - bl _0804441E -_080437D8: - ldr r1, =gBattleMoves - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x8] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080437F0 - bl _0804441E -_080437F0: - ldr r3, =gSpecialStatuses - ldr r5, =gBankTarget - ldrb r1, [r5] - lsls r0, r1, 2 - adds r0, r1 - lsls r2, r0, 2 - adds r0, r3, 0 - adds r0, 0x8 - adds r0, r2, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043818 - adds r0, r3, 0 - adds r0, 0xC - adds r0, r2, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08043818 - bl _0804441E -_08043818: - adds r0, r1, 0 - muls r0, r7 - adds r0, r6 - ldrh r0, [r0, 0x28] - cmp r0, 0 - bne _08043828 - bl _0804441E -_08043828: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - beq _08043840 - bl _0804441E -_08043840: - mov r1, r8 - ldrb r0, [r1] - muls r0, r7 - adds r0, r6 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0xC - bne _08043854 - bl _0804441E -_08043854: - ldr r0, [sp, 0x8] - ldr r1, [sp, 0x10] - bl GetGenderFromSpeciesAndPersonality - adds r4, r0, 0 - ldr r0, [sp, 0xC] - ldr r1, [sp, 0x14] - bl GetGenderFromSpeciesAndPersonality - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bne _08043872 - bl _0804441E -_08043872: - mov r2, r8 - ldrb r0, [r2] - muls r0, r7 - adds r4, r6, 0 - adds r4, 0x50 - adds r0, r4 - ldr r0, [r0] - movs r1, 0xF0 - lsls r1, 12 - ands r0, r1 - cmp r0, 0 - beq _0804388E - bl _0804441E -_0804388E: - ldr r0, [sp, 0x8] - ldr r1, [sp, 0x10] - bl GetGenderFromSpeciesAndPersonality - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _080438A2 - bl _0804441E -_080438A2: - ldr r0, [sp, 0xC] - ldr r1, [sp, 0x14] - bl GetGenderFromSpeciesAndPersonality - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _080438B6 - bl _0804441E -_080438B6: - mov r3, r8 - ldrb r0, [r3] - adds r2, r0, 0 - muls r2, r7 - adds r2, r4 - ldr r1, =gBitTable - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - lsls r1, 16 - ldr r0, [r2] - orrs r0, r1 - str r0, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB66F - str r0, [r1] - bl _080443D0 - .pool -_08043908: - movs r5, 0 - mov r10, r5 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r10, r0 - bcc _08043918 - bl _0804441E -_08043918: - ldr r1, =gBattleMons - movs r0, 0x58 - mov r2, r10 - muls r2, r0 - adds r0, r2, 0 - adds r0, r1 - adds r0, 0x20 - ldrb r0, [r0] - subs r0, 0x7 - adds r2, r1, 0 - cmp r0, 0x41 - bls _08043932 - b _08043B96 -_08043932: - lsls r0, 2 - ldr r1, =_08043948 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08043948: - .4byte _08043AAC - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B70 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043AD4 - .4byte _08043B96 - .4byte _08043A50 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043A7C - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B40 - .4byte _08043B10 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043B96 - .4byte _08043AD4 -_08043A50: - movs r0, 0x58 - mov r3, r10 - muls r3, r0 - adds r0, r3, 0 - adds r1, r2, 0 - adds r1, 0x4C - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x00000f88 - ands r0, r1 - cmp r0, 0 - bne _08043A6A - b _08043B96 -_08043A6A: - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC70 - b _08043B5C - .pool -_08043A7C: - movs r0, 0x58 - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - adds r1, r2, 0 - adds r1, 0x50 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - bne _08043A96 - b _08043B96 -_08043A96: - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC98 - bl StringCopy - movs r2, 0x2 - mov r9, r2 - b _08043B9C - .pool -_08043AAC: - movs r0, 0x58 - mov r3, r10 - muls r3, r0 - adds r0, r3, 0 - adds r1, r2, 0 - adds r1, 0x4C - adds r0, r1 - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08043B96 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC80 - b _08043B5C - .pool -_08043AD4: - movs r0, 0x58 - mov r3, r10 - muls r3, r0 - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r3, r0 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - beq _08043B96 - adds r2, 0x50 - adds r2, r3, r2 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC78 - bl StringCopy - movs r0, 0x1 - mov r9, r0 - b _08043B9C - .pool -_08043B10: - movs r0, 0x58 - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - adds r1, r2, 0 - adds r1, 0x4C - adds r0, r1 - ldr r0, [r0] - movs r1, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08043B96 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC88 - bl StringCopy - movs r2, 0x1 - mov r9, r2 - b _08043B9C - .pool -_08043B40: - movs r0, 0x58 - mov r3, r10 - muls r3, r0 - adds r0, r3, 0 - adds r1, r2, 0 - adds r1, 0x4C - adds r0, r1 - ldr r0, [r0] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08043B96 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC90 -_08043B5C: - bl StringCopy - movs r5, 0x1 - mov r9, r5 - b _08043B9C - .pool -_08043B70: - movs r0, 0x58 - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - adds r1, r2, 0 - adds r1, 0x50 - adds r0, r1 - ldr r0, [r0] - movs r1, 0xF0 - lsls r1, 12 - ands r0, r1 - cmp r0, 0 - beq _08043B96 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BCA0 - bl StringCopy - movs r2, 0x3 - mov r9, r2 -_08043B96: - mov r3, r9 - cmp r3, 0 - beq _08043C50 -_08043B9C: - mov r5, r9 - cmp r5, 0x2 - beq _08043BD0 - cmp r5, 0x2 - bgt _08043BB4 - cmp r5, 0x1 - beq _08043BBC - b _08043BFC - .pool -_08043BB4: - mov r0, r9 - cmp r0, 0x3 - beq _08043BE8 - b _08043BFC -_08043BBC: - ldr r1, =gBattleMons - movs r0, 0x58 - mov r2, r10 - muls r2, r0 - adds r1, 0x4C - adds r2, r1 - movs r0, 0 - b _08043BFA - .pool -_08043BD0: - ldr r1, =gBattleMons - movs r0, 0x58 - mov r2, r10 - muls r2, r0 - adds r1, 0x50 - adds r2, r1 - ldr r0, [r2] - movs r1, 0x8 - negs r1, r1 - b _08043BF8 - .pool -_08043BE8: - ldr r1, =gBattleMons - movs r0, 0x58 - mov r2, r10 - muls r2, r0 - adds r1, 0x50 - adds r2, r1 - ldr r0, [r2] - ldr r1, =0xfff0ffff -_08043BF8: - ands r0, r1 -_08043BFA: - str r0, [r2] -_08043BFC: - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB68C - str r0, [r1] - ldr r0, =gBattleScripting - mov r1, r10 - strb r1, [r0, 0x17] - ldr r4, =gActiveBank - strb r1, [r4] - ldrb r1, [r4] - movs r0, 0x58 - muls r0, r1 - ldr r1, =gBattleMons + 0x4C - adds r0, r1 - str r0, [sp] - movs r0, 0 - movs r1, 0x28 - movs r2, 0 - movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs - ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution - bl _0804443A - .pool -_08043C50: - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r10, r0 - bcs _08043C64 - b _08043918 -_08043C64: - bl _0804441E - .pool -_08043C6C: - movs r2, 0 - mov r10, r2 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r10, r0 - bcc _08043C7A - b _0804441E -_08043C7A: - ldr r4, =gBattleMons -_08043C7C: - movs r0, 0x58 - mov r3, r10 - muls r3, r0 - adds r0, r3, 0 - adds r0, r4 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0x3B - bne _08043CA0 - mov r0, r10 - bl castform_switch - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - cmp r0, 0 - beq _08043CA0 - b _080442FC -_08043CA0: - mov r0, r10 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r10, r0 - bcc _08043C7C - b _0804441E - .pool -_08043CBC: - ldrb r0, [r7] - cmp r0, 0x1C - beq _08043CC4 - b _0804441E -_08043CC4: - ldr r4, =gHitMarker - ldr r1, [r4] - movs r0, 0x80 - lsls r0, 7 - ands r0, r1 - cmp r0, 0 - bne _08043CD4 - b _0804441E -_08043CD4: - ldr r0, =0xffffbfff - ands r1, r0 - str r1, [r4] - mov r5, r8 - ldr r1, [r5] - adds r1, 0xB2 - ldrb r2, [r1] - movs r0, 0x3F - ands r0, r2 - strb r0, [r1] - ldr r0, [r5] - adds r1, r0, 0 - adds r1, 0xB2 - ldrb r0, [r1] - cmp r0, 0x6 - bne _08043CF8 - movs r0, 0x2 - strb r0, [r1] -_08043CF8: - ldr r1, =gBattleCommunication - mov r2, r8 - ldr r0, [r2] - adds r0, 0xB2 - ldrb r0, [r0] - adds r0, 0x40 - strb r0, [r1, 0x3] - ldr r1, =gBattleScripting - ldr r0, =gBankTarget - ldrb r0, [r0] - strb r0, [r1, 0x17] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB67F - str r0, [r1] - ldr r0, [r4] - movs r1, 0x80 - lsls r1, 6 - orrs r0, r1 - str r0, [r4] - b _080443D0 - .pool -_08043D40: - ldrb r0, [r7] - cmp r0, 0x1C - beq _08043D48 - b _0804441E -_08043D48: - ldr r4, =gHitMarker - ldr r1, [r4] - movs r0, 0x80 - lsls r0, 7 - ands r0, r1 - cmp r0, 0 - bne _08043D58 - b _0804441E -_08043D58: - ldr r0, =0xffffbfff - ands r1, r0 - str r1, [r4] - mov r3, r8 - ldr r1, [r3] - adds r1, 0xB2 - ldrb r2, [r1] - movs r0, 0x3F - ands r0, r2 - strb r0, [r1] - ldr r0, [r3] - adds r1, r0, 0 - adds r1, 0xB2 - ldrb r0, [r1] - cmp r0, 0x6 - bne _08043D7C - movs r0, 0x2 - strb r0, [r1] -_08043D7C: - ldr r1, =gBattleCommunication - mov r3, r8 - ldr r0, [r3] - adds r0, 0xB2 - ldrb r0, [r0] - strb r0, [r1, 0x3] - ldr r1, =gBattleScripting - ldr r0, =gBankAttacker - ldrb r0, [r0] - strb r0, [r1, 0x17] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB67F - str r0, [r1] - ldr r0, [r4] - movs r1, 0x80 - lsls r1, 6 - orrs r0, r1 - str r0, [r4] - b _080443D0 - .pool -_08043DC4: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r1, [r0] - cmp r4, r1 - blt _08043DD0 - b _0804441E -_08043DD0: - ldr r0, =gBattleMons - adds r5, r1, 0 - ldr r2, =gStatuses3 - adds r3, r0, 0 - adds r3, 0x20 - movs r6, 0x80 - lsls r6, 12 -_08043DDE: - ldrb r1, [r3] - cmp r1, 0x16 - bne _08043DEE - ldr r0, [r2] - ands r0, r6 - cmp r0, 0 - beq _08043DEE - b _08044324 -_08043DEE: - adds r2, 0x4 - adds r3, 0x58 - adds r4, 0x1 - cmp r4, r5 - blt _08043DDE - b _0804441E - .pool -_08043E08: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08043E14 - b _0804441E -_08043E14: - ldr r5, =gActiveBank - mov r8, r5 - ldr r0, =gBattleMons - adds r0, 0x20 - str r0, [sp, 0x1C] - movs r1, 0 - str r1, [sp, 0x20] -_08043E22: - ldr r2, [sp, 0x1C] - ldrb r0, [r2] - cmp r0, 0x24 - beq _08043E2C - b _08043FBE -_08043E2C: - ldr r0, =gStatuses3 - ldr r3, [sp, 0x20] - adds r0, r3, r0 - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 13 - ands r1, r0 - str r3, [sp, 0x18] - cmp r1, 0 - bne _08043E42 - b _08043FBE -_08043E42: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBankIdentity - movs r1, 0x1 - adds r5, r0, 0 - eors r5, r1 - ands r5, r1 - adds r0, r5, 0 - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r5, 0x2 - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r2, 0x1 - ands r0, r2 - cmp r0, 0 - bne _08043E74 - b _08043F84 -_08043E74: - movs r1, 0x58 - adds r0, r6, 0 - muls r0, r1 - ldr r3, =gBattleMons - adds r1, r0, r3 - adds r0, r1, 0 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0 - beq _08043F40 - ldrh r0, [r1, 0x28] - cmp r0, 0 - beq _08043EFC - movs r1, 0x58 - adds r0, r7, 0 - muls r0, r1 - adds r1, r0, r3 - adds r0, r1, 0 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0 - beq _08043EFC - ldrh r0, [r1, 0x28] - cmp r0, 0 - beq _08043EFC - str r2, [sp, 0x24] - bl Random - ldr r2, [sp, 0x24] - adds r1, r2, 0 - ands r1, r0 - lsls r1, 1 - orrs r5, r1 - adds r0, r5, 0 - bl GetBankByPlayerAI - mov r2, r8 - strb r0, [r2] - ldrb r0, [r2] - movs r3, 0x58 - muls r0, r3 - ldr r5, =gBattleMons - adds r0, r5 - adds r0, 0x20 - ldrb r0, [r0] - ldr r1, [sp, 0x1C] - strb r0, [r1] - ldrb r0, [r2] - muls r0, r3 - adds r0, r5 - adds r0, 0x20 - ldrb r0, [r0] - ldr r2, =gLastUsedAbility - strb r0, [r2] - b _08043FAC - .pool -_08043EFC: - ldr r3, =gBattleMons - movs r2, 0x58 - adds r0, r6, 0 - muls r0, r2 - adds r1, r0, r3 - adds r0, r1, 0 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0 - beq _08043F40 - ldrh r0, [r1, 0x28] - cmp r0, 0 - beq _08043F40 - mov r5, r8 - strb r6, [r5] - adds r1, r4, 0 - muls r1, r2 - adds r1, r3 - ldrb r0, [r5] - muls r0, r2 - adds r0, r3 - adds r0, 0x20 - ldrb r0, [r0] - adds r1, 0x20 - strb r0, [r1] - ldrb r0, [r5] - muls r0, r2 - adds r0, r3 - adds r0, 0x20 - ldrb r0, [r0] - b _08043FA8 - .pool -_08043F40: - ldr r3, =gBattleMons - movs r2, 0x58 - adds r0, r7, 0 - muls r0, r2 - adds r1, r0, r3 - adds r0, r1, 0 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0 - beq _08043FB6 - ldrh r0, [r1, 0x28] - cmp r0, 0 - beq _08043FB6 - mov r5, r8 - strb r7, [r5] - adds r1, r4, 0 - muls r1, r2 - adds r1, r3 - ldrb r0, [r5] - muls r0, r2 - adds r0, r3 - adds r0, 0x20 - ldrb r0, [r0] - adds r1, 0x20 - strb r0, [r1] - ldrb r0, [r5] - muls r0, r2 - adds r0, r3 - adds r0, 0x20 - ldrb r0, [r0] - b _08043FA8 - .pool -_08043F84: - mov r2, r8 - strb r6, [r2] - movs r3, 0x58 - adds r0, r6, 0 - muls r0, r3 - ldr r5, =gBattleMons - adds r0, r5 - adds r2, r0, 0 - adds r2, 0x20 - ldrb r1, [r2] - cmp r1, 0 - beq _08043FB6 - ldrh r0, [r0, 0x28] - cmp r0, 0 - beq _08043FB6 - ldr r0, [sp, 0x1C] - strb r1, [r0] - ldrb r0, [r2] -_08043FA8: - ldr r1, =gLastUsedAbility - strb r0, [r1] -_08043FAC: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_08043FB6: - mov r2, r9 - cmp r2, 0 - beq _08043FBE - b _08044340 -_08043FBE: - ldr r3, [sp, 0x1C] - adds r3, 0x58 - str r3, [sp, 0x1C] - ldr r5, [sp, 0x20] - adds r5, 0x4 - str r5, [sp, 0x20] - adds r4, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - bge _08043FD6 - b _08043E22 -_08043FD6: - b _0804441E - .pool -_08043FE4: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r1, [r0] - cmp r4, r1 - blt _08043FF0 - b _0804441E -_08043FF0: - ldr r0, =gBattleMons - adds r5, r1, 0 - ldr r2, =gStatuses3 - adds r3, r0, 0 - adds r3, 0x20 - movs r6, 0x80 - lsls r6, 12 -_08043FFE: - ldrb r1, [r3] - cmp r1, 0x16 - bne _0804400E - ldr r0, [r2] - ands r0, r6 - cmp r0, 0 - beq _0804400E - b _080443B4 -_0804400E: - adds r2, 0x4 - adds r3, 0x58 - adds r4, 0x1 - cmp r4, r5 - blt _08043FFE - b _0804441E - .pool -_08044028: - mov r0, r10 - bl GetBankSide - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _0804403E - b _0804441E -_0804403E: - ldr r7, =gBattleMons -_08044040: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - adds r3, r4, 0x1 - cmp r0, r5 - beq _0804406A - movs r0, 0x58 - muls r0, r4 - adds r0, r7 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, r6 - bne _0804406A - ldr r0, =gLastUsedAbility - strb r6, [r0] - lsls r0, r3, 24 - lsrs r0, 24 - mov r9, r0 -_0804406A: - adds r4, r3, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08044040 - b _0804441E - .pool -_08044084: - mov r0, r10 - bl GetBankSide - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _0804409A - b _0804441E -_0804409A: - ldr r7, =gBattleMons -_0804409C: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - adds r3, r4, 0x1 - cmp r0, r5 - bne _080440C6 - movs r0, 0x58 - muls r0, r4 - adds r0, r7 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, r6 - bne _080440C6 - ldr r0, =gLastUsedAbility - strb r6, [r0] - lsls r0, r3, 24 - lsrs r0, 24 - mov r9, r0 -_080440C6: - adds r4, r3, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _0804409C - b _0804441E - .pool -_080440E0: - ldrb r0, [r7] - cmp r0, 0xFD - beq _08044104 - cmp r0, 0xFE - beq _0804413C - movs r4, 0 - ldr r0, =gNoOfAllBanks - adds r5, r0, 0 - ldrb r0, [r5] - cmp r4, r0 - blt _080440F8 - b _0804441E -_080440F8: - ldr r2, =gBattleMons - b _08044174 - .pool -_08044104: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08044110 - b _0804441E -_08044110: - ldr r5, =gStatuses3 - movs r2, 0x80 - lsls r2, 9 - adds r1, r0, 0 -_08044118: - lsls r0, r4, 2 - adds r0, r5 - ldr r0, [r0] - ands r0, r2 - adds r3, r4, 0x1 - cmp r0, 0 - beq _0804412C - lsls r0, r3, 24 - lsrs r0, 24 - mov r9, r0 -_0804412C: - adds r4, r3, 0 - cmp r4, r1 - blt _08044118 - b _0804441E - .pool -_0804413C: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08044148 - b _0804441E -_08044148: - ldr r5, =gStatuses3 - movs r2, 0x80 - lsls r2, 10 - adds r1, r0, 0 -_08044150: - lsls r0, r4, 2 - adds r0, r5 - ldr r0, [r0] - ands r0, r2 - adds r3, r4, 0x1 - cmp r0, 0 - beq _08044164 - lsls r0, r3, 24 - lsrs r0, 24 - mov r9, r0 -_08044164: - adds r4, r3, 0 - cmp r4, r1 - blt _08044150 - b _0804441E - .pool -_08044174: - movs r0, 0x58 - muls r0, r4 - adds r0, r2 - adds r0, 0x20 - ldrb r0, [r0] - adds r3, r4, 0x1 - cmp r0, r6 - bne _0804418C - strb r6, [r7] - lsls r0, r3, 24 - lsrs r0, 24 - mov r9, r0 -_0804418C: - adds r4, r3, 0 - ldrb r1, [r5] - cmp r4, r1 - blt _08044174 - b _0804441E -_08044196: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _080441A2 - b _0804441E -_080441A2: - ldr r2, =gBattleMons - mov r8, r2 - adds r2, r0, 0 - movs r5, 0x58 -_080441AA: - adds r0, r4, 0 - muls r0, r5 - mov r3, r8 - adds r1, r0, r3 - adds r0, r1, 0 - adds r0, 0x20 - ldrb r0, [r0] - adds r3, r4, 0x1 - cmp r0, r6 - bne _080441CC - ldrh r0, [r1, 0x28] - cmp r0, 0 - beq _080441CC - strb r6, [r7] - lsls r0, r3, 24 - lsrs r0, 24 - mov r9, r0 -_080441CC: - adds r4, r3, 0 - cmp r4, r2 - blt _080441AA - b _0804441E - .pool -_080441DC: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _080441E8 - b _0804441E -_080441E8: - ldr r7, =gBattleMons - adds r1, r0, 0 - movs r5, 0x58 - ldr r2, =gLastUsedAbility -_080441F0: - adds r0, r4, 0 - muls r0, r5 - adds r0, r7 - adds r0, 0x20 - ldrb r0, [r0] - adds r3, r4, 0x1 - cmp r0, r6 - bne _0804420C - cmp r4, r10 - beq _0804420C - strb r6, [r2] - lsls r0, r3, 24 - lsrs r0, 24 - mov r9, r0 -_0804420C: - adds r4, r3, 0 - cmp r4, r1 - blt _080441F0 - b _0804441E - .pool -_08044220: - mov r0, r10 - bl GetBankSide - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08044236 - b _0804441E -_08044236: - ldr r7, =gBattleMons -_08044238: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, r5 - beq _08044264 - movs r0, 0x58 - muls r0, r4 - adds r0, r7 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, r6 - bne _08044264 - ldr r0, =gLastUsedAbility - strb r6, [r0] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_08044264: - adds r4, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08044238 - b _0804441E - .pool -_0804427C: - mov r0, r10 - bl GetBankSide - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08044292 - b _0804441E -_08044292: - ldr r7, =gBattleMons -_08044294: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, r5 - bne _080442C0 - movs r0, 0x58 - muls r0, r4 - adds r0, r7 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, r6 - bne _080442C0 - ldr r0, =gLastUsedAbility - strb r6, [r0] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080442C0: - adds r4, 0x1 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r4, r0 - blt _08044294 - b _0804441E - .pool -_080442D8: - ldr r0, =gUnknown_082DB4A9 - bl b_push_move_exec - ldr r0, =gBattleScripting - strb r6, [r0, 0x17] -_080442E2: - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r0, 0x7F - mov r1, r9 - subs r1, 0x1 - strb r1, [r0] - b _0804441E - .pool -_080442FC: - ldr r0, =gUnknown_082DB4A9 - bl b_push_move_exec - ldr r0, =gBattleScripting - mov r5, r10 - strb r5, [r0, 0x17] - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r0, 0x7F - mov r1, r9 - subs r1, 0x1 - strb r1, [r0] - b _0804443A - .pool -_08044324: - strb r1, [r7] - ldr r0, [r2] - ldr r1, =0xfff7ffff - ands r0, r1 - str r0, [r2] - ldr r0, =gUnknown_082DB4B8 - bl b_push_move_exec - b _080443C8 - .pool -_08044340: - ldr r0, =gUnknown_082DB452 - bl b_push_move_exec - ldr r1, =gStatuses3 - ldr r0, [sp, 0x18] - adds r1, r0, r1 - ldr r0, [r1] - ldr r2, =0xffefffff - ands r0, r2 - str r0, [r1] - ldr r0, =gBattleScripting - strb r4, [r0, 0x17] - ldr r1, =gBattleTextBuff1 - movs r4, 0xFD - strb r4, [r1] - movs r0, 0x4 - strb r0, [r1, 0x1] - ldr r2, =gActiveBank - ldrb r0, [r2] - strb r0, [r1, 0x2] - ldr r3, =gBattlePartyID - ldrb r0, [r2] - lsls r0, 1 - adds r0, r3 - ldrh r0, [r0] - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - ldr r1, =gBattleTextBuff2 - strb r4, [r1] - movs r0, 0x9 - strb r0, [r1, 0x1] - ldr r0, =gLastUsedAbility - ldrb r0, [r0] - strb r0, [r1, 0x2] - movs r0, 0x1 - negs r0, r0 - strb r0, [r1, 0x3] - b _0804441E - .pool -_080443B4: - strb r1, [r7] - ldr r0, [r2] - ldr r1, =0xfff7ffff - ands r0, r1 - str r0, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB4C1 - str r0, [r1] -_080443C8: - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r0, 0xD8 - strb r4, [r0] -_080443D0: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - b _0804441E - .pool -_080443EC: - movs r4, 0 - ldr r0, =gNoOfAllBanks - ldrb r1, [r0] - cmp r4, r1 - bge _0804441E - ldr r0, =gBattleMons - adds r2, r1, 0 - adds r1, r0, 0 - adds r1, 0x20 - ldr r3, =gLastUsedAbility -_08044400: - ldrb r0, [r1] - cmp r0, r6 - bne _08044416 - cmp r4, r10 - beq _08044416 - strb r6, [r3] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_08044416: - adds r1, 0x58 - adds r4, 0x1 - cmp r4, r2 - blt _08044400 -_0804441E: - mov r1, r9 - cmp r1, 0 - beq _0804443A -_08044424: - ldr r2, [sp, 0x4] - cmp r2, 0xB - bhi _0804443A - ldr r1, =gLastUsedAbility - ldrb r0, [r1] - cmp r0, 0xFF - beq _0804443A - adds r1, r0, 0 - mov r0, r10 - bl RecordAbilityBattle -_0804443A: - mov r0, r9 - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end AbilityBattleEffects - - thumb_func_start b_call_bc_move_exec -b_call_bc_move_exec: @ 8044458 - ldr r1, =gBattlescriptCurrInstr - str r0, [r1] - ldr r0, =gBattleResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - adds r3, r2, 0 - adds r3, 0x20 - ldrb r0, [r3] - adds r1, r0, 0x1 - strb r1, [r3] - lsls r0, 24 - lsrs r0, 22 - adds r2, r0 - ldr r1, =gBattleMainFunc - ldr r0, [r1] - str r0, [r2] - ldr r0, =bc_move_exec_returning - str r0, [r1] - ldr r1, =gFightStateTracker - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end b_call_bc_move_exec - - thumb_func_start b_push_move_exec -b_push_move_exec: @ 8044498 - push {r4,lr} - adds r4, r0, 0 - bl b_movescr_stack_push_cursor - ldr r0, =gBattlescriptCurrInstr - str r4, [r0] - ldr r0, =gBattleResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - adds r3, r2, 0 - adds r3, 0x20 - ldrb r0, [r3] - adds r1, r0, 0x1 - strb r1, [r3] - lsls r0, 24 - lsrs r0, 22 - adds r2, r0 - ldr r1, =gBattleMainFunc - ldr r0, [r1] - str r0, [r2] - ldr r0, =sub_803E08C - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end b_push_move_exec - - thumb_func_start berry_effects_maybe -berry_effects_maybe: @ 80444DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - movs r0, 0 - mov r10, r0 - movs r1, 0 - str r1, [sp, 0xC] - add r0, sp, 0x4 - strb r1, [r0] - ldr r4, =gLastUsedItem - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r0, r1 - ldrh r0, [r0, 0x2E] - strh r0, [r4] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAF - bne _08044534 - ldr r1, =gEnigmaBerries - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r5, [r0, 0x7] - ldrb r0, [r0, 0x1A] - b _08044548 - .pool -_08044534: - ldrh r0, [r4] - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4] - bl ItemId_GetHoldEffectParam - lsls r0, 24 - lsrs r0, 24 -_08044548: - mov r9, r0 - ldr r1, =gBattleMons - ldr r0, =gBankAttacker - ldrb r2, [r0] - movs r0, 0x58 - muls r0, r2 - adds r0, r1 - ldrh r0, [r0, 0x2E] - str r0, [sp, 0x14] - cmp r0, 0xAF - bne _0804457C - ldr r1, =gEnigmaBerries - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r3, [r0, 0x7] - mov r8, r3 - ldrb r0, [r0, 0x1A] - b _08044592 - .pool -_0804457C: - ldr r0, [sp, 0x14] - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, [sp, 0x14] - bl ItemId_GetHoldEffectParam - lsls r0, 24 - lsrs r0, 24 -_08044592: - str r0, [sp, 0x10] - ldr r2, =gBattleMons - ldr r0, =gBankTarget - ldrb r1, [r0] - movs r0, 0x58 - muls r0, r1 - adds r0, r2 - ldrh r4, [r0, 0x2E] - cmp r4, 0xAF - beq _080445B2 - adds r0, r4, 0 - bl ItemId_GetHoldEffect - adds r0, r4, 0 - bl ItemId_GetHoldEffectParam -_080445B2: - ldr r0, [sp, 0x8] - cmp r0, 0x4 - bls _080445BC - bl _0804582A -_080445BC: - lsls r0, 2 - ldr r1, =_080445D4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080445D4: - .4byte _080445E8 - .4byte _08044688 - .4byte _0804582A - .4byte _08045280 - .4byte _080456D0 -_080445E8: - cmp r5, 0x17 - beq _08044618 - cmp r5, 0x20 - beq _080445F4 - bl _0804582A -_080445F4: - adds r0, r7, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - beq _08044604 - bl _0804582A -_08044604: - ldr r0, =gBattleStruct - ldr r0, [r0] - adds r0, 0x4A - movs r1, 0x2 - strb r1, [r0] - bl _0804582A - .pool -_08044618: - ldr r1, =gBattleMons - mov r8, r1 - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x18 - adds r1, r0 - movs r2, 0x6 - movs r3, 0x7 - mov r10, r3 -_0804462E: - movs r0, 0 - ldrsb r0, [r1, r0] - cmp r0, 0x5 - bgt _0804463C - strb r2, [r1] - movs r5, 0x5 - str r5, [sp, 0xC] -_0804463C: - adds r1, 0x1 - movs r0, 0x1 - negs r0, r0 - add r10, r0 - mov r3, r10 - cmp r3, 0 - bge _0804462E - ldr r5, [sp, 0xC] - cmp r5, 0 - bne _08044654 - bl _0804582A -_08044654: - ldr r0, =gBattleScripting - strb r7, [r0, 0x17] - ldr r0, =gStringBank - strb r7, [r0] - ldr r1, =gActiveBank - ldr r0, =gBankAttacker - strb r7, [r0] - strb r7, [r1] - ldr r0, =gUnknown_082DB7AE - bl b_call_bc_move_exec - bl _0804582A - .pool -_08044688: - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r0, r1 - ldrh r0, [r0, 0x28] - mov r8, r1 - cmp r0, 0 - bne _0804469C - bl _0804582A -_0804469C: - subs r0, r5, 0x1 - cmp r0, 0x2A - bls _080446A6 - bl _080451D6 -_080446A6: - lsls r0, 2 - ldr r1, =_080446B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080446B8: - .4byte _08044764 - .4byte _08044F44 - .4byte _08045008 - .4byte _08044F74 - .4byte _08044FA8 - .4byte _08044FD8 - .4byte _080447B0 - .4byte _08045044 - .4byte _08045074 - .4byte _0804497C - .4byte _080449FC - .4byte _08044A78 - .4byte _08044B0C - .4byte _08044BA0 - .4byte _08044C34 - .4byte _08044C9C - .4byte _08044CF0 - .4byte _08044D44 - .4byte _08044DAC - .4byte _08044E10 - .4byte _08044E5C - .4byte _080451D6 - .4byte _080448B0 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451A0 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _080451D6 - .4byte _0804491C -_08044764: - movs r0, 0x58 - muls r0, r7 - mov r1, r8 - adds r2, r0, r1 - ldrh r0, [r2, 0x2C] - ldrh r1, [r2, 0x28] - lsrs r0, 1 - cmp r1, r0 - bls _0804477A - bl _080451D6 -_0804477A: - cmp r6, 0 - beq _08044782 - bl _080451D6 -_08044782: - ldr r4, =gBattleMoveDamage - mov r3, r9 - str r3, [r4] - ldrh r3, [r2, 0x28] - mov r5, r9 - adds r0, r3, r5 - ldrh r1, [r2, 0x2C] - cmp r0, r1 - ble _08044798 - subs r0, r1, r3 - str r0, [r4] -_08044798: - ldr r0, [r4] - negs r0, r0 - str r0, [r4] - ldr r0, =gUnknown_082DB7C4 - bl b_call_bc_move_exec - b _08044B02 - .pool -_080447B0: - cmp r6, 0 - beq _080447B8 - bl _080451D6 -_080447B8: - adds r0, r7, 0 - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _080447DC - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - b _080447EA - .pool -_080447DC: - ldr r1, =gBattlePartyID - lsls r0, r7, 1 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty -_080447EA: - adds r4, r1, r0 - movs r1, 0 - mov r10, r1 - add r5, sp, 0x4 -_080447F2: - mov r1, r10 - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - mov r1, r10 - adds r1, 0x11 - adds r0, r4, 0 - bl GetMonData - strb r0, [r5] - adds r0, r4, 0 - movs r1, 0x15 - bl GetMonData - lsls r0, 24 - lsrs r1, r0, 24 - cmp r6, 0 - beq _08044822 - ldrb r0, [r5] - cmp r0, 0 - beq _0804482C -_08044822: - movs r2, 0x1 - add r10, r2 - mov r3, r10 - cmp r3, 0x3 - ble _080447F2 -_0804482C: - mov r5, r10 - cmp r5, 0x4 - bne _08044836 - bl _080451D6 -_08044836: - lsls r2, r5, 24 - lsrs r2, 24 - adds r0, r6, 0 - bl CalculatePPWithBonus - lsls r0, 24 - lsrs r2, r0, 24 - add r0, sp, 0x4 - ldrb r0, [r0] - mov r3, r9 - adds r1, r0, r3 - cmp r1, r2 - ble _08044860 - add r0, sp, 0x4 - strb r2, [r0] - b _08044864 - .pool -_08044860: - add r0, sp, 0x4 - strb r1, [r0] -_08044864: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - strb r6, [r1, 0x2] - lsrs r0, r6, 8 - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - ldr r0, =gUnknown_082DB7E1 - bl b_call_bc_move_exec - mov r1, r10 - adds r1, 0x9 - lsls r1, 24 - lsrs r1, 24 - add r5, sp, 0x4 - str r5, [sp] - movs r0, 0 - movs r2, 0 - movs r3, 0x1 - bl dp01_build_cmdbuf_x02_a_b_varargs - ldr r0, =gActiveBank - ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution - movs r0, 0x3 - str r0, [sp, 0xC] - bl _080451DE - .pool -_080448B0: - ldr r0, =gBattleMons - movs r1, 0x58 - muls r1, r7 - adds r0, 0x18 - adds r1, r0 - movs r2, 0x6 - movs r3, 0x7 - mov r10, r3 -_080448C0: - movs r0, 0 - ldrsb r0, [r1, r0] - cmp r0, 0x5 - bgt _080448CE - strb r2, [r1] - movs r5, 0x5 - str r5, [sp, 0xC] -_080448CE: - adds r1, 0x1 - movs r0, 0x1 - negs r0, r0 - add r10, r0 - mov r3, r10 - cmp r3, 0 - bge _080448C0 - movs r5, 0x8 - mov r10, r5 - ldr r0, [sp, 0xC] - cmp r0, 0 - bne _080448EA - bl _0804582A -_080448EA: - ldr r0, =gBattleScripting - strb r7, [r0, 0x17] - ldr r0, =gStringBank - strb r7, [r0] - ldr r1, =gActiveBank - ldr r0, =gBankAttacker - strb r7, [r0] - strb r7, [r1] - ldr r0, =gUnknown_082DB7AE - bl b_call_bc_move_exec - bl _080451D6 - .pool -_0804491C: - movs r0, 0x58 - muls r0, r7 - mov r2, r8 - adds r1, r0, r2 - ldrh r0, [r1, 0x28] - ldrh r3, [r1, 0x2C] - cmp r0, r3 - bcc _08044930 - bl _080451D6 -_08044930: - cmp r6, 0 - beq _08044938 - bl _080451D6 -_08044938: - ldr r3, =gBattleMoveDamage - ldrh r0, [r1, 0x2C] - lsrs r0, 4 - str r0, [r3] - cmp r0, 0 - bne _08044948 - movs r0, 0x1 - str r0, [r3] -_08044948: - ldrh r2, [r1, 0x28] - ldr r0, [r3] - adds r0, r2, r0 - ldrh r1, [r1, 0x2C] - cmp r0, r1 - ble _08044958 - subs r0, r1, r2 - str r0, [r3] -_08044958: - ldr r0, [r3] - negs r0, r0 - str r0, [r3] - ldr r0, =gUnknown_082DB7F1 - bl b_call_bc_move_exec - movs r0, 0x4 - str r0, [sp, 0xC] - adds r0, r7, 0 - adds r1, r5, 0 - bl RecordItemEffectBattle - bl _080451D6 - .pool -_0804497C: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - str r1, [sp, 0x18] - adds r4, r1, 0 - add r4, r8 - ldrh r0, [r4, 0x2C] - ldrh r1, [r4, 0x28] - lsrs r0, 1 - cmp r1, r0 - bls _08044996 - bl _080451D6 -_08044996: - cmp r6, 0 - beq _0804499E - bl _080451D6 -_0804499E: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x8 - strb r0, [r1, 0x1] - strb r6, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r5, =gBattleMoveDamage - ldrh r0, [r4, 0x2C] - mov r1, r9 - bl __divsi3 - str r0, [r5] - cmp r0, 0 - bne _080449C2 - movs r0, 0x1 - str r0, [r5] -_080449C2: - ldrh r2, [r4, 0x28] - ldr r0, [r5] - adds r0, r2, r0 - ldrh r1, [r4, 0x2C] - cmp r0, r1 - ble _080449D2 - subs r0, r1, r2 - str r0, [r5] -_080449D2: - ldr r0, [r5] - negs r0, r0 - str r0, [r5] - mov r0, r8 - adds r0, 0x48 - ldr r2, [sp, 0x18] - adds r0, r2, r0 - ldr r0, [r0] - movs r1, 0 - bl GetFlavourRelationByPersonality - lsls r0, 24 - cmp r0, 0 - bge _080449F0 - b _08044B7C -_080449F0: - b _08044B90 - .pool -_080449FC: - movs r0, 0x58 - adds r5, r7, 0 - muls r5, r0 - str r5, [sp, 0x1C] - add r5, r8 - ldrh r0, [r5, 0x2C] - ldrh r1, [r5, 0x28] - lsrs r0, 1 - cmp r1, r0 - bls _08044A14 - bl _080451D6 -_08044A14: - cmp r6, 0 - beq _08044A1C - bl _080451D6 -_08044A1C: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x8 - strb r0, [r1, 0x1] - movs r6, 0x1 - strb r6, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r4, =gBattleMoveDamage - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - str r0, [r4] - cmp r0, 0 - bne _08044A40 - str r6, [r4] -_08044A40: - ldrh r2, [r5, 0x28] - ldr r0, [r4] - adds r0, r2, r0 - ldrh r1, [r5, 0x2C] - cmp r0, r1 - ble _08044A50 - subs r0, r1, r2 - str r0, [r4] -_08044A50: - ldr r0, [r4] - negs r0, r0 - str r0, [r4] - mov r0, r8 - adds r0, 0x48 - ldr r1, [sp, 0x1C] - adds r0, r1, r0 - ldr r0, [r0] - movs r1, 0x1 - bl GetFlavourRelationByPersonality - lsls r0, 24 - cmp r0, 0 - bge _08044A6E - b _08044C0E -_08044A6E: - b _08044C24 - .pool -_08044A78: - movs r0, 0x58 - adds r3, r7, 0 - muls r3, r0 - str r3, [sp, 0x20] - adds r5, r3, 0 - add r5, r8 - ldrh r0, [r5, 0x2C] - ldrh r1, [r5, 0x28] - lsrs r0, 1 - cmp r1, r0 - bls _08044A90 - b _080451D6 -_08044A90: - cmp r6, 0 - beq _08044A96 - b _080451D6 -_08044A96: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x8 - strb r0, [r1, 0x1] - movs r0, 0x2 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r4, =gBattleMoveDamage - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - str r0, [r4] - cmp r0, 0 - bne _08044ABC - movs r0, 0x1 - str r0, [r4] -_08044ABC: - ldrh r2, [r5, 0x28] - ldr r0, [r4] - adds r0, r2, r0 - ldrh r1, [r5, 0x2C] - cmp r0, r1 - ble _08044ACC - subs r0, r1, r2 - str r0, [r4] -_08044ACC: - ldr r0, [r4] - negs r0, r0 - str r0, [r4] - mov r0, r8 - adds r0, 0x48 - ldr r5, [sp, 0x20] - adds r0, r5, r0 - ldr r0, [r0] - movs r1, 0x2 - bl GetFlavourRelationByPersonality - lsls r0, 24 - cmp r0, 0 - bge _08044AFC - ldr r0, =gUnknown_082DB824 - bl b_call_bc_move_exec - b _08044B02 - .pool -_08044AFC: - ldr r0, =gUnknown_082DB7C4 - bl b_call_bc_move_exec -_08044B02: - movs r0, 0x4 - str r0, [sp, 0xC] - b _080451DE - .pool -_08044B0C: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - str r1, [sp, 0x24] - adds r5, r1, 0 - add r5, r8 - ldrh r0, [r5, 0x2C] - ldrh r1, [r5, 0x28] - lsrs r0, 1 - cmp r1, r0 - bls _08044B24 - b _080451D6 -_08044B24: - cmp r6, 0 - beq _08044B2A - b _080451D6 -_08044B2A: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x8 - strb r0, [r1, 0x1] - movs r0, 0x3 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r4, =gBattleMoveDamage - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - str r0, [r4] - cmp r0, 0 - bne _08044B50 - movs r0, 0x1 - str r0, [r4] -_08044B50: - ldrh r2, [r5, 0x28] - ldr r0, [r4] - adds r0, r2, r0 - ldrh r1, [r5, 0x2C] - cmp r0, r1 - ble _08044B60 - subs r0, r1, r2 - str r0, [r4] -_08044B60: - ldr r0, [r4] - negs r0, r0 - str r0, [r4] - mov r0, r8 - adds r0, 0x48 - ldr r2, [sp, 0x24] - adds r0, r2, r0 - ldr r0, [r0] - movs r1, 0x3 - bl GetFlavourRelationByPersonality - lsls r0, 24 - cmp r0, 0 - bge _08044B90 -_08044B7C: - ldr r0, =gUnknown_082DB824 - bl b_call_bc_move_exec - b _08044B96 - .pool -_08044B90: - ldr r0, =gUnknown_082DB7C4 - bl b_call_bc_move_exec -_08044B96: - movs r3, 0x4 - str r3, [sp, 0xC] - b _080451DE - .pool -_08044BA0: - movs r0, 0x58 - adds r5, r7, 0 - muls r5, r0 - str r5, [sp, 0x28] - add r5, r8 - ldrh r0, [r5, 0x2C] - ldrh r1, [r5, 0x28] - lsrs r0, 1 - cmp r1, r0 - bls _08044BB6 - b _080451D6 -_08044BB6: - cmp r6, 0 - beq _08044BBC - b _080451D6 -_08044BBC: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x8 - strb r0, [r1, 0x1] - movs r0, 0x4 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r4, =gBattleMoveDamage - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - str r0, [r4] - cmp r0, 0 - bne _08044BE2 - movs r0, 0x1 - str r0, [r4] -_08044BE2: - ldrh r2, [r5, 0x28] - ldr r0, [r4] - adds r0, r2, r0 - ldrh r1, [r5, 0x2C] - cmp r0, r1 - ble _08044BF2 - subs r0, r1, r2 - str r0, [r4] -_08044BF2: - ldr r0, [r4] - negs r0, r0 - str r0, [r4] - mov r0, r8 - adds r0, 0x48 - ldr r1, [sp, 0x28] - adds r0, r1, r0 - ldr r0, [r0] - movs r1, 0x4 - bl GetFlavourRelationByPersonality - lsls r0, 24 - cmp r0, 0 - bge _08044C24 -_08044C0E: - ldr r0, =gUnknown_082DB824 - bl b_call_bc_move_exec - b _08044C2A - .pool -_08044C24: - ldr r0, =gUnknown_082DB7C4 - bl b_call_bc_move_exec -_08044C2A: - movs r2, 0x4 - str r2, [sp, 0xC] - b _080451DE - .pool -_08044C34: - movs r0, 0x58 - muls r0, r7 - mov r3, r8 - adds r5, r0, r3 - ldrh r4, [r5, 0x28] - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - cmp r4, r0 - ble _08044C4C - b _080451D6 -_08044C4C: - cmp r6, 0 - beq _08044C52 - b _080451D6 -_08044C52: - movs r0, 0x19 - ldrsb r0, [r5, r0] - cmp r0, 0xB - ble _08044C5C - b _080451D6 -_08044C5C: - ldr r1, =gBattleTextBuff1 - movs r2, 0xFD - strb r2, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - movs r0, 0x1 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r1, =gBattleTextBuff2 - strb r2, [r1] - strb r6, [r1, 0x1] - movs r0, 0xD2 - strb r0, [r1, 0x2] - strb r6, [r1, 0x3] - subs r0, 0xD3 - strb r0, [r1, 0x4] - ldr r0, =gUnknown_0202420E - strb r7, [r0] - ldr r1, =gBattleScripting - movs r0, 0x11 - strb r0, [r1, 0x1A] - movs r0, 0xF - b _08044DF0 - .pool -_08044C9C: - movs r0, 0x58 - muls r0, r7 - mov r1, r8 - adds r5, r0, r1 - ldrh r4, [r5, 0x28] - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - cmp r4, r0 - ble _08044CB4 - b _080451D6 -_08044CB4: - cmp r6, 0 - beq _08044CBA - b _080451D6 -_08044CBA: - movs r0, 0x1A - ldrsb r0, [r5, r0] - cmp r0, 0xB - ble _08044CC4 - b _080451D6 -_08044CC4: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - movs r0, 0x2 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r0, =gUnknown_0202420E - strb r7, [r0] - ldr r1, =gBattleScripting - movs r0, 0x12 - strb r0, [r1, 0x1A] - movs r0, 0x10 - b _08044D8A - .pool -_08044CF0: - movs r0, 0x58 - muls r0, r7 - mov r3, r8 - adds r5, r0, r3 - ldrh r4, [r5, 0x28] - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - cmp r4, r0 - ble _08044D08 - b _080451D6 -_08044D08: - cmp r6, 0 - beq _08044D0E - b _080451D6 -_08044D0E: - movs r0, 0x1B - ldrsb r0, [r5, r0] - cmp r0, 0xB - ble _08044D18 - b _080451D6 -_08044D18: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - movs r0, 0x3 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r0, =gUnknown_0202420E - strb r7, [r0] - ldr r1, =gBattleScripting - movs r0, 0x13 - strb r0, [r1, 0x1A] - movs r0, 0x11 - b _08044DF0 - .pool -_08044D44: - movs r0, 0x58 - muls r0, r7 - mov r1, r8 - adds r5, r0, r1 - ldrh r4, [r5, 0x28] - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - cmp r4, r0 - ble _08044D5C - b _080451D6 -_08044D5C: - cmp r6, 0 - beq _08044D62 - b _080451D6 -_08044D62: - movs r0, 0x1C - ldrsb r0, [r5, r0] - cmp r0, 0xB - ble _08044D6C - b _080451D6 -_08044D6C: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - movs r0, 0x4 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r0, =gUnknown_0202420E - strb r7, [r0] - ldr r1, =gBattleScripting - movs r0, 0x14 - strb r0, [r1, 0x1A] - movs r0, 0x12 -_08044D8A: - strb r0, [r1, 0x10] - strb r6, [r1, 0x11] - ldr r0, =gUnknown_082DB84E - bl b_call_bc_move_exec - movs r2, 0x5 - str r2, [sp, 0xC] - b _080451DE - .pool -_08044DAC: - movs r0, 0x58 - muls r0, r7 - mov r3, r8 - adds r5, r0, r3 - ldrh r4, [r5, 0x28] - ldrh r0, [r5, 0x2C] - mov r1, r9 - bl __divsi3 - cmp r4, r0 - ble _08044DC4 - b _080451D6 -_08044DC4: - cmp r6, 0 - beq _08044DCA - b _080451D6 -_08044DCA: - movs r0, 0x1D - ldrsb r0, [r5, r0] - cmp r0, 0xB - ble _08044DD4 - b _080451D6 -_08044DD4: - ldr r1, =gBattleTextBuff1 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r0, =gUnknown_0202420E - strb r7, [r0] - ldr r1, =gBattleScripting - movs r0, 0x15 - strb r0, [r1, 0x1A] - movs r0, 0x13 -_08044DF0: - strb r0, [r1, 0x10] - strb r6, [r1, 0x11] - ldr r0, =gUnknown_082DB84E - bl b_call_bc_move_exec - movs r5, 0x5 - str r5, [sp, 0xC] - b _080451DE - .pool -_08044E10: - movs r0, 0x58 - adds r5, r7, 0 - muls r5, r0 - mov r1, r8 - adds r0, r5, r1 - ldrh r4, [r0, 0x28] - ldrh r0, [r0, 0x2C] - mov r1, r9 - bl __divsi3 - cmp r4, r0 - ble _08044E2A - b _080451D6 -_08044E2A: - cmp r6, 0 - beq _08044E30 - b _080451D6 -_08044E30: - mov r0, r8 - adds r0, 0x50 - adds r1, r5, r0 - ldr r2, [r1] - movs r3, 0x80 - lsls r3, 13 - adds r0, r2, 0 - ands r0, r3 - cmp r0, 0 - beq _08044E46 - b _080451D6 -_08044E46: - orrs r2, r3 - str r2, [r1] - ldr r0, =gUnknown_082DB869 - bl b_call_bc_move_exec - movs r2, 0x2 - str r2, [sp, 0xC] - b _080451DE - .pool -_08044E5C: - cmp r6, 0 - beq _08044E62 - b _080451D6 -_08044E62: - movs r0, 0x58 - adds r5, r7, 0 - muls r5, r0 - mov r3, r8 - adds r0, r5, r3 - ldrh r4, [r0, 0x28] - ldrh r0, [r0, 0x2C] - mov r1, r9 - bl __divsi3 - cmp r4, r0 - ble _08044E7C - b _080451D6 -_08044E7C: - movs r0, 0 - mov r10, r0 - adds r0, r5, 0x1 - mov r1, r8 - adds r1, 0x18 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xB - ble _08044EAC - mov r0, r8 - adds r0, 0x19 - adds r1, r5, r0 -_08044E98: - adds r1, 0x1 - movs r2, 0x1 - add r10, r2 - mov r3, r10 - cmp r3, 0x4 - bgt _08044EAC - movs r0, 0 - ldrsb r0, [r1, r0] - cmp r0, 0xB - bgt _08044E98 -_08044EAC: - mov r5, r10 - cmp r5, 0x5 - bne _08044EB4 - b _080451D6 -_08044EB4: - movs r0, 0x58 - muls r0, r7 - adds r4, r0, 0x1 - ldr r5, =gBattleMons + 0x18 -_08044EBC: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x5 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - adds r0, r4 - adds r0, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xC - beq _08044EBC - ldr r1, =gBattleTextBuff1 - movs r2, 0 - movs r3, 0xFD - strb r3, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - mov r0, r10 - adds r0, 0x1 - strb r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x3] - ldr r0, =gBattleTextBuff2 - strb r3, [r0] - strb r2, [r0, 0x1] - movs r1, 0xD1 - strb r1, [r0, 0x2] - strb r2, [r0, 0x3] - strb r2, [r0, 0x4] - movs r1, 0xD2 - strb r1, [r0, 0x5] - strb r2, [r0, 0x6] - subs r1, 0xD3 - strb r1, [r0, 0x7] - ldr r0, =gUnknown_0202420E - strb r7, [r0] - ldr r1, =gBattleScripting - mov r0, r10 - adds r0, 0x21 - strb r0, [r1, 0x1A] - adds r0, 0x6 - strb r0, [r1, 0x10] - strb r2, [r1, 0x11] - ldr r0, =gUnknown_082DB84E - bl b_call_bc_move_exec - movs r0, 0x5 - str r0, [sp, 0xC] - b _080451DE - .pool -_08044F44: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x4C - adds r1, r0 - ldr r2, [r1] - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - bne _08044F5C - b _080451D6 -_08044F5C: - movs r0, 0x41 - negs r0, r0 - ands r2, r0 - str r2, [r1] - ldr r0, =gUnknown_082DB706 - bl b_call_bc_move_exec - movs r1, 0x1 - str r1, [sp, 0xC] - b _080451DE - .pool -_08044F74: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x4C - adds r1, r0 - ldr r2, [r1] - movs r0, 0x88 - ands r0, r2 - cmp r0, 0 - bne _08044F8C - b _080451D6 -_08044F8C: - ldr r0, =0xfffff077 - ands r2, r0 - str r2, [r1] - ldr r0, =gUnknown_082DB71E - bl b_call_bc_move_exec - movs r2, 0x1 - str r2, [sp, 0xC] - b _080451DE - .pool -_08044FA8: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x4C - adds r1, r0 - ldr r2, [r1] - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - bne _08044FC0 - b _080451D6 -_08044FC0: - movs r0, 0x11 - negs r0, r0 - ands r2, r0 - str r2, [r1] - ldr r0, =gUnknown_082DB736 - bl b_call_bc_move_exec - movs r3, 0x1 - str r3, [sp, 0xC] - b _080451DE - .pool -_08044FD8: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x4C - adds r1, r0 - ldr r2, [r1] - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - bne _08044FF0 - b _080451D6 -_08044FF0: - movs r0, 0x21 - negs r0, r0 - ands r2, r0 - str r2, [r1] - ldr r0, =gUnknown_082DB74E - bl b_call_bc_move_exec - movs r5, 0x1 - str r5, [sp, 0xC] - b _080451DE - .pool -_08045008: - movs r0, 0x58 - adds r3, r7, 0 - muls r3, r0 - mov r0, r8 - adds r0, 0x4C - adds r2, r3, r0 - ldr r1, [r2] - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - bne _08045020 - b _080451D6 -_08045020: - movs r0, 0x8 - negs r0, r0 - ands r1, r0 - str r1, [r2] - mov r1, r8 - adds r1, 0x50 - adds r1, r3, r1 - ldr r0, [r1] - ldr r2, =0xf7ffffff - ands r0, r2 - str r0, [r1] - ldr r0, =gUnknown_082DB766 - b _0804518A - .pool -_08045044: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x50 - adds r1, r0 - ldr r2, [r1] - movs r0, 0x7 - ands r0, r2 - cmp r0, 0 - bne _0804505C - b _080451D6 -_0804505C: - movs r0, 0x8 - negs r0, r0 - ands r2, r0 - str r2, [r1] - ldr r0, =gUnknown_082DB77E - bl b_call_bc_move_exec - movs r1, 0x2 - str r1, [sp, 0xC] - b _080451DE - .pool -_08045074: - movs r0, 0x58 - adds r5, r7, 0 - muls r5, r0 - mov r0, r8 - adds r0, 0x4C - adds r4, r5, r0 - ldr r2, [r4] - ldrb r0, [r4] - cmp r0, 0 - bne _0804509A - mov r0, r8 - adds r0, 0x50 - adds r0, r5, r0 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - bne _0804509A - b _080451D6 -_0804509A: - movs r3, 0 - mov r10, r3 - movs r0, 0x88 - ands r2, r0 - cmp r2, 0 - beq _080450B2 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC70 - bl StringCopy - movs r0, 0x1 - mov r10, r0 -_080450B2: - ldr r0, [r4] - movs r1, 0x7 - mov r9, r1 - ands r0, r1 - mov r6, r8 - adds r6, 0x50 - cmp r0, 0 - beq _080450D8 - adds r2, r5, r6 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC78 - bl StringCopy - movs r2, 0x1 - add r10, r2 -_080450D8: - ldr r0, [r4] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080450EE - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC80 - bl StringCopy - movs r3, 0x1 - add r10, r3 -_080450EE: - ldr r0, [r4] - movs r1, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08045104 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC88 - bl StringCopy - movs r0, 0x1 - add r10, r0 -_08045104: - ldr r0, [r4] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0804511A - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC90 - bl StringCopy - movs r1, 0x1 - add r10, r1 -_0804511A: - adds r0, r5, r6 - ldr r0, [r0] - mov r2, r9 - ands r0, r2 - cmp r0, 0 - beq _08045132 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC98 - bl StringCopy - movs r3, 0x1 - add r10, r3 -_08045132: - mov r5, r10 - cmp r5, 0x1 - bgt _08045164 - ldr r1, =gBattleCommunication - movs r0, 0 - b _08045168 - .pool -_08045164: - ldr r1, =gBattleCommunication - movs r0, 0x1 -_08045168: - strb r0, [r1, 0x5] - ldr r2, =gBattleMons - movs r0, 0x58 - adds r3, r7, 0 - muls r3, r0 - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r3, r0 - movs r1, 0 - str r1, [r0] - adds r2, 0x50 - adds r3, r2 - ldr r0, [r3] - subs r1, 0x8 - ands r0, r1 - str r0, [r3] - ldr r0, =gUnknown_082DB794 -_0804518A: - bl b_call_bc_move_exec - movs r0, 0x1 - str r0, [sp, 0xC] - b _080451DE - .pool -_080451A0: - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x50 - adds r1, r0 - ldr r2, [r1] - movs r0, 0xF0 - lsls r0, 12 - ands r0, r2 - cmp r0, 0 - beq _080451D6 - ldr r0, =0xfff0ffff - ands r2, r0 - str r2, [r1] - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BCA0 - bl StringCopy - ldr r0, =gUnknown_082DB794 - bl b_call_bc_move_exec - ldr r1, =gBattleCommunication - movs r0, 0 - strb r0, [r1, 0x5] - movs r1, 0x2 - str r1, [sp, 0xC] -_080451D6: - ldr r2, [sp, 0xC] - cmp r2, 0 - bne _080451DE - b _0804582A -_080451DE: - ldr r0, =gBattleScripting - strb r7, [r0, 0x17] - ldr r0, =gStringBank - strb r7, [r0] - ldr r4, =gActiveBank - ldr r0, =gBankAttacker - strb r7, [r0] - strb r7, [r4] - ldr r3, [sp, 0xC] - cmp r3, 0x1 - beq _08045220 - cmp r3, 0x3 - beq _08045226 - b _0804582A - .pool -_08045220: - movs r0, 0x58 - muls r0, r7 - b _0804568C -_08045226: - ldr r4, =gBattleMons - movs r0, 0x58 - adds r3, r7, 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 - beq _08045242 - b _0804582A -_08045242: - ldr r1, =gDisableStructs - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x18] - lsrs r1, 4 - ldr r2, =gBitTable - mov r5, r10 - lsls r0, r5, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08045262 - b _0804582A -_08045262: - adds r1, r5, r3 - adds r0, r4, 0 - adds r0, 0x24 - adds r1, r0 - add r0, sp, 0x4 - ldrb r0, [r0] - strb r0, [r1] - b _0804582A - .pool -_08045280: - movs r7, 0 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r7, r0 - bcc _0804528C - b _0804582A -_0804528C: - ldr r4, =gLastUsedItem - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r0, r1 - ldrh r0, [r0, 0x2E] - strh r0, [r4] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAF - bne _080452C0 - ldr r1, =gEnigmaBerries - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r5, [r0, 0x7] - b _080452D0 - .pool -_080452C0: - ldrh r0, [r4] - bl ItemId_GetHoldEffect - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4] - bl ItemId_GetHoldEffectParam -_080452D0: - subs r0, r5, 0x2 - cmp r0, 0x1A - bls _080452D8 - b _08045674 -_080452D8: - lsls r0, 2 - ldr r1, =_080452E8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080452E8: - .4byte _08045354 - .4byte _08045444 - .4byte _08045390 - .4byte _080453CC - .4byte _08045408 - .4byte _08045674 - .4byte _0804548C - .4byte _08045520 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045614 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _08045674 - .4byte _080454C8 -_08045354: - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r1, 0x4C - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _0804536A - b _08045674 -_0804536A: - movs r0, 0x41 - negs r0, r0 - ands r1, r0 - str r1, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB70C - str r0, [r1] - movs r0, 0x1 - str r0, [sp, 0xC] - b _0804567A - .pool -_08045390: - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r1, 0x4C - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - bne _080453A6 - b _08045674 -_080453A6: - ldr r0, =0xfffff077 - ands r1, r0 - str r1, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB724 - str r0, [r1] - movs r1, 0x1 - str r1, [sp, 0xC] - b _0804567A - .pool -_080453CC: - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r1, 0x4C - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _080453E2 - b _08045674 -_080453E2: - movs r0, 0x11 - negs r0, r0 - ands r1, r0 - str r1, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB73C - str r0, [r1] - movs r2, 0x1 - str r2, [sp, 0xC] - b _0804567A - .pool -_08045408: - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r1, 0x4C - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0804541E - b _08045674 -_0804541E: - movs r0, 0x21 - negs r0, r0 - ands r1, r0 - str r1, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB754 - str r0, [r1] - movs r3, 0x1 - str r3, [sp, 0xC] - b _0804567A - .pool -_08045444: - ldr r2, =gBattleMons - movs r0, 0x58 - adds r4, r7, 0 - muls r4, r0 - adds r0, r2, 0 - adds r0, 0x4C - adds r3, r4, r0 - ldr r1, [r3] - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - bne _0804545E - b _08045674 -_0804545E: - movs r0, 0x8 - negs r0, r0 - ands r1, r0 - str r1, [r3] - adds r2, 0x50 - adds r2, r4, r2 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB76C - b _080455DC - .pool -_0804548C: - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r1, 0x50 - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - bne _080454A2 - b _08045674 -_080454A2: - movs r0, 0x8 - negs r0, r0 - ands r1, r0 - str r1, [r2] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB784 - str r0, [r1] - movs r0, 0x2 - str r0, [sp, 0xC] - b _0804567A - .pool -_080454C8: - ldr r1, =gBattleMons - movs r0, 0x58 - muls r0, r7 - adds r1, 0x50 - adds r2, r0, r1 - ldr r1, [r2] - movs r0, 0xF0 - lsls r0, 12 - ands r0, r1 - cmp r0, 0 - bne _080454E0 - b _08045674 -_080454E0: - ldr r0, =0xfff0ffff - ands r1, r0 - str r1, [r2] - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BCA0 - bl StringCopy - bl b_movescr_stack_push_cursor - ldr r1, =gBattleCommunication - movs r0, 0 - strb r0, [r1, 0x5] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB79A - str r0, [r1] - movs r1, 0x2 - str r1, [sp, 0xC] - b _0804567A - .pool -_08045520: - ldr r4, =gBattleMons - movs r0, 0x58 - adds r5, r7, 0 - muls r5, r0 - adds r0, r4, 0 - adds r0, 0x4C - adds r6, r5, r0 - ldr r2, [r6] - ldrb r0, [r6] - cmp r0, 0 - bne _08045548 - adds r0, r4, 0 - adds r0, 0x50 - adds r0, r5, r0 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - bne _08045548 - b _08045674 -_08045548: - movs r0, 0x88 - ands r2, r0 - cmp r2, 0 - beq _08045558 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC70 - bl StringCopy -_08045558: - ldr r0, [r6] - movs r2, 0x7 - mov r8, r2 - ands r0, r2 - adds r4, 0x50 - cmp r0, 0 - beq _08045578 - adds r2, r5, r4 - ldr r0, [r2] - ldr r1, =0xf7ffffff - ands r0, r1 - str r0, [r2] - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC78 - bl StringCopy -_08045578: - ldr r0, [r6] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0804558A - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC80 - bl StringCopy -_0804558A: - ldr r0, [r6] - movs r1, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0804559C - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC88 - bl StringCopy -_0804559C: - ldr r0, [r6] - movs r1, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080455AE - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC90 - bl StringCopy -_080455AE: - adds r5, r4 - ldr r0, [r5] - mov r3, r8 - ands r0, r3 - cmp r0, 0 - beq _080455C2 - ldr r0, =gBattleTextBuff1 - ldr r1, =gUnknown_0831BC98 - bl StringCopy -_080455C2: - movs r4, 0 - str r4, [r6] - ldr r0, [r5] - movs r1, 0x8 - negs r1, r1 - ands r0, r1 - str r0, [r5] - bl b_movescr_stack_push_cursor - ldr r0, =gBattleCommunication - strb r4, [r0, 0x5] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB79A -_080455DC: - str r0, [r1] - movs r5, 0x1 - str r5, [sp, 0xC] - b _0804567A - .pool -_08045614: - ldr r0, =gBattleMons - mov r8, r0 - movs r0, 0x58 - adds r1, r7, 0 - muls r1, r0 - mov r0, r8 - adds r0, 0x18 - adds r1, r0 - movs r2, 0x6 - movs r3, 0x7 - mov r10, r3 -_0804562A: - movs r0, 0 - ldrsb r0, [r1, r0] - cmp r0, 0x5 - bgt _08045638 - strb r2, [r1] - movs r5, 0x5 - str r5, [sp, 0xC] -_08045638: - adds r1, 0x1 - movs r0, 0x1 - negs r0, r0 - add r10, r0 - mov r3, r10 - cmp r3, 0 - bge _0804562A - ldr r5, [sp, 0xC] - cmp r5, 0 - beq _080456B8 - ldr r0, =gBattleScripting - strb r7, [r0, 0x17] - ldr r0, =gStringBank - strb r7, [r0] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB7B4 - str r0, [r1] - b _0804582A - .pool -_08045674: - ldr r0, [sp, 0xC] - cmp r0, 0 - beq _080456B8 -_0804567A: - ldr r0, =gBattleScripting - strb r7, [r0, 0x17] - ldr r0, =gStringBank - strb r7, [r0] - ldr r4, =gActiveBank - strb r7, [r4] - ldrb r1, [r4] - movs r0, 0x58 - muls r0, r1 -_0804568C: - ldr r1, =gBattleMons + 0x4C - adds r0, r1 - str r0, [sp] - movs r0, 0 - movs r1, 0x28 - movs r2, 0 - movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs - ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution - b _0804582A - .pool -_080456B8: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gNoOfAllBanks - ldrb r0, [r0] - cmp r7, r0 - bcs _080456C8 - b _0804528C -_080456C8: - b _0804582A - .pool -_080456D0: - ldr r7, =gBattleMoveDamage - ldr r0, [r7] - cmp r0, 0 - bne _080456DA - b _0804582A -_080456DA: - mov r1, r8 - cmp r1, 0x1E - beq _080456EC - cmp r1, 0x3E - beq _08045794 - b _0804582A - .pool -_080456EC: - ldr r0, =gBattleMoveFlags - ldrb r1, [r0] - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - beq _080456FA - b _0804582A -_080456FA: - ldr r2, =gSpecialStatuses - ldr r4, =gBankTarget - ldrb r1, [r4] - lsls r0, r1, 2 - adds r0, r1 - lsls r1, r0, 2 - adds r0, r2, 0 - adds r0, 0x8 - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08045720 - adds r0, r2, 0 - adds r0, 0xC - adds r0, r1, r0 - ldr r0, [r0] - cmp r0, 0 - bne _08045720 - b _0804582A -_08045720: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x64 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - ldr r2, [sp, 0x10] - cmp r0, r2 - bcs _0804582A - ldr r2, =gBattleMoves - ldr r0, =gCurrentMove - ldrh r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x8] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0804582A - ldr r2, =gBattleMons - ldrb r1, [r4] - movs r0, 0x58 - muls r0, r1 - adds r0, r2 - ldrh r0, [r0, 0x28] - cmp r0, 0 - beq _0804582A - ldr r1, =gBattleCommunication - movs r0, 0x8 - strb r0, [r1, 0x3] - bl b_movescr_stack_push_cursor - movs r0, 0 - movs r1, 0 - bl sub_8048760 - bl b_movescr_stack_pop_cursor - b _0804582A - .pool -_08045794: - ldr r0, =gBattleMoveFlags - ldrb r0, [r0] - movs r5, 0x29 - ands r5, r0 - cmp r5, 0 - bne _0804582A - ldr r1, =gSpecialStatuses - ldr r4, =gBankTarget - ldrb r2, [r4] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 2 - adds r6, r1, 0x4 - adds r0, r6 - ldr r1, [r0] - cmp r1, 0 - beq _0804582A - ldr r0, =0x0000ffff - cmp r1, r0 - beq _0804582A - ldr r0, =gBankAttacker - ldrb r3, [r0] - cmp r3, r2 - beq _0804582A - ldr r2, =gBattleMons - ldrb r1, [r0] - movs r0, 0x58 - muls r0, r1 - adds r0, r2 - ldrh r1, [r0, 0x28] - ldrh r0, [r0, 0x2C] - cmp r1, r0 - beq _0804582A - cmp r1, 0 - beq _0804582A - ldr r0, =gLastUsedItem - mov r1, sp - ldrh r1, [r1, 0x14] - strh r1, [r0] - ldr r0, =gStringBank - strb r3, [r0] - ldr r0, =gBattleScripting - strb r3, [r0, 0x17] - ldrb r1, [r4] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldr r0, [r0] - ldr r1, [sp, 0x10] - bl __divsi3 - negs r0, r0 - str r0, [r7] - ldrb r1, [r4] - cmp r0, 0 - bne _0804580C - movs r0, 0x1 - negs r0, r0 - str r0, [r7] -_0804580C: - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - str r5, [r0] - bl b_movescr_stack_push_cursor - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB7F7 - str r0, [r1] - ldr r0, [sp, 0xC] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] -_0804582A: - ldr r0, [sp, 0xC] - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end berry_effects_maybe - - thumb_func_start sub_8045868 -sub_8045868: @ 8045868 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gDisableStructs - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - movs r2, 0 - strb r2, [r1, 0x10] - ldr r1, =gBattleMons - movs r2, 0x58 - adds r3, r0, 0 - muls r3, r2 - adds r1, 0x50 - adds r3, r1 - ldr r1, [r3] - ldr r2, =0xfdffffff - ands r1, r2 - str r1, [r3] - ldr r1, =gStatuses3 - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - ldr r2, =0xffffbfff - ands r1, r2 - str r1, [r0] - bx lr - .pool - thumb_func_end sub_8045868 - - thumb_func_start sub_80458B4 -sub_80458B4: @ 80458B4 - push {lr} - ldr r0, =gBattleExecBuffer - ldr r0, [r0] - cmp r0, 0 - bne _080458D0 - ldr r1, =gBattleScriptingCommandsTable - ldr r0, =gBattlescriptCurrInstr - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 -_080458D0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80458B4 - - thumb_func_start GetMoveTarget -GetMoveTarget: @ 80458E0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r7, r0, 16 - lsls r1, 24 - lsrs r0, r1, 24 - movs r5, 0 - cmp r0, 0 - beq _080458FE - subs r0, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - b _0804590A -_080458FE: - ldr r1, =gBattleMoves - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r6, [r0, 0x6] -_0804590A: - cmp r6, 0x40 - bls _08045910 - b _08045C20 -_08045910: - lsls r0, r6, 2 - ldr r1, =_08045924 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08045924: - .4byte _08045A28 - .4byte _08045B28 - .4byte _08045C1C - .4byte _08045C20 - .4byte _08045B40 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045B28 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C1C - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045B28 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045C20 - .4byte _08045B28 -_08045A28: - ldr r0, =gBankAttacker - ldrb r0, [r0] - bl GetBankSide - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gSideTimers - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r2, r0, r1 - ldrb r0, [r2, 0x8] - cmp r0, 0 - beq _08045A5A - ldr r1, =gBattleMons - ldrb r4, [r2, 0x9] - movs r0, 0x58 - muls r0, r4 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - beq _08045A5A - b _08045B70 -_08045A5A: - ldr r0, =gBankAttacker - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r7, 1 - mov r8, r0 -_08045A6A: - bl Random - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gNoOfAllBanks - ldrb r1, [r1] - bl __modsi3 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gBankAttacker - ldrb r3, [r6] - cmp r5, r3 - beq _08045A6A - adds r0, r5, 0 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - beq _08045A6A - ldr r0, =gAbsentBankFlags - ldrb r2, [r0] - ldr r1, =gBitTable - lsls r0, r5, 2 - adds r0, r1 - ldr r0, [r0] - ands r2, r0 - cmp r2, 0 - bne _08045A6A - ldr r0, =gBattleMoves - mov r3, r8 - adds r1, r3, r7 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x2] - cmp r0, 0xD - beq _08045AB8 - b _08045C20 -_08045AB8: - ldrb r1, [r6] - str r2, [sp] - movs r0, 0x10 - movs r2, 0x1F - movs r3, 0 - bl AbilityBattleEffects - lsls r0, 24 - cmp r0, 0 - bne _08045ACE - b _08045C20 -_08045ACE: - ldr r2, =gBattleMons - movs r1, 0x58 - adds r0, r5, 0 - muls r0, r1 - adds r0, r2 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0x1F - bne _08045AE2 - b _08045C20 -_08045AE2: - movs r4, 0x2 - eors r5, r4 - adds r0, r5, 0 - muls r0, r1 - adds r0, r2 - adds r0, 0x20 - ldrb r1, [r0] - adds r0, r5, 0 - bl RecordAbilityBattle - ldr r1, =gSpecialStatuses - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0] - orrs r1, r4 - strb r1, [r0] - b _08045C20 - .pool -_08045B28: - ldr r0, =gBankAttacker - ldrb r0, [r0] - bl GetBankIdentity - adds r1, r0, 0 - movs r2, 0x1 - movs r0, 0x1 - ands r0, r1 - eors r0, r2 - b _08045BD2 - .pool -_08045B40: - ldr r0, =gBankAttacker - ldrb r0, [r0] - bl GetBankSide - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gSideTimers - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r2, r0, r1 - ldrb r0, [r2, 0x8] - cmp r0, 0 - beq _08045B80 - ldr r1, =gBattleMons - ldrb r4, [r2, 0x9] - movs r0, 0x58 - muls r0, r4 - adds r0, r1 - ldrh r0, [r0, 0x28] - cmp r0, 0 - beq _08045B80 -_08045B70: - adds r5, r4, 0 - b _08045C20 - .pool -_08045B80: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r4, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08045BFC - movs r0, 0x4 - ands r6, r0 - cmp r6, 0 - beq _08045BFC - ldr r0, =gBankAttacker - ldrb r0, [r0] - bl GetBankSide - lsls r0, 24 - cmp r0, 0 - bne _08045BC0 - bl Random - adds r1, r4, 0 - ands r1, r0 - cmp r1, 0 - beq _08045BBC - movs r0, 0x1 - b _08045BD2 - .pool -_08045BBC: - movs r0, 0x3 - b _08045BD2 -_08045BC0: - bl Random - adds r1, r4, 0 - ands r1, r0 - cmp r1, 0 - beq _08045BD0 - movs r0, 0 - b _08045BD2 -_08045BD0: - movs r0, 0x2 -_08045BD2: - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gAbsentBankFlags - ldrb r1, [r0] - ldr r2, =gBitTable - lsls r0, r5, 2 - adds r0, r2 - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08045C20 - movs r0, 0x2 - eors r5, r0 - b _08045C20 - .pool -_08045BFC: - ldr r0, =gBankAttacker - ldrb r0, [r0] - bl GetBankIdentity - adds r1, r0, 0 - movs r2, 0x1 - movs r0, 0x1 - ands r0, r1 - eors r0, r2 - bl GetBankByPlayerAI - lsls r0, 24 - lsrs r5, r0, 24 - b _08045C20 - .pool -_08045C1C: - ldr r0, =gBankAttacker - ldrb r5, [r0] -_08045C20: - ldr r0, =gBankAttacker - ldrb r0, [r0] - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r0, r1 - strb r5, [r0, 0xC] - adds r0, r5, 0 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end GetMoveTarget - - thumb_func_start sub_8045C44 -sub_8045C44: @ 8045C44 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08045C8A - ldr r0, =gBattlePartyID - lsls r4, 1 - adds r5, r4, r0 - ldrh r0, [r5] - movs r7, 0x64 - muls r0, r7 - ldr r6, =gPlayerParty - adds r0, r6 - movs r1, 0xB - movs r2, 0 - bl GetMonData - movs r1, 0xCD - lsls r1, 1 - cmp r0, r1 - beq _08045C98 - ldrh r0, [r5] - muls r0, r7 - adds r0, r6 - movs r1, 0xB - movs r2, 0 - bl GetMonData - cmp r0, 0x97 - beq _08045C98 -_08045C8A: - movs r0, 0x1 - b _08045CAE - .pool -_08045C98: - ldr r0, =gBattlePartyID - adds r0, r4, r0 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x50 - movs r2, 0 - bl GetMonData -_08045CAE: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8045C44 - - thumb_func_start sub_8045CBC -sub_8045CBC: @ 8045CBC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - movs r6, 0 - ldr r5, =gBattleTypeFlags - ldr r0, [r5] - ldr r1, =0x02000002 - ands r0, r1 - cmp r0, 0 - bne _08045DAC - ldr r4, =gBankAttacker - ldrb r0, [r4] - bl GetBankSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08045DAC - ldrb r0, [r4] - bl sub_8045C44 - cmp r0, 0 - beq _08045D76 - ldr r0, [r5] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _08045D08 - ldrb r0, [r4] - bl GetBankIdentity - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _08045DAC -_08045D08: - ldr r0, =gBattleTypeFlags - ldr r1, [r0] - ldr r0, =0x003f0100 - ands r0, r1 - cmp r0, 0 - bne _08045DAC - movs r0, 0x80 - lsls r0, 17 - ands r1, r0 - cmp r1, 0 - bne _08045DAC - ldr r2, =gBattleMons - ldr r0, =gBankAttacker - ldrb r1, [r0] - movs r0, 0x58 - muls r1, r0 - adds r0, r2, 0 - adds r0, 0x54 - adds r0, r1, r0 - ldr r0, [r0] - adds r2, 0x3C - adds r1, r2 - bl IsOtherTrainer - lsls r0, 24 - cmp r0, 0 - beq _08045DAC - ldr r0, =0x0000086e - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _08045DAC - movs r6, 0xA - ldr r0, =0x00000868 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08045D5A - movs r6, 0x1E -_08045D5A: - ldr r0, =0x0000086a - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08045D68 - movs r6, 0x32 -_08045D68: - ldr r0, =0x0000086c - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08045D76 - movs r6, 0x46 -_08045D76: - ldr r5, =gBattleMons - ldr r0, =gBankAttacker - mov r8, r0 - ldrb r0, [r0] - movs r7, 0x58 - muls r0, r7 - adds r0, r5 - adds r0, 0x2A - ldrb r0, [r0] - cmp r0, r6 - bls _08045DAC - bl Random - movs r1, 0xFF - ands r1, r0 - mov r2, r8 - ldrb r0, [r2] - adds r2, r0, 0 - muls r2, r7 - adds r0, r2, r5 - adds r0, 0x2A - ldrb r0, [r0] - adds r0, r6 - muls r0, r1 - asrs r4, r0, 8 - cmp r4, r6 - bge _08045DD4 -_08045DAC: - movs r0, 0 - b _08045FD0 - .pool -_08045DD4: - ldr r3, =gCurrentMove - ldrh r0, [r3] - cmp r0, 0x63 - bne _08045DEA - adds r0, r5, 0 - adds r0, 0x50 - adds r0, r2, r0 - ldr r1, [r0] - ldr r2, =0xff7fffff - ands r1, r2 - str r1, [r0] -_08045DEA: - mov r1, r8 - ldrb r0, [r1] - muls r0, r7 - adds r1, r5, 0 - adds r1, 0x4C - adds r0, r1 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - beq _08045E20 - ldrh r0, [r3] - cmp r0, 0xAD - beq _08045E0A - cmp r0, 0xD6 - bne _08045E20 -_08045E0A: - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB695 - b _08045F7A - .pool -_08045E20: - bl Random - movs r5, 0xFF - adds r1, r5, 0 - ands r1, r0 - ldr r7, =gBattleMons - ldr r2, =gBankAttacker - mov r9, r2 - ldrb r3, [r2] - movs r0, 0x58 - mov r8, r0 - mov r0, r8 - muls r0, r3 - adds r0, r7 - adds r0, 0x2A - ldrb r2, [r0] - adds r0, r2, r6 - muls r0, r1 - asrs r4, r0, 8 - cmp r4, r6 - bge _08045EE8 - ldr r6, =gBitTable - ldr r5, =gCurrMovePos - ldrb r0, [r5] - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0] - adds r0, r3, 0 - movs r2, 0xFF - bl CheckMoveLimitations - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bne _08045E68 - b _08045F6A -_08045E68: - ldr r1, =gUnknown_020241E9 - mov r8, r1 - movs r7, 0x3 -_08045E6E: - bl Random - ands r0, r7 - mov r2, r8 - strb r0, [r2] - strb r0, [r5] - ldrb r0, [r5] - lsls r0, 2 - adds r0, r6 - ldr r0, [r0] - ands r0, r4 - cmp r0, 0 - bne _08045E6E - ldr r4, =gRandomMove - ldr r3, =gBattleMons - ldr r0, =gCurrMovePos - ldrb r0, [r0] - lsls r0, 1 - ldr r1, =gBankAttacker - ldrb r2, [r1] - movs r1, 0x58 - muls r1, r2 - adds r0, r1 - adds r3, 0xC - adds r0, r3 - ldrh r0, [r0] - strh r0, [r4] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB6A5 - str r0, [r1] - ldrh r0, [r4] - movs r1, 0 - bl GetMoveTarget - ldr r1, =gBankTarget - strb r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 14 - b _08045FCA - .pool -_08045EE8: - subs r0, r2, r6 - lsls r0, 24 - lsrs r6, r0, 24 - bl Random - adds r4, r5, 0 - ands r4, r0 - cmp r4, r6 - bge _08045F64 - mov r1, r9 - ldrb r0, [r1] - mov r1, r8 - muls r1, r0 - adds r0, r7, 0 - adds r0, 0x4C - adds r0, r1, r0 - ldr r0, [r0] - ands r0, r5 - cmp r0, 0 - bne _08045F64 - adds r0, r1, r7 - adds r0, 0x20 - ldrb r0, [r0] - cmp r0, 0x48 - beq _08045F64 - cmp r0, 0xF - beq _08045F64 - movs r2, 0 - ldr r0, =gNoOfAllBanks - ldrb r3, [r0] - mov r8, r0 - cmp r2, r3 - bge _08045F4A - ldr r0, [r7, 0x50] - movs r1, 0x70 - ands r0, r1 - cmp r0, 0 - bne _08045F4A - adds r1, r7, 0 - adds r1, 0x50 - movs r5, 0x70 -_08045F3A: - adds r1, 0x58 - adds r2, 0x1 - cmp r2, r3 - bge _08045F4A - ldr r0, [r1] - ands r0, r5 - cmp r0, 0 - beq _08045F3A -_08045F4A: - mov r0, r8 - ldrb r0, [r0] - cmp r2, r0 - bne _08045F64 - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB6D9 - b _08045F7A - .pool -_08045F64: - subs r4, r6 - cmp r4, r6 - blt _08045F8C -_08045F6A: - bl Random - ldr r2, =gBattleCommunication - movs r1, 0x3 - ands r1, r0 - strb r1, [r2, 0x5] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB6AD -_08045F7A: - str r0, [r1] - movs r0, 0x1 - b _08045FD0 - .pool -_08045F8C: - ldr r4, =gBankAttacker - ldrb r1, [r4] - movs r0, 0x58 - muls r1, r0 - ldr r0, =gBattleMons - adds r1, r0 - movs r0, 0x28 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldrb r0, [r4] - str r0, [sp, 0x8] - ldrb r0, [r4] - str r0, [sp, 0xC] - adds r0, r1, 0 - movs r2, 0x1 - movs r3, 0 - bl CalculateBaseDamage - ldr r1, =gBattleMoveDamage - str r0, [r1] - ldr r1, =gBankTarget - ldrb r0, [r4] - strb r0, [r1] - ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB6F0 - str r0, [r1] - ldr r2, =gHitMarker - ldr r0, [r2] - movs r1, 0x80 - lsls r1, 12 -_08045FCA: - orrs r0, r1 - str r0, [r2] - movs r0, 0x2 -_08045FD0: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8045CBC - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/battle_4.s b/asm/battle_4.s index a1c1ddf7f..075321c71 100644 --- a/asm/battle_4.s +++ b/asm/battle_4.s @@ -48,7 +48,7 @@ _08046020: b _08046396 .pool _08046064: - bl sub_8041A6C + bl AtkCanceller_UnableToUseMove lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0 @@ -132,7 +132,7 @@ _08046108: ands r0, r1 cmp r0, 0 bne _08046160 - bl sub_8045CBC + bl IsPokeDisobedient lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0 @@ -1339,10 +1339,10 @@ _08046B72: movs r0, 0 movs r2, 0 movs r3, 0x1 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes mov r7, r9 ldrb r0, [r7] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _08046BDC: ldr r2, =gHitMarker ldr r0, [r2] @@ -3431,7 +3431,7 @@ _08047D44: adds r0, 0x1 strb r0, [r5, 0x19] ldrb r0, [r7] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _08047D88: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -3535,7 +3535,7 @@ _08047E76: bl dp01_build_cmdbuf_x18_0_aa_health_bar_update ldr r4, =gActiveBank ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldrb r0, [r4] bl GetBankSide lsls r0, 24 @@ -3763,7 +3763,7 @@ _0804807C: b _080480E0 .pool _08048098: - ldr r0, =gUnknown_020241F8 + ldr r0, =gTakenDmg ldr r2, =gActiveBank ldrb r1, [r2] lsls r1, 2 @@ -3777,14 +3777,14 @@ _08048098: adds r5, r2, 0 cmp r0, 0 bne _080480D4 - ldr r1, =gUnknown_02024288 + ldr r1, =gTakenDmgBanks ldrb r0, [r5] adds r0, r1 ldr r1, =gBankAttacker b _080480DC .pool _080480D4: - ldr r1, =gUnknown_02024288 + ldr r1, =gTakenDmgBanks ldrb r0, [r5] adds r0, r1 ldr r1, =gBankTarget @@ -3965,9 +3965,9 @@ _0804823A: movs r1, 0x2A movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804829A .pool _08048274: @@ -4090,7 +4090,7 @@ _08048372: _08048376: bl dp01_build_cmdbuf_x2B_aa_0 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _080483C8 _08048382: ldrb r1, [r1] @@ -4112,7 +4112,7 @@ _0804839E: bl dp01_build_cmdbuf_x2B_aa_0 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _080483C8 .pool _080483B0: @@ -4125,7 +4125,7 @@ _080483B0: bl dp01_build_cmdbuf_x2B_aa_0 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _080483C8: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -4384,7 +4384,7 @@ atk11_printstring_playeronly: @ 80485D0 movs r0, 0 bl dp01_build_cmdbuf_x11_TODO ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r4] adds r0, 0x3 str r0, [r4] @@ -4511,7 +4511,7 @@ atk14_printfromtable_playeronly: @ 80486C4 movs r0, 0 bl dp01_build_cmdbuf_x11_TODO ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x5 str r0, [r5] @@ -4555,8 +4555,8 @@ _0804874E: .pool thumb_func_end sub_8048728 - thumb_func_start sub_8048760 -sub_8048760: @ 8048760 + thumb_func_start SetMoveEffect +SetMoveEffect: @ 8048760 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -4578,7 +4578,7 @@ sub_8048760: @ 8048760 ands r0, r3 cmp r0, 0 beq _080487B8 - ldr r2, =gUnknown_0202420E + ldr r2, =gEffectBank ldr r0, =gBankAttacker ldrb r0, [r0] strb r0, [r2] @@ -4592,7 +4592,7 @@ sub_8048760: @ 8048760 b _080487C4 .pool _080487B8: - ldr r2, =gUnknown_0202420E + ldr r2, =gEffectBank ldr r0, =gBankTarget ldrb r0, [r0] strb r0, [r2] @@ -4670,7 +4670,7 @@ _08048828: .pool _08048880: ldr r3, =gBattleMons - ldr r2, =gUnknown_0202420E + ldr r2, =gEffectBank ldrb r1, [r2] movs r0, 0x58 muls r0, r1 @@ -5123,7 +5123,7 @@ _08048BEA: str r2, [sp, 0x4] _08048C26: ldr r4, =gBattleMons - ldr r0, =gUnknown_0202420E + ldr r0, =gEffectBank ldrb r3, [r0] movs r0, 0x58 adds r2, r3, 0 @@ -5360,7 +5360,7 @@ _08048DFC: bne _08048E50 bl Random ldr r2, =gBattleMons - ldr r1, =gUnknown_0202420E + ldr r1, =gEffectBank ldrb r3, [r1] movs r1, 0x58 muls r3, r1 @@ -5376,7 +5376,7 @@ _08048DFC: .pool _08048E50: ldr r2, =gBattleMons - ldr r0, =gUnknown_0202420E + ldr r0, =gEffectBank ldrb r1, [r0] movs r0, 0x58 muls r1, r0 @@ -5395,7 +5395,7 @@ _08048E64: ldr r0, [r0] str r0, [r2] ldr r4, =gActiveBank - ldr r1, =gUnknown_0202420E + ldr r1, =gEffectBank ldrb r0, [r1] strb r0, [r4] ldrb r1, [r1] @@ -5408,9 +5408,9 @@ _08048E64: movs r1, 0x28 movs r2, 0 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r2, =gHitMarker ldr r1, [r2] movs r0, 0x80 @@ -5777,7 +5777,7 @@ _0804925A: strb r0, [r4, 0x3] movs r0, 0 movs r1, 0 - bl sub_8048760 + bl SetMoveEffect b _080499B2 .pool _0804927C: @@ -6131,7 +6131,7 @@ _080495A8: ands r0, r1 cmp r0, 0 bne _080495D4 - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r0, 0x29 adds r0, r4, r0 ldrb r1, [r0] @@ -6242,10 +6242,10 @@ _0804967C: movs r1, 0x2 movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes mov r2, r10 ldrb r0, [r2] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldrb r0, [r7] strb r0, [r4] ldrb r0, [r7] @@ -6260,9 +6260,9 @@ _0804967C: movs r1, 0x2 movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r7] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r4, =gBattlescriptCurrInstr ldr r0, [r4] adds r0, 0x1 @@ -6368,9 +6368,9 @@ _080497C2: movs r1, 0x28 movs r2, 0 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r4, =gBattlescriptCurrInstr ldr r0, [r4] adds r0, 0x1 @@ -6500,7 +6500,7 @@ _08049900: movs r5, 0 movs r1, 0 strh r1, [r0, 0x2E] - ldr r2, =gUnknown_020243D0 + ldr r2, =gWishFutureKnock adds r2, 0x29 adds r2, r4, r2 ldr r3, =gBitTable @@ -6568,7 +6568,7 @@ _080499B8: pop {r0} bx r0 .pool - thumb_func_end sub_8048760 + thumb_func_end SetMoveEffect thumb_func_start atk15_seteffectwithchancetarget atk15_seteffectwithchancetarget: @ 80499D4 @@ -6646,13 +6646,13 @@ _08049A50: _08049A7E: movs r0, 0 movs r1, 0x80 - bl sub_8048760 + bl SetMoveEffect b _08049AA2 .pool _08049A90: movs r0, 0 movs r1, 0 - bl sub_8048760 + bl SetMoveEffect b _08049AA2 _08049A9A: ldr r1, =gBattlescriptCurrInstr @@ -6676,7 +6676,7 @@ atk16_seteffectprimary: @ 8049AC0 push {lr} movs r0, 0x1 movs r1, 0 - bl sub_8048760 + bl SetMoveEffect pop {r0} bx r0 thumb_func_end atk16_seteffectprimary @@ -6686,7 +6686,7 @@ atk17_seteffectsecondary: @ 8049AD0 push {lr} movs r0, 0 movs r1, 0 - bl sub_8048760 + bl SetMoveEffect pop {r0} bx r0 thumb_func_end atk17_seteffectsecondary @@ -7006,9 +7006,9 @@ _08049D34: movs r0, 0 movs r2, 0 movs r3, 0x1 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattleTextBuff1 movs r0, 0xFD strb r0, [r1] @@ -7066,7 +7066,7 @@ atk1A_faint_animation: @ 8049E40 movs r0, 0 bl dp01_build_cmdbuf_x0A_A_A_A ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -7122,9 +7122,9 @@ _08049EB4: movs r1, 0x28 movs r2, 0 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _08049EDC: bl sub_803A75C ldr r1, =gBattlescriptCurrInstr @@ -7665,7 +7665,7 @@ atk23_getexp: @ 804A32C ldr r0, [r0] ldrb r0, [r0, 0x1] bl get_battle_side_of_something - ldr r1, =gUnknown_0202420D + ldr r1, =gBank1 strb r0, [r1] ldr r2, =gUnknown_020243FE movs r1, 0x2 @@ -7697,7 +7697,7 @@ _0804A38C: .4byte _0804AC40 .4byte _0804AC88 _0804A3A8: - ldr r4, =gUnknown_0202420D + ldr r4, =gBank1 ldrb r0, [r4] bl GetBankSide lsls r0, 24 @@ -7792,7 +7792,7 @@ _0804A486: ble _0804A418 ldr r3, =gBaseStats ldr r2, =gBattleMons - ldr r0, =gUnknown_0202420D + ldr r0, =gBank1 ldrb r1, [r0] movs r0, 0x58 muls r1, r0 @@ -8183,7 +8183,7 @@ _0804A78E: ldr r1, =gPlayerParty adds r0, r1 ldr r3, =gBattleMons - ldr r1, =gUnknown_0202420D + ldr r1, =gBank1 ldrb r2, [r1] movs r1, 0x58 muls r1, r2 @@ -8299,7 +8299,7 @@ _0804A85A: movs r0, 0 bl dp01_build_cmdbuf_x19_a_bb ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804A92A: ldr r1, =gBattleScripting ldrb r0, [r1, 0x1C] @@ -8672,7 +8672,7 @@ _0804AC88: cmp r5, 0 bne _0804ACB2 ldr r4, =gBattleMons - ldr r2, =gUnknown_0202420D + ldr r2, =gBank1 ldrb r0, [r2] movs r1, 0x58 muls r0, r1 @@ -9941,7 +9941,7 @@ _0804B624: bl dp01_build_cmdbuf_x18_0_aa_health_bar_update ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x2 @@ -10192,7 +10192,7 @@ _0804B822: bl dp01_build_cmdbuf_x34_a_bb_aka_battle_anim ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r4] adds r0, 0x7 str r0, [r4] @@ -10235,7 +10235,7 @@ _0804B894: movs r0, 0 bl dp01_build_cmdbuf_x34_a_bb_aka_battle_anim ldrb r0, [r6] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x7 _0804B8A8: @@ -10291,7 +10291,7 @@ _0804B8FA: bl dp01_build_cmdbuf_x34_a_bb_aka_battle_anim ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0xA @@ -10333,7 +10333,7 @@ _0804B960: movs r0, 0 bl dp01_build_cmdbuf_x34_a_bb_aka_battle_anim ldrb r0, [r7] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r6] _0804B972: adds r0, 0xA @@ -10613,7 +10613,7 @@ _0804BB6C: bl dp01_build_cmdbuf_x34_a_bb_aka_battle_anim ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, =gBattlescriptCurrInstr ldr r0, [r0] ldrb r1, [r0, 0x3] @@ -10720,7 +10720,7 @@ _0804BC68: movs r1, 0x1 bl dp01_build_cmdbuf_x33_a_33_33 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804C15A .pool _0804BC80: @@ -10730,7 +10730,7 @@ _0804BC80: movs r1, 0 bl dp01_build_cmdbuf_x33_a_33_33 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldrb r1, [r6] lsls r1, 2 adds r1, r5 @@ -10986,9 +10986,9 @@ _0804BEBA: movs r1, 0x28 movs r2, 0 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution bl b_movescr_stack_push_cursor ldr r1, =gBattlescriptCurrInstr ldr r0, =gUnknown_082DB282 @@ -11177,7 +11177,7 @@ _0804C088: movs r0, 0x3 movs r1, 0 movs r2, 0 - bl berry_effects_maybe + bl ItemBattleEffects lsls r0, 24 cmp r0, 0 beq _0804C184 @@ -11191,7 +11191,7 @@ _0804C0A8: movs r0, 0x4 movs r1, 0 movs r2, 0 - bl berry_effects_maybe + bl ItemBattleEffects _0804C0B2: lsls r0, 24 cmp r0, 0 @@ -11254,7 +11254,7 @@ _0804C120: movs r1, 0 bl dp01_build_cmdbuf_x33_a_33_33 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, =gStatuses3 ldrb r2, [r5] lsls r2, 2 @@ -12061,7 +12061,7 @@ atk4B_return_atk_to_ball: @ 804C844 movs r1, 0 bl dp01_build_cmdbuf_x06_a ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804C872: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -12108,7 +12108,7 @@ atk4C_copy_poke_data: @ 804C894 movs r1, 0 bl dp01_build_cmdbuf_x00_a_b_0 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -12206,7 +12206,7 @@ _0804C93E: bl GetBankSide lsls r0, 24 lsrs r2, r0, 24 - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r0, 0x29 adds r0, r2, r0 ldrb r1, [r0] @@ -12401,7 +12401,7 @@ _0804CB3E: movs r0, 0 bl dp01_build_cmdbuf_x05_a_b_c ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r4] adds r0, 0x3 str r0, [r4] @@ -12864,7 +12864,7 @@ sub_804CF10: @ 804CF10 movs r3, 0 bl dp01_build_cmdbuf_x16_a_b_c_ptr_d_e_f ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution add sp, 0x4 pop {r4,r5} pop {r0} @@ -12959,7 +12959,7 @@ _0804CFE2: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804D098 .pool _0804D054: @@ -12992,7 +12992,7 @@ _0804D088: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804D098: ldrb r0, [r4] adds r0, 0x1 @@ -13049,7 +13049,7 @@ _0804D0B8: movs r0, 0 bl dp01_build_cmdbuf_x2A_2A_2A_2A ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804D170 .pool _0804D120: @@ -13085,7 +13085,7 @@ _0804D15C: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution movs r0, 0x1 mov r9, r0 _0804D170: @@ -13128,7 +13128,7 @@ _0804D170: movs r0, 0 bl dp01_build_cmdbuf_x2A_2A_2A_2A ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804D22E .pool _0804D1D8: @@ -13169,7 +13169,7 @@ _0804D214: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804D22E: ldr r6, =gBitTable ldr r0, [r6, 0x4] @@ -13206,7 +13206,7 @@ _0804D22E: movs r0, 0 bl dp01_build_cmdbuf_x2A_2A_2A_2A ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804D2E4 .pool _0804D290: @@ -13242,7 +13242,7 @@ _0804D2CC: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution movs r0, 0x2 mov r2, r9 orrs r2, r0 @@ -13287,7 +13287,7 @@ _0804D2E4: movs r0, 0 bl dp01_build_cmdbuf_x2A_2A_2A_2A ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804D3A2 .pool _0804D34C: @@ -13328,7 +13328,7 @@ _0804D388: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804D3A2: ldr r1, =gSpecialStatuses ldrb r0, [r1] @@ -13365,7 +13365,7 @@ _0804D3E8: bl sub_8034464 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804D3FA: ldr r1, =gSpecialStatuses ldrb r0, [r1, 0x14] @@ -13402,7 +13402,7 @@ _0804D43C: bl sub_8034464 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804D450: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -13471,7 +13471,7 @@ _0804D482: movs r0, 0 bl dp01_build_cmdbuf_x2A_2A_2A_2A ldrb r0, [r6] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804D52A .pool _0804D4F8: @@ -13542,7 +13542,7 @@ _0804D52A: movs r0, 0 bl dp01_build_cmdbuf_x2A_2A_2A_2A ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804D5DA .pool _0804D5A8: @@ -13585,7 +13585,7 @@ _0804D5F8: ldr r0, =gHitMarker ldr r0, [r0] lsrs r5, r0, 28 - ldr r1, =gUnknown_0202420D + ldr r1, =gBank1 movs r0, 0 strb r0, [r1] ldr r4, =gBitTable @@ -13731,7 +13731,7 @@ _0804D6E0: movs r3, 0 bl dp01_build_cmdbuf_x16_a_b_c_ptr_d_e_f ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r6] adds r0, 0x6 str r0, [r6] @@ -13770,7 +13770,7 @@ _0804D77C: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804D792: ldrb r0, [r4] adds r0, 0x1 @@ -13812,7 +13812,7 @@ _0804D7F4: movs r2, 0 bl sub_8034464 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804D804: add sp, 0x4 pop {r3,r4} @@ -14340,7 +14340,7 @@ _0804DC88: ldrb r1, [r5] movs r0, 0 movs r2, 0 - bl berry_effects_maybe + bl ItemBattleEffects lsls r0, 24 cmp r0, 0 bne _0804DD8E @@ -14414,7 +14414,7 @@ _0804DD0C: ldr r0, =gHitMarker ldr r0, [r0] lsrs r4, r0, 28 - ldr r1, =gUnknown_0202420D + ldr r1, =gBank1 ldrb r0, [r1] adds r0, 0x1 strb r0, [r1] @@ -14471,7 +14471,7 @@ atk53_trainer_slide: @ 804DDA8 movs r0, 0 bl dp01_build_cmdbuf_x08_8_8_8 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -14497,7 +14497,7 @@ atk54_effectiveness_sound: @ 804DDD8 movs r0, 0 bl dp01_build_cmdbuf_x2B_aa_0 ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r4] adds r0, 0x3 str r0, [r4] @@ -14524,7 +14524,7 @@ atk55_play_sound: @ 804DE14 movs r2, 0 bl sub_8034300 ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r4] adds r0, 0x3 str r0, [r4] @@ -14546,7 +14546,7 @@ atk56_fainting_cry: @ 804DE50 movs r0, 0 bl dp01_build_cmdbuf_x2D_2D_2D_2D ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -14568,7 +14568,7 @@ atk57: @ 804DE80 movs r0, 0 bl dp01_build_cmdbuf_x37_a ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x1 @@ -14592,7 +14592,7 @@ atk58_return_to_ball: @ 804DEB8 movs r1, 0x1 bl dp01_build_cmdbuf_x06_a ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -15327,7 +15327,7 @@ _0804E55A: bl dp01_build_cmdbuf_x29_29_29_29 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x2 @@ -15596,7 +15596,7 @@ _0804E794: movs r2, 0 bl dp01_build_cmdbuf_x00_a_b_0 ldrb r0, [r6] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldrb r0, [r5] adds r0, 0x1 strb r0, [r5] @@ -15786,7 +15786,7 @@ _0804E926: bl dp01_build_cmdbuf_x30_TODO ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x2 @@ -15813,7 +15813,7 @@ atk62_08025C6C: @ 804E960 movs r0, 0 bl dp01_build_cmdbuf_x31_31_31_31 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -15911,7 +15911,7 @@ atk64_statusanimation: @ 804E9F4 movs r1, 0 bl dp01_build_cmdbuf_x1B_aaaa_b ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804EA54: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -15982,7 +15982,7 @@ atk65_status2animation: @ 804EA84 movs r1, 0x1 bl dp01_build_cmdbuf_x1B_aaaa_b ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804EAFC: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -16046,7 +16046,7 @@ atk66_chosenstatusanimation: @ 804EB2C movs r0, 0 bl dp01_build_cmdbuf_x1B_aaaa_b ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804EB96: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -16392,9 +16392,9 @@ atk6A_removeitem: @ 804EE58 movs r1, 0x2 movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r6] adds r0, 0x2 str r0, [r6] @@ -17139,7 +17139,7 @@ atk6F_set_visible: @ 804F50C movs r1, 0 bl dp01_build_cmdbuf_x33_a_33_33 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -17208,7 +17208,7 @@ atk71_buffer_move_to_learn: @ 804F59C thumb_func_start atk72_jump_if_can_run_frombattle atk72_jump_if_can_run_frombattle: @ 804F5B4 push {lr} - ldr r0, =gUnknown_0202420D + ldr r0, =gBank1 ldrb r0, [r0] bl sub_803EC20 lsls r0, 24 @@ -17905,7 +17905,7 @@ _0804FC18: bl sub_8033E10 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804FD70 .pool _0804FC2C: @@ -17969,7 +17969,7 @@ _0804FCA2: movs r1, 0 bl dp01_build_cmdbuf_x06_a ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _0804FD70 .pool _0804FCC4: @@ -18038,7 +18038,7 @@ _0804FD5C: bl sub_8034300 ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _0804FD70: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -18253,7 +18253,7 @@ _0804FF14: movs r0, 0 bl dp01_build_cmdbuf_x18_0_aa_health_bar_update ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x1 @@ -18340,9 +18340,9 @@ atk79_setatkhptozero: @ 804FFE4 movs r1, 0x2A movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x1 @@ -18672,7 +18672,7 @@ _080502F4: strh r0, [r2] ldr r0, =gBattleCommunication strb r1, [r0, 0x5] - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r0, 0x28 movs r1, 0x5 strb r1, [r0] @@ -19010,9 +19010,9 @@ _080505B8: movs r1, 0x28 movs r2, 0 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r7] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x5 @@ -19072,8 +19072,8 @@ atk83_nop: @ 8050640 .pool thumb_func_end atk83_nop - thumb_func_start sub_8050650 -sub_8050650: @ 8050650 + thumb_func_start UproarWakeUpCheck +UproarWakeUpCheck: @ 8050650 push {r4-r7,lr} mov r7, r8 push {r7} @@ -19148,7 +19148,7 @@ _080506E2: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_8050650 + thumb_func_end UproarWakeUpCheck thumb_func_start atk84_jump_if_cant_sleep atk84_jump_if_cant_sleep: @ 80506EC @@ -19167,7 +19167,7 @@ atk84_jump_if_cant_sleep: @ 80506EC orrs r4, r0 ldr r6, =gBankTarget ldrb r0, [r6] - bl sub_8050650 + bl UproarWakeUpCheck lsls r0, 24 cmp r0, 0 beq _08050720 @@ -20133,7 +20133,7 @@ atk8B_setbide: @ 8050F40 ldrh r1, [r1] movs r2, 0 strh r1, [r0] - ldr r1, =gUnknown_020241F8 + ldr r1, =gTakenDmg ldrb r0, [r3] lsls r0, 2 adds r0, r1 @@ -21477,7 +21477,7 @@ _08051AEC: ldr r1, =gBattleCommunication movs r0, 0x3 strb r0, [r1, 0x5] - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r0, 0x28 movs r1, 0x5 strb r1, [r0] @@ -21878,7 +21878,7 @@ atk98_status_icon_update: @ 8051E48 movs r0, 0 bl dp01_build_cmdbuf_x1A_aaaa_bbbb ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] @@ -21912,7 +21912,7 @@ _08051EA0: movs r0, 0 bl dp01_build_cmdbuf_x1A_aaaa_bbbb ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _08051EDC: ldr r0, =gBattleTypeFlags ldr r0, [r0] @@ -21949,7 +21949,7 @@ _08051EDC: movs r0, 0 bl dp01_build_cmdbuf_x1A_aaaa_bbbb ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _08051F2C: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -22251,7 +22251,7 @@ _080521CA: bl dp01_build_cmdbuf_x38_a mov r2, r8 ldrb r0, [r2] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattleCommunication movs r0, 0 _080521EC: @@ -23769,10 +23769,10 @@ _08052E7A: movs r1, 0x3 movs r2, 0 movs r3, 0x10 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattleTextBuff1 movs r0, 0xFD strb r0, [r1] @@ -24378,9 +24378,9 @@ _08053304: movs r0, 0 movs r2, 0 movs r3, 0x1 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _080533B8: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -24723,9 +24723,9 @@ _080536BC: movs r0, 0 movs r1, 0x28 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _080536DE: ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] @@ -25708,7 +25708,7 @@ _08053F2A: lsls r0, 31 cmp r0, 0 bne _08054030 - ldr r0, =gUnknown_02024274 + ldr r0, =gChosenMovesByBanks lsls r1, r3, 1 adds r1, r0 ldrh r0, [r1] @@ -25824,7 +25824,7 @@ _08054088: ldr r1, =gBattleCommunication movs r0, 0x4 strb r0, [r1, 0x5] - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r0, 0x28 movs r1, 0x5 strb r1, [r0] @@ -26413,7 +26413,7 @@ atkC3_setfutureattack: @ 8054598 mov r5, r8 push {r5-r7} sub sp, 0x14 - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock mov r8, r0 ldr r6, =gBankTarget ldrb r1, [r6] @@ -26965,7 +26965,7 @@ _08054A78: ldr r0, =gBattleCommunication movs r1, 0x5 strb r1, [r0, 0x5] - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r0, 0x28 strb r1, [r0] _08054A86: @@ -27031,7 +27031,7 @@ _08054AF4: movs r0, 0 bl dp01_build_cmdbuf_x18_0_aa_health_bar_update ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x5 @@ -27202,9 +27202,9 @@ atkCD_cureifburnedparalysedorpoisoned: @ 8054C60 movs r1, 0x28 movs r2, 0 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution b _08054CD6 .pool _08054CBC: @@ -27492,7 +27492,7 @@ _08054EE8: ands r0, r1 cmp r0, 0 bne _08054F46 - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r2, r0, 0 adds r2, 0x29 adds r0, r4, r2 @@ -27633,10 +27633,10 @@ _08055010: movs r1, 0x2 movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldr r1, =gBankAttacker ldrb r0, [r1] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldrb r0, [r7] strb r0, [r4] ldrb r0, [r7] @@ -27649,9 +27649,9 @@ _08055010: movs r1, 0x2 movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r7] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldrb r0, [r7] mov r2, r10 ldr r1, [r2] @@ -27813,7 +27813,7 @@ atkD4_wish_effect: @ 80551C0 b _0805528C .pool _080551D8: - ldr r1, =gUnknown_020243D0 + ldr r1, =gWishFutureKnock ldr r4, =gBankAttacker adds r0, r1, 0 adds r0, 0x20 @@ -27845,7 +27845,7 @@ _08055210: ldr r4, =gBankTarget ldrb r0, [r4] strb r0, [r1, 0x2] - ldr r0, =gUnknown_020243D0 + ldr r0, =gWishFutureKnock adds r0, 0x24 ldrb r5, [r4] adds r0, r5 @@ -28875,9 +28875,9 @@ atkE2_switchout_abilities: @ 8055A78 movs r0, 0 movs r1, 0x28 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _08055AD2: ldr r0, [r5] adds r0, 0x2 @@ -29276,7 +29276,7 @@ _08055E2C: movs r1, 0 bl dp01_build_cmdbuf_x34_a_bb_aka_battle_anim ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x1 @@ -29296,12 +29296,12 @@ atkE7_castform_data_change: @ 8055E64 str r0, [r1] ldr r0, =gBattleScripting ldrb r0, [r0, 0x17] - bl castform_switch + bl CastformDataTypeChange lsls r0, 24 lsrs r4, r0, 24 cmp r4, 0 beq _08055E8E - ldr r0, =gUnknown_082DB4A9 + ldr r0, =BattleScript_CastformChange bl b_push_move_exec ldr r0, =gBattleStruct ldr r0, [r0] @@ -29529,9 +29529,9 @@ atkEA_recycleitem: @ 8056014 movs r1, 0x2 movs r2, 0 movs r3, 0x2 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r7] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, [r1] adds r0, 0x5 @@ -29676,7 +29676,7 @@ atkEC_pursuit_sth: @ 805616C ldrb r0, [r0] cmp r0, 0 bne _0805620C - ldr r1, =gUnknown_02024274 + ldr r1, =gChosenMovesByBanks lsls r0, r3, 1 adds r0, r1 ldrh r2, [r0] @@ -29725,7 +29725,7 @@ _08056226: thumb_func_start atkED_802B4B4 atkED_802B4B4: @ 8056230 push {r4,lr} - ldr r1, =gUnknown_0202420E + ldr r1, =gEffectBank ldr r3, =gBankAttacker ldrb r0, [r3] strb r0, [r1] @@ -29841,7 +29841,7 @@ _0805630E: movs r1, 0x5 bl dp01_build_cmdbuf_x0D_a ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, =gUnknown_082DBE02 b _08056694 @@ -29856,7 +29856,7 @@ _0805635C: movs r1, 0x4 bl dp01_build_cmdbuf_x0D_a ldrb r0, [r5] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, =gUnknown_082DBDCA b _08056694 @@ -30082,7 +30082,7 @@ _08056564: bl dp01_build_cmdbuf_x0D_a ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r1, =gBattlescriptCurrInstr ldr r0, =gUnknown_082DBD84 str r0, [r1] @@ -30148,7 +30148,7 @@ _08056614: bl dp01_build_cmdbuf_x0D_a ldr r0, =gActiveBank ldrb r0, [r0] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution cmp r4, 0x4 bne _0805668C ldr r1, =gBattlescriptCurrInstr @@ -31146,7 +31146,7 @@ sub_8056EF8: @ 8056EF8 movs r0, 0 bl dp01_build_cmdbuf_x09_9_9_9 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution ldr r0, [r5] adds r0, 0x2 str r0, [r5] diff --git a/asm/battle_5.s b/asm/battle_5.s index 064171dd8..3db603531 100644 --- a/asm/battle_5.s +++ b/asm/battle_5.s @@ -398,7 +398,7 @@ _0805729A: cmp r0, 0 beq _08057372 mov r0, r9 - bl sub_8050650 + bl UproarWakeUpCheck lsls r0, 24 cmp r0, 0 beq _080572FC @@ -419,7 +419,7 @@ _0805729A: mov r2, r10 strb r0, [r2, 0x5] ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB220 + ldr r0, =BattleScript_MoveUsedWokeUp str r0, [r1] movs r0, 0x2 mov r8, r0 @@ -461,7 +461,7 @@ _08057322: cmp r4, 0 beq _08057354 ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB213 + ldr r0, =BattleScript_MoveUsedIsAsleep str r0, [r1] movs r1, 0x2 mov r8, r1 @@ -478,7 +478,7 @@ _08057354: ldr r0, =gBattleCommunication strb r4, [r0, 0x5] ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB220 + ldr r0, =BattleScript_MoveUsedWokeUp str r0, [r1] movs r2, 0x2 mov r8, r2 @@ -513,7 +513,7 @@ _08057390: cmp r5, 0 beq _080573D4 ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB26A + ldr r0, =BattleScript_MoveUsedIsFrozen str r0, [r1] b _080573EC .pool @@ -525,7 +525,7 @@ _080573D4: str r0, [r4] bl b_movescr_stack_push_cursor ldr r1, =gBattlescriptCurrInstr - ldr r0, =gUnknown_082DB277 + ldr r0, =BattleScript_MoveUsedUnfroze str r0, [r1] mov r0, r10 strb r5, [r0, 0x5] @@ -562,9 +562,9 @@ _08057406: movs r1, 0x28 movs r2, 0 movs r3, 0x4 - bl dp01_build_cmdbuf_x02_a_b_varargs + bl EmitSetAttributes ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution _08057430: mov r0, r8 add sp, 0x4 diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index fc2c36fc8..f35b2f7da 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -50069,7 +50069,7 @@ sub_8117E94: @ 8117E94 ldrb r1, [r1] strb r1, [r2] ldr r2, =gAnimationBankTarget - ldr r1, =gUnknown_0202420E + ldr r1, =gEffectBank ldrb r1, [r1] strb r1, [r2] bl move_anim_task_del @@ -50136,7 +50136,7 @@ sub_8117F30: @ 8117F30 ldrb r1, [r1] strb r1, [r2] ldr r2, =gAnimationBankTarget - ldr r1, =gUnknown_0202420E + ldr r1, =gEffectBank ldrb r1, [r1] strb r1, [r2] bl move_anim_task_del diff --git a/asm/battle_anim_8170478.s b/asm/battle_anim_8170478.s index c64dd69e5..abbca8ff7 100644 --- a/asm/battle_anim_8170478.s +++ b/asm/battle_anim_8170478.s @@ -5069,7 +5069,7 @@ sub_8172ED0: @ 8172ED0 lsls r0, 24 lsrs r0, 24 ldr r2, =gAnimationBankTarget - ldr r1, =gUnknown_0202420E + ldr r1, =gEffectBank ldrb r1, [r1] strb r1, [r2] bl move_anim_task_del diff --git a/asm/battle_link_817C95C.s b/asm/battle_link_817C95C.s index a08d34cad..94ae7ad7f 100644 --- a/asm/battle_link_817C95C.s +++ b/asm/battle_link_817C95C.s @@ -44,7 +44,7 @@ _0817C988: bl GetBankSide lsls r0, 24 lsrs r6, r0, 24 - ldr r0, =gUnknown_0202420E + ldr r0, =gEffectBank ldrb r0, [r0] bl GetBankSide lsls r0, 24 @@ -145,7 +145,7 @@ _0817CA9C: bl GetBankIdentity lsls r0, 24 lsrs r5, r0, 25 - ldr r0, =gUnknown_0202420E + ldr r0, =gEffectBank ldrb r0, [r0] bl GetBankIdentity lsls r0, 24 @@ -1302,7 +1302,7 @@ _0817D6F2: bl _0817E0A6 _0817D704: ldr r5, =gBattlePartyID - ldr r6, =gUnknown_0202420E + ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 adds r0, r5 @@ -1396,7 +1396,7 @@ _0817D7B2: .pool _0817D7D8: ldr r5, =gBattlePartyID - ldr r6, =gUnknown_0202420E + ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 adds r0, r5 @@ -1440,7 +1440,7 @@ _0817D7D8: .pool _0817D838: ldr r5, =gBattlePartyID - ldr r6, =gUnknown_0202420E + ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 adds r0, r5 @@ -1628,7 +1628,7 @@ _0817D9AE: b _0817E086 _0817D9C2: ldr r5, =gBattlePartyID - ldr r6, =gUnknown_0202420E + ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 adds r0, r5 @@ -1703,7 +1703,7 @@ _0817DA48: .pool _0817DA68: ldr r5, =gBattlePartyID - ldr r6, =gUnknown_0202420E + ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 adds r0, r5 @@ -1791,7 +1791,7 @@ _0817DB10: .pool _0817DB24: ldr r5, =gBattlePartyID - ldr r6, =gUnknown_0202420E + ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 adds r0, r5 diff --git a/asm/battle_message.s b/asm/battle_message.s index dec210b25..4688a5add 100644 --- a/asm/battle_message.s +++ b/asm/battle_message.s @@ -1349,7 +1349,7 @@ _0814ED5E: bl _0814F5BE .pool _0814ED70: - ldr r5, =gUnknown_0202420E + ldr r5, =gEffectBank ldrb r0, [r5] bl GetBankSide lsls r0, 24 @@ -1695,7 +1695,7 @@ _0814F0A8: .pool _0814F0B8: ldr r1, =gAbilitiesPerBank - ldr r0, =gUnknown_0202420E + ldr r0, =gEffectBank _0814F0BC: ldrb r0, [r0] _0814F0BE: diff --git a/asm/pokemon_item_effect.s b/asm/pokemon_item_effect.s index 137f7a5c0..c798d7753 100644 --- a/asm/pokemon_item_effect.s +++ b/asm/pokemon_item_effect.s @@ -1157,7 +1157,7 @@ _0806C6AE: movs r2, 0 bl dp01_build_cmdbuf_x00_a_b_0 ldrb r0, [r4] - bl dp01_battle_side_mark_buffer_for_execution + bl MarkBufferBankForExecution strb r5, [r4] b _0806C6EC .pool diff --git a/asm/recorded_battle.s b/asm/recorded_battle.s index 53824dfea..94d96b2f8 100644 --- a/asm/recorded_battle.s +++ b/asm/recorded_battle.s @@ -2599,7 +2599,7 @@ _081863A2: ldr r2, [sp, 0x40] bl SetMonData _081863CA: - ldr r2, =gUnknown_02024274 + ldr r2, =gChosenMovesByBanks ldr r3, [sp, 0x44] adds r2, r3, r2 ldr r0, =gBattleStruct diff --git a/asm/rom3.s b/asm/rom3.s index e2f268f43..c3a730836 100644 --- a/asm/rom3.s +++ b/asm/rom3.s @@ -1573,7 +1573,7 @@ _08033346: ldrsh r1, [r0, r2] ldr r0, [r4] adds r1, r0 - ldr r0, =gUnknown_0202420E + ldr r0, =gEffectBank ldrb r0, [r0] strb r0, [r1, 0x7] movs r2, 0 @@ -2084,7 +2084,7 @@ _080337D2: adds r0, r1 ldrb r0, [r0, 0x6] strb r0, [r2] - ldr r2, =gUnknown_0202420E + ldr r2, =gEffectBank movs r4, 0x26 ldrsh r0, [r5, r4] adds r0, r1 @@ -2175,8 +2175,8 @@ dp01_build_cmdbuf_x01_a_b_0: @ 80338D8 .pool thumb_func_end dp01_build_cmdbuf_x01_a_b_0 - thumb_func_start dp01_build_cmdbuf_x02_a_b_varargs -dp01_build_cmdbuf_x02_a_b_varargs: @ 8033900 + thumb_func_start EmitSetAttributes +EmitSetAttributes: @ 8033900 push {r4-r6,lr} ldr r4, [sp, 0x10] lsls r0, 24 @@ -2209,7 +2209,7 @@ _0803392E: pop {r0} bx r0 .pool - thumb_func_end dp01_build_cmdbuf_x02_a_b_varargs + thumb_func_end EmitSetAttributes thumb_func_start sub_8033940 sub_8033940: @ 8033940 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index da05b9367..ca599631c 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -21,7 +21,7 @@ gUnknown_082D8CD4:: @ 82D8CD4 gUnknown_082D8D65:: @ 82D8D65 .incbin "baserom.gba", 0x2d8d65, 0x6fd -gUnknown_082D9462:: @ 82D9462 +BattleScript_MoveUsedMustRecharge:: @ 82D9462 .incbin "baserom.gba", 0x2d9462, 0xa7f gUnknown_082D9EE1:: @ 82D9EE1 @@ -120,16 +120,16 @@ gUnknown_082DACFA:: @ 82DACFA gUnknown_082DAD0B:: @ 82DAD0B .incbin "baserom.gba", 0x2dad0b, 0xa -gUnknown_082DAD15:: @ 82DAD15 +BattleScript_LeechSeedTurnDrain:: @ 82DAD15 .incbin "baserom.gba", 0x2dad15, 0x5c -gUnknown_082DAD71:: @ 82DAD71 +BattleScript_BideStoringEnergy:: @ 82DAD71 .incbin "baserom.gba", 0x2dad71, 0xb -gUnknown_082DAD7C:: @ 82DAD7C +BattleScript_BideAttack:: @ 82DAD7C .incbin "baserom.gba", 0x2dad7c, 0x48 -gUnknown_082DADC4:: @ 82DADC4 +BattleScript_BideNoEnergyToAttack:: @ 82DADC4 .incbin "baserom.gba", 0x2dadc4, 0x14 gUnknown_082DADD8:: @ 82DADD8 @@ -141,19 +141,19 @@ gUnknown_082DAE03:: @ 82DAE03 gUnknown_082DAE0D:: @ 82DAE0D .incbin "baserom.gba", 0x2dae0d, 0x7 -gUnknown_082DAE14:: @ 82DAE14 +BattleScript_MoveUsedIsDisabled:: @ 82DAE14 .incbin "baserom.gba", 0x2dae14, 0xb gUnknown_082DAE1F:: @ 82DAE1F .incbin "baserom.gba", 0x2dae1f, 0x4 -gUnknown_082DAE23:: @ 82DAE23 +BattleScript_DisabledNoMore:: @ 82DAE23 .incbin "baserom.gba", 0x2dae23, 0x7 gUnknown_082DAE2A:: @ 82DAE2A .incbin "baserom.gba", 0x2dae2a, 0xd -gUnknown_082DAE37:: @ 82DAE37 +BattleScript_EncoredNoMore:: @ 82DAE37 .incbin "baserom.gba", 0x2dae37, 0x7 gUnknown_082DAE3E:: @ 82DAE3E @@ -192,7 +192,7 @@ gUnknown_082DAFDD:: @ 82DAFDD gUnknown_082DAFE4:: @ 82DAFE4 .incbin "baserom.gba", 0x2dafe4, 0x8e -gUnknown_082DB072:: @ 82DB072 +BattleScript_NoMovesLeft:: @ 82DB072 .incbin "baserom.gba", 0x2db072, 0x4 gUnknown_082DB076:: @ 82DB076 @@ -210,16 +210,16 @@ gUnknown_082DB098:: @ 82DB098 gUnknown_082DB0A0:: @ 82DB0A0 .incbin "baserom.gba", 0x2db0a0, 0x4 -gUnknown_082DB0A4:: @ 82DB0A4 +BattleScript_MoveUsedIsTaunted:: @ 82DB0A4 .incbin "baserom.gba", 0x2db0a4, 0xb gUnknown_082DB0AF:: @ 82DB0AF .incbin "baserom.gba", 0x2db0af, 0x8 -gUnknown_082DB0B7:: @ 82DB0B7 +BattleScript_WishComesTrue:: @ 82DB0B7 .incbin "baserom.gba", 0x2db0b7, 0x37 -gUnknown_082DB0EE:: @ 82DB0EE +BattleScript_IngrainTurnHeal:: @ 82DB0EE .incbin "baserom.gba", 0x2db0ee, 0x29 gUnknown_082DB117:: @ 82DB117 @@ -228,7 +228,7 @@ gUnknown_082DB117:: @ 82DB117 gUnknown_082DB168:: @ 82DB168 .incbin "baserom.gba", 0x2db168, 0xe -gUnknown_082DB176:: @ 82DB176 +BattleScript_MoveUsedIsImprisoned:: @ 82DB176 .incbin "baserom.gba", 0x2db176, 0xb gUnknown_082DB181:: @ 82DB181 @@ -258,97 +258,97 @@ gUnknown_082DB1D5:: @ 82DB1D5 gUnknown_082DB1FF:: @ 82DB1FF .incbin "baserom.gba", 0x2db1ff, 0x14 -gUnknown_082DB213:: @ 82DB213 +BattleScript_MoveUsedIsAsleep:: @ 82DB213 .incbin "baserom.gba", 0x2db213, 0xd -gUnknown_082DB220:: @ 82DB220 +BattleScript_MoveUsedWokeUp:: @ 82DB220 .incbin "baserom.gba", 0x2db220, 0x14 gUnknown_082DB234:: @ 82DB234 .incbin "baserom.gba", 0x2db234, 0x9 -gUnknown_082DB23D:: @ 82DB23D +BattleScript_PoisonTurnDmg:: @ 82DB23D .incbin "baserom.gba", 0x2db23d, 0x22 -gUnknown_082DB25F:: @ 82DB25F +BattleScript_BurnTurnDmg:: @ 82DB25F .incbin "baserom.gba", 0x2db25f, 0xb -gUnknown_082DB26A:: @ 82DB26A +BattleScript_MoveUsedIsFrozen:: @ 82DB26A .incbin "baserom.gba", 0x2db26a, 0xd -gUnknown_082DB277:: @ 82DB277 +BattleScript_MoveUsedUnfroze:: @ 82DB277 .incbin "baserom.gba", 0x2db277, 0xb gUnknown_082DB282:: @ 82DB282 .incbin "baserom.gba", 0x2db282, 0x9 -gUnknown_082DB28B:: @ 82DB28B +BattleScript_MoveUsedIsParalyzed:: @ 82DB28B .incbin "baserom.gba", 0x2db28b, 0x10 -gUnknown_082DB29B:: @ 82DB29B +BattleScript_MoveUsedFlinched:: @ 82DB29B .incbin "baserom.gba", 0x2db29b, 0xb gUnknown_082DB2A6:: @ 82DB2A6 .incbin "baserom.gba", 0x2db2a6, 0x9 -gUnknown_082DB2AF:: @ 82DB2AF +BattleScript_ThrashConfuses:: @ 82DB2AF .incbin "baserom.gba", 0x2db2af, 0xe -gUnknown_082DB2BD:: @ 82DB2BD +BattleScript_MoveUsedIsConfused:: @ 82DB2BD .incbin "baserom.gba", 0x2db2bd, 0x43 -gUnknown_082DB300:: @ 82DB300 +BattleScript_MoveUsedIsConfusedNoMore:: @ 82DB300 .incbin "baserom.gba", 0x2db300, 0x7 gUnknown_082DB307:: @ 82DB307 .incbin "baserom.gba", 0x2db307, 0x7 -gUnknown_082DB30E:: @ 82DB30E +BattleScript_WrapTurnDmg:: @ 82DB30E .incbin "baserom.gba", 0x2db30e, 0x12 -gUnknown_082DB320:: @ 82DB320 +BattleScript_WrapEnds:: @ 82DB320 .incbin "baserom.gba", 0x2db320, 0x7 -gUnknown_082DB327:: @ 82DB327 +BattleScript_MoveUsedIsInLove:: @ 82DB327 .incbin "baserom.gba", 0x2db327, 0xd -gUnknown_082DB334:: @ 82DB334 +BattleScript_MoveUsedIsParalyzedCantAttack:: @ 82DB334 .incbin "baserom.gba", 0x2db334, 0xb -gUnknown_082DB33F:: @ 82DB33F +BattleScript_NightmareTurnDmg:: @ 82DB33F .incbin "baserom.gba", 0x2db33f, 0x11 -gUnknown_082DB350:: @ 82DB350 +BattleScript_CurseTurnDmg:: @ 82DB350 .incbin "baserom.gba", 0x2db350, 0x11 gUnknown_082DB361:: @ 82DB361 .incbin "baserom.gba", 0x2db361, 0x17 -gUnknown_082DB378:: @ 82DB378 +BattleScript_YawnMakesAsleep:: @ 82DB378 .incbin "baserom.gba", 0x2db378, 0xaa gUnknown_082DB422:: @ 82DB422 .incbin "baserom.gba", 0x2db422, 0xe -gUnknown_082DB430:: @ 82DB430 +BattleScript_DrizzleActivates:: @ 82DB430 .incbin "baserom.gba", 0x2db430, 0x14 -gUnknown_082DB444:: @ 82DB444 +BattleScript_SpeedBoostActivates:: @ 82DB444 .incbin "baserom.gba", 0x2db444, 0xe -gUnknown_082DB452:: @ 82DB452 +BattleScript_TraceActivates:: @ 82DB452 .incbin "baserom.gba", 0x2db452, 0xa -gUnknown_082DB45C:: @ 82DB45C +BattleScript_RainDishActivates:: @ 82DB45C .incbin "baserom.gba", 0x2db45c, 0x14 -gUnknown_082DB470:: @ 82DB470 +BattleScript_SandstreamActivates:: @ 82DB470 .incbin "baserom.gba", 0x2db470, 0x14 -gUnknown_082DB484:: @ 82DB484 +BattleScript_ShedSkinActivates:: @ 82DB484 .incbin "baserom.gba", 0x2db484, 0x25 -gUnknown_082DB4A9:: @ 82DB4A9 +BattleScript_CastformChange:: @ 82DB4A9 .incbin "baserom.gba", 0x2db4a9, 0xf gUnknown_082DB4B8:: @ 82DB4B8 @@ -357,7 +357,7 @@ gUnknown_082DB4B8:: @ 82DB4B8 gUnknown_082DB4C1:: @ 82DB4C1 .incbin "baserom.gba", 0x2db4c1, 0x69 -gUnknown_082DB52A:: @ 82DB52A +BattleScript_DroughtActivates:: @ 82DB52A .incbin "baserom.gba", 0x2db52a, 0x14 gUnknown_082DB53E:: @ 82DB53E @@ -369,10 +369,10 @@ gUnknown_082DB552:: @ 82DB552 gUnknown_082DB560:: @ 82DB560 .incbin "baserom.gba", 0x2db560, 0xe -gUnknown_082DB56E:: @ 82DB56E +BattleScript_MoveHPDrain_PPLoss:: @ 82DB56E .incbin "baserom.gba", 0x2db56e, 0x1 -gUnknown_082DB56F:: @ 82DB56F +BattleScript_MoveHPDrain:: @ 82DB56F .incbin "baserom.gba", 0x2db56f, 0x22 gUnknown_082DB591:: @ 82DB591 @@ -381,10 +381,10 @@ gUnknown_082DB591:: @ 82DB591 gUnknown_082DB592:: @ 82DB592 .incbin "baserom.gba", 0x2db592, 0x15 -gUnknown_082DB5A7:: @ 82DB5A7 +BattleScript_FlashFireBoost_PPLoss:: @ 82DB5A7 .incbin "baserom.gba", 0x2db5a7, 0x1 -gUnknown_082DB5A8:: @ 82DB5A8 +BattleScript_FlashFireBoost:: @ 82DB5A8 .incbin "baserom.gba", 0x2db5a8, 0x1f gUnknown_082DB5C7:: @ 82DB5C7 @@ -405,7 +405,7 @@ gUnknown_082DB5F5:: @ 82DB5F5 gUnknown_082DB603:: @ 82DB603 .incbin "baserom.gba", 0x2db603, 0x1c -gUnknown_082DB61F:: @ 82DB61F +BattleScript_SoundproofProtected:: @ 82DB61F .incbin "baserom.gba", 0x2db61f, 0x10 gUnknown_082DB62F:: @ 82DB62F @@ -414,19 +414,19 @@ gUnknown_082DB62F:: @ 82DB62F gUnknown_082DB63F:: @ 82DB63F .incbin "baserom.gba", 0x2db63f, 0xe -gUnknown_082DB64D:: @ 82DB64D +BattleScript_ColorChangeActivates:: @ 82DB64D .incbin "baserom.gba", 0x2db64d, 0x7 -gUnknown_082DB654:: @ 82DB654 +BattleScript_RoughSkinActivates:: @ 82DB654 .incbin "baserom.gba", 0x2db654, 0x1b -gUnknown_082DB66F:: @ 82DB66F +BattleScript_CuteCharmActivates:: @ 82DB66F .incbin "baserom.gba", 0x2db66f, 0xd -gUnknown_082DB67C:: @ 82DB67C +BattleScript_ApplySecondaryEffect:: @ 82DB67C .incbin "baserom.gba", 0x2db67c, 0x3 -gUnknown_082DB67F:: @ 82DB67F +BattleScript_SynchronizeActivates:: @ 82DB67F .incbin "baserom.gba", 0x2db67f, 0x3 gUnknown_082DB682:: @ 82DB682 @@ -441,7 +441,7 @@ gUnknown_082DB695:: @ 82DB695 gUnknown_082DB6A5:: @ 82DB6A5 .incbin "baserom.gba", 0x2db6a5, 0x8 -gUnknown_082DB6AD:: @ 82DB6AD +BattleScript_MoveUsedLoafingAround:: @ 82DB6AD .incbin "baserom.gba", 0x2db6ad, 0x2c gUnknown_082DB6D9:: @ 82DB6D9 @@ -453,64 +453,64 @@ gUnknown_082DB6F0:: @ 82DB6F0 gUnknown_082DB6FB:: @ 82DB6FB .incbin "baserom.gba", 0x2db6fb, 0xb -gUnknown_082DB706:: @ 82DB706 +BattleScript_BerryCurePrlzEnd2:: @ 82DB706 .incbin "baserom.gba", 0x2db706, 0x6 -gUnknown_082DB70C:: @ 82DB70C +BattleScript_BerryCureParRet:: @ 82DB70C .incbin "baserom.gba", 0x2db70c, 0x12 -gUnknown_082DB71E:: @ 82DB71E +BattleScript_BerryCurePsnEnd2:: @ 82DB71E .incbin "baserom.gba", 0x2db71e, 0x6 -gUnknown_082DB724:: @ 82DB724 +BattleScript_BerryCurePsnRet:: @ 82DB724 .incbin "baserom.gba", 0x2db724, 0x12 -gUnknown_082DB736:: @ 82DB736 +BattleScript_BerryCureBrnEnd2:: @ 82DB736 .incbin "baserom.gba", 0x2db736, 0x6 -gUnknown_082DB73C:: @ 82DB73C +BattleScript_BerryCureBrnRet:: @ 82DB73C .incbin "baserom.gba", 0x2db73c, 0x12 -gUnknown_082DB74E:: @ 82DB74E +BattleScript_BerryCureFrzEnd2:: @ 82DB74E .incbin "baserom.gba", 0x2db74e, 0x6 -gUnknown_082DB754:: @ 82DB754 +BattleScript_BerryCureFrzRet:: @ 82DB754 .incbin "baserom.gba", 0x2db754, 0x12 -gUnknown_082DB766:: @ 82DB766 +BattleScript_BerryCureSlpEnd2:: @ 82DB766 .incbin "baserom.gba", 0x2db766, 0x6 -gUnknown_082DB76C:: @ 82DB76C +BattleScript_BerryCureSlpRet:: @ 82DB76C .incbin "baserom.gba", 0x2db76c, 0x12 -gUnknown_082DB77E:: @ 82DB77E +BattleScript_BerryCureConfusionEnd2:: @ 82DB77E .incbin "baserom.gba", 0x2db77e, 0x6 -gUnknown_082DB784:: @ 82DB784 +BattleScript_BerryCureConfusionRet:: @ 82DB784 .incbin "baserom.gba", 0x2db784, 0x10 -gUnknown_082DB794:: @ 82DB794 +BattleScript_BerryCureChosenStatusEnd2:: @ 82DB794 .incbin "baserom.gba", 0x2db794, 0x6 -gUnknown_082DB79A:: @ 82DB79A +BattleScript_BerryCureChosenStatusRet:: @ 82DB79A .incbin "baserom.gba", 0x2db79a, 0x14 -gUnknown_082DB7AE:: @ 82DB7AE +BattleScript_WhiteHerbEnd2:: @ 82DB7AE .incbin "baserom.gba", 0x2db7ae, 0x6 -gUnknown_082DB7B4:: @ 82DB7B4 +BattleScript_WhiteHerbRet:: @ 82DB7B4 .incbin "baserom.gba", 0x2db7b4, 0x10 -gUnknown_082DB7C4:: @ 82DB7C4 +BattleScript_ItemHealHP_RemoveItem:: @ 82DB7C4 .incbin "baserom.gba", 0x2db7c4, 0x1d -gUnknown_082DB7E1:: @ 82DB7E1 +BattleScript_BerryPPHealEnd2:: @ 82DB7E1 .incbin "baserom.gba", 0x2db7e1, 0x10 -gUnknown_082DB7F1:: @ 82DB7F1 +BattleScript_ItemHealHP_End2:: @ 82DB7F1 .incbin "baserom.gba", 0x2db7f1, 0x6 -gUnknown_082DB7F7:: @ 82DB7F7 +BattleScript_ItemHealHP_Ret:: @ 82DB7F7 .incbin "baserom.gba", 0x2db7f7, 0x1b gUnknown_082DB812:: @ 82DB812 @@ -519,13 +519,13 @@ gUnknown_082DB812:: @ 82DB812 gUnknown_082DB816:: @ 82DB816 .incbin "baserom.gba", 0x2db816, 0xe -gUnknown_082DB824:: @ 82DB824 +BattleScript_BerryConfuseHealEnd2:: @ 82DB824 .incbin "baserom.gba", 0x2db824, 0x2a -gUnknown_082DB84E:: @ 82DB84E +BattleScript_BerryStatRaiseEnd2:: @ 82DB84E .incbin "baserom.gba", 0x2db84e, 0x1b -gUnknown_082DB869:: @ 82DB869 +BattleScript_BerryFocusEnergyEnd2:: @ 82DB869 .incbin "baserom.gba", 0x2db869, 0x10 gUnknown_082DB879:: @ 82DB879 diff --git a/data/data2b.s b/data/data2b.s index 28d34f79b..1499c51fe 100644 --- a/data/data2b.s +++ b/data/data2b.s @@ -227,25 +227,25 @@ gUnknown_0831BC0C:: @ 831BC0C gUnknown_0831BC44:: @ 831BC44 .incbin "baserom.gba", 0x31bc44, 0x2c -gUnknown_0831BC70:: @ 831BC70 +gStatusConditionString_PoisonJpn:: @ 831BC70 .incbin "baserom.gba", 0x31bc70, 0x8 -gUnknown_0831BC78:: @ 831BC78 +gStatusConditionString_SleepJpn:: @ 831BC78 .incbin "baserom.gba", 0x31bc78, 0x8 -gUnknown_0831BC80:: @ 831BC80 +gStatusConditionString_ParalysisJpn:: @ 831BC80 .incbin "baserom.gba", 0x31bc80, 0x8 -gUnknown_0831BC88:: @ 831BC88 +gStatusConditionString_BurnJpn:: @ 831BC88 .incbin "baserom.gba", 0x31bc88, 0x8 -gUnknown_0831BC90:: @ 831BC90 +gStatusConditionString_IceJpn:: @ 831BC90 .incbin "baserom.gba", 0x31bc90, 0x8 -gUnknown_0831BC98:: @ 831BC98 +gStatusConditionString_ConfusionJpn:: @ 831BC98 .incbin "baserom.gba", 0x31bc98, 0x8 -gUnknown_0831BCA0:: @ 831BCA0 +gStatusConditionString_LoveJpn:: @ 831BCA0 .incbin "baserom.gba", 0x31bca0, 0x8 gUnknown_0831BCA8:: @ 831BCA8 @@ -260,6 +260,6 @@ gUnknown_0831BCEF:: @ 831BCEF gUnknown_0831BCF3:: @ 831BCF3 .incbin "baserom.gba", 0x31bcf3, 0x5 -gUnknown_0831BCF8:: @ 831BCF8 +gSoundMovesTable:: @ 831BCF8 .incbin "baserom.gba", 0x31bcf8, 0x18 diff --git a/include/battle.h b/include/battle.h index 51f9298cc..4093f55d1 100644 --- a/include/battle.h +++ b/include/battle.h @@ -1,6 +1,8 @@ #ifndef GUARD_BATTLE_H #define GUARD_BATTLE_H +#define BATTLE_BANKS_COUNT 4 + #define BATTLE_TYPE_DOUBLE 0x0001 #define BATTLE_TYPE_LINK 0x0002 #define BATTLE_TYPE_WILD 0x0004 @@ -24,6 +26,7 @@ #define BATTLE_TYPE_x100000 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_x4000000 0x4000000 @@ -135,26 +138,26 @@ #define SIDE_STATUS_MIST (1 << 8) #define SIDE_STATUS_SPIKES_DAMAGED (1 << 9) -#define ABILITYEFFECT_ON_SWITCHIN 0x0 -#define ABILITYEFFECT_ENDTURN 0x1 -#define ABILITYEFFECT_MOVES_BLOCK 0x2 -#define ABILITYEFFECT_ABSORBING 0x3 -#define ABILITYEFFECT_CONTACT 0x4 -#define ABILITYEFFECT_IMMUNITY 0x5 -#define ABILITYEFFECT_FORECAST 0x6 -#define ABILITYEFFECT_SYNCHRONIZE 0x7 -#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x8 -#define ABILITYEFFECT_INTIMIDATE1 0x9 -#define ABILITYEFFECT_INTIMIDATE2 0xA -#define ABILITYEFFECT_TRACE 0xB -#define ABILITYEFFECT_CHECK_OTHER_SIDE 0xC -#define ABILITYEFFECT_CHECK_BANK_SIDE 0xD -#define ABILITYEFFECT_FIELD_SPORT 0xE +#define ABILITYEFFECT_ON_SWITCHIN 0x0 +#define ABILITYEFFECT_ENDTURN 0x1 +#define ABILITYEFFECT_MOVES_BLOCK 0x2 +#define ABILITYEFFECT_ABSORBING 0x3 +#define ABILITYEFFECT_CONTACT 0x4 +#define ABILITYEFFECT_IMMUNITY 0x5 +#define ABILITYEFFECT_FORECAST 0x6 +#define ABILITYEFFECT_SYNCHRONIZE 0x7 +#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x8 +#define ABILITYEFFECT_INTIMIDATE1 0x9 +#define ABILITYEFFECT_INTIMIDATE2 0xA +#define ABILITYEFFECT_TRACE 0xB +#define ABILITYEFFECT_CHECK_OTHER_SIDE 0xC +#define ABILITYEFFECT_CHECK_BANK_SIDE 0xD +#define ABILITYEFFECT_FIELD_SPORT 0xE #define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK 0xF -#define ABILITYEFFECT_COUNT_OTHER_SIZE 0x10 -#define ABILITYEFFECT_COUNT_BANK_SIDE 0x11 -#define ABILITYEFFECT_COUNT_ON_FIELD 0x12 -#define ABILITYEFFECT_CHECK_ON_FIELD 0x13 +#define ABILITYEFFECT_COUNT_OTHER_SIZE 0x10 +#define ABILITYEFFECT_COUNT_BANK_SIDE 0x11 +#define ABILITYEFFECT_COUNT_ON_FIELD 0x12 +#define ABILITYEFFECT_CHECK_ON_FIELD 0x13 #define WEATHER_HAS_EFFECT ((!AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_AIR_LOCK, 0, 0))) @@ -171,7 +174,6 @@ #define MAX_TRAINER_ITEMS 4 #define MAX_MON_MOVES 4 -#define MAX_BANKS_BATTLE 4 #define WEATHER_RAIN_TEMPORARY (1 << 0) #define WEATHER_RAIN_DOWNPOUR (1 << 1) @@ -186,8 +188,26 @@ #define WEATHER_HAIL (1 << 7) #define WEATHER_HAIL_ANY ((WEATHER_HAIL)) -u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg); -u8 GetBankSide(u8 bank); +#define REQUEST_ALL_BATTLE 0x0 +#define REQUEST_SPECIES_BATTLE 0x1 +#define REQUEST_HELDITEM_BATTLE 0x2 +#define REQUEST_MOVES_PP_BATTLE 0x3 +#define REQUEST_PPMOVE1_BATTLE 0x9 +#define REQUEST_PPMOVE2_BATTLE 0xA +#define REQUEST_PPMOVE3_BATTLE 0xB +#define REQUEST_PPMOVE4_BATTLE 0xC +#define REQUEST_STATUS_BATTLE 0x28 +#define REQUEST_HP_BATTLE 0x2A + +// array entries for battle communication +#define MOVE_EFFECT_BYTE 0x3 +#define MULTISTRING_CHOOSER 0x5 +#define MSG_DISPLAY 0x7 + +// functions + +extern u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg); +extern u8 GetBankSide(u8 bank); struct Trainer { @@ -248,9 +268,102 @@ struct DisableStruct /*0x1A*/ u8 unk1A[2]; }; -extern struct DisableStruct gDisableStructs[]; +extern struct DisableStruct gDisableStructs[BATTLE_BANKS_COUNT]; + +struct ProtectStruct +{ + /* field_0 */ + u32 protected:1; + u32 endured:1; + u32 onlyStruggle:1; + u32 helpingHand:1; + u32 bounceMove:1; + u32 stealMove:1; + u32 flag0Unknown:1; + u32 prlzImmobility:1; + /* field_1 */ + u32 confusionSelfDmg:1; + u32 notEffective:1; + u32 chargingTurn:1; + u32 fleeFlag:2; // for RunAway and Smoke Ball + u32 usedImprisionedMove:1; + u32 loveImmobility:1; + u32 usedDisabledMove:1; + /* field_2 */ + u32 usedTauntedMove:1; // 0x1 + u32 flag2Unknown:1; // 0x2 + u32 flinchImmobility:1; // 0x4 + u32 notFirstStrike:1; // 0x8 + u32 flag_x10 : 1; // 0x10 + u32 flag_x20 : 1; // 0x20 + u32 flag_x40 : 1; // 0x40 + u32 flag_x80 : 1; // 0x80 + /* field_3 */ + u32 field3 : 8; + + /* field_4 */ u32 physicalDmg; + /* field_8 */ u32 specialDmg; + /* field_C */ u8 physicalBank; + /* field_D */ u8 specialBank; + /* field_E */ u16 fieldE; +}; + +extern struct ProtectStruct gProtectStructs[BATTLE_BANKS_COUNT]; + +struct SpecialStatus +{ + u8 statLowered : 1; + u8 lightningRodRedirected : 1; + u8 restoredBankSprite: 1; + u8 intimidatedPoke : 1; + u8 traced : 1; + u8 flag20 : 1; + u8 flag40 : 1; + u8 focusBanded : 1; + u8 field1[3]; + s32 moveturnLostHP; + s32 moveturnLostHP_physical; + s32 moveturnLostHP_special; + u8 moveturnPhysicalBank; + u8 moveturnSpecialBank; + u8 field12; + u8 field13; +}; + +extern struct SpecialStatus gSpecialStatuses[BATTLE_BANKS_COUNT]; + +struct SideTimer +{ + /*0x00*/ u8 reflectTimer; + /*0x01*/ u8 reflectBank; + /*0x02*/ u8 lightscreenTimer; + /*0x03*/ u8 lightscreenBank; + /*0x04*/ u8 mistTimer; + /*0x05*/ u8 mistBank; + /*0x06*/ u8 safeguardTimer; + /*0x07*/ u8 safeguardBank; + /*0x08*/ u8 followmeTimer; + /*0x09*/ u8 followmeTarget; + /*0x0A*/ u8 spikesAmount; + /*0x0B*/ u8 fieldB; +}; + +extern struct SideTimer gSideTimers[]; + +struct WishFutureKnock +{ + u8 futureSightCounter[BATTLE_BANKS_COUNT]; + u8 futureSightAttacker[BATTLE_BANKS_COUNT]; + s32 futureSightDmg[BATTLE_BANKS_COUNT]; + u16 futureSightMove[BATTLE_BANKS_COUNT]; + u8 wishCounter[BATTLE_BANKS_COUNT]; + u8 wishUserID[BATTLE_BANKS_COUNT]; + u8 weatherDuration; + u16 knockedOffPokes; +}; + +extern struct WishFutureKnock gWishFutureKnock; -//size should be 0x1C struct AI_ThinkingStruct { u8 aiState; @@ -267,23 +380,28 @@ struct AI_ThinkingStruct struct UsedMoves { - u16 moves[4]; - u16 unknown[4]; + u16 moves[BATTLE_BANKS_COUNT]; + u16 unknown[BATTLE_BANKS_COUNT]; }; -//size should be 0x54 struct BattleHistory { - struct UsedMoves usedMoves[4]; - u8 abilities[4]; - u8 itemEffects[4]; - u16 TrainerItems[4]; + struct UsedMoves usedMoves[BATTLE_BANKS_COUNT]; + u8 abilities[BATTLE_BANKS_COUNT]; + u8 itemEffects[BATTLE_BANKS_COUNT]; + u16 TrainerItems[BATTLE_BANKS_COUNT]; u8 itemsNo; }; struct BattleScriptsStack { - u8 *ptr[8]; + const u8 *ptr[8]; + u8 size; +}; + +struct BattleCallbacksStack +{ + void (*function[8])(void); u8 size; }; @@ -292,7 +410,7 @@ struct BattleResources struct SecretBaseRecord* secretBase; struct UnknownFlags *flags; struct BattleScriptsStack* battleScriptsStack; - void* battleCallbackStack; + struct BattleCallbacksStack* battleCallbackStack; void* statsBeforeLvlUp; struct AI_ThinkingStruct *ai; struct BattleHistory *battleHistory; @@ -301,6 +419,9 @@ struct BattleResources extern struct BattleResources* gBattleResources; +#define BATTLESCRIPTS_STACK (gBattleResources->battleScriptsStack) +#define BATTLE_CALLBACKS_STACK (gBattleResources->battleCallbackStack) + struct BattleResults { u8 playerFaintCounter; // 0x0 @@ -331,12 +452,11 @@ extern struct BattleResults gBattleResults; struct BattleStruct { - u8 field_1; - u8 field_2; - u8 field_3; - u8 field_4; - u8 wrappedMove1[4]; - u8 wrappedMove2[4]; + u8 turnEffectsTracker; + u8 turnEffectsBank; + u8 filler2; + u8 turncountersTracker; + u8 wrappedMove[8]; // ask gamefreak why they declared it that way u8 moveTarget[4]; u8 expGetterId; u8 field_11; @@ -393,7 +513,7 @@ struct BattleStruct u8 field_47; u8 field_48; u8 field_49; - u8 field_4A; + u8 moneyMultiplier; u8 field_4B; u8 field_4C; u8 field_4D; @@ -411,10 +531,7 @@ struct BattleStruct u8 field_59; u8 field_5A; u8 field_5B; - u8 field_5C; - u8 field_5D; - u8 field_5E; - u8 field_5F; + u8 field_5C[4]; u8 field_60; u8 field_61; u8 field_62; @@ -494,10 +611,31 @@ struct BattleStruct u8 field_B6; u8 field_B7; u16 usedHeldItems[4]; + u8 field_C0[8]; + u16 choicedMove[4]; + u8 field_D0[8]; + u8 intimidateBank; + u8 fillerD9[0xDA-0xD9]; + u8 field_DA; + u8 turnSideTracker; + u8 fillerDC[0xDF-0xDC]; + u8 field_DF; + u8 fillerE0[0x1A0-0xE0]; + u8 field_1A0; + u8 field_1A1; + u8 filler1A2; + u8 atkCancellerTracker; }; extern struct BattleStruct* gBattleStruct; +#define MEME_ACCESS_U8(structName, structPtr, arrayId, offsetField, value) \ +{ \ + u8* var2 = (u8*)((u32)(arrayId)); \ + var2 = (u32)(structPtr) + var2; \ + var2[offsetof(struct structName, offsetField)] = value; \ +} + struct BattleScripting { u8 field_0; @@ -513,6 +651,17 @@ struct BattleScripting u8 field_D; u8 dmgMultiplier; u8 field_F; + u8 animArg1; + u8 animArg2; + u8 field_12; + u8 field_13; + u8 atk49_state; + u8 field_15; + u8 field_16; + u8 bank; + u8 field_18; + u8 field_19; + u8 statChanger; }; extern struct BattleScripting gBattleScripting; diff --git a/include/hall_of_fame.h b/include/hall_of_fame.h new file mode 100644 index 000000000..62e84c39e --- /dev/null +++ b/include/hall_of_fame.h @@ -0,0 +1,9 @@ +#ifndef GUARD_HALL_OF_FAME_H +#define GUARD_HALL_OF_FAME_H + +void sub_8141F90(void); +void sub_8143648(u16 paletteTag, u8 arg1); +void sub_81428CC(void); +void sub_8143680(int, u8); + +#endif // GUARD_HALL_OF_FAME_H diff --git a/include/pokemon.h b/include/pokemon.h index 3472da04b..9d01c051e 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -439,6 +439,12 @@ struct BattleMove u8 flags; }; +#define FLAG_MAKES_CONTACT 0x1 +#define FLAG_PROTECT_AFFECTED 0x2 +#define FLAG_MAGICCOAT_AFFECTED 0x4 +#define FLAG_SNATCH_AFFECTED 0x8 +#define FLAG_KINGSROCK_AFFECTED 0x20 + struct SpindaSpot { u8 x, y; diff --git a/ld_script.txt b/ld_script.txt index 9b0384427..826e3d4b2 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -58,7 +58,7 @@ SECTIONS { src/decompress.o(.text); asm/battle_1.o(.text); asm/battle_2.o(.text); - asm/battle_3.o(.text); + src/battle_3.o(.text); src/battle_4.o(.text); asm/battle_4.o(.text); asm/battle_5.o(.text); diff --git a/src/battle_3.c b/src/battle_3.c new file mode 100644 index 000000000..a2ddd1c2d --- /dev/null +++ b/src/battle_3.c @@ -0,0 +1,6431 @@ +#include "global.h" +#include "battle.h" +#include "abilities.h" +#include "moves.h" +#include "hold_effects.h" +#include "pokemon.h" +#include "species.h" +#include "item.h" +#include "items.h" +#include "util.h" +#include "battle_move_effects.h" +#include "rng.h" +#include "text.h" +#include "string_util.h" +#include "battle_message.h" +#include "battle_ai.h" +#include "event_data.h" + +extern const u8* gBattlescriptCurrInstr; +extern const u8* gUnknown_02024220[BATTLE_BANKS_COUNT]; +extern const u8* gUnknown_02024230[BATTLE_BANKS_COUNT]; +extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; +extern u8 gActiveBank; +extern u8 gStringBank; +extern u16 gCurrentMove; +extern u16 gLastUsedItem; +extern u8 gNoOfAllBanks; +extern u32 gStatuses3[BATTLE_BANKS_COUNT]; +extern u8 gBankAttacker; +extern u8 gBankTarget; +extern u8 gAbsentBankFlags; +extern u16 gBattleWeather; +extern u8 gTurnOrder[BATTLE_BANKS_COUNT]; +extern u16 gSideAffecting[]; +extern u8 gBattleCommunication[]; +extern void (*gBattleMainFunc)(void); +extern s32 gBattleMoveDamage; +extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT]; +extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; +extern u32 gBattleTypeFlags; +extern u16 gLastUsedMovesByBanks[BATTLE_BANKS_COUNT]; +extern u32 gHitMarker; +extern u8 gEffectBank; +extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; +extern u8 gBank1; +extern u16 gChosenMovesByBanks[]; +extern u8 gBattleMoveFlags; +extern s32 gTakenDmg[BATTLE_BANKS_COUNT]; +extern u8 gTakenDmgBanks[BATTLE_BANKS_COUNT]; +extern u8 gLastUsedAbility; +extern u8 gFightStateTracker; +extern u32 gBattleExecBuffer; +extern u16 gRandomMove; +extern u8 gCurrMovePos; +extern u8 gUnknown_020241E9; + +extern const struct BattleMove gBattleMoves[]; +extern void (* const gBattleScriptingCommandsTable[])(void); + +// scripts +extern const u8 gUnknown_082DAE2A[]; +extern const u8 gUnknown_082DAE1F[]; +extern const u8 gUnknown_082DB089[]; +extern const u8 gUnknown_082DB098[]; +extern const u8 gUnknown_082DB0AF[]; +extern const u8 gUnknown_082DB0A0[]; +extern const u8 gUnknown_082DB185[]; +extern const u8 gUnknown_082DB181[]; +extern const u8 gUnknown_082DB812[]; +extern const u8 gUnknown_082DB076[]; +extern const u8 BattleScript_NoMovesLeft[]; +extern const u8 gUnknown_082DACFA[]; +extern const u8 gUnknown_082DAD0B[]; +extern const u8 gUnknown_082DACC9[]; +extern const u8 gUnknown_082DAC47[]; +extern const u8 gUnknown_082DACE0[]; +extern const u8 gUnknown_082DACD2[]; +extern const u8 BattleScript_WishComesTrue[]; +extern const u8 gUnknown_082DACC9[]; +extern const u8 gUnknown_082DAC2C[]; +extern const u8 BattleScript_IngrainTurnHeal[]; +extern const u8 BattleScript_LeechSeedTurnDrain[]; +extern const u8 BattleScript_PoisonTurnDmg[]; +extern const u8 BattleScript_BurnTurnDmg[]; +extern const u8 BattleScript_NightmareTurnDmg[]; +extern const u8 BattleScript_CurseTurnDmg[]; +extern const u8 BattleScript_WrapTurnDmg[]; +extern const u8 BattleScript_WrapEnds[]; +extern const u8 gUnknown_082DB234[]; +extern const u8 gUnknown_082DB2A6[]; +extern const u8 BattleScript_ThrashConfuses[]; +extern const u8 BattleScript_DisabledNoMore[]; +extern const u8 BattleScript_EncoredNoMore[]; +extern const u8 BattleScript_YawnMakesAsleep[]; +extern const u8 gUnknown_082DAFE4[]; +extern const u8 gUnknown_082DB8F3[]; +extern const u8 gUnknown_082DAF05[]; +extern const u8 gUnknown_082DAF20[]; +extern const u8 gUnknown_082DA7C4[]; +extern const u8 gUnknown_082DA7CD[]; +extern const u8 BattleScript_MoveUsedWokeUp[]; +extern const u8 BattleScript_MoveUsedIsAsleep[]; +extern const u8 BattleScript_MoveUsedIsFrozen[]; +extern const u8 BattleScript_MoveUsedUnfroze[]; +extern const u8 BattleScript_MoveUsedLoafingAround[]; +extern const u8 BattleScript_MoveUsedMustRecharge[]; +extern const u8 BattleScript_MoveUsedFlinched[]; +extern const u8 BattleScript_MoveUsedIsDisabled[]; +extern const u8 BattleScript_MoveUsedIsTaunted[]; +extern const u8 BattleScript_MoveUsedIsImprisoned[]; +extern const u8 BattleScript_MoveUsedIsConfused[]; +extern const u8 BattleScript_MoveUsedIsConfusedNoMore[]; +extern const u8 BattleScript_MoveUsedIsParalyzed[]; +extern const u8 BattleScript_MoveUsedIsParalyzedCantAttack[]; +extern const u8 BattleScript_MoveUsedIsInLove[]; +extern const u8 BattleScript_BideStoringEnergy[]; +extern const u8 BattleScript_BideAttack[]; +extern const u8 BattleScript_BideNoEnergyToAttack[]; +extern const u8 gUnknown_082DACE7[]; +extern const u8 BattleScript_DrizzleActivates[]; +extern const u8 BattleScript_SandstreamActivates[]; +extern const u8 BattleScript_DroughtActivates[]; +extern const u8 BattleScript_CastformChange[]; +extern const u8 BattleScript_RainDishActivates[]; +extern const u8 BattleScript_ShedSkinActivates[]; +extern const u8 BattleScript_SpeedBoostActivates[]; +extern const u8 BattleScript_SoundproofProtected[]; +extern const u8 BattleScript_MoveHPDrain[]; +extern const u8 BattleScript_MoveHPDrain_PPLoss[]; +extern const u8 BattleScript_FlashFireBoost[]; +extern const u8 BattleScript_FlashFireBoost_PPLoss[]; +extern const u8 BattleScript_ColorChangeActivates[]; +extern const u8 BattleScript_RoughSkinActivates[]; +extern const u8 BattleScript_ApplySecondaryEffect[]; +extern const u8 BattleScript_CuteCharmActivates[]; +extern const u8 gUnknown_082DB68C[]; +extern const u8 BattleScript_SynchronizeActivates[]; +extern const u8 gUnknown_082DB4B8[]; +extern const u8 gUnknown_082DB4C1[]; +extern const u8 BattleScript_TraceActivates[]; + +extern const u8 BattleScript_WhiteHerbEnd2[]; +extern const u8 BattleScript_WhiteHerbRet[]; +extern const u8 BattleScript_ItemHealHP_RemoveItem[]; +extern const u8 BattleScript_BerryPPHealEnd2[]; +extern const u8 BattleScript_ItemHealHP_End2[]; +extern const u8 BattleScript_BerryConfuseHealEnd2[]; +extern const u8 BattleScript_BerryStatRaiseEnd2[]; +extern const u8 BattleScript_BerryFocusEnergyEnd2[]; +extern const u8 BattleScript_BerryCurePrlzEnd2[]; +extern const u8 BattleScript_BerryCurePsnEnd2[]; +extern const u8 BattleScript_BerryCureBrnEnd2[]; +extern const u8 BattleScript_BerryCureFrzEnd2[]; +extern const u8 BattleScript_BerryCureSlpEnd2[]; +extern const u8 BattleScript_BerryCureConfusionEnd2[]; +extern const u8 BattleScript_BerryCureChosenStatusEnd2[]; +extern const u8 BattleScript_BerryCureParRet[]; +extern const u8 BattleScript_BerryCurePsnRet[]; +extern const u8 BattleScript_BerryCureBrnRet[]; +extern const u8 BattleScript_BerryCureFrzRet[]; +extern const u8 BattleScript_BerryCureSlpRet[]; +extern const u8 BattleScript_BerryCureConfusionRet[]; +extern const u8 BattleScript_BerryCureChosenStatusRet[]; +extern const u8 BattleScript_ItemHealHP_Ret[]; + +extern const u8 gUnknown_082DB695[]; //disobedient while asleep +extern const u8 gUnknown_082DB6A5[]; //disobedient, uses a random move +extern const u8 gUnknown_082DB6D9[]; //disobedient, went to sleep +extern const u8 gUnknown_082DB6F0[]; //disobedient, hits itself + +extern const u8 gStatusConditionString_PoisonJpn[]; +extern const u8 gStatusConditionString_SleepJpn[]; +extern const u8 gStatusConditionString_ParalysisJpn[]; +extern const u8 gStatusConditionString_BurnJpn[]; +extern const u8 gStatusConditionString_IceJpn[]; +extern const u8 gStatusConditionString_ConfusionJpn[]; +extern const u8 gStatusConditionString_LoveJpn[]; +extern const u16 gSoundMovesTable[]; + +extern void CancelMultiTurnMoves(u8 bank); +extern u8 b_first_side(u8, u8, u8); +extern void sub_803CEDC(u8, u8); +extern void b_call_bc_move_exec(const u8 *); +extern void BattleTurnPassed(void); +extern void EmitSetAttributes(u8 a, u8 request, u8 c, u8 bytes, void *data); +extern void SetMoveEffect(bool8 primary, u8 certainArg); +extern bool8 UproarWakeUpCheck(u8 bank); +extern void MarkBufferBankForExecution(u8 bank); +extern u8 sub_803F90C(u8 bank); +extern u8 GetBankIdentity(u8); +extern void sub_803F9EC(); +extern bool8 sub_80423F4(u8 bank, u8, u8); +extern s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideFlags, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef); +extern u8 GetBankByPlayerAI(u8); +extern u8 sub_806D864(u8); +extern u8 sub_806D82C(u8); +extern u8 weather_get_current(void); +extern void sub_803E08C(void); +extern void bc_move_exec_returning(void); +extern s8 GetFlavourRelationByPersonality(u32 personality, u8 flavor); + +u8 IsImprisoned(u8 bank, u16 move); +u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn); +u8 GetMoveTarget(u16 move, u8 useMoveTarget); +void b_push_move_exec(const u8* BS_ptr); + +void b_movescr_stack_push(const u8* bsPtr) +{ + BATTLESCRIPTS_STACK->ptr[BATTLESCRIPTS_STACK->size++] = bsPtr; +} + +void b_movescr_stack_push_cursor(void) +{ + BATTLESCRIPTS_STACK->ptr[BATTLESCRIPTS_STACK->size++] = gBattlescriptCurrInstr; +} + +void b_movescr_stack_pop_cursor(void) +{ + gBattlescriptCurrInstr = BATTLESCRIPTS_STACK->ptr[--BATTLESCRIPTS_STACK->size]; +} + +u8 sub_803FB4C(void) // msg, can't select a move +{ + u8 limitations = 0; + u16 move = gBattleMons[gActiveBank].moves[gBattleBufferB[gActiveBank][2]]; + u8 holdEffect; + u16* choicedMove = &gBattleStruct->choicedMove[gActiveBank]; + + if (gDisableStructs[gActiveBank].disabledMove == move && move != 0) + { + gBattleScripting.bank = gActiveBank; + gCurrentMove = move; + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gUnknown_02024230[gActiveBank] = gUnknown_082DAE2A; + gProtectStructs[gActiveBank].flag_x10 = 1; + } + else + { + gUnknown_02024220[gActiveBank] = gUnknown_082DAE1F; + limitations = 1; + } + } + + if (move == gLastUsedMovesByBanks[gActiveBank] && move != MOVE_STRUGGLE && (gBattleMons[gActiveBank].status2 & STATUS2_TORMENT)) + { + CancelMultiTurnMoves(gActiveBank); + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gUnknown_02024230[gActiveBank] = gUnknown_082DB098; + gProtectStructs[gActiveBank].flag_x10 = 1; + } + else + { + gUnknown_02024220[gActiveBank] = gUnknown_082DB089; + limitations++; + } + } + + if (gDisableStructs[gActiveBank].tauntTimer1 != 0 && gBattleMoves[move].power == 0) + { + gCurrentMove = move; + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gUnknown_02024230[gActiveBank] = gUnknown_082DB0AF; + gProtectStructs[gActiveBank].flag_x10 = 1; + } + else + { + gUnknown_02024220[gActiveBank] = gUnknown_082DB0A0; + limitations++; + } + } + + if (IsImprisoned(gActiveBank, move)) + { + gCurrentMove = move; + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gUnknown_02024230[gActiveBank] = gUnknown_082DB185; + gProtectStructs[gActiveBank].flag_x10 = 1; + } + else + { + gUnknown_02024220[gActiveBank] = gUnknown_082DB181; + limitations++; + } + } + + if (gBattleMons[gActiveBank].item == ITEM_ENIGMA_BERRY) + holdEffect = gEnigmaBerries[gActiveBank].holdEffect; + else + holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBank].item); + + gStringBank = gActiveBank; + + if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move) + { + gCurrentMove = *choicedMove; + gLastUsedItem = gBattleMons[gActiveBank].item; + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gProtectStructs[gActiveBank].flag_x10 = 1; + } + else + { + gUnknown_02024220[gActiveBank] = gUnknown_082DB812; + limitations++; + } + } + + if (gBattleMons[gActiveBank].pp[gBattleBufferB[gActiveBank][2]] == 0) + { + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gProtectStructs[gActiveBank].flag_x10 = 1; + } + else + { + gUnknown_02024220[gActiveBank] = gUnknown_082DB076; + limitations++; + } + } + + return limitations; +} + +#define MOVE_LIMITATION_ZEROMOVE (1 << 0) +#define MOVE_LIMITATION_PP (1 << 1) +#define MOVE_LIMITATION_DISABLED (1 << 2) +#define MOVE_LIMITATION_TORMENTED (1 << 3) +#define MOVE_LIMITATION_TAUNT (1 << 4) +#define MOVE_LIMITATION_IMPRISION (1 << 5) + +u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check) +{ + u8 holdEffect; + u16* choicedMove = &gBattleStruct->choicedMove[bank]; + s32 i; + + if (gBattleMons[bank].item == ITEM_ENIGMA_BERRY) + holdEffect = gEnigmaBerries[bank].holdEffect; + else + holdEffect = ItemId_GetHoldEffect(gBattleMons[bank].item); + + gStringBank = bank; + + for (i = 0; i < BATTLE_BANKS_COUNT; i++) + { + if (gBattleMons[bank].moves[i] == 0 && check & MOVE_LIMITATION_ZEROMOVE) + unusableMoves |= gBitTable[i]; + if (gBattleMons[bank].pp[i] == 0 && check & MOVE_LIMITATION_PP) + unusableMoves |= gBitTable[i]; + if (gBattleMons[bank].moves[i] == gDisableStructs[bank].disabledMove && check & MOVE_LIMITATION_DISABLED) + unusableMoves |= gBitTable[i]; + if (gBattleMons[bank].moves[i] == gLastUsedMovesByBanks[bank] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[bank].status2 & STATUS2_TORMENT) + unusableMoves |= gBitTable[i]; + if (gDisableStructs[bank].tauntTimer1 && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[bank].moves[i]].power == 0) + unusableMoves |= gBitTable[i]; + if (IsImprisoned(bank, gBattleMons[bank].moves[i]) && check & MOVE_LIMITATION_IMPRISION) + unusableMoves |= gBitTable[i]; + if (gDisableStructs[bank].encoreTimer1 && gDisableStructs[bank].encoredMove != gBattleMons[bank].moves[i]) + unusableMoves |= gBitTable[i]; + if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != gBattleMons[bank].moves[i]) + unusableMoves |= gBitTable[i]; + } + return unusableMoves; +} + +bool8 AreAllMovesUnusable(void) +{ + u8 unusable; + unusable = CheckMoveLimitations(gActiveBank, 0, 0xFF); + + if (unusable == 0xF) // all moves are unusable + { + gProtectStructs[gActiveBank].onlyStruggle = 1; + gUnknown_02024220[gActiveBank] = BattleScript_NoMovesLeft; + } + else + { + gProtectStructs[gActiveBank].onlyStruggle = 0; + } + + return (unusable == 0xF); +} + +u8 IsImprisoned(u8 bank, u16 move) +{ + s32 i; + u8 imprisionedMoves = 0; + u8 bankSide = GetBankSide(bank); + + for (i = 0; i < gNoOfAllBanks; i++) + { + if (bankSide != GetBankSide(i) && gStatuses3[i] & STATUS3_IMPRISIONED) + { + s32 j; + for (j = 0; j < 4; j++) + { + if (move == gBattleMons[i].moves[j]) + break; + } + if (j < 4) + imprisionedMoves++; + } + } + + return imprisionedMoves; +} + +u8 UpdateTurnCounters(void) +{ + u8 effect = 0; + s32 i; + + for (gBankAttacker = 0; gBankAttacker < gNoOfAllBanks && gAbsentBankFlags & gBitTable[gBankAttacker]; gBankAttacker++) + { + } + for (gBankTarget = 0; gBankTarget < gNoOfAllBanks && gAbsentBankFlags & gBitTable[gBankTarget]; gBankTarget++) + { + } + + do + { + u8 sideBank; + + switch (gBattleStruct->turncountersTracker) + { + case 0: + for (i = 0; i < gNoOfAllBanks; i++) + { + gTurnOrder[i] = i; + } + for (i = 0; i < gNoOfAllBanks - 1; i++) + { + s32 j; + for (j = i + 1; j < gNoOfAllBanks; j++) + { + if (b_first_side(gTurnOrder[i], gTurnOrder[j], 0)) + sub_803CEDC(i, j); + } + } + + // It's stupid, but won't match without it + { + u8* var = &gBattleStruct->turncountersTracker; + (*var)++; + gBattleStruct->turnSideTracker = 0; + } + // fall through + case 1: + while (gBattleStruct->turnSideTracker < 2) + { + sideBank = gBattleStruct->turnSideTracker; + gActiveBank = gBankAttacker = gSideTimers[sideBank].reflectBank; + if (gSideAffecting[sideBank] & SIDE_STATUS_REFLECT) + { + if (--gSideTimers[sideBank].reflectTimer == 0) + { + gSideAffecting[sideBank] &= ~SIDE_STATUS_REFLECT; + b_call_bc_move_exec(gUnknown_082DACFA); + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 2; + gBattleTextBuff1[2] = MOVE_REFLECT; + gBattleTextBuff1[3] = MOVE_REFLECT >> 8; + gBattleTextBuff1[4] = EOS; + effect++; + } + } + gBattleStruct->turnSideTracker++; + if (effect) + break; + } + if (!effect) + { + gBattleStruct->turncountersTracker++; + gBattleStruct->turnSideTracker = 0; + } + break; + case 2: + while (gBattleStruct->turnSideTracker < 2) + { + sideBank = gBattleStruct->turnSideTracker; + gActiveBank = gBankAttacker = gSideTimers[sideBank].lightscreenBank; + if (gSideAffecting[sideBank] & SIDE_STATUS_LIGHTSCREEN) + { + if (--gSideTimers[sideBank].lightscreenTimer == 0) + { + gSideAffecting[sideBank] &= ~SIDE_STATUS_LIGHTSCREEN; + b_call_bc_move_exec(gUnknown_082DACFA); + gBattleCommunication[MULTISTRING_CHOOSER] = sideBank; + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 2; + gBattleTextBuff1[2] = MOVE_LIGHT_SCREEN; + gBattleTextBuff1[3] = MOVE_LIGHT_SCREEN >> 8; + gBattleTextBuff1[4] = EOS; + effect++; + } + } + gBattleStruct->turnSideTracker++; + if (effect) + break; + } + if (!effect) + { + gBattleStruct->turncountersTracker++; + gBattleStruct->turnSideTracker = 0; + } + break; + case 3: + while (gBattleStruct->turnSideTracker < 2) + { + sideBank = gBattleStruct->turnSideTracker; + gActiveBank = gBankAttacker = gSideTimers[sideBank].mistBank; + if (gSideTimers[sideBank].mistTimer != 0 + && --gSideTimers[sideBank].mistTimer == 0) + { + gSideAffecting[sideBank] &= ~SIDE_STATUS_MIST; + b_call_bc_move_exec(gUnknown_082DACFA); + gBattleCommunication[MULTISTRING_CHOOSER] = sideBank; + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 2; + gBattleTextBuff1[2] = MOVE_MIST; + gBattleTextBuff1[3] = MOVE_MIST >> 8; + gBattleTextBuff1[4] = EOS; + effect++; + } + gBattleStruct->turnSideTracker++; + if (effect) + break; + } + if (!effect) + { + gBattleStruct->turncountersTracker++; + gBattleStruct->turnSideTracker = 0; + } + break; + case 4: + while (gBattleStruct->turnSideTracker < 2) + { + sideBank = gBattleStruct->turnSideTracker; + gActiveBank = gBankAttacker = gSideTimers[sideBank].safeguardBank; + if (gSideAffecting[sideBank] & SIDE_STATUS_SAFEGUARD) + { + if (--gSideTimers[sideBank].safeguardTimer == 0) + { + gSideAffecting[sideBank] &= ~SIDE_STATUS_SAFEGUARD; + b_call_bc_move_exec(gUnknown_082DAD0B); + effect++; + } + } + gBattleStruct->turnSideTracker++; + if (effect) + break; + } + if (!effect) + { + gBattleStruct->turncountersTracker++; + gBattleStruct->turnSideTracker = 0; + } + break; + case 5: + while (gBattleStruct->turnSideTracker < gNoOfAllBanks) + { + gActiveBank = gTurnOrder[gBattleStruct->turnSideTracker]; + if (gWishFutureKnock.wishCounter[gActiveBank] != 0 + && --gWishFutureKnock.wishCounter[gActiveBank] == 0 + && gBattleMons[gActiveBank].hp != 0) + { + gBankTarget = gActiveBank; + b_call_bc_move_exec(BattleScript_WishComesTrue); + effect++; + } + gBattleStruct->turnSideTracker++; + if (effect) + break; + } + if (!effect) + { + gBattleStruct->turncountersTracker++; + } + break; + case 6: + if (gBattleWeather & WEATHER_RAIN_ANY) + { + if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) + { + if (--gWishFutureKnock.weatherDuration == 0) + { + gBattleWeather &= ~WEATHER_RAIN_TEMPORARY; + gBattleWeather &= ~WEATHER_RAIN_DOWNPOUR; + gBattleCommunication[MULTISTRING_CHOOSER] = 2; + } + else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + else + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + } + else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + else + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + b_call_bc_move_exec(gUnknown_082DAC2C); + effect++; + } + gBattleStruct->turncountersTracker++; + break; + case 7: + if (gBattleWeather & WEATHER_SANDSTORM_ANY) + { + if (!(gBattleWeather & WEATHER_SANDSTORM_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) + { + gBattleWeather &= ~WEATHER_SANDSTORM_TEMPORARY; + gBattlescriptCurrInstr = gUnknown_082DACC9; + } + else + gBattlescriptCurrInstr = gUnknown_082DAC47; + + gBattleScripting.animArg1 = 0xC; + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + b_call_bc_move_exec(gBattlescriptCurrInstr); + effect++; + } + gBattleStruct->turncountersTracker++; + break; + case 8: + if (gBattleWeather & WEATHER_SUN_ANY) + { + if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) + { + gBattleWeather &= ~WEATHER_SUN_TEMPORARY; + gBattlescriptCurrInstr = gUnknown_082DACE0; + } + else + gBattlescriptCurrInstr = gUnknown_082DACD2; + + b_call_bc_move_exec(gBattlescriptCurrInstr); + effect++; + } + gBattleStruct->turncountersTracker++; + break; + case 9: + if (gBattleWeather & WEATHER_HAIL) + { + if (--gWishFutureKnock.weatherDuration == 0) + { + gBattleWeather &= ~WEATHER_HAIL; + gBattlescriptCurrInstr = gUnknown_082DACC9; + } + else + gBattlescriptCurrInstr = gUnknown_082DAC47; + + gBattleScripting.animArg1 = 0xD; + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + b_call_bc_move_exec(gBattlescriptCurrInstr); + effect++; + } + gBattleStruct->turncountersTracker++; + break; + case 10: + effect++; + break; + } + } while (effect == 0); + return (gBattleMainFunc != BattleTurnPassed); +} + +#define TURNBASED_MAX_CASE 19 + +u8 TurnBasedEffects(void) +{ + u8 effect = 0; + + gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); + while (gBattleStruct->turnEffectsBank < gNoOfAllBanks && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE) + { + gActiveBank = gBankAttacker = gTurnOrder[gBattleStruct->turnEffectsBank]; + if (gAbsentBankFlags & gBitTable[gActiveBank]) + { + gBattleStruct->turnEffectsBank++; + } + else + { + switch (gBattleStruct->turnEffectsTracker) + { + case 0: // ingrain + if ((gStatuses3[gActiveBank] & STATUS3_ROOTED) + && gBattleMons[gActiveBank].hp != gBattleMons[gActiveBank].maxHP + && gBattleMons[gActiveBank].hp != 0) + { + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 16; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + gBattleMoveDamage *= -1; + b_call_bc_move_exec(BattleScript_IngrainTurnHeal); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; + case 1: // end turn abilities + if (AbilityBattleEffects(ABILITYEFFECT_ENDTURN, gActiveBank, 0, 0, 0)) + effect++; + gBattleStruct->turnEffectsTracker++; + break; + case 2: // item effects + if (ItemBattleEffects(1, gActiveBank, 0)) + effect++; + gBattleStruct->turnEffectsTracker++; + break; + case 18: // item effects again + if (ItemBattleEffects(1, gActiveBank, 1)) + effect++; + gBattleStruct->turnEffectsTracker++; + break; + case 3: // leech seed + if ((gStatuses3[gActiveBank] & STATUS3_LEECHSEED) + && gBattleMons[gStatuses3[gActiveBank] & STATUS3_LEECHSEED_BANK].hp != 0 + && gBattleMons[gActiveBank].hp != 0) + { + gBankTarget = gStatuses3[gActiveBank] & STATUS3_LEECHSEED_BANK; //funny how the 'target' is actually the bank that receives HP + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 8; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + gBattleScripting.animArg1 = gBankTarget; + gBattleScripting.animArg2 = gBankAttacker; + b_call_bc_move_exec(BattleScript_LeechSeedTurnDrain); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; + case 4: // poison + if ((gBattleMons[gActiveBank].status1 & STATUS_POISON) && gBattleMons[gActiveBank].hp != 0) + { + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 8; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + b_call_bc_move_exec(BattleScript_PoisonTurnDmg); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; + case 5: // toxic poison + if ((gBattleMons[gActiveBank].status1 & STATUS_TOXIC_POISON) && gBattleMons[gActiveBank].hp != 0) + { + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 16; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if ((gBattleMons[gActiveBank].status1 & 0xF00) != 0xF00) //not 16 turns + gBattleMons[gActiveBank].status1 += 0x100; + gBattleMoveDamage *= (gBattleMons[gActiveBank].status1 & 0xF00) >> 8; + b_call_bc_move_exec(BattleScript_PoisonTurnDmg); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; + case 6: // burn + if ((gBattleMons[gActiveBank].status1 & STATUS_BURN) && gBattleMons[gActiveBank].hp != 0) + { + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 8; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + b_call_bc_move_exec(BattleScript_BurnTurnDmg); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; + case 7: // spooky nightmares + if ((gBattleMons[gActiveBank].status2 & STATUS2_NIGHTMARE) && gBattleMons[gActiveBank].hp != 0) + { + // R/S does not perform this sleep check, which causes the nighmare effect to + // persist even after the affected Pokemon has been awakened by Shed Skin + if (gBattleMons[gActiveBank].status1 & STATUS_SLEEP) + { + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + b_call_bc_move_exec(BattleScript_NightmareTurnDmg); + effect++; + } + else + { + gBattleMons[gActiveBank].status2 &= ~STATUS2_NIGHTMARE; + } + } + gBattleStruct->turnEffectsTracker++; + break; + case 8: // curse + if ((gBattleMons[gActiveBank].status2 & STATUS2_CURSED) && gBattleMons[gActiveBank].hp != 0) + { + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + b_call_bc_move_exec(BattleScript_CurseTurnDmg); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; + case 9: // wrap + if ((gBattleMons[gActiveBank].status2 & STATUS2_WRAPPED) && gBattleMons[gActiveBank].hp != 0) + { + gBattleMons[gActiveBank].status2 -= 0x2000; + if (gBattleMons[gActiveBank].status2 & STATUS2_WRAPPED) // damaged by wrap + { + // This is the only way I could get this array access to match. + gBattleScripting.animArg1 = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 0); + gBattleScripting.animArg2 = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 1); + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 2; + gBattleTextBuff1[2] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 0); + gBattleTextBuff1[3] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 1); + gBattleTextBuff1[4] = EOS; + gBattlescriptCurrInstr = BattleScript_WrapTurnDmg; + gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 16; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + } + else // broke free + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 2; + gBattleTextBuff1[2] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 0); + gBattleTextBuff1[3] = *(gBattleStruct->wrappedMove + gActiveBank * 2 + 1); + gBattleTextBuff1[4] = EOS; + gBattlescriptCurrInstr = BattleScript_WrapEnds; + } + b_call_bc_move_exec(gBattlescriptCurrInstr); + effect++; + } + gBattleStruct->turnEffectsTracker++; + break; + case 10: // uproar + if (gBattleMons[gActiveBank].status2 & STATUS2_UPROAR) + { + for (gBankAttacker = 0; gBankAttacker < gNoOfAllBanks; gBankAttacker++) + { + if ((gBattleMons[gBankAttacker].status1 & STATUS_SLEEP) + && gBattleMons[gBankAttacker].ability != ABILITY_SOUNDPROOF) + { + gBattleMons[gBankAttacker].status1 &= ~(STATUS_SLEEP); + gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + b_call_bc_move_exec(gUnknown_082DB234); + gActiveBank = gBankAttacker; + EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1); + MarkBufferBankForExecution(gActiveBank); + break; + } + } + if (gBankAttacker != gNoOfAllBanks) + { + effect = 2; // a pokemon was awaken + break; + } + else + { + gBankAttacker = gActiveBank; + gBattleMons[gActiveBank].status2 -= 0x10; // uproar timer goes down + if (sub_803F90C(gActiveBank)) + { + CancelMultiTurnMoves(gActiveBank); + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + } + else if (gBattleMons[gActiveBank].status2 & STATUS2_UPROAR) + { + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleMons[gActiveBank].status2 |= STATUS2_MULTIPLETURNS; + } + else + { + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + CancelMultiTurnMoves(gActiveBank); + } + b_call_bc_move_exec(gUnknown_082DB2A6); + effect = 1; + } + } + if (effect != 2) + gBattleStruct->turnEffectsTracker++; + break; + case 11: // thrash + if (gBattleMons[gActiveBank].status2 & STATUS2_LOCK_CONFUSE) + { + gBattleMons[gActiveBank].status2 -= 0x400; + if (sub_803F90C(gActiveBank)) + CancelMultiTurnMoves(gActiveBank); + else if (!(gBattleMons[gActiveBank].status2 & STATUS2_LOCK_CONFUSE) + && (gBattleMons[gActiveBank].status2 & STATUS2_MULTIPLETURNS)) + { + gBattleMons[gActiveBank].status2 &= ~(STATUS2_MULTIPLETURNS); + if (!(gBattleMons[gActiveBank].status2 & STATUS2_CONFUSION)) + { + gBattleCommunication[MOVE_EFFECT_BYTE] = 0x47; + SetMoveEffect(1, 0); + if (gBattleMons[gActiveBank].status2 & STATUS2_CONFUSION) + b_call_bc_move_exec(BattleScript_ThrashConfuses); + effect++; + } + } + } + gBattleStruct->turnEffectsTracker++; + break; + case 12: // disable + if (gDisableStructs[gActiveBank].disableTimer1 != 0) + { + int i; + for (i = 0; i < 4; i++) + { + if (gDisableStructs[gActiveBank].disabledMove == gBattleMons[gActiveBank].moves[i]) + break; + } + if (i == 4) // pokemon does not have the disabled move anymore + { + gDisableStructs[gActiveBank].disabledMove = 0; + gDisableStructs[gActiveBank].disableTimer1 = 0; + } + else if (--gDisableStructs[gActiveBank].disableTimer1 == 0) // disable ends + { + gDisableStructs[gActiveBank].disabledMove = 0; + b_call_bc_move_exec(BattleScript_DisabledNoMore); + effect++; + } + } + gBattleStruct->turnEffectsTracker++; + break; + case 13: // encore + if (gDisableStructs[gActiveBank].encoreTimer1 != 0) + { + if (gBattleMons[gActiveBank].moves[gDisableStructs[gActiveBank].encoredMovePos] != gDisableStructs[gActiveBank].encoredMove) // pokemon does not have the encored move anymore + { + gDisableStructs[gActiveBank].encoredMove = 0; + gDisableStructs[gActiveBank].encoreTimer1 = 0; + } + else if (--gDisableStructs[gActiveBank].encoreTimer1 == 0 + || gBattleMons[gActiveBank].pp[gDisableStructs[gActiveBank].encoredMovePos] == 0) + { + gDisableStructs[gActiveBank].encoredMove = 0; + gDisableStructs[gActiveBank].encoreTimer1 = 0; + b_call_bc_move_exec(BattleScript_EncoredNoMore); + effect++; + } + } + gBattleStruct->turnEffectsTracker++; + break; + case 14: // lock-on decrement + if (gStatuses3[gActiveBank] & STATUS3_ALWAYS_HITS) + gStatuses3[gActiveBank] -= 0x8; + gBattleStruct->turnEffectsTracker++; + break; + case 15: // charge + if (gDisableStructs[gActiveBank].chargeTimer1 && --gDisableStructs[gActiveBank].chargeTimer1 == 0) + gStatuses3[gActiveBank] &= ~STATUS3_CHARGED_UP; + gBattleStruct->turnEffectsTracker++; + break; + case 16: // taunt + if (gDisableStructs[gActiveBank].tauntTimer1) + gDisableStructs[gActiveBank].tauntTimer1--; + gBattleStruct->turnEffectsTracker++; + break; + case 17: // yawn + if (gStatuses3[gActiveBank] & STATUS3_YAWN) + { + gStatuses3[gActiveBank] -= 0x800; + if (!(gStatuses3[gActiveBank] & STATUS3_YAWN) && !(gBattleMons[gActiveBank].status1 & STATUS_ANY) + && gBattleMons[gActiveBank].ability != ABILITY_VITAL_SPIRIT + && gBattleMons[gActiveBank].ability != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBank)) + { + CancelMultiTurnMoves(gActiveBank); + gBattleMons[gActiveBank].status1 |= (Random() & 3) + 2; + EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1); + MarkBufferBankForExecution(gActiveBank); + gEffectBank = gActiveBank; + b_call_bc_move_exec(BattleScript_YawnMakesAsleep); + effect++; + } + } + gBattleStruct->turnEffectsTracker++; + break; + case 19: // done + gBattleStruct->turnEffectsTracker = 0; + gBattleStruct->turnEffectsBank++; + break; + } + if (effect != 0) + return effect; + } + } + gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_x20); + return 0; +} + +bool8 sub_8041364(void) +{ + gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); + + switch (gBattleStruct->field_1A0) + { + case 0: + while (gBattleStruct->field_1A1 < gNoOfAllBanks) + { + gActiveBank = gBattleStruct->field_1A1; + if (gAbsentBankFlags & gBitTable[gActiveBank]) + { + gBattleStruct->field_1A1++; + continue; + } + + gBattleStruct->field_1A1++; + if (gWishFutureKnock.futureSightCounter[gActiveBank] != 0 + && --gWishFutureKnock.futureSightCounter[gActiveBank] == 0 + && gBattleMons[gActiveBank].hp != 0) + { + if (gWishFutureKnock.futureSightMove[gActiveBank] == MOVE_FUTURE_SIGHT) + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + else + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 2; + gBattleTextBuff1[2] = gWishFutureKnock.futureSightMove[gActiveBank]; + gBattleTextBuff1[3] = gWishFutureKnock.futureSightMove[gActiveBank] >> 8; + gBattleTextBuff1[4] = EOS; + gBankTarget = gActiveBank; + gBankAttacker = gWishFutureKnock.futureSightAttacker[gActiveBank]; + gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBank]; + gSpecialStatuses[gBankTarget].moveturnLostHP = 0xFFFF; + b_call_bc_move_exec(gUnknown_082DAFE4); + + if (gWishFutureKnock.futureSightCounter[gActiveBank] == 0 + && gWishFutureKnock.futureSightCounter[gActiveBank ^ 2] == 0) + { + gSideAffecting[GetBankIdentity(gBankTarget) & 1] &= ~SIDE_STATUS_FUTUREATTACK; + } + return 1; + } + } + // Why do I have to keep doing this to match? + { + u8* var = &gBattleStruct->field_1A0; + *var = 1; + gBattleStruct->field_1A1 = 0; + } + // fall through + case 1: + while (gBattleStruct->field_1A1 < gNoOfAllBanks) + { + gActiveBank = gBankAttacker = gTurnOrder[gBattleStruct->field_1A1]; + if (gAbsentBankFlags & gBitTable[gActiveBank]) + { + gBattleStruct->field_1A1++; + continue; + } + gBattleStruct->field_1A1++; + if (gStatuses3[gActiveBank] & STATUS3_PERISH_SONG) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 1; + gBattleTextBuff1[2] = 1; + gBattleTextBuff1[3] = 1; + gBattleTextBuff1[4] = gDisableStructs[gActiveBank].perishSong1; + gBattleTextBuff1[5] = EOS; + if (gDisableStructs[gActiveBank].perishSong1 == 0) + { + gStatuses3[gActiveBank] &= ~STATUS3_PERISH_SONG; + gBattleMoveDamage = gBattleMons[gActiveBank].hp; + gBattlescriptCurrInstr = gUnknown_082DAF05; + } + else + { + gDisableStructs[gActiveBank].perishSong1--; + gBattlescriptCurrInstr = gUnknown_082DAF20; + } + b_call_bc_move_exec(gBattlescriptCurrInstr); + return 1; + } + } + // Hm... + { + u8* var = &gBattleStruct->field_1A0; + *var = 2; + gBattleStruct->field_1A1 = 0; + } + // fall through + case 2: + if ((gBattleTypeFlags & BATTLE_TYPE_ARENA) + && gBattleStruct->field_DA == 2 + && gBattleMons[0].hp != 0 && gBattleMons[1].hp != 0) + { + s32 i; + + for (i = 0; i < 2; i++) + CancelMultiTurnMoves(i); + + gBattlescriptCurrInstr = gUnknown_082DB8F3; + b_call_bc_move_exec(gUnknown_082DB8F3); + gBattleStruct->field_1A0++; + return 1; + } + break; + } + + gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_x20); + + return 0; +} + +#define sub_8041728_MAX_CASE 7 + +bool8 sub_8041728(void) +{ + if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) + return FALSE; + do + { + int i; + switch (gBattleStruct->field_4D) + { + case 0: + gBattleStruct->field_4E = 0; + gBattleStruct->field_4D++; + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gAbsentBankFlags & gBitTable[i] && !sub_80423F4(i, 6, 6)) + gAbsentBankFlags &= ~(gBitTable[i]); + } + // fall through + case 1: + do + { + gBank1 = gBankTarget = gBattleStruct->field_4E; + if (gBattleMons[gBattleStruct->field_4E].hp == 0 + && !(gBattleStruct->field_DF & gBitTable[gBattlePartyID[gBattleStruct->field_4E]]) + && !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E])) + { + b_call_bc_move_exec(gUnknown_082DA7C4); + gBattleStruct->field_4D = 2; + return TRUE; + } + } while (++gBattleStruct->field_4E != gNoOfAllBanks); + gBattleStruct->field_4D = 3; + break; + case 2: + sub_803F9EC(gBank1); + if (++gBattleStruct->field_4E == gNoOfAllBanks) + gBattleStruct->field_4D = 3; + else + gBattleStruct->field_4D = 1; + break; + case 3: + gBattleStruct->field_4E = 0; + gBattleStruct->field_4D++; + // fall through + case 4: + do + { + gBank1 = gBankTarget = gBattleStruct->field_4E; //or should banks be switched? + if (gBattleMons[gBattleStruct->field_4E].hp == 0 + && !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E])) + { + b_call_bc_move_exec(gUnknown_082DA7CD); + gBattleStruct->field_4D = 5; + return TRUE; + } + } while (++gBattleStruct->field_4E != gNoOfAllBanks); + gBattleStruct->field_4D = 6; + break; + case 5: + if (++gBattleStruct->field_4E == gNoOfAllBanks) + gBattleStruct->field_4D = 6; + else + gBattleStruct->field_4D = 4; + break; + case 6: + if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) || ItemBattleEffects(1, 0, 1) || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) + return TRUE; + gBattleStruct->field_4D++; + break; + case 7: + break; + } + } while (gBattleStruct->field_4D != sub_8041728_MAX_CASE); + return FALSE; +} + +void b_clear_atk_up_if_hit_flag_unless_enraged(void) +{ + int i; + for (i = 0; i < gNoOfAllBanks; i++) + { + if ((gBattleMons[i].status2 & STATUS2_RAGE) && gChosenMovesByBanks[i] != MOVE_RAGE) + gBattleMons[i].status2 &= ~(STATUS2_RAGE); + } +} + +#define ATKCANCELLER_MAX_CASE 14 + +u8 AtkCanceller_UnableToUseMove(void) +{ + u8 effect = 0; + s32* bideDmg = &gBattleScripting.bideDmg; + do + { + switch (gBattleStruct->atkCancellerTracker) + { + case 0: // flags clear + gBattleMons[gBankAttacker].status2 &= ~(STATUS2_DESTINY_BOND); + gStatuses3[gBankAttacker] &= ~(STATUS3_GRUDGE); + gBattleStruct->atkCancellerTracker++; + break; + case 1: // check being asleep + if (gBattleMons[gBankAttacker].status1 & STATUS_SLEEP) + { + if (UproarWakeUpCheck(gBankAttacker)) + { + gBattleMons[gBankAttacker].status1 &= ~(STATUS_SLEEP); + gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE); + b_movescr_stack_push_cursor(); + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; + effect = 2; + } + else + { + u8 toSub; + if (gBattleMons[gBankAttacker].ability == ABILITY_EARLY_BIRD) + toSub = 2; + else + toSub = 1; + if ((gBattleMons[gBankAttacker].status1 & STATUS_SLEEP) < toSub) + gBattleMons[gBankAttacker].status1 &= ~(STATUS_SLEEP); + else + gBattleMons[gBankAttacker].status1 -= toSub; + if (gBattleMons[gBankAttacker].status1 & STATUS_SLEEP) + { + if (gCurrentMove != MOVE_SNORE && gCurrentMove != MOVE_SLEEP_TALK) + { + gBattlescriptCurrInstr = BattleScript_MoveUsedIsAsleep; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + effect = 2; + } + } + else + { + gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE); + b_movescr_stack_push_cursor(); + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; + effect = 2; + } + } + } + gBattleStruct->atkCancellerTracker++; + break; + case 2: // check being frozen + if (gBattleMons[gBankAttacker].status1 & STATUS_FREEZE) + { + if (Random() % 5) + { + if (gBattleMoves[gCurrentMove].effect != EFFECT_THAW_HIT) // unfreezing via a move effect happens in case 13 + { + gBattlescriptCurrInstr = BattleScript_MoveUsedIsFrozen; + gHitMarker |= HITMARKER_NO_ATTACKSTRING; + } + else + { + gBattleStruct->atkCancellerTracker++; + break; + } + } + else // unfreeze + { + gBattleMons[gBankAttacker].status1 &= ~(STATUS_FREEZE); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + } + effect = 2; + } + gBattleStruct->atkCancellerTracker++; + break; + case 3: // truant + if (gBattleMons[gBankAttacker].ability == ABILITY_TRUANT && gDisableStructs[gBankAttacker].truantCounter) + { + CancelMultiTurnMoves(gBankAttacker); + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; + gBattleMoveFlags |= MOVESTATUS_MISSED; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 4: // recharge + if (gBattleMons[gBankAttacker].status2 & STATUS2_RECHARGE) + { + gBattleMons[gBankAttacker].status2 &= ~(STATUS2_RECHARGE); + gDisableStructs[gBankAttacker].rechargeCounter = 0; + CancelMultiTurnMoves(gBankAttacker); + gBattlescriptCurrInstr = BattleScript_MoveUsedMustRecharge; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 5: // flinch + if (gBattleMons[gBankAttacker].status2 & STATUS2_FLINCHED) + { + gBattleMons[gBankAttacker].status2 &= ~(STATUS2_FLINCHED); + gProtectStructs[gBankAttacker].flinchImmobility = 1; + CancelMultiTurnMoves(gBankAttacker); + gBattlescriptCurrInstr = BattleScript_MoveUsedFlinched; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 6: // disabled move + if (gDisableStructs[gBankAttacker].disabledMove == gCurrentMove && gDisableStructs[gBankAttacker].disabledMove != 0) + { + gProtectStructs[gBankAttacker].usedDisabledMove = 1; + gBattleScripting.bank = gBankAttacker; + CancelMultiTurnMoves(gBankAttacker); + gBattlescriptCurrInstr = BattleScript_MoveUsedIsDisabled; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 7: // taunt + if (gDisableStructs[gBankAttacker].tauntTimer1 && gBattleMoves[gCurrentMove].power == 0) + { + gProtectStructs[gBankAttacker].usedTauntedMove = 1; + CancelMultiTurnMoves(gBankAttacker); + gBattlescriptCurrInstr = BattleScript_MoveUsedIsTaunted; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 8: // imprisoned + if (IsImprisoned(gBankAttacker, gCurrentMove)) + { + gProtectStructs[gBankAttacker].usedImprisionedMove = 1; + CancelMultiTurnMoves(gBankAttacker); + gBattlescriptCurrInstr = BattleScript_MoveUsedIsImprisoned; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 9: // confusion + if (gBattleMons[gBankAttacker].status2 & STATUS2_CONFUSION) + { + gBattleMons[gBankAttacker].status2--; + if (gBattleMons[gBankAttacker].status2 & STATUS2_CONFUSION) + { + if (Random() & 1) + { + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + b_movescr_stack_push_cursor(); + } + else // confusion dmg + { + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBankTarget = gBankAttacker; + gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBankAttacker], &gBattleMons[gBankAttacker], MOVE_POUND, 0, 40, 0, gBankAttacker, gBankAttacker); + gProtectStructs[gBankAttacker].confusionSelfDmg = 1; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + } + gBattlescriptCurrInstr = BattleScript_MoveUsedIsConfused; + } + else // snapped out of confusion + { + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_MoveUsedIsConfusedNoMore; + } + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 10: // paralysis + if ((gBattleMons[gBankAttacker].status1 & STATUS_PARALYSIS) && (Random() % 4) == 0) + { + gProtectStructs[gBankAttacker].prlzImmobility = 1; + // This is removed in Emerald for some reason + //CancelMultiTurnMoves(gBankAttacker); + gBattlescriptCurrInstr = BattleScript_MoveUsedIsParalyzed; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 11: // infatuation + if (gBattleMons[gBankAttacker].status2 & STATUS2_INFATUATION) + { + gBattleScripting.bank = CountTrailingZeroBits((gBattleMons[gBankAttacker].status2 & STATUS2_INFATUATION) >> 0x10); + if (Random() & 1) + b_movescr_stack_push_cursor(); + else + { + b_movescr_stack_push(BattleScript_MoveUsedIsParalyzedCantAttack); + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + gProtectStructs[gBankAttacker].loveImmobility = 1; + CancelMultiTurnMoves(gBankAttacker); + } + gBattlescriptCurrInstr = BattleScript_MoveUsedIsInLove; + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 12: // bide + if (gBattleMons[gBankAttacker].status2 & STATUS2_BIDE) + { + gBattleMons[gBankAttacker].status2 -= 0x100; + if (gBattleMons[gBankAttacker].status2 & STATUS2_BIDE) + gBattlescriptCurrInstr = BattleScript_BideStoringEnergy; + else + { + // This is removed in Emerald for some reason + //gBattleMons[gBankAttacker].status2 &= ~(STATUS2_MULTIPLETURNS); + if (gTakenDmg[gBankAttacker]) + { + gCurrentMove = MOVE_BIDE; + *bideDmg = gTakenDmg[gBankAttacker] * 2; + gBankTarget = gTakenDmgBanks[gBankAttacker]; + if (gAbsentBankFlags & gBitTable[gBankTarget]) + gBankTarget = GetMoveTarget(MOVE_BIDE, 1); + gBattlescriptCurrInstr = BattleScript_BideAttack; + } + else + gBattlescriptCurrInstr = BattleScript_BideNoEnergyToAttack; + } + effect = 1; + } + gBattleStruct->atkCancellerTracker++; + break; + case 13: // move thawing + if (gBattleMons[gBankAttacker].status1 & STATUS_FREEZE) + { + if (gBattleMoves[gCurrentMove].effect == EFFECT_THAW_HIT) + { + gBattleMons[gBankAttacker].status1 &= ~(STATUS_FREEZE); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + } + effect = 2; + } + gBattleStruct->atkCancellerTracker++; + break; + case 14: // last case + break; + } + + } while (gBattleStruct->atkCancellerTracker != ATKCANCELLER_MAX_CASE && effect == 0); + + if (effect == 2) + { + gActiveBank = gBankAttacker; + EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1); + MarkBufferBankForExecution(gActiveBank); + } + return effect; +} + +bool8 sub_80423F4(u8 bank, u8 r1, u8 r2) +{ + struct Pokemon* party; + u8 r7; + u8 r6; + s32 i; + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + return FALSE; + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) + { + if (GetBankSide(bank) == SIDE_PLAYER) + party = gPlayerParty; + else + party = gEnemyParty; + r6 = ((bank & 2) / 2); + for (i = r6 * 3; i < r6 * 3 + 3; i++) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) + break; + } + return (i == r6 * 3 + 3); + } + else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + if (gBattleTypeFlags & BATTLE_TYPE_x800000) + { + if (GetBankSide(bank) == SIDE_PLAYER) + { + party = gPlayerParty; + r7 = sub_806D864(bank); + r6 = sub_806D82C(r7); + } + else + { + // FIXME: Compiler insists on moving r4 into r1 before doing the eor + #ifndef NONMATCHING + register u32 var asm("r1"); + #else + u32 var; + #endif // NONMATCHING + + party = gEnemyParty; + var = bank ^ 1; + r6 = (var != 0) ? 1 : 0; + } + } + else + { + r7 = sub_806D864(bank); + if (GetBankSide(bank) == SIDE_PLAYER) + party = gPlayerParty; + else + party = gEnemyParty; + r6 = sub_806D82C(r7); + } + for (i = r6 * 3; i < r6 * 3 + 3; i++) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) + break; + } + return (i == r6 * 3 + 3); + } + else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && GetBankSide(bank) == SIDE_OPPONENT) + { + party = gEnemyParty; + + if (bank == 1) + r6 = 0; + else + r6 = 3; + for (i = r6; i < r6 + 3; i++) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) + break; + } + return (i == r6 + 3); + } + else + { + if (GetBankSide(bank) == SIDE_OPPONENT) + { + r7 = GetBankByPlayerAI(1); + r6 = GetBankByPlayerAI(3); + party = gEnemyParty; + } + else + { + r7 = GetBankByPlayerAI(0); + r6 = GetBankByPlayerAI(2); + party = gPlayerParty; + } + if (r1 == 6) + r1 = gBattlePartyID[r7]; + if (r2 == 6) + r2 = gBattlePartyID[r6]; + for (i = 0; i < 6; i++) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG + // FIXME: Using index[array] instead of array[index] is BAD! + && i != r1 && i != r2 && i != r7[gBattleStruct->field_5C] && i != r6[gBattleStruct->field_5C]) + break; + } + return (i == 6); + } +} + +enum +{ + CASTFORM_NO_CHANGE, //0 + CASTFORM_TO_NORMAL, //1 + CASTFORM_TO_FIRE, //2 + CASTFORM_TO_WATER, //3 + CASTFORM_TO_ICE, //4 +}; + +u8 CastformDataTypeChange(u8 bank) +{ + u8 formChange = 0; + if (gBattleMons[bank].species != SPECIES_CASTFORM || gBattleMons[bank].ability != ABILITY_FORECAST || gBattleMons[bank].hp == 0) + return CASTFORM_NO_CHANGE; + if (!WEATHER_HAS_EFFECT && gBattleMons[bank].type1 != TYPE_NORMAL && gBattleMons[bank].type2 != TYPE_NORMAL) + { + gBattleMons[bank].type1 = TYPE_NORMAL; + gBattleMons[bank].type2 = TYPE_NORMAL; + return CASTFORM_TO_NORMAL; + } + if (!WEATHER_HAS_EFFECT) + return CASTFORM_NO_CHANGE; + if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL)) && gBattleMons[bank].type1 != TYPE_NORMAL && gBattleMons[bank].type2 != TYPE_NORMAL) + { + gBattleMons[bank].type1 = TYPE_NORMAL; + gBattleMons[bank].type2 = TYPE_NORMAL; + formChange = CASTFORM_TO_NORMAL; + } + if (gBattleWeather & WEATHER_SUN_ANY && gBattleMons[bank].type1 != TYPE_FIRE && gBattleMons[bank].type2 != TYPE_FIRE) + { + gBattleMons[bank].type1 = TYPE_FIRE; + gBattleMons[bank].type2 = TYPE_FIRE; + formChange = CASTFORM_TO_FIRE; + } + if (gBattleWeather & WEATHER_RAIN_ANY && gBattleMons[bank].type1 != TYPE_WATER && gBattleMons[bank].type2 != TYPE_WATER) + { + gBattleMons[bank].type1 = TYPE_WATER; + gBattleMons[bank].type2 = TYPE_WATER; + formChange = CASTFORM_TO_WATER; + } + if (gBattleWeather & WEATHER_HAIL && gBattleMons[bank].type1 != TYPE_ICE && gBattleMons[bank].type2 != TYPE_ICE) + { + gBattleMons[bank].type1 = TYPE_ICE; + gBattleMons[bank].type2 = TYPE_ICE; + formChange = CASTFORM_TO_ICE; + } + return formChange; +} + +// We meet again, ABE. +#ifdef NONMATCHING +u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) +{ + u8 effect = 0; + struct Pokemon* pokeAtk; + struct Pokemon* pokeDef; + u16 speciesAtk; + u16 speciesDef; + u32 pidAtk; + u32 pidDef; + + if (gBankAttacker >= gNoOfAllBanks) + gBankAttacker = bank; + if (GetBankSide(gBankAttacker) == SIDE_PLAYER) + pokeAtk = &gPlayerParty[gBattlePartyID[gBankAttacker]]; + else + pokeAtk = &gEnemyParty[gBattlePartyID[gBankAttacker]]; + + if (gBankTarget >= gNoOfAllBanks) + gBankTarget = bank; + if (GetBankSide(gBankTarget) == SIDE_PLAYER) + pokeDef = &gPlayerParty[gBattlePartyID[gBankTarget]]; + else + pokeDef = &gEnemyParty[gBattlePartyID[gBankTarget]]; + + speciesAtk = GetMonData(pokeAtk, MON_DATA_SPECIES); + pidAtk = GetMonData(pokeAtk, MON_DATA_PERSONALITY); + + speciesDef = GetMonData(pokeDef, MON_DATA_SPECIES); + pidDef = GetMonData(pokeDef, MON_DATA_PERSONALITY); + + if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) // why isn't that check done at the beginning? + { + int i; // r4 + u16 move; + // Hmm... + #define moveType moveArg + //u16 moveType; + u8 side; + + if (special) + gLastUsedAbility = special; + else + gLastUsedAbility = gBattleMons[bank].ability; + + if (moveArg) + move = moveArg; + else + move = gCurrentMove; + + if (gBattleStruct->dynamicMoveType) + moveType = gBattleStruct->dynamicMoveType & 0x3F; + else + moveType = gBattleMoves[move].type; + + switch (caseID) + { + case ABILITYEFFECT_ON_SWITCHIN: // 0 + //_08042A18 + if (gBankAttacker >= gNoOfAllBanks) + gBankAttacker = bank; + switch (gLastUsedAbility) + { + case 0xFF: //weather from overworld + //_08042A86 + switch (weather_get_current()) + { + case 3: + case 5: + case 13: + if (!(gBattleWeather & WEATHER_RAIN_ANY)) + { + gBattleWeather = (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_PERMANENT); + gBattleScripting.animArg1 = 0xA; + gBattleScripting.bank = bank; + effect++; + } + break; + case 8: + if (!(gBattleWeather & WEATHER_SANDSTORM_ANY)) + { + gBattleWeather = (WEATHER_SANDSTORM_PERMANENT | WEATHER_SANDSTORM_TEMPORARY); + gBattleScripting.animArg1 = 0xC; + gBattleScripting.bank = bank; + effect++; + } + break; + case 12: + if (!(gBattleWeather & WEATHER_SUN_ANY)) + { + gBattleWeather = (WEATHER_SUN_PERMANENT | WEATHER_SUN_TEMPORARY); + gBattleScripting.animArg1 = 0xB; + gBattleScripting.bank = bank; + effect++; + } + break; + } + if (effect) + { + gBattleCommunication[MULTISTRING_CHOOSER] = weather_get_current(); + b_push_move_exec(gUnknown_082DACE7); + } + break; + case ABILITY_DRIZZLE: + //_08042B78 + if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) + { + gBattleWeather = (WEATHER_RAIN_PERMANENT | WEATHER_RAIN_TEMPORARY); + b_push_move_exec(BattleScript_DrizzleActivates); + gBattleScripting.bank = bank; + effect++; + } + break; + case ABILITY_SAND_STREAM: + //_08042BA8 + if (!(gBattleWeather & WEATHER_SANDSTORM_PERMANENT)) + { + gBattleWeather = (WEATHER_SANDSTORM_PERMANENT | WEATHER_SANDSTORM_TEMPORARY); + b_push_move_exec(BattleScript_SandstreamActivates); + gBattleScripting.bank = bank; + effect++; + } + break; + case ABILITY_DROUGHT: + //_08042BD8 + if (!(gBattleWeather & WEATHER_SUN_PERMANENT)) + { + gBattleWeather = (WEATHER_SUN_PERMANENT | WEATHER_SUN_TEMPORARY); + b_push_move_exec(BattleScript_DroughtActivates); + gBattleScripting.bank = bank; + effect++; + } + break; + case ABILITY_INTIMIDATE: + //_08042C08 + if (!(gSpecialStatuses[bank].intimidatedPoke)) + { + gStatuses3[bank] |= STATUS3_INTIMIDATE_POKES; + gSpecialStatuses[bank].intimidatedPoke = 1; + } + break; + case ABILITY_FORECAST: + //_08042C3C + effect = CastformDataTypeChange(bank); + if (effect != 0) + { + b_push_move_exec(BattleScript_CastformChange); + gBattleScripting.bank = bank; + gBattleStruct->formToChangeInto = effect - 1; + } + break; + case ABILITY_TRACE: + if (!(gSpecialStatuses[bank].traced)) + { + gStatuses3[bank] |= STATUS3_TRACE; + gSpecialStatuses[bank].traced = 1; + } + break; + case ABILITY_CLOUD_NINE: + case ABILITY_AIR_LOCK: + { + u8 i; + + for (i = 0; i < gNoOfAllBanks; i++) + { + // TODO: i should be in r6 here + //asm("":::"r4","r5"); + effect = CastformDataTypeChange(i); + if (effect != 0) + { + b_push_move_exec(BattleScript_CastformChange); + gBattleScripting.bank = i; + gBattleStruct->formToChangeInto = effect - 1; + break; + } + } + } + break; + } + break; + case ABILITYEFFECT_ENDTURN: // 1 + //_08042CDC + if (gBattleMons[bank].hp != 0) + { + gBankAttacker = bank; + switch (gLastUsedAbility) + { + case ABILITY_RAIN_DISH: + //_08042D22 + if (WEATHER_HAS_EFFECT && (gBattleWeather & WEATHER_RAIN_ANY) + && gBattleMons[bank].maxHP > gBattleMons[bank].hp) + { + gLastUsedAbility = ABILITY_RAIN_DISH; //why + b_push_move_exec(BattleScript_RainDishActivates); + gBattleMoveDamage = gBattleMons[bank].maxHP / 16; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + gBattleMoveDamage *= -1; + effect++; + } + break; + case ABILITY_SHED_SKIN: + //_08042DA0 + if ((gBattleMons[bank].status1 & STATUS_ANY) && (Random() % 3) == 0) + { + if (gBattleMons[bank].status1 & (STATUS_POISON | STATUS_TOXIC_POISON)) + StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); + if (gBattleMons[bank].status1 & STATUS_SLEEP) + StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); + if (gBattleMons[bank].status1 & STATUS_PARALYSIS) + StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); + if (gBattleMons[bank].status1 & STATUS_BURN) + StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); + if (gBattleMons[bank].status1 & STATUS_FREEZE) + StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); + gBattleMons[bank].status1 = 0; + gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE); // fix nighmare glitch + gBattleScripting.bank = gActiveBank = bank; + b_push_move_exec(BattleScript_ShedSkinActivates); + EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[bank].status1); + MarkBufferBankForExecution(gActiveBank); + effect++; + } + break; + case ABILITY_SPEED_BOOST: + //_08042E84 + if (gBattleMons[bank].statStages[STAT_STAGE_SPEED] < 0xC && gDisableStructs[bank].isFirstTurn != 2) + { + gBattleMons[bank].statStages[STAT_STAGE_SPEED]++; + gBattleScripting.animArg1 = 0x11; + gBattleScripting.animArg2 = 0; + b_push_move_exec(BattleScript_SpeedBoostActivates); + gBattleScripting.bank = bank; + effect++; + } + break; + case ABILITY_TRUANT: + gDisableStructs[gBankAttacker].truantCounter ^= 1; + break; + } + } + break; + case ABILITYEFFECT_MOVES_BLOCK: // 2 + //_08042EF8 + if (gLastUsedAbility == ABILITY_SOUNDPROOF) + { + for (i = 0; gSoundMovesTable[i] != 0xFFFF; i++) + { + if (gSoundMovesTable[i] == move) + break; + } + if (gSoundMovesTable[i] != 0xFFFF) + { + if (gBattleMons[gBankAttacker].status2 & STATUS2_MULTIPLETURNS) + gHitMarker |= HITMARKER_NO_PPDEDUCT; + gBattlescriptCurrInstr = BattleScript_SoundproofProtected; + effect = 1; + } + } + break; + case ABILITYEFFECT_ABSORBING: // 3 + if (move) + { + switch (gLastUsedAbility) + { + case ABILITY_VOLT_ABSORB: + if (moveType == TYPE_ELECTRIC && gBattleMoves[move].power != 0) + { + if (gProtectStructs[gBankAttacker].notFirstStrike) + gBattlescriptCurrInstr = BattleScript_MoveHPDrain; + else + gBattlescriptCurrInstr = BattleScript_MoveHPDrain_PPLoss; + effect = 1; + } + break; + case ABILITY_WATER_ABSORB: + if (moveType == TYPE_WATER && gBattleMoves[move].power != 0) + { + if (gProtectStructs[gBankAttacker].notFirstStrike) + gBattlescriptCurrInstr = BattleScript_MoveHPDrain; + else + gBattlescriptCurrInstr = BattleScript_MoveHPDrain_PPLoss; + effect = 1; + } + break; + case ABILITY_FLASH_FIRE: + //_0804305C + if (moveType == TYPE_FIRE && !(gBattleMons[bank].status1 & STATUS_FREEZE)) + { + if (!(gBattleResources->flags->flags[bank] & UNKNOWN_FLAG_FLASH_FIRE)) + { + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + if (gProtectStructs[gBankAttacker].notFirstStrike) + gBattlescriptCurrInstr = BattleScript_FlashFireBoost; + else + gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss; + gBattleResources->flags->flags[bank] |= UNKNOWN_FLAG_FLASH_FIRE; + effect = 2; + } + else + { + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + if (gProtectStructs[gBankAttacker].notFirstStrike) + gBattlescriptCurrInstr = BattleScript_FlashFireBoost; + else + gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss; + effect = 2; + } + } + break; + } + if (effect == 1) + { + if (gBattleMons[bank].maxHP == gBattleMons[bank].hp) + { + if ((gProtectStructs[gBankAttacker].notFirstStrike)) + gBattlescriptCurrInstr = BattleScript_MoveHPDrain; + else + gBattlescriptCurrInstr = BattleScript_MoveHPDrain_PPLoss; + } + else + { + gBattleMoveDamage = gBattleMons[bank].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + gBattleMoveDamage *= -1; + } + } + } + break; + case ABILITYEFFECT_CONTACT: // 4 + //_080431AC + switch (gLastUsedAbility) + { + case ABILITY_COLOR_CHANGE: + //_08043288 + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && move != MOVE_STRUGGLE + && gBattleMoves[move].power != 0 + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && gBattleMons[bank].type1 != moveType + && gBattleMons[bank].type2 != moveType + && gBattleMons[bank].hp != 0) + { + gBattleMons[bank].type1 = moveType; + gBattleMons[bank].type2 = moveType; + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 3; + gBattleTextBuff1[2] = moveType; + gBattleTextBuff1[3] = 0xFF; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_ColorChangeActivates; + effect++; + } + break; + case ABILITY_ROUGH_SKIN: + //_08043350 + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && gBattleMons[gBankAttacker].hp != 0 + && !gProtectStructs[gBankAttacker].confusionSelfDmg + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) + { + gBattleMoveDamage = gBattleMons[gBankAttacker].maxHP / 16; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_RoughSkinActivates; + effect++; + } + break; + case ABILITY_EFFECT_SPORE: + //_08043410 + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && gBattleMons[gBankAttacker].hp != 0 + && !gProtectStructs[gBankAttacker].confusionSelfDmg + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (Random() % 10) == 0) + { + do + { + gBattleCommunication[MOVE_EFFECT_BYTE] = Random() & 3; + } while (gBattleCommunication[MOVE_EFFECT_BYTE] == 0); + if (gBattleCommunication[MOVE_EFFECT_BYTE] == 3) + gBattleCommunication[MOVE_EFFECT_BYTE] += 2; + gBattleCommunication[MOVE_EFFECT_BYTE] += 0x40; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; + gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + effect++; + } + break; + case ABILITY_POISON_POINT: + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && gBattleMons[gBankAttacker].hp != 0 + && !gProtectStructs[gBankAttacker].confusionSelfDmg + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (Random() % 3) == 0) + { + gBattleCommunication[MOVE_EFFECT_BYTE] = 0x42; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; + gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + effect++; + } + break; + case ABILITY_STATIC: + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && gBattleMons[gBankAttacker].hp != 0 + && !gProtectStructs[gBankAttacker].confusionSelfDmg + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (Random() % 3) == 0) + { + gBattleCommunication[MOVE_EFFECT_BYTE] = 0x45; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; + gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + effect++; + } + break; + case ABILITY_FLAME_BODY: + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && gBattleMons[gBankAttacker].hp != 0 + && !gProtectStructs[gBankAttacker].confusionSelfDmg + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && (Random() % 3) == 0) + { + gBattleCommunication[MOVE_EFFECT_BYTE] = 0x43; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; + gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + effect++; + } + break; + case ABILITY_CUTE_CHARM: + //_0804379C + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && gBattleMons[gBankAttacker].hp != 0 + && !gProtectStructs[gBankAttacker].confusionSelfDmg + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && gBattleMons[gBankTarget].hp != 0 + && (Random() % 3) == 0 + && gBattleMons[gBankAttacker].ability != ABILITY_OBLIVIOUS + && GetGenderFromSpeciesAndPersonality(speciesAtk, pidAtk) != GetGenderFromSpeciesAndPersonality(speciesDef, pidDef) + && !(gBattleMons[gBankAttacker].status2 & STATUS2_INFATUATION) + && GetGenderFromSpeciesAndPersonality(speciesAtk, pidAtk) != 0xFF + && GetGenderFromSpeciesAndPersonality(speciesDef, pidDef) != 0xFF) + { + gBattleMons[gBankAttacker].status2 |= (gBitTable[gBankTarget] << 0x10); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_CuteCharmActivates; + effect++; + } + break; + } + break; + case ABILITYEFFECT_IMMUNITY: // 5 + { + #define i bank + for (i = 0; i < gNoOfAllBanks; i++) + { + switch (gBattleMons[i].ability) + { + case ABILITY_IMMUNITY: + if (gBattleMons[i].status1 & (STATUS_POISON | STATUS_TOXIC_POISON | 0xF00)) // TODO: what is 0xF00? + { + StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); + effect = 1; + } + break; + case ABILITY_OWN_TEMPO: + //_08043A7C + if (gBattleMons[i].status2 & STATUS2_CONFUSION) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); + effect = 2; + } + break; + case ABILITY_LIMBER: + if (gBattleMons[i].status1 & STATUS_PARALYSIS) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); + effect = 1; + } + break; + case ABILITY_INSOMNIA: + case ABILITY_VITAL_SPIRIT: + if (gBattleMons[i].status1 & STATUS_SLEEP) + { + gBattleMons[i].status2 &= ~(STATUS2_NIGHTMARE); + StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); + effect = 1; + } + break; + case ABILITY_WATER_VEIL: + if (gBattleMons[i].status1 & STATUS_BURN) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); + effect = 1; + } + break; + case ABILITY_MAGMA_ARMOR: + if (gBattleMons[i].status1 & STATUS_FREEZE) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); + effect = 1; + } + break; + case ABILITY_OBLIVIOUS: + //_08043B70 + if (gBattleMons[i].status2 & STATUS2_INFATUATION) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); + effect = 3; + } + break; + } + if (effect) + { + switch (effect) + { + case 1: // status cleared + gBattleMons[i].status1 = 0; + break; + case 2: // get rid of confusion + gBattleMons[i].status2 &= ~(STATUS2_CONFUSION); + break; + case 3: // get rid of infatuation + gBattleMons[i].status2 &= ~(STATUS2_INFATUATION); + break; + } + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = gUnknown_082DB68C; + gBattleScripting.bank = i; + gActiveBank = i; + EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1); + MarkBufferBankForExecution(gActiveBank); + return effect; + } + } + #undef i + } + break; + case ABILITYEFFECT_FORECAST: // 6 + { + #define i bank + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ABILITY_FORECAST) + { + effect = CastformDataTypeChange(i); + if (effect) + { + b_push_move_exec(BattleScript_CastformChange); + gBattleScripting.bank = i; + gBattleStruct->formToChangeInto = effect - 1; + return effect; + } + } + } + #undef i + } + break; + case ABILITYEFFECT_SYNCHRONIZE: // 7 + //_08043CBC + if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT)) + { + gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); + gBattleStruct->synchronizeMoveEffect &= 0x3F; + if (gBattleStruct->synchronizeMoveEffect == 6) + gBattleStruct->synchronizeMoveEffect = 2; + gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect + 0x40; + gBattleScripting.bank = gBankTarget; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; + gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + effect++; + } + break; + case ABILITYEFFECT_ATK_SYNCHRONIZE: // 8 + if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT)) + { + gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); + gBattleStruct->synchronizeMoveEffect &= 0x3F; + if (gBattleStruct->synchronizeMoveEffect == 6) + gBattleStruct->synchronizeMoveEffect = 2; + gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect; + gBattleScripting.bank = gBankAttacker; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; + gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + effect++; + } + break; + case ABILITYEFFECT_INTIMIDATE1: // 9 + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ABILITY_INTIMIDATE && gStatuses3[i] & STATUS3_INTIMIDATE_POKES) + { + gLastUsedAbility = ABILITY_INTIMIDATE; + gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES); + b_push_move_exec(gUnknown_082DB4B8); + gBattleStruct->intimidateBank = i; + effect++; + break; + } + } + break; + case ABILITYEFFECT_TRACE: // 11 + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ABILITY_TRACE && (gStatuses3[i] & STATUS3_TRACE)) + { + u8 opposite = (GetBankIdentity(i) ^ 1) & 1; + u8 target1 = GetBankByPlayerAI(opposite); + u8 target2 = GetBankByPlayerAI(opposite + 2); + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + { + if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0 + && gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0) + { + gActiveBank = GetBankByPlayerAI(((Random() & 1) * 2) | opposite); + gBattleMons[i].ability = gBattleMons[gActiveBank].ability; + gLastUsedAbility = gBattleMons[gActiveBank].ability; + effect++; + } + else if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0) + { + gActiveBank = target1; + gBattleMons[i].ability = gBattleMons[gActiveBank].ability; + gLastUsedAbility = gBattleMons[gActiveBank].ability; + effect++; + } + else if (gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0) + { + gActiveBank = target2; + gBattleMons[i].ability = gBattleMons[gActiveBank].ability; + gLastUsedAbility = gBattleMons[gActiveBank].ability; + effect++; + } + } + else + { + gActiveBank = target1; + if (gBattleMons[target1].ability && gBattleMons[target1].hp) + { + gBattleMons[i].ability = gBattleMons[target1].ability; + gLastUsedAbility = gBattleMons[target1].ability; + effect++; + } + } + if (effect) + { + b_push_move_exec(BattleScript_TraceActivates); + gStatuses3[i] &= ~(STATUS3_TRACE); + gBattleScripting.bank = i; + + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 4; + gBattleTextBuff1[2] = gActiveBank; + gBattleTextBuff1[3] = gBattlePartyID[gActiveBank]; + gBattleTextBuff1[4] = EOS; + + gBattleTextBuff2[0] = 0xFD; + gBattleTextBuff2[1] = 9; + gBattleTextBuff2[2] = gLastUsedAbility; + gBattleTextBuff2[3] = EOS; + break; + } + } + } + break; + case ABILITYEFFECT_INTIMIDATE2: // 10 + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ABILITY_INTIMIDATE && (gStatuses3[i] & STATUS3_INTIMIDATE_POKES)) + { + gLastUsedAbility = ABILITY_INTIMIDATE; + gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = gUnknown_082DB4C1; + gBattleStruct->intimidateBank = i; + effect++; + break; + } + } + break; + case ABILITYEFFECT_CHECK_OTHER_SIDE: // 12 + side = GetBankSide(bank); + for (i = 0; i < gNoOfAllBanks; i++) + { + if (GetBankSide(i) != side && gBattleMons[i].ability == ability) + { + gLastUsedAbility = ability; + effect = i + 1; + } + } + break; + case ABILITYEFFECT_CHECK_BANK_SIDE: // 13 + side = GetBankSide(bank); + for (i = 0; i < gNoOfAllBanks; i++) + { + if (GetBankSide(i) == side && gBattleMons[i].ability == ability) + { + gLastUsedAbility = ability; + effect = i + 1; + } + } + break; + case ABILITYEFFECT_FIELD_SPORT: // 14 + switch (gLastUsedAbility) + { + case 0xFD: + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gStatuses3[i] & STATUS3_MUDSPORT) + effect = i + 1; + } + break; + case 0xFE: + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gStatuses3[i] & STATUS3_WATERSPORT) + effect = i + 1; + } + break; + default: + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ability) + { + gLastUsedAbility = ability; + effect = i + 1; + } + } + break; + } + break; + case ABILITYEFFECT_CHECK_ON_FIELD: // 19 + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ability && gBattleMons[i].hp != 0) + { + gLastUsedAbility = ability; + effect = i + 1; + } + } + break; + case ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK: // 15 + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ability && i != bank) + { + gLastUsedAbility = ability; + effect = i + 1; + } + } + break; + case ABILITYEFFECT_COUNT_OTHER_SIZE: // 16 + side = GetBankSide(bank); + for (i = 0; i < gNoOfAllBanks; i++) + { + if (GetBankSide(i) != side && gBattleMons[i].ability == ability) + { + gLastUsedAbility = ability; + effect++; + } + } + break; + case ABILITYEFFECT_COUNT_BANK_SIDE: // 17 + side = GetBankSide(bank); + for (i = 0; i < gNoOfAllBanks; i++) + { + if (GetBankSide(i) == side && gBattleMons[i].ability == ability) + { + gLastUsedAbility = ability; + effect++; + } + } + break; + case ABILITYEFFECT_COUNT_ON_FIELD: // 18 + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].ability == ability && i != bank) + { + gLastUsedAbility = ability; + effect++; + } + } + break; + } + if (effect && caseID < 0xC && gLastUsedAbility != 0xFF) + RecordAbilityBattle(bank, gLastUsedAbility); + } + + return effect; +} +#else +__attribute__((naked)) +u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg) +{ + asm( + "\n\ + .syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x28\n\ + ldr r4, [sp, 0x48]\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x4]\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r10, r1\n\ + lsls r2, 24\n\ + lsrs r6, r2, 24\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + mov r8, r3\n\ + lsls r4, 16\n\ + lsrs r4, 16\n\ + movs r0, 0\n\ + mov r9, r0\n\ + ldr r5, =gBankAttacker\n\ + ldr r1, =gNoOfAllBanks\n\ + ldrb r0, [r5]\n\ + ldrb r1, [r1]\n\ + cmp r0, r1\n\ + bcc _08042864\n\ + mov r1, r10\n\ + strb r1, [r5]\n\ +_08042864:\n\ + ldrb r0, [r5]\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + bne _08042894\n\ + ldr r1, =gBattlePartyID\n\ + ldrb r0, [r5]\n\ + lsls r0, 1\n\ + adds r0, r1\n\ + ldrh r1, [r0]\n\ + movs r0, 0x64\n\ + muls r1, r0\n\ + ldr r0, =gPlayerParty\n\ + b _080428A4\n\ + .pool\n\ +_08042894:\n\ + ldr r1, =gBattlePartyID\n\ + ldrb r0, [r5]\n\ + lsls r0, 1\n\ + adds r0, r1\n\ + ldrh r1, [r0]\n\ + movs r0, 0x64\n\ + muls r1, r0\n\ + ldr r0, =gEnemyParty\n\ +_080428A4:\n\ + adds r7, r1, r0\n\ + ldr r5, =gBankTarget\n\ + ldr r1, =gNoOfAllBanks\n\ + ldrb r0, [r5]\n\ + ldrb r1, [r1]\n\ + cmp r0, r1\n\ + bcc _080428B6\n\ + mov r2, r10\n\ + strb r2, [r5]\n\ +_080428B6:\n\ + ldrb r0, [r5]\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + bne _080428E8\n\ + ldr r1, =gBattlePartyID\n\ + ldrb r0, [r5]\n\ + lsls r0, 1\n\ + adds r0, r1\n\ + ldrh r1, [r0]\n\ + movs r0, 0x64\n\ + muls r1, r0\n\ + ldr r0, =gPlayerParty\n\ + b _080428F8\n\ + .pool\n\ +_080428E8:\n\ + ldr r1, =gBattlePartyID\n\ + ldrb r0, [r5]\n\ + lsls r0, 1\n\ + adds r0, r1\n\ + ldrh r1, [r0]\n\ + movs r0, 0x64\n\ + muls r1, r0\n\ + ldr r0, =gEnemyParty\n\ +_080428F8:\n\ + adds r5, r1, r0\n\ + adds r0, r7, 0\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + str r0, [sp, 0x8]\n\ + adds r0, r7, 0\n\ + movs r1, 0\n\ + bl GetMonData\n\ + str r0, [sp, 0x10]\n\ + adds r0, r5, 0\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + str r0, [sp, 0xC]\n\ + adds r0, r5, 0\n\ + movs r1, 0\n\ + bl GetMonData\n\ + str r0, [sp, 0x14]\n\ + ldr r0, =gBattleTypeFlags\n\ + ldr r0, [r0]\n\ + movs r1, 0x80\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _0804293A\n\ + bl _0804443A\n\ +_0804293A:\n\ + mov r3, r8\n\ + cmp r3, 0\n\ + beq _08042958\n\ + ldr r0, =gLastUsedAbility\n\ + strb r3, [r0]\n\ + adds r7, r0, 0\n\ + b _0804296E\n\ + .pool\n\ +_08042958:\n\ + ldr r2, =gLastUsedAbility\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r5, r10\n\ + muls r5, r0\n\ + adds r0, r5, 0\n\ + adds r0, r1\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + strb r0, [r2]\n\ + adds r7, r2, 0\n\ +_0804296E:\n\ + cmp r4, 0\n\ + beq _08042980\n\ + adds r5, r4, 0\n\ + b _08042984\n\ + .pool\n\ +_08042980:\n\ + ldr r0, =gCurrentMove\n\ + ldrh r5, [r0]\n\ +_08042984:\n\ + ldr r1, =gBattleStruct\n\ + ldr r0, [r1]\n\ + ldrb r0, [r0, 0x13]\n\ + mov r8, r1\n\ + cmp r0, 0\n\ + beq _080429A0\n\ + movs r3, 0x3F\n\ + ands r3, r0\n\ + b _080429AC\n\ + .pool\n\ +_080429A0:\n\ + ldr r1, =gBattleMoves\n\ + lsls r0, r5, 1\n\ + adds r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldrb r3, [r0, 0x2]\n\ +_080429AC:\n\ + ldr r0, [sp, 0x4]\n\ + cmp r0, 0x13\n\ + bls _080429B6\n\ + bl _0804441E\n\ +_080429B6:\n\ + lsls r0, 2\n\ + ldr r1, =_080429C8\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080429C8:\n\ + .4byte _08042A18\n\ + .4byte _08042CDC\n\ + .4byte _08042EF8\n\ + .4byte _08042F8C\n\ + .4byte _080431AC\n\ + .4byte _08043908\n\ + .4byte _08043C6C\n\ + .4byte _08043CBC\n\ + .4byte _08043D40\n\ + .4byte _08043DC4\n\ + .4byte _08043FE4\n\ + .4byte _08043E08\n\ + .4byte _08044028\n\ + .4byte _08044084\n\ + .4byte _080440E0\n\ + .4byte _080441DC\n\ + .4byte _08044220\n\ + .4byte _0804427C\n\ + .4byte _080443EC\n\ + .4byte _08044196\n\ +_08042A18:\n\ + ldr r2, =gBankAttacker\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r1, [r2]\n\ + adds r5, r0, 0\n\ + ldrb r3, [r5]\n\ + cmp r1, r3\n\ + bcc _08042A2A\n\ + mov r0, r10\n\ + strb r0, [r2]\n\ +_08042A2A:\n\ + ldrb r0, [r7]\n\ + cmp r0, 0x2D\n\ + bne _08042A32\n\ + b _08042BA8\n\ +_08042A32:\n\ + cmp r0, 0x2D\n\ + bgt _08042A64\n\ + cmp r0, 0xD\n\ + bne _08042A3C\n\ + b _08042CA4\n\ +_08042A3C:\n\ + cmp r0, 0xD\n\ + bgt _08042A54\n\ + cmp r0, 0x2\n\ + bne _08042A46\n\ + b _08042B78\n\ +_08042A46:\n\ + bl _0804441E\n\ + .pool\n\ +_08042A54:\n\ + cmp r0, 0x16\n\ + bne _08042A5A\n\ + b _08042C08\n\ +_08042A5A:\n\ + cmp r0, 0x24\n\ + bne _08042A60\n\ + b _08042C68\n\ +_08042A60:\n\ + bl _0804441E\n\ +_08042A64:\n\ + cmp r0, 0x46\n\ + bne _08042A6A\n\ + b _08042BD8\n\ +_08042A6A:\n\ + cmp r0, 0x46\n\ + bgt _08042A78\n\ + cmp r0, 0x3B\n\ + bne _08042A74\n\ + b _08042C3C\n\ +_08042A74:\n\ + bl _0804441E\n\ +_08042A78:\n\ + cmp r0, 0x4D\n\ + bne _08042A7E\n\ + b _08042CA4\n\ +_08042A7E:\n\ + cmp r0, 0xFF\n\ + beq _08042A86\n\ + bl _0804441E\n\ +_08042A86:\n\ + ldr r0, =gBattleTypeFlags\n\ + ldr r0, [r0]\n\ + movs r1, 0x80\n\ + lsls r1, 17\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08042B4C\n\ + bl weather_get_current\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + subs r0, 0x3\n\ + cmp r0, 0xA\n\ + bhi _08042B4C\n\ + lsls r0, 2\n\ + ldr r1, =_08042AB4\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_08042AB4:\n\ + .4byte _08042AE0\n\ + .4byte _08042B4C\n\ + .4byte _08042AE0\n\ + .4byte _08042B4C\n\ + .4byte _08042B4C\n\ + .4byte _08042B04\n\ + .4byte _08042B4C\n\ + .4byte _08042B4C\n\ + .4byte _08042B4C\n\ + .4byte _08042B28\n\ + .4byte _08042AE0\n\ +_08042AE0:\n\ + ldr r2, =gBattleWeather\n\ + ldrh r1, [r2]\n\ + movs r0, 0x7\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08042B4C\n\ + movs r0, 0x5\n\ + strh r0, [r2]\n\ + ldr r1, =gBattleScripting\n\ + movs r0, 0xA\n\ + strb r0, [r1, 0x10]\n\ + mov r2, r10\n\ + strb r2, [r1, 0x17]\n\ + b _08042B42\n\ + .pool\n\ +_08042B04:\n\ + ldr r3, =gBattleWeather\n\ + ldrh r1, [r3]\n\ + movs r2, 0x18\n\ + adds r0, r2, 0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08042B4C\n\ + strh r2, [r3]\n\ + ldr r1, =gBattleScripting\n\ + movs r0, 0xC\n\ + strb r0, [r1, 0x10]\n\ + mov r3, r10\n\ + strb r3, [r1, 0x17]\n\ + b _08042B42\n\ + .pool\n\ +_08042B28:\n\ + ldr r3, =gBattleWeather\n\ + ldrh r1, [r3]\n\ + movs r2, 0x60\n\ + adds r0, r2, 0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08042B4C\n\ + strh r2, [r3]\n\ + ldr r1, =gBattleScripting\n\ + movs r0, 0xB\n\ + strb r0, [r1, 0x10]\n\ + mov r5, r10\n\ + strb r5, [r1, 0x17]\n\ +_08042B42:\n\ + mov r0, r9\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_08042B4C:\n\ + mov r0, r9\n\ + cmp r0, 0\n\ + bne _08042B56\n\ + bl _0804443A\n\ +_08042B56:\n\ + bl weather_get_current\n\ + ldr r1, =gBattleCommunication\n\ + strb r0, [r1, 0x5]\n\ + ldr r0, =gUnknown_082DACE7\n\ + bl b_push_move_exec\n\ + bl _0804441E\n\ + .pool\n\ +_08042B78:\n\ + ldr r2, =gBattleWeather\n\ + ldrh r1, [r2]\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042B88\n\ + bl _0804441E\n\ +_08042B88:\n\ + movs r0, 0x5\n\ + strh r0, [r2]\n\ + ldr r0, =BattleScript_DrizzleActivates\n\ + bl b_push_move_exec\n\ + ldr r0, =gBattleScripting\n\ + mov r1, r10\n\ + strb r1, [r0, 0x17]\n\ + bl _080443D0\n\ + .pool\n\ +_08042BA8:\n\ + ldr r2, =gBattleWeather\n\ + ldrh r1, [r2]\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042BB8\n\ + bl _0804441E\n\ +_08042BB8:\n\ + movs r0, 0x18\n\ + strh r0, [r2]\n\ + ldr r0, =BattleScript_SandstreamActivates\n\ + bl b_push_move_exec\n\ + ldr r0, =gBattleScripting\n\ + mov r2, r10\n\ + strb r2, [r0, 0x17]\n\ + bl _080443D0\n\ + .pool\n\ +_08042BD8:\n\ + ldr r2, =gBattleWeather\n\ + ldrh r1, [r2]\n\ + movs r0, 0x40\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042BE8\n\ + bl _0804441E\n\ +_08042BE8:\n\ + movs r0, 0x60\n\ + strh r0, [r2]\n\ + ldr r0, =BattleScript_DroughtActivates\n\ + bl b_push_move_exec\n\ + ldr r0, =gBattleScripting\n\ + mov r3, r10\n\ + strb r3, [r0, 0x17]\n\ + bl _080443D0\n\ + .pool\n\ +_08042C08:\n\ + ldr r0, =gSpecialStatuses\n\ + mov r5, r10\n\ + lsls r2, r5, 2\n\ + adds r1, r2, r5\n\ + lsls r1, 2\n\ + adds r3, r1, r0\n\ + ldrb r0, [r3]\n\ + lsls r0, 28\n\ + cmp r0, 0\n\ + bge _08042C20\n\ + bl _0804441E\n\ +_08042C20:\n\ + ldr r1, =gStatuses3\n\ + adds r1, r2, r1\n\ + ldr r0, [r1]\n\ + movs r2, 0x80\n\ + lsls r2, 12\n\ + orrs r0, r2\n\ + str r0, [r1]\n\ + ldrb r0, [r3]\n\ + movs r1, 0x8\n\ + b _08042C92\n\ + .pool\n\ +_08042C3C:\n\ + mov r0, r10\n\ + bl CastformDataTypeChange\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ + cmp r0, 0\n\ + bne _08042C50\n\ + bl _0804443A\n\ +_08042C50:\n\ + ldr r0, =BattleScript_CastformChange\n\ + bl b_push_move_exec\n\ + ldr r0, =gBattleScripting\n\ + mov r1, r10\n\ + strb r1, [r0, 0x17]\n\ + bl _080442E2\n\ + .pool\n\ +_08042C68:\n\ + ldr r0, =gSpecialStatuses\n\ + mov r3, r10\n\ + lsls r2, r3, 2\n\ + adds r1, r2, r3\n\ + lsls r1, 2\n\ + adds r3, r1, r0\n\ + ldrb r0, [r3]\n\ + lsls r0, 27\n\ + cmp r0, 0\n\ + bge _08042C80\n\ + bl _0804441E\n\ +_08042C80:\n\ + ldr r1, =gStatuses3\n\ + adds r1, r2, r1\n\ + ldr r0, [r1]\n\ + movs r2, 0x80\n\ + lsls r2, 13\n\ + orrs r0, r2\n\ + str r0, [r1]\n\ + ldrb r0, [r3]\n\ + movs r1, 0x10\n\ +_08042C92:\n\ + orrs r0, r1\n\ + strb r0, [r3]\n\ + bl _0804441E\n\ + .pool\n\ +_08042CA4:\n\ + movs r6, 0\n\ + ldrb r5, [r5]\n\ + cmp r6, r5\n\ + bcc _08042CB0\n\ + bl _0804441E\n\ +_08042CB0:\n\ + adds r0, r6, 0\n\ + bl CastformDataTypeChange\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ + cmp r0, 0\n\ + beq _08042CC4\n\ + bl _080442D8\n\ +_08042CC4:\n\ + adds r0, r6, 0x1\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r6, r0\n\ + bcc _08042CB0\n\ + bl _0804441E\n\ + .pool\n\ +_08042CDC:\n\ + ldr r5, =gBattleMons\n\ + mov r8, r5\n\ + movs r0, 0x58\n\ + mov r6, r10\n\ + muls r6, r0\n\ + adds r4, r6, r5\n\ + ldrh r0, [r4, 0x28]\n\ + cmp r0, 0\n\ + bne _08042CF2\n\ + bl _0804441E\n\ +_08042CF2:\n\ + ldr r0, =gBankAttacker\n\ + mov r1, r10\n\ + strb r1, [r0]\n\ + ldrb r5, [r7]\n\ + cmp r5, 0x2C\n\ + beq _08042D22\n\ + cmp r5, 0x2C\n\ + bgt _08042D14\n\ + cmp r5, 0x3\n\ + bne _08042D08\n\ + b _08042E84\n\ +_08042D08:\n\ + bl _0804441E\n\ + .pool\n\ +_08042D14:\n\ + cmp r5, 0x36\n\ + bne _08042D1A\n\ + b _08042ED0\n\ +_08042D1A:\n\ + cmp r5, 0x3D\n\ + beq _08042DA0\n\ + bl _0804441E\n\ +_08042D22:\n\ + movs r0, 0\n\ + str r0, [sp]\n\ + movs r0, 0x13\n\ + movs r1, 0\n\ + movs r2, 0xD\n\ + movs r3, 0\n\ + bl AbilityBattleEffects\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0\n\ + beq _08042D3E\n\ + bl _0804441E\n\ +_08042D3E:\n\ + str r0, [sp]\n\ + movs r0, 0x13\n\ + movs r1, 0\n\ + movs r2, 0x4D\n\ + movs r3, 0\n\ + bl AbilityBattleEffects\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _08042D56\n\ + bl _0804441E\n\ +_08042D56:\n\ + ldr r0, =gBattleWeather\n\ + ldrh r1, [r0]\n\ + movs r0, 0x7\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08042D66\n\ + bl _0804441E\n\ +_08042D66:\n\ + ldrh r0, [r4, 0x2C]\n\ + ldrh r2, [r4, 0x28]\n\ + cmp r0, r2\n\ + bhi _08042D72\n\ + bl _0804441E\n\ +_08042D72:\n\ + strb r5, [r7]\n\ + ldr r0, =BattleScript_RainDishActivates\n\ + bl b_push_move_exec\n\ + ldr r1, =gBattleMoveDamage\n\ + ldrh r0, [r4, 0x2C]\n\ + lsrs r0, 4\n\ + str r0, [r1]\n\ + cmp r0, 0\n\ + bne _08042D8A\n\ + movs r0, 0x1\n\ + str r0, [r1]\n\ +_08042D8A:\n\ + ldr r0, [r1]\n\ + negs r0, r0\n\ + str r0, [r1]\n\ + bl _080443D0\n\ + .pool\n\ +_08042DA0:\n\ + mov r0, r8\n\ + adds r0, 0x4C\n\ + adds r5, r6, r0\n\ + ldrb r0, [r5]\n\ + cmp r0, 0\n\ + bne _08042DB0\n\ + bl _0804441E\n\ +_08042DB0:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0x3\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + lsrs r4, r0, 16\n\ + cmp r4, 0\n\ + beq _08042DCA\n\ + bl _0804441E\n\ +_08042DCA:\n\ + ldr r0, [r5]\n\ + movs r1, 0x88\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042DDC\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_PoisonJpn\n\ + bl StringCopy\n\ +_08042DDC:\n\ + ldr r0, [r5]\n\ + movs r1, 0x7\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042DEE\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_SleepJpn\n\ + bl StringCopy\n\ +_08042DEE:\n\ + ldr r0, [r5]\n\ + movs r1, 0x40\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042E00\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_ParalysisJpn\n\ + bl StringCopy\n\ +_08042E00:\n\ + ldr r0, [r5]\n\ + movs r1, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042E12\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_BurnJpn\n\ + bl StringCopy\n\ +_08042E12:\n\ + ldr r0, [r5]\n\ + movs r1, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042E24\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_IceJpn\n\ + bl StringCopy\n\ +_08042E24:\n\ + str r4, [r5]\n\ + mov r1, r8\n\ + adds r1, 0x50\n\ + adds r1, r6, r1\n\ + ldr r0, [r1]\n\ + ldr r2, =0xf7ffffff\n\ + ands r0, r2\n\ + str r0, [r1]\n\ + ldr r0, =gBattleScripting\n\ + ldr r4, =gActiveBank\n\ + mov r3, r10\n\ + strb r3, [r4]\n\ + strb r3, [r0, 0x17]\n\ + ldr r0, =BattleScript_ShedSkinActivates\n\ + bl b_push_move_exec\n\ + str r5, [sp]\n\ + movs r0, 0\n\ + movs r1, 0x28\n\ + movs r2, 0\n\ + movs r3, 0x4\n\ + bl EmitSetAttributes\n\ + ldrb r0, [r4]\n\ + bl MarkBufferBankForExecution\n\ + bl _080443D0\n\ + .pool\n\ +_08042E84:\n\ + ldrb r2, [r4, 0x1B]\n\ + movs r0, 0x1B\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0xB\n\ + ble _08042E92\n\ + bl _0804441E\n\ +_08042E92:\n\ + ldr r0, =gDisableStructs\n\ + mov r5, r10\n\ + lsls r1, r5, 3\n\ + subs r1, r5\n\ + lsls r1, 2\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x16]\n\ + cmp r0, 0x2\n\ + bne _08042EA8\n\ + bl _0804441E\n\ +_08042EA8:\n\ + adds r0, r2, 0x1\n\ + movs r1, 0\n\ + strb r0, [r4, 0x1B]\n\ + ldr r4, =gBattleScripting\n\ + movs r0, 0x11\n\ + strb r0, [r4, 0x10]\n\ + strb r1, [r4, 0x11]\n\ + ldr r0, =BattleScript_SpeedBoostActivates\n\ + bl b_push_move_exec\n\ + strb r5, [r4, 0x17]\n\ + bl _080443D0\n\ + .pool\n\ +_08042ED0:\n\ + ldr r2, =gDisableStructs\n\ + ldrb r0, [r0]\n\ + lsls r1, r0, 3\n\ + subs r1, r0\n\ + lsls r1, 2\n\ + adds r1, r2\n\ + ldrb r3, [r1, 0x18]\n\ + lsls r0, r3, 31\n\ + lsrs r0, 31\n\ + movs r2, 0x1\n\ + eors r2, r0\n\ + movs r0, 0x2\n\ + negs r0, r0\n\ + ands r0, r3\n\ + orrs r0, r2\n\ + strb r0, [r1, 0x18]\n\ + bl _0804441E\n\ + .pool\n\ +_08042EF8:\n\ + ldrb r0, [r7]\n\ + cmp r0, 0x2B\n\ + beq _08042F02\n\ + bl _0804441E\n\ +_08042F02:\n\ + movs r4, 0\n\ + ldr r0, =gSoundMovesTable\n\ + ldrh r2, [r0]\n\ + ldr r3, =0x0000ffff\n\ + adds r1, r0, 0\n\ + cmp r2, r3\n\ + bne _08042F14\n\ + bl _0804441E\n\ +_08042F14:\n\ + cmp r2, r5\n\ + beq _08042F2C\n\ + adds r2, r1, 0\n\ +_08042F1A:\n\ + adds r2, 0x2\n\ + adds r4, 0x1\n\ + ldrh r0, [r2]\n\ + cmp r0, r3\n\ + bne _08042F28\n\ + bl _0804441E\n\ +_08042F28:\n\ + cmp r0, r5\n\ + bne _08042F1A\n\ +_08042F2C:\n\ + lsls r0, r4, 1\n\ + adds r0, r1\n\ + ldrh r1, [r0]\n\ + ldr r0, =0x0000ffff\n\ + cmp r1, r0\n\ + bne _08042F3C\n\ + bl _0804441E\n\ +_08042F3C:\n\ + ldr r1, =gBattleMons\n\ + ldr r0, =gBankAttacker\n\ + ldrb r2, [r0]\n\ + movs r0, 0x58\n\ + muls r0, r2\n\ + adds r1, 0x50\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + movs r1, 0x80\n\ + lsls r1, 5\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08042F62\n\ + ldr r0, =gHitMarker\n\ + ldr r1, [r0]\n\ + movs r2, 0x80\n\ + lsls r2, 4\n\ + orrs r1, r2\n\ + str r1, [r0]\n\ +_08042F62:\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_SoundproofProtected\n\ + str r0, [r1]\n\ + movs r0, 0x1\n\ + mov r9, r0\n\ + bl _08044424\n\ + .pool\n\ +_08042F8C:\n\ + cmp r5, 0\n\ + bne _08042F94\n\ + bl _0804441E\n\ +_08042F94:\n\ + ldrb r0, [r7]\n\ + cmp r0, 0xB\n\ + beq _08043004\n\ + cmp r0, 0xB\n\ + bgt _08042FA4\n\ + cmp r0, 0xA\n\ + beq _08042FAA\n\ + b _08043126\n\ +_08042FA4:\n\ + cmp r0, 0x12\n\ + beq _0804305C\n\ + b _08043126\n\ +_08042FAA:\n\ + cmp r3, 0xD\n\ + beq _08042FB0\n\ + b _08043126\n\ +_08042FB0:\n\ + ldr r0, =gBattleMoves\n\ + lsls r1, r5, 1\n\ + adds r1, r5\n\ + lsls r1, 2\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + cmp r0, 0\n\ + bne _08042FC2\n\ + b _08043126\n\ +_08042FC2:\n\ + ldr r1, =gProtectStructs\n\ + ldr r0, =gBankAttacker\n\ + ldrb r0, [r0]\n\ + lsls r0, 4\n\ + adds r0, r1\n\ + ldrb r0, [r0, 0x2]\n\ + lsls r0, 28\n\ + cmp r0, 0\n\ + bge _08042FF0\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_MoveHPDrain\n\ + b _08042FF4\n\ + .pool\n\ +_08042FF0:\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_MoveHPDrain_PPLoss\n\ +_08042FF4:\n\ + str r0, [r1]\n\ + movs r1, 0x1\n\ + b _08043124\n\ + .pool\n\ +_08043004:\n\ + cmp r3, 0xB\n\ + beq _0804300A\n\ + b _08043126\n\ +_0804300A:\n\ + ldr r0, =gBattleMoves\n\ + lsls r1, r5, 1\n\ + adds r1, r5\n\ + lsls r1, 2\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + cmp r0, 0\n\ + bne _0804301C\n\ + b _08043126\n\ +_0804301C:\n\ + ldr r1, =gProtectStructs\n\ + ldr r0, =gBankAttacker\n\ + ldrb r0, [r0]\n\ + lsls r0, 4\n\ + adds r0, r1\n\ + ldrb r0, [r0, 0x2]\n\ + lsls r0, 28\n\ + cmp r0, 0\n\ + bge _08043048\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_MoveHPDrain\n\ + b _0804304C\n\ + .pool\n\ +_08043048:\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_MoveHPDrain_PPLoss\n\ +_0804304C:\n\ + str r0, [r1]\n\ + movs r2, 0x1\n\ + mov r9, r2\n\ + b _08043126\n\ + .pool\n\ +_0804305C:\n\ + cmp r3, 0xA\n\ + bne _08043126\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r3, r10\n\ + muls r3, r0\n\ + adds r0, r3, 0\n\ + adds r1, 0x4C\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + movs r1, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043126\n\ + ldr r2, =gBattleResources\n\ + ldr r0, [r2]\n\ + ldr r0, [r0, 0x4]\n\ + mov r5, r10\n\ + lsls r1, r5, 2\n\ + adds r0, r1\n\ + ldr r3, [r0]\n\ + movs r4, 0x1\n\ + ands r3, r4\n\ + adds r5, r1, 0\n\ + cmp r3, 0\n\ + bne _080430EC\n\ + ldr r0, =gBattleCommunication\n\ + strb r3, [r0, 0x5]\n\ + ldr r1, =gProtectStructs\n\ + ldr r0, =gBankAttacker\n\ + ldrb r0, [r0]\n\ + lsls r0, 4\n\ + adds r0, r1\n\ + ldrb r0, [r0, 0x2]\n\ + lsls r0, 28\n\ + cmp r0, 0\n\ + bge _080430C8\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_FlashFireBoost\n\ + b _080430CC\n\ + .pool\n\ +_080430C8:\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_FlashFireBoost_PPLoss\n\ +_080430CC:\n\ + str r0, [r1]\n\ + ldr r0, [r2]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r5\n\ + ldr r0, [r1]\n\ + movs r2, 0x1\n\ + orrs r0, r2\n\ + str r0, [r1]\n\ + movs r0, 0x2\n\ + mov r9, r0\n\ + b _08043126\n\ + .pool\n\ +_080430EC:\n\ + ldr r0, =gBattleCommunication\n\ + strb r4, [r0, 0x5]\n\ + ldr r1, =gProtectStructs\n\ + ldr r0, =gBankAttacker\n\ + ldrb r0, [r0]\n\ + lsls r0, 4\n\ + adds r0, r1\n\ + ldrb r0, [r0, 0x2]\n\ + lsls r0, 28\n\ + cmp r0, 0\n\ + bge _0804311C\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_FlashFireBoost\n\ + b _08043120\n\ + .pool\n\ +_0804311C:\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_FlashFireBoost_PPLoss\n\ +_08043120:\n\ + str r0, [r1]\n\ + movs r1, 0x2\n\ +_08043124:\n\ + mov r9, r1\n\ +_08043126:\n\ + mov r2, r9\n\ + cmp r2, 0x1\n\ + beq _08043130\n\ + bl _0804441E\n\ +_08043130:\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r3, r10\n\ + muls r3, r0\n\ + adds r0, r3, 0\n\ + adds r1, r0, r1\n\ + ldrh r0, [r1, 0x2C]\n\ + ldrh r5, [r1, 0x28]\n\ + cmp r0, r5\n\ + bne _0804318C\n\ + ldr r1, =gProtectStructs\n\ + ldr r0, =gBankAttacker\n\ + ldrb r0, [r0]\n\ + lsls r0, 4\n\ + adds r0, r1\n\ + ldrb r0, [r0, 0x2]\n\ + lsls r0, 28\n\ + cmp r0, 0\n\ + bge _08043178\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =gUnknown_082DB592\n\ + str r0, [r1]\n\ + bl _0804441E\n\ + .pool\n\ +_08043178:\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =gUnknown_082DB591\n\ + str r0, [r1]\n\ + bl _0804441E\n\ + .pool\n\ +_0804318C:\n\ + ldr r2, =gBattleMoveDamage\n\ + ldrh r0, [r1, 0x2C]\n\ + lsrs r0, 2\n\ + str r0, [r2]\n\ + cmp r0, 0\n\ + bne _0804319C\n\ + mov r0, r9\n\ + str r0, [r2]\n\ +_0804319C:\n\ + ldr r0, [r2]\n\ + negs r0, r0\n\ + str r0, [r2]\n\ + bl _0804441E\n\ + .pool\n\ +_080431AC:\n\ + ldrb r0, [r7]\n\ + subs r0, 0x9\n\ + cmp r0, 0x2F\n\ + bls _080431B8\n\ + bl _0804441E\n\ +_080431B8:\n\ + lsls r0, 2\n\ + ldr r1, =_080431C8\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080431C8:\n\ + .4byte _080435E4\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _08043288\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _08043350\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _08043410\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _08043508\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _080436C0\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804441E\n\ + .4byte _0804379C\n\ +_08043288:\n\ + ldr r0, =gBattleMoveFlags\n\ + ldrb r1, [r0]\n\ + movs r0, 0x29\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043298\n\ + bl _0804441E\n\ +_08043298:\n\ + cmp r5, 0xA5\n\ + bne _080432A0\n\ + bl _0804441E\n\ +_080432A0:\n\ + ldr r0, =gBattleMoves\n\ + lsls r1, r5, 1\n\ + adds r1, r5\n\ + lsls r1, 2\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + cmp r0, 0\n\ + bne _080432B4\n\ + bl _0804441E\n\ +_080432B4:\n\ + ldr r2, =gSpecialStatuses\n\ + ldr r0, =gBankTarget\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r1, r0, 2\n\ + adds r0, r2, 0\n\ + adds r0, 0x8\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _080432DC\n\ + adds r0, r2, 0\n\ + adds r0, 0xC\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _080432DC\n\ + bl _0804441E\n\ +_080432DC:\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r2, r10\n\ + muls r2, r0\n\ + adds r0, r2, 0\n\ + adds r1, r0, r1\n\ + adds r4, r1, 0\n\ + adds r4, 0x21\n\ + ldrb r0, [r4]\n\ + cmp r0, r3\n\ + bne _080432F6\n\ + bl _0804441E\n\ +_080432F6:\n\ + adds r2, r1, 0\n\ + adds r2, 0x22\n\ + ldrb r0, [r2]\n\ + cmp r0, r3\n\ + bne _08043304\n\ + bl _0804441E\n\ +_08043304:\n\ + ldrh r0, [r1, 0x28]\n\ + cmp r0, 0\n\ + bne _0804330E\n\ + bl _0804441E\n\ +_0804330E:\n\ + strb r3, [r4]\n\ + strb r3, [r2]\n\ + ldr r1, =gBattleTextBuff1\n\ + movs r0, 0xFD\n\ + strb r0, [r1]\n\ + movs r0, 0x3\n\ + strb r0, [r1, 0x1]\n\ + strb r3, [r1, 0x2]\n\ + movs r0, 0xFF\n\ + strb r0, [r1, 0x3]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_ColorChangeActivates\n\ + str r0, [r1]\n\ + bl _080443D0\n\ + .pool\n\ +_08043350:\n\ + ldr r0, =gBattleMoveFlags\n\ + ldrb r1, [r0]\n\ + movs r0, 0x29\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043360\n\ + bl _0804441E\n\ +_08043360:\n\ + ldr r1, =gBattleMons\n\ + ldr r0, =gBankAttacker\n\ + ldrb r2, [r0]\n\ + movs r0, 0x58\n\ + muls r0, r2\n\ + adds r3, r0, r1\n\ + ldrh r0, [r3, 0x28]\n\ + cmp r0, 0\n\ + bne _08043376\n\ + bl _0804441E\n\ +_08043376:\n\ + ldr r0, =gProtectStructs\n\ + lsls r1, r2, 4\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _08043388\n\ + bl _0804441E\n\ +_08043388:\n\ + ldr r2, =gSpecialStatuses\n\ + ldr r0, =gBankTarget\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r1, r0, 2\n\ + adds r0, r2, 0\n\ + adds r0, 0x8\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _080433B0\n\ + adds r0, r2, 0\n\ + adds r0, 0xC\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _080433B0\n\ + bl _0804441E\n\ +_080433B0:\n\ + ldr r1, =gBattleMoves\n\ + lsls r0, r5, 1\n\ + adds r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldrb r1, [r0, 0x8]\n\ + movs r2, 0x1\n\ + adds r0, r2, 0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _080433CA\n\ + bl _0804441E\n\ +_080433CA:\n\ + ldr r1, =gBattleMoveDamage\n\ + ldrh r0, [r3, 0x2C]\n\ + lsrs r0, 4\n\ + str r0, [r1]\n\ + cmp r0, 0\n\ + bne _080433D8\n\ + str r2, [r1]\n\ +_080433D8:\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_RoughSkinActivates\n\ + str r0, [r1]\n\ + bl _080443D0\n\ + .pool\n\ +_08043410:\n\ + ldr r0, =gBattleMoveFlags\n\ + ldrb r1, [r0]\n\ + movs r0, 0x29\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043420\n\ + bl _0804441E\n\ +_08043420:\n\ + ldr r1, =gBattleMons\n\ + ldr r0, =gBankAttacker\n\ + ldrb r2, [r0]\n\ + movs r0, 0x58\n\ + muls r0, r2\n\ + adds r0, r1\n\ + ldrh r0, [r0, 0x28]\n\ + cmp r0, 0\n\ + bne _08043436\n\ + bl _0804441E\n\ +_08043436:\n\ + ldr r0, =gProtectStructs\n\ + lsls r1, r2, 4\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _08043448\n\ + bl _0804441E\n\ +_08043448:\n\ + ldr r2, =gSpecialStatuses\n\ + ldr r0, =gBankTarget\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r1, r0, 2\n\ + adds r0, r2, 0\n\ + adds r0, 0x8\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043470\n\ + adds r0, r2, 0\n\ + adds r0, 0xC\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043470\n\ + bl _0804441E\n\ +_08043470:\n\ + ldr r1, =gBattleMoves\n\ + lsls r0, r5, 1\n\ + adds r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldrb r1, [r0, 0x8]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043488\n\ + bl _0804441E\n\ +_08043488:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0xA\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + cmp r0, 0\n\ + beq _080434A0\n\ + bl _0804441E\n\ +_080434A0:\n\ + ldr r5, =gBattleCommunication\n\ + movs r4, 0x3\n\ +_080434A4:\n\ + bl Random\n\ + ands r0, r4\n\ + strb r0, [r5, 0x3]\n\ + cmp r0, 0\n\ + beq _080434A4\n\ + ldr r1, =gBattleCommunication\n\ + ldrb r0, [r1, 0x3]\n\ + cmp r0, 0x3\n\ + bne _080434BC\n\ + adds r0, 0x2\n\ + strb r0, [r1, 0x3]\n\ +_080434BC:\n\ + ldrb r0, [r1, 0x3]\n\ + adds r0, 0x40\n\ + strb r0, [r1, 0x3]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_ApplySecondaryEffect\n\ + str r0, [r1]\n\ + ldr r2, =gHitMarker\n\ + ldr r0, [r2]\n\ + movs r1, 0x80\n\ + lsls r1, 6\n\ + orrs r0, r1\n\ + str r0, [r2]\n\ + bl _080443D0\n\ + .pool\n\ +_08043508:\n\ + ldr r0, =gBattleMoveFlags\n\ + ldrb r1, [r0]\n\ + movs r0, 0x29\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043518\n\ + bl _0804441E\n\ +_08043518:\n\ + ldr r1, =gBattleMons\n\ + ldr r0, =gBankAttacker\n\ + ldrb r2, [r0]\n\ + movs r0, 0x58\n\ + muls r0, r2\n\ + adds r0, r1\n\ + ldrh r0, [r0, 0x28]\n\ + cmp r0, 0\n\ + bne _0804352E\n\ + bl _0804441E\n\ +_0804352E:\n\ + ldr r0, =gProtectStructs\n\ + lsls r1, r2, 4\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _08043540\n\ + bl _0804441E\n\ +_08043540:\n\ + ldr r2, =gSpecialStatuses\n\ + ldr r0, =gBankTarget\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r1, r0, 2\n\ + adds r0, r2, 0\n\ + adds r0, 0x8\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043568\n\ + adds r0, r2, 0\n\ + adds r0, 0xC\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043568\n\ + bl _0804441E\n\ +_08043568:\n\ + ldr r1, =gBattleMoves\n\ + lsls r0, r5, 1\n\ + adds r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldrb r1, [r0, 0x8]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043580\n\ + bl _0804441E\n\ +_08043580:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0x3\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + cmp r0, 0\n\ + beq _08043598\n\ + bl _0804441E\n\ +_08043598:\n\ + ldr r1, =gBattleCommunication\n\ + movs r0, 0x42\n\ + strb r0, [r1, 0x3]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_ApplySecondaryEffect\n\ + str r0, [r1]\n\ + ldr r2, =gHitMarker\n\ + ldr r0, [r2]\n\ + movs r1, 0x80\n\ + lsls r1, 6\n\ + orrs r0, r1\n\ + str r0, [r2]\n\ + bl _080443D0\n\ + .pool\n\ +_080435E4:\n\ + ldr r0, =gBattleMoveFlags\n\ + ldrb r1, [r0]\n\ + movs r0, 0x29\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080435F4\n\ + bl _0804441E\n\ +_080435F4:\n\ + ldr r1, =gBattleMons\n\ + ldr r0, =gBankAttacker\n\ + ldrb r2, [r0]\n\ + movs r0, 0x58\n\ + muls r0, r2\n\ + adds r0, r1\n\ + ldrh r0, [r0, 0x28]\n\ + cmp r0, 0\n\ + bne _0804360A\n\ + bl _0804441E\n\ +_0804360A:\n\ + ldr r0, =gProtectStructs\n\ + lsls r1, r2, 4\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _0804361C\n\ + bl _0804441E\n\ +_0804361C:\n\ + ldr r2, =gSpecialStatuses\n\ + ldr r0, =gBankTarget\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r1, r0, 2\n\ + adds r0, r2, 0\n\ + adds r0, 0x8\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043644\n\ + adds r0, r2, 0\n\ + adds r0, 0xC\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043644\n\ + bl _0804441E\n\ +_08043644:\n\ + ldr r1, =gBattleMoves\n\ + lsls r0, r5, 1\n\ + adds r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldrb r1, [r0, 0x8]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0804365C\n\ + bl _0804441E\n\ +_0804365C:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0x3\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + cmp r0, 0\n\ + beq _08043674\n\ + bl _0804441E\n\ +_08043674:\n\ + ldr r1, =gBattleCommunication\n\ + movs r0, 0x45\n\ + strb r0, [r1, 0x3]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_ApplySecondaryEffect\n\ + str r0, [r1]\n\ + ldr r2, =gHitMarker\n\ + ldr r0, [r2]\n\ + movs r1, 0x80\n\ + lsls r1, 6\n\ + orrs r0, r1\n\ + str r0, [r2]\n\ + bl _080443D0\n\ + .pool\n\ +_080436C0:\n\ + ldr r0, =gBattleMoveFlags\n\ + ldrb r1, [r0]\n\ + movs r0, 0x29\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080436D0\n\ + bl _0804441E\n\ +_080436D0:\n\ + ldr r1, =gBattleMons\n\ + ldr r0, =gBankAttacker\n\ + ldrb r2, [r0]\n\ + movs r0, 0x58\n\ + muls r0, r2\n\ + adds r0, r1\n\ + ldrh r0, [r0, 0x28]\n\ + cmp r0, 0\n\ + bne _080436E6\n\ + bl _0804441E\n\ +_080436E6:\n\ + ldr r0, =gProtectStructs\n\ + lsls r1, r2, 4\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _080436F8\n\ + bl _0804441E\n\ +_080436F8:\n\ + ldr r1, =gBattleMoves\n\ + lsls r0, r5, 1\n\ + adds r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldrb r1, [r0, 0x8]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043710\n\ + bl _0804441E\n\ +_08043710:\n\ + ldr r2, =gSpecialStatuses\n\ + ldr r0, =gBankTarget\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r1, r0, 2\n\ + adds r0, r2, 0\n\ + adds r0, 0x8\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043738\n\ + adds r0, r2, 0\n\ + adds r0, 0xC\n\ + adds r0, r1, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043738\n\ + bl _0804441E\n\ +_08043738:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0x3\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + cmp r0, 0\n\ + beq _08043750\n\ + bl _0804441E\n\ +_08043750:\n\ + ldr r1, =gBattleCommunication\n\ + movs r0, 0x43\n\ + strb r0, [r1, 0x3]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_ApplySecondaryEffect\n\ + str r0, [r1]\n\ + ldr r2, =gHitMarker\n\ + ldr r0, [r2]\n\ + movs r1, 0x80\n\ + lsls r1, 6\n\ + orrs r0, r1\n\ + str r0, [r2]\n\ + bl _080443D0\n\ + .pool\n\ +_0804379C:\n\ + ldr r0, =gBattleMoveFlags\n\ + ldrb r1, [r0]\n\ + movs r0, 0x29\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080437AC\n\ + bl _0804441E\n\ +_080437AC:\n\ + ldr r6, =gBattleMons\n\ + ldr r3, =gBankAttacker\n\ + mov r8, r3\n\ + ldrb r1, [r3]\n\ + movs r7, 0x58\n\ + adds r0, r1, 0\n\ + muls r0, r7\n\ + adds r0, r6\n\ + ldrh r0, [r0, 0x28]\n\ + cmp r0, 0\n\ + bne _080437C6\n\ + bl _0804441E\n\ +_080437C6:\n\ + ldr r0, =gProtectStructs\n\ + lsls r1, 4\n\ + adds r1, r0\n\ + ldrb r0, [r1, 0x1]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _080437D8\n\ + bl _0804441E\n\ +_080437D8:\n\ + ldr r1, =gBattleMoves\n\ + lsls r0, r5, 1\n\ + adds r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldrb r1, [r0, 0x8]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _080437F0\n\ + bl _0804441E\n\ +_080437F0:\n\ + ldr r3, =gSpecialStatuses\n\ + ldr r5, =gBankTarget\n\ + ldrb r1, [r5]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r2, r0, 2\n\ + adds r0, r3, 0\n\ + adds r0, 0x8\n\ + adds r0, r2, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043818\n\ + adds r0, r3, 0\n\ + adds r0, 0xC\n\ + adds r0, r2, r0\n\ + ldr r0, [r0]\n\ + cmp r0, 0\n\ + bne _08043818\n\ + bl _0804441E\n\ +_08043818:\n\ + adds r0, r1, 0\n\ + muls r0, r7\n\ + adds r0, r6\n\ + ldrh r0, [r0, 0x28]\n\ + cmp r0, 0\n\ + bne _08043828\n\ + bl _0804441E\n\ +_08043828:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0x3\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + cmp r0, 0\n\ + beq _08043840\n\ + bl _0804441E\n\ +_08043840:\n\ + mov r1, r8\n\ + ldrb r0, [r1]\n\ + muls r0, r7\n\ + adds r0, r6\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, 0xC\n\ + bne _08043854\n\ + bl _0804441E\n\ +_08043854:\n\ + ldr r0, [sp, 0x8]\n\ + ldr r1, [sp, 0x10]\n\ + bl GetGenderFromSpeciesAndPersonality\n\ + adds r4, r0, 0\n\ + ldr r0, [sp, 0xC]\n\ + ldr r1, [sp, 0x14]\n\ + bl GetGenderFromSpeciesAndPersonality\n\ + lsls r4, 24\n\ + lsls r0, 24\n\ + cmp r4, r0\n\ + bne _08043872\n\ + bl _0804441E\n\ +_08043872:\n\ + mov r2, r8\n\ + ldrb r0, [r2]\n\ + muls r0, r7\n\ + adds r4, r6, 0\n\ + adds r4, 0x50\n\ + adds r0, r4\n\ + ldr r0, [r0]\n\ + movs r1, 0xF0\n\ + lsls r1, 12\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _0804388E\n\ + bl _0804441E\n\ +_0804388E:\n\ + ldr r0, [sp, 0x8]\n\ + ldr r1, [sp, 0x10]\n\ + bl GetGenderFromSpeciesAndPersonality\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0xFF\n\ + bne _080438A2\n\ + bl _0804441E\n\ +_080438A2:\n\ + ldr r0, [sp, 0xC]\n\ + ldr r1, [sp, 0x14]\n\ + bl GetGenderFromSpeciesAndPersonality\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0xFF\n\ + bne _080438B6\n\ + bl _0804441E\n\ +_080438B6:\n\ + mov r3, r8\n\ + ldrb r0, [r3]\n\ + adds r2, r0, 0\n\ + muls r2, r7\n\ + adds r2, r4\n\ + ldr r1, =gBitTable\n\ + ldrb r0, [r5]\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + ldr r1, [r0]\n\ + lsls r1, 16\n\ + ldr r0, [r2]\n\ + orrs r0, r1\n\ + str r0, [r2]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_CuteCharmActivates\n\ + str r0, [r1]\n\ + bl _080443D0\n\ + .pool\n\ +_08043908:\n\ + movs r5, 0\n\ + mov r10, r5\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r10, r0\n\ + bcc _08043918\n\ + bl _0804441E\n\ +_08043918:\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r2, r10\n\ + muls r2, r0\n\ + adds r0, r2, 0\n\ + adds r0, r1\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + subs r0, 0x7\n\ + adds r2, r1, 0\n\ + cmp r0, 0x41\n\ + bls _08043932\n\ + b _08043B96\n\ +_08043932:\n\ + lsls r0, 2\n\ + ldr r1, =_08043948\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_08043948:\n\ + .4byte _08043AAC\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B70\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043AD4\n\ + .4byte _08043B96\n\ + .4byte _08043A50\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043A7C\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B40\n\ + .4byte _08043B10\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043B96\n\ + .4byte _08043AD4\n\ +_08043A50:\n\ + movs r0, 0x58\n\ + mov r3, r10\n\ + muls r3, r0\n\ + adds r0, r3, 0\n\ + adds r1, r2, 0\n\ + adds r1, 0x4C\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + ldr r1, =0x00000f88\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043A6A\n\ + b _08043B96\n\ +_08043A6A:\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_PoisonJpn\n\ + b _08043B5C\n\ + .pool\n\ +_08043A7C:\n\ + movs r0, 0x58\n\ + mov r1, r10\n\ + muls r1, r0\n\ + adds r0, r1, 0\n\ + adds r1, r2, 0\n\ + adds r1, 0x50\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + movs r1, 0x7\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043A96\n\ + b _08043B96\n\ +_08043A96:\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_ConfusionJpn\n\ + bl StringCopy\n\ + movs r2, 0x2\n\ + mov r9, r2\n\ + b _08043B9C\n\ + .pool\n\ +_08043AAC:\n\ + movs r0, 0x58\n\ + mov r3, r10\n\ + muls r3, r0\n\ + adds r0, r3, 0\n\ + adds r1, r2, 0\n\ + adds r1, 0x4C\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + movs r1, 0x40\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043B96\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_ParalysisJpn\n\ + b _08043B5C\n\ + .pool\n\ +_08043AD4:\n\ + movs r0, 0x58\n\ + mov r3, r10\n\ + muls r3, r0\n\ + adds r0, r2, 0\n\ + adds r0, 0x4C\n\ + adds r0, r3, r0\n\ + ldr r0, [r0]\n\ + movs r1, 0x7\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043B96\n\ + adds r2, 0x50\n\ + adds r2, r3, r2\n\ + ldr r0, [r2]\n\ + ldr r1, =0xf7ffffff\n\ + ands r0, r1\n\ + str r0, [r2]\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_SleepJpn\n\ + bl StringCopy\n\ + movs r0, 0x1\n\ + mov r9, r0\n\ + b _08043B9C\n\ + .pool\n\ +_08043B10:\n\ + movs r0, 0x58\n\ + mov r1, r10\n\ + muls r1, r0\n\ + adds r0, r1, 0\n\ + adds r1, r2, 0\n\ + adds r1, 0x4C\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + movs r1, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043B96\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_BurnJpn\n\ + bl StringCopy\n\ + movs r2, 0x1\n\ + mov r9, r2\n\ + b _08043B9C\n\ + .pool\n\ +_08043B40:\n\ + movs r0, 0x58\n\ + mov r3, r10\n\ + muls r3, r0\n\ + adds r0, r3, 0\n\ + adds r1, r2, 0\n\ + adds r1, 0x4C\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + movs r1, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043B96\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_IceJpn\n\ +_08043B5C:\n\ + bl StringCopy\n\ + movs r5, 0x1\n\ + mov r9, r5\n\ + b _08043B9C\n\ + .pool\n\ +_08043B70:\n\ + movs r0, 0x58\n\ + mov r1, r10\n\ + muls r1, r0\n\ + adds r0, r1, 0\n\ + adds r1, r2, 0\n\ + adds r1, 0x50\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + movs r1, 0xF0\n\ + lsls r1, 12\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08043B96\n\ + ldr r0, =gBattleTextBuff1\n\ + ldr r1, =gStatusConditionString_LoveJpn\n\ + bl StringCopy\n\ + movs r2, 0x3\n\ + mov r9, r2\n\ +_08043B96:\n\ + mov r3, r9\n\ + cmp r3, 0\n\ + beq _08043C50\n\ +_08043B9C:\n\ + mov r5, r9\n\ + cmp r5, 0x2\n\ + beq _08043BD0\n\ + cmp r5, 0x2\n\ + bgt _08043BB4\n\ + cmp r5, 0x1\n\ + beq _08043BBC\n\ + b _08043BFC\n\ + .pool\n\ +_08043BB4:\n\ + mov r0, r9\n\ + cmp r0, 0x3\n\ + beq _08043BE8\n\ + b _08043BFC\n\ +_08043BBC:\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r2, r10\n\ + muls r2, r0\n\ + adds r1, 0x4C\n\ + adds r2, r1\n\ + movs r0, 0\n\ + b _08043BFA\n\ + .pool\n\ +_08043BD0:\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r2, r10\n\ + muls r2, r0\n\ + adds r1, 0x50\n\ + adds r2, r1\n\ + ldr r0, [r2]\n\ + movs r1, 0x8\n\ + negs r1, r1\n\ + b _08043BF8\n\ + .pool\n\ +_08043BE8:\n\ + ldr r1, =gBattleMons\n\ + movs r0, 0x58\n\ + mov r2, r10\n\ + muls r2, r0\n\ + adds r1, 0x50\n\ + adds r2, r1\n\ + ldr r0, [r2]\n\ + ldr r1, =0xfff0ffff\n\ +_08043BF8:\n\ + ands r0, r1\n\ +_08043BFA:\n\ + str r0, [r2]\n\ +_08043BFC:\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =gUnknown_082DB68C\n\ + str r0, [r1]\n\ + ldr r0, =gBattleScripting\n\ + mov r1, r10\n\ + strb r1, [r0, 0x17]\n\ + ldr r4, =gActiveBank\n\ + strb r1, [r4]\n\ + ldrb r1, [r4]\n\ + movs r0, 0x58\n\ + muls r0, r1\n\ + ldr r1, =gBattleMons + 0x4C\n\ + adds r0, r1\n\ + str r0, [sp]\n\ + movs r0, 0\n\ + movs r1, 0x28\n\ + movs r2, 0\n\ + movs r3, 0x4\n\ + bl EmitSetAttributes\n\ + ldrb r0, [r4]\n\ + bl MarkBufferBankForExecution\n\ + bl _0804443A\n\ + .pool\n\ +_08043C50:\n\ + mov r0, r10\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r10, r0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r10, r0\n\ + bcs _08043C64\n\ + b _08043918\n\ +_08043C64:\n\ + bl _0804441E\n\ + .pool\n\ +_08043C6C:\n\ + movs r2, 0\n\ + mov r10, r2\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r10, r0\n\ + bcc _08043C7A\n\ + b _0804441E\n\ +_08043C7A:\n\ + ldr r4, =gBattleMons\n\ +_08043C7C:\n\ + movs r0, 0x58\n\ + mov r3, r10\n\ + muls r3, r0\n\ + adds r0, r3, 0\n\ + adds r0, r4\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, 0x3B\n\ + bne _08043CA0\n\ + mov r0, r10\n\ + bl CastformDataTypeChange\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ + cmp r0, 0\n\ + beq _08043CA0\n\ + b _080442FC\n\ +_08043CA0:\n\ + mov r0, r10\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r10, r0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r10, r0\n\ + bcc _08043C7C\n\ + b _0804441E\n\ + .pool\n\ +_08043CBC:\n\ + ldrb r0, [r7]\n\ + cmp r0, 0x1C\n\ + beq _08043CC4\n\ + b _0804441E\n\ +_08043CC4:\n\ + ldr r4, =gHitMarker\n\ + ldr r1, [r4]\n\ + movs r0, 0x80\n\ + lsls r0, 7\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043CD4\n\ + b _0804441E\n\ +_08043CD4:\n\ + ldr r0, =0xffffbfff\n\ + ands r1, r0\n\ + str r1, [r4]\n\ + mov r5, r8\n\ + ldr r1, [r5]\n\ + adds r1, 0xB2\n\ + ldrb r2, [r1]\n\ + movs r0, 0x3F\n\ + ands r0, r2\n\ + strb r0, [r1]\n\ + ldr r0, [r5]\n\ + adds r1, r0, 0\n\ + adds r1, 0xB2\n\ + ldrb r0, [r1]\n\ + cmp r0, 0x6\n\ + bne _08043CF8\n\ + movs r0, 0x2\n\ + strb r0, [r1]\n\ +_08043CF8:\n\ + ldr r1, =gBattleCommunication\n\ + mov r2, r8\n\ + ldr r0, [r2]\n\ + adds r0, 0xB2\n\ + ldrb r0, [r0]\n\ + adds r0, 0x40\n\ + strb r0, [r1, 0x3]\n\ + ldr r1, =gBattleScripting\n\ + ldr r0, =gBankTarget\n\ + ldrb r0, [r0]\n\ + strb r0, [r1, 0x17]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_SynchronizeActivates\n\ + str r0, [r1]\n\ + ldr r0, [r4]\n\ + movs r1, 0x80\n\ + lsls r1, 6\n\ + orrs r0, r1\n\ + str r0, [r4]\n\ + b _080443D0\n\ + .pool\n\ +_08043D40:\n\ + ldrb r0, [r7]\n\ + cmp r0, 0x1C\n\ + beq _08043D48\n\ + b _0804441E\n\ +_08043D48:\n\ + ldr r4, =gHitMarker\n\ + ldr r1, [r4]\n\ + movs r0, 0x80\n\ + lsls r0, 7\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _08043D58\n\ + b _0804441E\n\ +_08043D58:\n\ + ldr r0, =0xffffbfff\n\ + ands r1, r0\n\ + str r1, [r4]\n\ + mov r3, r8\n\ + ldr r1, [r3]\n\ + adds r1, 0xB2\n\ + ldrb r2, [r1]\n\ + movs r0, 0x3F\n\ + ands r0, r2\n\ + strb r0, [r1]\n\ + ldr r0, [r3]\n\ + adds r1, r0, 0\n\ + adds r1, 0xB2\n\ + ldrb r0, [r1]\n\ + cmp r0, 0x6\n\ + bne _08043D7C\n\ + movs r0, 0x2\n\ + strb r0, [r1]\n\ +_08043D7C:\n\ + ldr r1, =gBattleCommunication\n\ + mov r3, r8\n\ + ldr r0, [r3]\n\ + adds r0, 0xB2\n\ + ldrb r0, [r0]\n\ + strb r0, [r1, 0x3]\n\ + ldr r1, =gBattleScripting\n\ + ldr r0, =gBankAttacker\n\ + ldrb r0, [r0]\n\ + strb r0, [r1, 0x17]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =BattleScript_SynchronizeActivates\n\ + str r0, [r1]\n\ + ldr r0, [r4]\n\ + movs r1, 0x80\n\ + lsls r1, 6\n\ + orrs r0, r1\n\ + str r0, [r4]\n\ + b _080443D0\n\ + .pool\n\ +_08043DC4:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r1, [r0]\n\ + cmp r4, r1\n\ + blt _08043DD0\n\ + b _0804441E\n\ +_08043DD0:\n\ + ldr r0, =gBattleMons\n\ + adds r5, r1, 0\n\ + ldr r2, =gStatuses3\n\ + adds r3, r0, 0\n\ + adds r3, 0x20\n\ + movs r6, 0x80\n\ + lsls r6, 12\n\ +_08043DDE:\n\ + ldrb r1, [r3]\n\ + cmp r1, 0x16\n\ + bne _08043DEE\n\ + ldr r0, [r2]\n\ + ands r0, r6\n\ + cmp r0, 0\n\ + beq _08043DEE\n\ + b _08044324\n\ +_08043DEE:\n\ + adds r2, 0x4\n\ + adds r3, 0x58\n\ + adds r4, 0x1\n\ + cmp r4, r5\n\ + blt _08043DDE\n\ + b _0804441E\n\ + .pool\n\ +_08043E08:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08043E14\n\ + b _0804441E\n\ +_08043E14:\n\ + ldr r5, =gActiveBank\n\ + mov r8, r5\n\ + ldr r0, =gBattleMons\n\ + adds r0, 0x20\n\ + str r0, [sp, 0x1C]\n\ + movs r1, 0\n\ + str r1, [sp, 0x20]\n\ +_08043E22:\n\ + ldr r2, [sp, 0x1C]\n\ + ldrb r0, [r2]\n\ + cmp r0, 0x24\n\ + beq _08043E2C\n\ + b _08043FBE\n\ +_08043E2C:\n\ + ldr r0, =gStatuses3\n\ + ldr r3, [sp, 0x20]\n\ + adds r0, r3, r0\n\ + ldr r1, [r0]\n\ + movs r0, 0x80\n\ + lsls r0, 13\n\ + ands r1, r0\n\ + str r3, [sp, 0x18]\n\ + cmp r1, 0\n\ + bne _08043E42\n\ + b _08043FBE\n\ +_08043E42:\n\ + lsls r0, r4, 24\n\ + lsrs r0, 24\n\ + bl GetBankIdentity\n\ + movs r1, 0x1\n\ + adds r5, r0, 0\n\ + eors r5, r1\n\ + ands r5, r1\n\ + adds r0, r5, 0\n\ + bl GetBankByPlayerAI\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + adds r0, r5, 0x2\n\ + bl GetBankByPlayerAI\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + ldr r0, =gBattleTypeFlags\n\ + ldr r0, [r0]\n\ + movs r2, 0x1\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _08043E74\n\ + b _08043F84\n\ +_08043E74:\n\ + movs r1, 0x58\n\ + adds r0, r6, 0\n\ + muls r0, r1\n\ + ldr r3, =gBattleMons\n\ + adds r1, r0, r3\n\ + adds r0, r1, 0\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _08043F40\n\ + ldrh r0, [r1, 0x28]\n\ + cmp r0, 0\n\ + beq _08043EFC\n\ + movs r1, 0x58\n\ + adds r0, r7, 0\n\ + muls r0, r1\n\ + adds r1, r0, r3\n\ + adds r0, r1, 0\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _08043EFC\n\ + ldrh r0, [r1, 0x28]\n\ + cmp r0, 0\n\ + beq _08043EFC\n\ + str r2, [sp, 0x24]\n\ + bl Random\n\ + ldr r2, [sp, 0x24]\n\ + adds r1, r2, 0\n\ + ands r1, r0\n\ + lsls r1, 1\n\ + orrs r5, r1\n\ + adds r0, r5, 0\n\ + bl GetBankByPlayerAI\n\ + mov r2, r8\n\ + strb r0, [r2]\n\ + ldrb r0, [r2]\n\ + movs r3, 0x58\n\ + muls r0, r3\n\ + ldr r5, =gBattleMons\n\ + adds r0, r5\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + ldr r1, [sp, 0x1C]\n\ + strb r0, [r1]\n\ + ldrb r0, [r2]\n\ + muls r0, r3\n\ + adds r0, r5\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + ldr r2, =gLastUsedAbility\n\ + strb r0, [r2]\n\ + b _08043FAC\n\ + .pool\n\ +_08043EFC:\n\ + ldr r3, =gBattleMons\n\ + movs r2, 0x58\n\ + adds r0, r6, 0\n\ + muls r0, r2\n\ + adds r1, r0, r3\n\ + adds r0, r1, 0\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _08043F40\n\ + ldrh r0, [r1, 0x28]\n\ + cmp r0, 0\n\ + beq _08043F40\n\ + mov r5, r8\n\ + strb r6, [r5]\n\ + adds r1, r4, 0\n\ + muls r1, r2\n\ + adds r1, r3\n\ + ldrb r0, [r5]\n\ + muls r0, r2\n\ + adds r0, r3\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + adds r1, 0x20\n\ + strb r0, [r1]\n\ + ldrb r0, [r5]\n\ + muls r0, r2\n\ + adds r0, r3\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + b _08043FA8\n\ + .pool\n\ +_08043F40:\n\ + ldr r3, =gBattleMons\n\ + movs r2, 0x58\n\ + adds r0, r7, 0\n\ + muls r0, r2\n\ + adds r1, r0, r3\n\ + adds r0, r1, 0\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _08043FB6\n\ + ldrh r0, [r1, 0x28]\n\ + cmp r0, 0\n\ + beq _08043FB6\n\ + mov r5, r8\n\ + strb r7, [r5]\n\ + adds r1, r4, 0\n\ + muls r1, r2\n\ + adds r1, r3\n\ + ldrb r0, [r5]\n\ + muls r0, r2\n\ + adds r0, r3\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + adds r1, 0x20\n\ + strb r0, [r1]\n\ + ldrb r0, [r5]\n\ + muls r0, r2\n\ + adds r0, r3\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + b _08043FA8\n\ + .pool\n\ +_08043F84:\n\ + mov r2, r8\n\ + strb r6, [r2]\n\ + movs r3, 0x58\n\ + adds r0, r6, 0\n\ + muls r0, r3\n\ + ldr r5, =gBattleMons\n\ + adds r0, r5\n\ + adds r2, r0, 0\n\ + adds r2, 0x20\n\ + ldrb r1, [r2]\n\ + cmp r1, 0\n\ + beq _08043FB6\n\ + ldrh r0, [r0, 0x28]\n\ + cmp r0, 0\n\ + beq _08043FB6\n\ + ldr r0, [sp, 0x1C]\n\ + strb r1, [r0]\n\ + ldrb r0, [r2]\n\ +_08043FA8:\n\ + ldr r1, =gLastUsedAbility\n\ + strb r0, [r1]\n\ +_08043FAC:\n\ + mov r0, r9\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_08043FB6:\n\ + mov r2, r9\n\ + cmp r2, 0\n\ + beq _08043FBE\n\ + b _08044340\n\ +_08043FBE:\n\ + ldr r3, [sp, 0x1C]\n\ + adds r3, 0x58\n\ + str r3, [sp, 0x1C]\n\ + ldr r5, [sp, 0x20]\n\ + adds r5, 0x4\n\ + str r5, [sp, 0x20]\n\ + adds r4, 0x1\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + bge _08043FD6\n\ + b _08043E22\n\ +_08043FD6:\n\ + b _0804441E\n\ + .pool\n\ +_08043FE4:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r1, [r0]\n\ + cmp r4, r1\n\ + blt _08043FF0\n\ + b _0804441E\n\ +_08043FF0:\n\ + ldr r0, =gBattleMons\n\ + adds r5, r1, 0\n\ + ldr r2, =gStatuses3\n\ + adds r3, r0, 0\n\ + adds r3, 0x20\n\ + movs r6, 0x80\n\ + lsls r6, 12\n\ +_08043FFE:\n\ + ldrb r1, [r3]\n\ + cmp r1, 0x16\n\ + bne _0804400E\n\ + ldr r0, [r2]\n\ + ands r0, r6\n\ + cmp r0, 0\n\ + beq _0804400E\n\ + b _080443B4\n\ +_0804400E:\n\ + adds r2, 0x4\n\ + adds r3, 0x58\n\ + adds r4, 0x1\n\ + cmp r4, r5\n\ + blt _08043FFE\n\ + b _0804441E\n\ + .pool\n\ +_08044028:\n\ + mov r0, r10\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _0804403E\n\ + b _0804441E\n\ +_0804403E:\n\ + ldr r7, =gBattleMons\n\ +_08044040:\n\ + lsls r0, r4, 24\n\ + lsrs r0, 24\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + adds r3, r4, 0x1\n\ + cmp r0, r5\n\ + beq _0804406A\n\ + movs r0, 0x58\n\ + muls r0, r4\n\ + adds r0, r7\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, r6\n\ + bne _0804406A\n\ + ldr r0, =gLastUsedAbility\n\ + strb r6, [r0]\n\ + lsls r0, r3, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_0804406A:\n\ + adds r4, r3, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08044040\n\ + b _0804441E\n\ + .pool\n\ +_08044084:\n\ + mov r0, r10\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _0804409A\n\ + b _0804441E\n\ +_0804409A:\n\ + ldr r7, =gBattleMons\n\ +_0804409C:\n\ + lsls r0, r4, 24\n\ + lsrs r0, 24\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + adds r3, r4, 0x1\n\ + cmp r0, r5\n\ + bne _080440C6\n\ + movs r0, 0x58\n\ + muls r0, r4\n\ + adds r0, r7\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, r6\n\ + bne _080440C6\n\ + ldr r0, =gLastUsedAbility\n\ + strb r6, [r0]\n\ + lsls r0, r3, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_080440C6:\n\ + adds r4, r3, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _0804409C\n\ + b _0804441E\n\ + .pool\n\ +_080440E0:\n\ + ldrb r0, [r7]\n\ + cmp r0, 0xFD\n\ + beq _08044104\n\ + cmp r0, 0xFE\n\ + beq _0804413C\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + adds r5, r0, 0\n\ + ldrb r0, [r5]\n\ + cmp r4, r0\n\ + blt _080440F8\n\ + b _0804441E\n\ +_080440F8:\n\ + ldr r2, =gBattleMons\n\ + b _08044174\n\ + .pool\n\ +_08044104:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08044110\n\ + b _0804441E\n\ +_08044110:\n\ + ldr r5, =gStatuses3\n\ + movs r2, 0x80\n\ + lsls r2, 9\n\ + adds r1, r0, 0\n\ +_08044118:\n\ + lsls r0, r4, 2\n\ + adds r0, r5\n\ + ldr r0, [r0]\n\ + ands r0, r2\n\ + adds r3, r4, 0x1\n\ + cmp r0, 0\n\ + beq _0804412C\n\ + lsls r0, r3, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_0804412C:\n\ + adds r4, r3, 0\n\ + cmp r4, r1\n\ + blt _08044118\n\ + b _0804441E\n\ + .pool\n\ +_0804413C:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08044148\n\ + b _0804441E\n\ +_08044148:\n\ + ldr r5, =gStatuses3\n\ + movs r2, 0x80\n\ + lsls r2, 10\n\ + adds r1, r0, 0\n\ +_08044150:\n\ + lsls r0, r4, 2\n\ + adds r0, r5\n\ + ldr r0, [r0]\n\ + ands r0, r2\n\ + adds r3, r4, 0x1\n\ + cmp r0, 0\n\ + beq _08044164\n\ + lsls r0, r3, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_08044164:\n\ + adds r4, r3, 0\n\ + cmp r4, r1\n\ + blt _08044150\n\ + b _0804441E\n\ + .pool\n\ +_08044174:\n\ + movs r0, 0x58\n\ + muls r0, r4\n\ + adds r0, r2\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + adds r3, r4, 0x1\n\ + cmp r0, r6\n\ + bne _0804418C\n\ + strb r6, [r7]\n\ + lsls r0, r3, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_0804418C:\n\ + adds r4, r3, 0\n\ + ldrb r1, [r5]\n\ + cmp r4, r1\n\ + blt _08044174\n\ + b _0804441E\n\ +_08044196:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _080441A2\n\ + b _0804441E\n\ +_080441A2:\n\ + ldr r2, =gBattleMons\n\ + mov r8, r2\n\ + adds r2, r0, 0\n\ + movs r5, 0x58\n\ +_080441AA:\n\ + adds r0, r4, 0\n\ + muls r0, r5\n\ + mov r3, r8\n\ + adds r1, r0, r3\n\ + adds r0, r1, 0\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + adds r3, r4, 0x1\n\ + cmp r0, r6\n\ + bne _080441CC\n\ + ldrh r0, [r1, 0x28]\n\ + cmp r0, 0\n\ + beq _080441CC\n\ + strb r6, [r7]\n\ + lsls r0, r3, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_080441CC:\n\ + adds r4, r3, 0\n\ + cmp r4, r2\n\ + blt _080441AA\n\ + b _0804441E\n\ + .pool\n\ +_080441DC:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _080441E8\n\ + b _0804441E\n\ +_080441E8:\n\ + ldr r7, =gBattleMons\n\ + adds r1, r0, 0\n\ + movs r5, 0x58\n\ + ldr r2, =gLastUsedAbility\n\ +_080441F0:\n\ + adds r0, r4, 0\n\ + muls r0, r5\n\ + adds r0, r7\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + adds r3, r4, 0x1\n\ + cmp r0, r6\n\ + bne _0804420C\n\ + cmp r4, r10\n\ + beq _0804420C\n\ + strb r6, [r2]\n\ + lsls r0, r3, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_0804420C:\n\ + adds r4, r3, 0\n\ + cmp r4, r1\n\ + blt _080441F0\n\ + b _0804441E\n\ + .pool\n\ +_08044220:\n\ + mov r0, r10\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08044236\n\ + b _0804441E\n\ +_08044236:\n\ + ldr r7, =gBattleMons\n\ +_08044238:\n\ + lsls r0, r4, 24\n\ + lsrs r0, 24\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, r5\n\ + beq _08044264\n\ + movs r0, 0x58\n\ + muls r0, r4\n\ + adds r0, r7\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, r6\n\ + bne _08044264\n\ + ldr r0, =gLastUsedAbility\n\ + strb r6, [r0]\n\ + mov r0, r9\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_08044264:\n\ + adds r4, 0x1\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08044238\n\ + b _0804441E\n\ + .pool\n\ +_0804427C:\n\ + mov r0, r10\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08044292\n\ + b _0804441E\n\ +_08044292:\n\ + ldr r7, =gBattleMons\n\ +_08044294:\n\ + lsls r0, r4, 24\n\ + lsrs r0, 24\n\ + bl GetBankSide\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, r5\n\ + bne _080442C0\n\ + movs r0, 0x58\n\ + muls r0, r4\n\ + adds r0, r7\n\ + adds r0, 0x20\n\ + ldrb r0, [r0]\n\ + cmp r0, r6\n\ + bne _080442C0\n\ + ldr r0, =gLastUsedAbility\n\ + strb r6, [r0]\n\ + mov r0, r9\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_080442C0:\n\ + adds r4, 0x1\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + blt _08044294\n\ + b _0804441E\n\ + .pool\n\ +_080442D8:\n\ + ldr r0, =BattleScript_CastformChange\n\ + bl b_push_move_exec\n\ + ldr r0, =gBattleScripting\n\ + strb r6, [r0, 0x17]\n\ +_080442E2:\n\ + ldr r0, =gBattleStruct\n\ + ldr r0, [r0]\n\ + adds r0, 0x7F\n\ + mov r1, r9\n\ + subs r1, 0x1\n\ + strb r1, [r0]\n\ + b _0804441E\n\ + .pool\n\ +_080442FC:\n\ + ldr r0, =BattleScript_CastformChange\n\ + bl b_push_move_exec\n\ + ldr r0, =gBattleScripting\n\ + mov r5, r10\n\ + strb r5, [r0, 0x17]\n\ + ldr r0, =gBattleStruct\n\ + ldr r0, [r0]\n\ + adds r0, 0x7F\n\ + mov r1, r9\n\ + subs r1, 0x1\n\ + strb r1, [r0]\n\ + b _0804443A\n\ + .pool\n\ +_08044324:\n\ + strb r1, [r7]\n\ + ldr r0, [r2]\n\ + ldr r1, =0xfff7ffff\n\ + ands r0, r1\n\ + str r0, [r2]\n\ + ldr r0, =gUnknown_082DB4B8\n\ + bl b_push_move_exec\n\ + b _080443C8\n\ + .pool\n\ +_08044340:\n\ + ldr r0, =BattleScript_TraceActivates\n\ + bl b_push_move_exec\n\ + ldr r1, =gStatuses3\n\ + ldr r0, [sp, 0x18]\n\ + adds r1, r0, r1\n\ + ldr r0, [r1]\n\ + ldr r2, =0xffefffff\n\ + ands r0, r2\n\ + str r0, [r1]\n\ + ldr r0, =gBattleScripting\n\ + strb r4, [r0, 0x17]\n\ + ldr r1, =gBattleTextBuff1\n\ + movs r4, 0xFD\n\ + strb r4, [r1]\n\ + movs r0, 0x4\n\ + strb r0, [r1, 0x1]\n\ + ldr r2, =gActiveBank\n\ + ldrb r0, [r2]\n\ + strb r0, [r1, 0x2]\n\ + ldr r3, =gBattlePartyID\n\ + ldrb r0, [r2]\n\ + lsls r0, 1\n\ + adds r0, r3\n\ + ldrh r0, [r0]\n\ + strb r0, [r1, 0x3]\n\ + movs r0, 0xFF\n\ + strb r0, [r1, 0x4]\n\ + ldr r1, =gBattleTextBuff2\n\ + strb r4, [r1]\n\ + movs r0, 0x9\n\ + strb r0, [r1, 0x1]\n\ + ldr r0, =gLastUsedAbility\n\ + ldrb r0, [r0]\n\ + strb r0, [r1, 0x2]\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + strb r0, [r1, 0x3]\n\ + b _0804441E\n\ + .pool\n\ +_080443B4:\n\ + strb r1, [r7]\n\ + ldr r0, [r2]\n\ + ldr r1, =0xfff7ffff\n\ + ands r0, r1\n\ + str r0, [r2]\n\ + bl b_movescr_stack_push_cursor\n\ + ldr r1, =gBattlescriptCurrInstr\n\ + ldr r0, =gUnknown_082DB4C1\n\ + str r0, [r1]\n\ +_080443C8:\n\ + ldr r0, =gBattleStruct\n\ + ldr r0, [r0]\n\ + adds r0, 0xD8\n\ + strb r4, [r0]\n\ +_080443D0:\n\ + mov r0, r9\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ + b _0804441E\n\ + .pool\n\ +_080443EC:\n\ + movs r4, 0\n\ + ldr r0, =gNoOfAllBanks\n\ + ldrb r1, [r0]\n\ + cmp r4, r1\n\ + bge _0804441E\n\ + ldr r0, =gBattleMons\n\ + adds r2, r1, 0\n\ + adds r1, r0, 0\n\ + adds r1, 0x20\n\ + ldr r3, =gLastUsedAbility\n\ +_08044400:\n\ + ldrb r0, [r1]\n\ + cmp r0, r6\n\ + bne _08044416\n\ + cmp r4, r10\n\ + beq _08044416\n\ + strb r6, [r3]\n\ + mov r0, r9\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r9, r0\n\ +_08044416:\n\ + adds r1, 0x58\n\ + adds r4, 0x1\n\ + cmp r4, r2\n\ + blt _08044400\n\ +_0804441E:\n\ + mov r1, r9\n\ + cmp r1, 0\n\ + beq _0804443A\n\ +_08044424:\n\ + ldr r2, [sp, 0x4]\n\ + cmp r2, 0xB\n\ + bhi _0804443A\n\ + ldr r1, =gLastUsedAbility\n\ + ldrb r0, [r1]\n\ + cmp r0, 0xFF\n\ + beq _0804443A\n\ + adds r1, r0, 0\n\ + mov r0, r10\n\ + bl RecordAbilityBattle\n\ +_0804443A:\n\ + mov r0, r9\n\ + add sp, 0x28\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .pool\n\ + .syntax divided"); +} +#endif // NONMATCHING + +void b_call_bc_move_exec(const u8* BS_ptr) +{ + gBattlescriptCurrInstr = BS_ptr; + BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc; + gBattleMainFunc = bc_move_exec_returning; + gFightStateTracker = 0; +} + +void b_push_move_exec(const u8* BS_ptr) +{ + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BS_ptr; + BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc; + gBattleMainFunc = sub_803E08C; +} + +enum +{ + ITEM_NO_EFFECT, // 0 + ITEM_STATUS_CHANGE, // 1 + ITEM_EFFECT_OTHER, // 2 + ITEM_PP_CHANGE, // 3 + ITEM_HP_CHANGE, // 4 + ITEM_STATS_CHANGE, // 5 +}; + +enum +{ + FLAVOR_SPICY, // 0 + FLAVOR_DRY, // 1 + FLAVOR_SWEET, // 2 + FLAVOR_BITTER, // 3 + FLAVOR_SOUR, // 4 +}; + +u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) +{ + int i = 0; + u8 effect = ITEM_NO_EFFECT; + u8 changedPP = 0; + u8 bankHoldEffect, atkHoldEffect, defHoldEffect; + u8 bankQuality, atkQuality, defQuality; + u16 atkItem, defItem; + + gLastUsedItem = gBattleMons[bank].item; + if (gLastUsedItem == ITEM_ENIGMA_BERRY) + { + bankHoldEffect = gEnigmaBerries[bank].holdEffect; + bankQuality = gEnigmaBerries[bank].holdEffectParam; + } + else + { + bankHoldEffect = ItemId_GetHoldEffect(gLastUsedItem); + bankQuality = ItemId_GetHoldEffectParam(gLastUsedItem); + } + + atkItem = gBattleMons[gBankAttacker].item; + if (atkItem == ITEM_ENIGMA_BERRY) + { + atkHoldEffect = gEnigmaBerries[gBankAttacker].holdEffect; + atkQuality = gEnigmaBerries[gBankAttacker].holdEffectParam; + } + else + { + atkHoldEffect = ItemId_GetHoldEffect(atkItem); + atkQuality = ItemId_GetHoldEffectParam(atkItem); + } + + // def variables are unused + defItem = gBattleMons[gBankTarget].item; + if (defItem == ITEM_ENIGMA_BERRY) + { + defHoldEffect = gEnigmaBerries[gBankTarget].holdEffect; + defQuality = gEnigmaBerries[gBankTarget].holdEffectParam; + } + else + { + defHoldEffect = ItemId_GetHoldEffect(defItem); + defQuality = ItemId_GetHoldEffectParam(defItem); + } + + switch (caseID) + { + case 0: + switch (bankHoldEffect) + { + case HOLD_EFFECT_DOUBLE_PRIZE: + if (GetBankSide(bank) == SIDE_PLAYER) + gBattleStruct->moneyMultiplier = 2; + break; + case HOLD_EFFECT_RESTORE_STATS: + for (i = 0; i < 8; i++) + { + if (gBattleMons[bank].statStages[i] < 6) + { + gBattleMons[bank].statStages[i] = 6; + effect = ITEM_STATS_CHANGE; + } + } + if (effect) + { + gBattleScripting.bank = bank; + gStringBank = bank; + gActiveBank = gBankAttacker = bank; + b_call_bc_move_exec(BattleScript_WhiteHerbEnd2); + } + break; + } + break; + case 1: + if (gBattleMons[bank].hp) + { + switch (bankHoldEffect) + { + case HOLD_EFFECT_RESTORE_HP: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / 2 && !moveTurn) + { + gBattleMoveDamage = bankQuality; + if (gBattleMons[bank].hp + bankQuality > gBattleMons[bank].maxHP) + gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp; + gBattleMoveDamage *= -1; + b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem); + effect = 4; + } + break; + case HOLD_EFFECT_RESTORE_PP: + if (!moveTurn) + { + struct Pokemon* poke; + u8 ppBonuses; + u16 move; + + if (GetBankSide(bank) == SIDE_PLAYER) + poke = &gPlayerParty[gBattlePartyID[bank]]; + else + poke = &gEnemyParty[gBattlePartyID[bank]]; + for (i = 0; i < 4; i++) + { + move = GetMonData(poke, MON_DATA_MOVE1 + i); + changedPP = GetMonData(poke, MON_DATA_PP1 + i); + ppBonuses = GetMonData(poke, MON_DATA_PP_BONUSES); + if (move && changedPP == 0) + break; + } + if (i != 4) + { + u8 maxPP = CalculatePPWithBonus(move, ppBonuses, i); + if (changedPP + bankQuality > maxPP) + changedPP = maxPP; + else + changedPP = changedPP + bankQuality; + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 2; + gBattleTextBuff1[2] = move; + gBattleTextBuff1[3] = move >> 8; + gBattleTextBuff1[4] = 0xFF; + b_call_bc_move_exec(BattleScript_BerryPPHealEnd2); + EmitSetAttributes(0, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); + MarkBufferBankForExecution(gActiveBank); + effect = ITEM_PP_CHANGE; + } + } + break; + case HOLD_EFFECT_RESTORE_STATS: + for (i = 0; i < 8; i++) + { + if (gBattleMons[bank].statStages[i] < 6) + { + gBattleMons[bank].statStages[i] = 6; + effect = ITEM_STATS_CHANGE; + } + } + if (effect) + { + gBattleScripting.bank = bank; + gStringBank = bank; + gActiveBank = gBankAttacker = bank; + b_call_bc_move_exec(BattleScript_WhiteHerbEnd2); + } + break; + case HOLD_EFFECT_LEFTOVERS: + if (gBattleMons[bank].hp < gBattleMons[bank].maxHP && !moveTurn) + { + gBattleMoveDamage = gBattleMons[bank].maxHP / 16; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if (gBattleMons[bank].hp + gBattleMoveDamage > gBattleMons[bank].maxHP) + gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp; + gBattleMoveDamage *= -1; + b_call_bc_move_exec(BattleScript_ItemHealHP_End2); + effect = ITEM_HP_CHANGE; + RecordItemEffectBattle(bank, bankHoldEffect); + } + break; + // nice copy/paste there gamefreak, making a function for confuse berries was too much eh? + case HOLD_EFFECT_CONFUSE_SPICY: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / 2 && !moveTurn) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 8; + gBattleTextBuff1[2] = FLAVOR_SPICY; + gBattleTextBuff1[3] = EOS; + gBattleMoveDamage = gBattleMons[bank].maxHP / bankQuality; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if (gBattleMons[bank].hp + gBattleMoveDamage > gBattleMons[bank].maxHP) + gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp; + gBattleMoveDamage *= -1; + if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_SPICY) < 0) + b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2); + else + b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem); + effect = ITEM_HP_CHANGE; + } + break; + case HOLD_EFFECT_CONFUSE_DRY: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / 2 && !moveTurn) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 8; + gBattleTextBuff1[2] = FLAVOR_DRY; + gBattleTextBuff1[3] = EOS; + gBattleMoveDamage = gBattleMons[bank].maxHP / bankQuality; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if (gBattleMons[bank].hp + gBattleMoveDamage > gBattleMons[bank].maxHP) + gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp; + gBattleMoveDamage *= -1; + if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_DRY) < 0) + b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2); + else + b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem); + effect = ITEM_HP_CHANGE; + } + break; + case HOLD_EFFECT_CONFUSE_SWEET: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / 2 && !moveTurn) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 8; + gBattleTextBuff1[2] = FLAVOR_SWEET; + gBattleTextBuff1[3] = EOS; + gBattleMoveDamage = gBattleMons[bank].maxHP / bankQuality; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if (gBattleMons[bank].hp + gBattleMoveDamage > gBattleMons[bank].maxHP) + gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp; + gBattleMoveDamage *= -1; + if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_SWEET) < 0) + b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2); + else + b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem); + effect = ITEM_HP_CHANGE; + } + break; + case HOLD_EFFECT_CONFUSE_BITTER: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / 2 && !moveTurn) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 8; + gBattleTextBuff1[2] = FLAVOR_BITTER; + gBattleTextBuff1[3] = EOS; + gBattleMoveDamage = gBattleMons[bank].maxHP / bankQuality; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if (gBattleMons[bank].hp + gBattleMoveDamage > gBattleMons[bank].maxHP) + gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp; + gBattleMoveDamage *= -1; + if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_BITTER) < 0) + b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2); + else + b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem); + effect = ITEM_HP_CHANGE; + } + break; + case HOLD_EFFECT_CONFUSE_SOUR: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / 2 && !moveTurn) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 8; + gBattleTextBuff1[2] = FLAVOR_SOUR; + gBattleTextBuff1[3] = EOS; + gBattleMoveDamage = gBattleMons[bank].maxHP / bankQuality; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + if (gBattleMons[bank].hp + gBattleMoveDamage > gBattleMons[bank].maxHP) + gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp; + gBattleMoveDamage *= -1; + if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_SOUR) < 0) + b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2); + else + b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem); + effect = ITEM_HP_CHANGE; + } + break; + // copy/paste again, smh + case HOLD_EFFECT_ATTACK_UP: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality && !moveTurn && gBattleMons[bank].statStages[STAT_STAGE_ATK] < 0xC) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 5; + gBattleTextBuff1[2] = STAT_STAGE_ATK; + gBattleTextBuff1[3] = EOS; + + gBattleTextBuff2[0] = 0xFD; + gBattleTextBuff2[1] = 0; + gBattleTextBuff2[2] = 0xD2; + gBattleTextBuff2[3] = 0xD2 >> 8; + gBattleTextBuff2[4] = EOS; + + gEffectBank = bank; + gBattleScripting.statChanger = 0x10 + STAT_STAGE_ATK; + gBattleScripting.animArg1 = 0xE + STAT_STAGE_ATK; + gBattleScripting.animArg2 = 0; + b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2); + effect = ITEM_STATS_CHANGE; + } + break; + case HOLD_EFFECT_DEFENSE_UP: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality && !moveTurn && gBattleMons[bank].statStages[STAT_STAGE_DEF] < 0xC) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 5; + gBattleTextBuff1[2] = STAT_STAGE_DEF; + gBattleTextBuff1[3] = EOS; + + gEffectBank = bank; + gBattleScripting.statChanger = 0x10 + STAT_STAGE_DEF; + gBattleScripting.animArg1 = 0xE + STAT_STAGE_DEF; + gBattleScripting.animArg2 = 0; + b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2); + effect = ITEM_STATS_CHANGE; + } + break; + case HOLD_EFFECT_SPEED_UP: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality && !moveTurn && gBattleMons[bank].statStages[STAT_STAGE_SPEED] < 0xC) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 5; + gBattleTextBuff1[2] = STAT_STAGE_SPEED; + gBattleTextBuff1[3] = EOS; + + gEffectBank = bank; + gBattleScripting.statChanger = 0x10 + STAT_STAGE_SPEED; + gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPEED; + gBattleScripting.animArg2 = 0; + b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2); + effect = ITEM_STATS_CHANGE; + } + break; + case HOLD_EFFECT_SP_ATTACK_UP: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality && !moveTurn && gBattleMons[bank].statStages[STAT_STAGE_SPATK] < 0xC) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 5; + gBattleTextBuff1[2] = STAT_STAGE_SPATK; + gBattleTextBuff1[3] = EOS; + + gEffectBank = bank; + gBattleScripting.statChanger = 0x10 + STAT_STAGE_SPATK; + gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPATK; + gBattleScripting.animArg2 = 0; + b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2); + effect = ITEM_STATS_CHANGE; + } + break; + case HOLD_EFFECT_SP_DEFENSE_UP: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality && !moveTurn && gBattleMons[bank].statStages[STAT_STAGE_SPDEF] < 0xC) + { + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 5; + gBattleTextBuff1[2] = STAT_STAGE_SPDEF; + gBattleTextBuff1[3] = EOS; + + gEffectBank = bank; + gBattleScripting.statChanger = 0x10 + STAT_STAGE_SPDEF; + gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPDEF; + gBattleScripting.animArg2 = 0; + b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2); + effect = ITEM_STATS_CHANGE; + } + break; + case HOLD_EFFECT_CRITICAL_UP: + if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality && !moveTurn && !(gBattleMons[bank].status2 & STATUS2_FOCUS_ENERGY)) + { + gBattleMons[bank].status2 |= STATUS2_FOCUS_ENERGY; + b_call_bc_move_exec(BattleScript_BerryFocusEnergyEnd2); + effect = ITEM_EFFECT_OTHER; + } + break; + case HOLD_EFFECT_RANDOM_STAT_UP: + if (!moveTurn && gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality) + { + for (i = 0; i < 5; i++) + { + if (gBattleMons[bank].statStages[STAT_STAGE_ATK + i] < 0xC) + break; + } + if (i != 5) + { + do + { + i = Random() % 5; + } while (gBattleMons[bank].statStages[STAT_STAGE_ATK + i] == 0xC); + + gBattleTextBuff1[0] = 0xFD; + gBattleTextBuff1[1] = 5; + gBattleTextBuff1[2] = i + 1; + gBattleTextBuff1[3] = EOS; + + gBattleTextBuff2[0] = 0xFD; + gBattleTextBuff2[1] = 0; + gBattleTextBuff2[2] = 0xD1; + gBattleTextBuff2[3] = 0xD1 >> 8; + gBattleTextBuff2[4] = 0; + gBattleTextBuff2[5] = 0xD2; + gBattleTextBuff2[6] = 0xD2 >> 8; + gBattleTextBuff2[7] = EOS; + + gEffectBank = bank; + gBattleScripting.statChanger = 0x21 + i; + gBattleScripting.animArg1 = 0x21 + i + 6; + gBattleScripting.animArg2 = 0; + b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2); + effect = ITEM_STATS_CHANGE; + } + } + break; + case HOLD_EFFECT_CURE_PAR: + if (gBattleMons[bank].status1 & STATUS_PARALYSIS) + { + gBattleMons[bank].status1 &= ~(STATUS_PARALYSIS); + b_call_bc_move_exec(BattleScript_BerryCurePrlzEnd2); + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_PSN: + if (gBattleMons[bank].status1 & STATUS_PSN_ANY) + { + gBattleMons[bank].status1 &= ~(STATUS_PSN_ANY | STATUS_TOXIC_COUNTER); + b_call_bc_move_exec(BattleScript_BerryCurePsnEnd2); + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_BRN: + if (gBattleMons[bank].status1 & STATUS_BURN) + { + gBattleMons[bank].status1 &= ~(STATUS_BURN); + b_call_bc_move_exec(BattleScript_BerryCureBrnEnd2); + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_FRZ: + if (gBattleMons[bank].status1 & STATUS_FREEZE) + { + gBattleMons[bank].status1 &= ~(STATUS_FREEZE); + b_call_bc_move_exec(BattleScript_BerryCureFrzEnd2); + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_SLP: + if (gBattleMons[bank].status1 & STATUS_SLEEP) + { + gBattleMons[bank].status1 &= ~(STATUS_SLEEP); + gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE); + b_call_bc_move_exec(BattleScript_BerryCureSlpEnd2); + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_CONFUSION: + if (gBattleMons[bank].status2 & STATUS2_CONFUSION) + { + gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION); + b_call_bc_move_exec(BattleScript_BerryCureConfusionEnd2); + effect = ITEM_EFFECT_OTHER; + } + break; + case HOLD_EFFECT_CURE_STATUS: + if (gBattleMons[bank].status1 & STATUS_ANY || gBattleMons[bank].status2 & STATUS2_CONFUSION) + { + i = 0; + if (gBattleMons[bank].status1 & STATUS_PSN_ANY) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); + i++; + } + if (gBattleMons[bank].status1 & STATUS_SLEEP) + { + gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE); + StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); + i++; + } + if (gBattleMons[bank].status1 & STATUS_PARALYSIS) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); + i++; + } + if (gBattleMons[bank].status1 & STATUS_BURN) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); + i++; + } + if (gBattleMons[bank].status1 & STATUS_FREEZE) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); + i++; + } + if (gBattleMons[bank].status2 & STATUS2_CONFUSION) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); + i++; + } + if (!(i > 1)) + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + else + gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleMons[bank].status1 = 0; + gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION); + b_call_bc_move_exec(BattleScript_BerryCureChosenStatusEnd2); + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_ATTRACT: + if (gBattleMons[bank].status2 & STATUS2_INFATUATION) + { + gBattleMons[bank].status2 &= ~(STATUS2_INFATUATION); + StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); + b_call_bc_move_exec(BattleScript_BerryCureChosenStatusEnd2); + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + effect = ITEM_EFFECT_OTHER; + } + break; + } + if (effect) + { + gBattleScripting.bank = bank; + gStringBank = bank; + gActiveBank = gBankAttacker = bank; + switch (effect) + { + case ITEM_STATUS_CHANGE: + EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[bank].status1); + MarkBufferBankForExecution(gActiveBank); + break; + case ITEM_PP_CHANGE: + if (!(gBattleMons[bank].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[bank].unk18_b & gBitTable[i])) + gBattleMons[bank].pp[i] = changedPP; + break; + } + } + } + break; + case 2: + break; + case 3: + for (bank = 0; bank < gNoOfAllBanks; bank++) + { + gLastUsedItem = gBattleMons[bank].item; + if (gBattleMons[bank].item == ITEM_ENIGMA_BERRY) + { + bankHoldEffect = gEnigmaBerries[bank].holdEffect; + bankQuality = gEnigmaBerries[bank].holdEffectParam; + } + else + { + bankHoldEffect = ItemId_GetHoldEffect(gLastUsedItem); + bankQuality = ItemId_GetHoldEffectParam(gLastUsedItem); + } + switch (bankHoldEffect) + { + case HOLD_EFFECT_CURE_PAR: + if (gBattleMons[bank].status1 & STATUS_PARALYSIS) + { + gBattleMons[bank].status1 &= ~(STATUS_PARALYSIS); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_BerryCureParRet; + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_PSN: + if (gBattleMons[bank].status1 & STATUS_PSN_ANY) + { + gBattleMons[bank].status1 &= ~(STATUS_PSN_ANY | STATUS_TOXIC_COUNTER); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_BerryCurePsnRet; + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_BRN: + if (gBattleMons[bank].status1 & STATUS_BURN) + { + gBattleMons[bank].status1 &= ~(STATUS_BURN); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_BerryCureBrnRet; + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_FRZ: + if (gBattleMons[bank].status1 & STATUS_FREEZE) + { + gBattleMons[bank].status1 &= ~(STATUS_FREEZE); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_BerryCureFrzRet; + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_SLP: + if (gBattleMons[bank].status1 & STATUS_SLEEP) + { + gBattleMons[bank].status1 &= ~(STATUS_SLEEP); + gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_BerryCureSlpRet; + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_CURE_CONFUSION: + if (gBattleMons[bank].status2 & STATUS2_CONFUSION) + { + gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION); + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_BerryCureConfusionRet; + effect = ITEM_EFFECT_OTHER; + } + break; + case HOLD_EFFECT_CURE_ATTRACT: + if (gBattleMons[bank].status2 & STATUS2_INFATUATION) + { + gBattleMons[bank].status2 &= ~(STATUS2_INFATUATION); + StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); + b_movescr_stack_push_cursor(); + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; + effect = ITEM_EFFECT_OTHER; + } + break; + case HOLD_EFFECT_CURE_STATUS: + if (gBattleMons[bank].status1 & STATUS_ANY || gBattleMons[bank].status2 & STATUS2_CONFUSION) + { + if (gBattleMons[bank].status1 & STATUS_PSN_ANY) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); + } + if (gBattleMons[bank].status1 & STATUS_SLEEP) + { + gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE); + StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); + } + if (gBattleMons[bank].status1 & STATUS_PARALYSIS) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); + } + if (gBattleMons[bank].status1 & STATUS_BURN) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); + } + if (gBattleMons[bank].status1 & STATUS_FREEZE) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); + } + if (gBattleMons[bank].status2 & STATUS2_CONFUSION) + { + StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); + } + gBattleMons[bank].status1 = 0; + gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION); + b_movescr_stack_push_cursor(); + gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; + effect = ITEM_STATUS_CHANGE; + } + break; + case HOLD_EFFECT_RESTORE_STATS: + for (i = 0; i < 8; i++) + { + if (gBattleMons[bank].statStages[i] < 6) + { + gBattleMons[bank].statStages[i] = 6; + effect = ITEM_STATS_CHANGE; + } + } + if (effect) + { + gBattleScripting.bank = bank; + gStringBank = bank; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_WhiteHerbRet; + return effect; // unnecessary return + } + break; + } + if (effect) + { + gBattleScripting.bank = bank; + gStringBank = bank; + gActiveBank = bank; + EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1); + MarkBufferBankForExecution(gActiveBank); + break; + } + } + break; + case 4: + if (gBattleMoveDamage) + { + switch (atkHoldEffect) + { + case HOLD_EFFECT_FLINCH: + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && (gSpecialStatuses[gBankTarget].moveturnLostHP_physical || gSpecialStatuses[gBankTarget].moveturnLostHP_special) + && (Random() % 100) < atkQuality + && gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED + && gBattleMons[gBankTarget].hp) + { + gBattleCommunication[MOVE_EFFECT_BYTE] = 8; + b_movescr_stack_push_cursor(); + SetMoveEffect(0, 0); + b_movescr_stack_pop_cursor(); + } + break; + case HOLD_EFFECT_SHELL_BELL: + if (!(gBattleMoveFlags & MOVESTATUS_NOEFFECT) + && gSpecialStatuses[gBankTarget].moveturnLostHP != 0 + && gSpecialStatuses[gBankTarget].moveturnLostHP != 0xFFFF + && gBankAttacker != gBankTarget + && gBattleMons[gBankAttacker].hp != gBattleMons[gBankAttacker].maxHP + && gBattleMons[gBankAttacker].hp != 0) + { + gLastUsedItem = atkItem; + gStringBank = gBankAttacker; + gBattleScripting.bank = gBankAttacker; + gBattleMoveDamage = (gSpecialStatuses[gBankTarget].moveturnLostHP / atkQuality) * -1; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = -1; + gSpecialStatuses[gBankTarget].moveturnLostHP = 0; + b_movescr_stack_push_cursor(); + gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret; + effect++; + } + break; + } + } + break; + } + + return effect; +} + +void sub_8045868(u8 bank) +{ + gDisableStructs[bank].furyCutterCounter = 0; + gBattleMons[bank].status2 &= ~(STATUS2_DESTINY_BOND); + gStatuses3[bank] &= ~(STATUS3_GRUDGE); +} + +void sub_80458B4(void) +{ + if (gBattleExecBuffer == 0) + gBattleScriptingCommandsTable[*gBattlescriptCurrInstr](); +} + +u8 GetMoveTarget(u16 move, u8 useMoveTarget) +{ + u8 targetBank = 0; + u8 moveTarget; + u8 side; + + if (useMoveTarget) + moveTarget = useMoveTarget - 1; + else + moveTarget = gBattleMoves[move].target; + + switch (moveTarget) + { + case 0: + side = GetBankSide(gBankAttacker) ^ 1; + if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) + targetBank = gSideTimers[side].followmeTarget; + else + { + side = GetBankSide(gBankAttacker); + do + { + targetBank = Random() % gNoOfAllBanks; + } while (targetBank == gBankAttacker || side == GetBankSide(targetBank) || gAbsentBankFlags & gBitTable[targetBank]); + if (gBattleMoves[move].type == TYPE_ELECTRIC + && AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIZE, gBankAttacker, ABILITY_LIGHTNING_ROD, 0, 0) + && gBattleMons[targetBank].ability != ABILITY_LIGHTNING_ROD) + { + targetBank ^= 2; + RecordAbilityBattle(targetBank, gBattleMons[targetBank].ability); + gSpecialStatuses[targetBank].lightningRodRedirected = 1; + } + } + break; + case 1: + case 8: + case 32: + case 64: + targetBank = GetBankByPlayerAI((GetBankIdentity(gBankAttacker) & 1) ^ 1); + if (gAbsentBankFlags & gBitTable[targetBank]) + targetBank ^= 2; + break; + case 4: + side = GetBankSide(gBankAttacker) ^ 1; + if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) + targetBank = gSideTimers[side].followmeTarget; + else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & 4) + { + if (GetBankSide(gBankAttacker) == SIDE_PLAYER) + { + if (Random() & 1) + targetBank = GetBankByPlayerAI(1); + else + targetBank = GetBankByPlayerAI(3); + } + else + { + if (Random() & 1) + targetBank = GetBankByPlayerAI(0); + else + targetBank = GetBankByPlayerAI(2); + } + if (gAbsentBankFlags & gBitTable[targetBank]) + targetBank ^= 2; + } + else + targetBank = GetBankByPlayerAI((GetBankIdentity(gBankAttacker) & 1) ^ 1); + break; + case 2: + case 16: + targetBank = gBankAttacker; + break; + } + + #ifndef NONMATCHING + MEME_ACCESS_U8(BattleStruct, gBattleStruct, gBankAttacker, moveTarget, targetBank); + #else + gBattleStruct->moveTarget[gBankAttacker] = targetBank; + #endif // NONMATCHING + + return targetBank; +} + +static bool32 HasObedientBitSet(u8 bank) +{ + if (GetBankSide(bank) == SIDE_OPPONENT) + return TRUE; + if (GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS + && GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES, NULL) != SPECIES_MEW) + return TRUE; + return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_OBEDIENCE, NULL); +} + +u8 IsPokeDisobedient(void) +{ + s32 rnd; + s32 calc; + u8 obedienceLevel = 0; + + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + return 0; + if (GetBankSide(gBankAttacker) == SIDE_OPPONENT) + return 0; + + if (HasObedientBitSet(gBankAttacker)) // only if species is Mew or Deoxys + { + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBankIdentity(gBankAttacker) == 2) + return 0; + if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + return 0; + if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) + return 0; + if (!IsOtherTrainer(gBattleMons[gBankAttacker].otId, gBattleMons[gBankAttacker].otName)) + return 0; + if (FlagGet(BADGE08_GET)) + return 0; + + obedienceLevel = 10; + + if (FlagGet(BADGE02_GET)) + obedienceLevel = 30; + if (FlagGet(BADGE04_GET)) + obedienceLevel = 50; + if (FlagGet(BADGE06_GET)) + obedienceLevel = 70; + } + + if (gBattleMons[gBankAttacker].level <= obedienceLevel) + return 0; + rnd = (Random() & 255); + calc = (gBattleMons[gBankAttacker].level + obedienceLevel) * rnd >> 8; + if (calc < obedienceLevel) + return 0; + + // is not obedient + if (gCurrentMove == MOVE_RAGE) + gBattleMons[gBankAttacker].status2 &= ~(STATUS2_RAGE); + if (gBattleMons[gBankAttacker].status1 & STATUS_SLEEP && (gCurrentMove == MOVE_SNORE || gCurrentMove == MOVE_SLEEP_TALK)) + { + gBattlescriptCurrInstr = gUnknown_082DB695; + return 1; + } + + rnd = (Random() & 255); + calc = (gBattleMons[gBankAttacker].level + obedienceLevel) * rnd >> 8; + if (calc < obedienceLevel) + { + calc = CheckMoveLimitations(gBankAttacker, gBitTable[gCurrMovePos], 0xFF); + if (calc == 0xF) // all moves cannot be used + { + gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3; + gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; + return 1; + } + else // use a random move + { + do + { + gCurrMovePos = gUnknown_020241E9 = Random() & 3; + } while (gBitTable[gCurrMovePos] & calc); + + gRandomMove = gBattleMons[gBankAttacker].moves[gCurrMovePos]; + gBattlescriptCurrInstr = gUnknown_082DB6A5; + gBankTarget = GetMoveTarget(gRandomMove, 0); + gHitMarker |= HITMARKER_x200000; + return 2; + } + } + else + { + obedienceLevel = gBattleMons[gBankAttacker].level - obedienceLevel; + + calc = (Random() & 255); + if (calc < obedienceLevel && !(gBattleMons[gBankAttacker].status1 & STATUS_ANY) && gBattleMons[gBankAttacker].ability != ABILITY_VITAL_SPIRIT && gBattleMons[gBankAttacker].ability != ABILITY_INSOMNIA) + { + // try putting asleep + int i; + for (i = 0; i < gNoOfAllBanks; i++) + { + if (gBattleMons[i].status2 & STATUS2_UPROAR) + break; + } + if (i == gNoOfAllBanks) + { + gBattlescriptCurrInstr = gUnknown_082DB6D9; + return 1; + } + } + calc -= obedienceLevel; + if (calc < obedienceLevel) + { + gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBankAttacker], &gBattleMons[gBankAttacker], MOVE_POUND, 0, 40, 0, gBankAttacker, gBankAttacker); + gBankTarget = gBankAttacker; + gBattlescriptCurrInstr = gUnknown_082DB6F0; + gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; + return 2; + } + else + { + gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3; + gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; + return 1; + } + } +} diff --git a/src/battle_ai.c b/src/battle_ai.c index 76bf4156d..3b696b84e 100644 --- a/src/battle_ai.c +++ b/src/battle_ai.c @@ -87,7 +87,7 @@ static u8 BattleAI_ChooseMoveOrAction_Singles(void); static u8 BattleAI_ChooseMoveOrAction_Doubles(void); static void RecordLastUsedMoveByTarget(void); static void BattleAI_DoAIProcessing(void); -static void AIStackPushVar(u8 *); +static void AIStackPushVar(const u8 *); static bool8 AIStackPop(void); static void BattleAICmd_if_random_less_than(void); @@ -192,7 +192,7 @@ static void BattleAICmd_if_holds_item(void); // ewram -EWRAM_DATA u8 *gAIScriptPtr = NULL; +EWRAM_DATA const u8 *gAIScriptPtr = NULL; EWRAM_DATA static u8 sBank_AI = 0; // const rom data @@ -2902,7 +2902,7 @@ static void BattleAICmd_if_flash_fired(void) gAIScriptPtr += 6; } -static void AIStackPushVar(u8 *var) +static void AIStackPushVar(const u8 *var) { gBattleResources->AI_ScriptsStack->ptr[gBattleResources->AI_ScriptsStack->size++] = var; } diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c new file mode 100644 index 000000000..d9fd40b84 --- /dev/null +++ b/src/hall_of_fame.c @@ -0,0 +1,4 @@ +#include "global.h" +#include "hall_of_fame.h" + + diff --git a/sym_ewram.txt b/sym_ewram.txt index 5c48c224d..a675fa4e2 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -346,7 +346,7 @@ gBattleMoveDamage: @ 20241F0 gUnknown_020241F4: @ 20241F4 .space 0x4 -gUnknown_020241F8: @ 20241F8 +gTakenDmg: @ 20241F8 .space 0x10 gLastUsedItem: @ 2024208 @@ -361,10 +361,10 @@ gBankAttacker: @ 202420B gBankTarget: @ 202420C .space 0x1 -gUnknown_0202420D: @ 202420D +gBank1: @ 202420D .space 0x1 -gUnknown_0202420E: @ 202420E +gEffectBank: @ 202420E .space 0x1 gStringBank: @ 202420F @@ -412,7 +412,7 @@ gUnknown_02024268: @ 2024268 gUnknown_02024270: @ 2024270 .space 0x4 -gUnknown_02024274: @ 2024274 +gChosenMovesByBanks: @ 2024274 .space 0x8 gBattleMoveFlags: @ 202427C @@ -424,7 +424,7 @@ gHitMarker: @ 2024280 gUnknown_02024284: @ 2024284 .space 0x4 -gUnknown_02024288: @ 2024288 +gTakenDmgBanks: @ 2024288 .space 0x4 gUnknown_0202428C: @ 202428C @@ -469,7 +469,7 @@ gSpecialStatuses: @ 202437C gBattleWeather: @ 20243CC .space 0x4 -gUnknown_020243D0: @ 20243D0 +gWishFutureKnock: @ 20243D0 .space 0x2C gUnknown_020243FC: @ 20243FC