Fix opponent post-summon ability triggers happening twice in trainer battles

pull/2/head
Flashfyre 2023-11-05 22:44:49 -05:00
parent 52039849ac
commit cc27913728
2 changed files with 9 additions and 1 deletions

View File

@ -383,7 +383,8 @@ export class EncounterPhase extends BattlePhase {
this.scene.unshiftPhase(new ShinySparklePhase(this.scene, BattlerIndex.ENEMY + e)); this.scene.unshiftPhase(new ShinySparklePhase(this.scene, BattlerIndex.ENEMY + e));
}); });
enemyField.map(p => this.scene.pushPhase(new PostSummonPhase(this.scene, p.getBattlerIndex()))); if (this.scene.currentBattle.battleType !== BattleType.TRAINER)
enemyField.map(p => this.scene.pushPhase(new PostSummonPhase(this.scene, p.getBattlerIndex())));
// TODO: Remove // TODO: Remove
//this.scene.unshiftPhase(new SelectModifierPhase(this.scene)); //this.scene.unshiftPhase(new SelectModifierPhase(this.scene));

View File

@ -39,6 +39,9 @@ export enum FieldPosition {
const ABILITY_OVERRIDE = Abilities.NONE; const ABILITY_OVERRIDE = Abilities.NONE;
const MOVE_OVERRIDE = Moves.NONE; const MOVE_OVERRIDE = Moves.NONE;
const OPP_ABILITY_OVERRIDE = Abilities.NONE;
const OPP_MOVE_OVERRIDE = Moves.NONE;
export default abstract class Pokemon extends Phaser.GameObjects.Container { export default abstract class Pokemon extends Phaser.GameObjects.Container {
public id: integer; public id: integer;
public name: string; public name: string;
@ -494,6 +497,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
getAbility(): Ability { getAbility(): Ability {
if (ABILITY_OVERRIDE && this.isPlayer()) if (ABILITY_OVERRIDE && this.isPlayer())
return abilities[ABILITY_OVERRIDE]; return abilities[ABILITY_OVERRIDE];
if (OPP_ABILITY_OVERRIDE && !this.isPlayer())
return abilities[OPP_ABILITY_OVERRIDE];
if (this.fusionSpecies) if (this.fusionSpecies)
return abilities[this.getFusionSpeciesForm().getAbility(this.fusionAbilityIndex)]; return abilities[this.getFusionSpeciesForm().getAbility(this.fusionAbilityIndex)];
return abilities[this.getSpeciesForm().getAbility(this.abilityIndex)]; return abilities[this.getSpeciesForm().getAbility(this.abilityIndex)];
@ -619,6 +624,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (MOVE_OVERRIDE && this.isPlayer()) if (MOVE_OVERRIDE && this.isPlayer())
this.moveset[0] = new PokemonMove(MOVE_OVERRIDE); this.moveset[0] = new PokemonMove(MOVE_OVERRIDE);
else if (OPP_MOVE_OVERRIDE && !this.isPlayer())
this.moveset[0] = new PokemonMove(OPP_MOVE_OVERRIDE);
} }
trySelectMove(moveIndex: integer, ignorePp?: boolean): boolean { trySelectMove(moveIndex: integer, ignorePp?: boolean): boolean {