Code tidying with Rubocop

This commit is contained in:
Maruno17
2023-07-18 22:42:10 +01:00
parent 6053363715
commit a5734eaf46
68 changed files with 276 additions and 232 deletions

View File

@@ -430,8 +430,8 @@ class MapScreenScene
if @dragging
if @dragmapid >= 0
sprite = getMapSprite(@dragmapid)
x = x + @dragOffsetX
y = y + @dragOffsetY
x += @dragOffsetX
y += @dragOffsetY
sprite.x = x & ~3
sprite.y = y & ~3
@sprites["title"].text = _ISPRINTF("D: Help [{1:03d}: {2:s}]", mapid, @mapinfos[@dragmapid].name)

View File

@@ -73,23 +73,27 @@ module BattleAnimationEditor
return @invalid
end
def invalidate # Marks that the control must be redrawn to reflect current logic
# Marks that the control must be redrawn to reflect current logic.
def invalidate
@invalid = true
end
def update; end # Updates the logic on the control, invalidating it if necessary
# Updates the logic on the control, invalidating it if necessary.
def update; end
def refresh; end # Redraws the control
# Redraws the control.
def refresh; end
def validate # Makes the control no longer invalid
# Makes the control no longer invalid.
def validate
@invalid = false
end
def repaint # Redraws the control only if it is invalid
if self.invalid?
self.refresh
self.validate
end
# Redraws the control only if it is invalid.
def repaint
return if !self.invalid?
self.refresh
self.validate
end
end
@@ -275,7 +279,7 @@ module BattleAnimationEditor
end
def update
cursor_to_show = ((System.uptime - @cursor_timer_start) / 0.35).to_i % 2 == 0
cursor_to_show = ((System.uptime - @cursor_timer_start) / 0.35).to_i.even?
self.changed = false
if cursor_to_show != @cursor_shown
@cursor_shown = cursor_to_show

View File

@@ -154,7 +154,8 @@ module BooleanProperty2
end
def self.format(value)
return (value) ? _INTL("True") : (!value.nil?) ? _INTL("False") : "-"
return _INTL("True") if value
return (value.nil?) ? "-" : _INTL("False")
end
end
@@ -576,7 +577,9 @@ module GenderProperty
def self.format(value)
return "-" if !value
return (value == 0) ? _INTL("Male") : (value == 1) ? _INTL("Female") : "-"
return _INTL("Male") if value == 0
return _INTL("Female") if value == 1
return "-"
end
end

View File

@@ -875,7 +875,6 @@ MenuHandlers.add(:debug_menu, :set_money, {
params.setDefaultValue($player.battle_points)
$player.battle_points = pbMessageChooseNumber("\\ts[]" + _INTL("Set the player's BP amount."), params)
end
end
}
})

View File

@@ -361,7 +361,8 @@ class SpeciesLister
return @index
end
def commands # Sorted alphabetically
# Sorted alphabetically.
def commands
@commands.clear
@ids.clear
cmds = []
@@ -420,7 +421,8 @@ class ItemLister
return @index
end
def commands # Sorted alphabetically
# Sorted alphabetically.
def commands
@commands.clear
@ids.clear
cmds = []