More Rubocopping

This commit is contained in:
Maruno17
2021-12-20 17:18:21 +00:00
parent db4acd3369
commit 33fcbf623b
154 changed files with 1388 additions and 1420 deletions

View File

@@ -3,9 +3,9 @@
#===============================================================================
def _pbNextComb(comb, length)
i = comb.length - 1
begin
loop do
valid = true
for j in i...comb.length
(i...comb.length).each do |j|
if j == i
comb[j] += 1
else
@@ -18,7 +18,8 @@ def _pbNextComb(comb, length)
end
return true if valid
i -= 1
end while i >= 0
break unless i >= 0
end
return false
end
@@ -30,22 +31,19 @@ def pbEachCombination(array, num)
yield array
return
elsif num == 1
for x in array
array.each do |x|
yield [x]
end
return
end
currentComb = []
arr = []
for i in 0...num
currentComb[i] = i
end
begin
for i in 0...num
arr[i] = array[currentComb[i]]
end
num.times { |i| currentComb[i] = i }
loop do
num.times { |i| arr[i] = array[currentComb[i]] }
yield arr
end while _pbNextComb(currentComb, array.length)
break unless _pbNextComb(currentComb, array.length)
end
end
# Returns a language ID
@@ -113,7 +111,7 @@ end
def getConstantName(mod, value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
mod.constants.each do |c|
return c.to_s if mod.const_get(c.to_sym) == value
end
raise _INTL("Value {1} not defined by a constant in {2}", value, mod.name)
@@ -121,7 +119,7 @@ end
def getConstantNameOrValue(mod, value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
mod.constants.each do |c|
return c.to_s if mod.const_get(c.to_sym) == value
end
return value.inspect
@@ -177,7 +175,7 @@ def pbExclaim(event, id = Settings::EXCLAMATION_ANIMATION_ID, tinting = false)
if event.is_a?(Array)
sprite = nil
done = []
for i in event
event.each do |i|
if !done.include?(i.id)
sprite = $scene.spriteset.addUserAnimation(id, i.x, i.y, tinting, 2)
done.push(i.id)
@@ -428,7 +426,7 @@ def pbMoveTutorChoose(move, movelist = nil, bymachine = false, oneusemachine = f
ret = false
move = GameData::Move.get(move).id
if movelist != nil && movelist.is_a?(Array)
for i in 0...movelist.length
movelist.length.times do |i|
movelist[i] = GameData::Move.get(movelist[i]).id
end
end
@@ -466,7 +464,7 @@ end
def pbConvertItemToItem(variable, array)
item = GameData::Item.get(pbGet(variable))
pbSet(variable, nil)
for i in 0...(array.length / 2)
(array.length / 2).times do |i|
next if item != array[2 * i]
pbSet(variable, array[(2 * i) + 1])
return
@@ -476,7 +474,7 @@ end
def pbConvertItemToPokemon(variable, array)
item = GameData::Item.get(pbGet(variable))
pbSet(variable, nil)
for i in 0...(array.length / 2)
(array.length / 2).times do |i|
next if item != array[2 * i]
pbSet(variable, GameData::Species.get(array[(2 * i) + 1]).id)
return
@@ -505,12 +503,13 @@ def pbCommonEvent(id)
celist = ce.list
interp = Interpreter.new
interp.setup(celist, 0)
begin
loop do
Graphics.update
Input.update
interp.update
pbUpdateSceneMap
end while interp.running?
break unless interp.running?
end
return true
end
@@ -550,7 +549,7 @@ def pbHideVisibleObjects
end
def pbShowObjects(visibleObjects)
for o in visibleObjects
visibleObjects.each do |o|
next if pbDisposed?(o)
o.visible = true
end
@@ -578,7 +577,7 @@ end
def pbChooseLanguage
commands = []
for lang in Settings::LANGUAGES
Settings::LANGUAGES.each do |lang|
commands.push(lang[0])
end
return pbShowCommands(nil, commands)

View File

@@ -210,22 +210,22 @@ def pbSize(pkmn)
m = pkmn.personalID & 0xFF
n = (pkmn.personalID >> 8) & 0xFF
s = ((((ativ ^ dfiv) * hpiv) ^ m) * 256) + (((saiv ^ sdiv) * spiv) ^ n)
xyz = []
if s < 10 then xyz = [ 290, 1, 0]
elsif s < 110 then xyz = [ 300, 1, 10]
elsif s < 310 then xyz = [ 400, 2, 110]
elsif s < 710 then xyz = [ 500, 4, 310]
elsif s < 2710 then xyz = [ 600, 20, 710]
elsif s < 7710 then xyz = [ 700, 50, 2710]
elsif s < 17710 then xyz = [ 800, 100, 7710]
elsif s < 32710 then xyz = [ 900, 150, 17710]
elsif s < 47710 then xyz = [1000, 150, 32710]
elsif s < 57710 then xyz = [1100, 100, 47710]
elsif s < 62710 then xyz = [1200, 50, 57710]
elsif s < 64710 then xyz = [1300, 20, 62710]
elsif s < 65210 then xyz = [1400, 5, 64710]
elsif s < 65410 then xyz = [1500, 2, 65210]
else xyz = [1700, 1, 65510]
xyz = [1700, 1, 65510]
case s
when 0...10 then xyz = [ 290, 1, 0]
when 10...110 then xyz = [ 300, 1, 10]
when 110...310 then xyz = [ 400, 2, 110]
when 310...710 then xyz = [ 500, 4, 310]
when 710...2710 then xyz = [ 600, 20, 710]
when 2710...7710 then xyz = [ 700, 50, 2710]
when 7710...17710 then xyz = [ 800, 100, 7710]
when 17710...32710 then xyz = [ 900, 150, 17710]
when 32710...47710 then xyz = [1000, 150, 32710]
when 47710...57710 then xyz = [1100, 100, 47710]
when 57710...62710 then xyz = [1200, 50, 57710]
when 62710...64710 then xyz = [1300, 20, 62710]
when 64710...65210 then xyz = [1400, 5, 64710]
when 65210...65410 then xyz = [1500, 2, 65210]
end
return ((((s - xyz[2]) / xyz[1]) + xyz[0]).floor * baseheight / 10).floor
end