mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-11 02:42:19 +02:00
Rerolling shiny also tries rerolling for better variant
This commit is contained in:
parent
0108d011f8
commit
1f47aab8bb
@ -37,7 +37,6 @@ import {
|
||||
PokemonHpRestoreModifier,
|
||||
PokemonIncrementingStatModifier,
|
||||
RememberMoveModifier,
|
||||
ShinyRateBoosterModifier,
|
||||
} from "./modifier/modifier";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import {
|
||||
@ -1290,17 +1289,6 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies Shiny Charms and other modifiers to check the general shiny rate
|
||||
* @returns The chance out of 65536 to get a shiny
|
||||
*/
|
||||
getModifiedShinyThreshold(): number {
|
||||
const threshold = new NumberHolder(BASE_SHINY_CHANCE);
|
||||
this.applyModifiers(ShinyRateBoosterModifier, true, threshold);
|
||||
threshold.value *= timedEventManager.getShinyMultiplier();
|
||||
return threshold.value;
|
||||
}
|
||||
|
||||
getDoubleBattleChance(newWaveIndex: number, playerField: PlayerPokemon[]) {
|
||||
const doubleChance = new NumberHolder(newWaveIndex % 10 === 0 ? 32 : 8);
|
||||
this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance);
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
transitionMysteryEncounterIntroVisuals,
|
||||
updatePlayerMoney,
|
||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#app/utils/common";
|
||||
import { isNullOrUndefined, NumberHolder, randSeedInt, randSeedItem } from "#app/utils/common";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
@ -30,6 +30,8 @@ import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { NON_LEGEND_PARADOX_POKEMON, NON_LEGEND_ULTRA_BEASTS } from "#app/data/balance/special-species-groups";
|
||||
import { timedEventManager } from "#app/global-event-manager";
|
||||
import { BASE_SHINY_CHANCE } from "#app/data/balance/rates";
|
||||
import { ShinyRateBoosterModifier } from "#app/modifier/modifier";
|
||||
|
||||
/** the i18n namespace for this encounter */
|
||||
const namespace = "mysteryEncounters/thePokemonSalesman";
|
||||
@ -122,11 +124,13 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
|
||||
) {
|
||||
// If you roll 20%, give event encounter with 2 extra shiny rolls and its HA, if it has one
|
||||
const enc = randSeedItem(validEventEncounters);
|
||||
const thresh = globalScene.getModifiedShinyThreshold();
|
||||
const threshold = new NumberHolder(BASE_SHINY_CHANCE);
|
||||
globalScene.applyModifiers(ShinyRateBoosterModifier, true, threshold);
|
||||
threshold.value *= timedEventManager.getShinyMultiplier();
|
||||
species = getPokemonSpecies(enc.species);
|
||||
pokemon = new PlayerPokemon(species, 5, species.abilityHidden === Abilities.NONE ? undefined : 2, enc.formIndex);
|
||||
pokemon.trySetShinySeed(thresh); // Apply event shiny boost even though it's a PlayerPokemon
|
||||
pokemon.trySetShinySeed(thresh);
|
||||
pokemon.trySetShinySeed(threshold.value); // Apply event shiny boost even though it's a PlayerPokemon
|
||||
pokemon.trySetShinySeed(threshold.value); // Try again
|
||||
} else {
|
||||
pokemon = new PlayerPokemon(species, 5, 2, species.formIndex);
|
||||
}
|
||||
|
@ -1075,8 +1075,8 @@ export function getRandomEncounterSpecies(level: number, isBoss = false, rerollH
|
||||
ret.formIndex = formIndex;
|
||||
}
|
||||
|
||||
//Reroll shiny for event encounters
|
||||
if (isEventEncounter && !ret.shiny) {
|
||||
//Reroll shiny or variant for event encounters
|
||||
if (isEventEncounter) {
|
||||
ret.trySetShinySeed();
|
||||
}
|
||||
//Reroll hidden ability
|
||||
|
@ -3181,6 +3181,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
thresholdOverride?: number,
|
||||
applyModifiersToOverride?: boolean,
|
||||
): boolean {
|
||||
if (!this.shiny) {
|
||||
const shinyThreshold = new NumberHolder(BASE_SHINY_CHANCE);
|
||||
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
||||
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
||||
@ -3196,14 +3197,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
shinyThreshold,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
shinyThreshold.value = thresholdOverride;
|
||||
}
|
||||
|
||||
this.shiny = this.shiny || randSeedInt(65536) < shinyThreshold.value; // If it's already shiny, don't un-shiny it
|
||||
this.shiny = randSeedInt(65536) < shinyThreshold.value;
|
||||
}
|
||||
|
||||
if (this.shiny) {
|
||||
this.variant = this.generateShinyVariant();
|
||||
this.variant = this.variant ?? 0;
|
||||
this.variant = Math.max(this.generateShinyVariant(), this.variant) as Variant; // Don't set a variant lower than the current one
|
||||
this.luck =
|
||||
this.variant + 1 + (this.fusionShiny ? this.fusionVariant + 1 : 0);
|
||||
this.initShinySparkle();
|
||||
|
Loading…
Reference in New Issue
Block a user