test fixes and final cleanup

This commit is contained in:
Moka 2024-11-09 17:19:45 +01:00
parent 5ba47c7fb1
commit a64a94193d
3 changed files with 14 additions and 12 deletions

View File

@ -71,7 +71,7 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter =
let pokemon: PlayerPokemon; let pokemon: PlayerPokemon;
if (randSeedInt(SHINY_MAGIKARP_WEIGHT) === 0 || isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE) { if (randSeedInt(SHINY_MAGIKARP_WEIGHT) === 0 || isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE) {
// If no HA mon found or you roll 1%, give shiny Magikarp with HA and random variant // If no HA mon found or you roll 1%, give shiny Magikarp with random variant
species = getPokemonSpecies(Species.MAGIKARP); species = getPokemonSpecies(Species.MAGIKARP);
pokemon = new PlayerPokemon(scene, species, 5, 2, species.formIndex, undefined, true); pokemon = new PlayerPokemon(scene, species, 5, 2, species.formIndex, undefined, true);
} else { } else {

View File

@ -84,8 +84,6 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
constructor(scene: BattleScene, encounter: MysteryEncounter) { constructor(scene: BattleScene, encounter: MysteryEncounter) {
super(scene, -72, 76); super(scene, -72, 76);
this.shinySparkleSprites = [];
this.encounter = encounter; this.encounter = encounter;
this.enterFromRight = encounter.enterIntroVisualsFromRight ?? false; this.enterFromRight = encounter.enterIntroVisualsFromRight ?? false;
// Shallow copy configs to allow visual config updates at runtime without dirtying master copy of Encounter // Shallow copy configs to allow visual config updates at runtime without dirtying master copy of Encounter
@ -129,6 +127,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
// Sprites with custom X or Y defined will not count for normal spacing requirements // Sprites with custom X or Y defined will not count for normal spacing requirements
const spacingValue = Math.round((maxX - minX) / Math.max(this.spriteConfigs.filter(s => !s.x && !s.y).length, 1)); const spacingValue = Math.round((maxX - minX) / Math.max(this.spriteConfigs.filter(s => !s.x && !s.y).length, 1));
this.shinySparkleSprites = [];
const shinySparkleSprites = scene.add.container(0, 0); const shinySparkleSprites = scene.add.container(0, 0);
this.spriteConfigs?.forEach((config) => { this.spriteConfigs?.forEach((config) => {
const { spriteKey, isItem, hasShadow, scale, x, y, yShadow, alpha, isPokemon, isShiny, variant } = config; const { spriteKey, isItem, hasShadow, scale, x, y, yShadow, alpha, isPokemon, isShiny, variant } = config;
@ -274,18 +273,22 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
this.getSprites().map((sprite, i) => { this.getSprites().map((sprite, i) => {
if (!this.spriteConfigs[i].isItem) { if (!this.spriteConfigs[i].isItem) {
sprite.setTexture(this.spriteConfigs[i].spriteKey); sprite.setTexture(this.spriteConfigs[i].spriteKey).setFrame(0);
// Show the first frame for a smooth transition when the animation starts. if (sprite.texture.frameTotal > 1) {
const firstFrame = sprite.texture.frames["0001.png"]; // Show the first animation frame for a smooth transition when the animation starts.
sprite.setFrame(firstFrame ?? 0); const firstFrame = sprite.texture.frames["0001.png"];
sprite.setFrame(firstFrame ?? 0);
}
} }
}); });
this.getTintSprites().map((tintSprite, i) => { this.getTintSprites().map((tintSprite, i) => {
if (!this.spriteConfigs[i].isItem) { if (!this.spriteConfigs[i].isItem) {
tintSprite.setTexture(this.spriteConfigs[i].spriteKey); tintSprite.setTexture(this.spriteConfigs[i].spriteKey).setFrame(0);
// Show the first frame for a smooth transition when the animation starts. if (tintSprite.texture.frameTotal > 1) {
const firstFrame = tintSprite.texture.frames["0001.png"]; // Show the first frame for a smooth transition when the animation starts.
tintSprite.setFrame(firstFrame ?? 0); const firstFrame = tintSprite.texture.frames["0001.png"];
tintSprite.setFrame(firstFrame ?? 0);
}
} }
}); });

View File

@ -204,7 +204,6 @@ export class EncounterPhase extends BattlePhase {
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id); battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
const playerPokemon = this.scene.getPlayerPokemon(); const playerPokemon = this.scene.getPlayerPokemon();
if (playerPokemon?.visible) { if (playerPokemon?.visible) {
//TODO HERE
this.scene.field.moveBelow(enemyPokemon as Pokemon, playerPokemon); this.scene.field.moveBelow(enemyPokemon as Pokemon, playerPokemon);
} }
enemyPokemon.tint(0, 0.5); enemyPokemon.tint(0, 0.5);