Yet more Rubocopping

This commit is contained in:
Maruno17
2021-12-23 00:27:17 +00:00
parent 514fe13ca2
commit 132a16950d
171 changed files with 1455 additions and 1647 deletions

View File

@@ -293,10 +293,7 @@ def pbWriteCup(id, rules)
end
end
cmd = 0
if trlists.length != 0
cmd = pbMessage(_INTL("Generate Pokémon teams for this challenge?"),
[_INTL("NO"), _INTL("YES, USE EXISTING"), _INTL("YES, USE NEW")], 1)
else
if trlists.length == 0
cmd = pbMessage(_INTL("Generate Pokémon teams for this challenge?"),
[_INTL("YES"), _INTL("NO")], 2)
case cmd
@@ -305,6 +302,9 @@ def pbWriteCup(id, rules)
when 1
cmd = 0
end
else
cmd = pbMessage(_INTL("Generate Pokémon teams for this challenge?"),
[_INTL("NO"), _INTL("YES, USE EXISTING"), _INTL("YES, USE NEW")], 1)
end
return if cmd == 0 # No
case cmd

View File

@@ -284,18 +284,20 @@ def pbRandomPokemonFromRule(rules, trainer)
newmoves.push(m) if m && !newmoves.include?(m)
end
if (newmoves.include?(spitup) || newmoves.include?(swallow)) &&
!newmoves.include?(stockpile)
next unless sketch
!newmoves.include?(stockpile) && !sketch
next
end
if (!newmoves.include?(spitup) && !newmoves.include?(swallow)) &&
newmoves.include?(stockpile)
next unless sketch
newmoves.include?(stockpile) && !sketch
next
end
if newmoves.include?(sleeptalk) && !newmoves.include?(rest)
next unless (sketch || !moves.include?(rest)) && rand(100) < 20
if newmoves.include?(sleeptalk) && !newmoves.include?(rest) &&
!((sketch || !moves.include?(rest)) && rand(100) < 20)
next
end
if newmoves.include?(snore) && !newmoves.include?(rest)
next unless (sketch || !moves.include?(rest)) && rand(100) < 20
if newmoves.include?(snore) && !newmoves.include?(rest) &&
!((sketch || !moves.include?(rest)) && rand(100) < 20)
next
end
totalbasedamage = 0
hasPhysical = false
@@ -310,13 +312,13 @@ def pbRandomPokemonFromRule(rules, trainer)
hasSpecial = true if d.category == 1
end
end
if !hasPhysical && ev.include?(:ATTACK)
if !hasPhysical && ev.include?(:ATTACK) && rand(100) < 80
# No physical attack, but emphasizes Attack
next if rand(100) < 80
next
end
if !hasSpecial && ev.include?(:SPECIAL_ATTACK)
if !hasSpecial && ev.include?(:SPECIAL_ATTACK) && rand(100) < 80
# No special attack, but emphasizes Special Attack
next if rand(100) < 80
next
end
r = rand(10)
next if r > 6 && totalbasedamage > 180

View File

@@ -184,15 +184,15 @@ class PlayerRating
# https://www.smogon.com/forums/threads/make-sense-of-your-shoddy-battle-rating.55764/
otherRating = 1500.0
otherDeviation = 350.0
s = Math.sqrt(100000.0 + (@deviation * @deviation) + (otherDeviation * otherDeviation))
s = Math.sqrt(100_000.0 + (@deviation * @deviation) + (otherDeviation * otherDeviation))
g = 10.0**((otherRating - @rating) * 0.79 / s)
@estimatedRating = (1.0 / (1.0 + g)) * 100.0 # Percent chance that I win against opponent
else
# GLIXARE method
rds = @deviation * @deviation
sqr = Math.sqrt(15.905694331435 * (rds + 221781.21786254))
sqr = Math.sqrt(15.905694331435 * (rds + 221_781.21786254))
inner = (1500.0 - @rating) * Math::PI / sqr
@estimatedRating = ((10000.0 / (1.0 + (10.0**inner))) + 0.5) / 100.0
@estimatedRating = ((10_000.0 / (1.0 + (10.0**inner))) + 0.5) / 100.0
end
return @estimatedRating
end
@@ -296,7 +296,7 @@ class PlayerRating
h2 += 0.5 * squVariance * e * (squDevplusVar - e) / (squD * d)
x1 = x0
x0 -= h1 / h2
break if ((x1 - x0).abs < 0.000001)
break if (x1 - x0).abs < 0.000001
}
return Math.exp(x0 / 2.0)
end
@@ -373,13 +373,7 @@ end
#===============================================================================
def pbRuledBattle(team1, team2, rule)
decision = 0
if rand(100) != 0
party1 = []
party2 = []
team1.length.times { |i| party1.push(team1[i]) }
team2.length.times { |i| party2.push(team2[i]) }
decision = pbDecideWinner(party1, party2, team1.rating, team2.rating)
else
if rand(100) == 0
level = rule.ruleset.suggestedLevel
t_type = GameData::TrainerType.keys.first
trainer1 = NPCTrainer.new("PLAYER1", t_type)
@@ -420,6 +414,12 @@ def pbRuledBattle(team1, team2, rule)
p.heal
p.item = items2[i]
end
else
party1 = []
party2 = []
team1.length.times { |i| party1.push(team1[i]) }
team2.length.times { |i| party2.push(team2[i]) }
decision = pbDecideWinner(party1, party2, team1.rating, team2.rating)
end
case decision
when 1 # Team 1 wins