mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-31 05:07:11 +00:00
Shinylock uncatchable Pokemon in endless mode (#1252)
* Shinylock uncatchable Pokemon * Fix typos * Pass the linter vibe check * Remove 2 shinylock cases * refactor
This commit is contained in:
parent
329c9619f6
commit
3e932ce2d0
@ -1222,7 +1222,22 @@ 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
|
||||||
|
* 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
|
||||||
|
* @returns true if the Pokemon has been set as a shiny, false otherwise
|
||||||
|
*/
|
||||||
trySetShiny(thresholdOverride?: integer): boolean {
|
trySetShiny(thresholdOverride?: integer): boolean {
|
||||||
|
// Shiny Pokemon should not spawn in the end biome in endless
|
||||||
|
if (this.scene.gameMode.isEndless && this.scene.arena.biomeType === Biome.END) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const rand1 = Utils.binToDec(Utils.decToBin(this.id).substring(0, 16));
|
const rand1 = Utils.binToDec(Utils.decToBin(this.id).substring(0, 16));
|
||||||
const rand2 = Utils.binToDec(Utils.decToBin(this.id).substring(16, 32));
|
const rand2 = Utils.binToDec(Utils.decToBin(this.id).substring(16, 32));
|
||||||
|
|
||||||
@ -1250,18 +1265,25 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return this.shiny;
|
return this.shiny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a variant
|
||||||
|
* Has a 10% of returning 2 (epic variant)
|
||||||
|
* And a 20% of returning 1 (rare variant)
|
||||||
|
* Returns 0 (basic shiny) if there is no variant or 70% of the time otherwise
|
||||||
|
* @returns the shiny variant
|
||||||
|
*/
|
||||||
generateVariant(): Variant {
|
generateVariant(): Variant {
|
||||||
if (!this.shiny || !variantData.hasOwnProperty(this.species.speciesId)) {
|
if (!this.shiny || !variantData.hasOwnProperty(this.species.speciesId)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const rand = Utils.randSeedInt(10);
|
const rand = Utils.randSeedInt(10);
|
||||||
if (rand > 3) {
|
if (rand >= 3) {
|
||||||
return 0;
|
return 0; // 7/10
|
||||||
|
} else if (rand >= 1) {
|
||||||
|
return 1; // 2/10
|
||||||
|
} else {
|
||||||
|
return 2; // 1/10
|
||||||
}
|
}
|
||||||
if (rand) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generateFusionSpecies(forStarter?: boolean): void {
|
generateFusionSpecies(forStarter?: boolean): void {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user