Resolved many Rubocop warnings

This commit is contained in:
Maruno17
2020-09-06 17:31:12 +01:00
parent 6c4670eaa3
commit 681a8331ab
137 changed files with 921 additions and 1200 deletions

View File

@@ -738,7 +738,6 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
pbFadeOutIn { pbTilesetScreen }
when "setencounters"
encdata = pbLoadEncountersData
oldencdata = Marshal.dump(encdata)
map = pbDefaultMap
loop do
map = pbListScreen(_INTL("SET ENCOUNTERS"),MapLister.new(map))

View File

@@ -75,7 +75,7 @@ class SpriteWindow_DebugVariables < Window_DrawableCommand
pbDrawShadowText(self.contents,x,y,[width,w].max,h,t,base,Color.new(26*8,26*8,25*8))
end
def drawItem(index,count,rect)
def drawItem(index,_count,rect)
pbSetNarrowFont(self.contents)
colors = 0; codeswitch = false
if @mode==0
@@ -83,8 +83,8 @@ class SpriteWindow_DebugVariables < Window_DrawableCommand
codeswitch = (name[/^s\:/])
val = (codeswitch) ? (eval($~.post_match) rescue nil) : $game_switches[index+1]
if val==nil; status = "[-]"; colors = 0; codeswitch = true
elsif val; status = "[ON]"; colors = 2
else; status = "[OFF]"; colors = 1
elsif val; status = "[ON]"; colors = 2
else; status = "[OFF]"; colors = 1
end
else
name = $data_system.variables[index+1]
@@ -93,7 +93,6 @@ class SpriteWindow_DebugVariables < Window_DrawableCommand
end
name = '' if name==nil
id_text = sprintf("%04d:",index+1)
width = self.contents.text_size(id_text).width
rect = drawCursor(index,rect)
totalWidth = rect.width
idWidth = totalWidth*15/100
@@ -275,7 +274,6 @@ def pbDebugDayCare
if Input.trigger?(Input::B)
break
elsif Input.trigger?(Input::C)
ret = cmdwindow.index
case cmdwindow.index
when 0 # Withdraw Pokémon 1
if !$PokemonGlobal.daycare[0][0]
@@ -382,7 +380,7 @@ class SpriteWindow_DebugRoamers < Window_DrawableCommand
pbDrawShadowText(self.contents,x,y,[width,w].max,h,t,base,Color.new(26*8,26*8,25*8))
end
def drawItem(index,count,rect)
def drawItem(index,_count,rect)
pbSetNarrowFont(self.contents)
rect = drawCursor(index,rect)
nameWidth = rect.width*50/100

View File

@@ -36,7 +36,6 @@ def pbEncounterEditorTypes(enc,enccmd)
enccmd.active = true
enccmd.index = 0
enccmd.visible = true
ret = 0
command = 0
loop do
Graphics.update
@@ -94,7 +93,7 @@ def pbNewEncounterType(enc)
if ret>=0
chances = EncounterTypes::EnctypeChances[ret]
enc[1][ret] = []
for i in 0...chances.length
chances.length.times do
enc[1][ret].push([1,5,5])
end
end
@@ -129,8 +128,6 @@ def pbEditEncounterType(enc,etype)
species = pbChooseSpeciesList(enctype[ret][0])
next if species<=0
enctype[ret][0] = species if species>0
minlevel = 0
maxlevel = 0
mLevel = PBExperience.maxLevel
params = ChooseNumberParams.new
params.setRange(1,mLevel)
@@ -185,7 +182,6 @@ def pbEncounterEditorMap(encdata,map)
enchelp.z = 99999
mapinfos = load_data("Data/MapInfos.rxdata")
mapname = mapinfos[map].name
lastchoice = 0
loop do
enc = encdata[map]
enchelp.text = mapname
@@ -421,7 +417,6 @@ def pbTrainerBattleEditor
if selection<0
# New trainer
trainertype = -1
trainername = ""
ret = pbMessage(_INTL("First, define the type of trainer."),[
_INTL("Use existing type"),
_INTL("Use new type"),

View File

@@ -2,7 +2,7 @@
# Data type properties
#===============================================================================
module UndefinedProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
pbMessage(_INTL("This property can't be edited here at this time."))
return oldsetting
end
@@ -15,7 +15,7 @@ end
module ReadOnlyProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
pbMessage(_INTL("This property cannot be edited."))
return oldsetting
end
@@ -125,7 +125,7 @@ end
module BooleanProperty
def self.set(settingname,oldsetting)
def self.set(settingname,_oldsetting)
return pbConfirmMessage(_INTL("Enable the setting {1}?",settingname)) ? true : false
end
@@ -137,7 +137,7 @@ end
module BooleanProperty2
def self.set(settingname,oldsetting)
def self.set(_settingname,_oldsetting)
ret = pbShowCommands(nil,[_INTL("True"),_INTL("False")],-1)
return (ret>=0) ? (ret==0) : nil
end
@@ -262,7 +262,7 @@ end
module SpeciesProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = pbChooseSpeciesList((oldsetting) ? oldsetting : 1)
return (ret<=0) ? (oldsetting) ? oldsetting : 0 : ret
end
@@ -279,7 +279,7 @@ end
module TypeProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = pbChooseTypeList((oldsetting) ? oldsetting : 0)
return (ret<0) ? (oldsetting) ? oldsetting : 0 : ret
end
@@ -296,7 +296,7 @@ end
module MoveProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = pbChooseMoveList((oldsetting) ? oldsetting : 1)
return (ret<=0) ? (oldsetting) ? oldsetting : 0 : ret
end
@@ -317,7 +317,7 @@ class MoveProperty2
@pokemondata = pokemondata
end
def set(settingname,oldsetting)
def set(_settingname,oldsetting)
ret = pbChooseMoveListForSpecies(@pokemondata[0],(oldsetting) ? oldsetting : 1)
return (ret>0) ? ret : (oldsetting) ? oldsetting : nil
end
@@ -334,7 +334,7 @@ end
class GenderProperty
def set(settingname,oldsetting)
def set(_settingname,_oldsetting)
ret = pbShowCommands(nil,[_INTL("Male"),_INTL("Female")],-1)
return (ret>=0) ? ret : nil
end
@@ -352,7 +352,7 @@ end
module ItemProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = pbChooseItemList((oldsetting) ? oldsetting : 1)
return (ret>0) ? ret : (oldsetting) ? oldsetting : nil
end
@@ -369,7 +369,7 @@ end
module NatureProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,_oldsetting)
commands = []
(PBNatures.getCount).times do |i|
commands.push(PBNatures.getName(i))
@@ -512,7 +512,7 @@ class BallProperty
@pokemondata = pokemondata
end
def set(settingname,oldsetting)
def set(_settingname,oldsetting)
ret = pbChooseBallList((oldsetting) ? oldsetting : -1)
return (ret>=0) ? ret : (oldsetting) ? oldsetting : nil
end
@@ -627,7 +627,7 @@ end
module RegionMapCoordsProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
regions = getMapNameList
selregion = -1
if regions.length==0
@@ -659,7 +659,7 @@ end
module WeatherEffectProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
options = []
for i in 0..PBFieldWeather.maxValue
options.push(getConstantName(PBFieldWeather,i) || "ERROR")
@@ -684,7 +684,7 @@ end
module EnvironmentProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,_oldsetting)
options = []
for i in 0..PBEnvironment.maxValue
options.push(getConstantName(PBEnvironment,i) || "ERROR")
@@ -741,7 +741,7 @@ module PocketProperty
_INTL("Battle Items"),_INTL("Key Items")]
end
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
cmd = pbMessage(_INTL("Choose a pocket for this item."),pocketnames(),-1)
return (cmd>=0) ? cmd+1 : oldsetting
end
@@ -817,7 +817,7 @@ end
module AbilityProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = pbChooseAbilityList((oldsetting) ? oldsetting : 1)
return (ret<=0) ? (oldsetting) ? oldsetting : 0 : ret
end
@@ -834,7 +834,7 @@ end
module MovePoolProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = oldsetting
cmdwin = pbListWindow([],200)
commands = []
@@ -981,7 +981,7 @@ end
module EggMovesProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = oldsetting
cmdwin = pbListWindow([],200)
commands = []
@@ -1083,7 +1083,7 @@ end
module FormNamesProperty
def self.set(settingname,oldsetting)
def self.set(_settingname,oldsetting)
ret = oldsetting
cmdwin = pbListWindow([],200)
commands = []
@@ -1099,7 +1099,7 @@ module FormNamesProperty
realcmds.sort! { |a,b| a[1]<=>b[1] }
commands = []
for i in 0...realcmds.length
text = (realcmds[i][1]>=0) ? sprintf("#{realcmds[i][1].to_s} - #{realcmds[i][0]}") : realcmds[i][0]
text = (realcmds[i][1]>=0) ? sprintf("#{realcmds[i][1]} - #{realcmds[i][0]}") : realcmds[i][0]
commands.push(text)
cmd[1] = i if oldsel>=0 && realcmds[i][1]==oldsel
end
@@ -1187,7 +1187,7 @@ class EvolutionsProperty
@evoparams = PBEvolution::EVOPARAM
end
def set(settingname,oldsetting)
def set(_settingname,oldsetting)
ret = oldsetting
cmdwin = pbListWindow([])
commands = []
@@ -1449,7 +1449,6 @@ def pbPropertyList(title,data,properties,saveprompt=false)
desc.viewport = viewport
desc.z = 2
selectedmap = -1
index = 0
retval = nil
commands = []
for i in 0...properties.length

View File

@@ -292,7 +292,7 @@ def pbChooseMoveListForSpecies(species,defaultMoveID=0)
end
commands.sort! { |a,b| a[1]<=>b[1] }
if defaultMoveID>0
commands.each_with_index do |item,i|
commands.each_with_index do |_item,i|
moveDefault = i if moveDefault==0 && i[0]==defaultMoveID
end
end
@@ -304,7 +304,7 @@ def pbChooseMoveListForSpecies(species,defaultMoveID=0)
end
commands2.sort! { |a,b| a[1]<=>b[1] }
if defaultMoveID>0
commands2.each_with_index do |item,i|
commands2.each_with_index do |_item,i|
moveDefault = i if moveDefault==0 && i[0]==defaultMoveID
end
end
@@ -398,7 +398,6 @@ def pbCommands2(cmdwindow,commands,cmdIfCancel,defaultindex=-1,noresize=false)
cmdwindow.z = 99999
cmdwindow.visible = true
cmdwindow.active = true
ret = 0
command = 0
loop do
Graphics.update
@@ -436,7 +435,6 @@ def pbCommands3(cmdwindow,commands,cmdIfCancel,defaultindex=-1,noresize=false)
cmdwindow.z = 99999
cmdwindow.visible = true
cmdwindow.active = true
ret = []
command = 0
loop do
Graphics.update
@@ -526,7 +524,6 @@ def pbCommandsSortable(cmdwindow,commands,cmdIfCancel,defaultindex=-1,sortable=f
cmdwindow.height = Graphics.height
cmdwindow.z = 99999
cmdwindow.active = true
ret = nil
command = 0
loop do
Graphics.update

View File

@@ -112,7 +112,7 @@ class PokemonTilesetScene
pbUpdateTileset
elsif Input.repeat?(Input::DOWN)
@y += 32
@y = @sprites["tileset"].bitmap.height-32 if @y>=@sprites["tileset"].bitmap.height-32
@y = height-32 if @y>=height-32
@topy = @y-(Graphics.height-64)+32 if @y-@topy>=Graphics.height-64
pbUpdateTileset
elsif Input.repeat?(Input::LEFT)
@@ -133,10 +133,10 @@ class PokemonTilesetScene
elsif Input.repeat?(Input::R)
@y += ((Graphics.height-64)/32)*32
@topy += ((Graphics.height-64)/32)*32
@y = @sprites["tileset"].bitmap.height-32 if @y>=@sprites["tileset"].bitmap.height-32
@y = height-32 if @y>=height-32
@topy = @y-(Graphics.height-64)+32 if @y-@topy>=Graphics.height-64
if @topy>=@sprites["tileset"].bitmap.height-(Graphics.height-64)
@topy = @sprites["tileset"].bitmap.height-(Graphics.height-64)
if @topy>=height-(Graphics.height-64)
@topy = height-(Graphics.height-64)
end
pbUpdateTileset
elsif Input.trigger?(Input::A)
@@ -149,7 +149,7 @@ class PokemonTilesetScene
ret = pbShowCommands(nil,commands,-1)
case ret
when 0
@y = @sprites["tileset"].bitmap.height-32
@y = height-32
@topy = @y-(Graphics.height-64)+32 if @y-@topy>=Graphics.height-64
pbUpdateTileset
when 1

View File

@@ -450,7 +450,8 @@ class MapScreenScene
c1=(refsprite.x-othersprite.x)/4
c2=(refsprite.y-othersprite.y)/4
conn=[refmap,0,0,i,c1,c2]
j=0;while j<ret.length && !connectionsSymmetric?(ret[j],conn)
j=0
while j<ret.length && !connectionsSymmetric?(ret[j],conn)
j+=1
end
if j==ret.length

View File

@@ -220,7 +220,6 @@ class SpritePositioner
pbAutoPosition
return false
end
oldvalues = []
case param
when 0
sprite = @sprites["pokemon_0"]

View File

@@ -516,7 +516,6 @@ class Slider < UIControl
width=self.width
height=self.height
color=Color.new(120,120,120)
colordisabled=Color.new(120,120,120,80)
bitmap.fill_rect(x,y,width,height,Color.new(0,0,0,0))
size=bitmap.text_size(self.label).width
leftarrows=bitmap.text_size(_INTL(" << "))
@@ -537,7 +536,6 @@ class Slider < UIControl
shadowtext(bitmap,x,y,rightarrows.width,height,_INTL(" >> "),
self.disabled || self.curvalue==self.maxvalue)
@rightarrow=Rect.new(x,y,rightarrows.width,height)
x+=rightarrows.width
end
end
@@ -614,10 +612,6 @@ class OptionalSlider < Slider
private
def updatedefs
x=self.x
y=self.y
width=self.width
height=self.height
checkboxwidth=32
@slider.bitmap=self.bitmap
@slider.parent=self.parent
@@ -770,7 +764,6 @@ class TextSlider < UIControl
width=self.width
height=self.height
color=Color.new(120,120,120)
colordisabled=Color.new(120,120,120,80)
bitmap.fill_rect(x,y,width,height,Color.new(0,0,0,0))
size=bitmap.text_size(self.label).width
leftarrows=bitmap.text_size(_INTL(" << "))
@@ -790,7 +783,6 @@ class TextSlider < UIControl
shadowtext(bitmap,x,y,rightarrows.width,height,_INTL(" >> "),
self.disabled || self.curvalue==self.maxvalue)
@rightarrow=Rect.new(x,y,rightarrows.width,height)
x+=rightarrows.width
end
end
@@ -867,10 +859,6 @@ class OptionalTextSlider < TextSlider
private
def updatedefs
x=self.x
y=self.y
width=self.width
height=self.height
checkboxwidth=32
@slider.bitmap=self.bitmap
@slider.parent=self.parent
@@ -1529,10 +1517,6 @@ class AnimationCanvas < Sprite
oldtargety=targetsprite ? targetsprite.y : 0
@player=PBAnimationPlayerX.new(@animation,
@battle.battlers[oppmove ? 1 : 0],@battle.battlers[oppmove ? 0 : 1],self,oppmove,true)
userwidth=(!usersprite || !usersprite.bitmap || usersprite.bitmap.disposed?) ? 128 : usersprite.bitmap.width
userheight=(!usersprite || !usersprite.bitmap || usersprite.bitmap.disposed?) ? 128 : usersprite.bitmap.height
targetwidth=(!targetsprite.bitmap || targetsprite.bitmap.disposed?) ? 128 : targetsprite.bitmap.width
targetheight=(!targetsprite.bitmap || targetsprite.bitmap.disposed?) ? 128 : targetsprite.bitmap.height
@player.setLineTransform(
PokeBattle_SceneConstants::FOCUSUSER_X,PokeBattle_SceneConstants::FOCUSUSER_Y,
PokeBattle_SceneConstants::FOCUSTARGET_X,PokeBattle_SceneConstants::FOCUSTARGET_Y,
@@ -1544,7 +1528,6 @@ class AnimationCanvas < Sprite
@sprites["pokemon_0"].y+=BORDERSIZE
@sprites["pokemon_1"].x+=BORDERSIZE
@sprites["pokemon_1"].y+=BORDERSIZE
prevoldstate=[]
oldstate=[]
for i in 0...PBAnimation::MAX_SPRITES
oldstate.push([@celsprites[i].visible,@framesprites[i].visible,@lastframesprites[i].visible])
@@ -1552,10 +1535,11 @@ class AnimationCanvas < Sprite
@framesprites[i].visible=false
@lastframesprites[i].visible=false
end
begin
loop do
Graphics.update
self.update
end while @playing
break if !@playing
end
for i in 0...PBAnimation::MAX_SPRITES
@celsprites[i].visible=oldstate[i][0]
@framesprites[i].visible=oldstate[i][1]
@@ -2447,7 +2431,7 @@ def pbEditBG(canvas,timing)
if maxsizewindow.changed?(9) # Cancel
break
end
if Input.trigger?(Input::B)
if Input.trigger?(Input::B)
break
end
end
@@ -3193,7 +3177,7 @@ def curveToPointPath(curve,numpoints)
path=PointPath.new
step=1.0/(numpoints-1)
t=0.0
for i in 0...numpoints
numpoints.times do
point=getCurvePoint(curve,t)
path.addPoint(point[0],point[1])
t+=step
@@ -3264,7 +3248,6 @@ def pbDefinePath(canvas)
loop do
Graphics.update
Input.update
redrawline=false
if Input.trigger?(Input::B)
break
end
@@ -3401,7 +3384,6 @@ def pbDefinePath(canvas)
cel[AnimFrame::X]=path[i-canvas.currentframe][0]
cel[AnimFrame::Y]=path[i-canvas.currentframe][1]
end
startframe=sliderwin2.value(0)
break
elsif sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break