Merge branch 'mystery-battle-events' into event/getting-lost-at-the-sea

This commit is contained in:
Felix Staud 2024-07-12 14:38:40 -07:00
commit c4e3a28585
3 changed files with 8 additions and 6 deletions

View File

@ -145,7 +145,7 @@ export const SleepingSnorlaxEncounter: IMysteryEncounter =
.withDialogue({ .withDialogue({
buttonLabel: `${namespace}_option_3_label`, buttonLabel: `${namespace}_option_3_label`,
buttonTooltip: `${namespace}_option_3_tooltip`, buttonTooltip: `${namespace}_option_3_tooltip`,
disabledTooltip: `${namespace}_option_3_disabled_tooltip`, disabledButtonTooltip: `${namespace}_option_3_disabled_tooltip`,
}) })
.withOptionPhase(async (scene: BattleScene) => { .withOptionPhase(async (scene: BattleScene) => {
// Steal the Snorlax's Leftovers // Steal the Snorlax's Leftovers

View File

@ -9,7 +9,8 @@ export class TextDisplay {
export class OptionTextDisplay { export class OptionTextDisplay {
buttonLabel: string; buttonLabel: string;
buttonTooltip?: string; buttonTooltip?: string;
disabledTooltip?: string; disabledButtonLabel?: string;
disabledButtonTooltip?: string;
secondOptionPrompt?: string; secondOptionPrompt?: string;
selected?: TextDisplay[]; selected?: TextDisplay[];
style?: TextStyle; style?: TextStyle;

View File

@ -325,12 +325,13 @@ export default class MysteryEncounterUiHandler extends UiHandler {
this.optionsMeetsReqs.push(option.meetsRequirements(this.scene)); this.optionsMeetsReqs.push(option.meetsRequirements(this.scene));
const optionDialogue = option.dialogue; const optionDialogue = option.dialogue;
const label = !this.optionsMeetsReqs[i] && optionDialogue.disabledButtonLabel ? optionDialogue.disabledButtonLabel : optionDialogue.buttonLabel;
let text: string; let text: string;
if (option.hasRequirements() && this.optionsMeetsReqs[i] && (option.optionMode === EncounterOptionMode.DEFAULT_OR_SPECIAL || option.optionMode === EncounterOptionMode.DISABLED_OR_SPECIAL)) { if (option.hasRequirements() && this.optionsMeetsReqs[i] && (option.optionMode === EncounterOptionMode.DEFAULT_OR_SPECIAL || option.optionMode === EncounterOptionMode.DISABLED_OR_SPECIAL)) {
// Options with special requirements that are met are automatically colored green // Options with special requirements that are met are automatically colored green
text = getEncounterText(this.scene, optionDialogue.buttonLabel, TextStyle.SUMMARY_GREEN); text = getEncounterText(this.scene, label, TextStyle.SUMMARY_GREEN);
} else { } else {
text = getEncounterText(this.scene, optionDialogue.buttonLabel, optionDialogue.style ? optionDialogue.style : TextStyle.WINDOW); text = getEncounterText(this.scene, label, optionDialogue.style ? optionDialogue.style : TextStyle.WINDOW);
} }
if (text) { if (text) {
@ -425,8 +426,8 @@ export default class MysteryEncounterUiHandler extends UiHandler {
let text: string; let text: string;
const cursorOption = this.filteredEncounterOptions[cursor]; const cursorOption = this.filteredEncounterOptions[cursor];
const optionDialogue = cursorOption.dialogue; const optionDialogue = cursorOption.dialogue;
if (!this.optionsMeetsReqs[cursor] && (cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_DEFAULT || cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_SPECIAL) && optionDialogue.disabledTooltip) { if (!this.optionsMeetsReqs[cursor] && (cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_DEFAULT || cursorOption.optionMode === EncounterOptionMode.DISABLED_OR_SPECIAL) && optionDialogue.disabledButtonTooltip) {
text = getEncounterText(this.scene, optionDialogue.disabledTooltip, TextStyle.TOOLTIP_CONTENT); text = getEncounterText(this.scene, optionDialogue.disabledButtonTooltip, TextStyle.TOOLTIP_CONTENT);
} else { } else {
text = getEncounterText(this.scene, optionDialogue.buttonTooltip, TextStyle.TOOLTIP_CONTENT); text = getEncounterText(this.scene, optionDialogue.buttonTooltip, TextStyle.TOOLTIP_CONTENT);
} }