From 3d0a9d71e36cb4e343d65d91bb42371e33adf655 Mon Sep 17 00:00:00 2001 From: Adrienn Tindall <33725376+adrienntindall@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:04:57 -0500 Subject: [PATCH] Move Status Flag Definitions --- asm/overlay_12_0224E4FC_s.s | 782 +------------------------------ include/battle.h | 2 +- include/constants/battle.h | 19 +- include/overlay_12_0224E4FC.h | 10 +- src/battle/battle_command.c | 8 +- src/battle/overlay_12_0224E4FC.c | 611 ++++++++++++++++++++++++ 6 files changed, 642 insertions(+), 790 deletions(-) diff --git a/asm/overlay_12_0224E4FC_s.s b/asm/overlay_12_0224E4FC_s.s index 1da39a6dd..e2ed7ef73 100644 --- a/asm/overlay_12_0224E4FC_s.s +++ b/asm/overlay_12_0224E4FC_s.s @@ -7,786 +7,8 @@ .text .public AddBattlerVar - - thumb_func_start ov12_02251A28 -ov12_02251A28: ; 0x02251A28 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x28 - add r7, r3, #0 - mov r3, #1 - str r3, [sp, #8] - mov r3, #4 - str r3, [sp] - mov r3, #0 - str r0, [sp, #4] - add r5, r1, #0 - add r6, r2, #0 - ldr r4, [sp, #0x40] - bl StruggleCheck - str r0, [sp, #0xc] - add r0, r7, #0 - bl MaskOfFlagNo - ldr r1, [sp, #0xc] - tst r0, r1 - beq _02251A7A - mov r0, #0xa - strb r0, [r4, #1] - ldr r0, _02251C3C ; =0x00000261 - add r1, r6, #0 - strh r0, [r4, #2] - add r0, r5, #0 - bl CreateNicknameTag - str r0, [r4, #4] - mov r0, #0xc0 - mul r0, r6 - add r1, r5, r0 - lsl r0, r7, #1 - add r1, r1, r0 - ldr r0, _02251C40 ; =0x00002D4C - ldrh r0, [r1, r0] - str r0, [r4, #8] - mov r0, #0 - str r0, [sp, #8] - b _02251C36 -_02251A7A: - mov r0, #8 - str r0, [sp] - ldr r0, [sp, #4] - add r1, r5, #0 - add r2, r6, #0 - mov r3, #0 - bl StruggleCheck - str r0, [sp, #0x10] - add r0, r7, #0 - bl MaskOfFlagNo - ldr r1, [sp, #0x10] - tst r0, r1 - beq _02251AB2 - mov r0, #2 - strb r0, [r4, #1] - mov r0, #0x99 - lsl r0, r0, #2 - strh r0, [r4, #2] - add r0, r5, #0 - add r1, r6, #0 - bl CreateNicknameTag - str r0, [r4, #4] - mov r0, #0 - str r0, [sp, #8] - b _02251C36 -_02251AB2: - mov r0, #0x10 - str r0, [sp] - ldr r0, [sp, #4] - add r1, r5, #0 - add r2, r6, #0 - mov r3, #0 - bl StruggleCheck - str r0, [sp, #0x14] - add r0, r7, #0 - bl MaskOfFlagNo - ldr r1, [sp, #0x14] - tst r0, r1 - beq _02251AF8 - mov r0, #0xa - strb r0, [r4, #1] - ldr r0, _02251C44 ; =0x00000265 - add r1, r6, #0 - strh r0, [r4, #2] - add r0, r5, #0 - bl CreateNicknameTag - str r0, [r4, #4] - mov r0, #0xc0 - mul r0, r6 - add r1, r5, r0 - lsl r0, r7, #1 - add r1, r1, r0 - ldr r0, _02251C40 ; =0x00002D4C - ldrh r0, [r1, r0] - str r0, [r4, #8] - mov r0, #0 - str r0, [sp, #8] - b _02251C36 -_02251AF8: - mov r0, #0x20 - str r0, [sp] - ldr r0, [sp, #4] - add r1, r5, #0 - add r2, r6, #0 - mov r3, #0 - bl StruggleCheck - str r0, [sp, #0x18] - add r0, r7, #0 - bl MaskOfFlagNo - ldr r1, [sp, #0x18] - tst r0, r1 - beq _02251B40 - mov r0, #0xa - strb r0, [r4, #1] - mov r0, #0x9a - lsl r0, r0, #2 - strh r0, [r4, #2] - add r0, r5, #0 - add r1, r6, #0 - bl CreateNicknameTag - str r0, [r4, #4] - mov r0, #0xc0 - mul r0, r6 - add r1, r5, r0 - lsl r0, r7, #1 - add r1, r1, r0 - ldr r0, _02251C40 ; =0x00002D4C - ldrh r0, [r1, r0] - str r0, [r4, #8] - mov r0, #0 - str r0, [sp, #8] - b _02251C36 -_02251B40: - mov r0, #0x40 - str r0, [sp] - ldr r0, [sp, #4] - add r1, r5, #0 - add r2, r6, #0 - mov r3, #0 - bl StruggleCheck - str r0, [sp, #0x1c] - add r0, r7, #0 - bl MaskOfFlagNo - ldr r1, [sp, #0x1c] - tst r0, r1 - beq _02251B86 - mov r0, #0xa - strb r0, [r4, #1] - ldr r0, _02251C48 ; =0x000003E9 - add r1, r6, #0 - strh r0, [r4, #2] - add r0, r5, #0 - bl CreateNicknameTag - str r0, [r4, #4] - mov r0, #0xc0 - mul r0, r6 - add r1, r5, r0 - lsl r0, r7, #1 - add r1, r1, r0 - ldr r0, _02251C40 ; =0x00002D4C - ldrh r0, [r1, r0] - str r0, [r4, #8] - mov r0, #0 - str r0, [sp, #8] - b _02251C36 -_02251B86: - mov r0, #0x80 - str r0, [sp] - ldr r0, [sp, #4] - add r1, r5, #0 - add r2, r6, #0 - mov r3, #0 - bl StruggleCheck - str r0, [sp, #0x20] - add r0, r7, #0 - bl MaskOfFlagNo - ldr r1, [sp, #0x20] - tst r0, r1 - beq _02251BD0 - mov r0, #0x22 - strb r0, [r4, #1] - ldr r0, _02251C4C ; =0x00000421 - add r1, r6, #0 - strh r0, [r4, #2] - add r0, r5, #0 - bl CreateNicknameTag - str r0, [r4, #4] - ldr r0, _02251C50 ; =0x00000179 - str r0, [r4, #8] - mov r0, #0xc0 - mul r0, r6 - add r1, r5, r0 - lsl r0, r7, #1 - add r1, r1, r0 - ldr r0, _02251C40 ; =0x00002D4C - ldrh r0, [r1, r0] - str r0, [r4, #0xc] - mov r0, #0 - str r0, [sp, #8] - b _02251C36 -_02251BD0: - mov r0, #2 - lsl r0, r0, #8 - str r0, [sp] - ldr r0, [sp, #4] - add r1, r5, #0 - add r2, r6, #0 - mov r3, #0 - bl StruggleCheck - str r0, [sp, #0x24] - add r0, r7, #0 - bl MaskOfFlagNo - ldr r1, [sp, #0x24] - tst r0, r1 - beq _02251C10 - mov r0, #0x18 - strb r0, [r4, #1] - ldr r0, _02251C54 ; =0x0000038F - strh r0, [r4, #2] - mov r0, #0xc0 - mul r0, r6 - add r2, r5, r0 - ldr r0, _02251C58 ; =0x00002DB8 - ldrh r1, [r2, r0] - add r0, #0x40 - str r1, [r4, #4] - ldrh r0, [r2, r0] - str r0, [r4, #8] - mov r0, #0 - str r0, [sp, #8] - b _02251C36 -_02251C10: - mov r0, #2 - str r0, [sp] - ldr r0, [sp, #4] - add r1, r5, #0 - add r2, r6, #0 - mov r3, #0 - bl StruggleCheck - add r5, r0, #0 - add r0, r7, #0 - bl MaskOfFlagNo - tst r0, r5 - beq _02251C36 - mov r0, #0 - str r0, [sp, #8] - strb r0, [r4, #1] - ldr r0, _02251C5C ; =0x00000337 - strh r0, [r4, #2] -_02251C36: - ldr r0, [sp, #8] - add sp, #0x28 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02251C3C: .word 0x00000261 -_02251C40: .word 0x00002D4C -_02251C44: .word 0x00000265 -_02251C48: .word 0x000003E9 -_02251C4C: .word 0x00000421 -_02251C50: .word 0x00000179 -_02251C54: .word 0x0000038F -_02251C58: .word 0x00002DB8 -_02251C5C: .word 0x00000337 - thumb_func_end ov12_02251A28 - - thumb_func_start BattleMon_GetMoveIndex -BattleMon_GetMoveIndex: ; 0x02251C60 - mov r3, #0 -_02251C62: - ldrh r2, [r0, #0xc] - cmp r1, r2 - beq _02251C70 - add r3, r3, #1 - add r0, r0, #2 - cmp r3, #4 - blt _02251C62 -_02251C70: - add r0, r3, #0 - bx lr - thumb_func_end BattleMon_GetMoveIndex - - thumb_func_start ov12_02251C74 -ov12_02251C74: ; 0x02251C74 - push {r4, r5, r6, lr} - add r6, r2, #0 - add r1, r6, #0 - add r5, r0, #0 - add r4, r3, #0 - bl GetBattlerHeldItemEffect - mov r1, #1 - cmp r0, #0x6a - beq _02251C9A - mov r0, #0xc0 - mul r0, r6 - add r2, r5, r0 - mov r0, #0xb7 - lsl r0, r0, #6 - ldr r2, [r2, r0] - lsl r0, r1, #0xa - tst r0, r2 - beq _02251CB0 -_02251C9A: - lsl r0, r4, #1 - add r2, r4, r0 - ldr r0, _02251D20 ; =sTypeEffectiveness + 1 - ldrb r0, [r0, r2] - cmp r0, #2 - bne _02251CB0 - ldr r0, _02251D24 ; =sTypeEffectiveness + 2 - ldrb r0, [r0, r2] - cmp r0, #0 - bne _02251CB0 - mov r1, #0 -_02251CB0: - lsl r0, r6, #6 - add r2, r5, r0 - mov r0, #0x75 - lsl r0, r0, #2 - ldr r0, [r2, r0] - lsl r0, r0, #0x19 - lsr r0, r0, #0x1f - beq _02251CCE - lsl r0, r4, #1 - add r2, r4, r0 - ldr r0, _02251D20 ; =sTypeEffectiveness + 1 - ldrb r0, [r0, r2] - cmp r0, #2 - bne _02251CCE - mov r1, #0 -_02251CCE: - mov r0, #6 - lsl r0, r0, #6 - ldr r2, [r5, r0] - mov r0, #7 - lsl r0, r0, #0xc - tst r0, r2 - beq _02251CF2 - lsl r0, r4, #1 - add r2, r4, r0 - ldr r0, _02251D20 ; =sTypeEffectiveness + 1 - ldrb r0, [r0, r2] - cmp r0, #2 - bne _02251CF2 - ldr r0, _02251D24 ; =sTypeEffectiveness + 2 - ldrb r0, [r0, r2] - cmp r0, #0 - bne _02251CF2 - mov r1, #0 -_02251CF2: - mov r0, #0xc0 - mul r0, r6 - add r2, r5, r0 - mov r0, #0xb7 - lsl r0, r0, #6 - ldr r2, [r2, r0] - mov r0, #1 - lsl r0, r0, #0x16 - tst r0, r2 - beq _02251D1C - lsl r0, r4, #1 - add r2, r4, r0 - ldr r0, _02251D20 ; =sTypeEffectiveness + 1 - ldrb r0, [r0, r2] - cmp r0, #0x11 - bne _02251D1C - ldr r0, _02251D24 ; =sTypeEffectiveness + 2 - ldrb r0, [r0, r2] - cmp r0, #0 - bne _02251D1C - mov r1, #0 -_02251D1C: - add r0, r1, #0 - pop {r4, r5, r6, pc} - .balign 4, 0 -_02251D20: .word sTypeEffectiveness + 1 -_02251D24: .word sTypeEffectiveness + 2 - thumb_func_end ov12_02251C74 - - thumb_func_start ov12_02251D28 -ov12_02251D28: ; 0x02251D28 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x30 - ldr r0, [sp, #0x50] - add r5, r1, #0 - str r0, [sp, #0x50] - ldr r0, [sp, #0x54] - str r2, [sp, #8] - str r0, [sp, #0x54] - add r0, r2, #0 - add r4, r3, #0 - ldr r7, [sp, #0x48] - ldr r6, [sp, #0x4c] - cmp r0, #0xa5 - bne _02251D4A - ldr r0, [sp, #0x50] - add sp, #0x30 - pop {r3, r4, r5, r6, r7, pc} -_02251D4A: - add r0, r5, #0 - add r1, r7, #0 - bl GetBattlerHeldItemEffect - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x24] - add r0, r5, #0 - add r1, r7, #0 - mov r2, #0 - bl BattleSystem_GetHeldItemDamageBoost - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x1c] - add r0, r5, #0 - add r1, r6, #0 - bl GetBattlerHeldItemEffect - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x20] - add r0, r5, #0 - add r1, r6, #0 - mov r2, #0 - bl BattleSystem_GetHeldItemDamageBoost - add r0, r5, #0 - add r1, r7, #0 - bl GetBattlerAbility - cmp r0, #0x60 - bne _02251D92 - mov r0, #0 - str r0, [sp, #0x28] - b _02251DAA -_02251D92: - cmp r4, #0 - beq _02251D9E - lsl r0, r4, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x28] - b _02251DAA -_02251D9E: - ldr r0, [sp, #8] - lsl r0, r0, #4 - add r1, r5, r0 - ldr r0, _0225203C ; =0x000003E2 - ldrb r0, [r1, r0] - str r0, [sp, #0x28] -_02251DAA: - ldr r0, [sp, #8] - lsl r0, r0, #4 - add r1, r5, r0 - ldr r0, _02252040 ; =0x000003E1 - ldrb r0, [r1, r0] - str r0, [sp, #0x14] - ldr r0, _02252044 ; =0x0000213C - ldr r1, [r5, r0] - mov r0, #2 - lsl r0, r0, #0xa - tst r0, r1 - bne _02251E08 - add r0, r5, #0 - add r1, r7, #0 - mov r2, #0x1b - mov r3, #0 - bl GetBattlerVar - ldr r1, [sp, #0x28] - cmp r1, r0 - beq _02251DE6 - add r0, r5, #0 - add r1, r7, #0 - mov r2, #0x1c - mov r3, #0 - bl GetBattlerVar - ldr r1, [sp, #0x28] - cmp r1, r0 - bne _02251E08 -_02251DE6: - add r0, r5, #0 - add r1, r7, #0 - bl GetBattlerAbility - cmp r0, #0x5b - bne _02251DFA - ldr r0, [sp, #0x50] - lsl r0, r0, #1 - str r0, [sp, #0x50] - b _02251E08 -_02251DFA: - ldr r1, [sp, #0x50] - mov r0, #0xf - mul r0, r1 - mov r1, #0xa - bl _s32_div_f - str r0, [sp, #0x50] -_02251E08: - add r0, r5, #0 - add r1, r7, #0 - add r2, r6, #0 - mov r3, #0x1a - bl CheckBattlerAbilityIfNotIgnored - cmp r0, #1 - bne _02251E34 - ldr r0, [sp, #0x28] - cmp r0, #4 - bne _02251E34 - ldr r0, [sp, #0x20] - cmp r0, #0x6a - beq _02251E34 - ldr r0, [sp, #0x54] - ldr r1, [r0] - mov r0, #2 - lsl r0, r0, #0xa - orr r1, r0 - ldr r0, [sp, #0x54] - str r1, [r0] - b _02251F50 -_02251E34: - mov r0, #0xc0 - add r1, r6, #0 - mul r1, r0 - ldr r0, _02252048 ; =0x00002DCC - add r3, r5, r1 - ldr r2, [r3, r0] - lsl r2, r2, #0x10 - lsr r2, r2, #0x1d - beq _02251E6C - sub r0, #0xc - ldr r2, [r3, r0] - mov r0, #1 - lsl r0, r0, #0xa - tst r2, r0 - bne _02251E6C - ldr r2, [sp, #0x28] - cmp r2, #4 - bne _02251E6C - ldr r2, [sp, #0x20] - cmp r2, #0x6a - beq _02251E6C - ldr r1, [sp, #0x54] - lsl r0, r0, #0xa - ldr r1, [r1] - orr r1, r0 - ldr r0, [sp, #0x54] - str r1, [r0] - b _02251F50 -_02251E6C: - add r0, r5, r1 - mov r4, #0 - str r0, [sp, #0x18] -_02251E72: - lsl r0, r4, #1 - ldr r1, _0225204C ; =sTypeEffectiveness - add r0, r4, r0 - add r1, r1, r0 - str r1, [sp, #0xc] - ldr r1, _0225204C ; =sTypeEffectiveness - ldrb r1, [r1, r0] - cmp r1, #0xfe - bne _02251EA2 - ldr r1, [sp, #0x18] - ldr r0, _02252050 ; =0x00002DB0 - ldr r1, [r1, r0] - mov r0, #2 - lsl r0, r0, #0x1c - tst r0, r1 - bne _02251F50 - add r0, r5, #0 - add r1, r7, #0 - bl GetBattlerAbility - cmp r0, #0x71 - beq _02251F50 - add r4, r4, #1 - b _02251F44 -_02251EA2: - ldr r0, [sp, #0x28] - cmp r0, r1 - bne _02251F42 - ldr r0, [sp, #0xc] - add r1, r6, #0 - ldrb r0, [r0, #1] - mov r2, #0x1b - mov r3, #0 - str r0, [sp, #0x10] - add r0, r5, #0 - bl GetBattlerVar - ldr r1, [sp, #0x10] - cmp r1, r0 - bne _02251EE8 - add r0, r5, #0 - add r1, r7, #0 - add r2, r6, #0 - add r3, r4, #0 - bl ov12_02251C74 - cmp r0, #1 - bne _02251EE8 - ldr r0, [sp, #0x14] - ldr r2, [sp, #0xc] - str r0, [sp] - ldr r0, [sp, #0x54] - ldr r3, [sp, #0x50] - str r0, [sp, #4] - ldrb r2, [r2, #2] - add r0, r5, #0 - add r1, r7, #0 - bl ov12_022583B4 - str r0, [sp, #0x50] -_02251EE8: - add r0, r5, #0 - add r1, r6, #0 - mov r2, #0x1c - mov r3, #0 - bl GetBattlerVar - ldr r1, [sp, #0x10] - cmp r1, r0 - bne _02251F42 - add r0, r5, #0 - add r1, r6, #0 - mov r2, #0x1b - mov r3, #0 - bl GetBattlerVar - str r0, [sp, #0x2c] - add r0, r5, #0 - add r1, r6, #0 - mov r2, #0x1c - mov r3, #0 - bl GetBattlerVar - ldr r1, [sp, #0x2c] - cmp r1, r0 - beq _02251F42 - add r0, r5, #0 - add r1, r7, #0 - add r2, r6, #0 - add r3, r4, #0 - bl ov12_02251C74 - cmp r0, #1 - bne _02251F42 - ldr r0, [sp, #0x14] - ldr r2, [sp, #0xc] - str r0, [sp] - ldr r0, [sp, #0x54] - ldr r3, [sp, #0x50] - str r0, [sp, #4] - ldrb r2, [r2, #2] - add r0, r5, #0 - add r1, r7, #0 - bl ov12_022583B4 - str r0, [sp, #0x50] -_02251F42: - add r4, r4, #1 -_02251F44: - lsl r0, r4, #1 - add r1, r4, r0 - ldr r0, _0225204C ; =sTypeEffectiveness - ldrb r0, [r0, r1] - cmp r0, #0xff - bne _02251E72 -_02251F50: - add r0, r5, #0 - add r1, r7, #0 - add r2, r6, #0 - mov r3, #0x19 - bl CheckBattlerAbilityIfNotIgnored - cmp r0, #1 - bne _02251F94 - ldr r1, [sp, #8] - add r0, r5, #0 - bl ov12_02258440 - cmp r0, #0 - beq _02251F94 - ldr r0, [sp, #0x54] - ldr r1, [r0] - mov r0, #2 - tst r0, r1 - beq _02251F7E - mov r0, #6 - and r0, r1 - cmp r0, #6 - bne _02251F94 -_02251F7E: - ldr r0, [sp, #0x14] - cmp r0, #0 - beq _02251F94 - ldr r0, [sp, #0x54] - ldr r1, [r0] - mov r0, #1 - lsl r0, r0, #0x12 - orr r1, r0 - ldr r0, [sp, #0x54] - str r1, [r0] - b _02252036 -_02251F94: - ldr r0, _02252044 ; =0x0000213C - ldr r2, [r5, r0] - mov r0, #2 - lsl r0, r0, #0xa - add r1, r2, #0 - tst r1, r0 - bne _02252022 - lsl r0, r0, #4 - tst r0, r2 - bne _02252022 - ldr r0, [sp, #0x54] - ldr r1, [r0] - mov r0, #2 - tst r0, r1 - beq _02251FFE - ldr r0, [sp, #0x14] - cmp r0, #0 - beq _02251FFE - add r0, r5, #0 - add r1, r7, #0 - add r2, r6, #0 - mov r3, #0x6f - bl CheckBattlerAbilityIfNotIgnored - cmp r0, #1 - beq _02251FD8 - add r0, r5, #0 - add r1, r7, #0 - add r2, r6, #0 - mov r3, #0x74 - bl CheckBattlerAbilityIfNotIgnored - cmp r0, #1 - bne _02251FE6 -_02251FD8: - ldr r0, [sp, #0x50] - lsl r1, r0, #1 - add r0, r0, r1 - mov r1, #4 - bl DamageDivide - str r0, [sp, #0x50] -_02251FE6: - ldr r0, [sp, #0x24] - cmp r0, #0x60 - bne _02251FFE - ldr r0, [sp, #0x1c] - ldr r1, [sp, #0x50] - add r0, #0x64 - str r0, [sp, #0x1c] - mul r0, r1 - mov r1, #0x64 - bl _s32_div_f - str r0, [sp, #0x50] -_02251FFE: - ldr r0, [sp, #0x54] - ldr r1, [r0] - mov r0, #4 - tst r0, r1 - beq _02252036 - ldr r0, [sp, #0x14] - cmp r0, #0 - beq _02252036 - add r0, r5, #0 - add r1, r7, #0 - bl GetBattlerAbility - cmp r0, #0x6e - bne _02252036 - ldr r0, [sp, #0x50] - lsl r0, r0, #1 - str r0, [sp, #0x50] - b _02252036 -_02252022: - ldr r0, [sp, #0x54] - ldr r1, [r0] - mov r0, #2 - bic r1, r0 - ldr r0, [sp, #0x54] - str r1, [r0] - mov r0, #4 - bic r1, r0 - ldr r0, [sp, #0x54] - str r1, [r0] -_02252036: - ldr r0, [sp, #0x50] - add sp, #0x30 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_0225203C: .word 0x000003E2 -_02252040: .word 0x000003E1 -_02252044: .word 0x0000213C -_02252048: .word 0x00002DCC -_0225204C: .word sTypeEffectiveness -_02252050: .word 0x00002DB0 - thumb_func_end ov12_02251D28 + .public sTypeEffectiveness + .public ov12_02251C74 thumb_func_start ov12_02252054 ov12_02252054: ; 0x02252054 diff --git a/include/battle.h b/include/battle.h index 5fcdbed3d..102e68bde 100644 --- a/include/battle.h +++ b/include/battle.h @@ -60,7 +60,7 @@ typedef struct TurnData { u32 helpingHandFlag:1; u32 magicCoatFlag:1; u32 snatchFlag:1; - u32 unk0_6:1; + u32 roostFlag:1; u32 unk0_7:2; u32 unk0_9:1; u32 unk0_A:22; diff --git a/include/constants/battle.h b/include/constants/battle.h index f78663704..e630cb42e 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -68,7 +68,7 @@ enum Terrain { #define MOVE_EFFECT_7 (1 << 7) #define MOVE_EFFECT_8 (1 << 8) #define MOVE_EFFECT_9 (1 << 9) -#define MOVE_EFFECT_10 (1 << 10) +#define MOVE_EFFECT_INGRAIN (1 << 10) #define MOVE_EFFECT_11 (1 << 11) #define MOVE_EFFECT_YAWN (1 << 12) #define MOVE_EFFECT_IMPRISON_USER (1 << 13) @@ -90,7 +90,17 @@ enum Terrain { #define MOVE_EFFECT_PHANTOM_FORCE (1 << 29) #define MOVE_EFFECT_IMPRISON (1 << 30) -#define MOVE_EFFECT_BATON_PASSABLE (MOVE_EFFECT_0 | MOVE_EFFECT_1 | MOVE_EFFECT_LEECH_SEED | MOVE_EFFECT_LOCK_ON | MOVE_EFFECT_PERISH_SONG | MOVE_EFFECT_10 | MOVE_EFFECT_LUCKY_CHANT | MOVE_EFFECT_MUD_SPORT | MOVE_EFFECT_WATER_SPORT | MOVE_EFFECT_GASTRO_ACID | MOVE_EFFECT_POWER_TRICK | MOVE_EFFECT_AQUA_RING | MOVE_EFFECT_HEAL_BLOCK | MOVE_EFECT_26 | MOVE_EFFECT_MAGNET_RISE) +#define MOVE_EFFECT_BATON_PASSABLE (MOVE_EFFECT_0 | MOVE_EFFECT_1 | MOVE_EFFECT_LEECH_SEED | MOVE_EFFECT_LOCK_ON | MOVE_EFFECT_PERISH_SONG | MOVE_EFFECT_INGRAIN | MOVE_EFFECT_LUCKY_CHANT | MOVE_EFFECT_MUD_SPORT | MOVE_EFFECT_WATER_SPORT | MOVE_EFFECT_GASTRO_ACID | MOVE_EFFECT_POWER_TRICK | MOVE_EFFECT_AQUA_RING | MOVE_EFFECT_HEAL_BLOCK | MOVE_EFECT_26 | MOVE_EFFECT_MAGNET_RISE) + +//Move status +#define MOVE_STATUS_MISS (1 << 0) +#define MOVE_STATUS_SUPER_EFFECTIVE (1 << 1) +#define MOVE_STATUS_NOT_VERY_EFFECTIVE (1 << 2) +#define MOVE_STATUS_LEVITATE_IMMUNE (1 << 11) +#define MOVE_STATUS_WONDER_GUARD_IMMUNE (1 << 18) +#define MOVE_STATUS_MAGNET_RISE_IMMUNE (1 << 20) + +#define MOVE_STATUS_ANY_EFFECTIVE (MOVE_STATUS_SUPER_EFFECTIVE | MOVE_STATUS_NOT_VERY_EFFECTIVE) //Field Conditions #define FIELD_CONDITION_RAIN (1 << 0) @@ -105,9 +115,11 @@ enum Terrain { #define FIELD_CONDITION_HAIL (1 << 6) #define FIELD_CONDITION_HAIL_PERMANENT (1 << 7) #define FIELD_CONDITION_HAIL_ALL (FIELD_CONDITION_HAIL | FIELD_CONDITION_HAIL_PERMANENT) +#define FIELD_CONDITION_GRAVITY (7 << 12) #define FIELD_CONDITION_FOG (1 << 15) -#define FIELD_CONDITION_WEATHER (FIELD_CONDITION_RAIN_ALL | FIELD_CONDITION_SANDSTORM_ALL | FIELD_CONDITION_SUN_ALL | FIELD_CONDITION_HAIL_ALL | FIELD_CONDITION_FOG) #define FIELD_CONDITION_TRICK_ROOM (7 << 16) + +#define FIELD_CONDITION_WEATHER (FIELD_CONDITION_RAIN_ALL | FIELD_CONDITION_SANDSTORM_ALL | FIELD_CONDITION_SUN_ALL | FIELD_CONDITION_HAIL_ALL | FIELD_CONDITION_FOG) //Field Side Conditions #define SIDE_CONDITION_REFLECT (1 << 0) @@ -163,6 +175,7 @@ enum Terrain { #define STATUS2_MEAN_LOOK (1 << 26) #define STATUS2_27 (1 << 27) #define STATUS2_28 (1 << 28) +#define STATUS2_FORESIGHT (1 << 29) #define STATUS2_DEFENCE_CURL (1 << 30) #define STATUS2_TORMENT (1 << 31) diff --git a/include/overlay_12_0224E4FC.h b/include/overlay_12_0224E4FC.h index d85b5459b..64e80450c 100644 --- a/include/overlay_12_0224E4FC.h +++ b/include/overlay_12_0224E4FC.h @@ -35,12 +35,17 @@ void InitSwitchWork(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId); void InitFaintedWork(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId); void ov12_02251710(BattleSystem *bsys, BATTLECONTEXT *ctx); u32 StruggleCheck(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, u32 nonSelectableMoves, u32 a4); +BOOL ov12_02251A28(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, int movePos, BATTLEMSG *msg); +int BattleMon_GetMoveIndex(BATTLEMON *mon, u16 move); +int ov12_02251D28(BattleSystem *bsys, BATTLECONTEXT *ctx, int moveNo, int moveTypeDefault, int battlerIdAttacker, int battlerIdTarget, int damage, u32 *moveStatusFlag); + +//The following functions are static, but the rest of the file is still being worked on +BOOL ov12_02251C74(BATTLECONTEXT *ctx, int battlerIdAttacker, int battlerIdTarget, int index); //The following functions haven't been decompiled as of now void ov12_02256F78(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, u8 monIndex); void Link_CheckTimeout(BATTLECONTEXT *ctx); BOOL CheckBattlerAbilityIfNotIgnored(BATTLECONTEXT *ctx, int battlerIdAttacker, int battlerIdTarget, u32 ability); -int BattleMon_GetMoveIndex(BATTLEMON *mon, int move); int GetMonsHitCount(BattleSystem *bsys, BATTLECONTEXT *ctx, int a2, int battlerId); int CreateNicknameTag(BATTLECONTEXT *ctx, int battlerId); BOOL CheckAbilityActive(BattleSystem *bsys, BATTLECONTEXT *ctx, int a2, int a3, int ability); @@ -100,5 +105,6 @@ void ov12_0225859C(BATTLECONTEXT *ctx, u8 battlerId); BOOL BattleContext_CheckMoveImprisoned(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, int moveNo); BOOL BattleContext_CheckMoveUnuseableInGravity(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, int moveNo); BOOL BattleContext_CheckMoveHealBlocked(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, int moveNo); - +int ov12_02258440(BATTLECONTEXT *ctx, int moveNo); +u32 ov12_022583B4(BATTLECONTEXT *ctx, int battlerIdA, u8 effectiveness, int damage, u32 movePower, u32 *moveStatusFlag); #endif diff --git a/src/battle/battle_command.c b/src/battle/battle_command.c index 5487dfde2..f0d11d6fe 100644 --- a/src/battle/battle_command.c +++ b/src/battle/battle_command.c @@ -4075,7 +4075,7 @@ BOOL BtlCmd_TryImprison(BattleSystem *bsys, BATTLECONTEXT *ctx) { } #else asm BOOL BtlCmd_TryImprison(BattleSystem *bsys, BATTLECONTEXT *ctx) { - push {r3, r4, r5, r6, r7, lr} + push {r3, r4, r5, r6, r7, lr} sub sp, #0x18 add r7, r1, #0 str r0, [sp] @@ -4332,7 +4332,7 @@ BOOL BtlCmd_TryPursuit(BattleSystem *bsys, BATTLECONTEXT *ctx) { moveNo = GetBattlerSelectedMove(ctx, battlerId); } if (moveNo) { - moveIndex = BattleMon_GetMoveIndex(&ctx->battleMons[battlerId], (u16)moveNo); + moveIndex = BattleMon_GetMoveIndex(&ctx->battleMons[battlerId], moveNo); if (ctx->unk_334.moveData[moveNo].effect == 128 && ctx->battleMons[battlerId].movePPCur[moveIndex]) { ctx->battleMons[battlerId].movePPCur[moveIndex]--; if (GetBattlerAbility(ctx, ctx->battlerIdSwitch) == ABILITY_PRESSURE && ctx->battleMons[battlerId].movePPCur[moveIndex]) { @@ -4419,7 +4419,7 @@ BOOL BtlCmd_PokemonEncounter44(BattleSystem *bsys, BATTLECONTEXT *ctx) { } break; case 6: - if (ctx->turnData[battlerId].unk0_6 == val) { + if (ctx->turnData[battlerId].roostFlag == val) { ret = TRUE; } break; @@ -4462,7 +4462,7 @@ BOOL BtlCmd_PokemonEncounter45(BattleSystem *bsys, BATTLECONTEXT *ctx) { ctx->turnData[battlerId].snatchFlag = val; break; case 6: - ctx->turnData[battlerId].unk0_6 = val; + ctx->turnData[battlerId].roostFlag = val; break; } diff --git a/src/battle/overlay_12_0224E4FC.c b/src/battle/overlay_12_0224E4FC.c index 8a6be7c43..7b2cbdb13 100644 --- a/src/battle/overlay_12_0224E4FC.c +++ b/src/battle/overlay_12_0224E4FC.c @@ -2006,3 +2006,614 @@ u32 StruggleCheck(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, u32 non } return nonSelectableMoves; } + +//Buffer messages related to being unable to select moves? +BOOL ov12_02251A28(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, int movePos, BATTLEMSG *msg) { + BOOL ret = TRUE; + + if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_DISABLED) & MaskOfFlagNo(movePos)) { + msg->tag = 10; + msg->id = 609; + msg->param[0] = CreateNicknameTag(ctx, battlerId); + msg->param[1] = ctx->battleMons[battlerId].moves[movePos]; + ret = FALSE; + } else if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_TORMENT) & MaskOfFlagNo(movePos)) { + msg->tag = 2; + msg->id = 612; + msg->param[0] = CreateNicknameTag(ctx, battlerId); + ret = FALSE; + } else if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_TAUNT) & MaskOfFlagNo(movePos)) { + msg->tag = 10; + msg->id = 613; + msg->param[0] = CreateNicknameTag(ctx, battlerId); + msg->param[1] = ctx->battleMons[battlerId].moves[movePos]; + ret = FALSE; + } else if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_IMPRISON) & MaskOfFlagNo(movePos)) { + msg->tag = 10; + msg->id = 616; + msg->param[0] = CreateNicknameTag(ctx, battlerId); + msg->param[1] = ctx->battleMons[battlerId].moves[movePos]; + ret = FALSE; + } else if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_GRAVITY) & MaskOfFlagNo(movePos)) { + msg->tag = 10; + msg->id = 1001; + msg->param[0] = CreateNicknameTag(ctx, battlerId); + msg->param[1] = ctx->battleMons[battlerId].moves[movePos]; + ret = FALSE; + } else if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_HEAL_BLOCK) & MaskOfFlagNo(movePos)) { + msg->tag = 34; + msg->id = 1057; + msg->param[0] = CreateNicknameTag(ctx, battlerId); + msg->param[1] = MOVE_HEAL_BLOCK; + msg->param[2] = ctx->battleMons[battlerId].moves[movePos]; + ret = FALSE; + } else if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_CHOICED) & MaskOfFlagNo(movePos)) { + msg->tag = 24; + msg->id = 911; + msg->param[0] = ctx->battleMons[battlerId].item; + msg->param[1] = ctx->battleMons[battlerId].unk88.moveNoChoice; + ret = FALSE; + } else if (StruggleCheck(bsys, ctx, battlerId, 0, STRUGGLE_CHECK_NO_PP) & MaskOfFlagNo(movePos)) { + msg->tag = 0; + msg->id = 823; + ret = FALSE; + } + + return ret; +} + +int BattleMon_GetMoveIndex(BATTLEMON *mon, u16 moveNo) { + int movePos; + + for (movePos = 0; movePos < 4; movePos++) { + if (mon->moves[movePos] == moveNo) { + break; + } + } + + return movePos; +} + +extern u8 sTypeEffectiveness[][3]; + +//static +BOOL ov12_02251C74(BATTLECONTEXT *ctx, int battlerIdAttacker, int battlerIdTarget, int index) { + int item = GetBattlerHeldItemEffect(ctx, battlerIdTarget); + BOOL ret = TRUE; + + if (item == HOLD_EFFECT_SPEED_DOWN_GROUNDED || (ctx->battleMons[battlerIdTarget].moveEffectFlags & MOVE_EFFECT_INGRAIN)) { + if (sTypeEffectiveness[index][1] == TYPE_FLYING && sTypeEffectiveness[index][2] == TYPE_MUL_NO_EFFECT) { + ret = FALSE; + } + } + + if (ctx->turnData[battlerIdTarget].roostFlag && sTypeEffectiveness[index][1] == TYPE_FLYING) { + ret = FALSE; + } + + if (ctx->fieldCondition & FIELD_CONDITION_GRAVITY) { + if (sTypeEffectiveness[index][1] == TYPE_FLYING && sTypeEffectiveness[index][2] == TYPE_MUL_NO_EFFECT) { + ret = FALSE; + } + } + + if (ctx->battleMons[battlerIdTarget].moveEffectFlags & MOVE_EFFECT_MIRACLE_EYE) { + if (sTypeEffectiveness[index][1] == TYPE_DARK && sTypeEffectiveness[index][2] == TYPE_MUL_NO_EFFECT) { + ret = FALSE; + } + } + + return ret; +} + +#ifdef NONMATCHING +//FIXME: Matches up to regswaps: https://decomp.me/scratch/h06Ji -adrienn +int ov12_02251D28(BattleSystem *bsys, BATTLECONTEXT *ctx, int moveNo, int moveTypeDefault, int battlerIdAttacker, int battlerIdTarget, int damage, u32 *moveStatusFlags) { + int i; + u8 moveType; + u8 itemAttacker; + u8 itemTarget; + u8 extraAttacker; + u8 extraTarget; + u32 movePower; + + if (moveNo == MOVE_STRUGGLE) { + return damage; + } + + itemAttacker = GetBattlerHeldItemEffect(ctx, battlerIdAttacker); + extraAttacker = BattleSystem_GetHeldItemDamageBoost(ctx, battlerIdAttacker, 0); + itemTarget = GetBattlerHeldItemEffect(ctx, battlerIdTarget); + extraTarget = BattleSystem_GetHeldItemDamageBoost(ctx, battlerIdTarget, 0); + + if (GetBattlerAbility(ctx, battlerIdAttacker) == ABILITY_NORMALIZE) { + moveType = TYPE_NORMAL; + } else if (moveTypeDefault) { + moveType = moveTypeDefault; + } else { + moveType = ctx->unk_334.moveData[moveNo].type; + } + + movePower = ctx->unk_334.moveData[moveNo].power; + + //STAB + if (!(ctx->linkStatus & (1 << 11)) && (GetBattlerVar(ctx, battlerIdAttacker, BMON_DATA_TYPE_1, NULL) == moveType || GetBattlerVar(ctx, battlerIdAttacker, BMON_DATA_TYPE_2, NULL) == moveType)) { + if (GetBattlerAbility(ctx, battlerIdAttacker) == ABILITY_ADAPTABILITY) { + damage *= 2; + } else { + damage = damage * 15 / 10; + } + } + + if (CheckBattlerAbilityIfNotIgnored(ctx, battlerIdAttacker, battlerIdTarget, ABILITY_LEVITATE) == TRUE && moveType == TYPE_GROUND && itemTarget != HOLD_EFFECT_SPEED_DOWN_GROUNDED) { + *moveStatusFlags |= MOVE_STATUS_LEVITATE_IMMUNE; + } else if (ctx->battleMons[battlerIdTarget].unk88.magnetRiseTurns && !(ctx->battleMons[battlerIdTarget].moveEffectFlags & MOVE_EFFECT_INGRAIN) && moveType == TYPE_GROUND && itemTarget != HOLD_EFFECT_SPEED_DOWN_GROUNDED) { + *moveStatusFlags |= MOVE_STATUS_MAGNET_RISE_IMMUNE; + } else { + i = 0; + do { + if (sTypeEffectiveness[i][0] == TYPE_FORESIGHT) { + if ((ctx->battleMons[battlerIdTarget].status2 & STATUS2_FORESIGHT) || GetBattlerAbility(ctx, battlerIdAttacker) == ABILITY_SCRAPPY) { + break; + } else { + i++; + continue; + } + } + if (sTypeEffectiveness[i][0] == moveType) { + u8 monType = sTypeEffectiveness[i][1]; + if (monType == GetBattlerVar(ctx, battlerIdTarget, BMON_DATA_TYPE_1, NULL) && ov12_02251C74(ctx, battlerIdAttacker, battlerIdTarget, i) == TRUE) { + damage = ov12_022583B4(ctx, battlerIdAttacker, sTypeEffectiveness[i][2], damage, movePower, moveStatusFlags); + } + if (monType == GetBattlerVar(ctx, battlerIdTarget, BMON_DATA_TYPE_2, NULL) && GetBattlerVar(ctx, battlerIdTarget, BMON_DATA_TYPE_1, NULL) != GetBattlerVar(ctx, battlerIdTarget, BMON_DATA_TYPE_2, NULL) && ov12_02251C74(ctx, battlerIdAttacker, battlerIdTarget, i) == TRUE) { + damage = ov12_022583B4(ctx, battlerIdAttacker, sTypeEffectiveness[i][2], damage, movePower, moveStatusFlags); + } + } + i++; + } while (sTypeEffectiveness[i][0] != TYPE_ENDTABLE); + } + + if (CheckBattlerAbilityIfNotIgnored(ctx, battlerIdAttacker, battlerIdTarget, ABILITY_WONDER_GUARD) == TRUE && ov12_02258440(ctx, moveNo) && + (!(*moveStatusFlags & MOVE_STATUS_SUPER_EFFECTIVE) || ((*moveStatusFlags & MOVE_STATUS_ANY_EFFECTIVE) == MOVE_STATUS_ANY_EFFECTIVE)) && movePower) { + *moveStatusFlags |= MOVE_STATUS_WONDER_GUARD_IMMUNE; + } else if (!(ctx->linkStatus & (1 << 11)) && !(ctx->linkStatus & (1 << 15))) { + if ((*moveStatusFlags & MOVE_STATUS_SUPER_EFFECTIVE) && movePower) { + if (CheckBattlerAbilityIfNotIgnored(ctx, battlerIdAttacker, battlerIdTarget, ABILITY_FILTER) == TRUE || CheckBattlerAbilityIfNotIgnored(ctx, battlerIdAttacker, battlerIdTarget, ABILITY_SOLID_ROCK) == TRUE) { + damage = DamageDivide(damage * 3, 4); + } + if (itemAttacker == HOLD_EFFECT_POWER_UP_SE) { + damage = damage * (100 + extraAttacker) / 100; + } + } + if ((*moveStatusFlags & MOVE_STATUS_NOT_VERY_EFFECTIVE) && movePower) { + if (GetBattlerAbility(ctx, battlerIdAttacker) == ABILITY_TINTED_LENS) { + damage *= 2; + } + } + } else { + *moveStatusFlags &= ~MOVE_STATUS_SUPER_EFFECTIVE; + *moveStatusFlags &= ~MOVE_STATUS_NOT_VERY_EFFECTIVE; + } + + return damage; +} +#else +extern s32 _s32_div_f(s32 a1, s32 a2); + +asm int ov12_02251D28(BattleSystem *bsys, BATTLECONTEXT *ctx, int moveNo, int moveTypeDefault, int battlerIdAttacker, int battlerIdTarget, int damage, u32 *moveStatusFlag) { + push {r3, r4, r5, r6, r7, lr} + sub sp, #0x30 + ldr r0, [sp, #0x50] + add r5, r1, #0 + str r0, [sp, #0x50] + ldr r0, [sp, #0x54] + str r2, [sp, #8] + str r0, [sp, #0x54] + add r0, r2, #0 + add r4, r3, #0 + ldr r7, [sp, #0x48] + ldr r6, [sp, #0x4c] + cmp r0, #0xa5 + bne _02251D4A + ldr r0, [sp, #0x50] + add sp, #0x30 + pop {r3, r4, r5, r6, r7, pc} +_02251D4A: + add r0, r5, #0 + add r1, r7, #0 + bl GetBattlerHeldItemEffect + lsl r0, r0, #0x18 + lsr r0, r0, #0x18 + str r0, [sp, #0x24] + add r0, r5, #0 + add r1, r7, #0 + mov r2, #0 + bl BattleSystem_GetHeldItemDamageBoost + lsl r0, r0, #0x18 + lsr r0, r0, #0x18 + str r0, [sp, #0x1c] + add r0, r5, #0 + add r1, r6, #0 + bl GetBattlerHeldItemEffect + lsl r0, r0, #0x18 + lsr r0, r0, #0x18 + str r0, [sp, #0x20] + add r0, r5, #0 + add r1, r6, #0 + mov r2, #0 + bl BattleSystem_GetHeldItemDamageBoost + add r0, r5, #0 + add r1, r7, #0 + bl GetBattlerAbility + cmp r0, #0x60 + bne _02251D92 + mov r0, #0 + str r0, [sp, #0x28] + b _02251DAA +_02251D92: + cmp r4, #0 + beq _02251D9E + lsl r0, r4, #0x18 + lsr r0, r0, #0x18 + str r0, [sp, #0x28] + b _02251DAA +_02251D9E: + ldr r0, [sp, #8] + lsl r0, r0, #4 + add r1, r5, r0 + ldr r0, =0x000003E2 + ldrb r0, [r1, r0] + str r0, [sp, #0x28] +_02251DAA: + ldr r0, [sp, #8] + lsl r0, r0, #4 + add r1, r5, r0 + ldr r0, =0x000003E1 + ldrb r0, [r1, r0] + str r0, [sp, #0x14] + ldr r0, =0x0000213C + ldr r1, [r5, r0] + mov r0, #2 + lsl r0, r0, #0xa + tst r0, r1 + bne _02251E08 + add r0, r5, #0 + add r1, r7, #0 + mov r2, #0x1b + mov r3, #0 + bl GetBattlerVar + ldr r1, [sp, #0x28] + cmp r1, r0 + beq _02251DE6 + add r0, r5, #0 + add r1, r7, #0 + mov r2, #0x1c + mov r3, #0 + bl GetBattlerVar + ldr r1, [sp, #0x28] + cmp r1, r0 + bne _02251E08 +_02251DE6: + add r0, r5, #0 + add r1, r7, #0 + bl GetBattlerAbility + cmp r0, #0x5b + bne _02251DFA + ldr r0, [sp, #0x50] + lsl r0, r0, #1 + str r0, [sp, #0x50] + b _02251E08 +_02251DFA: + ldr r1, [sp, #0x50] + mov r0, #0xf + mul r0, r1 + mov r1, #0xa + bl _s32_div_f + str r0, [sp, #0x50] +_02251E08: + add r0, r5, #0 + add r1, r7, #0 + add r2, r6, #0 + mov r3, #0x1a + bl CheckBattlerAbilityIfNotIgnored + cmp r0, #1 + bne _02251E34 + ldr r0, [sp, #0x28] + cmp r0, #4 + bne _02251E34 + ldr r0, [sp, #0x20] + cmp r0, #0x6a + beq _02251E34 + ldr r0, [sp, #0x54] + ldr r1, [r0, #0] + mov r0, #2 + lsl r0, r0, #0xa + orr r1, r0 + ldr r0, [sp, #0x54] + str r1, [r0] + b _02251F50 +_02251E34: + mov r0, #0xc0 + add r1, r6, #0 + mul r1, r0 + ldr r0, =0x00002DCC + add r3, r5, r1 + ldr r2, [r3, r0] + lsl r2, r2, #0x10 + lsr r2, r2, #0x1d + beq _02251E6C + sub r0, #0xc + ldr r2, [r3, r0] + mov r0, #1 + lsl r0, r0, #0xa + tst r2, r0 + bne _02251E6C + ldr r2, [sp, #0x28] + cmp r2, #4 + bne _02251E6C + ldr r2, [sp, #0x20] + cmp r2, #0x6a + beq _02251E6C + ldr r1, [sp, #0x54] + lsl r0, r0, #0xa + ldr r1, [r1, #0] + orr r1, r0 + ldr r0, [sp, #0x54] + str r1, [r0] + b _02251F50 +_02251E6C: + add r0, r5, r1 + mov r4, #0 + str r0, [sp, #0x18] +_02251E72: + lsl r0, r4, #1 + ldr r1, =sTypeEffectiveness + add r0, r4, r0 + add r1, r1, r0 + str r1, [sp, #0xc] + ldr r1, =sTypeEffectiveness + ldrb r1, [r1, r0] + cmp r1, #0xfe + bne _02251EA2 + ldr r1, [sp, #0x18] + ldr r0, =0x00002DB0 + ldr r1, [r1, r0] + mov r0, #2 + lsl r0, r0, #0x1c + tst r0, r1 + bne _02251F50 + add r0, r5, #0 + add r1, r7, #0 + bl GetBattlerAbility + cmp r0, #0x71 + beq _02251F50 + add r4, r4, #1 + b _02251F44 +_02251EA2: + ldr r0, [sp, #0x28] + cmp r0, r1 + bne _02251F42 + ldr r0, [sp, #0xc] + add r1, r6, #0 + ldrb r0, [r0, #1] + mov r2, #0x1b + mov r3, #0 + str r0, [sp, #0x10] + add r0, r5, #0 + bl GetBattlerVar + ldr r1, [sp, #0x10] + cmp r1, r0 + bne _02251EE8 + add r0, r5, #0 + add r1, r7, #0 + add r2, r6, #0 + add r3, r4, #0 + bl ov12_02251C74 + cmp r0, #1 + bne _02251EE8 + ldr r0, [sp, #0x14] + ldr r2, [sp, #0xc] + str r0, [sp] + ldr r0, [sp, #0x54] + ldr r3, [sp, #0x50] + str r0, [sp, #4] + ldrb r2, [r2, #2] + add r0, r5, #0 + add r1, r7, #0 + bl ov12_022583B4 + str r0, [sp, #0x50] +_02251EE8: + add r0, r5, #0 + add r1, r6, #0 + mov r2, #0x1c + mov r3, #0 + bl GetBattlerVar + ldr r1, [sp, #0x10] + cmp r1, r0 + bne _02251F42 + add r0, r5, #0 + add r1, r6, #0 + mov r2, #0x1b + mov r3, #0 + bl GetBattlerVar + str r0, [sp, #0x2c] + add r0, r5, #0 + add r1, r6, #0 + mov r2, #0x1c + mov r3, #0 + bl GetBattlerVar + ldr r1, [sp, #0x2c] + cmp r1, r0 + beq _02251F42 + add r0, r5, #0 + add r1, r7, #0 + add r2, r6, #0 + add r3, r4, #0 + bl ov12_02251C74 + cmp r0, #1 + bne _02251F42 + ldr r0, [sp, #0x14] + ldr r2, [sp, #0xc] + str r0, [sp] + ldr r0, [sp, #0x54] + ldr r3, [sp, #0x50] + str r0, [sp, #4] + ldrb r2, [r2, #2] + add r0, r5, #0 + add r1, r7, #0 + bl ov12_022583B4 + str r0, [sp, #0x50] +_02251F42: + add r4, r4, #1 +_02251F44: + lsl r0, r4, #1 + add r1, r4, r0 + ldr r0, =sTypeEffectiveness + ldrb r0, [r0, r1] + cmp r0, #0xff + bne _02251E72 +_02251F50: + add r0, r5, #0 + add r1, r7, #0 + add r2, r6, #0 + mov r3, #0x19 + bl CheckBattlerAbilityIfNotIgnored + cmp r0, #1 + bne _02251F94 + ldr r1, [sp, #8] + add r0, r5, #0 + bl ov12_02258440 + cmp r0, #0 + beq _02251F94 + ldr r0, [sp, #0x54] + ldr r1, [r0, #0] + mov r0, #2 + tst r0, r1 + beq _02251F7E + mov r0, #6 + and r0, r1 + cmp r0, #6 + bne _02251F94 +_02251F7E: + ldr r0, [sp, #0x14] + cmp r0, #0 + beq _02251F94 + ldr r0, [sp, #0x54] + ldr r1, [r0, #0] + mov r0, #1 + lsl r0, r0, #0x12 + orr r1, r0 + ldr r0, [sp, #0x54] + str r1, [r0] + b _02252036 +_02251F94: + ldr r0, =0x0000213C + ldr r2, [r5, r0] + mov r0, #2 + lsl r0, r0, #0xa + add r1, r2, #0 + tst r1, r0 + bne _02252022 + lsl r0, r0, #4 + tst r0, r2 + bne _02252022 + ldr r0, [sp, #0x54] + ldr r1, [r0, #0] + mov r0, #2 + tst r0, r1 + beq _02251FFE + ldr r0, [sp, #0x14] + cmp r0, #0 + beq _02251FFE + add r0, r5, #0 + add r1, r7, #0 + add r2, r6, #0 + mov r3, #0x6f + bl CheckBattlerAbilityIfNotIgnored + cmp r0, #1 + beq _02251FD8 + add r0, r5, #0 + add r1, r7, #0 + add r2, r6, #0 + mov r3, #0x74 + bl CheckBattlerAbilityIfNotIgnored + cmp r0, #1 + bne _02251FE6 +_02251FD8: + ldr r0, [sp, #0x50] + lsl r1, r0, #1 + add r0, r0, r1 + mov r1, #4 + bl DamageDivide + str r0, [sp, #0x50] +_02251FE6: + ldr r0, [sp, #0x24] + cmp r0, #0x60 + bne _02251FFE + ldr r0, [sp, #0x1c] + ldr r1, [sp, #0x50] + add r0, #0x64 + str r0, [sp, #0x1c] + mul r0, r1 + mov r1, #0x64 + bl _s32_div_f + str r0, [sp, #0x50] +_02251FFE: + ldr r0, [sp, #0x54] + ldr r1, [r0, #0] + mov r0, #4 + tst r0, r1 + beq _02252036 + ldr r0, [sp, #0x14] + cmp r0, #0 + beq _02252036 + add r0, r5, #0 + add r1, r7, #0 + bl GetBattlerAbility + cmp r0, #0x6e + bne _02252036 + ldr r0, [sp, #0x50] + lsl r0, r0, #1 + str r0, [sp, #0x50] + b _02252036 +_02252022: + ldr r0, [sp, #0x54] + ldr r1, [r0, #0] + mov r0, #2 + bic r1, r0 + ldr r0, [sp, #0x54] + str r1, [r0] + mov r0, #4 + bic r1, r0 + ldr r0, [sp, #0x54] + str r1, [r0] +_02252036: + ldr r0, [sp, #0x50] + add sp, #0x30 + pop {r3, r4, r5, r6, r7, pc} +} +#endif + +/* +void ov12_02252218(BattleSystem *bsys, int moveNo, int moveTypeDefault, int abilityAttacker, int abilityTarget, int item, int type1, int type2, u32 *moveStatusFlag) { + int i; + u8 moveType; + + if (moveNo == MOVE_STRUGGLE) { + return; + } + + if (abilityAttacker == ABILITY_NORMALIZE) { + moveType = TYPE_NORMAL; + } else if (moveTypeDefault) { + moveType = moveTypeDefault; + } else { + moveType = ctx->unk_334.moveData[moveNo].type; + } + + if (abilityAttacker != ABILITY_MOLD_BREAKER && abilityTarget == ABILITY_LEVITATE && moveType == TYPE_GROUND && !(ctx->fieldCondition & FIELD_CONDITION_GRAVITY) && item != HOLD_EFFECT_SPEED_DOWN_GROUNDED) { + *moveStatusFlag |= MOVE_EFFECT_NO_EFFECT + } + +} +*/ \ No newline at end of file