Adjust game volume
parent
c2cb433409
commit
96a15ccb0d
|
@ -98,7 +98,7 @@ export class SelectStarterPhase extends BattlePhase {
|
||||||
start() {
|
start() {
|
||||||
super.start();
|
super.start();
|
||||||
|
|
||||||
this.scene.sound.play('menu', { loop: true });
|
this.scene.playSound('menu', { loop: true });
|
||||||
|
|
||||||
this.scene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => {
|
this.scene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => {
|
||||||
const party = this.scene.getParty();
|
const party = this.scene.getParty();
|
||||||
|
@ -619,7 +619,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
||||||
angle: 1440,
|
angle: 1440,
|
||||||
y: (this.player ? 132 : 86) + fpOffset[1],
|
y: (this.player ? 132 : 86) + fpOffset[1],
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.scene.sound.play('pb_rel');
|
this.scene.playSound('pb_rel');
|
||||||
pokeball.destroy();
|
pokeball.destroy();
|
||||||
this.scene.add.existing(pokemon);
|
this.scene.add.existing(pokemon);
|
||||||
this.scene.field.add(pokemon);
|
this.scene.field.add(pokemon);
|
||||||
|
@ -701,7 +701,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
||||||
this.scene.getEnemyField().forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id));
|
this.scene.getEnemyField().forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id));
|
||||||
|
|
||||||
this.scene.ui.showText(this.player ? `Come back, ${pokemon.name}!` : `${this.scene.currentBattle.trainer.getName()}\nwithdrew ${pokemon.name}!`);
|
this.scene.ui.showText(this.player ? `Come back, ${pokemon.name}!` : `${this.scene.currentBattle.trainer.getName()}\nwithdrew ${pokemon.name}!`);
|
||||||
this.scene.sound.play('pb_rel');
|
this.scene.playSound('pb_rel');
|
||||||
pokemon.hideInfo();
|
pokemon.hideInfo();
|
||||||
pokemon.tint(getPokeballTintColor(pokemon.pokeball), 1, 250, 'Sine.easeIn');
|
pokemon.tint(getPokeballTintColor(pokemon.pokeball), 1, 250, 'Sine.easeIn');
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
|
@ -1708,7 +1708,7 @@ export class StatChangePhase extends PokemonPhase {
|
||||||
statSprite.setScale(6);
|
statSprite.setScale(6);
|
||||||
statSprite.setOrigin(0.5, 1);
|
statSprite.setOrigin(0.5, 1);
|
||||||
|
|
||||||
this.scene.sound.play(`stat_${this.levels >= 1 ? 'up' : 'down'}`);
|
this.scene.playSound(`stat_${this.levels >= 1 ? 'up' : 'down'}`);
|
||||||
|
|
||||||
statSprite.setMask(new Phaser.Display.Masks.BitmapMask(this.scene, pokemonMaskSprite));
|
statSprite.setMask(new Phaser.Display.Masks.BitmapMask(this.scene, pokemonMaskSprite));
|
||||||
|
|
||||||
|
@ -1904,13 +1904,13 @@ export class DamagePhase extends PokemonPhase {
|
||||||
|
|
||||||
switch (this.damageResult) {
|
switch (this.damageResult) {
|
||||||
case HitResult.EFFECTIVE:
|
case HitResult.EFFECTIVE:
|
||||||
this.scene.sound.play('hit');
|
this.scene.playSound('hit');
|
||||||
break;
|
break;
|
||||||
case HitResult.SUPER_EFFECTIVE:
|
case HitResult.SUPER_EFFECTIVE:
|
||||||
this.scene.sound.play('hit_strong');
|
this.scene.playSound('hit_strong');
|
||||||
break;
|
break;
|
||||||
case HitResult.NOT_VERY_EFFECTIVE:
|
case HitResult.NOT_VERY_EFFECTIVE:
|
||||||
this.scene.sound.play('hit_weak');
|
this.scene.playSound('hit_weak');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1974,7 +1974,7 @@ export class FaintPhase extends PokemonPhase {
|
||||||
|
|
||||||
pokemon.faintCry(() => {
|
pokemon.faintCry(() => {
|
||||||
pokemon.hideInfo();
|
pokemon.hideInfo();
|
||||||
this.scene.sound.play('faint');
|
this.scene.playSound('faint');
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: pokemon,
|
targets: pokemon,
|
||||||
duration: 500,
|
duration: 500,
|
||||||
|
@ -2189,7 +2189,7 @@ export class UnlockPhase extends BattlePhase {
|
||||||
this.scene.time.delayedCall(2000, () => {
|
this.scene.time.delayedCall(2000, () => {
|
||||||
this.scene.gameData.unlocks[this.unlockable] = true;
|
this.scene.gameData.unlocks[this.unlockable] = true;
|
||||||
this.scene.gameData.saveSystem();
|
this.scene.gameData.saveSystem();
|
||||||
this.scene.sound.play('level_up_fanfare');
|
this.scene.playSound('level_up_fanfare');
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.arenaBg.setVisible(false);
|
this.scene.arenaBg.setVisible(false);
|
||||||
this.scene.ui.fadeIn(250).then(() => {
|
this.scene.ui.fadeIn(250).then(() => {
|
||||||
|
@ -2536,7 +2536,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
this.pokeball.setOrigin(0.5, 0.625);
|
this.pokeball.setOrigin(0.5, 0.625);
|
||||||
this.scene.field.add(this.pokeball);
|
this.scene.field.add(this.pokeball);
|
||||||
|
|
||||||
this.scene.sound.play('pb_throw');
|
this.scene.playSound('pb_throw');
|
||||||
this.scene.time.delayedCall(300, () => {
|
this.scene.time.delayedCall(300, () => {
|
||||||
this.scene.field.moveBelow(this.pokeball as Phaser.GameObjects.GameObject, pokemon);
|
this.scene.field.moveBelow(this.pokeball as Phaser.GameObjects.GameObject, pokemon);
|
||||||
});
|
});
|
||||||
|
@ -2548,7 +2548,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.pokeball.setTexture('pb', `${pokeballAtlasKey}_opening`);
|
this.pokeball.setTexture('pb', `${pokeballAtlasKey}_opening`);
|
||||||
this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}_open`));
|
this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}_open`));
|
||||||
this.scene.sound.play('pb_rel');
|
this.scene.playSound('pb_rel');
|
||||||
pokemon.tint(getPokeballTintColor(this.pokeballType));
|
pokemon.tint(getPokeballTintColor(this.pokeballType));
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: pokemon,
|
targets: pokemon,
|
||||||
|
@ -2559,7 +2559,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.pokeball.setTexture('pb', `${pokeballAtlasKey}_opening`);
|
this.pokeball.setTexture('pb', `${pokeballAtlasKey}_opening`);
|
||||||
pokemon.setVisible(false);
|
pokemon.setVisible(false);
|
||||||
this.scene.sound.play('pb_catch');
|
this.scene.playSound('pb_catch');
|
||||||
this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}`));
|
this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}`));
|
||||||
|
|
||||||
const doShake = pokeballMultiplier > -1 ? () => {
|
const doShake = pokeballMultiplier > -1 ? () => {
|
||||||
|
@ -2587,13 +2587,13 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
this.failCatch(shakeCount);
|
this.failCatch(shakeCount);
|
||||||
} else if (shakeCount++ < 3) {
|
} else if (shakeCount++ < 3) {
|
||||||
if (Utils.randInt(65536) < y)
|
if (Utils.randInt(65536) < y)
|
||||||
this.scene.sound.play('pb_move');
|
this.scene.playSound('pb_move');
|
||||||
else {
|
else {
|
||||||
shakeCounter.stop();
|
shakeCounter.stop();
|
||||||
this.failCatch(shakeCount);
|
this.failCatch(shakeCount);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
this.scene.sound.play('pb_lock')
|
this.scene.playSound('pb_lock')
|
||||||
},
|
},
|
||||||
onComplete: () => this.catch()
|
onComplete: () => this.catch()
|
||||||
});
|
});
|
||||||
|
@ -2609,7 +2609,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
failCatch(shakeCount: integer) {
|
failCatch(shakeCount: integer) {
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
this.scene.sound.play('pb_rel');
|
this.scene.playSound('pb_rel');
|
||||||
pokemon.setY(this.originalY);
|
pokemon.setY(this.originalY);
|
||||||
pokemon.cry();
|
pokemon.cry();
|
||||||
pokemon.tint(getPokeballTintColor(this.pokeballType));
|
pokemon.tint(getPokeballTintColor(this.pokeballType));
|
||||||
|
@ -2713,7 +2713,7 @@ export class AttemptRunPhase extends PokemonPhase {
|
||||||
const escapeChance = (((playerPokemon.stats[Stat.SPD] * 128) / enemySpeed) + (30 * this.scene.currentBattle.escapeAttempts++)) % 256;
|
const escapeChance = (((playerPokemon.stats[Stat.SPD] * 128) / enemySpeed) + (30 * this.scene.currentBattle.escapeAttempts++)) % 256;
|
||||||
|
|
||||||
if (Utils.randInt(256) < escapeChance) {
|
if (Utils.randInt(256) < escapeChance) {
|
||||||
this.scene.sound.play('flee');
|
this.scene.playSound('flee');
|
||||||
this.scene.queueMessage('You got away safely!', null, true, 500);
|
this.scene.queueMessage('You got away safely!', null, true, 500);
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
|
@ -2838,7 +2838,7 @@ export class PartyHealPhase extends BattlePhase {
|
||||||
pokemon.updateInfo(true);
|
pokemon.updateInfo(true);
|
||||||
}
|
}
|
||||||
const healSong = this.scene.sound.add('heal');
|
const healSong = this.scene.sound.add('heal');
|
||||||
healSong.play();
|
healSong.play({ volume: this.scene.gameVolume });
|
||||||
this.scene.time.delayedCall(healSong.totalDuration * 1000, () => {
|
this.scene.time.delayedCall(healSong.totalDuration * 1000, () => {
|
||||||
healSong.destroy();
|
healSong.destroy();
|
||||||
if (this.resumeBgm && bgmPlaying)
|
if (this.resumeBgm && bgmPlaying)
|
||||||
|
|
|
@ -59,10 +59,11 @@ export interface PokeballCounts {
|
||||||
|
|
||||||
export default class BattleScene extends Phaser.Scene {
|
export default class BattleScene extends Phaser.Scene {
|
||||||
public auto: boolean;
|
public auto: boolean;
|
||||||
|
public gameVolume: number = 0.5;
|
||||||
public gameSpeed: integer = 1;
|
public gameSpeed: integer = 1;
|
||||||
public quickStart: boolean = quickStart;
|
public quickStart: boolean = quickStart;
|
||||||
public finalWave: integer = 200;
|
public finalWave: integer = 200;
|
||||||
|
|
||||||
public gameData: GameData;
|
public gameData: GameData;
|
||||||
|
|
||||||
private phaseQueue: BattlePhase[];
|
private phaseQueue: BattlePhase[];
|
||||||
|
@ -811,7 +812,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
if (this.bgm && bgmName === this.bgm.key) {
|
if (this.bgm && bgmName === this.bgm.key) {
|
||||||
if (!this.bgm.isPlaying) {
|
if (!this.bgm.isPlaying) {
|
||||||
this.bgm.play({
|
this.bgm.play({
|
||||||
volume: 1
|
volume: this.gameVolume
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -827,14 +828,16 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
const playNewBgm = () => {
|
const playNewBgm = () => {
|
||||||
if (bgmName === null && this.bgm && !this.bgm.pendingRemove) {
|
if (bgmName === null && this.bgm && !this.bgm.pendingRemove) {
|
||||||
this.bgm.play({
|
this.bgm.play({
|
||||||
volume: 1
|
volume: this.gameVolume
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPlaying)
|
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPlaying)
|
||||||
this.bgm.stop();
|
this.bgm.stop();
|
||||||
this.bgm = this.sound.add(bgmName, { loop: true });
|
this.bgm = this.sound.add(bgmName, { loop: true });
|
||||||
this.bgm.play();
|
this.bgm.play({
|
||||||
|
volume: this.gameVolume
|
||||||
|
});
|
||||||
if (loopPoint)
|
if (loopPoint)
|
||||||
this.bgm.on('looped', () => this.bgm.play({ seek: loopPoint }));
|
this.bgm.on('looped', () => this.bgm.play({ seek: loopPoint }));
|
||||||
};
|
};
|
||||||
|
@ -875,9 +878,20 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
SoundFade.fadeOut(this, bgm, duration, destroy);
|
SoundFade.fadeOut(this, bgm, duration, destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playSound(soundName: string, config?: object) {
|
||||||
|
if (config) {
|
||||||
|
if (config.hasOwnProperty('volume'))
|
||||||
|
config['volume'] *= this.gameVolume;
|
||||||
|
else
|
||||||
|
config['volume'] = this.gameVolume;
|
||||||
|
} else
|
||||||
|
config = { volume: this.gameVolume };
|
||||||
|
this.sound.play(soundName, config);
|
||||||
|
}
|
||||||
|
|
||||||
playSoundWithoutBgm(soundName: string, pauseDuration?: integer): void {
|
playSoundWithoutBgm(soundName: string, pauseDuration?: integer): void {
|
||||||
this.pauseBgm();
|
this.pauseBgm();
|
||||||
this.sound.play(soundName);
|
this.playSound(soundName);
|
||||||
const sound = this.sound.get(soundName);
|
const sound = this.sound.get(soundName);
|
||||||
if (this.bgmResumeTimer)
|
if (this.bgmResumeTimer)
|
||||||
this.bgmResumeTimer.destroy();
|
this.bgmResumeTimer.destroy();
|
||||||
|
@ -976,7 +990,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
if (modifier instanceof PersistentModifier) {
|
if (modifier instanceof PersistentModifier) {
|
||||||
if ((modifier as PersistentModifier).add(this.modifiers, !!virtual)) {
|
if ((modifier as PersistentModifier).add(this.modifiers, !!virtual)) {
|
||||||
if (playSound && !this.sound.get(soundName))
|
if (playSound && !this.sound.get(soundName))
|
||||||
this.sound.play(soundName);
|
this.playSound(soundName);
|
||||||
} else if (!virtual) {
|
} else if (!virtual) {
|
||||||
const defaultModifierType = getDefaultModifierTypeForTier(modifier.type.tier);
|
const defaultModifierType = getDefaultModifierTypeForTier(modifier.type.tier);
|
||||||
this.addModifier(defaultModifierType.newModifier(), playSound).then(() => resolve());
|
this.addModifier(defaultModifierType.newModifier(), playSound).then(() => resolve());
|
||||||
|
@ -988,7 +1002,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.updateModifiers().then(() => resolve());
|
this.updateModifiers().then(() => resolve());
|
||||||
} else if (modifier instanceof ConsumableModifier) {
|
} else if (modifier instanceof ConsumableModifier) {
|
||||||
if (playSound && !this.sound.get(soundName))
|
if (playSound && !this.sound.get(soundName))
|
||||||
this.sound.play(soundName);
|
this.playSound(soundName);
|
||||||
|
|
||||||
if (modifier instanceof ConsumablePokemonModifier) {
|
if (modifier instanceof ConsumablePokemonModifier) {
|
||||||
for (let p in this.party) {
|
for (let p in this.party) {
|
||||||
|
|
|
@ -236,7 +236,7 @@ class AnimTimedSoundEvent extends AnimTimedEvent {
|
||||||
const soundConfig = { rate: (this.pitch * 0.01), volume: (this.volume * 0.01) };
|
const soundConfig = { rate: (this.pitch * 0.01), volume: (this.volume * 0.01) };
|
||||||
if (this.resourceName) {
|
if (this.resourceName) {
|
||||||
try {
|
try {
|
||||||
scene.sound.play(this.resourceName, soundConfig);
|
scene.playSound(this.resourceName, soundConfig);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ export function doPokeballBounceAnim(scene: BattleScene, pokeball: Phaser.GameOb
|
||||||
duration: bouncePower * baseBounceDuration,
|
duration: bouncePower * baseBounceDuration,
|
||||||
ease: 'Cubic.easeIn',
|
ease: 'Cubic.easeIn',
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
scene.sound.play('pb_bounce_1', { volume: bouncePower });
|
scene.playSound('pb_bounce_1', { volume: bouncePower });
|
||||||
|
|
||||||
bouncePower = bouncePower > 0.01 ? bouncePower * 0.5 : 0;
|
bouncePower = bouncePower > 0.01 ? bouncePower * 0.5 : 0;
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ export abstract class PokemonSpeciesForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
cry(scene: BattleScene, soundConfig?: Phaser.Types.Sound.SoundConfig): integer {
|
cry(scene: BattleScene, soundConfig?: Phaser.Types.Sound.SoundConfig): integer {
|
||||||
scene.sound.play(this.speciesId.toString(), soundConfig);
|
scene.playSound(this.speciesId.toString(), soundConfig);
|
||||||
return scene.sound.get(this.speciesId.toString()).totalDuration * 1000;
|
return scene.sound.get(this.speciesId.toString()).totalDuration * 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
|
|
||||||
this.scene.time.delayedCall(1000, () => {
|
this.scene.time.delayedCall(1000, () => {
|
||||||
const evolutionBgm = this.scene.sound.add('evolution');
|
const evolutionBgm = this.scene.sound.add('evolution');
|
||||||
evolutionBgm.play();
|
evolutionBgm.play({ volume: this.scene.gameVolume });
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.evolutionBgOverlay,
|
targets: this.evolutionBgOverlay,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
|
@ -119,7 +119,7 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
this.evolutionBg.setVisible(true);
|
this.evolutionBg.setVisible(true);
|
||||||
this.evolutionBg.play();
|
this.evolutionBg.play();
|
||||||
});
|
});
|
||||||
this.scene.sound.play('charge');
|
this.scene.playSound('charge');
|
||||||
this.doSpiralUpward();
|
this.doSpiralUpward();
|
||||||
this.scene.tweens.addCounter({
|
this.scene.tweens.addCounter({
|
||||||
from: 0,
|
from: 0,
|
||||||
|
@ -131,17 +131,17 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.pokemonSprite.setVisible(false);
|
this.pokemonSprite.setVisible(false);
|
||||||
this.scene.time.delayedCall(1100, () => {
|
this.scene.time.delayedCall(1100, () => {
|
||||||
this.scene.sound.play('beam');
|
this.scene.playSound('beam');
|
||||||
this.doArcDownward();
|
this.doArcDownward();
|
||||||
this.scene.time.delayedCall(1500, () => {
|
this.scene.time.delayedCall(1500, () => {
|
||||||
this.pokemonEvoTintSprite.setScale(0.25);
|
this.pokemonEvoTintSprite.setScale(0.25);
|
||||||
this.pokemonEvoTintSprite.setVisible(true);
|
this.pokemonEvoTintSprite.setVisible(true);
|
||||||
this.doCycle(1).then(() => {
|
this.doCycle(1).then(() => {
|
||||||
this.scene.sound.play('sparkle');
|
this.scene.playSound('sparkle');
|
||||||
this.pokemonEvoSprite.setVisible(true);
|
this.pokemonEvoSprite.setVisible(true);
|
||||||
this.doCircleInward();
|
this.doCircleInward();
|
||||||
this.scene.time.delayedCall(900, () => {
|
this.scene.time.delayedCall(900, () => {
|
||||||
this.scene.sound.play('shine');
|
this.scene.playSound('shine');
|
||||||
this.doSpray();
|
this.doSpray();
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.evolutionOverlay,
|
targets: this.evolutionOverlay,
|
||||||
|
@ -167,7 +167,7 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
this.scene.time.delayedCall(250, () => {
|
this.scene.time.delayedCall(250, () => {
|
||||||
pokemon.cry();
|
pokemon.cry();
|
||||||
this.scene.time.delayedCall(1250, () => {
|
this.scene.time.delayedCall(1250, () => {
|
||||||
this.scene.sound.play('evolution_fanfare');
|
this.scene.playSound('evolution_fanfare');
|
||||||
this.scene.ui.showText(`Congratulations! Your ${preName}\nevolved into ${pokemon.name}!`, null, () => this.end(), null, true, 3000);
|
this.scene.ui.showText(`Congratulations! Your ${preName}\nevolved into ${pokemon.name}!`, null, () => this.end(), null, true, 3000);
|
||||||
this.scene.time.delayedCall(new Utils.FixedInt(4250) as unknown as integer, () => this.scene.playBgm());
|
this.scene.time.delayedCall(new Utils.FixedInt(4250) as unknown as integer, () => this.scene.playBgm());
|
||||||
});
|
});
|
||||||
|
|
|
@ -874,9 +874,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
const key = this.species.speciesId.toString();
|
const key = this.species.speciesId.toString();
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let rate = 0.85;
|
let rate = 0.85;
|
||||||
this.scene.sound.play(key, {
|
this.scene.playSound(key, { rate: rate });
|
||||||
rate: rate
|
|
||||||
});
|
|
||||||
const sprite = this.getSprite();
|
const sprite = this.getSprite();
|
||||||
const tintSprite = this.getTintSprite();
|
const tintSprite = this.getTintSprite();
|
||||||
const delay = Math.max(this.scene.sound.get(key).totalDuration * 50, 25);
|
const delay = Math.max(this.scene.sound.get(key).totalDuration * 50, 25);
|
||||||
|
@ -903,7 +901,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
rate *= 0.99;
|
rate *= 0.99;
|
||||||
crySound.play({
|
crySound.play({
|
||||||
rate: rate,
|
rate: rate,
|
||||||
seek: (i * delay * 0.001) * rate
|
seek: (i * delay * 0.001) * rate,
|
||||||
|
volume: this.scene.gameVolume
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1060,7 +1059,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
sparkle(): void {
|
sparkle(): void {
|
||||||
if (this.shinySparkle) {
|
if (this.shinySparkle) {
|
||||||
this.shinySparkle.play('sparkle');
|
this.shinySparkle.play('sparkle');
|
||||||
this.scene.sound.play('sparkle');
|
this.scene.playSound('sparkle');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
let duration = this.visible && !instant ? ((levelExp - this.lastLevelExp) / relLevelExp) * 1650 : 0;
|
let duration = this.visible && !instant ? ((levelExp - this.lastLevelExp) / relLevelExp) * 1650 : 0;
|
||||||
if (duration)
|
if (duration)
|
||||||
this.scene.sound.play('exp');
|
(this.scene as BattleScene).playSound('exp');
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.expBar,
|
targets: this.expBar,
|
||||||
ease: 'Sine.easeIn',
|
ease: 'Sine.easeIn',
|
||||||
|
@ -289,7 +289,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
||||||
if (ratio === 1) {
|
if (ratio === 1) {
|
||||||
this.lastLevelExp = 0;
|
this.lastLevelExp = 0;
|
||||||
this.lastLevel++;
|
this.lastLevel++;
|
||||||
this.scene.sound.play('level_up');
|
(this.scene as BattleScene).playSound('level_up');
|
||||||
this.setLevel(this.lastLevel);
|
this.setLevel(this.lastLevel);
|
||||||
this.scene.time.delayedCall(500, () => {
|
this.scene.time.delayedCall(500, () => {
|
||||||
this.expBar.setScale(0, 1);
|
this.expBar.setScale(0, 1);
|
||||||
|
|
|
@ -72,7 +72,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
|
||||||
this.message.setText(text.slice(0, charIndex));
|
this.message.setText(text.slice(0, charIndex));
|
||||||
const advance = () => {
|
const advance = () => {
|
||||||
if (charSound)
|
if (charSound)
|
||||||
this.scene.sound.play(charSound);
|
this.scene.playSound(charSound);
|
||||||
if (callback && !this.textTimer.repeatCount) {
|
if (callback && !this.textTimer.repeatCount) {
|
||||||
if (callbackDelay && !prompt) {
|
if (callbackDelay && !prompt) {
|
||||||
this.textCallbackTimer = this.scene.time.delayedCall(callbackDelay, () => {
|
this.textCallbackTimer = this.scene.time.delayedCall(callbackDelay, () => {
|
||||||
|
|
|
@ -313,7 +313,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
||||||
return;
|
return;
|
||||||
const value = t.getValue();
|
const value = t.getValue();
|
||||||
if (!bounce && value > lastValue) {
|
if (!bounce && value > lastValue) {
|
||||||
this.scene.sound.play('pb_bounce_1', { volume: 1 / ++bounceCount });
|
(this.scene as BattleScene).playSound('pb_bounce_1', { volume: 1 / ++bounceCount });
|
||||||
bounce = true;
|
bounce = true;
|
||||||
} else if (bounce && value < lastValue)
|
} else if (bounce && value < lastValue)
|
||||||
bounce = false;
|
bounce = false;
|
||||||
|
@ -323,7 +323,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
if (this.modifierTypeOption.upgraded) {
|
if (this.modifierTypeOption.upgraded) {
|
||||||
this.scene.time.delayedCall(remainingDuration, () => {
|
this.scene.time.delayedCall(remainingDuration, () => {
|
||||||
this.scene.sound.play('upgrade');
|
(this.scene as BattleScene).playSound('upgrade');
|
||||||
this.pbTint.setPosition(this.pb.x, this.pb.y);
|
this.pbTint.setPosition(this.pb.x, this.pb.y);
|
||||||
this.pbTint.setTintFill(0xFFFFFF);
|
this.pbTint.setTintFill(0xFFFFFF);
|
||||||
this.pbTint.setAlpha(0);
|
this.pbTint.setAlpha(0);
|
||||||
|
@ -354,7 +354,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.pb.setTexture('pb', `${this.getPbAtlasKey(false)}_open`);
|
this.pb.setTexture('pb', `${this.getPbAtlasKey(false)}_open`);
|
||||||
this.scene.sound.play('pb_rel');
|
(this.scene as BattleScene).playSound('pb_rel');
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.pb,
|
targets: this.pb,
|
||||||
|
|
|
@ -55,7 +55,7 @@ export default class PokeballTray extends Phaser.GameObjects.Container {
|
||||||
ball.setFrame(ballFrame);
|
ball.setFrame(ballFrame);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.scene.sound.play('pb_tray_enter');
|
(this.scene as BattleScene).playSound('pb_tray_enter');
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this,
|
targets: this,
|
||||||
|
@ -69,7 +69,7 @@ export default class PokeballTray extends Phaser.GameObjects.Container {
|
||||||
x: `${this.player ? '-' : '+'}=104`,
|
x: `${this.player ? '-' : '+'}=104`,
|
||||||
duration: b * 100,
|
duration: b * 100,
|
||||||
ease: 'Sine.easeIn',
|
ease: 'Sine.easeIn',
|
||||||
onComplete: () => this.scene.sound.play(b < party.length ? 'pb_tray_ball' : 'pb_tray_empty')
|
onComplete: () => (this.scene as BattleScene).playSound(b < party.length ? 'pb_tray_ball' : 'pb_tray_empty')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,7 +325,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
if (this.canCycleShiny) {
|
if (this.canCycleShiny) {
|
||||||
this.setSpeciesDetails(this.lastSpecies, !this.shinyCursor, undefined, undefined, undefined);
|
this.setSpeciesDetails(this.lastSpecies, !this.shinyCursor, undefined, undefined, undefined);
|
||||||
if (this.shinyCursor)
|
if (this.shinyCursor)
|
||||||
this.scene.sound.play('sparkle');
|
this.scene.playSound('sparkle');
|
||||||
else
|
else
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,11 +129,11 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
playSelect(): void {
|
playSelect(): void {
|
||||||
this.scene.sound.play('select');
|
(this.scene as BattleScene).playSound('select');
|
||||||
}
|
}
|
||||||
|
|
||||||
playError(): void {
|
playError(): void {
|
||||||
this.scene.sound.play('error');
|
(this.scene as BattleScene).playSound('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
fadeOut(duration: integer): Promise<void> {
|
fadeOut(duration: integer): Promise<void> {
|
||||||
|
|
Loading…
Reference in New Issue