Update phases.ts

This commit is contained in:
Lugiad 2024-05-20 02:07:56 +02:00 committed by GitHub
parent 3671fe4c2f
commit 8595a50cd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1250,8 +1250,12 @@ export class SummonPhase extends PartyMemberPokemonPhase {
}); });
this.scene.time.delayedCall(750, () => this.summon()); this.scene.time.delayedCall(750, () => this.summon());
} else { } else {
const trainerName = this.scene.currentBattle.trainer.getName(!(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER);
const pokemonName = this.getPokemon().name;
const message = i18next.t("battle:trainerSendOut", { trainerName, pokemonName });
this.scene.pbTrayEnemy.hide(); this.scene.pbTrayEnemy.hide();
this.scene.ui.showText(`${this.scene.currentBattle.trainer.getName(!(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER)} sent out\n${this.getPokemon().name}!`, null, () => this.summon()); this.scene.ui.showText(message, null, () => this.summon());
} }
} }
@ -3509,7 +3513,11 @@ export class MoneyRewardPhase extends BattlePhase {
this.scene.addMoney(moneyAmount.value); this.scene.addMoney(moneyAmount.value);
this.scene.ui.showText(`You got ₽${moneyAmount.value.toLocaleString('en-US')}\nfor winning!`, null, () => this.end(), null, true); const userLocale = navigator.language || 'en-US';
const formattedMoneyAmount = moneyAmount.value.toLocaleString(userLocale);
const message = i18next.t("battle:moneyWon", { moneyAmount: formattedMoneyAmount });
this.scene.ui.showText(message, null, () => this.end(), null, true);
} }
} }
@ -3544,20 +3552,23 @@ export class GameOverModifierRewardPhase extends ModifierRewardPhase {
super(scene, modifierTypeFunc); super(scene, modifierTypeFunc);
} }
doReward(): Promise<void> { async doReward(): Promise<void> {
return new Promise<void>(resolve => { await new Promise<void>(resolve => {
const newModifier = this.modifierType.newModifier(); const newModifier = this.modifierType.newModifier();
this.scene.addModifier(newModifier).then(() => { this.scene.addModifier(newModifier).then(() => {
this.scene.playSound('level_up_fanfare'); this.scene.playSound('level_up_fanfare');
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
this.scene.ui.fadeIn(250).then(() => { this.scene.ui.fadeIn(250).then(() => {
this.scene.ui.showText(`You received\n${newModifier.type.name}!`, null, () => { const modifierName = newModifier.type.name;
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true)); const message = i18next.t("battle:modifierReceived", { modifierName });
resolve();
}, null, true, 1500); this.scene.ui.showText(message, null, () => {
this.scene.time.delayedCall(1500, () => this.scene.arenaBg.setVisible(true));
resolve();
}, null, true, 1500);
}); });
}); });
}) });
} }
} }
@ -4415,14 +4426,14 @@ export class AttemptCapturePhase extends PokemonPhase {
Promise.all([ pokemon.hideInfo(), this.scene.gameData.setPokemonCaught(pokemon) ]).then(() => { Promise.all([ pokemon.hideInfo(), this.scene.gameData.setPokemonCaught(pokemon) ]).then(() => {
if (this.scene.getParty().length === 6) { if (this.scene.getParty().length === 6) {
const promptRelease = () => { const promptRelease = () => {
this.scene.ui.showText(`Your party is full.\nRelease a Pokémon to make room for ${pokemon.name}?`, null, () => { this.scene.ui.showText(i18next.t("battle:partyFull", { pokemonName: pokemon.name }), null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => { this.scene.ui.setMode(Mode.CONFIRM, () => {
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => { this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
this.scene.ui.setMode(Mode.MESSAGE).then(() => { this.scene.ui.setMode(Mode.MESSAGE).then(() => {
if (slotIndex < 6) if (slotIndex < 6)
addToParty(); addToParty();
else else
promptRelease(); promptRelease();
}); });
}); });
}, () => { }, () => {