diff --git a/src/battle-scene.ts b/src/battle-scene.ts index f1ccbbc17ec..4a21d8bd551 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1426,7 +1426,7 @@ export default class BattleScene extends SceneBase { randomSpecies(waveIndex: integer, level: integer, fromArenaPool?: boolean, speciesFilter?: PokemonSpeciesFilter, filterAllEvolutions?: boolean): PokemonSpecies { if (fromArenaPool) { - return this.arena.randomSpecies(waveIndex, level); + return this.arena.randomSpecies(waveIndex, level,null , getPartyLuckValue(this.party)); } const filteredSpecies = speciesFilter ? [...new Set(allSpecies.filter(s => s.isCatchable()).filter(speciesFilter).map(s => { if (!filterAllEvolutions) { diff --git a/src/field/arena.ts b/src/field/arena.ts index f6390e40db5..9bf8a3eac0a 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -68,14 +68,20 @@ export class Arena { } } - randomSpecies(waveIndex: integer, level: integer, attempt?: integer): PokemonSpecies { + randomSpecies(waveIndex: integer, level: integer, attempt?: integer, luckValue?: integer): PokemonSpecies { const overrideSpecies = this.scene.gameMode.getOverrideSpecies(waveIndex); if (overrideSpecies) { return overrideSpecies; } const isBoss = !!this.scene.getEncounterBossSegments(waveIndex, level) && !!this.pokemonPool[BiomePoolTier.BOSS].length && (this.biomeType !== Biome.END || this.scene.gameMode.isClassic || this.scene.gameMode.isWaveFinal(waveIndex)); - const tierValue = Utils.randSeedInt(!isBoss ? 512 : 64); + const randVal = isBoss ? 64 : 512; + // luck influences encounter rarity + let luckModifier = 0; + if (typeof luckValue !== "undefined") { + luckModifier = luckValue * (isBoss ? 2 : 0.5); + } + const tierValue = Utils.randSeedInt(randVal - luckModifier); let tier = !isBoss ? tierValue >= 156 ? BiomePoolTier.COMMON : tierValue >= 32 ? BiomePoolTier.UNCOMMON : tierValue >= 6 ? BiomePoolTier.RARE : tierValue >= 1 ? BiomePoolTier.SUPER_RARE : BiomePoolTier.ULTRA_RARE : tierValue >= 20 ? BiomePoolTier.BOSS : tierValue >= 6 ? BiomePoolTier.BOSS_RARE : tierValue >= 1 ? BiomePoolTier.BOSS_SUPER_RARE : BiomePoolTier.BOSS_ULTRA_RARE;