mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-18 06:51:08 +00:00
luck based encounter
This commit is contained in:
parent
395fa6e33d
commit
6d71db0f13
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user