battle 4 up to 0xE5

This commit is contained in:
DizzyEggg 2017-09-27 23:43:45 +02:00
parent d769ec1374
commit 69928d3904
17 changed files with 1845 additions and 5614 deletions

View File

@ -1548,7 +1548,7 @@ _080358E0:
.4byte _08035A70
_08035904:
ldr r4, =gUnknown_0831ABA8
ldr r5, =gUnknown_02022FF0
ldr r5, =gBattleTerrain
ldrb r1, [r5]
lsls r0, r1, 2
adds r0, r1
@ -2633,7 +2633,7 @@ _08036350:
cmp r0, 0
bne _0803639C
ldr r4, =gUnknown_0831ABA8
ldr r5, =gUnknown_02022FF0
ldr r5, =gBattleTerrain
ldrb r1, [r5]
lsls r0, r1, 2
adds r0, r1
@ -2779,7 +2779,7 @@ _080364A8:
.4byte _08036518
_080364CC:
ldr r2, =gUnknown_0831ABA8
ldr r0, =gUnknown_02022FF0
ldr r0, =gBattleTerrain
ldrb r1, [r0]
lsls r0, r1, 2
adds r0, r1
@ -2889,7 +2889,7 @@ _080365B4:
.4byte _08036624
_080365D8:
ldr r2, =gUnknown_0831ABA8
ldr r0, =gUnknown_02022FF0
ldr r0, =gBattleTerrain
ldrb r1, [r0]
lsls r0, r1, 2
adds r0, r1
@ -3004,7 +3004,7 @@ _080366C8:
.4byte _08036740
_080366EC:
ldr r2, =gUnknown_0831ABA8
ldr r0, =gUnknown_02022FF0
ldr r0, =gBattleTerrain
ldrb r1, [r0]
lsls r0, r1, 2
adds r0, r1

View File

@ -170,7 +170,7 @@ _080368BE:
ldr r0, =gUnknown_02022E22
strh r1, [r0]
bl sub_80B0BD0
ldr r2, =gUnknown_02022FF0
ldr r2, =gBattleTerrain
strb r0, [r2]
ldr r4, =gBattleTypeFlags
ldr r0, [r4]
@ -7852,7 +7852,7 @@ bc_load_battlefield: @ 803AC34
bl GetBankByIdentity
ldr r4, =gActiveBank
strb r0, [r4]
ldr r0, =gUnknown_02022FF0
ldr r0, =gBattleTerrain
ldrb r1, [r0]
movs r0, 0
bl dp01_build_cmdbuf_x2E_a
@ -9207,7 +9207,7 @@ _0803B7DA:
ldr r1, =gBattleStruct
mov r8, r1
movs r7, 0x6
ldr r6, =gUnknown_0202421C
ldr r6, =gActionForBanks
ldr r2, =gChosenMovesByBanks
movs r4, 0xFF
movs r3, 0
@ -9511,7 +9511,7 @@ _0803BAB2:
ldrb r0, [r4]
cmp r2, r0
bge _0803BAE0
ldr r7, =gUnknown_0202421C
ldr r7, =gActionForBanks
movs r6, 0xFF
movs r5, 0
ldr r3, =gChosenMovesByBanks
@ -10049,7 +10049,7 @@ _0803BF68:
ands r3, r0
cmp r3, 0
beq _0803BFD0
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
adds r0, r2, r0
movs r1, 0xD
strb r1, [r0]
@ -10092,7 +10092,7 @@ _0803BFD0:
cmp r1, 0
beq _0803C00C
_0803BFF0:
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
adds r0, r2, r0
strb r3, [r0]
ldr r1, =gBattleCommunication
@ -10100,7 +10100,7 @@ _0803BFF0:
bl _0803CC72
.pool
_0803C00C:
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
ldrb r1, [r0]
ldr r0, =gBattleBufferB
ldrb r2, [r0, 0x1]
@ -10141,7 +10141,7 @@ _0803C058:
ldrb r1, [r0]
adds r0, r5, 0
bl RecordedBattle_SetBankAction
ldr r1, =gUnknown_0202421C
ldr r1, =gActionForBanks
ldrb r0, [r6]
adds r1, r0, r1
lsls r0, 9
@ -10497,7 +10497,7 @@ _0803C3B0:
adds r4, r0, 0
cmp r1, 0x2
bne _0803C3D8
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
ldrb r0, [r0]
cmp r0, 0x2
bne _0803C3D8
@ -10511,7 +10511,7 @@ _0803C3D8:
ldrb r0, [r4]
cmp r0, 0x3
bne _0803C410
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
ldrb r0, [r0, 0x1]
cmp r0, 0x2
bne _0803C410
@ -10664,7 +10664,7 @@ _0803C532:
bl _0803CD70
.pool
_0803C550:
ldr r4, =gUnknown_0202421C
ldr r4, =gActionForBanks
ldrb r0, [r5]
bl GetBankIdentity
eors r0, r6
@ -10763,7 +10763,7 @@ _0803C628:
ands r0, r1
cmp r0, 0
beq _0803C690
ldr r4, =gUnknown_0202421C
ldr r4, =gActionForBanks
ldr r6, =gActiveBank
ldrb r0, [r6]
bl GetBankIdentity
@ -10945,7 +10945,7 @@ _0803C7D8:
beq _0803C804
b _0803CD04
_0803C804:
ldr r1, =gUnknown_0202421C
ldr r1, =gActionForBanks
adds r0, r5, r1
ldrb r0, [r0]
adds r2, r1, 0
@ -11410,7 +11410,7 @@ _0803CC38:
lsls r1, 8
orrs r0, r1
str r0, [r2]
ldr r1, =gUnknown_0202421C
ldr r1, =gActionForBanks
ldrb r0, [r5]
adds r0, r1
movs r1, 0x3
@ -11515,7 +11515,7 @@ _0803CD1E:
cmp r4, r5
bge _0803CD70
_0803CD4A:
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
adds r0, r4, r0
ldrb r0, [r0]
cmp r0, 0x2
@ -12033,7 +12033,7 @@ _0803D198:
b _0803D254
.pool
_0803D1B8:
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
mov r3, r9
adds r1, r3, r0
ldrb r1, [r1]
@ -12209,7 +12209,7 @@ sub_803D2E8: @ 803D2E8
b _0803D54A
_0803D310:
ldr r7, =gUnknown_0202407A
ldr r6, =gUnknown_0202421C
ldr r6, =gActionForBanks
mov r2, r8
ldr r5, =gTurnOrder
_0803D318:
@ -12245,7 +12245,7 @@ _0803D354:
ldrb r2, [r2]
cmp r3, r2
bcs _0803D3C0
ldr r0, =gUnknown_0202421C
ldr r0, =gActionForBanks
ldrb r1, [r0]
adds r4, r0, 0
cmp r1, 0x3
@ -12269,7 +12269,7 @@ _0803D376:
b _0803D3BE
.pool
_0803D3A4:
ldr r1, =gUnknown_0202421C
ldr r1, =gActionForBanks
ldrb r0, [r1]
ldr r4, =gActiveBank
mov r8, r4
@ -12289,7 +12289,7 @@ _0803D3C0:
cmp r3, 0x5
bne _0803D448
ldr r6, =gUnknown_0202407A
ldr r1, =gUnknown_0202421C
ldr r1, =gActionForBanks
mov r2, r8
ldrb r0, [r2]
adds r0, r1
@ -12349,7 +12349,7 @@ _0803D448:
ldrb r0, [r1]
cmp r0, 0
beq _0803D48E
ldr r6, =gUnknown_0202421C
ldr r6, =gActionForBanks
mov r2, r8
ldr r5, =gUnknown_0202407A
ldr r4, =gTurnOrder
@ -12387,7 +12387,7 @@ _0803D48E:
ldrb r0, [r4]
cmp r0, 0
beq _0803D4D2
ldr r6, =gUnknown_0202421C
ldr r6, =gActionForBanks
ldr r5, =gUnknown_0202407A
ldr r4, =gTurnOrder
_0803D4A2:
@ -15097,7 +15097,7 @@ sub_803EE48: @ 803EE48
cmp r1, 0
beq _0803EEE0
adds r4, r2, 0
ldr r6, =gUnknown_0202421C
ldr r6, =gActionForBanks
ldr r5, =gBattleOutcome
_0803EE7C:
ldrb r0, [r4]
@ -15797,8 +15797,8 @@ _0803F532:
.pool
thumb_func_end PressurePPLose
thumb_func_start sub_803F548
sub_803F548: @ 803F548
thumb_func_start PressurePPLoseOnUsingImprision
PressurePPLoseOnUsingImprision: @ 803F548
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@ -15946,10 +15946,10 @@ _0803F658:
pop {r0}
bx r0
.pool
thumb_func_end sub_803F548
thumb_func_end PressurePPLoseOnUsingImprision
thumb_func_start sub_803F67C
sub_803F67C: @ 803F67C
thumb_func_start PressurePPLoseOnUsingPerishSong
PressurePPLoseOnUsingPerishSong: @ 803F67C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@ -16078,7 +16078,7 @@ _0803F762:
pop {r0}
bx r0
.pool
thumb_func_end sub_803F67C
thumb_func_end PressurePPLoseOnUsingPerishSong
thumb_func_start sub_803F790
sub_803F790: @ 803F790

File diff suppressed because it is too large Load Diff

View File

@ -47348,7 +47348,7 @@ sub_811675C: @ 811675C
ldrsh r0, [r0, r1]
bl sub_811583C
adds r2, r0, 0
ldr r0, =gUnknown_02022FF0
ldr r0, =gBattleTerrain
ldrb r0, [r0]
cmp r0, 0x9
bhi _08116832
@ -49759,7 +49759,7 @@ sub_8117C24: @ 8117C24
lsls r0, 24
lsrs r0, 24
ldr r2, =gBattleAnimArgs
ldr r1, =gUnknown_02022FF0
ldr r1, =gBattleTerrain
ldrb r1, [r1]
strh r1, [r2]
bl move_anim_task_del

View File

@ -31263,8 +31263,8 @@ _081AAA9E:
.pool
thumb_func_end sub_81AAA7C
thumb_func_start CalculateBattlePyramidPickupItemId
CalculateBattlePyramidPickupItemId: @ 81AAAE0
thumb_func_start GetBattlePyramidPickupItemId
GetBattlePyramidPickupItemId: @ 81AAAE0
push {r4-r6,lr}
ldr r0, =gSaveBlock2Ptr
ldr r1, [r0]
@ -31331,6 +31331,6 @@ _081AAB5A:
pop {r1}
bx r1
.pool
thumb_func_end CalculateBattlePyramidPickupItemId
thumb_func_end GetBattlePyramidPickupItemId
.align 2, 0 @ Don't pad with nop.

View File

@ -5476,8 +5476,8 @@ _08075028:
bx r1
thumb_func_end sub_8074FE8
thumb_func_start sub_8075034
sub_8075034: @ 8075034
thumb_func_start GetScaledHPFraction
GetScaledHPFraction: @ 8075034
push {r4,lr}
lsls r2, 24
lsrs r2, 24
@ -5499,7 +5499,7 @@ _08075058:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8075034
thumb_func_end GetScaledHPFraction
thumb_func_start sub_8075060
sub_8075060: @ 8075060
@ -5514,7 +5514,7 @@ sub_8075060: @ 8075060
b _0807508E
_08075072:
movs r2, 0x30
bl sub_8075034
bl GetScaledHPFraction
lsls r0, 24
lsrs r1, r0, 24
movs r0, 0x3

View File

@ -186,7 +186,7 @@ evolution_cutscene: @ 813DA8C
ldr r0, =gUnknown_02022E22
movs r1, 0
strh r1, [r0]
ldr r1, =gUnknown_02022FF0
ldr r1, =gBattleTerrain
movs r0, 0x9
strb r0, [r1]
bl c2_berry_program_update_menu
@ -479,7 +479,7 @@ sub_813DD7C: @ 813DD7C
strh r0, [r1]
ldr r0, =gUnknown_02022E22
strh r4, [r0]
ldr r1, =gUnknown_02022FF0
ldr r1, =gBattleTerrain
movs r0, 0x9
strb r0, [r1]
bl c2_berry_program_update_menu

View File

@ -5495,7 +5495,7 @@ _081B2F04:
asrs r1, 16
ldr r2, [r6]
ldrb r2, [r2, 0x1A]
bl sub_8075034
bl GetScaledHPFraction
lsls r0, 24
lsrs r5, r0, 24
ldrb r0, [r6, 0x8]

View File

@ -43,18 +43,18 @@ gMovesForbiddenToCopy:: @ 831C3E0
.2byte MOVE_COVET, MOVE_TRICK, MOVE_FOCUS_PUNCH, 0xffff
.align 2
gUnknown_0831C408:: @ 831C408
sFlailHpScaleToPowerTable:: @ 831C408
.byte 0x01, 0xc8, 0x04, 0x96, 0x09, 0x64, 0x10, 0x50
.byte 0x20, 0x28, 0x30, 0x14
.align 2
gUnknown_0831C414:: @ 831C414
sNaturePowerMoves:: @ 831C414
.2byte 0x004e, 0x004b, 0x0059, 0x0038
.2byte 0x0039, 0x003d, 0x009d, 0x00f7
.2byte 0x0081, 0x0081
.align 2
gUnknown_0831C428:: @ 831C428
sWeightToDamageTable:: @ 831C428
.2byte 0x0064, 0x0014, 0x00fa, 0x0028
.2byte 0x01f4, 0x003c, 0x03e8, 0x0050
.2byte 0x07d0, 0x0064, 0xffff, 0xffff

View File

@ -6,13 +6,13 @@
gBattleScriptsForMoveEffects:: @ 82D86A8
.incbin "baserom.gba", 0x2d86a8, 0x388
gUnknown_082D8A30:: @ 82D8A30
BattleScript_PresentDamageTarget:: @ 82D8A30
.incbin "baserom.gba", 0x2d8a30, 0x1e
BattleScript_MoveEnd:: @ 82D8A4E
.incbin "baserom.gba", 0x2d8a4e, 0x12
gUnknown_082D8A60:: @ 82D8A60
BattleScript_PauseEffectivenessSoundResultMsgEndMove:: @ 82D8A60
.incbin "baserom.gba", 0x2d8a60, 0x274
BattleScript_StatUp:: @ 82D8CD4
@ -24,10 +24,10 @@ BattleScript_StatDown:: @ 82D8D65
BattleScript_MoveUsedMustRecharge:: @ 82D9462
.incbin "baserom.gba", 0x2d9462, 0xa7f
gUnknown_082D9EE1:: @ 82D9EE1
BattleScript_PresentHealTarget:: @ 82D9EE1
.incbin "baserom.gba", 0x2d9ee1, 0x1a
gUnknown_082D9EFB:: @ 82D9EFB
BattleScript_AlreadyAtFullHp:: @ 82D9EFB
.incbin "baserom.gba", 0x2d9efb, 0x21
BattleScript_ButItFailed:: @ 82D9F1C
@ -180,13 +180,13 @@ BattleScript_AllStatsUp:: @ 82DAF27
BattleScript_RapidSpinAway:: @ 82DAFC3
.incbin "baserom.gba", 0x2dafc3, 0x2
gUnknown_082DAFC5:: @ 82DAFC5
BattleScript_WrapFree:: @ 82DAFC5
.incbin "baserom.gba", 0x2dafc5, 0x11
gUnknown_082DAFD6:: @ 82DAFD6
BattleScript_LeechSeedFree:: @ 82DAFD6
.incbin "baserom.gba", 0x2dafd6, 0x7
gUnknown_082DAFDD:: @ 82DAFDD
BattleScript_SpikesFree:: @ 82DAFDD
.incbin "baserom.gba", 0x2dafdd, 0x7
gUnknown_082DAFE4:: @ 82DAFE4
@ -444,7 +444,7 @@ BattleScript_SoundproofProtected:: @ 82DB61F
BattleScript_AbilityNoSpecificStatLoss:: @ 82DB62F
.incbin "baserom.gba", 0x2db62f, 0x10
BattleScript_StickyHoldOnKnockOff:: @ 82DB63F
BattleScript_StickyHoldActivates:: @ 82DB63F
.incbin "baserom.gba", 0x2db63f, 0xe
BattleScript_ColorChangeActivates:: @ 82DB64D

View File

@ -112,7 +112,7 @@
#define STATUS3_ROOTED 0x400
#define STATUS3_CHARGED_UP 0x200
#define STATUS3_YAWN 0x1800 //two bits
#define STATUS3_IMPRISIONED 0x2000
#define STATUS3_IMPRISONED_OTHERS 0x2000
#define STATUS3_GRUDGE 0x4000
#define STATUS3_CANT_SCORE_A_CRIT 0x8000
#define STATUS3_MUDSPORT 0x10000
@ -172,7 +172,7 @@
#define ABILITYEFFECT_CHECK_BANK_SIDE 0xD
#define ABILITYEFFECT_FIELD_SPORT 0xE
#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK 0xF
#define ABILITYEFFECT_COUNT_OTHER_SIZE 0x10
#define ABILITYEFFECT_COUNT_OTHER_SIDE 0x10
#define ABILITYEFFECT_COUNT_BANK_SIDE 0x11
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
@ -206,6 +206,15 @@
#define WEATHER_HAIL (1 << 7)
#define WEATHER_HAIL_ANY ((WEATHER_HAIL))
#define BATTLE_TERRAIN_GRASS 0
#define BATTLE_TERRAIN_LONG_GRASS 1
#define BATTLE_TERRAIN_SAND 2
#define BATTLE_TERRAIN_UNDERWATER 3
#define BATTLE_TERRAIN_WATER 4
#define BATTLE_TERRAIN_POND 5
#define BATTLE_TERRAIN_ROCK 6
#define BATTLE_TERRAIN_CAVE 7
// array entries for battle communication
#define CURSOR_POSITION 0x1
#define MOVE_EFFECT_BYTE 0x3
@ -554,46 +563,7 @@ struct BattleStruct
u8 wildVictorySong;
u8 dynamicMoveType;
u8 wrappedBy[4];
u8 field_18;
u8 field_19;
u8 field_1A;
u8 field_1B;
u8 field_1C;
u8 field_1D;
u8 field_1E;
u8 field_1F;
u8 field_20;
u8 field_21;
u8 field_22;
u8 field_23;
u8 field_24;
u8 field_25;
u8 field_26;
u8 field_27;
u8 field_28;
u8 field_29;
u8 field_2A;
u8 field_2B;
u8 field_2C;
u8 field_2D;
u8 field_2E;
u8 field_2F;
u8 field_30;
u8 field_31;
u8 field_32;
u8 field_33;
u8 field_34;
u8 field_35;
u8 field_36;
u8 field_37;
u8 field_38;
u8 field_39;
u8 field_3A;
u8 field_3B;
u8 field_3C;
u8 field_3D;
u8 field_3E;
u8 field_3F;
u16 assistPossibleMoves[5 * 4]; // 5 mons, each of them knowing 4 moves
u8 field_40;
u8 field_41;
u8 field_42;
@ -710,28 +680,6 @@ extern struct BattleStruct* gBattleStruct;
var2[offsetof(struct structName, offsetField)] = value; \
}
// This is a leftover from R/S direct use of ewram addresses
#define GET_CHANGED_ITEM_PTR_VIA_MEME_ACCESS(bank, varName) \
{ \
void** memes1 = (void**)(&gBattleStruct); \
void* memes2 = (void*)((u32)(bank * 2 + offsetof(struct BattleStruct, changedItems))); \
varName = (u16*)(((void*)(*memes1) + (u32)(memes2))); \
}
#define GET_USED_ITEM_PTR_VIA_MEME_ACCESS(bank, varName) \
{ \
void** memes1 = (void**)(&gBattleStruct); \
void* memes2 = (void*)((u32)(bank * 2 + offsetof(struct BattleStruct, usedHeldItems))); \
varName = (u16*)(((void*)(*memes1) + (u32)(memes2))); \
}
#define GET_HP_SWITCHOUT_PTR_VIA_MEME_ACCESS(bank, varName) \
{ \
void** memes1 = (void**)(&gBattleStruct); \
void* memes2 = (void*)((u32)(bank * 2 + offsetof(struct BattleStruct, hpOnSwitchout))); \
varName = (u16*)(((void*)(*memes1) + (u32)(memes2))); \
}
#define GET_MOVE_TYPE(move, typeArg) \
{ \
if (gBattleStruct->dynamicMoveType) \
@ -917,15 +865,24 @@ void BattleMainCB2(void);
void ResetSentPokesToOpponentValue(void);
bool8 CanRunFromBattle(u8 bank);
bool8 IsRunningFromBattleImpossible(void);
void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
void PressurePPLoseOnUsingImprision(u8 bankAtk);
// battle_3
#define MOVE_LIMITATION_ZEROMOVE (1 << 0)
#define MOVE_LIMITATION_PP (1 << 1)
#define MOVE_LIMITATION_DISABLED (1 << 2)
#define MOVE_LIMITATION_TORMENTED (1 << 3)
#define MOVE_LIMITATION_TAUNT (1 << 4)
#define MOVE_LIMITATION_IMPRISION (1 << 5)
void BattleScriptPush(const u8* bsPtr);
void BattleScriptPushCursor(void);
void BattleScriptPop(void);
u8 sub_803FB4C(void); // msg, can't select a move
u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check);
bool8 AreAllMovesUnusable(void);
u8 IsImprisoned(u8 bank, u16 move);
u8 GetImprisonedMovesCount(u8 bank, u16 move);
u8 UpdateTurnCounters(void);
u8 TurnBasedEffects(void);
bool8 sub_8041364(void);

View File

@ -82,6 +82,14 @@
textVar[3] = B_BUFF_EOS; \
}
#define PREPARE_ABILITY_BUFFER(textVar, abilityId) \
{ \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
textVar[1] = B_BUFF_ABILITY; \
textVar[2] = abilityId; \
textVar[3] = B_BUFF_EOS; \
}
#define PREPARE_TYPE_BUFFER(textVar, typeId) \
{ \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
@ -142,6 +150,15 @@
textVar[4] = B_BUFF_EOS; \
}
#define PREPARE_ITEM_BUFFER(textVar, item) \
{ \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
textVar[1] = B_BUFF_ITEM; \
textVar[2] = item; \
textVar[3] = (item & 0xFF00) >> 8; \
textVar[4] = B_BUFF_EOS; \
}
#define PREPARE_SPECIES_BUFFER(textVar, species) \
{ \
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \

19
include/mail.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef GUARD_MAIL_H
#define GUARD_MAIL_H
#include "items.h"
#define IS_ITEM_MAIL(itemId)((itemId == ITEM_ORANGE_MAIL \
|| itemId == ITEM_HARBOR_MAIL \
|| itemId == ITEM_GLITTER_MAIL \
|| itemId == ITEM_MECH_MAIL \
|| itemId == ITEM_WOOD_MAIL \
|| itemId == ITEM_WAVE_MAIL \
|| itemId == ITEM_BEAD_MAIL \
|| itemId == ITEM_SHADOW_MAIL \
|| itemId == ITEM_TROPIC_MAIL \
|| itemId == ITEM_DREAM_MAIL \
|| itemId == ITEM_FAB_MAIL \
|| itemId == ITEM_RETRO_MAIL))
#endif // GUARD_MAIL_H

View File

@ -261,7 +261,7 @@ u8 sub_803FB4C(void) // msg, can't select a move
}
}
if (IsImprisoned(gActiveBank, move))
if (GetImprisonedMovesCount(gActiveBank, move))
{
gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
@ -314,13 +314,6 @@ u8 sub_803FB4C(void) // msg, can't select a move
return limitations;
}
#define MOVE_LIMITATION_ZEROMOVE (1 << 0)
#define MOVE_LIMITATION_PP (1 << 1)
#define MOVE_LIMITATION_DISABLED (1 << 2)
#define MOVE_LIMITATION_TORMENTED (1 << 3)
#define MOVE_LIMITATION_TAUNT (1 << 4)
#define MOVE_LIMITATION_IMPRISION (1 << 5)
u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check)
{
u8 holdEffect;
@ -346,7 +339,7 @@ u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check)
unusableMoves |= gBitTable[i];
if (gDisableStructs[bank].tauntTimer1 && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[bank].moves[i]].power == 0)
unusableMoves |= gBitTable[i];
if (IsImprisoned(bank, gBattleMons[bank].moves[i]) && check & MOVE_LIMITATION_IMPRISION)
if (GetImprisonedMovesCount(bank, gBattleMons[bank].moves[i]) && check & MOVE_LIMITATION_IMPRISION)
unusableMoves |= gBitTable[i];
if (gDisableStructs[bank].encoreTimer1 && gDisableStructs[bank].encoredMove != gBattleMons[bank].moves[i])
unusableMoves |= gBitTable[i];
@ -374,7 +367,7 @@ bool8 AreAllMovesUnusable(void)
return (unusable == 0xF);
}
u8 IsImprisoned(u8 bank, u16 move)
u8 GetImprisonedMovesCount(u8 bank, u16 move)
{
s32 i;
u8 imprisionedMoves = 0;
@ -382,7 +375,7 @@ u8 IsImprisoned(u8 bank, u16 move)
for (i = 0; i < gNoOfAllBanks; i++)
{
if (bankSide != GetBankSide(i) && gStatuses3[i] & STATUS3_IMPRISIONED)
if (bankSide != GetBankSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
{
s32 j;
for (j = 0; j < 4; j++)
@ -1327,7 +1320,7 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleStruct->atkCancellerTracker++;
break;
case 8: // imprisoned
if (IsImprisoned(gBankAttacker, gCurrentMove))
if (GetImprisonedMovesCount(gBankAttacker, gCurrentMove))
{
gProtectStructs[gBankAttacker].usedImprisionedMove = 1;
CancelMultiTurnMoves(gBankAttacker);
@ -2379,7 +2372,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
}
}
break;
case ABILITYEFFECT_COUNT_OTHER_SIZE: // 16
case ABILITYEFFECT_COUNT_OTHER_SIDE: // 16
side = GetBankSide(bank);
for (i = 0; i < gNoOfAllBanks; i++)
{
@ -6238,7 +6231,7 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
targetBank = Random() % gNoOfAllBanks;
} while (targetBank == gBankAttacker || side == GetBankSide(targetBank) || gAbsentBankFlags & gBitTable[targetBank]);
if (gBattleMoves[move].type == TYPE_ELECTRIC
&& AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIZE, gBankAttacker, ABILITY_LIGHTNING_ROD, 0, 0)
&& AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBankAttacker, ABILITY_LIGHTNING_ROD, 0, 0)
&& gBattleMons[targetBank].ability != ABILITY_LIGHTNING_ROD)
{
targetBank ^= 2;

File diff suppressed because it is too large Load Diff

View File

@ -1361,20 +1361,20 @@ void BoxMonRestorePP(struct BoxPokemon *boxMon)
void sub_806E994(void)
{
gLastUsedAbility = gBattleStruct->field_B0;
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 4;
gBattleTextBuff1[0] = B_BUFF_PLACEHOLDER_BEGIN;
gBattleTextBuff1[1] = B_BUFF_MON_NICK_WITH_PREFIX;
gBattleTextBuff1[2] = gBattleStruct->field_49;
gBattleTextBuff1[4] = EOS;
gBattleTextBuff1[4] = B_BUFF_EOS;
if (!GetBankSide(gBattleStruct->field_49))
gBattleTextBuff1[3] = pokemon_order_func(gBattlePartyID[gBattleStruct->field_49]);
else
gBattleTextBuff1[3] = gBattlePartyID[gBattleStruct->field_49];
gBattleTextBuff2[0] = 0xFD;
gBattleTextBuff2[1] = 4;
gBattleTextBuff2[2] = gBankInMenu;
gBattleTextBuff2[3] = pokemon_order_func(gBattlePartyID[gBankInMenu]);
gBattleTextBuff2[4] = EOS;
BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4);
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBankInMenu, pokemon_order_func(gBattlePartyID[gBankInMenu]))
BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4);
}
struct PokeItem
@ -1388,7 +1388,7 @@ extern const struct PokeItem gAlteringCaveWildMonHeldItems[9];
static s32 GetWildMonTableIdInAlteringCave(u16 species)
{
s32 i;
for (i = 0; i < 9; i++)
for (i = 0; i < (s32) ARRAY_COUNT(gAlteringCaveWildMonHeldItems); i++)
if (gAlteringCaveWildMonHeldItems[i].species == species)
return i;
return 0;

View File

@ -268,7 +268,7 @@ gUnknown_02022F88: @ 2022F88
gBattleTypeFlags: @ 2022FEC
.space 0x4
gUnknown_02022FF0: @ 2022FF0
gBattleTerrain: @ 2022FF0
.space 0x4
gUnknown_02022FF4: @ 2022FF4
@ -382,7 +382,7 @@ gMultiHitCounter: @ 2024212
gBattlescriptCurrInstr: @ 2024214
.space 0x8
gUnknown_0202421C: @ 202421C
gActionForBanks: @ 202421C
.space 0x4
gUnknown_02024220: @ 2024220