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" "vite-plugin-fs": "^1.0.0-beta.6"
}, },
"dependencies": { "dependencies": {
"phaser": "^3.61.0-beta.2", "phaser": "^3.70.0",
"phaser3-rex-plugins": "^1.1.84" "phaser3-rex-plugins": "^1.1.84"
} }
} }

View File

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

View File

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

View File

@ -13,7 +13,12 @@ export default class Trainer extends Phaser.GameObjects.Container {
super(scene, -72, 80); super(scene, -72, 80);
this.config = trainerConfigs[trainerType]; this.config = trainerConfigs[trainerType];
this.female = female; 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())]); 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()) onComplete: () => options.forEach(o => o.destroy())
}); });
if (this.transferButtonContainer.visible) { [ this.rerollButtonContainer, this.transferButtonContainer ].forEach(container => {
if (container.visible) {
this.scene.tweens.add({ this.scene.tweens.add({
targets: [ this.rerollButtonContainer, this.transferButtonContainer ], targets: container,
alpha: 0, alpha: 0,
duration: 250, duration: 250,
ease: 'Cubic.easeIn', ease: 'Cubic.easeIn',
onComplete: () => { onComplete: () => {
if (!this.options.length) { if (!this.options.length)
this.rerollButtonContainer.setVisible(false); container.setVisible(false);
this.transferButtonContainer.setVisible(false); else
} else { container.setAlpha(1);
this.rerollButtonContainer.setAlpha(1);
this.transferButtonContainer.setAlpha(1);
} }
});
} }
}) });
}
} }
eraseCursor() { eraseCursor() {

View File

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