finish unit tests for fiery fallout
This commit is contained in:
parent
37419eb1d3
commit
03f999e169
|
@ -2650,7 +2650,7 @@ export default class BattleScene extends SceneBase {
|
||||||
return encounter;
|
return encounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common / Uncommon / Rare / Super Rare
|
// Common / Great / Ultra / Rogue
|
||||||
const tierWeights = [64, 40, 21, 3];
|
const tierWeights = [64, 40, 21, 3];
|
||||||
|
|
||||||
// Adjust tier weights by previously encountered events to lower odds of only common/uncommons in run
|
// Adjust tier weights by previously encountered events to lower odds of only common/uncommons in run
|
||||||
|
|
|
@ -528,10 +528,10 @@ export function initMoveAnim(scene: BattleScene, move: Moves): Promise<void> {
|
||||||
/**
|
/**
|
||||||
* Fetches animation configs to be used in a Mystery Encounter
|
* Fetches animation configs to be used in a Mystery Encounter
|
||||||
* @param scene
|
* @param scene
|
||||||
* @param anims - one or more animations to fetch
|
* @param encounterAnim - one or more animations to fetch
|
||||||
*/
|
*/
|
||||||
export async function initEncounterAnims(scene: BattleScene, anims: EncounterAnim | EncounterAnim[]): Promise<void> {
|
export async function initEncounterAnims(scene: BattleScene, encounterAnim: EncounterAnim | EncounterAnim[]): Promise<void> {
|
||||||
anims = anims instanceof Array ? anims : [anims];
|
const anims = Array.isArray(encounterAnim) ? encounterAnim : [encounterAnim];
|
||||||
const encounterAnimNames = Utils.getEnumKeys(EncounterAnim);
|
const encounterAnimNames = Utils.getEnumKeys(EncounterAnim);
|
||||||
const encounterAnimIds = Utils.getEnumValues(EncounterAnim);
|
const encounterAnimIds = Utils.getEnumValues(EncounterAnim);
|
||||||
const encounterAnimFetches = [];
|
const encounterAnimFetches = [];
|
||||||
|
|
|
@ -175,7 +175,7 @@ export const FieryFalloutEncounter: IMysteryEncounter =
|
||||||
async (scene: BattleScene) => {
|
async (scene: BattleScene) => {
|
||||||
// Damage non-fire types and burn 1 random non-fire type member
|
// Damage non-fire types and burn 1 random non-fire type member
|
||||||
const encounter = scene.currentBattle.mysteryEncounter;
|
const encounter = scene.currentBattle.mysteryEncounter;
|
||||||
const nonFireTypes = scene.getParty().filter((p) => !p.getTypes().includes(Type.FIRE));
|
const nonFireTypes = scene.getParty().filter((p) => p.isAllowedInBattle() && !p.getTypes().includes(Type.FIRE));
|
||||||
|
|
||||||
for (const pkm of nonFireTypes) {
|
for (const pkm of nonFireTypes) {
|
||||||
const percentage = DAMAGE_PERCENTAGE / 100;
|
const percentage = DAMAGE_PERCENTAGE / 100;
|
||||||
|
@ -201,8 +201,8 @@ export const FieryFalloutEncounter: IMysteryEncounter =
|
||||||
.withOption(
|
.withOption(
|
||||||
new MysteryEncounterOptionBuilder()
|
new MysteryEncounterOptionBuilder()
|
||||||
.withOptionMode(EncounterOptionMode.DISABLED_OR_SPECIAL)
|
.withOptionMode(EncounterOptionMode.DISABLED_OR_SPECIAL)
|
||||||
.withPrimaryPokemonRequirement(new TypeRequirement(Type.STEEL, true,1)) // Will set option3PrimaryName dialogue token automatically
|
.withPrimaryPokemonRequirement(new TypeRequirement(Type.FIRE, true,1)) // Will set option3PrimaryName dialogue token automatically
|
||||||
.withSecondaryPokemonRequirement(new TypeRequirement(Type.STEEL, true,1)) // Will set option3SecondaryName dialogue token automatically
|
.withSecondaryPokemonRequirement(new TypeRequirement(Type.FIRE, true,1)) // Will set option3SecondaryName dialogue token automatically
|
||||||
.withDialogue({
|
.withDialogue({
|
||||||
buttonLabel: `${namespace}:option:3:label`,
|
buttonLabel: `${namespace}:option:3:label`,
|
||||||
buttonTooltip: `${namespace}:option:3:tooltip`,
|
buttonTooltip: `${namespace}:option:3:tooltip`,
|
||||||
|
|
|
@ -103,12 +103,7 @@ export class TimeOfDayRequirement extends EncounterSceneRequirement {
|
||||||
|
|
||||||
constructor(timeOfDay: TimeOfDay | TimeOfDay[]) {
|
constructor(timeOfDay: TimeOfDay | TimeOfDay[]) {
|
||||||
super();
|
super();
|
||||||
if (timeOfDay instanceof Array) {
|
this.requiredTimeOfDay = Array.isArray(timeOfDay) ? timeOfDay : [timeOfDay];
|
||||||
this.requiredTimeOfDay = timeOfDay;
|
|
||||||
} else {
|
|
||||||
this.requiredTimeOfDay = [];
|
|
||||||
this.requiredTimeOfDay.push(timeOfDay);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -130,12 +125,7 @@ export class WeatherRequirement extends EncounterSceneRequirement {
|
||||||
|
|
||||||
constructor(weather: WeatherType | WeatherType[]) {
|
constructor(weather: WeatherType | WeatherType[]) {
|
||||||
super();
|
super();
|
||||||
if (weather instanceof Array) {
|
this.requiredWeather = Array.isArray(weather) ? weather : [weather];
|
||||||
this.requiredWeather = weather;
|
|
||||||
} else {
|
|
||||||
this.requiredWeather = [];
|
|
||||||
this.requiredWeather.push(weather);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -185,12 +175,7 @@ export class PersistentModifierRequirement extends EncounterSceneRequirement {
|
||||||
requiredItems?: ModifierType[]; // TODO: not implemented
|
requiredItems?: ModifierType[]; // TODO: not implemented
|
||||||
constructor(item: ModifierType | ModifierType[]) {
|
constructor(item: ModifierType | ModifierType[]) {
|
||||||
super();
|
super();
|
||||||
if (item instanceof Array) {
|
this.requiredItems = Array.isArray(item) ? item : [item];
|
||||||
this.requiredItems = item;
|
|
||||||
} else {
|
|
||||||
this.requiredItems = [];
|
|
||||||
this.requiredItems.push(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -251,12 +236,7 @@ export class SpeciesRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (species instanceof Array) {
|
this.requiredSpecies = Array.isArray(species) ? species : [species];
|
||||||
this.requiredSpecies = species;
|
|
||||||
} else {
|
|
||||||
this.requiredSpecies = [];
|
|
||||||
this.requiredSpecies.push(species);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -294,12 +274,7 @@ export class NatureRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (nature instanceof Array) {
|
this.requiredNature = Array.isArray(nature) ? nature : [nature];
|
||||||
this.requiredNature = nature;
|
|
||||||
} else {
|
|
||||||
this.requiredNature = [];
|
|
||||||
this.requiredNature.push(nature);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -338,12 +313,7 @@ export class TypeRequirement extends EncounterPokemonRequirement {
|
||||||
this.excludeFainted = excludeFainted;
|
this.excludeFainted = excludeFainted;
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (type instanceof Array) {
|
this.requiredType = Array.isArray(type) ? type : [type];
|
||||||
this.requiredType = type;
|
|
||||||
} else {
|
|
||||||
this.requiredType = [];
|
|
||||||
this.requiredType.push(type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -388,12 +358,7 @@ export class MoveRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (moves instanceof Array) {
|
this.requiredMoves = Array.isArray(moves) ? moves : [moves];
|
||||||
this.requiredMoves = moves;
|
|
||||||
} else {
|
|
||||||
this.requiredMoves = [];
|
|
||||||
this.requiredMoves.push(moves);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -437,12 +402,7 @@ export class CompatibleMoveRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (learnableMove instanceof Array) {
|
this.requiredMoves = Array.isArray(learnableMove) ? learnableMove : [learnableMove];
|
||||||
this.requiredMoves = learnableMove;
|
|
||||||
} else {
|
|
||||||
this.requiredMoves = [];
|
|
||||||
this.requiredMoves.push(learnableMove);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -482,12 +442,7 @@ export class EvolutionTargetSpeciesRequirement extends EncounterPokemonRequireme
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (evolutionTargetSpecies instanceof Array) {
|
this.requiredEvolutionTargetSpecies = Array.isArray(evolutionTargetSpecies) ? evolutionTargetSpecies : [evolutionTargetSpecies];
|
||||||
this.requiredEvolutionTargetSpecies = evolutionTargetSpecies;
|
|
||||||
} else {
|
|
||||||
this.requiredEvolutionTargetSpecies = [];
|
|
||||||
this.requiredEvolutionTargetSpecies.push(evolutionTargetSpecies);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -526,12 +481,7 @@ export class AbilityRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (abilities instanceof Array) {
|
this.requiredAbilities = Array.isArray(abilities) ? abilities : [abilities];
|
||||||
this.requiredAbilities = abilities;
|
|
||||||
} else {
|
|
||||||
this.requiredAbilities = [];
|
|
||||||
this.requiredAbilities.push(abilities);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -571,12 +521,7 @@ export class StatusEffectRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (statusEffect instanceof Array) {
|
this.requiredStatusEffect = Array.isArray(statusEffect) ? statusEffect : [statusEffect];
|
||||||
this.requiredStatusEffect = statusEffect;
|
|
||||||
} else {
|
|
||||||
this.requiredStatusEffect = [];
|
|
||||||
this.requiredStatusEffect.push(statusEffect);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -646,12 +591,7 @@ export class CanFormChangeWithItemRequirement extends EncounterPokemonRequiremen
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (formChangeItem instanceof Array) {
|
this.requiredFormChangeItem = Array.isArray(formChangeItem) ? formChangeItem : [formChangeItem];
|
||||||
this.requiredFormChangeItem = formChangeItem;
|
|
||||||
} else {
|
|
||||||
this.requiredFormChangeItem = [];
|
|
||||||
this.requiredFormChangeItem.push(formChangeItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -703,12 +643,7 @@ export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (evolutionItems instanceof Array) {
|
this.requiredEvolutionItem = Array.isArray(evolutionItems) ? evolutionItems : [evolutionItems];
|
||||||
this.requiredEvolutionItem = evolutionItems;
|
|
||||||
} else {
|
|
||||||
this.requiredEvolutionItem = [];
|
|
||||||
this.requiredEvolutionItem.push(evolutionItems);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
@ -757,12 +692,7 @@ export class HeldItemRequirement extends EncounterPokemonRequirement {
|
||||||
super();
|
super();
|
||||||
this.minNumberOfPokemon = minNumberOfPokemon;
|
this.minNumberOfPokemon = minNumberOfPokemon;
|
||||||
this.invertQuery = invertQuery;
|
this.invertQuery = invertQuery;
|
||||||
if (heldItem instanceof Array) {
|
this.requiredHeldItemModifier = Array.isArray(heldItem) ? heldItem : [heldItem];
|
||||||
this.requiredHeldItemModifier = heldItem;
|
|
||||||
} else {
|
|
||||||
this.requiredHeldItemModifier = [];
|
|
||||||
this.requiredHeldItemModifier.push(heldItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meetsRequirement(scene: BattleScene): boolean {
|
meetsRequirement(scene: BattleScene): boolean {
|
||||||
|
|
|
@ -489,8 +489,8 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
withAnimations(...encounterAnimations: EncounterAnim[]): this & Required<Pick<IMysteryEncounter, "encounterAnimations">> {
|
withAnimations(...encounterAnimations: EncounterAnim[]): this & Required<Pick<IMysteryEncounter, "encounterAnimations">> {
|
||||||
encounterAnimations = encounterAnimations instanceof Array ? encounterAnimations : [encounterAnimations];
|
const animations = Array.isArray(encounterAnimations) ? encounterAnimations : [encounterAnimations];
|
||||||
return Object.assign(this, { encounterAnimations: encounterAnimations });
|
return Object.assign(this, { encounterAnimations: animations });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -207,10 +207,11 @@ export async function initBattleWithEnemyConfig(scene: BattleScene, partyConfig:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Status
|
// Set Status
|
||||||
if (partyConfig.pokemonConfigs[e].status) {
|
const statusEffects = partyConfig.pokemonConfigs[e].status;
|
||||||
|
if (statusEffects) {
|
||||||
// Default to cureturn 3 for sleep
|
// Default to cureturn 3 for sleep
|
||||||
const status = partyConfig.pokemonConfigs[e].status instanceof Array ? partyConfig.pokemonConfigs[e].status[0] : partyConfig.pokemonConfigs[e].status;
|
const status = Array.isArray(statusEffects) ? statusEffects[0] : statusEffects;
|
||||||
const cureTurn = partyConfig.pokemonConfigs[e].status instanceof Array ? partyConfig.pokemonConfigs[e].status[1] : partyConfig.pokemonConfigs[e].status === StatusEffect.SLEEP ? 3 : null;
|
const cureTurn = Array.isArray(statusEffects) ? statusEffects[1] : statusEffects === StatusEffect.SLEEP ? 3 : null;
|
||||||
enemyPokemon.status = new Status(status, 0, cureTurn);
|
enemyPokemon.status = new Status(status, 0, cureTurn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +282,7 @@ export async function initBattleWithEnemyConfig(scene: BattleScene, partyConfig:
|
||||||
* @param moves
|
* @param moves
|
||||||
*/
|
*/
|
||||||
export function initCustomMovesForEncounter(scene: BattleScene, moves: Moves | Moves[]) {
|
export function initCustomMovesForEncounter(scene: BattleScene, moves: Moves | Moves[]) {
|
||||||
moves = moves instanceof Array ? moves : [moves];
|
moves = Array.isArray(moves) ? moves : [moves];
|
||||||
return Promise.all(moves.map(move => initMoveAnim(scene, move)))
|
return Promise.all(moves.map(move => initMoveAnim(scene, move)))
|
||||||
.then(() => loadMoveAnimAssets(scene, moves));
|
.then(() => loadMoveAnimAssets(scene, moves));
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,8 +98,8 @@ export function getLowestLevelPlayerPokemon(scene: BattleScene, unfainted: boole
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getRandomSpeciesByStarterTier(starterTiers: number | [number, number], excludedSpecies?: Species[], types?: Type[]): Species {
|
export function getRandomSpeciesByStarterTier(starterTiers: number | [number, number], excludedSpecies?: Species[], types?: Type[]): Species {
|
||||||
let min = starterTiers instanceof Array ? starterTiers[0] : starterTiers;
|
let min = Array.isArray(starterTiers) ? starterTiers[0] : starterTiers;
|
||||||
let max = starterTiers instanceof Array ? starterTiers[1] : starterTiers;
|
let max = Array.isArray(starterTiers) ? starterTiers[1] : starterTiers;
|
||||||
|
|
||||||
let filteredSpecies: [PokemonSpecies, number][] = Object.keys(speciesStarters)
|
let filteredSpecies: [PokemonSpecies, number][] = Object.keys(speciesStarters)
|
||||||
.map(s => [parseInt(s) as Species, speciesStarters[s] as number])
|
.map(s => [parseInt(s) as Species, speciesStarters[s] as number])
|
||||||
|
|
|
@ -89,8 +89,7 @@ export async function skipBattleRunMysteryEncounterRewardsPhase(game: GameManage
|
||||||
p.status = new Status(StatusEffect.FAINT);
|
p.status = new Status(StatusEffect.FAINT);
|
||||||
game.scene.field.remove(p);
|
game.scene.field.remove(p);
|
||||||
});
|
});
|
||||||
game.scene.unshiftPhase(new VictoryPhase(game.scene, 0));
|
game.scene.pushPhase(new VictoryPhase(game.scene, 0));
|
||||||
game.endPhase();
|
|
||||||
game.phaseInterceptor.superEndPhase();
|
game.phaseInterceptor.superEndPhase();
|
||||||
await game.phaseInterceptor.to(MysteryEncounterRewardsPhase, true);
|
await game.phaseInterceptor.to(MysteryEncounterRewardsPhase, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,16 +9,19 @@ import Battle from "#app/battle";
|
||||||
import { Gender } from "#app/data/gender";
|
import { Gender } from "#app/data/gender";
|
||||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||||
import * as BattleAnims from "#app/data/battle-anims";
|
import * as BattleAnims from "#app/data/battle-anims";
|
||||||
|
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import { EncounterOptionMode } from "#app/data/mystery-encounters/mystery-encounter-option";
|
import { EncounterOptionMode } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||||
import { runSelectMysteryEncounterOption, skipBattleRunMysteryEncounterRewardsPhase } from "#test/mystery-encounter/encounterTestUtils";
|
import { runSelectMysteryEncounterOption, skipBattleRunMysteryEncounterRewardsPhase } from "#test/mystery-encounter/encounterTestUtils";
|
||||||
import { CommandPhase, MovePhase, SelectModifierPhase } from "#app/phases";
|
import { CommandPhase, MovePhase, SelectModifierPhase } from "#app/phases";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import BattleScene from "#app/battle-scene";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||||
|
import { Type } from "#app/data/type";
|
||||||
|
import { Status, StatusEffect } from "#app/data/status-effect";
|
||||||
|
|
||||||
const namespace = "mysteryEncounter:fieryFallout";
|
const namespace = "mysteryEncounter:fieryFallout";
|
||||||
/** Arcanine and Ninetails for 2 Fire types. Lapras for burnable mon. */
|
/** Arcanine and Ninetails for 2 Fire types. Lapras, Gengar, Abra for burnable mon. */
|
||||||
const defaultParty = [Species.ARCANINE, Species.NINETALES, Species.LAPRAS];
|
const defaultParty = [Species.ARCANINE, Species.NINETALES, Species.LAPRAS, Species.GENGAR, Species.ABRA];
|
||||||
const defaultBiome = Biome.VOLCANO;
|
const defaultBiome = Biome.VOLCANO;
|
||||||
const defaultWave = 45;
|
const defaultWave = 45;
|
||||||
|
|
||||||
|
@ -37,6 +40,7 @@ describe("Fiery Fallout - Mystery Encounter", () => {
|
||||||
game.override.mysteryEncounterChance(100);
|
game.override.mysteryEncounterChance(100);
|
||||||
game.override.startingWave(defaultWave);
|
game.override.startingWave(defaultWave);
|
||||||
game.override.startingBiome(defaultBiome);
|
game.override.startingBiome(defaultBiome);
|
||||||
|
game.override.trainerWave(false);
|
||||||
|
|
||||||
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
|
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
|
||||||
new Map<Biome, MysteryEncounterType[]>([
|
new Map<Biome, MysteryEncounterType[]>([
|
||||||
|
@ -168,12 +172,12 @@ describe("Fiery Fallout - Mystery Encounter", () => {
|
||||||
&& (m as PokemonHeldItemModifier).pokemonId === leadPokemonId, true) as PokemonHeldItemModifier[];
|
&& (m as PokemonHeldItemModifier).pokemonId === leadPokemonId, true) as PokemonHeldItemModifier[];
|
||||||
const charcoal = leadPokemonItems.find(i => i.type.name === "Charcoal");
|
const charcoal = leadPokemonItems.find(i => i.type.name === "Charcoal");
|
||||||
expect(charcoal).toBeDefined;
|
expect(charcoal).toBeDefined;
|
||||||
});
|
}, 100000000);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Option 2 - Suffer the weather", () => {
|
describe("Option 2 - Suffer the weather", () => {
|
||||||
it("should have the correct properties", () => {
|
it("should have the correct properties", () => {
|
||||||
const option1 = FieryFalloutEncounter.options[0];
|
const option1 = FieryFalloutEncounter.options[1];
|
||||||
expect(option1.optionMode).toBe(EncounterOptionMode.DEFAULT);
|
expect(option1.optionMode).toBe(EncounterOptionMode.DEFAULT);
|
||||||
expect(option1.dialogue).toBeDefined();
|
expect(option1.dialogue).toBeDefined();
|
||||||
expect(option1.dialogue).toStrictEqual({
|
expect(option1.dialogue).toStrictEqual({
|
||||||
|
@ -187,32 +191,32 @@ describe("Fiery Fallout - Mystery Encounter", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should damage all (allowed in battle) party PKM by 25%", async () => {
|
it("should damage all non-fire party PKM by 20% and randomly burn 1", async () => {
|
||||||
game.override.startingWave(33);
|
|
||||||
|
|
||||||
await game.runToMysteryEncounter(defaultParty);
|
await game.runToMysteryEncounter(defaultParty);
|
||||||
|
|
||||||
const party = scene.getParty();
|
const party = scene.getParty();
|
||||||
|
const lapras = party.find((pkm) => pkm.species.speciesId === Species.LAPRAS);
|
||||||
|
lapras.status = new Status(StatusEffect.POISON);
|
||||||
const abra = party.find((pkm) => pkm.species.speciesId === Species.ABRA);
|
const abra = party.find((pkm) => pkm.species.speciesId === Species.ABRA);
|
||||||
vi.spyOn(abra, "isAllowedInBattle").mockReturnValue(false);
|
vi.spyOn(abra, "isAllowedInBattle").mockReturnValue(false);
|
||||||
|
|
||||||
await runSelectMysteryEncounterOption(game, 3);
|
await runSelectMysteryEncounterOption(game, 2);
|
||||||
|
|
||||||
const allowedPkm = party.filter((pkm) => pkm.isAllowedInBattle());
|
const burnablePokemon = party.filter((pkm) => pkm.isAllowedInBattle() && !pkm.getTypes().includes(Type.FIRE));
|
||||||
const notAllowedPkm = party.filter((pkm) => !pkm.isAllowedInBattle());
|
const notBurnablePokemon = party.filter((pkm) => !pkm.isAllowedInBattle() || pkm.getTypes().includes(Type.FIRE));
|
||||||
allowedPkm.forEach((pkm) =>
|
expect(scene.currentBattle.mysteryEncounter.dialogueTokens["burnedPokemon"]).toBe("Gengar");
|
||||||
expect(pkm.hp, `${pkm.name} should have receivd 25% damage: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp() - Math.floor(pkm.getMaxHp() * 0.25))
|
burnablePokemon.forEach((pkm) => {
|
||||||
);
|
expect(pkm.hp, `${pkm.name} should have received 20% damage: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp() - Math.floor(pkm.getMaxHp() * 0.2));
|
||||||
|
});
|
||||||
notAllowedPkm.forEach((pkm) => expect(pkm.hp, `${pkm.name} should be full hp: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp()));
|
expect(burnablePokemon.some(pkm => pkm?.status?.effect === StatusEffect.BURN)).toBeTruthy();
|
||||||
|
notBurnablePokemon.forEach((pkm) => expect(pkm.hp, `${pkm.name} should be full hp: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp()));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should leave encounter without battle", async () => {
|
it("should leave encounter without battle", async () => {
|
||||||
game.override.startingWave(33);
|
|
||||||
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
|
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
|
||||||
|
|
||||||
await game.runToMysteryEncounter(defaultParty);
|
await game.runToMysteryEncounter(defaultParty);
|
||||||
await runSelectMysteryEncounterOption(game, 3);
|
await runSelectMysteryEncounterOption(game, 2);
|
||||||
|
|
||||||
expect(leaveEncounterWithoutBattleSpy).toBeCalled();
|
expect(leaveEncounterWithoutBattleSpy).toBeCalled();
|
||||||
});
|
});
|
||||||
|
@ -220,42 +224,36 @@ describe("Fiery Fallout - Mystery Encounter", () => {
|
||||||
|
|
||||||
describe("Option 3 - use FIRE types", () => {
|
describe("Option 3 - use FIRE types", () => {
|
||||||
it("should have the correct properties", () => {
|
it("should have the correct properties", () => {
|
||||||
const option1 = FieryFalloutEncounter.options[0];
|
const option1 = FieryFalloutEncounter.options[2];
|
||||||
expect(option1.optionMode).toBe(EncounterOptionMode.DEFAULT);
|
expect(option1.optionMode).toBe(EncounterOptionMode.DISABLED_OR_SPECIAL);
|
||||||
expect(option1.dialogue).toBeDefined();
|
expect(option1.dialogue).toBeDefined();
|
||||||
expect(option1.dialogue).toStrictEqual({
|
expect(option1.dialogue).toStrictEqual({
|
||||||
buttonLabel: `${namespace}:option:1:label`,
|
buttonLabel: `${namespace}:option:3:label`,
|
||||||
buttonTooltip: `${namespace}:option:1:tooltip`,
|
buttonTooltip: `${namespace}:option:3:tooltip`,
|
||||||
|
disabledButtonTooltip: `${namespace}:option:3:disabled_tooltip`,
|
||||||
selected: [
|
selected: [
|
||||||
{
|
{
|
||||||
text: `${namespace}:option:1:selected`,
|
text: `${namespace}:option:3:selected`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should damage all (allowed in battle) party PKM by 25%", async () => {
|
it("should give charcoal to lead pokemon", async () => {
|
||||||
game.override.startingWave(33);
|
|
||||||
|
|
||||||
await game.runToMysteryEncounter(defaultParty);
|
await game.runToMysteryEncounter(defaultParty);
|
||||||
|
|
||||||
const party = scene.getParty();
|
|
||||||
const abra = party.find((pkm) => pkm.species.speciesId === Species.ABRA);
|
|
||||||
vi.spyOn(abra, "isAllowedInBattle").mockReturnValue(false);
|
|
||||||
|
|
||||||
await runSelectMysteryEncounterOption(game, 3);
|
await runSelectMysteryEncounterOption(game, 3);
|
||||||
|
// await skipBattleRunMysteryEncounterRewardsPhase(game);
|
||||||
|
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
||||||
|
expect(scene.getCurrentPhase().constructor.name).toBe(SelectModifierPhase.name);
|
||||||
|
|
||||||
const allowedPkm = party.filter((pkm) => pkm.isAllowedInBattle());
|
const leadPokemonId = scene.getParty()?.[0].id;
|
||||||
const notAllowedPkm = party.filter((pkm) => !pkm.isAllowedInBattle());
|
const leadPokemonItems = scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||||
allowedPkm.forEach((pkm) =>
|
&& (m as PokemonHeldItemModifier).pokemonId === leadPokemonId, true) as PokemonHeldItemModifier[];
|
||||||
expect(pkm.hp, `${pkm.name} should have receivd 25% damage: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp() - Math.floor(pkm.getMaxHp() * 0.25))
|
const charcoal = leadPokemonItems.find(i => i.type.name === "Charcoal");
|
||||||
);
|
expect(charcoal).toBeDefined;
|
||||||
|
|
||||||
notAllowedPkm.forEach((pkm) => expect(pkm.hp, `${pkm.name} should be full hp: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp()));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should leave encounter without battle", async () => {
|
it("should leave encounter without battle", async () => {
|
||||||
game.override.startingWave(33);
|
|
||||||
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
|
const leaveEncounterWithoutBattleSpy = vi.spyOn(EncounterPhaseUtils, "leaveEncounterWithoutBattle");
|
||||||
|
|
||||||
await game.runToMysteryEncounter(defaultParty);
|
await game.runToMysteryEncounter(defaultParty);
|
||||||
|
|
|
@ -31,6 +31,7 @@ describe("Lost at Sea - Mystery Encounter", () => {
|
||||||
game.override.mysteryEncounterChance(100);
|
game.override.mysteryEncounterChance(100);
|
||||||
game.override.startingWave(defaultWave);
|
game.override.startingWave(defaultWave);
|
||||||
game.override.startingBiome(defaultBiome);
|
game.override.startingBiome(defaultBiome);
|
||||||
|
game.override.trainerWave(false);
|
||||||
|
|
||||||
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
|
vi.spyOn(MysteryEncounters, "mysteryEncountersByBiome", "get").mockReturnValue(
|
||||||
new Map<Biome, MysteryEncounterType[]>([
|
new Map<Biome, MysteryEncounterType[]>([
|
||||||
|
|
|
@ -24,6 +24,7 @@ describe("Mystery Encounters", () => {
|
||||||
game.override.startingWave(11);
|
game.override.startingWave(11);
|
||||||
game.override.mysteryEncounterChance(100);
|
game.override.mysteryEncounterChance(100);
|
||||||
game.override.mysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS);
|
game.override.mysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS);
|
||||||
|
game.override.trainerWave(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Spawns a mystery encounter", async () => {
|
it("Spawns a mystery encounter", async () => {
|
||||||
|
|
|
@ -60,6 +60,17 @@ export class OverridesHelper {
|
||||||
return spy;
|
return spy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override each wave to have or not have standard trainer battles
|
||||||
|
* @returns spy instance
|
||||||
|
* @param isTrainer
|
||||||
|
*/
|
||||||
|
trainerWave(isTrainer: boolean): MockInstance {
|
||||||
|
const spy = vi.spyOn(this.game.scene.gameMode, "isWaveTrainer").mockReturnValue(isTrainer);
|
||||||
|
this.log(`${isTrainer? "forcing" : "ignoring"} trainer waves!`);
|
||||||
|
return spy;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override the weather (type)
|
* Override the weather (type)
|
||||||
* @param type weather type to set
|
* @param type weather type to set
|
||||||
|
|
Loading…
Reference in New Issue