Compare commits
23 Commits
1e57f158e4
...
3456f33156
Author | SHA1 | Date |
---|---|---|
Blitzy | 3456f33156 | |
NightKev | 0989128deb | |
AJ Fontaine | 4e0b10769b | |
Bertie690 | 4c17ebd400 | |
Madmadness65 | ec09186264 | |
NightKev | e88b8aeb6f | |
AJ Fontaine | 8d20b7b5e0 | |
damocleas | d14a5b8819 | |
NightKev | 7563a6cd0b | |
AJ Fontaine | 9fb9bb7e5d | |
damocleas | 7ee573937e | |
AJ Fontaine | 8d11313458 | |
Lugiad | ec68ec2066 | |
NightKev | 2593d0206c | |
David Yang | 33982c311e | |
AJ Fontaine | f1c06a5476 | |
damocleas | 706a23238c | |
NightKev | 996ce5d986 | |
NightKev | 1a57d3998f | |
AJ Fontaine | 8685ec3c3c | |
Bertie690 | 747656e8df | |
Xavion3 | 9c29cdc63d | |
damocleas | bfe0d9bb79 |
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pokemon-rogue-battle",
|
||||
"version": "1.4.3",
|
||||
"version": "1.5.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pokemon-rogue-battle",
|
||||
"version": "1.4.3",
|
||||
"version": "1.5.2",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@material/material-color-utilities": "^0.2.7",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "pokemon-rogue-battle",
|
||||
"private": true,
|
||||
"version": "1.4.3",
|
||||
"version": "1.5.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
|
|
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 37 KiB |
|
@ -1 +1 @@
|
|||
Subproject commit e07ab625f2080afe36b61fad291b0ec5eff4000c
|
||||
Subproject commit 5ef993b95fa8248adc0fb7d9489baccf546bf8e3
|
|
@ -869,6 +869,12 @@ export default class BattleScene extends SceneBase {
|
|||
return party.slice(0, Math.min(party.length, this.currentBattle?.double ? 2 : 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Pokemon on both sides of the battle - player first, then enemy.
|
||||
* Does not actually check if the pokemon are on the field or not, and always has length 4 regardless of battle type.
|
||||
* @param activeOnly Whether to consider only active pokemon
|
||||
* @returns array of {@linkcode Pokemon}
|
||||
*/
|
||||
public getField(activeOnly: boolean = false): Pokemon[] {
|
||||
const ret = new Array(4).fill(null);
|
||||
const playerField = this.getPlayerField();
|
||||
|
@ -1843,8 +1849,10 @@ export default class BattleScene extends SceneBase {
|
|||
this.currentBattle.battleScore += Math.ceil(scoreIncrease);
|
||||
}
|
||||
|
||||
getMaxExpLevel(ignoreLevelCap?: boolean): integer {
|
||||
if (ignoreLevelCap) {
|
||||
getMaxExpLevel(ignoreLevelCap: boolean = false): integer {
|
||||
if (Overrides.LEVEL_CAP_OVERRIDE > 0) {
|
||||
return Overrides.LEVEL_CAP_OVERRIDE;
|
||||
} else if (ignoreLevelCap || Overrides.LEVEL_CAP_OVERRIDE < 0) {
|
||||
return Number.MAX_SAFE_INTEGER;
|
||||
}
|
||||
const waveIndex = Math.ceil((this.currentBattle?.waveIndex || 1) / 10) * 10;
|
||||
|
@ -2082,8 +2090,11 @@ export default class BattleScene extends SceneBase {
|
|||
return sound;
|
||||
}
|
||||
|
||||
/** The loop point of any given battle, mystery encounter, or title track, read as seconds and milliseconds. */
|
||||
getBgmLoopPoint(bgmName: string): number {
|
||||
switch (bgmName) {
|
||||
case "title": //Firel PokéRogue Title
|
||||
return 46.500;
|
||||
case "battle_kanto_champion": //B2W2 Kanto Champion Battle
|
||||
return 13.950;
|
||||
case "battle_johto_champion": //B2W2 Johto Champion Battle
|
||||
|
@ -3388,7 +3399,8 @@ export default class BattleScene extends SceneBase {
|
|||
const previousEncounter = this.mysteryEncounterSaveData.encounteredEvents.length > 0 ?
|
||||
this.mysteryEncounterSaveData.encounteredEvents[this.mysteryEncounterSaveData.encounteredEvents.length - 1].type
|
||||
: null;
|
||||
const biomeMysteryEncounters = mysteryEncountersByBiome.get(this.arena.biomeType) ?? [];
|
||||
const disabledEncounters = this.eventManager.getEventMysteryEncountersDisabled();
|
||||
const biomeMysteryEncounters = mysteryEncountersByBiome.get(this.arena.biomeType)?.filter(enc => !disabledEncounters.includes(enc)) ?? [];
|
||||
// If no valid encounters exist at tier, checks next tier down, continuing until there are some encounters available
|
||||
while (availableEncounters.length === 0 && tier !== null) {
|
||||
availableEncounters = biomeMysteryEncounters
|
||||
|
@ -3397,7 +3409,7 @@ export default class BattleScene extends SceneBase {
|
|||
if (!encounterCandidate) {
|
||||
return false;
|
||||
}
|
||||
if (encounterCandidate.encounterTier !== tier) {
|
||||
if (this.eventManager.getMysteryEncounterTierForEvent(encounterType, encounterCandidate.encounterTier) !== tier) {
|
||||
return false;
|
||||
}
|
||||
const disallowedGameModes = encounterCandidate.disallowedGameModes;
|
||||
|
|
|
@ -1380,8 +1380,10 @@ export class UserHpDamageAttr extends FixedDamageAttr {
|
|||
}
|
||||
|
||||
export class TargetHalfHpDamageAttr extends FixedDamageAttr {
|
||||
// the initial amount of hp the target had before the first hit
|
||||
// used for multi lens
|
||||
/**
|
||||
* The initial amount of hp the target had before the first hit.
|
||||
* Used for calculating multi lens damage.
|
||||
*/
|
||||
private initialHp: number;
|
||||
constructor() {
|
||||
super(0);
|
||||
|
@ -1405,12 +1407,10 @@ export class TargetHalfHpDamageAttr extends FixedDamageAttr {
|
|||
// multi lens added hit; use initialHp tracker to ensure correct damage
|
||||
(args[0] as Utils.NumberHolder).value = Utils.toDmgValue(this.initialHp / 2);
|
||||
return true;
|
||||
break;
|
||||
case lensCount + 1:
|
||||
// parental bond added hit; calc damage as normal
|
||||
(args[0] as Utils.NumberHolder).value = Utils.toDmgValue(target.hp / 2);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6129,7 +6129,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Don't allow wild mons to flee with U-turn et al
|
||||
// Don't allow wild mons to flee with U-turn et al.
|
||||
if (this.selfSwitch && !user.isPlayer() && move.category !== MoveCategory.STATUS) {
|
||||
return false;
|
||||
}
|
||||
|
@ -7084,7 +7084,25 @@ export class RepeatMoveAttr extends MoveEffectAttr {
|
|||
// get the last move used (excluding status based failures) as well as the corresponding moveset slot
|
||||
const lastMove = target.getLastXMoves(-1).find(m => m.move !== Moves.NONE)!;
|
||||
const movesetMove = target.getMoveset().find(m => m?.moveId === lastMove.move)!;
|
||||
const moveTargets = lastMove.targets ?? [];
|
||||
// If the last move used can hit more than one target or has variable targets,
|
||||
// re-compute the targets for the attack
|
||||
// (mainly for alternating double/single battle shenanigans)
|
||||
// Rampaging moves (e.g. Outrage) are not included due to being incompatible with Instruct
|
||||
// TODO: Fix this once dragon darts gets smart targeting
|
||||
let moveTargets = movesetMove.getMove().isMultiTarget() ? getMoveTargets(target, lastMove.move).targets : lastMove.targets;
|
||||
|
||||
/** In the event the instructed move's only target is a fainted opponent, redirect it to an alive ally if possible
|
||||
Normally, all yet-unexecuted move phases would swap over when the enemy in question faints
|
||||
(see `redirectPokemonMoves` in `battle-scene.ts`),
|
||||
but since instruct adds a new move phase pre-emptively, we need to handle this interaction manually.
|
||||
*/
|
||||
const firstTarget = globalScene.getField()[moveTargets[0]];
|
||||
if (globalScene.currentBattle.double && moveTargets.length === 1 && firstTarget.isFainted() && firstTarget !== target.getAlly()) {
|
||||
const ally = firstTarget.getAlly();
|
||||
if (ally.isActive()) { // ally exists, is not dead and can sponge the blast
|
||||
moveTargets = [ ally.getBattlerIndex() ];
|
||||
}
|
||||
}
|
||||
|
||||
globalScene.queueMessage(i18next.t("moveTriggers:instructingMove", {
|
||||
userPokemonName: getPokemonNameWithAffix(user),
|
||||
|
@ -7098,12 +7116,9 @@ export class RepeatMoveAttr extends MoveEffectAttr {
|
|||
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => {
|
||||
// TODO: Confirm behavior of instructing move known by target but called by another move
|
||||
const lastMove = target.getLastXMoves(-1).find(m => m.move !== Moves.NONE);
|
||||
const movesetMove = target.getMoveset().find(m => m?.moveId === lastMove?.move);
|
||||
const moveTargets = lastMove?.targets ?? [];
|
||||
// TODO: Add a way of adding moves to list procedurally rather than a pre-defined blacklist
|
||||
const unrepeatablemoves = [
|
||||
const uninstructableMoves = [
|
||||
// Locking/Continually Executed moves
|
||||
Moves.OUTRAGE,
|
||||
Moves.RAGING_FURY,
|
||||
|
@ -7158,11 +7173,11 @@ export class RepeatMoveAttr extends MoveEffectAttr {
|
|||
// TODO: Add Max/G-Move blockage if or when they are implemented
|
||||
];
|
||||
|
||||
if (!movesetMove // called move not in target's moveset (dancer, forgetting the move, etc.)
|
||||
if (!lastMove?.move // no move to instruct
|
||||
|| !movesetMove // called move not in target's moveset (forgetting the move, etc.)
|
||||
|| movesetMove.ppUsed === movesetMove.getMovePp() // move out of pp
|
||||
|| allMoves[lastMove?.move ?? Moves.NONE].isChargingMove() // called move is a charging/recharging move
|
||||
|| !moveTargets.length // called move has no targets
|
||||
|| unrepeatablemoves.includes(lastMove?.move ?? Moves.NONE)) { // called move is explicitly in the banlist
|
||||
|| allMoves[lastMove.move].isChargingMove() // called move is a charging/recharging move
|
||||
|| uninstructableMoves.includes(lastMove.move)) { // called move is in the banlist
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -7170,7 +7185,7 @@ export class RepeatMoveAttr extends MoveEffectAttr {
|
|||
}
|
||||
|
||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
||||
// TODO: Make the AI acutally use instruct
|
||||
// TODO: Make the AI actually use instruct
|
||||
/* Ideally, the AI would score instruct based on the scorings of the on-field pokemons'
|
||||
* last used moves at the time of using Instruct (by the time the instructor gets to act)
|
||||
* with respect to the user's side.
|
||||
|
@ -10279,7 +10294,10 @@ export function initMoves() {
|
|||
new StatusMove(Moves.INSTRUCT, Type.PSYCHIC, -1, 15, -1, 0, 7)
|
||||
.ignoresSubstitute()
|
||||
.attr(RepeatMoveAttr)
|
||||
.edgeCase(), // incorrect interactions with Gigaton Hammer, Blood Moon & Torment
|
||||
// incorrect interactions with Gigaton Hammer, Blood Moon & Torment
|
||||
// Also has incorrect interactions with Dancer due to the latter
|
||||
// erroneously adding copied moves to move history.
|
||||
.edgeCase(),
|
||||
new AttackMove(Moves.BEAK_BLAST, Type.FLYING, MoveCategory.PHYSICAL, 100, 100, 15, -1, -3, 7)
|
||||
.attr(BeakBlastHeaderAttr)
|
||||
.ballBombMove()
|
||||
|
|
|
@ -4,6 +4,7 @@ import type {
|
|||
import {
|
||||
generateModifierType,
|
||||
generateModifierTypeOption,
|
||||
getRandomEncounterSpecies,
|
||||
initBattleWithEnemyConfig,
|
||||
leaveEncounterWithoutBattle,
|
||||
setEncounterExp,
|
||||
|
@ -11,17 +12,15 @@ import {
|
|||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { EnemyPokemon } from "#app/field/pokemon";
|
||||
import type {
|
||||
BerryModifierType,
|
||||
ModifierTypeOption } from "#app/modifier/modifier-type";
|
||||
import {
|
||||
getPartyLuckValue,
|
||||
ModifierPoolType,
|
||||
modifierTypes,
|
||||
regenerateModifierPoolThresholds,
|
||||
} from "#app/modifier/modifier-type";
|
||||
import { randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -31,7 +30,6 @@ import { queueEncounterMessage, showEncounterText } from "#app/data/mystery-enco
|
|||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import { applyModifierTypeToPlayerPokemon, getEncounterPokemonLevelForWave, getHighestStatPlayerPokemon, getSpriteKeysFromPokemon, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { BerryModifier } from "#app/modifier/modifier";
|
||||
|
@ -40,8 +38,6 @@ import { BerryType } from "#enums/berry-type";
|
|||
import { PERMANENT_STATS, Stat } from "#enums/stat";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/berriesAbound";
|
||||
|
@ -69,20 +65,12 @@ export const BerriesAboundEncounter: MysteryEncounter =
|
|||
|
||||
// Calculate boss mon
|
||||
const level = getEncounterPokemonLevelForWave(STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER);
|
||||
let bossSpecies: PokemonSpecies;
|
||||
if (globalScene.eventManager.isEventActive() && globalScene.eventManager.activeEvent()?.uncommonBreedEncounters && randSeedInt(2) === 1) {
|
||||
const eventEncounter = randSeedItem(globalScene.eventManager.activeEvent()!.uncommonBreedEncounters!);
|
||||
const levelSpecies = getPokemonSpecies(eventEncounter.species).getWildSpeciesForLevel(level, eventEncounter.allowEvolution ?? false, true, globalScene.gameMode);
|
||||
bossSpecies = getPokemonSpecies( levelSpecies );
|
||||
} else {
|
||||
bossSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, level, 0, getPartyLuckValue(globalScene.getPlayerParty()), true);
|
||||
}
|
||||
const bossPokemon = new EnemyPokemon(bossSpecies, level, TrainerSlot.NONE, true);
|
||||
const bossPokemon = getRandomEncounterSpecies(level, true);
|
||||
encounter.setDialogueToken("enemyPokemon", getPokemonNameWithAffix(bossPokemon));
|
||||
const config: EnemyPartyConfig = {
|
||||
pokemonConfigs: [{
|
||||
level: level,
|
||||
species: bossSpecies,
|
||||
species: bossPokemon.species,
|
||||
dataSource: new PokemonData(bossPokemon),
|
||||
isBoss: true
|
||||
}],
|
||||
|
|
|
@ -41,7 +41,7 @@ const OPTION_3_DISALLOWED_MODIFIERS = [
|
|||
const DELIBIRDY_MONEY_PRICE_MULTIPLIER = 2;
|
||||
|
||||
const doEventReward = () => {
|
||||
const event_buff = globalScene.eventManager.activeEvent()?.delibirdyBuff ?? [];
|
||||
const event_buff = globalScene.eventManager.getDelibirdyBuff();
|
||||
if (event_buff.length > 0) {
|
||||
const candidates = event_buff.filter((c => {
|
||||
const mtype = generateModifierType(modifierTypes[c]);
|
||||
|
|
|
@ -2,6 +2,7 @@ import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/myst
|
|||
import type {
|
||||
EnemyPartyConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import {
|
||||
getRandomEncounterSpecies,
|
||||
initBattleWithEnemyConfig,
|
||||
leaveEncounterWithoutBattle,
|
||||
setEncounterExp,
|
||||
|
@ -9,12 +10,10 @@ import {
|
|||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { STEALING_MOVES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { EnemyPokemon } from "#app/field/pokemon";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import type {
|
||||
ModifierTypeOption } from "#app/modifier/modifier-type";
|
||||
import {
|
||||
getPartyLuckValue,
|
||||
getPlayerModifierTypeOptions,
|
||||
ModifierPoolType,
|
||||
regenerateModifierPoolThresholds,
|
||||
|
@ -26,16 +25,13 @@ import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-en
|
|||
import { MoveRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import { getEncounterPokemonLevelForWave, getSpriteKeysFromPokemon, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/fightOrFlight";
|
||||
|
@ -63,20 +59,12 @@ export const FightOrFlightEncounter: MysteryEncounter =
|
|||
|
||||
// Calculate boss mon
|
||||
const level = getEncounterPokemonLevelForWave(STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER);
|
||||
let bossSpecies: PokemonSpecies;
|
||||
if (globalScene.eventManager.isEventActive() && globalScene.eventManager.activeEvent()?.uncommonBreedEncounters && randSeedInt(2) === 1) {
|
||||
const eventEncounter = randSeedItem(globalScene.eventManager.activeEvent()!.uncommonBreedEncounters!);
|
||||
const levelSpecies = getPokemonSpecies(eventEncounter.species).getWildSpeciesForLevel(level, eventEncounter.allowEvolution ?? false, true, globalScene.gameMode);
|
||||
bossSpecies = getPokemonSpecies( levelSpecies );
|
||||
} else {
|
||||
bossSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, level, 0, getPartyLuckValue(globalScene.getPlayerParty()), true);
|
||||
}
|
||||
const bossPokemon = new EnemyPokemon(bossSpecies, level, TrainerSlot.NONE, true);
|
||||
const bossPokemon = getRandomEncounterSpecies(level, true);
|
||||
encounter.setDialogueToken("enemyPokemon", bossPokemon.getNameToRender());
|
||||
const config: EnemyPartyConfig = {
|
||||
pokemonConfigs: [{
|
||||
level: level,
|
||||
species: bossSpecies,
|
||||
species: bossPokemon.species,
|
||||
dataSource: new PokemonData(bossPokemon),
|
||||
isBoss: true,
|
||||
tags: [ BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON ],
|
||||
|
|
|
@ -449,7 +449,7 @@ function getPokemonTradeOptions(): Map<number, EnemyPokemon[]> {
|
|||
});
|
||||
tradeOptionsMap.set(pokemon.id, tradeOptions);
|
||||
} else {
|
||||
const originalBst = pokemon.calculateBaseStats().reduce((a, b) => a + b, 0);
|
||||
const originalBst = pokemon.getSpeciesForm().getBaseStatTotal();
|
||||
|
||||
const tradeOptions: PokemonSpecies[] = [];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
|
|
|
@ -452,7 +452,7 @@ function getSpeciesFromPool(speciesPool: (Species | BreederSpeciesEvolution)[][]
|
|||
}
|
||||
|
||||
function calculateEggRewardsForPokemon(pokemon: PlayerPokemon): [number, number] {
|
||||
const bst = pokemon.calculateBaseStats().reduce((a, b) => a + b, 0);
|
||||
const bst = pokemon.getSpeciesForm().getBaseStatTotal();
|
||||
// 1 point for every 20 points below 680 BST the pokemon is, (max 18, min 1)
|
||||
const pointsFromBst = Math.min(Math.max(Math.floor((680 - bst) / 20), 1), 18);
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ export const TheStrongStuffEncounter: MysteryEncounter =
|
|||
// Sort party by bst
|
||||
const sortedParty = globalScene.getPlayerParty().slice(0)
|
||||
.sort((pokemon1, pokemon2) => {
|
||||
const pokemon1Bst = pokemon1.calculateBaseStats().reduce((a, b) => a + b, 0);
|
||||
const pokemon2Bst = pokemon2.calculateBaseStats().reduce((a, b) => a + b, 0);
|
||||
const pokemon1Bst = pokemon1.getSpeciesForm().getBaseStatTotal();
|
||||
const pokemon2Bst = pokemon2.getSpeciesForm().getBaseStatTotal();
|
||||
return pokemon2Bst - pokemon1Bst;
|
||||
});
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import type { EnemyPartyConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { initBattleWithEnemyConfig, leaveEncounterWithoutBattle, setEncounterExp, setEncounterRewards } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { getRandomEncounterSpecies, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, setEncounterExp, setEncounterRewards } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { CHARMING_MOVES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
import { getPartyLuckValue } from "#app/modifier/modifier-type";
|
||||
import type { EnemyPokemon } from "#app/field/pokemon";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
|
@ -12,10 +12,9 @@ import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-en
|
|||
import { MoveRequirement, PersistentModifierRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import { catchPokemon, getHighestLevelPlayerPokemon, getSpriteKeysFromPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import type { Moves } from "#enums/moves";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { SelfStatusMove } from "#app/data/move";
|
||||
|
@ -26,8 +25,6 @@ import { BerryModifier } from "#app/modifier/modifier";
|
|||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/uncommonBreed";
|
||||
|
@ -56,15 +53,7 @@ export const UncommonBreedEncounter: MysteryEncounter =
|
|||
// Calculate boss mon
|
||||
// Level equal to 2 below highest party member
|
||||
const level = getHighestLevelPlayerPokemon(false, true).level - 2;
|
||||
let species: PokemonSpecies;
|
||||
if (globalScene.eventManager.isEventActive() && globalScene.eventManager.activeEvent()?.uncommonBreedEncounters && randSeedInt(2) === 1) {
|
||||
const eventEncounter = randSeedItem(globalScene.eventManager.activeEvent()!.uncommonBreedEncounters!);
|
||||
const levelSpecies = getPokemonSpecies(eventEncounter.species).getWildSpeciesForLevel(level, eventEncounter.allowEvolution ?? false, true, globalScene.gameMode);
|
||||
species = getPokemonSpecies( levelSpecies );
|
||||
} else {
|
||||
species = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, level, 0, getPartyLuckValue(globalScene.getPlayerParty()), true);
|
||||
}
|
||||
const pokemon = new EnemyPokemon(species, level, TrainerSlot.NONE, true);
|
||||
const pokemon = getRandomEncounterSpecies(level, true, true);
|
||||
|
||||
// Pokemon will always have one of its egg moves in its moveset
|
||||
const eggMoves = pokemon.getEggMoves();
|
||||
|
@ -92,7 +81,7 @@ export const UncommonBreedEncounter: MysteryEncounter =
|
|||
const config: EnemyPartyConfig = {
|
||||
pokemonConfigs: [{
|
||||
level: level,
|
||||
species: species,
|
||||
species: pokemon.species,
|
||||
dataSource: new PokemonData(pokemon),
|
||||
isBoss: false,
|
||||
tags: [ BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON ],
|
||||
|
|
|
@ -360,7 +360,7 @@ function getTeamTransformations(): PokemonTransformation[] {
|
|||
const index = pokemonTransformations.findIndex(p => p.previousPokemon.id === removed.id);
|
||||
pokemonTransformations[index].heldItems = removed.getHeldItems().filter(m => !(m instanceof PokemonFormChangeItemModifier));
|
||||
|
||||
const bst = removed.calculateBaseStats().reduce((a, b) => a + b, 0);
|
||||
const bst = removed.getSpeciesForm().getBaseStatTotal();
|
||||
let newBstRange: [number, number];
|
||||
if (i < 2) {
|
||||
newBstRange = HIGH_BST_TRANSFORM_BASE_VALUES;
|
||||
|
|
|
@ -6,9 +6,9 @@ import { AVERAGE_ENCOUNTERS_PER_RUN_TARGET, WEIGHT_INCREMENT_ON_SPAWN_MISS } fro
|
|||
import { showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import type { AiType, PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { FieldPosition, PokemonMove, PokemonSummonData } from "#app/field/pokemon";
|
||||
import { EnemyPokemon, FieldPosition, PokemonMove, PokemonSummonData } from "#app/field/pokemon";
|
||||
import type { CustomModifierSettings, ModifierType } from "#app/modifier/modifier-type";
|
||||
import { ModifierPoolType, ModifierTypeGenerator, ModifierTypeOption, modifierTypes, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||
import { getPartyLuckValue, ModifierPoolType, ModifierTypeGenerator, ModifierTypeOption, modifierTypes, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||
import { MysteryEncounterBattlePhase, MysteryEncounterBattleStartCleanupPhase, MysteryEncounterPhase, MysteryEncounterRewardsPhase } from "#app/phases/mystery-encounter-phases";
|
||||
import type PokemonData from "#app/system/pokemon-data";
|
||||
import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
|
@ -16,7 +16,7 @@ import type { PartyOption, PokemonSelectFilter } from "#app/ui/party-ui-handler"
|
|||
import { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import * as Utils from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#app/utils";
|
||||
import type { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Biome } from "#enums/biome";
|
||||
import type { TrainerType } from "#enums/trainer-type";
|
||||
|
@ -45,6 +45,7 @@ import { PartyExpPhase } from "#app/phases/party-exp-phase";
|
|||
import type { Variant } from "#app/data/variant";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
|
||||
/**
|
||||
* Animates exclamation sprite over trainer's head at start of encounter
|
||||
|
@ -874,6 +875,41 @@ export function handleMysteryEncounterTurnStartEffects(): boolean {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for encounters such as {@linkcode UncommonBreedEncounter} which call for a random species including event encounters.
|
||||
* If the mon is from the event encounter list, it will do an extra shiny roll.
|
||||
* @param level the level of the mon, which differs between MEs
|
||||
* @param isBoss whether the mon should be a Boss
|
||||
* @param rerollHidden whether the mon should get an extra roll for Hidden Ability
|
||||
* @returns {@linkcode EnemyPokemon} for the requested encounter
|
||||
*/
|
||||
export function getRandomEncounterSpecies(level: number, isBoss: boolean = false, rerollHidden: boolean = false): EnemyPokemon {
|
||||
let bossSpecies: PokemonSpecies;
|
||||
let isEventEncounter = false;
|
||||
const eventEncounters = globalScene.eventManager.getEventEncounters();
|
||||
|
||||
if (eventEncounters.length > 0 && randSeedInt(2) === 1) {
|
||||
const eventEncounter = randSeedItem(eventEncounters);
|
||||
const levelSpecies = getPokemonSpecies(eventEncounter.species).getWildSpeciesForLevel(level, !eventEncounter.blockEvolution, isBoss, globalScene.gameMode);
|
||||
isEventEncounter = true;
|
||||
bossSpecies = getPokemonSpecies(levelSpecies);
|
||||
} else {
|
||||
bossSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, level, 0, getPartyLuckValue(globalScene.getPlayerParty()), isBoss);
|
||||
}
|
||||
const ret = new EnemyPokemon(bossSpecies, level, TrainerSlot.NONE, isBoss);
|
||||
|
||||
//Reroll shiny for event encounters
|
||||
if (isEventEncounter && !ret.shiny) {
|
||||
ret.trySetShinySeed();
|
||||
}
|
||||
//Reroll hidden ability
|
||||
if (rerollHidden && ret.abilityIndex !== 2 && ret.species.abilityHidden) {
|
||||
ret.tryRerollHiddenAbilitySeed();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: remove once encounter spawn rate is finalized
|
||||
* Just a helper function to calculate aggregate stats for MEs in a Classic run
|
||||
|
|
|
@ -162,7 +162,7 @@ export function getNonVolatileStatusEffects():Array<StatusEffect> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns whether a statuss effect is non volatile.
|
||||
* Returns whether a status effect is non volatile.
|
||||
* Non-volatile status condition is a status that remains after being switched out.
|
||||
* @param status The status to check
|
||||
*/
|
||||
|
|
|
@ -375,8 +375,8 @@ export function getRandomWeatherType(arena: Arena): WeatherType {
|
|||
break;
|
||||
}
|
||||
|
||||
if (arena.biomeType === Biome.TOWN && globalScene.eventManager.isEventActive() && (globalScene.eventManager.activeEvent()?.weather?.length ?? 0) > 0) {
|
||||
globalScene.eventManager.activeEvent()?.weather?.map(w => weatherPool.push(w));
|
||||
if (arena.biomeType === Biome.TOWN && globalScene.eventManager.isEventActive()) {
|
||||
globalScene.eventManager.getWeather()?.map(w => weatherPool.push(w));
|
||||
}
|
||||
|
||||
if (weatherPool.length > 1) {
|
||||
|
|
|
@ -695,6 +695,7 @@ export class Arena {
|
|||
globalScene.loadBgm(this.bgm);
|
||||
}
|
||||
|
||||
/** The loop point of any given biome track, read as seconds and milliseconds. */
|
||||
getBgmLoopPoint(): number {
|
||||
switch (this.biomeType) {
|
||||
case Biome.TOWN:
|
||||
|
|
|
@ -10,7 +10,7 @@ import type Move from "#app/data/move";
|
|||
import { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariableAtkAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, VariableMoveTypeAttr, VariableDefAttr, AttackMove, ModifiedDamageAttr, VariableMoveTypeMultiplierAttr, IgnoreOpponentStatStagesAttr, SacrificialAttr, VariableMoveCategoryAttr, CounterDamageAttr, StatStageChangeAttr, RechargeAttr, IgnoreWeatherTypeDebuffAttr, BypassBurnDamageReductionAttr, SacrificialAttrOnHit, OneHitKOAccuracyAttr, RespectAttackTypeImmunityAttr, MoveTarget, CombinedPledgeStabBoostAttr, VariableMoveTypeChartAttr } from "#app/data/move";
|
||||
import type { PokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import { default as PokemonSpecies, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER, getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { starterPassiveAbilities } from "#app/data/balance/passives";
|
||||
import type { Constructor } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt, type nil } from "#app/utils";
|
||||
|
@ -1108,6 +1108,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
return this.getStat(Stat.HP);
|
||||
}
|
||||
|
||||
/** Returns the amount of hp currently missing from this {@linkcode Pokemon} (max - current) */
|
||||
getInverseHp(): integer {
|
||||
return this.getMaxHp() - this.hp;
|
||||
}
|
||||
|
@ -1955,7 +1956,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
* @param thresholdOverride number that is divided by 2^16 (65536) to get the shiny chance, overrides {@linkcode shinyThreshold} if set (bypassing shiny rate modifiers such as Shiny Charm)
|
||||
* @returns true if the Pokemon has been set as a shiny, false otherwise
|
||||
*/
|
||||
trySetShiny(thresholdOverride?: integer): boolean {
|
||||
trySetShiny(thresholdOverride?: number): boolean {
|
||||
// Shiny Pokemon should not spawn in the end biome in endless
|
||||
if (globalScene.gameMode.isEndless && globalScene.arena.biomeType === Biome.END) {
|
||||
return false;
|
||||
|
@ -1967,7 +1968,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
const E = globalScene.gameData.trainerId ^ globalScene.gameData.secretId;
|
||||
const F = rand1 ^ rand2;
|
||||
|
||||
const shinyThreshold = new Utils.IntegerHolder(BASE_SHINY_CHANCE);
|
||||
const shinyThreshold = new Utils.NumberHolder(BASE_SHINY_CHANCE);
|
||||
if (thresholdOverride === undefined) {
|
||||
if (globalScene.eventManager.isEventActive()) {
|
||||
shinyThreshold.value *= globalScene.eventManager.getShinyMultiplier();
|
||||
|
@ -2058,6 +2059,38 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that tries to set a Pokemon to have its hidden ability based on seed, if it exists.
|
||||
* For manual use only, usually to roll a Pokemon's hidden ability chance a second time.
|
||||
*
|
||||
* The base hidden ability odds are {@linkcode BASE_HIDDEN_ABILITY_CHANCE} / `65536`
|
||||
* @param thresholdOverride number that is divided by `2^16` (`65536`) to get the HA chance, overrides {@linkcode haThreshold} if set (bypassing HA rate modifiers such as Ability Charm)
|
||||
* @param applyModifiersToOverride If {@linkcode thresholdOverride} is set and this is true, will apply Ability Charm to {@linkcode thresholdOverride}
|
||||
* @returns `true` if the Pokemon has been set to have its hidden ability, `false` otherwise
|
||||
*/
|
||||
public tryRerollHiddenAbilitySeed(thresholdOverride?: number, applyModifiersToOverride?: boolean): boolean {
|
||||
if (!this.species.abilityHidden) {
|
||||
return false;
|
||||
}
|
||||
const haThreshold = new Utils.NumberHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
||||
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
||||
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
||||
haThreshold.value = thresholdOverride;
|
||||
}
|
||||
if (!this.hasTrainer()) {
|
||||
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, haThreshold);
|
||||
}
|
||||
} else {
|
||||
haThreshold.value = thresholdOverride;
|
||||
}
|
||||
|
||||
if (randSeedInt(65536) < haThreshold.value) {
|
||||
this.abilityIndex = 2;
|
||||
}
|
||||
|
||||
return this.abilityIndex === 2;
|
||||
}
|
||||
|
||||
public generateFusionSpecies(forStarter?: boolean): void {
|
||||
const hiddenAbilityChance = new Utils.NumberHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
||||
if (!this.hasTrainer()) {
|
||||
|
@ -2391,8 +2424,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.battleInfo.toggleFlyout(visible);
|
||||
}
|
||||
|
||||
addExp(exp: integer) {
|
||||
const maxExpLevel = globalScene.getMaxExpLevel();
|
||||
/**
|
||||
* Adds experience to this PlayerPokemon, subject to wave based level caps.
|
||||
* @param exp The amount of experience to add
|
||||
* @param ignoreLevelCap Whether to ignore level caps when adding experience (defaults to false)
|
||||
*/
|
||||
addExp(exp: integer, ignoreLevelCap: boolean = false) {
|
||||
const maxExpLevel = globalScene.getMaxExpLevel(ignoreLevelCap);
|
||||
const initialExp = this.exp;
|
||||
this.exp += exp;
|
||||
while (this.level < maxExpLevel && this.exp >= getLevelTotalExp(this.level + 1, this.species.growthRate)) {
|
||||
|
@ -4323,10 +4361,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
].filter(d => !!d);
|
||||
const amount = new Utils.NumberHolder(friendship);
|
||||
globalScene.applyModifier(PokemonFriendshipBoosterModifier, true, this, amount);
|
||||
let candyFriendshipMultiplier = CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER;
|
||||
if (globalScene.eventManager.isEventActive()) {
|
||||
candyFriendshipMultiplier *= globalScene.eventManager.getFriendshipMultiplier();
|
||||
}
|
||||
const candyFriendshipMultiplier = globalScene.eventManager.getClassicFriendshipMultiplier();
|
||||
const starterAmount = new Utils.NumberHolder(Math.floor(amount.value * (globalScene.gameMode.isClassic ? candyFriendshipMultiplier : 1) / (fusionStarterSpeciesId ? 2 : 1)));
|
||||
|
||||
// Add friendship to this PlayerPokemon
|
||||
|
|
|
@ -246,9 +246,9 @@ export class LoadingScene extends SceneBase {
|
|||
}
|
||||
const availableLangs = [ "en", "de", "it", "fr", "ja", "ko", "es-ES", "pt-BR", "zh-CN" ];
|
||||
if (lang && availableLangs.includes(lang)) {
|
||||
this.loadImage("winter_holidays2024-event-" + lang, "events");
|
||||
this.loadImage("yearofthesnakeevent-" + lang, "events");
|
||||
} else {
|
||||
this.loadImage("winter_holidays2024-event-en", "events");
|
||||
this.loadImage("yearofthesnakeevent-en", "events");
|
||||
}
|
||||
|
||||
this.loadAtlas("statuses", "");
|
||||
|
|
|
@ -2537,9 +2537,10 @@ export function getPartyLuckValue(party: Pokemon[]): integer {
|
|||
}, 0, globalScene.seed);
|
||||
return DailyLuck.value;
|
||||
}
|
||||
const luck = Phaser.Math.Clamp(party.map(p => p.isAllowedInBattle() ? p.getLuck() : 0)
|
||||
const eventSpecies = globalScene.eventManager.getEventLuckBoostedSpecies();
|
||||
const luck = Phaser.Math.Clamp(party.map(p => p.isAllowedInBattle() ? p.getLuck() + (eventSpecies.includes(p.species.speciesId) ? 1 : 0) : 0)
|
||||
.reduce((total: integer, value: integer) => total += value, 0), 0, 14);
|
||||
return luck ?? 0;
|
||||
return Math.min(globalScene.eventManager.getEventLuckBoost() + (luck ?? 0), 14);
|
||||
}
|
||||
|
||||
export function getLuckString(luckValue: integer): string {
|
||||
|
|
|
@ -22,7 +22,7 @@ import { WeatherType } from "#enums/weather-type";
|
|||
*
|
||||
* Any override added here will be used instead of the value in {@linkcode DefaultOverrides}
|
||||
*
|
||||
* If an override name starts with "STARTING", it will apply when a new run begins
|
||||
* If an override name starts with "STARTING", it will only apply when a new run begins.
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
|
@ -39,7 +39,7 @@ const overrides = {} satisfies Partial<InstanceType<typeof DefaultOverrides>>;
|
|||
* ---
|
||||
* Defaults for Overrides that are used when testing different in game situations
|
||||
*
|
||||
* If an override name starts with "STARTING", it will apply when a new run begins
|
||||
* If an override name starts with "STARTING", it will only apply when a new run begins.
|
||||
*/
|
||||
class DefaultOverrides {
|
||||
// -----------------
|
||||
|
@ -63,8 +63,11 @@ class DefaultOverrides {
|
|||
readonly STARTING_WAVE_OVERRIDE: number = 0;
|
||||
readonly STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN;
|
||||
readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null;
|
||||
/** Multiplies XP gained by this value including 0. Set to null to ignore the override */
|
||||
/** Multiplies XP gained by this value including 0. Set to null to ignore the override. */
|
||||
readonly XP_MULTIPLIER_OVERRIDE: number | null = null;
|
||||
/** Sets the level cap to this number during experience gain calculations. Set to `0` to disable override & use normal wave-based level caps,
|
||||
or any negative number to set it to 9 quadrillion (effectively disabling it). */
|
||||
readonly LEVEL_CAP_OVERRIDE: number = 0;
|
||||
readonly NEVER_CRIT_OVERRIDE: boolean = false;
|
||||
/** default 1000 */
|
||||
readonly STARTING_MONEY_OVERRIDE: number = 0;
|
||||
|
|
|
@ -26,7 +26,7 @@ export enum LearnMoveType {
|
|||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||
private moveId: Moves;
|
||||
private messageMode: Mode;
|
||||
private learnMoveType;
|
||||
private learnMoveType: LearnMoveType;
|
||||
private cost: number;
|
||||
|
||||
constructor(partyMemberIndex: integer, moveId: Moves, learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE, cost: number = -1) {
|
||||
|
|
|
@ -39,7 +39,11 @@ export class TrainerVictoryPhase extends BattlePhase {
|
|||
// Validate Voucher for boss trainers
|
||||
if (vouchers.hasOwnProperty(TrainerType[trainerType])) {
|
||||
if (!globalScene.validateVoucher(vouchers[TrainerType[trainerType]]) && globalScene.currentBattle.trainer?.config.isBoss) {
|
||||
globalScene.unshiftPhase(new ModifierRewardPhase([ modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM ][vouchers[TrainerType[trainerType]].voucherType]));
|
||||
if (globalScene.eventManager.getUpgradeUnlockedVouchers()) {
|
||||
globalScene.unshiftPhase(new ModifierRewardPhase([ modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM ][vouchers[TrainerType[trainerType]].voucherType]));
|
||||
} else {
|
||||
globalScene.unshiftPhase(new ModifierRewardPhase([ modifierTypes.VOUCHER, modifierTypes.VOUCHER, modifierTypes.VOUCHER_PLUS, modifierTypes.VOUCHER_PREMIUM ][vouchers[TrainerType[trainerType]].voucherType]));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Breeders in Space achievement
|
||||
|
|
|
@ -7,7 +7,6 @@ import GameManager from "#test/utils/gameManager";
|
|||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
|
||||
describe("Abilities - Dancer", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
@ -24,20 +23,21 @@ describe("Abilities - Dancer", () => {
|
|||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.battleType("double")
|
||||
.moveset([ Moves.SWORDS_DANCE, Moves.SPLASH ])
|
||||
.enemySpecies(Species.MAGIKARP)
|
||||
.enemyAbility(Abilities.DANCER)
|
||||
.enemyMoveset([ Moves.VICTORY_DANCE ]);
|
||||
game.override.battleType("double");
|
||||
});
|
||||
|
||||
// Reference Link: https://bulbapedia.bulbagarden.net/wiki/Dancer_(Ability)
|
||||
|
||||
it("triggers when dance moves are used, doesn't consume extra PP", async () => {
|
||||
game.override
|
||||
.enemyAbility(Abilities.DANCER)
|
||||
.enemySpecies(Species.MAGIKARP)
|
||||
.enemyMoveset(Moves.VICTORY_DANCE);
|
||||
await game.classicMode.startBattle([ Species.ORICORIO, Species.FEEBAS ]);
|
||||
|
||||
const [ oricorio ] = game.scene.getPlayerField();
|
||||
const [ oricorio, feebas ] = game.scene.getPlayerField();
|
||||
game.move.changeMoveset(oricorio, [ Moves.SWORDS_DANCE, Moves.VICTORY_DANCE, Moves.SPLASH ]);
|
||||
game.move.changeMoveset(feebas, [ Moves.SWORDS_DANCE, Moves.SPLASH ]);
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
game.move.select(Moves.SWORDS_DANCE, 1);
|
||||
|
@ -59,5 +59,44 @@ describe("Abilities - Dancer", () => {
|
|||
|
||||
// doesn't use PP if copied move is also in moveset
|
||||
expect(oricorio.moveset[0]?.ppUsed).toBe(0);
|
||||
expect(oricorio.moveset[1]?.ppUsed).toBe(0);
|
||||
});
|
||||
|
||||
// TODO: Enable after Dancer rework to not push to move history
|
||||
it.todo("should not count as the last move used for mirror move/instruct", async () => {
|
||||
game.override
|
||||
.moveset([ Moves.FIERY_DANCE, Moves.REVELATION_DANCE ])
|
||||
.enemyMoveset([ Moves.INSTRUCT, Moves.MIRROR_MOVE, Moves.SPLASH ])
|
||||
.enemySpecies(Species.SHUCKLE)
|
||||
.enemyLevel(10);
|
||||
await game.classicMode.startBattle([ Species.ORICORIO, Species.FEEBAS ]);
|
||||
|
||||
const [ oricorio ] = game.scene.getPlayerField();
|
||||
const [ , shuckle2 ] = game.scene.getEnemyField();
|
||||
|
||||
game.move.select(Moves.REVELATION_DANCE, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2);
|
||||
game.move.select(Moves.FIERY_DANCE, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2);
|
||||
await game.forceEnemyMove(Moves.INSTRUCT, BattlerIndex.PLAYER);
|
||||
await game.forceEnemyMove(Moves.MIRROR_MOVE, BattlerIndex.PLAYER);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY_2, BattlerIndex.ENEMY ]);
|
||||
await game.phaseInterceptor.to("MovePhase"); // Oricorio rev dance
|
||||
await game.phaseInterceptor.to("MovePhase"); // Feebas fiery dance
|
||||
await game.phaseInterceptor.to("MovePhase"); // Oricorio fiery dance (from dancer)
|
||||
await game.phaseInterceptor.to("MoveEndPhase", false);
|
||||
// dancer copied move doesn't appear in move history
|
||||
expect(oricorio.getLastXMoves(-1)[0].move).toBe(Moves.REVELATION_DANCE);
|
||||
|
||||
await game.phaseInterceptor.to("MovePhase"); // shuckle 2 mirror moves oricorio
|
||||
await game.phaseInterceptor.to("MovePhase"); // calls instructed rev dance
|
||||
let currentPhase = game.scene.getCurrentPhase() as MovePhase;
|
||||
expect(currentPhase.pokemon).toBe(shuckle2);
|
||||
expect(currentPhase.move.moveId).toBe(Moves.REVELATION_DANCE);
|
||||
|
||||
await game.phaseInterceptor.to("MovePhase"); // shuckle 1 instructs oricorio
|
||||
await game.phaseInterceptor.to("MovePhase");
|
||||
currentPhase = game.scene.getCurrentPhase() as MovePhase;
|
||||
expect(currentPhase.pokemon).toBe(oricorio);
|
||||
expect(currentPhase.move.moveId).toBe(Moves.REVELATION_DANCE);
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { BattlerIndex } from "#app/battle";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { MoveResult } from "#app/field/pokemon";
|
||||
import type { MovePhase } from "#app/phases/move-phase";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
|
@ -12,10 +13,10 @@ describe("Moves - Instruct", () => {
|
|||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
function instructSuccess(pokemon: Pokemon, move: Moves): void {
|
||||
expect(pokemon.getLastXMoves(-1)[0].move).toBe(move);
|
||||
expect(pokemon.getLastXMoves(-1)[1].move).toBe(pokemon.getLastXMoves()[0].move);
|
||||
expect(pokemon.getMoveset().find(m => m?.moveId === move)?.ppUsed).toBe(2);
|
||||
function instructSuccess(target: Pokemon, move: Moves): void {
|
||||
expect(target.getLastXMoves(-1)[0].move).toBe(move);
|
||||
expect(target.getLastXMoves(-1)[1].move).toBe(target.getLastXMoves()[0].move);
|
||||
expect(target.getMoveset().find(m => m?.moveId === move)?.ppUsed).toBe(2);
|
||||
}
|
||||
|
||||
beforeAll(() => {
|
||||
|
@ -36,27 +37,40 @@ describe("Moves - Instruct", () => {
|
|||
.enemyAbility(Abilities.NO_GUARD)
|
||||
.enemyLevel(100)
|
||||
.startingLevel(100)
|
||||
.ability(Abilities.BALL_FETCH)
|
||||
.moveset([ Moves.INSTRUCT, Moves.SONIC_BOOM, Moves.SPLASH, Moves.TORMENT ])
|
||||
.disableCrits();
|
||||
});
|
||||
|
||||
it("should repeat enemy's attack move when moving last", async () => {
|
||||
it("should repeat target's last used move", async () => {
|
||||
game.override
|
||||
.moveset(Moves.INSTRUCT)
|
||||
.enemyLevel(1000); // ensures shuckle no die
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
game.move.changeMoveset(enemy, Moves.SONIC_BOOM);
|
||||
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
await game.forceEnemyMove(Moves.SONIC_BOOM, BattlerIndex.PLAYER);
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
await game.forceEnemyMove(Moves.SONIC_BOOM);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
|
||||
await game.phaseInterceptor.to("MovePhase"); // enemy attacks us
|
||||
await game.phaseInterceptor.to("MovePhase", false); // instruct
|
||||
let currentPhase = game.scene.getCurrentPhase() as MovePhase;
|
||||
expect(currentPhase.pokemon).toBe(game.scene.getPlayerPokemon());
|
||||
await game.phaseInterceptor.to("MoveEndPhase");
|
||||
|
||||
await game.phaseInterceptor.to("MovePhase", false); // enemy repeats move
|
||||
currentPhase = game.scene.getCurrentPhase() as MovePhase;
|
||||
expect(currentPhase.pokemon).toBe(enemy);
|
||||
expect(currentPhase.move.moveId).toBe(Moves.SONIC_BOOM);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerPokemon()?.getInverseHp()).toBe(40);
|
||||
instructSuccess(enemy, Moves.SONIC_BOOM);
|
||||
expect(game.scene.getPlayerPokemon()?.getInverseHp()).toBe(40);
|
||||
});
|
||||
|
||||
it("should repeat enemy's move through substitute", async () => {
|
||||
game.override.moveset([ Moves.INSTRUCT, Moves.SPLASH ]);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
|
@ -72,75 +86,94 @@ describe("Moves - Instruct", () => {
|
|||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerPokemon()?.getInverseHp()).toBe(40);
|
||||
instructSuccess(game.scene.getEnemyPokemon()!, Moves.SONIC_BOOM);
|
||||
expect(game.scene.getPlayerPokemon()?.getInverseHp()).toBe(40);
|
||||
});
|
||||
|
||||
it("should repeat ally's attack on enemy", async () => {
|
||||
game.override
|
||||
.battleType("double")
|
||||
.moveset([]);
|
||||
.enemyMoveset(Moves.SPLASH);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS, Species.SHUCKLE ]);
|
||||
|
||||
const [ amoonguss, shuckle ] = game.scene.getPlayerField();
|
||||
game.move.changeMoveset(amoonguss, Moves.INSTRUCT);
|
||||
game.move.changeMoveset(shuckle, Moves.SONIC_BOOM);
|
||||
game.move.changeMoveset(amoonguss, [ Moves.INSTRUCT, Moves.SONIC_BOOM ]);
|
||||
game.move.changeMoveset(shuckle, [ Moves.INSTRUCT, Moves.SONIC_BOOM ]);
|
||||
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2);
|
||||
game.move.select(Moves.SONIC_BOOM, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
expect(game.scene.getEnemyField()[0].getInverseHp()).toBe(40);
|
||||
instructSuccess(shuckle, Moves.SONIC_BOOM);
|
||||
expect(game.scene.getEnemyField()[0].getInverseHp()).toBe(40);
|
||||
});
|
||||
|
||||
// TODO: Enable test case once gigaton hammer (and blood moon) is fixed
|
||||
// TODO: Enable test case once gigaton hammer (and blood moon) are reworked
|
||||
it.todo("should repeat enemy's Gigaton Hammer", async () => {
|
||||
game.override
|
||||
.moveset(Moves.INSTRUCT)
|
||||
.enemyLevel(5);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
game.move.changeMoveset(enemy, Moves.GIGATON_HAMMER);
|
||||
game.move.changeMoveset(enemy, [ Moves.GIGATON_HAMMER, Moves.BLOOD_MOON ]);
|
||||
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
instructSuccess(enemy, Moves.GIGATON_HAMMER);
|
||||
expect(game.scene.getPlayerPokemon()!.turnData.attacksReceived.length).toBe(2);
|
||||
});
|
||||
|
||||
it("should add moves to move queue for copycat", async () => {
|
||||
game.override
|
||||
.battleType("double")
|
||||
.moveset(Moves.INSTRUCT)
|
||||
.enemyLevel(5);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
const [ enemy1, enemy2 ] = game.scene.getEnemyField()!;
|
||||
game.move.changeMoveset(enemy1, Moves.WATER_GUN);
|
||||
game.move.changeMoveset(enemy2, Moves.COPYCAT);
|
||||
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
instructSuccess(enemy1, Moves.WATER_GUN);
|
||||
// amoonguss gets hit by water gun thrice; once by original attack, once by instructed use and once by copycat
|
||||
expect(game.scene.getPlayerPokemon()!.turnData.attacksReceived.length).toBe(3);
|
||||
});
|
||||
|
||||
it("should respect enemy's status condition", async () => {
|
||||
game.override
|
||||
.moveset([ Moves.THUNDER_WAVE, Moves.INSTRUCT ])
|
||||
.enemyMoveset([ Moves.SPLASH, Moves.SONIC_BOOM ]);
|
||||
.moveset([ Moves.INSTRUCT, Moves.THUNDER_WAVE ])
|
||||
.enemyMoveset(Moves.SONIC_BOOM);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
game.move.select(Moves.THUNDER_WAVE);
|
||||
await game.forceEnemyMove(Moves.SONIC_BOOM);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.move.forceStatusActivation(true);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||
await game.phaseInterceptor.to("MovePhase");
|
||||
// force enemy's instructed move to bork and then immediately thaw out
|
||||
await game.move.forceStatusActivation(true);
|
||||
await game.move.forceStatusActivation(false);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
const moveHistory = game.scene.getEnemyPokemon()!.getMoveHistory();
|
||||
expect(moveHistory.length).toBe(3);
|
||||
expect(moveHistory[0].move).toBe(Moves.SONIC_BOOM);
|
||||
expect(moveHistory[1].move).toBe(Moves.NONE);
|
||||
expect(moveHistory[2].move).toBe(Moves.SONIC_BOOM);
|
||||
const moveHistory = game.scene.getEnemyPokemon()?.getLastXMoves(-1)!;
|
||||
expect(moveHistory.map(m => m.move)).toEqual([ Moves.SONIC_BOOM, Moves.NONE, Moves.SONIC_BOOM ]);
|
||||
expect(game.scene.getPlayerPokemon()?.getInverseHp()).toBe(40);
|
||||
});
|
||||
|
||||
it("should not repeat enemy's out of pp move", async () => {
|
||||
game.override.enemySpecies(Species.UNOWN);
|
||||
game.override
|
||||
.moveset(Moves.INSTRUCT)
|
||||
.enemySpecies(Species.UNOWN);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
|
@ -153,13 +186,85 @@ describe("Moves - Instruct", () => {
|
|||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
const playerMove = game.scene.getPlayerPokemon()!.getLastXMoves()!;
|
||||
expect(playerMove[0].result).toBe(MoveResult.FAIL);
|
||||
const playerMoves = game.scene.getPlayerPokemon()!.getLastXMoves(-1)!;
|
||||
expect(playerMoves[0].result).toBe(MoveResult.FAIL);
|
||||
expect(enemyPokemon.getMoveHistory().length).toBe(1);
|
||||
});
|
||||
|
||||
it("should redirect attacking moves if enemy faints", async () => {
|
||||
game.override
|
||||
.battleType("double")
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
.enemySpecies(Species.MAGIKARP)
|
||||
.enemyLevel(1);
|
||||
await game.classicMode.startBattle([ Species.HISUI_ELECTRODE, Species.KOMMO_O ]);
|
||||
|
||||
const [ electrode, kommo_o ] = game.scene.getPlayerField()!;
|
||||
game.move.changeMoveset(electrode, Moves.CHLOROBLAST);
|
||||
game.move.changeMoveset(kommo_o, Moves.INSTRUCT);
|
||||
|
||||
game.move.select(Moves.CHLOROBLAST, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
// Chloroblast always deals 50% max HP% recoil UNLESS you whiff
|
||||
// due to lack of targets or similar,
|
||||
// so all we have to do is check whether electrode fainted or not.
|
||||
// Naturally, both karps should also be dead as well.
|
||||
expect(electrode.isFainted()).toBe(true);
|
||||
const [ karp1, karp2 ] = game.scene.getEnemyField()!;
|
||||
expect(karp1.isFainted()).toBe(true);
|
||||
expect(karp2.isFainted()).toBe(true);
|
||||
}),
|
||||
|
||||
it("should allow for dancer copying of instructed dance move", async () => {
|
||||
game.override
|
||||
.battleType("double")
|
||||
.enemyMoveset([ Moves.INSTRUCT, Moves.SPLASH ]);
|
||||
await game.classicMode.startBattle([ Species.ORICORIO, Species.VOLCARONA ]);
|
||||
|
||||
const [ oricorio, volcarona ] = game.scene.getPlayerField();
|
||||
game.move.changeMoveset(oricorio, Moves.SPLASH);
|
||||
game.move.changeMoveset(volcarona, Moves.FIERY_DANCE);
|
||||
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER);
|
||||
game.move.select(Moves.FIERY_DANCE, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY);
|
||||
await game.forceEnemyMove(Moves.INSTRUCT, BattlerIndex.PLAYER_2);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
// fiery dance triggered dancer successfully for a total of 4 hits
|
||||
// Volcarona fiery dance has a _small_ chance to 3HKO a shuckle in worst case, so we add the hit count of both
|
||||
// foes to account for spillover
|
||||
instructSuccess(volcarona, Moves.FIERY_DANCE);
|
||||
expect(game.scene.getEnemyField()[0].turnData.attacksReceived.length +
|
||||
game.scene.getEnemyField()[1].turnData.attacksReceived.length).toBe(4);
|
||||
});
|
||||
|
||||
it("should not repeat move when switching out", async () => {
|
||||
game.override
|
||||
.enemyMoveset(Moves.INSTRUCT)
|
||||
.enemySpecies(Species.UNOWN);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS, Species.TOXICROAK ]);
|
||||
|
||||
const amoonguss = game.scene.getPlayerPokemon()!;
|
||||
game.move.changeMoveset(amoonguss, Moves.SEED_BOMB);
|
||||
|
||||
amoonguss.battleSummonData.moveHistory = [{ move: Moves.SEED_BOMB, targets: [ BattlerIndex.ENEMY ], result: MoveResult.SUCCESS }];
|
||||
|
||||
game.doSwitchPokemon(1);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
const enemyMoves = game.scene.getEnemyPokemon()!.getLastXMoves(-1)!;
|
||||
expect(enemyMoves[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should fail if no move has yet been used by target", async () => {
|
||||
game.override.enemyMoveset(Moves.SPLASH);
|
||||
game.override
|
||||
.moveset(Moves.INSTRUCT)
|
||||
.enemyMoveset(Moves.SPLASH);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
|
@ -183,48 +288,46 @@ describe("Moves - Instruct", () => {
|
|||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.DISABLE, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY);
|
||||
await game.forceEnemyMove(Moves.SONIC_BOOM, BattlerIndex.PLAYER);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerField()[0].getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||
const enemyMove = game.scene.getEnemyPokemon()!.getLastXMoves()[0];
|
||||
const enemyMove = game.scene.getEnemyField()[0]!.getLastXMoves()[0];
|
||||
expect(enemyMove.result).toBe(MoveResult.FAIL);
|
||||
expect(game.scene.getEnemyPokemon()!.getMoveset().find(m => m?.moveId === Moves.SONIC_BOOM)?.ppUsed).toBe(1);
|
||||
|
||||
expect(game.scene.getEnemyField()[0].getMoveset().find(m => m?.moveId === Moves.SONIC_BOOM)?.ppUsed).toBe(1);
|
||||
});
|
||||
|
||||
it("should not repeat enemy's move through protect", async () => {
|
||||
game.override.moveset([ Moves.INSTRUCT ]);
|
||||
await game.classicMode.startBattle([ Species.AMOONGUSS ]);
|
||||
|
||||
const MoveToUse = Moves.PROTECT;
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
game.move.changeMoveset(enemyPokemon, MoveToUse);
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
game.move.changeMoveset(enemy, Moves.PROTECT);
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
await game.forceEnemyMove(Moves.PROTECT);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
expect(enemyPokemon.getLastXMoves(-1)[0].move).toBe(Moves.PROTECT);
|
||||
expect(enemyPokemon.getLastXMoves(-1)[1]).toBeUndefined(); // undefined because protect failed
|
||||
expect(enemyPokemon.getMoveset().find(m => m?.moveId === Moves.PROTECT)?.ppUsed).toBe(1);
|
||||
expect(enemy.getLastXMoves(-1)[0].move).toBe(Moves.PROTECT);
|
||||
expect(enemy.getLastXMoves(-1)[1]).toBeUndefined(); // undefined because instruct failed and didn't repeat
|
||||
expect(enemy.getMoveset().find(m => m?.moveId === Moves.PROTECT)?.ppUsed).toBe(1);
|
||||
});
|
||||
|
||||
it("should not repeat enemy's charging move", async () => {
|
||||
game.override
|
||||
.enemyMoveset([ Moves.SONIC_BOOM, Moves.HYPER_BEAM ])
|
||||
.enemyLevel(5);
|
||||
.moveset([ Moves.INSTRUCT ])
|
||||
.enemyMoveset([ Moves.SONIC_BOOM, Moves.HYPER_BEAM ]);
|
||||
await game.classicMode.startBattle([ Species.SHUCKLE ]);
|
||||
|
||||
const player = game.scene.getPlayerPokemon()!;
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
enemyPokemon.battleSummonData.moveHistory = [{ move: Moves.SONIC_BOOM, targets: [ BattlerIndex.PLAYER ], result: MoveResult.SUCCESS, virtual: false }];
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
enemy.battleSummonData.moveHistory = [{ move: Moves.SONIC_BOOM, targets: [ BattlerIndex.PLAYER ], result: MoveResult.SUCCESS, virtual: false }];
|
||||
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
await game.forceEnemyMove(Moves.HYPER_BEAM);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.toNextTurn();
|
||||
|
||||
// instruct fails at copying last move due to charging turn (rather than instructing sonic boom)
|
||||
expect(player.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
|
@ -234,31 +337,162 @@ describe("Moves - Instruct", () => {
|
|||
expect(player.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should not repeat dance move not known by target", async () => {
|
||||
it("should not repeat move since forgotten by target", async () => {
|
||||
game.override
|
||||
.battleType("double")
|
||||
.moveset([ Moves.INSTRUCT, Moves.FIERY_DANCE ])
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
.enemyAbility(Abilities.DANCER);
|
||||
await game.classicMode.startBattle([ Species.SHUCKLE, Species.SHUCKLE ]);
|
||||
.enemyLevel(5)
|
||||
.xpMultiplier(0)
|
||||
.enemySpecies(Species.WURMPLE)
|
||||
.enemyMoveset(Moves.INSTRUCT);
|
||||
await game.classicMode.startBattle([ Species.REGIELEKI ]);
|
||||
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.FIERY_DANCE, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY);
|
||||
const regieleki = game.scene.getPlayerPokemon()!;
|
||||
// fill out moveset with random moves
|
||||
game.move.changeMoveset(regieleki, [ Moves.ELECTRO_DRIFT, Moves.SPLASH, Moves.ICE_BEAM, Moves.ANCIENT_POWER ]);
|
||||
|
||||
game.move.select(Moves.ELECTRO_DRIFT);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||
await game.phaseInterceptor.to("FaintPhase");
|
||||
await game.move.learnMove(Moves.ELECTROWEB);
|
||||
await game.toNextWave();
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
expect(game.scene.getEnemyField()[0].getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should disregard priority of instructed move on use", async () => {
|
||||
game.override
|
||||
.enemyMoveset([ Moves.SPLASH, Moves.WHIRLWIND ])
|
||||
.moveset(Moves.INSTRUCT);
|
||||
await game.classicMode.startBattle([ Species.LUCARIO, Species.BANETTE ]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
enemyPokemon.battleSummonData.moveHistory = [{ move: Moves.WHIRLWIND, targets: [ BattlerIndex.PLAYER ], result: MoveResult.SUCCESS, virtual: false }];
|
||||
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
// lucario instructed enemy whirlwind at 0 priority to switch itself out
|
||||
const instructedMove = enemyPokemon.getLastXMoves(-1)[1];
|
||||
expect(instructedMove.result).toBe(MoveResult.SUCCESS);
|
||||
expect(instructedMove.move).toBe(Moves.WHIRLWIND);
|
||||
expect(game.scene.getPlayerPokemon()?.species.speciesId).toBe(Species.BANETTE);
|
||||
});
|
||||
|
||||
it("should respect moves' original priority for psychic terrain", async () => {
|
||||
game.override.
|
||||
battleType("double")
|
||||
.moveset([ Moves.QUICK_ATTACK, Moves.SPLASH, Moves.INSTRUCT ])
|
||||
.enemyMoveset([ Moves.SPLASH, Moves.PSYCHIC_TERRAIN ]);
|
||||
await game.classicMode.startBattle([ Species.BANETTE, Species.KLEFKI ]);
|
||||
|
||||
game.move.select(Moves.QUICK_ATTACK, BattlerIndex.PLAYER, BattlerIndex.ENEMY); // succeeds due to terrain no
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER_2);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.forceEnemyMove(Moves.PSYCHIC_TERRAIN);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerField()[0].getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
// quick attack failed when instructed
|
||||
const banette = game.scene.getPlayerPokemon()!;
|
||||
expect(banette.getLastXMoves(-1)[1].move).toBe(Moves.QUICK_ATTACK);
|
||||
expect(banette.getLastXMoves(-1)[1].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should still work w/ prankster in psychic terrain", async () => {
|
||||
game.override.
|
||||
battleType("double")
|
||||
.enemyMoveset([ Moves.SPLASH, Moves.PSYCHIC_TERRAIN ]);
|
||||
await game.classicMode.startBattle([ Species.BANETTE, Species.KLEFKI ]);
|
||||
|
||||
const [ banette, klefki ] = game.scene.getPlayerField()!;
|
||||
game.move.changeMoveset(banette, [ Moves.VINE_WHIP, Moves.SPLASH ]);
|
||||
game.move.changeMoveset(klefki, [ Moves.INSTRUCT, Moves.SPLASH ]);
|
||||
|
||||
game.move.select(Moves.VINE_WHIP, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER_2);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.forceEnemyMove(Moves.PSYCHIC_TERRAIN);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER); // copies vine whip
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
expect(banette.getLastXMoves(-1)[1].move).toBe(Moves.VINE_WHIP);
|
||||
expect(banette.getLastXMoves(-1)[2].move).toBe(Moves.VINE_WHIP);
|
||||
expect(banette.getMoveset().find(m => m?.moveId === Moves.VINE_WHIP )?.ppUsed).toBe(2);
|
||||
});
|
||||
|
||||
it("should cause spread moves to correctly hit targets in doubles after singles", async () => {
|
||||
game.override
|
||||
.battleType("even-doubles")
|
||||
.moveset([ Moves.BREAKING_SWIPE, Moves.INSTRUCT, Moves.SPLASH ])
|
||||
.enemyMoveset(Moves.SONIC_BOOM)
|
||||
.enemySpecies(Species.AXEW)
|
||||
.startingLevel(500);
|
||||
await game.classicMode.startBattle([ Species.KORAIDON, Species.KLEFKI ]);
|
||||
|
||||
const koraidon = game.scene.getPlayerField()[0]!;
|
||||
|
||||
game.move.select(Moves.BREAKING_SWIPE);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
expect(koraidon.getInverseHp()).toBe(0);
|
||||
expect(koraidon.getLastXMoves(-1)[0].targets).toEqual([ BattlerIndex.ENEMY ]);
|
||||
await game.toNextWave();
|
||||
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
// did not take damage since enemies died beforehand;
|
||||
// last move used hit both enemies
|
||||
expect(koraidon.getInverseHp()).toBe(0);
|
||||
expect(koraidon.getLastXMoves(-1)[1].targets?.sort()).toEqual([ BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
});
|
||||
|
||||
it("should cause AoE moves to correctly hit everyone in doubles after singles", async () => {
|
||||
game.override
|
||||
.battleType("even-doubles")
|
||||
.moveset([ Moves.BRUTAL_SWING, Moves.INSTRUCT, Moves.SPLASH ])
|
||||
.enemySpecies(Species.AXEW)
|
||||
.enemyMoveset(Moves.SONIC_BOOM)
|
||||
.startingLevel(500);
|
||||
await game.classicMode.startBattle([ Species.KORAIDON, Species.KLEFKI ]);
|
||||
|
||||
const koraidon = game.scene.getPlayerField()[0]!;
|
||||
|
||||
game.move.select(Moves.BRUTAL_SWING);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
expect(koraidon.getInverseHp()).toBe(0);
|
||||
expect(koraidon.getLastXMoves(-1)[0].targets).toEqual([ BattlerIndex.ENEMY ]);
|
||||
await game.toNextWave();
|
||||
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("TurnEndPhase", false);
|
||||
// did not take damage since enemies died beforehand;
|
||||
// last move used hit everything around it
|
||||
expect(koraidon.getInverseHp()).toBe(0);
|
||||
expect(koraidon.getLastXMoves(-1)[1].targets?.sort()).toEqual([ BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
});
|
||||
|
||||
it("should cause multi-hit moves to hit the appropriate number of times in singles", async () => {
|
||||
game.override
|
||||
.enemyAbility(Abilities.SKILL_LINK)
|
||||
.moveset([ Moves.SPLASH, Moves.INSTRUCT ])
|
||||
.enemyMoveset(Moves.BULLET_SEED);
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
|
||||
const player = game.scene.getPlayerPokemon()!;
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.toNextTurn();
|
||||
|
@ -267,34 +501,35 @@ describe("Moves - Instruct", () => {
|
|||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(player.turnData.attacksReceived.length).toBe(10);
|
||||
expect(bulbasaur.turnData.attacksReceived.length).toBe(10);
|
||||
|
||||
await game.toNextTurn();
|
||||
game.move.select(Moves.INSTRUCT);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(player.turnData.attacksReceived.length).toBe(10);
|
||||
expect(bulbasaur.turnData.attacksReceived.length).toBe(10);
|
||||
});
|
||||
|
||||
it("should cause multi-hit moves to hit the appropriate number of times in doubles", async () => {
|
||||
game.override
|
||||
.battleType("double")
|
||||
.enemyAbility(Abilities.SKILL_LINK)
|
||||
.moveset([ Moves.SPLASH, Moves.INSTRUCT ])
|
||||
.enemyMoveset([ Moves.BULLET_SEED, Moves.SPLASH ])
|
||||
.enemyLevel(5);
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR, Species.IVYSAUR ]);
|
||||
|
||||
const [ , ivysaur ] = game.scene.getPlayerField();
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
game.move.select(Moves.SPLASH, 1);
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER);
|
||||
game.move.select(Moves.SPLASH, BattlerIndex.PLAYER_2);
|
||||
await game.forceEnemyMove(Moves.BULLET_SEED, BattlerIndex.PLAYER_2);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(Moves.INSTRUCT, 0, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.INSTRUCT, 1, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY);
|
||||
await game.forceEnemyMove(Moves.BULLET_SEED, BattlerIndex.PLAYER_2);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
|
@ -303,8 +538,8 @@ describe("Moves - Instruct", () => {
|
|||
expect(ivysaur.turnData.attacksReceived.length).toBe(15);
|
||||
|
||||
await game.toNextTurn();
|
||||
game.move.select(Moves.INSTRUCT, 0, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.INSTRUCT, 1, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.INSTRUCT, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY);
|
||||
await game.forceEnemyMove(Moves.BULLET_SEED, BattlerIndex.PLAYER_2);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2 ]);
|
||||
|
|
|
@ -4,6 +4,8 @@ import GameManager from "#test/utils/gameManager";
|
|||
import { Species } from "#enums/species";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { Button } from "#app/enums/buttons";
|
||||
|
||||
describe("Learn Move Phase", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
|
@ -26,7 +28,7 @@ describe("Learn Move Phase", () => {
|
|||
|
||||
it("If Pokemon has less than 4 moves, its newest move will be added to the lowest empty index", async () => {
|
||||
game.override.moveset([ Moves.SPLASH ]);
|
||||
await game.startBattle([ Species.BULBASAUR ]);
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const pokemon = game.scene.getPlayerPokemon()!;
|
||||
const newMovePos = pokemon?.getMoveset().length;
|
||||
game.move.select(Moves.SPLASH);
|
||||
|
@ -36,12 +38,113 @@ describe("Learn Move Phase", () => {
|
|||
const levelReq = levelMove[0];
|
||||
const levelMoveId = levelMove[1];
|
||||
expect(pokemon.level).toBeGreaterThanOrEqual(levelReq);
|
||||
expect(pokemon?.getMoveset()[newMovePos]?.moveId).toBe(levelMoveId);
|
||||
expect(pokemon?.moveset[newMovePos]?.moveId).toBe(levelMoveId);
|
||||
});
|
||||
|
||||
it("If a pokemon has 4 move slots filled, the chosen move will be deleted and replaced", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
const prevMoveset = [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ];
|
||||
const moveSlotNum = 3;
|
||||
|
||||
game.move.changeMoveset(bulbasaur, prevMoveset);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
|
||||
// queue up inputs to confirm dialog boxes
|
||||
game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
|
||||
game.scene.ui.processInput(Button.ACTION);
|
||||
});
|
||||
game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => {
|
||||
for (let x = 0; x < moveSlotNum; x++) {
|
||||
game.scene.ui.processInput(Button.DOWN);
|
||||
}
|
||||
game.scene.ui.processInput(Button.ACTION);
|
||||
});
|
||||
await game.phaseInterceptor.to(LearnMovePhase);
|
||||
|
||||
const levelMove = bulbasaur.getLevelMoves(5)[0];
|
||||
const levelReq = levelMove[0];
|
||||
const levelMoveId = levelMove[1];
|
||||
expect(bulbasaur.level).toBeGreaterThanOrEqual(levelReq);
|
||||
// Check each of mr mime's moveslots to make sure the changed move (and ONLY the changed move) is different
|
||||
bulbasaur.getMoveset().forEach((move, index) => {
|
||||
const expectedMove: Moves = (index === moveSlotNum ? levelMoveId : prevMoveset[index]);
|
||||
expect(move?.moveId).toBe(expectedMove);
|
||||
});
|
||||
});
|
||||
|
||||
it("selecting the newly deleted move will reject it and keep old moveset", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
const prevMoveset = [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ];
|
||||
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
|
||||
// queue up inputs to confirm dialog boxes
|
||||
game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
|
||||
game.scene.ui.processInput(Button.ACTION);
|
||||
});
|
||||
game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => {
|
||||
for (let x = 0; x < 4; x++) {
|
||||
game.scene.ui.processInput(Button.DOWN); // moves down 4 times to the 5th move slot
|
||||
}
|
||||
game.scene.ui.processInput(Button.ACTION);
|
||||
});
|
||||
game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
|
||||
game.scene.ui.processInput(Button.ACTION);
|
||||
});
|
||||
await game.phaseInterceptor.to(LearnMovePhase);
|
||||
|
||||
const levelReq = bulbasaur.getLevelMoves(5)[0][0];
|
||||
expect(bulbasaur.level).toBeGreaterThanOrEqual(levelReq);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual(prevMoveset);
|
||||
});
|
||||
|
||||
it("macro should add moves in free slots normally", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.move.learnMove(Moves.SACRED_FIRE, 0, 1);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.SACRED_FIRE ]);
|
||||
|
||||
});
|
||||
|
||||
it("macro should replace moves", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.move.learnMove(Moves.SACRED_FIRE, 0, 1);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SPLASH, Moves.SACRED_FIRE, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
|
||||
});
|
||||
|
||||
it("macro should allow for cancelling move learning", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR ]);
|
||||
const bulbasaur = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.changeMoveset(bulbasaur, [ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.move.learnMove(Moves.SACRED_FIRE, 0, 4);
|
||||
expect(bulbasaur.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SPLASH, Moves.ABSORB, Moves.ACID, Moves.VINE_WHIP ]);
|
||||
|
||||
});
|
||||
|
||||
it("macro works on off-field party members", async () => {
|
||||
await game.classicMode.startBattle([ Species.BULBASAUR, Species.SQUIRTLE ]);
|
||||
const squirtle = game.scene.getPlayerParty()[1]!;
|
||||
|
||||
game.move.changeMoveset(squirtle, [ Moves.SPLASH, Moves.WATER_GUN, Moves.FREEZE_DRY, Moves.GROWL ]);
|
||||
game.move.select(Moves.TACKLE);
|
||||
await game.move.learnMove(Moves.SHELL_SMASH, 1, 0);
|
||||
expect(squirtle.getMoveset().map(m => m?.moveId)).toEqual([ Moves.SHELL_SMASH, Moves.WATER_GUN, Moves.FREEZE_DRY, Moves.GROWL ]);
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Future Tests:
|
||||
* If a Pokemon has four moves, the user can specify an old move to be forgotten and a new move will take its place.
|
||||
* If a Pokemon has four moves, the user can reject the new move, keeping the moveset the same.
|
||||
*/
|
||||
});
|
||||
|
|
|
@ -129,9 +129,10 @@ export default class GameManager {
|
|||
|
||||
/**
|
||||
* Adds an action to be executed on the next prompt.
|
||||
* This can be used to (among other things) simulate inputs or run functions mid-phase.
|
||||
* @param phaseTarget - The target phase.
|
||||
* @param mode - The mode to wait for.
|
||||
* @param callback - The callback to execute.
|
||||
* @param callback - The callback function to execute on next prompt.
|
||||
* @param expireFn - Optional function to determine if the prompt has expired.
|
||||
*/
|
||||
onNextPrompt(phaseTarget: string, mode: Mode, callback: () => void, expireFn?: () => void, awaitingActionInput: boolean = false) {
|
||||
|
@ -400,6 +401,11 @@ export default class GameManager {
|
|||
return updateUserInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Faints a player or enemy pokemon instantly by setting their HP to 0.
|
||||
* @param pokemon The player/enemy pokemon being fainted
|
||||
* @returns A promise that resolves once the fainted pokemon's FaintPhase finishes running.
|
||||
*/
|
||||
async killPokemon(pokemon: PlayerPokemon | EnemyPokemon) {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
pokemon.hp = 0;
|
||||
|
@ -453,8 +459,9 @@ export default class GameManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Intercepts `TurnStartPhase` and mocks the getSpeedOrder's return value {@linkcode TurnStartPhase.getSpeedOrder}
|
||||
* Used to modify the turn order.
|
||||
* Intercepts `TurnStartPhase` and mocks {@linkcode TurnStartPhase.getSpeedOrder}'s return value.
|
||||
* Used to manually modify Pokemon turn order.
|
||||
* Note: This *DOES NOT* account for priority, only speed.
|
||||
* @param {BattlerIndex[]} order The turn order to set
|
||||
* @example
|
||||
* ```ts
|
||||
|
@ -468,7 +475,7 @@ export default class GameManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes all held items from enemy pokemon
|
||||
* Removes all held items from enemy pokemon.
|
||||
*/
|
||||
removeEnemyHeldItems(): void {
|
||||
this.scene.clearEnemyHeldItemModifiers();
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import type { BattlerIndex } from "#app/battle";
|
||||
import { Button } from "#app/enums/buttons";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import Overrides from "#app/overrides";
|
||||
import type { CommandPhase } from "#app/phases/command-phase";
|
||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
|
@ -75,9 +77,10 @@ export class MoveHelper extends GameManagerHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when the normal moveset override can't be used (such as when it's necessary to check updated properties of the moveset).
|
||||
* @param pokemon - The pokemon being modified
|
||||
* @param moveset - The moveset to use
|
||||
* Changes a pokemon's moveset to the given move(s).
|
||||
* Used when the normal moveset override can't be used (such as when it's necessary to check or update properties of the moveset).
|
||||
* @param pokemon - The {@linkcode Pokemon} being modified
|
||||
* @param moveset - The {@linkcode Moves} (single or array) to change the Pokemon's moveset to
|
||||
*/
|
||||
public changeMoveset(pokemon: Pokemon, moveset: Moves | Moves[]): void {
|
||||
if (!Array.isArray(moveset)) {
|
||||
|
@ -90,4 +93,40 @@ export class MoveHelper extends GameManagerHelper {
|
|||
const movesetStr = moveset.map((moveId) => Moves[moveId]).join(", ");
|
||||
console.log(`Pokemon ${pokemon.species.name}'s moveset manually set to ${movesetStr} (=[${moveset.join(", ")}])!`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates learning a move for a player pokemon.
|
||||
* @param move The {@linkcode Moves} being learnt
|
||||
* @param partyIndex The party position of the {@linkcode PlayerPokemon} learning the move (defaults to 0)
|
||||
* @param moveSlotIndex The INDEX (0-4) of the move slot to replace if existent move slots are full;
|
||||
* defaults to 0 (first slot) and 4 aborts the procedure
|
||||
* @returns a promise that resolves once the move has been successfully learnt
|
||||
*/
|
||||
public async learnMove(move: Moves | integer, partyIndex: integer = 0, moveSlotIndex: integer = 0) {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
this.game.scene.pushPhase(new LearnMovePhase(partyIndex, move));
|
||||
|
||||
// if slots are full, queue up inputs to replace existing moves
|
||||
if (this.game.scene.getPlayerParty()[partyIndex].moveset.filter(m => m).length === 4) {
|
||||
this.game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
|
||||
this.game.scene.ui.processInput(Button.ACTION); // "Should a move be forgotten and replaced with XXX?"
|
||||
});
|
||||
this.game.onNextPrompt("LearnMovePhase", Mode.SUMMARY, () => {
|
||||
for (let x = 0; x < (moveSlotIndex ?? 0); x++) {
|
||||
this.game.scene.ui.processInput(Button.DOWN); // Scrolling in summary pane to move position
|
||||
}
|
||||
this.game.scene.ui.processInput(Button.ACTION);
|
||||
if (moveSlotIndex === 4) {
|
||||
this.game.onNextPrompt("LearnMovePhase", Mode.CONFIRM, () => {
|
||||
this.game.scene.ui.processInput(Button.ACTION); // "Give up on learning XXX?"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
await this.game.phaseInterceptor.to(LearnMovePhase).catch(e => reject(e));
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,6 +71,26 @@ export class OverridesHelper extends GameManagerHelper {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the wave level cap
|
||||
* @param cap the level cap value to set; 0 uses normal level caps and negative values
|
||||
* disable it completely
|
||||
* @returns `this`
|
||||
*/
|
||||
public levelCap(cap: number): this {
|
||||
vi.spyOn(Overrides, "LEVEL_CAP_OVERRIDE", "get").mockReturnValue(cap);
|
||||
let capStr: string;
|
||||
if (cap > 0) {
|
||||
capStr = `Level cap set to ${cap}!`;
|
||||
} else if (cap < 0) {
|
||||
capStr = "Level cap disabled!";
|
||||
} else {
|
||||
capStr = "Level cap reset to default value for wave.";
|
||||
}
|
||||
this.log(capStr);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the player (pokemon) starting held items
|
||||
* @param items the items to hold
|
||||
|
@ -140,7 +160,7 @@ export class OverridesHelper extends GameManagerHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Override the player (pokemon) {@linkcode Abilities | ability}
|
||||
* Override the player (pokemon) {@linkcode Abilities | ability}.
|
||||
* @param ability the (pokemon) {@linkcode Abilities | ability} to set
|
||||
* @returns `this`
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER } from "#app/data/balance/starters";
|
||||
import { TimedEventManager } from "#app/timed-event-manager";
|
||||
|
||||
/** Mock TimedEventManager so that ongoing events don't impact tests */
|
||||
|
@ -8,8 +9,8 @@ export class MockTimedEventManager extends TimedEventManager {
|
|||
override isEventActive(): boolean {
|
||||
return false;
|
||||
}
|
||||
override getFriendshipMultiplier(): number {
|
||||
return 1;
|
||||
override getClassicFriendshipMultiplier(): number {
|
||||
return CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER;
|
||||
}
|
||||
override getShinyMultiplier(): number {
|
||||
return 1;
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { TextStyle, addTextObject } from "#app/ui/text";
|
||||
import type { nil } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import i18next from "i18next";
|
||||
import { Species } from "#enums/species";
|
||||
import type { WeatherPoolEntry } from "#app/data/weather";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER } from "./data/balance/starters";
|
||||
import { MysteryEncounterType } from "./enums/mystery-encounter-type";
|
||||
import { MysteryEncounterTier } from "./enums/mystery-encounter-tier";
|
||||
|
||||
export enum EventType {
|
||||
SHINY,
|
||||
NO_TIMER_DISPLAY
|
||||
NO_TIMER_DISPLAY,
|
||||
LUCK
|
||||
}
|
||||
|
||||
interface EventBanner {
|
||||
|
@ -21,19 +26,29 @@ interface EventBanner {
|
|||
|
||||
interface EventEncounter {
|
||||
species: Species;
|
||||
allowEvolution?: boolean;
|
||||
blockEvolution?: boolean;
|
||||
}
|
||||
|
||||
interface EventMysteryEncounterTier {
|
||||
mysteryEncounter: MysteryEncounterType;
|
||||
tier?: MysteryEncounterTier;
|
||||
disable?: boolean;
|
||||
}
|
||||
|
||||
interface TimedEvent extends EventBanner {
|
||||
name: string;
|
||||
eventType: EventType;
|
||||
shinyMultiplier?: number;
|
||||
friendshipMultiplier?: number;
|
||||
classicFriendshipMultiplier?: number;
|
||||
luckBoost?: number;
|
||||
upgradeUnlockedVouchers?: boolean;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
uncommonBreedEncounters?: EventEncounter[];
|
||||
eventEncounters?: EventEncounter[];
|
||||
delibirdyBuff?: string[];
|
||||
weather?: WeatherPoolEntry[];
|
||||
mysteryEncounterTierChanges?: EventMysteryEncounterTier[];
|
||||
luckBoostedSpecies?: Species[];
|
||||
}
|
||||
|
||||
const timedEvents: TimedEvent[] = [
|
||||
|
@ -41,36 +56,94 @@ const timedEvents: TimedEvent[] = [
|
|||
name: "Winter Holiday Update",
|
||||
eventType: EventType.SHINY,
|
||||
shinyMultiplier: 2,
|
||||
friendshipMultiplier: 1,
|
||||
upgradeUnlockedVouchers: true,
|
||||
startDate: new Date(Date.UTC(2024, 11, 21, 0)),
|
||||
endDate: new Date(Date.UTC(2025, 0, 4, 0)),
|
||||
bannerKey: "winter_holidays2024-event-",
|
||||
scale: 0.21,
|
||||
availableLangs: [ "en", "de", "it", "fr", "ja", "ko", "es-ES", "pt-BR", "zh-CN" ],
|
||||
uncommonBreedEncounters: [
|
||||
{ species: Species.GIMMIGHOUL },
|
||||
eventEncounters: [
|
||||
{ species: Species.GIMMIGHOUL, blockEvolution: true },
|
||||
{ species: Species.DELIBIRD },
|
||||
{ species: Species.STANTLER, allowEvolution: true },
|
||||
{ species: Species.CYNDAQUIL, allowEvolution: true },
|
||||
{ species: Species.PIPLUP, allowEvolution: true },
|
||||
{ species: Species.CHESPIN, allowEvolution: true },
|
||||
{ species: Species.BALTOY, allowEvolution: true },
|
||||
{ species: Species.SNOVER, allowEvolution: true },
|
||||
{ species: Species.CHINGLING, allowEvolution: true },
|
||||
{ species: Species.LITWICK, allowEvolution: true },
|
||||
{ species: Species.CUBCHOO, allowEvolution: true },
|
||||
{ species: Species.SWIRLIX, allowEvolution: true },
|
||||
{ species: Species.AMAURA, allowEvolution: true },
|
||||
{ species: Species.MUDBRAY, allowEvolution: true },
|
||||
{ species: Species.ROLYCOLY, allowEvolution: true },
|
||||
{ species: Species.MILCERY, allowEvolution: true },
|
||||
{ species: Species.SMOLIV, allowEvolution: true },
|
||||
{ species: Species.ALOLA_VULPIX, allowEvolution: true },
|
||||
{ species: Species.GALAR_DARUMAKA, allowEvolution: true },
|
||||
{ species: Species.STANTLER },
|
||||
{ species: Species.CYNDAQUIL },
|
||||
{ species: Species.PIPLUP },
|
||||
{ species: Species.CHESPIN },
|
||||
{ species: Species.BALTOY },
|
||||
{ species: Species.SNOVER },
|
||||
{ species: Species.CHINGLING },
|
||||
{ species: Species.LITWICK },
|
||||
{ species: Species.CUBCHOO },
|
||||
{ species: Species.SWIRLIX },
|
||||
{ species: Species.AMAURA },
|
||||
{ species: Species.MUDBRAY },
|
||||
{ species: Species.ROLYCOLY },
|
||||
{ species: Species.MILCERY },
|
||||
{ species: Species.SMOLIV },
|
||||
{ species: Species.ALOLA_VULPIX },
|
||||
{ species: Species.GALAR_DARUMAKA },
|
||||
{ species: Species.IRON_BUNDLE }
|
||||
],
|
||||
delibirdyBuff: [ "CATCHING_CHARM", "SHINY_CHARM", "ABILITY_CHARM", "EXP_CHARM", "SUPER_EXP_CHARM", "HEALING_CHARM" ],
|
||||
weather: [{ weatherType: WeatherType.SNOW, weight: 1 }]
|
||||
weather: [{ weatherType: WeatherType.SNOW, weight: 1 }],
|
||||
mysteryEncounterTierChanges: [
|
||||
{ mysteryEncounter: MysteryEncounterType.DELIBIRDY, tier: MysteryEncounterTier.COMMON },
|
||||
{ mysteryEncounter: MysteryEncounterType.PART_TIMER, disable: true },
|
||||
{ mysteryEncounter: MysteryEncounterType.AN_OFFER_YOU_CANT_REFUSE, disable: true },
|
||||
{ mysteryEncounter: MysteryEncounterType.FIELD_TRIP, disable: true },
|
||||
{ mysteryEncounter: MysteryEncounterType.DEPARTMENT_STORE_SALE, disable: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Year of the Snake",
|
||||
eventType: EventType.LUCK,
|
||||
luckBoost: 1,
|
||||
startDate: new Date(Date.UTC(2025, 0, 29, 0)),
|
||||
endDate: new Date(Date.UTC(2025, 1, 3, 0)),
|
||||
bannerKey: "yearofthesnakeevent-",
|
||||
scale: 0.21,
|
||||
availableLangs: [ "en", "de", "it", "fr", "ja", "ko", "es-ES", "pt-BR", "zh-CN" ],
|
||||
eventEncounters: [
|
||||
{ species: Species.EKANS },
|
||||
{ species: Species.ONIX },
|
||||
{ species: Species.DRATINI },
|
||||
{ species: Species.CLEFFA },
|
||||
{ species: Species.UMBREON },
|
||||
{ species: Species.DUNSPARCE },
|
||||
{ species: Species.TEDDIURSA },
|
||||
{ species: Species.SEVIPER },
|
||||
{ species: Species.LUNATONE },
|
||||
{ species: Species.CHINGLING },
|
||||
{ species: Species.SNIVY },
|
||||
{ species: Species.DARUMAKA },
|
||||
{ species: Species.DRAMPA },
|
||||
{ species: Species.SILICOBRA },
|
||||
{ species: Species.BLOODMOON_URSALUNA }
|
||||
],
|
||||
luckBoostedSpecies: [
|
||||
Species.EKANS, Species.ARBOK,
|
||||
Species.ONIX, Species.STEELIX,
|
||||
Species.DRATINI, Species.DRAGONAIR, Species.DRAGONITE,
|
||||
Species.CLEFFA, Species.CLEFAIRY, Species.CLEFABLE,
|
||||
Species.UMBREON,
|
||||
Species.DUNSPARCE, Species.DUDUNSPARCE,
|
||||
Species.TEDDIURSA, Species.URSARING, Species.URSALUNA,
|
||||
Species.SEVIPER,
|
||||
Species.LUNATONE,
|
||||
Species.RAYQUAZA,
|
||||
Species.CHINGLING, Species.CHIMECHO,
|
||||
Species.CRESSELIA,
|
||||
Species.DARKRAI,
|
||||
Species.SNIVY, Species.SERVINE, Species.SERPERIOR,
|
||||
Species.DARUMAKA, Species.DARMANITAN,
|
||||
Species.ZYGARDE,
|
||||
Species.DRAMPA,
|
||||
Species.LUNALA,
|
||||
Species.BLACEPHALON,
|
||||
Species.SILICOBRA, Species.SANDACONDA,
|
||||
Species.ROARING_MOON,
|
||||
Species.BLOODMOON_URSALUNA
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -97,16 +170,6 @@ export class TimedEventManager {
|
|||
return activeEvents.length > 0;
|
||||
}
|
||||
|
||||
getFriendshipMultiplier(): number {
|
||||
let multiplier = 1;
|
||||
const friendshipEvents = timedEvents.filter((te) => this.isActive(te));
|
||||
friendshipEvents.forEach((fe) => {
|
||||
multiplier *= fe.friendshipMultiplier ?? 1;
|
||||
});
|
||||
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
getShinyMultiplier(): number {
|
||||
let multiplier = 1;
|
||||
const shinyEvents = timedEvents.filter((te) => te.eventType === EventType.SHINY && this.isActive(te));
|
||||
|
@ -120,6 +183,120 @@ export class TimedEventManager {
|
|||
getEventBannerFilename(): string {
|
||||
return timedEvents.find((te: TimedEvent) => this.isActive(te))?.bannerKey ?? "";
|
||||
}
|
||||
|
||||
getEventEncounters(): EventEncounter[] {
|
||||
const ret: EventEncounter[] = [];
|
||||
timedEvents.filter((te) => this.isActive(te)).map((te) => {
|
||||
if (!isNullOrUndefined(te.eventEncounters)) {
|
||||
ret.push(...te.eventEncounters);
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* For events that change the classic candy friendship multiplier
|
||||
* @returns The highest classic friendship multiplier among the active events, or the default CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER
|
||||
*/
|
||||
getClassicFriendshipMultiplier(): number {
|
||||
let multiplier = CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER;
|
||||
const classicFriendshipEvents = timedEvents.filter((te) => this.isActive(te));
|
||||
classicFriendshipEvents.forEach((fe) => {
|
||||
if (!isNullOrUndefined(fe.classicFriendshipMultiplier) && fe.classicFriendshipMultiplier > multiplier) {
|
||||
multiplier = fe.classicFriendshipMultiplier;
|
||||
}
|
||||
});
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* For events where defeated bosses (Gym Leaders, E4 etc) give out Voucher Plus even if they were defeated before
|
||||
* @returns Whether vouchers should be upgraded
|
||||
*/
|
||||
getUpgradeUnlockedVouchers(): boolean {
|
||||
return timedEvents.some((te) => this.isActive(te) && (te.upgradeUnlockedVouchers ?? false));
|
||||
}
|
||||
|
||||
/**
|
||||
* For events where Delibirdy gives extra items
|
||||
* @returns list of ids of {@linkcode ModifierType}s that Delibirdy hands out as a bonus
|
||||
*/
|
||||
getDelibirdyBuff(): string[] {
|
||||
const ret: string[] = [];
|
||||
timedEvents.filter((te) => this.isActive(te)).map((te) => {
|
||||
if (!isNullOrUndefined(te.delibirdyBuff)) {
|
||||
ret.push(...te.delibirdyBuff);
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* For events where there's a set weather for town biome (other biomes are hard)
|
||||
* @returns Event weathers for town
|
||||
*/
|
||||
getWeather(): WeatherPoolEntry[] {
|
||||
const ret: WeatherPoolEntry[] = [];
|
||||
timedEvents.filter((te) => this.isActive(te)).map((te) => {
|
||||
if (!isNullOrUndefined(te.weather)) {
|
||||
ret.push(...te.weather);
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
getAllMysteryEncounterChanges(): EventMysteryEncounterTier[] {
|
||||
const ret: EventMysteryEncounterTier[] = [];
|
||||
timedEvents.filter((te) => this.isActive(te)).map((te) => {
|
||||
if (!isNullOrUndefined(te.mysteryEncounterTierChanges)) {
|
||||
ret.push(...te.mysteryEncounterTierChanges);
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
getEventMysteryEncountersDisabled(): MysteryEncounterType[] {
|
||||
const ret: MysteryEncounterType[] = [];
|
||||
timedEvents.filter((te) => this.isActive(te) && !isNullOrUndefined(te.mysteryEncounterTierChanges)).map((te) => {
|
||||
te.mysteryEncounterTierChanges?.map((metc) => {
|
||||
if (metc.disable) {
|
||||
ret.push(metc.mysteryEncounter);
|
||||
}
|
||||
});
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
getMysteryEncounterTierForEvent(encounterType: MysteryEncounterType, normal: MysteryEncounterTier): MysteryEncounterTier {
|
||||
let ret = normal;
|
||||
timedEvents.filter((te) => this.isActive(te) && !isNullOrUndefined(te.mysteryEncounterTierChanges)).map((te) => {
|
||||
te.mysteryEncounterTierChanges?.map((metc) => {
|
||||
if (metc.mysteryEncounter === encounterType) {
|
||||
ret = metc.tier ?? normal;
|
||||
}
|
||||
});
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
getEventLuckBoost(): number {
|
||||
let ret = 0;
|
||||
const luckEvents = timedEvents.filter((te) => this.isActive(te) && !isNullOrUndefined(te.luckBoost));
|
||||
luckEvents.forEach((le) => {
|
||||
ret += le.luckBoost!;
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
getEventLuckBoostedSpecies(): Species[] {
|
||||
const ret: Species[] = [];
|
||||
timedEvents.filter((te) => this.isActive(te)).map((te) => {
|
||||
if (!isNullOrUndefined(te.luckBoostedSpecies)) {
|
||||
ret.push(...te.luckBoostedSpecies.filter(s => !ret.includes(s)));
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
export class TimedEventDisplay extends Phaser.GameObjects.Container {
|
||||
|
|
|
@ -111,7 +111,7 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||
render() {
|
||||
const ui = this.getUi();
|
||||
this.excludedMenus = () => [
|
||||
{ condition: globalScene.getCurrentPhase() instanceof SelectModifierPhase, options: [ MenuOptions.EGG_GACHA, MenuOptions.EGG_LIST ]},
|
||||
{ condition: globalScene.getCurrentPhase() instanceof SelectModifierPhase, options: [ MenuOptions.EGG_GACHA ]},
|
||||
{ condition: bypassLogin, options: [ MenuOptions.LOG_OUT ]}
|
||||
];
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ([ Mode.CONFIRM, Mode.COMMAND, Mode.FIGHT, Mode.MESSAGE ].includes(this.mode)) {
|
||||
if ([ Mode.CONFIRM, Mode.COMMAND, Mode.FIGHT, Mode.MESSAGE, Mode.TARGET_SELECT ].includes(this.mode)) {
|
||||
globalScene?.processInfoButton(pressed);
|
||||
return true;
|
||||
}
|
||||
|
@ -277,6 +277,11 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a player input of a button (delivering it to the current UI handler for processing)
|
||||
* @param button The {@linkcode Button} being inputted
|
||||
* @returns true if the input attempt succeeds
|
||||
*/
|
||||
processInput(button: Button): boolean {
|
||||
if (this.overlayActive) {
|
||||
return false;
|
||||
|
|