Merge branch 'SonikkuA-DatH-Quashh' of https://github.com/SonikkuA-DatH/pokeemerald-expansion into quash

This commit is contained in:
DizzyEggg 2022-08-24 23:35:42 +02:00
commit 06b4548603
4 changed files with 13 additions and 21 deletions

View file

@ -149,6 +149,7 @@ struct ProtectStruct
u16 beakBlastCharge:1;
u32 physicalDmg;
u32 specialDmg;
u8 quash : 1;
u8 physicalBattlerId;
u8 specialBattlerId;
};

View file

@ -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
{

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

@ -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: