mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-30 20:22:32 +02:00
Compare commits
8 Commits
32d4102594
...
6a58d1b928
Author | SHA1 | Date | |
---|---|---|---|
|
6a58d1b928 | ||
|
0a77dcdb4f | ||
|
d323817eb9 | ||
|
91b32132d0 | ||
|
97e362368c | ||
|
063e6dbd2d | ||
|
68d3d27d47 | ||
|
a301507f80 |
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,18 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[Feature]"
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||
|
||||
**Describe the Feature**
|
||||
<!-- A clear and concise description of what you want to happen. -->
|
||||
<!-- Add a link to the feature if it is an existing move/ability/etc -->
|
||||
|
||||
**Additional context**
|
||||
<!-- Add any other context or screenshots about the feature request here. -->
|
39
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
39
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Feature Request
|
||||
description: Suggest an idea for this project
|
||||
title: "[Feature] "
|
||||
labels: ["enhancement"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this feature request!
|
||||
- type: textarea
|
||||
id: relation
|
||||
attributes:
|
||||
label: Is your feature request related to a problem? Please describe.
|
||||
description: Clear and concise description of what the problem is.
|
||||
placeholder: E.g. "I'm always frustrated when [...]"
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
---
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Describe the Feature
|
||||
description: A clear and concise description of what you want to happen. Add a link to the feature if it is an existing move/ability/etc.
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
---
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context or screenshots about the feature request here.
|
||||
validations:
|
||||
required: true
|
5
.github/pull_request_template.md
vendored
5
.github/pull_request_template.md
vendored
@ -5,12 +5,12 @@
|
||||
## What are the changes?
|
||||
<!-- Summarize what are the changes from a user perspective on the application -->
|
||||
|
||||
## Why am I doing these changes?
|
||||
## Why am I doing these changes the user will see?
|
||||
<!-- Explain why you decided to introduce these changes -->
|
||||
<!-- Does it come from an issue or another PR? Please link it -->
|
||||
<!-- Explain why you believe this can enhance user experience -->
|
||||
|
||||
## What did change?
|
||||
## What are the changes from a developer perspective?
|
||||
<!-- Explicitly state what are the changes introduced by the PR -->
|
||||
<!-- You can make use of a comparison between what was the state before and after your PR changes -->
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
- [ ] The PR is self-contained and cannot be split into smaller PRs?
|
||||
- [ ] Have I provided a clear explanation of the changes?
|
||||
- [ ] Have I considered writing automated tests for the issue?
|
||||
- [ ] If I have text, did I add placeholders for them in locales?
|
||||
- [ ] Have I tested the changes (manually)?
|
||||
- [ ] Are all unit tests still passing? (`npm run test`)
|
||||
- [ ] Are the changes visual?
|
||||
|
@ -941,14 +941,19 @@ export class PostDefendPerishSongAbAttr extends PostDefendAbAttr {
|
||||
|
||||
export class PostDefendWeatherChangeAbAttr extends PostDefendAbAttr {
|
||||
private weatherType: WeatherType;
|
||||
protected condition: PokemonDefendCondition | null;
|
||||
|
||||
constructor(weatherType: WeatherType) {
|
||||
constructor(weatherType: WeatherType, condition?: PokemonDefendCondition) {
|
||||
super();
|
||||
|
||||
this.weatherType = weatherType;
|
||||
this.condition = condition ?? null;
|
||||
}
|
||||
|
||||
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean {
|
||||
if (this.condition !== null && !this.condition(pokemon, attacker, move)) {
|
||||
return false;
|
||||
}
|
||||
if (!pokemon.scene.arena.weather?.isImmutable()) {
|
||||
return pokemon.scene.arena.trySetWeather(this.weatherType, true);
|
||||
}
|
||||
@ -5092,7 +5097,7 @@ export function initAbilities() {
|
||||
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.hasFlag(MoveFlags.SOUND_BASED), 0.5)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.SAND_SPIT, 8)
|
||||
.attr(PostDefendWeatherChangeAbAttr, WeatherType.SANDSTORM),
|
||||
.attr(PostDefendWeatherChangeAbAttr, WeatherType.SANDSTORM, (target, user, move) => move.category !== MoveCategory.STATUS),
|
||||
new Ability(Abilities.ICE_SCALES, 8)
|
||||
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.category === MoveCategory.SPECIAL, 0.5)
|
||||
.ignorable(),
|
||||
|
@ -3222,7 +3222,7 @@ export class PlayerPokemon extends Pokemon {
|
||||
}
|
||||
|
||||
if (!dataSource) {
|
||||
this.generateAndPopulateMoveset();
|
||||
this.moveset = [];
|
||||
}
|
||||
this.generateCompatibleTms();
|
||||
}
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "Passive",
|
||||
"passiveUnlocked": "Passive freigeschaltet",
|
||||
"passiveLocked": "Passive gesperrt",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "Band",
|
||||
"hasWon": "Hat Klassik-Modus gewonnen",
|
||||
"hasNotWon": "Hat Klassik-Modus nicht gewonnen",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "Pokédex-Nummer",
|
||||
"sortByCost": "Kosten",
|
||||
"sortByCandies": "Anzahl Bonbons",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "Passive",
|
||||
"passiveUnlocked": "Passive Unlocked",
|
||||
"passiveLocked": "Passive Locked",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ribbon - Yes",
|
||||
"hasNotWon": "Ribbon - No",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "No.",
|
||||
"sortByCost": "Cost",
|
||||
"sortByCandies": "Candy Count",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "Passive",
|
||||
"passiveUnlocked": "Pasiva Desbloq.",
|
||||
"passiveLocked": "Pasiva Bloq.",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ya ha ganado",
|
||||
"hasNotWon": "Aún no ha ganado",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "Núm.",
|
||||
"sortByCost": "Coste",
|
||||
"sortByCandies": "# Caramelos",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "Passif",
|
||||
"passiveUnlocked": "Passif débloqué",
|
||||
"passiveLocked": "Passif verrouillé",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "Ruban",
|
||||
"hasWon": "Ruban - Oui",
|
||||
"hasNotWon": "Ruban - Non",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "Par N°",
|
||||
"sortByCost": "Par cout",
|
||||
"sortByCandies": "Par bonbons",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "Passive",
|
||||
"passiveUnlocked": "Passiva sbloccata",
|
||||
"passiveLocked": "Passiva bloccata",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "Ribbon",
|
||||
"hasWon": "Ribbon - Yes",
|
||||
"hasNotWon": "Ribbon - No",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "Num. Dex",
|
||||
"sortByCost": "Costo",
|
||||
"sortByCandies": "Caramelle",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "패시브",
|
||||
"passiveUnlocked": "패시브 해금",
|
||||
"passiveLocked": "패시브 잠김",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "클리어 여부",
|
||||
"hasWon": "클리어 함",
|
||||
"hasNotwon": "클리어 안함",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "도감번호",
|
||||
"sortByCost": "코스트",
|
||||
"sortByCandies": "사탕 수",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "Passiva",
|
||||
"passiveUnlocked": "Passiva Desbloq.",
|
||||
"passiveLocked": "Passiva Bloq.",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "Fita",
|
||||
"hasWon": "Fita - Sim",
|
||||
"hasNotWon": "Fita - Não",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "Número",
|
||||
"sortByCost": "Custo",
|
||||
"sortByCandies": "# Doces",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "被动",
|
||||
"passiveUnlocked": "被动解锁",
|
||||
"passiveLocked": "被动未解锁",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "缎带",
|
||||
"hasWon": "有缎带",
|
||||
"hasNotWon": "无缎带",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "编号",
|
||||
"sortByCost": "费用",
|
||||
"sortByCandies": "糖果",
|
||||
|
@ -13,9 +13,18 @@ export const filterBar: SimpleTranslationEntries = {
|
||||
"passive": "被動",
|
||||
"passiveUnlocked": "被動解鎖",
|
||||
"passiveLocked": "被動未解鎖",
|
||||
"costReduction": "Cost Reduction",
|
||||
"costReductionUnlocked": "Cost Reduction Unlocked",
|
||||
"costReductionLocked": "Cost Reduction Locked",
|
||||
"ribbon": "緞帶",
|
||||
"hasWon": "有緞帶",
|
||||
"hasNotWon": "無緞帶",
|
||||
"hiddenAbility": "Hidden Ability",
|
||||
"hasHiddenAbility": "Hidden Ability - Yes",
|
||||
"noHiddenAbility": "Hidden Ability - No",
|
||||
"pokerus": "Pokerus",
|
||||
"hasPokerus": "Pokerus - Yes",
|
||||
"noPokerus": "Pokerus - No",
|
||||
"sortByNumber": "編號",
|
||||
"sortByCost": "花費",
|
||||
"sortByCandies": "糖果",
|
||||
|
@ -642,6 +642,10 @@ export class SelectStarterPhase extends Phase {
|
||||
this.scene.arena.init();
|
||||
this.scene.sessionPlayTime = 0;
|
||||
this.scene.lastSavePlayTime = 0;
|
||||
// Ensures Keldeo (or any future Pokemon that have this type of form change) starts in the correct form
|
||||
this.scene.getParty().forEach((p: PlayerPokemon) => {
|
||||
this.scene.triggerPokemonFormChange(p, SpeciesFormChangeMoveLearnedTrigger);
|
||||
});
|
||||
this.end();
|
||||
});
|
||||
}
|
||||
|
@ -8,15 +8,10 @@ import { generateStarter, getMovePosition } from "#app/test/utils/gameManagerUti
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { Status, StatusEffect } from "#app/data/status-effect";
|
||||
import { GameModes, getGameMode } from "#app/game-mode";
|
||||
import {
|
||||
CommandPhase, DamagePhase, EncounterPhase,
|
||||
EnemyCommandPhase, SelectStarterPhase,
|
||||
TurnInitPhase,
|
||||
} from "#app/phases";
|
||||
import { CommandPhase, DamagePhase, EncounterPhase, EnemyCommandPhase, SelectStarterPhase, TurnInitPhase } from "#app/phases";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { removeEnemyHeldItems } from "../utils/testUtils";
|
||||
|
||||
describe("Abilities - Intimidate", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -45,7 +40,6 @@ describe("Abilities - Intimidate", () => {
|
||||
|
||||
it("single - wild with switch", async () => {
|
||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
@ -76,7 +70,6 @@ describe("Abilities - Intimidate", () => {
|
||||
it("single - boss should only trigger once then switch", async () => {
|
||||
game.override.startingWave(10);
|
||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
@ -106,7 +99,6 @@ describe("Abilities - Intimidate", () => {
|
||||
it("single - trainer should only trigger once with switch", async () => {
|
||||
game.override.startingWave(5);
|
||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
@ -137,7 +129,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.battleType("double");
|
||||
game.override.startingWave(5);
|
||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
@ -164,7 +155,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.battleType("double");
|
||||
game.override.startingWave(3);
|
||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
@ -191,7 +181,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.battleType("double");
|
||||
game.override.startingWave(10);
|
||||
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
game.onNextPrompt(
|
||||
"CheckSwitchPhase",
|
||||
Mode.CONFIRM,
|
||||
@ -218,7 +207,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.startingWave(2);
|
||||
game.override.moveset([Moves.AERIAL_ACE]);
|
||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||
@ -245,7 +233,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.startingWave(2);
|
||||
game.override.moveset([Moves.SPLASH]);
|
||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||
@ -271,7 +258,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.enemyMoveset([Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH]);
|
||||
game.override.startingWave(5);
|
||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||
@ -311,7 +297,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
|
||||
game.override.startingWave(5);
|
||||
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||
let battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
|
||||
@ -351,7 +336,6 @@ describe("Abilities - Intimidate", () => {
|
||||
game.override.startingWave(3);
|
||||
vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "COIN_CASE" }]);
|
||||
await game.runToSummon([Species.MIGHTYENA]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
await game.phaseInterceptor.to(CommandPhase, false);
|
||||
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||
expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1);
|
||||
@ -378,7 +362,6 @@ describe("Abilities - Intimidate", () => {
|
||||
});
|
||||
|
||||
await game.phaseInterceptor.run(EncounterPhase);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
|
||||
await game.phaseInterceptor.to(CommandPhase, false);
|
||||
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
||||
|
@ -40,7 +40,7 @@ describe("Abilities - Power Spot", () => {
|
||||
|
||||
vi.spyOn(moveToCheck, "calculateBattlePower");
|
||||
|
||||
await game.startBattle([Species.PIKACHU, Species.STONJOURNER]);
|
||||
await game.startBattle([Species.REGIELEKI, Species.STONJOURNER]);
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.DAZZLING_GLEAM));
|
||||
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
|
||||
await game.phaseInterceptor.to(MoveEffectPhase);
|
||||
@ -54,7 +54,7 @@ describe("Abilities - Power Spot", () => {
|
||||
|
||||
vi.spyOn(moveToCheck, "calculateBattlePower");
|
||||
|
||||
await game.startBattle([Species.PIKACHU, Species.STONJOURNER]);
|
||||
await game.startBattle([Species.REGIELEKI, Species.STONJOURNER]);
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.BREAKING_SWIPE));
|
||||
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
|
||||
await game.phaseInterceptor.to(MoveEffectPhase);
|
||||
@ -68,7 +68,7 @@ describe("Abilities - Power Spot", () => {
|
||||
|
||||
vi.spyOn(moveToCheck, "calculateBattlePower");
|
||||
|
||||
await game.startBattle([Species.STONJOURNER, Species.PIKACHU]);
|
||||
await game.startBattle([Species.STONJOURNER, Species.REGIELEKI]);
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.BREAKING_SWIPE));
|
||||
game.doAttack(getMovePosition(game.scene, 1, Moves.SPLASH));
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
57
src/test/abilities/sand_spit.test.ts
Normal file
57
src/test/abilities/sand_spit.test.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { getMovePosition } from "../utils/gameManagerUtils";
|
||||
import { WeatherType } from "#app/enums/weather-type.js";
|
||||
|
||||
|
||||
describe("Ability Timing", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override.battleType("single");
|
||||
game.override.disableCrits();
|
||||
|
||||
game.override.enemySpecies(Species.MAGIKARP);
|
||||
game.override.enemyAbility(Abilities.BALL_FETCH);
|
||||
|
||||
game.override.starterSpecies(Species.SILICOBRA);
|
||||
game.override.ability(Abilities.SAND_SPIT);
|
||||
game.override.moveset([Moves.SPLASH, Moves.COIL]);
|
||||
});
|
||||
|
||||
it("should trigger when hit with damaging move", async() => {
|
||||
game.override.enemyMoveset(Array(4).fill(Moves.TACKLE));
|
||||
await game.startBattle();
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.arena.weather.weatherType).toBe(WeatherType.SANDSTORM);
|
||||
}, 20000);
|
||||
|
||||
it("should not trigger when targetted with status moves", async() => {
|
||||
game.override.enemyMoveset(Array(4).fill(Moves.GROWL));
|
||||
await game.startBattle();
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.COIL));
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SANDSTORM);
|
||||
}, 20000);
|
||||
});
|
@ -8,7 +8,7 @@ import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { removeEnemyHeldItems, SPLASH_ONLY } from "../utils/testUtils";
|
||||
import { SPLASH_ONLY } from "../utils/testUtils";
|
||||
|
||||
describe("Moves - Octolock", () => {
|
||||
describe("integration tests", () => {
|
||||
@ -41,7 +41,6 @@ describe("Moves - Octolock", () => {
|
||||
|
||||
it("Reduces DEf and SPDEF by 1 each turn", { timeout: 10000 }, async () => {
|
||||
await game.startBattle([Species.GRAPPLOCT]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyField();
|
||||
|
||||
@ -63,7 +62,6 @@ describe("Moves - Octolock", () => {
|
||||
|
||||
it("Traps the target pokemon", { timeout: 10000 }, async () => {
|
||||
await game.startBattle([Species.GRAPPLOCT]);
|
||||
removeEnemyHeldItems(game.scene);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyField();
|
||||
|
||||
|
@ -1,31 +1,21 @@
|
||||
import GameWrapper from "#app/test/utils/gameWrapper";
|
||||
import {Mode} from "#app/ui/ui";
|
||||
import {generateStarter, waitUntil} from "#app/test/utils/gameManagerUtils";
|
||||
import {
|
||||
CommandPhase,
|
||||
EncounterPhase,
|
||||
FaintPhase,
|
||||
LoginPhase,
|
||||
NewBattlePhase,
|
||||
SelectStarterPhase,
|
||||
SelectTargetPhase,
|
||||
TitlePhase, TurnEndPhase, TurnInitPhase,
|
||||
TurnStartPhase,
|
||||
} from "#app/phases";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { generateStarter, waitUntil } from "#app/test/utils/gameManagerUtils";
|
||||
import { CommandPhase, EncounterPhase, FaintPhase, LoginPhase, NewBattlePhase, SelectStarterPhase, SelectTargetPhase, TitlePhase, TurnEndPhase, TurnInitPhase, TurnStartPhase } from "#app/phases";
|
||||
import BattleScene from "#app/battle-scene.js";
|
||||
import PhaseInterceptor from "#app/test/utils/phaseInterceptor";
|
||||
import TextInterceptor from "#app/test/utils/TextInterceptor";
|
||||
import {GameModes, getGameMode} from "#app/game-mode";
|
||||
import { GameModes, getGameMode } from "#app/game-mode";
|
||||
import fs from "fs";
|
||||
import {AES, enc} from "crypto-js";
|
||||
import {updateUserInfo} from "#app/account";
|
||||
import { AES, enc } from "crypto-js";
|
||||
import { updateUserInfo } from "#app/account";
|
||||
import InputsHandler from "#app/test/utils/inputsHandler";
|
||||
import ErrorInterceptor from "#app/test/utils/errorInterceptor";
|
||||
import {EnemyPokemon, PlayerPokemon} from "#app/field/pokemon";
|
||||
import {MockClock} from "#app/test/utils/mocks/mockClock";
|
||||
import {Command} from "#app/ui/command-ui-handler";
|
||||
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
||||
import { MockClock } from "#app/test/utils/mocks/mockClock";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||
import PartyUiHandler, {PartyUiMode} from "#app/ui/party-ui-handler";
|
||||
import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import Trainer from "#app/field/trainer";
|
||||
import { ExpNotification } from "#enums/exp-notification";
|
||||
import { GameDataType } from "#enums/game-data-type";
|
||||
@ -36,6 +26,8 @@ import { BattlerIndex } from "#app/battle.js";
|
||||
import TargetSelectUiHandler from "#app/ui/target-select-ui-handler.js";
|
||||
import { OverridesHelper } from "./overridesHelper";
|
||||
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type.js";
|
||||
import overrides from "#app/overrides.js";
|
||||
import { removeEnemyHeldItems } from "./testUtils";
|
||||
|
||||
/**
|
||||
* Class to manage the game state and transitions between phases.
|
||||
@ -140,6 +132,9 @@ export default class GameManager {
|
||||
});
|
||||
|
||||
await this.phaseInterceptor.run(EncounterPhase);
|
||||
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0) {
|
||||
removeEnemyHeldItems(this.scene);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,4 +34,5 @@ export function arrayOfRange(start: integer, end: integer) {
|
||||
export function removeEnemyHeldItems(scene: BattleScene) {
|
||||
scene.clearEnemyHeldItemModifiers();
|
||||
scene.clearEnemyModifiers();
|
||||
console.log("Enemy held items removed");
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ export class DropDownLabel {
|
||||
public text: string;
|
||||
public sprite?: Phaser.GameObjects.Sprite;
|
||||
|
||||
constructor(label: string, sprite?: Phaser.GameObjects.Sprite, state: DropDownState = DropDownState.ON) {
|
||||
constructor(label: string, sprite?: Phaser.GameObjects.Sprite, state: DropDownState = DropDownState.OFF) {
|
||||
this.text = label || "";
|
||||
this.sprite = sprite;
|
||||
this.state = state || DropDownState.ON;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,12 +262,13 @@ export class DropDown extends Phaser.GameObjects.Container {
|
||||
public options: DropDownOption[];
|
||||
private window: Phaser.GameObjects.NineSlice;
|
||||
private cursorObj: Phaser.GameObjects.Image;
|
||||
private dropDownType: DropDownType = DropDownType.MULTI;
|
||||
public dropDownType: DropDownType = DropDownType.MULTI;
|
||||
public cursor: number = 0;
|
||||
private lastCursor: number = -1;
|
||||
public defaultCursor: number = 0;
|
||||
private onChange: () => void;
|
||||
private lastDir: SortDirection = SortDirection.ASC;
|
||||
private defaultValues: any[];
|
||||
private defaultSettings: any[];
|
||||
|
||||
constructor(scene: BattleScene, x: number, y: number, options: DropDownOption[], onChange: () => void, type: DropDownType = DropDownType.MULTI, optionSpacing: number = 2) {
|
||||
const windowPadding = 5;
|
||||
@ -292,7 +293,7 @@ export class DropDown extends Phaser.GameObjects.Container {
|
||||
this.options.unshift(new DropDownOption(scene, "ALL", new DropDownLabel(i18next.t("filterBar:all"), undefined, this.checkForAllOn() ? DropDownState.ON : DropDownState.OFF)));
|
||||
}
|
||||
|
||||
this.defaultValues = this.getVals();
|
||||
this.defaultSettings = this.getSettings();
|
||||
|
||||
// Place ui elements in the correct spot
|
||||
options.forEach((option, index) => {
|
||||
@ -339,8 +340,8 @@ export class DropDown extends Phaser.GameObjects.Container {
|
||||
|
||||
resetCursor(): boolean {
|
||||
// If we are an hybrid dropdown in "hover" mode, don't move the cursor back to 0
|
||||
if (this.dropDownType === DropDownType.HYBRID && this.checkForAllOff() && this.cursor > 0) {
|
||||
return false;
|
||||
if (this.dropDownType === DropDownType.HYBRID && this.checkForAllOff()) {
|
||||
return this.setCursor(this.lastCursor);
|
||||
}
|
||||
return this.setCursor(this.defaultCursor);
|
||||
}
|
||||
@ -361,6 +362,7 @@ export class DropDown extends Phaser.GameObjects.Container {
|
||||
this.cursorObj.setVisible(true);
|
||||
// If hydrid type, we need to update the filters when going up/down in the list
|
||||
if (this.dropDownType === DropDownType.HYBRID) {
|
||||
this.lastCursor = cursor;
|
||||
this.onChange();
|
||||
}
|
||||
}
|
||||
@ -457,23 +459,43 @@ export class DropDown extends Phaser.GameObjects.Container {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current selected settings dictionary for each option
|
||||
* @returns an array of dictionaries with the current state of each option
|
||||
* - the settings dictionary is like this { val: any, state: DropDownState, cursor: boolean, dir: SortDirection }
|
||||
*/
|
||||
private getSettings(): any[] {
|
||||
const settings = [];
|
||||
for (let i = 0; i < this.options.length; i++) {
|
||||
settings.push({ val: this.options[i].val, state: this.options[i].state , cursor: (this.cursor === i), dir: this.options[i].dir });
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the values of all options are the same as the default ones
|
||||
* @returns true if they are the same, false otherwise
|
||||
*/
|
||||
public hasDefaultValues(): boolean {
|
||||
const currentValues = this.getVals();
|
||||
const currentValues = this.getSettings();
|
||||
|
||||
const compareValues = (keys: string[]): boolean => {
|
||||
return currentValues.length === this.defaultSettings.length &&
|
||||
currentValues.every((value, index) =>
|
||||
keys.every(key => value[key] === this.defaultSettings[index][key])
|
||||
);
|
||||
};
|
||||
|
||||
switch (this.dropDownType) {
|
||||
case DropDownType.MULTI:
|
||||
case DropDownType.HYBRID:
|
||||
return currentValues.length === this.defaultValues.length && currentValues.every((value, index) => value === this.defaultValues[index]);
|
||||
|
||||
case DropDownType.RADIAL:
|
||||
return currentValues.every((value, index) => value["val"] === this.defaultValues[index]["val"] && value["state"] === this.defaultValues[index]["state"]);
|
||||
return compareValues(["val", "state"]);
|
||||
|
||||
case DropDownType.HYBRID:
|
||||
return compareValues(["val", "state", "cursor"]);
|
||||
|
||||
case DropDownType.SINGLE:
|
||||
return currentValues[0]["dir"] === this.defaultValues[0]["dir"] && currentValues[0]["val"] === this.defaultValues[0]["val"];
|
||||
return compareValues(["val", "state", "dir"]);
|
||||
|
||||
default:
|
||||
return false;
|
||||
@ -484,46 +506,29 @@ export class DropDown extends Phaser.GameObjects.Container {
|
||||
* Set all values to their default state
|
||||
*/
|
||||
public resetToDefault(): void {
|
||||
this.setCursor(this.defaultCursor);
|
||||
if (this.defaultSettings.length > 0) {
|
||||
this.setCursor(this.defaultCursor);
|
||||
this.lastDir = SortDirection.ASC;
|
||||
|
||||
for (let i = 0; i < this.options.length; i++) {
|
||||
const option = this.options[i];
|
||||
// reset values
|
||||
switch (this.dropDownType) {
|
||||
case DropDownType.HYBRID:
|
||||
case DropDownType.MULTI:
|
||||
if (this.defaultValues.includes(option.val)) {
|
||||
option.setOptionState(DropDownState.ON);
|
||||
for (let i = 0; i < this.options.length; i++) {
|
||||
// reset values with the defaultValues
|
||||
if (this.dropDownType === DropDownType.SINGLE) {
|
||||
if (this.defaultSettings[i].state === DropDownState.OFF) {
|
||||
this.options[i].setOptionState(DropDownState.OFF);
|
||||
this.options[i].setDirection(SortDirection.ASC);
|
||||
this.options[i].toggle.setVisible(false);
|
||||
} else {
|
||||
this.options[i].setOptionState(DropDownState.ON);
|
||||
this.options[i].setDirection(SortDirection.ASC);
|
||||
this.options[i].toggle.setVisible(true);
|
||||
}
|
||||
} else {
|
||||
option.setOptionState(DropDownState.OFF);
|
||||
}
|
||||
break;
|
||||
case DropDownType.RADIAL:
|
||||
const targetValue = this.defaultValues.find(value => value.val === option.val);
|
||||
option.setOptionState(targetValue.state);
|
||||
break;
|
||||
case DropDownType.SINGLE:
|
||||
if (option.val === this.defaultValues[0].val) {
|
||||
if (option.state !== DropDownState.ON) {
|
||||
this.toggleOptionState(i);
|
||||
}
|
||||
if (option.dir !== this.defaultValues[0].dir) {
|
||||
this.toggleOptionState(i);
|
||||
if (this.defaultSettings[i]) {
|
||||
this.options[i].setOptionState(this.defaultSettings[i]["state"]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Select or unselect "ALL" button if applicable
|
||||
if (this.dropDownType === DropDownType.MULTI || this.dropDownType === DropDownType.HYBRID) {
|
||||
if (this.checkForAllOn()) {
|
||||
this.options[0].setOptionState(DropDownState.ON);
|
||||
} else {
|
||||
this.options[0].setOptionState(DropDownState.OFF);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import BattleScene from "#app/battle-scene.js";
|
||||
import { DropDown } from "./dropdown";
|
||||
import { DropDown, DropDownType } from "./dropdown";
|
||||
import { StarterContainer } from "./starter-container";
|
||||
import { addTextObject, getTextColor, TextStyle } from "./text";
|
||||
import { UiTheme } from "#enums/ui-theme";
|
||||
@ -120,11 +120,13 @@ export class FilterBar extends Phaser.GameObjects.Container {
|
||||
/**
|
||||
* Move the leftmost dropdown to the left of the FilterBar instead of below it
|
||||
*/
|
||||
offsetFirstFilter(): void {
|
||||
if (this.dropDowns[0]) {
|
||||
this.dropDowns[0].autoSize();
|
||||
this.dropDowns[0].x -= this.dropDowns[0].getWidth();
|
||||
this.dropDowns[0].y = 0;
|
||||
offsetHybridFilters(): void {
|
||||
for (let i=0; i<this.dropDowns.length; i++) {
|
||||
if (this.dropDowns[i].dropDownType === DropDownType.HYBRID) {
|
||||
this.dropDowns[i].autoSize();
|
||||
this.dropDowns[i].x = - this.dropDowns[i].getWidth();
|
||||
this.dropDowns[i].y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,8 +431,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
new DropDownLabel(i18next.t("filterBar:passiveUnlocked"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:passiveLocked"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
|
||||
const costReductionLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:costReduction"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:costReductionUnlocked"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:costReductionLocked"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
|
||||
const unlocksOptions = [
|
||||
new DropDownOption(this.scene, "PASSIVE", passiveLabels),
|
||||
new DropDownOption(this.scene, "COST_REDUCTION", costReductionLabels),
|
||||
];
|
||||
|
||||
this.filterBar.addFilter(DropDownColumn.UNLOCKS, i18next.t("filterBar:unlocksFilter"), new DropDown(this.scene, 0, 0, unlocksOptions, this.updateStarters, DropDownType.RADIAL));
|
||||
@ -443,18 +451,30 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
new DropDownLabel(i18next.t("filterBar:hasWon"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:hasNotWon"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
const hiddenAbilityLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:hiddenAbility"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:hasHiddenAbility"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:noHiddenAbility"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
const pokerusLabels = [
|
||||
new DropDownLabel(i18next.t("filterBar:pokerus"), undefined, DropDownState.OFF),
|
||||
new DropDownLabel(i18next.t("filterBar:hasPokerus"), undefined, DropDownState.ON),
|
||||
new DropDownLabel(i18next.t("filterBar:noPokerus"), undefined, DropDownState.EXCLUDE),
|
||||
];
|
||||
const miscOptions = [
|
||||
new DropDownOption(this.scene, "WIN", winLabels),
|
||||
new DropDownOption(this.scene, "HIDDEN_ABILITY", hiddenAbilityLabels),
|
||||
new DropDownOption(this.scene, "POKERUS", pokerusLabels),
|
||||
];
|
||||
this.filterBar.addFilter(DropDownColumn.MISC, i18next.t("filterBar:miscFilter"), new DropDown(this.scene, 0, 0, miscOptions, this.updateStarters, DropDownType.RADIAL));
|
||||
|
||||
// sort filter
|
||||
const sortOptions = [
|
||||
new DropDownOption(this.scene, 0, new DropDownLabel(i18next.t("filterBar:sortByNumber"))),
|
||||
new DropDownOption(this.scene, 1, new DropDownLabel(i18next.t("filterBar:sortByCost"), undefined, DropDownState.OFF)),
|
||||
new DropDownOption(this.scene, 2, new DropDownLabel(i18next.t("filterBar:sortByCandies"), undefined, DropDownState.OFF)),
|
||||
new DropDownOption(this.scene, 3, new DropDownLabel(i18next.t("filterBar:sortByIVs"), undefined, DropDownState.OFF)),
|
||||
new DropDownOption(this.scene, 4, new DropDownLabel(i18next.t("filterBar:sortByName"), undefined, DropDownState.OFF))
|
||||
new DropDownOption(this.scene, 0, new DropDownLabel(i18next.t("filterBar:sortByNumber"), undefined, DropDownState.ON)),
|
||||
new DropDownOption(this.scene, 1, new DropDownLabel(i18next.t("filterBar:sortByCost"))),
|
||||
new DropDownOption(this.scene, 2, new DropDownLabel(i18next.t("filterBar:sortByCandies"))),
|
||||
new DropDownOption(this.scene, 3, new DropDownLabel(i18next.t("filterBar:sortByIVs"))),
|
||||
new DropDownOption(this.scene, 4, new DropDownLabel(i18next.t("filterBar:sortByName")))
|
||||
];
|
||||
this.filterBar.addFilter(DropDownColumn.SORT, i18next.t("filterBar:sortFilter"), new DropDown(this.scene, 0, 0, sortOptions, this.updateStarters, DropDownType.SINGLE));
|
||||
this.filterBarContainer.add(this.filterBar);
|
||||
@ -462,7 +482,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
this.starterSelectContainer.add(this.filterBarContainer);
|
||||
|
||||
// Offset the generation filter dropdown to avoid covering the filtered pokemon
|
||||
this.filterBar.offsetFirstFilter();
|
||||
this.filterBar.offsetHybridFilters();
|
||||
|
||||
if (!this.scene.uiTheme) {
|
||||
starterContainerWindow.setVisible(false);
|
||||
@ -914,19 +934,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
*/
|
||||
resetFilters() : void {
|
||||
const genDropDown: DropDown = this.filterBar.getFilter(DropDownColumn.GEN);
|
||||
if (this.scene.gameMode.isChallenge) {
|
||||
// In challenge mode all gens are selected by default
|
||||
genDropDown.defaultCursor = 0;
|
||||
} else {
|
||||
// in other modes, gen 1 is selected by default, and all options disabled
|
||||
genDropDown.defaultCursor = 1;
|
||||
}
|
||||
|
||||
this.filterBar.setValsToDefault();
|
||||
|
||||
// for all modes except challenge, disable all gen options to enable hovering behavior
|
||||
if (!this.scene.gameMode.isChallenge) {
|
||||
genDropDown.unselectAllOptions();
|
||||
// if not in a challenge, in Gen hybrid filter hovering mode, set the cursor to the Gen1
|
||||
genDropDown.setCursor(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2107,9 +2120,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
const isCaught = !!(caughtVariants & DexAttr.NON_SHINY);
|
||||
const isUncaught = !isCaught && !isVariantCaught && !isVariant2Caught && !isVariant3Caught;
|
||||
const isPassiveUnlocked = this.scene.gameData.starterData[container.species.speciesId].passiveAttr > 0;
|
||||
const isCostReduced = this.scene.gameData.starterData[container.species.speciesId].valueReduction > 0;
|
||||
const isWin = this.scene.gameData.starterData[container.species.speciesId].classicWinCount > 0;
|
||||
const isNotWin = this.scene.gameData.starterData[container.species.speciesId].classicWinCount === 0;
|
||||
const isUndefined = this.scene.gameData.starterData[container.species.speciesId].classicWinCount === undefined;
|
||||
const isHA = this.scene.gameData.starterData[container.species.speciesId].abilityAttr & AbilityAttr.ABILITY_HIDDEN;
|
||||
|
||||
const fitsGen = this.filterBar.getVals(DropDownColumn.GEN).includes(container.species.generation);
|
||||
|
||||
@ -2139,6 +2154,16 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
}
|
||||
});
|
||||
|
||||
const fitsCostReduction = this.filterBar.getVals(DropDownColumn.UNLOCKS).some(unlocks => {
|
||||
if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.ON) {
|
||||
return isCostReduced;
|
||||
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.EXCLUDE) {
|
||||
return !isCostReduced;
|
||||
} else if (unlocks.val === "COST_REDUCTION" && unlocks.state === DropDownState.OFF) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
const fitsWin = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
if (container.species.speciesId < 10) {
|
||||
}
|
||||
@ -2151,7 +2176,27 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
}
|
||||
});
|
||||
|
||||
if (fitsGen && fitsType && fitsShiny && fitsPassive && fitsWin) {
|
||||
const fitsHA = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.ON) {
|
||||
return isHA;
|
||||
} else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.EXCLUDE) {
|
||||
return !isHA;
|
||||
} else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.OFF) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
const fitsPokerus = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
if (misc.val === "POKERUS" && misc.state === DropDownState.ON) {
|
||||
return this.pokerusSpecies.includes(container.species);
|
||||
} else if (misc.val === "POKERUS" && misc.state === DropDownState.EXCLUDE) {
|
||||
return !this.pokerusSpecies.includes(container.species);
|
||||
} else if (misc.val === "POKERUS" && misc.state === DropDownState.OFF) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (fitsGen && fitsType && fitsShiny && fitsPassive && fitsCostReduction && fitsWin && fitsHA && fitsPokerus) {
|
||||
this.filteredStarterContainers.push(container);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user