mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-11 18:09:29 +02:00
Apply Matthew's Suggestions
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
This commit is contained in:
parent
74e32ebb24
commit
b17d682350
@ -52,7 +52,8 @@ export class PokemonMove {
|
||||
const usability = new BooleanHolder(
|
||||
!move.name.endsWith(" (N)") &&
|
||||
(ignorePp || this.ppUsed < this.getMovePp() || move.pp === -1) &&
|
||||
!(this.moveId && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)),
|
||||
// TODO: Review if the `MoveId.NONE` check is even necessary anymore
|
||||
!(this.moveId !== MoveId.NONE && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)),
|
||||
);
|
||||
if (pokemon.isPlayer()) {
|
||||
applyChallenges(ChallengeType.POKEMON_MOVE, move.id, usability);
|
||||
|
@ -312,10 +312,10 @@ export class GameMode implements GameModeConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the game mode has the shop enabled or not
|
||||
* @returns Whether the shop is available or not
|
||||
* Check if the current game mode has the shop enabled or not
|
||||
* @returns Whether the shop is available in the current mode
|
||||
*/
|
||||
getShopStatus(): boolean {
|
||||
public getShopStatus(): boolean {
|
||||
const status = new BooleanHolder(!this.hasNoShop);
|
||||
applyChallenges(ChallengeType.SHOP, status);
|
||||
return status.value;
|
||||
|
@ -31,26 +31,25 @@ describe("Challenges - Limited Catch", () => {
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.startingModifier([{ name: "MASTER_BALL", count: 1 }])
|
||||
.moveset(MoveId.RAZOR_LEAF);
|
||||
});
|
||||
|
||||
it("allows Pokémon to be caught on X1 waves", async () => {
|
||||
it("should allow wild Pokémon to be caught on X1 waves", async () => {
|
||||
game.override.startingWave(31);
|
||||
await game.challengeMode.startBattle([SpeciesId.NUZLEAF]);
|
||||
|
||||
game.doThrowPokeball(PokeballType.MASTER_BALL);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.scene.getPlayerParty().length).toBe(2);
|
||||
expect(game.scene.getPlayerParty()).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("prevents Pokémon from being caught on waves that aren't X1 waves", async () => {
|
||||
it("should prevent Pokémon from being caught on non-X1 waves", async () => {
|
||||
game.override.startingWave(53);
|
||||
await game.challengeMode.startBattle([SpeciesId.NUZLEAF]);
|
||||
|
||||
game.doThrowPokeball(PokeballType.MASTER_BALL);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.scene.getPlayerParty().length).toBe(1);
|
||||
expect(game.scene.getPlayerParty()).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
@ -30,70 +30,61 @@ describe("Challenges - No Support", () => {
|
||||
.enemySpecies(SpeciesId.VOLTORB)
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.moveset(MoveId.RAZOR_LEAF);
|
||||
});
|
||||
|
||||
it('disables the shop in "No Shop"', async () => {
|
||||
it('should disable the shop in "No Shop"', async () => {
|
||||
game.override.startingWave(181);
|
||||
game.challengeMode.addChallenge(Challenges.NO_SUPPORT, 2, 1);
|
||||
await game.challengeMode.startBattle([SpeciesId.NUZLEAF]);
|
||||
|
||||
game.move.select(MoveId.RAZOR_LEAF);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
|
||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||
expect(game.scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||
|
||||
expect(game.scene.ui.getMode()).toBe(UiMode.MODIFIER_SELECT);
|
||||
const modifierSelectHandler = game.scene.ui.handlers.find(
|
||||
h => h instanceof ModifierSelectUiHandler,
|
||||
) as ModifierSelectUiHandler;
|
||||
expect(modifierSelectHandler.shopOptionsRows.length).toBe(0);
|
||||
expect(modifierSelectHandler.shopOptionsRows).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('disables the automatic party heal in "No Heal"', async () => {
|
||||
it('should disable the automatic party heal in "No Heal"', async () => {
|
||||
game.override.startingWave(10);
|
||||
game.challengeMode.addChallenge(Challenges.NO_SUPPORT, 1, 1);
|
||||
await game.challengeMode.startBattle([SpeciesId.NUZLEAF]);
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
playerPokemon!.damageAndUpdate(playerPokemon!.hp / 2);
|
||||
const playerPokemon = game.field.getPlayerPokemon();
|
||||
playerPokemon.hp /= 2;
|
||||
|
||||
game.move.select(MoveId.RAZOR_LEAF);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
await game.toNextWave();
|
||||
|
||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||
game.doSelectModifier();
|
||||
|
||||
// Next wave
|
||||
await game.phaseInterceptor.to("TurnInitPhase");
|
||||
expect(playerPokemon!.isFullHp()).toBe(false);
|
||||
expect(playerPokemon).not.toHaveFullHp();
|
||||
});
|
||||
|
||||
it('disables the automatic party heal and the shop in "Both"', async () => {
|
||||
it('should disable both automatic party healing and shop in "Both"', async () => {
|
||||
game.override.startingWave(10);
|
||||
game.challengeMode.addChallenge(Challenges.NO_SUPPORT, 3, 1);
|
||||
await game.challengeMode.startBattle([SpeciesId.NUZLEAF]);
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
playerPokemon!.damageAndUpdate(playerPokemon!.hp / 2);
|
||||
const playerPokemon = game.field.getPlayerPokemon();
|
||||
playerPokemon.hp /= 2;
|
||||
|
||||
game.move.select(MoveId.RAZOR_LEAF);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
await game.toNextWave();
|
||||
|
||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||
game.doSelectModifier();
|
||||
expect(playerPokemon).not.toHaveFullHp();
|
||||
|
||||
// Next wave
|
||||
await game.phaseInterceptor.to("TurnInitPhase");
|
||||
expect(playerPokemon!.isFullHp()).toBe(false);
|
||||
|
||||
game.move.select(MoveId.RAZOR_LEAF);
|
||||
game.move.use(MoveId.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
|
||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||
expect(game.scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
|
||||
|
||||
expect(game.scene.ui.getMode()).toBe(UiMode.MODIFIER_SELECT);
|
||||
const modifierSelectHandler = game.scene.ui.handlers.find(
|
||||
h => h instanceof ModifierSelectUiHandler,
|
||||
) as ModifierSelectUiHandler;
|
||||
expect(modifierSelectHandler.shopOptionsRows.length).toBe(0);
|
||||
expect(modifierSelectHandler.shopOptionsRows).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
@ -35,19 +35,22 @@ describe("Challenges - Permanent Faint", () => {
|
||||
.enemySpecies(SpeciesId.VOLTORB)
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.moveset(MoveId.RAZOR_LEAF);
|
||||
});
|
||||
|
||||
it("disables REVIVAL_BLESSING for the player only", async () => {
|
||||
it("should render Revival Blessing unusable by players only", async () => {
|
||||
game.override.enemyMoveset(MoveId.REVIVAL_BLESSING).moveset(MoveId.REVIVAL_BLESSING);
|
||||
await game.challengeMode.startBattle([SpeciesId.NUZLEAF]);
|
||||
|
||||
const player = game.field.getPlayerPokemon();
|
||||
const revBlessing = player.getMoveset()[0];
|
||||
expect(revBlessing.isUsable()).toBe(false);
|
||||
|
||||
game.move.select(MoveId.REVIVAL_BLESSING);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
|
||||
// Player struggled due to only move being the unusable Revival Blessing
|
||||
expect(player).toHaveUsedMove(MoveId.STRUGGLE);
|
||||
expect(game.field.getEnemyPokemon()).toHaveUsedMove(MoveId.REVIVAL_BLESSING);
|
||||
expect(game.field.getPlayerPokemon()).toHaveUsedMove(MoveId.STRUGGLE);
|
||||
});
|
||||
|
||||
it("prevents REVIVE items in shop and in wave rewards", async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user