mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-28 12:32:44 +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 {
|
public trySetShinySeed(thresholdOverride?: number, applyModifiersToOverride?: boolean): boolean {
|
||||||
if (!this.shiny) {
|
if (!this.shiny) {
|
||||||
const shinyThreshold = new NumberHolder(BASE_SHINY_CHANCE);
|
const shinyThreshold = new NumberHolder(thresholdOverride ?? BASE_SHINY_CHANCE);
|
||||||
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
if (applyModifiersToOverride) {
|
||||||
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
|
||||||
shinyThreshold.value = thresholdOverride;
|
|
||||||
}
|
|
||||||
if (timedEventManager.isEventActive()) {
|
if (timedEventManager.isEventActive()) {
|
||||||
shinyThreshold.value *= timedEventManager.getShinyMultiplier();
|
shinyThreshold.value *= timedEventManager.getShinyMultiplier();
|
||||||
}
|
}
|
||||||
globalScene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
globalScene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
||||||
} else {
|
|
||||||
shinyThreshold.value = thresholdOverride;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.shiny = randSeedInt(65536) < shinyThreshold.value;
|
this.shiny = randSeedInt(65536) < shinyThreshold.value;
|
||||||
@ -2864,16 +2859,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (!this.species.abilityHidden) {
|
if (!this.species.abilityHidden) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const haThreshold = new NumberHolder(BASE_HIDDEN_ABILITY_CHANCE);
|
const haThreshold = new NumberHolder(thresholdOverride ?? BASE_HIDDEN_ABILITY_CHANCE);
|
||||||
if (thresholdOverride === undefined || applyModifiersToOverride) {
|
if (applyModifiersToOverride) {
|
||||||
if (thresholdOverride !== undefined && applyModifiersToOverride) {
|
|
||||||
haThreshold.value = thresholdOverride;
|
|
||||||
}
|
|
||||||
if (!this.hasTrainer()) {
|
if (!this.hasTrainer()) {
|
||||||
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, haThreshold);
|
globalScene.applyModifiers(HiddenAbilityRateBoosterModifier, true, haThreshold);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
haThreshold.value = thresholdOverride;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (randSeedInt(65536) < haThreshold.value) {
|
if (randSeedInt(65536) < haThreshold.value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user