Update Phaser version

This commit is contained in:
Flashfyre 2023-11-10 16:41:02 -05:00
parent 83fae68abf
commit 55a61158cf
6 changed files with 29 additions and 26 deletions

View File

@ -16,7 +16,7 @@
"vite-plugin-fs": "^1.0.0-beta.6"
},
"dependencies": {
"phaser": "^3.61.0-beta.2",
"phaser": "^3.70.0",
"phaser3-rex-plugins": "^1.1.84"
}
}

View File

@ -973,13 +973,13 @@ export default class BattleScene extends Phaser.Scene {
: this.getBgmLoopPoint(bgmName);
let loaded = false;
const playNewBgm = () => {
if (bgmName === null && this.bgm && !this.bgm.pendingRemove) {
if (bgmName === null && this.bgm) {
this.bgm.play({
volume: this.masterVolume * this.bgmVolume
});
return;
}
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPlaying)
if (this.bgm && this.bgm.isPlaying)
this.bgm.stop();
this.bgm = this.sound.add(bgmName, { loop: true });
this.bgm.play({
@ -995,7 +995,7 @@ export default class BattleScene extends Phaser.Scene {
});
if (fadeOut) {
const onBgmFaded = () => {
if (loaded && (!this.bgm.isPlaying || this.bgm.pendingRemove))
if (loaded && !this.bgm.isPlaying)
playNewBgm();
};
this.time.delayedCall(this.fadeOutBgm(500, true) ? 750 : 250, onBgmFaded);
@ -1005,7 +1005,7 @@ export default class BattleScene extends Phaser.Scene {
}
pauseBgm(): boolean {
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPlaying) {
if (this.bgm && this.bgm.isPlaying) {
this.bgm.pause();
return true;
}
@ -1013,7 +1013,7 @@ export default class BattleScene extends Phaser.Scene {
}
resumeBgm(): boolean {
if (this.bgm && !this.bgm.pendingRemove && this.bgm.isPaused) {
if (this.bgm && this.bgm.isPaused) {
this.bgm.resume();
return true;
}

View File

@ -1088,8 +1088,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (cry && !cry.pendingRemove) {
rate *= 0.99;
cry.setRate(rate);
}
else {
} else {
faintCryTimer.destroy();
faintCryTimer = null;
if (callback)

View File

@ -13,7 +13,12 @@ export default class Trainer extends Phaser.GameObjects.Container {
super(scene, -72, 80);
this.config = trainerConfigs[trainerType];
this.female = female;
this.partyTemplateIndex = Math.min(partyTemplateIndex !== undefined ? partyTemplateIndex : Phaser.Math.RND.weightedPick(this.config.partyTemplates.map((_, i) => i)), this.config.partyTemplates.length - 1);
this.partyTemplateIndex = Math.min(partyTemplateIndex !== undefined ? partyTemplateIndex : Phaser.Math.RND.weightedPick(this.config.partyTemplates.map((_, i) => i)),
this.config.partyTemplates.length - 1);
// TODO: Remove when Phaser weightedPick bug is fixed
if (isNaN(this.partyTemplateIndex))
this.partyTemplateIndex = this.config.partyTemplates.length - 1;
console.log(Object.keys(trainerPartyTemplates)[Object.values(trainerPartyTemplates).indexOf(this.getPartyTemplate())]);

View File

@ -255,23 +255,22 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
onComplete: () => options.forEach(o => o.destroy())
});
if (this.transferButtonContainer.visible) {
this.scene.tweens.add({
targets: [ this.rerollButtonContainer, this.transferButtonContainer ],
alpha: 0,
duration: 250,
ease: 'Cubic.easeIn',
onComplete: () => {
if (!this.options.length) {
this.rerollButtonContainer.setVisible(false);
this.transferButtonContainer.setVisible(false);
} else {
this.rerollButtonContainer.setAlpha(1);
this.transferButtonContainer.setAlpha(1);
[ this.rerollButtonContainer, this.transferButtonContainer ].forEach(container => {
if (container.visible) {
this.scene.tweens.add({
targets: container,
alpha: 0,
duration: 250,
ease: 'Cubic.easeIn',
onComplete: () => {
if (!this.options.length)
container.setVisible(false);
else
container.setAlpha(1);
}
}
})
}
});
}
});
}
eraseCursor() {

View File

@ -221,7 +221,7 @@ export default class PartyUiHandler extends MessageUiHandler {
let filterResult: string;
if (option !== PartyOption.TRANSFER && option !== PartyOption.SPLICE) {
filterResult = (this.selectFilter as PokemonSelectFilter)(pokemon);
if (option === PartyOption.TRANSFER && filterResult === null && this.partyUiMode === PartyUiMode.MOVE_MODIFIER)
if (filterResult === null && this.partyUiMode === PartyUiMode.MOVE_MODIFIER)
filterResult = this.moveSelectFilter(pokemon.moveset[this.optionsCursor]);
} else {
const transferPokemon = this.scene.getParty()[this.transferCursor];