mirror of
https://github.com/pret/pokeruby.git
synced 2024-12-03 18:50:47 +00:00
last function IsPokeDisobedient
This commit is contained in:
parent
3d0adf4157
commit
6785868132
583
asm/battle_3.s
583
asm/battle_3.s
@ -6,590 +6,7 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start unref_sub_801B40C
|
||||
unref_sub_801B40C: @ 801B40C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x8
|
||||
movs r0, 0
|
||||
str r0, [sp]
|
||||
ldr r0, _0801B464 @ =gBattleTypeFlags
|
||||
ldrh r1, [r0]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0801B42A
|
||||
b _0801B56E
|
||||
_0801B42A:
|
||||
movs r1, 0x1
|
||||
mov r9, r1
|
||||
_0801B42E:
|
||||
movs r5, 0
|
||||
ldr r4, _0801B468 @ =gUnknown_081FC1D0
|
||||
ldr r2, [sp]
|
||||
adds r2, 0x1
|
||||
str r2, [sp, 0x4]
|
||||
_0801B438:
|
||||
ldr r0, _0801B46C @ =gAbsentBankFlags
|
||||
ldrb r2, [r0]
|
||||
ldr r3, _0801B470 @ =gBitTable
|
||||
lsls r0, r5, 2
|
||||
adds r0, r3
|
||||
ldr r0, [r0]
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
bne _0801B45A
|
||||
adds r0, r5, 0x2
|
||||
lsls r1, r0, 2
|
||||
adds r1, r3
|
||||
ldr r1, [r1]
|
||||
ands r2, r1
|
||||
adds r7, r0, 0
|
||||
cmp r2, 0
|
||||
beq _0801B474
|
||||
_0801B45A:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
b _0801B556
|
||||
.align 2, 0
|
||||
_0801B464: .4byte gBattleTypeFlags
|
||||
_0801B468: .4byte gUnknown_081FC1D0
|
||||
_0801B46C: .4byte gAbsentBankFlags
|
||||
_0801B470: .4byte gBitTable
|
||||
_0801B474:
|
||||
ldr r0, _0801B580 @ =gUnknown_081FC1D0
|
||||
ldr r2, [sp]
|
||||
lsls r1, r2, 3
|
||||
adds r6, r1, r0
|
||||
ldr r4, _0801B584 @ =gChosenMovesByBanks
|
||||
lsls r0, r5, 1
|
||||
adds r3, r0, r4
|
||||
ldrh r2, [r6]
|
||||
mov r8, r1
|
||||
mov r10, r0
|
||||
ldrh r3, [r3]
|
||||
cmp r2, r3
|
||||
bne _0801B4E4
|
||||
lsls r0, r7, 1
|
||||
adds r0, r4
|
||||
ldrh r1, [r6, 0x2]
|
||||
ldrh r0, [r0]
|
||||
cmp r1, r0
|
||||
bne _0801B4E4
|
||||
adds r0, r5, 0
|
||||
bl GetBankIdentity
|
||||
mov r2, r9
|
||||
ands r2, r0
|
||||
lsls r1, r2, 1
|
||||
adds r1, r2
|
||||
lsls r1, 2
|
||||
ldr r0, _0801B588 @ =gSideTimer
|
||||
adds r1, r0
|
||||
lsls r0, r7, 4
|
||||
orrs r0, r5
|
||||
strb r0, [r1, 0x3]
|
||||
adds r0, r5, 0
|
||||
bl GetBankIdentity
|
||||
mov r1, r9
|
||||
ands r1, r0
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, _0801B588 @ =gSideTimer
|
||||
adds r0, r1
|
||||
ldrh r1, [r6, 0x4]
|
||||
strh r1, [r0, 0x4]
|
||||
adds r0, r5, 0
|
||||
bl GetBankIdentity
|
||||
mov r1, r9
|
||||
ands r1, r0
|
||||
lsls r1, 1
|
||||
ldr r2, _0801B58C @ =gSideAffecting
|
||||
adds r1, r2
|
||||
ldrh r0, [r1]
|
||||
movs r2, 0x4
|
||||
orrs r0, r2
|
||||
strh r0, [r1]
|
||||
_0801B4E4:
|
||||
ldr r0, _0801B580 @ =gUnknown_081FC1D0
|
||||
mov r1, r8
|
||||
adds r4, r1, r0
|
||||
ldr r2, _0801B584 @ =gChosenMovesByBanks
|
||||
lsls r0, r7, 1
|
||||
adds r0, r2
|
||||
ldrh r1, [r4]
|
||||
ldrh r0, [r0]
|
||||
cmp r1, r0
|
||||
bne _0801B54E
|
||||
mov r0, r10
|
||||
adds r1, r0, r2
|
||||
ldrh r0, [r4, 0x2]
|
||||
ldrh r1, [r1]
|
||||
cmp r0, r1
|
||||
bne _0801B54E
|
||||
adds r0, r5, 0
|
||||
bl GetBankIdentity
|
||||
mov r2, r9
|
||||
ands r2, r0
|
||||
lsls r1, r2, 1
|
||||
adds r1, r2
|
||||
lsls r1, 2
|
||||
ldr r2, _0801B588 @ =gSideTimer
|
||||
adds r1, r2
|
||||
lsls r0, r5, 4
|
||||
orrs r0, r7
|
||||
strb r0, [r1, 0x3]
|
||||
adds r0, r5, 0
|
||||
bl GetBankIdentity
|
||||
mov r1, r9
|
||||
ands r1, r0
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, _0801B588 @ =gSideTimer
|
||||
adds r0, r1
|
||||
ldrh r1, [r4, 0x4]
|
||||
strh r1, [r0, 0x4]
|
||||
adds r0, r5, 0
|
||||
bl GetBankIdentity
|
||||
mov r1, r9
|
||||
ands r1, r0
|
||||
lsls r1, 1
|
||||
ldr r2, _0801B58C @ =gSideAffecting
|
||||
adds r1, r2
|
||||
ldrh r0, [r1]
|
||||
movs r2, 0x4
|
||||
orrs r0, r2
|
||||
strh r0, [r1]
|
||||
_0801B54E:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
ldr r4, _0801B580 @ =gUnknown_081FC1D0
|
||||
_0801B556:
|
||||
cmp r5, 0x1
|
||||
bhi _0801B55C
|
||||
b _0801B438
|
||||
_0801B55C:
|
||||
ldr r0, [sp, 0x4]
|
||||
str r0, [sp]
|
||||
lsls r0, 3
|
||||
adds r0, r4
|
||||
ldrh r1, [r0]
|
||||
ldr r0, _0801B590 @ =0x0000ffff
|
||||
cmp r1, r0
|
||||
beq _0801B56E
|
||||
b _0801B42E
|
||||
_0801B56E:
|
||||
add sp, 0x8
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0801B580: .4byte gUnknown_081FC1D0
|
||||
_0801B584: .4byte gChosenMovesByBanks
|
||||
_0801B588: .4byte gSideTimer
|
||||
_0801B58C: .4byte gSideAffecting
|
||||
_0801B590: .4byte 0x0000ffff
|
||||
thumb_func_end unref_sub_801B40C
|
||||
|
||||
thumb_func_start sub_801B594
|
||||
sub_801B594: @ 801B594
|
||||
push {lr}
|
||||
ldr r0, _0801B5B4 @ =gBattleExecBuffer
|
||||
ldr r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _0801B5B0
|
||||
ldr r1, _0801B5B8 @ =gBattleScriptingCommandsTable
|
||||
ldr r0, _0801B5BC @ =gBattlescriptCurrInstr
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
bl _call_via_r0
|
||||
_0801B5B0:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0801B5B4: .4byte gBattleExecBuffer
|
||||
_0801B5B8: .4byte gBattleScriptingCommandsTable
|
||||
_0801B5BC: .4byte gBattlescriptCurrInstr
|
||||
thumb_func_end sub_801B594
|
||||
|
||||
thumb_func_start sub_801B5C0
|
||||
sub_801B5C0: @ 801B5C0
|
||||
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 _0801B5DE
|
||||
subs r0, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
b _0801B5EA
|
||||
_0801B5DE:
|
||||
ldr r1, _0801B5FC @ =gBattleMoves
|
||||
lsls r0, r7, 1
|
||||
adds r0, r7
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldrb r6, [r0, 0x6]
|
||||
_0801B5EA:
|
||||
cmp r6, 0x40
|
||||
bls _0801B5F0
|
||||
b _0801B900
|
||||
_0801B5F0:
|
||||
lsls r0, r6, 2
|
||||
ldr r1, _0801B600 @ =_0801B604
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.align 2, 0
|
||||
_0801B5FC: .4byte gBattleMoves
|
||||
_0801B600: .4byte _0801B604
|
||||
.align 2, 0
|
||||
_0801B604:
|
||||
.4byte _0801B708
|
||||
.4byte _0801B808
|
||||
.4byte _0801B8FC
|
||||
.4byte _0801B900
|
||||
.4byte _0801B820
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B808
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B8FC
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B808
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B900
|
||||
.4byte _0801B808
|
||||
_0801B708:
|
||||
ldr r0, _0801B7E8 @ =gBankAttacker
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
movs r1, 0x1
|
||||
eors r0, r1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r1, _0801B7EC @ =gSideTimer
|
||||
lsls r0, r4, 1
|
||||
adds r0, r4
|
||||
lsls r0, 2
|
||||
adds r2, r0, r1
|
||||
ldrb r0, [r2, 0x8]
|
||||
cmp r0, 0
|
||||
beq _0801B73A
|
||||
ldr r1, _0801B7F0 @ =gBattleMons
|
||||
ldrb r4, [r2, 0x9]
|
||||
movs r0, 0x58
|
||||
muls r0, r4
|
||||
adds r0, r1
|
||||
ldrh r0, [r0, 0x28]
|
||||
cmp r0, 0
|
||||
beq _0801B73A
|
||||
b _0801B850
|
||||
_0801B73A:
|
||||
ldr r0, _0801B7E8 @ =gBankAttacker
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
lsls r0, r7, 1
|
||||
mov r8, r0
|
||||
_0801B74A:
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
ldr r1, _0801B7F4 @ =gNoOfAllBanks
|
||||
ldrb r1, [r1]
|
||||
bl __modsi3
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
ldr r6, _0801B7E8 @ =gBankAttacker
|
||||
ldrb r2, [r6]
|
||||
cmp r5, r2
|
||||
beq _0801B74A
|
||||
adds r0, r5, 0
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r4, r0
|
||||
beq _0801B74A
|
||||
ldr r0, _0801B7F8 @ =gAbsentBankFlags
|
||||
ldrb r2, [r0]
|
||||
ldr r1, _0801B7FC @ =gBitTable
|
||||
lsls r0, r5, 2
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
ands r2, r0
|
||||
cmp r2, 0
|
||||
bne _0801B74A
|
||||
ldr r0, _0801B800 @ =gBattleMoves
|
||||
mov r3, r8
|
||||
adds r1, r3, r7
|
||||
lsls r1, 2
|
||||
adds r1, r0
|
||||
ldrb r0, [r1, 0x2]
|
||||
cmp r0, 0xD
|
||||
beq _0801B798
|
||||
b _0801B900
|
||||
_0801B798:
|
||||
ldrb r1, [r6]
|
||||
str r2, [sp]
|
||||
movs r0, 0x10
|
||||
movs r2, 0x1F
|
||||
movs r3, 0
|
||||
bl AbilityBattleEffects
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0801B7AE
|
||||
b _0801B900
|
||||
_0801B7AE:
|
||||
ldr r2, _0801B7F0 @ =gBattleMons
|
||||
movs r1, 0x58
|
||||
adds r0, r5, 0
|
||||
muls r0, r1
|
||||
adds r0, r2
|
||||
adds r0, 0x20
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1F
|
||||
bne _0801B7C2
|
||||
b _0801B900
|
||||
_0801B7C2:
|
||||
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, _0801B804 @ =gSpecialStatuses
|
||||
lsls r0, r5, 2
|
||||
adds r0, r5
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldrb r1, [r0]
|
||||
orrs r1, r4
|
||||
strb r1, [r0]
|
||||
b _0801B900
|
||||
.align 2, 0
|
||||
_0801B7E8: .4byte gBankAttacker
|
||||
_0801B7EC: .4byte gSideTimer
|
||||
_0801B7F0: .4byte gBattleMons
|
||||
_0801B7F4: .4byte gNoOfAllBanks
|
||||
_0801B7F8: .4byte gAbsentBankFlags
|
||||
_0801B7FC: .4byte gBitTable
|
||||
_0801B800: .4byte gBattleMoves
|
||||
_0801B804: .4byte gSpecialStatuses
|
||||
_0801B808:
|
||||
ldr r0, _0801B81C @ =gBankAttacker
|
||||
ldrb r0, [r0]
|
||||
bl GetBankIdentity
|
||||
adds r1, r0, 0
|
||||
movs r2, 0x1
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
eors r0, r2
|
||||
b _0801B8B2
|
||||
.align 2, 0
|
||||
_0801B81C: .4byte gBankAttacker
|
||||
_0801B820:
|
||||
ldr r0, _0801B854 @ =gBankAttacker
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
movs r1, 0x1
|
||||
eors r0, r1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r1, _0801B858 @ =gSideTimer
|
||||
lsls r0, r4, 1
|
||||
adds r0, r4
|
||||
lsls r0, 2
|
||||
adds r2, r0, r1
|
||||
ldrb r0, [r2, 0x8]
|
||||
cmp r0, 0
|
||||
beq _0801B860
|
||||
ldr r1, _0801B85C @ =gBattleMons
|
||||
ldrb r4, [r2, 0x9]
|
||||
movs r0, 0x58
|
||||
muls r0, r4
|
||||
adds r0, r1
|
||||
ldrh r0, [r0, 0x28]
|
||||
cmp r0, 0
|
||||
beq _0801B860
|
||||
_0801B850:
|
||||
adds r5, r4, 0
|
||||
b _0801B900
|
||||
.align 2, 0
|
||||
_0801B854: .4byte gBankAttacker
|
||||
_0801B858: .4byte gSideTimer
|
||||
_0801B85C: .4byte gBattleMons
|
||||
_0801B860:
|
||||
ldr r0, _0801B894 @ =gBattleTypeFlags
|
||||
ldrh r1, [r0]
|
||||
movs r4, 0x1
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0801B8DC
|
||||
movs r0, 0x4
|
||||
ands r6, r0
|
||||
cmp r6, 0
|
||||
beq _0801B8DC
|
||||
ldr r0, _0801B898 @ =gBankAttacker
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0801B8A0
|
||||
bl Random
|
||||
adds r1, r4, 0
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
beq _0801B89C
|
||||
movs r0, 0x1
|
||||
b _0801B8B2
|
||||
.align 2, 0
|
||||
_0801B894: .4byte gBattleTypeFlags
|
||||
_0801B898: .4byte gBankAttacker
|
||||
_0801B89C:
|
||||
movs r0, 0x3
|
||||
b _0801B8B2
|
||||
_0801B8A0:
|
||||
bl Random
|
||||
adds r1, r4, 0
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
beq _0801B8B0
|
||||
movs r0, 0
|
||||
b _0801B8B2
|
||||
_0801B8B0:
|
||||
movs r0, 0x2
|
||||
_0801B8B2:
|
||||
bl GetBankByPlayerAI
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
ldr r0, _0801B8D4 @ =gAbsentBankFlags
|
||||
ldrb r1, [r0]
|
||||
ldr r2, _0801B8D8 @ =gBitTable
|
||||
lsls r0, r5, 2
|
||||
adds r0, r2
|
||||
ldr r0, [r0]
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
beq _0801B900
|
||||
movs r0, 0x2
|
||||
eors r5, r0
|
||||
b _0801B900
|
||||
.align 2, 0
|
||||
_0801B8D4: .4byte gAbsentBankFlags
|
||||
_0801B8D8: .4byte gBitTable
|
||||
_0801B8DC:
|
||||
ldr r0, _0801B8F8 @ =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 _0801B900
|
||||
.align 2, 0
|
||||
_0801B8F8: .4byte gBankAttacker
|
||||
_0801B8FC:
|
||||
ldr r0, _0801B91C @ =gBankAttacker
|
||||
ldrb r5, [r0]
|
||||
_0801B900:
|
||||
ldr r1, _0801B920 @ =0x02000000
|
||||
ldr r0, _0801B91C @ =gBankAttacker
|
||||
ldrb r0, [r0]
|
||||
ldr r2, _0801B924 @ =0x00016010
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
strb r5, [r0]
|
||||
adds r0, r5, 0
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0801B91C: .4byte gBankAttacker
|
||||
_0801B920: .4byte 0x02000000
|
||||
_0801B924: .4byte 0x00016010
|
||||
thumb_func_end sub_801B5C0
|
||||
|
||||
thumb_func_start IsPokeDisobedient
|
||||
IsPokeDisobedient: @ 801B928
|
||||
|
@ -286,11 +286,3 @@ gLinkOpponentBufferCommands:: @ 81FB048
|
||||
|
||||
@ 81FB12C
|
||||
.include "data/battle_moves.inc"
|
||||
|
||||
.align 2
|
||||
gUnknown_081FC1D0:: @ 81FC1D0
|
||||
.2byte 0x34, 0x10, 0x101
|
||||
.space 2
|
||||
|
||||
.2byte -1, -1, -1
|
||||
.space 2
|
||||
|
@ -96,6 +96,7 @@
|
||||
#define HITMARKER_IGNORE_UNDERWATER 0x00040000
|
||||
#define HITMARKER_UNABLE_TO_USE_MOVE 0x00080000
|
||||
#define HITMARKER_x100000 0x00100000
|
||||
#define HITMARKER_x200000 0x00200000
|
||||
#define HITMARKER_x400000 0x00400000
|
||||
#define HITMARKER_x800000 0x00800000
|
||||
#define HITMARKER_GRUDGE 0x01000000
|
||||
@ -661,6 +662,8 @@ extern u8 ewram[];
|
||||
#define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840))
|
||||
#define ewram17000 ((u32 *) (ewram + 0x17100))
|
||||
|
||||
typedef void (*BattleCmdFunc)(void);
|
||||
|
||||
struct funcStack
|
||||
{
|
||||
void* ptr[8];
|
||||
|
@ -333,6 +333,7 @@ SECTIONS {
|
||||
data/data2a.o(.rodata);
|
||||
src/battle_4.o(.rodata);
|
||||
data/data2b.o(.rodata);
|
||||
src/battle_3.o(.rodata);
|
||||
src/pokemon_data.o(.rodata);
|
||||
. = ALIGN(4);
|
||||
src/trig.o(.rodata);
|
||||
|
224
src/battle_3.c
224
src/battle_3.c
@ -12,6 +12,7 @@
|
||||
#include "text.h"
|
||||
#include "battle_move_effects.h"
|
||||
#include "string_util.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern u8* gBattlescriptCurrInstr;
|
||||
extern u8 gActiveBank;
|
||||
@ -61,7 +62,7 @@ bool8 sub_8018018(u8 bank, u8, u8);
|
||||
void sub_8015740(u8 bank);
|
||||
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 a4, u16 powerOverride, u8 typeOverride, u8 bank_atk, u8 bank_def);
|
||||
u8 CountTrailingZeroBits(u32 a);
|
||||
u8 sub_801B5C0(u16 move, u8 targetbyte); //get target of move
|
||||
u8 sub_801B5C0(u16 move, u8 useMoveTarget); //get target of move
|
||||
u8 sub_803FC34(u8 bank);
|
||||
u16 sub_803FBFC(u8 a);
|
||||
u8 weather_get_current(void);
|
||||
@ -6354,9 +6355,19 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
|
||||
return effect;
|
||||
}
|
||||
|
||||
extern const u16 gUnknown_081FC1D0[];
|
||||
struct CombinedMove
|
||||
{
|
||||
u16 move1;
|
||||
u16 move2;
|
||||
u16 newMove;
|
||||
};
|
||||
|
||||
const struct CombinedMove sCombinedMoves[2] =
|
||||
{
|
||||
{MOVE_EMBER, MOVE_GUST, MOVE_HEAT_WAVE},
|
||||
{0xFFFF, 0xFFFF, 0xFFFF}
|
||||
};
|
||||
|
||||
/*
|
||||
void unref_sub_801B40C(void)
|
||||
{
|
||||
int i = 0;
|
||||
@ -6372,23 +6383,220 @@ void unref_sub_801B40C(void)
|
||||
bank++;
|
||||
else
|
||||
{
|
||||
if (gUnknown_081FC1D0[i * 4 + 0] == gChosenMovesByBanks[bank] && gUnknown_081FC1D0[i * 4 + 1] == gChosenMovesByBanks[bank + 2])
|
||||
if (sCombinedMoves[i].move1 == gChosenMovesByBanks[bank] && sCombinedMoves[i].move2 == gChosenMovesByBanks[bank + 2])
|
||||
{
|
||||
gSideTimer[GetBankIdentity(bank) & 1].field3 = (bank) | ((bank + 2) << 4);
|
||||
gSideTimer[GetBankIdentity(bank) & 1].field4 = gUnknown_081FC1D0[i * 4 + 2];
|
||||
gSideTimer[GetBankIdentity(bank) & 1].field4 = sCombinedMoves[i].newMove;
|
||||
gSideAffecting[GetBankIdentity(bank) & 1] |= SIDE_STATUS_X4;
|
||||
}
|
||||
if (gUnknown_081FC1D0[i * 4 + 0] == gChosenMovesByBanks[bank + 2] && gUnknown_081FC1D0[i * 4 + 1] == gChosenMovesByBanks[bank])
|
||||
if (sCombinedMoves[i].move1 == gChosenMovesByBanks[bank + 2] && sCombinedMoves[i].move2 == gChosenMovesByBanks[bank])
|
||||
{
|
||||
gSideTimer[GetBankIdentity(bank) & 1].field3 = (bank + 2) | ((bank) << 4);
|
||||
gSideTimer[GetBankIdentity(bank) & 1].field4 = gUnknown_081FC1D0[i * 4 + 2];
|
||||
gSideTimer[GetBankIdentity(bank) & 1].field4 = sCombinedMoves[i].newMove;
|
||||
gSideAffecting[GetBankIdentity(bank) & 1] |= SIDE_STATUS_X4;
|
||||
}
|
||||
bank++;
|
||||
}
|
||||
} while (bank < 2);
|
||||
i++;
|
||||
} while (gUnknown_081FC1D0[i * 4] != 0xFFFF);
|
||||
} while (sCombinedMoves[i].move1 != 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
extern const BattleCmdFunc gBattleScriptingCommandsTable[];
|
||||
extern u32 gBattleExecBuffer;
|
||||
|
||||
void sub_801B594(void)
|
||||
{
|
||||
if (gBattleExecBuffer == 0)
|
||||
gBattleScriptingCommandsTable[*gBattlescriptCurrInstr]();
|
||||
}
|
||||
|
||||
u8 sub_801B5C0(u16 move, u8 useMoveTarget) //get move target
|
||||
{
|
||||
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 (gSideTimer[side].followmeTimer && gBattleMons[gSideTimer[side].followmeTarget].hp)
|
||||
targetBank = gSideTimer[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 (gSideTimer[side].followmeTimer && gBattleMons[gSideTimer[side].followmeTarget].hp)
|
||||
targetBank = gSideTimer[side].followmeTarget;
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & 4)
|
||||
{
|
||||
if (GetBankSide(gBankAttacker) == 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
ewram[gBankAttacker + 0x16010] = targetBank;
|
||||
return targetBank;
|
||||
}
|
||||
|
||||
extern u8 gUnknown_081D995F[]; //disobedient while asleep
|
||||
extern u8 gUnknown_081D9977[]; //disobedient no possible moves to use
|
||||
extern u8 gUnknown_081D996F[]; //disobedient, uses a random move
|
||||
extern u8 gUnknown_081D9989[]; //disobedient, went to sleep
|
||||
extern u8 gUnknown_081D99A0[]; //disobedient, hits itself
|
||||
|
||||
extern u8 gUnknown_02024BE5;
|
||||
extern u8 gCurrMovePos;
|
||||
extern u16 gRandomMove;
|
||||
extern s32 gBattleMoveDamage;
|
||||
extern u16 gDynamicBasePower;
|
||||
|
||||
/*
|
||||
u8 IsPokeDisobedient(void)
|
||||
{
|
||||
u8 obedienceLevel;
|
||||
register s32 calc asm("r4");
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK
|
||||
|| GetBankSide(gBankAttacker) == 1
|
||||
|| !IsOtherTrainer(gBattleMons[gBankAttacker].otId, gBattleMons[gBankAttacker].otName)
|
||||
|| 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;
|
||||
calc = (Random() & 255);
|
||||
calc = (gBattleMons[gBankAttacker].level + obedienceLevel) * calc / 256;
|
||||
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_081D995F;
|
||||
return 1;
|
||||
}
|
||||
calc = (Random() & 255);
|
||||
calc = (gBattleMons[gBankAttacker].level + obedienceLevel) * calc / 256;
|
||||
if (calc < obedienceLevel)
|
||||
{
|
||||
u8 moveLimitations = CheckMoveLimitations(gBankAttacker, gBitTable[gCurrMovePos], 0xFF);
|
||||
if (moveLimitations == 0xF) // all moves cannot be used
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3;
|
||||
gBattlescriptCurrInstr = gUnknown_081D9977;
|
||||
return 1;
|
||||
}
|
||||
else // use a random move
|
||||
{
|
||||
do
|
||||
{
|
||||
gCurrMovePos = gUnknown_02024BE5 = Random() & 3;
|
||||
} while (gBitTable[gCurrMovePos] & moveLimitations);
|
||||
gRandomMove = gBattleMons[gBankAttacker].moves[gCurrMovePos];
|
||||
gBattleCommunication[3] = 0;
|
||||
gDynamicBasePower = 0;
|
||||
BATTLE_STRUCT->dynamicMoveType = 0;
|
||||
gBattlescriptCurrInstr = gUnknown_081D996F;
|
||||
gBankTarget = sub_801B5C0(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_081D9989;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
calc -= obedienceLevel;
|
||||
if (calc < obedienceLevel)
|
||||
{
|
||||
gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBankAttacker], &gBattleMons[gBankAttacker], MOVE_POUND, 0, 40, 0, gBankAttacker, gBankAttacker);
|
||||
gBankTarget = gBankAttacker;
|
||||
gBattlescriptCurrInstr = gUnknown_081D99A0;
|
||||
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3;
|
||||
gBattlescriptCurrInstr = gUnknown_081D9977;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -529,8 +529,6 @@ static void atkF5_removeattackerstatus1(void);
|
||||
static void atkF6_802BF48(void);
|
||||
static void atkF7_802BF54(void);
|
||||
|
||||
typedef void (*BattleCmdFunc)(void);
|
||||
|
||||
const BattleCmdFunc gBattleScriptingCommandsTable[] =
|
||||
{
|
||||
atk00_attackcanceler,
|
||||
|
Loading…
Reference in New Issue
Block a user