Adding ME handling

This commit is contained in:
frutescens 2024-09-28 00:35:56 -07:00
parent 666526c668
commit d7475793e6
2 changed files with 84 additions and 3 deletions

View File

@ -109,6 +109,76 @@ export interface EnemyPartyConfig {
countAsSeen?: boolean;
}
export function getMysteryEncounterKey(encounter: MysteryEncounterType): string {
const key = "mysteryEncounter:";
switch (encounter) {
case MysteryEncounterType.MYSTERIOUS_CHALLENGERS:
return key + "mysteriousChallengers";
case MysteryEncounterType.MYSTERIOUS_CHEST:
return key + "mysteriousChest";
case MysteryEncounterType.DARK_DEAL:
return key + "darkDeal";
case MysteryEncounterType.FIGHT_OR_FLIGHT:
return key + "fightOrFlight";
case MysteryEncounterType.SLUMBERING_SNORLAX:
return key + "slumberingSnorlax";
case MysteryEncounterType.TRAINING_SESSION:
return key + "trainingSession";
case MysteryEncounterType.DEPARTMENT_STORE_SALE:
return key + "departmentStoreSale";
case MysteryEncounterType.SHADY_VITAMIN_DEALER:
return key + "shadyVitaminDealer";
case MysteryEncounterType.FIELD_TRIP:
return key + "fieldTrip";
case MysteryEncounterType.FIERY_FALLOUT:
return key + "fieryFallout";
case MysteryEncounterType.LOST_AT_SEA:
return key + "lostAtSea";
case MysteryEncounterType.SAFARI_ZONE:
return key + "safariZone";
case MysteryEncounterType.THE_STRONG_STUFF:
return key + "theStrongStuff";
case MysteryEncounterType.THE_POKEMON_SALESMAN:
return key + "pokemonSalesman";
case MysteryEncounterType.AN_OFFER_YOU_CANT_REFUSE:
return key + "offerYouCantRefuse";
case MysteryEncounterType.DELIBIRDY:
return key + "delibirdy";
case MysteryEncounterType.ABSOLUTE_AVARICE:
return key + "absoluteAvarice";
case MysteryEncounterType.A_TRAINERS_TEST:
return key + "aTrainersTest";
case MysteryEncounterType.TRASH_TO_TREASURE:
return key + "trashToTreasure";
case MysteryEncounterType.BERRIES_ABOUND:
return key + "berriesAbound";
case MysteryEncounterType.CLOWNING_AROUND:
return key + "clowningAround";
case MysteryEncounterType.PART_TIMER:
return key + "partTimer";
case MysteryEncounterType.DANCING_LESSONS:
return key + "dancingLessons";
case MysteryEncounterType.WEIRD_DREAM:
return key + "weirdDream";
case MysteryEncounterType.THE_WINSTRATE_CHALLENGE:
return key + "theWinstrateChallenge";
case MysteryEncounterType.TELEPORTING_HIJINKS:
return key + "teleportingHijinks";
case MysteryEncounterType.BUG_TYPE_SUPERFAN:
return key + "bugTypeSuperfan";
case MysteryEncounterType.FUN_AND_GAMES:
return key + "funAndGames";
case MysteryEncounterType.UNCOMMON_BREED:
return key + "uncommonBreed";
case MysteryEncounterType.GLOBAL_TRADE_SYSTEM:
return key + "globalTradeSystem";
case MysteryEncounterType.THE_EXPERT_POKEMON_BREEDER:
return key + "expertPokemonBreeder";
default:
return key;
}
}
/**
* Generates an enemy party for a mystery encounter battle
* This will override and replace any standard encounter generation logic

View File

@ -5,6 +5,7 @@ import { SessionSaveData } from "../system/game-data";
import { TextStyle, addTextObject, addBBCodeTextObject, getTextColor } from "./text";
import { Mode } from "./ui";
import { addWindow } from "./ui-theme";
import { getPokeballAtlasKey } from "../data/pokeball";
import * as Utils from "../utils";
import PokemonData from "../system/pokemon-data";
import i18next from "i18next";
@ -246,7 +247,6 @@ export default class RunInfoUiHandler extends UiHandler {
private parseRunStatus() {
console.log(this.runInfo);
const runStatusText = addTextObject(this.scene, 6, 5, `${i18next.t("saveSlotSelectUiHandler:wave")} ${this.runInfo.waveIndex} - ${getBiomeName(this.runInfo.arena.biome)}`, TextStyle.WINDOW, {fontSize : "65px", lineSpacing: 0.1});
this.runResultContainer.add(runStatusText);
const enemyContainer = this.scene.add.container(0, 0);
// Wild - Single and Doubles
@ -263,8 +263,19 @@ export default class RunInfoUiHandler extends UiHandler {
}
} else if (this.runInfo.battleType === BattleType.TRAINER || (this.runInfo.battleType === BattleType.MYSTERY_ENCOUNTER && this.runInfo.trainer)) {
this.loadTrainerSprites(enemyContainer);
const row_limit = 3;
this.runInfo.enemyParty.forEach((p, i) => {
const pokeball = this.scene.add.sprite(0, 0, "pb");
pokeball.setFrame(getPokeballAtlasKey(p.pokeball));
pokeball.setScale(0.5);
pokeball.setPosition(52 + ((i % row_limit) * 8), (i <= 2) ? 25 : 32);
enemyContainer.add(pokeball);
});
} else if (this.runInfo.battleType === BattleType.MYSTERY_ENCOUNTER) {
console.log(this.runInfo.mysteryEncounterType);
}
this.runResultContainer.add(enemyContainer);
this.runResultContainer.add(runStatusText);
this.runContainer.add(this.runResultContainer);
}
@ -347,8 +358,8 @@ export default class RunInfoUiHandler extends UiHandler {
}
enemyContainer.add(doubleContainer);
} else {
const scale = (this.runDisplayMode === RunDisplayMode.RUN_HISTORY) ? 0.35 : 1;
const position = (this.runDisplayMode === RunDisplayMode.RUN_HISTORY) ? [12, 28] : [28, 12];
const scale = (this.runDisplayMode === RunDisplayMode.RUN_HISTORY) ? 0.35 : 0.65;
const position = (this.runDisplayMode === RunDisplayMode.RUN_HISTORY) ? [12, 28] : [35, 36];
tObjSprite.setScale(scale, scale);
tObjSprite.setPosition(position[0], position[1]);
enemyContainer.add(tObjSprite);