finishing touches
This commit is contained in:
parent
39f98222a6
commit
941a8e71d6
|
@ -71,8 +71,3 @@ export default class MysteryEncounterDialogue {
|
||||||
}
|
}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const allMysteryEncounterDialogue: { [encounterType: number]: MysteryEncounterDialogue } = {};
|
|
||||||
|
|
||||||
export function initMysteryEncounterDialogue() {
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../.
|
||||||
import * as Utils from "../../utils";
|
import * as Utils from "../../utils";
|
||||||
import { StatusEffect } from "../status-effect";
|
import { StatusEffect } from "../status-effect";
|
||||||
import MysteryEncounterDialogue, {
|
import MysteryEncounterDialogue, {
|
||||||
allMysteryEncounterDialogue,
|
|
||||||
OptionTextDisplay
|
OptionTextDisplay
|
||||||
} from "./mystery-encounter-dialogue";
|
} from "./mystery-encounter-dialogue";
|
||||||
import MysteryEncounterOption, { MysteryEncounterOptionBuilder, OptionPhaseCallback } from "./mystery-encounter-option";
|
import MysteryEncounterOption, { MysteryEncounterOptionBuilder, OptionPhaseCallback } from "./mystery-encounter-option";
|
||||||
|
@ -137,17 +136,12 @@ export default class MysteryEncounter implements MysteryEncounter {
|
||||||
Object.assign(this, encounter);
|
Object.assign(this, encounter);
|
||||||
}
|
}
|
||||||
this.encounterTier = this.encounterTier ? this.encounterTier : MysteryEncounterTier.COMMON;
|
this.encounterTier = this.encounterTier ? this.encounterTier : MysteryEncounterTier.COMMON;
|
||||||
this.dialogue = Object.assign((this.dialogue ?? {}), allMysteryEncounterDialogue[this.encounterType] ?? {});
|
this.dialogue = {};
|
||||||
this.encounterVariant = MysteryEncounterVariant.DEFAULT;
|
this.encounterVariant = MysteryEncounterVariant.DEFAULT;
|
||||||
this.requirements = this.requirements ? this.requirements : [];
|
this.requirements = this.requirements ? this.requirements : [];
|
||||||
this.hideBattleIntroMessage = !isNullOrUndefined(this.hideBattleIntroMessage) ? this.hideBattleIntroMessage : false;
|
this.hideBattleIntroMessage = !isNullOrUndefined(this.hideBattleIntroMessage) ? this.hideBattleIntroMessage : false;
|
||||||
this.hideIntroVisuals = !isNullOrUndefined(this.hideIntroVisuals) ? this.hideIntroVisuals : true;
|
this.hideIntroVisuals = !isNullOrUndefined(this.hideIntroVisuals) ? this.hideIntroVisuals : true;
|
||||||
|
|
||||||
// Populate options with respective dialogue
|
|
||||||
if (this.dialogue?.encounterOptionsDialogue) {
|
|
||||||
// this.options.forEach((o, i) => o.dialogue = this.dialogue.encounterOptionsDialogue.options[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset any dirty flags or encounter data
|
// Reset any dirty flags or encounter data
|
||||||
this.lockEncounterRewardTiers = true;
|
this.lockEncounterRewardTiers = true;
|
||||||
this.dialogueTokens = new Map<string, [RegExp, string]>;
|
this.dialogueTokens = new Map<string, [RegExp, string]>;
|
||||||
|
@ -482,15 +476,37 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
|
||||||
return this.withSceneRequirement(new PartySizeRequirement([min, max ?? min]));
|
return this.withSceneRequirement(new PartySizeRequirement([min, max ?? min]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a primary pokemon requirement
|
||||||
|
*
|
||||||
|
* @param requirement {@linkcode EncounterPokemonRequirement}
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
withPrimaryPokemonRequirement(requirement: EncounterPokemonRequirement): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
|
withPrimaryPokemonRequirement(requirement: EncounterPokemonRequirement): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
|
||||||
this.primaryPokemonRequirements.push(requirement);
|
this.primaryPokemonRequirements.push(requirement);
|
||||||
return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements });
|
return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a primary pokemon status effect requirement
|
||||||
|
*
|
||||||
|
* @param statusEffect the status effect/s to check
|
||||||
|
* @param minNumberOfPokemon minimum number of pokemon to have the effect
|
||||||
|
* @param invertQuery if true will invert the query
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
withPrimaryPokemonStatusEffectRequirement(statusEffect: StatusEffect | StatusEffect[], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
|
withPrimaryPokemonStatusEffectRequirement(statusEffect: StatusEffect | StatusEffect[], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
|
||||||
return this.withPrimaryPokemonRequirement(new StatusEffectRequirement(statusEffect, minNumberOfPokemon, invertQuery));
|
return this.withPrimaryPokemonRequirement(new StatusEffectRequirement(statusEffect, minNumberOfPokemon, invertQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a primary pokemon health ratio requirement
|
||||||
|
*
|
||||||
|
* @param requiredHealthRange the health range to check
|
||||||
|
* @param minNumberOfPokemon minimum number of pokemon to have the health range
|
||||||
|
* @param invertQuery if true will invert the query
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
withPrimaryPokemonHealthRatioRequirement(requiredHealthRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
|
withPrimaryPokemonHealthRatioRequirement(requiredHealthRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false): this & Required<Pick<MysteryEncounter, "primaryPokemonRequirements">> {
|
||||||
return this.withPrimaryPokemonRequirement(new HealthRatioRequirement(requiredHealthRange, minNumberOfPokemon, invertQuery));
|
return this.withPrimaryPokemonRequirement(new HealthRatioRequirement(requiredHealthRange, minNumberOfPokemon, invertQuery));
|
||||||
}
|
}
|
||||||
|
@ -579,12 +595,17 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
|
||||||
return Object.assign(this, { hideIntroVisuals: hideIntroVisuals });
|
return Object.assign(this, { hideIntroVisuals: hideIntroVisuals });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a title for the encounter
|
||||||
|
*
|
||||||
|
* @param title - title of the encounter
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
withTitle(title: TemplateStringsArray | `mysteryEncounter:${string}`) {
|
withTitle(title: TemplateStringsArray | `mysteryEncounter:${string}`) {
|
||||||
const dialogue = this.dialogue ?? {};
|
const encounterOptionsDialogue = this.dialogue.encounterOptionsDialogue ?? {};
|
||||||
const encounterOptionsDialogue = this.dialogue?.encounterOptionsDialogue ?? {};
|
|
||||||
|
|
||||||
this.dialogue = {
|
this.dialogue = {
|
||||||
...dialogue,
|
...this.dialogue,
|
||||||
encounterOptionsDialogue: {
|
encounterOptionsDialogue: {
|
||||||
...encounterOptionsDialogue,
|
...encounterOptionsDialogue,
|
||||||
title,
|
title,
|
||||||
|
@ -594,12 +615,17 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a description of the encounter
|
||||||
|
*
|
||||||
|
* @param description - description of the encounter
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
withDescription(description: TemplateStringsArray | `mysteryEncounter:${string}`) {
|
withDescription(description: TemplateStringsArray | `mysteryEncounter:${string}`) {
|
||||||
const dialogue = this.dialogue ?? {};
|
const encounterOptionsDialogue = this.dialogue.encounterOptionsDialogue ?? {};
|
||||||
const encounterOptionsDialogue = this.dialogue?.encounterOptionsDialogue ?? {};
|
|
||||||
|
|
||||||
this.dialogue = {
|
this.dialogue = {
|
||||||
...dialogue,
|
...this.dialogue,
|
||||||
encounterOptionsDialogue: {
|
encounterOptionsDialogue: {
|
||||||
...encounterOptionsDialogue,
|
...encounterOptionsDialogue,
|
||||||
description,
|
description,
|
||||||
|
@ -609,12 +635,17 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a query for the encounter
|
||||||
|
*
|
||||||
|
* @param query - query to use for the encounter
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
withQuery(query: TemplateStringsArray | `mysteryEncounter:${string}`) {
|
withQuery(query: TemplateStringsArray | `mysteryEncounter:${string}`) {
|
||||||
const dialogue = this.dialogue ?? {};
|
const encounterOptionsDialogue = this.dialogue.encounterOptionsDialogue ?? {};
|
||||||
const encounterOptionsDialogue = this.dialogue?.encounterOptionsDialogue ?? {};
|
|
||||||
|
|
||||||
this.dialogue = {
|
this.dialogue = {
|
||||||
...dialogue,
|
...this.dialogue,
|
||||||
encounterOptionsDialogue: {
|
encounterOptionsDialogue: {
|
||||||
...encounterOptionsDialogue,
|
...encounterOptionsDialogue,
|
||||||
query,
|
query,
|
||||||
|
@ -624,11 +655,23 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add outro dialogue/s for the encounter
|
||||||
|
*
|
||||||
|
* @param dialogue - outro dialogue/s
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
withOutroDialogue(dialogue: MysteryEncounterDialogue["outro"] = []) {
|
withOutroDialogue(dialogue: MysteryEncounterDialogue["outro"] = []) {
|
||||||
this.dialogue = {...this.dialogue, outro: dialogue };
|
this.dialogue = {...this.dialogue, outro: dialogue };
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the mystery encounter
|
||||||
|
*
|
||||||
|
* @param this - MysteryEncounter
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
build(this: MysteryEncounter) {
|
build(this: MysteryEncounter) {
|
||||||
return new MysteryEncounter(this);
|
return new MysteryEncounter(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import { initStatsKeys } from "./ui/game-stats-ui-handler";
|
||||||
import { initVouchers } from "./system/voucher";
|
import { initVouchers } from "./system/voucher";
|
||||||
import { Biome } from "#enums/biome";
|
import { Biome } from "#enums/biome";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import {initMysteryEncounterDialogue} from "#app/data/mystery-encounters/mystery-encounter-dialogue";
|
|
||||||
import {initMysteryEncounters} from "#app/data/mystery-encounters/mystery-encounters";
|
import {initMysteryEncounters} from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
|
|
||||||
export class LoadingScene extends SceneBase {
|
export class LoadingScene extends SceneBase {
|
||||||
|
@ -346,7 +345,6 @@ export class LoadingScene extends SceneBase {
|
||||||
initMoves();
|
initMoves();
|
||||||
initAbilities();
|
initAbilities();
|
||||||
initChallenges();
|
initChallenges();
|
||||||
initMysteryEncounterDialogue();
|
|
||||||
initMysteryEncounters();
|
initMysteryEncounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,9 +117,9 @@ export const EGG_GACHA_PULL_COUNT_OVERRIDE: number = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 1 to 256, set to null to ignore
|
// 1 to 256, set to null to ignore
|
||||||
export const MYSTERY_ENCOUNTER_RATE_OVERRIDE: number = 10000;
|
export const MYSTERY_ENCOUNTER_RATE_OVERRIDE: number = null;
|
||||||
export const MYSTERY_ENCOUNTER_TIER_OVERRIDE: MysteryEncounterTier = null;
|
export const MYSTERY_ENCOUNTER_TIER_OVERRIDE: MysteryEncounterTier = null;
|
||||||
export const MYSTERY_ENCOUNTER_OVERRIDE: MysteryEncounterType = MysteryEncounterType.DARK_DEAL;
|
export const MYSTERY_ENCOUNTER_OVERRIDE: MysteryEncounterType = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MODIFIER / ITEM OVERRIDES
|
* MODIFIER / ITEM OVERRIDES
|
||||||
|
|
|
@ -13,7 +13,6 @@ import { initVouchers } from "#app/system/voucher";
|
||||||
import { initAchievements } from "#app/system/achv";
|
import { initAchievements } from "#app/system/achv";
|
||||||
import { initStatsKeys } from "#app/ui/game-stats-ui-handler";
|
import { initStatsKeys } from "#app/ui/game-stats-ui-handler";
|
||||||
import { initMysteryEncounters } from "#app/data/mystery-encounters/mystery-encounters";
|
import { initMysteryEncounters } from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
import { initMysteryEncounterDialogue } from "#app/data/mystery-encounters/mystery-encounter-dialogue";
|
|
||||||
import { beforeAll, beforeEach, vi } from "vitest";
|
import { beforeAll, beforeEach, vi } from "vitest";
|
||||||
import * as overrides from "#app/overrides";
|
import * as overrides from "#app/overrides";
|
||||||
|
|
||||||
|
@ -28,7 +27,6 @@ initSpecies();
|
||||||
initMoves();
|
initMoves();
|
||||||
initAbilities();
|
initAbilities();
|
||||||
initLoggedInUser();
|
initLoggedInUser();
|
||||||
initMysteryEncounterDialogue();
|
|
||||||
initMysteryEncounters();
|
initMysteryEncounters();
|
||||||
|
|
||||||
global.testFailed = false;
|
global.testFailed = false;
|
||||||
|
|
Loading…
Reference in New Issue