Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Moved code preventing MBH's transfer to post modifier generation #4858

Open
wants to merge 13 commits into
base: beta
Choose a base branch
from
7 changes: 7 additions & 0 deletions src/game-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ export class GameMode implements GameModeConfig {
return waveIndex % 10 === 0;
}

/**
* @returns `true` if the current battle is against classic mode's final boss
*/
isBattleClassicFinalBoss(waveIndex: number): boolean {
return (this.modeId === GameModes.CLASSIC || this.modeId === GameModes.CHALLENGE) && this.isWaveFinal(waveIndex);
}

/**
* Every 50 waves of an Endless mode is a boss
* At this time it is paradox pokemon
Expand Down
13 changes: 9 additions & 4 deletions src/phases/encounter-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ export class EncounterPhase extends BattlePhase {
} else if (!(battle.waveIndex % 1000)) {
enemyPokemon.formIndex = 1;
enemyPokemon.updateScale();
const bossMBH = this.scene.findModifier(m => m instanceof TurnHeldItemTransferModifier && m.pokemonId === enemyPokemon.id, false) as TurnHeldItemTransferModifier;
this.scene.removeModifier(bossMBH!);
bossMBH?.setTransferrableFalse();
this.scene.addEnemyModifier(bossMBH!);
}
}

Expand Down Expand Up @@ -442,6 +438,15 @@ export class EncounterPhase extends BattlePhase {
if (enemyPokemon.isShiny()) {
this.scene.unshiftPhase(new ShinySparklePhase(this.scene, BattlerIndex.ENEMY + e));
}
/** This sets Eternatus' held item to be untransferrable, preventing it from being stolen */
if (enemyPokemon.species.speciesId === Species.ETERNATUS && (this.scene.gameMode.isBattleClassicFinalBoss(this.scene.currentBattle.waveIndex) || this.scene.gameMode.isEndlessMajorBoss(this.scene.currentBattle.waveIndex))) {
const enemyMBH = this.scene.findModifier(m => m instanceof TurnHeldItemTransferModifier, false) as TurnHeldItemTransferModifier;
if (enemyMBH) {
this.scene.removeModifier(enemyMBH, true);
enemyMBH.setTransferrableFalse();
this.scene.addEnemyModifier(enemyMBH);
}
}
});

if (![ BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER ].includes(this.scene.currentBattle.battleType)) {
Expand Down
Loading