Skip to content

Commit

Permalink
Merge branch 'pagefaultgames:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pom-eranian authored Oct 27, 2024
2 parents 5e7ac54 + dfb42e4 commit d92995f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pokemon-rogue-battle",
"private": true,
"version": "1.1.0",
"version": "1.1.2",
"type": "module",
"scripts": {
"start": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/data/balance/species-egg-tiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ export const speciesEggTiers = {
[Species.DREEPY]: EggTier.RARE,
[Species.ZACIAN]: EggTier.LEGENDARY,
[Species.ZAMAZENTA]: EggTier.LEGENDARY,
[Species.ETERNATUS]: EggTier.COMMON,
[Species.ETERNATUS]: EggTier.LEGENDARY,
[Species.KUBFU]: EggTier.EPIC,
[Species.ZARUDE]: EggTier.EPIC,
[Species.REGIELEKI]: EggTier.EPIC,
Expand Down
10 changes: 7 additions & 3 deletions src/data/egg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,15 @@ export class Egg {
////
}

export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timestamp: number): Species {
const legendarySpecies = Object.entries(speciesEggTiers)
export function getValidLegendaryGachaSpecies() : Species[] {
return Object.entries(speciesEggTiers)
.filter(s => s[1] === EggTier.LEGENDARY)
.map(s => parseInt(s[0]))
.filter(s => getPokemonSpecies(s).isObtainable());
.filter(s => getPokemonSpecies(s).isObtainable() && s !== Species.ETERNATUS);
}

export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timestamp: number): Species {
const legendarySpecies = getValidLegendaryGachaSpecies();

let ret: Species;

Expand Down
2 changes: 1 addition & 1 deletion src/phases/turn-start-phase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ export class TurnStartPhase extends FieldPhase {
}

this.scene.pushPhase(new WeatherEffectPhase(this.scene));
this.scene.pushPhase(new BerryPhase(this.scene));

/** Add a new phase to check who should be taking status damage */
this.scene.pushPhase(new CheckStatusEffectPhase(this.scene, moveOrder));

this.scene.pushPhase(new BerryPhase(this.scene));
this.scene.pushPhase(new TurnEndPhase(this.scene));

/**
Expand Down
30 changes: 29 additions & 1 deletion src/test/eggs/egg.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Egg, getLegendaryGachaSpeciesForTimestamp } from "#app/data/egg";
import { speciesEggTiers } from "#app/data/balance/species-egg-tiers";
import { speciesStarterCosts } from "#app/data/balance/starters";
import { Egg, getLegendaryGachaSpeciesForTimestamp, getValidLegendaryGachaSpecies } from "#app/data/egg";
import { allSpecies } from "#app/data/pokemon-species";
import { EggSourceType } from "#app/enums/egg-source-types";
import { EggTier } from "#app/enums/egg-type";
import { VariantTier } from "#app/enums/variant-tier";
Expand Down Expand Up @@ -64,6 +67,12 @@ describe("Egg Generation Tests", () => {
expect(gachaSpeciesCount).toBeGreaterThan(0.4 * EGG_HATCH_COUNT);
expect(gachaSpeciesCount).toBeLessThan(0.6 * EGG_HATCH_COUNT);
});
it("should never be allowed to generate Eternatus via the legendary gacha", () => {
const validLegendaryGachaSpecies = getValidLegendaryGachaSpecies();
expect(validLegendaryGachaSpecies.every(s => speciesEggTiers[s] === EggTier.LEGENDARY)).toBe(true);
expect(validLegendaryGachaSpecies.every(s => allSpecies[s].isObtainable())).toBe(true);
expect(validLegendaryGachaSpecies.includes(Species.ETERNATUS)).toBe(false);
});
it("should hatch an Arceus. Set from species", () => {
const scene = game.scene;
const expectedSpecies = Species.ARCEUS;
Expand Down Expand Up @@ -376,4 +385,23 @@ describe("Egg Generation Tests", () => {
expect(diffShiny).toBe(true);
expect(diffAbility).toBe(true);
});

// For now, we are using this test to detect oversights in egg tiers.
// Delete this test if the balance team rebalances species costs independently of egg tiers.
it("should have correct egg tiers based on species costs", () => {
const getExpectedEggTier = (starterCost) =>
starterCost <= 3 ? EggTier.COMMON
: starterCost <= 5 ? EggTier.RARE
: starterCost <= 7 ? EggTier.EPIC
: EggTier.LEGENDARY;

allSpecies.forEach(pokemonSpecies => {
const rootSpecies = pokemonSpecies.getRootSpeciesId();
const speciesCost = speciesStarterCosts[rootSpecies];
const expectedEggTier = getExpectedEggTier(speciesCost);
const actualEggTier = speciesEggTiers[rootSpecies];

expect(actualEggTier).toBe(expectedEggTier);
});
});
});

0 comments on commit d92995f

Please sign in to comment.