Update Phaser version

pull/2/head
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 => {
this.scene.tweens.add({ if (container.visible) {
targets: [ this.rerollButtonContainer, this.transferButtonContainer ], this.scene.tweens.add({
alpha: 0, targets: container,
duration: 250, alpha: 0,
ease: 'Cubic.easeIn', duration: 250,
onComplete: () => { ease: 'Cubic.easeIn',
if (!this.options.length) { onComplete: () => {
this.rerollButtonContainer.setVisible(false); if (!this.options.length)
this.transferButtonContainer.setVisible(false); container.setVisible(false);
} else { else
this.rerollButtonContainer.setAlpha(1); container.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];