styling and text coloring fixes

This commit is contained in:
ImperialSympathizer 2024-07-09 23:19:44 -04:00
parent fc25c3b55e
commit efb00553c9
36 changed files with 302 additions and 338 deletions

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const DarkDealDialogue: MysteryEncounterDialogue = { export const DarkDealDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const DepartmentStoreSaleDialogue: MysteryEncounterDialogue = { export const DepartmentStoreSaleDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const FightOrFlightDialogue: MysteryEncounterDialogue = { export const FightOrFlightDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const MysteriousChallengersDialogue: MysteryEncounterDialogue = { export const MysteriousChallengersDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const MysteriousChestDialogue: MysteryEncounterDialogue = { export const MysteriousChestDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const ShadyVitaminDealerDialogue: MysteryEncounterDialogue = { export const ShadyVitaminDealerDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const SleepingSnorlaxDialogue: MysteryEncounterDialogue = { export const SleepingSnorlaxDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,4 +1,4 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const TrainingSessionDialogue: MysteryEncounterDialogue = { export const TrainingSessionDialogue: MysteryEncounterDialogue = {
intro: [ intro: [

View File

@ -1,22 +1,22 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import {AddPokeballModifierType} from "../../modifier/modifier-type"; import { AddPokeballModifierType } from "../../../modifier/modifier-type";
import { import {
EnemyPartyConfig, EnemyPokemonConfig, EnemyPartyConfig, EnemyPokemonConfig,
getRandomPlayerPokemon, getRandomPlayerPokemon,
getRandomSpeciesByStarterTier, getRandomSpeciesByStarterTier,
initBattleWithEnemyConfig, initBattleWithEnemyConfig,
leaveEncounterWithoutBattle leaveEncounterWithoutBattle
} from "./mystery-encounter-utils"; } from "../mystery-encounter-utils";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import {ModifierRewardPhase} from "#app/phases"; import { ModifierRewardPhase } from "#app/phases";
import {getPokemonSpecies} from "../pokemon-species"; import { getPokemonSpecies } from "../../pokemon-species";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import {PokeballType} from "../pokeball"; import { PokeballType } from "../../pokeball";
import {PartySizeRequirement, WaveCountRequirement} from "../mystery-encounter-requirements"; import { PartySizeRequirement, WaveCountRequirement } from "../mystery-encounter-requirements";
import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import {Type} from "#app/data/type"; import { Type } from "#app/data/type";
import {Species} from "#enums/species"; import { Species } from "#enums/species";
import {isNullOrUndefined, randSeedInt} from "#app/utils"; import { isNullOrUndefined, randSeedInt } from "#app/utils";
// Exclude Ultra Beasts, Paradox, Necrozma, Eternatus, and egg-locked mythicals // Exclude Ultra Beasts, Paradox, Necrozma, Eternatus, and egg-locked mythicals
const excludedBosses = [ const excludedBosses = [

View File

@ -1,15 +1,15 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import { import {
leaveEncounterWithoutBattle, setEncounterExp, leaveEncounterWithoutBattle, setEncounterExp,
setEncounterRewards, setEncounterRewards,
} from "#app/data/mystery-encounters/mystery-encounter-utils"; } from "#app/data/mystery-encounters/mystery-encounter-utils";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import {WaveCountRequirement} from "../mystery-encounter-requirements"; import { WaveCountRequirement } from "../mystery-encounter-requirements";
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import {modifierTypes} from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import {Species} from "#enums/species"; import { Species } from "#enums/species";
import {randSeedInt} from "#app/utils"; import { randSeedInt } from "#app/utils";
export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncounterBuilder() export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncounterBuilder()
.withEncounterType(MysteryEncounterType.DEPARTMENT_STORE_SALE) .withEncounterType(MysteryEncounterType.DEPARTMENT_STORE_SALE)
@ -50,7 +50,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount
} }
setEncounterExp(scene, scene.getParty().map(p => p.id), 300); setEncounterExp(scene, scene.getParty().map(p => p.id), 300);
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false });
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
}) })
.build()) .build())
@ -70,7 +70,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount
i++; i++;
} }
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false });
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
}) })
.build()) .build())
@ -90,7 +90,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount
i++; i++;
} }
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false });
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
}) })
.build()) .build())
@ -108,13 +108,13 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = new MysteryEncount
modifiers.push(modifierTypes.GREAT_BALL); modifiers.push(modifierTypes.GREAT_BALL);
} else if (roll < 60) { } else if (roll < 60) {
modifiers.push(modifierTypes.ULTRA_BALL); modifiers.push(modifierTypes.ULTRA_BALL);
} else { } else {
modifiers.push(modifierTypes.ROGUE_BALL); modifiers.push(modifierTypes.ROGUE_BALL);
} }
i++; i++;
} }
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false });
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
}) })
.build()) .build())

View File

@ -1,5 +1,5 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import {ModifierTier} from "#app/modifier/modifier-tier"; import { ModifierTier } from "#app/modifier/modifier-tier";
import { import {
EnemyPartyConfig, EnemyPartyConfig,
initBattleWithEnemyConfig, initBattleWithEnemyConfig,
@ -7,10 +7,10 @@ import {
setEncounterRewards, setEncounterRewards,
showEncounterText showEncounterText
} from "#app/data/mystery-encounters/mystery-encounter-utils"; } from "#app/data/mystery-encounters/mystery-encounter-utils";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import {MoveRequirement, WaveCountRequirement} from "../mystery-encounter-requirements"; import { MoveRequirement, WaveCountRequirement } from "../mystery-encounter-requirements";
import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import { import {
getPartyLuckValue, getPartyLuckValue,
getPlayerModifierTypeOptions, getPlayerModifierTypeOptions,
@ -18,13 +18,13 @@ import {
ModifierTypeOption, ModifierTypeOption,
regenerateModifierPoolThresholds regenerateModifierPoolThresholds
} from "#app/modifier/modifier-type"; } from "#app/modifier/modifier-type";
import {BattlerTagType} from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import {StatChangePhase} from "#app/phases"; import { StatChangePhase } from "#app/phases";
import {BattleStat} from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import Pokemon from "#app/field/pokemon"; import Pokemon from "#app/field/pokemon";
import {randSeedInt} from "#app/utils"; import { randSeedInt } from "#app/utils";
import {Moves} from "#enums/moves"; import { Moves } from "#enums/moves";
import {TextStyle} from "#app/ui/text"; import { TextStyle } from "#app/ui/text";
const validMovesForSteal = [ const validMovesForSteal = [
Moves.PLUCK, Moves.PLUCK,
@ -50,7 +50,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, scene.currentBattle.waveIndex, 0, getPartyLuckValue(scene.getParty()), true); const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, scene.currentBattle.waveIndex, 0, getPartyLuckValue(scene.getParty()), true);
const config: EnemyPartyConfig = { const config: EnemyPartyConfig = {
levelAdditiveMultiplier: 1, levelAdditiveMultiplier: 1,
pokemonConfigs: [{species: bossSpecies, isBoss: true}] pokemonConfigs: [{ species: bossSpecies, isBoss: true }]
}; };
encounter.enemyPartyConfigs = [config]; encounter.enemyPartyConfigs = [config];
@ -58,7 +58,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil
// 10-60 GREAT, 60-110 ULTRA, 110-160 ROGUE, 160-180 MASTER // 10-60 GREAT, 60-110 ULTRA, 110-160 ROGUE, 160-180 MASTER
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];
encounter.setDialogueToken("itemName", item.type.name); encounter.setDialogueToken("itemName", item.type.name);
encounter.misc = item; encounter.misc = item;
@ -103,7 +103,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil
.withOptionPhase(async (scene: BattleScene) => { .withOptionPhase(async (scene: BattleScene) => {
// Pick battle // Pick battle
const item = scene.currentBattle.mysteryEncounter.misc as ModifierTypeOption; const item = scene.currentBattle.mysteryEncounter.misc as ModifierTypeOption;
setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false });
await initBattleWithEnemyConfig(scene, scene.currentBattle.mysteryEncounter.enemyPartyConfigs[0]); await initBattleWithEnemyConfig(scene, scene.currentBattle.mysteryEncounter.enemyPartyConfigs[0]);
}) })
.build()) .build())
@ -112,7 +112,7 @@ export const FightOrFlightEncounter: MysteryEncounter = new MysteryEncounterBuil
// Pick steal // Pick steal
const encounter = scene.currentBattle.mysteryEncounter; const encounter = scene.currentBattle.mysteryEncounter;
const item = scene.currentBattle.mysteryEncounter.misc as ModifierTypeOption; const item = scene.currentBattle.mysteryEncounter.misc as ModifierTypeOption;
setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeOptions: [item], fillRemaining: false });
// If player has a stealing move, they succeed automatically // If player has a stealing move, they succeed automatically
const moveRequirement = new MoveRequirement(validMovesForSteal); const moveRequirement = new MoveRequirement(validMovesForSteal);

View File

@ -1,9 +1,9 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import { ModifierTier } from "#app/modifier/modifier-tier"; import { ModifierTier } from "#app/modifier/modifier-tier";
import {modifierTypes} from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import { EnemyPartyConfig, initBattleWithEnemyConfig, setEncounterRewards } from "#app/data/mystery-encounters/mystery-encounter-utils"; import { EnemyPartyConfig, initBattleWithEnemyConfig, setEncounterRewards } from "#app/data/mystery-encounters/mystery-encounter-utils";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import { WaveCountRequirement } from "../mystery-encounter-requirements"; import { WaveCountRequirement } from "../mystery-encounter-requirements";
import { import {
@ -12,8 +12,8 @@ import {
TrainerPartyTemplate, TrainerPartyTemplate,
trainerPartyTemplates trainerPartyTemplates
} from "#app/data/trainer-config"; } from "#app/data/trainer-config";
import * as Utils from "../../utils"; import * as Utils from "../../../utils";
import {PartyMemberStrength} from "#enums/party-member-strength"; import { PartyMemberStrength } from "#enums/party-member-strength";
export const MysteriousChallengersEncounter: MysteryEncounter = new MysteryEncounterBuilder() export const MysteriousChallengersEncounter: MysteryEncounter = new MysteryEncounterBuilder()
.withEncounterType(MysteryEncounterType.MYSTERIOUS_CHALLENGERS) .withEncounterType(MysteryEncounterType.MYSTERIOUS_CHALLENGERS)

View File

@ -1,4 +1,4 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import { ModifierTier } from "#app/modifier/modifier-tier"; import { ModifierTier } from "#app/modifier/modifier-tier";
import { import {
getHighestLevelPlayerPokemon, getHighestLevelPlayerPokemon,
@ -8,12 +8,12 @@ import {
setEncounterRewards, setEncounterRewards,
showEncounterText showEncounterText
} from "#app/data/mystery-encounters/mystery-encounter-utils"; } from "#app/data/mystery-encounters/mystery-encounter-utils";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import {WaveCountRequirement} from "../mystery-encounter-requirements"; import { WaveCountRequirement } from "../mystery-encounter-requirements";
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import {GameOverPhase} from "#app/phases"; import { GameOverPhase } from "#app/phases";
import {randSeedInt} from "#app/utils"; import { randSeedInt } from "#app/utils";
export const MysteriousChestEncounter: MysteryEncounter = new MysteryEncounterBuilder() export const MysteriousChestEncounter: MysteryEncounter = new MysteryEncounterBuilder()
.withEncounterType(MysteryEncounterType.MYSTERIOUS_CHEST) .withEncounterType(MysteryEncounterType.MYSTERIOUS_CHEST)
@ -42,25 +42,25 @@ export const MysteriousChestEncounter: MysteryEncounter = new MysteryEncounterBu
const roll = randSeedInt(100); const roll = randSeedInt(100);
if (roll > 60) { if (roll > 60) {
// Choose between 2 COMMON / 2 GREAT tier items (40%) // Choose between 2 COMMON / 2 GREAT tier items (40%)
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.GREAT, ModifierTier.GREAT]}); setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.GREAT, ModifierTier.GREAT] });
// Display result message then proceed to rewards // Display result message then proceed to rewards
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_normal_result"); queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_normal_result");
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
} else if (roll > 40) { } else if (roll > 40) {
// Choose between 3 ULTRA tier items (20%) // Choose between 3 ULTRA tier items (20%)
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA]}); setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA] });
// Display result message then proceed to rewards // Display result message then proceed to rewards
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_good_result"); queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_good_result");
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
} else if (roll > 36) { } else if (roll > 36) {
// Choose between 2 ROGUE tier items (4%) // Choose between 2 ROGUE tier items (4%)
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE]}); setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE] });
// Display result message then proceed to rewards // Display result message then proceed to rewards
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_great_result"); queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_great_result");
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
} else if (roll > 35) { } else if (roll > 35) {
// Choose 1 MASTER tier item (1%) // Choose 1 MASTER tier item (1%)
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.MASTER]}); setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.MASTER] });
// Display result message then proceed to rewards // Display result message then proceed to rewards
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_amazing_result"); queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_amazing_result");
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);

View File

@ -1,21 +1,21 @@
import MysteryEncounter from "../mystery-encounter"; import MysteryEncounter from "../mystery-encounter";
import {DarkDealEncounter} from "./dark-deal"; import { DarkDealEncounter } from "./dark-deal";
import {MysteriousChallengersEncounter} from "./mysterious-challengers"; import { MysteriousChallengersEncounter } from "./mysterious-challengers";
import {MysteriousChestEncounter} from "./mysterious-chest"; import { MysteriousChestEncounter } from "./mysterious-chest";
import {FightOrFlightEncounter} from "#app/data/mystery-encounters/fight-or-flight"; import { FightOrFlightEncounter } from "#app/data/mystery-encounters/encounters/fight-or-flight";
import {TrainingSessionEncounter} from "#app/data/mystery-encounters/training-session"; import { TrainingSessionEncounter } from "#app/data/mystery-encounters/encounters/training-session";
import { Biome } from "#app/enums/biome"; import { Biome } from "#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";
import {DepartmentStoreSaleEncounter} from "#app/data/mystery-encounters/department-store-sale"; import { DepartmentStoreSaleEncounter } from "#app/data/mystery-encounters/encounters/department-store-sale";
import {ShadyVitaminDealerEncounter} from "#app/data/mystery-encounters/shady-vitamin-dealer"; import { ShadyVitaminDealerEncounter } from "#app/data/mystery-encounters/encounters/shady-vitamin-dealer";
// Spawn chance: (BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT + WIGHT_INCREMENT_ON_SPAWN_MISS * <number of missed spawns>) / 256 // Spawn chance: (BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT + WIGHT_INCREMENT_ON_SPAWN_MISS * <number of missed spawns>) / 256
export const BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT = 1; export const BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT = 1;
export const WIGHT_INCREMENT_ON_SPAWN_MISS = 5; export const WIGHT_INCREMENT_ON_SPAWN_MISS = 5;
export const AVERAGE_ENCOUNTERS_PER_RUN_TARGET = 15; export const AVERAGE_ENCOUNTERS_PER_RUN_TARGET = 15;
export const allMysteryEncounters : {[encounterType:string]: MysteryEncounter} = {}; export const allMysteryEncounters: { [encounterType: string]: MysteryEncounter } = {};
// Add MysteryEncounterType to biomes to enable it exclusively for those biomes // Add MysteryEncounterType to biomes to enable it exclusively for those biomes
// To enable an encounter in all biomes, do not add to this map // To enable an encounter in all biomes, do not add to this map
@ -23,7 +23,7 @@ export const mysteryEncountersByBiome = new Map<Biome, MysteryEncounterType[]>([
[Biome.TOWN, [ [Biome.TOWN, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.PLAINS,[ [Biome.PLAINS, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.GRASS, [ [Biome.GRASS, [
@ -40,90 +40,50 @@ export const mysteryEncountersByBiome = new Map<Biome, MysteryEncounterType[]>([
MysteryEncounterType.SLEEPING_SNORLAX MysteryEncounterType.SLEEPING_SNORLAX
]], ]],
[Biome.SEA, [ [Biome.SEA, []],
[Biome.SWAMP, []],
]],
[Biome.SWAMP, [
]],
[Biome.BEACH, [ [Biome.BEACH, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.LAKE, [ [Biome.LAKE, []],
[Biome.SEABED, []],
]],
[Biome.SEABED, [
]],
[Biome.MOUNTAIN, [ [Biome.MOUNTAIN, [
MysteryEncounterType.SLEEPING_SNORLAX MysteryEncounterType.SLEEPING_SNORLAX
]], ]],
[Biome.BADLANDS, [ [Biome.BADLANDS, []],
]],
[Biome.CAVE, [ [Biome.CAVE, [
MysteryEncounterType.SLEEPING_SNORLAX MysteryEncounterType.SLEEPING_SNORLAX
]], ]],
[Biome.DESERT, [ [Biome.DESERT, []],
[Biome.ICE_CAVE, []],
]],
[Biome.ICE_CAVE, [
]],
[Biome.MEADOW, [ [Biome.MEADOW, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.POWER_PLANT, [ [Biome.POWER_PLANT, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.VOLCANO, [ [Biome.VOLCANO, []],
[Biome.GRAVEYARD, []],
]], [Biome.DOJO, []],
[Biome.GRAVEYARD, [
]],
[Biome.DOJO, [
]],
[Biome.FACTORY, [ [Biome.FACTORY, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.RUINS, [ [Biome.RUINS, []],
[Biome.WASTELAND, []],
]], [Biome.ABYSS, []],
[Biome.WASTELAND, [ [Biome.SPACE, []],
]],
[Biome.ABYSS, [
]],
[Biome.SPACE, [
]],
[Biome.CONSTRUCTION_SITE, [ [Biome.CONSTRUCTION_SITE, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.JUNGLE, [ [Biome.JUNGLE, []],
[Biome.FAIRY_CAVE, []],
]], [Biome.TEMPLE, []],
[Biome.FAIRY_CAVE, [
]],
[Biome.TEMPLE, [
]],
[Biome.SLUM, [ [Biome.SLUM, [
MysteryEncounterType.DEPARTMENT_STORE_SALE MysteryEncounterType.DEPARTMENT_STORE_SALE
]], ]],
[Biome.SNOWY_FOREST, [ [Biome.SNOWY_FOREST, []],
[Biome.ISLAND, []],
]], [Biome.LABORATORY, []]
[Biome.ISLAND, [
]],
[Biome.LABORATORY, [
]]
]); ]);
// Only add your MysterEncounter here if you want it to be in every biome. // Only add your MysterEncounter here if you want it to be in every biome.
@ -131,7 +91,7 @@ export const mysteryEncountersByBiome = new Map<Biome, MysteryEncounterType[]>([
export function initMysteryEncounters() { export function initMysteryEncounters() {
allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHALLENGERS] = MysteriousChallengersEncounter; allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHALLENGERS] = MysteriousChallengersEncounter;
allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHEST] = MysteriousChestEncounter; allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHEST] = MysteriousChestEncounter;
allMysteryEncounters[MysteryEncounterType.DARK_DEAL] = DarkDealEncounter; allMysteryEncounters[MysteryEncounterType.DARK_DEAL] = DarkDealEncounter;
allMysteryEncounters[MysteryEncounterType.FIGHT_OR_FLIGHT] = FightOrFlightEncounter; allMysteryEncounters[MysteryEncounterType.FIGHT_OR_FLIGHT] = FightOrFlightEncounter;
allMysteryEncounters[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionEncounter; allMysteryEncounters[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionEncounter;
allMysteryEncounters[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxEncounter; allMysteryEncounters[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxEncounter;

View File

@ -1,4 +1,4 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import { import {
generateModifierType, generateModifierType,
leaveEncounterWithoutBattle, leaveEncounterWithoutBattle,
@ -7,20 +7,20 @@ import {
setEncounterRewards, setEncounterRewards,
updatePlayerMoney, updatePlayerMoney,
} from "#app/data/mystery-encounters/mystery-encounter-utils"; } from "#app/data/mystery-encounters/mystery-encounter-utils";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { import {
HealthRatioRequirement, HealthRatioRequirement,
MoneyRequirement, MoneyRequirement,
StatusEffectRequirement, StatusEffectRequirement,
WaveCountRequirement WaveCountRequirement
} from "../mystery-encounter-requirements"; } from "../mystery-encounter-requirements";
import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import {modifierTypes} from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import {Species} from "#enums/species"; import { Species } from "#enums/species";
import {randSeedInt} from "#app/utils"; import { randSeedInt } from "#app/utils";
import Pokemon, {PlayerPokemon} from "#app/field/pokemon"; import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
import {StatusEffect} from "#app/data/status-effect"; import { StatusEffect } from "#app/data/status-effect";
export const ShadyVitaminDealerEncounter: MysteryEncounter = new MysteryEncounterBuilder() export const ShadyVitaminDealerEncounter: MysteryEncounter = new MysteryEncounterBuilder()
.withEncounterType(MysteryEncounterType.SHADY_VITAMIN_DEALER) .withEncounterType(MysteryEncounterType.SHADY_VITAMIN_DEALER)
@ -134,7 +134,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = new MysteryEncounte
i++; i++;
} }
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeFuncs: modifiers, fillRemaining: false });
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
}) })
.build()) .build())

View File

@ -1,23 +1,23 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import { import {
EnemyPartyConfig, EnemyPartyConfig,
EnemyPokemonConfig, generateModifierType, EnemyPokemonConfig, generateModifierType,
initBattleWithEnemyConfig, initBattleWithEnemyConfig,
leaveEncounterWithoutBattle, queueEncounterMessage, leaveEncounterWithoutBattle, queueEncounterMessage,
setEncounterRewards setEncounterRewards
} from "./mystery-encounter-utils"; } from "../mystery-encounter-utils";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import * as Utils from "../../utils"; import * as Utils from "../../../utils";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import {MoveRequirement, WaveCountRequirement} from "../mystery-encounter-requirements"; import { MoveRequirement, WaveCountRequirement } from "../mystery-encounter-requirements";
import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import { import {
ModifierTypeOption, ModifierTypeOption,
modifierTypes modifierTypes
} from "#app/modifier/modifier-type"; } from "#app/modifier/modifier-type";
import { getPokemonSpecies } from "../pokemon-species"; import { getPokemonSpecies } from "../../pokemon-species";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Status, StatusEffect } from "../status-effect"; import { Status, StatusEffect } from "../../status-effect";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { BerryType } from "#enums/berry-type"; import { BerryType } from "#enums/berry-type";
@ -65,7 +65,7 @@ export const SleepingSnorlaxEncounter: MysteryEncounter = new MysteryEncounterBu
.withOption(new MysteryEncounterOptionBuilder() .withOption(new MysteryEncounterOptionBuilder()
.withOptionPhase(async (scene: BattleScene) => { .withOptionPhase(async (scene: BattleScene) => {
const instance = scene.currentBattle.mysteryEncounter; const instance = scene.currentBattle.mysteryEncounter;
let roll:integer; let roll: integer;
scene.executeWithSeedOffset(() => { scene.executeWithSeedOffset(() => {
roll = Utils.randSeedInt(16, 0); roll = Utils.randSeedInt(16, 0);
}, scene.currentBattle.waveIndex); }, scene.currentBattle.waveIndex);
@ -73,12 +73,12 @@ export const SleepingSnorlaxEncounter: MysteryEncounter = new MysteryEncounterBu
if (roll > 4) { if (roll > 4) {
// Fall asleep and get a sitrus berry (75%) // Fall asleep and get a sitrus berry (75%)
const p = instance.primaryPokemon; const p = instance.primaryPokemon;
p.status = new Status(StatusEffect.SLEEP, 0, 3); p.status = new Status(StatusEffect.SLEEP, 0, 3);
p.updateInfo(true); p.updateInfo(true);
// const sitrus = (modifierTypes.BERRY?.() as ModifierTypeGenerator).generateType(scene.getParty(), [BerryType.SITRUS]); // const sitrus = (modifierTypes.BERRY?.() as ModifierTypeGenerator).generateType(scene.getParty(), [BerryType.SITRUS]);
const sitrus = generateModifierType(scene, modifierTypes.BERRY, [BerryType.SITRUS]); const sitrus = generateModifierType(scene, modifierTypes.BERRY, [BerryType.SITRUS]);
setEncounterRewards(scene, { guaranteedModifierTypeOptions: [new ModifierTypeOption(sitrus, 0)], fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeOptions: [new ModifierTypeOption(sitrus, 0)], fillRemaining: false });
queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_2_bad_result"); queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_2_bad_result");
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
} else { } else {
@ -101,7 +101,7 @@ export const SleepingSnorlaxEncounter: MysteryEncounter = new MysteryEncounterBu
.withPrimaryPokemonRequirement(new MoveRequirement([Moves.PLUCK, Moves.COVET, Moves.KNOCK_OFF, Moves.THIEF, Moves.TRICK, Moves.SWITCHEROO])) .withPrimaryPokemonRequirement(new MoveRequirement([Moves.PLUCK, Moves.COVET, Moves.KNOCK_OFF, Moves.THIEF, Moves.TRICK, Moves.SWITCHEROO]))
.withOptionPhase(async (scene: BattleScene) => { .withOptionPhase(async (scene: BattleScene) => {
// Leave encounter with no rewards or exp // Leave encounter with no rewards or exp
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS], fillRemaining: false}); setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS], fillRemaining: false });
queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_3_good_result"); queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_3_good_result");
leaveEncounterWithoutBattle(scene); leaveEncounterWithoutBattle(scene);
}) })

View File

@ -1,4 +1,4 @@
import BattleScene from "../../battle-scene"; import BattleScene from "../../../battle-scene";
import { import {
EnemyPartyConfig, EnemyPartyConfig,
getEncounterText, getEncounterText,
@ -6,23 +6,23 @@ import {
selectPokemonForOption, selectPokemonForOption,
setEncounterRewards setEncounterRewards
} from "#app/data/mystery-encounters/mystery-encounter-utils"; } from "#app/data/mystery-encounters/mystery-encounter-utils";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import MysteryEncounter, {MysteryEncounterBuilder, MysteryEncounterTier} from "../mystery-encounter"; import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
import {MysteryEncounterOptionBuilder} from "../mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
import {WaveCountRequirement} from "../mystery-encounter-requirements"; import { WaveCountRequirement } from "../mystery-encounter-requirements";
import {PlayerPokemon} from "#app/field/pokemon"; import { PlayerPokemon } from "#app/field/pokemon";
import PokemonData from "#app/system/pokemon-data"; import PokemonData from "#app/system/pokemon-data";
import {randSeedShuffle} from "#app/utils"; import { randSeedShuffle } from "#app/utils";
import {getNatureName, Nature} from "#app/data/nature"; import { getNatureName, Nature } from "#app/data/nature";
import {BattlerTagType} from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import {OptionSelectItem} from "#app/ui/abstact-option-select-ui-handler"; import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import {PokemonHeldItemModifier} from "#app/modifier/modifier"; import { PokemonHeldItemModifier } from "#app/modifier/modifier";
import {PokemonHeldItemModifierType} from "#app/modifier/modifier-type"; import { PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
import {Ability, allAbilities} from "#app/data/ability"; import { Ability, allAbilities } from "#app/data/ability";
import {speciesStarters} from "#app/data/pokemon-species"; import { speciesStarters } from "#app/data/pokemon-species";
import {AbilityAttr} from "#app/system/game-data"; import { AbilityAttr } from "#app/system/game-data";
import {Stat} from "#app/data/pokemon-stat"; import { Stat } from "#app/data/pokemon-stat";
import {pokemonInfo} from "#app/locales/en/pokemon-info"; import { pokemonInfo } from "#app/locales/en/pokemon-info";
export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBuilder() export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBuilder()
.withEncounterType(MysteryEncounterType.TRAINING_SESSION) .withEncounterType(MysteryEncounterType.TRAINING_SESSION)
@ -83,7 +83,7 @@ export const TrainingSessionEncounter: MysteryEncounter = new MysteryEncounterBu
const ivIndexes = []; const ivIndexes = [];
playerPokemon.ivs.forEach((iv, index) => { playerPokemon.ivs.forEach((iv, index) => {
if (iv < 31) { if (iv < 31) {
ivIndexes.push({iv: iv, index: index}); ivIndexes.push({ iv: iv, index: index });
} }
}); });
@ -302,5 +302,6 @@ function getEnemyConfig(scene: BattleScene, playerPokemon: PlayerPokemon, segmen
class ModifiersHolder { class ModifiersHolder {
public value: PokemonHeldItemModifier[] = []; public value: PokemonHeldItemModifier[] = [];
constructor() {} constructor() {
}
} }

View File

@ -1,7 +1,7 @@
import {MysteryEncounterTier} from "#app/data/mystery-encounter"; import { MysteryEncounterTier } from "#app/data/mystery-encounters/mystery-encounter";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import {BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT} from "#app/data/mystery-encounters/mystery-encounters"; import { BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT } from "#app/data/mystery-encounters/encounters/mystery-encounters";
import {isNullOrUndefined} from "../utils"; import { isNullOrUndefined } from "#app/utils";
export class MysteryEncounterData { export class MysteryEncounterData {
encounteredEvents: [MysteryEncounterType, MysteryEncounterTier][] = []; encounteredEvents: [MysteryEncounterType, MysteryEncounterTier][] = [];

View File

@ -1,13 +1,13 @@
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import {MysteriousChallengersDialogue} from "#app/data/mystery-encounters/dialogue/mysterious-challengers-dialogue"; import { MysteriousChallengersDialogue } from "#app/data/mystery-encounters/dialogue/mysterious-challengers-dialogue";
import {MysteriousChestDialogue} from "#app/data/mystery-encounters/dialogue/mysterious-chest-dialogue"; import { MysteriousChestDialogue } from "#app/data/mystery-encounters/dialogue/mysterious-chest-dialogue";
import {DarkDealDialogue} from "#app/data/mystery-encounters/dialogue/dark-deal-dialogue"; import { DarkDealDialogue } from "#app/data/mystery-encounters/dialogue/dark-deal-dialogue";
import {FightOrFlightDialogue} from "#app/data/mystery-encounters/dialogue/fight-or-flight-dialogue"; import { FightOrFlightDialogue } from "#app/data/mystery-encounters/dialogue/fight-or-flight-dialogue";
import {TrainingSessionDialogue} from "#app/data/mystery-encounters/dialogue/training-session-dialogue"; import { TrainingSessionDialogue } from "#app/data/mystery-encounters/dialogue/training-session-dialogue";
import { SleepingSnorlaxDialogue } from "./sleeping-snorlax-dialogue"; import { SleepingSnorlaxDialogue } from "./dialogue/sleeping-snorlax-dialogue";
import {DepartmentStoreSaleDialogue} from "#app/data/mystery-encounters/dialogue/department-store-sale-dialogue"; import { DepartmentStoreSaleDialogue } from "#app/data/mystery-encounters/dialogue/department-store-sale-dialogue";
import {ShadyVitaminDealerDialogue} from "#app/data/mystery-encounters/dialogue/shady-vitamin-dealer"; import { ShadyVitaminDealerDialogue } from "#app/data/mystery-encounters/dialogue/shady-vitamin-dealer";
import {TextStyle} from "#app/ui/text"; import { TextStyle } from "#app/ui/text";
export class TextDisplay { export class TextDisplay {
speaker?: TemplateStringsArray | `mysteryEncounter:${string}`; speaker?: TemplateStringsArray | `mysteryEncounter:${string}`;
@ -87,7 +87,7 @@ export interface EncounterTypeDialogue {
*/ */
export const allMysteryEncounterDialogue: EncounterTypeDialogue = {}; export const allMysteryEncounterDialogue: EncounterTypeDialogue = {};
export function initMysteryEncounterDialogue() { export function initMysteryEncounterDialogue() {
allMysteryEncounterDialogue[MysteryEncounterType.MYSTERIOUS_CHALLENGERS] = MysteriousChallengersDialogue; allMysteryEncounterDialogue[MysteryEncounterType.MYSTERIOUS_CHALLENGERS] = MysteriousChallengersDialogue;

View File

@ -1,13 +1,13 @@
import { PlayerPokemon } from "#app/field/pokemon"; import { PlayerPokemon } from "#app/field/pokemon";
import * as Utils from "../utils"; import * as Utils from "../../utils";
import BattleScene from "../battle-scene"; import BattleScene from "../../battle-scene";
import { EncounterPokemonRequirement, EncounterSceneRequirement } from "./mystery-encounter-requirements"; import { EncounterPokemonRequirement, EncounterSceneRequirement } from "./mystery-encounter-requirements";
import {OptionTextDisplay} from "#app/data/mystery-encounters/dialogue/mystery-encounter-dialogue"; import { OptionTextDisplay } from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export default interface MysteryEncounterOption { export default interface MysteryEncounterOption {
requirements?: EncounterSceneRequirement[]; requirements?: EncounterSceneRequirement[];
primaryPokemonRequirements?: EncounterPokemonRequirement[]; primaryPokemonRequirements?: EncounterPokemonRequirement[];
secondaryPokemonRequirements ?: EncounterPokemonRequirement[]; secondaryPokemonRequirements?: EncounterPokemonRequirement[];
primaryPokemon?: PlayerPokemon; primaryPokemon?: PlayerPokemon;
secondaryPokemon?: PlayerPokemon[]; secondaryPokemon?: PlayerPokemon[];
excludePrimaryFromSecondaryRequirements?: boolean; excludePrimaryFromSecondaryRequirements?: boolean;
@ -37,15 +37,16 @@ export default class MysteryEncounterOption implements MysteryEncounterOption {
this.meetsPrimaryRequirementAndPrimaryPokemonSelected(scene) && this.meetsPrimaryRequirementAndPrimaryPokemonSelected(scene) &&
this.meetsSupportingRequirementAndSupportingPokemonSelected(scene); this.meetsSupportingRequirementAndSupportingPokemonSelected(scene);
} }
meetsPrimaryRequirementAndPrimaryPokemonSelected?(scene: BattleScene) { meetsPrimaryRequirementAndPrimaryPokemonSelected?(scene: BattleScene) {
if (!this.primaryPokemonRequirements) { if (!this.primaryPokemonRequirements) {
return true; return true;
} }
let qualified:PlayerPokemon[] = scene.getParty(); let qualified: PlayerPokemon[] = scene.getParty();
for (const req of this.primaryPokemonRequirements) { for (const req of this.primaryPokemonRequirements) {
console.log(req); console.log(req);
if (req.meetsRequirement(scene)) { if (req.meetsRequirement(scene)) {
if (req instanceof EncounterPokemonRequirement) { if (req instanceof EncounterPokemonRequirement) {
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));
} }
} else { } else {
@ -71,14 +72,14 @@ export default class MysteryEncounterOption implements MysteryEncounterOption {
} }
if (truePrimaryPool.length > 0) { if (truePrimaryPool.length > 0) {
// always choose from the non-overlapping pokemon first // always choose from the non-overlapping pokemon first
this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)]; this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)];
return true; return true;
} else { } else {
// if there are multiple overlapping pokemon, we're okay - just choose one and take it out of the supporting pokemon pool // if there are multiple overlapping pokemon, we're okay - just choose one and take it out of the supporting pokemon pool
if (overlap.length > 1 || (this.secondaryPokemon.length - overlap.length >= 1)) { if (overlap.length > 1 || (this.secondaryPokemon.length - overlap.length >= 1)) {
// is this working? // is this working?
this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)]; this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)];
this.secondaryPokemon = this.secondaryPokemon.filter((supp)=> supp !== this.primaryPokemon); this.secondaryPokemon = this.secondaryPokemon.filter((supp) => supp !== this.primaryPokemon);
return true; return true;
} }
console.log("Mystery Encounter Edge Case: Requirement not met due to primay pokemon overlapping with support pokemon. There's no valid primary pokemon left."); console.log("Mystery Encounter Edge Case: Requirement not met due to primay pokemon overlapping with support pokemon. There's no valid primary pokemon left.");
@ -97,10 +98,10 @@ export default class MysteryEncounterOption implements MysteryEncounterOption {
return true; return true;
} }
let qualified:PlayerPokemon[] = scene.getParty(); let qualified: PlayerPokemon[] = scene.getParty();
for (const req of this.secondaryPokemonRequirements) { for (const req of this.secondaryPokemonRequirements) {
if (req.meetsRequirement(scene)) { if (req.meetsRequirement(scene)) {
if (req instanceof EncounterPokemonRequirement) { if (req instanceof EncounterPokemonRequirement) {
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));
} }
@ -150,7 +151,7 @@ export class MysteryEncounterOptionBuilder implements Partial<MysteryEncounterOp
return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements }); return Object.assign(this, { primaryPokemonRequirements: this.primaryPokemonRequirements });
} }
withSecondaryPokemonRequirement(requirement: EncounterPokemonRequirement, excludePrimaryFromSecondaryRequirements?: boolean): this & Required<Pick<MysteryEncounterOption, "secondaryPokemonRequirements">> { withSecondaryPokemonRequirement(requirement: EncounterPokemonRequirement, excludePrimaryFromSecondaryRequirements?: boolean): this & Required<Pick<MysteryEncounterOption, "secondaryPokemonRequirements">> {
this.secondaryPokemonRequirements.push(requirement); this.secondaryPokemonRequirements.push(requirement);
this.excludePrimaryFromSecondaryRequirements = excludePrimaryFromSecondaryRequirements; this.excludePrimaryFromSecondaryRequirements = excludePrimaryFromSecondaryRequirements;
return Object.assign(this, { secondaryPokemonRequirements: this.secondaryPokemonRequirements }); return Object.assign(this, { secondaryPokemonRequirements: this.secondaryPokemonRequirements });

View File

@ -1,19 +1,19 @@
import {PlayerPokemon} from "#app/field/pokemon"; import { PlayerPokemon } from "#app/field/pokemon";
import {ModifierType, PokemonHeldItemModifierType} from "#app/modifier/modifier-type"; import { ModifierType, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
import BattleScene from "../battle-scene"; import BattleScene from "../../battle-scene";
import {isNullOrUndefined} from "../utils"; import { isNullOrUndefined } from "#app/utils";
import {Abilities} from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import {Moves} from "#enums/moves"; import { Moves } from "#enums/moves";
import {Species} from "#enums/species"; import { Species } from "#enums/species";
import {TimeOfDay} from "#enums/time-of-day"; import { TimeOfDay } from "#enums/time-of-day";
import {Nature} from "./nature"; import { Nature } from "../nature";
import {EvolutionItem, pokemonEvolutions} from "./pokemon-evolutions"; import { EvolutionItem, pokemonEvolutions } from "../pokemon-evolutions";
import {FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger} from "./pokemon-forms"; import { FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger } from "../pokemon-forms";
import {SpeciesFormKey} from "./pokemon-species"; import { SpeciesFormKey } from "../pokemon-species";
import {StatusEffect} from "./status-effect"; import { StatusEffect } from "../status-effect";
import {Type} from "./type"; import { Type } from "../type";
import {WeatherType} from "./weather"; import { WeatherType } from "../weather";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
export interface EncounterRequirement { export interface EncounterRequirement {
meetsRequirement(scene: BattleScene): boolean; // Boolean to see if a requirement is met meetsRequirement(scene: BattleScene): boolean; // Boolean to see if a requirement is met
@ -147,6 +147,7 @@ export class WeatherRequirement extends EncounterSceneRequirement {
return true; return true;
} }
getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] {
return ["weather", WeatherType[scene.arena?.weather?.weatherType].replace("_", " ").toLocaleLowerCase()]; return ["weather", WeatherType[scene.arena?.weather?.weatherType].replace("_", " ").toLocaleLowerCase()];
} }
@ -205,7 +206,7 @@ export class PersistentModifierRequirement extends EncounterSceneRequirement {
getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] {
const requiredItemsInInventory = this.requiredItems.filter((a) => { const requiredItemsInInventory = this.requiredItems.filter((a) => {
scene.modifiers.filter((itemInScene) => itemInScene.type.id === a.id).length > 0; scene.modifiers.filter((itemInScene) => itemInScene.type.id === a.id).length > 0;
}); });
if (requiredItemsInInventory.length > 0) { if (requiredItemsInInventory.length > 0) {
return ["requiredItem", requiredItemsInInventory[0].name]; return ["requiredItem", requiredItemsInInventory[0].name];
@ -245,8 +246,8 @@ export class MoneyRequirement extends EncounterSceneRequirement {
export class SpeciesRequirement extends EncounterPokemonRequirement { export class SpeciesRequirement extends EncounterPokemonRequirement {
requiredSpecies: Species[]; requiredSpecies: Species[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(species: Species | Species[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(species: Species | Species[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -288,8 +289,8 @@ export class SpeciesRequirement extends EncounterPokemonRequirement {
export class NatureRequirement extends EncounterPokemonRequirement { export class NatureRequirement extends EncounterPokemonRequirement {
requiredNature: Nature[]; requiredNature: Nature[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(nature: Nature | Nature[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(nature: Nature | Nature[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -330,8 +331,8 @@ export class NatureRequirement extends EncounterPokemonRequirement {
export class TypeRequirement extends EncounterPokemonRequirement { export class TypeRequirement extends EncounterPokemonRequirement {
requiredType: Type[]; requiredType: Type[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(type: Type | Type[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(type: Type | Type[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -374,8 +375,8 @@ export class TypeRequirement extends EncounterPokemonRequirement {
export class MoveRequirement extends EncounterPokemonRequirement { export class MoveRequirement extends EncounterPokemonRequirement {
requiredMoves: Moves[] = []; requiredMoves: Moves[] = [];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(moves: Moves | Moves[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(moves: Moves | Moves[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -423,8 +424,8 @@ export class MoveRequirement extends EncounterPokemonRequirement {
*/ */
export class CompatibleMoveRequirement extends EncounterPokemonRequirement { export class CompatibleMoveRequirement extends EncounterPokemonRequirement {
requiredMoves: Moves[]; requiredMoves: Moves[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(learnableMove: Moves | Moves[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(learnableMove: Moves | Moves[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -512,8 +513,8 @@ export class EvolutionTargetSpeciesRequirement extends EncounterPokemonRequireme
export class AbilityRequirement extends EncounterPokemonRequirement { export class AbilityRequirement extends EncounterPokemonRequirement {
requiredAbilities: Abilities[]; requiredAbilities: Abilities[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(abilities: Abilities | Abilities[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(abilities: Abilities | Abilities[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -557,8 +558,8 @@ export class AbilityRequirement extends EncounterPokemonRequirement {
export class StatusEffectRequirement extends EncounterPokemonRequirement { export class StatusEffectRequirement extends EncounterPokemonRequirement {
requiredStatusEffect: StatusEffect[]; requiredStatusEffect: StatusEffect[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(statusEffect: StatusEffect | StatusEffect[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(statusEffect: StatusEffect | StatusEffect[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -632,8 +633,8 @@ export class StatusEffectRequirement extends EncounterPokemonRequirement {
*/ */
export class CanFormChangeWithItemRequirement extends EncounterPokemonRequirement { export class CanFormChangeWithItemRequirement extends EncounterPokemonRequirement {
requiredFormChangeItem: FormChangeItem[]; requiredFormChangeItem: FormChangeItem[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(formChangeItem: FormChangeItem | FormChangeItem[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(formChangeItem: FormChangeItem | FormChangeItem[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -654,13 +655,14 @@ export class CanFormChangeWithItemRequirement extends EncounterPokemonRequiremen
} }
return this.queryParty(partyPokemon).length >= this.minNumberOfPokemon; return this.queryParty(partyPokemon).length >= this.minNumberOfPokemon;
} }
filterByForm(pokemon, formChangeItem) {
filterByForm(pokemon, formChangeItem) {
if (pokemonFormChanges.hasOwnProperty(pokemon.species.speciesId) if (pokemonFormChanges.hasOwnProperty(pokemon.species.speciesId)
// Get all form changes for this species with an item trigger, including any compound triggers // Get all form changes for this species with an item trigger, including any compound triggers
&& pokemonFormChanges[pokemon.species.speciesId].filter(fc => fc.trigger.hasTriggerType(SpeciesFormChangeItemTrigger)) && pokemonFormChanges[pokemon.species.speciesId].filter(fc => fc.trigger.hasTriggerType(SpeciesFormChangeItemTrigger))
// Returns true if any form changes match this item // Returns true if any form changes match this item
.map(fc => fc.findTrigger(SpeciesFormChangeItemTrigger) as SpeciesFormChangeItemTrigger) .map(fc => fc.findTrigger(SpeciesFormChangeItemTrigger) as SpeciesFormChangeItemTrigger)
.flat().flatMap(fc => fc.item).includes(formChangeItem)) { .flat().flatMap(fc => fc.item).includes(formChangeItem)) {
return true; return true;
} else { } else {
return false; return false;
@ -688,8 +690,8 @@ export class CanFormChangeWithItemRequirement extends EncounterPokemonRequiremen
export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement { export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement {
requiredEvolutionItem: EvolutionItem[]; requiredEvolutionItem: EvolutionItem[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(evolutionItems: EvolutionItem | EvolutionItem[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(evolutionItems: EvolutionItem | EvolutionItem[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -716,7 +718,7 @@ export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement {
&& (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFormKey() !== SpeciesFormKey.GIGANTAMAX)) { && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFormKey() !== SpeciesFormKey.GIGANTAMAX)) {
return true; return true;
} else if (pokemon.isFusion() && pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) && pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.item === evolutionItem } else if (pokemon.isFusion() && pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) && pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.item === evolutionItem
&& (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFusionFormKey() !== SpeciesFormKey.GIGANTAMAX)) { && (!e.condition || e.condition.predicate(pokemon))).length && (pokemon.getFusionFormKey() !== SpeciesFormKey.GIGANTAMAX)) {
return true; return true;
} }
return false; return false;
@ -742,8 +744,8 @@ export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement {
export class HeldItemRequirement extends EncounterPokemonRequirement { export class HeldItemRequirement extends EncounterPokemonRequirement {
requiredHeldItemModifier: PokemonHeldItemModifierType[]; requiredHeldItemModifier: PokemonHeldItemModifierType[];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(heldItem: PokemonHeldItemModifierType | PokemonHeldItemModifierType[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(heldItem: PokemonHeldItemModifierType | PokemonHeldItemModifierType[], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -776,7 +778,7 @@ export class HeldItemRequirement extends EncounterPokemonRequirement {
getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] {
const requiredItems = this.requiredHeldItemModifier.filter((a) => { const requiredItems = this.requiredHeldItemModifier.filter((a) => {
pokemon.getHeldItems().filter((it) => it.type.id === a.id ).length > 0; pokemon.getHeldItems().filter((it) => it.type.id === a.id).length > 0;
}); });
if (requiredItems.length > 0) { if (requiredItems.length > 0) {
return ["heldItem", requiredItems[0].name]; return ["heldItem", requiredItems[0].name];
@ -787,8 +789,8 @@ export class HeldItemRequirement extends EncounterPokemonRequirement {
export class LevelRequirement extends EncounterPokemonRequirement { export class LevelRequirement extends EncounterPokemonRequirement {
requiredLevelRange?: [number, number]; requiredLevelRange?: [number, number];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(requiredLevelRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(requiredLevelRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -826,8 +828,8 @@ export class LevelRequirement extends EncounterPokemonRequirement {
export class FriendshipRequirement extends EncounterPokemonRequirement { export class FriendshipRequirement extends EncounterPokemonRequirement {
requiredFriendshipRange?: [number, number]; requiredFriendshipRange?: [number, number];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(requiredFriendshipRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(requiredFriendshipRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -869,8 +871,8 @@ export class FriendshipRequirement extends EncounterPokemonRequirement {
*/ */
export class HealthRatioRequirement extends EncounterPokemonRequirement { export class HealthRatioRequirement extends EncounterPokemonRequirement {
requiredHealthRange?: [number, number]; requiredHealthRange?: [number, number];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(requiredHealthRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(requiredHealthRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();
@ -903,14 +905,14 @@ export class HealthRatioRequirement extends EncounterPokemonRequirement {
} }
getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] { getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] {
return ["healthRatio", Math.floor(pokemon.getHpRatio()*100).toString() + "%"]; return ["healthRatio", Math.floor(pokemon.getHpRatio() * 100).toString() + "%"];
} }
} }
export class WeightRequirement extends EncounterPokemonRequirement { export class WeightRequirement extends EncounterPokemonRequirement {
requiredWeightRange?: [number, number]; requiredWeightRange?: [number, number];
minNumberOfPokemon:number; minNumberOfPokemon: number;
invertQuery:boolean; invertQuery: boolean;
constructor(requiredWeightRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) { constructor(requiredWeightRange: [number, number], minNumberOfPokemon: number = 1, invertQuery: boolean = false) {
super(); super();

View File

@ -1,12 +1,12 @@
import i18next from "i18next"; import i18next from "i18next";
import {BattleType} from "#app/battle"; import { BattleType } from "#app/battle";
import BattleScene from "../../battle-scene"; import BattleScene from "../../battle-scene";
import PokemonSpecies, {getPokemonSpecies, speciesStarters} from "../pokemon-species"; import PokemonSpecies, { getPokemonSpecies, speciesStarters } from "../pokemon-species";
import {MysteryEncounterVariant} from "../mystery-encounter"; import { MysteryEncounterVariant } from "./mystery-encounter";
import {Status, StatusEffect} from "../status-effect"; import { Status, StatusEffect } from "../status-effect";
import {TrainerConfig, trainerConfigs, TrainerSlot} from "../trainer-config"; import { TrainerConfig, trainerConfigs, TrainerSlot } from "../trainer-config";
import Pokemon, {FieldPosition, PlayerPokemon} from "#app/field/pokemon"; import Pokemon, { FieldPosition, PlayerPokemon } from "#app/field/pokemon";
import Trainer, {TrainerVariant} from "../../field/trainer"; import Trainer, { TrainerVariant } from "../../field/trainer";
import { import {
ExpBalanceModifier, ExpBalanceModifier,
ExpShareModifier, ExpShareModifier,
@ -32,24 +32,24 @@ import {
ShowPartyExpBarPhase, ShowPartyExpBarPhase,
TrainerVictoryPhase TrainerVictoryPhase
} from "#app/phases"; } from "#app/phases";
import {MysteryEncounterBattlePhase, MysteryEncounterRewardsPhase} from "#app/phases/mystery-encounter-phase"; import { MysteryEncounterBattlePhase, MysteryEncounterRewardsPhase } from "#app/phases/mystery-encounter-phase";
import * as Utils from "../../utils"; import * as Utils from "../../utils";
import {isNullOrUndefined} from "#app/utils"; import { isNullOrUndefined } from "#app/utils";
import {SelectModifierPhase} from "#app/phases/select-modifier-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import {TrainerType} from "#enums/trainer-type"; import { TrainerType } from "#enums/trainer-type";
import {Species} from "#enums/species"; import { Species } from "#enums/species";
import {Type} from "#app/data/type"; import { Type } from "#app/data/type";
import {BattlerTagType} from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import PokemonData from "#app/system/pokemon-data"; import PokemonData from "#app/system/pokemon-data";
import {Biome} from "#enums/biome"; import { Biome } from "#enums/biome";
import {biomeLinks} from "#app/data/biomes"; import { biomeLinks } from "#app/data/biomes";
import {Mode} from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import {PartyOption, PartyUiMode} from "#app/ui/party-ui-handler"; import { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler";
import {OptionSelectConfig, OptionSelectItem} from "#app/ui/abstact-option-select-ui-handler"; import { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import {WIGHT_INCREMENT_ON_SPAWN_MISS} from "#app/data/mystery-encounters/mystery-encounters"; import { WIGHT_INCREMENT_ON_SPAWN_MISS } from "#app/data/mystery-encounters/encounters/mystery-encounters";
import {getTextWithColors, TextStyle} from "#app/ui/text"; import { getTextWithColors, TextStyle } from "#app/ui/text";
import * as Overrides from "#app/overrides"; import * as Overrides from "#app/overrides";
import {UiTheme} from "#enums/ui-theme"; import { UiTheme } from "#enums/ui-theme";
/** /**
* *
@ -402,7 +402,7 @@ export async function initBattleWithEnemyConfig(scene: BattleScene, partyConfig:
// Set Status // Set Status
if (partyConfig.pokemonConfigs[e].status) { if (partyConfig.pokemonConfigs[e].status) {
// Default to cureturn 3 for sleep // Default to cureturn 3 for sleep
const cureTurn = partyConfig.pokemonConfigs[e].status === StatusEffect.SLEEP ? 3: null; const cureTurn = partyConfig.pokemonConfigs[e].status === StatusEffect.SLEEP ? 3 : null;
enemyPokemon.status = new Status(partyConfig.pokemonConfigs[e].status, 0, cureTurn); enemyPokemon.status = new Status(partyConfig.pokemonConfigs[e].status, 0, cureTurn);
} }

View File

@ -1,18 +1,18 @@
import BattleScene from "../battle-scene"; import BattleScene from "../../battle-scene";
import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../field/mystery-encounter-intro"; import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "../../field/mystery-encounter-intro";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import MysteryEncounterDialogue, { import MysteryEncounterDialogue, {
allMysteryEncounterDialogue allMysteryEncounterDialogue
} from "./mystery-encounters/dialogue/mystery-encounter-dialogue"; } from "./mystery-encounter-dialogue";
import MysteryEncounterOption from "./mystery-encounter-option"; import MysteryEncounterOption from "./mystery-encounter-option";
import { import {
EncounterPokemonRequirement, EncounterPokemonRequirement,
EncounterSceneRequirement EncounterSceneRequirement
} from "./mystery-encounter-requirements"; } from "./mystery-encounter-requirements";
import * as Utils from "../utils"; import * as Utils from "../../utils";
import {EnemyPartyConfig} from "#app/data/mystery-encounters/mystery-encounter-utils"; import { EnemyPartyConfig } from "#app/data/mystery-encounters/mystery-encounter-utils";
import Pokemon, { PlayerPokemon } from "#app/field/pokemon"; import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
import {isNullOrUndefined} from "../utils"; import { isNullOrUndefined } from "#app/utils";
export enum MysteryEncounterVariant { export enum MysteryEncounterVariant {
DEFAULT, DEFAULT,
@ -53,7 +53,7 @@ export default interface MysteryEncounter {
*/ */
requirements?: EncounterSceneRequirement[]; requirements?: EncounterSceneRequirement[];
primaryPokemonRequirements?: EncounterPokemonRequirement[]; primaryPokemonRequirements?: EncounterPokemonRequirement[];
secondaryPokemonRequirements ?: EncounterPokemonRequirement[]; // A list of requirements that must ALL be met by a subset of pokemon to trigger the event secondaryPokemonRequirements?: EncounterPokemonRequirement[]; // A list of requirements that must ALL be met by a subset of pokemon to trigger the event
excludePrimaryFromSupportRequirements?: boolean; excludePrimaryFromSupportRequirements?: boolean;
// Primary Pokemon is a single pokemon randomly selected from a set of pokemon that meet ALL primary pokemon requirements // Primary Pokemon is a single pokemon randomly selected from a set of pokemon that meet ALL primary pokemon requirements
primaryPokemon?: PlayerPokemon; primaryPokemon?: PlayerPokemon;
@ -157,7 +157,7 @@ export default class MysteryEncounter implements MysteryEncounter {
* @returns * @returns
*/ */
meetsRequirements?(scene: BattleScene) { meetsRequirements?(scene: BattleScene) {
const sceneReq = !this.requirements.some(requirement => !requirement.meetsRequirement(scene)); const sceneReq = !this.requirements.some(requirement => !requirement.meetsRequirement(scene));
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);
@ -179,17 +179,17 @@ export default class MysteryEncounter implements MysteryEncounter {
if (this.primaryPokemonRequirements.length === 0) { if (this.primaryPokemonRequirements.length === 0) {
const activeMon = scene.getParty().filter(p => p.isActive(true)); const activeMon = scene.getParty().filter(p => p.isActive(true));
if (activeMon.length > 0) { if (activeMon.length > 0) {
this.primaryPokemon = activeMon[0]; this.primaryPokemon = activeMon[0];
} else { } else {
this.primaryPokemon = scene.getParty().filter(p => !p.isFainted())[0]; this.primaryPokemon = scene.getParty().filter(p => !p.isFainted())[0];
} }
return true; return true;
} }
let qualified:PlayerPokemon[] = scene.getParty(); let qualified: PlayerPokemon[] = scene.getParty();
for (const req of this.primaryPokemonRequirements) { for (const req of this.primaryPokemonRequirements) {
console.log(req); console.log(req);
if (req.meetsRequirement(scene)) { if (req.meetsRequirement(scene)) {
if (req instanceof EncounterPokemonRequirement) { if (req instanceof EncounterPokemonRequirement) {
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));
} }
} else { } else {
@ -215,14 +215,14 @@ export default class MysteryEncounter implements MysteryEncounter {
} }
if (truePrimaryPool.length > 0) { if (truePrimaryPool.length > 0) {
// always choose from the non-overlapping pokemon first // always choose from the non-overlapping pokemon first
this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)]; this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)];
return true; return true;
} else { } else {
// if there are multiple overlapping pokemon, we're okay - just choose one and take it out of the primary pokemon pool // if there are multiple overlapping pokemon, we're okay - just choose one and take it out of the primary pokemon pool
if (overlap.length > 1 || (this.secondaryPokemon.length - overlap.length >= 1)) { if (overlap.length > 1 || (this.secondaryPokemon.length - overlap.length >= 1)) {
// is this working? // is this working?
this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)]; this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)];
this.secondaryPokemon = this.secondaryPokemon.filter((supp)=> supp !== this.primaryPokemon); this.secondaryPokemon = this.secondaryPokemon.filter((supp) => supp !== this.primaryPokemon);
return true; return true;
} }
console.log("Mystery Encounter Edge Case: Requirement not met due to primary pokemon overlapping with secondary pokemon. There's no valid primary pokemon left."); console.log("Mystery Encounter Edge Case: Requirement not met due to primary pokemon overlapping with secondary pokemon. There's no valid primary pokemon left.");
@ -241,10 +241,10 @@ export default class MysteryEncounter implements MysteryEncounter {
return true; return true;
} }
let qualified:PlayerPokemon[] = scene.getParty(); let qualified: PlayerPokemon[] = scene.getParty();
for (const req of this.secondaryPokemonRequirements) { for (const req of this.secondaryPokemonRequirements) {
if (req.meetsRequirement(scene)) { if (req.meetsRequirement(scene)) {
if (req instanceof EncounterPokemonRequirement) { if (req instanceof EncounterPokemonRequirement) {
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn)); qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));
} }
@ -376,9 +376,9 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
*/ */
withOption(option: MysteryEncounterOption): this & Pick<MysteryEncounter, "options"> { withOption(option: MysteryEncounterOption): this & Pick<MysteryEncounter, "options"> {
if (this.options[0] === null) { if (this.options[0] === null) {
return Object.assign(this, { options: [ option, this.options[0] ] }); return Object.assign(this, { options: [option, this.options[0]] });
} else if (this.options[1] === null) { } else if (this.options[1] === null) {
return Object.assign(this, { options: [this.options[0], option ] }); return Object.assign(this, { options: [this.options[0], option] });
} else { } else {
this.options.push(option); this.options.push(option);
return Object.assign(this, { options: this.options }); return Object.assign(this, { options: this.options });
@ -438,7 +438,7 @@ export class MysteryEncounterBuilder implements Partial<MysteryEncounter> {
// TODO: Maybe add an optional parameter for excluding primary pokemon from the support cast? // TODO: Maybe add an optional parameter for excluding primary pokemon from the support cast?
// ex. if your only grass type pokemon, a snivy, is chosen as primary, if the support pokemon requires a grass type, the event won't trigger because // ex. if your only grass type pokemon, a snivy, is chosen as primary, if the support pokemon requires a grass type, the event won't trigger because
// it's already been // it's already been
withSecondaryPokemonRequirement(requirement: EncounterPokemonRequirement, excludePrimaryFromSecondaryRequirements:boolean = false): this & Required<Pick<MysteryEncounter, "secondaryPokemonRequirements">> { withSecondaryPokemonRequirement(requirement: EncounterPokemonRequirement, excludePrimaryFromSecondaryRequirements: boolean = false): this & Required<Pick<MysteryEncounter, "secondaryPokemonRequirements">> {
this.secondaryPokemonRequirements.push(requirement); this.secondaryPokemonRequirements.push(requirement);
this.excludePrimaryFromSupportRequirements = excludePrimaryFromSecondaryRequirements; this.excludePrimaryFromSupportRequirements = excludePrimaryFromSecondaryRequirements;
return Object.assign(this, { excludePrimaryFromSecondaryRequirements: this.excludePrimaryFromSupportRequirements, secondaryPokemonRequirements: this.secondaryPokemonRequirements }); return Object.assign(this, { excludePrimaryFromSecondaryRequirements: this.excludePrimaryFromSupportRequirements, secondaryPokemonRequirements: this.secondaryPokemonRequirements });

View File

@ -1,6 +1,6 @@
import { GameObjects } from "phaser"; import { GameObjects } from "phaser";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import MysteryEncounter from "../data/mystery-encounter"; import MysteryEncounter from "../data/mystery-encounters/mystery-encounter";
export class MysteryEncounterSpriteConfig { export class MysteryEncounterSpriteConfig {
spriteKey: string; // e.g. "ace_trainer_f" spriteKey: string; // e.g. "ace_trainer_f"
@ -40,7 +40,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
const getSprite = (spriteKey: string, hasShadow?: boolean) => { const getSprite = (spriteKey: string, hasShadow?: boolean) => {
const ret = this.scene.addFieldSprite(0, 0, spriteKey); const ret = this.scene.addFieldSprite(0, 0, spriteKey);
ret.setOrigin(0.5, 1); ret.setOrigin(0.5, 1);
ret.setPipeline(this.scene.spritePipeline, {tone: [0.0, 0.0, 0.0, 0.0], hasShadow: !!hasShadow}); ret.setPipeline(this.scene.spritePipeline, { tone: [0.0, 0.0, 0.0, 0.0], hasShadow: !!hasShadow });
return ret; return ret;
}; };

View File

@ -22,8 +22,8 @@ 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/dialogue/mystery-encounter-dialogue"; 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/encounters/mystery-encounters";
export class LoadingScene extends SceneBase { export class LoadingScene extends SceneBase {
readonly LOAD_EVENTS = Phaser.Loader.Events; readonly LOAD_EVENTS = Phaser.Loader.Events;

View File

@ -1,4 +1,4 @@
import {SimpleTranslationEntries} from "#app/interfaces/locales"; import { SimpleTranslationEntries } from "#app/interfaces/locales";
/** /**
* Patterns that can be used: * Patterns that can be used:

View File

@ -19,7 +19,7 @@ import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { TimeOfDay } from "#enums/time-of-day"; import { TimeOfDay } from "#enums/time-of-day";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; // eslint-disable-line @typescript-eslint/no-unused-vars import {MysteryEncounterType} from "#enums/mystery-encounter-type"; // eslint-disable-line @typescript-eslint/no-unused-vars
import {MysteryEncounterTier} from "#app/data/mystery-encounter"; // eslint-disable-line @typescript-eslint/no-unused-vars import {MysteryEncounterTier} from "#app/data/mystery-encounters/mystery-encounter"; // eslint-disable-line @typescript-eslint/no-unused-vars
/** /**
* Overrides for testing different in game situations * Overrides for testing different in game situations

View File

@ -65,7 +65,7 @@ import { PlayerGender } from "#enums/player-gender";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { TrainerType } from "#enums/trainer-type"; import { TrainerType } from "#enums/trainer-type";
import { BattlePhase } from "#app/phases/battle-phase"; import { BattlePhase } from "#app/phases/battle-phase";
import { MysteryEncounterVariant } from "#app/data/mystery-encounter"; import { MysteryEncounterVariant } from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phase"; import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phase";
import { getEncounterText, handleMysteryEncounterVictory } from "#app/data/mystery-encounters/mystery-encounter-utils"; import { getEncounterText, handleMysteryEncounterVictory } from "#app/data/mystery-encounters/mystery-encounter-utils";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase";

View File

@ -1,6 +1,6 @@
import {Phase} from "#app/phase"; import { Phase } from "#app/phase";
import BattleScene from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
import {TrainerSlot} from "#app/data/trainer-config"; import { TrainerSlot } from "#app/data/trainer-config";
export class BattlePhase extends Phase { export class BattlePhase extends Phase {
constructor(scene: BattleScene) { constructor(scene: BattleScene) {

View File

@ -6,16 +6,16 @@ import {
getEncounterText getEncounterText
} from "../data/mystery-encounters/mystery-encounter-utils"; } from "../data/mystery-encounters/mystery-encounter-utils";
import { CheckSwitchPhase, NewBattlePhase, PostSummonPhase, ReturnPhase, ScanIvsPhase, SummonPhase, ToggleDoublePositionPhase } from "../phases"; import { CheckSwitchPhase, NewBattlePhase, PostSummonPhase, ReturnPhase, ScanIvsPhase, SummonPhase, ToggleDoublePositionPhase } from "../phases";
import MysteryEncounterOption from "../data/mystery-encounter-option"; import MysteryEncounterOption from "../data/mystery-encounters/mystery-encounter-option";
import { MysteryEncounterVariant } from "../data/mystery-encounter"; import { MysteryEncounterVariant } from "../data/mystery-encounters/mystery-encounter";
import { getCharVariantFromDialogue } from "../data/dialogue"; import { getCharVariantFromDialogue } from "../data/dialogue";
import { TrainerSlot } from "../data/trainer-config"; import { TrainerSlot } from "../data/trainer-config";
import { BattleSpec } from "../enums/battle-spec"; import { BattleSpec } from "../enums/battle-spec";
import { Tutorial, handleTutorial } from "../tutorial"; import { Tutorial, handleTutorial } from "../tutorial";
import { IvScannerModifier } from "../modifier/modifier"; import { IvScannerModifier } from "../modifier/modifier";
import * as Utils from "../utils"; import * as Utils from "../utils";
import {SelectModifierPhase} from "#app/phases/select-modifier-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import {isNullOrUndefined} from "../utils"; import { isNullOrUndefined } from "../utils";
/** /**
* Will handle (in order): * Will handle (in order):
@ -402,7 +402,7 @@ export class MysteryEncounterRewardsPhase extends Phase {
this.scene.currentBattle.mysteryEncounter.doEncounterRewards(this.scene); this.scene.currentBattle.mysteryEncounter.doEncounterRewards(this.scene);
} else if (this.addHealPhase) { } else if (this.addHealPhase) {
this.scene.tryRemovePhase(p => p instanceof SelectModifierPhase); this.scene.tryRemovePhase(p => p instanceof SelectModifierPhase);
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, 0, null, { fillRemaining: false, rerollMultiplier: 0})); this.scene.unshiftPhase(new SelectModifierPhase(this.scene, 0, null, { fillRemaining: false, rerollMultiplier: 0 }));
} }
}, this.scene.currentBattle.waveIndex * 1000); }, this.scene.currentBattle.waveIndex * 1000);

View File

@ -1,4 +1,4 @@
import {ModifierTier} from "#app/modifier/modifier-tier"; import { ModifierTier } from "#app/modifier/modifier-tier";
import { import {
CustomModifierSettings, CustomModifierSettings,
FusePokemonModifierType, getPlayerModifierTypeOptions, FusePokemonModifierType, getPlayerModifierTypeOptions,
@ -15,13 +15,13 @@ import {
} from "#app/modifier/modifier-type"; } from "#app/modifier/modifier-type";
import BattleScene from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import {ExtraModifierModifier, Modifier, PokemonHeldItemModifier} from "#app/modifier/modifier"; import { ExtraModifierModifier, Modifier, PokemonHeldItemModifier } from "#app/modifier/modifier";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import {Mode} from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import PartyUiHandler, {PartyOption, PartyUiMode} from "#app/ui/party-ui-handler"; import PartyUiHandler, { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler";
import ModifierSelectUiHandler, {SHOP_OPTIONS_ROW_LIMIT} from "#app/ui/modifier-select-ui-handler"; import ModifierSelectUiHandler, { SHOP_OPTIONS_ROW_LIMIT } from "#app/ui/modifier-select-ui-handler";
import {BattlePhase} from "#app/phases/battle-phase"; import { BattlePhase } from "#app/phases/battle-phase";
import {isNullOrUndefined} from "#app/utils"; import { isNullOrUndefined } from "#app/utils";
export class SelectModifierPhase extends BattlePhase { export class SelectModifierPhase extends BattlePhase {
private rerollCount: integer; private rerollCount: integer;
@ -47,7 +47,7 @@ export class SelectModifierPhase extends BattlePhase {
const party = this.scene.getParty(); const party = this.scene.getParty();
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount); regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
const modifierCount = new Utils.IntegerHolder(3); const modifierCount = new Utils.IntegerHolder(3);
if (this.isPlayer()) { if (this.isPlayer()) {
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount); this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
} }
@ -241,7 +241,7 @@ export class SelectModifierPhase extends BattlePhase {
} else { } else {
baseValue = 250; baseValue = 250;
} }
const multiplier = !isNullOrUndefined(this.customModifierSettings?.rerollMultiplier) ? this.customModifierSettings.rerollMultiplier : 1; const multiplier = !isNullOrUndefined(this.customModifierSettings?.rerollMultiplier) ? this.customModifierSettings.rerollMultiplier : 1;
return Math.min(Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount) * multiplier, Number.MAX_SAFE_INTEGER); return Math.min(Math.ceil(this.scene.currentBattle.waveIndex / 10) * baseValue * Math.pow(2, this.rerollCount) * multiplier, Number.MAX_SAFE_INTEGER);
} }

View File

@ -40,8 +40,8 @@ import { GameDataType } from "#enums/game-data-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { PlayerGender } from "#enums/player-gender"; import { PlayerGender } from "#enums/player-gender";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { MysteryEncounterData } from "../data/mystery-encounter-data"; import { MysteryEncounterData } from "../data/mystery-encounters/mystery-encounter-data";
import MysteryEncounter from "../data/mystery-encounter"; import MysteryEncounter from "../data/mystery-encounters/mystery-encounter";
export const defaultStarterSpecies: Species[] = [ export const defaultStarterSpecies: Species[] = [
Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE,

View File

@ -10,7 +10,7 @@ import {initSceneWithoutEncounterPhase} from "#test/utils/gameManagerUtils";
import {Species} from "#enums/species"; import {Species} from "#enums/species";
import BattleScene from "#app/battle-scene"; import BattleScene from "#app/battle-scene";
import {StatusEffect} from "#app/data/status-effect"; import {StatusEffect} from "#app/data/status-effect";
import MysteryEncounter from "#app/data/mystery-encounter"; import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
import {MessagePhase} from "#app/phases"; import {MessagePhase} from "#app/phases";
import {getPokemonSpecies, speciesStarters} from "#app/data/pokemon-species"; import {getPokemonSpecies, speciesStarters} from "#app/data/pokemon-species";
import {Type} from "#app/data/type"; import {Type} from "#app/data/type";
@ -277,7 +277,7 @@ describe("Mystery Encounter Utils", () => {
scene.currentBattle.mysteryEncounter.setDialogueToken("test", "value"); scene.currentBattle.mysteryEncounter.setDialogueToken("test", "value");
const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue");
expect(result).toEqual("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]"); expect(result).toEqual("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}");
}); });
it("can perform nested dialogue token injection", () => { it("can perform nested dialogue token injection", () => {
@ -286,7 +286,7 @@ describe("Mystery Encounter Utils", () => {
scene.currentBattle.mysteryEncounter.setDialogueToken("testvalue", "new"); scene.currentBattle.mysteryEncounter.setDialogueToken("testvalue", "new");
const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue");
expect(result).toEqual("[color=#f8f8f8][shadow=#6b5a73]valuevalue new @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]"); expect(result).toEqual("valuevalue new @ec{test1} value @ec{test\\} @ec{test\\} {test}");
}); });
}); });
@ -298,7 +298,7 @@ describe("Mystery Encounter Utils", () => {
const phaseSpy = vi.spyOn(game.scene, "unshiftPhase"); const phaseSpy = vi.spyOn(game.scene, "unshiftPhase");
queueEncounterMessage(scene, "mysteryEncounter:unit_test_dialogue"); queueEncounterMessage(scene, "mysteryEncounter:unit_test_dialogue");
expect(spy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", null, true); expect(spy).toHaveBeenCalledWith("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", null, true);
expect(phaseSpy).toHaveBeenCalledWith(expect.any(MessagePhase)); expect(phaseSpy).toHaveBeenCalledWith(expect.any(MessagePhase));
}); });
}); });
@ -310,7 +310,7 @@ describe("Mystery Encounter Utils", () => {
const spy = vi.spyOn(game.scene.ui, "showText"); const spy = vi.spyOn(game.scene.ui, "showText");
showEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); showEncounterText(scene, "mysteryEncounter:unit_test_dialogue");
expect(spy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", null, expect.any(Function), 0, true); expect(spy).toHaveBeenCalledWith("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", null, expect.any(Function), 0, true);
}); });
}); });
@ -321,7 +321,7 @@ describe("Mystery Encounter Utils", () => {
const spy = vi.spyOn(game.scene.ui, "showDialogue"); const spy = vi.spyOn(game.scene.ui, "showDialogue");
showEncounterDialogue(scene, "mysteryEncounter:unit_test_dialogue", "mysteryEncounter:unit_test_dialogue"); showEncounterDialogue(scene, "mysteryEncounter:unit_test_dialogue", "mysteryEncounter:unit_test_dialogue");
expect(spy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", "[color=#f8f8f8][shadow=#6b5a73]valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}[/color][/shadow]", null, undefined, 0, 0); expect(spy).toHaveBeenCalledWith("valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", "valuevalue @ec{testvalue} @ec{test1} value @ec{test\\} @ec{test\\} {test}", null, undefined, 0, 0);
}); });
}); });

View File

@ -8,7 +8,7 @@ import {Mode} from "#app/ui/ui";
import {Button} from "#enums/buttons"; import {Button} from "#enums/buttons";
import MysteryEncounterUiHandler from "#app/ui/mystery-encounter-ui-handler"; import MysteryEncounterUiHandler from "#app/ui/mystery-encounter-ui-handler";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; import {MysteryEncounterType} from "#enums/mystery-encounter-type";
import {MysteryEncounterTier} from "#app/data/mystery-encounter"; import {MysteryEncounterTier} from "#app/data/mystery-encounters/mystery-encounter";
describe("Mystery Encounter Phases", () => { describe("Mystery Encounter Phases", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -89,8 +89,8 @@ describe("Mystery Encounter Phases", () => {
expect(dialogueSpy).toHaveBeenCalledTimes(1); expect(dialogueSpy).toHaveBeenCalledTimes(1);
expect(messageSpy).toHaveBeenCalledTimes(2); expect(messageSpy).toHaveBeenCalledTimes(2);
expect(dialogueSpy).toHaveBeenCalledWith("What's this?", "???", null, expect.any(Function)); expect(dialogueSpy).toHaveBeenCalledWith("What's this?", "???", null, expect.any(Function));
expect(messageSpy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]Mysterious challengers have appeared![/color][/shadow]", null, expect.any(Function), 750, true); expect(messageSpy).toHaveBeenCalledWith("Mysterious challengers have appeared!", null, expect.any(Function), 750, true);
expect(messageSpy).toHaveBeenCalledWith("[color=#f8f8f8][shadow=#6b5a73]The trainer steps forward...[/color][/shadow]", null, expect.any(Function), 750, true); expect(messageSpy).toHaveBeenCalledWith("The trainer steps forward...", null, expect.any(Function), 750, true);
}); });
}); });

View File

@ -6,7 +6,7 @@ import AwaitableUiHandler from "./awaitable-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier"; import { LockModifierTiersModifier, PokemonHeldItemModifier } from "../modifier/modifier";
import { handleTutorial, Tutorial } from "../tutorial"; import { handleTutorial, Tutorial } from "../tutorial";
import {Button} from "#enums/buttons"; import { Button } from "#enums/buttons";
import MoveInfoOverlay from "./move-info-overlay"; import MoveInfoOverlay from "./move-info-overlay";
import { allMoves } from "../data/move"; import { allMoves } from "../data/move";
import * as Utils from "./../utils"; import * as Utils from "./../utils";
@ -23,8 +23,8 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
private continueButtonContainer: Phaser.GameObjects.Container; private continueButtonContainer: Phaser.GameObjects.Container;
private rerollCostText: Phaser.GameObjects.Text; private rerollCostText: Phaser.GameObjects.Text;
private lockRarityButtonText: Phaser.GameObjects.Text; private lockRarityButtonText: Phaser.GameObjects.Text;
private moveInfoOverlay : MoveInfoOverlay; private moveInfoOverlay: MoveInfoOverlay;
private moveInfoOverlayActive : boolean = false; private moveInfoOverlayActive: boolean = false;
private rowCursor: integer = 0; private rowCursor: integer = 0;
private player: boolean; private player: boolean;
@ -52,7 +52,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
const canvas = document.createElement("canvas"); const canvas = document.createElement("canvas");
const context = canvas.getContext("2d"); const context = canvas.getContext("2d");
const [ , styleOptions, , , ] = getTextStyleOptions(TextStyle.PARTY, (this.scene as BattleScene).uiTheme); const [, styleOptions, , ,] = getTextStyleOptions(TextStyle.PARTY, (this.scene as BattleScene).uiTheme);
context.font = styleOptions.fontSize + "px " + styleOptions.fontFamily; context.font = styleOptions.fontSize + "px " + styleOptions.fontFamily;
this.transferButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:transfer")).width; this.transferButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:transfer")).width;
this.checkButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:checkTeam")).width; this.checkButtonWidth = context.measureText(i18next.t("modifierSelectUiHandler:checkTeam")).width;
@ -113,7 +113,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
onSide: true, onSide: true,
right: true, right: true,
x: 1, x: 1,
y: -MoveInfoOverlay.getHeight(overlayScale, true) -1, y: -MoveInfoOverlay.getHeight(overlayScale, true) - 1,
width: (this.scene.game.canvas.width / 6) - 2, width: (this.scene.game.canvas.width / 6) - 2,
}); });
ui.add(this.moveInfoOverlay); ui.add(this.moveInfoOverlay);
@ -433,10 +433,10 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
this.cursorObj.setPosition(6, this.lockRarityButtonContainer.visible ? -72 : -60); this.cursorObj.setPosition(6, this.lockRarityButtonContainer.visible ? -72 : -60);
ui.showText(i18next.t("modifierSelectUiHandler:rerollDesc")); ui.showText(i18next.t("modifierSelectUiHandler:rerollDesc"));
} else if (cursor === 1) { } else if (cursor === 1) {
this.cursorObj.setPosition((this.scene.game.canvas.width - this.transferButtonWidth - this.checkButtonWidth)/6 - 30, -60); this.cursorObj.setPosition((this.scene.game.canvas.width - this.transferButtonWidth - this.checkButtonWidth) / 6 - 30, -60);
ui.showText(i18next.t("modifierSelectUiHandler:transferDesc")); ui.showText(i18next.t("modifierSelectUiHandler:transferDesc"));
} else if (cursor === 2) { } else if (cursor === 2) {
this.cursorObj.setPosition((this.scene.game.canvas.width - this.checkButtonWidth)/6 - 10, -60); this.cursorObj.setPosition((this.scene.game.canvas.width - this.checkButtonWidth) / 6 - 10, -60);
ui.showText(i18next.t("modifierSelectUiHandler:checkTeamDesc")); ui.showText(i18next.t("modifierSelectUiHandler:checkTeamDesc"));
} else { } else {
this.cursorObj.setPosition(6, -60); this.cursorObj.setPosition(6, -60);

View File

@ -6,7 +6,7 @@ import {Button} from "#enums/buttons";
import {addWindow, WindowVariant} from "./ui-theme"; import {addWindow, WindowVariant} from "./ui-theme";
import {MysteryEncounterPhase} from "../phases/mystery-encounter-phase"; import {MysteryEncounterPhase} from "../phases/mystery-encounter-phase";
import {PartyUiMode} from "./party-ui-handler"; import {PartyUiMode} from "./party-ui-handler";
import MysteryEncounterOption from "../data/mystery-encounter-option"; import MysteryEncounterOption from "../data/mystery-encounters/mystery-encounter-option";
import * as Utils from "../utils"; import * as Utils from "../utils";
import {isNullOrUndefined} from "../utils"; import {isNullOrUndefined} from "../utils";
import {getPokeballAtlasKey} from "../data/pokeball"; import {getPokeballAtlasKey} from "../data/pokeball";