SetMoveEffect functionally equivalent and close

This commit is contained in:
DizzyEggg 2017-09-20 22:54:26 +02:00
parent 28da80e19a
commit 0c7555e237
7 changed files with 813 additions and 93 deletions

View File

@ -6358,7 +6358,7 @@ sub_8039F40: @ 8039F40
ldr r5, =gDisableStructs
movs r4, 0
ldr r7, =gUnknown_02024240
ldr r6, =gUnknown_02024268
ldr r6, =gLockedMoves
_08039F70:
ldr r0, =gStatuses3
adds r0, r4, r0
@ -6498,7 +6498,7 @@ _0803A0AE:
strb r1, [r0]
ldr r0, =gBattleExecBuffer
str r1, [r0]
ldr r0, =gUnknown_0202432E
ldr r0, =gPaydayMoney
movs r2, 0
strh r1, [r0]
ldr r1, =gBattleResources
@ -12752,7 +12752,7 @@ _0803D7A0:
bcc _0803D71C
_0803D7AE:
bl b_clear_atk_up_if_hit_flag_unless_enraged
ldr r1, =gUnknown_02024082
ldr r1, =gCurrentMoveTurn
movs r0, 0
strb r0, [r1]
ldr r1, =gFightStateTracker
@ -12800,7 +12800,7 @@ _0803D828:
ldr r5, =gBattleStruct
ldr r0, [r5]
adds r0, 0x4B
ldr r4, =gUnknown_02024082
ldr r4, =gCurrentMoveTurn
ldrb r1, [r4]
strb r1, [r0]
ldr r1, =gUnknown_0831BC0C
@ -13642,7 +13642,7 @@ sub_803E0B8: @ 803E0B8
str r0, [sp]
ldr r6, =gBankAttacker
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -13747,7 +13747,7 @@ _0803E1BC:
_0803E1E2:
ldr r3, =gCurrentMove
ldr r2, =gUnknown_020241EC
ldr r1, =gUnknown_02024268
ldr r1, =gLockedMoves
lsls r0, r4, 1
adds r0, r1
ldrh r0, [r0]
@ -14450,7 +14450,7 @@ bs2_8016374: @ 803E868
push {r4,lr}
ldr r3, =gBankAttacker
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -14515,7 +14515,7 @@ sub_803E90C: @ 803E90C
ldr r4, =gBankAttacker
ldr r2, =gBankTarget
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -15052,7 +15052,7 @@ _0803EE06:
_0803EE12:
cmp r7, 0
beq _0803EE24
ldr r1, =gUnknown_02024082
ldr r1, =gCurrentMoveTurn
ldr r0, =gNoOfAllBanks
ldrb r0, [r0]
strb r0, [r1]
@ -15076,7 +15076,7 @@ sub_803EE48: @ 803EE48
push {r4-r6,lr}
ldr r4, =gBankAttacker
ldr r1, =gTurnOrder
ldr r5, =gUnknown_02024082
ldr r5, =gCurrentMoveTurn
ldrb r0, [r5]
adds r0, r1
ldrb r0, [r0]
@ -15214,7 +15214,7 @@ _0803EF98:
sub_803EFA8: @ 803EFA8
ldr r2, =gBankAttacker
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -15239,7 +15239,7 @@ sub_803EFA8: @ 803EFA8
bs5_8016AC0: @ 803EFF0
ldr r2, =gBankAttacker
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -15272,7 +15272,7 @@ sub_803F050: @ 803F050
push {r4-r6,lr}
ldr r3, =gBankAttacker
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -15359,7 +15359,7 @@ sub_803F120: @ 803F120
push {r4,lr}
ldr r2, =gBankAttacker
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -15445,7 +15445,7 @@ bs8_exit_by_flight: @ 803F1F0
push {r4,lr}
ldr r2, =gBankAttacker
ldr r1, =gTurnOrder
ldr r4, =gUnknown_02024082
ldr r4, =gCurrentMoveTurn
ldrb r0, [r4]
adds r0, r1
ldrb r0, [r0]
@ -15468,7 +15468,7 @@ bs8_exit_by_flight: @ 803F1F0
bs9_8016C9C: @ 803F22C
ldr r3, =gBankAttacker
ldr r1, =gTurnOrder
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r0, [r0]
adds r0, r1
ldrb r2, [r0]
@ -15529,7 +15529,7 @@ _0803F2C0:
thumb_func_start bsD_proceed
bsD_proceed: @ 803F2CC
ldr r1, =gUnknown_02024082
ldr r1, =gCurrentMoveTurn
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
@ -15552,7 +15552,7 @@ bsD_proceed: @ 803F2CC
bsC_8016D70: @ 803F300
push {r4-r6,lr}
ldr r1, =gTurnOrder
ldr r2, =gUnknown_02024082
ldr r2, =gCurrentMoveTurn
ldrb r0, [r2]
adds r0, r1
ldrb r0, [r0]

View File

@ -329,7 +329,7 @@ _08048A1A:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB5E9
ldr r0, =BattleScript_PSNPrevention
str r0, [r4]
ldr r2, =gHitMarker
ldr r1, [r2]
@ -453,7 +453,7 @@ _08048B16:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB5D1
ldr r0, =BattleScript_BRNPrevention
str r0, [r4]
ldr r2, =gHitMarker
ldr r1, [r2]
@ -500,7 +500,7 @@ _08048B8A:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB5D1
ldr r0, =BattleScript_BRNPrevention
b _08048D72
.pool
_08048BA4:
@ -645,7 +645,7 @@ _08048CA2:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB5DD
ldr r0, =BattleScript_PRLZPrevention
str r0, [r4]
ldr r2, =gHitMarker
ldr r1, [r2]
@ -730,7 +730,7 @@ _08048D66:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB5E9
ldr r0, =BattleScript_PSNPrevention
_08048D72:
str r0, [r4]
ldr r1, =gBattleCommunication
@ -1080,14 +1080,14 @@ _080490F0:
movs r1, 0x27
bl RecordAbilityBattle
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DB603
ldr r0, =BattleScript_FlinchPrevention
str r0, [r1]
bl _080499B2
.pool
_08049114:
adds r0, r2, 0
bl BankGetTurnOrder
ldr r1, =gUnknown_02024082
ldr r1, =gCurrentMoveTurn
lsls r0, 24
lsrs r0, 24
ldrb r1, [r1]
@ -1132,7 +1132,7 @@ _08049178:
lsls r0, 5
orrs r1, r0
str r1, [r2]
ldr r1, =gUnknown_02024268
ldr r1, =gLockedMoves
ldrb r0, [r3]
lsls r0, 1
adds r0, r1
@ -1172,7 +1172,7 @@ _080491D8:
ands r1, r0
cmp r1, 0
bne _08049210
ldr r4, =gUnknown_0202432E
ldr r4, =gPaydayMoney
ldrh r3, [r4]
ldr r2, =gBattleMons
ldrb r1, [r5]
@ -1245,7 +1245,7 @@ _0804927C:
lsls r1, 5
orrs r0, r1
str r0, [r2]
ldr r1, =gUnknown_02024268
ldr r1, =gLockedMoves
mov r2, r9
ldrb r0, [r2]
lsls r0, 1
@ -1326,7 +1326,7 @@ _080492E0:
ldr r0, [r0]
str r0, [r4]
strb r5, [r2, 0x5]
ldr r3, =gUnknown_085CC982
ldr r3, =gTrappingMoves
ldrh r0, [r3]
ldrh r4, [r6]
cmp r0, r4
@ -1390,7 +1390,7 @@ _080493D4:
movs r0, 0x10
adds r2, r7, 0
movs r3, 0
bl sub_8050A1C
bl ChangeStatBuffs
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0
@ -1407,7 +1407,7 @@ _080493F2:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082D8CD4
ldr r0, =BattleScript_StatUp
b _080499B0
.pool
_0804941C:
@ -1420,7 +1420,7 @@ _0804941C:
lsrs r1, 24
adds r2, r7, 0
movs r3, 0
bl sub_8050A1C
bl ChangeStatBuffs
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0
@ -1437,7 +1437,7 @@ _0804943C:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082D8D65
ldr r0, =BattleScript_StatDown
b _080499B0
.pool
_08049468:
@ -1449,7 +1449,7 @@ _08049468:
movs r0, 0x20
adds r2, r7, 0
movs r3, 0
bl sub_8050A1C
bl ChangeStatBuffs
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0
@ -1466,7 +1466,7 @@ _08049486:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082D8CD4
ldr r0, =BattleScript_StatUp
b _080499B0
.pool
_080494B0:
@ -1479,7 +1479,7 @@ _080494B0:
lsrs r1, 24
adds r2, r7, 0
movs r3, 0
bl sub_8050A1C
bl ChangeStatBuffs
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0
@ -1496,7 +1496,7 @@ _080494D0:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082D8D65
ldr r0, =BattleScript_StatDown
b _080499B0
.pool
_080494FC:
@ -1522,7 +1522,7 @@ _080494FC:
adds r0, r2
movs r1, 0x2
strb r1, [r0, 0x19]
ldr r1, =gUnknown_02024268
ldr r1, =gLockedMoves
ldrb r0, [r3]
lsls r0, 1
adds r0, r1
@ -1618,7 +1618,7 @@ _080495D4:
bne _0804963C
bl b_movescr_stack_push_cursor
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DB682
ldr r0, =BattleScript_NoItemSteal
str r0, [r1]
ldr r1, =gLastUsedAbility
ldrb r0, [r7]
@ -1718,7 +1718,7 @@ _0804967C:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB422
ldr r0, =BattleScript_ItemSteal
str r0, [r4]
ldrb r0, [r7]
ldr r1, [r5]
@ -1778,7 +1778,7 @@ _08049778:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DAF27
ldr r0, =BattleScript_AllStatsUp
b _080499B0
.pool
_08049790:
@ -1786,7 +1786,7 @@ _08049790:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DAFC3
ldr r0, =BattleScript_RapidSpinAway
b _080499B0
.pool
_080497A8:
@ -1826,7 +1826,7 @@ _080497C2:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB361
ldr r0, =BattleScript_TargetPRLZHeal
b _080499B0
.pool
_08049808:
@ -1834,7 +1834,7 @@ _08049808:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB117
ldr r0, =BattleScript_AtkDefDown
b _080499B0
.pool
_08049820:
@ -1881,7 +1881,7 @@ _08049880:
lsls r0, 5
orrs r1, r0
str r1, [r2]
ldr r1, =gUnknown_02024268
ldr r1, =gLockedMoves
mov r2, r9
ldrb r0, [r2]
lsls r0, 1
@ -1971,7 +1971,7 @@ _08049900:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB168
ldr r0, =BattleScript_KnockedOff
str r0, [r4]
mov r1, r9
ldrb r0, [r1]
@ -2002,7 +2002,7 @@ _080499A4:
ldr r0, [r4]
adds r0, 0x1
bl b_movescr_stack_push
ldr r0, =gUnknown_082DB1D5
ldr r0, =BattleScript_SAtkDown2
_080499B0:
str r0, [r4]
_080499B2:
@ -13531,7 +13531,7 @@ atk77_setprotect: @ 804FD8C
movs r1, 0
strb r1, [r0, 0x8]
_0804FDBC:
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r1, [r0]
ldr r0, =gNoOfAllBanks
ldrb r0, [r0]
@ -14965,8 +14965,8 @@ _08050A04:
.pool
thumb_func_end atk88_negativedamage
thumb_func_start sub_8050A1C
sub_8050A1C: @ 8050A1C
thumb_func_start ChangeStatBuffs
ChangeStatBuffs: @ 8050A1C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@ -15477,7 +15477,7 @@ _08050E80:
pop {r1}
bx r1
.pool
thumb_func_end sub_8050A1C
thumb_func_end ChangeStatBuffs
thumb_func_start atk89_statbuffchange
atk89_statbuffchange: @ 8050EA0
@ -15503,7 +15503,7 @@ atk89_statbuffchange: @ 8050EA0
movs r1, 0xF
ands r1, r4
ldrb r2, [r2, 0x1]
bl sub_8050A1C
bl ChangeStatBuffs
lsls r0, 24
cmp r0, 0
bne _08050EDC
@ -15576,7 +15576,7 @@ atk8B_setbide: @ 8050F40
lsls r1, 5
orrs r0, r1
str r0, [r2]
ldr r1, =gUnknown_02024268
ldr r1, =gLockedMoves
ldrb r0, [r3]
lsls r0, 1
adds r0, r1
@ -16365,7 +16365,7 @@ atk91_givepaydaymoney: @ 80515C8
ands r0, r1
cmp r0, 0
bne _08051650
ldr r1, =gUnknown_0202432E
ldr r1, =gPaydayMoney
ldrh r0, [r1]
cmp r0, 0
beq _08051650
@ -20500,7 +20500,7 @@ _08053948:
ldr r0, [r1]
orrs r0, r7
str r0, [r1]
ldr r1, =gUnknown_02024268
ldr r1, =gLockedMoves
ldrb r0, [r6]
lsls r0, 1
adds r0, r1
@ -24092,7 +24092,7 @@ atkDF_setmagiccoat: @ 805589C
movs r2, 0x20
orrs r1, r2
strb r1, [r0]
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r1, [r0]
ldr r0, =gNoOfAllBanks
ldrb r0, [r0]
@ -24147,7 +24147,7 @@ atkE0_setstealstatchange: @ 8055920
movs r2, 0x20
orrs r1, r2
strb r1, [r0]
ldr r0, =gUnknown_02024082
ldr r0, =gCurrentMoveTurn
ldrb r1, [r0]
ldr r0, =gNoOfAllBanks
ldrb r0, [r0]
@ -26577,7 +26577,7 @@ atkF7_802BF54: @ 8056EDC
ldr r1, =gFightStateTracker
movs r0, 0xC
strb r0, [r1]
ldr r1, =gUnknown_02024082
ldr r1, =gCurrentMoveTurn
ldr r0, =gNoOfAllBanks
ldrb r0, [r0]
strb r0, [r1]

View File

@ -599,7 +599,7 @@ gUnknown_085CC270:: @ 85CC270
gMissStringIds:: @ 85CC834
.incbin "baserom.gba", 0x5cc834, 0x14e
gUnknown_085CC982:: @ 85CC982
gTrappingMoves:: @ 85CC982
.incbin "baserom.gba", 0x5cc982, 0xe
gUnknown_085CC990:: @ 85CC990

View File

@ -15,10 +15,10 @@ BattleScript_MoveEnd:: @ 82D8A4E
gUnknown_082D8A60:: @ 82D8A60
.incbin "baserom.gba", 0x2d8a60, 0x274
gUnknown_082D8CD4:: @ 82D8CD4
BattleScript_StatUp:: @ 82D8CD4
.incbin "baserom.gba", 0x2d8cd4, 0x91
gUnknown_082D8D65:: @ 82D8D65
BattleScript_StatDown:: @ 82D8D65
.incbin "baserom.gba", 0x2d8d65, 0x6fd
BattleScript_MoveUsedMustRecharge:: @ 82D9462
@ -174,10 +174,10 @@ gUnknown_082DAF05:: @ 82DAF05
gUnknown_082DAF20:: @ 82DAF20
.incbin "baserom.gba", 0x2daf20, 0x7
gUnknown_082DAF27:: @ 82DAF27
BattleScript_AllStatsUp:: @ 82DAF27
.incbin "baserom.gba", 0x2daf27, 0x9c
gUnknown_082DAFC3:: @ 82DAFC3
BattleScript_RapidSpinAway:: @ 82DAFC3
.incbin "baserom.gba", 0x2dafc3, 0x2
gUnknown_082DAFC5:: @ 82DAFC5
@ -222,10 +222,10 @@ BattleScript_WishComesTrue:: @ 82DB0B7
BattleScript_IngrainTurnHeal:: @ 82DB0EE
.incbin "baserom.gba", 0x2db0ee, 0x29
gUnknown_082DB117:: @ 82DB117
BattleScript_AtkDefDown:: @ 82DB117
.incbin "baserom.gba", 0x2db117, 0x51
gUnknown_082DB168:: @ 82DB168
BattleScript_KnockedOff:: @ 82DB168
.incbin "baserom.gba", 0x2db168, 0xe
BattleScript_MoveUsedIsImprisoned:: @ 82DB176
@ -252,7 +252,7 @@ BattleScript_EnduredMsg:: @ 82DB1C7
BattleScript_OneHitKOMsg:: @ 82DB1CE
.incbin "baserom.gba", 0x2db1ce, 0x7
gUnknown_082DB1D5:: @ 82DB1D5
BattleScript_SAtkDown2:: @ 82DB1D5
.incbin "baserom.gba", 0x2db1d5, 0x2a
gUnknown_082DB1FF:: @ 82DB1FF
@ -321,13 +321,13 @@ BattleScript_NightmareTurnDmg:: @ 82DB33F
BattleScript_CurseTurnDmg:: @ 82DB350
.incbin "baserom.gba", 0x2db350, 0x11
gUnknown_082DB361:: @ 82DB361
BattleScript_TargetPRLZHeal:: @ 82DB361
.incbin "baserom.gba", 0x2db361, 0x17
BattleScript_YawnMakesAsleep:: @ 82DB378
.incbin "baserom.gba", 0x2db378, 0xaa
gUnknown_082DB422:: @ 82DB422
BattleScript_ItemSteal:: @ 82DB422
.incbin "baserom.gba", 0x2db422, 0xe
BattleScript_DrizzleActivates:: @ 82DB430
@ -390,19 +390,19 @@ BattleScript_FlashFireBoost:: @ 82DB5A8
gUnknown_082DB5C7:: @ 82DB5C7
.incbin "baserom.gba", 0x2db5c7, 0xa
gUnknown_082DB5D1:: @ 82DB5D1
BattleScript_BRNPrevention:: @ 82DB5D1
.incbin "baserom.gba", 0x2db5d1, 0xc
gUnknown_082DB5DD:: @ 82DB5DD
BattleScript_PRLZPrevention:: @ 82DB5DD
.incbin "baserom.gba", 0x2db5dd, 0xc
gUnknown_082DB5E9:: @ 82DB5E9
BattleScript_PSNPrevention:: @ 82DB5E9
.incbin "baserom.gba", 0x2db5e9, 0xc
gUnknown_082DB5F5:: @ 82DB5F5
.incbin "baserom.gba", 0x2db5f5, 0xe
gUnknown_082DB603:: @ 82DB603
BattleScript_FlinchPrevention:: @ 82DB603
.incbin "baserom.gba", 0x2db603, 0x1c
BattleScript_SoundproofProtected:: @ 82DB61F
@ -429,7 +429,7 @@ BattleScript_ApplySecondaryEffect:: @ 82DB67C
BattleScript_SynchronizeActivates:: @ 82DB67F
.incbin "baserom.gba", 0x2db67f, 0x3
gUnknown_082DB682:: @ 82DB682
BattleScript_NoItemSteal:: @ 82DB682
.incbin "baserom.gba", 0x2db682, 0xa
gUnknown_082DB68C:: @ 82DB68C

View File

@ -376,7 +376,7 @@ struct WishFutureKnock
u8 wishCounter[BATTLE_BANKS_COUNT];
u8 wishUserID[BATTLE_BANKS_COUNT];
u8 weatherDuration;
u16 knockedOffPokes;
u8 knockedOffPokes[2];
};
extern struct WishFutureKnock gWishFutureKnock;
@ -627,10 +627,10 @@ struct BattleStruct
u8 field_B5;
u8 field_B6;
u8 field_B7;
u16 usedHeldItems[4];
u16 usedHeldItems[BATTLE_BANKS_COUNT];
u8 field_C0[8];
u16 choicedMove[4];
u8 field_D0[8];
u16 choicedMove[BATTLE_BANKS_COUNT];
u16 field_D0[BATTLE_BANKS_COUNT];
u8 intimidateBank;
u8 fillerD9[0xDA-0xD9];
u8 field_DA;
@ -663,6 +663,35 @@ extern struct BattleStruct* gBattleStruct;
#define GET_BANK_SIDE(bank)((GetBankIdentity(bank) & 1))
#define MOVE_EFFECT_SLEEP 0x1
#define MOVE_EFFECT_POISON 0x2
#define MOVE_EFFECT_BURN 0x3
#define MOVE_EFFECT_FREEZE 0x4
#define MOVE_EFFECT_PARALYSIS 0x5
#define MOVE_EFFECT_TOXIC 0x6
#define MOVE_EFFECT_CONFUSION 0x7
#define MOVE_EFFECT_FLINCH 0x8
#define MOVE_EFFECT_TRI_ATTACK 0x9
#define MOVE_EFFECT_UPROAR 0xA
#define MOVE_EFFECT_PAYDAY 0xB
#define MOVE_EFFECT_CHARGING 0xC
#define MOVE_EFFECT_WRAP 0xD
#define MOVE_EFFECT_RECOIL_25 0xE
#define MOVE_EFFECT_RECHARGE 0x1D
#define MOVE_EFFECT_RAGE 0x1E
#define MOVE_EFFECT_STEAL_ITEM 0x1F
#define MOVE_EFFECT_PREVENT_ESCAPE 0x20
#define MOVE_EFFECT_NIGHTMARE 0x21
#define MOVE_EFFECT_ALL_STATS_UP 0x22
#define MOVE_EFFECT_RAPIDSPIN 0x23
#define MOVE_EFFECT_REMOVE_PARALYSIS 0x24
#define MOVE_EFFECT_ATK_DEF_DOWN 0x25
#define MOVE_EFFECT_RECOIL_33_PARALYSIS 0x26
#define MOVE_EFFECT_THRASH 0x35
#define MOVE_EFFECT_KNOCK_OFF 0x36
#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B
#define MOVE_EFFECT_AFFECTS_USER 0x40
struct BattleScripting
{
u8 field_0;

View File

@ -71,15 +71,17 @@ extern u8 gPlayerPartyCount;
extern u16 gMoveToLearn;
extern u16 gRandomMove;
extern u8 gBankInMenu;
extern u8 gActionForBanks[4];
extern u8 gActionForBanks[BATTLE_BANKS_COUNT];
extern u8 gCurrentMoveTurn;
extern u8 gBattleBufferB[4][0x200];
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern u16 gLockedMoves[BATTLE_BANKS_COUNT];
extern const struct BattleMove gBattleMoves[];
extern const u16 gMissStringIds[];
extern const u8 gTrainerMoney[];
extern const u8 gTypeEffectiveness[];
extern const struct BaseStats gBaseStats[];
extern const u8 gTypeEffectiveness[];
extern const u16 gMissStringIds[];
extern const u16 gTrappingMoves[];
extern const u8 gTrainerMoney[];
// functions
@ -106,6 +108,9 @@ extern const u8 BattleScript_ItemSteal[];
extern const u8 BattleScript_RapidSpinAway[];
extern const u8 BattleScript_TargetPRLZHeal[];
extern const u8 BattleScript_KnockedOff[];
extern const u8 BattleScript_AllStatsUp[];
extern const u8 BattleScript_AtkDefDown[];
extern const u8 BattleScript_SAtkDown2[];
extern const u8 BattleScript_LevelUp[];
extern const u8 BattleScript_WrapFree[];
extern const u8 BattleScript_LeechSeedFree[];
@ -139,6 +144,7 @@ bool8 IsTwoTurnsMove(u16 move);
void DestinyBondFlagUpdate(void);
u8 AttacksThisTurn(u8 bank, u16 move); // Note: returns 1 if it's a charging turn, otherwise 2.
static void CheckWonderGuardAndLevitate(void);
u8 ChangeStatBuffs(s8, u8 statId, u8, const u8* BS_ptr);
void atk00_attackcanceler(void);
void atk01_accuracycheck(void);
@ -672,14 +678,14 @@ const u16 gCriticalHitChance[] = {16, 8, 4, 3, 2};
const u32 gStatusFlagsForMoveEffects[] =
{
0x00000000,
0x00000007,
0x00000008,
0x00000010,
0x00000020,
0x00000040,
0x00000080,
0x00000007,
0x00000008,
STATUS_SLEEP,
STATUS_POISON,
STATUS_BURN,
STATUS_FREEZE,
STATUS_PARALYSIS,
STATUS_TOXIC_POISON,
STATUS2_CONFUSION,
STATUS2_FLINCHED,
0x00000000,
0x00000070,
0x00000000,
@ -733,6 +739,8 @@ const u32 gStatusFlagsForMoveEffects[] =
0x00000000
};
extern const u8* gMoveEffectBS_Ptrs[];
void atk00_attackcanceler(void)
{
s32 i;
@ -2023,3 +2031,686 @@ u8 BankGetTurnOrder(u8 bank)
}
return i;
}
#define INCREMENT_RESET_RETURN \
{ \
gBattlescriptCurrInstr++; \
gBattleCommunication[MOVE_EFFECT_BYTE] = 0; \
return; \
}
#define RESET_RETURN \
{ \
gBattleCommunication[MOVE_EFFECT_BYTE] = 0; \
return; \
}
void SetMoveEffect(bool8 primary, u8 certain)
{
bool32 statusChanged = FALSE;
u8 affectsUser = 0; // 0x40 otherwise
bool32 noSunCanFreeze = TRUE;
if (gBattleCommunication[MOVE_EFFECT_BYTE] & MOVE_EFFECT_AFFECTS_USER)
{
gEffectBank = gBankAttacker; // bank that effects get applied on
gBattleCommunication[MOVE_EFFECT_BYTE] &= ~(MOVE_EFFECT_AFFECTS_USER);
affectsUser = MOVE_EFFECT_AFFECTS_USER;
gBattleScripting.bank = gBankTarget; // theoretically the attacker
}
else
{
gEffectBank = gBankTarget;
gBattleScripting.bank = gBankAttacker;
}
if (gBattleMons[gEffectBank].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 9)
INCREMENT_RESET_RETURN
if (gSideAffecting[GET_BANK_SIDE(gEffectBank)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 7)
INCREMENT_RESET_RETURN
if (gBattleMons[gEffectBank].hp == 0
&& gBattleCommunication[MOVE_EFFECT_BYTE] != MOVE_EFFECT_PAYDAY
&& gBattleCommunication[MOVE_EFFECT_BYTE] != MOVE_EFFECT_STEAL_ITEM)
INCREMENT_RESET_RETURN
if (gBattleMons[gEffectBank].status2 & STATUS2_SUBSTITUTE && affectsUser != MOVE_EFFECT_AFFECTS_USER)
INCREMENT_RESET_RETURN
if (gBattleCommunication[MOVE_EFFECT_BYTE] <= 6) // status change
{
switch (gStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]])
{
case STATUS_SLEEP:
// check active uproar
if (gBattleMons[gEffectBank].ability != ABILITY_SOUNDPROOF)
{
for (gActiveBank = 0;
gActiveBank < gNoOfAllBanks && !(gBattleMons[gActiveBank].status2 & STATUS2_UPROAR);
gActiveBank++)
{}
}
else
gActiveBank = gNoOfAllBanks;
if (gBattleMons[gEffectBank].status1)
break;
if (gActiveBank != gNoOfAllBanks)
break;
if (gBattleMons[gEffectBank].ability == ABILITY_VITAL_SPIRIT)
break;
if (gBattleMons[gEffectBank].ability == ABILITY_INSOMNIA)
break;
CancelMultiTurnMoves(gEffectBank);
statusChanged = TRUE;
break;
case STATUS_POISON:
if (gBattleMons[gEffectBank].ability == ABILITY_IMMUNITY
&& (primary == TRUE || certain == 0x80))
{
gLastUsedAbility = ABILITY_IMMUNITY;
RecordAbilityBattle(gEffectBank, ABILITY_IMMUNITY);
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
{
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}
RESET_RETURN
}
if ((gBattleMons[gEffectBank].type1 == TYPE_POISON || gBattleMons[gEffectBank].type2 == TYPE_POISON
|| gBattleMons[gEffectBank].type1 == TYPE_STEEL || gBattleMons[gEffectBank].type2 == TYPE_STEEL)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& (primary == 1 || certain == 0x80))
{
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
RESET_RETURN
}
if (gBattleMons[gEffectBank].type1 == TYPE_POISON)
break;
if (gBattleMons[gEffectBank].type2 == TYPE_POISON)
break;
if (gBattleMons[gEffectBank].type1 == TYPE_STEEL)
break;
if (gBattleMons[gEffectBank].type2 == TYPE_STEEL)
break;
if (gBattleMons[gEffectBank].status1)
break;
if (gBattleMons[gEffectBank].ability == ABILITY_IMMUNITY)
break;
statusChanged = TRUE;
break;
case STATUS_BURN:
if (gBattleMons[gEffectBank].ability == ABILITY_WATER_VEIL
&& (primary == 1 || certain == 0x80))
{
gLastUsedAbility = ABILITY_WATER_VEIL;
RecordAbilityBattle(gEffectBank, ABILITY_WATER_VEIL);
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
{
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}
RESET_RETURN
}
if ((gBattleMons[gEffectBank].type1 == TYPE_FIRE
|| gBattleMons[gEffectBank].type2 == TYPE_FIRE)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& (primary == 1 || certain == 0x80))
{
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
RESET_RETURN
}
if (gBattleMons[gEffectBank].type1 == TYPE_FIRE)
break;
if (gBattleMons[gEffectBank].type2 == TYPE_FIRE)
break;
if (gBattleMons[gEffectBank].ability == ABILITY_WATER_VEIL)
break;
if (gBattleMons[gEffectBank].status1)
break;
statusChanged = TRUE;
break;
case STATUS_FREEZE:
if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SUN_ANY)
noSunCanFreeze = FALSE;
if (gBattleMons[gEffectBank].type1 == TYPE_ICE)
break;
if (gBattleMons[gEffectBank].type2 == TYPE_ICE)
break;
if (gBattleMons[gEffectBank].status1)
break;
if (noSunCanFreeze == 0)
break;
if (gBattleMons[gEffectBank].ability == ABILITY_MAGMA_ARMOR)
break;
CancelMultiTurnMoves(gEffectBank);
statusChanged = TRUE;
break;
case STATUS_PARALYSIS:
if (gBattleMons[gEffectBank].ability == ABILITY_LIMBER)
{
if (primary == TRUE || certain == 0x80)
{
gLastUsedAbility = ABILITY_LIMBER;
RecordAbilityBattle(gEffectBank, ABILITY_LIMBER);
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PRLZPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
{
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}
RESET_RETURN
}
else
break;
}
if (gBattleMons[gEffectBank].status1)
break;
statusChanged = TRUE;
break;
case STATUS_TOXIC_POISON:
if (gBattleMons[gEffectBank].ability == ABILITY_IMMUNITY && (primary == 1 || certain == 0x80))
{
gLastUsedAbility = ABILITY_IMMUNITY;
RecordAbilityBattle(gEffectBank, ABILITY_IMMUNITY);
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
{
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}
RESET_RETURN
}
if ((gBattleMons[gEffectBank].type1 == TYPE_POISON || gBattleMons[gEffectBank].type2 == TYPE_POISON
|| gBattleMons[gEffectBank].type1 == TYPE_STEEL || gBattleMons[gEffectBank].type2 == TYPE_STEEL)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
&& (primary == TRUE || certain == 0x80))
{
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
RESET_RETURN
}
if (gBattleMons[gEffectBank].status1)
break;
if (gBattleMons[gEffectBank].type1 != TYPE_POISON
&& gBattleMons[gEffectBank].type2 != TYPE_POISON
&& gBattleMons[gEffectBank].type1 != TYPE_STEEL
&& gBattleMons[gEffectBank].type2 != TYPE_STEEL)
{
if (gBattleMons[gEffectBank].ability == ABILITY_IMMUNITY)
break;
// It's redundant, because at this point we know the status1 value is 0.
gBattleMons[gEffectBank].status1 &= ~(STATUS_TOXIC_POISON);
gBattleMons[gEffectBank].status1 &= ~(STATUS_POISON);
statusChanged = TRUE;
break;
}
else
{
gBattleMoveFlags |= MOVESTATUS_NOTAFFECTED;
}
break;
}
if (statusChanged == TRUE)
{
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
if (gStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]] == STATUS_SLEEP)
gBattleMons[gEffectBank].status1 |= ((Random() & 3) + 2);
else
gBattleMons[gEffectBank].status1 |= gStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]];
gBattlescriptCurrInstr = gMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
gActiveBank = gEffectBank;
EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gEffectBank].status1);
MarkBufferBankForExecution(gActiveBank);
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
{
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gHitMarker &= ~(HITMARKER_IGNORE_SAFEGUARD);
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}
// for synchronize
if (gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_POISON
|| gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_TOXIC
|| gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_PARALYSIS
|| gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_BURN)
{
u8* synchronizeEffect = &gBattleStruct->synchronizeMoveEffect;
*synchronizeEffect = gBattleCommunication[MOVE_EFFECT_BYTE];
gHitMarker |= HITMARKER_SYNCHRONISE_EFFECT;
}
return;
}
else if (statusChanged == FALSE)
{
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
gBattlescriptCurrInstr++;
return;
}
}
else
{
if (gBattleMons[gEffectBank].status2 & gStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]])
{
gBattlescriptCurrInstr++;
}
else
{
u8 side;
u32 statusFlag =
switch (gStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]])
{
case MOVE_EFFECT_CONFUSION:
if (gBattleMons[gEffectBank].ability == ABILITY_OWN_TEMPO
|| gBattleMons[gEffectBank].status2 & STATUS2_CONFUSION)
{
gBattlescriptCurrInstr++;
}
else
{
gBattleMons[gEffectBank].status2 |= (((Random()) % 0x4)) + 2;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = gMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
}
break;
case MOVE_EFFECT_FLINCH:
if (gBattleMons[gEffectBank].ability == ABILITY_INNER_FOCUS)
{
if (primary == 1 || certain == 0x80)
{
gLastUsedAbility = ABILITY_INNER_FOCUS;
RecordAbilityBattle(gEffectBank, ABILITY_INNER_FOCUS);
gBattlescriptCurrInstr = BattleScript_FlinchPrevention;
RESET_RETURN
}
else
{
gBattlescriptCurrInstr++;
break;
}
}
else
{
if (BankGetTurnOrder(gEffectBank) > gCurrentMoveTurn)
gBattleMons[gEffectBank].status2 |= gStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]];
INCREMENT_RESET_RETURN
}
break;
case MOVE_EFFECT_UPROAR:
if (gBattleMons[gEffectBank].status2 & STATUS2_UPROAR)
{
gBattlescriptCurrInstr++;
}
else
{
gBattleMons[gEffectBank].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gEffectBank] = gCurrentMove;
gBattleMons[gEffectBank].status2 |= ((Random() & 3) + 2) << 4;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = gMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
}
break;
case MOVE_EFFECT_PAYDAY:
if (GET_BANK_SIDE(gBankAttacker) == SIDE_PLAYER)
{
u16 PayDay = gPaydayMoney;
gPaydayMoney += (gBattleMons[gBankAttacker].level * 5);
if (PayDay > gPaydayMoney)
gPaydayMoney = 0xFFFF;
}
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = gMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
break;
case MOVE_EFFECT_TRI_ATTACK:
if (gBattleMons[gEffectBank].status1)
{
gBattlescriptCurrInstr++;
}
else
{
gBattleCommunication[MOVE_EFFECT_BYTE] = Random() % 3 + 3;
SetMoveEffect(FALSE, 0);
}
break;
case MOVE_EFFECT_CHARGING:
gBattleMons[gEffectBank].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gEffectBank] = gCurrentMove;
gProtectStructs[gEffectBank].chargingTurn = 1;
gBattlescriptCurrInstr++;
break;
case MOVE_EFFECT_WRAP:
if (gBattleMons[gEffectBank].status2 & STATUS2_WRAPPED)
{
gBattlescriptCurrInstr++;
}
else
{
gBattleMons[gEffectBank].status2 |= ((Random() & 3) + 2) << 0xD;
*(gBattleStruct->wrappedMove + gEffectBank * 2 + 0) = gCurrentMove;
*(gBattleStruct->wrappedMove + gEffectBank * 2 + 1) = gCurrentMove >> 8;
*(gBattleStruct->wrappedBy + gEffectBank) = gBankAttacker;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = gMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattleCommunication[MULTISTRING_CHOOSER] <= 4; gBattleCommunication[MULTISTRING_CHOOSER]++)
{
if (gCurrentMove == gTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]])
break;
}
}
break;
case MOVE_EFFECT_RECOIL_25: // 25% recoil
gBattleMoveDamage = (gHpDealt) / 4;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = gMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
break;
case 15 ... 21: // stat + 1
if (ChangeStatBuffs(0x10, gBattleCommunication[MOVE_EFFECT_BYTE] + 0xF2, affectsUser, 0))
{
gBattlescriptCurrInstr++;
}
else
{
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & 0x3F;
gBattleScripting.animArg2 = 0;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_StatUp;
}
break;
case 22 ... 28: // stat - 1
if (ChangeStatBuffs(~(0x6f), gBattleCommunication[MOVE_EFFECT_BYTE] + 0xEB, affectsUser, 0))
{
gBattlescriptCurrInstr++;
}
else
{
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & 0x3F;
gBattleScripting.animArg2 = 0;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_StatDown;
}
break;
case 39 ... 45: // stat + 2
if (ChangeStatBuffs(0x20, gBattleCommunication[MOVE_EFFECT_BYTE] + 0xDA, affectsUser, 0))
{
gBattlescriptCurrInstr++;
}
else
{
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & 0x3F;
gBattleScripting.animArg2 = 0;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_StatUp;
}
break;
case 46 ... 52: // stat - 2
if (ChangeStatBuffs(~(0x5f), gBattleCommunication[MOVE_EFFECT_BYTE] + 0xD3, affectsUser, 0))
{
gBattlescriptCurrInstr++;
}
else
{
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & 0x3F;
gBattleScripting.animArg2 = 0;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_StatDown;
}
break;
case MOVE_EFFECT_RECHARGE:
gBattleMons[gEffectBank].status2 |= STATUS2_RECHARGE;
gDisableStructs[gEffectBank].rechargeCounter = 2;
gLockedMoves[gEffectBank] = gCurrentMove;
gBattlescriptCurrInstr++;
break;
case MOVE_EFFECT_RAGE:
gBattleMons[gBankAttacker].status2 |= STATUS2_RAGE;
gBattlescriptCurrInstr++;
break;
case MOVE_EFFECT_STEAL_ITEM:
{
if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
{
gBattlescriptCurrInstr++;
break;
}
side = GetBankSide(gBankAttacker);
if (GetBankSide(gBankAttacker) == SIDE_OPPONENT
&& !(gBattleTypeFlags &
(BATTLE_TYPE_EREADER_TRAINER
| BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_LINK
| BATTLE_TYPE_x2000000
| BATTLE_TYPE_SECRET_BASE)))
{
gBattlescriptCurrInstr++;
break;
}
if (!(gBattleTypeFlags &
(BATTLE_TYPE_EREADER_TRAINER
| BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_LINK
| BATTLE_TYPE_x2000000
| BATTLE_TYPE_SECRET_BASE))
&& (gWishFutureKnock.knockedOffPokes[side] & gBitTable[gBattlePartyID[gBankAttacker]]))
{
gBattlescriptCurrInstr++;
break;
}
if (gBattleMons[gBankTarget].item
&& gBattleMons[gBankTarget].ability == ABILITY_STICKY_HOLD)
{
b_movescr_stack_push_cursor();
gBattlescriptCurrInstr = BattleScript_NoItemSteal;
gLastUsedAbility = gBattleMons[gBankTarget].ability;
RecordAbilityBattle(gBankTarget, gLastUsedAbility);
break;
}
if (gBattleMons[gBankAttacker].item)
{
gBattlescriptCurrInstr++;
break;
}
if (gBattleMons[gBankTarget].item == ITEM_ENIGMA_BERRY)
{
gBattlescriptCurrInstr++;
break;
}
if (gBattleMons[gBankTarget].item > 0x78
&& gBattleMons[gBankTarget].item < (0x79 + 12))
{
gBattlescriptCurrInstr++;
break;
}
if (gBattleMons[gBankTarget].item == 0)
{
gBattlescriptCurrInstr++;
break;
}
*(u16*)((u8*)((gBattleStruct->field_D0) + gBankAttacker * 2)) = gLastUsedItem = gBattleMons[gBankTarget].item;
gBattleMons[gBankTarget].item = 0;
gActiveBank = gBankAttacker;
EmitSetAttributes(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedItem);
MarkBufferBankForExecution(gBankAttacker);
gActiveBank = gBankTarget;
EmitSetAttributes(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gBankTarget].item);
MarkBufferBankForExecution(gBankTarget);
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_ItemSteal;
*(u8*)((u8*)(&gBattleStruct->choicedMove[gBankTarget]) + 0) = 0;
*(u8*)((u8*)(&gBattleStruct->choicedMove[gBankTarget]) + 1) = 0;
}
break;
case MOVE_EFFECT_PREVENT_ESCAPE:
gBattleMons[gBankTarget].status2 |= STATUS2_ESCAPE_PREVENTION;
gDisableStructs[gBankTarget].bankPreventingEscape = gBankAttacker;
gBattlescriptCurrInstr++;
break;
case MOVE_EFFECT_NIGHTMARE:
gBattleMons[gBankTarget].status2 |= STATUS2_NIGHTMARE;
gBattlescriptCurrInstr++;
break;
case MOVE_EFFECT_ALL_STATS_UP:
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_AllStatsUp;
break;
case MOVE_EFFECT_RAPIDSPIN:
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_RapidSpinAway;
break;
case MOVE_EFFECT_REMOVE_PARALYSIS: // Smelling salts
if (!(gBattleMons[gBankTarget].status1 & STATUS_PARALYSIS))
{
gBattlescriptCurrInstr++;
}
else
{
gBattleMons[gBankTarget].status1 &= ~(STATUS_PARALYSIS);
gActiveBank = gBankTarget;
EmitSetAttributes(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBankTarget].status1);
MarkBufferBankForExecution(gActiveBank);
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_TargetPRLZHeal;
}
break;
case MOVE_EFFECT_ATK_DEF_DOWN: // SuperPower
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_AtkDefDown;
break;
case MOVE_EFFECT_RECOIL_33_PARALYSIS: // Volt Tackle
gBattleMoveDamage = gHpDealt / 3;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = gMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
break;
case MOVE_EFFECT_THRASH:
if (gBattleMons[gEffectBank].status2 & STATUS2_LOCK_CONFUSE)
{
gBattlescriptCurrInstr++;
}
else
{
gBattleMons[gEffectBank].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gEffectBank] = gCurrentMove;
gBattleMons[gEffectBank].status2 |= (((Random() & 1) + 2) << 0xA);
}
break;
case MOVE_EFFECT_KNOCK_OFF:
if (gBattleMons[gEffectBank].ability == ABILITY_STICKY_HOLD)
{
if (gBattleMons[gEffectBank].item == 0)
{
gBattlescriptCurrInstr++;
}
else
{
gLastUsedAbility = ABILITY_STICKY_HOLD;
gBattlescriptCurrInstr = BattleScript_NoItemSteal;
RecordAbilityBattle(gEffectBank, ABILITY_STICKY_HOLD);
}
break;
}
if (gBattleMons[gEffectBank].item == 0)
{
gBattlescriptCurrInstr++;
}
else
{
side = GetBankSide(gEffectBank);
gLastUsedItem = gBattleMons[gEffectBank].item;
gBattleMons[gEffectBank].item = 0;
gWishFutureKnock.knockedOffPokes[side] |= gBitTable[gBattlePartyID[gEffectBank]];
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_KnockedOff;
*(u8*)((u8*)(&gBattleStruct->choicedMove[gEffectBank]) + 0) = 0;
*(u8*)((u8*)(&gBattleStruct->choicedMove[gEffectBank]) + 1) = 0;
}
break;
default:
gBattlescriptCurrInstr++;
break;
case MOVE_EFFECT_SP_ATK_TWO_DOWN: // Overheat
b_movescr_stack_push(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_SAtkDown2;
break;
}
}
}
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
}

View File

@ -313,7 +313,7 @@ gUnknown_0202407A: @ 202407A
gTurnOrder: @ 202407E
.space 0x4
gUnknown_02024082: @ 2024082
gCurrentMoveTurn: @ 2024082
.space 0x1
gFightStateTracker: @ 2024083
@ -406,7 +406,7 @@ gUnknown_02024258: @ 2024258
gUnknown_02024260: @ 2024260
.space 0x8
gUnknown_02024268: @ 2024268
gLockedMoves: @ 2024268
.space 0x8
gUnknown_02024270: @ 2024270
@ -445,7 +445,7 @@ gDisableStructs: @ 20242BC
gPauseCounterBattle: @ 202432C
.space 0x2
gUnknown_0202432E: @ 202432E
gPaydayMoney: @ 202432E
.space 0x2
gUnknown_02024330: @ 2024330