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

[Hotfix] Allow Fake Out to be used at the start of every wave again #4105

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/phases/battle-end-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ export class BattleEndPhase extends BattlePhase {
this.scene.unshiftPhase(new GameOverPhase(this.scene, true));
}

/**
* Allow Fake Out and First Impression to be used at the start of every wild battle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just want to make a change to two specific moves wouldn't this make more sense as a move attribute rather than doing something that might cause unintended behavior by manually changing a Pokemon's turns out?

* Note: This is specifically a buff to those moves and not normally expected behavior
*/
for (const pokemon of this.scene.getField()) {
if (pokemon && pokemon.battleSummonData.turnCount > 1) {
pokemon.battleSummonData.turnCount = 1;
}
}

for (const pokemon of this.scene.getParty().filter(p => p.isAllowedInBattle())) {
applyPostBattleAbAttrs(PostBattleAbAttr, pokemon);
}
Expand Down
36 changes: 27 additions & 9 deletions src/test/moves/fake_out.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ describe("Moves - Fake Out", () => {
game.override
.battleType("single")
.enemySpecies(Species.CORVIKNIGHT)
.starterSpecies(Species.FEEBAS)
.moveset([Moves.FAKE_OUT, Moves.SPLASH])
.enemyMoveset(SPLASH_ONLY)
.enemyLevel(10)
.startingLevel(10) // prevent LevelUpPhase from happening
.disableCrits();
});

it("can only be used on the first turn a pokemon is sent out", async() => {
await game.classicMode.startBattle();
it("can only be used on the first turn a pokemon is sent out in a battle", async() => {
await game.classicMode.startBattle([Species.FEEBAS]);

const enemy = game.scene.getEnemyPokemon()!;

Expand All @@ -45,22 +46,27 @@ describe("Moves - Fake Out", () => {
await game.toNextTurn();

expect(enemy.hp).toBe(postTurnOneHp);
}, 20000);

game.move.select(Moves.SPLASH);
await game.doKillOpponents();
await game.toNextWave();
// This is a PokeRogue buff to Fake Out
it("can be used at the start of every wave even if the pokemon wasn't recalled", async() => {
await game.classicMode.startBattle([Species.FEEBAS]);

const enemy = game.scene.getEnemyPokemon()!;
enemy.damageAndUpdate(enemy.getMaxHp() - 1);

const newEnemy = game.scene.getEnemyPokemon()!;
game.move.select(Moves.FAKE_OUT);
await game.toNextWave();

game.move.select(Moves.FAKE_OUT);
await game.toNextTurn();

expect(newEnemy.hp).toBe(newEnemy.getMaxHp());
expect(game.scene.getEnemyPokemon()!.isFullHp()).toBe(false);
}, 20000);

it("can be used again if recalled and sent back out", async() => {
game.override.startingWave(4);
await game.classicMode.startBattle();
await game.classicMode.startBattle([Species.FEEBAS, Species.MAGIKARP]);

const enemy1 = game.scene.getEnemyPokemon()!;

Expand All @@ -77,6 +83,18 @@ describe("Moves - Fake Out", () => {

const enemy2 = game.scene.getEnemyPokemon()!;

expect(enemy2.hp).toBeLessThan(enemy2.getMaxHp());
enemy2.hp = enemy2.getMaxHp();

game.doSwitchPokemon(1);
await game.toNextTurn();

game.doSwitchPokemon(1);
await game.toNextTurn();

game.move.select(Moves.FAKE_OUT);
await game.toNextTurn();

expect(enemy2.hp).toBeLessThan(enemy2.getMaxHp());
}, 20000);
});
Loading