Fixed bad uses of .sample

This commit is contained in:
Maruno17
2021-12-29 12:21:19 +00:00
parent 6339f5a577
commit 3d37733d1a
2 changed files with 4 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ end
def pbRandomMove def pbRandomMove
keys = GameData::Move.keys keys = GameData::Move.keys
loop do loop do
move_id = keys[keys.sample] move_id = keys.sample
move = GameData::Move.get(move_id) move = GameData::Move.get(move_id)
next if move.id == :SKETCH || move.id == :STRUGGLE next if move.id == :SKETCH || move.id == :STRUGGLE
return move.id return move.id
@@ -153,7 +153,7 @@ def pbRandomPokemonFromRule(rules, trainer)
keys = GameData::Species.keys keys = GameData::Species.keys
loop do loop do
loop do loop do
species = keys[keys.sample] species = keys.sample
break if GameData::Species.get(species).form == 0 break if GameData::Species.get(species).form == 0
end end
r = rand(20) r = rand(20)
@@ -175,7 +175,7 @@ def pbRandomPokemonFromRule(rules, trainer)
nature = nil nature = nil
keys = GameData::Nature.keys keys = GameData::Nature.keys
loop do loop do
nature = keys[keys.sample] nature = keys.sample
nature_data = GameData::Nature.get(nature) nature_data = GameData::Nature.get(nature)
if [:LAX, :GENTLE].include?(nature_data.id) || nature_data.stat_changes.length == 0 if [:LAX, :GENTLE].include?(nature_data.id) || nature_data.stat_changes.length == 0
next if rand(20) < 19 next if rand(20) < 19

View File

@@ -25,7 +25,7 @@ def pbTrainerInfo(pokemonlist, trfile, rules)
else else
tr_typekeys = GameData::TrainerType.keys tr_typekeys = GameData::TrainerType.keys
loop do loop do
tr_type = tr_typekeys[tr_typekeys.sample] tr_type = tr_typekeys.sample
tr_type_data = GameData::TrainerType.get(tr_type) tr_type_data = GameData::TrainerType.get(tr_type)
next if tr_type_data.base_money >= 100 next if tr_type_data.base_money >= 100
trainerid = tr_type_data.id trainerid = tr_type_data.id