mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-24 00:09:31 +02:00
creates table for tracking species egg tiers
This commit is contained in:
parent
0a7fab463e
commit
82b96eabec
@ -1,6 +1,9 @@
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { EggTier } from "#enums/egg-type";
|
import { EggTier } from "#enums/egg-type";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of all starters and their respective {@link EggTier}, which determines which type of egg the starter hatches from.
|
||||||
|
*/
|
||||||
export const speciesEggTiers = {
|
export const speciesEggTiers = {
|
||||||
[Species.BULBASAUR]: EggTier.COMMON,
|
[Species.BULBASAUR]: EggTier.COMMON,
|
||||||
[Species.CHARMANDER]: EggTier.COMMON,
|
[Species.CHARMANDER]: EggTier.COMMON,
|
||||||
|
@ -162,7 +162,7 @@ export class Egg {
|
|||||||
|
|
||||||
// Override egg tier and hatchwaves if species was given
|
// Override egg tier and hatchwaves if species was given
|
||||||
if (eggOptions?.species) {
|
if (eggOptions?.species) {
|
||||||
this._tier = this.getEggTierFromSpeciesStarterValue();
|
this._tier = this.getEggTier();
|
||||||
this._hatchWaves = eggOptions.hatchWaves ?? this.getEggTierDefaultHatchWaves();
|
this._hatchWaves = eggOptions.hatchWaves ?? this.getEggTierDefaultHatchWaves();
|
||||||
}
|
}
|
||||||
// If species has no variant, set variantTier to common. This needs to
|
// If species has no variant, set variantTier to common. This needs to
|
||||||
@ -536,22 +536,8 @@ export class Egg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getEggTierFromSpeciesStarterValue(): EggTier {
|
private getEggTier(): EggTier {
|
||||||
const speciesStartValue = speciesStarterCosts[this.species];
|
return speciesEggTiers[this.species];
|
||||||
if (speciesStartValue >= 1 && speciesStartValue <= 3) {
|
|
||||||
return EggTier.COMMON;
|
|
||||||
}
|
|
||||||
if (speciesStartValue >= 4 && speciesStartValue <= 5) {
|
|
||||||
return EggTier.GREAT;
|
|
||||||
}
|
|
||||||
if (speciesStartValue >= 6 && speciesStartValue <= 7) {
|
|
||||||
return EggTier.ULTRA;
|
|
||||||
}
|
|
||||||
if (speciesStartValue >= 8) {
|
|
||||||
return EggTier.MASTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EggTier.COMMON;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////
|
////
|
||||||
@ -560,8 +546,8 @@ export class Egg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timestamp: number): Species {
|
export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timestamp: number): Species {
|
||||||
const legendarySpecies = Object.entries(speciesStarterCosts)
|
const legendarySpecies = Object.entries(speciesEggTiers)
|
||||||
.filter(s => s[1] >= 8 && s[1] <= 9)
|
.filter(s => s[1] === EggTier.MASTER)
|
||||||
.map(s => parseInt(s[0]))
|
.map(s => parseInt(s[0]))
|
||||||
.filter(s => getPokemonSpecies(s).isObtainable());
|
.filter(s => getPokemonSpecies(s).isObtainable());
|
||||||
|
|
||||||
@ -583,17 +569,9 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for a given species EggTier Value
|
* Check for a given species EggTier Value
|
||||||
* @param species - Species for wich we will check the egg tier it belongs to
|
* @param pokemonSpecies - Species for wich we will check the egg tier it belongs to
|
||||||
* @returns The egg tier of a given pokemon species
|
* @returns The egg tier of a given pokemon species
|
||||||
*/
|
*/
|
||||||
export function getEggTierForSpecies(pokemonSpecies :PokemonSpecies): EggTier {
|
export function getEggTierForSpecies(pokemonSpecies :PokemonSpecies): EggTier {
|
||||||
const speciesBaseValue = speciesStarterCosts[pokemonSpecies.getRootSpeciesId()];
|
return speciesEggTiers[pokemonSpecies.getRootSpeciesId()];
|
||||||
if (speciesBaseValue <= 3) {
|
|
||||||
return EggTier.COMMON;
|
|
||||||
} else if (speciesBaseValue <= 5) {
|
|
||||||
return EggTier.GREAT;
|
|
||||||
} else if (speciesBaseValue <= 7) {
|
|
||||||
return EggTier.ULTRA;
|
|
||||||
}
|
|
||||||
return EggTier.MASTER;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user