Prevent shinies from altering runs

Places variant rolls inside of an ExecuteWithSeedOffset block, using the current floor's RNG seed as the seed and the Pokémon's ID as the offset.
This commit is contained in:
RedstonewolfX 2024-09-24 18:37:51 -04:00
parent 93ff4adc30
commit 5c30f5cfdd
2 changed files with 8 additions and 5 deletions

View File

@ -1913,10 +1913,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (!this.shiny || (!variantData.hasOwnProperty(variantDataIndex) && !variantData.hasOwnProperty(this.species.speciesId))) {
return 0;
}
const rand = Utils.randSeedInt(10);
if (rand >= 4) {
const rand = new Utils.IntegerHolder(0);
this.scene.executeWithSeedOffset(() => {
rand.value = Utils.randSeedInt(10);
}, this.id, this.scene.waveSeed);
if (rand.value >= 4) {
return 0; // 6/10
} else if (rand >= 1) {
} else if (rand.value >= 1) {
return 1; // 3/10
} else {
return 2; // 1/10

View File

@ -2448,9 +2448,9 @@ export class ModifierTypeOption {
*/
export function getPartyLuckValue(party: Pokemon[]): integer {
if (party[0].scene.gameMode.isDaily) {
let DailyLuck: integer = 0;
const DailyLuck = new Utils.IntegerHolder(0);
party[0].scene.executeWithSeedOffset(() => {
DailyLuck = Utils.randSeedInt(15); // Random number between 0 and 14
DailyLuck.value = Utils.randSeedInt(15); // Random number between 0 and 14
}, 0, party[0].scene.seed);
return DailyLuck;
}