mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
More Rubocop changes
This commit is contained in:
@@ -44,7 +44,7 @@ def pbEntryScreen(*arg)
|
||||
# Set party
|
||||
pbBattleChallenge.setParty(ret) if ret
|
||||
# Continue (return true) if Pokémon were chosen
|
||||
retval = (ret != nil && ret.length > 0)
|
||||
retval = (ret && ret.length > 0)
|
||||
}
|
||||
return retval
|
||||
end
|
||||
|
||||
@@ -231,7 +231,7 @@ def pbGenerateChallenge(rule, tag)
|
||||
i = 0
|
||||
loop do
|
||||
changed = false
|
||||
teams.length.times { |j|
|
||||
teams.length.times do |j|
|
||||
yield(nil)
|
||||
other = j
|
||||
5.times do
|
||||
@@ -241,19 +241,14 @@ def pbGenerateChallenge(rule, tag)
|
||||
next if other == j
|
||||
changed = true
|
||||
pbRuledBattle(teams[j], teams[other], rule)
|
||||
}
|
||||
end
|
||||
i += 1
|
||||
gameCount = 0
|
||||
teams.each do |team|
|
||||
gameCount += team.games
|
||||
end
|
||||
teams.each { |team| gameCount += team.games }
|
||||
yield(nil)
|
||||
if gameCount / teams.length >= 12
|
||||
teams.each do |team|
|
||||
team.updateRating
|
||||
end
|
||||
break
|
||||
end
|
||||
next if gameCount / teams.length < 12
|
||||
teams.each { |team| team.updateRating }
|
||||
break
|
||||
end
|
||||
teams.sort! { |a, b| b.rating <=> a.rating }
|
||||
save_data(teams, tag + "_teams.rxdata")
|
||||
|
||||
@@ -305,12 +305,11 @@ def pbRandomPokemonFromRule(rules, trainer)
|
||||
hasNormal = false
|
||||
newmoves.each do |move|
|
||||
d = GameData::Move.get(move)
|
||||
if d.base_damage >= 1
|
||||
totalbasedamage += d.base_damage
|
||||
hasNormal = true if d.type == :NORMAL
|
||||
hasPhysical = true if d.category == 0
|
||||
hasSpecial = true if d.category == 1
|
||||
end
|
||||
next if d.base_damage == 0
|
||||
totalbasedamage += d.base_damage
|
||||
hasNormal = true if d.type == :NORMAL
|
||||
hasPhysical = true if d.category == 0
|
||||
hasSpecial = true if d.category == 1
|
||||
end
|
||||
if !hasPhysical && ev.include?(:ATTACK) && rand(100) < 80
|
||||
# No physical attack, but emphasizes Attack
|
||||
@@ -339,17 +338,17 @@ def pbRandomPokemonFromRule(rules, trainer)
|
||||
break
|
||||
end
|
||||
end
|
||||
if item == :LIGHTCLAY && !moves.any? { |m| [:LIGHTSCREEN, :REFLECT].include?(m) }
|
||||
if item == :LIGHTCLAY && moves.none? { |m| [:LIGHTSCREEN, :REFLECT].include?(m) }
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
if item == :BLACKSLUDGE
|
||||
types = GameData::Species.get(species).types
|
||||
item = :LEFTOVERS if !types.include?(:POISON)
|
||||
end
|
||||
if item == :HEATROCK && !moves.any? { |m| m == :SUNNYDAY }
|
||||
if item == :HEATROCK && moves.none? { |m| m == :SUNNYDAY }
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
if item == :DAMPROCK && !moves.any? { |m| m == :RAINDANCE }
|
||||
if item == :DAMPROCK && moves.none? { |m| m == :RAINDANCE }
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
if moves.any? { |m| m == :REST }
|
||||
|
||||
@@ -145,13 +145,12 @@ def pbTrainerInfo(pokemonlist, trfile, rules)
|
||||
numbersPokemon.push(pokemonlist[index])
|
||||
else
|
||||
t = pkmntypes[index]
|
||||
t.each { |typ|
|
||||
if types[typ] > 0 && !numbers.include?(index)
|
||||
numbers.push(index)
|
||||
numbersPokemon.push(pokemonlist[index])
|
||||
break
|
||||
end
|
||||
}
|
||||
t.each do |typ|
|
||||
next if types[typ] <= 0 || numbers.include?(index)
|
||||
numbers.push(index)
|
||||
numbersPokemon.push(pokemonlist[index])
|
||||
break
|
||||
end
|
||||
end
|
||||
break if numbers.length >= Settings::MAX_PARTY_SIZE && rules.ruleset.hasValidTeam?(numbersPokemon)
|
||||
end
|
||||
@@ -192,12 +191,11 @@ def pbTrainerInfo(pokemonlist, trfile, rules)
|
||||
break
|
||||
end
|
||||
trlists.length.times do |i|
|
||||
if trlists[i][2].include?(trfile)
|
||||
trIndex = i
|
||||
trlists[i][0] = newbttrainers
|
||||
trlists[i][1] = pbpokemonlist
|
||||
trlists[i][5] = !hasDefault
|
||||
end
|
||||
next if !trlists[i][2].include?(trfile)
|
||||
trIndex = i
|
||||
trlists[i][0] = newbttrainers
|
||||
trlists[i][1] = pbpokemonlist
|
||||
trlists[i][5] = !hasDefault
|
||||
end
|
||||
yield(nil) if block_given?
|
||||
if trIndex < 0
|
||||
|
||||
Reference in New Issue
Block a user