mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
Merge branch 'beta' into waveData
This commit is contained in:
commit
5a9fbd13f0
@ -27,7 +27,7 @@ import {
|
|||||||
} from "#app/data/balance/pokemon-level-moves";
|
} from "#app/data/balance/pokemon-level-moves";
|
||||||
import type { Stat } from "#enums/stat";
|
import type { Stat } from "#enums/stat";
|
||||||
import type { Variant, VariantSet } from "#app/sprites/variant";
|
import type { Variant, VariantSet } from "#app/sprites/variant";
|
||||||
import { populateVariantColorCache, variantData } from "#app/sprites/variant";
|
import { populateVariantColorCache, variantColorCache, variantData } from "#app/sprites/variant";
|
||||||
import { speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters";
|
import { speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters";
|
||||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||||
import { starterPassiveAbilities } from "#app/data/balance/passives";
|
import { starterPassiveAbilities } from "#app/data/balance/passives";
|
||||||
@ -405,7 +405,7 @@ export abstract class PokemonSpeciesForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Compute the sprite ID of the pokemon form. */
|
/** Compute the sprite ID of the pokemon form. */
|
||||||
getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back?: boolean): string {
|
getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back = false): string {
|
||||||
const baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
|
const baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
|
||||||
|
|
||||||
let config = variantData;
|
let config = variantData;
|
||||||
@ -595,6 +595,44 @@ export abstract class PokemonSpeciesForm {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the variant colors for the species into the variant color cache
|
||||||
|
*
|
||||||
|
* @param spriteKey - The sprite key to use
|
||||||
|
* @param female - Whether to load female instead of male
|
||||||
|
* @param back - Whether the back sprite is being loaded
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
async loadVariantColors(
|
||||||
|
spriteKey: string,
|
||||||
|
female: boolean,
|
||||||
|
variant: Variant,
|
||||||
|
back = false,
|
||||||
|
formIndex?: number,
|
||||||
|
): Promise<void> {
|
||||||
|
let baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
|
||||||
|
if (back) {
|
||||||
|
baseSpriteKey = "back__" + baseSpriteKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (variantColorCache.hasOwnProperty(baseSpriteKey)) {
|
||||||
|
// Variant colors have already been loaded
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const variantInfo = variantData[this.getVariantDataIndex(formIndex)];
|
||||||
|
// Do nothing if there is no variant information or the variant does not have color replacements
|
||||||
|
if (!variantInfo || variantInfo[variant] !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await populateVariantColorCache(
|
||||||
|
"pkmn__" + baseSpriteKey,
|
||||||
|
globalScene.experimentalSprites && hasExpSprite(spriteKey),
|
||||||
|
baseSpriteKey.replace("__", "/"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async loadAssets(
|
async loadAssets(
|
||||||
female: boolean,
|
female: boolean,
|
||||||
formIndex?: number,
|
formIndex?: number,
|
||||||
@ -607,15 +645,9 @@ export abstract class PokemonSpeciesForm {
|
|||||||
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant, back);
|
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant, back);
|
||||||
globalScene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant, back));
|
globalScene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant, back));
|
||||||
globalScene.load.audio(this.getCryKey(formIndex), `audio/${this.getCryKey(formIndex)}.m4a`);
|
globalScene.load.audio(this.getCryKey(formIndex), `audio/${this.getCryKey(formIndex)}.m4a`);
|
||||||
|
if (!isNullOrUndefined(variant)) {
|
||||||
const baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
|
await this.loadVariantColors(spriteKey, female, variant, back, formIndex);
|
||||||
|
}
|
||||||
// Force the variant color cache to be loaded for the form
|
|
||||||
await populateVariantColorCache(
|
|
||||||
"pkmn__" + baseSpriteKey,
|
|
||||||
globalScene.experimentalSprites && hasExpSprite(spriteKey),
|
|
||||||
baseSpriteKey,
|
|
||||||
);
|
|
||||||
return new Promise<void>(resolve => {
|
return new Promise<void>(resolve => {
|
||||||
globalScene.load.once(Phaser.Loader.Events.COMPLETE, () => {
|
globalScene.load.once(Phaser.Loader.Events.COMPLETE, () => {
|
||||||
const originalWarn = console.warn;
|
const originalWarn = console.warn;
|
||||||
|
Loading…
Reference in New Issue
Block a user