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