mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 00:06:18 +00:00
[Balance] Double base shiny odds, adjusted Shiny Charm to match (#3964)
* Double shiny odds "anyone wanna double the base shiny odds for me" - damo, 2024 * Adjust Shiny Charm to compensate for increased base odds * Remove magic number * Update tsdoc and remove unneeded `console.log()` * Clarify tsdoc
This commit is contained in:
parent
1e432fc74b
commit
84ef7f0683
@ -1527,13 +1527,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that tries to set a Pokemon shiny based on the trainer's trainer ID and secret ID
|
||||
* Function that tries to set a Pokemon shiny based on the trainer's trainer ID and secret ID.
|
||||
* Endless Pokemon in the end biome are unable to be set to shiny
|
||||
*
|
||||
* The exact mechanic is that it calculates E as the XOR of the player's trainer ID and secret ID
|
||||
* F is calculated as the XOR of the first 16 bits of the Pokemon's ID with the last 16 bits
|
||||
* The XOR of E and F are then compared to the thresholdOverride (default case 32) to see whether or not to generate a shiny
|
||||
* @param thresholdOverride number that is divided by 2^16 (65536) to get the shiny chance
|
||||
* The exact mechanic is that it calculates E as the XOR of the player's trainer ID and secret ID.
|
||||
* F is calculated as the XOR of the first 16 bits of the Pokemon's ID with the last 16 bits.
|
||||
* The XOR of E and F are then compared to the {@linkcode shinyThreshold} (or {@linkcode thresholdOverride} if set) to see whether or not to generate a shiny.
|
||||
* The base shiny odds are {@linkcode baseShinyChance} / 65536
|
||||
* @param thresholdOverride number that is divided by 2^16 (65536) to get the shiny chance, overrides {@linkcode shinyThreshold} if set (bypassing shiny rate modifiers such as Shiny Charm)
|
||||
* @returns true if the Pokemon has been set as a shiny, false otherwise
|
||||
*/
|
||||
trySetShiny(thresholdOverride?: integer): boolean {
|
||||
@ -1548,7 +1549,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const E = this.scene.gameData.trainerId ^ this.scene.gameData.secretId;
|
||||
const F = rand1 ^ rand2;
|
||||
|
||||
const shinyThreshold = new Utils.IntegerHolder(32);
|
||||
/** `64/65536 -> 1/1024` */
|
||||
const baseShinyChance = 64;
|
||||
const shinyThreshold = new Utils.IntegerHolder(baseShinyChance);
|
||||
if (thresholdOverride === undefined) {
|
||||
if (this.scene.eventManager.isEventActive()) {
|
||||
shinyThreshold.value *= this.scene.eventManager.getShinyMultiplier();
|
||||
@ -1561,9 +1564,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
this.shiny = (E ^ F) < shinyThreshold.value;
|
||||
if ((E ^ F) < 32) {
|
||||
console.log("REAL SHINY!!");
|
||||
}
|
||||
|
||||
if (this.shiny) {
|
||||
this.initShinySparkle();
|
||||
|
@ -2193,7 +2193,7 @@ export class ShinyRateBoosterModifier extends PersistentModifier {
|
||||
}
|
||||
|
||||
apply(args: any[]): boolean {
|
||||
(args[0] as Utils.IntegerHolder).value *= Math.pow(2, 2 + this.getStackCount());
|
||||
(args[0] as Utils.IntegerHolder).value *= Math.pow(2, 1 + this.getStackCount());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user