mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-23 15:59:26 +02:00
ME related changes
This commit is contained in:
parent
c23da7728b
commit
d01e28fdcc
@ -3169,13 +3169,17 @@ export default class BattleScene extends SceneBase {
|
||||
/**
|
||||
* Loads or generates a mystery encounter
|
||||
* @param encounterType used to load session encounter when restarting game, etc.
|
||||
* @param canBypass optional boolean to indicate that the request is coming from a function that needs to access a Mystery Encounter outside of gameplay requirements
|
||||
* @returns
|
||||
*/
|
||||
getMysteryEncounter(encounterType?: MysteryEncounterType): MysteryEncounter {
|
||||
getMysteryEncounter(encounterType?: MysteryEncounterType, canBypass?: boolean): MysteryEncounter {
|
||||
// Loading override or session encounter
|
||||
let encounter: MysteryEncounter | null;
|
||||
if (!isNullOrUndefined(Overrides.MYSTERY_ENCOUNTER_OVERRIDE) && allMysteryEncounters.hasOwnProperty(Overrides.MYSTERY_ENCOUNTER_OVERRIDE)) {
|
||||
encounter = allMysteryEncounters[Overrides.MYSTERY_ENCOUNTER_OVERRIDE];
|
||||
} else if (canBypass) {
|
||||
encounter = allMysteryEncounters[encounterType ?? -1];
|
||||
return encounter;
|
||||
} else {
|
||||
encounter = !isNullOrUndefined(encounterType) ? allMysteryEncounters[encounterType] : null;
|
||||
}
|
||||
|
@ -128,6 +128,7 @@ export const ATrainersTestEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -166,6 +166,7 @@ export const AbsoluteAvariceEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
}
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -64,6 +64,7 @@ export const AnOfferYouCantRefuseEncounter: MysteryEncounter =
|
||||
speaker: `${namespace}:speaker`,
|
||||
},
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -110,6 +110,7 @@ export const BerriesAboundEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -276,6 +276,7 @@ export const BugTypeSuperfanEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -148,6 +148,7 @@ export const ClowningAroundEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -102,6 +102,7 @@ export const DancingLessonsEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
}
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -117,6 +117,7 @@ export const DarkDealEncounter: MysteryEncounter =
|
||||
.withSceneWaveRangeRequirement(30, CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES[1])
|
||||
.withScenePartySizeRequirement(2, 6, true) // Must have at least 2 pokemon in party
|
||||
.withCatchAllowed(true)
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -84,6 +84,7 @@ export const DelibirdyEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
}
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -51,6 +51,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter =
|
||||
},
|
||||
])
|
||||
.withAutoHideIntroVisuals(false)
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -52,6 +52,7 @@ export const FieldTripEncounter: MysteryEncounter =
|
||||
},
|
||||
])
|
||||
.withAutoHideIntroVisuals(false)
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -122,6 +122,7 @@ export const FieryFalloutEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -120,6 +120,7 @@ export const FightOrFlightEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -76,6 +76,7 @@ export const FunAndGamesEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro_dialogue`,
|
||||
},
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -96,6 +96,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
}
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -50,6 +50,7 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -125,6 +125,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -61,6 +61,7 @@ export const MysteriousChestEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
}
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -69,6 +69,7 @@ export const PartTimerEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -54,6 +54,7 @@ export const SafariZoneEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
},
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -62,6 +62,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter =
|
||||
speaker: `${namespace}:speaker`,
|
||||
},
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -88,6 +88,7 @@ export const SlumberingSnorlaxEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -58,6 +58,7 @@ export const TeleportingHijinksEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
}
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -196,6 +196,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -53,6 +53,7 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter =
|
||||
speaker: `${namespace}:speaker`,
|
||||
},
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -117,6 +117,7 @@ export const TheStrongStuffEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -94,6 +94,7 @@ export const TheWinstrateChallengeEncounter: MysteryEncounter =
|
||||
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -52,6 +52,7 @@ export const TrainingSessionEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
}
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -54,6 +54,7 @@ export const TrashToTreasureEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro`,
|
||||
},
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -125,6 +125,7 @@ export const UncommonBreedEncounter: MysteryEncounter =
|
||||
scene.time.delayedCall(500, () => scene.playSound("battle_anims/PRSFX- Spotlight2"));
|
||||
return true;
|
||||
})
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -125,6 +125,7 @@ export const WeirdDreamEncounter: MysteryEncounter =
|
||||
text: `${namespace}:intro_dialogue`,
|
||||
},
|
||||
])
|
||||
.setLocalizationKey(`${namespace}`)
|
||||
.withTitle(`${namespace}:title`)
|
||||
.withDescription(`${namespace}:description`)
|
||||
.withQuery(`${namespace}:query`)
|
||||
|
@ -190,7 +190,10 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
||||
secondaryPokemon?: PlayerPokemon[];
|
||||
|
||||
// #region Post-construct / Auto-populated params
|
||||
|
||||
/**
|
||||
* Localization Key
|
||||
*/
|
||||
localizationKey: string;
|
||||
/**
|
||||
* Dialogue object containing all the dialogue, messages, tooltips, etc. for an encounter
|
||||
*/
|
||||
@ -264,6 +267,7 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
||||
Object.assign(this, encounter);
|
||||
}
|
||||
this.encounterTier = this.encounterTier ?? MysteryEncounterTier.COMMON;
|
||||
this.localizationKey = this.localizationKey ?? "";
|
||||
this.dialogue = this.dialogue ?? {};
|
||||
this.spriteConfigs = this.spriteConfigs ? [...this.spriteConfigs] : [];
|
||||
// Default max is 1 for ROGUE encounters, 2 for others
|
||||
@ -528,6 +532,7 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
|
||||
options: [MysteryEncounterOption, MysteryEncounterOption, ...MysteryEncounterOption[]];
|
||||
enemyPartyConfigs: EnemyPartyConfig[] = [];
|
||||
|
||||
localizationKey: string = "";
|
||||
dialogue: MysteryEncounterDialogue = {};
|
||||
requirements: EncounterSceneRequirement[] = [];
|
||||
primaryPokemonRequirements: EncounterPokemonRequirement[] = [];
|
||||
@ -632,6 +637,16 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
|
||||
return this.withIntroSpriteConfigs(spriteConfigs).withIntroDialogue(dialogue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the localization key used by the encounter
|
||||
* @param localizationKey the localizationKey used for the encounter
|
||||
* @returns
|
||||
*/
|
||||
setLocalizationKey(localizationKey: string): this {
|
||||
this.localizationKey = localizationKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* OPTIONAL
|
||||
*/
|
||||
|
@ -37,7 +37,6 @@ import { GameOverPhase } from "#app/phases/game-over-phase";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
import { PartyExpPhase } from "#app/phases/party-exp-phase";
|
||||
import { Variant } from "#app/data/variant";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
|
||||
/**
|
||||
* Animates exclamation sprite over trainer's head at start of encounter
|
||||
@ -110,81 +109,6 @@ export interface EnemyPartyConfig {
|
||||
countAsSeen?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* TEMPORARY FUNCTION - will be removed once locales settles down and be replaced with a class-variable of the mystery encounter instead
|
||||
* @param encounter
|
||||
* @returns
|
||||
*/
|
||||
export function getMysteryEncounterKey(encounter: MysteryEncounterType | -1): 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
|
||||
|
@ -24,7 +24,7 @@ import { Species } from "#enums/species";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
|
||||
import { getBiomeName } from "#app/data/balance/biomes";
|
||||
import { getMysteryEncounterKey } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { MysteryEncounterType } from "#app/enums/mystery-encounter-type";
|
||||
|
||||
/**
|
||||
* RunInfoUiMode indicates possible overlays of RunInfoUiHandler.
|
||||
@ -299,7 +299,7 @@ export default class RunInfoUiHandler extends UiHandler {
|
||||
const subSprite = this.scene.add.sprite(56, -106, "pkmn__sub");
|
||||
subSprite.setScale(0.65);
|
||||
subSprite.setPosition(34, 46);
|
||||
const mysteryEncounterTitle = i18next.t(getMysteryEncounterKey(this.runInfo.mysteryEncounterType)+".title");
|
||||
const mysteryEncounterTitle = i18next.t(this.scene.getMysteryEncounter(this.runInfo.mysteryEncounterType as MysteryEncounterType, true).localizationKey+":title");
|
||||
const descContainer = this.scene.add.container(0, 0);
|
||||
const textBox = addTextObject(this.scene, 0, 0, mysteryEncounterTitle, TextStyle.WINDOW, { fontSize : "45px", wordWrap: {width: 160} });
|
||||
descContainer.add(textBox);
|
||||
|
Loading…
Reference in New Issue
Block a user