Merge pull request #2239 from DizzyEggg/quash

Quash
This commit is contained in:
ghoulslash 2022-08-29 10:43:54 -04:00 committed by GitHub
commit 2cd01bd95d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 76 deletions

View File

@ -147,6 +147,7 @@ struct ProtectStruct
u16 pranksterElevated:1;
u16 quickDraw:1;
u16 beakBlastCharge:1;
u16 quash:1;
u32 physicalDmg;
u32 specialDmg;
u8 physicalBattlerId;

View File

@ -3140,6 +3140,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].spikyShielded = FALSE;
gProtectStructs[gActiveBattler].kingsShielded = FALSE;
gProtectStructs[gActiveBattler].banefulBunkered = FALSE;
gProtectStructs[gActiveBattler].quash = FALSE;
gProtectStructs[gActiveBattler].obstructed = FALSE;
gProtectStructs[gActiveBattler].endured = FALSE;
gProtectStructs[gActiveBattler].noValidMoves = FALSE;
@ -4516,6 +4517,9 @@ s8 GetMovePriority(u32 battlerId, u16 move)
}
}
if (gProtectStructs[battlerId].quash)
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[gActiveBattler].quash = FALSE;
}
else
{

View File

@ -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!");

View File

@ -8500,28 +8500,14 @@ static void Cmd_various(void)
}
return;
case VARIOUS_TRY_QUASH:
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget))
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) // It's true if foe is faster, has a bigger priority, or switches
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // This replaces the current battlescript with the "fail" script.
}
else
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 = TRUE;
gBattlescriptCurrInstr += 7; // and then we proceed with the rest of our battlescript
}
return;
case VARIOUS_INVERT_STAT_STAGES: