Fix interaction between Terastallization and Pursuit in NatDex formatst if used on a switching enemy

* Terastallization should happen before Pursuit.
This commit is contained in:
Zachary Perlmutter 2024-10-17 15:36:51 -07:00
parent a3c090d808
commit 274ee23d90

View File

@ -14916,10 +14916,20 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
}
// Run through each action in queue to check if the Pursuit user is supposed to Mega Evolve this turn.
// If it is, then Mega Evolve before moving.
if (source.canMegaEvo || source.canUltraBurst) {
if (source.canMegaEvo || source.canUltraBurst || source.canTerastallize) {
for (const [actionIndex, action] of this.queue.entries()) {
if (action.pokemon === source && action.choice === 'megaEvo') {
this.actions.runMegaEvo(source);
if (action.pokemon === source) {
switch (action.choice) {
case 'megaEvo':
this.actions.runMegaEvo(source);
break;
// Also a "forme" change that happens before moves, though only possible in NatDex
case 'terastallize':
this.actions.terastallize(source);
break;
default:
continue;
}
this.queue.list.splice(actionIndex, 1);
break;
}