Add faster evolution skipping
parent
36b3c91276
commit
87e0e06b9e
|
@ -30,6 +30,7 @@ export class EggHatchPhase extends Phase {
|
|||
|
||||
private pokemon: PlayerPokemon;
|
||||
private eggMoveIndex: integer;
|
||||
private hatched: boolean;
|
||||
private canSkip: boolean;
|
||||
private skipped: boolean;
|
||||
private evolutionBgm: AnySound;
|
||||
|
@ -108,9 +109,11 @@ export class EggHatchPhase extends Phase {
|
|||
this.pokemon = pokemon;
|
||||
|
||||
pokemon.loadAssets().then(() => {
|
||||
this.scene.time.delayedCall(1000, () => {
|
||||
this.evolutionBgm = this.scene.playSoundWithoutBgm('evolution');
|
||||
this.canSkip = true;
|
||||
|
||||
this.scene.time.delayedCall(1000, () => {
|
||||
if (!this.skipped)
|
||||
this.evolutionBgm = this.scene.playSoundWithoutBgm('evolution');
|
||||
});
|
||||
|
||||
this.scene.time.delayedCall(2000, () => {
|
||||
|
@ -190,12 +193,17 @@ export class EggHatchPhase extends Phase {
|
|||
if (!this.canSkip || this.skipped)
|
||||
return false;
|
||||
this.skipped = true;
|
||||
if (!this.hatched)
|
||||
this.doHatch();
|
||||
else
|
||||
this.doReveal();
|
||||
return true;
|
||||
}
|
||||
|
||||
doHatch(): void {
|
||||
this.canSkip = false;
|
||||
this.hatched = true;
|
||||
if (this.evolutionBgm)
|
||||
SoundFade.fadeOut(this.scene, this.evolutionBgm, Utils.fixedInt(100));
|
||||
for (let e = 0; e < 5; e++)
|
||||
this.scene.time.delayedCall(Utils.fixedInt(375 * e), () => this.scene.playSound('egg_hatch', { volume: 1 - (e * 0.2) }));
|
||||
|
@ -205,9 +213,20 @@ export class EggHatchPhase extends Phase {
|
|||
duration: Utils.fixedInt(125),
|
||||
targets: this.eggHatchOverlay,
|
||||
alpha: 1,
|
||||
ease: 'Cubic.easeIn'
|
||||
ease: 'Cubic.easeIn',
|
||||
onComplete: () => {
|
||||
this.skipped = false;
|
||||
this.canSkip = true;
|
||||
}
|
||||
});
|
||||
this.scene.time.delayedCall(Utils.fixedInt(1500), () => {
|
||||
this.canSkip = false;
|
||||
if (!this.skipped)
|
||||
this.doReveal();
|
||||
});
|
||||
}
|
||||
|
||||
doReveal(): void {
|
||||
const isShiny = this.pokemon.isShiny();
|
||||
if (this.pokemon.species.mythical)
|
||||
this.scene.validateAchv(achvs.HATCH_MYTHICAL);
|
||||
|
@ -219,16 +238,16 @@ export class EggHatchPhase extends Phase {
|
|||
this.pokemonSprite.play(this.pokemon.getSpriteKey(true));
|
||||
this.pokemonSprite.pipelineData['ignoreTimeTint'] = true;
|
||||
this.pokemonSprite.setVisible(true);
|
||||
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
|
||||
this.scene.time.delayedCall(Utils.fixedInt(250), () => {
|
||||
this.pokemon.cry();
|
||||
if (isShiny) {
|
||||
this.scene.time.delayedCall(Utils.fixedInt(1250), () => {
|
||||
this.scene.time.delayedCall(Utils.fixedInt(500), () => {
|
||||
this.pokemonShinySparkle.play('sparkle');
|
||||
this.scene.playSound('sparkle');
|
||||
});
|
||||
}
|
||||
this.scene.time.delayedCall(Utils.fixedInt(!isShiny ? 1250 : 1750), () => {
|
||||
this.infoContainer.show(this.pokemon);
|
||||
this.scene.time.delayedCall(Utils.fixedInt(!this.skipped ? !isShiny ? 1250 : 1750 : !isShiny ? 250 : 750), () => {
|
||||
this.infoContainer.show(this.pokemon, false, this.skipped ? 2 : 1);
|
||||
|
||||
this.scene.playSoundWithoutBgm('evolution_fanfare');
|
||||
|
||||
|
@ -245,12 +264,11 @@ export class EggHatchPhase extends Phase {
|
|||
});
|
||||
});
|
||||
this.scene.tweens.add({
|
||||
duration: Utils.fixedInt(3000),
|
||||
duration: Utils.fixedInt(this.skipped ? 500 : 3000),
|
||||
targets: this.eggHatchOverlay,
|
||||
alpha: 0,
|
||||
ease: 'Cubic.easeOut'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
sin(index: integer, amplitude: integer): number {
|
||||
|
@ -288,14 +306,15 @@ export class EggHatchPhase extends Phase {
|
|||
});
|
||||
|
||||
const updateParticle = () => {
|
||||
yOffset++;
|
||||
const speedMultiplier = this.skipped ? 6 : 1;
|
||||
yOffset += speedMultiplier;
|
||||
if (trigIndex < 160) {
|
||||
particle.setPosition(initialX + (speed * f) / 3, initialY + yOffset);
|
||||
particle.y += -this.sin(trigIndex, amp);
|
||||
if (f > 108)
|
||||
particle.setScale((1 - (f - 108) / 20));
|
||||
trigIndex += 2;
|
||||
f++;
|
||||
trigIndex += 2 * speedMultiplier;
|
||||
f += speedMultiplier;
|
||||
} else {
|
||||
particle.destroy();
|
||||
particleTimer.remove();
|
||||
|
|
|
@ -973,11 +973,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.scene.fieldUI.moveAbove(this.battleInfo, otherBattleInfo);
|
||||
this.battleInfo.setX(this.battleInfo.x + (this.isPlayer() ? 150 : !this.isBoss() ? -150 : -198));
|
||||
this.battleInfo.setVisible(true);
|
||||
if (this.isPlayer())
|
||||
this.battleInfo.expMaskRect.x += 150;
|
||||
this.scene.tweens.add({
|
||||
targets: this.battleInfo,
|
||||
targets: [ this.battleInfo, this.battleInfo.expMaskRect ],
|
||||
x: this.isPlayer() ? '-=150' : `+=${!this.isBoss() ? 150 : 246}`,
|
||||
duration: 1000,
|
||||
ease: 'Sine.easeOut'
|
||||
ease: 'Cubic.easeOut'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -986,11 +988,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
return new Promise(resolve => {
|
||||
if (this.battleInfo.visible) {
|
||||
this.scene.tweens.add({
|
||||
targets: this.battleInfo,
|
||||
targets: [ this.battleInfo, this.battleInfo.expMaskRect ],
|
||||
x: this.isPlayer() ? '+=150' : `-=${!this.isBoss() ? 150 : 246}`,
|
||||
duration: 500,
|
||||
ease: 'Sine.easeIn',
|
||||
ease: 'Cubic.easeIn',
|
||||
onComplete: () => {
|
||||
if (this.isPlayer())
|
||||
this.battleInfo.expMaskRect.x -= 150;
|
||||
this.battleInfo.setVisible(false);
|
||||
this.battleInfo.setX(this.battleInfo.x - (this.isPlayer() ? 150 : !this.isBoss() ? -150 : -198));
|
||||
resolve();
|
||||
|
|
|
@ -40,7 +40,8 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||
private type1Icon: Phaser.GameObjects.Sprite;
|
||||
private type2Icon: Phaser.GameObjects.Sprite;
|
||||
private expBar: Phaser.GameObjects.Image;
|
||||
private expMaskRect: Phaser.GameObjects.Graphics;
|
||||
|
||||
public expMaskRect: Phaser.GameObjects.Graphics;
|
||||
|
||||
constructor(scene: Phaser.Scene, x: number, y: number, player: boolean) {
|
||||
super(scene, x, y);
|
||||
|
|
|
@ -109,7 +109,7 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
|
|||
this.setVisible(false);
|
||||
}
|
||||
|
||||
show(pokemon: Pokemon, showMoves: boolean = false): Promise<void> {
|
||||
show(pokemon: Pokemon, showMoves: boolean = false, speedMultiplier: number = 1): Promise<void> {
|
||||
return new Promise<void>(resolve => {
|
||||
if (pokemon.gender > Gender.GENDERLESS) {
|
||||
this.pokemonGenderText.setText(getGenderSymbol(pokemon.gender));
|
||||
|
@ -136,7 +136,7 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
|
|||
|
||||
this.scene.tweens.add({
|
||||
targets: this,
|
||||
duration: Utils.fixedInt(750),
|
||||
duration: Utils.fixedInt(Math.floor(750 / speedMultiplier)),
|
||||
ease: 'Cubic.easeInOut',
|
||||
x: this.initialX - 104,
|
||||
onComplete: () => {
|
||||
|
@ -146,9 +146,9 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
|
|||
|
||||
if (showMoves) {
|
||||
this.scene.tweens.add({
|
||||
delay: Utils.fixedInt(325),
|
||||
delay: Utils.fixedInt(Math.floor(325 / speedMultiplier)),
|
||||
targets: this.pokemonMovesContainer,
|
||||
duration: Utils.fixedInt(325),
|
||||
duration: Utils.fixedInt(Math.floor(325 / speedMultiplier)),
|
||||
ease: 'Cubic.easeInOut',
|
||||
x: this.movesContainerInitialX - 57,
|
||||
onComplete: () => resolve()
|
||||
|
@ -167,21 +167,21 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
|
|||
});
|
||||
}
|
||||
|
||||
hide(): Promise<void> {
|
||||
hide(speedMultiplier: number = 1): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
if (!this.shown)
|
||||
return resolve();
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this.pokemonMovesContainer,
|
||||
duration: Utils.fixedInt(750),
|
||||
duration: Utils.fixedInt(Math.floor(750 / speedMultiplier)),
|
||||
ease: 'Cubic.easeInOut',
|
||||
x: this.movesContainerInitialX
|
||||
});
|
||||
|
||||
this.scene.tweens.add({
|
||||
targets: this,
|
||||
duration: Utils.fixedInt(750),
|
||||
duration: Utils.fixedInt(Math.floor(750 / speedMultiplier)),
|
||||
ease: 'Cubic.easeInOut',
|
||||
x: this.initialX,
|
||||
onComplete: () => {
|
||||
|
|
Loading…
Reference in New Issue