mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
[Refactor] Clean up shiny/HA reroll methods (#5803)
This commit is contained in:
parent
5efdb0dc0b
commit
ebc6ff2ed3
@ -2785,17 +2785,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
*/
|
||||
public trySetShinySeed(thresholdOverride?: number, applyModifiersToOverride?: boolean): boolean {
|
||||
if (!this.shiny) {
|
||||
const shinyThreshold = new NumberHolder(BASE_SHINY_CHANCE);
|
||||
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
||||
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
||||
shinyThreshold.value = thresholdOverride;
|
||||
}
|
||||
const shinyThreshold = new NumberHolder(thresholdOverride ?? BASE_SHINY_CHANCE);
|
||||
if (applyModifiersToOverride) {
|
||||
if (timedEventManager.isEventActive()) {
|
||||
shinyThreshold.value *= timedEventManager.getShinyMultiplier();
|
||||
}
|
||||
globalScene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
||||
} else {
|
||||
shinyThreshold.value = thresholdOverride;
|
||||
}
|
||||
|
||||
this.shiny = randSeedInt(65536) < shinyThreshold.value;
|
||||
@ -2864,16 +2859,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
if (!this.species.abilityHidden) {
|
||||
return false;
|
||||
}
|
||||
const haThreshold = new NumberHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
||||
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
||||
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
||||
haThreshold.value = thresholdOverride;
|
||||
}
|
||||
const haThreshold = new NumberHolder(thresholdOverride ?? BASE_HIDDEN_ABILITY_CHANCE);
|
||||
if (applyModifiersToOverride) {
|
||||
if (!this.hasTrainer()) {
|
||||
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, haThreshold);
|
||||
}
|
||||
} else {
|
||||
haThreshold.value = thresholdOverride;
|
||||
}
|
||||
|
||||
if (randSeedInt(65536) < haThreshold.value) {
|
||||
|
Loading…
Reference in New Issue
Block a user