From d99fd30e4d60533e46d59e872cac542786a8d929 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 11:51:20 +1300 Subject: [PATCH] Looping battle script, correct message Testing in Sword showed that the pop up should happen once if two mons are cured, and that the correct message is "X was cured of its poisoning!" --- data/battle_scripts_1.s | 24 ++++++++++-------------- src/battle_message.c | 2 +- src/battle_util.c | 17 ++++------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 37b592365..5bd37cf04 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8927,30 +8927,26 @@ BattleScript_DarkTypePreventsPrankster:: orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT goto BattleScript_MoveEnd -BattleScript_PastelVeilActivatesOld:: - call BattleScript_AbilityPopUp - printfromtable gSwitchInAbilityStringIds - curestatus BS_SCRIPTING - updatestatusicon BS_SCRIPTING - waitmessage B_WAIT_TIME_LONG - end3 - BattleScript_PastelVeilActivates:: - call BattleScript_AbilityPopUp - printfromtable gSwitchInAbilityStringIds - waitmessage B_WAIT_TIME_LONG - copybyte gBattlerTarget, gBattlerAttacker setbyte gBattleCommunication, 0 + setbyte gBattleCommunication + 1, 0 BattleScript_PastelVeil_TryCurePoison: jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_PastelVeilCurePoison - goto BattleScript_PastelVeilEnd + goto BattleScript_PastelVeilLoopIncrement BattleScript_PastelVeilCurePoison: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication + 1, 0x0, BattleScript_PastelVeilCurePoisonNoPopUp + call BattleScript_AbilityPopUp + setbyte gBattleCommunication + 1, 1 +BattleScript_PastelVeilCurePoisonNoPopUp: @ Only show Pastel Veil pop up once if it cures two mons + printfromtable gSwitchInAbilityStringIds + waitmessage B_WAIT_TIME_LONG curestatus BS_TARGET updatestatusicon BS_TARGET +BattleScript_PastelVeilLoopIncrement: jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_PastelVeilEnd addbyte gBattleCommunication, 1 jumpifnoally BS_TARGET, BattleScript_PastelVeilEnd setallytonexttarget BattleScript_PastelVeil_TryCurePoison - goto BattleScript_MoveEnd + goto BattleScript_PastelVeilEnd BattleScript_PastelVeilEnd: end3 diff --git a/src/battle_message.c b/src/battle_message.c index 3a17a7240..61889a2b7 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -724,7 +724,7 @@ static const u8 sText_ButPokemonCantUseTheMove[] = _("But {B_ATK_NAME_WITH_PREFI static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way it is now!"); static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!"); static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!"); -static const u8 sText_PastelVeilEnters[] = _("{B_EFF_NAME_WITH_PREFIX}'s poisoning\nwas cured!"); +static const u8 sText_PastelVeilEnters[] = _("{B_DEF_NAME_WITH_PREFIX} was cured\nof its poisoning!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { diff --git a/src/battle_util.c b/src/battle_util.c index 0600d37e8..25bfde382 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4064,19 +4064,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_PASTEL_VEIL: if (!gSpecialStatuses[battler].switchInAbilityDone) { - u32 side = GetBattlerSide(battler); - - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (IsBattlerAlive(i) && GetBattlerSide(i) == side - && (gBattleMons[i].status1 & STATUS1_POISON || gBattleMons[i].status1 & STATUS1_TOXIC_POISON)) - { - gActiveBattler = gBattleScripting.battler = gEffectBattler = i; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PASTEL_VEIL; - BattleScriptPushCursorAndCallback(BattleScript_PastelVeilActivates); - effect++; - } - } + gBattlerTarget = battler; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PASTEL_VEIL; + BattleScriptPushCursorAndCallback(BattleScript_PastelVeilActivates); + effect++; gSpecialStatuses[battler].switchInAbilityDone = 1; } break;