Fix Air Balloon message happening when another battler switches in (#8455)

This commit is contained in:
PhallenTree 2025-12-06 16:47:53 +00:00 committed by GitHub
parent 3fb8215016
commit 02798e9990
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 6 deletions

View File

@ -196,11 +196,10 @@ struct SpecialStatus
u8 rototillerAffected:1; // to be affected by rototiller
// End of byte
u8 criticalHit:1;
u8 switchInItemDone:1;
u8 instructedChosenTarget:3;
u8 berryReduced:1;
u8 neutralizingGasRemoved:1; // See VARIOUS_TRY_END_NEUTRALIZING_GAS
u8 padding2:1;
u8 padding2:2;
// End of byte
u8 gemParam:7;
u8 gemBoost:1;

View File

@ -222,9 +222,8 @@ static enum ItemEffect TryAirBalloon(u32 battler, ActivationTiming timing)
effect = ITEM_EFFECT_OTHER;
}
}
else if (!gSpecialStatuses[battler].switchInItemDone)
else if (gBattleStruct->battlerState[battler].switchIn)
{
gSpecialStatuses[battler].switchInItemDone = TRUE;
BattleScriptCall(BattleScript_AirBalloonMsgInRet);
RecordItemEffectBattle(battler, HOLD_EFFECT_AIR_BALLOON);
effect = ITEM_EFFECT_OTHER;

View File

@ -3240,7 +3240,6 @@ void SwitchInClearSetData(u32 battler, struct Volatiles *volatilesCopy)
gBattleStruct->battlerState[battler].canPickupItem = FALSE;
gBattleStruct->battlerState[battler].wasAboveHalfHp = gBattleMons[battler].hp > gBattleMons[battler].maxHP / 2;
gBattleStruct->hazardsCounter = 0;
gSpecialStatuses[battler].switchInItemDone = FALSE;
ClearPursuitValuesIfSet(battler);

View File

@ -229,7 +229,6 @@ static bool32 FirstEventBlockEvents(struct BattleCalcValues *calcValues)
else if (EmergencyExitCanBeTriggered(battler))
{
gBattleScripting.battler = gBattlerAbility = battler;
gSpecialStatuses[battler].switchInItemDone = FALSE;
gBattleStruct->battlerState[battler].forcedSwitch = FALSE;
gBattleStruct->eventState.switchIn = 0;
BattleScriptCall(BattleScript_EmergencyExit);

View File

@ -24,6 +24,20 @@ SINGLE_BATTLE_TEST("Air Balloon prevents the holder from taking damage from grou
}
}
SINGLE_BATTLE_TEST("Air Balloon only displays entry message when user switches in")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { SWITCH(opponent, 1); }
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
NOT MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
}
}
SINGLE_BATTLE_TEST("Air Balloon pops when the holder is hit by a move that is not ground type")
{
GIVEN {