set up descriptions

This commit is contained in:
frutescens 2024-09-28 08:57:05 -07:00
parent d7475793e6
commit 514055dcd8
2 changed files with 20 additions and 0 deletions

View File

@ -37,6 +37,7 @@ import { GameOverPhase } from "#app/phases/game-over-phase";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import { PartyExpPhase } from "#app/phases/party-exp-phase"; import { PartyExpPhase } from "#app/phases/party-exp-phase";
import { Variant } from "#app/data/variant"; import { Variant } from "#app/data/variant";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
/** /**
* Animates exclamation sprite over trainer's head at start of encounter * Animates exclamation sprite over trainer's head at start of encounter

View File

@ -271,6 +271,19 @@ export default class RunInfoUiHandler extends UiHandler {
pokeball.setPosition(52 + ((i % row_limit) * 8), (i <= 2) ? 25 : 32); pokeball.setPosition(52 + ((i % row_limit) * 8), (i <= 2) ? 25 : 32);
enemyContainer.add(pokeball); enemyContainer.add(pokeball);
}); });
const trainerObj = this.runInfo.trainer.toTrainer(this.scene);
const RIVAL_TRAINER_ID_THRESHOLD = 375;
let trainerName = "";
if (this.runInfo.trainer.trainerType >= RIVAL_TRAINER_ID_THRESHOLD) {
trainerName = (trainerObj.variant === TrainerVariant.FEMALE) ? i18next.t("trainerNames:rival_female") : i18next.t("trainerNames:rival");
} else {
trainerName = trainerObj.getName(0, true);
}
const boxString = i18next.t(trainerObj.variant !== TrainerVariant.DOUBLE ? "battle:trainerAppeared" : "battle:trainerAppearedDouble", { trainerName: trainerName }).replace(/\n/g, " ");
const descContainer = this.scene.add.container(0, 0);
this.provideDesc(descContainer, boxString);
descContainer.setPosition(52, 38);
this.runResultContainer.add(descContainer);
} else if (this.runInfo.battleType === BattleType.MYSTERY_ENCOUNTER) { } else if (this.runInfo.battleType === BattleType.MYSTERY_ENCOUNTER) {
console.log(this.runInfo.mysteryEncounterType); console.log(this.runInfo.mysteryEncounterType);
} }
@ -429,6 +442,12 @@ export default class RunInfoUiHandler extends UiHandler {
enemyContainer.add(enemyPartyContainer); enemyContainer.add(enemyPartyContainer);
} }
provideDesc(descContainer: Phaser.GameObjects.Container, desc: string) {
const textBox = addTextObject(this.scene, 0, 0, desc, TextStyle.MESSAGE, { fontSize : "35px", wordWrap: {width: 150} });
console.log(textBox.width);
descContainer.add(textBox);
}
/** /**
* Shows information about the run like the run's mode, duration, luck, money, and player held items * Shows information about the run like the run's mode, duration, luck, money, and player held items
* The values for luck and money are from the end of the run, not the player's luck at the start of the run. * The values for luck and money are from the end of the run, not the player's luck at the start of the run.