From b6fff16a7deb9d457725437b6f08a9148d629bc0 Mon Sep 17 00:00:00 2001 From: SonikkuA-DatH <58025603+SonikkuA-DatH@users.noreply.github.com> Date: Fri, 3 Dec 2021 18:04:44 -0800 Subject: [PATCH 1/4] Update battle.h --- include/battle.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/battle.h b/include/battle.h index 5658f603cf..6e04aa05d4 100644 --- a/include/battle.h +++ b/include/battle.h @@ -158,6 +158,7 @@ struct ProtectStruct u32 quickDraw:1; u32 physicalDmg; u32 specialDmg; + u8 quash : 1; u8 physicalBattlerId; u8 specialBattlerId; }; From a32ac0d2905edb295e6eb1307eb034b2dd0380f4 Mon Sep 17 00:00:00 2001 From: SonikkuA-DatH <58025603+SonikkuA-DatH@users.noreply.github.com> Date: Fri, 3 Dec 2021 18:05:39 -0800 Subject: [PATCH 2/4] Update battle_message.c --- src/battle_message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_message.c b/src/battle_message.c index d64d02f902..3819e5c45a 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -621,7 +621,7 @@ static const u8 sText_PkmnBlewAwayToxicSpikes[] = _("{B_ATK_NAME_WITH_PREFIX} bl static const u8 sText_PkmnBlewAwayStickyWeb[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTICKY WEB!"); static const u8 sText_PkmnBlewAwayStealthRock[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTEALTH ROCK!"); static const u8 sText_StickyWebUsed[] = _("A sticky web spreads out on the\nground around {B_DEF_TEAM2} team!"); -static const u8 sText_QuashSuccess[] = _("The opposing {B_ATK_NAME_WITH_PREFIX}'s move was postponed!"); +static const u8 sText_QuashSuccess[] = _("The opposing {B_DEF_NAME_WITH_PREFIX}'s\nmove was postponed!"); static const u8 sText_IonDelugeOn[] = _("A deluge of ions showers\nthe battlefield!"); static const u8 sText_TopsyTurvySwitchedStats[] = _("{B_DEF_NAME_WITH_PREFIX}'s stat changes were\nall reversed!"); static const u8 sText_TerrainBecomesMisty[] = _("Mist swirled about\nthe battlefield!"); From 76136c48589037ba6af78c90c76276521d8c9d15 Mon Sep 17 00:00:00 2001 From: SonikkuA-DatH <58025603+SonikkuA-DatH@users.noreply.github.com> Date: Fri, 3 Dec 2021 18:07:35 -0800 Subject: [PATCH 3/4] Update battle_main.c --- src/battle_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/battle_main.c b/src/battle_main.c index 7667360488..4d52adc73d 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4412,6 +4412,10 @@ s8 GetMovePriority(u32 battlerId, u16 move) break; } } + if (gProtectStructs[battlerId].quash == 1) + { + priority = -8; + } return priority; } @@ -4636,6 +4640,7 @@ static void TurnValuesCleanUp(bool8 var0) gProtectStructs[gActiveBattler].spikyShielded = FALSE; gProtectStructs[gActiveBattler].kingsShielded = FALSE; gProtectStructs[gActiveBattler].banefulBunkered = FALSE; + gProtectStructs[gBattlerTarget].quash = FALSE; } else { From 78ab05e6504cde844e76e706bcf1b637c85dd0c5 Mon Sep 17 00:00:00 2001 From: SonikkuA-DatH <58025603+SonikkuA-DatH@users.noreply.github.com> Date: Fri, 3 Dec 2021 18:09:07 -0800 Subject: [PATCH 4/4] Update battle_script_commands.c --- src/battle_script_commands.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fcac028945..b5296fb7c7 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8142,28 +8142,14 @@ static void Cmd_various(void) } return; case VARIOUS_TRY_QUASH: - if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) + if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) // is true if foe is faster, has a bigger priority, or switches { - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); - } - else + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // This replaces the current battlescript with the "fail" script, if the condition + } // we checked is true + else // If the condition is not true, it means we are faster than the foe, so we can set the quash bit { - for (i = 0; i < gBattlersCount; i++) - data[i] = gBattlerByTurnOrder[i]; - for (i = 0; i < gBattlersCount; i++) - { - if (data[i] == gBattlerTarget) - { - for (j = i + 1; j < gBattlersCount; j++) - data[i++] = data[j]; - } - else - { - gBattlerByTurnOrder[i] = data[i]; - } - } - gBattlerByTurnOrder[gBattlersCount - 1] = gBattlerTarget; - gBattlescriptCurrInstr += 7; + gProtectStructs[gBattlerTarget].quash = 1; + gBattlescriptCurrInstr += 7; // and then we proceed with the rest of our battlescript } return; case VARIOUS_INVERT_STAT_STAGES: