diff --git a/include/battle.h b/include/battle.h index 931b13b2f4..6472df3cb9 100644 --- a/include/battle.h +++ b/include/battle.h @@ -149,6 +149,7 @@ struct ProtectStruct u16 beakBlastCharge:1; u32 physicalDmg; u32 specialDmg; + u8 quash : 1; u8 physicalBattlerId; u8 specialBattlerId; }; diff --git a/src/battle_main.c b/src/battle_main.c index 5c03a18b46..4566dce4b6 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4515,6 +4515,10 @@ s8 GetMovePriority(u32 battlerId, u16 move) break; } } + if (gProtectStructs[battlerId].quash == 1) + { + priority = -8; + } return priority; } @@ -4736,6 +4740,7 @@ static void TurnValuesCleanUp(bool8 var0) gProtectStructs[gActiveBattler].spikyShielded = FALSE; gProtectStructs[gActiveBattler].kingsShielded = FALSE; gProtectStructs[gActiveBattler].banefulBunkered = FALSE; + gProtectStructs[gBattlerTarget].quash = FALSE; } else { diff --git a/src/battle_message.c b/src/battle_message.c index 688a48f256..c19ca75638 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -625,7 +625,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!"); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 420d5790ce..f551c39871 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8454,28 +8454,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: