mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 22:24:58 +00:00
More tweaks from the Rubocop overlord
This commit is contained in:
@@ -17,9 +17,10 @@ def pbGetExceptionMessage(e, _script = "")
|
||||
return e.event_message.dup if e.is_a?(EventScriptError) # Message with map/event ID generated elsewhere
|
||||
emessage = e.message.dup
|
||||
emessage.force_encoding(Encoding::UTF_8)
|
||||
if e.is_a?(Hangup)
|
||||
case e
|
||||
when Hangup
|
||||
emessage = "The script is taking too long. The game will restart."
|
||||
elsif e.is_a?(Errno::ENOENT)
|
||||
when Errno::ENOENT
|
||||
filename = emessage.sub("No such file or directory - ", "")
|
||||
emessage = "File #{filename} not found."
|
||||
end
|
||||
|
||||
@@ -67,7 +67,7 @@ module FileInputMixin
|
||||
self.pos = 0
|
||||
offset = fgetdw >> 3
|
||||
return 0 if index >= offset
|
||||
self.pos = index * 8 + 4
|
||||
self.pos = (index * 8) + 4
|
||||
return fgetdw
|
||||
end
|
||||
|
||||
|
||||
@@ -412,7 +412,8 @@ class Messages
|
||||
|
||||
def self.writeObject(f, msgs, secname, origMessages = nil)
|
||||
return if !msgs
|
||||
if msgs.is_a?(Array)
|
||||
case msgs
|
||||
when Array
|
||||
f.write("[#{secname}]\r\n")
|
||||
for j in 0...msgs.length
|
||||
next if nil_or_empty?(msgs[j])
|
||||
@@ -427,7 +428,7 @@ class Messages
|
||||
f.write(origValue + "\r\n")
|
||||
f.write(value + "\r\n")
|
||||
end
|
||||
elsif msgs.is_a?(OrderedHash)
|
||||
when OrderedHash
|
||||
f.write("[#{secname}]\r\n")
|
||||
keys = msgs.keys
|
||||
for key in keys
|
||||
|
||||
@@ -212,11 +212,12 @@ module PluginManager
|
||||
dependencies = value
|
||||
dependencies = [dependencies] if !dependencies.is_a?(Array) || !dependencies[0].is_a?(Array)
|
||||
for dep in value
|
||||
if dep.is_a?(String) # "plugin name"
|
||||
case dep
|
||||
when String # "plugin name"
|
||||
if !self.installed?(dep)
|
||||
self.error("Plugin '#{name}' requires plugin '#{dep}' to be installed above it.")
|
||||
end
|
||||
elsif dep.is_a?(Array)
|
||||
when Array
|
||||
case dep.size
|
||||
when 1 # ["plugin name"]
|
||||
if dep[0].is_a?(String)
|
||||
@@ -428,8 +429,8 @@ module PluginManager
|
||||
return 1 if !c2
|
||||
return 1 if c1.to_i(16) > c2.to_i(16)
|
||||
return -1 if c1.to_i(16) < c2.to_i(16)
|
||||
else
|
||||
return -1 if c2
|
||||
elsif c2
|
||||
return -1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
|
||||
@@ -7,7 +7,7 @@ class SpriteAnimation
|
||||
end
|
||||
|
||||
%w[
|
||||
x y ox oy viewport flash src_rect opacity tone
|
||||
x y ox oy viewport flash src_rect opacity tone
|
||||
].each_with_index do |s, _i|
|
||||
eval <<-__END__
|
||||
|
||||
@@ -187,7 +187,7 @@ class SpriteAnimation
|
||||
sprite_y = self.viewport.rect.height - 160
|
||||
end
|
||||
else
|
||||
sprite_x = self.x - self.ox + self.src_rect.width / 2
|
||||
sprite_x = self.x - self.ox + (self.src_rect.width / 2)
|
||||
sprite_y = self.y - self.oy
|
||||
sprite_y += self.src_rect.height / 2 if position == 1
|
||||
sprite_y += self.src_rect.height if position == 2
|
||||
@@ -370,7 +370,7 @@ module RPG
|
||||
@_damage_sprite.ox = 80
|
||||
@_damage_sprite.oy = 20
|
||||
@_damage_sprite.x = self.x
|
||||
@_damage_sprite.y = self.y - self.oy / 2
|
||||
@_damage_sprite.y = self.y - (self.oy / 2)
|
||||
@_damage_sprite.z = 3000
|
||||
@_damage_duration = 40
|
||||
end
|
||||
@@ -450,7 +450,7 @@ module RPG
|
||||
super
|
||||
if @_whiten_duration > 0
|
||||
@_whiten_duration -= 1
|
||||
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
|
||||
self.color.alpha = 128 - ((16 - @_whiten_duration) * 10)
|
||||
end
|
||||
if @_appear_duration > 0
|
||||
@_appear_duration -= 1
|
||||
@@ -458,11 +458,11 @@ module RPG
|
||||
end
|
||||
if @_escape_duration > 0
|
||||
@_escape_duration -= 1
|
||||
self.opacity = 256 - (32 - @_escape_duration) * 10
|
||||
self.opacity = 256 - ((32 - @_escape_duration) * 10)
|
||||
end
|
||||
if @_collapse_duration > 0
|
||||
@_collapse_duration -= 1
|
||||
self.opacity = 256 - (48 - @_collapse_duration) * 6
|
||||
self.opacity = 256 - ((48 - @_collapse_duration) * 6)
|
||||
end
|
||||
if @_damage_duration > 0
|
||||
@_damage_duration -= 1
|
||||
@@ -476,7 +476,7 @@ module RPG
|
||||
when 28..33
|
||||
@_damage_sprite.y += 4
|
||||
end
|
||||
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
|
||||
@_damage_sprite.opacity = 256 - ((12 - @_damage_duration) * 32)
|
||||
if @_damage_duration == 0
|
||||
dispose_damage
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user