[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 r = randSeedInt(SHINY_MAGIKARP_WEIGHT);
const validEventEncounters = timedEventManager let validEventEncounters = timedEventManager
.getEventEncounters() .getEventEncounters()
.filter( .filter(
s => s =>
@ -116,18 +116,44 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
// If you roll 1%, give shiny Magikarp with random variant // If you roll 1%, give shiny Magikarp with random variant
species = getPokemonSpecies(Species.MAGIKARP); species = getPokemonSpecies(Species.MAGIKARP);
pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true); pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true);
} else if ( }
else if (
(validEventEncounters.length > 0 && (r <= EVENT_THRESHOLD || (validEventEncounters.length > 0 && (r <= EVENT_THRESHOLD ||
(isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE))) (isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE)))
) { ) {
// If you roll 20%, give event encounter with 3 extra shiny rolls and its HA, if it has one tries = 0;
const enc = randSeedItem(validEventEncounters); do {
species = getPokemonSpecies(enc.species); // If you roll 20%, give event encounter with 3 extra shiny rolls and its HA, if it has one
pokemon = new PlayerPokemon(species, 5, species.abilityHidden === Abilities.NONE ? undefined : 2, enc.formIndex); const enc = randSeedItem(validEventEncounters);
pokemon.trySetShinySeed(); species = getPokemonSpecies(enc.species);
pokemon.trySetShinySeed(); pokemon = new PlayerPokemon(species, 5, species.abilityHidden === Abilities.NONE ? undefined : 2, enc.formIndex);
pokemon.trySetShinySeed(); pokemon.trySetShinySeed();
} else { pokemon.trySetShinySeed();
pokemon.trySetShinySeed();
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 = new PlayerPokemon(species, 5, 2, species.formIndex);
} }
pokemon.generateAndPopulateMoveset(); pokemon.generateAndPopulateMoveset();