mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 08:16:04 +00:00
Apply suggestions from code review
This commit is contained in:
parent
695965f0df
commit
14c0447a81
@ -1,9 +1,9 @@
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of all {@link https://bulbapedia.bulbagarden.net/wiki/Paradox_Pok%C3%A9mon | Paradox Pokemon}, including the legendaries Miraidon and Koraidon.
|
* A list of all {@link https://bulbapedia.bulbagarden.net/wiki/Paradox_Pok%C3%A9mon | Paradox Pokemon}, NOT including the legendaries Miraidon and Koraidon.
|
||||||
*/
|
*/
|
||||||
export const PARADOX_POKEMON = [
|
export const NON_LEGEND_PARADOX_POKEMON = [
|
||||||
Species.GREAT_TUSK,
|
Species.GREAT_TUSK,
|
||||||
Species.SCREAM_TAIL,
|
Species.SCREAM_TAIL,
|
||||||
Species.BRUTE_BONNET,
|
Species.BRUTE_BONNET,
|
||||||
@ -24,14 +24,14 @@ export const PARADOX_POKEMON = [
|
|||||||
Species.IRON_LEAVES,
|
Species.IRON_LEAVES,
|
||||||
Species.IRON_BOULDER,
|
Species.IRON_BOULDER,
|
||||||
Species.IRON_CROWN,
|
Species.IRON_CROWN,
|
||||||
Species.KORAIDON,
|
|
||||||
Species.MIRAIDON,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of all {@link https://bulbapedia.bulbagarden.net/wiki/Ultra_Beast | Ultra Beasts}, NOT including legendaries such as Necrozma.
|
* A list of all {@link https://bulbapedia.bulbagarden.net/wiki/Ultra_Beast | Ultra Beasts}, NOT including legendaries such as Necrozma or the Cosmog line.
|
||||||
|
*
|
||||||
|
* Note that all of these Ultra Beasts are still considered Sub-Legendary.
|
||||||
*/
|
*/
|
||||||
export const ULTRA_BEASTS = [
|
export const NON_LEGEND_ULTRA_BEASTS = [
|
||||||
Species.NIHILEGO,
|
Species.NIHILEGO,
|
||||||
Species.BUZZWOLE,
|
Species.BUZZWOLE,
|
||||||
Species.PHEROMOSA,
|
Species.PHEROMOSA,
|
||||||
|
@ -8,7 +8,7 @@ import { getPokemonSpecies } from "#app/data/pokemon-species";
|
|||||||
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||||
import { EnemyPartyConfig, EnemyPokemonConfig, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, } from "../utils/encounter-phase-utils";
|
import { EnemyPartyConfig, EnemyPokemonConfig, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, } from "../utils/encounter-phase-utils";
|
||||||
import { getRandomPlayerPokemon, getRandomSpeciesByStarterTier } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
import { getRandomPlayerPokemon, getRandomSpeciesByStarterCost } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
|
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
|
||||||
@ -174,7 +174,7 @@ export const DarkDealEncounter: MysteryEncounter =
|
|||||||
const roll = randSeedInt(100);
|
const roll = randSeedInt(100);
|
||||||
const starterTier: number | [number, number] =
|
const starterTier: number | [number, number] =
|
||||||
roll >= 65 ? 6 : roll >= 15 ? 7 : roll >= 5 ? 8 : [ 9, 10 ];
|
roll >= 65 ? 6 : roll >= 15 ? 7 : roll >= 5 ? 8 : [ 9, 10 ];
|
||||||
const bossSpecies = getPokemonSpecies(getRandomSpeciesByStarterTier(starterTier, excludedBosses, bossTypes));
|
const bossSpecies = getPokemonSpecies(getRandomSpeciesByStarterCost(starterTier, excludedBosses, bossTypes));
|
||||||
const pokemonConfig: EnemyPokemonConfig = {
|
const pokemonConfig: EnemyPokemonConfig = {
|
||||||
species: bossSpecies,
|
species: bossSpecies,
|
||||||
isBoss: true,
|
isBoss: true,
|
||||||
|
@ -11,7 +11,7 @@ import { PlayerGender } from "#enums/player-gender";
|
|||||||
import { IntegerHolder, randSeedInt } from "#app/utils";
|
import { IntegerHolder, randSeedInt } from "#app/utils";
|
||||||
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||||
import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||||
import { doPlayerFlee, doPokemonFlee, getRandomSpeciesByStarterTier, trainerThrowPokeball } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
import { doPlayerFlee, doPokemonFlee, getRandomSpeciesByStarterCost, trainerThrowPokeball } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||||
import { getEncounterText, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
import { getEncounterText, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
@ -19,7 +19,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
|
|||||||
import { ScanIvsPhase } from "#app/phases/scan-ivs-phase";
|
import { ScanIvsPhase } from "#app/phases/scan-ivs-phase";
|
||||||
import { SummonPhase } from "#app/phases/summon-phase";
|
import { SummonPhase } from "#app/phases/summon-phase";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||||
import { PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
const namespace = "mysteryEncounters/safariZone";
|
const namespace = "mysteryEncounters/safariZone";
|
||||||
@ -532,5 +532,5 @@ async function doEndTurn(scene: BattleScene, cursorIndex: number) {
|
|||||||
* @returns A random species that has at most 5 starter cost and is not Mythical, Paradox, etc.
|
* @returns A random species that has at most 5 starter cost and is not Mythical, Paradox, etc.
|
||||||
*/
|
*/
|
||||||
export function getSafariSpeciesSpawn(): PokemonSpecies {
|
export function getSafariSpeciesSpawn(): PokemonSpecies {
|
||||||
return getPokemonSpecies(getRandomSpeciesByStarterTier([ 0, 5 ], PARADOX_POKEMON, undefined, false, false, false));
|
return getPokemonSpecies(getRandomSpeciesByStarterCost([ 0, 5 ], NON_LEGEND_PARADOX_POKEMON, undefined, false, false, false));
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
|||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||||
import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||||
import { catchPokemon, getRandomSpeciesByStarterTier, getSpriteKeysFromPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
import { catchPokemon, getRandomSpeciesByStarterCost, getSpriteKeysFromPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||||
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
@ -17,7 +17,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
||||||
|
|
||||||
/** the i18n namespace for this encounter */
|
/** the i18n namespace for this encounter */
|
||||||
const namespace = "mysteryEncounters/thePokemonSalesman";
|
const namespace = "mysteryEncounters/thePokemonSalesman";
|
||||||
@ -170,5 +170,5 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter =
|
|||||||
* @returns A random species that has at most 5 starter cost and is not Mythical, Paradox, etc.
|
* @returns A random species that has at most 5 starter cost and is not Mythical, Paradox, etc.
|
||||||
*/
|
*/
|
||||||
export function getSalesmanSpeciesOffer(): PokemonSpecies {
|
export function getSalesmanSpeciesOffer(): PokemonSpecies {
|
||||||
return getPokemonSpecies(getRandomSpeciesByStarterTier([ 0, 5 ], PARADOX_POKEMON, undefined, false, false, false));
|
return getPokemonSpecies(getRandomSpeciesByStarterCost([ 0, 5 ], NON_LEGEND_PARADOX_POKEMON, undefined, false, false, false));
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ export function getHighestStatTotalPlayerPokemon(scene: BattleScene, isAllowed:
|
|||||||
* @param allowMythical
|
* @param allowMythical
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getRandomSpeciesByStarterTier(starterTiers: number | [number, number], excludedSpecies?: Species[], types?: Type[], allowSubLegendary: boolean = true, allowLegendary: boolean = true, allowMythical: boolean = true): Species {
|
export function getRandomSpeciesByStarterCost(starterTiers: number | [number, number], excludedSpecies?: Species[], types?: Type[], allowSubLegendary: boolean = true, allowLegendary: boolean = true, allowMythical: boolean = true): Species {
|
||||||
let min = Array.isArray(starterTiers) ? starterTiers[0] : starterTiers;
|
let min = Array.isArray(starterTiers) ? starterTiers[0] : starterTiers;
|
||||||
let max = Array.isArray(starterTiers) ? starterTiers[1] : starterTiers;
|
let max = Array.isArray(starterTiers) ? starterTiers[1] : starterTiers;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
|||||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { getSafariSpeciesSpawn, SafariZoneEncounter } from "#app/data/mystery-encounters/encounters/safari-zone-encounter";
|
import { getSafariSpeciesSpawn, SafariZoneEncounter } from "#app/data/mystery-encounters/encounters/safari-zone-encounter";
|
||||||
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/safariZone";
|
const namespace = "mysteryEncounters/safariZone";
|
||||||
const defaultParty = [ Species.LAPRAS, Species.GENGAR, Species.ABRA ];
|
const defaultParty = [ Species.LAPRAS, Species.GENGAR, Species.ABRA ];
|
||||||
@ -138,7 +138,7 @@ describe("Safari Zone - Mystery Encounter", () => {
|
|||||||
for (let i = 0; i < NUM_ROLLS; i++) {
|
for (let i = 0; i < NUM_ROLLS; i++) {
|
||||||
rngSweepProgress = (2 * i + 1) / (2 * NUM_ROLLS);
|
rngSweepProgress = (2 * i + 1) / (2 * NUM_ROLLS);
|
||||||
const simSpecies = getSafariSpeciesSpawn().speciesId;
|
const simSpecies = getSafariSpeciesSpawn().speciesId;
|
||||||
expect(PARADOX_POKEMON).not.toContain(simSpecies);
|
expect(NON_LEGEND_PARADOX_POKEMON).not.toContain(simSpecies);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
|
|||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { initSceneWithoutEncounterPhase } from "#test/utils/gameManagerUtils";
|
import { initSceneWithoutEncounterPhase } from "#test/utils/gameManagerUtils";
|
||||||
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
||||||
import { PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
||||||
|
|
||||||
const namespace = "mysteryEncounters/thePokemonSalesman";
|
const namespace = "mysteryEncounters/thePokemonSalesman";
|
||||||
const defaultParty = [ Species.LAPRAS, Species.GENGAR, Species.ABRA ];
|
const defaultParty = [ Species.LAPRAS, Species.GENGAR, Species.ABRA ];
|
||||||
@ -173,7 +173,7 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
|
|||||||
expect(mysteryEncounterPhase.continueEncounter).not.toHaveBeenCalled();
|
expect(mysteryEncounterPhase.continueEncounter).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not spawn any Paradox Pokemon", async () => {
|
it("should not offer any Paradox Pokemon", async () => {
|
||||||
const NUM_ROLLS = 2000; // As long as this is greater than total number of species, this should cover all possible RNG rolls
|
const NUM_ROLLS = 2000; // As long as this is greater than total number of species, this should cover all possible RNG rolls
|
||||||
let rngSweepProgress = 0; // Will simulate full range of RNG rolls by steadily increasing from 0 to 1
|
let rngSweepProgress = 0; // Will simulate full range of RNG rolls by steadily increasing from 0 to 1
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
|
|||||||
for (let i = 0; i < NUM_ROLLS; i++) {
|
for (let i = 0; i < NUM_ROLLS; i++) {
|
||||||
rngSweepProgress = (2 * i + 1) / (2 * NUM_ROLLS);
|
rngSweepProgress = (2 * i + 1) / (2 * NUM_ROLLS);
|
||||||
const simSpecies = getSalesmanSpeciesOffer().speciesId;
|
const simSpecies = getSalesmanSpeciesOffer().speciesId;
|
||||||
expect(PARADOX_POKEMON).not.toContain(simSpecies);
|
expect(NON_LEGEND_PARADOX_POKEMON).not.toContain(simSpecies);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import BattleScene from "#app/battle-scene";
|
|||||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||||
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||||
import { getEncounterText, queueEncounterMessage, showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
import { getEncounterText, queueEncounterMessage, showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||||
import { getHighestLevelPlayerPokemon, getLowestLevelPlayerPokemon, getRandomPlayerPokemon, getRandomSpeciesByStarterTier, koPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
import { getHighestLevelPlayerPokemon, getLowestLevelPlayerPokemon, getRandomPlayerPokemon, getRandomSpeciesByStarterCost, koPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||||
import { Type } from "#enums/type";
|
import { Type } from "#enums/type";
|
||||||
import { MessagePhase } from "#app/phases/message-phase";
|
import { MessagePhase } from "#app/phases/message-phase";
|
||||||
@ -204,9 +204,9 @@ describe("Mystery Encounter Utils", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getRandomSpeciesByStarterTier", () => {
|
describe("getRandomSpeciesByStarterCost", () => {
|
||||||
it("gets species for a starter tier", () => {
|
it("gets species for a starter tier", () => {
|
||||||
const result = getRandomSpeciesByStarterTier(5);
|
const result = getRandomSpeciesByStarterCost(5);
|
||||||
const pokeSpecies = getPokemonSpecies(result);
|
const pokeSpecies = getPokemonSpecies(result);
|
||||||
|
|
||||||
expect(pokeSpecies.speciesId).toBe(result);
|
expect(pokeSpecies.speciesId).toBe(result);
|
||||||
@ -214,7 +214,7 @@ describe("Mystery Encounter Utils", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("gets species for a starter tier range", () => {
|
it("gets species for a starter tier range", () => {
|
||||||
const result = getRandomSpeciesByStarterTier([ 5, 8 ]);
|
const result = getRandomSpeciesByStarterCost([ 5, 8 ]);
|
||||||
const pokeSpecies = getPokemonSpecies(result);
|
const pokeSpecies = getPokemonSpecies(result);
|
||||||
|
|
||||||
expect(pokeSpecies.speciesId).toBe(result);
|
expect(pokeSpecies.speciesId).toBe(result);
|
||||||
@ -224,14 +224,14 @@ describe("Mystery Encounter Utils", () => {
|
|||||||
|
|
||||||
it("excludes species from search", () => {
|
it("excludes species from search", () => {
|
||||||
// Only 9 tiers are: Koraidon, Miraidon, Arceus, Rayquaza, Kyogre, Groudon, Zacian
|
// Only 9 tiers are: Koraidon, Miraidon, Arceus, Rayquaza, Kyogre, Groudon, Zacian
|
||||||
const result = getRandomSpeciesByStarterTier(9, [ Species.KORAIDON, Species.MIRAIDON, Species.ARCEUS, Species.RAYQUAZA, Species.KYOGRE, Species.GROUDON ]);
|
const result = getRandomSpeciesByStarterCost(9, [ Species.KORAIDON, Species.MIRAIDON, Species.ARCEUS, Species.RAYQUAZA, Species.KYOGRE, Species.GROUDON ]);
|
||||||
const pokeSpecies = getPokemonSpecies(result);
|
const pokeSpecies = getPokemonSpecies(result);
|
||||||
expect(pokeSpecies.speciesId).toBe(Species.ZACIAN);
|
expect(pokeSpecies.speciesId).toBe(Species.ZACIAN);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("gets species of specified types", () => {
|
it("gets species of specified types", () => {
|
||||||
// Only 9 tiers are: Koraidon, Miraidon, Arceus, Rayquaza, Kyogre, Groudon, Zacian
|
// Only 9 tiers are: Koraidon, Miraidon, Arceus, Rayquaza, Kyogre, Groudon, Zacian
|
||||||
const result = getRandomSpeciesByStarterTier(9, undefined, [ Type.GROUND ]);
|
const result = getRandomSpeciesByStarterCost(9, undefined, [ Type.GROUND ]);
|
||||||
const pokeSpecies = getPokemonSpecies(result);
|
const pokeSpecies = getPokemonSpecies(result);
|
||||||
expect(pokeSpecies.speciesId).toBe(Species.GROUDON);
|
expect(pokeSpecies.speciesId).toBe(Species.GROUDON);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user