Compare commits

...

13 Commits

Author SHA1 Message Date
Blitzy 1e57f158e4
Merge 6a7194c414 into 8d11313458 2025-01-28 21:12:51 -06:00
AJ Fontaine 8d11313458
[Misc] Charms in any events (#5194) 2025-01-27 14:44:21 -08:00
Lugiad ec68ec2066
[UI/UX] Year of the Snake event banners (#5192)
* Update loading-scene.ts

* 2025 Lunar Year Banners
2025-01-27 15:22:47 -07:00
NightKev 2593d0206c
[i18n] Update locales submodule (#5190) 2025-01-26 16:12:11 -08:00
David Yang 33982c311e
[UI/UX] Allow viewing egg list from rewards screen (#5181) 2025-01-26 10:28:03 -07:00
AJ Fontaine f1c06a5476
[Sprite] Fix Lugia backsprite being cut off (#5144) 2025-01-25 18:58:21 -08:00
damocleas 706a23238c
Revert "[Bug] Fix miniblackhole (#5169)" (#5183)
This reverts commit 9c29cdc63d.
2025-01-25 14:29:09 -08:00
NightKev 996ce5d986
[Misc] Update version to 1.5.0 (#5175) 2025-01-24 21:06:57 -08:00
NightKev 1a57d3998f
Merge branch 'main' into beta 2025-01-24 21:04:13 -08:00
AJ Fontaine 8685ec3c3c
[Misc] Rework some aspects of timed events (#5099)
* Refactor timed event changes

* Use getWeather function

* Add mystery encounter tier change/disabling to timed events

* Event luck boost, event encounter helper function

* Events without shiny boost shouldn't give shiny charm

* globalScene -> this in battle scene class

* Change event pools
2025-01-24 15:59:24 -07:00
Bertie690 747656e8df
[Test] Added learn move utility function & level cap overrides (#5058)
* Added learn move utility function
* Added utility functions
* add another test
* Update overrides.ts
* Update moveHelper.ts
* Update overridesHelper.ts
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: damocleas <damocleas25@gmail.com>
2025-01-23 18:47:22 -07:00
Xavion3 9c29cdc63d
[Bug] Fix miniblackhole (#5169) 2025-01-23 17:18:21 -07:00
damocleas bfe0d9bb79
Merge pull request #5076 from pagefaultgames/beta
Minor Release 1.4.3
2025-01-03 19:35:41 -05:00
34 changed files with 1882 additions and 5204 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "pokemon-rogue-battle",
"version": "1.4.3",
"version": "1.5.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pokemon-rogue-battle",
"version": "1.4.3",
"version": "1.5.0",
"hasInstallScript": true,
"dependencies": {
"@material/material-color-utilities": "^0.2.7",

View File

@ -1,7 +1,7 @@
{
"name": "pokemon-rogue-battle",
"private": true,
"version": "1.4.3",
"version": "1.5.0",
"type": "module",
"scripts": {
"start": "vite",

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 37 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 37 KiB

@ -1 +1 @@
Subproject commit e07ab625f2080afe36b61fad291b0ec5eff4000c
Subproject commit 5ef993b95fa8248adc0fb7d9489baccf546bf8e3

View File

@ -1843,8 +1843,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;
@ -3388,7 +3390,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 +3400,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;

View File

@ -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
}],

View File

@ -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]);

View File

@ -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 ],

View File

@ -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 ],

View File

@ -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, !isNullOrUndefined(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

View File

@ -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) {

View File

@ -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";
@ -1955,7 +1955,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 +1967,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 +2058,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 +2423,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 +4360,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

View File

@ -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", "");

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -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.
*/
});

View File

@ -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();
});
}
}

View File

@ -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

View File

@ -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;

View File

@ -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: [],
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 {

View File

@ -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 ]}
];