From e00890a5559b452b2dbbb82a4b2dcb464aa79707 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 20 May 2019 12:20:49 +0200 Subject: [PATCH] Fix Air Baloon msg --- data/battle_scripts_1.s | 2 +- include/battle.h | 1 + src/battle_util.c | 51 ++++++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index b04db678f8..a4d81c0b57 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6902,7 +6902,7 @@ BattleScript_ItemHealHP_End2:: BattleScript_AirBaloonMsgIn:: printstring STRINGID_AIRBALLOONFLOAT waitmessage 0x40 - end2 + end3 BattleScript_AirBaloonMsgPop:: printstring STRINGID_AIRBALLOONPOP diff --git a/include/battle.h b/include/battle.h index 16822bb1a9..4e43cbcfbd 100644 --- a/include/battle.h +++ b/include/battle.h @@ -165,6 +165,7 @@ struct SpecialStatus u8 sturdied:1; u8 stormDrainRedirected:1; u8 switchInAbilityDone:1; + u8 switchInItemDone:1; u8 instructedChosenTarget:3; u8 berryReduced:1; u8 gemBoost:1; diff --git a/src/battle_util.c b/src/battle_util.c index d98f39d331..857b48abcf 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3746,35 +3746,40 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (caseID) { case ITEMEFFECT_ON_SWITCH_IN: - switch (battlerHoldEffect) + if (!gSpecialStatuses[battlerId].switchInItemDone) { - case HOLD_EFFECT_DOUBLE_PRIZE: - if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) - gBattleStruct->moneyMultiplier *= 2; - break; - case HOLD_EFFECT_RESTORE_STATS: - for (i = 0; i < NUM_BATTLE_STATS; i++) + switch (battlerHoldEffect) { - if (gBattleMons[battlerId].statStages[i] < 6) + case HOLD_EFFECT_DOUBLE_PRIZE: + if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) + gBattleStruct->moneyMultiplier *= 2; + break; + case HOLD_EFFECT_RESTORE_STATS: + for (i = 0; i < NUM_BATTLE_STATS; i++) { - gBattleMons[battlerId].statStages[i] = 6; - effect = ITEM_STATS_CHANGE; + if (gBattleMons[battlerId].statStages[i] < 6) + { + gBattleMons[battlerId].statStages[i] = 6; + effect = ITEM_STATS_CHANGE; + } } + if (effect) + { + gBattleScripting.battler = battlerId; + gPotentialItemEffectBattler = battlerId; + gActiveBattler = gBattlerAttacker = battlerId; + BattleScriptExecute(BattleScript_WhiteHerbEnd2); + } + break; + case HOLD_EFFECT_AIR_BALLOON: + effect = ITEM_EFFECT_OTHER; + gBattleScripting.battler = battlerId; + BattleScriptPushCursorAndCallback(BattleScript_AirBaloonMsgIn); + RecordItemEffectBattle(battlerId, HOLD_EFFECT_AIR_BALLOON); + break; } if (effect) - { - gBattleScripting.battler = battlerId; - gPotentialItemEffectBattler = battlerId; - gActiveBattler = gBattlerAttacker = battlerId; - BattleScriptExecute(BattleScript_WhiteHerbEnd2); - } - break; - case HOLD_EFFECT_AIR_BALLOON: - effect = ITEM_EFFECT_OTHER; - gBattleScripting.battler = battlerId; - BattleScriptExecute(BattleScript_AirBaloonMsgIn); - RecordItemEffectBattle(battlerId, HOLD_EFFECT_AIR_BALLOON); - break; + gSpecialStatuses[battlerId].switchInItemDone = 1; } break; case 1: