mirror of
https://github.com/pret/pokeheartgold.git
synced 2025-02-05 20:36:45 +00:00
parent
b3e6499bc1
commit
5d4c08f6c0
@ -22,464 +22,13 @@
|
||||
.public BattleControllerPlayer_ItemInput
|
||||
.public BattleControllerPlayer_PokemonInput
|
||||
.public BattleControllerPlayer_RunInput
|
||||
.public BattleControllerPlayer_SafariBallInput
|
||||
.public BattleControllerPlayer_SafariThrowBall
|
||||
.public BattleControllerPlayer_SafariThrowMud
|
||||
.public BattleControllerPlayer_SafariRun
|
||||
.public BattleControllerPlayer_SafariWatching
|
||||
.public BattleControllerPlayer_CatchingContestThrowBall
|
||||
.public TryDisobedience
|
||||
|
||||
thumb_func_start ov12_0224AE64
|
||||
ov12_0224AE64: ; 0x0224AE64
|
||||
push {r4, lr}
|
||||
add r4, r1, #0
|
||||
add r0, r4, #0
|
||||
mov r1, #1
|
||||
mov r2, #0xe5
|
||||
bl ReadBattleScriptFromNarc
|
||||
mov r0, #0
|
||||
str r0, [r4, #0x64]
|
||||
mov r0, #1
|
||||
str r0, [r4, #0x6c]
|
||||
mov r0, #0x16
|
||||
str r0, [r4, #8]
|
||||
mov r0, #0x28
|
||||
str r0, [r4, #0xc]
|
||||
pop {r4, pc}
|
||||
thumb_func_end ov12_0224AE64
|
||||
|
||||
thumb_func_start ov12_0224AE84
|
||||
ov12_0224AE84: ; 0x0224AE84
|
||||
push {r3, r4, r5, lr}
|
||||
add r4, r1, #0
|
||||
add r5, r0, #0
|
||||
add r0, r4, #0
|
||||
mov r1, #1
|
||||
mov r2, #0xb
|
||||
bl ReadBattleScriptFromNarc
|
||||
mov r0, #0
|
||||
str r0, [r4, #0x64]
|
||||
mov r0, #1
|
||||
str r0, [r4, #0x6c]
|
||||
mov r0, #0x16
|
||||
str r0, [r4, #8]
|
||||
mov r0, #0x28
|
||||
ldr r1, _0224AEC8 ; =0x000001F3
|
||||
str r0, [r4, #0xc]
|
||||
add r0, r1, #0
|
||||
sub r0, #0xcb
|
||||
str r1, [r4, r0]
|
||||
add r0, r5, #0
|
||||
bl BattleSystem_GetSafariBallCount
|
||||
sub r1, r0, #1
|
||||
add r0, r5, #0
|
||||
bl BattleSystem_SetSafariBallCount
|
||||
ldr r1, _0224AECC ; =0x0000216C
|
||||
mov r0, #2
|
||||
ldr r2, [r4, r1]
|
||||
lsl r0, r0, #0x1e
|
||||
orr r0, r2
|
||||
str r0, [r4, r1]
|
||||
pop {r3, r4, r5, pc}
|
||||
.balign 4, 0
|
||||
_0224AEC8: .word 0x000001F3
|
||||
_0224AECC: .word 0x0000216C
|
||||
thumb_func_end ov12_0224AE84
|
||||
|
||||
thumb_func_start ov12_0224AED0
|
||||
ov12_0224AED0: ; 0x0224AED0
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
sub sp, #0x30
|
||||
add r5, r0, #0
|
||||
add r4, r1, #0
|
||||
add r7, r2, #0
|
||||
bl BattleSystem_GetBattleType
|
||||
add r6, r0, #0
|
||||
add r0, r5, #0
|
||||
mov r1, #0
|
||||
bl BattleSystem_GetPlayerProfile
|
||||
str r0, [sp, #0x28]
|
||||
mov r0, #0x84
|
||||
tst r0, r6
|
||||
beq _0224AEF6
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AEF6:
|
||||
ldr r1, [r4, #0x64]
|
||||
add r0, r5, #0
|
||||
bl BattleSystem_GetFieldSide
|
||||
cmp r0, #0
|
||||
beq _0224AF08
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AF08:
|
||||
mov r0, #0x40
|
||||
tst r0, r6
|
||||
beq _0224AF20
|
||||
ldr r1, [r4, #0x64]
|
||||
add r0, r5, #0
|
||||
bl ov12_0223AB0C
|
||||
cmp r0, #4
|
||||
bne _0224AF20
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AF20:
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
bl ov12_02256854
|
||||
cmp r0, #1
|
||||
bne _0224AF32
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AF32:
|
||||
ldr r1, [r4, #0x64]
|
||||
add r0, r4, #0
|
||||
bl Battler_CanSelectAction
|
||||
cmp r0, #0
|
||||
bne _0224AF44
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AF44:
|
||||
ldr r0, _0224B1D0 ; =0x00003044
|
||||
ldr r0, [r4, r0]
|
||||
cmp r0, #0x75
|
||||
bne _0224AF5E
|
||||
ldr r0, _0224B1D4 ; =0x0000213C
|
||||
ldr r1, [r4, r0]
|
||||
mov r0, #2
|
||||
lsl r0, r0, #8
|
||||
tst r0, r1
|
||||
beq _0224AF5E
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AF5E:
|
||||
ldr r0, [sp, #0x28]
|
||||
bl PlayerProfile_CountBadges
|
||||
cmp r0, #8
|
||||
blt _0224AF6E
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AF6E:
|
||||
ldr r0, [sp, #0x28]
|
||||
mov r6, #0xa
|
||||
bl PlayerProfile_CountBadges
|
||||
cmp r0, #1
|
||||
blt _0224AF7C
|
||||
mov r6, #0x14
|
||||
_0224AF7C:
|
||||
ldr r0, [sp, #0x28]
|
||||
bl PlayerProfile_CountBadges
|
||||
cmp r0, #2
|
||||
blt _0224AF88
|
||||
mov r6, #0x1e
|
||||
_0224AF88:
|
||||
ldr r0, [sp, #0x28]
|
||||
mov r1, #3
|
||||
bl PlayerProfile_TestBadgeFlag
|
||||
cmp r0, #0
|
||||
beq _0224AF96
|
||||
mov r6, #0x32
|
||||
_0224AF96:
|
||||
ldr r0, [sp, #0x28]
|
||||
mov r1, #5
|
||||
bl PlayerProfile_TestBadgeFlag
|
||||
cmp r0, #0
|
||||
beq _0224AFA4
|
||||
mov r6, #0x46
|
||||
_0224AFA4:
|
||||
ldr r1, [r4, #0x64]
|
||||
mov r0, #0xc0
|
||||
mul r0, r1
|
||||
str r0, [sp, #0x20]
|
||||
add r1, r4, r0
|
||||
ldr r0, _0224B1D8 ; =0x00002D74
|
||||
ldrb r0, [r1, r0]
|
||||
cmp r0, r6
|
||||
bhi _0224AFBC
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AFBC:
|
||||
add r0, r5, #0
|
||||
bl BattleSystem_Random
|
||||
ldr r1, [sp, #0x20]
|
||||
lsl r0, r0, #0x18
|
||||
add r2, r4, r1
|
||||
ldr r1, _0224B1D8 ; =0x00002D74
|
||||
lsr r0, r0, #0x18
|
||||
ldrb r2, [r2, r1]
|
||||
add r2, r6, r2
|
||||
mul r0, r2
|
||||
asr r0, r0, #8
|
||||
cmp r0, r6
|
||||
bge _0224AFDE
|
||||
add sp, #0x30
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224AFDE:
|
||||
ldr r0, _0224B1D0 ; =0x00003044
|
||||
ldr r0, [r4, r0]
|
||||
cmp r0, #0x63
|
||||
bne _0224AFF6
|
||||
add r1, #0x3c
|
||||
add r0, r4, r1
|
||||
ldr r1, [sp, #0x20]
|
||||
ldr r2, [r0, r1]
|
||||
ldr r1, _0224B1DC ; =0xFF7FFFFF
|
||||
and r2, r1
|
||||
ldr r1, [sp, #0x20]
|
||||
str r2, [r0, r1]
|
||||
_0224AFF6:
|
||||
ldr r0, [r4, #0x64]
|
||||
mov r1, #0xc0
|
||||
mul r1, r0
|
||||
str r0, [sp, #0x1c]
|
||||
ldr r0, _0224B1E0 ; =0x00002DAC
|
||||
add r1, r4, r1
|
||||
ldr r1, [r1, r0]
|
||||
mov r0, #7
|
||||
tst r0, r1
|
||||
beq _0224B020
|
||||
ldr r0, _0224B1D0 ; =0x00003044
|
||||
ldr r0, [r4, r0]
|
||||
cmp r0, #0xad
|
||||
beq _0224B016
|
||||
cmp r0, #0xd6
|
||||
bne _0224B020
|
||||
_0224B016:
|
||||
mov r0, #0xfe
|
||||
str r0, [r7]
|
||||
add sp, #0x30
|
||||
mov r0, #1
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224B020:
|
||||
ldr r0, [sp, #0x1c]
|
||||
mov r1, #0xc0
|
||||
mul r1, r0
|
||||
ldr r0, _0224B1D8 ; =0x00002D74
|
||||
add r1, r4, r1
|
||||
ldrb r0, [r1, r0]
|
||||
str r0, [sp, #0x24]
|
||||
add r0, r5, #0
|
||||
bl BattleSystem_Random
|
||||
ldr r1, [sp, #0x24]
|
||||
lsl r0, r0, #0x18
|
||||
add r1, r6, r1
|
||||
lsr r0, r0, #0x18
|
||||
mul r0, r1
|
||||
asr r0, r0, #8
|
||||
cmp r0, r6
|
||||
bge _0224B108
|
||||
ldr r0, [sp, #0x1c]
|
||||
lsl r0, r0, #1
|
||||
add r1, r4, r0
|
||||
ldr r0, _0224B1E4 ; =0x000030BC
|
||||
ldrh r0, [r1, r0]
|
||||
bl MaskOfFlagNo
|
||||
add r3, r0, #0
|
||||
mov r0, #0
|
||||
mvn r0, r0
|
||||
str r0, [sp]
|
||||
ldr r2, [r4, #0x64]
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
bl StruggleCheck
|
||||
add r6, r0, #0
|
||||
cmp r6, #0xf
|
||||
bne _0224B074
|
||||
mov r0, #0xff
|
||||
str r0, [r7]
|
||||
add sp, #0x30
|
||||
mov r0, #1
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224B074:
|
||||
add r0, r5, #0
|
||||
bl BattleSystem_Random
|
||||
mov r1, #3
|
||||
and r0, r1
|
||||
str r0, [sp, #0x2c]
|
||||
bl MaskOfFlagNo
|
||||
tst r0, r6
|
||||
bne _0224B074
|
||||
ldr r0, [r4, #0x64]
|
||||
ldr r3, _0224B1E4 ; =0x000030BC
|
||||
lsl r0, r0, #1
|
||||
add r1, r4, r0
|
||||
ldr r0, [sp, #0x2c]
|
||||
strh r0, [r1, r3]
|
||||
ldr r1, [r4, #0x64]
|
||||
mov r0, #0xc0
|
||||
mul r0, r1
|
||||
lsl r1, r1, #1
|
||||
add r1, r4, r1
|
||||
ldrh r1, [r1, r3]
|
||||
add r0, r4, r0
|
||||
lsl r1, r1, #1
|
||||
add r1, r0, r1
|
||||
ldr r0, _0224B1E8 ; =0x00002D4C
|
||||
ldrh r1, [r1, r0]
|
||||
add r0, r3, #0
|
||||
sub r0, #0x7c
|
||||
str r1, [r4, r0]
|
||||
add r0, r3, #0
|
||||
sub r0, #0x7c
|
||||
ldr r1, [r4, r0]
|
||||
add r0, r3, #0
|
||||
sub r0, #0x78
|
||||
str r1, [r4, r0]
|
||||
mov r0, #1
|
||||
str r0, [sp]
|
||||
mov r0, #0
|
||||
str r0, [sp, #4]
|
||||
sub r3, #0x7c
|
||||
ldr r3, [r4, r3]
|
||||
ldr r2, [r4, #0x64]
|
||||
lsl r3, r3, #0x10
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
lsr r3, r3, #0x10
|
||||
bl ov12_022506D4
|
||||
str r0, [r4, #0x6c]
|
||||
cmp r0, #0xff
|
||||
bne _0224B0E8
|
||||
ldr r2, [r4, #0x64]
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
bl ov12_02253DA0
|
||||
b _0224B0E8
|
||||
_0224B0E8:
|
||||
ldr r1, [r4, #0x64]
|
||||
add sp, #0x30
|
||||
lsl r1, r1, #4
|
||||
add r2, r4, r1
|
||||
ldr r1, _0224B1EC ; =0x000021AC
|
||||
str r0, [r2, r1]
|
||||
mov r0, #1
|
||||
lsl r0, r0, #8
|
||||
str r0, [r7]
|
||||
ldr r1, _0224B1F0 ; =0x00002184
|
||||
mov r0, #1
|
||||
ldr r2, [r4, r1]
|
||||
orr r0, r2
|
||||
str r0, [r4, r1]
|
||||
mov r0, #2
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224B108:
|
||||
ldr r0, [sp, #0x24]
|
||||
sub r0, r0, r6
|
||||
lsl r0, r0, #0x18
|
||||
lsr r6, r0, #0x18
|
||||
add r0, r5, #0
|
||||
bl BattleSystem_Random
|
||||
lsl r0, r0, #0x18
|
||||
lsr r0, r0, #0x18
|
||||
str r0, [sp, #0x18]
|
||||
cmp r0, r6
|
||||
bge _0224B160
|
||||
ldr r1, [r4, #0x64]
|
||||
mov r0, #0xc0
|
||||
mul r0, r1
|
||||
add r2, r4, r0
|
||||
ldr r0, _0224B1E0 ; =0x00002DAC
|
||||
ldr r0, [r2, r0]
|
||||
lsl r0, r0, #0x18
|
||||
lsr r0, r0, #0x18
|
||||
bne _0224B160
|
||||
add r0, r4, #0
|
||||
bl GetBattlerAbility
|
||||
cmp r0, #0x48
|
||||
beq _0224B160
|
||||
ldr r1, [r4, #0x64]
|
||||
add r0, r4, #0
|
||||
bl GetBattlerAbility
|
||||
cmp r0, #0xf
|
||||
beq _0224B160
|
||||
mov r1, #6
|
||||
lsl r1, r1, #6
|
||||
mov r0, #0xf
|
||||
ldr r2, [r4, r1]
|
||||
lsl r0, r0, #8
|
||||
tst r0, r2
|
||||
bne _0224B160
|
||||
sub r1, #0x7f
|
||||
add sp, #0x30
|
||||
str r1, [r7]
|
||||
mov r0, #1
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224B160:
|
||||
ldr r0, [sp, #0x18]
|
||||
sub r0, r0, r6
|
||||
cmp r0, r6
|
||||
bge _0224B1C6
|
||||
ldr r1, [r4, #0x64]
|
||||
mov r0, #0x46
|
||||
str r1, [r4, #0x6c]
|
||||
lsl r0, r0, #2
|
||||
str r1, [r4, r0]
|
||||
ldr r1, [r4, #0x64]
|
||||
mov r3, #0
|
||||
str r3, [sp]
|
||||
mov r0, #0x28
|
||||
str r0, [sp, #4]
|
||||
lsl r0, r1, #0x18
|
||||
str r3, [sp, #8]
|
||||
lsr r0, r0, #0x18
|
||||
str r0, [sp, #0xc]
|
||||
str r0, [sp, #0x10]
|
||||
mov r2, #1
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
str r2, [sp, #0x14]
|
||||
bl CalcMoveDamage
|
||||
ldr r2, _0224B1F4 ; =0x0000215C
|
||||
add r1, r4, #0
|
||||
str r0, [r4, r2]
|
||||
ldr r2, [r4, r2]
|
||||
add r0, r5, #0
|
||||
bl ApplyDamageRange
|
||||
ldr r1, _0224B1F4 ; =0x0000215C
|
||||
add sp, #0x30
|
||||
str r0, [r4, r1]
|
||||
mov r0, #0
|
||||
ldr r2, [r4, r1]
|
||||
mvn r0, r0
|
||||
mul r0, r2
|
||||
str r0, [r4, r1]
|
||||
ldr r0, _0224B1F8 ; =0x00000102
|
||||
str r0, [r7]
|
||||
add r0, r1, #0
|
||||
sub r0, #0x20
|
||||
ldr r2, [r4, r0]
|
||||
mov r0, #2
|
||||
orr r0, r2
|
||||
sub r1, #0x20
|
||||
str r0, [r4, r1]
|
||||
mov r0, #3
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_0224B1C6:
|
||||
mov r0, #0xff
|
||||
str r0, [r7]
|
||||
mov r0, #1
|
||||
add sp, #0x30
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
_0224B1D0: .word 0x00003044
|
||||
_0224B1D4: .word 0x0000213C
|
||||
_0224B1D8: .word 0x00002D74
|
||||
_0224B1DC: .word 0xFF7FFFFF
|
||||
_0224B1E0: .word 0x00002DAC
|
||||
_0224B1E4: .word 0x000030BC
|
||||
_0224B1E8: .word 0x00002D4C
|
||||
_0224B1EC: .word 0x000021AC
|
||||
_0224B1F0: .word 0x00002184
|
||||
_0224B1F4: .word 0x0000215C
|
||||
_0224B1F8: .word 0x00000102
|
||||
thumb_func_end ov12_0224AED0
|
||||
|
||||
thumb_func_start ov12_0224B1FC
|
||||
ov12_0224B1FC: ; 0x0224B1FC
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
@ -2789,7 +2338,7 @@ _0224C3D6:
|
||||
add r0, r5, #0
|
||||
add r1, r4, #0
|
||||
add r2, sp, #0
|
||||
bl ov12_0224AED0
|
||||
bl TryDisobedience
|
||||
cmp r0, #0
|
||||
beq _0224C41C
|
||||
cmp r0, #1
|
||||
@ -7141,11 +6690,11 @@ sPlayerBattleCommands: ; 0x0226CA90
|
||||
.word BattleControllerPlayer_ItemInput
|
||||
.word BattleControllerPlayer_PokemonInput
|
||||
.word BattleControllerPlayer_RunInput
|
||||
.word BattleControllerPlayer_SafariBallInput
|
||||
.word BattleControllerPlayer_SafariThrowBall
|
||||
.word BattleControllerPlayer_SafariThrowMud
|
||||
.word BattleControllerPlayer_SafariRun
|
||||
.word ov12_0224AE64
|
||||
.word ov12_0224AE84
|
||||
.word BattleControllerPlayer_SafariWatching
|
||||
.word BattleControllerPlayer_CatchingContestThrowBall
|
||||
.word ov12_0224C370
|
||||
.word ov12_0224C38C
|
||||
.word ov12_0224C4D8
|
||||
|
@ -26,9 +26,12 @@ void BattleControllerPlayer_FightInput(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_ItemInput(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_PokemonInput(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_RunInput(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_SafariBallInput(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_SafariThrowBall(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_SafariThrowMud(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_SafariRun(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_SafariWatching(BattleSystem *bsys, BattleContext *ctx);
|
||||
void BattleControllerPlayer_CatchingContestThrowBall(BattleSystem *bsys, BattleContext *ctx);
|
||||
u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script);
|
||||
|
||||
//The following functions haven't been decompiled yet
|
||||
void ov12_0224E384(BattleSystem *bsys, BattleContext *ctx);
|
||||
|
@ -54,7 +54,7 @@ void PlayerProfile_SetTrainerGender(PlayerProfile* profile, int gender);
|
||||
u32 PlayerProfile_GetTrainerGender(PlayerProfile* profile);
|
||||
BOOL PlayerProfile_TestBadgeFlag(PlayerProfile* profile, s32 badge_no);
|
||||
void PlayerProfile_SetBadgeFlag(PlayerProfile* profile, s32 badge_no);
|
||||
u32 PlayerProfile_CountBadges(PlayerProfile* profile);
|
||||
s32 PlayerProfile_CountBadges(PlayerProfile* profile);
|
||||
u32 PlayerProfile_GetMoney(PlayerProfile* profile);
|
||||
u32 PlayerProfile_SetMoney(PlayerProfile* profile, u32 amount);
|
||||
u8 PlayerProfile_GetAvatar(PlayerProfile* profile);
|
||||
|
@ -1690,7 +1690,7 @@ void BattleControllerPlayer_RunInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
}
|
||||
|
||||
//static
|
||||
void BattleControllerPlayer_SafariBallInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
void BattleControllerPlayer_SafariThrowBall(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int cnt;
|
||||
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 275);
|
||||
@ -1738,3 +1738,164 @@ void BattleControllerPlayer_SafariRun(BattleSystem *bsys, BattleContext *ctx) {
|
||||
ctx->safariRunAttempts++;
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void BattleControllerPlayer_SafariWatching(BattleSystem *bsys, BattleContext *ctx) {
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 229);
|
||||
ctx->battlerIdAttacker = 0;
|
||||
ctx->battlerIdTarget = 1;
|
||||
ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT;
|
||||
ctx->commandNext = CONTROLLER_COMMAND_40;
|
||||
}
|
||||
|
||||
//static
|
||||
void BattleControllerPlayer_CatchingContestThrowBall(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int cnt;
|
||||
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 11);
|
||||
ctx->battlerIdAttacker = BATTLER_PLAYER;
|
||||
ctx->battlerIdTarget = BATTLER_ENEMY;
|
||||
ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT;
|
||||
ctx->commandNext = CONTROLLER_COMMAND_40;
|
||||
ctx->itemTemp = ITEM_SPORT_BALL;
|
||||
cnt = BattleSystem_GetSafariBallCount(bsys) - 1;
|
||||
BattleSystem_SetSafariBallCount(bsys, cnt);
|
||||
ctx->moveStatusFlag |= 1 << 0x1F;
|
||||
}
|
||||
|
||||
//static
|
||||
u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
int rnd, struggleRnd;
|
||||
u32 battleType;
|
||||
u8 level;
|
||||
PlayerProfile *profile;
|
||||
|
||||
battleType = BattleSystem_GetBattleType(bsys);
|
||||
profile = BattleSystem_GetPlayerProfile(bsys, 0);
|
||||
|
||||
if (battleType & (BATTLE_TYPE_LINK | BATTLE_TYPE_TOWER)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (BattleSystem_GetFieldSide(bsys, ctx->battlerIdAttacker)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((battleType & BATTLE_TYPE_6) && ov12_0223AB0C(bsys, ctx->battlerIdAttacker) == 4) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ov12_02256854(bsys, ctx) == TRUE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!Battler_CanSelectAction(ctx, ctx->battlerIdAttacker)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ctx->moveNoCur == MOVE_BIDE && (ctx->battleStatus & BATTLE_STATUS_CHARGE_MOVE_HIT)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PlayerProfile_CountBadges(profile) >= 8) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
level = 10;
|
||||
|
||||
if (PlayerProfile_CountBadges(profile) >= 1) {
|
||||
level = 20;
|
||||
}
|
||||
|
||||
if (PlayerProfile_CountBadges(profile) >= 2) {
|
||||
level = 30;
|
||||
}
|
||||
|
||||
if (PlayerProfile_TestBadgeFlag(profile, 3)) {
|
||||
level = 50;
|
||||
}
|
||||
|
||||
if (PlayerProfile_TestBadgeFlag(profile, 5)) {
|
||||
level = 70;
|
||||
}
|
||||
|
||||
if (ctx->battleMons[ctx->battlerIdAttacker].level <= level) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
rnd = ((BattleSystem_Random(bsys) & 0xff) * (ctx->battleMons[ctx->battlerIdAttacker].level + level)) >> 8;
|
||||
|
||||
if (rnd < level) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ctx->moveNoCur == MOVE_RAGE) {
|
||||
ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_23;
|
||||
}
|
||||
|
||||
if (ctx->battleMons[ctx->battlerIdAttacker].status & STATUS_SLEEP && (ctx->moveNoCur == MOVE_SNORE || ctx->moveNoCur == MOVE_SLEEP_TALK)) {
|
||||
*script = 254;
|
||||
return 1;
|
||||
}
|
||||
|
||||
rnd = ((BattleSystem_Random(bsys) & 0xff) * (ctx->battleMons[ctx->battlerIdAttacker].level + level)) >> 8;
|
||||
|
||||
//use a random (useable) move
|
||||
if (rnd < level) {
|
||||
rnd = StruggleCheck(bsys, ctx, ctx->battlerIdAttacker, MaskOfFlagNo(ctx->movePos[ctx->battlerIdAttacker]), -1);
|
||||
|
||||
if (rnd == 0xF) {
|
||||
*script = 255;
|
||||
return 1;
|
||||
}
|
||||
do {
|
||||
struggleRnd = BattleSystem_Random(bsys) & 3;
|
||||
} while (MaskOfFlagNo(struggleRnd) & rnd);
|
||||
|
||||
ctx->movePos[ctx->battlerIdAttacker] = struggleRnd;
|
||||
ctx->moveNoTemp = ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->movePos[ctx->battlerIdAttacker]];
|
||||
ctx->moveNoCur = ctx->moveNoTemp;
|
||||
ctx->battlerIdTarget = ov12_022506D4(bsys, ctx, ctx->battlerIdAttacker, ctx->moveNoTemp, 1, 0);
|
||||
|
||||
if (ctx->battlerIdTarget == BATTLER_NONE) {
|
||||
ctx->unk_21A8[ctx->battlerIdAttacker][1] = ov12_02253DA0(bsys, ctx, ctx->battlerIdAttacker);
|
||||
} else {
|
||||
ctx->unk_21A8[ctx->battlerIdAttacker][1] = ctx->battlerIdTarget;
|
||||
}
|
||||
|
||||
*script = 256;
|
||||
ctx->unk_2184 |= 1;
|
||||
|
||||
return 2; // ???
|
||||
}
|
||||
|
||||
level = ctx->battleMons[ctx->battlerIdAttacker].level - level;
|
||||
rnd = BattleSystem_Random(bsys) & 0xFF;
|
||||
|
||||
//take a nap
|
||||
if (rnd < level && !(ctx->battleMons[ctx->battlerIdAttacker].status & STATUS_ALL) &&
|
||||
GetBattlerAbility(ctx, ctx->battlerIdAttacker) != ABILITY_VITAL_SPIRIT &&
|
||||
GetBattlerAbility(ctx, ctx->battlerIdAttacker) != ABILITY_INSOMNIA &&
|
||||
!(ctx->fieldCondition & (0xF << 8))) {
|
||||
*script = 257;
|
||||
return 1;
|
||||
}
|
||||
|
||||
rnd -= level;
|
||||
|
||||
//hitting itself
|
||||
if (rnd < level) {
|
||||
ctx->battlerIdTarget = ctx->battlerIdAttacker;
|
||||
ctx->battlerIdTemp = ctx->battlerIdTarget;
|
||||
ctx->hpCalc = CalcMoveDamage(bsys, ctx, MOVE_POUND, 0, 0, 40, 0, ctx->battlerIdAttacker, ctx->battlerIdAttacker, 1);
|
||||
ctx->hpCalc = ApplyDamageRange(bsys, ctx, ctx->hpCalc);
|
||||
ctx->hpCalc *= -1;
|
||||
*script = 258;
|
||||
ctx->battleStatus |= 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
*script = 255;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void PlayerProfile_SetBadgeFlag(PlayerProfile* profile, s32 badge_no) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 PlayerProfile_CountBadges(PlayerProfile* profile) {
|
||||
s32 PlayerProfile_CountBadges(PlayerProfile* profile) {
|
||||
u32 badges = 0;
|
||||
|
||||
for (u32 i = profile->johtoBadges; i != 0; i >>= 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user