From 5280840cac935bb05be74c9682f1c02c227af867 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 28 Feb 2024 14:57:11 -0500 Subject: [PATCH] Fix cases of items not using seeded random --- src/modifier/modifier-type.ts | 4 ++-- src/modifier/modifier.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 048cf6114..cc78aa253 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -993,8 +993,8 @@ const modifierPool = { new WeightedModifierType(modifierTypes.SHINY_CHARM, 18), new WeightedModifierType(modifierTypes.HEALING_CHARM, 18), new WeightedModifierType(modifierTypes.VOUCHER_PLUS, 6), - new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.ceil(party[0].scene.currentBattle.waveIndex / 50) * 8), - new WeightedModifierType(modifierTypes.DYNAMAX_BAND, (party: Pokemon[]) => Math.ceil(party[0].scene.currentBattle.waveIndex / 50) * 8), + new WeightedModifierType(modifierTypes.MEGA_BRACELET, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 8), + new WeightedModifierType(modifierTypes.DYNAMAX_BAND, (party: Pokemon[]) => Math.min(Math.ceil(party[0].scene.currentBattle.waveIndex / 50), 4) * 8), new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => party[0].scene.gameMode !== GameMode.SPLICED_ENDLESS && party.filter(p => !p.fusionSpecies).length > 1 ? 12 : 0), new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE] ? 2 : 0), ].map(m => { m.setTier(ModifierTier.MASTER); return m; }), diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 11cf0738b..e25826539 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -1736,7 +1736,7 @@ export class ContactHeldItemTransferChanceModifier extends HeldItemTransferModif } getTransferredItemCount(): integer { - return Math.random() < (this.chance * this.getStackCount()) ? 1 : 0; + return Phaser.Math.RND.realInRange(0, 1) < (this.chance * this.getStackCount()) ? 1 : 0; } getTransferMessage(pokemon: Pokemon, targetPokemon: Pokemon, item: ModifierTypes.ModifierType): string { @@ -1924,7 +1924,7 @@ export class EnemyAttackStatusEffectChanceModifier extends EnemyPersistentModifi apply(args: any[]): boolean { const target = (args[0] as Pokemon); - if (Math.random() < this.chance * this.getStackCount()) { + if (Phaser.Math.RND.realInRange(0, 1) < (this.chance * this.getStackCount())) { target.scene.unshiftPhase(new ObtainStatusEffectPhase(target.scene, target.getBattlerIndex(), this.effect)); return true; } @@ -1956,7 +1956,7 @@ export class EnemyStatusEffectHealChanceModifier extends EnemyPersistentModifier apply(args: any[]): boolean { const target = (args[0] as Pokemon); - if (target.status && Math.random() < this.chance * this.getStackCount()) { + if (target.status && Phaser.Math.RND.realInRange(0, 1) < (this.chance * this.getStackCount())) { target.scene.queueMessage(getPokemonMessage(target, ` was cured of its\n${getStatusEffectDescriptor(target.status.effect)}!`)); target.resetStatus(); target.updateInfo(); @@ -1991,7 +1991,7 @@ export class EnemyInstantReviveChanceModifier extends EnemyPersistentModifier { } apply(args: any[]): boolean { - if (Math.random() >= this.chance * this.getStackCount()) + if (Phaser.Math.RND.realInRange(0, 1) >= (this.chance * this.getStackCount())) return false; const pokemon = args[0] as Pokemon;