mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-28 17:56:09 +00:00
Add waveTurnCount
to PokemonBattleData
(#4168)
Swap `FirstMoveCondition` to use the new `waveTurnCount` field
This commit is contained in:
parent
3d3460888a
commit
7d2df53c51
@ -6591,7 +6591,7 @@ export class MoveCondition {
|
||||
|
||||
export class FirstMoveCondition extends MoveCondition {
|
||||
constructor() {
|
||||
super((user, target, move) => user.battleSummonData?.turnCount === 1);
|
||||
super((user, target, move) => user.battleSummonData?.waveTurnCount === 1);
|
||||
}
|
||||
|
||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
||||
|
@ -5000,6 +5000,8 @@ export class PokemonBattleData {
|
||||
export class PokemonBattleSummonData {
|
||||
/** The number of turns the pokemon has passed since entering the battle */
|
||||
public turnCount: number = 1;
|
||||
/** The number of turns the pokemon has passed since the start of the wave */
|
||||
public waveTurnCount: number = 1;
|
||||
/** The list of moves the pokemon has used since entering the battle */
|
||||
public moveHistory: TurnMove[] = [];
|
||||
}
|
||||
|
@ -35,6 +35,12 @@ export class BattleEndPhase extends BattlePhase {
|
||||
this.scene.unshiftPhase(new GameOverPhase(this.scene, true));
|
||||
}
|
||||
|
||||
for (const pokemon of this.scene.getField()) {
|
||||
if (pokemon && pokemon.battleSummonData) {
|
||||
pokemon.battleSummonData.waveTurnCount = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (const pokemon of this.scene.getParty().filter(p => p.isAllowedInBattle())) {
|
||||
applyPostBattleAbAttrs(PostBattleAbAttr, pokemon);
|
||||
}
|
||||
|
@ -173,6 +173,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
||||
// Or compensate for force switch move if switched out pokemon is not fainted
|
||||
if (currentCommand === Command.POKEMON || lastPokemonIsForceSwitchedAndNotFainted) {
|
||||
pokemon.battleSummonData.turnCount--;
|
||||
pokemon.battleSummonData.waveTurnCount--;
|
||||
}
|
||||
|
||||
if (this.switchType === SwitchType.BATON_PASS && pokemon) {
|
||||
|
@ -44,6 +44,7 @@ export class TurnEndPhase extends FieldPhase {
|
||||
this.scene.applyModifiers(TurnHeldItemTransferModifier, pokemon.isPlayer(), pokemon);
|
||||
|
||||
pokemon.battleSummonData.turnCount++;
|
||||
pokemon.battleSummonData.waveTurnCount++;
|
||||
};
|
||||
|
||||
this.executeForAll(handlePokemon);
|
||||
|
@ -23,14 +23,15 @@ describe("Moves - Fake Out", () => {
|
||||
game.override
|
||||
.battleType("single")
|
||||
.enemySpecies(Species.CORVIKNIGHT)
|
||||
.starterSpecies(Species.FEEBAS)
|
||||
.moveset([Moves.FAKE_OUT, Moves.SPLASH])
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
.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()!;
|
||||
|
||||
@ -44,22 +45,27 @@ describe("Moves - Fake Out", () => {
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemy.hp).toBe(postTurnOneHp);
|
||||
}, 20000);
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
// 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);
|
||||
|
||||
game.move.select(Moves.FAKE_OUT);
|
||||
await game.toNextWave();
|
||||
|
||||
const newEnemy = game.scene.getEnemyPokemon()!;
|
||||
|
||||
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()!;
|
||||
|
||||
@ -76,6 +82,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…
Reference in New Issue
Block a user