[Balance][Mystery][Beta] Salesman doesn't offer event mons without HA or shiny (#5746)

Don't offer event mons without HA or shiny
This commit is contained in:
AJ Fontaine 2025-05-02 21:52:51 -04:00 committed by GitHub
parent 3cb3fd15ec
commit 24939ad2e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,7 +88,7 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
const r = randSeedInt(SHINY_MAGIKARP_WEIGHT);
const validEventEncounters = timedEventManager
let validEventEncounters = timedEventManager
.getEventEncounters()
.filter(
s =>
@ -116,10 +116,13 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
// If you roll 1%, give shiny Magikarp with random variant
species = getPokemonSpecies(Species.MAGIKARP);
pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true);
} else if (
}
else if (
(validEventEncounters.length > 0 && (r <= EVENT_THRESHOLD ||
(isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE)))
) {
tries = 0;
do {
// If you roll 20%, give event encounter with 3 extra shiny rolls and its HA, if it has one
const enc = randSeedItem(validEventEncounters);
species = getPokemonSpecies(enc.species);
@ -127,7 +130,30 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
pokemon.trySetShinySeed();
pokemon.trySetShinySeed();
pokemon.trySetShinySeed();
} else {
if (pokemon.shiny || pokemon.abilityIndex === 2) {
break;
}
tries++;
} while (tries < 6);
if (!pokemon.shiny && pokemon.abilityIndex !== 2) {
// If, after 6 tries, you STILL somehow don't have an HA or shiny mon, pick from only the event mons that have an HA.
if (validEventEncounters.some(s => !!getPokemonSpecies(s.species).abilityHidden)) {
validEventEncounters.filter(s => !!getPokemonSpecies(s.species).abilityHidden);
const enc = randSeedItem(validEventEncounters);
species = getPokemonSpecies(enc.species);
pokemon = new PlayerPokemon(species, 5, 2, enc.formIndex);
pokemon.trySetShinySeed();
pokemon.trySetShinySeed();
pokemon.trySetShinySeed();
}
else {
// If there's, and this would never happen, no eligible event encounters with a hidden ability, just do Magikarp
species = getPokemonSpecies(Species.MAGIKARP);
pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true);
}
}
}
else {
pokemon = new PlayerPokemon(species, 5, 2, species.formIndex);
}
pokemon.generateAndPopulateMoveset();