Add changes suggested by PigeonBar

This commit is contained in:
NightKev 2024-11-30 16:31:11 -08:00
parent 58edade3b0
commit 4e4bac4ef3
2 changed files with 22 additions and 4 deletions

View File

@ -3728,8 +3728,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
setFrameRate(frameRate: integer) { setFrameRate(frameRate: integer) {
this.scene.anims.get(this.getBattleSpriteKey()).frameRate = frameRate; this.scene.anims.get(this.getBattleSpriteKey()).frameRate = frameRate;
try {
this.getSprite().play(this.getBattleSpriteKey()); this.getSprite().play(this.getBattleSpriteKey());
} catch (err: unknown) {
console.error(`Failed to play animation for ${this.getBattleSpriteKey()}`, err);
}
try {
this.getTintSprite()?.play(this.getBattleSpriteKey()); this.getTintSprite()?.play(this.getBattleSpriteKey());
} catch (err: unknown) {
console.error(`Failed to play animation for ${this.getBattleSpriteKey()}`, err);
}
} }
tint(color: number, alpha?: number, duration?: integer, ease?: string) { tint(color: number, alpha?: number, duration?: integer, ease?: string) {

View File

@ -43,7 +43,12 @@ export class QuietFormChangePhase extends BattlePhase {
const getPokemonSprite = () => { const getPokemonSprite = () => {
const sprite = this.scene.addPokemonSprite(this.pokemon, this.pokemon.x + this.pokemon.getSprite().x, this.pokemon.y + this.pokemon.getSprite().y, "pkmn__sub"); const sprite = this.scene.addPokemonSprite(this.pokemon, this.pokemon.x + this.pokemon.getSprite().x, this.pokemon.y + this.pokemon.getSprite().y, "pkmn__sub");
sprite.setOrigin(0.5, 1); sprite.setOrigin(0.5, 1);
sprite.play(this.pokemon.getBattleSpriteKey()).stop(); const spriteKey = this.pokemon.getBattleSpriteKey();
try {
sprite.play(spriteKey).stop();
} catch (err: unknown) {
console.error(`Failed to play animation for ${spriteKey}`, err);
}
sprite.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: false, teraColor: getTypeRgb(this.pokemon.getTeraType()) }); sprite.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: false, teraColor: getTypeRgb(this.pokemon.getTeraType()) });
[ "spriteColors", "fusionSpriteColors" ].map(k => { [ "spriteColors", "fusionSpriteColors" ].map(k => {
if (this.pokemon.summonData?.speciesForm) { if (this.pokemon.summonData?.speciesForm) {
@ -81,7 +86,12 @@ export class QuietFormChangePhase extends BattlePhase {
this.pokemon.setVisible(false); this.pokemon.setVisible(false);
this.pokemon.changeForm(this.formChange).then(() => { this.pokemon.changeForm(this.formChange).then(() => {
pokemonFormTintSprite.setScale(0.01); pokemonFormTintSprite.setScale(0.01);
pokemonFormTintSprite.play(this.pokemon.getBattleSpriteKey()).stop(); const spriteKey = this.pokemon.getBattleSpriteKey();
try {
pokemonFormTintSprite.play(spriteKey).stop();
} catch (err: unknown) {
console.error(`Failed to play animation for ${spriteKey}`, err);
}
pokemonFormTintSprite.setVisible(true); pokemonFormTintSprite.setVisible(true);
this.scene.tweens.add({ this.scene.tweens.add({
targets: pokemonTintSprite, targets: pokemonTintSprite,