mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
more renaming
This commit is contained in:
parent
157b88b6db
commit
c3c13d0acf
@ -1830,13 +1830,13 @@ GetBankPosition: @ 80A6A44
|
||||
.pool
|
||||
thumb_func_end GetBankPosition
|
||||
|
||||
thumb_func_start GetBankByIdentity
|
||||
GetBankByIdentity: @ 80A6A54
|
||||
thumb_func_start GetBankByPosition
|
||||
GetBankByPosition: @ 80A6A54
|
||||
push {r4,lr}
|
||||
lsls r0, 24
|
||||
lsrs r3, r0, 24
|
||||
movs r1, 0
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r2, [r0]
|
||||
cmp r1, r2
|
||||
bcs _080A6A7E
|
||||
@ -1860,7 +1860,7 @@ _080A6A7E:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end GetBankByIdentity
|
||||
thumb_func_end GetBankByPosition
|
||||
|
||||
thumb_func_start IsBankSpritePresent
|
||||
IsBankSpritePresent: @ 80A6A90
|
||||
@ -3496,7 +3496,7 @@ _080A76F2:
|
||||
cmp r5, 0
|
||||
beq _080A771A
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl IsAnimBankSpriteVisible
|
||||
@ -3504,7 +3504,7 @@ _080A76F2:
|
||||
cmp r0, 0
|
||||
beq _080A771A
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r0, 0x10
|
||||
@ -3514,7 +3514,7 @@ _080A771A:
|
||||
cmp r6, 0
|
||||
beq _080A7746
|
||||
movs r0, 0x2
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl IsAnimBankSpriteVisible
|
||||
@ -3522,7 +3522,7 @@ _080A771A:
|
||||
cmp r0, 0
|
||||
beq _080A7746
|
||||
movs r0, 0x2
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r1, r0, 0
|
||||
@ -3534,7 +3534,7 @@ _080A7746:
|
||||
cmp r7, 0
|
||||
beq _080A7772
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl IsAnimBankSpriteVisible
|
||||
@ -3542,7 +3542,7 @@ _080A7746:
|
||||
cmp r0, 0
|
||||
beq _080A7772
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r1, r0, 0
|
||||
@ -3555,7 +3555,7 @@ _080A7772:
|
||||
cmp r0, 0
|
||||
beq _080A77A0
|
||||
movs r0, 0x3
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl IsAnimBankSpriteVisible
|
||||
@ -3563,7 +3563,7 @@ _080A7772:
|
||||
cmp r0, 0
|
||||
beq _080A77A0
|
||||
movs r0, 0x3
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r1, r0, 0
|
||||
@ -3592,7 +3592,7 @@ sub_80A77B4: @ 80A77B4
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
@ -4959,7 +4959,7 @@ _080A825C:
|
||||
sub_80A8278: @ 80A8278
|
||||
push {r4-r6,lr}
|
||||
movs r5, 0
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r0, [r0]
|
||||
cmp r5, r0
|
||||
bge _080A82D2
|
||||
@ -4998,7 +4998,7 @@ _080A8286:
|
||||
strb r2, [r0, 0x5]
|
||||
_080A82C8:
|
||||
adds r5, 0x1
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r0, [r0]
|
||||
cmp r5, r0
|
||||
blt _080A8286
|
||||
|
@ -200,7 +200,7 @@ _080D5320:
|
||||
_080D5324:
|
||||
movs r0, 0x3
|
||||
_080D5326:
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
adds r0, r4, 0
|
||||
|
@ -7539,7 +7539,7 @@ sub_8102434: @ 8102434
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
movs r4, 0
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r0, [r0]
|
||||
cmp r4, r0
|
||||
bcs _08102490
|
||||
@ -7576,7 +7576,7 @@ _08102482:
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r0, [r0]
|
||||
cmp r4, r0
|
||||
bcc _08102448
|
||||
@ -7605,7 +7605,7 @@ _081024B2:
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
_081024C2:
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r0, [r0]
|
||||
cmp r4, r0
|
||||
bcc _081024B2
|
||||
@ -21049,14 +21049,14 @@ sub_8109198: @ 8109198
|
||||
cmp r4, r0
|
||||
bne _081091DE
|
||||
movs r0, 0x2
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldrb r1, [r5]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r1, r0
|
||||
beq _081091D6
|
||||
movs r0, 0x3
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldrb r1, [r5]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -28050,7 +28050,7 @@ sub_810C9E4: @ 810C9E4
|
||||
ldrh r0, [r4, 0x2]
|
||||
lsls r0, 20
|
||||
lsrs r0, 24
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
adds r0, r5, 0
|
||||
@ -33064,7 +33064,7 @@ _0810F212:
|
||||
bne _0810F2B8
|
||||
_0810F22E:
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
adds r7, r4, 0
|
||||
@ -33193,7 +33193,7 @@ sub_810F340: @ 810F340
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
movs r1, 0x3C
|
||||
@ -33370,7 +33370,7 @@ sub_810F46C: @ 810F46C
|
||||
cmp r0, 0
|
||||
bne _0810F502
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
adds r6, r4, 0
|
||||
@ -33441,7 +33441,7 @@ sub_810F524: @ 810F524
|
||||
cmp r0, 0
|
||||
bne _0810F57C
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r4, r0, 0
|
||||
@ -43586,7 +43586,7 @@ _08114902:
|
||||
beq _0811492E
|
||||
_08114908:
|
||||
adds r0, r4, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
adds r0, r4, 0
|
||||
@ -45846,7 +45846,7 @@ sub_8115B0C: @ 8115B0C
|
||||
strh r1, [r0, 0x12]
|
||||
strh r5, [r0, 0x18]
|
||||
movs r4, 0
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r1, [r0]
|
||||
mov r9, r3
|
||||
mov r8, r2
|
||||
@ -46650,7 +46650,7 @@ _0811618A:
|
||||
cmp r0, 0x1
|
||||
bhi _081161DC
|
||||
movs r4, 0
|
||||
ldr r5, =gNoOfAllBanks
|
||||
ldr r5, =gBattleBanksCount
|
||||
ldrb r0, [r5]
|
||||
cmp r4, r0
|
||||
bcs _081161DC
|
||||
@ -50065,7 +50065,7 @@ sub_8117E94: @ 8117E94
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r2, =gAnimBankAttacker
|
||||
ldr r1, =gBankTarget
|
||||
ldr r1, =gBankDefender
|
||||
ldrb r1, [r1]
|
||||
strb r1, [r2]
|
||||
ldr r2, =gAnimBankTarget
|
||||
@ -50117,7 +50117,7 @@ sub_8117F10: @ 8117F10
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r2, =gAnimBankTarget
|
||||
ldr r1, =gBankTarget
|
||||
ldr r1, =gBankDefender
|
||||
ldrb r1, [r1]
|
||||
strb r1, [r2]
|
||||
bl DestroyAnimVisualTask
|
||||
@ -52078,7 +52078,7 @@ sub_8118FBC: @ 8118FBC
|
||||
lsls r5, 16
|
||||
lsrs r5, 16
|
||||
adds r0, r4, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r1, =gMonSpritesGfxPtr
|
||||
|
@ -1283,7 +1283,7 @@ _08170F54:
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl sub_80A82E4
|
||||
@ -1335,7 +1335,7 @@ _08170F54:
|
||||
ldr r0, =SpriteCallbackDummy
|
||||
str r0, [r4]
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldr r1, =gBankSpriteIds
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -1371,7 +1371,7 @@ sub_8171030: @ 8171030
|
||||
lsrs r5, r0, 24
|
||||
ldr r6, =gSprites
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldr r1, =gBankSpriteIds
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -1422,7 +1422,7 @@ sub_81710A8: @ 81710A8
|
||||
lsrs r5, r0, 24
|
||||
ldr r6, =gSprites
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldr r4, =gBankSpriteIds
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -1438,7 +1438,7 @@ sub_81710A8: @ 81710A8
|
||||
cmp r0, 0
|
||||
bge _081710F4
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r0, r4
|
||||
@ -5575,7 +5575,7 @@ sub_817330C: @ 817330C
|
||||
movs r0, 0x1E
|
||||
strh r0, [r4, 0x2E]
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r1, 0
|
||||
@ -5587,7 +5587,7 @@ sub_817330C: @ 817330C
|
||||
adds r0, r1
|
||||
strh r0, [r4, 0x32]
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
movs r1, 0x1
|
||||
@ -5732,7 +5732,7 @@ sub_817345C: @ 817345C
|
||||
.pool
|
||||
_08173478:
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldr r1, =gAnimBankAttacker
|
||||
strb r0, [r1]
|
||||
movs r0, 0x1
|
||||
@ -5740,12 +5740,12 @@ _08173478:
|
||||
.pool
|
||||
_0817348C:
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldr r1, =gAnimBankAttacker
|
||||
strb r0, [r1]
|
||||
movs r0, 0
|
||||
_08173498:
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
ldr r1, =gAnimBankTarget
|
||||
strb r0, [r1]
|
||||
_081734A0:
|
||||
|
@ -21034,7 +21034,7 @@ sub_81A5718: @ 81A5718
|
||||
b _081A57D8
|
||||
.pool
|
||||
_081A576C:
|
||||
ldr r0, =gBattleMoveFlags
|
||||
ldr r0, =gMoveResultFlags
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x29
|
||||
ands r0, r1
|
||||
|
@ -39,7 +39,7 @@ _0817C988:
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
@ -83,7 +83,7 @@ _0817CA10:
|
||||
str r1, [sp, 0x8]
|
||||
cmp r6, 0
|
||||
bne _0817CA3C
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 1
|
||||
adds r0, r2
|
||||
@ -94,7 +94,7 @@ _0817CA10:
|
||||
b _0817CA4C
|
||||
.pool
|
||||
_0817CA3C:
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 1
|
||||
adds r0, r2
|
||||
@ -140,7 +140,7 @@ _0817CA9C:
|
||||
lsls r0, 24
|
||||
lsrs r0, 25
|
||||
mov r8, r0
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
bl GetBankPosition
|
||||
lsls r0, 24
|
||||
@ -941,7 +941,7 @@ _0817D3F2:
|
||||
bl _0817E0A6
|
||||
_0817D3FE:
|
||||
ldr r0, =gBankAttacker
|
||||
ldr r1, =gBankTarget
|
||||
ldr r1, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
ldrb r1, [r1]
|
||||
cmp r0, r1
|
||||
@ -2564,7 +2564,7 @@ _0817E122:
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r9, r0
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
@ -3249,7 +3249,7 @@ sub_817E684: @ 817E684
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
@ -3714,7 +3714,7 @@ sub_817EA80: @ 817EA80
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
bl GetBankSide
|
||||
lsls r0, 24
|
||||
@ -4291,7 +4291,7 @@ _0817EEF8:
|
||||
bgt _0817EF10
|
||||
b _0817F1FA
|
||||
_0817EF10:
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
muls r0, r1
|
||||
adds r0, r5
|
||||
@ -4386,7 +4386,7 @@ _0817EF98:
|
||||
mov r10, r3
|
||||
mov r8, r0
|
||||
add r7, sp, 0x10
|
||||
ldr r4, =gBankTarget
|
||||
ldr r4, =gBankDefender
|
||||
mov r9, r4
|
||||
_0817EFC2:
|
||||
lsls r1, r5, 1
|
||||
@ -4411,7 +4411,7 @@ _0817EFC2:
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0817F0B4
|
||||
ldr r4, =gSideAffecting
|
||||
ldr r4, =gSideStatuses
|
||||
mov r1, r9
|
||||
ldrb r0, [r1]
|
||||
bl GetBankPosition
|
||||
@ -4545,7 +4545,7 @@ _0817F0D8:
|
||||
movs r7, 0
|
||||
_0817F0F6:
|
||||
movs r5, 0
|
||||
ldr r4, =gBankTarget
|
||||
ldr r4, =gBankDefender
|
||||
ldr r6, =gEnemyParty
|
||||
ldr r0, =gBankAttacker
|
||||
ldrb r0, [r0]
|
||||
|
@ -1060,7 +1060,7 @@ _080D8004:
|
||||
str r4, [r0]
|
||||
ldr r4, =gBankAttacker
|
||||
strb r2, [r4]
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
strb r3, [r0]
|
||||
bl sub_80DB0C4
|
||||
ldr r2, =gBankSpriteIds
|
||||
@ -13798,7 +13798,7 @@ sub_80DEA20: @ 80DEA20
|
||||
bl CreateInvisibleSpriteWithCallback
|
||||
ldr r1, =gBankSpriteIds
|
||||
strb r0, [r1, 0x3]
|
||||
ldr r0, =gBankTarget
|
||||
ldr r0, =gBankDefender
|
||||
ldrb r0, [r0]
|
||||
adds r0, r1
|
||||
ldrb r1, [r0]
|
||||
@ -13905,12 +13905,12 @@ _080DEAD0:
|
||||
.4byte _080DEB60
|
||||
.4byte _080DEB60
|
||||
_080DEB54:
|
||||
ldr r1, =gBankTarget
|
||||
ldr r1, =gBankDefender
|
||||
movs r0, 0x2
|
||||
b _080DEB64
|
||||
.pool
|
||||
_080DEB60:
|
||||
ldr r1, =gBankTarget
|
||||
ldr r1, =gBankDefender
|
||||
movs r0, 0x3
|
||||
_080DEB64:
|
||||
strb r0, [r1]
|
||||
|
@ -1389,7 +1389,7 @@
|
||||
.endm
|
||||
|
||||
.macro jumpifmovehadnoeffect jumpptr
|
||||
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, \jumpptr
|
||||
jumpifbyte COMMON_BITS, gMoveResultFlags, MOVE_RESULT_NO_EFFECT, \jumpptr
|
||||
.endm
|
||||
|
||||
.macro jumpifbattletype flags, jumpptr
|
||||
|
@ -16060,7 +16060,7 @@ _081B8B1E:
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
_081B8B24:
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r0, [r0]
|
||||
cmp r4, r0
|
||||
bcc _081B8AFC
|
||||
@ -16228,7 +16228,7 @@ _081B8CBE:
|
||||
bne _081B8CFC
|
||||
movs r5, 0x1
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
mov r2, sp
|
||||
ldr r1, =gBattlePartyID
|
||||
lsls r0, 24
|
||||
@ -16255,7 +16255,7 @@ _081B8CF0:
|
||||
_081B8CFC:
|
||||
movs r5, 0x2
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
mov r1, sp
|
||||
ldr r4, =gBattlePartyID
|
||||
lsls r0, 24
|
||||
@ -16264,7 +16264,7 @@ _081B8CFC:
|
||||
ldrh r0, [r0]
|
||||
strb r0, [r1]
|
||||
movs r0, 0x2
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
mov r1, sp
|
||||
lsls r0, 24
|
||||
lsrs r0, 23
|
||||
@ -16344,19 +16344,19 @@ sub_81B8D88: @ 81B8D88
|
||||
cmp r0, 0
|
||||
bne _081B8DB0
|
||||
movs r0, 0
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
movs r0, 0x2
|
||||
b _081B8DBC
|
||||
_081B8DB0:
|
||||
movs r0, 0x1
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
movs r0, 0x3
|
||||
_081B8DBC:
|
||||
bl GetBankByIdentity
|
||||
bl GetBankByPosition
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
bl sub_81B1250
|
||||
|
@ -124,7 +124,7 @@ _0806BDC4:
|
||||
orrs r1, r0
|
||||
lsrs r1, 31
|
||||
str r1, [sp, 0x1C]
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldr r4, [sp, 0xC]
|
||||
subs r4, 0xD
|
||||
ldrb r0, [r0]
|
||||
@ -148,7 +148,7 @@ _0806BE3C:
|
||||
ldr r1, [sp, 0x1C]
|
||||
adds r1, 0x2
|
||||
str r1, [sp, 0x1C]
|
||||
ldr r0, =gNoOfAllBanks
|
||||
ldr r0, =gBattleBanksCount
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
bge _0806BE70
|
||||
|
@ -51,15 +51,15 @@
|
||||
.set B_POSITION_OPPONENT_RIGHT, 3
|
||||
|
||||
@ status 1
|
||||
.set STATUS_SLEEP, 0x7
|
||||
.set STATUS_POISON, 0x8
|
||||
.set STATUS_BURN, 0x10
|
||||
.set STATUS_FREEZE, 0x20
|
||||
.set STATUS_PARALYSIS, 0x40
|
||||
.set STATUS_TOXIC_POISON, 0x80
|
||||
.set STATUS_TOXIC_COUNTER, 0xF00
|
||||
.set STATUS1_SLEEP, 0x7
|
||||
.set STATUS1_POISON, 0x8
|
||||
.set STATUS1_BURN, 0x10
|
||||
.set STATUS1_FREEZE, 0x20
|
||||
.set STATUS1_PARALYSIS, 0x40
|
||||
.set STATUS1_TOXIC_POISON, 0x80
|
||||
.set STATUS1_TOXIC_COUNTER, 0xF00
|
||||
|
||||
.set STATUS_ANY, STATUS_SLEEP | STATUS_POISON | STATUS_BURN | STATUS_FREEZE | STATUS_PARALYSIS | STATUS_TOXIC_POISON
|
||||
.set STATUS1_ANY, STATUS1_SLEEP | STATUS1_POISON | STATUS1_BURN | STATUS1_FREEZE | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON
|
||||
|
||||
@ status 2
|
||||
.set STATUS2_CONFUSION, 0x00000007
|
||||
@ -160,11 +160,12 @@
|
||||
.set HITMARKER_x8000000, 0x08000000
|
||||
|
||||
@ move flags
|
||||
.set MOVESTATUS_MISSED, 0x1
|
||||
.set MOVESTATUS_SUPEREFFECTIVE, 0x2
|
||||
.set MOVESTATUS_NOTVERYEFFECTIVE, 0x4
|
||||
.set MOVESTATUS_NOTAFFECTED, 0x8
|
||||
.set MOVESTATUS_ONEHITKO, 0x10
|
||||
.set MOVESTATUS_FAILED, 0x20
|
||||
.set MOVESTATUS_ENDURED, 0x40
|
||||
.set MOVESTATUS_HUNGON, 0x80
|
||||
.set MOVE_RESULT_MISSED, 0x1
|
||||
.set MOVE_RESULT_SUPER_EFFECTIVE, 0x2
|
||||
.set MOVE_RESULT_NOT_VERY_EFFECTIVE, 0x4
|
||||
.set MOVE_RESULT_DOESNT_AFFECT_FOE, 0x8
|
||||
.set MOVE_RESULT_ONE_HIT_KO, 0x10
|
||||
.set MOVE_RESULT_FAILED, 0x20
|
||||
.set MOVE_RESULT_FOE_ENDURED, 0x40
|
||||
.set MOVE_RESULT_FOE_HUNG_ON, 0x80
|
||||
.set MOVE_RESULT_NO_EFFECT, (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED)
|
||||
|
@ -218,7 +218,7 @@ BattleAIScript_82DC2D4:
|
||||
get_ability AI_TARGET
|
||||
if_equal ABILITY_INSOMNIA, Score_Minus10
|
||||
if_equal ABILITY_VITAL_SPIRIT, Score_Minus10
|
||||
if_status AI_TARGET, STATUS_ANY, Score_Minus10
|
||||
if_status AI_TARGET, STATUS1_ANY, Score_Minus10
|
||||
if_side_affecting AI_TARGET, SIDE_STATUS_SAFEGUARD, Score_Minus10
|
||||
end
|
||||
|
||||
@ -237,11 +237,11 @@ BattleAIScript_82DC31A:
|
||||
|
||||
BattleAIScript_82DC31B:
|
||||
if_status2 AI_TARGET, STATUS2_NIGHTMARE, Score_Minus10
|
||||
if_not_status AI_TARGET, STATUS_SLEEP, Score_Minus8
|
||||
if_not_status AI_TARGET, STATUS1_SLEEP, Score_Minus8
|
||||
end
|
||||
|
||||
BattleAIScript_82DC330:
|
||||
if_not_status AI_TARGET, STATUS_SLEEP, Score_Minus8
|
||||
if_not_status AI_TARGET, STATUS1_SLEEP, Score_Minus8
|
||||
if_type_effectiveness AI_EFFECTIVENESS_x0, Score_Minus10
|
||||
end
|
||||
|
||||
@ -350,7 +350,7 @@ BattleAIScript_82DC48C:
|
||||
if_equal TYPE_POISON, Score_Minus10
|
||||
get_ability AI_TARGET
|
||||
if_equal ABILITY_IMMUNITY, Score_Minus10
|
||||
if_status AI_TARGET, STATUS_ANY, Score_Minus10
|
||||
if_status AI_TARGET, STATUS1_ANY, Score_Minus10
|
||||
if_side_affecting AI_TARGET, SIDE_STATUS_SAFEGUARD, Score_Minus10
|
||||
end
|
||||
|
||||
@ -402,7 +402,7 @@ BattleAIScript_82DC545:
|
||||
if_type_effectiveness AI_EFFECTIVENESS_x0, Score_Minus10
|
||||
get_ability AI_TARGET
|
||||
if_equal ABILITY_LIMBER, Score_Minus10
|
||||
if_status AI_TARGET, STATUS_ANY, Score_Minus10
|
||||
if_status AI_TARGET, STATUS1_ANY, Score_Minus10
|
||||
if_side_affecting AI_TARGET, SIDE_STATUS_SAFEGUARD, Score_Minus10
|
||||
end
|
||||
|
||||
@ -428,7 +428,7 @@ BattleAIScript_82DC59D:
|
||||
end
|
||||
|
||||
BattleAIScript_82DC5A5:
|
||||
if_not_status AI_USER, STATUS_SLEEP, Score_Minus8
|
||||
if_not_status AI_USER, STATUS1_SLEEP, Score_Minus8
|
||||
end
|
||||
|
||||
BattleAIScript_82DC5B0:
|
||||
@ -536,7 +536,7 @@ BattleAIScript_82DC6A9:
|
||||
BattleAIScript_82DC6B4:
|
||||
get_ability AI_TARGET
|
||||
if_equal ABILITY_WATER_VEIL, Score_Minus10
|
||||
if_status AI_TARGET, STATUS_ANY, Score_Minus10
|
||||
if_status AI_TARGET, STATUS1_ANY, Score_Minus10
|
||||
if_type_effectiveness AI_EFFECTIVENESS_x0, Score_Minus10
|
||||
if_type_effectiveness AI_EFFECTIVENESS_x0_5, Score_Minus10
|
||||
if_type_effectiveness AI_EFFECTIVENESS_x0_25, Score_Minus10
|
||||
@ -566,7 +566,7 @@ BattleAIScript_82DC708:
|
||||
end
|
||||
|
||||
BattleAIScript_82DC713:
|
||||
if_not_status AI_USER, STATUS_POISON | STATUS_BURN | STATUS_PARALYSIS | STATUS_TOXIC_POISON, Score_Minus10
|
||||
if_not_status AI_USER, STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON, Score_Minus10
|
||||
end
|
||||
|
||||
BattleAIScript_82DC71E:
|
||||
@ -1076,7 +1076,7 @@ BattleAIScript_82DCD3D:
|
||||
score -1
|
||||
|
||||
BattleAIScript_82DCD4D:
|
||||
if_not_status AI_TARGET, STATUS_TOXIC_POISON, BattleAIScript_82DCD6C
|
||||
if_not_status AI_TARGET, STATUS1_TOXIC_POISON, BattleAIScript_82DCD6C
|
||||
if_hp_more_than AI_USER, 50, BattleAIScript_82DCD64
|
||||
if_random_less_than 80, BattleAIScript_82DCD6C
|
||||
|
||||
@ -1263,7 +1263,7 @@ BattleAIScript_82DCF22:
|
||||
score -2
|
||||
|
||||
BattleAIScript_82DCF32:
|
||||
if_not_status AI_TARGET, STATUS_TOXIC_POISON, BattleAIScript_82DCF44
|
||||
if_not_status AI_TARGET, STATUS1_TOXIC_POISON, BattleAIScript_82DCF44
|
||||
if_random_less_than 70, BattleAIScript_82DCF44
|
||||
score +2
|
||||
|
||||
@ -1520,7 +1520,7 @@ BattleAIScript_82DD228:
|
||||
end
|
||||
|
||||
BattleAIScript_82DD229:
|
||||
if_status AI_TARGET, STATUS_TOXIC_POISON, BattleAIScript_82DD256
|
||||
if_status AI_TARGET, STATUS1_TOXIC_POISON, BattleAIScript_82DD256
|
||||
if_status2 AI_TARGET, STATUS2_CURSED, BattleAIScript_82DD256
|
||||
if_status3 AI_TARGET, STATUS3_PERISH_SONG, BattleAIScript_82DD256
|
||||
if_status2 AI_TARGET, STATUS2_INFATUATION, BattleAIScript_82DD256
|
||||
@ -1673,7 +1673,7 @@ BattleAIScript_82DD381:
|
||||
goto BattleAIScript_82DD3E9
|
||||
|
||||
BattleAIScript_82DD3B9:
|
||||
if_not_status AI_TARGET, STATUS_ANY, BattleAIScript_82DD3E1
|
||||
if_not_status AI_TARGET, STATUS1_ANY, BattleAIScript_82DD3E1
|
||||
goto BattleAIScript_82DD3E9
|
||||
|
||||
BattleAIScript_82DD3C8:
|
||||
@ -1722,7 +1722,7 @@ BattleAIScript_82DD430:
|
||||
end
|
||||
|
||||
BattleAIScript_82DD431:
|
||||
if_status AI_TARGET, STATUS_SLEEP, BattleAIScript_82DD4D6
|
||||
if_status AI_TARGET, STATUS1_SLEEP, BattleAIScript_82DD4D6
|
||||
if_status2 AI_TARGET, STATUS2_INFATUATION, BattleAIScript_82DD4D6
|
||||
if_status2 AI_TARGET, STATUS2_CONFUSION, BattleAIScript_82DD4D6
|
||||
if_hp_more_than AI_USER, 30, BattleAIScript_82DD45E
|
||||
@ -1901,7 +1901,7 @@ BattleAIScript_82DD582:
|
||||
end
|
||||
|
||||
BattleAIScript_82DD583:
|
||||
if_status AI_USER, STATUS_SLEEP, Score_Plus10
|
||||
if_status AI_USER, STATUS1_SLEEP, Score_Plus10
|
||||
score -5
|
||||
end
|
||||
|
||||
@ -1952,8 +1952,8 @@ BattleAIScript_82DD60A:
|
||||
end
|
||||
|
||||
BattleAIScript_82DD60B:
|
||||
if_status AI_TARGET, STATUS_ANY, BattleAIScript_82DD621
|
||||
if_status_in_party AI_TARGET, STATUS_ANY, BattleAIScript_82DD621
|
||||
if_status AI_TARGET, STATUS1_ANY, BattleAIScript_82DD621
|
||||
if_status_in_party AI_TARGET, STATUS1_ANY, BattleAIScript_82DD621
|
||||
score -5
|
||||
|
||||
BattleAIScript_82DD621:
|
||||
@ -2012,7 +2012,7 @@ BattleAIScript_82DD693:
|
||||
BattleAIScript_82DD694:
|
||||
get_protect_count AI_USER
|
||||
if_more_than 1, BattleAIScript_82DD75A
|
||||
if_status AI_USER, STATUS_TOXIC_POISON, BattleAIScript_82DD751
|
||||
if_status AI_USER, STATUS1_TOXIC_POISON, BattleAIScript_82DD751
|
||||
if_status2 AI_USER, STATUS2_CURSED, BattleAIScript_82DD751
|
||||
if_status3 AI_USER, STATUS3_PERISH_SONG, BattleAIScript_82DD751
|
||||
if_status2 AI_USER, STATUS2_INFATUATION, BattleAIScript_82DD751
|
||||
@ -2020,7 +2020,7 @@ BattleAIScript_82DD694:
|
||||
if_status3 AI_USER, STATUS3_YAWN, BattleAIScript_82DD751
|
||||
if_has_move_with_effect AI_TARGET, EFFECT_RESTORE_HP, BattleAIScript_82DD751
|
||||
if_has_move_with_effect AI_TARGET, EFFECT_DEFENSE_CURL, BattleAIScript_82DD751
|
||||
if_status AI_TARGET, STATUS_TOXIC_POISON, BattleAIScript_82DD730
|
||||
if_status AI_TARGET, STATUS1_TOXIC_POISON, BattleAIScript_82DD730
|
||||
if_status2 AI_TARGET, STATUS2_CURSED, BattleAIScript_82DD730
|
||||
if_status3 AI_TARGET, STATUS3_PERISH_SONG, BattleAIScript_82DD730
|
||||
if_status2 AI_TARGET, STATUS2_INFATUATION, BattleAIScript_82DD730
|
||||
@ -2238,7 +2238,7 @@ BattleAIScript_82DD959:
|
||||
end
|
||||
|
||||
BattleAIScript_82DD95A:
|
||||
if_status AI_TARGET, STATUS_SLEEP, BattleAIScript_82DD9FF
|
||||
if_status AI_TARGET, STATUS1_SLEEP, BattleAIScript_82DD9FF
|
||||
if_status2 AI_TARGET, STATUS2_INFATUATION, BattleAIScript_82DD9FF
|
||||
if_status2 AI_TARGET, STATUS2_CONFUSION, BattleAIScript_82DD9FF
|
||||
if_hp_more_than AI_USER, 30, BattleAIScript_82DD987
|
||||
@ -2323,7 +2323,7 @@ BattleAIScript_82DDA2F:
|
||||
goto BattleAIScript_82DDAB4
|
||||
|
||||
BattleAIScript_82DDA3D:
|
||||
if_status AI_TARGET, STATUS_TOXIC_POISON, BattleAIScript_82DDAAC
|
||||
if_status AI_TARGET, STATUS1_TOXIC_POISON, BattleAIScript_82DDAAC
|
||||
if_status2 AI_TARGET, STATUS2_CURSED, BattleAIScript_82DDAAC
|
||||
if_status3 AI_TARGET, STATUS3_LEECHSEED, BattleAIScript_82DDAAC
|
||||
get_weather
|
||||
@ -2396,7 +2396,7 @@ BattleAIScript_82DDAF5:
|
||||
end
|
||||
|
||||
BattleAIScript_82DDAF6:
|
||||
if_not_status AI_TARGET, STATUS_POISON | STATUS_BURN | STATUS_PARALYSIS | STATUS_TOXIC_POISON, BattleAIScript_82DDB02
|
||||
if_not_status AI_TARGET, STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON, BattleAIScript_82DDB02
|
||||
score +1
|
||||
|
||||
BattleAIScript_82DDB02:
|
||||
@ -2405,7 +2405,7 @@ BattleAIScript_82DDB02:
|
||||
BattleAIScript_82DDB03:
|
||||
if_type_effectiveness AI_EFFECTIVENESS_x0_25, BattleAIScript_82DDB42
|
||||
if_type_effectiveness AI_EFFECTIVENESS_x0_5, BattleAIScript_82DDB42
|
||||
if_status AI_TARGET, STATUS_SLEEP, BattleAIScript_82DDB59
|
||||
if_status AI_TARGET, STATUS1_SLEEP, BattleAIScript_82DDB59
|
||||
if_status2 AI_TARGET, STATUS2_INFATUATION, BattleAIScript_82DDB49
|
||||
if_status2 AI_TARGET, STATUS2_CONFUSION, BattleAIScript_82DDB49
|
||||
is_first_turn_for AI_USER
|
||||
@ -2429,7 +2429,7 @@ BattleAIScript_82DDB5B:
|
||||
end
|
||||
|
||||
BattleAIScript_82DDB5C:
|
||||
if_status AI_TARGET, STATUS_PARALYSIS, BattleAIScript_82DDB6B
|
||||
if_status AI_TARGET, STATUS1_PARALYSIS, BattleAIScript_82DDB6B
|
||||
goto BattleAIScript_82DDB6D
|
||||
|
||||
BattleAIScript_82DDB6B:
|
||||
@ -2571,7 +2571,7 @@ sItemsTable_82DDC6E:
|
||||
.byte -1
|
||||
|
||||
BattleAIScript_82DDC72:
|
||||
if_status AI_TARGET, STATUS_SLEEP, BattleAIScript_82DDC9D
|
||||
if_status AI_TARGET, STATUS1_SLEEP, BattleAIScript_82DDC9D
|
||||
if_status2 AI_TARGET, STATUS2_INFATUATION, BattleAIScript_82DDC9D
|
||||
if_status2 AI_TARGET, STATUS2_CONFUSION, BattleAIScript_82DDC9D
|
||||
if_random_less_than 180, BattleAIScript_82DDC9D
|
||||
@ -2960,7 +2960,7 @@ BattleAIScript_82DDFED:
|
||||
end
|
||||
|
||||
BattleAIScript_82DDFF5:
|
||||
if_status AI_USER, STATUS_ANY, BattleAIScript_82DE000
|
||||
if_status AI_USER, STATUS1_ANY, BattleAIScript_82DE000
|
||||
end
|
||||
|
||||
BattleAIScript_82DE000:
|
||||
@ -3060,7 +3060,7 @@ BattleAIScript_82DE14A:
|
||||
BattleAIScript_82DE14F:
|
||||
get_ability AI_TARGET
|
||||
if_not_equal ABILITY_GUTS, Score_Minus30_
|
||||
if_status AI_TARGET, STATUS_ANY, Score_Minus30_
|
||||
if_status AI_TARGET, STATUS1_ANY, Score_Minus30_
|
||||
if_hp_less_than AI_USER, 91, Score_Minus30_
|
||||
goto Score_Plus5
|
||||
|
||||
|
@ -286,7 +286,7 @@ BattleScript_MoveEnd::
|
||||
end
|
||||
|
||||
BattleScript_MakeMoveMissed::
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_MISSED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
BattleScript_PrintMoveMissed::
|
||||
attackstring
|
||||
ppreduce
|
||||
@ -303,9 +303,9 @@ BattleScript_EffectSleep::
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS_SLEEP, BattleScript_AlreadyAsleep
|
||||
jumpifstatus TARGET, STATUS1_SLEEP, BattleScript_AlreadyAsleep
|
||||
jumpifcantmakeasleep BattleScript_CantMakeAsleep
|
||||
jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS1_ANY, BattleScript_ButItFailed
|
||||
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
|
||||
jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected
|
||||
attackanimation
|
||||
@ -397,7 +397,7 @@ BattleScript_EffectExplosion::
|
||||
faintifabilitynotdamp
|
||||
setatkhptozero
|
||||
waitstate
|
||||
jumpifbyte NO_COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED, BattleScript_82D8B94
|
||||
jumpifbyte NO_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_MISSED, BattleScript_82D8B94
|
||||
call BattleScript_82D8BEA
|
||||
goto BattleScript_82D8B96
|
||||
BattleScript_82D8B94::
|
||||
@ -436,16 +436,16 @@ BattleScript_82D8BCF::
|
||||
end
|
||||
|
||||
BattleScript_82D8BEA::
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_MISSED
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
attackanimation
|
||||
waitanimation
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_MISSED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
return
|
||||
|
||||
BattleScript_EffectDreamEater::
|
||||
attackcanceler
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_82D8C0E
|
||||
jumpifstatus TARGET, STATUS_SLEEP, BattleScript_82D8C18
|
||||
jumpifstatus TARGET, STATUS1_SLEEP, BattleScript_82D8C18
|
||||
BattleScript_82D8C0E::
|
||||
attackstring
|
||||
ppreduce
|
||||
@ -487,7 +487,7 @@ BattleScript_EffectMirrorMove::
|
||||
pause 0x40
|
||||
trymirrormove
|
||||
ppreduce
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_FAILED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_FAILED
|
||||
printstring STRINGID_MIRRORMOVEFAILED
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
@ -633,7 +633,7 @@ BattleScript_MultiHitLoop::
|
||||
jumpifhasnohp ATTACKER, BattleScript_MultiHitEnd
|
||||
jumpifhasnohp TARGET, BattleScript_MultiHitPrintStrings
|
||||
jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoMultiHit
|
||||
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_MultiHitPrintStrings
|
||||
jumpifstatus ATTACKER, STATUS1_SLEEP, BattleScript_MultiHitPrintStrings
|
||||
BattleScript_DoMultiHit::
|
||||
movevaluescleanup
|
||||
copybyte cEFFECT_CHOOSER, sMULTIHIT_EFFECT
|
||||
@ -656,7 +656,7 @@ BattleScript_DoMultiHit::
|
||||
addbyte sMULTIHIT_STRING + 4, 0x1
|
||||
setbyte sMOVEEND_STATE, 0x0
|
||||
moveend 0x2, 0x10
|
||||
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_ENDURED, BattleScript_MultiHitPrintStrings
|
||||
jumpifbyte COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings
|
||||
decrementmultihit BattleScript_MultiHitLoop
|
||||
goto BattleScript_MultiHitPrintStrings
|
||||
BattleScript_MultiHitNoMoreHits::
|
||||
@ -712,9 +712,9 @@ BattleScript_EffectToxic::
|
||||
ppreduce
|
||||
jumpifability TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpifstatus TARGET, STATUS_TOXIC_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS1_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpifstatus TARGET, STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpifstatus TARGET, STATUS1_ANY, BattleScript_ButItFailed
|
||||
jumpiftype TARGET, TYPE_POISON, BattleScript_NotAffected
|
||||
jumpiftype TARGET, TYPE_STEEL, BattleScript_NotAffected
|
||||
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
|
||||
@ -735,7 +735,7 @@ BattleScript_AlreadyPoisoned::
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_ImmunityProtected::
|
||||
copybyte gEffectBank, gBankTarget
|
||||
copybyte gEffectBank, gBankDefender
|
||||
setbyte cMULTISTRING_CHOOSER, 0x0
|
||||
call BattleScript_PSNPrevention
|
||||
goto BattleScript_MoveEnd
|
||||
@ -759,7 +759,7 @@ BattleScript_EffectRest::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_RestIsAlreadyAsleep
|
||||
jumpifstatus ATTACKER, STATUS1_SLEEP, BattleScript_RestIsAlreadyAsleep
|
||||
jumpifcantmakeasleep BattleScript_RestCantSleep
|
||||
trysetrest BattleScript_AlreadyAtFullHp
|
||||
pause 0x20
|
||||
@ -835,7 +835,7 @@ BattleScript_EffectSuperFang::
|
||||
attackstring
|
||||
ppreduce
|
||||
typecalc
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
damagetohalftargethp
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
@ -845,7 +845,7 @@ BattleScript_EffectDragonRage::
|
||||
attackstring
|
||||
ppreduce
|
||||
typecalc
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
setword gBattleMoveDamage, 40
|
||||
adjustsetdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
@ -879,19 +879,19 @@ BattleScript_MoveMissedDoDamage::
|
||||
pause 0x40
|
||||
resultmessage
|
||||
waitmessage 0x40
|
||||
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_NOTAFFECTED, BattleScript_MoveEnd
|
||||
jumpifbyte COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
|
||||
printstring STRINGID_PKMNCRASHED
|
||||
waitmessage 0x40
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
manipulatedamage ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_MISSED
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
|
||||
healthbarupdate ATTACKER
|
||||
datahpupdate ATTACKER
|
||||
tryfaintmon ATTACKER, FALSE, NULL
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_MISSED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectMist::
|
||||
@ -1012,11 +1012,11 @@ BattleScript_EffectPoison::
|
||||
ppreduce
|
||||
jumpifability TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpifstatus TARGET, STATUS_TOXIC_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpifstatus TARGET, STATUS1_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpifstatus TARGET, STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
|
||||
jumpiftype TARGET, TYPE_POISON, BattleScript_NotAffected
|
||||
jumpiftype TARGET, TYPE_STEEL, BattleScript_NotAffected
|
||||
jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS1_ANY, BattleScript_ButItFailed
|
||||
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
|
||||
jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected
|
||||
attackanimation
|
||||
@ -1035,8 +1035,8 @@ BattleScript_EffectParalyze::
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
|
||||
typecalc
|
||||
jumpifmovehadnoeffect BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS_PARALYSIS, BattleScript_AlreadyParalyzed
|
||||
jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS1_PARALYSIS, BattleScript_AlreadyParalyzed
|
||||
jumpifstatus TARGET, STATUS1_ANY, BattleScript_ButItFailed
|
||||
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
|
||||
jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected
|
||||
attackanimation
|
||||
@ -1055,7 +1055,7 @@ BattleScript_AlreadyParalyzed::
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_LimberProtected::
|
||||
copybyte gEffectBank, gBankTarget
|
||||
copybyte gEffectBank, gBankDefender
|
||||
setbyte cMULTISTRING_CHOOSER, 0x0
|
||||
call BattleScript_PRLZPrevention
|
||||
goto BattleScript_MoveEnd
|
||||
@ -1221,7 +1221,7 @@ BattleScript_EffectLevelDamage::
|
||||
attackstring
|
||||
ppreduce
|
||||
typecalc
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
dmgtolevel
|
||||
adjustsetdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
@ -1232,7 +1232,7 @@ BattleScript_EffectPsywave::
|
||||
attackstring
|
||||
ppreduce
|
||||
typecalc
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
psywavedamageeffect
|
||||
adjustsetdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
@ -1279,7 +1279,7 @@ BattleScript_EffectPainSplit::
|
||||
|
||||
BattleScript_EffectSnore::
|
||||
attackcanceler
|
||||
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_SnoreIsAsleep
|
||||
jumpifstatus ATTACKER, STATUS1_SLEEP, BattleScript_SnoreIsAsleep
|
||||
attackstring
|
||||
ppreduce
|
||||
goto BattleScript_ButItFailed
|
||||
@ -1333,7 +1333,7 @@ BattleScript_EffectSketch::
|
||||
|
||||
BattleScript_EffectSleepTalk::
|
||||
attackcanceler
|
||||
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_SleepTalkIsAsleep
|
||||
jumpifstatus ATTACKER, STATUS1_SLEEP, BattleScript_SleepTalkIsAsleep
|
||||
attackstring
|
||||
ppreduce
|
||||
goto BattleScript_ButItFailed
|
||||
@ -1415,7 +1415,7 @@ BattleScript_TripleKickLoop::
|
||||
jumpifhasnohp ATTACKER, BattleScript_TripleKickEnd
|
||||
jumpifhasnohp TARGET, BattleScript_TripleKickNoMoreHits
|
||||
jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoTripleKickAttack
|
||||
jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_TripleKickNoMoreHits
|
||||
jumpifstatus ATTACKER, STATUS1_SLEEP, BattleScript_TripleKickNoMoreHits
|
||||
BattleScript_DoTripleKickAttack::
|
||||
accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE
|
||||
movevaluescleanup
|
||||
@ -1440,18 +1440,18 @@ BattleScript_DoTripleKickAttack::
|
||||
waitmessage 0x1
|
||||
setbyte sMOVEEND_STATE, 0x0
|
||||
moveend 0x2, 0x10
|
||||
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_ENDURED, BattleScript_TripleKickPrintStrings
|
||||
jumpifbyte COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_TripleKickPrintStrings
|
||||
decrementmultihit BattleScript_TripleKickLoop
|
||||
goto BattleScript_TripleKickPrintStrings
|
||||
BattleScript_TripleKickNoMoreHits::
|
||||
pause 0x20
|
||||
jumpifbyte EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_TripleKickPrintStrings
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_MISSED
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
BattleScript_TripleKickPrintStrings::
|
||||
resultmessage
|
||||
waitmessage 0x40
|
||||
jumpifbyte EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_TripleKickEnd
|
||||
jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_NOTAFFECTED, BattleScript_TripleKickEnd
|
||||
jumpifbyte COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_TripleKickEnd
|
||||
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 0x6
|
||||
printstring STRINGID_HITXTIMES
|
||||
waitmessage 0x40
|
||||
@ -1487,7 +1487,7 @@ BattleScript_EffectNightmare::
|
||||
ppreduce
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
|
||||
jumpifstatus2 TARGET, STATUS2_NIGHTMARE, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS_SLEEP, BattleScript_NightmareWorked
|
||||
jumpifstatus TARGET, STATUS1_SLEEP, BattleScript_NightmareWorked
|
||||
goto BattleScript_ButItFailed
|
||||
BattleScript_NightmareWorked::
|
||||
attackanimation
|
||||
@ -1513,7 +1513,7 @@ BattleScript_EffectCurse::
|
||||
jumpifstat ATTACKER, NOT_EQUAL, ATK, 0xC, BattleScript_CurseTrySpeed
|
||||
jumpifstat ATTACKER, EQUAL, DEF, 0xC, BattleScript_ButItFailed
|
||||
BattleScript_CurseTrySpeed::
|
||||
copybyte gBankTarget, gBankAttacker
|
||||
copybyte gBankDefender, gBankAttacker
|
||||
setbyte sANIM_TURN, 0x1
|
||||
attackanimation
|
||||
waitanimation
|
||||
@ -1534,7 +1534,7 @@ BattleScript_CurseTryDefence::
|
||||
BattleScript_CurseEnd::
|
||||
goto BattleScript_MoveEnd
|
||||
BattleScript_GhostCurse::
|
||||
jumpifbytenotequal gBankAttacker, gBankTarget, BattleScript_DoGhostCurse
|
||||
jumpifbytenotequal gBankAttacker, gBankDefender, BattleScript_DoGhostCurse
|
||||
getmovetarget ATTACKER
|
||||
BattleScript_DoGhostCurse::
|
||||
attackcanceler
|
||||
@ -1603,7 +1603,7 @@ BattleScript_PerishSongLoop::
|
||||
jumpifability SCRIPTING_BANK, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected
|
||||
BattleScript_PerishSongLoopIncrement::
|
||||
addbyte sBANK, 0x1
|
||||
jumpifbytenotequal sBANK, gNoOfAllBanks, BattleScript_PerishSongLoop
|
||||
jumpifbytenotequal sBANK, gBattleBanksCount, BattleScript_PerishSongLoop
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_PerishSongNotAffected::
|
||||
@ -1748,7 +1748,7 @@ BattleScript_EffectSonicboom::
|
||||
attackstring
|
||||
ppreduce
|
||||
typecalc
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
setword gBattleMoveDamage, 20
|
||||
adjustsetdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
@ -2085,14 +2085,14 @@ BattleScript_ButItFailedPpReduce::
|
||||
ppreduce
|
||||
BattleScript_ButItFailed::
|
||||
pause 0x20
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_FAILED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_FAILED
|
||||
resultmessage
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_NotAffected::
|
||||
pause 0x20
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_NOTAFFECTED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
|
||||
resultmessage
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
@ -2204,10 +2204,10 @@ BattleScript_EffectWillOWisp::
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS_BURN, BattleScript_AlreadyBurned
|
||||
jumpifstatus TARGET, STATUS1_BURN, BattleScript_AlreadyBurned
|
||||
jumpiftype TARGET, TYPE_FIRE, BattleScript_NotAffected
|
||||
jumpifability TARGET, ABILITY_WATER_VEIL, BattleScript_WaterVeilPrevents
|
||||
jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed
|
||||
jumpifstatus TARGET, STATUS1_ANY, BattleScript_ButItFailed
|
||||
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
|
||||
jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected
|
||||
attackanimation
|
||||
@ -2217,7 +2217,7 @@ BattleScript_EffectWillOWisp::
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_WaterVeilPrevents::
|
||||
copybyte gEffectBank, gBankTarget
|
||||
copybyte gEffectBank, gBankDefender
|
||||
setbyte cMULTISTRING_CHOOSER, 0x0
|
||||
call BattleScript_BRNPrevention
|
||||
goto BattleScript_MoveEnd
|
||||
@ -2275,7 +2275,7 @@ BattleScript_82DA15A::
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectFacade::
|
||||
jumpifstatus ATTACKER, STATUS_POISON | STATUS_BURN | STATUS_PARALYSIS | STATUS_TOXIC_POISON, BattleScript_FacadeDoubleDmg
|
||||
jumpifstatus ATTACKER, STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON, BattleScript_FacadeDoubleDmg
|
||||
goto BattleScript_EffectHit
|
||||
|
||||
BattleScript_FacadeDoubleDmg::
|
||||
@ -2293,7 +2293,7 @@ BattleScript_EffectFocusPunch::
|
||||
BattleScript_EffectSmellingsalt::
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_EffectHit
|
||||
setmoveeffect EFFECT_REMOVE_PARALYSIS | CERTAIN
|
||||
jumpifstatus TARGET, STATUS_PARALYSIS, BattleScript_SmellingsaltDoubleDmg
|
||||
jumpifstatus TARGET, STATUS1_PARALYSIS, BattleScript_SmellingsaltDoubleDmg
|
||||
goto BattleScript_EffectHit
|
||||
|
||||
BattleScript_SmellingsaltDoubleDmg::
|
||||
@ -2452,7 +2452,7 @@ BattleScript_EffectBrickBreak::
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
jumpifbyte EQUAL, sANIM_TURN, 0x0, BattleScript_BrickBreakAnim
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE
|
||||
BattleScript_BrickBreakAnim::
|
||||
attackanimation
|
||||
waitanimation
|
||||
@ -2511,7 +2511,7 @@ BattleScript_EffectEndeavor::
|
||||
accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE
|
||||
typecalc
|
||||
jumpifmovehadnoeffect BattleScript_HitFromAtkAnimation
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
copyword gBattleMoveDamage, gHpDealt
|
||||
adjustsetdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
@ -2598,11 +2598,11 @@ BattleScript_EffectTeeterDance::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
setbyte gBankTarget, 0x0
|
||||
setbyte gBankDefender, 0x0
|
||||
BattleScript_TeeterDanceLoop::
|
||||
movevaluescleanup
|
||||
setmoveeffect EFFECT_CONFUSION
|
||||
jumpifbyteequal gBankAttacker, gBankTarget, BattleScript_TeeterDanceLoopIncrement
|
||||
jumpifbyteequal gBankAttacker, gBankDefender, BattleScript_TeeterDanceLoopIncrement
|
||||
jumpifability TARGET, ABILITY_OWN_TEMPO, BattleScript_TeeterDanceOwnTempoPrevents
|
||||
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_TeeterDanceSubstitutePrevents
|
||||
jumpifstatus2 TARGET, STATUS2_CONFUSION, BattleScript_TeeterDanceAlreadyConfused
|
||||
@ -2618,8 +2618,8 @@ BattleScript_TeeterDanceDoMoveEndIncrement::
|
||||
setbyte sMOVEEND_STATE, 0x0
|
||||
moveend 0x2, 0x10
|
||||
BattleScript_TeeterDanceLoopIncrement::
|
||||
addbyte gBankTarget, 0x1
|
||||
jumpifbytenotequal gBankTarget, gNoOfAllBanks, BattleScript_TeeterDanceLoop
|
||||
addbyte gBankDefender, 0x1
|
||||
jumpifbytenotequal gBankDefender, gBattleBanksCount, BattleScript_TeeterDanceLoop
|
||||
end
|
||||
|
||||
BattleScript_TeeterDanceOwnTempoPrevents::
|
||||
@ -2706,7 +2706,7 @@ BattleScript_TickleEnd::
|
||||
|
||||
BattleScript_CantLowerMultipleStats::
|
||||
pause 0x20
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_FAILED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_FAILED
|
||||
printstring STRINGID_STATSWONTDECREASE2
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
@ -2792,7 +2792,7 @@ BattleScript_CalmMindEnd::
|
||||
|
||||
BattleScript_CantRaiseMultipleStats::
|
||||
pause 0x20
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_FAILED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_FAILED
|
||||
printstring STRINGID_STATSWONTINCREASE2
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
@ -2935,7 +2935,7 @@ BattleScript_82DA908::
|
||||
switchinanim GBANK_1, FALSE
|
||||
waitstate
|
||||
switchineffects 5
|
||||
jumpifbytenotequal gBank1, gNoOfAllBanks, BattleScript_82DA908
|
||||
jumpifbytenotequal gBank1, gBattleBanksCount, BattleScript_82DA908
|
||||
BattleScript_82DA92C::
|
||||
end2
|
||||
|
||||
@ -3243,7 +3243,7 @@ BattleScript_DamagingWeatherLoop::
|
||||
BattleScript_DamagingWeatherLoopIncrement::
|
||||
jumpifbyte NOT_EQUAL, gBattleOutcome, 0, BattleScript_DamagingWeatherContinuesEnd
|
||||
addbyte gBattleCommunication, 0x1
|
||||
jumpifbytenotequal gBattleCommunication, gNoOfAllBanks, BattleScript_DamagingWeatherLoop
|
||||
jumpifbytenotequal gBattleCommunication, gBattleBanksCount, BattleScript_DamagingWeatherLoop
|
||||
BattleScript_DamagingWeatherContinuesEnd::
|
||||
bicword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
|
||||
end2
|
||||
@ -3322,7 +3322,7 @@ BattleScript_BideAttack::
|
||||
waitmessage 0x40
|
||||
accuracycheck BattleScript_MoveMissed, ACC_CURR_MOVE
|
||||
typecalc
|
||||
bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
copyword gBattleMoveDamage, sBIDE_DMG
|
||||
adjustsetdamage
|
||||
setbyte sANIM_TURN, 0x1
|
||||
@ -3521,7 +3521,7 @@ BattleScript_RapidSpinAway::
|
||||
BattleScript_WrapFree::
|
||||
printstring STRINGID_PKMNGOTFREE
|
||||
waitmessage 0x40
|
||||
copybyte gBankTarget, sBANK
|
||||
copybyte gBankDefender, sBANK
|
||||
return
|
||||
|
||||
BattleScript_LeechSeedFree::
|
||||
@ -3564,16 +3564,16 @@ BattleScript_FutureAttackEnd::
|
||||
moveend 0x1, 0x0
|
||||
setbyte sMOVEEND_STATE, 0xB
|
||||
moveend 0x2, 0xE
|
||||
setbyte gBattleMoveFlags, 0
|
||||
setbyte gMoveResultFlags, 0
|
||||
end2
|
||||
|
||||
BattleScript_FutureAttackMiss::
|
||||
pause 0x20
|
||||
setbyte gBattleMoveFlags, 0
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_FAILED
|
||||
setbyte gMoveResultFlags, 0
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_FAILED
|
||||
resultmessage
|
||||
waitmessage 0x40
|
||||
setbyte gBattleMoveFlags, 0
|
||||
setbyte gMoveResultFlags, 0
|
||||
end2
|
||||
|
||||
BattleScript_NoMovesLeft::
|
||||
@ -4032,7 +4032,7 @@ BattleScript_WeatherFormChanges::
|
||||
BattleScript_WeatherFormChangesLoop::
|
||||
trycastformdatachange
|
||||
addbyte sBANK, 0x1
|
||||
jumpifbytenotequal sBANK, gNoOfAllBanks, BattleScript_WeatherFormChangesLoop
|
||||
jumpifbytenotequal sBANK, gBattleBanksCount, BattleScript_WeatherFormChangesLoop
|
||||
return
|
||||
|
||||
BattleScript_CastformChange::
|
||||
@ -4053,7 +4053,7 @@ BattleScript_82DB4B8::
|
||||
BattleScript_82DB4BE::
|
||||
pause 0x20
|
||||
BattleScript_82DB4C1::
|
||||
setbyte gBankTarget, 0x0
|
||||
setbyte gBankDefender, 0x0
|
||||
setstatchanger ATK, 1, TRUE
|
||||
BattleScript_82DB4CD::
|
||||
trygetintimidatetarget BattleScript_82DB51B
|
||||
@ -4068,7 +4068,7 @@ BattleScript_82DB4CD::
|
||||
printstring STRINGID_PKMNCUTSATTACKWITH
|
||||
waitmessage 0x40
|
||||
BattleScript_82DB510::
|
||||
addbyte gBankTarget, 0x1
|
||||
addbyte gBankDefender, 0x1
|
||||
goto BattleScript_82DB4CD
|
||||
BattleScript_82DB51B::
|
||||
return
|
||||
@ -4117,7 +4117,7 @@ BattleScript_MoveHPDrain::
|
||||
datahpupdate TARGET
|
||||
printstring STRINGID_PKMNRESTOREDHPUSING
|
||||
waitmessage 0x40
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_NOTAFFECTED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_MonMadeMoveUseless_PPLoss::
|
||||
@ -4127,7 +4127,7 @@ BattleScript_MonMadeMoveUseless::
|
||||
pause 0x20
|
||||
printstring STRINGID_PKMNSXMADEYUSELESS
|
||||
waitmessage 0x40
|
||||
orbyte gBattleMoveFlags, MOVESTATUS_NOTAFFECTED
|
||||
orbyte gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_FlashFireBoost_PPLoss::
|
||||
@ -4474,7 +4474,7 @@ BattleScript_82DB887::
|
||||
waitmessage 0x40
|
||||
BattleScript_82DB89D::
|
||||
addbyte gBattleCommunication + 1, 0x1
|
||||
jumpifbytenotequal gBattleCommunication + 1, gNoOfAllBanks, BattleScript_82DB887
|
||||
jumpifbytenotequal gBattleCommunication + 1, gBattleBanksCount, BattleScript_82DB887
|
||||
setbyte gBattleCommunication, 0x0
|
||||
setbyte gBattleCommunication + 1, 0x0
|
||||
end2
|
||||
|
158
include/battle.h
158
include/battle.h
@ -39,15 +39,20 @@
|
||||
#define B_POSITION_PLAYER_RIGHT 2
|
||||
#define B_POSITION_OPPONENT_RIGHT 3
|
||||
|
||||
#define B_POSITION_PARTNER(position) ((position) ^ 2)
|
||||
#define B_POSITION_OPPOSITE(position) ((position) ^ 1)
|
||||
|
||||
#define SIDE_PLAYER 0x0
|
||||
#define SIDE_OPPONENT 0x1
|
||||
|
||||
#define BIT_SIDE 0x1
|
||||
#define BIT_MON 0x2
|
||||
|
||||
#define GET_BANK_POSITION(bank)((gBankPositions[bank]))
|
||||
#define GET_BANK_SIDE(bank)((GetBankPosition(bank) & BIT_SIDE))
|
||||
#define GET_BANK_SIDE2(bank)((GET_BANK_POSITION(bank) & BIT_SIDE))
|
||||
#define GET_BANK_POSITION(bank) (gBankPositions[bank])
|
||||
#define GET_BANK_SIDE(bank) (GetBankPosition(bank) & BIT_SIDE)
|
||||
#define GET_BANK_SIDE2(bank) (GET_BANK_POSITION(bank) & BIT_SIDE)
|
||||
|
||||
// Battle Type Flags
|
||||
|
||||
#define BATTLE_TYPE_DOUBLE 0x0001
|
||||
#define BATTLE_TYPE_LINK 0x0002
|
||||
@ -84,59 +89,66 @@
|
||||
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
|
||||
#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
|
||||
|
||||
extern u32 gBattleTypeFlags;
|
||||
|
||||
#define TRAINER_OPPONENT_3FE 0x3FE
|
||||
#define TRAINER_OPPONENT_C00 0xC00
|
||||
#define TRAINER_OPPONENT_800 0x800
|
||||
#define STEVEN_PARTNER_ID 0xC03
|
||||
#define SECRET_BASE_OPPONENT 0x400
|
||||
|
||||
#define BATTLE_WON 0x1
|
||||
#define BATTLE_LOST 0x2
|
||||
#define BATTLE_DREW 0x3
|
||||
#define BATTLE_RAN 0x4
|
||||
#define BATTLE_PLAYER_TELEPORTED 0x5
|
||||
#define BATTLE_POKE_FLED 0x6
|
||||
#define BATTLE_CAUGHT 0x7
|
||||
#define BATTLE_SAFARI_OUT_OF_BALLS 0x8
|
||||
#define BATTLE_FORFEITED 0x9
|
||||
#define BATTLE_OPPONENT_TELEPORTED 0xA
|
||||
#define B_OUTCOME_WON 0x1
|
||||
#define B_OUTCOME_LOST 0x2
|
||||
#define B_OUTCOME_DREW 0x3
|
||||
#define B_OUTCOME_RAN 0x4
|
||||
#define B_OUTCOME_PLAYER_TELEPORTED 0x5
|
||||
#define B_OUTCOME_POKE_FLED 0x6
|
||||
#define B_OUTCOME_CAUGHT_POKE 0x7
|
||||
#define B_OUTCOME_NO_SAFARI_BALLS 0x8
|
||||
#define B_OUTCOME_FORFEITED 0x9
|
||||
#define B_OUTCOME_POKE_TELEPORTED 0xA
|
||||
#define B_OUTCOME_LINK_BATTLE_RAN 0x80
|
||||
|
||||
#define OUTCOME_LINK_BATTLE_RUN 0x80
|
||||
extern u8 gBattleOutcome;
|
||||
|
||||
#define STATUS_NONE 0x0
|
||||
#define STATUS_SLEEP 0x7
|
||||
#define STATUS_POISON 0x8
|
||||
#define STATUS_BURN 0x10
|
||||
#define STATUS_FREEZE 0x20
|
||||
#define STATUS_PARALYSIS 0x40
|
||||
#define STATUS_TOXIC_POISON 0x80
|
||||
#define STATUS_TOXIC_COUNTER 0xF00
|
||||
// Non-volatile status conditions
|
||||
// These persist remain outside of battle and after switching out
|
||||
#define STATUS1_NONE 0x0
|
||||
#define STATUS1_SLEEP 0x7
|
||||
#define STATUS1_POISON 0x8
|
||||
#define STATUS1_BURN 0x10
|
||||
#define STATUS1_FREEZE 0x20
|
||||
#define STATUS1_PARALYSIS 0x40
|
||||
#define STATUS1_TOXIC_POISON 0x80
|
||||
#define STATUS1_TOXIC_COUNTER 0xF00
|
||||
#define STATUS1_PSN_ANY (STATUS1_POISON | STATUS1_TOXIC_POISON)
|
||||
#define STATUS1_ANY (STATUS1_SLEEP | STATUS1_POISON | STATUS1_BURN | STATUS1_FREEZE | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)
|
||||
|
||||
#define STATUS_PSN_ANY ((STATUS_POISON | STATUS_TOXIC_POISON))
|
||||
#define STATUS_ANY ((STATUS_SLEEP | STATUS_POISON | STATUS_BURN | STATUS_FREEZE | STATUS_PARALYSIS | STATUS_TOXIC_POISON))
|
||||
|
||||
#define STATUS2_CONFUSION 0x00000007
|
||||
#define STATUS2_FLINCHED 0x00000008
|
||||
#define STATUS2_UPROAR 0x00000070
|
||||
#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
|
||||
#define STATUS2_LOCK_CONFUSE 0x00000C00
|
||||
#define STATUS2_MULTIPLETURNS 0x00001000
|
||||
#define STATUS2_WRAPPED 0x0000E000
|
||||
#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every bank
|
||||
#define STATUS2_INFATUATED_WITH(bank)((gBitTable[bank] << 16))
|
||||
#define STATUS2_FOCUS_ENERGY 0x00100000
|
||||
#define STATUS2_TRANSFORMED 0x00200000
|
||||
#define STATUS2_RECHARGE 0x00400000
|
||||
#define STATUS2_RAGE 0x00800000
|
||||
#define STATUS2_SUBSTITUTE 0x01000000
|
||||
#define STATUS2_DESTINY_BOND 0x02000000
|
||||
#define STATUS2_ESCAPE_PREVENTION 0x04000000
|
||||
#define STATUS2_NIGHTMARE 0x08000000
|
||||
#define STATUS2_CURSED 0x10000000
|
||||
#define STATUS2_FORESIGHT 0x20000000
|
||||
#define STATUS2_DEFENSE_CURL 0x40000000
|
||||
#define STATUS2_TORMENT 0x80000000
|
||||
// Volatile status ailments
|
||||
// These are removed after exiting the battle or switching out
|
||||
#define STATUS2_CONFUSION 0x00000007
|
||||
#define STATUS2_FLINCHED 0x00000008
|
||||
#define STATUS2_UPROAR 0x00000070
|
||||
#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
|
||||
#define STATUS2_LOCK_CONFUSE 0x00000C00
|
||||
#define STATUS2_MULTIPLETURNS 0x00001000
|
||||
#define STATUS2_WRAPPED 0x0000E000
|
||||
#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every bank
|
||||
#define STATUS2_INFATUATED_WITH(bank) (gBitTable[bank] << 16)
|
||||
#define STATUS2_FOCUS_ENERGY 0x00100000
|
||||
#define STATUS2_TRANSFORMED 0x00200000
|
||||
#define STATUS2_RECHARGE 0x00400000
|
||||
#define STATUS2_RAGE 0x00800000
|
||||
#define STATUS2_SUBSTITUTE 0x01000000
|
||||
#define STATUS2_DESTINY_BOND 0x02000000
|
||||
#define STATUS2_ESCAPE_PREVENTION 0x04000000
|
||||
#define STATUS2_NIGHTMARE 0x08000000
|
||||
#define STATUS2_CURSED 0x10000000
|
||||
#define STATUS2_FORESIGHT 0x20000000
|
||||
#define STATUS2_DEFENSE_CURL 0x40000000
|
||||
#define STATUS2_TORMENT 0x80000000
|
||||
|
||||
// Seems like per-bank statuses. Not quite sure how to categorize these
|
||||
#define STATUS3_LEECHSEED_BANK 0x3
|
||||
#define STATUS3_LEECHSEED 0x4
|
||||
#define STATUS3_ALWAYS_HITS 0x18 // two bits
|
||||
@ -155,8 +167,11 @@
|
||||
#define STATUS3_UNDERWATER 0x40000
|
||||
#define STATUS3_INTIMIDATE_POKES 0x80000
|
||||
#define STATUS3_TRACE 0x100000
|
||||
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)
|
||||
|
||||
#define STATUS3_SEMI_INVULNERABLE ((STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER))
|
||||
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
|
||||
|
||||
//
|
||||
|
||||
#define HITMARKER_x10 0x00000010
|
||||
#define HITMARKER_x20 0x00000020
|
||||
@ -182,8 +197,12 @@
|
||||
#define HITMARKER_OBEYS 0x02000000
|
||||
#define HITMARKER_x4000000 0x04000000
|
||||
#define HITMARKER_x8000000 0x08000000
|
||||
#define HITMARKER_FAINTED(bank) ((gBitTable[bank] << 0x1C))
|
||||
#define HITMARKER_UNK(bank) ((0x10000000 << bank))
|
||||
#define HITMARKER_FAINTED(bank) (gBitTable[bank] << 0x1C)
|
||||
#define HITMARKER_UNK(bank) (0x10000000 << bank)
|
||||
|
||||
extern u32 gHitMarker;
|
||||
|
||||
// Per-side statuses that affect an entire party
|
||||
|
||||
#define SIDE_STATUS_REFLECT (1 << 0)
|
||||
#define SIDE_STATUS_LIGHTSCREEN (1 << 1)
|
||||
@ -194,6 +213,8 @@
|
||||
#define SIDE_STATUS_MIST (1 << 8)
|
||||
#define SIDE_STATUS_SPIKES_DAMAGED (1 << 9)
|
||||
|
||||
extern u16 gSideStatuses[2];
|
||||
|
||||
#define ACTION_USE_MOVE 0
|
||||
#define ACTION_USE_ITEM 1
|
||||
#define ACTION_SWITCH 2
|
||||
@ -210,33 +231,36 @@
|
||||
#define ACTION_NOTHING_FAINTED 13 // when choosing an action
|
||||
#define ACTION_INIT_VALUE 0xFF
|
||||
|
||||
#define MOVESTATUS_MISSED (1 << 0)
|
||||
#define MOVESTATUS_SUPEREFFECTIVE (1 << 1)
|
||||
#define MOVESTATUS_NOTVERYEFFECTIVE (1 << 2)
|
||||
#define MOVESTATUS_NOTAFFECTED (1 << 3)
|
||||
#define MOVESTATUS_ONEHITKO (1 << 4)
|
||||
#define MOVESTATUS_FAILED (1 << 5)
|
||||
#define MOVESTATUS_ENDURED (1 << 6)
|
||||
#define MOVESTATUS_HUNGON (1 << 7)
|
||||
|
||||
#define MOVESTATUS_NOEFFECT ((MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED))
|
||||
#define MOVE_RESULT_MISSED (1 << 0)
|
||||
#define MOVE_RESULT_SUPER_EFFECTIVE (1 << 1)
|
||||
#define MOVE_RESULT_NOT_VERY_EFFECTIVE (1 << 2)
|
||||
#define MOVE_RESULT_DOESNT_AFFECT_FOE (1 << 3)
|
||||
#define MOVE_RESULT_ONE_HIT_KO (1 << 4)
|
||||
#define MOVE_RESULT_FAILED (1 << 5)
|
||||
#define MOVE_RESULT_FOE_ENDURED (1 << 6)
|
||||
#define MOVE_RESULT_FOE_HUNG_ON (1 << 7)
|
||||
#define MOVE_RESULT_NO_EFFECT (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED)
|
||||
|
||||
#define MAX_TRAINER_ITEMS 4
|
||||
#define MAX_MON_MOVES 4
|
||||
|
||||
// Battle Weather flags
|
||||
|
||||
#define WEATHER_RAIN_TEMPORARY (1 << 0)
|
||||
#define WEATHER_RAIN_DOWNPOUR (1 << 1)
|
||||
#define WEATHER_RAIN_DOWNPOUR (1 << 1) // unused
|
||||
#define WEATHER_RAIN_PERMANENT (1 << 2)
|
||||
#define WEATHER_RAIN_ANY ((WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT))
|
||||
#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT)
|
||||
#define WEATHER_SANDSTORM_TEMPORARY (1 << 3)
|
||||
#define WEATHER_SANDSTORM_PERMANENT (1 << 4)
|
||||
#define WEATHER_SANDSTORM_ANY ((WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT))
|
||||
#define WEATHER_SANDSTORM_ANY (WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT)
|
||||
#define WEATHER_SUN_TEMPORARY (1 << 5)
|
||||
#define WEATHER_SUN_PERMANENT (1 << 6)
|
||||
#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT))
|
||||
#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT)
|
||||
#define WEATHER_HAIL (1 << 7)
|
||||
#define WEATHER_HAIL_ANY ((WEATHER_HAIL))
|
||||
#define WEATHER_ANY ((WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY))
|
||||
#define WEATHER_HAIL_ANY (WEATHER_HAIL)
|
||||
#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)
|
||||
|
||||
extern u16 gBattleWeather;
|
||||
|
||||
#define BATTLE_TERRAIN_GRASS 0
|
||||
#define BATTLE_TERRAIN_LONG_GRASS 1
|
||||
@ -249,6 +273,8 @@
|
||||
#define BATTLE_TERRAIN_BUILDING 8
|
||||
#define BATTLE_TERRAIN_PLAIN 9
|
||||
|
||||
extern u8 gBattleTerrain;
|
||||
|
||||
// array entries for battle communication
|
||||
#define MULTIUSE_STATE 0x0
|
||||
#define CURSOR_POSITION 0x1
|
||||
@ -847,7 +873,7 @@ enum
|
||||
// rom_80A5C6C
|
||||
u8 GetBankSide(u8 bank);
|
||||
u8 GetBankPosition(u8 bank);
|
||||
u8 GetBankByIdentity(u8 bank);
|
||||
u8 GetBankByPosition(u8 bank);
|
||||
|
||||
struct BattleSpriteInfo
|
||||
{
|
||||
|
286
src/battle_2.c
286
src/battle_2.c
@ -111,14 +111,14 @@ extern u16 gBattleWeather;
|
||||
extern u16 gPauseCounterBattle;
|
||||
extern u16 gRandomTurnNumber;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern u8 gBankAttacker;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gLeveledUpInBattle;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u32 gBattleExecBuffer;
|
||||
extern u8 gMultiHitCounter;
|
||||
extern u8 gBattleMoveFlags;
|
||||
extern u8 gMoveResultFlags;
|
||||
extern s32 gBattleMoveDamage;
|
||||
extern const u8* gPalaceSelectionBattleScripts[BATTLE_BANKS_COUNT];
|
||||
extern u16 gLastPrintedMoves[BATTLE_BANKS_COUNT];
|
||||
@ -130,7 +130,7 @@ extern u16 gLockedMoves[BATTLE_BANKS_COUNT];
|
||||
extern u8 gLastHitBy[BATTLE_BANKS_COUNT];
|
||||
extern u8 gUnknown_02024284[BATTLE_BANKS_COUNT];
|
||||
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
|
||||
extern u16 gSideAffecting[2];
|
||||
extern u16 gSideStatuses[2];
|
||||
extern u16 gCurrentMove;
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
@ -291,16 +291,16 @@ static void (* const sTurnActionsFuncsTable[])(void) =
|
||||
static void (* const sEndTurnFuncsTable[])(void) =
|
||||
{
|
||||
HandleEndTurn_ContinueBattle, // battle outcome 0
|
||||
HandleEndTurn_BattleWon, // BATTLE_WON
|
||||
HandleEndTurn_BattleLost, // BATTLE_LOST
|
||||
HandleEndTurn_BattleLost, // BATTLE_DREW
|
||||
HandleEndTurn_RanFromBattle, // BATTLE_RAN
|
||||
HandleEndTurn_FinishBattle, // BATTLE_PLAYER_TELEPORTED
|
||||
HandleEndTurn_MonFled, // BATTLE_POKE_FLED
|
||||
HandleEndTurn_FinishBattle, // BATTLE_CAUGHT
|
||||
HandleEndTurn_BattleWon, // B_OUTCOME_WON
|
||||
HandleEndTurn_BattleLost, // B_OUTCOME_LOST
|
||||
HandleEndTurn_BattleLost, // B_OUTCOME_DREW
|
||||
HandleEndTurn_RanFromBattle, // B_OUTCOME_RAN
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_PLAYER_TELEPORTED
|
||||
HandleEndTurn_MonFled, // B_OUTCOME_POKE_FLED
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_CAUGHT_POKE
|
||||
HandleEndTurn_FinishBattle, // battle outcome 8
|
||||
HandleEndTurn_FinishBattle, // BATTLE_FORFEITED
|
||||
HandleEndTurn_FinishBattle, // BATTLE_OPPONENT_TELEPORTED
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_FORFEITED
|
||||
HandleEndTurn_FinishBattle, // B_OUTCOME_POKE_TELEPORTED
|
||||
};
|
||||
|
||||
const u8 gStatusConditionString_PoisonJpn[8] = _("どく$$$$$");
|
||||
@ -1586,7 +1586,7 @@ void BattleMainCB2(void)
|
||||
|
||||
if (gMain.heldKeys & B_BUTTON && gBattleTypeFlags & BATTLE_TYPE_RECORDED && sub_8186450())
|
||||
{
|
||||
gSpecialVar_Result = gBattleOutcome = BATTLE_PLAYER_TELEPORTED;
|
||||
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED;
|
||||
ResetPaletteFadeControl();
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||
SetMainCallback2(CB2_QuitRecordedBattle);
|
||||
@ -2720,7 +2720,7 @@ static void BattleMainCB1(void)
|
||||
{
|
||||
gBattleMainFunc();
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
gBattleBankFunc[gActiveBank]();
|
||||
}
|
||||
|
||||
@ -2756,7 +2756,7 @@ static void BattleStartClearSetData(void)
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
gSideAffecting[i] = 0;
|
||||
gSideStatuses[i] = 0;
|
||||
|
||||
dataPtr = (u8 *)&gSideTimers[i];
|
||||
for (j = 0; j < sizeof(struct SideTimer); j++)
|
||||
@ -2764,7 +2764,7 @@ static void BattleStartClearSetData(void)
|
||||
}
|
||||
|
||||
gBankAttacker = 0;
|
||||
gBankTarget = 0;
|
||||
gBankDefender = 0;
|
||||
gBattleWeather = 0;
|
||||
|
||||
dataPtr = (u8 *)&gWishFutureKnock;
|
||||
@ -2850,7 +2850,7 @@ void SwitchInClearSetData(void)
|
||||
{
|
||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
||||
gBattleMons[gActiveBank].statStages[i] = 6;
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].bankPreventingEscape == gActiveBank)
|
||||
gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION;
|
||||
@ -2866,7 +2866,7 @@ void SwitchInClearSetData(void)
|
||||
gBattleMons[gActiveBank].status2 &= (STATUS2_CONFUSION | STATUS2_FOCUS_ENERGY | STATUS2_SUBSTITUTE | STATUS2_ESCAPE_PREVENTION | STATUS2_CURSED);
|
||||
gStatuses3[gActiveBank] &= (STATUS3_LEECHSEED_BANK | STATUS3_LEECHSEED | STATUS3_ALWAYS_HITS | STATUS3_PERISH_SONG | STATUS3_ROOTED | STATUS3_MUDSPORT | STATUS3_WATERSPORT);
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (GetBankSide(gActiveBank) != GetBankSide(i)
|
||||
&& (gStatuses3[i] & STATUS3_ALWAYS_HITS) != 0
|
||||
@ -2883,7 +2883,7 @@ void SwitchInClearSetData(void)
|
||||
gStatuses3[gActiveBank] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBank))
|
||||
gBattleMons[i].status2 &= ~(STATUS2_INFATUATED_WITH(gActiveBank));
|
||||
@ -2907,7 +2907,7 @@ void SwitchInClearSetData(void)
|
||||
gDisableStructs[gActiveBank].bankPreventingEscape = disableStructCopy.bankPreventingEscape;
|
||||
}
|
||||
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gDisableStructs[gActiveBank].isFirstTurn = 2;
|
||||
gDisableStructs[gActiveBank].truantUnknownBit = disableStructCopy.truantUnknownBit;
|
||||
gLastMoves[gActiveBank] = 0;
|
||||
@ -2930,7 +2930,7 @@ void SwitchInClearSetData(void)
|
||||
|
||||
gBattleStruct->field_92 &= ~(gBitTable[gActiveBank]);
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (i != gActiveBank && GetBankSide(i) != GetBankSide(gActiveBank))
|
||||
{
|
||||
@ -2963,7 +2963,7 @@ void FaintClearSetData(void)
|
||||
gBattleMons[gActiveBank].status2 = 0;
|
||||
gStatuses3[gActiveBank] = 0;
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].bankPreventingEscape == gActiveBank)
|
||||
gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION;
|
||||
@ -3025,7 +3025,7 @@ void FaintClearSetData(void)
|
||||
|
||||
gBattleStruct->field_92 &= ~(gBitTable[gActiveBank]);
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (i != gActiveBank && GetBankSide(i) != GetBankSide(gActiveBank))
|
||||
{
|
||||
@ -3059,7 +3059,7 @@ static void BattleIntroGetMonsData(void)
|
||||
if (gBattleExecBuffer == 0)
|
||||
{
|
||||
gBattleCommunication[1]++;
|
||||
if (gBattleCommunication[1] == gNoOfAllBanks)
|
||||
if (gBattleCommunication[1] == gBattleBanksCount)
|
||||
gBattleMainFunc = BattleIntroPrepareBackgroundSlide;
|
||||
else
|
||||
gBattleCommunication[MULTIUSE_STATE] = 0;
|
||||
@ -3072,7 +3072,7 @@ static void BattleIntroPrepareBackgroundSlide(void)
|
||||
{
|
||||
if (gBattleExecBuffer == 0)
|
||||
{
|
||||
gActiveBank = GetBankByIdentity(0);
|
||||
gActiveBank = GetBankByPosition(0);
|
||||
EmitIntroSlide(0, gBattleTerrain);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
gBattleMainFunc = BattleIntroDrawTrainersOrMonsSprites;
|
||||
@ -3089,7 +3089,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
||||
if (gBattleExecBuffer)
|
||||
return;
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI)
|
||||
&& GetBankSide(gActiveBank) == SIDE_PLAYER)
|
||||
@ -3203,7 +3203,7 @@ static void BattleIntroDrawPartySummaryScreens(void)
|
||||
hpStatus[i].status = GetMonData(&gEnemyParty[i], MON_DATA_STATUS);
|
||||
}
|
||||
}
|
||||
gActiveBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
gActiveBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
EmitDrawPartyStatusSummary(0, hpStatus, 0x80);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
|
||||
@ -3221,7 +3221,7 @@ static void BattleIntroDrawPartySummaryScreens(void)
|
||||
hpStatus[i].status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS);
|
||||
}
|
||||
}
|
||||
gActiveBank = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
gActiveBank = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
EmitDrawPartyStatusSummary(0, hpStatus, 0x80);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
|
||||
@ -3257,7 +3257,7 @@ static void BattleIntroPrintTrainerWantsToBattle(void)
|
||||
{
|
||||
if (gBattleExecBuffer == 0)
|
||||
{
|
||||
gActiveBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
gActiveBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
PrepareStringBattle(STRINGID_INTROMSG, gActiveBank);
|
||||
gBattleMainFunc = BattleIntroPrintOpponentSendsOut;
|
||||
}
|
||||
@ -3291,7 +3291,7 @@ static void BattleIntroPrintOpponentSendsOut(void)
|
||||
else
|
||||
identity = B_POSITION_OPPONENT_LEFT;
|
||||
|
||||
PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByIdentity(identity));
|
||||
PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByPosition(identity));
|
||||
gBattleMainFunc = BattleIntroOpponent1SendsOutMonAnimation;
|
||||
}
|
||||
|
||||
@ -3311,7 +3311,7 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void)
|
||||
else
|
||||
identity = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankPosition(gActiveBank) == identity)
|
||||
{
|
||||
@ -3343,7 +3343,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
if (gBattleExecBuffer)
|
||||
return;
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankPosition(gActiveBank) == identity)
|
||||
{
|
||||
@ -3400,7 +3400,7 @@ _0803B29A:\n\
|
||||
bne _0803B2F2\n\
|
||||
ldr r0, =gActiveBank\n\
|
||||
strb r2, [r0]\n\
|
||||
ldr r1, =gNoOfAllBanks\n\
|
||||
ldr r1, =gBattleBanksCount\n\
|
||||
adds r4, r0, 0\n\
|
||||
ldrb r1, [r1]\n\
|
||||
cmp r2, r1\n\
|
||||
@ -3427,7 +3427,7 @@ _0803B2D8:\n\
|
||||
ldrb r0, [r6]\n\
|
||||
adds r0, 0x1\n\
|
||||
strb r0, [r6]\n\
|
||||
ldr r1, =gNoOfAllBanks\n\
|
||||
ldr r1, =gBattleBanksCount\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r0, 24\n\
|
||||
ldr r4, =gActiveBank\n\
|
||||
@ -3453,7 +3453,7 @@ static void BattleIntroRecordMonsToDex(void)
|
||||
{
|
||||
if (gBattleExecBuffer == 0)
|
||||
{
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankSide(gActiveBank) == SIDE_OPPONENT
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER
|
||||
@ -3494,7 +3494,7 @@ static void BattleIntroPrintPlayerSendsOut(void)
|
||||
identity = B_POSITION_PLAYER_LEFT;
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
|
||||
PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByIdentity(identity));
|
||||
PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByPosition(identity));
|
||||
|
||||
gBattleMainFunc = BattleIntroPlayer1SendsOutMonAnimation;
|
||||
}
|
||||
@ -3516,7 +3516,7 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void)
|
||||
else
|
||||
identity = B_POSITION_PLAYER_RIGHT;
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankPosition(gActiveBank) == identity)
|
||||
{
|
||||
@ -3551,7 +3551,7 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void)
|
||||
if (gBattleExecBuffer)
|
||||
return;
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankPosition(gActiveBank) == identity)
|
||||
{
|
||||
@ -3576,7 +3576,7 @@ void sub_803B598(void) // unused
|
||||
{
|
||||
if (gBattleExecBuffer == 0)
|
||||
{
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
|
||||
{
|
||||
@ -3604,11 +3604,11 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
|
||||
if (gBattleStruct->switchInAbilitiesCounter == 0)
|
||||
{
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
gBanksByTurnOrder[i] = i;
|
||||
for (i = 0; i < gNoOfAllBanks - 1; i++)
|
||||
for (i = 0; i < gBattleBanksCount - 1; i++)
|
||||
{
|
||||
for (j = i + 1; j < gNoOfAllBanks; j++)
|
||||
for (j = i + 1; j < gBattleBanksCount; j++)
|
||||
{
|
||||
if (GetWhoStrikesFirst(gBanksByTurnOrder[i], gBanksByTurnOrder[j], TRUE) != 0)
|
||||
SwapTurnOrder(i, j);
|
||||
@ -3622,7 +3622,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
return;
|
||||
}
|
||||
// check all switch in abilities happening from the fastest mon to slowest
|
||||
while (gBattleStruct->switchInAbilitiesCounter < gNoOfAllBanks)
|
||||
while (gBattleStruct->switchInAbilitiesCounter < gBattleBanksCount)
|
||||
{
|
||||
if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBanksByTurnOrder[gBattleStruct->switchInAbilitiesCounter], 0, 0, 0) != 0)
|
||||
effect++;
|
||||
@ -3637,7 +3637,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
if (AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) != 0)
|
||||
return;
|
||||
// check all switch in items having effect from the fastest mon to slowest
|
||||
while (gBattleStruct->switchInItemsCounter < gNoOfAllBanks)
|
||||
while (gBattleStruct->switchInItemsCounter < gBattleBanksCount)
|
||||
{
|
||||
if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBanksByTurnOrder[gBattleStruct->switchInItemsCounter], 0) != 0)
|
||||
effect++;
|
||||
@ -3663,7 +3663,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; i++)
|
||||
gBattleCommunication[i] = 0;
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
gBattleMons[i].status2 &= ~(STATUS2_FLINCHED);
|
||||
|
||||
*(&gBattleStruct->turnEffectsTracker) = 0;
|
||||
@ -3673,7 +3673,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
gBattleScripting.atk49_state = 0;
|
||||
gBattleStruct->faintedActionsState = 0;
|
||||
gBattleStruct->turncountersTracker = 0;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
|
||||
gRandomTurnNumber = Random();
|
||||
|
||||
@ -3693,10 +3693,10 @@ static void HandleEndTurn_ContinueBattle(void)
|
||||
gBattleMainFunc = BattleTurnPassed;
|
||||
for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; i++)
|
||||
gBattleCommunication[i] = 0;
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
gBattleMons[i].status2 &= ~(STATUS2_FLINCHED);
|
||||
if ((gBattleMons[i].status1 & STATUS_SLEEP) && (gBattleMons[i].status2 & STATUS2_MULTIPLETURNS))
|
||||
if ((gBattleMons[i].status1 & STATUS1_SLEEP) && (gBattleMons[i].status2 & STATUS2_MULTIPLETURNS))
|
||||
CancelMultiTurnMoves(i);
|
||||
}
|
||||
gBattleStruct->turnEffectsTracker = 0;
|
||||
@ -3704,7 +3704,7 @@ static void HandleEndTurn_ContinueBattle(void)
|
||||
gBattleStruct->wishPerishSongState = 0;
|
||||
gBattleStruct->wishPerishSongBank = 0;
|
||||
gBattleStruct->turncountersTracker = 0;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3735,7 +3735,7 @@ void BattleTurnPassed(void)
|
||||
gBattleScripting.animTargetsHit = 0;
|
||||
gBattleScripting.atk49_state = 0;
|
||||
gBattleMoveDamage = 0;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
gBattleCommunication[i] = 0;
|
||||
@ -3753,7 +3753,7 @@ void BattleTurnPassed(void)
|
||||
gBattleStruct->field_DA++;
|
||||
}
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
gActionForBanks[i] = ACTION_INIT_VALUE;
|
||||
gChosenMovesByBanks[i] = MOVE_NONE;
|
||||
@ -3795,7 +3795,7 @@ u8 IsRunningFromBattleImpossible(void)
|
||||
|
||||
side = GetBankSide(gActiveBank);
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (side != GetBankSide(i)
|
||||
&& gBattleMons[i].ability == ABILITY_SHADOW_TAG)
|
||||
@ -3889,7 +3889,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
s32 i;
|
||||
|
||||
gBattleCommunication[ACTIONS_CONFIRMED_COUNT] = 0;
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
u8 identity = GetBankPosition(gActiveBank);
|
||||
switch (gBattleCommunication[gActiveBank])
|
||||
@ -3902,8 +3902,8 @@ static void HandleTurnActionSelectionState(void)
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = 6;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI
|
||||
|| !(identity & BIT_MON)
|
||||
|| gBattleStruct->field_91 & gBitTable[GetBankByIdentity(identity ^ BIT_MON)]
|
||||
|| gBattleCommunication[GetBankByIdentity(identity ^ BIT_MON)] == 5)
|
||||
|| gBattleStruct->field_91 & gBitTable[GetBankByPosition(identity ^ BIT_MON)]
|
||||
|| gBattleCommunication[GetBankByPosition(identity ^ BIT_MON)] == 5)
|
||||
{
|
||||
if (gBattleStruct->field_91 & gBitTable[gActiveBank])
|
||||
{
|
||||
@ -4041,38 +4041,38 @@ static void HandleTurnActionSelectionState(void)
|
||||
break;
|
||||
case ACTION_CANCEL_PARTNER:
|
||||
gBattleCommunication[gActiveBank] = 7;
|
||||
gBattleCommunication[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] = 1;
|
||||
gBattleCommunication[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)] = 1;
|
||||
RecordedBattle_ClearBankAction(gActiveBank, 1);
|
||||
if (gBattleMons[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].status2 & STATUS2_MULTIPLETURNS
|
||||
|| gBattleMons[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].status2 & STATUS2_RECHARGE)
|
||||
if (gBattleMons[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)].status2 & STATUS2_MULTIPLETURNS
|
||||
|| gBattleMons[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)].status2 & STATUS2_RECHARGE)
|
||||
{
|
||||
EmitCmd50(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
return;
|
||||
}
|
||||
else if (gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_SWITCH)
|
||||
else if (gActionForBanks[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_SWITCH)
|
||||
{
|
||||
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 2);
|
||||
RecordedBattle_ClearBankAction(GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON), 2);
|
||||
}
|
||||
else if (gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_RUN)
|
||||
else if (gActionForBanks[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_RUN)
|
||||
{
|
||||
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
|
||||
RecordedBattle_ClearBankAction(GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
|
||||
}
|
||||
else if (gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE
|
||||
&& (gProtectStructs[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].onlyStruggle
|
||||
|| gDisableStructs[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].encoredMove))
|
||||
else if (gActionForBanks[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE
|
||||
&& (gProtectStructs[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)].onlyStruggle
|
||||
|| gDisableStructs[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)].encoredMove))
|
||||
{
|
||||
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
|
||||
RecordedBattle_ClearBankAction(GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_PALACE
|
||||
&& gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE)
|
||||
&& gActionForBanks[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE)
|
||||
{
|
||||
gRngValue = gBattlePalaceMoveSelectionRngValue;
|
||||
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
|
||||
RecordedBattle_ClearBankAction(GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 3);
|
||||
RecordedBattle_ClearBankAction(GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON), 3);
|
||||
}
|
||||
EmitCmd50(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
@ -4226,7 +4226,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
|
||||
if (((gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_DOUBLE)) != BATTLE_TYPE_DOUBLE)
|
||||
|| (identity & BIT_MON)
|
||||
|| (*(&gBattleStruct->field_91) & gBitTable[GetBankByIdentity(identity ^ BIT_MON)]))
|
||||
|| (*(&gBattleStruct->field_91) & gBitTable[GetBankByPosition(identity ^ BIT_MON)]))
|
||||
{
|
||||
EmitLinkStandbyMsg(0, 0, i);
|
||||
}
|
||||
@ -4296,14 +4296,14 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
|
||||
// check if everyone chose actions
|
||||
if (gBattleCommunication[ACTIONS_CONFIRMED_COUNT] == gNoOfAllBanks)
|
||||
if (gBattleCommunication[ACTIONS_CONFIRMED_COUNT] == gBattleBanksCount)
|
||||
{
|
||||
sub_818603C(1);
|
||||
gBattleMainFunc = SetActionsAndBanksTurnOrder;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
{
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (gActionForBanks[i] == ACTION_SWITCH)
|
||||
sub_80571DC(i, *(gBattleStruct->monToSwitchIntoId + i));
|
||||
@ -4316,13 +4316,13 @@ static bool8 sub_803CDB8(void)
|
||||
{
|
||||
s32 i, var;
|
||||
|
||||
for (var = 0, i = 0; i < gNoOfAllBanks; i++)
|
||||
for (var = 0, i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (gBattleCommunication[i] == 5)
|
||||
var++;
|
||||
}
|
||||
|
||||
if (var + 1 == gNoOfAllBanks)
|
||||
if (var + 1 == gBattleBanksCount)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -4411,7 +4411,7 @@ u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves)
|
||||
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
|
||||
speedBank1 /= 2;
|
||||
|
||||
if (gBattleMons[bank1].status1 & STATUS_PARALYSIS)
|
||||
if (gBattleMons[bank1].status1 & STATUS1_PARALYSIS)
|
||||
speedBank1 /= 4;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100)
|
||||
@ -4445,7 +4445,7 @@ u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves)
|
||||
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
|
||||
speedBank2 /= 2;
|
||||
|
||||
if (gBattleMons[bank2].status1 & STATUS_PARALYSIS)
|
||||
if (gBattleMons[bank2].status1 & STATUS1_PARALYSIS)
|
||||
speedBank2 /= 4;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100)
|
||||
@ -4518,7 +4518,7 @@ static void SetActionsAndBanksTurnOrder(void)
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
|
||||
{
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
gActionsByTurnOrder[var] = gActionForBanks[gActiveBank];
|
||||
gBanksByTurnOrder[var] = gActiveBank;
|
||||
@ -4529,7 +4529,7 @@ static void SetActionsAndBanksTurnOrder(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
{
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (gActionForBanks[gActiveBank] == ACTION_RUN)
|
||||
{
|
||||
@ -4557,7 +4557,7 @@ static void SetActionsAndBanksTurnOrder(void)
|
||||
gActionsByTurnOrder[0] = gActionForBanks[gActiveBank];
|
||||
gBanksByTurnOrder[0] = gActiveBank;
|
||||
var = 1;
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (i != gActiveBank)
|
||||
{
|
||||
@ -4572,7 +4572,7 @@ static void SetActionsAndBanksTurnOrder(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (gActionForBanks[gActiveBank] == ACTION_USE_ITEM || gActionForBanks[gActiveBank] == ACTION_SWITCH)
|
||||
{
|
||||
@ -4581,7 +4581,7 @@ static void SetActionsAndBanksTurnOrder(void)
|
||||
var++;
|
||||
}
|
||||
}
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (gActionForBanks[gActiveBank] != ACTION_USE_ITEM && gActionForBanks[gActiveBank] != ACTION_SWITCH)
|
||||
{
|
||||
@ -4590,9 +4590,9 @@ static void SetActionsAndBanksTurnOrder(void)
|
||||
var++;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < gNoOfAllBanks - 1; i++)
|
||||
for (i = 0; i < gBattleBanksCount - 1; i++)
|
||||
{
|
||||
for (j = i + 1; j < gNoOfAllBanks; j++)
|
||||
for (j = i + 1; j < gBattleBanksCount; j++)
|
||||
{
|
||||
u8 bank1 = gBanksByTurnOrder[i];
|
||||
u8 bank2 = gBanksByTurnOrder[j];
|
||||
@ -4617,7 +4617,7 @@ static void TurnValuesCleanUp(bool8 var0)
|
||||
s32 i;
|
||||
u8 *dataPtr;
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (var0)
|
||||
{
|
||||
@ -4651,7 +4651,7 @@ static void TurnValuesCleanUp(bool8 var0)
|
||||
|
||||
static void SpecialStatusesClear(void)
|
||||
{
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
s32 i;
|
||||
u8 *dataPtr = (u8*)(&gSpecialStatuses[gActiveBank]);
|
||||
@ -4665,12 +4665,12 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void)
|
||||
{
|
||||
if (!(gHitMarker & HITMARKER_RUN))
|
||||
{
|
||||
while (gBattleStruct->focusPunchBank < gNoOfAllBanks)
|
||||
while (gBattleStruct->focusPunchBank < gBattleBanksCount)
|
||||
{
|
||||
gActiveBank = gBankAttacker = gBattleStruct->focusPunchBank;
|
||||
gBattleStruct->focusPunchBank++;
|
||||
if (gChosenMovesByBanks[gActiveBank] == MOVE_FOCUS_PUNCH
|
||||
&& !(gBattleMons[gActiveBank].status1 & STATUS_SLEEP)
|
||||
&& !(gBattleMons[gActiveBank].status1 & STATUS1_SLEEP)
|
||||
&& !(gDisableStructs[gBankAttacker].truantCounter)
|
||||
&& !(gProtectStructs[gActiveBank].onlyStruggle))
|
||||
{
|
||||
@ -4704,7 +4704,7 @@ static void RunTurnActionsFunctions(void)
|
||||
*(&gBattleStruct->savedTurnActionNumber) = gCurrentTurnActionNumber;
|
||||
sTurnActionsFuncsTable[gCurrentActionFuncId]();
|
||||
|
||||
if (gCurrentTurnActionNumber >= gNoOfAllBanks) // everyone did their actions, turn finished
|
||||
if (gCurrentTurnActionNumber >= gBattleBanksCount) // everyone did their actions, turn finished
|
||||
{
|
||||
gHitMarker &= ~(HITMARKER_x100000);
|
||||
gBattleMainFunc = sEndTurnFuncsTable[gBattleOutcome & 0x7F];
|
||||
@ -4727,9 +4727,9 @@ static void HandleEndTurn_BattleWon(void)
|
||||
{
|
||||
gSpecialVar_Result = gBattleOutcome;
|
||||
gBattleTextBuff1[0] = gBattleOutcome;
|
||||
gBankAttacker = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
gBankAttacker = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost;
|
||||
gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
|
||||
gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN);
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
||||
&& gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_x4000000 | BATTLE_TYPE_EREADER_TRAINER))
|
||||
@ -4785,24 +4785,24 @@ static void HandleEndTurn_BattleLost(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
{
|
||||
if (gBattleOutcome & OUTCOME_LINK_BATTLE_RUN)
|
||||
if (gBattleOutcome & B_OUTCOME_LINK_BATTLE_RAN)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeitedLinkBattle;
|
||||
gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
|
||||
gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN);
|
||||
gSaveBlock2Ptr->field_CA9_b = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_82DAA0B;
|
||||
gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
|
||||
gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleTextBuff1[0] = gBattleOutcome;
|
||||
gBankAttacker = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
gBankAttacker = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost;
|
||||
gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
|
||||
gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -4820,13 +4820,13 @@ static void HandleEndTurn_RanFromBattle(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER && gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeited;
|
||||
gBattleOutcome = BATTLE_FORFEITED;
|
||||
gBattleOutcome = B_OUTCOME_FORFEITED;
|
||||
gSaveBlock2Ptr->field_CA9_b = 1;
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeited;
|
||||
gBattleOutcome = BATTLE_FORFEITED;
|
||||
gBattleOutcome = B_OUTCOME_FORFEITED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4869,7 +4869,7 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
| BATTLE_TYPE_WALLY_TUTORIAL
|
||||
| BATTLE_TYPE_FRONTIER)))
|
||||
{
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
|
||||
{
|
||||
@ -4919,7 +4919,7 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
ResetSpriteData();
|
||||
if (gLeveledUpInBattle == 0 || gBattleOutcome != BATTLE_WON)
|
||||
if (gLeveledUpInBattle == 0 || gBattleOutcome != B_OUTCOME_WON)
|
||||
{
|
||||
gBattleMainFunc = ReturnFromBattleToOverworld;
|
||||
return;
|
||||
@ -4994,7 +4994,7 @@ static void ReturnFromBattleToOverworld(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_ROAMER)
|
||||
{
|
||||
UpdateRoamerHPStatus(&gEnemyParty[0]);
|
||||
if ((gBattleOutcome & BATTLE_WON) || gBattleOutcome == BATTLE_CAUGHT)
|
||||
if ((gBattleOutcome & B_OUTCOME_WON) || gBattleOutcome == B_OUTCOME_CAUGHT_POKE)
|
||||
SetRoamerInactive();
|
||||
}
|
||||
|
||||
@ -5039,7 +5039,7 @@ static void HandleAction_UseMove(void)
|
||||
gCritMultiplier = 1;
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gBattleStruct->atkCancellerTracker = 0;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gMultiHitCounter = 0;
|
||||
gBattleCommunication[6] = 0;
|
||||
gCurrMovePos = gUnknown_020241E9 = *(gBattleStruct->chosenMovePositions + gBankAttacker);
|
||||
@ -5100,7 +5100,7 @@ static void HandleAction_UseMove(void)
|
||||
&& GetBankSide(gBankAttacker) != GetBankSide(gSideTimers[side].followmeTarget)
|
||||
&& gBattleMons[gSideTimers[side].followmeTarget].hp != 0)
|
||||
{
|
||||
gBankTarget = gSideTimers[side].followmeTarget;
|
||||
gBankDefender = gSideTimers[side].followmeTarget;
|
||||
}
|
||||
else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
&& gSideTimers[side].followmeTimer == 0
|
||||
@ -5110,7 +5110,7 @@ static void HandleAction_UseMove(void)
|
||||
&& gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC)
|
||||
{
|
||||
side = GetBankSide(gBankAttacker);
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (side != GetBankSide(gActiveBank)
|
||||
&& *(gBattleStruct->moveTarget + gBankAttacker) != gActiveBank
|
||||
@ -5127,34 +5127,34 @@ static void HandleAction_UseMove(void)
|
||||
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
|
||||
{
|
||||
if (Random() & 1)
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
else
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Random() & 1)
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
else
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gBankTarget = *(gBattleStruct->moveTarget + gBankAttacker);
|
||||
gBankDefender = *(gBattleStruct->moveTarget + gBankAttacker);
|
||||
}
|
||||
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget])
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender])
|
||||
{
|
||||
if (GetBankSide(gBankAttacker) != GetBankSide(gBankTarget))
|
||||
if (GetBankSide(gBankAttacker) != GetBankSide(gBankDefender))
|
||||
{
|
||||
gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
|
||||
gBankDefender = GetBankByPosition(GetBankPosition(gBankDefender) ^ BIT_MON);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBankTarget = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_SIDE);
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget])
|
||||
gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
|
||||
gBankDefender = GetBankByPosition(GetBankPosition(gBankAttacker) ^ BIT_SIDE);
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender])
|
||||
gBankDefender = GetBankByPosition(GetBankPosition(gBankDefender) ^ BIT_MON);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5163,7 +5163,7 @@ static void HandleAction_UseMove(void)
|
||||
gActiveBank = gBanksByTurnOrder[var];
|
||||
RecordAbilityBattle(gActiveBank, gBattleMons[gActiveBank].ability);
|
||||
gSpecialStatuses[gActiveBank].lightningRodRedirected = 1;
|
||||
gBankTarget = gActiveBank;
|
||||
gBankDefender = gActiveBank;
|
||||
}
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
|
||||
@ -5172,38 +5172,38 @@ static void HandleAction_UseMove(void)
|
||||
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
|
||||
{
|
||||
if (Random() & 1)
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
else
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Random() & 1)
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
else
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
|
||||
}
|
||||
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget]
|
||||
&& GetBankSide(gBankAttacker) != GetBankSide(gBankTarget))
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender]
|
||||
&& GetBankSide(gBankAttacker) != GetBankSide(gBankDefender))
|
||||
{
|
||||
gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
|
||||
gBankDefender = GetBankByPosition(GetBankPosition(gBankDefender) ^ BIT_MON);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gBankTarget = *(gBattleStruct->moveTarget + gBankAttacker);
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget])
|
||||
gBankDefender = *(gBattleStruct->moveTarget + gBankAttacker);
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender])
|
||||
{
|
||||
if (GetBankSide(gBankAttacker) != GetBankSide(gBankTarget))
|
||||
if (GetBankSide(gBankAttacker) != GetBankSide(gBankDefender))
|
||||
{
|
||||
gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
|
||||
gBankDefender = GetBankByPosition(GetBankPosition(gBankDefender) ^ BIT_MON);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBankTarget = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_SIDE);
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget])
|
||||
gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
|
||||
gBankDefender = GetBankByPosition(GetBankPosition(gBankAttacker) ^ BIT_SIDE);
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender])
|
||||
gBankDefender = GetBankByPosition(GetBankPosition(gBankDefender) ^ BIT_MON);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5260,7 +5260,7 @@ static void HandleAction_Switch(void)
|
||||
|
||||
static void HandleAction_UseItem(void)
|
||||
{
|
||||
gBankAttacker = gBankTarget = gBanksByTurnOrder[gCurrentTurnActionNumber];
|
||||
gBankAttacker = gBankDefender = gBanksByTurnOrder[gCurrentTurnActionNumber];
|
||||
gBattle_BG0_X = 0;
|
||||
gBattle_BG0_Y = 0;
|
||||
ClearFuryCutterDestinyBondGrudge(gBankAttacker);
|
||||
@ -5410,8 +5410,8 @@ bool8 TryRunFromBattle(u8 bank)
|
||||
|
||||
if (effect)
|
||||
{
|
||||
gCurrentTurnActionNumber = gNoOfAllBanks;
|
||||
gBattleOutcome = BATTLE_RAN;
|
||||
gCurrentTurnActionNumber = gBattleBanksCount;
|
||||
gBattleOutcome = B_OUTCOME_RAN;
|
||||
}
|
||||
|
||||
return effect;
|
||||
@ -5423,23 +5423,23 @@ static void HandleAction_Run(void)
|
||||
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
|
||||
{
|
||||
gCurrentTurnActionNumber = gNoOfAllBanks;
|
||||
gCurrentTurnActionNumber = gBattleBanksCount;
|
||||
|
||||
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
|
||||
for (gActiveBank = 0; gActiveBank < gBattleBanksCount; gActiveBank++)
|
||||
{
|
||||
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
|
||||
{
|
||||
if (gActionForBanks[gActiveBank] == ACTION_RUN)
|
||||
gBattleOutcome |= BATTLE_LOST;
|
||||
gBattleOutcome |= B_OUTCOME_LOST;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gActionForBanks[gActiveBank] == ACTION_RUN)
|
||||
gBattleOutcome |= BATTLE_WON;
|
||||
gBattleOutcome |= B_OUTCOME_WON;
|
||||
}
|
||||
}
|
||||
|
||||
gBattleOutcome |= OUTCOME_LINK_BATTLE_RUN;
|
||||
gBattleOutcome |= B_OUTCOME_LINK_BATTLE_RAN;
|
||||
gSaveBlock2Ptr->field_CA9_b = 1;
|
||||
}
|
||||
else
|
||||
@ -5464,8 +5464,8 @@ static void HandleAction_Run(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gCurrentTurnActionNumber = gNoOfAllBanks;
|
||||
gBattleOutcome = BATTLE_POKE_FLED;
|
||||
gCurrentTurnActionNumber = gBattleBanksCount;
|
||||
gBattleOutcome = B_OUTCOME_POKE_FLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5546,8 +5546,8 @@ static void HandleAction_SafriZoneRun(void)
|
||||
{
|
||||
gBankAttacker = gBanksByTurnOrder[gCurrentTurnActionNumber];
|
||||
PlaySE(SE_NIGERU);
|
||||
gCurrentTurnActionNumber = gNoOfAllBanks;
|
||||
gBattleOutcome = BATTLE_RAN;
|
||||
gCurrentTurnActionNumber = gBattleBanksCount;
|
||||
gBattleOutcome = B_OUTCOME_RAN;
|
||||
}
|
||||
|
||||
static void HandleAction_Action9(void)
|
||||
@ -5597,7 +5597,7 @@ static void HandleAction_ActionFinished(void)
|
||||
|
||||
gCurrentMove = 0;
|
||||
gBattleMoveDamage = 0;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gBattleScripting.animTurn = 0;
|
||||
gBattleScripting.animTargetsHit = 0;
|
||||
gLastLandedMoves[gBankAttacker] = 0;
|
||||
|
@ -48,16 +48,16 @@ extern u32 gBattleTypeFlags;
|
||||
extern u8 gActiveBank;
|
||||
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
|
||||
extern u16 gCurrentMove;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u16 gLastMoves[BATTLE_BANKS_COUNT];
|
||||
extern u16 gTrainerBattleOpponent_A;
|
||||
extern u16 gTrainerBattleOpponent_B;
|
||||
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
|
||||
extern u16 gSideAffecting[2];
|
||||
extern u16 gSideStatuses[2];
|
||||
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
extern u16 gDynamicBasePower;
|
||||
extern u8 gBattleMoveFlags;
|
||||
extern u8 gMoveResultFlags;
|
||||
extern s32 gBattleMoveDamage;
|
||||
extern u8 gCritMultiplier;
|
||||
extern u16 gBattleWeather;
|
||||
@ -367,14 +367,14 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
|
||||
// decide a random target bank in doubles
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
gBankTarget = (Random() & BIT_MON) + (GetBankSide(gActiveBank) ^ BIT_SIDE);
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget])
|
||||
gBankTarget ^= BIT_MON;
|
||||
gBankDefender = (Random() & BIT_MON) + (GetBankSide(gActiveBank) ^ BIT_SIDE);
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender])
|
||||
gBankDefender ^= BIT_MON;
|
||||
}
|
||||
// in singles there's only one choice
|
||||
else
|
||||
{
|
||||
gBankTarget = sBank_AI ^ BIT_SIDE;
|
||||
gBankDefender = sBank_AI ^ BIT_SIDE;
|
||||
}
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
@ -491,7 +491,7 @@ static u8 BattleAI_ChooseMoveOrAction_Doubles(void)
|
||||
else
|
||||
BattleAI_SetupAIData(0xF);
|
||||
|
||||
gBankTarget = i;
|
||||
gBankDefender = i;
|
||||
|
||||
if ((i & BIT_SIDE) != (sBank_AI & BIT_SIDE))
|
||||
RecordLastUsedMoveByTarget();
|
||||
@ -573,8 +573,8 @@ static u8 BattleAI_ChooseMoveOrAction_Doubles(void)
|
||||
}
|
||||
}
|
||||
|
||||
gBankTarget = mostViableTargetsArray[Random() % mostViableTargetsNo];
|
||||
return actionOrMoveIndex[gBankTarget];
|
||||
gBankDefender = mostViableTargetsArray[Random() % mostViableTargetsNo];
|
||||
return actionOrMoveIndex[gBankDefender];
|
||||
}
|
||||
|
||||
static void BattleAI_DoAIProcessing(void)
|
||||
@ -627,12 +627,12 @@ static void RecordLastUsedMoveByTarget(void)
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] == gLastMoves[gBankTarget])
|
||||
if (gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] == gLastMoves[gBankDefender])
|
||||
break;
|
||||
if (gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] != gLastMoves[gBankTarget] // HACK: This redundant condition is a hack to make the asm match.
|
||||
&& gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] == 0)
|
||||
if (gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] != gLastMoves[gBankDefender] // HACK: This redundant condition is a hack to make the asm match.
|
||||
&& gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] == 0)
|
||||
{
|
||||
gBattleResources->battleHistory->usedMoves[gBankTarget].moves[i] = gLastMoves[gBankTarget];
|
||||
gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] = gLastMoves[gBankDefender];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -723,7 +723,7 @@ static void BattleAICmd_if_hp_less_than(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) < gAIScriptPtr[2])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
||||
@ -738,7 +738,7 @@ static void BattleAICmd_if_hp_more_than(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) > gAIScriptPtr[2])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
||||
@ -753,7 +753,7 @@ static void BattleAICmd_if_hp_equal(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) == gAIScriptPtr[2])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
||||
@ -768,7 +768,7 @@ static void BattleAICmd_if_hp_not_equal(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) != gAIScriptPtr[2])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
|
||||
@ -784,7 +784,7 @@ static void BattleAICmd_if_status(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
@ -802,7 +802,7 @@ static void BattleAICmd_if_not_status(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
@ -820,7 +820,7 @@ static void BattleAICmd_if_status2(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
@ -838,7 +838,7 @@ static void BattleAICmd_if_not_status2(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
@ -856,7 +856,7 @@ static void BattleAICmd_if_status3(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
@ -874,7 +874,7 @@ static void BattleAICmd_if_not_status3(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
@ -892,12 +892,12 @@ static void BattleAICmd_if_side_affecting(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
side = GET_BANK_SIDE(bank);
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
if ((gSideAffecting[side] & status) != 0)
|
||||
if ((gSideStatuses[side] & status) != 0)
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
||||
else
|
||||
gAIScriptPtr += 10;
|
||||
@ -911,12 +911,12 @@ static void BattleAICmd_if_not_side_affecting(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
side = GET_BANK_SIDE(bank);
|
||||
status = AIScriptRead32(gAIScriptPtr + 2);
|
||||
|
||||
if ((gSideAffecting[side] & status) == 0)
|
||||
if ((gSideStatuses[side] & status) == 0)
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
|
||||
else
|
||||
gAIScriptPtr += 10;
|
||||
@ -1126,13 +1126,13 @@ static void BattleAICmd_get_type(void)
|
||||
AI_THINKING_STRUCT->funcResult = gBattleMons[sBank_AI].type1;
|
||||
break;
|
||||
case AI_TYPE1_TARGET: // target primary type
|
||||
AI_THINKING_STRUCT->funcResult = gBattleMons[gBankTarget].type1;
|
||||
AI_THINKING_STRUCT->funcResult = gBattleMons[gBankDefender].type1;
|
||||
break;
|
||||
case AI_TYPE2_USER: // AI user secondary type
|
||||
AI_THINKING_STRUCT->funcResult = gBattleMons[sBank_AI].type2;
|
||||
break;
|
||||
case AI_TYPE2_TARGET: // target secondary type
|
||||
AI_THINKING_STRUCT->funcResult = gBattleMons[gBankTarget].type2;
|
||||
AI_THINKING_STRUCT->funcResult = gBattleMons[gBankDefender].type2;
|
||||
break;
|
||||
case AI_TYPE_MOVE: // type of move being pointed to
|
||||
AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->moveConsidered].type;
|
||||
@ -1149,11 +1149,11 @@ static u8 BattleAI_GetWantedBank(u8 bank)
|
||||
return sBank_AI;
|
||||
case AI_TARGET:
|
||||
default:
|
||||
return gBankTarget;
|
||||
return gBankDefender;
|
||||
case AI_USER_PARTNER:
|
||||
return sBank_AI ^ BIT_MON;
|
||||
case AI_TARGET_PARTNER:
|
||||
return gBankTarget ^ BIT_MON;
|
||||
return gBankDefender ^ BIT_MON;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1196,7 +1196,7 @@ static void BattleAICmd_get_how_powerful_move_is(void)
|
||||
gDynamicBasePower = 0;
|
||||
*(&gBattleStruct->dynamicMoveType) = 0;
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
|
||||
for (checkedMove = 0; checkedMove < 4; checkedMove++)
|
||||
@ -1212,8 +1212,8 @@ static void BattleAICmd_get_how_powerful_move_is(void)
|
||||
&& gBattleMoves[gBattleMons[sBank_AI].moves[checkedMove]].power > 1)
|
||||
{
|
||||
gCurrentMove = gBattleMons[sBank_AI].moves[checkedMove];
|
||||
AI_CalcDmg(sBank_AI, gBankTarget);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankTarget);
|
||||
AI_CalcDmg(sBank_AI, gBankDefender);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
|
||||
moveDmgs[checkedMove] = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[checkedMove] / 100;
|
||||
if (moveDmgs[checkedMove] == 0)
|
||||
moveDmgs[checkedMove] = 1;
|
||||
@ -1248,7 +1248,7 @@ static void BattleAICmd_get_last_used_bank_move(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
AI_THINKING_STRUCT->funcResult = gLastMoves[sBank_AI];
|
||||
else
|
||||
AI_THINKING_STRUCT->funcResult = gLastMoves[gBankTarget];
|
||||
AI_THINKING_STRUCT->funcResult = gLastMoves[gBankDefender];
|
||||
|
||||
gAIScriptPtr += 2;
|
||||
}
|
||||
@ -1271,7 +1271,7 @@ static void BattleAICmd_if_not_equal_(void) // same as if_not_equal
|
||||
|
||||
static void BattleAICmd_if_user_goes(void)
|
||||
{
|
||||
if (GetWhoStrikesFirst(sBank_AI, gBankTarget, TRUE) == gAIScriptPtr[1])
|
||||
if (GetWhoStrikesFirst(sBank_AI, gBankDefender, TRUE) == gAIScriptPtr[1])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
||||
else
|
||||
gAIScriptPtr += 6;
|
||||
@ -1279,7 +1279,7 @@ static void BattleAICmd_if_user_goes(void)
|
||||
|
||||
static void BattleAICmd_if_user_doesnt_go(void)
|
||||
{
|
||||
if (GetWhoStrikesFirst(sBank_AI, gBankTarget, TRUE) != gAIScriptPtr[1])
|
||||
if (GetWhoStrikesFirst(sBank_AI, gBankDefender, TRUE) != gAIScriptPtr[1])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
||||
else
|
||||
gAIScriptPtr += 6;
|
||||
@ -1305,7 +1305,7 @@ static void BattleAICmd_count_usable_party_mons(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (GetBankSide(bank) == SIDE_PLAYER)
|
||||
party = gPlayerParty;
|
||||
@ -1317,7 +1317,7 @@ static void BattleAICmd_count_usable_party_mons(void)
|
||||
u32 identity;
|
||||
bankOnField1 = gBattlePartyID[bank];
|
||||
identity = GetBankPosition(bank) ^ BIT_MON;
|
||||
bankOnField2 = gBattlePartyID[GetBankByIdentity(identity)];
|
||||
bankOnField2 = gBattlePartyID[GetBankByPosition(identity)];
|
||||
}
|
||||
else // in singles there's only one bank by side
|
||||
{
|
||||
@ -1358,7 +1358,7 @@ static void BattleAICmd_get_ability(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (gActiveBank != bank)
|
||||
{
|
||||
@ -1482,7 +1482,7 @@ static void BattleAICmd_get_highest_type_effectiveness(void)
|
||||
dynamicMoveType = &gBattleStruct->dynamicMoveType;
|
||||
*dynamicMoveType = 0;
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
AI_THINKING_STRUCT->funcResult = 0;
|
||||
|
||||
@ -1493,7 +1493,7 @@ static void BattleAICmd_get_highest_type_effectiveness(void)
|
||||
|
||||
if (gCurrentMove)
|
||||
{
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankTarget);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
|
||||
|
||||
// reduce by 1/3.
|
||||
if (gBattleMoveDamage == 120)
|
||||
@ -1505,7 +1505,7 @@ static void BattleAICmd_get_highest_type_effectiveness(void)
|
||||
if (gBattleMoveDamage == 15)
|
||||
gBattleMoveDamage = AI_EFFECTIVENESS_x0_25;
|
||||
|
||||
if (gBattleMoveFlags & MOVESTATUS_NOTAFFECTED)
|
||||
if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
|
||||
gBattleMoveDamage = AI_EFFECTIVENESS_x0;
|
||||
|
||||
if (AI_THINKING_STRUCT->funcResult < gBattleMoveDamage)
|
||||
@ -1522,13 +1522,13 @@ static void BattleAICmd_if_type_effectiveness(void)
|
||||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
|
||||
gBattleMoveDamage = AI_EFFECTIVENESS_x1;
|
||||
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
|
||||
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankTarget);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
|
||||
|
||||
if (gBattleMoveDamage == 120)
|
||||
gBattleMoveDamage = AI_EFFECTIVENESS_x2;
|
||||
@ -1539,7 +1539,7 @@ static void BattleAICmd_if_type_effectiveness(void)
|
||||
if (gBattleMoveDamage == 15)
|
||||
gBattleMoveDamage = AI_EFFECTIVENESS_x0_25;
|
||||
|
||||
if (gBattleMoveFlags & MOVESTATUS_NOTAFFECTED)
|
||||
if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
|
||||
gBattleMoveDamage = AI_EFFECTIVENESS_x0;
|
||||
|
||||
// store gBattleMoveDamage in a u8 variable because gAIScriptPtr[1] is a u8.
|
||||
@ -1572,7 +1572,7 @@ static void BattleAICmd_if_status_in_party(void)
|
||||
bank = sBank_AI;
|
||||
break;
|
||||
default:
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1609,7 +1609,7 @@ static void BattleAICmd_if_status_not_in_party(void)
|
||||
bank = sBank_AI;
|
||||
break;
|
||||
default:
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1669,7 +1669,7 @@ static void BattleAICmd_if_stat_level_less_than(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] < gAIScriptPtr[3])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
||||
@ -1684,7 +1684,7 @@ static void BattleAICmd_if_stat_level_more_than(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] > gAIScriptPtr[3])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
||||
@ -1699,7 +1699,7 @@ static void BattleAICmd_if_stat_level_equal(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] == gAIScriptPtr[3])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
||||
@ -1714,7 +1714,7 @@ static void BattleAICmd_if_stat_level_not_equal(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] != gAIScriptPtr[3])
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
|
||||
@ -1733,11 +1733,11 @@ static void BattleAICmd_if_can_faint(void)
|
||||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
|
||||
AI_CalcDmg(sBank_AI, gBankTarget);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankTarget);
|
||||
AI_CalcDmg(sBank_AI, gBankDefender);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
|
||||
|
||||
gBattleMoveDamage = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[AI_THINKING_STRUCT->movesetIndex] / 100;
|
||||
|
||||
@ -1745,7 +1745,7 @@ static void BattleAICmd_if_can_faint(void)
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
|
||||
if (gBattleMons[gBankTarget].hp <= gBattleMoveDamage)
|
||||
if (gBattleMons[gBankDefender].hp <= gBattleMoveDamage)
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
||||
else
|
||||
gAIScriptPtr += 5;
|
||||
@ -1762,17 +1762,17 @@ static void BattleAICmd_if_cant_faint(void)
|
||||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
|
||||
AI_CalcDmg(sBank_AI, gBankTarget);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankTarget);
|
||||
AI_CalcDmg(sBank_AI, gBankDefender);
|
||||
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
|
||||
|
||||
gBattleMoveDamage = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[AI_THINKING_STRUCT->movesetIndex] / 100;
|
||||
|
||||
// this macro is missing the damage 0 = 1 assumption.
|
||||
|
||||
if (gBattleMons[gBankTarget].hp > gBattleMoveDamage)
|
||||
if (gBattleMons[gBankDefender].hp > gBattleMoveDamage)
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
||||
else
|
||||
gAIScriptPtr += 5;
|
||||
@ -1829,7 +1829,7 @@ static void BattleAICmd_if_has_move(void)
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[gBankTarget].moves[i] == *movePtr)
|
||||
if (BATTLE_HISTORY->usedMoves[gBankDefender].moves[i] == *movePtr)
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
@ -1873,7 +1873,7 @@ static void BattleAICmd_if_doesnt_have_move(void)
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[gBankTarget].moves[i] == *movePtr)
|
||||
if (BATTLE_HISTORY->usedMoves[gBankDefender].moves[i] == *movePtr)
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
@ -1911,8 +1911,8 @@ static void BattleAICmd_if_has_move_with_effect(void)
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
// UB: checks sBank_AI instead of gBankTarget
|
||||
if (gBattleMons[sBank_AI].moves[i] != 0 && gBattleMoves[BATTLE_HISTORY->usedMoves[gBankTarget].moves[i]].effect == gAIScriptPtr[2])
|
||||
// UB: checks sBank_AI instead of gBankDefender
|
||||
if (gBattleMons[sBank_AI].moves[i] != 0 && gBattleMoves[BATTLE_HISTORY->usedMoves[gBankDefender].moves[i]].effect == gAIScriptPtr[2])
|
||||
break;
|
||||
}
|
||||
if (i == 4)
|
||||
@ -1945,7 +1945,7 @@ static void BattleAICmd_if_doesnt_have_move_with_effect(void)
|
||||
case AI_TARGET_PARTNER:
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[gBankTarget].moves[i] && gBattleMoves[BATTLE_HISTORY->usedMoves[gBankTarget].moves[i]].effect == gAIScriptPtr[2])
|
||||
if (BATTLE_HISTORY->usedMoves[gBankDefender].moves[i] && gBattleMoves[BATTLE_HISTORY->usedMoves[gBankDefender].moves[i]].effect == gAIScriptPtr[2])
|
||||
break;
|
||||
}
|
||||
if (i != 4)
|
||||
@ -1963,7 +1963,7 @@ static void BattleAICmd_if_any_move_disabled_or_encored(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (gAIScriptPtr[2] == 0)
|
||||
{
|
||||
@ -2041,7 +2041,7 @@ static void BattleAICmd_get_hold_effect(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
if (gActiveBank != bank)
|
||||
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(BATTLE_HISTORY->itemEffects[bank]);
|
||||
@ -2079,7 +2079,7 @@ static void BattleAICmd_get_gender(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
AI_THINKING_STRUCT->funcResult = GetGenderFromSpeciesAndPersonality(gBattleMons[bank].species, gBattleMons[bank].personality);
|
||||
|
||||
@ -2093,7 +2093,7 @@ static void BattleAICmd_is_first_turn_for(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].isFirstTurn;
|
||||
|
||||
@ -2107,7 +2107,7 @@ static void BattleAICmd_get_stockpile_count(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].stockpileCounter;
|
||||
|
||||
@ -2128,7 +2128,7 @@ static void BattleAICmd_get_used_held_item(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
// This is likely a leftover from Ruby's code and its ugly ewram access
|
||||
#ifdef NONMATCHING
|
||||
@ -2168,7 +2168,7 @@ static void BattleAICmd_get_protect_count(void)
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
bank = sBank_AI;
|
||||
else
|
||||
bank = gBankTarget;
|
||||
bank = gBankDefender;
|
||||
|
||||
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].protectUses;
|
||||
|
||||
@ -2221,7 +2221,7 @@ static void BattleAICmd_if_level_cond(void)
|
||||
switch (gAIScriptPtr[1])
|
||||
{
|
||||
case 0: // greater than
|
||||
if (gBattleMons[sBank_AI].level > gBattleMons[gBankTarget].level)
|
||||
if (gBattleMons[sBank_AI].level > gBattleMons[gBankDefender].level)
|
||||
{
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
||||
return;
|
||||
@ -2229,7 +2229,7 @@ static void BattleAICmd_if_level_cond(void)
|
||||
gAIScriptPtr += 6;
|
||||
return;
|
||||
case 1: // less than
|
||||
if (gBattleMons[sBank_AI].level < gBattleMons[gBankTarget].level)
|
||||
if (gBattleMons[sBank_AI].level < gBattleMons[gBankDefender].level)
|
||||
{
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
||||
return;
|
||||
@ -2237,7 +2237,7 @@ static void BattleAICmd_if_level_cond(void)
|
||||
gAIScriptPtr += 6;
|
||||
return;
|
||||
case 2: // equal
|
||||
if (gBattleMons[sBank_AI].level == gBattleMons[gBankTarget].level)
|
||||
if (gBattleMons[sBank_AI].level == gBattleMons[gBankDefender].level)
|
||||
{
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
|
||||
return;
|
||||
@ -2249,7 +2249,7 @@ static void BattleAICmd_if_level_cond(void)
|
||||
|
||||
static void BattleAICmd_if_target_taunted(void)
|
||||
{
|
||||
if (gDisableStructs[gBankTarget].tauntTimer1 != 0)
|
||||
if (gDisableStructs[gBankDefender].tauntTimer1 != 0)
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
||||
else
|
||||
gAIScriptPtr += 5;
|
||||
@ -2257,7 +2257,7 @@ static void BattleAICmd_if_target_taunted(void)
|
||||
|
||||
static void BattleAICmd_if_target_not_taunted(void)
|
||||
{
|
||||
if (gDisableStructs[gBankTarget].tauntTimer1 == 0)
|
||||
if (gDisableStructs[gBankDefender].tauntTimer1 == 0)
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
||||
else
|
||||
gAIScriptPtr += 5;
|
||||
@ -2265,7 +2265,7 @@ static void BattleAICmd_if_target_not_taunted(void)
|
||||
|
||||
static void BattleAICmd_if_target_is_ally(void)
|
||||
{
|
||||
if ((sBank_AI & BIT_SIDE) == (gBankTarget & BIT_SIDE))
|
||||
if ((sBank_AI & BIT_SIDE) == (gBankDefender & BIT_SIDE))
|
||||
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
|
||||
else
|
||||
gAIScriptPtr += 5;
|
||||
|
@ -19,7 +19,7 @@ extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
extern u16 gLastLandedMoves[BATTLE_BANKS_COUNT];
|
||||
extern u8 gLastHitBy[BATTLE_BANKS_COUNT];
|
||||
extern u16 gDynamicBasePower;
|
||||
extern u8 gBattleMoveFlags;
|
||||
extern u8 gMoveResultFlags;
|
||||
extern u8 gCritMultiplier;
|
||||
extern s32 gBattleMoveDamage;
|
||||
|
||||
@ -48,7 +48,7 @@ static bool8 ShouldSwitchIfPerishSong(void)
|
||||
|
||||
static bool8 ShouldSwitchIfWonderGuard(void)
|
||||
{
|
||||
u8 opposingIdentity;
|
||||
u8 opposingPosition;
|
||||
u8 opposingBank;
|
||||
u8 moveFlags;
|
||||
s32 i, j;
|
||||
@ -60,20 +60,20 @@ static bool8 ShouldSwitchIfWonderGuard(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
return FALSE;
|
||||
|
||||
opposingIdentity = GetBankPosition(gActiveBank) ^ BIT_SIDE;
|
||||
opposingPosition = B_POSITION_OPPOSITE(GetBankPosition(gActiveBank));
|
||||
|
||||
if (gBattleMons[GetBankByIdentity(opposingIdentity)].ability != ABILITY_WONDER_GUARD)
|
||||
if (gBattleMons[GetBankByPosition(opposingPosition)].ability != ABILITY_WONDER_GUARD)
|
||||
return FALSE;
|
||||
|
||||
// check if pokemon has a super effective move
|
||||
for (opposingBank = GetBankByIdentity(opposingIdentity), i = 0; i < 4; i++)
|
||||
for (opposingBank = GetBankByPosition(opposingPosition), i = 0; i < 4; i++)
|
||||
{
|
||||
move = gBattleMons[gActiveBank].moves[i];
|
||||
if (move == MOVE_NONE)
|
||||
continue;
|
||||
|
||||
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
|
||||
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE)
|
||||
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -110,14 +110,14 @@ static bool8 ShouldSwitchIfWonderGuard(void)
|
||||
GetMonData(&party[i], MON_DATA_SPECIES); // unused return value
|
||||
GetMonData(&party[i], MON_DATA_ALT_ABILITY); // unused return value
|
||||
|
||||
for (opposingBank = GetBankByIdentity(opposingIdentity), j = 0; j < 4; j++)
|
||||
for (opposingBank = GetBankByPosition(opposingPosition), j = 0; j < 4; j++)
|
||||
{
|
||||
move = GetMonData(&party[i], MON_DATA_MOVE1 + j);
|
||||
if (move == MOVE_NONE)
|
||||
continue;
|
||||
|
||||
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
|
||||
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % 3 < 2)
|
||||
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % 3 < 2)
|
||||
{
|
||||
// we found a mon
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
|
||||
@ -151,10 +151,10 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
bankIn1 = gActiveBank;
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)])
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)))])
|
||||
bankIn2 = gActiveBank;
|
||||
else
|
||||
bankIn2 = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON);
|
||||
bankIn2 = GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -231,7 +231,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
|
||||
|
||||
static bool8 ShouldSwitchIfNaturalCure(void)
|
||||
{
|
||||
if (!(gBattleMons[gActiveBank].status1 & STATUS_SLEEP))
|
||||
if (!(gBattleMons[gActiveBank].status1 & STATUS1_SLEEP))
|
||||
return FALSE;
|
||||
if (gBattleMons[gActiveBank].ability != ABILITY_NATURAL_CURE)
|
||||
return FALSE;
|
||||
@ -251,9 +251,9 @@ static bool8 ShouldSwitchIfNaturalCure(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (FindMonWithFlagsAndSuperEffective(MOVESTATUS_NOTAFFECTED, 1))
|
||||
if (FindMonWithFlagsAndSuperEffective(MOVE_RESULT_DOESNT_AFFECT_FOE, 1))
|
||||
return TRUE;
|
||||
if (FindMonWithFlagsAndSuperEffective(MOVESTATUS_NOTVERYEFFECTIVE, 1))
|
||||
if (FindMonWithFlagsAndSuperEffective(MOVE_RESULT_NOT_VERY_EFFECTIVE, 1))
|
||||
return TRUE;
|
||||
if (Random() & 1)
|
||||
{
|
||||
@ -267,14 +267,14 @@ static bool8 ShouldSwitchIfNaturalCure(void)
|
||||
|
||||
static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
|
||||
{
|
||||
u8 opposingIdentity;
|
||||
u8 opposingPosition;
|
||||
u8 opposingBank;
|
||||
s32 i;
|
||||
u8 moveFlags;
|
||||
u16 move;
|
||||
|
||||
opposingIdentity = GetBankPosition(gActiveBank) ^ BIT_SIDE;
|
||||
opposingBank = GetBankByIdentity(opposingIdentity);
|
||||
opposingPosition = B_POSITION_OPPOSITE(GetBankPosition(gActiveBank));
|
||||
opposingBank = GetBankByPosition(opposingPosition);
|
||||
|
||||
if (!(gAbsentBankFlags & gBitTable[opposingBank]))
|
||||
{
|
||||
@ -285,7 +285,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
|
||||
continue;
|
||||
|
||||
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
|
||||
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE)
|
||||
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE)
|
||||
{
|
||||
if (noRng)
|
||||
return TRUE;
|
||||
@ -297,7 +297,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||
return FALSE;
|
||||
|
||||
opposingBank = GetBankByIdentity(opposingIdentity ^ BIT_MON);
|
||||
opposingBank = GetBankByPosition(B_POSITION_PARTNER(opposingPosition));
|
||||
|
||||
if (!(gAbsentBankFlags & gBitTable[opposingBank]))
|
||||
{
|
||||
@ -308,7 +308,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
|
||||
continue;
|
||||
|
||||
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
|
||||
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE)
|
||||
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE)
|
||||
{
|
||||
if (noRng)
|
||||
return TRUE;
|
||||
@ -357,10 +357,10 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
bankIn1 = gActiveBank;
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)])
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)))])
|
||||
bankIn2 = gActiveBank;
|
||||
else
|
||||
bankIn2 = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON);
|
||||
bankIn2 = GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -423,7 +423,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
|
||||
continue;
|
||||
|
||||
moveFlags = AI_TypeCalc(move, gBattleMons[bankIn1].species, gBattleMons[bankIn1].ability);
|
||||
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0)
|
||||
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % moduloPercent == 0)
|
||||
{
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
|
||||
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
|
||||
@ -468,10 +468,10 @@ static bool8 ShouldSwitch(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
bankIn1 = *activeBankPtr;
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(*activeBankPtr) ^ BIT_MON)])
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByPosition(GetBankPosition(*activeBankPtr) ^ BIT_MON)])
|
||||
bankIn2 = *activeBankPtr;
|
||||
else
|
||||
bankIn2 = GetBankByIdentity(GetBankPosition(*activeBankPtr) ^ BIT_MON);
|
||||
bankIn2 = GetBankByPosition(GetBankPosition(*activeBankPtr) ^ BIT_MON);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -530,8 +530,8 @@ static bool8 ShouldSwitch(void)
|
||||
return FALSE;
|
||||
if (AreStatsRaised())
|
||||
return FALSE;
|
||||
if (FindMonWithFlagsAndSuperEffective(MOVESTATUS_NOTAFFECTED, 2)
|
||||
|| FindMonWithFlagsAndSuperEffective(MOVESTATUS_NOTVERYEFFECTIVE, 3))
|
||||
if (FindMonWithFlagsAndSuperEffective(MOVE_RESULT_DOESNT_AFFECT_FOE, 2)
|
||||
|| FindMonWithFlagsAndSuperEffective(MOVE_RESULT_NOT_VERY_EFFECTIVE, 3))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@ -561,13 +561,13 @@ void AI_TrySwitchOrUseItem(void)
|
||||
{
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||
{
|
||||
bankIn1 = GetBankByIdentity(bankIdentity);
|
||||
bankIn1 = GetBankByPosition(bankIdentity);
|
||||
bankIn2 = bankIn1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bankIn1 = GetBankByIdentity(bankIdentity);
|
||||
bankIn2 = GetBankByIdentity(bankIdentity ^ BIT_MON);
|
||||
bankIn1 = GetBankByPosition(bankIdentity);
|
||||
bankIn2 = GetBankByPosition(bankIdentity ^ BIT_MON);
|
||||
}
|
||||
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
|
||||
@ -659,10 +659,10 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
bankIn1 = gActiveBank;
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)])
|
||||
if (gAbsentBankFlags & gBitTable[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)])
|
||||
bankIn2 = gActiveBank;
|
||||
else
|
||||
bankIn2 = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON);
|
||||
bankIn2 = GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON);
|
||||
|
||||
// UB: It considers the opponent only player's side even though it can battle alongside player;
|
||||
opposingBank = Random() & BIT_MON;
|
||||
@ -671,7 +671,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
opposingBank = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_SIDE);
|
||||
opposingBank = GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_SIDE);
|
||||
bankIn1 = gActiveBank;
|
||||
bankIn2 = gActiveBank;
|
||||
}
|
||||
@ -734,7 +734,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
move = GetMonData(&party[bestMonId], MON_DATA_MOVE1 + i);
|
||||
if (move != MOVE_NONE && TypeCalc(move, gActiveBank, opposingBank) & MOVESTATUS_SUPEREFFECTIVE)
|
||||
if (move != MOVE_NONE && TypeCalc(move, gActiveBank, opposingBank) & MOVE_RESULT_SUPER_EFFECTIVE)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -752,7 +752,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gBattleScripting.dmgMultiplier = 1;
|
||||
gBattleMoveFlags = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
bestDmg = 0;
|
||||
bestMonId = 6;
|
||||
@ -877,27 +877,27 @@ static bool8 ShouldUseItem(void)
|
||||
break;
|
||||
case AI_ITEM_CURE_CONDITION:
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) = 0;
|
||||
if (itemEffects[3] & 0x20 && gBattleMons[gActiveBank].status1 & STATUS_SLEEP)
|
||||
if (itemEffects[3] & 0x20 && gBattleMons[gActiveBank].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x20;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x10 && (gBattleMons[gActiveBank].status1 & STATUS_POISON || gBattleMons[gActiveBank].status1 & STATUS_TOXIC_POISON))
|
||||
if (itemEffects[3] & 0x10 && (gBattleMons[gActiveBank].status1 & STATUS1_POISON || gBattleMons[gActiveBank].status1 & STATUS1_TOXIC_POISON))
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x10;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x8 && gBattleMons[gActiveBank].status1 & STATUS_BURN)
|
||||
if (itemEffects[3] & 0x8 && gBattleMons[gActiveBank].status1 & STATUS1_BURN)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x8;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x4 && gBattleMons[gActiveBank].status1 & STATUS_FREEZE)
|
||||
if (itemEffects[3] & 0x4 && gBattleMons[gActiveBank].status1 & STATUS1_FREEZE)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x4;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x2 && gBattleMons[gActiveBank].status1 & STATUS_PARALYSIS)
|
||||
if (itemEffects[3] & 0x2 && gBattleMons[gActiveBank].status1 & STATUS1_PARALYSIS)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x2;
|
||||
shouldUse = TRUE;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define ANIM_SPRITE_INDEX_COUNT 8
|
||||
|
||||
extern u8 gBankAttacker;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u16 gBattle_WIN0H;
|
||||
extern u16 gBattle_WIN0V;
|
||||
extern u16 gBattle_WIN1H;
|
||||
@ -222,7 +222,7 @@ void ClearBattleAnimationVars(void)
|
||||
void DoMoveAnim(u16 move)
|
||||
{
|
||||
gAnimBankAttacker = gBankAttacker;
|
||||
gAnimBankTarget = gBankTarget;
|
||||
gAnimBankTarget = gBankDefender;
|
||||
LaunchBattleAnimation(gBattleAnims_Moves, move, TRUE);
|
||||
}
|
||||
|
||||
|
@ -273,13 +273,13 @@ static void sub_8035AE4(u8 taskId, u8 bank, u8 bgId, u8 destX, u8 destY)
|
||||
|
||||
static void sub_8035C4C(void)
|
||||
{
|
||||
if (gBattleOutcome == BATTLE_DREW)
|
||||
if (gBattleOutcome == B_OUTCOME_DREW)
|
||||
{
|
||||
BattleHandleAddTextPrinter(gText_Draw, 0x15);
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
if (gBattleOutcome == BATTLE_WON)
|
||||
if (gBattleOutcome == B_OUTCOME_WON)
|
||||
{
|
||||
switch (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18)
|
||||
{
|
||||
@ -324,7 +324,7 @@ static void sub_8035C4C(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gBattleOutcome == BATTLE_WON)
|
||||
else if (gBattleOutcome == B_OUTCOME_WON)
|
||||
{
|
||||
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 != 0)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
@ -47,7 +47,7 @@ extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT];
|
||||
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
|
||||
extern u16 gPartnerTrainerId;
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gUnknown_020244B4[];
|
||||
extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT];
|
||||
@ -1875,10 +1875,10 @@ static void LinkOpponentHandleCmd55(void)
|
||||
{
|
||||
sub_81851A8(&gBattleBufferA[gActiveBank][4]);
|
||||
|
||||
if (gBattleBufferA[gActiveBank][1] == BATTLE_DREW)
|
||||
if (gBattleBufferA[gActiveBank][1] == B_OUTCOME_DREW)
|
||||
gBattleOutcome = gBattleBufferA[gActiveBank][1];
|
||||
else
|
||||
gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ BATTLE_DREW;
|
||||
gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ B_OUTCOME_DREW;
|
||||
|
||||
gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBank][2];
|
||||
FadeOutMapMusic(5);
|
||||
|
@ -28,7 +28,7 @@ extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
@ -47,7 +47,7 @@ extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT];
|
||||
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
|
||||
extern u16 gPartnerTrainerId;
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gUnknown_020244B4[];
|
||||
extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT];
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
@ -1581,18 +1581,18 @@ static void OpponentHandleChooseMove(void)
|
||||
EmitTwoReturnValues(1, ACTION_RUN, 0);
|
||||
break;
|
||||
case 6:
|
||||
EmitTwoReturnValues(1, 15, gBankTarget);
|
||||
EmitTwoReturnValues(1, 15, gBankDefender);
|
||||
break;
|
||||
default:
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_x10))
|
||||
gBankTarget = gActiveBank;
|
||||
gBankDefender = gActiveBank;
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
|
||||
{
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget])
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender])
|
||||
gBankDefender = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
|
||||
}
|
||||
EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBankTarget << 8));
|
||||
EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBankDefender << 8));
|
||||
break;
|
||||
}
|
||||
OpponentBufferExecCompleted();
|
||||
@ -1609,9 +1609,9 @@ static void OpponentHandleChooseMove(void)
|
||||
if (gBattleMoves[move].target & (MOVE_TARGET_USER | MOVE_TARGET_x10))
|
||||
EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBank << 8));
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(Random() & 2) << 8));
|
||||
EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByPosition(Random() & 2) << 8));
|
||||
else
|
||||
EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(B_POSITION_PLAYER_LEFT) << 8));
|
||||
EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByPosition(B_POSITION_PLAYER_LEFT) << 8));
|
||||
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
@ -1638,12 +1638,12 @@ static void OpponentHandleChoosePokemon(void)
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||
{
|
||||
bank2 = bank1 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
bank2 = bank1 = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
bank1 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
bank2 = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
bank1 = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
bank2 = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
}
|
||||
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
|
||||
|
@ -33,7 +33,7 @@ extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern u8 gPlayerDpadHoldFrames;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
@ -358,7 +358,7 @@ static void HandleInputChooseAction(void)
|
||||
{
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
&& GetBankPosition(gActiveBank) == B_POSITION_PLAYER_RIGHT
|
||||
&& !(gAbsentBankFlags & gBitTable[GetBankByIdentity(B_POSITION_PLAYER_LEFT)])
|
||||
&& !(gAbsentBankFlags & gBitTable[GetBankByPosition(B_POSITION_PLAYER_LEFT)])
|
||||
&& !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||
{
|
||||
if (gBattleBufferA[gActiveBank][1] == ACTION_USE_ITEM)
|
||||
@ -397,14 +397,14 @@ static void HandleInputChooseTarget(void)
|
||||
|
||||
// what a weird loop
|
||||
i = 0;
|
||||
if (gNoOfAllBanks != 0)
|
||||
if (gBattleBanksCount != 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (i != gMultiUsePlayerCursor)
|
||||
dp11b_obj_free(i, 1);
|
||||
i++;
|
||||
} while (i < gNoOfAllBanks);
|
||||
} while (i < gBattleBanksCount);
|
||||
}
|
||||
|
||||
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2)
|
||||
@ -447,8 +447,8 @@ static void HandleInputChooseTarget(void)
|
||||
{
|
||||
if (--i < 0)
|
||||
i = 4; // UB: array out of range
|
||||
gMultiUsePlayerCursor = GetBankByIdentity(identities[i]);
|
||||
} while (gMultiUsePlayerCursor == gNoOfAllBanks);
|
||||
gMultiUsePlayerCursor = GetBankByPosition(identities[i]);
|
||||
} while (gMultiUsePlayerCursor == gBattleBanksCount);
|
||||
|
||||
i = 0;
|
||||
switch (GetBankPosition(gMultiUsePlayerCursor))
|
||||
@ -489,8 +489,8 @@ static void HandleInputChooseTarget(void)
|
||||
{
|
||||
if (++i > 3)
|
||||
i = 0;
|
||||
gMultiUsePlayerCursor = GetBankByIdentity(identities[i]);
|
||||
} while (gMultiUsePlayerCursor == gNoOfAllBanks);
|
||||
gMultiUsePlayerCursor = GetBankByPosition(identities[i]);
|
||||
} while (gMultiUsePlayerCursor == gBattleBanksCount);
|
||||
|
||||
i = 0;
|
||||
switch (GetBankPosition(gMultiUsePlayerCursor))
|
||||
@ -545,7 +545,7 @@ static void HandleInputChooseMove(void)
|
||||
if (moveTarget & MOVE_TARGET_x10)
|
||||
gMultiUsePlayerCursor = gActiveBank;
|
||||
else
|
||||
gMultiUsePlayerCursor = GetBankByIdentity((GetBankPosition(gActiveBank) & BIT_SIDE) ^ BIT_SIDE);
|
||||
gMultiUsePlayerCursor = GetBankByPosition((GetBankPosition(gActiveBank) & BIT_SIDE) ^ BIT_SIDE);
|
||||
|
||||
if (!gBattleBufferA[gActiveBank][1]) // not a double battle
|
||||
{
|
||||
@ -579,10 +579,10 @@ static void HandleInputChooseMove(void)
|
||||
|
||||
if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER))
|
||||
gMultiUsePlayerCursor = gActiveBank;
|
||||
else if (gAbsentBankFlags & gBitTable[GetBankByIdentity(B_POSITION_OPPONENT_LEFT)])
|
||||
gMultiUsePlayerCursor = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
else if (gAbsentBankFlags & gBitTable[GetBankByPosition(B_POSITION_OPPONENT_LEFT)])
|
||||
gMultiUsePlayerCursor = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
else
|
||||
gMultiUsePlayerCursor = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
gMultiUsePlayerCursor = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
|
||||
gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
|
||||
}
|
||||
@ -905,7 +905,7 @@ static void sub_80586F8(void)
|
||||
gMain.inBattle = 0;
|
||||
gMain.callback1 = gPreBattleCallback1;
|
||||
SetMainCallback2(sub_8038D64);
|
||||
if (gBattleOutcome == BATTLE_WON)
|
||||
if (gBattleOutcome == B_OUTCOME_WON)
|
||||
sub_817E3F4();
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
@ -918,7 +918,7 @@ static void sub_80586F8(void)
|
||||
gMain.inBattle = 0;
|
||||
gMain.callback1 = gPreBattleCallback1;
|
||||
SetMainCallback2(sub_8038D64);
|
||||
if (gBattleOutcome == BATTLE_WON)
|
||||
if (gBattleOutcome == B_OUTCOME_WON)
|
||||
sub_817E3F4();
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
@ -2463,7 +2463,7 @@ static void PlayerHandleSuccessBallThrowAnim(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
|
||||
gDoingBattleAnim = TRUE;
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW);
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW);
|
||||
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
|
||||
}
|
||||
|
||||
@ -2473,7 +2473,7 @@ static void PlayerHandleBallThrowAnim(void)
|
||||
|
||||
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
|
||||
gDoingBattleAnim = TRUE;
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW);
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW);
|
||||
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
@ -47,7 +47,7 @@ extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT];
|
||||
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
|
||||
extern u16 gPartnerTrainerId;
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gUnknown_020244B4[];
|
||||
extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT];
|
||||
@ -1545,15 +1545,15 @@ static void PlayerPartnerHandleChooseMove(void)
|
||||
chosenMoveId = BattleAI_ChooseMoveOrAction();
|
||||
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_x10 | MOVE_TARGET_USER))
|
||||
gBankTarget = gActiveBank;
|
||||
gBankDefender = gActiveBank;
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
|
||||
{
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
if (gAbsentBankFlags & gBitTable[gBankTarget])
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
if (gAbsentBankFlags & gBitTable[gBankDefender])
|
||||
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
}
|
||||
|
||||
EmitTwoReturnValues(1, 10, chosenMoveId | (gBankTarget << 8));
|
||||
EmitTwoReturnValues(1, 10, chosenMoveId | (gBankDefender << 8));
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1568,8 +1568,8 @@ static void PlayerPartnerHandleChoosePokemon(void)
|
||||
|
||||
if (chosenMonId == 6) // just switch to the next mon
|
||||
{
|
||||
u8 playerMonIdentity = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
u8 selfIdentity = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
|
||||
u8 playerMonIdentity = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
u8 selfIdentity = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
|
||||
|
||||
for (chosenMonId = 3; chosenMonId < 6; chosenMonId++)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
@ -48,7 +48,7 @@ extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT];
|
||||
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
|
||||
extern u16 gPartnerTrainerId;
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gUnknown_020244B4[];
|
||||
extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT];
|
||||
@ -1814,10 +1814,10 @@ static void RecordedOpponentHandleResetActionMoveSelection(void)
|
||||
|
||||
static void RecordedOpponentHandleCmd55(void)
|
||||
{
|
||||
if (gBattleBufferA[gActiveBank][1] == BATTLE_DREW)
|
||||
if (gBattleBufferA[gActiveBank][1] == B_OUTCOME_DREW)
|
||||
gBattleOutcome = gBattleBufferA[gActiveBank][1];
|
||||
else
|
||||
gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ BATTLE_DREW;
|
||||
gBattleOutcome = gBattleBufferA[gActiveBank][1] ^ B_OUTCOME_DREW;
|
||||
|
||||
FadeOutMapMusic(5);
|
||||
BeginFastPaletteFade(3);
|
||||
|
@ -28,7 +28,7 @@ extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
@ -48,7 +48,7 @@ extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT];
|
||||
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
|
||||
extern u16 gPartnerTrainerId;
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gUnknown_020244B4[];
|
||||
extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT];
|
||||
@ -1445,7 +1445,7 @@ static void RecordedPlayerHandlePrintSelectionString(void)
|
||||
|
||||
static void ChooseActionInBattlePalace(void)
|
||||
{
|
||||
if (gBattleCommunication[4] >= gNoOfAllBanks / 2)
|
||||
if (gBattleCommunication[4] >= gBattleBanksCount / 2)
|
||||
{
|
||||
EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBank), 0);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
|
@ -26,7 +26,7 @@ extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
@ -415,7 +415,7 @@ static void SafariHandleSuccessBallThrowAnim(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
|
||||
gDoingBattleAnim = TRUE;
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ static void SafariHandleBallThrowAnim(void)
|
||||
|
||||
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
|
||||
gDoingBattleAnim = TRUE;
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
@ -1113,7 +1113,7 @@ static void WallyHandleSuccessBallThrowAnim(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
|
||||
gDoingBattleAnim = TRUE;
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
|
||||
}
|
||||
|
||||
@ -1123,7 +1123,7 @@ static void WallyHandleBallThrowAnim(void)
|
||||
|
||||
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
|
||||
gDoingBattleAnim = TRUE;
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
|
||||
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
|
||||
extern u8 gBankPositions[BATTLE_BANKS_COUNT];
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gUnknown_0202428C;
|
||||
extern u32 gUnknown_02022FF4;
|
||||
@ -32,7 +32,7 @@ extern u8 gUnknown_02022D08;
|
||||
extern u8 gUnknown_02022D09;
|
||||
extern u8 gUnknown_02022D0A;
|
||||
extern u8 gBankAttacker;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gEffectBank;
|
||||
extern u16 gBattleWeather;
|
||||
@ -124,7 +124,7 @@ void sub_8032768(void)
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||
{
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
sub_81B8D64(i, 0);
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ static void SetControllersVariables(void)
|
||||
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
}
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
|
||||
sub_81B8D64(0, 0);
|
||||
sub_81B8D64(1, 0);
|
||||
@ -200,7 +200,7 @@ static void SetControllersVariables(void)
|
||||
gBattleBankFunc[1] = SetControllerToOpponent;
|
||||
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
|
||||
|
||||
gNoOfAllBanks = 2;
|
||||
gBattleBanksCount = 2;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
{
|
||||
@ -216,7 +216,7 @@ static void SetControllersVariables(void)
|
||||
gBattleBankFunc[1] = SetControllerToRecordedOpponent;
|
||||
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
|
||||
|
||||
gNoOfAllBanks = 2;
|
||||
gBattleBanksCount = 2;
|
||||
}
|
||||
else // see how the banks are switched
|
||||
{
|
||||
@ -226,7 +226,7 @@ static void SetControllersVariables(void)
|
||||
gBattleBankFunc[0] = SetControllerToRecordedOpponent;
|
||||
gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
|
||||
|
||||
gNoOfAllBanks = 2;
|
||||
gBattleBanksCount = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -255,7 +255,7 @@ static void SetControllersVariables(void)
|
||||
gBattleBankFunc[3] = SetControllerToOpponent;
|
||||
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
{
|
||||
@ -275,7 +275,7 @@ static void SetControllersVariables(void)
|
||||
gBattleBankFunc[3] = SetControllerToOpponent;
|
||||
gBankPositions[3] = 3;
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
|
||||
sub_81B8D64(0, 0);
|
||||
sub_81B8D64(1, 0);
|
||||
@ -430,7 +430,7 @@ static void SetControllersVariablesInLinkBattle(void)
|
||||
gBattleBankFunc[1] = SetControllerToLinkOpponent;
|
||||
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
|
||||
|
||||
gNoOfAllBanks = 2;
|
||||
gBattleBanksCount = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -440,7 +440,7 @@ static void SetControllersVariablesInLinkBattle(void)
|
||||
gBattleBankFunc[0] = SetControllerToLinkOpponent;
|
||||
gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
|
||||
|
||||
gNoOfAllBanks = 2;
|
||||
gBattleBanksCount = 2;
|
||||
}
|
||||
}
|
||||
else if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
@ -461,7 +461,7 @@ static void SetControllersVariablesInLinkBattle(void)
|
||||
gBattleBankFunc[3] = SetControllerToLinkOpponent;
|
||||
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -477,7 +477,7 @@ static void SetControllersVariablesInLinkBattle(void)
|
||||
gBattleBankFunc[2] = SetControllerToLinkOpponent;
|
||||
gBankPositions[2] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
}
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|
||||
@ -498,7 +498,7 @@ static void SetControllersVariablesInLinkBattle(void)
|
||||
gBattleBankFunc[3] = SetControllerToOpponent;
|
||||
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -514,7 +514,7 @@ static void SetControllersVariablesInLinkBattle(void)
|
||||
gBattleBankFunc[3] = SetControllerToLinkOpponent;
|
||||
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
}
|
||||
|
||||
sub_81B8D64(0, 0);
|
||||
@ -604,7 +604,7 @@ static void SetControllersVariablesInLinkBattle(void)
|
||||
}
|
||||
}
|
||||
|
||||
gNoOfAllBanks = 4;
|
||||
gBattleBanksCount = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ static void SetBattlePartyIds(void)
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||
{
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
@ -753,7 +753,7 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data)
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_BUFFER_ID] = bufferId;
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ACTIVE_BANK] = gActiveBank;
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ATTACKER] = gBankAttacker;
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_TARGET] = gBankTarget;
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_TARGET] = gBankDefender;
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_LO] = alignedSize;
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_HI] = (alignedSize & 0x0000FF00) >> 8;
|
||||
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ABSENT_BANK_FLAGS] = gAbsentBankFlags;
|
||||
@ -921,7 +921,7 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_WILD))
|
||||
{
|
||||
gBankAttacker = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 2];
|
||||
gBankTarget = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 3];
|
||||
gBankDefender = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 3];
|
||||
gAbsentBankFlags = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 6];
|
||||
gEffectBank = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 7];
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200];
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern u16 gUnknown_020243FC;
|
||||
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
|
||||
@ -262,7 +262,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
||||
else if (var1 == MOVE_TARGET_SELECTED)
|
||||
chosenMoveId |= (BattlePalaceGetTargetRetValue());
|
||||
else
|
||||
chosenMoveId |= (GetBankByIdentity((GetBankPosition(gActiveBank) & BIT_SIDE) ^ BIT_SIDE) << 8);
|
||||
chosenMoveId |= (GetBankByPosition((GetBankPosition(gActiveBank) & BIT_SIDE) ^ BIT_SIDE) << 8);
|
||||
|
||||
return chosenMoveId;
|
||||
}
|
||||
@ -299,13 +299,13 @@ static u16 BattlePalaceGetTargetRetValue(void)
|
||||
|
||||
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
|
||||
{
|
||||
opposing1 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
opposing2 = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
opposing1 = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
opposing2 = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
opposing1 = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
opposing2 = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
|
||||
opposing1 = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
opposing2 = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
|
||||
}
|
||||
|
||||
if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp)
|
||||
@ -391,15 +391,15 @@ void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status)
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 1;
|
||||
if (!isStatus2)
|
||||
{
|
||||
if (status == STATUS_FREEZE)
|
||||
if (status == STATUS1_FREEZE)
|
||||
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_FRZ);
|
||||
else if (status == STATUS_POISON || status & STATUS_TOXIC_POISON)
|
||||
else if (status == STATUS1_POISON || status & STATUS1_TOXIC_POISON)
|
||||
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_PSN);
|
||||
else if (status == STATUS_BURN)
|
||||
else if (status == STATUS1_BURN)
|
||||
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_BRN);
|
||||
else if (status & STATUS_SLEEP)
|
||||
else if (status & STATUS1_SLEEP)
|
||||
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_SLP);
|
||||
else if (status == STATUS_PARALYSIS)
|
||||
else if (status == STATUS1_PARALYSIS)
|
||||
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_PRZ);
|
||||
else // no animation
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 0;
|
||||
@ -807,7 +807,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
|
||||
gHealthBoxesIds[*bank] = CreateBankHealthboxSprites(*bank);
|
||||
|
||||
(*bank)++;
|
||||
if (*bank == gNoOfAllBanks)
|
||||
if (*bank == gBattleBanksCount)
|
||||
{
|
||||
*bank = 0;
|
||||
(*state1)++;
|
||||
@ -821,7 +821,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
|
||||
DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], TRUE);
|
||||
|
||||
(*bank)++;
|
||||
if (*bank == gNoOfAllBanks)
|
||||
if (*bank == gBattleBanksCount)
|
||||
{
|
||||
*bank = 0;
|
||||
(*state1)++;
|
||||
@ -839,7 +839,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
|
||||
}
|
||||
SetHealthboxSpriteInvisible(gHealthBoxesIds[*bank]);
|
||||
(*bank)++;
|
||||
if (*bank == gNoOfAllBanks)
|
||||
if (*bank == gBattleBanksCount)
|
||||
{
|
||||
*bank = 0;
|
||||
(*state1)++;
|
||||
@ -871,7 +871,7 @@ void CopyAllBattleSpritesInvisibilities(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
gBattleSpritesDataPtr->bankData[i].invisible = gSprites[gBankSpriteIds[i]].invisible;
|
||||
}
|
||||
|
||||
@ -1080,7 +1080,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank)
|
||||
|
||||
void BattleStopLowHpSound(void)
|
||||
{
|
||||
u8 playerBank = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
u8 playerBank = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
|
||||
gBattleSpritesDataPtr->bankData[playerBank].lowHpSong = 0;
|
||||
if (IsDoubleBattle())
|
||||
@ -1101,8 +1101,8 @@ void sub_805EAE8(void)
|
||||
{
|
||||
if (gMain.inBattle)
|
||||
{
|
||||
u8 playerBank1 = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
|
||||
u8 playerBank2 = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
|
||||
u8 playerBank1 = GetBankByPosition(B_POSITION_PLAYER_LEFT);
|
||||
u8 playerBank2 = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
|
||||
u8 bank1PartyId = pokemon_order_func(gBattlePartyID[playerBank1]);
|
||||
u8 bank2PartyId = pokemon_order_func(gBattlePartyID[playerBank2]);
|
||||
|
||||
@ -1117,7 +1117,7 @@ void sub_805EB9C(u8 affineMode)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (IsBankSpritePresent(i))
|
||||
{
|
||||
@ -1143,13 +1143,13 @@ void LoadAndCreateEnemyShadowSprites(void)
|
||||
|
||||
LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow);
|
||||
|
||||
bank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
bank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8);
|
||||
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
|
||||
|
||||
if (IsDoubleBattle())
|
||||
{
|
||||
bank = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
bank = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8);
|
||||
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
|
||||
}
|
||||
@ -1286,7 +1286,7 @@ bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon)
|
||||
s16 hp, maxHP;
|
||||
s32 barLevel;
|
||||
|
||||
if (GetMonData(mon, MON_DATA_STATUS) & (STATUS_ANY | STATUS_TOXIC_COUNTER))
|
||||
if (GetMonData(mon, MON_DATA_STATUS) & (STATUS1_ANY | STATUS1_TOXIC_COUNTER))
|
||||
return FALSE;
|
||||
|
||||
hp = GetMonData(mon, MON_DATA_HP);
|
||||
|
@ -154,7 +154,7 @@ enum
|
||||
|
||||
extern u8 gBankPositions[BATTLE_BANKS_COUNT];
|
||||
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
|
||||
|
||||
extern const u8 * const gNatureNamePointers[];
|
||||
@ -1086,7 +1086,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
u8 healthboxSpriteId_1 = gHealthBoxesIds[i];
|
||||
u8 healthboxSpriteId_2 = gSprites[gHealthBoxesIds[i]].oam.affineParam;
|
||||
@ -1414,7 +1414,7 @@ void SwapHpBarsWithHpText(void)
|
||||
s32 i;
|
||||
u8 spriteId;
|
||||
|
||||
for (i = 0; i < gNoOfAllBanks; i++)
|
||||
for (i = 0; i < gBattleBanksCount; i++)
|
||||
{
|
||||
if (gSprites[gHealthBoxesIds[i]].callback == SpriteCallbackDummy
|
||||
&& GetBankSide(i) != SIDE_OPPONENT
|
||||
@ -2029,27 +2029,27 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
||||
tileNumAdder = 0x11;
|
||||
}
|
||||
|
||||
if (status & STATUS_SLEEP)
|
||||
if (status & STATUS1_SLEEP)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_SLP_BANK0, bank));
|
||||
statusPalId = PAL_STATUS_SLP;
|
||||
}
|
||||
else if (status & STATUS_PSN_ANY)
|
||||
else if (status & STATUS1_PSN_ANY)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PSN_BANK0, bank));
|
||||
statusPalId = PAL_STATUS_PSN;
|
||||
}
|
||||
else if (status & STATUS_BURN)
|
||||
else if (status & STATUS1_BURN)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_BRN_BANK0, bank));
|
||||
statusPalId = PAL_STATUS_BRN;
|
||||
}
|
||||
else if (status & STATUS_FREEZE)
|
||||
else if (status & STATUS1_FREEZE)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_FRZ_BANK0, bank));
|
||||
statusPalId = PAL_STATUS_FRZ;
|
||||
}
|
||||
else if (status & STATUS_PARALYSIS)
|
||||
else if (status & STATUS1_PARALYSIS)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PRZ_BANK0, bank));
|
||||
statusPalId = PAL_STATUS_PAR;
|
||||
|
@ -18,7 +18,7 @@ extern u16 gLastUsedItem;
|
||||
extern u8 gLastUsedAbility;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankAttacker;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gStringBank;
|
||||
extern u8 gEffectBank;
|
||||
extern u8 gAbilitiesPerBank[BATTLE_BANKS_COUNT];
|
||||
@ -1631,13 +1631,13 @@ void BufferStringBattle(u16 stringID)
|
||||
stringPtr = gText_AttackerUsedX;
|
||||
break;
|
||||
case STRINGID_BATTLEEND: // battle end
|
||||
if (gBattleTextBuff1[0] & OUTCOME_LINK_BATTLE_RUN)
|
||||
if (gBattleTextBuff1[0] & B_OUTCOME_LINK_BATTLE_RAN)
|
||||
{
|
||||
gBattleTextBuff1[0] &= ~(OUTCOME_LINK_BATTLE_RUN);
|
||||
if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != BATTLE_DREW)
|
||||
gBattleTextBuff1[0] ^= (BATTLE_LOST | BATTLE_WON);
|
||||
gBattleTextBuff1[0] &= ~(B_OUTCOME_LINK_BATTLE_RAN);
|
||||
if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW)
|
||||
gBattleTextBuff1[0] ^= (B_OUTCOME_LOST | B_OUTCOME_WON);
|
||||
|
||||
if (gBattleTextBuff1[0] == BATTLE_LOST || gBattleTextBuff1[0] == BATTLE_DREW)
|
||||
if (gBattleTextBuff1[0] == B_OUTCOME_LOST || gBattleTextBuff1[0] == B_OUTCOME_DREW)
|
||||
stringPtr = gText_GotAwaySafely;
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
stringPtr = gText_TwoWildFled;
|
||||
@ -1646,23 +1646,23 @@ void BufferStringBattle(u16 stringID)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != BATTLE_DREW)
|
||||
gBattleTextBuff1[0] ^= (BATTLE_LOST | BATTLE_WON);
|
||||
if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW)
|
||||
gBattleTextBuff1[0] ^= (B_OUTCOME_LOST | B_OUTCOME_WON);
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
switch (gBattleTextBuff1[0])
|
||||
{
|
||||
case BATTLE_WON:
|
||||
case B_OUTCOME_WON:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_x800000)
|
||||
stringPtr = gText_TwoInGameTrainersDefeated;
|
||||
else
|
||||
stringPtr = gText_TwoLinkTrainersDefeated;
|
||||
break;
|
||||
case BATTLE_LOST:
|
||||
case B_OUTCOME_LOST:
|
||||
stringPtr = gText_PlayerLostToTwo;
|
||||
break;
|
||||
case BATTLE_DREW:
|
||||
case B_OUTCOME_DREW:
|
||||
stringPtr = gText_PlayerBattledToDrawVsTwo;
|
||||
break;
|
||||
}
|
||||
@ -1671,13 +1671,13 @@ void BufferStringBattle(u16 stringID)
|
||||
{
|
||||
switch (gBattleTextBuff1[0])
|
||||
{
|
||||
case BATTLE_WON:
|
||||
case B_OUTCOME_WON:
|
||||
stringPtr = gText_PlayerDefeatedLinkTrainerTrainer1;
|
||||
break;
|
||||
case BATTLE_LOST:
|
||||
case B_OUTCOME_LOST:
|
||||
stringPtr = gText_PlayerLostAgainstTrainer1;
|
||||
break;
|
||||
case BATTLE_DREW:
|
||||
case B_OUTCOME_DREW:
|
||||
stringPtr = gText_PlayerBattledToDrawTrainer1;
|
||||
break;
|
||||
}
|
||||
@ -1686,13 +1686,13 @@ void BufferStringBattle(u16 stringID)
|
||||
{
|
||||
switch (gBattleTextBuff1[0])
|
||||
{
|
||||
case BATTLE_WON:
|
||||
case B_OUTCOME_WON:
|
||||
stringPtr = gText_PlayerDefeatedLinkTrainer;
|
||||
break;
|
||||
case BATTLE_LOST:
|
||||
case B_OUTCOME_LOST:
|
||||
stringPtr = gText_PlayerLostAgainstLinkTrainer;
|
||||
break;
|
||||
case BATTLE_DREW:
|
||||
case B_OUTCOME_DREW:
|
||||
stringPtr = gText_PlayerBattledToDrawLinkTrainer;
|
||||
break;
|
||||
}
|
||||
@ -1834,25 +1834,25 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
||||
toCpy = gStringVar3;
|
||||
break;
|
||||
case B_TXT_PLAYER_MON1_NAME: // first player poke name
|
||||
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByIdentity(B_POSITION_PLAYER_LEFT)]],
|
||||
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByPosition(B_POSITION_PLAYER_LEFT)]],
|
||||
MON_DATA_NICKNAME, text);
|
||||
StringGetEnd10(text);
|
||||
toCpy = text;
|
||||
break;
|
||||
case B_TXT_OPPONENT_MON1_NAME: // first enemy poke name
|
||||
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByIdentity(B_POSITION_OPPONENT_LEFT)]],
|
||||
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByPosition(B_POSITION_OPPONENT_LEFT)]],
|
||||
MON_DATA_NICKNAME, text);
|
||||
StringGetEnd10(text);
|
||||
toCpy = text;
|
||||
break;
|
||||
case B_TXT_PLAYER_MON2_NAME: // second player poke name
|
||||
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByIdentity(B_POSITION_PLAYER_RIGHT)]],
|
||||
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByPosition(B_POSITION_PLAYER_RIGHT)]],
|
||||
MON_DATA_NICKNAME, text);
|
||||
StringGetEnd10(text);
|
||||
toCpy = text;
|
||||
break;
|
||||
case B_TXT_OPPONENT_MON2_NAME: // second enemy poke name
|
||||
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByIdentity(B_POSITION_OPPONENT_RIGHT)]],
|
||||
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByPosition(B_POSITION_OPPONENT_RIGHT)]],
|
||||
MON_DATA_NICKNAME, text);
|
||||
StringGetEnd10(text);
|
||||
toCpy = text;
|
||||
@ -1883,13 +1883,13 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
||||
break;
|
||||
case B_TXT_ATK_NAME_WITH_PREFIX_MON1: // attacker name with prefix, only bank 0/1
|
||||
HANDLE_NICKNAME_STRING_CASE(gBankAttacker,
|
||||
gBattlePartyID[GetBankByIdentity(GET_BANK_SIDE(gBankAttacker))])
|
||||
gBattlePartyID[GetBankByPosition(GET_BANK_SIDE(gBankAttacker))])
|
||||
break;
|
||||
case B_TXT_ATK_PARTNER_NAME: // attacker partner name
|
||||
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
|
||||
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByIdentity(GET_BANK_SIDE(gBankAttacker)) + 2]], MON_DATA_NICKNAME, text);
|
||||
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByPosition(GET_BANK_SIDE(gBankAttacker)) + 2]], MON_DATA_NICKNAME, text);
|
||||
else
|
||||
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByIdentity(GET_BANK_SIDE(gBankAttacker)) + 2]], MON_DATA_NICKNAME, text);
|
||||
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByPosition(GET_BANK_SIDE(gBankAttacker)) + 2]], MON_DATA_NICKNAME, text);
|
||||
|
||||
StringGetEnd10(text);
|
||||
toCpy = text;
|
||||
@ -1898,7 +1898,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
||||
HANDLE_NICKNAME_STRING_CASE(gBankAttacker, gBattlePartyID[gBankAttacker])
|
||||
break;
|
||||
case B_TXT_DEF_NAME_WITH_PREFIX: // target name with prefix
|
||||
HANDLE_NICKNAME_STRING_CASE(gBankTarget, gBattlePartyID[gBankTarget])
|
||||
HANDLE_NICKNAME_STRING_CASE(gBankDefender, gBattlePartyID[gBankDefender])
|
||||
break;
|
||||
case B_TXT_EFF_NAME_WITH_PREFIX: // effect bank name with prefix
|
||||
HANDLE_NICKNAME_STRING_CASE(gEffectBank, gBattlePartyID[gEffectBank])
|
||||
@ -1971,7 +1971,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
||||
toCpy = gAbilityNames[gAbilitiesPerBank[gBankAttacker]];
|
||||
break;
|
||||
case B_TXT_DEF_ABILITY: // target ability
|
||||
toCpy = gAbilityNames[gAbilitiesPerBank[gBankTarget]];
|
||||
toCpy = gAbilityNames[gAbilitiesPerBank[gBankDefender]];
|
||||
break;
|
||||
case B_TXT_SCR_ACTIVE_ABILITY: // scripting active ability
|
||||
toCpy = gAbilityNames[gAbilitiesPerBank[gBattleScripting.bank]];
|
||||
@ -2098,7 +2098,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
||||
toCpy = gText_FoePkmnPrefix3;
|
||||
break;
|
||||
case B_TXT_DEF_PREFIX2:
|
||||
if (GetBankSide(gBankTarget) == SIDE_PLAYER)
|
||||
if (GetBankSide(gBankDefender) == SIDE_PLAYER)
|
||||
toCpy = gText_AllyPkmnPrefix2;
|
||||
else
|
||||
toCpy = gText_FoePkmnPrefix3;
|
||||
@ -2110,7 +2110,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
||||
toCpy = gText_FoePkmnPrefix2;
|
||||
break;
|
||||
case B_TXT_DEF_PREFIX1:
|
||||
if (GetBankSide(gBankTarget) == SIDE_PLAYER)
|
||||
if (GetBankSide(gBankDefender) == SIDE_PLAYER)
|
||||
toCpy = gText_AllyPkmnPrefix;
|
||||
else
|
||||
toCpy = gText_FoePkmnPrefix2;
|
||||
@ -2122,7 +2122,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
|
||||
toCpy = gText_FoePkmnPrefix4;
|
||||
break;
|
||||
case B_TXT_DEF_PREFIX3:
|
||||
if (GetBankSide(gBankTarget) == SIDE_PLAYER)
|
||||
if (GetBankSide(gBankDefender) == SIDE_PLAYER)
|
||||
toCpy = gText_AllyPkmnPrefix3;
|
||||
else
|
||||
toCpy = gText_FoePkmnPrefix4;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -990,14 +990,14 @@ static bool32 IsPlayerDefeated(u32 battleOutcome)
|
||||
{
|
||||
switch (battleOutcome)
|
||||
{
|
||||
case BATTLE_LOST:
|
||||
case BATTLE_DREW:
|
||||
case B_OUTCOME_LOST:
|
||||
case B_OUTCOME_DREW:
|
||||
return TRUE;
|
||||
case BATTLE_WON:
|
||||
case BATTLE_RAN:
|
||||
case BATTLE_PLAYER_TELEPORTED:
|
||||
case BATTLE_POKE_FLED:
|
||||
case BATTLE_CAUGHT:
|
||||
case B_OUTCOME_WON:
|
||||
case B_OUTCOME_RAN:
|
||||
case B_OUTCOME_PLAYER_TELEPORTED:
|
||||
case B_OUTCOME_POKE_FLED:
|
||||
case B_OUTCOME_CAUGHT_POKE:
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -87,15 +87,15 @@ void AdjustFriendshipOnBattleFaint(u8 bank)
|
||||
{
|
||||
u8 opposingBank2;
|
||||
|
||||
opposingBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
opposingBank2 = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
opposingBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
opposingBank2 = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
|
||||
if (gBattleMons[opposingBank2].level > gBattleMons[opposingBank].level)
|
||||
opposingBank = opposingBank2;
|
||||
}
|
||||
else
|
||||
{
|
||||
opposingBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
opposingBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
}
|
||||
|
||||
if (gBattleMons[opposingBank].level > gBattleMons[bank].level)
|
||||
@ -138,11 +138,11 @@ u32 sub_805725C(u8 bank)
|
||||
switch (gBattleCommunication[MULTIUSE_STATE])
|
||||
{
|
||||
case 0:
|
||||
if (gBattleMons[bank].status1 & STATUS_SLEEP)
|
||||
if (gBattleMons[bank].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
if (UproarWakeUpCheck(bank))
|
||||
{
|
||||
gBattleMons[bank].status1 &= ~(STATUS_SLEEP);
|
||||
gBattleMons[bank].status1 &= ~(STATUS1_SLEEP);
|
||||
gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE);
|
||||
BattleScriptPushCursor();
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
@ -158,12 +158,12 @@ u32 sub_805725C(u8 bank)
|
||||
else
|
||||
toSub = 1;
|
||||
|
||||
if ((gBattleMons[bank].status1 & STATUS_SLEEP) < toSub)
|
||||
gBattleMons[bank].status1 &= ~(STATUS_SLEEP);
|
||||
if ((gBattleMons[bank].status1 & STATUS1_SLEEP) < toSub)
|
||||
gBattleMons[bank].status1 &= ~(STATUS1_SLEEP);
|
||||
else
|
||||
gBattleMons[bank].status1 -= toSub;
|
||||
|
||||
if (gBattleMons[bank].status1 & STATUS_SLEEP)
|
||||
if (gBattleMons[bank].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_MoveUsedIsAsleep;
|
||||
effect = 2;
|
||||
@ -181,7 +181,7 @@ u32 sub_805725C(u8 bank)
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
break;
|
||||
case 1:
|
||||
if (gBattleMons[bank].status1 & STATUS_FREEZE)
|
||||
if (gBattleMons[bank].status1 & STATUS1_FREEZE)
|
||||
{
|
||||
if (Random() % 5 != 0)
|
||||
{
|
||||
@ -189,7 +189,7 @@ u32 sub_805725C(u8 bank)
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[bank].status1 &= ~(STATUS_FREEZE);
|
||||
gBattleMons[bank].status1 &= ~(STATUS1_FREEZE);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
|
@ -177,7 +177,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
damage = damage / damageHelper;
|
||||
damage /= 50;
|
||||
|
||||
if ((attacker->status1 & STATUS_BURN) && attacker->ability != ABILITY_GUTS)
|
||||
if ((attacker->status1 & STATUS1_BURN) && attacker->ability != ABILITY_GUTS)
|
||||
damage /= 2;
|
||||
|
||||
if ((sideStatus & SIDE_STATUS_REFLECT) && gCritMultiplier == 1)
|
||||
|
@ -42,7 +42,7 @@ static bool32 sub_80F958C(void)
|
||||
static void sub_80F95C0(u8 partyIdx)
|
||||
{
|
||||
struct Pokemon *pokemon = gPlayerParty + partyIdx;
|
||||
unsigned int status = STATUS_NONE;
|
||||
unsigned int status = STATUS1_NONE;
|
||||
AdjustFriendship(pokemon, 0x07);
|
||||
SetMonData(pokemon, MON_DATA_STATUS, &status);
|
||||
GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1);
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
extern bool8 gDoingBattleAnim;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u16 gBattlePartyID[];
|
||||
extern u8 gBankSpriteIds[];
|
||||
extern u8 gHealthBoxesIds[];
|
||||
@ -378,7 +378,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
switch (throwCaseId)
|
||||
{
|
||||
case POKEBALL_PLAYER_SENDOUT:
|
||||
gBankTarget = bank;
|
||||
gBankDefender = bank;
|
||||
gSprites[ballSpriteId].pos1.x = 24;
|
||||
gSprites[ballSpriteId].pos1.y = 68;
|
||||
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
|
||||
@ -386,17 +386,17 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
case POKEBALL_OPPONENT_SENDOUT:
|
||||
gSprites[ballSpriteId].pos1.x = GetBankCoord(bank, BANK_X_POS);
|
||||
gSprites[ballSpriteId].pos1.y = GetBankCoord(bank, BANK_Y_POS) + 24;
|
||||
gBankTarget = bank;
|
||||
gBankDefender = bank;
|
||||
gSprites[ballSpriteId].data[0] = 0;
|
||||
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
|
||||
break;
|
||||
default:
|
||||
gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
notSendOut = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
gSprites[ballSpriteId].sBank = gBankTarget;
|
||||
gSprites[ballSpriteId].sBank = gBankDefender;
|
||||
if (!notSendOut)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
@ -405,12 +405,12 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
|
||||
// this will perform an unused ball throw animation
|
||||
gSprites[ballSpriteId].data[0] = 0x22;
|
||||
gSprites[ballSpriteId].data[2] = GetBankCoord(gBankTarget, BANK_X_POS);
|
||||
gSprites[ballSpriteId].data[4] = GetBankCoord(gBankTarget, BANK_Y_POS) - 16;
|
||||
gSprites[ballSpriteId].data[2] = GetBankCoord(gBankDefender, BANK_X_POS);
|
||||
gSprites[ballSpriteId].data[4] = GetBankCoord(gBankDefender, BANK_Y_POS) - 16;
|
||||
gSprites[ballSpriteId].data[5] = -40;
|
||||
sub_80A68D4(&gSprites[ballSpriteId]);
|
||||
gSprites[ballSpriteId].oam.affineParam = taskId;
|
||||
gTasks[taskId].tOpponentBank = gBankTarget;
|
||||
gTasks[taskId].tOpponentBank = gBankDefender;
|
||||
gTasks[taskId].func = TaskDummy;
|
||||
PlaySE(SE_NAGERU);
|
||||
}
|
||||
@ -767,7 +767,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
||||
}
|
||||
|
||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
if ((bank == GetBankByIdentity(B_POSITION_PLAYER_LEFT) || bank == GetBankByIdentity(B_POSITION_OPPONENT_LEFT))
|
||||
if ((bank == GetBankByPosition(B_POSITION_PLAYER_LEFT) || bank == GetBankByPosition(B_POSITION_OPPONENT_LEFT))
|
||||
&& IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
@ -783,7 +783,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
||||
|
||||
if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1)
|
||||
wantedCryCase = 0;
|
||||
else if (bank == GetBankByIdentity(B_POSITION_PLAYER_LEFT) || bank == GetBankByIdentity(B_POSITION_OPPONENT_LEFT))
|
||||
else if (bank == GetBankByPosition(B_POSITION_PLAYER_LEFT) || bank == GetBankByPosition(B_POSITION_OPPONENT_LEFT))
|
||||
wantedCryCase = 1;
|
||||
else
|
||||
wantedCryCase = 2;
|
||||
@ -956,7 +956,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
|
||||
sprite->data[0] = 0;
|
||||
|
||||
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
||||
&& sprite->sBank == GetBankByIdentity(B_POSITION_PLAYER_RIGHT))
|
||||
&& sprite->sBank == GetBankByPosition(B_POSITION_PLAYER_RIGHT))
|
||||
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
||||
else
|
||||
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
||||
@ -982,7 +982,7 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[0] = 0;
|
||||
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
||||
&& sprite->sBank == GetBankByIdentity(B_POSITION_OPPONENT_RIGHT))
|
||||
&& sprite->sBank == GetBankByPosition(B_POSITION_OPPONENT_RIGHT))
|
||||
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
||||
else
|
||||
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
||||
|
@ -17,7 +17,7 @@ struct Unknown_020249B4
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankAttacker;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gLastUsedAbility;
|
||||
extern u16 gTrainerBattleOpponent_A;
|
||||
extern u32 gBattleTypeFlags;
|
||||
@ -35,7 +35,7 @@ extern const u8 gText_BadEgg[];
|
||||
extern const u8 gText_EggNickname[];
|
||||
|
||||
extern u8 GetBankSide(u8 bank);
|
||||
extern u8 GetBankByIdentity(u8 bank);
|
||||
extern u8 GetBankByPosition(u8 bank);
|
||||
extern u8 GetBankPosition(u8 bank);
|
||||
|
||||
u8 CountAliveMonsInBattle(u8 caseId)
|
||||
@ -62,7 +62,7 @@ u8 CountAliveMonsInBattle(u8 caseId)
|
||||
case BATTLE_ALIVE_DEF_SIDE:
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (GetBankSide(i) == GetBankSide(gBankTarget) && !(gAbsentBankFlags & gBitTable[i]))
|
||||
if (GetBankSide(i) == GetBankSide(gBankDefender) && !(gAbsentBankFlags & gBitTable[i]))
|
||||
retVal++;
|
||||
}
|
||||
break;
|
||||
@ -90,7 +90,7 @@ u8 GetDefaultMoveTarget(u8 bank)
|
||||
|
||||
status ^= 1;
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||
return GetBankByIdentity(status);
|
||||
return GetBankByPosition(status);
|
||||
if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) > 1)
|
||||
{
|
||||
u8 val;
|
||||
@ -99,14 +99,14 @@ u8 GetDefaultMoveTarget(u8 bank)
|
||||
val = status ^ 2;
|
||||
else
|
||||
val = status;
|
||||
return GetBankByIdentity(val);
|
||||
return GetBankByPosition(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((gAbsentBankFlags & gBitTable[status]))
|
||||
return GetBankByIdentity(status ^ 2);
|
||||
return GetBankByPosition(status ^ 2);
|
||||
else
|
||||
return GetBankByIdentity(status);
|
||||
return GetBankByPosition(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ extern struct BattlePokemon gBattleMons[4];
|
||||
extern struct BattleEnigmaBerry gEnigmaBerries[4];
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gBankInMenu;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gBankDefender;
|
||||
extern u8 gBankAttacker;
|
||||
extern u8 gStringBank;
|
||||
extern u16 gTrainerBattleOpponent_A;
|
||||
@ -212,7 +212,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
|
||||
|
||||
void sub_806CF24(s32 stat)
|
||||
{
|
||||
gBankTarget = gBankInMenu;
|
||||
gBankDefender = gBankInMenu;
|
||||
StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[stat]]);
|
||||
StringCopy(gBattleTextBuff2, gText_StatRose);
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2);
|
||||
|
@ -26,7 +26,7 @@ extern u16 gTrainerBattleOpponent_A;
|
||||
extern u16 gTrainerBattleOpponent_B;
|
||||
extern u16 gPartnerTrainerId;
|
||||
extern u8 gActiveBank;
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
|
||||
extern u16 gChosenMovesByBanks[BATTLE_BANKS_COUNT];
|
||||
@ -226,7 +226,7 @@ u8 RecordedBattle_ReadBankAction(u8 bank)
|
||||
// trying to read past array or invalid action byte, battle is over
|
||||
if (sRecordedBytesNo[bank] >= BANK_RECORD_SIZE || sBattleRecords[bank][sRecordedBytesNo[bank]] == 0xFF)
|
||||
{
|
||||
gSpecialVar_Result = gBattleOutcome = BATTLE_PLAYER_TELEPORTED; // hah
|
||||
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; // hah
|
||||
ResetPaletteFadeControl();
|
||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||
SetMainCallback2(CB2_QuitRecordedBattle);
|
||||
@ -1523,7 +1523,7 @@ void sub_818603C(u8 arg0)
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
|
||||
return;
|
||||
|
||||
for (bank = 0; bank < gNoOfAllBanks; bank++)
|
||||
for (bank = 0; bank < gBattleBanksCount; bank++)
|
||||
{
|
||||
if (GetBankSide(bank) != SIDE_OPPONENT) // player's side only
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ extern u8 gReservedSpritePaletteCount;
|
||||
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
|
||||
extern u8 gBankInMenu;
|
||||
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gBattleBanksCount;
|
||||
extern u32 gBattleTypeFlags;
|
||||
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
|
||||
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
|
||||
@ -164,13 +164,13 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
|
||||
|
||||
LoadAndCreateEnemyShadowSprites();
|
||||
|
||||
opponentBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
|
||||
opponentBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
|
||||
species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES);
|
||||
SetBankEnemyShadowSpriteCallback(opponentBank, species);
|
||||
|
||||
if (IsDoubleBattle())
|
||||
{
|
||||
opponentBank = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
|
||||
opponentBank = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES);
|
||||
SetBankEnemyShadowSpriteCallback(opponentBank, species);
|
||||
}
|
||||
@ -210,7 +210,7 @@ static void sub_80A95F4(void)
|
||||
|
||||
static bool8 LoadBankSpriteGfx(u8 bank)
|
||||
{
|
||||
if (bank < gNoOfAllBanks)
|
||||
if (bank < gBattleBanksCount)
|
||||
{
|
||||
if (GetBankSide(bank) != SIDE_PLAYER)
|
||||
{
|
||||
@ -245,7 +245,7 @@ extern const struct MonCoords gTrainerBackPicCoords[];
|
||||
|
||||
static void CreateBankSprite(u8 bank)
|
||||
{
|
||||
if (bank < gNoOfAllBanks)
|
||||
if (bank < gBattleBanksCount)
|
||||
{
|
||||
u8 posY;
|
||||
|
||||
@ -313,7 +313,7 @@ static void CreateBankSprite(u8 bank)
|
||||
|
||||
static void CreateHealthboxSprite(u8 bank)
|
||||
{
|
||||
if (bank < gNoOfAllBanks)
|
||||
if (bank < gBattleBanksCount)
|
||||
{
|
||||
u8 healthboxSpriteId;
|
||||
|
||||
|
@ -108,20 +108,20 @@ void SafariZoneRetirePrompt(void)
|
||||
void CB2_EndSafariBattle(void)
|
||||
{
|
||||
sSafariZoneFleedMons += gBattleResults.field_1F;
|
||||
if (gBattleOutcome == BATTLE_CAUGHT)
|
||||
if (gBattleOutcome == B_OUTCOME_CAUGHT_POKE)
|
||||
sSafariZoneCaughtMons++;
|
||||
if (gNumSafariBalls != 0)
|
||||
{
|
||||
SetMainCallback2(c2_exit_to_overworld_2_switch);
|
||||
}
|
||||
else if (gBattleOutcome == BATTLE_SAFARI_OUT_OF_BALLS)
|
||||
else if (gBattleOutcome == B_OUTCOME_NO_SAFARI_BALLS)
|
||||
{
|
||||
ScriptContext2_RunNewScript(EventScript_2A4B4C);
|
||||
warp_in();
|
||||
gFieldCallback = sub_80AF6F0;
|
||||
SetMainCallback2(c2_load_new_map);
|
||||
}
|
||||
else if (gBattleOutcome == BATTLE_CAUGHT)
|
||||
else if (gBattleOutcome == B_OUTCOME_CAUGHT_POKE)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_2A4B9B);
|
||||
ScriptContext1_Stop();
|
||||
|
20
src/tv.c
20
src/tv.c
@ -1208,7 +1208,7 @@ void PutPokemonTodayFailedOnTheAir(void)
|
||||
{
|
||||
ct = 0xFF;
|
||||
}
|
||||
if (ct > 2 && (gBattleOutcome == BATTLE_POKE_FLED || gBattleOutcome == BATTLE_WON))
|
||||
if (ct > 2 && (gBattleOutcome == B_OUTCOME_POKE_FLED || gBattleOutcome == B_OUTCOME_WON))
|
||||
{
|
||||
sCurTVShowSlot = FindEmptyTVSlotBeyondFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows);
|
||||
if (sCurTVShowSlot != -1 && HasMixableShowAlreadyBeenSpawnedWithPlayerID(TVSHOW_POKEMON_TODAY_FAILED, FALSE) != TRUE)
|
||||
@ -2402,23 +2402,23 @@ void sub_80EE184(void)
|
||||
show->breakingNews.poke1Species = gBattleResults.playerMon1Species;
|
||||
switch (gBattleOutcome)
|
||||
{
|
||||
case BATTLE_LOST:
|
||||
case BATTLE_DREW:
|
||||
case B_OUTCOME_LOST:
|
||||
case B_OUTCOME_DREW:
|
||||
show->breakingNews.kind = TVSHOW_OFF_AIR;
|
||||
return;
|
||||
case BATTLE_CAUGHT:
|
||||
case B_OUTCOME_CAUGHT_POKE:
|
||||
show->breakingNews.outcome = 0;
|
||||
break;
|
||||
case BATTLE_WON:
|
||||
case B_OUTCOME_WON:
|
||||
show->breakingNews.outcome = 1;
|
||||
break;
|
||||
case BATTLE_RAN:
|
||||
case BATTLE_PLAYER_TELEPORTED:
|
||||
case BATTLE_SAFARI_OUT_OF_BALLS:
|
||||
case B_OUTCOME_RAN:
|
||||
case B_OUTCOME_PLAYER_TELEPORTED:
|
||||
case B_OUTCOME_NO_SAFARI_BALLS:
|
||||
show->breakingNews.outcome = 2;
|
||||
break;
|
||||
case BATTLE_POKE_FLED:
|
||||
case BATTLE_OPPONENT_TELEPORTED:
|
||||
case B_OUTCOME_POKE_FLED:
|
||||
case B_OUTCOME_POKE_TELEPORTED:
|
||||
show->breakingNews.outcome = 3;
|
||||
break;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ gActiveBank: @ 2024064
|
||||
gBattleExecBuffer: @ 2024068
|
||||
.space 0x4
|
||||
|
||||
gNoOfAllBanks: @ 202406C
|
||||
gBattleBanksCount: @ 202406C
|
||||
.space 0x2
|
||||
|
||||
gBattlePartyID: @ 202406E
|
||||
@ -336,7 +336,7 @@ gLastUsedAbility: @ 202420A
|
||||
gBankAttacker: @ 202420B
|
||||
.space 0x1
|
||||
|
||||
gBankTarget: @ 202420C
|
||||
gBankDefender: @ 202420C
|
||||
.space 0x1
|
||||
|
||||
gBank1: @ 202420D
|
||||
@ -393,7 +393,7 @@ gLastHitBy: @ 2024270
|
||||
gChosenMovesByBanks: @ 2024274
|
||||
.space 0x8
|
||||
|
||||
gBattleMoveFlags: @ 202427C
|
||||
gMoveResultFlags: @ 202427C
|
||||
.space 0x4
|
||||
|
||||
gHitMarker: @ 2024280
|
||||
@ -408,7 +408,7 @@ gTakenDmgBanks: @ 2024288
|
||||
gUnknown_0202428C: @ 202428C
|
||||
.space 0x2
|
||||
|
||||
gSideAffecting: @ 202428E
|
||||
gSideStatuses: @ 202428E
|
||||
.space 0x6
|
||||
|
||||
gSideTimers: @ 2024294
|
||||
|
Loading…
Reference in New Issue
Block a user