beta bug fixes

This commit is contained in:
ImperialSympathizer 2024-07-05 23:30:33 -04:00
parent 2318d86cb1
commit 8e84e40e35
7 changed files with 27 additions and 35 deletions

View File

@ -86,7 +86,7 @@ export default interface MysteryEncounter {
* Can be set for uses programatic dialogue during an encounter (storing the name of one of the party's pokemon, etc.) * Can be set for uses programatic dialogue during an encounter (storing the name of one of the party's pokemon, etc.)
* Example use: see MYSTERIOUS_CHEST * Example use: see MYSTERIOUS_CHEST
*/ */
dialogueTokens?: Map<RegExp, string>; dialogueTokens?: Map<string, [RegExp, string]>;
/** /**
* Should be set depending upon option selected as part of an encounter * Should be set depending upon option selected as part of an encounter
* For example, if there is no battle as part of the encounter/selected option, should be set to NO_BATTLE * For example, if there is no battle as part of the encounter/selected option, should be set to NO_BATTLE
@ -139,7 +139,7 @@ export default class MysteryEncounter implements MysteryEncounter {
// Reset any dirty flags or encounter data // Reset any dirty flags or encounter data
this.lockEncounterRewardTiers = true; this.lockEncounterRewardTiers = true;
this.dialogueTokens = new Map<RegExp, string>; this.dialogueTokens = new Map<string, [RegExp, string]>;
this.enemyPartyConfigs = []; this.enemyPartyConfigs = [];
this.introVisuals = null; this.introVisuals = null;
this.misc = null; this.misc = null;
@ -264,20 +264,20 @@ export default class MysteryEncounter implements MysteryEncounter {
*/ */
populateDialogueTokensFromRequirements?() { populateDialogueTokensFromRequirements?() {
if (this.primaryPokemon?.length > 0) { if (this.primaryPokemon?.length > 0) {
this.dialogueTokens.set(/@ec\{primaryName\}/gi, this.primaryPokemon.name); this.dialogueTokens.set("primaryName", [/@ec\{primaryName\}/gi, this.primaryPokemon.name]);
for (const req of this.primaryPokemonRequirements) { for (const req of this.primaryPokemonRequirements) {
if (!req.invertQuery) { if (!req.invertQuery) {
const entry: [RegExp, string] = req.getMatchingDialogueToken("primary", this.primaryPokemon); const entry: [RegExp, string] = req.getMatchingDialogueToken("primary", this.primaryPokemon);
this.dialogueTokens.set(entry[0], entry[1]); this.dialogueTokens.set("primary", entry);
} }
} }
} }
if (this.secondaryPokemonRequirements?.length > 0 && this.secondaryPokemon?.length > 0) { if (this.secondaryPokemonRequirements?.length > 0 && this.secondaryPokemon?.length > 0) {
this.dialogueTokens.set(/@ec\{secondaryName\}/gi, this.secondaryPokemon[0].name); this.dialogueTokens.set("secondaryName", [/@ec\{secondaryName\}/gi, this.secondaryPokemon[0].name]);
for (const req of this.secondaryPokemonRequirements) { for (const req of this.secondaryPokemonRequirements) {
if (!req.invertQuery) { if (!req.invertQuery) {
const entry: [RegExp, string] = req.getMatchingDialogueToken("secondary", this.secondaryPokemon[0]); const entry: [RegExp, string] = req.getMatchingDialogueToken("secondary", this.secondaryPokemon[0]);
this.dialogueTokens.set(entry[0], entry[1]); this.dialogueTokens.set("secondary", entry);
} }
} }
} }
@ -285,20 +285,20 @@ export default class MysteryEncounter implements MysteryEncounter {
const opt = this.options[i]; const opt = this.options[i];
const j = i + 1; const j = i + 1;
if (opt.primaryPokemonRequirements?.length > 0 && opt.primaryPokemon?.length > 0) { if (opt.primaryPokemonRequirements?.length > 0 && opt.primaryPokemon?.length > 0) {
this.dialogueTokens.set(new RegExp("@ec\{option" + j + "PrimaryName\\}", "gi"), opt.primaryPokemon.name); this.dialogueTokens.set("option" + j + "PrimaryName", [new RegExp("@ec\{option" + j + "PrimaryName\\}", "gi"), opt.primaryPokemon.name]);
for (const req of opt.primaryPokemonRequirements) { for (const req of opt.primaryPokemonRequirements) {
if (!req.invertQuery) { if (!req.invertQuery) {
const entry: [RegExp, string] = req.getMatchingDialogueToken("option" + j + "Primary", opt.primaryPokemon); const entry: [RegExp, string] = req.getMatchingDialogueToken("option" + j + "Primary", opt.primaryPokemon);
this.dialogueTokens.set(entry[0], entry[1]); this.dialogueTokens.set("option" + j + "Primary", entry);
} }
} }
} }
if (opt.secondaryPokemonRequirements?.length > 0 && opt.secondaryPokemon?.length > 0) { if (opt.secondaryPokemonRequirements?.length > 0 && opt.secondaryPokemon?.length > 0) {
this.dialogueTokens.set(new RegExp("@ec\{option" + j + "SecondaryName\\}", "gi"), opt.secondaryPokemon[0].name); this.dialogueTokens.set("option" + j + "SecondaryName", [new RegExp("@ec\{option" + j + "SecondaryName\\}", "gi"), opt.secondaryPokemon[0].name]);
for (const req of opt.secondaryPokemonRequirements) { for (const req of opt.secondaryPokemonRequirements) {
if (!req.invertQuery) { if (!req.invertQuery) {
const entry: [RegExp, string] = req.getMatchingDialogueToken("option" + j + "Secondary", opt.secondaryPokemon[0]); const entry: [RegExp, string] = req.getMatchingDialogueToken("option" + j + "Secondary", opt.secondaryPokemon[0]);
this.dialogueTokens.set(entry[0], entry[1]); this.dialogueTokens.set("option" + j + "Secondary", entry);
} }
} }
} }
@ -317,7 +317,7 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
primaryPokemonRequirements?: EncounterPokemonRequirement[] = []; primaryPokemonRequirements?: EncounterPokemonRequirement[] = [];
secondaryPokemonRequirements ?: EncounterPokemonRequirement[] = []; secondaryPokemonRequirements ?: EncounterPokemonRequirement[] = [];
excludePrimaryFromSupportRequirements?: boolean; excludePrimaryFromSupportRequirements?: boolean;
dialogueTokens?: Map<RegExp, string>; dialogueTokens?: Map<string, [RegExp, string]>;
doEncounterRewards?: (scene: BattleScene) => boolean; doEncounterRewards?: (scene: BattleScene) => boolean;
onInit?: (scene: BattleScene) => boolean; onInit?: (scene: BattleScene) => boolean;
hideBattleIntroMessage?: boolean; hideBattleIntroMessage?: boolean;

View File

@ -92,7 +92,7 @@ export const DarkDealEncounter: MysteryEncounter = new MysteryEncounterBuilder()
// Will never return last battle able mon and instead pick fainted/unable to battle // Will never return last battle able mon and instead pick fainted/unable to battle
const removedPokemon = getRandomPlayerPokemon(scene, false, true); const removedPokemon = getRandomPlayerPokemon(scene, false, true);
scene.removePokemonFromPlayerParty(removedPokemon); scene.removePokemonFromPlayerParty(removedPokemon);
scene.currentBattle.mysteryEncounter.dialogueTokens.set( /@ec\{pokeName\}/gi, removedPokemon.name); scene.currentBattle.mysteryEncounter.dialogueTokens.set("pokeName", [/@ec\{pokeName\}/gi, removedPokemon.name]);
// Store removed pokemon types // Store removed pokemon types
scene.currentBattle.mysteryEncounter.misc = [removedPokemon.species.type1]; scene.currentBattle.mysteryEncounter.misc = [removedPokemon.species.type1];

View File

@ -47,7 +47,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil
const tier = scene.currentBattle.waveIndex > 160 ? ModifierTier.MASTER : scene.currentBattle.waveIndex > 110 ? ModifierTier.ROGUE : scene.currentBattle.waveIndex > 60 ? ModifierTier.ULTRA : ModifierTier.GREAT; const tier = scene.currentBattle.waveIndex > 160 ? ModifierTier.MASTER : scene.currentBattle.waveIndex > 110 ? ModifierTier.ROGUE : scene.currentBattle.waveIndex > 60 ? ModifierTier.ULTRA : ModifierTier.GREAT;
regenerateModifierPoolThresholds(scene.getParty(), ModifierPoolType.PLAYER, 0); // refresh player item pool regenerateModifierPoolThresholds(scene.getParty(), ModifierPoolType.PLAYER, 0); // refresh player item pool
const item = getPlayerModifierTypeOptions(1, scene.getParty(), [], { guaranteedModifierTiers: [tier]})[0]; const item = getPlayerModifierTypeOptions(1, scene.getParty(), [], { guaranteedModifierTiers: [tier]})[0];
scene.currentBattle.mysteryEncounter.dialogueTokens.set(/@ec\{itemName\}/gi, item.type.name); scene.currentBattle.mysteryEncounter.dialogueTokens.set("itemName", [/@ec\{itemName\}/gi, item.type.name]);
scene.currentBattle.mysteryEncounter.misc = item; scene.currentBattle.mysteryEncounter.misc = item;
instance.spriteConfigs = [ instance.spriteConfigs = [
@ -92,7 +92,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil
const config = scene.currentBattle.mysteryEncounter.enemyPartyConfigs[0]; const config = scene.currentBattle.mysteryEncounter.enemyPartyConfigs[0];
config.pokemonConfigs[0].tags = [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON]; config.pokemonConfigs[0].tags = [BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON];
config.pokemonConfigs[0].mysteryEncounterBattleEffects = (pokemon: Pokemon) => { config.pokemonConfigs[0].mysteryEncounterBattleEffects = (pokemon: Pokemon) => {
pokemon.scene.currentBattle.mysteryEncounter.dialogueTokens.set(/@ec\{enemyPokemon\}/gi, pokemon.name); pokemon.scene.currentBattle.mysteryEncounter.dialogueTokens.set("enemyPokemon", [/@ec\{enemyPokemon\}/gi, pokemon.name]);
queueEncounterMessage(pokemon.scene, "mysteryEncounter:fight_or_flight_boss_enraged"); queueEncounterMessage(pokemon.scene, "mysteryEncounter:fight_or_flight_boss_enraged");
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.SPD], 1)); pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [BattleStat.ATK, BattleStat.DEF, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.SPD], 1));
}; };

View File

@ -69,7 +69,7 @@ export const MysteriousChestEncounter: MysteryEncounter = new MysteryEncounterBu
const highestLevelPokemon = getHighestLevelPlayerPokemon(scene, true); const highestLevelPokemon = getHighestLevelPlayerPokemon(scene, true);
koPlayerPokemon(highestLevelPokemon); koPlayerPokemon(highestLevelPokemon);
scene.currentBattle.mysteryEncounter.dialogueTokens.set(/@ec\{pokeName\}/gi, highestLevelPokemon.name); scene.currentBattle.mysteryEncounter.dialogueTokens.set("pokeName", [/@ec\{pokeName\}/gi, highestLevelPokemon.name]);
// Show which Pokemon was KOed, then leave encounter with no rewards // Show which Pokemon was KOed, then leave encounter with no rewards
// Does this synchronously so that game over doesn't happen over result message // Does this synchronously so that game over doesn't happen over result message
await showEncounterText(scene, "mysteryEncounter:mysterious_chest_option_1_bad_result") await showEncounterText(scene, "mysteryEncounter:mysterious_chest_option_1_bad_result")

View File

@ -131,8 +131,8 @@ export function getTextWithEncounterDialogueTokens(scene: BattleScene, textKey:
const dialogueTokens = scene.currentBattle?.mysteryEncounter?.dialogueTokens; const dialogueTokens = scene.currentBattle?.mysteryEncounter?.dialogueTokens;
if (dialogueTokens) { if (dialogueTokens) {
dialogueTokens.forEach((value, key) => { dialogueTokens.forEach((value) => {
textString = textString.replace(key, value); textString = textString.replace(value[0], value[1]);
}); });
} }
@ -450,7 +450,7 @@ export function selectPokemonForOption(scene: BattleScene, onPokemonSelected: (p
const pokemon = scene.getParty()[slotIndex]; const pokemon = scene.getParty()[slotIndex];
const secondaryOptions = onPokemonSelected(pokemon); const secondaryOptions = onPokemonSelected(pokemon);
if (!secondaryOptions) { if (!secondaryOptions) {
scene.currentBattle.mysteryEncounter.dialogueTokens.set(/@ec\{selectedPokemon\}/gi, pokemon.name); scene.currentBattle.mysteryEncounter.dialogueTokens.set("selectedPokemon", [/@ec\{selectedPokemon\}/gi, pokemon.name]);
resolve(true); resolve(true);
return; return;
} }
@ -464,7 +464,7 @@ export function selectPokemonForOption(scene: BattleScene, onPokemonSelected: (p
const onSelect = option.handler; const onSelect = option.handler;
option.handler = () => { option.handler = () => {
onSelect(); onSelect();
scene.currentBattle.mysteryEncounter.dialogueTokens.set(/@ec\{selectedPokemon\}/gi, pokemon.name); scene.currentBattle.mysteryEncounter.dialogueTokens.set("selectedPokemon", [/@ec\{selectedPokemon\}/gi, pokemon.name]);
resolve(true); resolve(true);
return true; return true;
}; };

View File

@ -77,8 +77,8 @@ export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBu
}; };
const onBeforeRewardsPhase = () => { const onBeforeRewardsPhase = () => {
encounter.dialogueTokens.set(/@ec\{stat1\}/gi, "-"); encounter.dialogueTokens.set("stat1", [/@ec\{stat1\}/gi, "-"]);
encounter.dialogueTokens.set(/@ec\{stat2\}/gi, "-"); encounter.dialogueTokens.set("stat2", [/@ec\{stat2\}/gi, "-"]);
// Add the pokemon back to party with IV boost // Add the pokemon back to party with IV boost
const ivIndexes = []; const ivIndexes = [];
playerPokemon.ivs.forEach((iv, index) => { playerPokemon.ivs.forEach((iv, index) => {
@ -100,9 +100,9 @@ export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBu
const ivToChange = ivIndexes.pop(); const ivToChange = ivIndexes.pop();
let newVal = ivToChange.iv; let newVal = ivToChange.iv;
if (improvedCount === 0) { if (improvedCount === 0) {
encounter.dialogueTokens.set(/@ec\{stat1\}/gi, getIvName(ivToChange.index)); encounter.dialogueTokens.set("stat1", [/@ec\{stat1\}/gi, getIvName(ivToChange.index)]);
} else { } else {
encounter.dialogueTokens.set(/@ec\{stat2\}/gi, getIvName(ivToChange.index)); encounter.dialogueTokens.set("stat2", [/@ec\{stat2\}/gi, getIvName(ivToChange.index)]);
} }
// Corrects required encounter breakpoints to be continuous for all IV values // Corrects required encounter breakpoints to be continuous for all IV values
@ -148,7 +148,7 @@ export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBu
label: getNatureName(nature, true, true, true, scene.uiTheme), label: getNatureName(nature, true, true, true, scene.uiTheme),
handler: () => { handler: () => {
// Pokemon and second option selected // Pokemon and second option selected
encounter.dialogueTokens.set(/@ec\{nature\}/gi, getNatureName(nature)); encounter.dialogueTokens.set("nature", [/@ec\{nature\}/gi, getNatureName(nature)]);
encounter.misc = { encounter.misc = {
playerPokemon: pokemon, playerPokemon: pokemon,
chosenNature: nature chosenNature: nature
@ -201,15 +201,15 @@ export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBu
const speciesForm = !!pokemon.getFusionSpeciesForm() ? pokemon.getFusionSpeciesForm() : pokemon.getSpeciesForm(); const speciesForm = !!pokemon.getFusionSpeciesForm() ? pokemon.getFusionSpeciesForm() : pokemon.getSpeciesForm();
const abilityCount = speciesForm.getAbilityCount(); const abilityCount = speciesForm.getAbilityCount();
const abilities = new Array(abilityCount).fill(null).map((val, i) => allAbilities[speciesForm.getAbility(i)]); const abilities = new Array(abilityCount).fill(null).map((val, i) => allAbilities[speciesForm.getAbility(i)]);
return abilities.map((ability: Ability) => { return abilities.map((ability: Ability, index) => {
const option: OptionSelectItem = { const option: OptionSelectItem = {
label: ability.name, label: ability.name,
handler: () => { handler: () => {
// Pokemon and ability selected // Pokemon and ability selected
encounter.dialogueTokens.set(/@ec\{ability\}/gi, ability.name); encounter.dialogueTokens.set("ability", [/@ec\{ability\}/gi, ability.name]);
encounter.misc = { encounter.misc = {
playerPokemon: pokemon, playerPokemon: pokemon,
abilityIndex: ability abilityIndex: index
}; };
return true; return true;
}, },

View File

@ -295,14 +295,6 @@ export class TitlePhase extends Phase {
}, },
keepOpen: true keepOpen: true
}, },
{
label: i18next.t("menu:settings"),
handler: () => {
this.scene.ui.setOverlayMode(Mode.SETTINGS);
return true;
},
keepOpen: true
},
{ {
label: i18next.t("menu:settings"), label: i18next.t("menu:settings"),
handler: () => { handler: () => {