Merge pull request #96 from AnonymousRandomPerson/master

Attack AI decomp
This commit is contained in:
Seth Barberee
2022-02-17 21:45:57 -08:00
committed by GitHub
54 changed files with 21607 additions and 22272 deletions

View File

@@ -2501,7 +2501,7 @@ _080414A0:
_080414A4:
adds r0, r4, 0
adds r1, r5, 0
bl sub_80570AC
bl MoveMatchesChargingStatus
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24

View File

@@ -4,7 +4,7 @@
.syntax unified
.text
thumb_func_start CanSee_2
CanSee_2:
push {r4,r5,lr}
@@ -566,7 +566,7 @@ _08045DF4:
_08045E08:
adds r0, r7, 0
movs r1, 0x1
bl ShouldAvoidEnemies_2
bl ShouldAvoidEnemiesAndShowEffect
lsls r0, 24
cmp r0, 0
beq _08045E40

View File

@@ -2505,7 +2505,7 @@ _080537B0: .4byte gUnknown_80FCD28
_080537B4:
adds r0, r7, 0
mov r1, r8
bl GetMoveType_2
bl GetMoveTypeForPokemon
lsls r0, 24
lsrs r0, 24
cmp r0, 0x5
@@ -2599,7 +2599,7 @@ _08053874:
adds r0, r7, 0
mov r1, r8
movs r2, 0
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
movs r1, 0xF0
ands r1, r0
cmp r1, 0
@@ -2831,7 +2831,7 @@ _08053A4C:
movs r4, 0
adds r0, r7, 0
mov r1, r8
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
cmp r0, 0
bne _08053A7E
@@ -2897,7 +2897,7 @@ _08053AE8:
adds r0, r7, 0
mov r1, r8
movs r2, 0
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
lsls r0, 16
asrs r1, r0, 16
ldr r0, _08053C88
@@ -2958,7 +2958,7 @@ _08053B5C:
adds r0, r7, 0
mov r1, r8
movs r2, 0
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
lsls r0, 16
movs r1, 0xF0
lsls r1, 12
@@ -3310,7 +3310,7 @@ _08053E4A:
adds r0, r7, 0
mov r1, r8
movs r2, 0
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
movs r1, 0xF
ands r1, r0
cmp r1, 0
@@ -5857,7 +5857,7 @@ sub_8055640:
mov r9, r3
ldr r7, [sp, 0x44]
adds r1, r5, 0
bl GetMoveType_2
bl GetMoveTypeForPokemon
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
@@ -6114,7 +6114,7 @@ sub_8055864:
adds r5, r2, 0
adds r6, r3, 0
adds r1, r5, 0
bl GetMoveType_2
bl GetMoveTypeForPokemon
adds r2, r0, 0
lsls r2, 24
lsrs r2, 24
@@ -6521,7 +6521,7 @@ _08055B74:
adds r0, r5, 0
adds r1, r6, 0
str r2, [sp, 0x30]
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
lsrs r4, r0, 24
ldrb r0, [r6, 0x4]
@@ -7112,7 +7112,7 @@ _08056068:
adds r0, r5, 0
adds r1, r7, 0
movs r2, 0x1
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
movs r4, 0xF0
adds r1, r4, 0
ands r1, r0
@@ -7124,7 +7124,7 @@ _08056084:
adds r0, r5, 0
adds r1, r7, 0
movs r2, 0x1
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
adds r1, r4, 0
ands r1, r0
cmp r1, 0x80
@@ -7148,7 +7148,7 @@ _080560AE:
beq _080560CC
adds r0, r5, 0
adds r1, r7, 0
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
cmp r0, 0
bne _080560CC
@@ -7165,7 +7165,7 @@ _080560CC:
bl sub_80928C0
adds r0, r5, 0
adds r1, r7, 0
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
cmp r0, 0
beq _08056124
@@ -8038,7 +8038,7 @@ _080567EC:
beq _08056820
mov r0, r10
ldr r1, [sp, 0x1C]
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
cmp r0, 0
bne _08056820
@@ -8349,7 +8349,7 @@ _08056A66:
mov r0, r10
ldr r1, [sp, 0x1C]
movs r2, 0
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
adds r2, r0, 0
lsls r2, 16
asrs r2, 16
@@ -8731,7 +8731,7 @@ _08056D44:
adds r0, r5, 0
mov r1, r8
movs r2, 0
bl GetTargetingFlags
bl GetMoveTargetingFlagsForPokemon
lsls r0, 16
asrs r7, r0, 16
movs r0, 0xF
@@ -8740,7 +8740,7 @@ _08056D44:
bne _08056D86
adds r0, r5, 0
mov r1, r8
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
lsrs r4, r0, 24
mov r2, r8
@@ -9186,49 +9186,4 @@ _080570A6:
bx r1
thumb_func_end sub_8057088
thumb_func_start sub_80570AC
sub_80570AC:
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
bne _080570C2
b _080570E8
_080570BE:
movs r0, 0x1
b _080570EA
_080570C2:
ldr r0, [r4, 0x70]
movs r3, 0
ldr r2, _080570F0
adds r4, r0, 0
adds r4, 0xC0
_080570CC:
ldrh r1, [r2]
cmp r1, 0
beq _080570E8
ldrh r0, [r5, 0x2]
cmp r0, r1
bne _080570E0
ldrb r0, [r4]
ldrb r1, [r2, 0x2]
cmp r0, r1
beq _080570BE
_080570E0:
adds r2, 0x4
adds r3, 0x1
cmp r3, 0x63
ble _080570CC
_080570E8:
movs r0, 0
_080570EA:
pop {r4,r5}
pop {r1}
bx r1
.align 2, 0
_080570F0: .4byte gChargeMovesToStatuses
thumb_func_end sub_80570AC
.align 2, 0
.align 2, 0

View File

@@ -392,7 +392,7 @@ IsMoveUsable_2:
cmp r1, 0x5
bne _08057414
adds r0, r4, 0
bl GetMoveDealsDirectDamage
bl MoveDealsDirectDamage
lsls r0, 24
cmp r0, 0
beq _0805743E
@@ -460,7 +460,7 @@ sub_805744C:
cmp r1, 0x5
bne _0805748E
adds r0, r4, 0
bl GetMoveDealsDirectDamage
bl MoveDealsDirectDamage
lsls r0, 24
cmp r0, 0
beq _080574B6
@@ -932,7 +932,7 @@ _080577C8: .4byte gUnknown_80FD14C
_080577CC:
adds r0, r4, 0
adds r1, r6, 0
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
cmp r0, 0
beq _080577F8

File diff suppressed because it is too large Load Diff

6209
asm/code_8069E0C.s Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -153,7 +153,7 @@ _080702B0:
beq _08070312
adds r0, r7, 0
adds r1, r4, 0
bl sub_80570AC
bl MoveMatchesChargingStatus
lsls r0, 24
cmp r0, 0
beq _08070312

View File

@@ -1,37 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start HasType
HasType:
push {lr}
lsls r1, 24
lsrs r1, 24
adds r3, r1, 0
ldr r0, [r0, 0x70]
adds r2, r0, 0
cmp r1, 0
beq _0807187A
adds r0, 0x5C
ldrb r0, [r0]
cmp r0, r1
beq _0807187E
adds r0, r2, 0
adds r0, 0x5D
ldrb r0, [r0]
cmp r0, r3
beq _0807187E
_0807187A:
movs r0, 0
b _08071880
_0807187E:
movs r0, 0x1
_08071880:
pop {r1}
bx r1
thumb_func_end HasType
.align 2, 0

View File

@@ -105,7 +105,7 @@ _08073D80:
_08073D98:
adds r0, r6, 0
movs r1, 0x1
bl ShouldAvoidEnemies_2
bl ShouldAvoidEnemiesAndShowEffect
lsls r0, 24
cmp r0, 0
beq _08073DC8

File diff suppressed because it is too large Load Diff

742
asm/code_807C4A0.s Normal file
View File

@@ -0,0 +1,742 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start IsTargetInLineRange
IsTargetInLineRange:
push {r4-r7,lr}
adds r4, r0, 0
adds r5, r1, 0
movs r0, 0x4
ldrsh r1, [r4, r0]
movs r3, 0x4
ldrsh r0, [r5, r3]
subs r3, r1, r0
cmp r3, 0
bge _0807C4B6
negs r3, r3
_0807C4B6:
movs r6, 0x6
ldrsh r1, [r4, r6]
movs r7, 0x6
ldrsh r0, [r5, r7]
subs r1, r0
cmp r1, 0
bge _0807C4C6
negs r1, r1
_0807C4C6:
adds r0, r1, 0
cmp r1, r3
bge _0807C4CE
adds r0, r3, 0
_0807C4CE:
cmp r0, 0xA
bgt _0807C578
cmp r0, r2
bgt _0807C578
movs r6, 0x1
negs r6, r6
cmp r3, r1
bne _0807C516
movs r0, 0x4
ldrsh r1, [r4, r0]
movs r2, 0x4
ldrsh r0, [r5, r2]
ldrh r2, [r4, 0x4]
ldrh r3, [r5, 0x4]
cmp r1, r0
bge _0807C4FE
movs r6, 0x6
ldrsh r1, [r4, r6]
movs r7, 0x6
ldrsh r0, [r5, r7]
cmp r1, r0
blt _0807C574
cmp r1, r0
bgt _0807C574
_0807C4FE:
lsls r1, r2, 16
lsls r0, r3, 16
movs r6, 0x7
cmp r1, r0
ble _0807C570
movs r0, 0x6
ldrsh r1, [r4, r0]
movs r2, 0x6
ldrsh r0, [r5, r2]
cmp r1, r0
ble _0807C570
b _0807C574
_0807C516:
movs r3, 0x4
ldrsh r1, [r4, r3]
movs r7, 0x4
ldrsh r0, [r5, r7]
ldrh r2, [r4, 0x4]
ldrh r3, [r5, 0x4]
cmp r1, r0
bne _0807C532
movs r0, 0x6
ldrsh r1, [r4, r0]
movs r7, 0x6
ldrsh r0, [r5, r7]
cmp r1, r0
blt _0807C574
_0807C532:
lsls r1, r2, 16
lsls r0, r3, 16
cmp r1, r0
bge _0807C546
movs r0, 0x6
ldrsh r1, [r4, r0]
movs r7, 0x6
ldrsh r0, [r5, r7]
cmp r1, r0
beq _0807C574
_0807C546:
lsls r1, r2, 16
lsls r0, r3, 16
cmp r1, r0
bne _0807C55A
movs r0, 0x6
ldrsh r1, [r4, r0]
movs r7, 0x6
ldrsh r0, [r5, r7]
cmp r1, r0
bgt _0807C574
_0807C55A:
lsls r1, r2, 16
lsls r0, r3, 16
cmp r1, r0
ble _0807C570
movs r0, 0x6
ldrsh r1, [r4, r0]
movs r2, 0x6
ldrsh r0, [r5, r2]
cmp r1, r0
bne _0807C570
movs r6, 0x6
_0807C570:
cmp r6, 0
blt _0807C578
_0807C574:
movs r0, 0x1
b _0807C57A
_0807C578:
movs r0, 0
_0807C57A:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end IsTargetInLineRange
thumb_func_start WeightMoveIfUsable
WeightMoveIfUsable:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
adds r6, r0, 0
adds r5, r2, 0
adds r7, r3, 0
ldr r0, [sp, 0x28]
lsls r1, 16
asrs r1, 16
mov r9, r1
lsls r0, 24
lsrs r0, 24
mov r10, r0
ldr r2, [r5, 0x70]
ldr r1, [r5, 0x4]
ldr r0, [r7, 0x4]
cmp r1, r0
beq _0807C5BC
movs r0, 0xF0
mov r1, r9
ands r0, r1
cmp r0, 0x30
beq _0807C5BC
cmp r0, 0x60
beq _0807C5BC
cmp r0, 0x70
bne _0807C5C4
_0807C5BC:
adds r0, r2, 0
adds r0, 0x46
ldrb r4, [r0]
b _0807C5CE
_0807C5C4:
adds r0, r5, 0x4
adds r1, r7, 0x4
bl CalculateFacingDir
adds r4, r0, 0
_0807C5CE:
ldr r0, _0807C638
adds r0, r4
mov r8, r0
ldrb r0, [r0]
cmp r0, 0
bne _0807C624
mov r0, r10
str r0, [sp]
mov r0, r9
adds r1, r5, 0
adds r2, r7, 0
ldr r3, [sp, 0x24]
bl CanUseStatusMove
lsls r0, 24
cmp r0, 0
beq _0807C624
movs r0, 0x1
mov r1, r8
strb r0, [r1]
ldr r0, _0807C63C
adds r0, r6, r0
strb r4, [r0]
adds r0, r5, 0
ldr r1, [sp, 0x24]
bl GetMoveTypeForPokemon
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
adds r0, r5, 0
mov r1, r9
adds r2, r7, 0
bl WeightMove
ldr r1, _0807C640
lsls r2, r6, 2
adds r1, r2, r1
str r0, [r1]
ldr r0, _0807C644
adds r2, r0
str r7, [r2]
adds r6, 0x1
_0807C624:
adds r0, r6, 0
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.align 2, 0
_0807C638: .4byte gCanAttackInDirection
_0807C63C: .4byte gPotentialAttackTargetDirections
_0807C640: .4byte gPotentialTargetWeights_2
_0807C644: .4byte gPotentialTargets
thumb_func_end WeightMoveIfUsable
thumb_func_start CanUseStatusMove
CanUseStatusMove:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
adds r5, r1, 0
adds r4, r2, 0
mov r8, r3
ldr r1, [sp, 0x1C]
lsls r0, 16
asrs r6, r0, 16
lsls r1, 24
lsrs r1, 24
mov r9, r1
movs r7, 0
movs r0, 0xF
ands r0, r6
adds r1, r0, 0
cmp r1, 0
bne _0807C686
adds r0, r5, 0
adds r1, r4, 0
movs r2, 0
movs r3, 0x1
bl CanTarget
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _0807C6E0
movs r7, 0x1
b _0807C6E4
_0807C686:
cmp r1, 0x1
beq _0807C6BE
cmp r1, 0x2
bne _0807C692
ldr r1, [r4, 0x70]
b _0807C69C
_0807C692:
cmp r1, 0x5
bne _0807C6B6
ldr r1, [r4, 0x70]
cmp r5, r4
beq _0807C6B2
_0807C69C:
movs r7, 0x1
ldrb r0, [r1, 0x8]
cmp r0, 0x1
beq _0807C6B2
adds r0, r1, 0
adds r0, 0xA4
ldrb r0, [r0]
cmp r0, 0x4
beq _0807C6B2
cmp r0, 0x1
bne _0807C6E0
_0807C6B2:
movs r0, 0
b _0807C7A0
_0807C6B6:
cmp r1, 0x6
bne _0807C6D4
cmp r5, r4
beq _0807C6B2
_0807C6BE:
adds r0, r5, 0
adds r1, r4, 0
movs r2, 0
movs r3, 0x1
bl CanTarget
lsls r0, 24
cmp r0, 0
bne _0807C6E0
movs r7, 0x1
b _0807C6E4
_0807C6D4:
subs r0, 0x3
lsls r0, 16
lsrs r0, 16
cmp r0, 0x1
bhi _0807C6E0
movs r7, 0x1
_0807C6E0:
cmp r7, 0
beq _0807C79E
_0807C6E4:
mov r0, r9
cmp r0, 0
beq _0807C77C
adds r0, r5, 0
adds r1, r4, 0
mov r2, r8
bl CanUseWithStatusChecker_2
lsls r0, 24
cmp r0, 0
beq _0807C6B2
movs r1, 0xF0
lsls r1, 4
ands r1, r6
movs r0, 0x80
lsls r0, 1
cmp r1, r0
beq _0807C78A
movs r0, 0x80
lsls r0, 2
cmp r1, r0
beq _0807C76E
movs r0, 0xC0
lsls r0, 2
cmp r1, r0
bne _0807C720
adds r0, r4, 0
bl HasNegativeStatus
b _0807C774
_0807C720:
movs r0, 0x80
lsls r0, 3
cmp r1, r0
bne _0807C730
adds r0, r4, 0
bl IsSleeping
b _0807C774
_0807C730:
movs r0, 0xC0
lsls r0, 3
cmp r1, r0
bne _0807C75A
ldr r1, [r4, 0x70]
adds r0, r1, 0
adds r0, 0x5C
ldrb r0, [r0]
cmp r0, 0xE
beq _0807C74E
adds r0, r1, 0
adds r0, 0x5D
ldrb r0, [r0]
cmp r0, 0xE
bne _0807C6B2
_0807C74E:
adds r0, r1, 0
adds r0, 0xF5
ldrb r0, [r0]
cmp r0, 0
beq _0807C79E
b _0807C6B2
_0807C75A:
movs r0, 0xA0
lsls r0, 3
cmp r1, r0
bne _0807C79E
adds r0, r4, 0
bl HasNegativeStatus
lsls r0, 24
cmp r0, 0
bne _0807C79E
_0807C76E:
adds r0, r4, 0
bl HasQuarterHPOrLess
_0807C774:
lsls r0, 24
cmp r0, 0
bne _0807C79E
b _0807C6B2
_0807C77C:
movs r0, 0xF0
lsls r0, 4
ands r0, r6
movs r1, 0x80
lsls r1, 1
cmp r0, r1
bne _0807C79E
_0807C78A:
mov r0, r8
movs r1, 0x2
bl GetMoveAccuracy
adds r4, r0, 0
movs r0, 0x64
bl DungeonRandomCapped
cmp r0, r4
bge _0807C6B2
_0807C79E:
adds r0, r7, 0
_0807C7A0:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end CanUseStatusMove
thumb_func_start WeightMove
WeightMove:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
adds r5, r0, 0
mov r8, r2
lsls r1, 16
asrs r1, 16
lsls r3, 24
lsrs r3, 24
mov r9, r3
movs r6, 0x1
ldr r4, [r2, 0x70]
adds r7, r4, 0
ldrb r0, [r4, 0x6]
cmp r0, 0
beq _0807C7D6
movs r0, 0xF
ands r0, r1
cmp r0, 0
beq _0807C7DA
_0807C7D6:
movs r0, 0x1
b _0807C848
_0807C7DA:
adds r0, r5, 0
movs r1, 0x9
bl HasIQSkill
lsls r0, 24
cmp r0, 0
beq _0807C804
ldr r0, _0807C7FC
ldr r0, [r0]
movs r2, 0x2
ldrsh r1, [r4, r2]
ldr r2, _0807C800
adds r0, r2
adds r0, r1
ldrb r6, [r0]
b _0807C846
.align 2, 0
_0807C7FC: .4byte gDungeonGlobalData
_0807C800: .4byte 0x0000363c
_0807C804:
adds r0, r5, 0
movs r1, 0xA
bl HasIQSkill
lsls r0, 24
cmp r0, 0
beq _0807C828
ldrb r1, [r7, 0xE]
movs r2, 0xC
negs r2, r2
adds r0, r2, 0
subs r0, r1
lsls r0, 24
lsrs r6, r0, 24
cmp r6, 0
bne _0807C846
movs r6, 0x1
b _0807C846
_0807C828:
adds r0, r5, 0
movs r1, 0xB
bl HasIQSkill
lsls r0, 24
cmp r0, 0
beq _0807C846
adds r0, r5, 0
mov r1, r8
mov r2, r9
bl WeightWeakTypePicker
adds r0, 0x1
lsls r0, 24
lsrs r6, r0, 24
_0807C846:
adds r0, r6, 0
_0807C848:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end WeightMove
thumb_func_start TargetRegularAttack
TargetRegularAttack:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x50
adds r7, r0, 0
str r1, [sp, 0x40]
lsls r2, 24
lsrs r2, 24
str r2, [sp, 0x44]
ldr r0, [r7, 0x70]
movs r1, 0
mov r8, r1
adds r1, r0, 0
adds r1, 0x46
ldrb r6, [r1]
adds r0, 0xE8
ldrb r0, [r0]
movs r3, 0x8
mov r10, r3
cmp r0, 0x1
bne _0807C886
movs r0, 0x1
mov r10, r0
_0807C886:
movs r4, 0
adds r0, r7, 0
movs r1, 0x9
bl HasIQSkill
lsls r0, 24
cmp r0, 0
bne _0807C8A4
adds r0, r7, 0
movs r1, 0xA
bl HasIQSkill
lsls r0, 24
cmp r0, 0
beq _0807C8A6
_0807C8A4:
movs r4, 0x1
_0807C8A6:
str r4, [sp, 0x48]
adds r0, r7, 0
movs r1, 0x8
bl HasIQSkill
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x4C]
movs r1, 0
mov r9, r1
cmp r9, r10
bge _0807C952
_0807C8BE:
movs r0, 0x7
ands r6, r0
movs r3, 0x4
ldrsh r0, [r7, r3]
ldr r1, _0807C95C
lsls r2, r6, 2
adds r2, r1
movs r3, 0
ldrsh r1, [r2, r3]
adds r0, r1
movs r3, 0x6
ldrsh r1, [r7, r3]
movs r3, 0x2
ldrsh r2, [r2, r3]
adds r1, r2
bl GetMapTileAtPosition
ldr r5, [r0, 0x10]
cmp r5, 0
beq _0807C948
adds r0, r5, 0
bl GetEntityType
cmp r0, 0x1
bne _0807C948
adds r0, r7, 0
adds r1, r6, 0
bl CanAttackInFront
lsls r0, 24
cmp r0, 0
beq _0807C948
adds r0, r7, 0
adds r1, r5, 0
movs r2, 0
ldr r3, [sp, 0x44]
bl CanTarget
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _0807C948
ldr r0, [sp, 0x4C]
cmp r0, 0
beq _0807C922
ldr r0, [r5, 0x70]
adds r0, 0xB0
ldrb r0, [r0]
cmp r0, 0x1
beq _0807C948
_0807C922:
mov r1, r8
lsls r4, r1, 2
mov r3, sp
adds r0, r3, r4
str r6, [r0]
adds r0, r7, 0
movs r1, 0
adds r2, r5, 0
movs r3, 0
bl WeightMove
add r1, sp, 0x20
adds r1, r4
str r0, [r1]
ldr r0, [sp, 0x48]
cmp r0, 0
beq _0807C960
movs r1, 0x1
add r8, r1
_0807C948:
movs r3, 0x1
add r9, r3
adds r6, 0x1
cmp r9, r10
blt _0807C8BE
_0807C952:
mov r0, r8
cmp r0, 0
bne _0807C966
movs r0, 0
b _0807C9E8
.align 2, 0
_0807C95C: .4byte gAdjacentTileOffsets
_0807C960:
ldr r1, [sp, 0x40]
str r6, [r1]
b _0807C9E6
_0807C966:
movs r4, 0
movs r3, 0
mov r0, r8
cmp r0, 0
ble _0807C984
add r1, sp, 0x20
mov r2, r8
_0807C974:
ldr r0, [r1]
cmp r3, r0
bge _0807C97C
adds r3, r0, 0
_0807C97C:
adds r1, 0x4
subs r2, 0x1
cmp r2, 0
bne _0807C974
_0807C984:
mov r1, r8
cmp r1, 0
ble _0807C9A0
movs r5, 0
add r1, sp, 0x20
mov r2, r8
_0807C990:
ldr r0, [r1]
cmp r3, r0
beq _0807C998
str r5, [r1]
_0807C998:
adds r1, 0x4
subs r2, 0x1
cmp r2, 0
bne _0807C990
_0807C9A0:
mov r3, r8
cmp r3, 0
ble _0807C9B4
add r1, sp, 0x20
mov r2, r8
_0807C9AA:
ldm r1!, {r0}
adds r4, r0
subs r2, 0x1
cmp r2, 0
bne _0807C9AA
_0807C9B4:
adds r0, r4, 0
bl DungeonRandomCapped
adds r1, r0, 0
movs r2, 0
cmp r2, r8
bge _0807C9DC
ldr r0, [sp, 0x20]
subs r1, r0
cmp r1, 0
blt _0807C9DC
add r3, sp, 0x20
_0807C9CC:
adds r3, 0x4
adds r2, 0x1
cmp r2, r8
bge _0807C9DC
ldr r0, [r3]
subs r1, r0
cmp r1, 0
bge _0807C9CC
_0807C9DC:
lsls r0, r2, 2
add r0, sp
ldr r0, [r0]
ldr r1, [sp, 0x40]
str r0, [r1]
_0807C9E6:
movs r0, 0x1
_0807C9E8:
add sp, 0x50
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end TargetRegularAttack
.align 2, 0

File diff suppressed because it is too large Load Diff

12493
asm/code_807CD9C.s Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

272
data/data_80F4DB4.s Normal file
View File

@@ -0,0 +1,272 @@
.section .rodata
.global gUnknown_80F4DB4
gUnknown_80F4DB4: @ 80F4DB4
@ replacing .incbin "baserom.gba", 0x000f4db4, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4DB6
gUnknown_80F4DB6: @ 80F4DB6
@ replacing .incbin "baserom.gba", 0x000f4db6, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DB8
gUnknown_80F4DB8: @ 80F4DB8
@ replacing .incbin "baserom.gba", 0x000f4db8, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DBA
gUnknown_80F4DBA: @ 80F4DBA
@ replacing .incbin "baserom.gba", 0x000f4dba, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DBC
gUnknown_80F4DBC: @ 80F4DBC
@ replacing .incbin "baserom.gba", 0x000f4dbc, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DBE
gUnknown_80F4DBE: @ 80F4DBE
@ replacing .incbin "baserom.gba", 0x000f4dbe, 0x2
.byte 0x12, 0x00
.global gUnknown_80F4DC0
gUnknown_80F4DC0: @ 80F4DC0
@ replacing .incbin "baserom.gba", 0x000f4dc0, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DC2
gUnknown_80F4DC2: @ 80F4DC2
@ replacing .incbin "baserom.gba", 0x000f4dc2, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4DC4
gUnknown_80F4DC4: @ 80F4DC4
@ replacing .incbin "baserom.gba", 0x000f4dc4, 0x2
.byte 0x28, 0x00
.global gUnknown_80F4DC6
gUnknown_80F4DC6: @ 80F4DC6
@ replacing .incbin "baserom.gba", 0x000f4dc6, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DC8
gUnknown_80F4DC8: @ 80F4DC8
@ replacing .incbin "baserom.gba", 0x000f4dc8, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4DCA
gUnknown_80F4DCA: @ 80F4DCA
@ replacing .incbin "baserom.gba", 0x000f4dca, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4DCC
gUnknown_80F4DCC: @ 80F4DCC
@ replacing .incbin "baserom.gba", 0x000f4dcc, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4DCE
gUnknown_80F4DCE: @ 80F4DCE
@ replacing .incbin "baserom.gba", 0x000f4dce, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DD0
gUnknown_80F4DD0: @ 80F4DD0
@ replacing .incbin "baserom.gba", 0x000f4dd0, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4DD2
gUnknown_80F4DD2: @ 80F4DD2
@ replacing .incbin "baserom.gba", 0x000f4dd2, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DD4
gUnknown_80F4DD4: @ 80F4DD4
@ replacing .incbin "baserom.gba", 0x000f4dd4, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DD6
gUnknown_80F4DD6: @ 80F4DD6
@ replacing .incbin "baserom.gba", 0x000f4dd6, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DD8
gUnknown_80F4DD8: @ 80F4DD8
@ replacing .incbin "baserom.gba", 0x000f4dd8, 0x2
.byte 0x32, 0x00
.global gUnknown_80F4DDA
gUnknown_80F4DDA: @ 80F4DDA
@ replacing .incbin "baserom.gba", 0x000f4dda, 0x2
.byte 0x32, 0x00
.global gUnknown_80F4DDC
gUnknown_80F4DDC: @ 80F4DDC
@ replacing .incbin "baserom.gba", 0x000f4ddc, 0x4
.byte 0x32, 0x00
.byte 0x32, 0x00
.global gUnknown_80F4DE0
gUnknown_80F4DE0: @ 80F4DE0
@ replacing .incbin "baserom.gba", 0x000f4de0, 0x2
.byte 0x32, 0x00
.global gUnknown_80F4DE2
gUnknown_80F4DE2: @ 80F4DE2
@ replacing .incbin "baserom.gba", 0x000f4de2, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DE4
gUnknown_80F4DE4: @ 80F4DE4
@ replacing .incbin "baserom.gba", 0x000f4de4, 0x2
.byte 0x0f, 0x00
.global gUnknown_80F4DE6
gUnknown_80F4DE6: @ 80F4DE6
@ replacing .incbin "baserom.gba", 0x000f4de6, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4DE8
gUnknown_80F4DE8: @ 80F4DE8
@ replacing .incbin "baserom.gba", 0x000f4de8, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DEA
gUnknown_80F4DEA: @ 80F4DEA
@ replacing .incbin "baserom.gba", 0x000f4dea, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DEC
gUnknown_80F4DEC: @ 80F4DEC
@ replacing .incbin "baserom.gba", 0x000f4dec, 0x2
.byte 0x0f, 0x00
.global gUnknown_80F4DEE
gUnknown_80F4DEE: @ 80F4DEE
@ replacing .incbin "baserom.gba", 0x000f4dee, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4DF0
gUnknown_80F4DF0: @ 80F4DF0
@ replacing .incbin "baserom.gba", 0x000f4df0, 0x2
.byte 0x19, 0x00
.global gUnknown_80F4DF2
gUnknown_80F4DF2: @ 80F4DF2
@ replacing .incbin "baserom.gba", 0x000f4df2, 0x2
.byte 0x23, 0x00
.global gUnknown_80F4DF4
gUnknown_80F4DF4: @ 80F4DF4
@ replacing .incbin "baserom.gba", 0x000f4df4, 0x2
.byte 0x19, 0x00
.global gUnknown_80F4DF6
gUnknown_80F4DF6: @ 80F4DF6
@ replacing .incbin "baserom.gba", 0x000f4df6, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4DF8
gUnknown_80F4DF8: @ 80F4DF8
@ replacing .incbin "baserom.gba", 0x000f4df8, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4DFA
gUnknown_80F4DFA: @ 80F4DFA
@ replacing .incbin "baserom.gba", 0x000f4dfa, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4DFC
gUnknown_80F4DFC: @ 80F4DFC
@ replacing .incbin "baserom.gba", 0x000f4dfc, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4DFE
gUnknown_80F4DFE: @ 80F4DFE
@ replacing .incbin "baserom.gba", 0x000f4dfe, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4E00
gUnknown_80F4E00: @ 80F4E00
@ replacing .incbin "baserom.gba", 0x000f4e00, 0x2
.byte 0x28, 0x00
.global gUnknown_80F4E02
gUnknown_80F4E02: @ 80F4E02
@ replacing .incbin "baserom.gba", 0x000f4e02, 0x2
.byte 0x3c, 0x00
.global gUnknown_80F4E04
gUnknown_80F4E04: @ 80F4E04
@ replacing .incbin "baserom.gba", 0x000f4e04, 0x2
.byte 0x3c, 0x00
.global gUnknown_80F4E06
gUnknown_80F4E06: @ 80F4E06
@ replacing .incbin "baserom.gba", 0x000f4e06, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4E08
gUnknown_80F4E08: @ 80F4E08
@ replacing .incbin "baserom.gba", 0x000f4e08, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4E0A
gUnknown_80F4E0A: @ 80F4E0A
@ replacing .incbin "baserom.gba", 0x000f4e0a, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4E0C
gUnknown_80F4E0C: @ 80F4E0C
@ replacing .incbin "baserom.gba", 0x000f4e0c, 0x2
.byte 0x32, 0x00
.global gUnknown_80F4E0E
gUnknown_80F4E0E: @ 80F4E0E
@ replacing .incbin "baserom.gba", 0x000f4e0e, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4E10
gUnknown_80F4E10: @ 80F4E10
@ replacing .incbin "baserom.gba", 0x000f4e10, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E12
gUnknown_80F4E12: @ 80F4E12
@ replacing .incbin "baserom.gba", 0x000f4e12, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E14
gUnknown_80F4E14: @ 80F4E14
@ replacing .incbin "baserom.gba", 0x000f4e14, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E16
gUnknown_80F4E16: @ 80F4E16
@ replacing .incbin "baserom.gba", 0x000f4e16, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E18
gUnknown_80F4E18: @ 80F4E18
@ replacing .incbin "baserom.gba", 0x000f4e18, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E1A
gUnknown_80F4E1A: @ 80F4E1A
@ replacing .incbin "baserom.gba", 0x000f4e1a, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E1C
gUnknown_80F4E1C: @ 80F4E1C
@ replacing .incbin "baserom.gba", 0x000f4e1c, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E1E
gUnknown_80F4E1E: @ 80F4E1E
@ replacing .incbin "baserom.gba", 0x000f4e1e, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4E20
gUnknown_80F4E20: @ 80F4E20
@ replacing .incbin "baserom.gba", 0x000f4e20, 0x2
.byte 0x0c, 0x00

881
data/data_80F4E2C.s Normal file
View File

@@ -0,0 +1,881 @@
.section .rodata
.global gUnknown_80F4E2C
gUnknown_80F4E2C: @ 80F4E2C
@ replacing .incbin "baserom.gba", 0x000f4e2c, 0x4
.byte 0x03, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4E30
gUnknown_80F4E30: @ 80F4E30
@ replacing .incbin "baserom.gba", 0x000f4e30, 0x4
.byte 0x7f, 0x00
.byte 0x7f, 0x00
.global gUnknown_80F4E34
gUnknown_80F4E34: @ 80F4E34
@ replacing .incbin "baserom.gba", 0x000f4e34, 0x4
.byte 0x7f, 0x00
.byte 0x7f, 0x00
.global gUnknown_80F4E38
gUnknown_80F4E38: @ 80F4E38
@ replacing .incbin "baserom.gba", 0x000f4e38, 0x4
.byte 0x7f, 0x00
.byte 0x7f, 0x00
.global gUnknown_80F4E3C
gUnknown_80F4E3C: @ 80F4E3C
@ replacing .incbin "baserom.gba", 0x000f4e3c, 0x4
.byte 0x01, 0x00
.byte 0x01, 0x00
.global gUnknown_80F4E40
gUnknown_80F4E40: @ 80F4E40
@ replacing .incbin "baserom.gba", 0x000f4e40, 0x8
.byte 0x08, 0x00
.byte 0x0a, 0x00
.byte 0x03, 0x00
.byte 0x04, 0x00
.global gUnknown_80F4E48
gUnknown_80F4E48: @ 80F4E48
@ replacing .incbin "baserom.gba", 0x000f4e48, 0x4
.byte 0x06, 0x00
.byte 0x08, 0x00
.global gUnknown_80F4E4C
gUnknown_80F4E4C: @ 80F4E4C
@ replacing .incbin "baserom.gba", 0x000f4e4c, 0x4
.byte 0x06, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4E50
gUnknown_80F4E50: @ 80F4E50
@ replacing .incbin "baserom.gba", 0x000f4e50, 0x4
.byte 0x01, 0x00
.byte 0x02, 0x00
.global gUnknown_80F4E54
gUnknown_80F4E54: @ 80F4E54
@ replacing .incbin "baserom.gba", 0x000f4e54, 0x4
.byte 0x02, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4E58
gUnknown_80F4E58: @ 80F4E58
@ replacing .incbin "baserom.gba", 0x000f4e58, 0x4
.byte 0x03, 0x00
.byte 0x06, 0x00
.global gUnknown_80F4E5C
gUnknown_80F4E5C: @ 80F4E5C
@ replacing .incbin "baserom.gba", 0x000f4e5c, 0x4
.byte 0x02, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4E60
gUnknown_80F4E60: @ 80F4E60
@ replacing .incbin "baserom.gba", 0x000f4e60, 0x10
.byte 0x0f, 0x00
.byte 0x1e, 0x00
.byte 0x02, 0x00
.byte 0x03, 0x00
.byte 0x02, 0x00
.byte 0x06, 0x00
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4E70
gUnknown_80F4E70: @ 80F4E70
@ replacing .incbin "baserom.gba", 0x000f4e70, 0x4
.byte 0x01, 0x00
.byte 0x01, 0x00
.global gUnknown_80F4E74
gUnknown_80F4E74: @ 80F4E74
@ replacing .incbin "baserom.gba", 0x000f4e74, 0x4
.byte 0x03, 0x00
.byte 0x07, 0x00
.global gUnknown_80F4E78
gUnknown_80F4E78: @ 80F4E78
@ replacing .incbin "baserom.gba", 0x000f4e78, 0x4
.byte 0x04, 0x00
.byte 0x08, 0x00
.global gUnknown_80F4E7C
gUnknown_80F4E7C: @ 80F4E7C
@ replacing .incbin "baserom.gba", 0x000f4e7c, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4E80
gUnknown_80F4E80: @ 80F4E80
@ replacing .incbin "baserom.gba", 0x000f4e80, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4E84
gUnknown_80F4E84: @ 80F4E84
@ replacing .incbin "baserom.gba", 0x000f4e84, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4E88
gUnknown_80F4E88: @ 80F4E88
@ replacing .incbin "baserom.gba", 0x000f4e88, 0x4
.byte 0x0f, 0x00
.byte 0x14, 0x00
.global gUnknown_80F4E8C
gUnknown_80F4E8C: @ 80F4E8C
@ replacing .incbin "baserom.gba", 0x000f4e8c, 0x4
.byte 0x0a, 0x00
.byte 0x0e, 0x00
.global gUnknown_80F4E90
gUnknown_80F4E90: @ 80F4E90
@ replacing .incbin "baserom.gba", 0x000f4e90, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4E94
gUnknown_80F4E94: @ 80F4E94
@ replacing .incbin "baserom.gba", 0x000f4e94, 0x4
.byte 0x02, 0x00
.byte 0x04, 0x00
.global gUnknown_80F4E98
gUnknown_80F4E98: @ 80F4E98
@ replacing .incbin "baserom.gba", 0x000f4e98, 0x4
.byte 0x06, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4E9C
gUnknown_80F4E9C: @ 80F4E9C
@ replacing .incbin "baserom.gba", 0x000f4e9c, 0x4
.byte 0x03, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4EA0
gUnknown_80F4EA0: @ 80F4EA0
@ replacing .incbin "baserom.gba", 0x000f4ea0, 0x4
.byte 0x04, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4EA4
gUnknown_80F4EA4: @ 80F4EA4
@ replacing .incbin "baserom.gba", 0x000f4ea4, 0x4
.byte 0x03, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4EA8
gUnknown_80F4EA8: @ 80F4EA8
@ replacing .incbin "baserom.gba", 0x000f4ea8, 0x4
.byte 0x03, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4EAC
gUnknown_80F4EAC: @ 80F4EAC
@ replacing .incbin "baserom.gba", 0x000f4eac, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4EB0
gUnknown_80F4EB0: @ 80F4EB0
@ replacing .incbin "baserom.gba", 0x000f4eb0, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4EB4
gUnknown_80F4EB4: @ 80F4EB4
@ replacing .incbin "baserom.gba", 0x000f4eb4, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4EB8
gUnknown_80F4EB8: @ 80F4EB8
@ replacing .incbin "baserom.gba", 0x000f4eb8, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4EBC
gUnknown_80F4EBC: @ 80F4EBC
@ replacing .incbin "baserom.gba", 0x000f4ebc, 0x4
.byte 0x14, 0x00
.byte 0x1e, 0x00
.global gUnknown_80F4EC0
gUnknown_80F4EC0: @ 80F4EC0
@ replacing .incbin "baserom.gba", 0x000f4ec0, 0x4
.byte 0x7f, 0x00
.byte 0x7f, 0x00
.global gUnknown_80F4EC4
gUnknown_80F4EC4: @ 80F4EC4
@ replacing .incbin "baserom.gba", 0x000f4ec4, 0x4
.byte 0x02, 0x00
.byte 0x04, 0x00
.global gUnknown_80F4EC8
gUnknown_80F4EC8: @ 80F4EC8
@ replacing .incbin "baserom.gba", 0x000f4ec8, 0x4
.byte 0x02, 0x00
.byte 0x04, 0x00
.global gUnknown_80F4ECC
gUnknown_80F4ECC: @ 80F4ECC
@ replacing .incbin "baserom.gba", 0x000f4ecc, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4ED0
gUnknown_80F4ED0: @ 80F4ED0
@ replacing .incbin "baserom.gba", 0x000f4ed0, 0x4
.byte 0x14, 0x00
.byte 0x32, 0x00
.global gUnknown_80F4ED4
gUnknown_80F4ED4: @ 80F4ED4
@ replacing .incbin "baserom.gba", 0x000f4ed4, 0x4
.byte 0x02, 0x00
.byte 0x06, 0x00
.global gUnknown_80F4ED8
gUnknown_80F4ED8: @ 80F4ED8
@ replacing .incbin "baserom.gba", 0x000f4ed8, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4EDC
gUnknown_80F4EDC: @ 80F4EDC
@ replacing .incbin "baserom.gba", 0x000f4edc, 0x4
.byte 0x01, 0x00
.byte 0x06, 0x00
.global gUnknown_80F4EE0
gUnknown_80F4EE0: @ 80F4EE0
@ replacing .incbin "baserom.gba", 0x000f4ee0, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4EE4
gUnknown_80F4EE4: @ 80F4EE4
@ replacing .incbin "baserom.gba", 0x000f4ee4, 0x4
.byte 0x0a, 0x00
.byte 0x14, 0x00
.global gUnknown_80F4EE8
gUnknown_80F4EE8: @ 80F4EE8
@ replacing .incbin "baserom.gba", 0x000f4ee8, 0x4
.byte 0x0a, 0x00
.byte 0x0c, 0x00
.global gUnknown_80F4EEC
gUnknown_80F4EEC: @ 80F4EEC
@ replacing .incbin "baserom.gba", 0x000f4eec, 0x4
.byte 0x03, 0x00
.byte 0x03, 0x00
.global gUnknown_80F4EF0
gUnknown_80F4EF0: @ 80F4EF0
@ replacing .incbin "baserom.gba", 0x000f4ef0, 0x4
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4EF4
gUnknown_80F4EF4: @ 80F4EF4
@ replacing .incbin "baserom.gba", 0x000f4ef4, 0x4
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4EF8
gUnknown_80F4EF8: @ 80F4EF8
@ replacing .incbin "baserom.gba", 0x000f4ef8, 0x4
.byte 0x03, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4EFC
gUnknown_80F4EFC: @ 80F4EFC
@ replacing .incbin "baserom.gba", 0x000f4efc, 0x4
.byte 0x7f, 0x00
.byte 0x7f, 0x00
.global gUnknown_80F4F00
gUnknown_80F4F00: @ 80F4F00
@ replacing .incbin "baserom.gba", 0x000f4f00, 0x4
.byte 0x04, 0x00
.byte 0x06, 0x00
.global gUnknown_80F4F04
gUnknown_80F4F04: @ 80F4F04
@ replacing .incbin "baserom.gba", 0x000f4f04, 0x4
.byte 0x7f, 0x00
.byte 0x7f, 0x00
.global gUnknown_80F4F08
gUnknown_80F4F08: @ 80F4F08
@ replacing .incbin "baserom.gba", 0x000f4f08, 0x4
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4F0C
gUnknown_80F4F0C: @ 80F4F0C
@ replacing .incbin "baserom.gba", 0x000f4f0c, 0x4
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4F10
gUnknown_80F4F10: @ 80F4F10
@ replacing .incbin "baserom.gba", 0x000f4f10, 0x8
.byte 0x7f, 0x00
.byte 0x7f, 0x00
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4F18
gUnknown_80F4F18: @ 80F4F18
@ replacing .incbin "baserom.gba", 0x000f4f18, 0x4
.byte 0x02, 0x00
.byte 0x05, 0x00
.global gUnknown_80F4F1C
gUnknown_80F4F1C: @ 80F4F1C
@ replacing .incbin "baserom.gba", 0x000f4f1c, 0x4
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4F20
gUnknown_80F4F20: @ 80F4F20
@ replacing .incbin "baserom.gba", 0x000f4f20, 0x4
.byte 0x0a, 0x00
.byte 0x0a, 0x00
.global gUnknown_80F4F24
gUnknown_80F4F24: @ 80F4F24
@ replacing .incbin "baserom.gba", 0x000f4f24, 0x4
.byte 0x0f, 0x00
.byte 0x14, 0x00
.global gUnknown_80F4F28
gUnknown_80F4F28: @ 80F4F28
@ replacing .incbin "baserom.gba", 0x000f4f28, 0x4
.byte 0x02, 0x00
.byte 0x02, 0x00
.global gUnknown_80F4F2C
gUnknown_80F4F2C: @ 80F4F2C
@ replacing .incbin "baserom.gba", 0x000f4f2c, 0x4
.byte 0x04, 0x00
.byte 0x08, 0x00
.global gUnknown_80F4F30
gUnknown_80F4F30: @ 80F4F30
@ replacing .incbin "baserom.gba", 0x000f4f30, 0x2
.byte 0xfa, 0x00
.global gUnknown_80F4F32
gUnknown_80F4F32: @ 80F4F32
@ replacing .incbin "baserom.gba", 0x000f4f32, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4F34
gUnknown_80F4F34: @ 80F4F34
@ replacing .incbin "baserom.gba", 0x000f4f34, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4F36
gUnknown_80F4F36: @ 80F4F36
@ replacing .incbin "baserom.gba", 0x000f4f36, 0x2
.byte 0x02, 0x00
.global gUnknown_80F4F38
gUnknown_80F4F38: @ 80F4F38
@ replacing .incbin "baserom.gba", 0x000f4f38, 0x2
.byte 0x02, 0x00
.global gUnknown_80F4F3A
gUnknown_80F4F3A: @ 80F4F3A
@ replacing .incbin "baserom.gba", 0x000f4f3a, 0x2
.byte 0x02, 0x00
.global gUnknown_80F4F3C
gUnknown_80F4F3C: @ 80F4F3C
@ replacing .incbin "baserom.gba", 0x000f4f3c, 0x2
.byte 0x05, 0x00
.global gUnknown_80F4F3E
gUnknown_80F4F3E: @ 80F4F3E
@ replacing .incbin "baserom.gba", 0x000f4f3e, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4F40
gUnknown_80F4F40: @ 80F4F40
@ replacing .incbin "baserom.gba", 0x000f4f40, 0x2
.byte 0x02, 0x00
.global gUnknown_80F4F42
gUnknown_80F4F42: @ 80F4F42
@ replacing .incbin "baserom.gba", 0x000f4f42, 0x4
.byte 0x14, 0x00
.byte 0x5f, 0x00
.global gUnknown_80F4F46
gUnknown_80F4F46: @ 80F4F46
@ replacing .incbin "baserom.gba", 0x000f4f46, 0x2
.byte 0x0c, 0x00
.global gUnknown_80F4F48
gUnknown_80F4F48: @ 80F4F48
@ replacing .incbin "baserom.gba", 0x000f4f48, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F4C
gUnknown_80F4F4C: @ 80F4F4C
@ replacing .incbin "baserom.gba", 0x000f4f4c, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F50
gUnknown_80F4F50: @ 80F4F50
@ replacing .incbin "baserom.gba", 0x000f4f50, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F54
gUnknown_80F4F54: @ 80F4F54
@ replacing .incbin "baserom.gba", 0x000f4f54, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F58
gUnknown_80F4F58: @ 80F4F58
@ replacing .incbin "baserom.gba", 0x000f4f58, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F5C
gUnknown_80F4F5C: @ 80F4F5C
@ replacing .incbin "baserom.gba", 0x000f4f5c, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F60
gUnknown_80F4F60: @ 80F4F60
@ replacing .incbin "baserom.gba", 0x000f4f60, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F64
gUnknown_80F4F64: @ 80F4F64
@ replacing .incbin "baserom.gba", 0x000f4f64, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F68
gUnknown_80F4F68: @ 80F4F68
@ replacing .incbin "baserom.gba", 0x000f4f68, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F6C
gUnknown_80F4F6C: @ 80F4F6C
@ replacing .incbin "baserom.gba", 0x000f4f6c, 0x4
.byte 0x00, 0x02
.byte 0x00, 0x00
.global gUnknown_80F4F70
gUnknown_80F4F70: @ 80F4F70
@ replacing .incbin "baserom.gba", 0x000f4f70, 0x2
.byte 0x05, 0x00
.global gUnknown_80F4F72
gUnknown_80F4F72: @ 80F4F72
@ replacing .incbin "baserom.gba", 0x000f4f72, 0x2
.byte 0x04, 0x00
.global gUnknown_80F4F74
gUnknown_80F4F74: @ 80F4F74
@ replacing .incbin "baserom.gba", 0x000f4f74, 0x2
.byte 0x05, 0x00
.global gUnknown_80F4F76
gUnknown_80F4F76: @ 80F4F76
@ replacing .incbin "baserom.gba", 0x000f4f76, 0x2
.byte 0x06, 0x00
.global gUnknown_80F4F78
gUnknown_80F4F78: @ 80F4F78
@ replacing .incbin "baserom.gba", 0x000f4f78, 0x2
.byte 0x08, 0x00
.global gUnknown_80F4F7A
gUnknown_80F4F7A: @ 80F4F7A
@ replacing .incbin "baserom.gba", 0x000f4f7a, 0x2
.byte 0xe7, 0x03
.global gUnknown_80F4F7C
gUnknown_80F4F7C: @ 80F4F7C
@ replacing .incbin "baserom.gba", 0x000f4f7c, 0x2
.byte 0x37, 0x00
.global gUnknown_80F4F7E
gUnknown_80F4F7E: @ 80F4F7E
@ replacing .incbin "baserom.gba", 0x000f4f7e, 0x2
.byte 0x41, 0x00
.global gUnknown_80F4F80
gUnknown_80F4F80: @ 80F4F80
@ replacing .incbin "baserom.gba", 0x000f4f80, 0x2
.byte 0x23, 0x00
.global gUnknown_80F4F82
gUnknown_80F4F82: @ 80F4F82
@ replacing .incbin "baserom.gba", 0x000f4f82, 0x2
.byte 0x05, 0x00
.global gUnknown_80F4F84
gUnknown_80F4F84: @ 80F4F84
@ replacing .incbin "baserom.gba", 0x000f4f84, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4F86
gUnknown_80F4F86: @ 80F4F86
@ replacing .incbin "baserom.gba", 0x000f4f86, 0x4
.byte 0x0a, 0x00
.byte 0x0f, 0x00
.global gUnknown_80F4F8A
gUnknown_80F4F8A: @ 80F4F8A
@ replacing .incbin "baserom.gba", 0x000f4f8a, 0x2
.byte 0x05, 0x00
.global gUnknown_80F4F8C
gUnknown_80F4F8C: @ 80F4F8C
@ replacing .incbin "baserom.gba", 0x000f4f8c, 0x2
.byte 0x23, 0x00
.global gUnknown_80F4F8E
gUnknown_80F4F8E: @ 80F4F8E
@ replacing .incbin "baserom.gba", 0x000f4f8e, 0x2
.byte 0x05, 0x00
.global gUnknown_80F4F90
gUnknown_80F4F90: @ 80F4F90
@ replacing .incbin "baserom.gba", 0x000f4f90, 0x2
.byte 0x05, 0x00
.global gUnknown_80F4F92
gUnknown_80F4F92: @ 80F4F92
@ replacing .incbin "baserom.gba", 0x000f4f92, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4F94
gUnknown_80F4F94: @ 80F4F94
@ replacing .incbin "baserom.gba", 0x000f4f94, 0xe
.byte 0x05, 0x00
.byte 0x0a, 0x00
.byte 0x0f, 0x00
.byte 0x19, 0x00
.byte 0x1e, 0x00
.byte 0x23, 0x00
.byte 0x28, 0x00
.global gUnknown_80F4FA2
gUnknown_80F4FA2: @ 80F4FA2
@ replacing .incbin "baserom.gba", 0x000f4fa2, 0x2
.byte 0x5a, 0x00
.global gUnknown_80F4FA4
gUnknown_80F4FA4: @ 80F4FA4
@ replacing .incbin "baserom.gba", 0x000f4fa4, 0x2
.byte 0x14, 0x00
.global gUnknown_80F4FA6
gUnknown_80F4FA6: @ 80F4FA6
@ replacing .incbin "baserom.gba", 0x000f4fa6, 0x2
.byte 0x2d, 0x00
.global gUnknown_80F4FA8
gUnknown_80F4FA8: @ 80F4FA8
@ replacing .incbin "baserom.gba", 0x000f4fa8, 0x2
.byte 0x0f, 0x00
.global gUnknown_80F4FAA
gUnknown_80F4FAA: @ 80F4FAA
@ replacing .incbin "baserom.gba", 0x000f4faa, 0x2
.byte 0x1e, 0x00
.global gUnknown_80F4FAC
gUnknown_80F4FAC: @ 80F4FAC
@ replacing .incbin "baserom.gba", 0x000f4fac, 0x2
.byte 0x01, 0x00
.global gUnknown_80F4FAE
gUnknown_80F4FAE: @ 80F4FAE
@ replacing .incbin "baserom.gba", 0x000f4fae, 0x4
.byte 0x02, 0x00
.byte 0x19, 0x00
.global gUnknown_80F4FB2
gUnknown_80F4FB2: @ 80F4FB2
@ replacing .incbin "baserom.gba", 0x000f4fb2, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4FB4
gUnknown_80F4FB4: @ 80F4FB4
@ replacing .incbin "baserom.gba", 0x000f4fb4, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4FB6
gUnknown_80F4FB6: @ 80F4FB6
@ replacing .incbin "baserom.gba", 0x000f4fb6, 0x2
.byte 0x64, 0x00
.global gUnknown_80F4FB8
gUnknown_80F4FB8: @ 80F4FB8
@ replacing .incbin "baserom.gba", 0x000f4fb8, 0x2
.byte 0x00, 0x00
.global gUnknown_80F4FBA
gUnknown_80F4FBA: @ 80F4FBA
@ replacing .incbin "baserom.gba", 0x000f4fba, 0x2
.byte 0x64, 0x00
.global gUnknown_80F4FBC
gUnknown_80F4FBC: @ 80F4FBC
@ replacing .incbin "baserom.gba", 0x000f4fbc, 0x2
.byte 0x02, 0x00
.global gUnknown_80F4FBE
gUnknown_80F4FBE: @ 80F4FBE
@ replacing .incbin "baserom.gba", 0x000f4fbe, 0x2
.byte 0x03, 0x00
.global gUnknown_80F4FC0
gUnknown_80F4FC0: @ 80F4FC0
@ replacing .incbin "baserom.gba", 0x000f4fc0, 0x2
.byte 0x24, 0xff
.global gUnknown_80F4FC2
gUnknown_80F4FC2: @ 80F4FC2
@ replacing .incbin "baserom.gba", 0x000f4fc2, 0x2
.byte 0x6a, 0xff
.global gUnknown_80F4FC4
gUnknown_80F4FC4: @ 80F4FC4
@ replacing .incbin "baserom.gba", 0x000f4fc4, 0x2
.byte 0x9c, 0xff
.global gUnknown_80F4FC6
gUnknown_80F4FC6: @ 80F4FC6
@ replacing .incbin "baserom.gba", 0x000f4fc6, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F4FC8
gUnknown_80F4FC8: @ 80F4FC8
.incbin "baserom.gba", 0xF4FC8, 0x3C
.global gUnknown_80F5004
gUnknown_80F5004: @ 80F5004
@ replacing .incbin "baserom.gba", 0x000f5004, 0x2
.byte 0x03, 0x00
.global gUnknown_80F5006
gUnknown_80F5006: @ 80F5006
@ replacing .incbin "baserom.gba", 0x000f5006, 0x2
.byte 0x02, 0x00
.global gUnknown_80F5008
gUnknown_80F5008: @ 80F5008
@ replacing .incbin "baserom.gba", 0x000f5008, 0x2
.byte 0x64, 0x00
.global gUnknown_80F500A
gUnknown_80F500A: @ 80F500A
@ replacing .incbin "baserom.gba", 0x000f500a, 0x10
.byte 0x32, 0x00, 0x50, 0x00, 0x1e, 0x00, 0x28, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x01, 0x00
.global gUnknown_80F501A
gUnknown_80F501A: @ 80F501A
@ replacing .incbin "baserom.gba", 0x000f501a, 0x10
.byte 0x32, 0x00, 0x50, 0x00, 0x1e, 0x00, 0x28, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x01, 0x00
.global gUnknown_80F502A
gUnknown_80F502A: @ 80F502A
@ replacing .incbin "baserom.gba", 0x000f502a, 0x10
.byte 0x32, 0x00, 0x50, 0x00, 0x1e, 0x00, 0x28, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x01, 0x00
.global gUnknown_80F503A
gUnknown_80F503A: @ 80F503A
@ replacing .incbin "baserom.gba", 0x000f503a, 0x2
.byte 0x01, 0x00
.global gUnknown_80F503C
gUnknown_80F503C: @ 80F503C
@ replacing .incbin "baserom.gba", 0x000f503c, 0x2
.byte 0x05, 0x00
.global gUnknown_80F503E
gUnknown_80F503E: @ 80F503E
@ replacing .incbin "baserom.gba", 0x000f503e, 0x2
.byte 0x06, 0x00
.global gUnknown_80F5040
gUnknown_80F5040: @ 80F5040
@ replacing .incbin "baserom.gba", 0x000f5040, 0x2
.byte 0x07, 0x00
.global gUnknown_80F5042
gUnknown_80F5042: @ 80F5042
@ replacing .incbin "baserom.gba", 0x000f5042, 0x2
.byte 0x08, 0x00
.global gUnknown_80F5044
gUnknown_80F5044: @ 80F5044
@ replacing .incbin "baserom.gba", 0x000f5044, 0x2
.byte 0x09, 0x00
.global gUnknown_80F5046
gUnknown_80F5046: @ 80F5046
@ replacing .incbin "baserom.gba", 0x000f5046, 0x2
.byte 0x14, 0x00
.global gUnknown_80F5048
gUnknown_80F5048: @ 80F5048
@ replacing .incbin "baserom.gba", 0x000f5048, 0x4
.byte 0x0f, 0x00, 0x00, 0x00
.global gUnknown_80F504C
gUnknown_80F504C: @ 80F504C
.incbin "baserom.gba", 0xF504C, 0x54
.global gUnknown_80F50A0
gUnknown_80F50A0: @ 80F50A0
.incbin "baserom.gba", 0xF50A0, 0x54
.global gUnknown_80F50F4
gUnknown_80F50F4: @ 80F50F4
.incbin "baserom.gba", 0xF50F4, 0xA8
.global gUnknown_80F519C
gUnknown_80F519C: @ 80F519C
@ replacing .incbin "baserom.gba", 0x000f519c, 0x4
.byte 0x1e, 0x00, 0x00, 0x00
.global gUnknown_80F51A0
gUnknown_80F51A0: @ 80F51A0
@ replacing .incbin "baserom.gba", 0x000f51a0, 0x4
.byte 0x1e, 0x00, 0x00, 0x00
.global gUnknown_80F51A4
gUnknown_80F51A4: @ 80F51A4
@ replacing .incbin "baserom.gba", 0x000f51a4, 0x10
.byte 0x00, 0x08, 0x00, 0x00
.byte 0x00, 0x04, 0x00, 0x00
.byte 0x00, 0x02, 0x00, 0x00
.byte 0x00, 0x01, 0x00, 0x00
.global gUnknown_80F51B4
gUnknown_80F51B4: @ 80F51B4
@ replacing .incbin "baserom.gba", 0x000f51b4, 0x10
.byte 0x19, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00
.global gUnknown_80F51C4
gUnknown_80F51C4: @ 80F51C4
@ replacing .incbin "baserom.gba", 0x000f51c4, 0x10
.byte 0x19, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00
.global gUnknown_80F51D4
gUnknown_80F51D4: @ 80F51D4
@ replacing .incbin "baserom.gba", 0x000f51d4, 0x10
.byte 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00
.global gUnknown_80F51E4
gUnknown_80F51E4: @ 80F51E4
@ replacing .incbin "baserom.gba", 0x000f51e4, 0x8
.byte 0x01, 0x02, 0x0d, 0x01, 0x03, 0x06, 0x03, 0x06
.global gUnknown_80F51EC
gUnknown_80F51EC: @ 80F51EC
.incbin "baserom.gba", 0xF51EC, 0x20
.global gUnknown_80F520C
gUnknown_80F520C: @ 80F520C
.incbin "baserom.gba", 0xF520C, 0x20
.global gTypeEffectivenessChart
gTypeEffectivenessChart: @ 80F522C
.incbin "baserom.gba", 0xF522C, 0x288
.global gUnknown_80F54B4
gUnknown_80F54B4: @ 80F54B4
.incbin "baserom.gba", 0xF54B4, 0x40
.global gUnknown_80F54F4
gUnknown_80F54F4: @ 80F54F4
.incbin "baserom.gba", 0xF54F4, 0xA0
.global gWarpScarfActivationChances
gWarpScarfActivationChances: @ 80F5594
@ replacing .incbin "baserom.gba", 0xF5594, 0x28
.2byte 0, 6, 12, 30, 50, 70, 90, 110, 130, 150, 170, 190, 210, 230, 250, 270, 290, 310, 999, 0
.global gUnknown_80F55BC
gUnknown_80F55BC: @ 80F55BC
.incbin "baserom.gba", 0xF55BC, 0x30
.global gUnknown_80F55EC
gUnknown_80F55EC: @ 80F55EC
.incbin "baserom.gba", 0xF55EC, 0x30
.global gDungeonCamouflageTypes
gDungeonCamouflageTypes: @ 80F561C
.incbin "baserom.gba", 0xF561C, 0x4C
.global gDungeonMusic
gDungeonMusic: @ 80F5668
.incbin "baserom.gba", 0xF5668, 0x98
.global gUnknown_80F5700
gUnknown_80F5700: @ 80F5700
.incbin "baserom.gba", 0xF5700, 0xCA
.global gUnknown_80F57CA
gUnknown_80F57CA: @ 80F57CA
@ replacing .incbin "baserom.gba", 0x000f57ca, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F57CC
gUnknown_80F57CC: @ 80F57CC
@ replacing .incbin "baserom.gba", 0x000f57cc, 0x2
.byte 0x14, 0x00
.global gUnknown_80F57CE
gUnknown_80F57CE: @ 80F57CE
@ replacing .incbin "baserom.gba", 0x000f57ce, 0x2
.byte 0x14, 0x00
.global gUnknown_80F57D0
gUnknown_80F57D0: @ 80F57D0
@ replacing .incbin "baserom.gba", 0x000f57d0, 0x2
.byte 0x14, 0x00
.global gUnknown_80F57D2
gUnknown_80F57D2: @ 80F57D2
@ replacing .incbin "baserom.gba", 0x000f57d2, 0x2
.byte 0x0a, 0x00
.global gUnknown_80F57D4
gUnknown_80F57D4: @ 80F57D4
.incbin "baserom.gba", 0xF57D4, 0x120
.global gUnknown_80F58F4
gUnknown_80F58F4: @ 80F58F4
.incbin "baserom.gba", 0xF58F4, 0x84
.global gUnknown_80F5978
gUnknown_80F5978: @ 80F5978
.incbin "baserom.gba", 0xF5978, 0x4C

View File

@@ -6109,7 +6109,3 @@ gUnknown_81069BC: @ 81069BC
.global gUnknown_81069D4
gUnknown_81069D4: @ 81069D4
.incbin "baserom.gba", 0x1069D4, 0x20
.global gChargeMovesToStatuses
gChargeMovesToStatuses: @ 81069F4
.incbin "baserom.gba", 0x1069F4, 0x28

View File

@@ -3,7 +3,10 @@
#include "dungeon_entity.h"
// 0x570AC
bool8 MoveMatchesChargingStatus(struct DungeonEntity *pokemon, struct PokemonMove *move);
// 0x570F4
// checkCharge = Check for the move named Charge.
bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge);
#endif

View File

@@ -44,7 +44,7 @@ struct PokemonMove
u8 moveFlags;
bool8 sealed;
u16 moveID;
u8 pp;
u8 PP;
u8 powerBoost; // How much the move is boosted by Ginsengs.
};
@@ -52,17 +52,19 @@ enum TargetingFlag
{
TARGETING_FLAG_TARGET_OTHER = 0x0,
TARGETING_FLAG_HEAL_TEAM = 0x1,
TARGETING_FLAG_SWAP_POSITIONS = 0x2,
TARGETING_FLAG_LONG_RANGE = 0x2,
TARGETING_FLAG_BOOST_SELF = 0x3,
TARGETING_FLAG_MULTI_TURN = 0x4,
TARGETING_FLAG_ATTACK_ALL = 0x5,
TARGETING_FLAG_BOOST_TEAM = 0x6,
TARGETING_FLAG_DONT_USE = 0xF,
TARGETING_FLAG_ITEM = 0xF,
TARGETING_FLAG_TARGET_FRONTAL_CONE = 0x10,
TARGETING_FLAG_TARGET_AROUND = 0x20,
TARGETING_FLAG_TARGET_ROOM = 0x30,
TARGETING_FLAG_TARGET_2_TILES_AHEAD = 0x40,
TARGETING_FLAG_TARGET_LINE = 0x50,
TARGETING_FLAG_TARGET_FLOOR = 0x60,
TARGETING_FLAG_SELF_HEAL = 0x70,
TARGETING_FLAG_TARGET_SELF = 0x70,
TARGETING_FLAG_CUT_CORNERS = 0x80,
TARGETING_FLAG_SET_TRAP = 0x100,
TARGETING_FLAG_HEAL_HP = 0x200,

View File

@@ -5,5 +5,7 @@
// 0x71494
bool8 ShouldAvoidEnemies(struct DungeonEntity *pokemon);
// 0x71518
bool8 ShouldAvoidEnemiesAndShowEffect(struct DungeonEntity *pokemon, bool8 showRunAwayEffect);
#endif

View File

@@ -3,7 +3,16 @@
#include "dungeon_entity.h"
// 0x7C9F8
bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange);
struct MoveTargetResults
{
bool8 moveUsable;
u8 targetDir;
s32 moveWeight;
};
// 0x7BB94
void DecideAttack(struct DungeonEntity *pokemon);
// 0x7C04C
s32 FindMoveTarget(struct MoveTargetResults *moveTargetResults, struct DungeonEntity *pokemon, struct PokemonMove *move);
#endif

View File

@@ -0,0 +1,9 @@
#ifndef GUARD_DUNGEON_AI_ATTACK_1_H
#define GUARD_DUNGEON_AI_ATTACK_1_H
#include "dungeon_entity.h"
// 0x7C9F8
bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange);
#endif

View File

@@ -7,6 +7,8 @@
bool8 CannotUseItems(struct DungeonEntity *pokemon);
// 0x70CD0
bool8 CannotAct(struct DungeonEntity *pokemon);
// 0x70d04
bool8 CannotAttack(struct DungeonEntity *pokemon, bool8 skipSleep);
// 0x70D6C
bool8 CanMoveInDirection(struct DungeonEntity *pokemon, u32 facingDir);

View File

@@ -5,5 +5,21 @@
// 0x71824
bool8 HasAbility(struct DungeonEntity *pokemon, u8 ability);
// 0x71858
bool8 HasType(struct DungeonEntity *pokemon, u8 type);
// 0x71884
bool8 CanSeeInvisible(struct DungeonEntity *pokemon);
// 0x718AC
bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic);
// 0x718D8
bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill);
void LoadIQSkills(struct DungeonEntity *pokemon);
bool8 CanSeeTeammate(struct DungeonEntity * pokemon);
u8 GetMoveTypeForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove);
// 0x71A44
s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove);
bool8 ToolboxEnabled(struct DungeonEntityData *pokemon);
#endif

View File

@@ -1,21 +0,0 @@
#ifndef GUARD_DUNGEON_POKEMON_ATTRIBUTES_1_H
#define GUARD_DUNGEON_POKEMON_ATTRIBUTES_1_H
#include "dungeon_entity.h"
// 0x71884
bool8 CanSeeInvisible(struct DungeonEntity *pokemon);
// 0x718AC
bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic);
// 0x718D8
bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill);
void LoadIQSkills(struct DungeonEntity *pokemon);
bool8 CanSeeTeammate(struct DungeonEntity * pokemon);
u8 GetMoveType_2(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove);
// 0x71A44
s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove);
bool8 ToolboxEnabled(struct DungeonEntityData *pokemon);
#endif

View File

@@ -38,7 +38,7 @@ struct MapTile
u8 unk8;
/* 0x9 */ u8 roomIndex;
// Bitwise flags for whether Pokémon can move to an adjacent tile. Bits correspond to directions in direction.h.
// Different sets of flags are used for Pokémon that can cross special terrain, corresponding to Cthe rossableTerrain enum.
// Different sets of flags are used for Pokémon that can cross special terrain, corresponding to the CrossableTerrain enum.
/* 0xA */ u8 canMoveAdjacent[NUM_CROSSABLE_TERRAIN];
u8 fillE[0x10 - 0xE];
/* 0x10 */ struct DungeonEntity *pokemon; // Pokémon on the tile.

View File

@@ -3,6 +3,17 @@
#include "constants/move.h"
// 0x92A88
void InitPokemonMove(struct PokemonMove *move, u16 moveID);
// 0x92AE0
s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 isAI);
u8 GetMoveType(struct PokemonMove *move);
// 0x92B90
u8 GetMoveWeight(struct PokemonMove *move);
s32 GetMovePower(struct PokemonMove *move);
// 0x92BF4
u32 GetMoveMaxPP(struct PokemonMove *move);
// 0x92C54
bool8 MoveDealsDirectDamage(struct PokemonMove *move);
#endif

View File

@@ -1,6 +1,8 @@
#ifndef GUARD_POKEMON_3_H
#define GUARD_POKEMON_3_H
bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex);
void SetIQSkill(u8 *param_1, u32 skillIndex);
bool8 IsIQSkillSet(u8 *IQSkillsEnabled, u32 IQSkill);
#endif

View File

@@ -3,6 +3,8 @@
#include "dungeon_entity.h"
extern const s16 gConfusedAttackChance;
// 0x7001C
bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon);

9
include/targeting.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef GUARD_TARGETING_H
#define GUARD_TARGETING_H
#include "dungeon_entity.h"
// 0x69DCC
void TargetTileInFront(struct DungeonEntity *pokemon);
#endif

10
include/targeting_flags.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef GUARD_TARGETING_FLAGS_H
#define GUARD_TARGETING_FLAGS_H
#include "constants/move.h"
#include "dungeon_entity.h"
// 0x7CD64
s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, u32 isAI);
#endif

View File

@@ -207,6 +207,8 @@ SECTIONS {
asm/code_8057144.o(.text);
src/code_8057824.o(.text);
asm/code_8057824.o(.text);
src/targeting.o(.text);
asm/code_8069E0C.o(.text);
src/code_806CD90.o(.text);
asm/code_806CD90.o(.text);
src/status_checks.o(.text);
@@ -224,15 +226,17 @@ SECTIONS {
src/dungeon_ai_1.o(.text);
asm/code_807167C.o(.text);
src/dungeon_pokemon_attributes.o(.text);
asm/code_8071858.o(.text);
src/dungeon_pokemon_attributes_1.o(.text);
asm/code_80718D8.o(.text);
src/dungeon_ai_items.o(.text);
asm/code_8073CF0.o(.text);
src/dungeon_ai_movement.o(.text);
asm/code_8075BA4.o(.text);
src/dungeon_ai_attack.o(.text);
asm/code_807C4A0.o(.text);
src/dungeon_ai_attack_1.o(.text);
asm/code_807CABC.o(.text);
src/targeting_flags.o(.text);
asm/code_807CD9C.o(.text);
src/dungeon_range.o(.text);
asm/code_808333C.o(.text);
src/dungeon_random.o(.text);
@@ -400,7 +404,11 @@ SECTIONS {
data/data_80F4278.o(.rodata);
src/dungeon_util.o(.rodata);
data/data_80F4468.o(.rodata);
src/dungeon_pokemon_attributes_1.o(.rodata);
src/status_checks.o(.rodata);
data/data_80F4DB4.o(.rodata);
src/dungeon_ai_attack.o(.rodata);
data/data_80F4E2C.o(.rodata);
src/dungeon_pokemon_attributes.o(.rodata);
data/data_80F59C8.o(.rodata);
src/charge_move.o(.rodata);
data/data_8106A4C.o(.rodata);

View File

@@ -1,9 +1,29 @@
#include "global.h"
#include "charge_move.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "dungeon_util.h"
struct MultiTurnChargeMove
{
u16 moveID;
u8 chargingStatus;
};
const struct MultiTurnChargeMove gMultiTurnChargeMoves[10] = {
{MOVE_SOLARBEAM, CHARGING_STATUS_SOLARBEAM},
{MOVE_SKY_ATTACK, CHARGING_STATUS_SKY_ATTACK},
{MOVE_RAZOR_WIND, CHARGING_STATUS_RAZOR_WIND},
{MOVE_FOCUS_PUNCH, CHARGING_STATUS_FOCUS_PUNCH},
{MOVE_SKULL_BASH, CHARGING_STATUS_SKULL_BASH},
{MOVE_FLY, CHARGING_STATUS_FLY},
{MOVE_BOUNCE, CHARGING_STATUS_BOUNCE},
{MOVE_DIVE, CHARGING_STATUS_DIVE},
{MOVE_DIG, CHARGING_STATUS_DIG},
{MOVE_NONE, CHARGING_STATUS_NONE}
};
const u32 gMultiTurnChargingStatuses[10] = {
CHARGING_STATUS_SOLARBEAM,
CHARGING_STATUS_SKY_ATTACK,
@@ -19,6 +39,32 @@ const u32 gMultiTurnChargingStatuses[10] = {
ALIGNED(4) const char chargingStatusFill[] = "pksdir0";
bool8 MoveMatchesChargingStatus(struct DungeonEntity *pokemon, struct PokemonMove *move)
{
if (!EntityExists(pokemon))
{
return FALSE;
}
else
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
s32 i;
for (i = 0; i < 100; i++)
{
if (gMultiTurnChargeMoves[i].moveID == MOVE_NONE)
{
return FALSE;
}
if (move->moveID == gMultiTurnChargeMoves[i].moveID &&
pokemonData->chargingStatus == gMultiTurnChargeMoves[i].chargingStatus)
{
return TRUE;
}
}
return FALSE;
}
}
bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge)
{
if (!EntityExists(pokemon))
@@ -53,4 +99,4 @@ bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge)
}
return FALSE;
}
}
}

View File

@@ -1,7 +1,9 @@
#include "global.h"
#include "constants/direction.h"
#include "constants/type.h"
#include "dungeon_entity.h"
#include "dungeon_global_data.h"
#include "constants/direction.h"
#include "dungeon_pokemon_attributes.h"
struct unkStruct_80420E8
{
@@ -16,7 +18,6 @@ extern void sub_804151C(struct DungeonEntity *r0, u32 r1, u8 r2);
extern void sub_80416E0(struct DungeonEntity *r0, u32, u32);
extern u8 sub_8042768(struct DungeonEntity *r0);
extern void sub_806CDD4(struct DungeonEntity *r0, u8, u32);
extern u8 HasType(struct DungeonEntity *r0, u8);
extern u32 sub_806F62C(u32);
extern void PlaySoundEffect(u32);
extern u8 sub_803F428(struct DungeonEntity *r0);
@@ -343,10 +344,10 @@ void sub_8041DD8(struct DungeonEntity *r0, s16 r1)
u32 temp;
temp = r1;
if(HasType(r0, 0xE) != 0)
if(HasType(r0, TYPE_GHOST) != 0)
sub_804151C(r0, temp, 1);
else
sub_804151C(r0, 0xE, 1);
sub_804151C(r0, TYPE_GHOST, 1);
}
void nullsub_89(void)

View File

@@ -2,6 +2,7 @@
#include "dungeon_global_data.h"
#include "dungeon_entity.h"
#include "constants/move.h"
#include "moves.h"
extern u32 gUnknown_80FCF74;
extern u32 gUnknown_80FCF80;
@@ -30,7 +31,6 @@ extern void sub_806F370(struct DungeonEntity *r0, struct DungeonEntity *r1, u32,
extern u32 gUnknown_80FD018;
extern s16 sub_8057600(void*, u32);
extern u32 GetMoveType(void*);
bool32 sub_8057824(struct DungeonEntity *param_1, struct DungeonEntity *param_2)
{

View File

@@ -4,16 +4,15 @@
#include "constants/ability.h"
#include "constants/tactic.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_util.h"
extern void CheckRunAwayVisualFlag(struct DungeonEntity *, u8 r1);
extern void CheckRunAwayVisualFlag(struct DungeonEntity *, bool8 showRunAwayEffect);
bool8 ShouldAvoidFirstHit(struct DungeonEntity *pokemon, bool8 forceAvoid)
{
if(!HasTactic(pokemon, TACTIC_AVOID_THE_FIRST_HIT))
if (!HasTactic(pokemon, TACTIC_AVOID_THE_FIRST_HIT))
return FALSE;
if(!forceAvoid)
if (!forceAvoid)
return FALSE;
return TRUE;
}
@@ -43,8 +42,8 @@ bool8 ShouldAvoidEnemies(struct DungeonEntity *pokemon)
return TRUE;
}
}
if (HasTactic(pokemon, TACTIC_GET_AWAY)
|| (HasTactic(pokemon, TACTIC_AVOID_TROUBLE) && pokemonData->HP <= pokemonData->maxHP / 2))
if (HasTactic(pokemon, TACTIC_GET_AWAY) ||
(HasTactic(pokemon, TACTIC_AVOID_TROUBLE) && pokemonData->HP <= pokemonData->maxHP / 2))
{
return TRUE;
}
@@ -52,11 +51,11 @@ bool8 ShouldAvoidEnemies(struct DungeonEntity *pokemon)
}
}
bool8 ShouldAvoidEnemies_2(struct DungeonEntity *pokemon, u8 r1)
bool8 ShouldAvoidEnemiesAndShowEffect(struct DungeonEntity *pokemon, bool8 showRunAwayEffect)
{
if(ShouldAvoidEnemies(pokemon))
if (ShouldAvoidEnemies(pokemon))
{
CheckRunAwayVisualFlag(pokemon, r1);
CheckRunAwayVisualFlag(pokemon, showRunAwayEffect);
return TRUE;
}
return FALSE;

View File

@@ -3,7 +3,7 @@
#include "constants/status.h"
#include "constants/targeting.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_pokemon_attributes.h"
const u8 gTargetingData[3][2][2][2] = {
{

View File

@@ -1,76 +1,526 @@
#include "global.h"
#include "dungeon_ai_attack.h"
#include "constants/direction.h"
#include "constants/dungeon_action.h"
#include "constants/iq_skill.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "constants/tactic.h"
#include "constants/type.h"
#include "charge_move.h"
#include "dungeon_action.h"
#include "dungeon_ai.h"
#include "dungeon_ai_attack_1.h"
#include "dungeon_capabilities_1.h"
#include "dungeon_global_data.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_random_1.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "moves.h"
#include "position_util.h"
#include "status_checks.h"
#include "targeting.h"
#include "targeting_flags.h"
bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange)
#define REGULAR_ATTACK_INDEX 4
const s16 gRegularAttackWeights[] = {100, 20, 30, 40, 50};
extern bool8 gCanAttackInDirection[NUM_DIRECTIONS];
extern s32 gNumPotentialTargets;
extern s32 gPotentialTargetWeights_2[NUM_DIRECTIONS];
extern u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS];
extern struct DungeonEntity *gPotentialTargets[NUM_DIRECTIONS];
extern bool8 IsMoveUsable(struct DungeonEntity*, s32, bool8);
extern bool8 TargetRegularAttack(struct DungeonEntity*, u32*, bool8);
extern bool8 CanUseWithStatusChecker(struct DungeonEntity*, struct PokemonMove*);
extern bool8 CanAttackInFront(struct DungeonEntity*, s32);
extern s32 WeightMoveIfUsable(s32, s32, struct DungeonEntity*, struct DungeonEntity*, struct PokemonMove*, bool8);
extern bool8 IsTargetInLineRange(struct DungeonEntity*, struct DungeonEntity*, s32);
extern bool8 CanUseStatusMove(s32, struct DungeonEntity*, struct DungeonEntity*, struct PokemonMove*, bool8);
extern s32 WeightMove(struct DungeonEntity*, s32, struct DungeonEntity*, u8);
void DecideAttack(struct DungeonEntity *pokemon)
{
s32 posDiffX = pokemon->posWorld.x - targetPokemon->posWorld.x;
s32 effectiveMaxRange;
if (posDiffX < 0)
struct DungeonEntityData *pokemonData = pokemon->entityData;
s32 i;
s32 chargeStatus = CHARGING_STATUS_CHARGE;
struct MoveTargetResults moveTargetResults[MAX_MON_MOVES + 1];
bool8 willNotUnlinkMove[MAX_MON_MOVES];
s32 randomWeight;
bool8 hasPPChecker;
s32 numUsableMoves;
s32 total;
s32 weightCounter;
bool8 hasWeakTypePicker;
s32 regularAttackTargetDir;
bool8 canTargetRegularAttack;
s32 maxWeight;
if (CannotAttack(pokemon, FALSE) ||
ShouldAvoidEnemiesAndShowEffect(pokemon, TRUE) ||
HasTactic(pokemon, TACTIC_KEEP_YOUR_DISTANCE) ||
(pokemonData->volatileStatus == VOLATILE_STATUS_CONFUSED && RollPercentChance(gConfusedAttackChance)))
{
posDiffX = -posDiffX;
return;
}
effectiveMaxRange = pokemon->posWorld.y - targetPokemon->posWorld.y;
if (effectiveMaxRange < 0)
if (pokemonData->chargingStatus != CHARGING_STATUS_NONE)
{
effectiveMaxRange = -effectiveMaxRange;
}
if (effectiveMaxRange < posDiffX)
{
effectiveMaxRange = posDiffX;
}
if (effectiveMaxRange > maxRange)
{
effectiveMaxRange = maxRange;
}
if (!HasIQSkill(pokemon, IQ_SKILL_COURSE_CHECKER))
{
// BUG: effectiveMaxRange is already capped at maxRange, so this condition always evaluates to TRUE.
// The AI also has range checks elsewhere, so this doesn't become an issue in most cases.
// If the AI has the Long Toss or Pierce statuses and Course Checker is disabled,
// this incorrect check causes the AI to throw items at targets further than 10 tiles away.
if (effectiveMaxRange <= maxRange)
for (i = 0; i < MAX_MON_MOVES; i++)
{
return TRUE;
if (pokemonData->moves[i].moveFlags & MOVE_FLAG_EXISTS &&
MoveMatchesChargingStatus(pokemon, &pokemonData->moves[i]) &&
pokemonData->chargingStatusMoveIndex == i)
{
s32 chosenMoveIndex;
SetAction(&pokemonData->action, DUNGEON_ACTION_USE_MOVE_AI);
chosenMoveIndex = i;
if (i > 0 && pokemonData->moves[i].moveFlags & MOVE_FLAG_LINKED)
{
while (--chosenMoveIndex > 0)
{
if (!(pokemonData->moves[chosenMoveIndex].moveFlags & MOVE_FLAG_LINKED))
{
break;
}
}
}
pokemonData->action.actionUseIndex = chosenMoveIndex;
TargetTileInFront(pokemon);
return;
}
}
}
total = 0;
numUsableMoves = 0;
for (i = 0; i < MAX_MON_MOVES; i++)
{
struct PokemonMove *move = &pokemonData->moves[i];
if (pokemonData->moves[i].moveFlags & MOVE_FLAG_EXISTS)
{
if (pokemonData->moves[i].moveFlags & MOVE_FLAG_ENABLED)
{
numUsableMoves++;
}
total += move->PP;
}
}
if (total == 0)
{
struct PokemonMove struggle;
InitPokemonMove(&struggle, MOVE_STRUGGLE);
FindMoveTarget(&moveTargetResults[0], pokemon, &struggle);
if (moveTargetResults[0].moveUsable)
{
SetAction(&pokemonData->action, DUNGEON_ACTION_STRUGGLE);
pokemonData->action.facingDir = moveTargetResults[0].targetDir & DIRECTION_MASK;
TargetTileInFront(pokemon);
}
return;
}
hasWeakTypePicker = HasIQSkill(pokemon, IQ_SKILL_WEAK_TYPE_PICKER);
hasPPChecker = HasIQSkill(pokemon, IQ_SKILL_PP_CHECKER) != FALSE;
total = 0;
for (i = 0; i < MAX_MON_MOVES; i++)
{
willNotUnlinkMove[i] = TRUE;
}
if (hasPPChecker)
{
s32 minPP = 99;
s32 linkedMoveStartIndex = 0;
// Linked moves unlink if any move in the chain runs out of PP.
// With PP Checker, the AI avoids this by not using linked moves if any move in the chain has 1 PP left.
// This requires a separate check from the 0-PP check used for unlinked moves.
for (i = 0; i < MAX_MON_MOVES; i++)
{
struct PokemonMove *move = &pokemonData->moves[i];
if (!(move->moveFlags & MOVE_FLAG_EXISTS))
{
break;
}
if (i != 0 && !(move->moveFlags & MOVE_FLAG_LINKED))
{
if (linkedMoveStartIndex + 1 < i && minPP <= 1 && linkedMoveStartIndex + 1 <= i)
{
s32 j;
for (j = linkedMoveStartIndex; j < i; j++)
{
willNotUnlinkMove[j] = FALSE;
}
}
minPP = move->PP;
linkedMoveStartIndex = i;
}
else
{
s32 newMinPP = move->PP;
if (newMinPP > minPP)
{
newMinPP = minPP;
}
minPP = newMinPP;
}
}
if (linkedMoveStartIndex + 1 < i && minPP <= 1 && linkedMoveStartIndex + 1 <= i)
{
s32 j;
for (j = linkedMoveStartIndex; j < i; j++)
{
willNotUnlinkMove[j] = FALSE;
}
}
}
for (i = 0; i < MAX_MON_MOVES; i++)
{
struct PokemonMove *move;
moveTargetResults[i].moveUsable = FALSE;
move = &pokemonData->moves[i];
if (move->moveFlags & MOVE_FLAG_EXISTS &&
willNotUnlinkMove[i] &&
IsMoveUsable(pokemon, i, hasPPChecker) &&
move->moveFlags & MOVE_FLAG_ENABLED)
{
moveTargetResults[i].moveUsable = TRUE;
if (pokemonData->chargingStatus == chargeStatus)
{
if (move->moveID == MOVE_CHARGE)
{
moveTargetResults[i].moveWeight = 0;
continue;
}
else if (GetMoveTypeForPokemon(pokemon, move) == TYPE_ELECTRIC)
{
moveTargetResults[i].moveWeight = GetMoveWeight(move);
}
else
{
moveTargetResults[i].moveWeight = 1;
}
}
else if (hasWeakTypePicker)
{
struct MoveTargetResults *results = &moveTargetResults[i];
results->moveWeight = FindMoveTarget(results, pokemon, move);
}
else
{
moveTargetResults[i].moveWeight = GetMoveWeight(move);
}
total += moveTargetResults[i].moveWeight;
}
}
moveTargetResults[REGULAR_ATTACK_INDEX].moveWeight = 0;
if (!HasIQSkill(pokemon, IQ_SKILL_EXCLUSIVE_MOVE_USER) && pokemonData->chargingStatus != chargeStatus)
{
moveTargetResults[REGULAR_ATTACK_INDEX].moveUsable = TRUE;
if (pokemonData->chargingStatus == chargeStatus)
{
// Never reached? Charge already skips the regular attack in the outer block.
moveTargetResults[REGULAR_ATTACK_INDEX].moveWeight = 1;
}
else if (hasWeakTypePicker)
{
moveTargetResults[REGULAR_ATTACK_INDEX].moveWeight = 2;
}
else
{
moveTargetResults[REGULAR_ATTACK_INDEX].moveWeight = gRegularAttackWeights[numUsableMoves];
}
total += moveTargetResults[REGULAR_ATTACK_INDEX].moveWeight;
}
if (hasWeakTypePicker)
{
s32 i;
maxWeight = 0;
total = 0;
for (i = 0; i < MAX_MON_MOVES + 1; i++)
{
if (!moveTargetResults[i].moveUsable)
{
moveTargetResults[i].moveWeight = 0;
}
else if (maxWeight < moveTargetResults[i].moveWeight)
{
maxWeight = moveTargetResults[i].moveWeight;
}
}
for (i = 0; i < MAX_MON_MOVES + 1; i++)
{
if (moveTargetResults[i].moveUsable)
{
if (maxWeight != moveTargetResults[i].moveWeight)
{
moveTargetResults[i].moveWeight = 0;
}
total += moveTargetResults[i].moveWeight;
}
}
}
if (total == 0)
{
return;
}
randomWeight = DungeonRandomCapped(total);
weightCounter = 0;
if (!HasIQSkill(pokemon, IQ_SKILL_EXCLUSIVE_MOVE_USER))
{
canTargetRegularAttack = TargetRegularAttack(pokemon, &regularAttackTargetDir, TRUE);
}
else
{
s32 currentPosX = pokemon->posWorld.x;
s32 currentPosY = pokemon->posWorld.y;
s32 adjacentTileOffsetX = gAdjacentTileOffsets[facingDir].x;
s32 adjacentTileOffsetY = gAdjacentTileOffsets[facingDir].y;
s32 i;
for (i = 0; i <= effectiveMaxRange; i++)
canTargetRegularAttack = FALSE;
regularAttackTargetDir = DIRECTION_SOUTH;
}
for (i = 0; i <= REGULAR_ATTACK_INDEX; i++)
{
if (moveTargetResults[i].moveUsable && moveTargetResults[i].moveWeight != 0)
{
struct MapTile *mapTile;
currentPosX += adjacentTileOffsetX;
currentPosY += adjacentTileOffsetY;
if (currentPosX <= 0 || currentPosY <= 0 ||
currentPosX >= DUNGEON_MAX_SIZE_X - 1 || currentPosY >= DUNGEON_MAX_SIZE_Y - 1)
weightCounter += moveTargetResults[i].moveWeight;
if (weightCounter >= randomWeight)
{
break;
if (i == REGULAR_ATTACK_INDEX)
{
if (canTargetRegularAttack)
{
SetAction(&pokemonData->action, DUNGEON_ACTION_REGULAR_ATTACK);
pokemonData->action.facingDir = regularAttackTargetDir & DIRECTION_MASK;
TargetTileInFront(pokemon);
}
}
else
{
FindMoveTarget(&moveTargetResults[i], pokemon, &pokemonData->moves[i]);
if (moveTargetResults[i].moveUsable)
{
s32 chosenMoveIndex;
SetAction(&pokemonData->action, DUNGEON_ACTION_USE_MOVE_AI);
chosenMoveIndex = i;
if (i > 0 && pokemonData->moves[i].moveFlags & MOVE_FLAG_LINKED)
{
while (--chosenMoveIndex > 0)
{
if (!(pokemonData->moves[chosenMoveIndex].moveFlags & MOVE_FLAG_LINKED))
{
break;
}
}
}
pokemonData->action.facingDir = moveTargetResults[i].targetDir & DIRECTION_MASK;
pokemonData->action.actionUseIndex = chosenMoveIndex;
TargetTileInFront(pokemon);
}
else
{
break;
}
}
return;
}
while (0); // Extra label needed to swap branch locations in ASM.
mapTile = GetMapTileAtPosition(currentPosX, currentPosY);
if (!(mapTile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)))
}
}
if (canTargetRegularAttack)
{
SetAction(&pokemonData->action, DUNGEON_ACTION_REGULAR_ATTACK);
pokemonData->action.facingDir = regularAttackTargetDir & DIRECTION_MASK;
TargetTileInFront(pokemon);
}
}
s32 FindMoveTarget(struct MoveTargetResults *moveTargetResults, struct DungeonEntity *pokemon, struct PokemonMove *move)
{
s32 targetingFlags;
s32 moveWeight = 1;
struct DungeonEntityData *pokemonData = pokemon->entityData;
s32 numPotentialTargets = 0;
s32 i;
bool8 hasStatusChecker;
s32 rangeTargetingFlags;
s32 rangeTargetingFlags2;
for (i = 0; i < NUM_DIRECTIONS; i++)
{
gCanAttackInDirection[i] = FALSE;
}
targetingFlags = GetMoveTargetingFlagsForPokemon(pokemon, move, TRUE);
hasStatusChecker = HasIQSkill(pokemon, IQ_SKILL_STATUS_CHECKER);
moveTargetResults->moveUsable = FALSE;
if ((pokemonData->volatileStatus == VOLATILE_STATUS_TAUNTED && !MoveDealsDirectDamage(move)) ||
(hasStatusChecker && !CanUseWithStatusChecker(pokemon, move)))
{
return 1;
}
rangeTargetingFlags = targetingFlags & 0xF0;
if (rangeTargetingFlags == TARGETING_FLAG_TARGET_OTHER ||
rangeTargetingFlags == TARGETING_FLAG_TARGET_FRONTAL_CONE ||
rangeTargetingFlags == TARGETING_FLAG_TARGET_AROUND)
{
if (pokemonData->eyesightStatus == EYESIGHT_STATUS_BLINKER)
{
u8 facingDir = pokemonData->action.facingDir;
i = facingDir; // Fixes a regswap.
if (!gCanAttackInDirection[i])
{
break;
gCanAttackInDirection[i] = TRUE;
gPotentialAttackTargetDirections[numPotentialTargets] = i;
gPotentialTargetWeights_2[numPotentialTargets] = 99;
gPotentialTargets[numPotentialTargets] = NULL;
numPotentialTargets++;
}
if (mapTile->pokemon == targetPokemon)
}
else
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
return TRUE;
// Double assignment to fix a regswap.
s16 rangeTargetingFlags = rangeTargetingFlags2 = targetingFlags & 0xF0;
struct MapTile *adjacentTile = GetMapTileAtPosition(pokemon->posWorld.x + gAdjacentTileOffsets[i].x,
pokemon->posWorld.y + gAdjacentTileOffsets[i].y);
struct DungeonEntity *adjacentPokemon = adjacentTile->pokemon;
if (adjacentPokemon != NULL && GetEntityType(adjacentPokemon) == ENTITY_POKEMON)
{
if (rangeTargetingFlags != TARGETING_FLAG_TARGET_FRONTAL_CONE &&
rangeTargetingFlags != TARGETING_FLAG_TARGET_AROUND)
{
if (!CanAttackInFront(pokemon, i))
{
continue;
}
}
numPotentialTargets = WeightMoveIfUsable(numPotentialTargets, targetingFlags, pokemon, adjacentPokemon, move, hasStatusChecker);
}
}
if (mapTile->pokemon != NULL)
}
}
else if (rangeTargetingFlags == TARGETING_FLAG_TARGET_ROOM)
{
s32 i;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++)
{
struct DungeonEntity *target = gDungeonGlobalData->allPokemon[i];
if (EntityExists(target) && CanSee(pokemon, target))
{
numPotentialTargets = WeightMoveIfUsable(numPotentialTargets, targetingFlags, pokemon, target, move, hasStatusChecker);
}
}
}
else if (rangeTargetingFlags == TARGETING_FLAG_TARGET_2_TILES_AHEAD)
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
struct MapTile *targetTile = GetMapTileAtPosition(pokemon->posWorld.x + gAdjacentTileOffsets[i].x,
pokemon->posWorld.y + gAdjacentTileOffsets[i].y);
if (CanAttackInFront(pokemon, i))
{
struct DungeonEntity *targetPokemon = targetTile->pokemon;
if (targetPokemon != NULL && GetEntityType(targetPokemon) == ENTITY_POKEMON)
{
s32 prevNumPotentialTargets = numPotentialTargets;
numPotentialTargets = WeightMoveIfUsable(numPotentialTargets, targetingFlags, pokemon, targetPokemon, move, hasStatusChecker);
if (prevNumPotentialTargets != numPotentialTargets)
{
continue;
}
}
targetTile = GetMapTileAtPosition(pokemon->posWorld.x + gAdjacentTileOffsets[i].x * 2,
pokemon->posWorld.y + gAdjacentTileOffsets[i].y * 2);
targetPokemon = targetTile->pokemon;
if (targetPokemon != NULL && GetEntityType(targetPokemon) == ENTITY_POKEMON)
{
numPotentialTargets = WeightMoveIfUsable(numPotentialTargets, targetingFlags, pokemon, targetPokemon, move, hasStatusChecker);
}
}
}
}
else if (rangeTargetingFlags == TARGETING_FLAG_TARGET_LINE || rangeTargetingFlags == TARGETING_FLAG_CUT_CORNERS)
{
s32 maxRange = 1;
s32 i;
if (rangeTargetingFlags == TARGETING_FLAG_TARGET_LINE)
{
maxRange = 10;
}
for (i = 0; i < DUNGEON_MAX_POKEMON; i++)
{
struct DungeonEntity *target = gDungeonGlobalData->allPokemon[i];
if (EntityExists(target) && pokemon != target)
{
s32 facingDir = CalculateFacingDir(&pokemon->posWorld, &target->posWorld);
if (!gCanAttackInDirection[facingDir] &&
CanSee(pokemon, target) &&
IsTargetInLineRange(pokemon, target, maxRange) &&
CanUseStatusMove(targetingFlags, pokemon, target, move, hasStatusChecker) &&
IsTargetStraightAhead(pokemon, target, facingDir, maxRange))
{
gCanAttackInDirection[facingDir] = TRUE;
gPotentialAttackTargetDirections[numPotentialTargets] = facingDir;
gPotentialTargetWeights_2[numPotentialTargets] = WeightMove(pokemon, targetingFlags, target, GetMoveTypeForPokemon(pokemon, move));
gPotentialTargets[numPotentialTargets] = target;
numPotentialTargets++;
}
}
}
}
else if (rangeTargetingFlags == TARGETING_FLAG_TARGET_FLOOR)
{
s32 i;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++)
{
struct DungeonEntity *target = gDungeonGlobalData->allPokemon[i];
if (EntityExists(target))
{
numPotentialTargets = WeightMoveIfUsable(numPotentialTargets, targetingFlags, pokemon, target, move, hasStatusChecker);
}
}
}
else if (rangeTargetingFlags == TARGETING_FLAG_TARGET_SELF)
{
numPotentialTargets = WeightMoveIfUsable(numPotentialTargets, targetingFlags, pokemon, pokemon, move, hasStatusChecker);
}
if (numPotentialTargets == 0)
{
moveTargetResults->moveUsable = FALSE;
}
else
{
s32 totalWeight = 0;
s32 maxWeight = 0;
s32 weightCounter;
s32 i;
for (i = 0; i < numPotentialTargets; i++)
{
if (maxWeight < gPotentialTargetWeights_2[i])
{
maxWeight = gPotentialTargetWeights_2[i];
}
}
for (i = 0; i < numPotentialTargets; i++)
{
if (maxWeight != gPotentialTargetWeights_2[i])
{
gPotentialTargetWeights_2[i] = 0;
}
}
moveWeight = maxWeight;
for (i = 0; i < numPotentialTargets; i++)
{
totalWeight += gPotentialTargetWeights_2[i];
}
weightCounter = DungeonRandomCapped(totalWeight);
for (i = 0; i < numPotentialTargets; i++)
{
weightCounter -= gPotentialTargetWeights_2[i];
if (weightCounter < 0)
{
break;
}
}
moveTargetResults->moveUsable = TRUE;
moveTargetResults->targetDir = gPotentialAttackTargetDirections[i];
moveTargetResults->moveWeight = 8;
}
return FALSE;
}
return moveWeight;
}

76
src/dungeon_ai_attack_1.c Normal file
View File

@@ -0,0 +1,76 @@
#include "global.h"
#include "dungeon_ai_attack_1.h"
#include "constants/iq_skill.h"
#include "dungeon_global_data.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange)
{
s32 posDiffX = pokemon->posWorld.x - targetPokemon->posWorld.x;
s32 effectiveMaxRange;
if (posDiffX < 0)
{
posDiffX = -posDiffX;
}
effectiveMaxRange = pokemon->posWorld.y - targetPokemon->posWorld.y;
if (effectiveMaxRange < 0)
{
effectiveMaxRange = -effectiveMaxRange;
}
if (effectiveMaxRange < posDiffX)
{
effectiveMaxRange = posDiffX;
}
if (effectiveMaxRange > maxRange)
{
effectiveMaxRange = maxRange;
}
if (!HasIQSkill(pokemon, IQ_SKILL_COURSE_CHECKER))
{
// BUG: effectiveMaxRange is already capped at maxRange, so this condition always evaluates to TRUE.
// The AI also has range checks elsewhere, so this doesn't become an issue in most cases.
// If the AI has the Long Toss or Pierce statuses and Course Checker is disabled,
// this incorrect check causes the AI to throw items at targets further than 10 tiles away.
if (effectiveMaxRange <= maxRange)
{
return TRUE;
}
}
else
{
s32 currentPosX = pokemon->posWorld.x;
s32 currentPosY = pokemon->posWorld.y;
s32 adjacentTileOffsetX = gAdjacentTileOffsets[facingDir].x;
s32 adjacentTileOffsetY = gAdjacentTileOffsets[facingDir].y;
s32 i;
for (i = 0; i <= effectiveMaxRange; i++)
{
struct MapTile *mapTile;
currentPosX += adjacentTileOffsetX;
currentPosY += adjacentTileOffsetY;
if (currentPosX <= 0 || currentPosY <= 0 ||
currentPosX >= DUNGEON_MAX_SIZE_X - 1 || currentPosY >= DUNGEON_MAX_SIZE_Y - 1)
{
break;
}
while (0); // Extra label needed to swap branch locations in ASM.
mapTile = GetMapTileAtPosition(currentPosX, currentPosY);
if (!(mapTile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)))
{
break;
}
if (mapTile->pokemon == targetPokemon)
{
return TRUE;
}
if (mapTile->pokemon != NULL)
{
break;
}
}
}
return FALSE;
}

View File

@@ -5,7 +5,7 @@
#include "constants/targeting.h"
#include "dungeon_ai_1.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "moves.h"
#include "number_util.h"
@@ -85,11 +85,11 @@ u32 EvaluateItem(struct DungeonEntity *targetPokemon, struct ItemSlot *item, u32
{
if (move->moveFlags & MOVE_FLAG_EXISTS)
{
if (move->pp == 0)
if (move->PP == 0)
{
itemWeight += 30;
}
if (move->pp != GetMoveMaxPP(move2))
if (move->PP != GetMoveMaxPP(move2))
{
itemWeight += 6;
}

View File

@@ -7,7 +7,7 @@
#include "constants/targeting.h"
#include "dungeon_action.h"
#include "dungeon_ai_1.h"
#include "dungeon_ai_attack.h"
#include "dungeon_ai_attack_1.h"
#include "dungeon_ai_item_weight.h"
#include "dungeon_ai_items.h"
#include "dungeon_capabilities.h"
@@ -15,7 +15,7 @@
#include "dungeon_entity.h"
#include "dungeon_global_data.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_random_1.h"
#include "dungeon_util.h"
@@ -40,7 +40,7 @@ extern void sub_8077274(struct DungeonEntity *, struct DungeonEntity *);
extern s32 gNumPotentialTargets;
extern u32 gPotentialTargetWeights[NUM_DIRECTIONS];
extern u32 gPotentialTargetDirections[NUM_DIRECTIONS];
extern u32 gPotentialItemTargetDirections[NUM_DIRECTIONS];
extern bool8 gTargetAhead[NUM_DIRECTIONS];
extern struct TeamInventory *gTeamInventory_203B460;
@@ -101,7 +101,7 @@ void DecideUseItem(struct DungeonEntity *pokemon)
pokemonData->action.actionUseIndex = selectedToolboxIndex;
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
pokemonData->action.facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
pokemonData->action.facingDir = gPotentialItemTargetDirections[targetIndex] & DIRECTION_MASK;
break;
}
}
@@ -261,7 +261,7 @@ void DecideUseItem(struct DungeonEntity *pokemon)
pokemonData->action.actionUseIndex = selectedToolboxIndex;
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
pokemonData->action.facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
pokemonData->action.facingDir = gPotentialItemTargetDirections[targetIndex] & DIRECTION_MASK;
return;
}
}
@@ -421,7 +421,7 @@ void TargetThrownItem(struct DungeonEntity *pokemon, struct DungeonEntity *targe
u32 itemWeight;
u32 *targetWeight;
gTargetAhead[targetDirection] = TRUE;
gPotentialTargetDirections[gNumPotentialTargets] = targetDirection;
gPotentialItemTargetDirections[gNumPotentialTargets] = targetDirection;
targetWeight = &gPotentialTargetWeights[gNumPotentialTargets];
itemWeight = !ignoreRollChance ? EvaluateItem(targetPokemon, item, targetingFlags) : 100;
*targetWeight = itemWeight;

View File

@@ -8,10 +8,11 @@
#include "constants/targeting.h"
#include "code_80521D0.h"
#include "dungeon_action.h"
#include "dungeon_ai_attack.h"
#include "dungeon_ai_items.h"
#include "dungeon_capabilities_1.h"
#include "dungeon_global_data.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_util_1.h"
@@ -19,6 +20,7 @@
#include "map.h"
#include "pokemon.h"
#include "status_checks.h"
#include "targeting.h"
extern char gAvailablePokemonNames[];
extern char *gPtrCouldntBeUsedMessage;
@@ -27,7 +29,6 @@ extern char *gPtrItsaMonsterHouseMessage;
extern void SendImmobilizeEndMessage(struct DungeonEntity*, struct DungeonEntity*);
extern void SetMessageArgument(char[], struct DungeonEntity*, u32);
extern void ResetAction(u16*);
extern void DecideAttack(struct DungeonEntity*);
extern void MoveIfPossible(struct DungeonEntity*, bool8);
extern u8 sub_8044B28(void);
extern void sub_807AB38(struct DungeonEntity *, u32);
@@ -35,7 +36,6 @@ extern void sub_8041888(u32);
extern u8 sub_803F428(s16 *);
extern void sub_803E708(u32, u32);
extern struct DungeonEntity *GetLeaderEntity();
extern void TargetTileInFront(struct DungeonEntity *);
u32 sub_8075818(struct DungeonEntity *entity)
{

View File

@@ -11,7 +11,7 @@
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "map.h"

View File

@@ -1,15 +1,27 @@
#include "global.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "constants/ability.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "constants/tactic.h"
#include "constants/type.h"
#include "dungeon_global_data.h"
#include "dungeon_items.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "moves.h"
#include "pokemon.h"
#include "pokemon_3.h"
const s16 gItemMasterMinWildLevel[] = {16};
extern u8 gAvailablePokemonNames[];
extern u32 gUnknown_80FC31C;
extern u32 gUnknown_80FCEFC;
extern u32 gUnknown_80FC2FC;
extern bool8 sub_805744C(struct DungeonEntity *, struct PokemonMove *, u32);
extern void SetMessageArgument(char[], struct DungeonEntity*, u32);
extern void sub_80522F4(struct DungeonEntity *r1, struct DungeonEntity *r2, u32);
@@ -51,7 +63,7 @@ bool8 sub_80717A4(struct DungeonEntity *param_1, u16 moveID)
{
struct DungeonEntityData * entityData;
s32 iVar3;
entityData = param_1->entityData;
if ((entityData->sleepStatus != SLEEP_STATUS_SLEEP) && (entityData->sleepStatus != SLEEP_STATUS_NAPPING) && (entityData->sleepStatus != SLEEP_STATUS_NIGHTMARE)) {
return FALSE;
@@ -66,10 +78,10 @@ bool8 sub_80717A4(struct DungeonEntity *param_1, u16 moveID)
for(iVar3 = 0, pokeMove = entityData->moves, pokeMove2 = pokeMove; iVar3 < MAX_MON_MOVES; pokeMove++, pokeMove2++, iVar3++)
{
if (((pokeMove->moveFlags & MOVE_FLAG_EXISTS) != 0) && (entityData->isLeader || ((pokeMove->moveFlags & MOVE_FLAG_ENABLED) != 0)))
if((sub_805744C(param_1, pokeMove2, 1) != '\0') && (pokeMove->pp != 0))
if((sub_805744C(param_1, pokeMove2, 1) != '\0') && (pokeMove->PP != 0))
if(pokeMove->moveID == moveID)
return TRUE;
}
}
return FALSE;
}
}
@@ -90,3 +102,158 @@ bool8 HasAbility(struct DungeonEntity *pokemon, u8 ability)
return FALSE;
}
}
bool8 HasType(struct DungeonEntity *pokemon, u8 type)
{
struct DungeonEntityData *pokemonData = pokemonData = pokemon->entityData;
if (type == TYPE_NONE)
{
return FALSE;
}
if (pokemonData->type1 == type)
{
return TRUE;
}
if (pokemonData->type2 == type)
{
return TRUE;
}
return FALSE;
}
bool8 CanSeeInvisible(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
if (pokemonData->eyesightStatus != EYESIGHT_STATUS_EYEDROPS)
{
if (!HasItem(pokemon, ITEM_ID_GOGGLE_SPECS))
return FALSE;
else
return TRUE;
}
else
return TRUE;
}
bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
if (pokemonData->isLeader)
{
bool8 isGoTheOtherWay = tactic == TACTIC_GO_THE_OTHER_WAY;
return isGoTheOtherWay;
}
return pokemonData->tactic == tactic;
}
bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill)
{
return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill);
}
bool8 HasIQSkillPair(struct DungeonEntity *pokemon, u8 IQSkill1, u8 IQSkill2)
{
return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill1 | 1 << IQSkill2);
}
void LoadIQSkills(struct DungeonEntity *pokemon)
{
u8 *iVar2;
s32 IQSkill;
struct DungeonEntityData *pokemonData;
pokemonData = pokemon->entityData;
if (pokemonData->isEnemy) {
iVar2 = pokemonData->IQSkillsEnabled;
SetIQSkill(iVar2, IQ_SKILL_STATUS_CHECKER);
SetIQSkill(iVar2, IQ_SKILL_PP_CHECKER);
SetIQSkill(iVar2, IQ_SKILL_ITEM_CATCHER);
if (pokemonData->isBoss)
SetIQSkill(iVar2, IQ_SKILL_SELF_CURER);
if (pokemonData->level >= *gItemMasterMinWildLevel)
SetIQSkill(iVar2, IQ_SKILL_ITEM_MASTER);
pokemonData->tactic = TACTIC_GO_AFTER_FOES;
}
else {
pokemonData->IQSkillsEnabled[0] = 0;
pokemonData->IQSkillsEnabled[1] = 0;
pokemonData->IQSkillsEnabled[2] = 0;
for(IQSkill = IQ_SKILL_TYPE_ADVANTAGE_MASTER; IQSkill < NUM_IQ_SKILLS; IQSkill++)
{
if (HasIQForSkill(pokemonData->IQ,IQSkill) &&
IsIQSkillSet(pokemonData->IQSkillsSelected, 1 << IQSkill))
{
SetIQSkill(pokemonData->IQSkillsEnabled,IQSkill);
}
}
}
}
bool8 CanSeeTeammate(struct DungeonEntity * pokemon)
{
struct DungeonEntity *teamMember;
s32 memberIdx;
if (pokemon->entityData->isEnemy) {
return FALSE;
}
else
{
for(memberIdx = 0; memberIdx < MAX_TEAM_MEMBERS; memberIdx++)
{
teamMember = gDungeonGlobalData->teamPokemon[memberIdx];
if (EntityExists(pokemon) && (pokemon != teamMember) && (CanSee(pokemon,teamMember)))
{
return TRUE;
}
}
return FALSE;
}
}
u8 GetMoveTypeForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove)
{
if (pokeMove->moveID == MOVE_HIDDEN_POWER)
return pokemon->entityData->hiddenPowerType;
else
return GetMoveType(pokeMove);
}
s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove)
{
if(pokeMove->moveID == MOVE_HIDDEN_POWER)
return (pokemon->entityData->hiddenPowerPower + pokeMove->powerBoost);
else
return (GetMovePower(pokeMove) + pokeMove->powerBoost);
}
bool8 ToolboxEnabled(struct DungeonEntityData *pokemon)
{
if(!IsToolboxEnabled(pokemon->entityID))
return FALSE;
return TRUE;
}
static inline bool8 sub_8071A8C_sub(struct DungeonEntityData *pokemonData)
{
if(pokemonData->joinLocation == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON ||
pokemonData->joinLocation == DUNGEON_RESCUE_TEAM_BASE)
return TRUE;
else
return FALSE;
}
bool8 sub_8071A8C(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData;
if(EntityExists(pokemon))
{
pokemonData = pokemon->entityData;
if(pokemonData->clientType != CLIENT_TYPE_CLIENT)
{
if(!sub_8071A8C_sub(pokemonData))
return TRUE;
}
}
return FALSE;
}

View File

@@ -1,161 +0,0 @@
#include "global.h"
#include "dungeon_pokemon_attributes_1.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "constants/tactic.h"
#include "dungeon_global_data.h"
#include "dungeon_items.h"
#include "dungeon_util.h"
#include "pokemon.h"
#include "pokemon_3.h"
const s16 gItemMasterMinWildLevel[] = {16};
extern bool8 IsIQSkillSet(u8 *, u32);
extern void SetIQSkill(u8 *param_1, u32 skillIndex);
extern bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex);
extern bool8 CanSee(struct DungeonEntity *, struct DungeonEntity *);
extern u8 GetMoveType(struct PokemonMove *move);
extern s32 GetMovePower(struct PokemonMove *move);
bool8 CanSeeInvisible(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
if (pokemonData->eyesightStatus != EYESIGHT_STATUS_EYEDROPS)
{
if (!HasItem(pokemon, ITEM_ID_GOGGLE_SPECS))
return FALSE;
else
return TRUE;
}
else
return TRUE;
}
bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
if (pokemonData->isLeader)
{
bool8 isGoTheOtherWay = tactic == TACTIC_GO_THE_OTHER_WAY;
return isGoTheOtherWay;
}
return pokemonData->tactic == tactic;
}
bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill)
{
return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill);
}
bool8 HasIQSkillPair(struct DungeonEntity *pokemon, u8 IQSkill1, u8 IQSkill2)
{
return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill1 | 1 << IQSkill2);
}
void LoadIQSkills(struct DungeonEntity *pokemon)
{
u8 *iVar2;
s32 IQSkill;
struct DungeonEntityData *pokemonData;
pokemonData = pokemon->entityData;
if (pokemonData->isEnemy) {
iVar2 = pokemonData->IQSkillsEnabled;
SetIQSkill(iVar2, IQ_SKILL_STATUS_CHECKER);
SetIQSkill(iVar2, IQ_SKILL_PP_CHECKER);
SetIQSkill(iVar2, IQ_SKILL_ITEM_CATCHER);
if (pokemonData->isBoss)
SetIQSkill(iVar2, IQ_SKILL_SELF_CURER);
if (pokemonData->level >= *gItemMasterMinWildLevel)
SetIQSkill(iVar2, IQ_SKILL_ITEM_MASTER);
pokemonData->tactic = TACTIC_GO_AFTER_FOES;
}
else {
pokemonData->IQSkillsEnabled[0] = 0;
pokemonData->IQSkillsEnabled[1] = 0;
pokemonData->IQSkillsEnabled[2] = 0;
for(IQSkill = IQ_SKILL_TYPE_ADVANTAGE_MASTER; IQSkill < NUM_IQ_SKILLS; IQSkill++)
{
if (HasIQForSkill(pokemonData->IQ,IQSkill) &&
IsIQSkillSet(pokemonData->IQSkillsSelected, 1 << IQSkill))
{
SetIQSkill(pokemonData->IQSkillsEnabled,IQSkill);
}
}
}
}
bool8 CanSeeTeammate(struct DungeonEntity * pokemon)
{
struct DungeonEntity *teamMember;
s32 memberIdx;
if (pokemon->entityData->isEnemy) {
return FALSE;
}
else
{
for(memberIdx = 0; memberIdx < MAX_TEAM_MEMBERS; memberIdx++)
{
teamMember = gDungeonGlobalData->teamPokemon[memberIdx];
if (EntityExists(pokemon) && (pokemon != teamMember) && (CanSee(pokemon,teamMember)))
{
return TRUE;
}
}
return FALSE;
}
}
u8 GetMoveType_2(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove)
{
if(pokeMove->moveID == MOVE_HIDDEN_POWER)
return pokemon->entityData->hiddenPowerType;
else
return GetMoveType(pokeMove);
}
s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove)
{
if(pokeMove->moveID == MOVE_HIDDEN_POWER)
return (pokemon->entityData->hiddenPowerPower + pokeMove->powerBoost);
else
return (GetMovePower(pokeMove) + pokeMove->powerBoost);
}
bool8 ToolboxEnabled(struct DungeonEntityData *pokemon)
{
if(!IsToolboxEnabled(pokemon->entityID))
return FALSE;
return TRUE;
}
static inline bool8 sub_8071A8C_sub(struct DungeonEntityData *pokemonData)
{
if(pokemonData->joinLocation == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON ||
pokemonData->joinLocation == DUNGEON_RESCUE_TEAM_BASE)
return TRUE;
else
return FALSE;
}
bool8 sub_8071A8C(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData;
if(EntityExists(pokemon))
{
pokemonData = pokemon->entityData;
if(pokemonData->clientType != CLIENT_TYPE_CLIENT)
{
if(!sub_8071A8C_sub(pokemonData))
return TRUE;
}
}
return FALSE;
}

View File

@@ -2,7 +2,7 @@
#include "dungeon_visibility.h"
#include "constants/status.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_range.h"
#include "dungeon_util.h"

View File

@@ -39,9 +39,7 @@ extern void ExpandPlaceholdersBuffer(u8 *, const u8 *, ...);
extern s32 sub_8090FEC(s32 a1, u8* a2, u8 a3);
extern void sub_80073B8(u32);
extern u32 sub_8097DF0(char *, struct subStruct_203B240 **);
extern void InitPokemonMove(void*, u16); // first arg is some struct
extern void sub_80078A4(u32, u32, u32, u32, u32);
extern u32 GetMoveType(void*);
extern u8* GetUnformattedTypeString(s16);
extern void sub_80073E0(u32);
extern void xxx_format_and_draw(u32, u32, u8 *, u32, u32);

View File

@@ -99,7 +99,7 @@ void sub_80928C0(u8 *buffer, struct PokemonMove *move, struct unkStruct_80928C0
ExpandPlaceholdersBuffer
(buffer,gUnknown_81098EC,uVar2,move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C,
gMovesData[move->moveID].namePointer,localBuffer,param_3->unk4,
move->pp,maxPP);
move->PP,maxPP);
break;
case 2:
@@ -107,7 +107,7 @@ void sub_80928C0(u8 *buffer, struct PokemonMove *move, struct unkStruct_80928C0
ExpandPlaceholdersBuffer
(buffer,gUnknown_8109910,uVar2,move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C,
gMovesData[move->moveID].namePointer,localBuffer,param_3->unk4,
move->pp,maxPP);
move->PP,maxPP);
break;
case 3:
@@ -115,7 +115,7 @@ void sub_80928C0(u8 *buffer, struct PokemonMove *move, struct unkStruct_80928C0
ExpandPlaceholdersBuffer
(buffer,gUnknown_81098EC,uVar2,move->moveFlags & MOVE_FLAG_ENABLED ? gUnknown_8109928 : gUnknown_810990C,
gMovesData[move->moveID].namePointer,localBuffer,param_3->unk4,
move->pp,maxPP);
move->PP,maxPP);
break;
case 4:
@@ -123,7 +123,7 @@ void sub_80928C0(u8 *buffer, struct PokemonMove *move, struct unkStruct_80928C0
ExpandPlaceholdersBuffer
(buffer,gUnknown_8109910,uVar2, move->moveFlags & MOVE_FLAG_ENABLED ? gUnknown_8109928 : gUnknown_810990C,
gMovesData[move->moveID].namePointer,localBuffer,param_3->unk4,
move->pp,maxPP);
move->PP,maxPP);
break;
}
}
@@ -133,7 +133,7 @@ void InitPokemonMove(struct PokemonMove *move, u16 moveID)
move->moveFlags = MOVE_FLAG_ENABLED | MOVE_FLAG_EXISTS;
move->sealed = FALSE;
move->moveID = moveID;
move->pp = GetMoveMaxPP(move);
move->PP = GetMoveMaxPP(move);
move->powerBoost = 0;
}
@@ -146,7 +146,7 @@ void sub_8092AA8(struct PokemonMove *move, u16 moveID)
move->moveFlags = MOVE_FLAG_ENABLED | MOVE_FLAG_EXISTS;
move->sealed = FALSE;
move->moveID = moveID;
move->pp = GetMoveMaxPP(move);
move->PP = GetMoveMaxPP(move);
move->powerBoost = 0;
}
}
@@ -155,12 +155,12 @@ void InitZeroedPPPokemonMove(struct PokemonMove *move, u16 moveID)
{
move->moveFlags = MOVE_FLAG_ENABLED | MOVE_FLAG_EXISTS;
move->moveID = moveID;
move->pp = 0;
move->PP = 0;
}
s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 r1)
s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 isAI)
{
return gMovesData[move->moveID].targetingFlags[r1];
return gMovesData[move->moveID].targetingFlags[isAI];
}
u8 GetMoveType(struct PokemonMove *move)
@@ -271,12 +271,12 @@ u8 GetMoveCriticalHitChance(struct PokemonMove *move)
return gMovesData[move->moveID].criticalHitChance;
}
u8 GetMoveCannotHitFrozen(struct PokemonMove *move)
bool8 MoveCannotHitFrozen(struct PokemonMove *move)
{
return gMovesData[move->moveID].cannotHitFrozen;
}
u8 GetMoveDealsDirectDamage(struct PokemonMove *move)
bool8 MoveDealsDirectDamage(struct PokemonMove *move)
{
return gMovesData[move->moveID].dealsDirectDamage;
}

View File

@@ -7,14 +7,14 @@ void SavePokemonMove(struct unkStruct_8094924 *r0, struct PokemonMove *move)
{
SaveIntegerBits(r0, &move->moveFlags, 4);
SaveIntegerBits(r0, &move->moveID, 9);
SaveIntegerBits(r0, &move->pp, 7);
SaveIntegerBits(r0, &move->PP, 7);
}
void RestorePokemonMove(struct unkStruct_8094924 *r0, struct PokemonMove *move)
{
RestoreIntegerBits(r0, &move->moveFlags, 4);
RestoreIntegerBits(r0, &move->moveID, 9);
RestoreIntegerBits(r0, &move->pp, 7);
RestoreIntegerBits(r0, &move->PP, 7);
}
void SavePokemonMoves(struct unkStruct_8094924 *r0, struct PokemonMove *moveSet)
@@ -40,7 +40,7 @@ void sub_8094148(struct unkStruct_8094924 *r0, struct PokemonMove *move)
SaveIntegerBits(r0, &move->moveFlags, 4);
SaveIntegerBits(r0, &move->sealed, 1);
SaveIntegerBits(r0, &move->moveID, 9);
SaveIntegerBits(r0, &move->pp, 7);
SaveIntegerBits(r0, &move->PP, 7);
SaveIntegerBits(r0, &move->powerBoost, 7);
}
@@ -61,7 +61,7 @@ void sub_80941B0(struct unkStruct_8094924 *r0, struct PokemonMove *move)
RestoreIntegerBits(r0, &move->moveFlags, 4);
RestoreIntegerBits(r0, &move->sealed, 1);
RestoreIntegerBits(r0, &move->moveID, 9);
RestoreIntegerBits(r0, &move->pp, 7);
RestoreIntegerBits(r0, &move->PP, 7);
RestoreIntegerBits(r0, &move->powerBoost, 7);
}

View File

@@ -47,7 +47,6 @@ extern s16 gUnknown_810AC66; // 0x8
// 2, 4, 6, 7, 8, 9, 0xA, 0xD, 0xF, 0x11
extern s32 gUnknown_810AC90[10];
extern void SetIQSkill(u8 *, u32);
extern void AddSprite(u16 *, u32, u32, u32);
extern void xxx_save_poke_sub_4_80902F4(struct unkStruct_8094924*, struct unkPokeSubStruct_4*);

View File

@@ -6,9 +6,12 @@
#include "constants/status.h"
#include "code_80521D0.h"
#include "dungeon_action.h"
#include "dungeon_ai_attack.h"
#include "dungeon_capabilities_1.h"
#include "dungeon_random.h"
const s16 gConfusedAttackChance = 70;
extern char *gPtrFrozenMessage;
extern char *gPtrWrappedAroundMessage;
extern char *gPtrWrappedByMessage;
@@ -18,7 +21,6 @@ extern char *gPtrInfatuatedMessage;
extern char gAvailablePokemonNames[];
extern void SetMessageArgument(char[], struct DungeonEntity*, u32);
extern void DecideAttack(struct DungeonEntity*);
bool8 HasStatusAffectingActions(struct DungeonEntity *pokemon)
{

11
src/targeting.c Normal file
View File

@@ -0,0 +1,11 @@
#include "global.h"
#include "targeting.h"
#include "dungeon_util.h"
void TargetTileInFront(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
pokemonData->targetPosition.x = pokemon->posWorld.x + gAdjacentTileOffsets[pokemonData->action.facingDir].x;
pokemonData->targetPosition.y = pokemon->posWorld.y + gAdjacentTileOffsets[pokemonData->action.facingDir].y;
}

16
src/targeting_flags.c Normal file
View File

@@ -0,0 +1,16 @@
#include "global.h"
#include "targeting_flags.h"
#include "constants/move_id.h"
#include "constants/type.h"
#include "dungeon_pokemon_attributes.h"
#include "moves.h"
s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, u32 isAI)
{
if (move->moveID == MOVE_CURSE && !isAI && !HasType(pokemon, TYPE_GHOST))
{
return TARGETING_FLAG_BOOST_SELF | TARGETING_FLAG_TARGET_SELF;
}
return GetMoveTargetingFlags(move, isAI);
}

View File

@@ -846,7 +846,7 @@ gUnknown_202F32C = .; /* 202F32C */
gUnknown_202F32D = .; /* 202F32D */
. += 0x3;
gPotentialTargetDirections = .; /* 202F330 */
gPotentialItemTargetDirections = .; /* 202F330 */
. += 0x20;
gTargetAhead = .; /* 202F350 */
@@ -861,13 +861,13 @@ gUnknown_202F378 = .; /* 202F378 */
gCanAttackInDirection = .; /* 202F380 */
. += 0x8;
gUnknown_202F388 = .; /* 202F388 */
gPotentialAttackTargetDirections = .; /* 202F388 */
. += 0x8;
gPotentialTargetWeights_2 = .; /* 202F390 */
. += 0x20;
gUnknown_202F3B0 = .; /* 202F3B0 */
gPotentialTargets = .; /* 202F3B0 */
. += 0x20;
gUnknown_202F3D0 = .; /* 202F3D0 */