mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-11 19:02:16 +02:00
Initial event commit
This commit is contained in:
parent
18c4dddcf0
commit
d90099dccd
@ -3,7 +3,7 @@ import {
|
||||
transitionMysteryEncounterIntroVisuals,
|
||||
updatePlayerMoney,
|
||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
@ -29,6 +29,8 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
|
||||
import { timedEventManager } from "#app/global-event-manager";
|
||||
import { NON_LEGEND_ULTRA_BEASTS } from "../../balance/special-species-groups";
|
||||
|
||||
/** the i18n namespace for this encounter */
|
||||
const namespace = "mysteryEncounters/thePokemonSalesman";
|
||||
@ -38,6 +40,9 @@ const MAX_POKEMON_PRICE_MULTIPLIER = 4;
|
||||
/** Odds of shiny magikarp will be 1/value */
|
||||
const SHINY_MAGIKARP_WEIGHT = 100;
|
||||
|
||||
/** Odds of event sale will be 1/value */
|
||||
const EVENT_THRESHOLD = 20;
|
||||
|
||||
/**
|
||||
* Pokemon Salesman encounter.
|
||||
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/3799 | GitHub Issue #3799}
|
||||
@ -82,15 +87,47 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
|
||||
tries++;
|
||||
}
|
||||
|
||||
const r = randSeedInt(SHINY_MAGIKARP_WEIGHT);
|
||||
|
||||
const validEventEncounters = timedEventManager
|
||||
.getEventEncounters()
|
||||
.filter(
|
||||
s =>
|
||||
!getPokemonSpecies(s.species).legendary &&
|
||||
!getPokemonSpecies(s.species).subLegendary &&
|
||||
!getPokemonSpecies(s.species).mythical &&
|
||||
!NON_LEGEND_PARADOX_POKEMON.includes(s.species) &&
|
||||
!NON_LEGEND_ULTRA_BEASTS.includes(s.species),
|
||||
);
|
||||
|
||||
let pokemon: PlayerPokemon;
|
||||
/**
|
||||
* Mon is determined as follows:
|
||||
* If you roll the 1% for Shiny Magikarp, you get Magikarp with a random variant
|
||||
* If an event with more than 1 valid event encounter species is active, you have 19% chance to get one of those
|
||||
* If the rolled species has no HA, you have a 5% chance to get Shiny Magikarp and a 95% chance to get an event encounter
|
||||
* If the rolled species has no HA and there are no valid event encounters, you will get Shiny Magikarp
|
||||
* Mons rolled from the event encounter pool get 2 extra shiny rolls
|
||||
*/
|
||||
if (
|
||||
randSeedInt(SHINY_MAGIKARP_WEIGHT) === 0 ||
|
||||
isNullOrUndefined(species.abilityHidden) ||
|
||||
species.abilityHidden === Abilities.NONE
|
||||
r === 0 ||
|
||||
((isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE) &&
|
||||
(validEventEncounters.length === 0 || r < SHINY_MAGIKARP_WEIGHT / EVENT_THRESHOLD))
|
||||
) {
|
||||
// If no HA mon found or you roll 1%, give shiny Magikarp with random variant
|
||||
// If you roll 1%, give shiny Magikarp with random variant
|
||||
species = getPokemonSpecies(Species.MAGIKARP);
|
||||
pokemon = new PlayerPokemon(species, 5, 2, species.formIndex, undefined, true);
|
||||
pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true);
|
||||
} else if (
|
||||
(validEventEncounters.length > 0 && r < EVENT_THRESHOLD) ||
|
||||
((isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE) &&
|
||||
r >= SHINY_MAGIKARP_WEIGHT / EVENT_THRESHOLD)
|
||||
) {
|
||||
// If you roll 19%, give event encounter with 2 extra shiny rolls
|
||||
const enc = randSeedItem(validEventEncounters);
|
||||
species = getPokemonSpecies(enc.species);
|
||||
pokemon = new PlayerPokemon(species, 5, species.abilityHidden === Abilities.NONE ? undefined : 2, enc.formIndex);
|
||||
pokemon.trySetShinySeed();
|
||||
pokemon.trySetShinySeed();
|
||||
} else {
|
||||
pokemon = new PlayerPokemon(species, 5, 2, species.formIndex);
|
||||
}
|
||||
|
@ -310,6 +310,47 @@ const timedEvents: TimedEvent[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Spring 2025",
|
||||
eventType: EventType.SHINY,
|
||||
startDate: new Date(Date.UTC(2025, 2, 30)),
|
||||
endDate: new Date(Date.UTC(2025, 4, 30)),
|
||||
bannerKey: "spr25",
|
||||
scale: 0.21,
|
||||
availableLangs: ["en", "de", "it", "fr", "ja", "ko", "es-ES", "es-MX", "pt-BR", "zh-CN"],
|
||||
shinyMultiplier: 3,
|
||||
upgradeUnlockedVouchers: true,
|
||||
classicWaveRewards: [
|
||||
{ wave: 8, type: "SHINY_CHARM" },
|
||||
{ wave: 8, type: "ABILITY_CHARM" },
|
||||
{ wave: 8, type: "CATCHING_CHARM" },
|
||||
{ wave: 25, type: "SHINY_CHARM" },
|
||||
],
|
||||
eventEncounters: [
|
||||
{ species: Species.NIDORAN_F },
|
||||
{ species: Species.NIDORAN_M },
|
||||
{ species: Species.EXEGGCUTE },
|
||||
{ species: Species.HOPPIP },
|
||||
{ species: Species.PINECO },
|
||||
{ species: Species.TOGEPI },
|
||||
{ species: Species.TORCHIC },
|
||||
{ species: Species.NOSEPASS },
|
||||
{ species: Species.SPOINK },
|
||||
{ species: Species.STARLY },
|
||||
{ species: Species.SHINX },
|
||||
{ species: Species.PACHIRISU },
|
||||
{ species: Species.CHERUBI },
|
||||
{ species: Species.MUNCHLAX },
|
||||
{ species: Species.TEPIG },
|
||||
{ species: Species.PANSAGE },
|
||||
{ species: Species.PANSEAR },
|
||||
{ species: Species.PANPOUR },
|
||||
{ species: Species.SEWADDLE },
|
||||
{ species: Species.ARCHEN },
|
||||
{ species: Species.JANGMO_O },
|
||||
{ species: Species.APPLIN },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export class TimedEventManager {
|
||||
|
Loading…
Reference in New Issue
Block a user