small fixes

This commit is contained in:
ImperialSympathizer 2024-07-05 21:03:18 -04:00
parent b3aa562bc6
commit 1d0109a386
6 changed files with 20 additions and 21 deletions

View File

@ -93,7 +93,12 @@ import { UiTheme } from "#enums/ui-theme";
import { TimedEventManager } from "#app/timed-event-manager.js"; import { TimedEventManager } from "#app/timed-event-manager.js";
import i18next from "i18next"; import i18next from "i18next";
import MysteryEncounter, { MysteryEncounterTier, MysteryEncounterVariant } from "./data/mystery-encounter"; import MysteryEncounter, { MysteryEncounterTier, MysteryEncounterVariant } from "./data/mystery-encounter";
import {mysteryEncountersByBiome, allMysteryEncounters, BASE_MYSTERY_ENCOUNTER_WEIGHT} from "./data/mystery-encounters/mystery-encounters"; import {
mysteryEncountersByBiome,
allMysteryEncounters,
BASE_MYSTERY_ENCOUNTER_WEIGHT,
AVERAGE_ENCOUNTERS_PER_RUN_TARGET
} from "./data/mystery-encounters/mystery-encounters";
import {MysteryEncounterFlags} from "#app/data/mystery-encounter-flags"; import {MysteryEncounterFlags} from "#app/data/mystery-encounter-flags";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
@ -1098,8 +1103,8 @@ export default class BattleScene extends SceneBase {
// Check for mystery encounter // Check for mystery encounter
// Can only occur in place of a standard wild battle, waves 10-180 // Can only occur in place of a standard wild battle, waves 10-180
// let testStartingWeight = 40; // let testStartingWeight = 10;
// while (testStartingWeight < 60) { // while (testStartingWeight < 30) {
// calculateMEAggregateStats(this, testStartingWeight); // calculateMEAggregateStats(this, testStartingWeight);
// testStartingWeight += 2; // testStartingWeight += 2;
// } // }
@ -1112,7 +1117,7 @@ export default class BattleScene extends SceneBase {
// If total number of encounters is lower than expected for the run, slightly favor a new encounter spawn // If total number of encounters is lower than expected for the run, slightly favor a new encounter spawn
// Do the reverse as well // Do the reverse as well
// Reduces occurrence of runs with very few (<6) and a ton (>10) of encounters // Reduces occurrence of runs with very few (<6) and a ton (>10) of encounters
const expectedEncountersByFloor = 8 / (180 - 10) * newWaveIndex; const expectedEncountersByFloor = AVERAGE_ENCOUNTERS_PER_RUN_TARGET / (180 - 10) * newWaveIndex;
const currentRunDiffFromAvg = expectedEncountersByFloor - (this.mysteryEncounterFlags?.encounteredEvents?.length || 0); const currentRunDiffFromAvg = expectedEncountersByFloor - (this.mysteryEncounterFlags?.encounteredEvents?.length || 0);
const favoredEncounterRate = sessionEncounterRate + currentRunDiffFromAvg * 5; const favoredEncounterRate = sessionEncounterRate + currentRunDiffFromAvg * 5;

View File

@ -157,12 +157,12 @@ export default class MysteryEncounter implements MysteryEncounter {
const secReqs = this.meetsSecondaryRequirementAndSecondaryPokemonSelected(scene); // secondary is checked first to handle cases of primary overlapping with secondary const secReqs = this.meetsSecondaryRequirementAndSecondaryPokemonSelected(scene); // secondary is checked first to handle cases of primary overlapping with secondary
const priReqs = this.meetsPrimaryRequirementAndPrimaryPokemonSelected(scene); const priReqs = this.meetsPrimaryRequirementAndPrimaryPokemonSelected(scene);
console.log("-------" + MysteryEncounterType[this.encounterType] + " Encounter Check -------"); // console.log("-------" + MysteryEncounterType[this.encounterType] + " Encounter Check -------");
console.log(this); // console.log(this);
console.log( "sceneCheck: " + sceneReq); // console.log( "sceneCheck: " + sceneReq);
console.log( "primaryCheck: " + priReqs); // console.log( "primaryCheck: " + priReqs);
console.log( "secondaryCheck: " + secReqs); // console.log( "secondaryCheck: " + secReqs);
console.log(MysteryEncounterTier[this.encounterTier]); // console.log(MysteryEncounterTier[this.encounterTier]);
return sceneReq && secReqs && priReqs; return sceneReq && secReqs && priReqs;
} }

View File

@ -595,6 +595,7 @@ export function handleMysteryEncounterVictory(scene: BattleScene, addHealPhase:
export function calculateMEAggregateStats(scene: BattleScene, baseSpawnWeight: number) { export function calculateMEAggregateStats(scene: BattleScene, baseSpawnWeight: number) {
const numRuns = 1000; const numRuns = 1000;
let run = 0; let run = 0;
const targetEncountersPerRun = 15;
const calculateNumEncounters = (): number[] => { const calculateNumEncounters = (): number[] => {
let encounterRate = baseSpawnWeight; let encounterRate = baseSpawnWeight;
@ -646,7 +647,7 @@ export function calculateMEAggregateStats(scene: BattleScene, baseSpawnWeight: n
// If total number of encounters is lower than expected for the run, slightly favor a new encounter // If total number of encounters is lower than expected for the run, slightly favor a new encounter
// Do the reverse as well // Do the reverse as well
const expectedEncountersByFloor = 8 / (180 - 10) * i; const expectedEncountersByFloor = targetEncountersPerRun / (180 - 10) * i;
const currentRunDiffFromAvg = expectedEncountersByFloor - numEncounters.reduce((a, b) => a + b); const currentRunDiffFromAvg = expectedEncountersByFloor - numEncounters.reduce((a, b) => a + b);
const favoredEncounterRate = encounterRate + currentRunDiffFromAvg * 5; const favoredEncounterRate = encounterRate + currentRunDiffFromAvg * 5;

View File

@ -8,7 +8,8 @@ import { Biome } from "#app/enums/biome";
import { SleepingSnorlaxEncounter } from "./sleeping-snorlax"; import { SleepingSnorlaxEncounter } from "./sleeping-snorlax";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
export const BASE_MYSTERY_ENCOUNTER_WEIGHT = 50; export const BASE_MYSTERY_ENCOUNTER_WEIGHT = 19;
export const AVERAGE_ENCOUNTERS_PER_RUN_TARGET = 15;
export const allMysteryEncounters : {[encounterType:string]: MysteryEncounter} = {}; export const allMysteryEncounters : {[encounterType:string]: MysteryEncounter} = {};

View File

@ -55,7 +55,7 @@ export const mysteryEncounter: SimpleTranslationEntries = {
"mysterious_challengers_outro_win": "The mysterious challenger was defeated!", "mysterious_challengers_outro_win": "The mysterious challenger was defeated!",
// Mysterious Encounters -- Rare Tier // Mysterious Encounters -- Rare Tier
"training_session_intro_message": "You've come across a some\ntraining tools and supplies.", "training_session_intro_message": "You've come across some\ntraining tools and supplies.",
"training_session_title": "Training Session", "training_session_title": "Training Session",
"training_session_description": "These supplies look like they could be used to train a member of your party! There are a few ways you could train your Pokémon, by battling against it with the rest of your team.", "training_session_description": "These supplies look like they could be used to train a member of your party! There are a few ways you could train your Pokémon, by battling against it with the rest of your team.",
"training_session_query": "How should you train?", "training_session_query": "How should you train?",

View File

@ -296,14 +296,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: () => {