pokerogue/src/phases/end-card-phase.ts
Sirz Benjie 408b66f913
[Misc][Refactor][GitHub] Ditch eslint for biome, and add a formatter (#5495)
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-09 14:13:25 -07:00

51 lines
1.3 KiB
TypeScript

import { globalScene } from "#app/global-scene";
import { PlayerGender } from "#app/enums/player-gender";
import { Phase } from "#app/phase";
import { addTextObject, TextStyle } from "#app/ui/text";
import i18next from "i18next";
export class EndCardPhase extends Phase {
public endCard: Phaser.GameObjects.Image;
public text: Phaser.GameObjects.Text;
start(): void {
super.start();
globalScene.ui.getMessageHandler().bg.setVisible(false);
globalScene.ui.getMessageHandler().nameBoxContainer.setVisible(false);
this.endCard = globalScene.add.image(
0,
0,
`end_${globalScene.gameData.gender === PlayerGender.FEMALE ? "f" : "m"}`,
);
this.endCard.setOrigin(0);
this.endCard.setScale(0.5);
globalScene.field.add(this.endCard);
this.text = addTextObject(
globalScene.game.canvas.width / 12,
globalScene.game.canvas.height / 6 - 16,
i18next.t("battle:congratulations"),
TextStyle.SUMMARY,
{ fontSize: "128px" },
);
this.text.setOrigin(0.5);
globalScene.field.add(this.text);
globalScene.ui.clearText();
globalScene.ui.fadeIn(1000).then(() => {
globalScene.ui.showText(
"",
null,
() => {
globalScene.ui.getMessageHandler().bg.setVisible(true);
this.end();
},
null,
true,
);
});
}
}