Add no-whiteout feature (#6795)

This commit is contained in:
Bassoonian 2025-05-17 11:20:35 +02:00 committed by GitHub
parent edf7c67775
commit 54806c8838
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 19 additions and 1 deletions

View File

@ -2558,3 +2558,8 @@
printstring STRINGID_EMPTYSTRING3
waitmessage 1
.endm
.macro jumpifnowhiteout jumpInstr:req
callnative BS_JumpIfNoWhiteOut
.4byte \jumpInstr
.endm

View File

@ -5394,6 +5394,7 @@ BattleScript_LocalBattleLost::
jumpifbattletype BATTLE_TYPE_TRAINER_HILL, BattleScript_LocalBattleLostPrintTrainersWinText
jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd
jumpifhalfword CMP_EQUAL, gTrainerBattleParameter + 2, TRAINER_SECRET_BASE, BattleScript_LocalBattleLostEnd
jumpifnowhiteout BattleScript_LocalBattleLostEnd_
BattleScript_LocalBattleLostPrintWhiteOut::
.if B_WHITEOUT_MONEY >= GEN_4
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostEnd

View File

@ -211,6 +211,7 @@
#define B_FLAG_TERA_ORB_CHARGED 0 // If this flag is set, the Tera Orb is charged. It is automatically set upon healing and cleared upon Terastallizing once configured.
#define B_FLAG_TERA_ORB_NO_COST 0 // If this flag is set, the Tera Orb does not use up its charge upon Terastallization. In S/V, this occurs after an event with Terapagos.
#define B_FLAG_SLEEP_CLAUSE 0 // If this flag is set, sleep clause is enabled; if the player / AI has already put a Pokémon on the opponent's side to sleep and it is still sleeping, another one can't be put to sleep. AI requires AI_FLAG_CHECK_BAD_MOVE to understand.
#define B_FLAG_NO_WHITEOUT 0 // If this flag is set, the player can not white out against Trainers. Please note that the party is not healed automatically!
// Var Settings
// To use the following features, change the 0 for a var present in include/constants/vars.h, preferably an unused one.

View File

@ -18690,3 +18690,13 @@ void BS_JumpIfLastUsedItemHoldEffect(void)
else
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_JumpIfNoWhiteOut(void)
{
NATIVE_ARGS(const u8 *jumpInstr);
if (FlagGet(B_FLAG_NO_WHITEOUT))
gBattlescriptCurrInstr = cmd->jumpInstr;
else
gBattlescriptCurrInstr = cmd->nextInstr;
}

View File

@ -1299,7 +1299,7 @@ static void CB2_EndTrainerBattle(void)
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{
if (InBattlePyramid() || InTrainerHillChallenge() || (!NoAliveMonsForPlayer()))
if (InBattlePyramid() || InTrainerHillChallenge() || (!NoAliveMonsForPlayer()) || FlagGet(B_FLAG_NO_WHITEOUT))
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
else
SetMainCallback2(CB2_WhiteOut);

View File

@ -440,6 +440,7 @@ void Overworld_ResetBattleFlagsAndVars(void)
FlagClear(B_FLAG_NO_RUNNING);
FlagClear(B_FLAG_DYNAMAX_BATTLE);
FlagClear(B_FLAG_SKY_BATTLE);
FlagClear(B_FLAG_NO_WHITEOUT);
}
#endif