Fixed Poké Radar rustling grass not always causing a wild encounter when stepping in it, other tweaks to Poké Radar

This commit is contained in:
Maruno17
2021-07-18 23:13:37 +01:00
parent 66ed71dcad
commit 4d9c8feb81
2 changed files with 21 additions and 10 deletions

View File

@@ -109,6 +109,9 @@ class PokemonEncounters
# Check if enc_type has a defined step chance/encounter table
return false if !@step_chances[enc_type] || @step_chances[enc_type] == 0
return false if !has_encounter_type?(enc_type)
# Poké Radar encounters always happen, ignoring the minimum step period and
# trigger probabilities
return true if pbPokeRadarOnShakingGrass
# Get base encounter chance and minimum steps grace period
encounter_chance = @step_chances[enc_type].to_f
min_steps_needed = (8 - encounter_chance / 10).clamp(0, 8).to_f
@@ -176,8 +179,9 @@ class PokemonEncounters
# taking into account Repels and ability effects.
def allow_encounter?(enc_data, repel_active = false)
return false if !enc_data
return true if pbPokeRadarOnShakingGrass
# Repel
if repel_active && !pbPokeRadarOnShakingGrass
if repel_active
first_pkmn = (Settings::REPEL_COUNTS_FAINTED_POKEMON) ? $Trainer.first_pokemon : $Trainer.first_able_pokemon
if first_pkmn && enc_data[1] < first_pkmn.level
@chance_accumulator = 0