Fix switch-in abilities when shift style switch

This commit is contained in:
DizzyEggg 2020-04-25 11:17:59 +02:00
parent 738d92e39d
commit ee68f0f826
4 changed files with 15 additions and 11 deletions

View File

@ -4921,6 +4921,7 @@ BattleScript_GiveExp::
end2
BattleScript_HandleFaintedMon::
setbyte sSHIFT_SWITCHED, 0x0
atk24 BattleScript_82DA8F6
jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_FaintedMonEnd
jumpifbattletype BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonTryChooseAnother
@ -4931,7 +4932,7 @@ BattleScript_HandleFaintedMon::
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x0, BattleScript_FaintedMonTryChooseAnother
jumpifplayerran BattleScript_FaintedMonEnd
printstring STRINGID_CANTESCAPE2
BattleScript_FaintedMonTryChooseAnother::
BattleScript_FaintedMonTryChooseAnother:
openpartyscreen 0x3, BattleScript_FaintedMonEnd
switchhandleorder BS_FAINTED, 0x2
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother
@ -4966,9 +4967,8 @@ BattleScript_FaintedMonTryChooseAnother::
hidepartystatussummary BS_ATTACKER
switchinanim BS_ATTACKER, 0x0
waitstate
switchineffects BS_ATTACKER
resetsentmonsvalue
BattleScript_FaintedMonChooseAnother::
setbyte sSHIFT_SWITCHED, 0x1
BattleScript_FaintedMonChooseAnother:
drawpartystatussummary BS_FAINTED
getswitchedmondata BS_FAINTED
switchindataupdate BS_FAINTED
@ -4979,11 +4979,19 @@ BattleScript_FaintedMonChooseAnother::
waitstate
various7 BS_ATTACKER
trytrainerslidelastonmsg BS_FAINTED
jumpifbytenotequal sSHIFT_SWITCHED, sZero, BattleScript_FaintedMonShiftSwitched
BattleScript_FaintedMonChooseAnotherEnd:
switchineffects BS_FAINTED
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonEnd
cancelallactions
BattleScript_FaintedMonEnd::
end2
BattleScript_FaintedMonShiftSwitched:
copybyte sSAVED_BATTLER, gBattlerTarget
switchineffects BS_ATTACKER
resetsentmonsvalue
copybyte gBattlerTarget, sSAVED_BATTLER
goto BattleScript_FaintedMonChooseAnotherEnd
BattleScript_82DA8F6::
openpartyscreen 0x5, BattleScript_82DA8FC

View File

@ -594,7 +594,7 @@ struct BattleScripting
u16 tripleKickPower;
u8 moveendState;
u8 savedStatChanger; // For further use, if attempting to change stat two times(ex. Moody)
u8 unused_16;
u8 shiftSwitched; // When the game tells you the next enemy's pokemon and you switch. Option for noobs but oh well.
u8 battler;
u8 animTurn;
u8 animTargetsHit;

View File

@ -12,7 +12,7 @@
#define sTRIPLE_KICK_POWER gBattleScripting + 0x12
#define sMOVEEND_STATE gBattleScripting + 0x14
#define sSAVED_STAT_CHANGER gBattleScripting + 0x15
#define sUNUSED_16 gBattleScripting + 0x16
#define sSHIFT_SWITCHED gBattleScripting + 0x16
#define sBATTLER gBattleScripting + 0x17
#define sB_ANIM_TURN gBattleScripting + 0x18
#define sB_ANIM_TARGETS_HIT gBattleScripting + 0x19

View File

@ -7006,11 +7006,7 @@ static void Cmd_various(void)
statId = (Random() % NUM_BATTLE_STATS) + 1;
} while (!(bits & gBitTable[statId]));
if (gBattleMons[gActiveBattler].statStages[statId] >= 11)
SET_STATCHANGER(statId, 1, FALSE);
else
SET_STATCHANGER(statId, 2, FALSE);
SET_STATCHANGER(statId, 2, FALSE);
gBattlescriptCurrInstr += 7;
}
else