diff --git a/Data/Scripts/001_Technical/001_Debugging/003_Errors.rb b/Data/Scripts/001_Technical/001_Debugging/003_Errors.rb index 9043ad576..20b591686 100644 --- a/Data/Scripts/001_Technical/001_Debugging/003_Errors.rb +++ b/Data/Scripts/001_Technical/001_Debugging/003_Errors.rb @@ -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 diff --git a/Data/Scripts/001_Technical/002_Files/002_FileMixins.rb b/Data/Scripts/001_Technical/002_Files/002_FileMixins.rb index 187049ec6..522cb9ade 100644 --- a/Data/Scripts/001_Technical/002_Files/002_FileMixins.rb +++ b/Data/Scripts/001_Technical/002_Files/002_FileMixins.rb @@ -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 diff --git a/Data/Scripts/001_Technical/003_Intl_Messages.rb b/Data/Scripts/001_Technical/003_Intl_Messages.rb index cd05152af..6e593e46a 100644 --- a/Data/Scripts/001_Technical/003_Intl_Messages.rb +++ b/Data/Scripts/001_Technical/003_Intl_Messages.rb @@ -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 diff --git a/Data/Scripts/001_Technical/005_PluginManager.rb b/Data/Scripts/001_Technical/005_PluginManager.rb index 34116872a..47e65c792 100644 --- a/Data/Scripts/001_Technical/005_PluginManager.rb +++ b/Data/Scripts/001_Technical/005_PluginManager.rb @@ -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 diff --git a/Data/Scripts/001_Technical/006_RPG_Sprite.rb b/Data/Scripts/001_Technical/006_RPG_Sprite.rb index f6fedfc4d..2e69bbd6f 100644 --- a/Data/Scripts/001_Technical/006_RPG_Sprite.rb +++ b/Data/Scripts/001_Technical/006_RPG_Sprite.rb @@ -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 diff --git a/Data/Scripts/003_Game processing/002_Scene_Map.rb b/Data/Scripts/003_Game processing/002_Scene_Map.rb index 5030f76ba..5149ab0c7 100644 --- a/Data/Scripts/003_Game processing/002_Scene_Map.rb +++ b/Data/Scripts/003_Game processing/002_Scene_Map.rb @@ -57,8 +57,8 @@ class Scene_Map if playingBGM && map.autoplay_bgm if (PBDayNight.isNight? rescue false) pbBGMFade(0.8) if playingBGM.name != map.bgm.name && playingBGM.name != map.bgm.name + "_n" - else - pbBGMFade(0.8) if playingBGM.name != map.bgm.name + elsif playingBGM.name != map.bgm.name + pbBGMFade(0.8) end end if playingBGS && map.autoplay_bgs diff --git a/Data/Scripts/003_Game processing/003_Interpreter.rb b/Data/Scripts/003_Game processing/003_Interpreter.rb index d8ec09004..70786dadf 100644 --- a/Data/Scripts/003_Game processing/003_Interpreter.rb +++ b/Data/Scripts/003_Game processing/003_Interpreter.rb @@ -452,8 +452,8 @@ class Interpreter $game_temp.mart_prices[item][0] = buy_price if buy_price > 0 if sell_price >= 0 # 0=can't sell $game_temp.mart_prices[item][1] = sell_price * 2 - else - $game_temp.mart_prices[item][1] = buy_price if buy_price > 0 + elsif buy_price > 0 + $game_temp.mart_prices[item][1] = buy_price end end diff --git a/Data/Scripts/003_Game processing/004_Interpreter_Commands.rb b/Data/Scripts/003_Game processing/004_Interpreter_Commands.rb index eb833b5a8..d7fdbb7fa 100644 --- a/Data/Scripts/003_Game processing/004_Interpreter_Commands.rb +++ b/Data/Scripts/003_Game processing/004_Interpreter_Commands.rb @@ -952,8 +952,8 @@ class Interpreter sscene = PokemonEntryScene.new sscreen = PokemonEntry.new(sscene) $game_actors[@parameters[0]].name = sscreen.pbStartScreen( - _INTL("Enter {1}'s name.", $game_actors[@parameters[0]].name), - 1, @parameters[1], $game_actors[@parameters[0]].name + _INTL("Enter {1}'s name.", $game_actors[@parameters[0]].name), + 1, @parameters[1], $game_actors[@parameters[0]].name ) } end diff --git a/Data/Scripts/004_Game classes/001_Game_Screen.rb b/Data/Scripts/004_Game classes/001_Game_Screen.rb index d41d1a68a..b3e1b50be 100644 --- a/Data/Scripts/004_Game classes/001_Game_Screen.rb +++ b/Data/Scripts/004_Game classes/001_Game_Screen.rb @@ -97,15 +97,15 @@ class Game_Screen end if @fadein_duration && @fadein_duration >= 1 d = @fadein_duration - @brightness = (@brightness * (d - 1) + 255) / d + @brightness = ((@brightness * (d - 1)) + 255) / d @fadein_duration -= 1 end if @tone_duration >= 1 d = @tone_duration - @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d - @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d - @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d - @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d + @tone.red = ((@tone.red * (d - 1)) + @tone_target.red) / d + @tone.green = ((@tone.green * (d - 1)) + @tone_target.green) / d + @tone.blue = ((@tone.blue * (d - 1)) + @tone_target.blue) / d + @tone.gray = ((@tone.gray * (d - 1)) + @tone_target.gray) / d @tone_duration -= 1 end if @flash_duration >= 1 diff --git a/Data/Scripts/004_Game classes/003_Game_Picture.rb b/Data/Scripts/004_Game classes/003_Game_Picture.rb index cd39dfdf9..ef10a56de 100644 --- a/Data/Scripts/004_Game classes/003_Game_Picture.rb +++ b/Data/Scripts/004_Game classes/003_Game_Picture.rb @@ -131,19 +131,19 @@ class Game_Picture def update if @duration >= 1 d = @duration - @x = (@x * (d - 1) + @target_x) / d - @y = (@y * (d - 1) + @target_y) / d - @zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d - @zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d - @opacity = (@opacity * (d - 1) + @target_opacity) / d + @x = ((@x * (d - 1)) + @target_x) / d + @y = ((@y * (d - 1)) + @target_y) / d + @zoom_x = ((@zoom_x * (d - 1)) + @target_zoom_x) / d + @zoom_y = ((@zoom_y * (d - 1)) + @target_zoom_y) / d + @opacity = ((@opacity * (d - 1)) + @target_opacity) / d @duration -= 1 end if @tone_duration >= 1 d = @tone_duration - @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d - @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d - @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d - @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d + @tone.red = ((@tone.red * (d - 1)) + @tone_target.red) / d + @tone.green = ((@tone.green * (d - 1)) + @tone_target.green) / d + @tone.blue = ((@tone.blue * (d - 1)) + @tone_target.blue) / d + @tone.gray = ((@tone.gray * (d - 1)) + @tone_target.gray) / d @tone_duration -= 1 end if @rotate_speed != 0 diff --git a/Data/Scripts/004_Game classes/004_Game_Map.rb b/Data/Scripts/004_Game classes/004_Game_Map.rb index ee57985f0..e8d40acfd 100644 --- a/Data/Scripts/004_Game classes/004_Game_Map.rb +++ b/Data/Scripts/004_Game classes/004_Game_Map.rb @@ -147,7 +147,7 @@ class Game_Map def passable?(x, y, d, self_event = nil) return false if !valid?(x, y) - bit = (1 << (d / 2 - 1)) & 0x0f + bit = (1 << ((d / 2) - 1)) & 0x0f for event in events.values next if event.tile_id <= 0 next if event == self_event @@ -224,7 +224,7 @@ class Game_Map end def playerPassable?(x, y, d, self_event = nil) - bit = (1 << (d / 2 - 1)) & 0x0f + bit = (1 << ((d / 2) - 1)) & 0x0f for i in [2, 1, 0] tile_id = data[x, y, i] terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id]) @@ -323,7 +323,7 @@ class Game_Map return if @display_x == value @display_x = value if metadata&.snap_edges - max_x = (self.width - Graphics.width * 1.0 / TILE_WIDTH) * REAL_RES_X + max_x = (self.width - (Graphics.width.to_f / TILE_WIDTH)) * REAL_RES_X @display_x = [0, [@display_x, max_x].min].max end $map_factory.setMapsInRange if $map_factory @@ -333,7 +333,7 @@ class Game_Map return if @display_y == value @display_y = value if metadata&.snap_edges - max_y = (self.height - Graphics.height * 1.0 / TILE_HEIGHT) * REAL_RES_Y + max_y = (self.height - (Graphics.height.to_f / TILE_HEIGHT)) * REAL_RES_Y @display_y = [0, [@display_y, max_y].min].max end $map_factory.setMapsInRange if $map_factory @@ -378,7 +378,7 @@ class Game_Map end def start_fog_opacity_change(opacity, duration) - @fog_opacity_target = opacity * 1.0 + @fog_opacity_target = opacity.to_f @fog_opacity_duration = duration if @fog_opacity_duration == 0 @fog_opacity = @fog_opacity_target @@ -437,15 +437,15 @@ class Game_Map if @fog_tone_duration >= 1 d = @fog_tone_duration target = @fog_tone_target - @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d - @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d - @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d - @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d + @fog_tone.red = ((@fog_tone.red * (d - 1)) + target.red) / d + @fog_tone.green = ((@fog_tone.green * (d - 1)) + target.green) / d + @fog_tone.blue = ((@fog_tone.blue * (d - 1)) + target.blue) / d + @fog_tone.gray = ((@fog_tone.gray * (d - 1)) + target.gray) / d @fog_tone_duration -= 1 end if @fog_opacity_duration >= 1 d = @fog_opacity_duration - @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d + @fog_opacity = ((@fog_opacity * (d - 1)) + @fog_opacity_target) / d @fog_opacity_duration -= 1 end end diff --git a/Data/Scripts/004_Game classes/005_Game_Map_Autoscroll.rb b/Data/Scripts/004_Game classes/005_Game_Map_Autoscroll.rb index 4e386dbea..3c1334fd3 100644 --- a/Data/Scripts/004_Game classes/005_Game_Map_Autoscroll.rb +++ b/Data/Scripts/004_Game classes/005_Game_Map_Autoscroll.rb @@ -87,12 +87,12 @@ class Interpreter print 'Map Autoscroll: invalid speed (1-6 only)' return command_skip end - center_x = (Graphics.width / 2 - Game_Map::TILE_WIDTH / 2) * 4 # X coordinate in the center of the screen - center_y = (Graphics.height / 2 - Game_Map::TILE_HEIGHT / 2) * 4 # Y coordinate in the center of the screen - max_x = ($game_map.width - Graphics.width * 1.0 / Game_Map::TILE_WIDTH) * 4 * Game_Map::TILE_WIDTH - max_y = ($game_map.height - Graphics.height * 1.0 / Game_Map::TILE_HEIGHT) * 4 * Game_Map::TILE_HEIGHT - count_x = ($game_map.display_x - [0, [x * Game_Map::REAL_RES_X - center_x, max_x].min].max) / Game_Map::REAL_RES_X - count_y = ($game_map.display_y - [0, [y * Game_Map::REAL_RES_Y - center_y, max_y].min].max) / Game_Map::REAL_RES_Y + center_x = ((Graphics.width / 2) - (Game_Map::TILE_WIDTH / 2)) * 4 # X coordinate in the center of the screen + center_y = ((Graphics.height / 2) - (Game_Map::TILE_HEIGHT / 2)) * 4 # Y coordinate in the center of the screen + max_x = ($game_map.width - (Graphics.width.to_f / Game_Map::TILE_WIDTH)) * 4 * Game_Map::TILE_WIDTH + max_y = ($game_map.height - (Graphics.height.to_f / Game_Map::TILE_HEIGHT)) * 4 * Game_Map::TILE_HEIGHT + count_x = ($game_map.display_x - [0, [(x * Game_Map::REAL_RES_X) - center_x, max_x].min].max) / Game_Map::REAL_RES_X + count_y = ($game_map.display_y - [0, [(y * Game_Map::REAL_RES_Y) - center_y, max_y].min].max) / Game_Map::REAL_RES_Y if !@diag @diag = true dir = nil @@ -148,20 +148,20 @@ end class Game_Map def scroll_downright(distance) @display_x = [@display_x + distance, - (self.width - Graphics.width * 1.0 / TILE_WIDTH) * REAL_RES_X].min + (self.width - (Graphics.width.to_f / TILE_WIDTH)) * REAL_RES_X].min @display_y = [@display_y + distance, - (self.height - Graphics.height * 1.0 / TILE_HEIGHT) * REAL_RES_Y].min + (self.height - (Graphics.height.to_f / TILE_HEIGHT)) * REAL_RES_Y].min end def scroll_downleft(distance) @display_x = [@display_x - distance, 0].max @display_y = [@display_y + distance, - (self.height - Graphics.height * 1.0 / TILE_HEIGHT) * REAL_RES_Y].min + (self.height - (Graphics.height.to_f / TILE_HEIGHT)) * REAL_RES_Y].min end def scroll_upright(distance) @display_x = [@display_x + distance, - (self.width - Graphics.width * 1.0 / TILE_WIDTH) * REAL_RES_X].min + (self.width - (Graphics.width.to_f / TILE_WIDTH)) * REAL_RES_X].min @display_y = [@display_y - distance, 0].max end diff --git a/Data/Scripts/004_Game classes/006_Game_MapFactory.rb b/Data/Scripts/004_Game classes/006_Game_MapFactory.rb index a20fcc154..81f5268eb 100644 --- a/Data/Scripts/004_Game classes/006_Game_MapFactory.rb +++ b/Data/Scripts/004_Game classes/006_Game_MapFactory.rb @@ -122,8 +122,8 @@ class PokemonMapFactory for conn in conns[id] if conn[0] == id mapA = getMap(conn[0]) - newdispx = (conn[4] - conn[1]) * Game_Map::REAL_RES_X + mapA.display_x - newdispy = (conn[5] - conn[2]) * Game_Map::REAL_RES_Y + mapA.display_y + newdispx = ((conn[4] - conn[1]) * Game_Map::REAL_RES_X) + mapA.display_x + newdispy = ((conn[5] - conn[2]) * Game_Map::REAL_RES_Y) + mapA.display_y if hasMap?(conn[3]) || MapFactoryHelper.mapInRangeById?(conn[3], newdispx, newdispy) mapB = getMap(conn[3]) mapB.display_x = newdispx if mapB.display_x != newdispx @@ -131,8 +131,8 @@ class PokemonMapFactory end else mapA = getMap(conn[3]) - newdispx = (conn[1] - conn[4]) * Game_Map::REAL_RES_X + mapA.display_x - newdispy = (conn[2] - conn[5]) * Game_Map::REAL_RES_Y + mapA.display_y + newdispx = ((conn[1] - conn[4]) * Game_Map::REAL_RES_X) + mapA.display_x + newdispy = ((conn[2] - conn[5]) * Game_Map::REAL_RES_Y) + mapA.display_y if hasMap?(conn[0]) || MapFactoryHelper.mapInRangeById?(conn[0], newdispx, newdispy) mapB = getMap(conn[0]) mapB.display_x = newdispx if mapB.display_x != newdispx @@ -204,8 +204,8 @@ class PokemonMapFactory if !($DEBUG && Input.press?(Input::CTRL)) return false if !map.passableStrict?(x, y, 0, thisEvent) end - else - return false if !map.passableStrict?(x, y, 0, thisEvent) + elsif !map.passableStrict?(x, y, 0, thisEvent) + return false end for event in map.events.values next if event == thisEvent || !event.at_coordinate?(x, y) @@ -488,8 +488,8 @@ module MapFactoryHelper dispy = map.display_y return false if dispx >= (map.width + range) * Game_Map::REAL_RES_X return false if dispy >= (map.height + range) * Game_Map::REAL_RES_Y - return false if dispx <= -(Graphics.width + range * Game_Map::TILE_WIDTH) * Game_Map::X_SUBPIXELS - return false if dispy <= -(Graphics.height + range * Game_Map::TILE_HEIGHT) * Game_Map::Y_SUBPIXELS + return false if dispx <= -(Graphics.width + (range * Game_Map::TILE_WIDTH)) * Game_Map::X_SUBPIXELS + return false if dispy <= -(Graphics.height + (range * Game_Map::TILE_HEIGHT)) * Game_Map::Y_SUBPIXELS return true end @@ -498,8 +498,8 @@ module MapFactoryHelper dims = MapFactoryHelper.getMapDims(id) return false if dispx >= (dims[0] + range) * Game_Map::REAL_RES_X return false if dispy >= (dims[1] + range) * Game_Map::REAL_RES_Y - return false if dispx <= -(Graphics.width + range * Game_Map::TILE_WIDTH) * Game_Map::X_SUBPIXELS - return false if dispy <= -(Graphics.height + range * Game_Map::TILE_HEIGHT) * Game_Map::Y_SUBPIXELS + return false if dispx <= -(Graphics.width + (range * Game_Map::TILE_WIDTH)) * Game_Map::X_SUBPIXELS + return false if dispy <= -(Graphics.height + (range * Game_Map::TILE_HEIGHT)) * Game_Map::Y_SUBPIXELS return true end end diff --git a/Data/Scripts/004_Game classes/007_Game_Character.rb b/Data/Scripts/004_Game classes/007_Game_Character.rb index 91cd2bb58..9442da80c 100644 --- a/Data/Scripts/004_Game classes/007_Game_Character.rb +++ b/Data/Scripts/004_Game classes/007_Game_Character.rb @@ -142,7 +142,7 @@ class Game_Character # 4 => 64 # 1.6 seconds # 5 => 30 # 0.75 seconds # 6 => 0 # 0 seconds, i.e. continuous movement - self.move_frequency_real = (40 - val * 2) * (6 - val) + self.move_frequency_real = (40 - (val * 2)) * (6 - val) end def move_frequency_real @@ -318,7 +318,7 @@ class Game_Character else jump_fraction = ((@jump_distance_left / @jump_distance) - 0.5).abs # 0.5 to 0 to 0.5 end - ret += @jump_peak * (4 * jump_fraction**2 - 1) + ret += @jump_peak * ((4 * (jump_fraction**2)) - 1) end return ret end @@ -328,7 +328,7 @@ class Game_Character z = screen_y_ground if @tile_id > 0 begin - return z + self.map.priorities[@tile_id] * 32 + return z + (self.map.priorities[@tile_id] * 32) rescue raise "Event's graphic is an out-of-range tile (event #{@id}, map #{self.map.map_id})" end @@ -405,8 +405,8 @@ class Game_Character end def move_type_toward_player - sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0) - sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0) + sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0)) + sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0)) if sx.abs + sy.abs >= 20 move_random return @@ -662,8 +662,8 @@ class Game_Character end def move_toward_player - sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0) - sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0) + sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0)) + sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0)) return if sx == 0 && sy == 0 abs_sx = sx.abs abs_sy = sy.abs @@ -684,8 +684,8 @@ class Game_Character end def move_away_from_player - sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0) - sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0) + sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0)) + sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0)) return if sx == 0 && sy == 0 abs_sx = sx.abs abs_sy = sy.abs @@ -737,7 +737,7 @@ class Game_Character end @x = @x + x_plus @y = @y + y_plus - real_distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus) + real_distance = Math.sqrt((x_plus * x_plus) + (y_plus * y_plus)) distance = [1, real_distance].max @jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping @jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max @@ -824,8 +824,8 @@ class Game_Character end def turn_toward_player - sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0) - sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0) + sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0)) + sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0)) return if sx == 0 && sy == 0 if sx.abs > sy.abs (sx > 0) ? turn_left : turn_right @@ -835,8 +835,8 @@ class Game_Character end def turn_away_from_player - sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0) - sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0) + sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0)) + sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0)) return if sx == 0 && sy == 0 if sx.abs > sy.abs (sx > 0) ? turn_right : turn_left diff --git a/Data/Scripts/004_Game classes/008_Game_Event.rb b/Data/Scripts/004_Game classes/008_Game_Event.rb index ac6ba43c5..318bbfad8 100644 --- a/Data/Scripts/004_Game classes/008_Game_Event.rb +++ b/Data/Scripts/004_Game classes/008_Game_Event.rb @@ -110,7 +110,7 @@ class Game_Event < Game_Character return false if !ontime now = pbGetTimeNow elapsed = (now.to_i - ontime) / 86400 - elapsed += 1 if (now.to_i - ontime) % 86400 > (now.hour * 3600 + now.min * 60 + now.sec) + elapsed += 1 if (now.to_i - ontime) % 86400 > ((now.hour * 3600) + (now.min * 60) + now.sec) return elapsed >= days end @@ -249,9 +249,9 @@ class Game_Event < Game_Character return true if @move_route_forcing return true if @event.name[/update/i] range = 2 # Number of tiles - return false if self.screen_x - @sprite_size[0] / 2 > Graphics.width + range * Game_Map::TILE_WIDTH - return false if self.screen_x + @sprite_size[0] / 2 < -range * Game_Map::TILE_WIDTH - return false if self.screen_y_ground - @sprite_size[1] > Graphics.height + range * Game_Map::TILE_HEIGHT + return false if self.screen_x - (@sprite_size[0] / 2) > Graphics.width + (range * Game_Map::TILE_WIDTH) + return false if self.screen_x + (@sprite_size[0] / 2) < -range * Game_Map::TILE_WIDTH + return false if self.screen_y_ground - @sprite_size[1] > Graphics.height + (range * Game_Map::TILE_HEIGHT) return false if self.screen_y_ground < -range * Game_Map::TILE_HEIGHT return true end diff --git a/Data/Scripts/004_Game classes/009_Game_Player.rb b/Data/Scripts/004_Game classes/009_Game_Player.rb index 252069904..c372dd36f 100644 --- a/Data/Scripts/004_Game classes/009_Game_Player.rb +++ b/Data/Scripts/004_Game classes/009_Game_Player.rb @@ -10,8 +10,8 @@ class Game_Player < Game_Character attr_accessor :charsetData attr_accessor :encounter_count - SCREEN_CENTER_X = (Settings::SCREEN_WIDTH / 2 - Game_Map::TILE_WIDTH / 2) * Game_Map::X_SUBPIXELS - SCREEN_CENTER_Y = (Settings::SCREEN_HEIGHT / 2 - Game_Map::TILE_HEIGHT / 2) * Game_Map::Y_SUBPIXELS + SCREEN_CENTER_X = ((Settings::SCREEN_WIDTH / 2) - (Game_Map::TILE_WIDTH / 2)) * Game_Map::X_SUBPIXELS + SCREEN_CENTER_Y = ((Settings::SCREEN_HEIGHT / 2) - (Game_Map::TILE_HEIGHT / 2)) * Game_Map::Y_SUBPIXELS @@bobFrameSpeed = 1.0 / 15 @@ -157,7 +157,7 @@ class Game_Player < Game_Character end @x = @x + x_plus @y = @y + y_plus - real_distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus) + real_distance = Math.sqrt((x_plus * x_plus) + (y_plus * y_plus)) distance = [1, real_distance].max @jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping @jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max @@ -287,8 +287,8 @@ class Game_Player < Game_Character # * Set Map Display Position to Center of Screen #----------------------------------------------------------------------------- def center(x, y) - self.map.display_x = x * Game_Map::REAL_RES_X - SCREEN_CENTER_X - self.map.display_y = y * Game_Map::REAL_RES_Y - SCREEN_CENTER_Y + self.map.display_x = (x * Game_Map::REAL_RES_X) - SCREEN_CENTER_X + self.map.display_y = (y * Game_Map::REAL_RES_Y) - SCREEN_CENTER_Y end #----------------------------------------------------------------------------- diff --git a/Data/Scripts/004_Game classes/011_Game_Follower.rb b/Data/Scripts/004_Game classes/011_Game_Follower.rb index 95131e1e9..4c1211417 100644 --- a/Data/Scripts/004_Game classes/011_Game_Follower.rb +++ b/Data/Scripts/004_Game classes/011_Game_Follower.rb @@ -164,7 +164,7 @@ class Game_Follower < Game_Event return false if !this_map || !this_map.valid?(x, y) return true if @through passed_tile_checks = false - bit = (1 << (direction / 2 - 1)) & 0x0f + bit = (1 << ((direction / 2) - 1)) & 0x0f # Check all events for ones using tiles as graphics, and see if they're passable for event in this_map.events.values next if event.tile_id < 0 || event.through || !event.at_coordinate?(x, y) diff --git a/Data/Scripts/005_Sprites/002_Sprite_Timer.rb b/Data/Scripts/005_Sprites/002_Sprite_Timer.rb index 901dec4d0..5022d55f0 100644 --- a/Data/Scripts/005_Sprites/002_Sprite_Timer.rb +++ b/Data/Scripts/005_Sprites/002_Sprite_Timer.rb @@ -38,8 +38,8 @@ class Sprite_Timer @timer.text = _ISPRINTF("{1:02d}:{2:02d}", min, sec) end @timer.update - else - @timer.visible = false if @timer + elsif @timer + @timer.visible = false end end end diff --git a/Data/Scripts/005_Sprites/003_Sprite_Character.rb b/Data/Scripts/005_Sprites/003_Sprite_Character.rb index 2839fc734..5c70369a0 100644 --- a/Data/Scripts/005_Sprites/003_Sprite_Character.rb +++ b/Data/Scripts/005_Sprites/003_Sprite_Character.rb @@ -117,7 +117,7 @@ class Sprite_Character < RPG::Sprite self.oy = @ch else @charbitmap = AnimatedBitmap.new( - 'Graphics/Characters/' + @character_name, @character_hue + 'Graphics/Characters/' + @character_name, @character_hue ) RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @character == $game_player @charbitmapAnimated = true diff --git a/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb b/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb index 015fc16e4..55a46096d 100644 --- a/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb +++ b/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb @@ -57,10 +57,10 @@ class Sprite_Reflection y += @height * 16 width = @rsprite.src_rect.width height = @rsprite.src_rect.height - @sprite.x = x + width / 2 - @sprite.y = y + height + height / 2 + @sprite.x = x + (width / 2) + @sprite.y = y + height + (height / 2) @sprite.ox = width / 2 - @sprite.oy = height / 2 - 2 # Hard-coded 2 pixel shift up + @sprite.oy = (height / 2) - 2 # Hard-coded 2 pixel shift up @sprite.oy -= @rsprite.character.bob_height * 2 @sprite.z = -50 # Still water is -100, map is 0 and above @sprite.z += 1 if @event == $game_player diff --git a/Data/Scripts/005_Sprites/005_Sprite_SurfBase.rb b/Data/Scripts/005_Sprites/005_Sprite_SurfBase.rb index caa6f16dd..f66e1bbc2 100644 --- a/Data/Scripts/005_Sprites/005_Sprite_SurfBase.rb +++ b/Data/Scripts/005_Sprites/005_Sprite_SurfBase.rb @@ -63,8 +63,8 @@ class Sprite_SurfBase sy = ((@event.direction - 2) / 2) * ch @sprite.src_rect.set(sx, sy, cw, ch) if $game_temp.surf_base_coords - @sprite.x = ($game_temp.surf_base_coords[0] * Game_Map::REAL_RES_X - @event.map.display_x + 3) / 4 + (Game_Map::TILE_WIDTH / 2) - @sprite.y = ($game_temp.surf_base_coords[1] * Game_Map::REAL_RES_Y - @event.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT / 2) + 16 + @sprite.x = ((($game_temp.surf_base_coords[0] * Game_Map::REAL_RES_X) - @event.map.display_x + 3) / 4) + (Game_Map::TILE_WIDTH / 2) + @sprite.y = ((($game_temp.surf_base_coords[1] * Game_Map::REAL_RES_Y) - @event.map.display_y + 3) / 4) + (Game_Map::TILE_HEIGHT / 2) + 16 else @sprite.x = @rsprite.x @sprite.y = @rsprite.y diff --git a/Data/Scripts/005_Sprites/007_Spriteset_Map.rb b/Data/Scripts/005_Sprites/007_Spriteset_Map.rb index fc2a5c9a7..1319d0eae 100644 --- a/Data/Scripts/005_Sprites/007_Spriteset_Map.rb +++ b/Data/Scripts/005_Sprites/007_Spriteset_Map.rb @@ -9,7 +9,7 @@ class ClippableSprite < Sprite_Character def update super @_src_rect = self.src_rect - tmright = @tilemap.map_data.xsize * Game_Map::TILE_WIDTH - @tilemap.ox + tmright = (@tilemap.map_data.xsize * Game_Map::TILE_WIDTH) - @tilemap.ox echoln "x=#{self.x},ox=#{self.ox},tmright=#{tmright},tmox=#{@tilemap.ox}" if @tilemap.ox - self.ox < -self.x # clipped on left diff --git a/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb b/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb index 9a371be77..3493dcb8a 100644 --- a/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb +++ b/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb @@ -18,9 +18,9 @@ class AnimationSprite < RPG::Sprite end def setCoords - self.x = ((@tileX * Game_Map::REAL_RES_X - @map.display_x) / Game_Map::X_SUBPIXELS).ceil + self.x = (((@tileX * Game_Map::REAL_RES_X) - @map.display_x) / Game_Map::X_SUBPIXELS).ceil self.x += Game_Map::TILE_WIDTH / 2 - self.y = ((@tileY * Game_Map::REAL_RES_Y - @map.display_y) / Game_Map::Y_SUBPIXELS).ceil + self.y = (((@tileY * Game_Map::REAL_RES_Y) - @map.display_y) / Game_Map::Y_SUBPIXELS).ceil self.y += Game_Map::TILE_HEIGHT end diff --git a/Data/Scripts/005_Sprites/010_ParticleEngine.rb b/Data/Scripts/005_Sprites/010_ParticleEngine.rb index 4e00ddb08..18e9ea8a7 100644 --- a/Data/Scripts/005_Sprites/010_ParticleEngine.rb +++ b/Data/Scripts/005_Sprites/010_ParticleEngine.rb @@ -9,23 +9,23 @@ class Particle_Engine @disposed = false @firsttime = true @effects = { - # PinkMan's Effects - "fire" => Particle_Engine::Fire, - "smoke" => Particle_Engine::Smoke, - "teleport" => Particle_Engine::Teleport, - "spirit" => Particle_Engine::Spirit, - "explosion" => Particle_Engine::Explosion, - "aura" => Particle_Engine::Aura, - # BlueScope's Effects - "soot" => Particle_Engine::Soot, - "sootsmoke" => Particle_Engine::SootSmoke, - "rocket" => Particle_Engine::Rocket, - "fixteleport" => Particle_Engine::FixedTeleport, - "smokescreen" => Particle_Engine::Smokescreen, - "flare" => Particle_Engine::Flare, - "splash" => Particle_Engine::Splash, - # By Peter O. - "starteleport" => Particle_Engine::StarTeleport + # PinkMan's Effects + "fire" => Particle_Engine::Fire, + "smoke" => Particle_Engine::Smoke, + "teleport" => Particle_Engine::Teleport, + "spirit" => Particle_Engine::Spirit, + "explosion" => Particle_Engine::Explosion, + "aura" => Particle_Engine::Aura, + # BlueScope's Effects + "soot" => Particle_Engine::Soot, + "sootsmoke" => Particle_Engine::SootSmoke, + "rocket" => Particle_Engine::Rocket, + "fixteleport" => Particle_Engine::FixedTeleport, + "smokescreen" => Particle_Engine::Smokescreen, + "flare" => Particle_Engine::Flare, + "splash" => Particle_Engine::Splash, + # By Peter O. + "starteleport" => Particle_Engine::StarTeleport } end @@ -261,9 +261,9 @@ class ParticleEffect_Event < ParticleEffect @real_y = newRealY if @opacityvar > 0 && @viewport opac = 255.0 / @opacityvar - minX = opac * (-@xgravity * 1.0 / @slowdown).floor + @startingx - maxX = opac * (@xgravity * 1.0 / @slowdown).floor + @startingx - minY = opac * (-@ygravity * 1.0 / @slowdown).floor + @startingy + minX = (opac * (-@xgravity.to_f / @slowdown).floor) + @startingx + maxX = (opac * (@xgravity.to_f / @slowdown).floor) + @startingx + minY = (opac * (-@ygravity.to_f / @slowdown).floor) + @startingy maxY = @startingy minX -= @bmwidth minY -= @bmheight @@ -309,14 +309,12 @@ class ParticleEffect_Event < ParticleEffect @particlex[i] = 0.0 @particley[i] = 0.0 end - else - if @opacity[i] <= 0 - @opacity[i] = 250 - @particles[i].y = @startingy + @yoffset - @particles[i].x = @startingx + @xoffset - @particlex[i] = 0.0 - @particley[i] = 0.0 - end + elsif @opacity[i] <= 0 + @opacity[i] = 250 + @particles[i].y = @startingy + @yoffset + @particles[i].x = @startingx + @xoffset + @particlex[i] = 0.0 + @particley[i] = 0.0 end calcParticlePos(i) if @randomhue == 1 @@ -333,11 +331,11 @@ class ParticleEffect_Event < ParticleEffect def calcParticlePos(i) @leftright = rand(2) if @leftright == 1 - xo = -@xgravity * 1.0 / @slowdown + xo = -@xgravity.to_f / @slowdown else - xo = @xgravity * 1.0 / @slowdown + xo = @xgravity.to_f / @slowdown end - yo = -@ygravity * 1.0 / @slowdown + yo = -@ygravity.to_f / @slowdown @particlex[i] += xo @particley[i] += yo @particlex[i] -= @__offsetx diff --git a/Data/Scripts/005_Sprites/011_PictureEx.rb b/Data/Scripts/005_Sprites/011_PictureEx.rb index 27ff47ddc..58219e2d1 100644 --- a/Data/Scripts/005_Sprites/011_PictureEx.rb +++ b/Data/Scripts/005_Sprites/011_PictureEx.rb @@ -47,23 +47,23 @@ def getCubicPoint2(src, t) x1 = src[6] y1 = src[7] - x1 = cx1 + (x1 - cx1) * t - x0 = x0 + (cx0 - x0) * t - cx0 = cx0 + (cx1 - cx0) * t - cx1 = cx0 + (x1 - cx0) * t - cx0 = x0 + (cx0 - x0) * t - cx = cx0 + (cx1 - cx0) * t + x1 = cx1 + ((x1 - cx1) * t) + x0 = x0 + ((cx0 - x0) * t) + cx0 = cx0 + ((cx1 - cx0) * t) + cx1 = cx0 + ((x1 - cx0) * t) + cx0 = x0 + ((cx0 - x0) * t) + cx = cx0 + ((cx1 - cx0) * t) # a = x1 - 3 * cx1 + 3 * cx0 - x0 # b = 3 * (cx1 - 2 * cx0 + x0) # c = 3 * (cx0 - x0) # d = x0 # cx = a*t*t*t + b*t*t + c*t + d - y1 = cy1 + (y1 - cy1) * t - y0 = y0 + (cy0 - y0) * t - cy0 = cy0 + (cy1 - cy0) * t - cy1 = cy0 + (y1 - cy0) * t - cy0 = y0 + (cy0 - y0) * t - cy = cy0 + (cy1 - cy0) * t + y1 = cy1 + ((y1 - cy1) * t) + y0 = y0 + ((cy0 - y0) * t) + cy0 = cy0 + ((cy1 - cy0) * t) + cy1 = cy0 + ((y1 - cy0) * t) + cy0 = y0 + ((cy0 - y0) * t) + cy = cy0 + ((cy1 - cy0) * t) # a = y1 - 3 * cy1 + 3 * cy0 - y0 # b = 3 * (cy1 - 2 * cy0 + y0) # c = 3 * (cy0 - y0) @@ -121,11 +121,12 @@ class PictureEx end def callback(cb) - if cb.is_a?(Proc) + case cb + when Proc cb.call(self) - elsif cb.is_a?(Array) + when Array cb[0].method(cb[1]).call(self) - elsif cb.is_a?(Method) + when Method cb.call(self) end end @@ -390,31 +391,31 @@ class PictureEx dur = (process[2] == 0) ? 1 : process[2] # Total duration of process case process[0] when Processes::XY, Processes::DeltaXY - @x = process[5] + fra * (process[7] - process[5]) / dur - @y = process[6] + fra * (process[8] - process[6]) / dur + @x = process[5] + (fra * (process[7] - process[5]) / dur) + @y = process[6] + (fra * (process[8] - process[6]) / dur) when Processes::Curve @x, @y = getCubicPoint2(process[5], fra.to_f / dur) when Processes::Z - @z = process[5] + fra * (process[6] - process[5]) / dur + @z = process[5] + (fra * (process[6] - process[5]) / dur) when Processes::Zoom - @zoom_x = process[5] + fra * (process[7] - process[5]) / dur - @zoom_y = process[6] + fra * (process[8] - process[6]) / dur + @zoom_x = process[5] + (fra * (process[7] - process[5]) / dur) + @zoom_y = process[6] + (fra * (process[8] - process[6]) / dur) when Processes::Angle - @angle = process[5] + fra * (process[6] - process[5]) / dur + @angle = process[5] + (fra * (process[6] - process[5]) / dur) when Processes::Tone - @tone.red = process[5].red + fra * (process[6].red - process[5].red) / dur - @tone.green = process[5].green + fra * (process[6].green - process[5].green) / dur - @tone.blue = process[5].blue + fra * (process[6].blue - process[5].blue) / dur - @tone.gray = process[5].gray + fra * (process[6].gray - process[5].gray) / dur + @tone.red = process[5].red + (fra * (process[6].red - process[5].red) / dur) + @tone.green = process[5].green + (fra * (process[6].green - process[5].green) / dur) + @tone.blue = process[5].blue + (fra * (process[6].blue - process[5].blue) / dur) + @tone.gray = process[5].gray + (fra * (process[6].gray - process[5].gray) / dur) when Processes::Color - @color.red = process[5].red + fra * (process[6].red - process[5].red) / dur - @color.green = process[5].green + fra * (process[6].green - process[5].green) / dur - @color.blue = process[5].blue + fra * (process[6].blue - process[5].blue) / dur - @color.alpha = process[5].alpha + fra * (process[6].alpha - process[5].alpha) / dur + @color.red = process[5].red + (fra * (process[6].red - process[5].red) / dur) + @color.green = process[5].green + (fra * (process[6].green - process[5].green) / dur) + @color.blue = process[5].blue + (fra * (process[6].blue - process[5].blue) / dur) + @color.alpha = process[5].alpha + (fra * (process[6].alpha - process[5].alpha) / dur) when Processes::Hue @hue = (process[6] - process[5]).to_f / dur when Processes::Opacity - @opacity = process[5] + fra * (process[6] - process[5]) / dur + @opacity = process[5] + (fra * (process[6] - process[5]) / dur) when Processes::Visible @visible = process[5] when Processes::BlendType diff --git a/Data/Scripts/005_Sprites/012_Interpolators.rb b/Data/Scripts/005_Sprites/012_Interpolators.rb index 174dd5c0d..cf929def4 100644 --- a/Data/Scripts/005_Sprites/012_Interpolators.rb +++ b/Data/Scripts/005_Sprites/012_Interpolators.rb @@ -51,26 +51,26 @@ class Interpolator def update if @tweening - t = (@step * 1.0) / @frames + t = @step.to_f / @frames for i in 0...@tweensteps.length item = @tweensteps[i] next if !item case i when ZOOM_X - @sprite.zoom_x = item[0] + item[1] * t + @sprite.zoom_x = item[0] + (item[1] * t) when ZOOM_Y - @sprite.zoom_y = item[0] + item[1] * t + @sprite.zoom_y = item[0] + (item[1] * t) when X - @sprite.x = item[0] + item[1] * t + @sprite.x = item[0] + (item[1] * t) when Y - @sprite.y = item[0] + item[1] * t + @sprite.y = item[0] + (item[1] * t) when OPACITY - @sprite.opacity = item[0] + item[1] * t + @sprite.opacity = item[0] + (item[1] * t) when COLOR - @sprite.color = Color.new(item[0].red + item[1].red * t, - item[0].green + item[1].green * t, - item[0].blue + item[1].blue * t, - item[0].alpha + item[1].alpha * t) + @sprite.color = Color.new(item[0].red + (item[1].red * t), + item[0].green + (item[1].green * t), + item[0].blue + (item[1].blue * t), + item[0].alpha + (item[1].alpha * t)) end end @step += 1 @@ -108,19 +108,19 @@ class RectInterpolator def update return if done? - t = (@curframe * 1.0 / @frames) + t = @curframe.to_f / @frames x1 = @oldrect.x x2 = @newrect.x - x = x1 + t * (x2 - x1) + x = x1 + (t * (x2 - x1)) y1 = @oldrect.y y2 = @newrect.y - y = y1 + t * (y2 - y1) + y = y1 + (t * (y2 - y1)) rx1 = @oldrect.x + @oldrect.width rx2 = @newrect.x + @newrect.width - rx = rx1 + t * (rx2 - rx1) + rx = rx1 + (t * (rx2 - rx1)) ry1 = @oldrect.y + @oldrect.height ry2 = @newrect.y + @newrect.height - ry = ry1 + t * (ry2 - ry1) + ry = ry1 + (t * (ry2 - ry1)) minx = x < rx ? x : rx maxx = x > rx ? x : rx miny = y < ry ? y : ry @@ -157,13 +157,13 @@ class PointInterpolator def update return if done? - t = (@curframe * 1.0 / @frames) + t = @curframe.to_f / @frames rx1 = @oldx rx2 = @newx - @x = rx1 + t * (rx2 - rx1) + @x = rx1 + (t * (rx2 - rx1)) ry1 = @oldy ry2 = @newy - @y = ry1 + t * (ry2 - ry1) + @y = ry1 + (t * (ry2 - ry1)) @curframe += 1 end end diff --git a/Data/Scripts/006_Map renderer/001_TilemapRenderer.rb b/Data/Scripts/006_Map renderer/001_TilemapRenderer.rb index 1da1aaf57..888975206 100644 --- a/Data/Scripts/006_Map renderer/001_TilemapRenderer.rb +++ b/Data/Scripts/006_Map renderer/001_TilemapRenderer.rb @@ -372,7 +372,7 @@ class TilemapRenderer if tile_id < true_tileset_start_id filename = "" if tile_id < TILESET_START_ID # Real autotiles - filename = map.autotile_names[tile_id / TILES_PER_AUTOTILE - 1] + filename = map.autotile_names[(tile_id / TILES_PER_AUTOTILE) - 1] elsif tile_id < single_autotile_start_id # Large extra autotiles filename = extra_autotile_arrays[0][(tile_id - TILESET_START_ID) / TILES_PER_AUTOTILE] else # Single extra autotiles @@ -406,8 +406,8 @@ class TilemapRenderer # x and y are the positions of tile within @tiles, not a map x/y def refresh_tile_coordinates(tile, x, y) - tile.x = x * DISPLAY_TILE_WIDTH - @pixel_offset_x - tile.y = y * DISPLAY_TILE_HEIGHT - @pixel_offset_y + tile.x = (x * DISPLAY_TILE_WIDTH) - @pixel_offset_x + tile.y = (y * DISPLAY_TILE_HEIGHT) - @pixel_offset_y end def refresh_tile_z(tile, map, y, layer, tile_id) @@ -417,7 +417,7 @@ class TilemapRenderer tile.z = 0 else priority = tile.priority - tile.z = (priority == 0) ? 0 : y * DISPLAY_TILE_HEIGHT + priority * 32 + 32 + tile.z = (priority == 0) ? 0 : (y * DISPLAY_TILE_HEIGHT) + (priority * 32) + 32 end end diff --git a/Data/Scripts/006_Map renderer/002_TilesetWrapper.rb b/Data/Scripts/006_Map renderer/002_TilesetWrapper.rb index 449b4c4f3..3a15224a8 100644 --- a/Data/Scripts/006_Map renderer/002_TilesetWrapper.rb +++ b/Data/Scripts/006_Map renderer/002_TilesetWrapper.rb @@ -23,7 +23,7 @@ class TilemapRenderer TILESET_WIDTH = SOURCE_TILE_WIDTH * TILESET_TILES_PER_ROW # Looks useless, but covers weird numbers given to mkxp.json or a funky driver MAX_TEX_SIZE = (Bitmap.max_size / 1024) * 1024 - MAX_TEX_SIZE_BOOSTED = MAX_TEX_SIZE**2 / TILESET_WIDTH + MAX_TEX_SIZE_BOOSTED = (MAX_TEX_SIZE**2) / TILESET_WIDTH module_function @@ -49,7 +49,7 @@ class TilemapRenderer def getWrappedRect(src_rect) ret = Rect.new(0, 0, 0, 0) col = (src_rect.y / MAX_TEX_SIZE.to_f).floor - ret.x = col * TILESET_WIDTH + src_rect.x.clamp(0, TILESET_WIDTH) + ret.x = (col * TILESET_WIDTH) + src_rect.x.clamp(0, TILESET_WIDTH) ret.y = src_rect.y % MAX_TEX_SIZE ret.width = src_rect.width.clamp(0, TILESET_WIDTH - src_rect.x) ret.height = src_rect.height.clamp(0, MAX_TEX_SIZE) @@ -70,8 +70,8 @@ class TilemapRenderer # FIXME: won't work on heights longer than two columns, but nobody should need # more than 32k pixels high at once anyway side = { - :a => MAX_TEX_SIZE - srcrect_mod.y, - :b => srcrect_mod.height - MAX_TEX_SIZE + srcrect_mod.y + :a => MAX_TEX_SIZE - srcrect_mod.y, + :b => srcrect_mod.height - MAX_TEX_SIZE + srcrect_mod.y } dest.blt(destX, destY, src, Rect.new(srcrect_mod.x, srcrect_mod.y, srcrect_mod.width, side[:a])) dest.blt(destX, destY + side[:a], src, Rect.new(srcrect_mod.x + TILESET_WIDTH, 0, srcrect_mod.width, side[:b])) diff --git a/Data/Scripts/006_Map renderer/003_AutotileExpander.rb b/Data/Scripts/006_Map renderer/003_AutotileExpander.rb index 337342c5e..731f9f6e6 100644 --- a/Data/Scripts/006_Map renderer/003_AutotileExpander.rb +++ b/Data/Scripts/006_Map renderer/003_AutotileExpander.rb @@ -36,11 +36,11 @@ class TilemapRenderer SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT)) when 2 # Top right corner new_bitmap.blt(dest_x, dest_y, bitmap, - Rect.new(SOURCE_TILE_WIDTH + frame * SOURCE_TILE_WIDTH * 3, SOURCE_TILE_HEIGHT * 4, + Rect.new(SOURCE_TILE_WIDTH + (frame * SOURCE_TILE_WIDTH * 3), SOURCE_TILE_HEIGHT * 4, SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT)) when 4 # Bottom right corner new_bitmap.blt(dest_x, dest_y, bitmap, - Rect.new(SOURCE_TILE_WIDTH + frame * SOURCE_TILE_WIDTH * 3, SOURCE_TILE_HEIGHT * 5, + Rect.new(SOURCE_TILE_WIDTH + (frame * SOURCE_TILE_WIDTH * 3), SOURCE_TILE_HEIGHT * 5, SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT)) when 8 # Bottom left corner new_bitmap.blt(dest_x, dest_y, bitmap, diff --git a/Data/Scripts/006_Map renderer/004_TileDrawingHelper.rb b/Data/Scripts/006_Map renderer/004_TileDrawingHelper.rb index 22b6a71b2..a2bb7e16a 100644 --- a/Data/Scripts/006_Map renderer/004_TileDrawingHelper.rb +++ b/Data/Scripts/006_Map renderer/004_TileDrawingHelper.rb @@ -89,7 +89,7 @@ class TileDrawingHelper def bltSmallAutotile(bitmap, x, y, cxTile, cyTile, id, frame) return if id >= 384 || frame < 0 || !@autotiles - autotile = @autotiles[id / 48 - 1] + autotile = @autotiles[(id / 48) - 1] return if !autotile || autotile.disposed? cxTile = [cxTile / 2, 1].max cyTile = [cyTile / 2, 1].max @@ -104,8 +104,8 @@ class TileDrawingHelper src = Rect.new(0, 0, 0, 0) for i in 0...4 tile_position = tiles[i] - 1 - src.set(tile_position % 6 * 16 + anim, tile_position / 6 * 16, 16, 16) - bitmap.stretch_blt(Rect.new(i % 2 * cxTile + x, i / 2 * cyTile + y, cxTile, cyTile), + src.set((tile_position % 6 * 16) + anim, tile_position / 6 * 16, 16, 16) + bitmap.stretch_blt(Rect.new((i % 2 * cxTile) + x, (i / 2 * cyTile) + y, cxTile, cyTile), autotile, src) end end @@ -180,9 +180,9 @@ def bltMinimapAutotile(dstBitmap, x, y, srcBitmap, id) src = Rect.new(0, 0, 0, 0) for i in 0...4 tile_position = tiles[i] - 1 - src.set(tile_position % 6 * cxTile + anim, + src.set((tile_position % 6 * cxTile) + anim, tile_position / 6 * cyTile, cxTile, cyTile) - dstBitmap.blt(i % 2 * cxTile + x, i / 2 * cyTile + y, srcBitmap, src) + dstBitmap.blt((i % 2 * cxTile) + x, (i / 2 * cyTile) + y, srcBitmap, src) end end diff --git a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb index 070457989..08171b21c 100644 --- a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb +++ b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb @@ -146,9 +146,10 @@ module MessageConfig def self.pbTryFonts(*args) for a in args next if !a - if a.is_a?(String) + case a + when String return a if Font.exist?(a) - elsif a.is_a?(Array) + when Array for aa in a ret = MessageConfig.pbTryFonts(aa) return ret if ret != "" @@ -177,7 +178,7 @@ end def pbBottomLeftLines(window, lines, width = nil) window.x = 0 window.width = width ? width : Graphics.width - window.height = (window.borderY rescue 32) + lines * 32 + window.height = (window.borderY rescue 32) + (lines * 32) window.y = Graphics.height - window.height end @@ -230,7 +231,7 @@ end # internal function def pbRepositionMessageWindow(msgwindow, linecount = 2) - msgwindow.height = 32 * linecount + msgwindow.borderY + msgwindow.height = (32 * linecount) + msgwindow.borderY msgwindow.y = (Graphics.height) - (msgwindow.height) if $game_system case $game_system.message_position @@ -278,10 +279,10 @@ def isDarkBackground(background, rect = nil) return true if rect.width <= 0 || rect.height <= 0 xSeg = (rect.width / 16) xLoop = (xSeg == 0) ? 1 : 16 - xStart = (xSeg == 0) ? rect.x + (rect.width / 2) : rect.x + xSeg / 2 + xStart = (xSeg == 0) ? rect.x + (rect.width / 2) : rect.x + (xSeg / 2) ySeg = (rect.height / 16) yLoop = (ySeg == 0) ? 1 : 16 - yStart = (ySeg == 0) ? rect.y + (rect.height / 2) : rect.y + ySeg / 2 + yStart = (ySeg == 0) ? rect.y + (rect.height / 2) : rect.y + (ySeg / 2) count = 0 y = yStart r = g = b = 0 @@ -303,7 +304,7 @@ def isDarkBackground(background, rect = nil) r /= count g /= count b /= count - return (r * 0.299 + g * 0.587 + b * 0.114) < 160 + return ((r * 0.299) + (g * 0.587) + (b * 0.114)) < 160 end def isDarkWindowskin(windowskin) @@ -316,7 +317,7 @@ def isDarkWindowskin(windowskin) return isDarkBackground(windowskin, Rect.new(32, 16, 16, 16)) else clr = windowskin.get_pixel(windowskin.width / 2, windowskin.height / 2) - return (clr.red * 0.299 + clr.green * 0.587 + clr.blue * 0.114) < 160 + return ((clr.red * 0.299) + (clr.green * 0.587) + (clr.blue * 0.114)) < 160 end end @@ -328,20 +329,20 @@ def getSkinColor(windowskin, color, isDarkSkin) windowskin.width != 128 || windowskin.height != 128 # Base color, shadow color (these are reversed on dark windowskins) textcolors = [ - "0070F8", "78B8E8", # 1 Blue - "E82010", "F8A8B8", # 2 Red - "60B048", "B0D090", # 3 Green - "48D8D8", "A8E0E0", # 4 Cyan - "D038B8", "E8A0E0", # 5 Magenta - "E8D020", "F8E888", # 6 Yellow - "A0A0A8", "D0D0D8", # 7 Grey - "F0F0F8", "C8C8D0", # 8 White - "9040E8", "B8A8E0", # 9 Purple - "F89818", "F8C898", # 10 Orange - colorToRgb32(MessageConfig::DARK_TEXT_MAIN_COLOR), - colorToRgb32(MessageConfig::DARK_TEXT_SHADOW_COLOR), # 11 Dark default - colorToRgb32(MessageConfig::LIGHT_TEXT_MAIN_COLOR), - colorToRgb32(MessageConfig::LIGHT_TEXT_SHADOW_COLOR) # 12 Light default + "0070F8", "78B8E8", # 1 Blue + "E82010", "F8A8B8", # 2 Red + "60B048", "B0D090", # 3 Green + "48D8D8", "A8E0E0", # 4 Cyan + "D038B8", "E8A0E0", # 5 Magenta + "E8D020", "F8E888", # 6 Yellow + "A0A0A8", "D0D0D8", # 7 Grey + "F0F0F8", "C8C8D0", # 8 White + "9040E8", "B8A8E0", # 9 Purple + "F89818", "F8C898", # 10 Orange + colorToRgb32(MessageConfig::DARK_TEXT_MAIN_COLOR), + colorToRgb32(MessageConfig::DARK_TEXT_SHADOW_COLOR), # 11 Dark default + colorToRgb32(MessageConfig::LIGHT_TEXT_MAIN_COLOR), + colorToRgb32(MessageConfig::LIGHT_TEXT_SHADOW_COLOR) # 12 Light default ] if color == 0 || color > textcolors.length / 2 # No special colour, use default if isDarkSkin # Dark background, light text @@ -352,14 +353,14 @@ def getSkinColor(windowskin, color, isDarkSkin) end # Special colour as listed above if isDarkSkin && color != 12 # Dark background, light text - return sprintf("", textcolors[2 * (color - 1) + 1], textcolors[2 * (color - 1)]) + return sprintf("", textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)]) end # Light background, dark text - return sprintf("", textcolors[2 * (color - 1)], textcolors[2 * (color - 1) + 1]) + return sprintf("", textcolors[2 * (color - 1)], textcolors[(2 * (color - 1)) + 1]) else # VX windowskin color = 0 if color >= 32 - x = 64 + (color % 8) * 8 - y = 96 + (color / 8) * 8 + x = 64 + ((color % 8) * 8) + y = 96 + ((color / 8) * 8) pixel = windowskin.get_pixel(x, y) return shadowctagFromColor(pixel) end @@ -441,10 +442,10 @@ def pbSrcOver(dstColor, srcColor) cg = dstColor.green * dstColor.alpha / 255 cb = dstColor.blue * dstColor.alpha / 255 ica = 255 - dstColor.alpha - a = 255 - (iea * ica) / 255 - r = (iea * cr) / 255 + er - g = (iea * cg) / 255 + eg - b = (iea * cb) / 255 + eb + a = 255 - ((iea * ica) / 255) + r = ((iea * cr) / 255) + er + g = ((iea * cg) / 255) + eg + b = ((iea * cb) / 255) + eb r = (a == 0) ? 0 : r * 255 / a g = (a == 0) ? 0 : g * 255 / a b = (a == 0) ? 0 : b * 255 / a diff --git a/Data/Scripts/007_Objects and windows/003_Window.rb b/Data/Scripts/007_Objects and windows/003_Window.rb index 77f1dadaa..4e1e24313 100644 --- a/Data/Scripts/007_Objects and windows/003_Window.rb +++ b/Data/Scripts/007_Objects and windows/003_Window.rb @@ -78,12 +78,12 @@ class Window def initialize(viewport = nil) @sprites = {} @spritekeys = [ - "back", - "corner0", "side0", "scroll0", - "corner1", "side1", "scroll1", - "corner2", "side2", "scroll2", - "corner3", "side3", "scroll3", - "cursor", "contents", "pause" + "back", + "corner0", "side0", "scroll0", + "corner1", "side1", "scroll1", + "corner2", "side2", "scroll2", + "corner3", "side3", "scroll3", + "cursor", "contents", "pause" ] @sidebitmaps = [nil, nil, nil, nil] @cursorbitmap = nil @@ -444,10 +444,10 @@ class Window cursorX = trimX cursorY = trimY + 64 sideRects = [ - Rect.new(trimX + 16, trimY + 0, 32, 16), - Rect.new(trimX, trimY + 16, 16, 32), - Rect.new(trimX + 48, trimY + 16, 16, 32), - Rect.new(trimX + 16, trimY + 48, 32, 16) + Rect.new(trimX + 16, trimY + 0, 32, 16), + Rect.new(trimX, trimY + 16, 16, 32), + Rect.new(trimX + 48, trimY + 16, 16, 32), + Rect.new(trimX + 16, trimY + 48, 32, 16) ] if @width > 32 && @height > 32 @sprites["contents"].src_rect.set(@ox, @oy, @width - 32, @height - 32) @@ -455,15 +455,15 @@ class Window @sprites["contents"].src_rect.set(0, 0, 0, 0) end pauseRects = [ - trimX + 32, trimY + 64, - trimX + 48, trimY + 64, - trimX + 32, trimY + 80, - trimX + 48, trimY + 80 + trimX + 32, trimY + 64, + trimX + 48, trimY + 64, + trimX + 32, trimY + 80, + trimX + 48, trimY + 80 ] pauseWidth = 16 pauseHeight = 16 @sprites["pause"].src_rect.set(pauseRects[@pauseframe * 2], - pauseRects[@pauseframe * 2 + 1], + pauseRects[(@pauseframe * 2) + 1], pauseWidth, pauseHeight) @sprites["pause"].x = @x + (@width / 2) - (pauseWidth / 2) @@ -486,13 +486,13 @@ class Window @sprites["side2"].y = @y + 16 @sprites["side3"].x = @x + 16 @sprites["side3"].y = @y + @height - 16 - @sprites["scroll0"].x = @x + @width / 2 - 8 + @sprites["scroll0"].x = @x + (@width / 2) - 8 @sprites["scroll0"].y = @y + 8 @sprites["scroll1"].x = @x + 8 - @sprites["scroll1"].y = @y + @height / 2 - 8 + @sprites["scroll1"].y = @y + (@height / 2) - 8 @sprites["scroll2"].x = @x + @width - 16 - @sprites["scroll2"].y = @y + @height / 2 - 8 - @sprites["scroll3"].x = @x + @width / 2 - 8 + @sprites["scroll2"].y = @y + (@height / 2) - 8 + @sprites["scroll3"].x = @x + (@width / 2) - 8 @sprites["scroll3"].y = @y + @height - 16 @sprites["back"].x = @x + 2 @sprites["back"].y = @y + 2 @@ -503,18 +503,18 @@ class Window height = @cursor_rect.height if width > 0 && height > 0 cursorrects = [ - # sides - Rect.new(cursorX + 2, cursorY + 0, 28, 2), - Rect.new(cursorX + 0, cursorY + 2, 2, 28), - Rect.new(cursorX + 30, cursorY + 2, 2, 28), - Rect.new(cursorX + 2, cursorY + 30, 28, 2), - # corners - Rect.new(cursorX + 0, cursorY + 0, 2, 2), - Rect.new(cursorX + 30, cursorY + 0, 2, 2), - Rect.new(cursorX + 0, cursorY + 30, 2, 2), - Rect.new(cursorX + 30, cursorY + 30, 2, 2), - # back - Rect.new(cursorX + 2, cursorY + 2, 28, 28) + # sides + Rect.new(cursorX + 2, cursorY + 0, 28, 2), + Rect.new(cursorX + 0, cursorY + 2, 2, 28), + Rect.new(cursorX + 30, cursorY + 2, 2, 28), + Rect.new(cursorX + 2, cursorY + 30, 28, 2), + # corners + Rect.new(cursorX + 0, cursorY + 0, 2, 2), + Rect.new(cursorX + 30, cursorY + 0, 2, 2), + Rect.new(cursorX + 0, cursorY + 30, 2, 2), + Rect.new(cursorX + 30, cursorY + 30, 2, 2), + # back + Rect.new(cursorX + 2, cursorY + 2, 28, 28) ] margin = 2 fullmargin = 4 @@ -575,7 +575,7 @@ class Window opn = @openness / 255.0 for k in @spritekeys sprite = @sprites[k] - ratio = (@height <= 0) ? 0 : (sprite.y - @y) * 1.0 / @height + ratio = (@height <= 0) ? 0 : (sprite.y - @y) / @height.to_f sprite.zoom_y = opn sprite.oy = 0 sprite.y = (@y + (@height / 2.0) + (@height * ratio * opn) - (@height / 2 * opn)).floor diff --git a/Data/Scripts/007_Objects and windows/004_SpriteWindow.rb b/Data/Scripts/007_Objects and windows/004_SpriteWindow.rb index b8fb9ed60..715870d4d 100644 --- a/Data/Scripts/007_Objects and windows/004_SpriteWindow.rb +++ b/Data/Scripts/007_Objects and windows/004_SpriteWindow.rb @@ -55,12 +55,12 @@ class SpriteWindow < Window def initialize(viewport = nil) @sprites = {} @spritekeys = [ - "back", - "corner0", "side0", "scroll0", - "corner1", "side1", "scroll1", - "corner2", "side2", "scroll2", - "corner3", "side3", "scroll3", - "cursor", "contents", "pause" + "back", + "corner0", "side0", "scroll0", + "corner1", "side1", "scroll1", + "corner2", "side2", "scroll2", + "corner3", "side3", "scroll3", + "cursor", "contents", "pause" ] @viewport = viewport @sidebitmaps = [nil, nil, nil, nil] @@ -578,25 +578,21 @@ class SpriteWindow < Window @sprites["scroll2"].src_rect.set(trimX + 40, trimY + 24, 8, 16) # right cursorX = trimX cursorY = trimY + 64 - sideRects = [ - Rect.new(trimX + 16, trimY + 0, 32, 16), - Rect.new(trimX, trimY + 16, 16, 32), - Rect.new(trimX + 48, trimY + 16, 16, 32), - Rect.new(trimX + 16, trimY + 48, 32, 16) - ] - pauseRects = [ - trimX + 32, trimY + 64, - trimX + 48, trimY + 64, - trimX + 32, trimY + 80, - trimX + 48, trimY + 80 - ] + sideRects = [Rect.new(trimX + 16, trimY + 0, 32, 16), + Rect.new(trimX, trimY + 16, 16, 32), + Rect.new(trimX + 48, trimY + 16, 16, 32), + Rect.new(trimX + 16, trimY + 48, 32, 16)] + pauseRects = [trimX + 32, trimY + 64, + trimX + 48, trimY + 64, + trimX + 32, trimY + 80, + trimX + 48, trimY + 80] pauseWidth = 16 pauseHeight = 16 @sprites["pause"].src_rect.set( - pauseRects[@pauseframe * 2], - pauseRects[@pauseframe * 2 + 1], - pauseWidth, pauseHeight - ) + pauseRects[@pauseframe * 2], + pauseRects[(@pauseframe * 2) + 1], + pauseWidth, pauseHeight + ) end else trimStartX = @trim[0] @@ -621,10 +617,10 @@ class SpriteWindow < Window backRect = Rect.new(@skinrect.x, @skinrect.y, @skinrect.width, @skinrect.height) blindsRect = nil sideRects = [ - Rect.new(startX, 0, @skinrect.width, startY), # side0 (top) - Rect.new(0, startY, startX, @skinrect.height), # side1 (left) - Rect.new(cx, startY, endX, @skinrect.height), # side2 (right) - Rect.new(startX, cy, @skinrect.width, endY) # side3 (bottom) + Rect.new(startX, 0, @skinrect.width, startY), # side0 (top) + Rect.new(0, startY, startX, @skinrect.height), # side1 (left) + Rect.new(cx, startY, endX, @skinrect.height), # side2 (right) + Rect.new(startX, cy, @skinrect.width, endY) # side3 (bottom) ] end end @@ -664,13 +660,13 @@ class SpriteWindow < Window @sprites["side2"].y = @y + startY @sprites["side3"].x = @x + startX @sprites["side3"].y = @y + @height - endY - @sprites["scroll0"].x = @x + @width / 2 - 8 + @sprites["scroll0"].x = @x + (@width / 2) - 8 @sprites["scroll0"].y = @y + 8 @sprites["scroll1"].x = @x + 8 - @sprites["scroll1"].y = @y + @height / 2 - 8 + @sprites["scroll1"].y = @y + (@height / 2) - 8 @sprites["scroll2"].x = @x + @width - 16 - @sprites["scroll2"].y = @y + @height / 2 - 8 - @sprites["scroll3"].x = @x + @width / 2 - 8 + @sprites["scroll2"].y = @y + (@height / 2) - 8 + @sprites["scroll3"].x = @x + (@width / 2) - 8 @sprites["scroll3"].y = @y + @height - 16 @sprites["cursor"].x = @x + startX + @cursor_rect.x @sprites["cursor"].y = @y + startY + @cursor_rect.y @@ -691,18 +687,18 @@ class SpriteWindow < Window height = @cursor_rect.height if width > 0 && height > 0 cursorrects = [ - # sides - Rect.new(cursorX + 2, cursorY + 0, 28, 2), - Rect.new(cursorX + 0, cursorY + 2, 2, 28), - Rect.new(cursorX + 30, cursorY + 2, 2, 28), - Rect.new(cursorX + 2, cursorY + 30, 28, 2), - # corners - Rect.new(cursorX + 0, cursorY + 0, 2, 2), - Rect.new(cursorX + 30, cursorY + 0, 2, 2), - Rect.new(cursorX + 0, cursorY + 30, 2, 2), - Rect.new(cursorX + 30, cursorY + 30, 2, 2), - # back - Rect.new(cursorX + 2, cursorY + 2, 28, 28) + # sides + Rect.new(cursorX + 2, cursorY + 0, 28, 2), + Rect.new(cursorX + 0, cursorY + 2, 2, 28), + Rect.new(cursorX + 30, cursorY + 2, 2, 28), + Rect.new(cursorX + 2, cursorY + 30, 28, 2), + # corners + Rect.new(cursorX + 0, cursorY + 0, 2, 2), + Rect.new(cursorX + 30, cursorY + 0, 2, 2), + Rect.new(cursorX + 0, cursorY + 30, 2, 2), + Rect.new(cursorX + 30, cursorY + 30, 2, 2), + # back + Rect.new(cursorX + 2, cursorY + 2, 28, 28) ] margin = 2 fullmargin = 4 @@ -789,7 +785,7 @@ class SpriteWindow < Window opn = @openness / 255.0 for k in @spritekeys sprite = @sprites[k] - ratio = (@height <= 0) ? 0 : (sprite.y - @y) * 1.0 / @height + ratio = (@height <= 0) ? 0 : (sprite.y - @y) / @height.to_f sprite.zoom_y = opn sprite.zoom_x = 1.0 sprite.oy = 0 @@ -845,8 +841,8 @@ class SpriteWindow_Base < SpriteWindow end def __setWindowskin(skin) - if skin && (skin.width == 192 && skin.height == 128) || # RPGXP Windowskin - (skin.width == 128 && skin.height == 128) # RPGVX Windowskin + if skin && ((skin.width == 192 && skin.height == 128) || # RPGXP Windowskin + (skin.width == 128 && skin.height == 128)) # RPGVX Windowskin self.skinformat = 0 else self.skinformat = 1 diff --git a/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb b/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb index 678725123..4ecd683b1 100644 --- a/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb +++ b/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb @@ -621,7 +621,7 @@ class Window_InputNumberPokemon < SpriteWindow_Base @sign = false @negative = false super(0, 0, 32, 32) - self.width = digits_max * 24 + 8 + self.borderX + self.width = (digits_max * 24) + 8 + self.borderX self.height = 32 + self.borderY colors = getDefaultTextColors(self.windowskin) @baseColor = colors[0] @@ -644,16 +644,16 @@ class Window_InputNumberPokemon < SpriteWindow_Base value = 0 if !value.is_a?(Numeric) if @sign @negative = (value < 0) - @number = [value.abs, 10**@digits_max - 1].min + @number = [value.abs, (10**@digits_max) - 1].min else - @number = [[value, 0].max, 10**@digits_max - 1].min + @number = [[value, 0].max, (10**@digits_max) - 1].min end refresh end def sign=(value) @sign = value - self.width = @digits_max * 24 + 8 + self.borderX + (@sign ? 24 : 0) + self.width = (@digits_max * 24) + 8 + self.borderX + (@sign ? 24 : 0) @index = (@digits_max - 1) + (@sign ? 1 : 0) refresh end @@ -717,9 +717,9 @@ class Window_InputNumberPokemon < SpriteWindow_Base def textHelper(x, y, text, i) textwidth = self.contents.text_size(text).width - pbDrawShadowText(self.contents, x + (12 - textwidth / 2), y, textwidth + 4, 32, text, @baseColor, @shadowColor) + pbDrawShadowText(self.contents, x + (12 - (textwidth / 2)), y, textwidth + 4, 32, text, @baseColor, @shadowColor) if @index == i && @active && @frame / 15 == 0 - self.contents.fill_rect(x + (12 - textwidth / 2), y + 30, textwidth, 2, @baseColor) + self.contents.fill_rect(x + (12 - (textwidth / 2)), y + 30, textwidth, 2, @baseColor) end end end @@ -825,9 +825,9 @@ class SpriteWindow_Selectable < SpriteWindow_Base item > self.top_item + self.page_item_max return Rect.new(0, 0, 0, 0) else - cursor_width = (self.width - self.borderX - (@column_max - 1) * @column_spacing) / @column_max + cursor_width = (self.width - self.borderX - ((@column_max - 1) * @column_spacing)) / @column_max x = item % @column_max * (cursor_width + @column_spacing) - y = item / @column_max * @row_height - @virtualOy + y = (item / @column_max * @row_height) - @virtualOy return Rect.new(x, y, cursor_width, @row_height) end end @@ -946,7 +946,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base # End of code cursor_width = (self.width - self.borderX) / @column_max x = self.index % @column_max * (cursor_width + @column_spacing) - y = self.index / @column_max * @row_height - @virtualOy + y = (self.index / @column_max * @row_height) - @virtualOy self.cursor_rect.set(x, y, cursor_width, @row_height) self.refresh if dorefresh || force end @@ -992,8 +992,8 @@ module UpDownArrowMixin def adjustForZoom(sprite) sprite.zoom_x = self.zoom_x sprite.zoom_y = self.zoom_y - sprite.x = sprite.x * self.zoom_x + self.offset_x / self.zoom_x - sprite.y = sprite.y * self.zoom_y + self.offset_y / self.zoom_y + sprite.x = (sprite.x * self.zoom_x) + (self.offset_x / self.zoom_x) + sprite.y = (sprite.y * self.zoom_y) + (self.offset_y / self.zoom_y) end def update @@ -1093,7 +1093,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx end # Store suggested width and height of window dims[0] = [self.borderX + 1, - (width * self.columns) + self.borderX + (self.columns - 1) * self.columnSpacing].max + (width * self.columns) + self.borderX + ((self.columns - 1) * self.columnSpacing)].max dims[1] = [self.borderY + 1, windowheight].max dims[1] = [dims[1], Graphics.height].min end diff --git a/Data/Scripts/007_Objects and windows/006_SpriteWindow_pictures.rb b/Data/Scripts/007_Objects and windows/006_SpriteWindow_pictures.rb index 01e7a7298..2d3920180 100644 --- a/Data/Scripts/007_Objects and windows/006_SpriteWindow_pictures.rb +++ b/Data/Scripts/007_Objects and windows/006_SpriteWindow_pictures.rb @@ -94,12 +94,13 @@ class PictureWindow < SpriteWindow_Base def setBitmap(pathOrBitmap, hue = 0) clearBitmaps if pathOrBitmap != nil && pathOrBitmap != "" - if pathOrBitmap.is_a?(Bitmap) + case pathOrBitmap + when Bitmap @_iconbitmap = pathOrBitmap self.contents = @_iconbitmap self.width = @_iconbitmap.width + self.borderX self.height = @_iconbitmap.height + self.borderY - elsif pathOrBitmap.is_a?(AnimatedBitmap) + when AnimatedBitmap @_iconbitmap = pathOrBitmap self.contents = @_iconbitmap.bitmap self.width = @_iconbitmap.bitmap.width + self.borderX diff --git a/Data/Scripts/007_Objects and windows/010_DrawText.rb b/Data/Scripts/007_Objects and windows/010_DrawText.rb index 4f55f5bcc..345d77dbd 100644 --- a/Data/Scripts/007_Objects and windows/010_DrawText.rb +++ b/Data/Scripts/007_Objects and windows/010_DrawText.rb @@ -48,35 +48,35 @@ def rgbToColor(param) case param.length when 8 # 32-bit hex return Color.new( - (baseint >> 24) & 0xFF, - (baseint >> 16) & 0xFF, - (baseint >> 8) & 0xFF, - (baseint) & 0xFF + (baseint >> 24) & 0xFF, + (baseint >> 16) & 0xFF, + (baseint >> 8) & 0xFF, + (baseint) & 0xFF ) when 6 # 24-bit hex return Color.new( - (baseint >> 16) & 0xFF, - (baseint >> 8) & 0xFF, - (baseint) & 0xFF + (baseint >> 16) & 0xFF, + (baseint >> 8) & 0xFF, + (baseint) & 0xFF ) when 4 # 16-bit hex return Color.new( - ((baseint) & 0x1F) << 3, - ((baseint >> 5) & 0x1F) << 3, - ((baseint >> 10) & 0x1F) << 3 + ((baseint) & 0x1F) << 3, + ((baseint >> 5) & 0x1F) << 3, + ((baseint >> 10) & 0x1F) << 3 ) when 1 # Color number i = param.to_i return Font.default_color if i >= 8 return [ - Color.new(255, 255, 255, 255), - Color.new(128, 128, 255, 255), - Color.new(255, 128, 128, 255), - Color.new(128, 255, 128, 255), - Color.new(128, 255, 255, 255), - Color.new(255, 128, 255, 255), - Color.new(255, 255, 128, 255), - Color.new(192, 192, 192, 255) + Color.new(255, 255, 255, 255), + Color.new(128, 128, 255, 255), + Color.new(255, 128, 128, 255), + Color.new(128, 255, 128, 255), + Color.new(128, 255, 255, 255), + Color.new(255, 128, 255, 255), + Color.new(255, 255, 128, 255), + Color.new(192, 192, 192, 255) ][i] else return Font.default_color @@ -86,9 +86,9 @@ end def Rgb16ToColor(param) baseint = param.to_i(16) return Color.new( - ((baseint) & 0x1F) << 3, - ((baseint >> 5) & 0x1F) << 3, - ((baseint >> 10) & 0x1F) << 3 + ((baseint) & 0x1F) << 3, + ((baseint >> 5) & 0x1F) << 3, + ((baseint >> 10) & 0x1F) << 3 ) end @@ -98,9 +98,9 @@ def getContrastColor(color) g = color.green b = color.blue yuv = [ - r * 0.299 + g * 0.587 + b * 0.114, - r * -0.1687 + g * -0.3313 + b * 0.500 + 0.5, - r * 0.500 + g * -0.4187 + b * -0.0813 + 0.5 + (r * 0.299) + (g * 0.587) + (b * 0.114), + (r * -0.1687) + (g * -0.3313) + (b * 0.500) + 0.5, + (r * 0.500) + (g * -0.4187) + (b * -0.0813) + 0.5 ] if yuv[0] < 127.5 yuv[0] += (255 - yuv[0]) / 2 @@ -108,10 +108,10 @@ def getContrastColor(color) yuv[0] = yuv[0] / 2 end return Color.new( - yuv[0] + 1.4075 * (yuv[2] - 0.5), - yuv[0] - 0.3455 * (yuv[1] - 0.5) - 0.7169 * (yuv[2] - 0.5), - yuv[0] + 1.7790 * (yuv[1] - 0.5), - color.alpha + yuv[0] + (1.4075 * (yuv[2] - 0.5)), + yuv[0] - (0.3455 * (yuv[1] - 0.5)) - (0.7169 * (yuv[2] - 0.5)), + yuv[0] + (1.7790 * (yuv[1] - 0.5)), + color.alpha ) end @@ -198,7 +198,7 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig if textchars[position] == "\n" if newlineBreaks # treat newline as break havenl = true - characters.push(["\n", x, y * lineheight + yDst, 0, lineheight, false, false, + characters.push(["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false, false, colorclone, nil, false, false, "", 8, position, nil, 0]) y += 1 x = 0 @@ -224,18 +224,16 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig # Push character if heightDst < 0 || yStart < yDst + heightDst havenl = true if isWaitChar(textchars[position]) - characters.push([ - textchars[position], - x + xStart, texty, width + 2, lineheight, - false, bold, italic, colorclone, nil, false, false, - defaultfontname, bitmap.font.size, position, nil, 0 - ]) + characters.push([textchars[position], + x + xStart, texty, width + 2, lineheight, + false, bold, italic, colorclone, nil, false, false, + defaultfontname, bitmap.font.size, position, nil, 0]) end x += width if !explicitBreaksOnly && x + 2 > widthDst && lastword[1] != 0 && (!hadnonspace || !hadspace) havenl = true - characters.insert(lastword[0], ["\n", x, y * lineheight + yDst, 0, lineheight, + characters.insert(lastword[0], ["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false, false, colorclone, nil, false, false, "", 8, position]) lastword[0] += 1 y += 1 @@ -626,7 +624,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = end nextline.times do havenl = true - characters.push(["\n", x, y * lineheight + yDst, 0, lineheight, false, false, false, + characters.push(["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false, false, defaultcolors[0], defaultcolors[1], false, false, "", 8, position, nil, 0]) charactersInternal.push([alignment, y, 0]) y += 1 @@ -640,7 +638,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = if newlineBreaks if nextline == 0 havenl = true - characters.push(["\n", x, y * lineheight + yDst, 0, lineheight, false, false, false, + characters.push(["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false, false, defaultcolors[0], defaultcolors[1], false, false, "", 8, position, nil, 0]) charactersInternal.push([alignment, y, 0]) y += 1 @@ -675,22 +673,20 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = if heightDst < 0 || texty < yDst + heightDst havenl = true if !graphic && isWaitChar(textchars[position]) extraspace = (!graphic && italiccount > 0) ? 2 + (width / 2) : 2 - characters.push([ - graphic || textchars[position], - x + xStart, texty, width + extraspace, lineheight, - graphic ? true : false, - (boldcount > 0), (italiccount > 0), colors[0], colors[1], - (underlinecount > 0), (strikecount > 0), fontname, fontsize, - position, graphicRect, - ((outlinecount > 0) ? 1 : 0) + ((outline2count > 0) ? 2 : 0) - ]) + characters.push([graphic || textchars[position], + x + xStart, texty, width + extraspace, lineheight, + graphic ? true : false, + (boldcount > 0), (italiccount > 0), colors[0], colors[1], + (underlinecount > 0), (strikecount > 0), fontname, fontsize, + position, graphicRect, + ((outlinecount > 0) ? 1 : 0) + ((outline2count > 0) ? 2 : 0)]) charactersInternal.push([alignment, y, xStart, textchars[position], extraspace]) end x += width if !explicitBreaksOnly && x + 2 > widthDst && lastword[1] != 0 && (!hadnonspace || !hadspace) havenl = true - characters.insert(lastword[0], ["\n", x, y * lineheight + yDst, 0, lineheight, + characters.insert(lastword[0], ["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false, false, defaultcolors[0], defaultcolors[1], false, false, "", 8, position, nil]) @@ -1045,8 +1041,8 @@ def drawSingleFormattedChar(bitmap, ch) end bitmap.font.color = ch[8] if bitmap.font.color != ch[8] bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0]) - else - bitmap.font.color = ch[8] if bitmap.font.color != ch[8] + elsif bitmap.font.color != ch[8] + bitmap.font.color = ch[8] end if ch[10] # underline bitmap.fill_rect(ch[1], ch[2] + ch[4] - 4 - [(ch[4] - bitmap.font.size) / 2, 0].max - 2, diff --git a/Data/Scripts/007_Objects and windows/011_Messages.rb b/Data/Scripts/007_Objects and windows/011_Messages.rb index af7670d1e..9fbf3b0e1 100644 --- a/Data/Scripts/007_Objects and windows/011_Messages.rb +++ b/Data/Scripts/007_Objects and windows/011_Messages.rb @@ -224,10 +224,9 @@ class FaceWindowVX < SpriteWindow_Base @faceIndex = faceinfo[1].to_i @facebitmaptmp = AnimatedBitmap.new(facefile) @facebitmap = BitmapWrapper.new(96, 96) - @facebitmap.blt(0, 0, @facebitmaptmp.bitmap, Rect.new( - (@faceIndex % 4) * 96, - (@faceIndex / 4) * 96, 96, 96 - )) + @facebitmap.blt(0, 0, @facebitmaptmp.bitmap, + Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96) + ) self.contents = @facebitmap end @@ -235,10 +234,9 @@ class FaceWindowVX < SpriteWindow_Base super if @facebitmaptmp.totalFrames > 1 @facebitmaptmp.update - @facebitmap.blt(0, 0, @facebitmaptmp.bitmap, Rect.new( - (@faceIndex % 4) * 96, - (@faceIndex / 4) * 96, 96, 96 - )) + @facebitmap.blt(0, 0, @facebitmaptmp.bitmap, + Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96) + ) end end @@ -581,7 +579,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni if atTop msgwindow.y = -msgwindow.height * signWaitCount / signWaitTime else - msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime + msgwindow.y = Graphics.height - (msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime) end end for i in 0...controls.length @@ -627,7 +625,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni msgwindow.y = Graphics.height - msgwindow.height msgback.y = msgwindow.y if msgback pbPositionNearMsgWindow(facewindow, msgwindow, :left) - msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime + msgwindow.y = Graphics.height - (msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime) when "ts" # Change text speed msgwindow.textspeed = (param == "") ? -999 : param.to_i when "." # Wait 0.25 seconds @@ -662,8 +660,8 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni if msgwindow.busy? pbPlayDecisionSE if msgwindow.pausing? msgwindow.resume - else - break if signWaitCount == 0 + elsif signWaitCount == 0 + break end end pbUpdateSceneMap @@ -692,7 +690,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni if atTop msgwindow.y = -msgwindow.height * i / signWaitTime else - msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - i) / signWaitTime + msgwindow.y = Graphics.height - (msgwindow.height * (signWaitTime - i) / signWaitTime) end Graphics.update Input.update diff --git a/Data/Scripts/007_Objects and windows/012_TextEntry.rb b/Data/Scripts/007_Objects and windows/012_TextEntry.rb index 7ba64d173..132f78cb3 100644 --- a/Data/Scripts/007_Objects and windows/012_TextEntry.rb +++ b/Data/Scripts/007_Objects and windows/012_TextEntry.rb @@ -453,10 +453,7 @@ class Window_MultilineTextEntry < SpriteWindow_Base totalColumns = getColumnsInLine(@cursorLine) @cursorColumn = totalColumns if @cursorColumn > totalColumns @cursorColumn = 0 if @cursorColumn < 0 # totalColumns can be 0 - updateCursorPos( - oldCursorLine != @cursorLine || - oldCursorColumn != @cursorColumn - ) + updateCursorPos(oldCursorLine != @cursorLine || oldCursorColumn != @cursorColumn) # echoln ["aftermoving",@cursorLine,@cursorColumn] end diff --git a/Data/Scripts/008_Audio/001_Audio.rb b/Data/Scripts/008_Audio/001_Audio.rb index 0080bc8ca..7de205ef7 100644 --- a/Data/Scripts/008_Audio/001_Audio.rb +++ b/Data/Scripts/008_Audio/001_Audio.rb @@ -128,7 +128,7 @@ def getPlayTime2(filename) data = fgetdw.call(file) return -1 if data != 0x61746164 # "data" datasize = fgetdw.call(file) - time = (datasize * 1.0) / bytessec + time = datasize.to_f / bytessec return time when 0x5367674F # "OggS" file.pos = 0 diff --git a/Data/Scripts/009_Scenes/001_Transitions.rb b/Data/Scripts/009_Scenes/001_Transitions.rb index cf4a6d5e2..aba221c76 100644 --- a/Data/Scripts/009_Scenes/001_Transitions.rb +++ b/Data/Scripts/009_Scenes/001_Transitions.rb @@ -178,7 +178,7 @@ module Transitions sprite_height = @overworld_bitmap.height / NUM_SPRITES_Y for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i @sprites[idx_sprite] = new_sprite(i * sprite_width, j * sprite_height, @overworld_bitmap) @sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height) end @@ -189,7 +189,7 @@ module Transitions @start_y = [] for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i @start_y[idx_sprite] = @sprites[idx_sprite].y @timings[idx_sprite] = 0.5 + rand end @@ -199,7 +199,7 @@ module Transitions def update_anim proportion = @timer / @duration @sprites.each_with_index do |sprite, i| - sprite.y = @start_y[i] + Graphics.height * @timings[i] * proportion * proportion + sprite.y = @start_y[i] + (Graphics.height * @timings[i] * proportion * proportion) sprite.opacity = 255 * (1 - proportion) end end @@ -219,7 +219,7 @@ module Transitions sprite_height = @overworld_bitmap.height / NUM_SPRITES_Y for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i @sprites[idx_sprite] = new_sprite((i + 0.5) * sprite_width, (j + 0.5) * sprite_height, @overworld_bitmap, sprite_width / 2, sprite_height / 2) @sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height) @@ -230,10 +230,10 @@ module Transitions def update_anim proportion = @timer / @duration @sprites.each_with_index do |sprite, i| - sprite.zoom_x = 1.0 * (1 - proportion) + sprite.zoom_x = (1 - proportion).to_f sprite.zoom_y = sprite.zoom_x if @parameters[0] # Rotation - direction = (1 - 2 * ((i / NUM_SPRITES_X + i % NUM_SPRITES_X) % 2)) + direction = (1 - (2 * (((i / NUM_SPRITES_X) + (i % NUM_SPRITES_X)) % 2))) sprite.angle = direction * 360 * 2 * proportion end end @@ -258,7 +258,7 @@ module Transitions sprite_height = @overworld_bitmap.height / NUM_SPRITES_Y for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i @sprites[idx_sprite] = new_sprite((i + 0.5) * sprite_width, (j + 0.5) * sprite_height, @overworld_bitmap, sprite_width / 2, sprite_height / 2) @sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height) @@ -272,17 +272,17 @@ module Transitions vague = (@parameters[0] || 9.6) * SPEED for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i spr = @sprites[idx_sprite] @start_positions[idx_sprite] = [spr.x, spr.y] - dx = spr.x - Graphics.width / 2 - dy = spr.y - Graphics.height / 2 + dx = spr.x - (Graphics.width / 2) + dy = spr.y - (Graphics.height / 2) move_x = move_y = 0 if dx == 0 && dy == 0 move_x = (dx == 0) ? rand_sign * vague : dx * SPEED * 1.5 move_y = (dy == 0) ? rand_sign * vague : dy * SPEED * 1.5 else - radius = Math.sqrt(dx**2 + dy**2) + radius = Math.sqrt((dx**2) + (dy**2)) move_x = dx * vague / radius move_y = dy * vague / radius end @@ -296,8 +296,8 @@ module Transitions def update_anim proportion = @timer / @duration @sprites.each_with_index do |sprite, i| - sprite.x = @start_positions[i][0] + @move_vectors[i][0] * proportion - sprite.y = @start_positions[i][1] + @move_vectors[i][1] * proportion + sprite.x = @start_positions[i][0] + (@move_vectors[i][0] * proportion) + sprite.y = @start_positions[i][1] + (@move_vectors[i][1] * proportion) sprite.opacity = 384 * (1 - proportion) end end @@ -331,7 +331,7 @@ module Transitions end for j in 0...num_stripes_y for i in 0...num_stripes_x - idx_sprite = j * num_stripes_x + i + idx_sprite = (j * num_stripes_x) + i @sprites[idx_sprite] = new_sprite(i * sprite_width, j * sprite_height, @overworld_bitmap) @sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height) end @@ -367,7 +367,7 @@ module Transitions def update_anim proportion = @timer / @duration - @overworld_sprite.zoom_x = 1.0 + 7.0 * proportion + @overworld_sprite.zoom_x = 1 + (7 * proportion) @overworld_sprite.zoom_y = @overworld_sprite.zoom_x @overworld_sprite.opacity = 255 * (1 - proportion) end @@ -410,7 +410,7 @@ module Transitions def update_anim proportion = @timer / @duration - inv_proportion = 1 / (1 + proportion * (MAX_PIXELLATION_FACTOR - 1)) + inv_proportion = 1 / (1 + (proportion * (MAX_PIXELLATION_FACTOR - 1))) new_size_rect = Rect.new(0, 0, @overworld_bitmap.width * inv_proportion, @overworld_bitmap.height * inv_proportion) # Take all of buffer_original, shrink it and put it into buffer_temp @@ -420,7 +420,7 @@ module Transitions @overworld_bitmap.stretch_blt(Rect.new(0, 0, @overworld_bitmap.width, @overworld_bitmap.height), @buffer_temp, new_size_rect) if @timer >= @start_black_fade - @overworld_sprite.opacity = 255 * (1 - (@timer - @start_black_fade) / (@duration - @start_black_fade)) + @overworld_sprite.opacity = 255 * (1 - ((@timer - @start_black_fade) / (@duration - @start_black_fade))) end end end @@ -466,7 +466,7 @@ module Transitions def initialize_sprites for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i if idx_sprite >= TOTAL_SPRITES / 2 sprite_x = ((j.odd?) ? i : (NUM_SPRITES_X - i - 1)) * @black_bitmap.width else @@ -485,7 +485,7 @@ module Transitions time_between_zooms = (@duration - TIME_TO_ZOOM) * 2 / (TOTAL_SPRITES - 1) for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i idx_from_start = (idx_sprite >= TOTAL_SPRITES / 2) ? TOTAL_SPRITES - 1 - idx_sprite : idx_sprite @timings[idx_sprite] = time_between_zooms * idx_from_start end @@ -534,9 +534,9 @@ module Transitions def initialize_sprites for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i - @sprites[idx_sprite] = new_sprite((i * @bitmap.width + @bitmap.width / 2) * @zoom_x_target, - (j * @bitmap.height + @bitmap.height / 2) * @zoom_y_target, + idx_sprite = (j * NUM_SPRITES_X) + i + @sprites[idx_sprite] = new_sprite(((i * @bitmap.width) + (@bitmap.width / 2)) * @zoom_x_target, + ((j * @bitmap.height) + (@bitmap.height / 2)) * @zoom_y_target, @bitmap, @bitmap.width / 2, @bitmap.height / 2) @sprites[idx_sprite].visible = false end @@ -546,16 +546,16 @@ module Transitions def set_up_timings for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_from_start = j * NUM_SPRITES_X + i # Top left -> bottom right + idx_from_start = (j * NUM_SPRITES_X) + i # Top left -> bottom right case @parameters[0] # Origin when 1 # Top right -> bottom left - idx_from_start = j * NUM_SPRITES_X + NUM_SPRITES_X - i - 1 + idx_from_start = (j * NUM_SPRITES_X) + NUM_SPRITES_X - i - 1 when 2 # Bottom left -> top right - idx_from_start = TOTAL_SPRITES - 1 - (j * NUM_SPRITES_X + NUM_SPRITES_X - i - 1) + idx_from_start = TOTAL_SPRITES - 1 - ((j * NUM_SPRITES_X) + NUM_SPRITES_X - i - 1) when 3 # Bottom right -> top left idx_from_start = TOTAL_SPRITES - 1 - idx_from_start end - dist = i + j.to_f * (NUM_SPRITES_X - 1) / (NUM_SPRITES_Y - 1) + dist = i + (j.to_f * (NUM_SPRITES_X - 1) / (NUM_SPRITES_Y - 1)) @timings[idx_from_start] = (dist / ((NUM_SPRITES_X - 1) * 2)) * (@duration - TIME_TO_ZOOM) end end @@ -641,16 +641,16 @@ module Transitions # Make overworld wave strips oscillate amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds @sprites.each_with_index do |sprite, i| - sprite.x = amplitude * Math.sin(@timer * WAVE_SPEED + i * WAVE_SPACING) + sprite.x = amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING)) end # Move bubbles sprite up and oscillate side to side @bubbles_sprite.x = (Graphics.width - @bubble_bitmap.width) / 2 @bubbles_sprite.x += MAX_BUBBLE_AMPLITUDE * Math.sin(@timer * BUBBLES_WAVE_SPEED) - @bubbles_sprite.y = Graphics.height * (1 - @timer * 1.2) + @bubbles_sprite.y = Graphics.height * (1 - (@timer * 1.2)) # Move splash sprite up if @timer >= @splash_rising_start proportion = (@timer - @splash_rising_start) / (@duration - @splash_rising_start) - @splash_sprite.y = Graphics.height * (1 - proportion * 2) + @splash_sprite.y = Graphics.height * (1 - (proportion * 2)) end # Move black sprite up if @timer >= @black_rising_start @@ -680,15 +680,15 @@ module Transitions # Balls that roll across the screen @ball_sprites = [] for i in 0...2 - x = (1 - i) * Graphics.width + (1 - i * 2) * @ball_bitmap.width / 2 - y = (Graphics.height + (i * 2 - 1) * @ball_bitmap.width) / 2 + x = ((1 - i) * Graphics.width) + ((1 - (i * 2)) * @ball_bitmap.width / 2) + y = (Graphics.height + (((i * 2) - 1) * @ball_bitmap.width)) / 2 @ball_sprites[i] = new_sprite(x, y, @ball_bitmap, @ball_bitmap.width / 2, @ball_bitmap.height / 2) @ball_sprites[i].z = 2 end # Black foreground sprites for i in 0...2 - @sprites[i] = new_sprite((1 - i * 2) * Graphics.width, i * Graphics.height / 2, @black_bitmap) + @sprites[i] = new_sprite((1 - (i * 2)) * Graphics.width, i * Graphics.height / 2, @black_bitmap) @sprites[i].z = 1 end @sprites[2] = new_sprite(0, Graphics.height / 2, @black_bitmap, 0, @black_bitmap.height / 2) @@ -718,8 +718,8 @@ module Transitions proportion = @timer / @ball_roll_end total_distance = Graphics.width + @ball_bitmap.width @ball_sprites.each_with_index do |sprite, i| - sprite.x = @ball_start_x[i] + (2 * i - 1) * (total_distance * proportion) - sprite.angle = (2 * i - 1) * 360 * proportion * 2 + sprite.x = @ball_start_x[i] + (((2 * i) - 1) * (total_distance * proportion)) + sprite.angle = ((2 * i) - 1) * 360 * proportion * 2 end else proportion = (@timer - @ball_roll_end) / (@duration - @ball_roll_end) @@ -728,11 +728,11 @@ module Transitions @ball_sprites.each { |s| s.visible = false } end # Zoom in overworld sprite - @overworld_sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom + @overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom @overworld_sprite.zoom_y = @overworld_sprite.zoom_x # Slide first two black bars across - @sprites[0].x = Graphics.width * (1 - proportion * proportion) - @sprites[1].x = Graphics.width * (proportion * proportion - 1) + @sprites[0].x = Graphics.width * (1 - (proportion * proportion)) + @sprites[1].x = Graphics.width * ((proportion * proportion) - 1) # Expand third black bar @sprites[2].zoom_y = 2.0 * proportion * proportion # Ends at 2x zoom end @@ -820,10 +820,10 @@ module Transitions # Split overworld/ball apart, move blackness in following them proportion = (@timer - @slide_start) / (@duration - @slide_start) @overworld_sprites.each_with_index do |sprite, i| - sprite.x = (0.5 + (i * 2 - 1) * proportion * proportion) * Graphics.width - sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom + sprite.x = (0.5 + (((i * 2) - 1) * proportion * proportion)) * Graphics.width + sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom sprite.zoom_y = sprite.zoom_x - @black_sprites[i].x = sprite.x + (1 - i * 2) * Graphics.width / 2 + @black_sprites[i].x = sprite.x + ((1 - (i * 2)) * Graphics.width / 2) @ball_sprites[i].x = sprite.x end end @@ -859,7 +859,7 @@ module Transitions # Black squares for j in 0...NUM_SPRITES_Y for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i + idx_sprite = (j * NUM_SPRITES_X) + i @sprites[idx_sprite] = new_sprite(i * @black_bitmap.width * @zoom_x_target, j * @black_bitmap.height * @zoom_y_target, @black_bitmap) @sprites[idx_sprite].visible = false @@ -868,7 +868,7 @@ module Transitions # Falling balls @ball_sprites = [] for i in 0...3 - @ball_sprites[i] = new_sprite(Graphics.width / 2 + (i - 1) * 160, + @ball_sprites[i] = new_sprite((Graphics.width / 2) + ((i - 1) * 160), -@ball_bitmap.height - BALL_START_Y_OFFSETS[i], @ball_bitmap, @ball_bitmap.width / 2, @ball_bitmap.height / 2) @ball_sprites[i].z = 2 @@ -882,8 +882,8 @@ module Transitions for j in 0...NUM_SPRITES_Y row_offset = NUM_SPRITES_Y - j - 1 for i in 0...NUM_SPRITES_X - idx_sprite = j * NUM_SPRITES_X + i - @timings[idx_sprite] = period * (row_offset * NUM_SPRITES_X + appear_order[i]) / TOTAL_SPRITES + idx_sprite = (j * NUM_SPRITES_X) + i + @timings[idx_sprite] = period * ((row_offset * NUM_SPRITES_X) + appear_order[i]) / TOTAL_SPRITES @timings[idx_sprite] += @black_appear_start end end @@ -906,7 +906,7 @@ module Transitions proportion = @timer / @black_appear_start @ball_sprites.each_with_index do |sprite, i| sprite.y = -@ball_bitmap.height - BALL_START_Y_OFFSETS[i] - sprite.y += (Graphics.height + BALL_START_Y_OFFSETS.max + @ball_bitmap.height * 2) * proportion + sprite.y += (Graphics.height + BALL_START_Y_OFFSETS.max + (@ball_bitmap.height * 2)) * proportion sprite.angle = 1.5 * 360 * proportion * ([1, -1][(i == 2) ? 0 : 1]) end else @@ -921,7 +921,7 @@ module Transitions end # Zoom in overworld sprite proportion = (@timer - @black_appear_start) / (@duration - @black_appear_start) - @overworld_sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom + @overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom @overworld_sprite.zoom_y = @overworld_sprite.zoom_x end end @@ -977,7 +977,7 @@ module Transitions if @timer <= @ball_appear_end # Make ball drop down and zoom in proportion = @timer / @ball_appear_end - @ball_sprite.y = -@ball_bitmap.height / 2 + (Graphics.height + @ball_bitmap.height * 3) * proportion * proportion + @ball_sprite.y = (-@ball_bitmap.height / 2) + ((Graphics.height + (@ball_bitmap.height * 3)) * proportion * proportion) @ball_sprite.angle = -1.5 * 360 * proportion @ball_sprite.zoom_x = 3 * proportion * proportion @ball_sprite.zoom_y = @ball_sprite.zoom_x @@ -986,10 +986,10 @@ module Transitions # Black curve and blackness descends proportion = (@timer - @ball_appear_end) / (@duration - @ball_appear_end) @sprites.each do |sprite| - sprite.y = -@curve_bitmap.height + (Graphics.height + @curve_bitmap.height) * proportion + sprite.y = -@curve_bitmap.height + ((Graphics.height + @curve_bitmap.height) * proportion) end # Zoom in overworld sprite - @overworld_sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom + @overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom @overworld_sprite.zoom_y = @overworld_sprite.zoom_x end end @@ -1024,7 +1024,7 @@ module Transitions # Ball sprites @ball_sprites = [] for i in 0...3 - @ball_sprites[i] = new_sprite((2 * i + 1) * Graphics.width / 6, + @ball_sprites[i] = new_sprite(((2 * i) + 1) * Graphics.width / 6, BALL_OFFSETS[i] * Graphics.height, @ball_bitmap, @ball_bitmap.width / 2, @ball_bitmap.height / 2) @ball_sprites[i].z = 4 @@ -1062,13 +1062,13 @@ module Transitions # Make overworld wave strips oscillate amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds @sprites.each_with_index do |sprite, i| - sprite.x = (1 - (i % 2) * 2) * amplitude * Math.sin(@timer * WAVE_SPEED + i * WAVE_SPACING) + sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING)) end # Move balls and trailing blackness up if @timer >= @ball_rising_start proportion = (@timer - @ball_rising_start) / (@duration - @ball_rising_start) @ball_sprites.each_with_index do |sprite, i| - sprite.y = BALL_OFFSETS[i] * Graphics.height - Graphics.height * 3.5 * proportion + sprite.y = (BALL_OFFSETS[i] * Graphics.height) - (Graphics.height * 3.5 * proportion) sprite.angle = [-1, -1, 1][i] * 360 * 2 * proportion @black_trail_sprites[i].y = sprite.y @black_trail_sprites[i].y = 0 if @black_trail_sprites[i].y < 0 @@ -1133,7 +1133,7 @@ module Transitions # Make overworld wave strips oscillate amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds @sprites.each_with_index do |sprite, i| - sprite.x = (1 - (i % 2) * 2) * amplitude * Math.sin(@timer * WAVE_SPEED + i * WAVE_SPACING) + sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING)) end if @timer <= @ball_appear_end # Fade in ball while spinning @@ -1208,11 +1208,11 @@ module Transitions if @timer <= @ball_appear_end # Balls fly out from centre of screen proportion = @timer / @ball_appear_end - ball_travel_x = (Graphics.width + @ball_bitmap.width * 2) / 2 - ball_travel_y = (Graphics.height + @ball_bitmap.height * 2) / 2 + ball_travel_x = (Graphics.width + (@ball_bitmap.width * 2)) / 2 + ball_travel_y = (Graphics.height + (@ball_bitmap.height * 2)) / 2 @ball_sprites.each_with_index do |sprite, i| - sprite.x = Graphics.width / 2 + [0, 1, 0, -1][i] * ball_travel_x * proportion if i.odd? - sprite.y = Graphics.height / 2 + [1, 0, -1, 0][i] * ball_travel_y * proportion if i.even? + sprite.x = (Graphics.width / 2) + ([0, 1, 0, -1][i] * ball_travel_x * proportion) if i.odd? + sprite.y = (Graphics.height / 2) + ([1, 0, -1, 0][i] * ball_travel_y * proportion) if i.even? end else # Black wedges expand to fill screen diff --git a/Data/Scripts/010_Data/001_GameData.rb b/Data/Scripts/010_Data/001_GameData.rb index 90021f2e7..97daec1ab 100644 --- a/Data/Scripts/010_Data/001_GameData.rb +++ b/Data/Scripts/010_Data/001_GameData.rb @@ -207,13 +207,14 @@ module GameData # @return [Boolean] whether other represents the same thing as this thing def ==(other) return false if other.nil? - if other.is_a?(Symbol) + case other + when Symbol return @id == other - elsif other.is_a?(self.class) + when self.class return @id == other.id - elsif other.is_a?(String) + when String return @id == other.to_sym - elsif other.is_a?(Integer) + when Integer return @id_number == other end return false diff --git a/Data/Scripts/010_Data/001_Hardcoded data/001_GrowthRate.rb b/Data/Scripts/010_Data/001_Hardcoded data/001_GrowthRate.rb index 824cc86f4..988bae6eb 100644 --- a/Data/Scripts/010_Data/001_Hardcoded data/001_GrowthRate.rb +++ b/Data/Scripts/010_Data/001_Hardcoded data/001_GrowthRate.rb @@ -133,7 +133,7 @@ GameData::GrowthRate.register({ 765275, 804997, 834809, 877201, 908905, 954084, 987754, 1035837, 1071552, 1122660, 1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884, 1640000], :exp_formula => proc { |level| - rate = [82 - (level - 100) / 2.0, 40].max + rate = [82 - ((level - 100) / 2.0), 40].max next (level**4) * rate / 5000 } }) @@ -152,7 +152,7 @@ GameData::GrowthRate.register({ 360838, 377197, 394045, 411388, 429235, 447591, 466464, 485862, 505791, 526260, 547274, 568841, 590969, 613664, 636935, 660787, 685228, 710266, 735907, 762160, 789030, 816525, 844653, 873420, 902835, 932903, 963632, 995030, 1027103, 1059860], - :exp_formula => proc { |level| next ((level**3) * 6 / 5) - 15 * (level**2) + 100 * level - 140 } + :exp_formula => proc { |level| next ((level**3) * 6 / 5) - (15 * (level**2)) + (100 * level) - 140 } }) GameData::GrowthRate.register({ diff --git a/Data/Scripts/010_Data/002_PBS data/006_Item.rb b/Data/Scripts/010_Data/002_PBS data/006_Item.rb index b5aae5cdb..e4e64c215 100644 --- a/Data/Scripts/010_Data/002_PBS data/006_Item.rb +++ b/Data/Scripts/010_Data/002_PBS data/006_Item.rb @@ -149,44 +149,44 @@ module GameData return false if species == :ARCEUS && ability != :MULTITYPE return false if species == :SILVALLY && ability != :RKSSYSTEM combos = { - :ARCEUS => [:FISTPLATE, :FIGHTINIUMZ, - :SKYPLATE, :FLYINIUMZ, - :TOXICPLATE, :POISONIUMZ, - :EARTHPLATE, :GROUNDIUMZ, - :STONEPLATE, :ROCKIUMZ, - :INSECTPLATE, :BUGINIUMZ, - :SPOOKYPLATE, :GHOSTIUMZ, - :IRONPLATE, :STEELIUMZ, - :FLAMEPLATE, :FIRIUMZ, - :SPLASHPLATE, :WATERIUMZ, - :MEADOWPLATE, :GRASSIUMZ, - :ZAPPLATE, :ELECTRIUMZ, - :MINDPLATE, :PSYCHIUMZ, - :ICICLEPLATE, :ICIUMZ, - :DRACOPLATE, :DRAGONIUMZ, - :DREADPLATE, :DARKINIUMZ, - :PIXIEPLATE, :FAIRIUMZ], - :SILVALLY => [:FIGHTINGMEMORY, - :FLYINGMEMORY, - :POISONMEMORY, - :GROUNDMEMORY, - :ROCKMEMORY, - :BUGMEMORY, - :GHOSTMEMORY, - :STEELMEMORY, - :FIREMEMORY, - :WATERMEMORY, - :GRASSMEMORY, - :ELECTRICMEMORY, - :PSYCHICMEMORY, - :ICEMEMORY, - :DRAGONMEMORY, - :DARKMEMORY, - :FAIRYMEMORY], - :GIRATINA => [:GRISEOUSORB], - :GENESECT => [:BURNDRIVE, :CHILLDRIVE, :DOUSEDRIVE, :SHOCKDRIVE], - :KYOGRE => [:BLUEORB], - :GROUDON => [:REDORB] + :ARCEUS => [:FISTPLATE, :FIGHTINIUMZ, + :SKYPLATE, :FLYINIUMZ, + :TOXICPLATE, :POISONIUMZ, + :EARTHPLATE, :GROUNDIUMZ, + :STONEPLATE, :ROCKIUMZ, + :INSECTPLATE, :BUGINIUMZ, + :SPOOKYPLATE, :GHOSTIUMZ, + :IRONPLATE, :STEELIUMZ, + :FLAMEPLATE, :FIRIUMZ, + :SPLASHPLATE, :WATERIUMZ, + :MEADOWPLATE, :GRASSIUMZ, + :ZAPPLATE, :ELECTRIUMZ, + :MINDPLATE, :PSYCHIUMZ, + :ICICLEPLATE, :ICIUMZ, + :DRACOPLATE, :DRAGONIUMZ, + :DREADPLATE, :DARKINIUMZ, + :PIXIEPLATE, :FAIRIUMZ], + :SILVALLY => [:FIGHTINGMEMORY, + :FLYINGMEMORY, + :POISONMEMORY, + :GROUNDMEMORY, + :ROCKMEMORY, + :BUGMEMORY, + :GHOSTMEMORY, + :STEELMEMORY, + :FIREMEMORY, + :WATERMEMORY, + :GRASSMEMORY, + :ELECTRICMEMORY, + :PSYCHICMEMORY, + :ICEMEMORY, + :DRAGONMEMORY, + :DARKMEMORY, + :FAIRYMEMORY], + :GIRATINA => [:GRISEOUSORB], + :GENESECT => [:BURNDRIVE, :CHILLDRIVE, :DOUSEDRIVE, :SHOCKDRIVE], + :KYOGRE => [:BLUEORB], + :GROUDON => [:REDORB] } return combos[species] && combos[species].include?(@id) end diff --git a/Data/Scripts/010_Data/002_PBS data/008_Species.rb b/Data/Scripts/010_Data/002_PBS data/008_Species.rb index 68e0e6a92..6197614b2 100644 --- a/Data/Scripts/010_Data/002_PBS data/008_Species.rb +++ b/Data/Scripts/010_Data/002_PBS data/008_Species.rb @@ -311,8 +311,8 @@ module GameData evos.each do |evo| if check_method.is_a?(Array) next if !check_method.include?(evo[2]) - else - next if evo[2] != check_method + elsif evo[2] != check_method + next end return true if check_param.nil? || evo[3] == check_param end diff --git a/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb b/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb index d17c51c51..ae1b222c5 100644 --- a/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb +++ b/Data/Scripts/010_Data/002_PBS data/010_SpeciesMetrics.rb @@ -66,18 +66,16 @@ module GameData def apply_metrics_to_sprite(sprite, index, shadow = false) if shadow - if (index & 1) == 1 # Foe Pokémon + if (index & 1) == 1 # Foe Pokémon sprite.x += @shadow_x * 2 end - else - if (index & 1) == 0 # Player's Pokémon - sprite.x += @back_sprite[0] * 2 - sprite.y += @back_sprite[1] * 2 - else # Foe Pokémon - sprite.x += @front_sprite[0] * 2 - sprite.y += @front_sprite[1] * 2 - sprite.y -= @front_sprite_altitude * 2 - end + elsif (index & 1) == 0 # Player's Pokémon + sprite.x += @back_sprite[0] * 2 + sprite.y += @back_sprite[1] * 2 + else # Foe Pokémon + sprite.x += @front_sprite[0] * 2 + sprite.y += @front_sprite[1] * 2 + sprite.y -= @front_sprite_altitude * 2 end end diff --git a/Data/Scripts/011_Battle/001_Battle/001_Battle.rb b/Data/Scripts/011_Battle/001_Battle/001_Battle.rb index 73f74925e..4d4e6bf57 100644 --- a/Data/Scripts/011_Battle/001_Battle/001_Battle.rb +++ b/Data/Scripts/011_Battle/001_Battle/001_Battle.rb @@ -141,12 +141,12 @@ class Battle @priorityTrickRoom = false @choices = [] @megaEvolution = [ - [-1] * (@player ? @player.length : 1), - [-1] * (@opponent ? @opponent.length : 1) + [-1] * (@player ? @player.length : 1), + [-1] * (@opponent ? @opponent.length : 1) ] @initialItems = [ - Array.new(@party1.length) { |i| (@party1[i]) ? @party1[i].item_id : nil }, - Array.new(@party2.length) { |i| (@party2[i]) ? @party2[i].item_id : nil } + Array.new(@party1.length) { |i| (@party1[i]) ? @party1[i].item_id : nil }, + Array.new(@party2.length) { |i| (@party2[i]) ? @party2[i].item_id : nil } ] @recycleItems = [Array.new(@party1.length, nil), Array.new(@party2.length, nil)] @belch = [Array.new(@party1.length, false), Array.new(@party2.length, false)] @@ -202,7 +202,7 @@ class Battle end def maxBattlerIndex - return (pbSideSize(0) > pbSideSize(1)) ? (pbSideSize(0) - 1) * 2 : pbSideSize(1) * 2 - 1 + return (pbSideSize(0) > pbSideSize(1)) ? (pbSideSize(0) - 1) * 2 : (pbSideSize(1) * 2) - 1 end #============================================================================= @@ -282,7 +282,7 @@ class Battle def pbNumPositions(side, idxTrainer) ret = 0 for i in 0...pbSideSize(side) - t = pbGetOwnerIndexFromBattlerIndex(i * 2 + side) + t = pbGetOwnerIndexFromBattlerIndex((i * 2) + side) next if t != idxTrainer ret += 1 end diff --git a/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb b/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb index 08984fb34..c5c73c51c 100644 --- a/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb +++ b/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb @@ -49,7 +49,7 @@ class Battle requireds = [] # Find out how many Pokémon each trainer on side needs to have for i in 0...@sideSizes[side] - idxTrainer = pbGetOwnerIndexFromBattlerIndex(i * 2 + side) + idxTrainer = pbGetOwnerIndexFromBattlerIndex((i * 2) + side) requireds[idxTrainer] = 0 if requireds[idxTrainer].nil? requireds[idxTrainer] += 1 end @@ -119,10 +119,10 @@ class Battle # Set up wild Pokémon if side == 1 && wildBattle? pbParty(1).each_with_index do |pkmn, idxPkmn| - pbCreateBattler(2 * idxPkmn + side, pkmn, idxPkmn) + pbCreateBattler((2 * idxPkmn) + side, pkmn, idxPkmn) # Changes the Pokémon's form upon entering battle (if it should) - @peer.pbOnEnteringBattle(self, @battlers[2 * idxPkmn + side], pkmn, true) - pbSetSeen(@battlers[2 * idxPkmn + side]) + @peer.pbOnEnteringBattle(self, @battlers[(2 * idxPkmn) + side], pkmn, true) + pbSetSeen(@battlers[(2 * idxPkmn) + side]) @usedInBattle[side][idxPkmn] = true end next @@ -132,7 +132,7 @@ class Battle requireds = [] # Find out how many Pokémon each trainer on side needs to have for i in 0...@sideSizes[side] - idxTrainer = pbGetOwnerIndexFromBattlerIndex(i * 2 + side) + idxTrainer = pbGetOwnerIndexFromBattlerIndex((i * 2) + side) requireds[idxTrainer] = 0 if requireds[idxTrainer].nil? requireds[idxTrainer] += 1 end @@ -143,7 +143,7 @@ class Battle ret[side][idxTrainer] = [] eachInTeam(side, idxTrainer) do |pkmn, idxPkmn| next if !pkmn.able? - idxBattler = 2 * battlerNumber + side + idxBattler = (2 * battlerNumber) + side pbCreateBattler(idxBattler, pkmn, idxPkmn) ret[side][idxTrainer].push(idxBattler) battlerNumber += 1 diff --git a/Data/Scripts/011_Battle/001_Battle/003_Battle_ExpAndMoveLearning.rb b/Data/Scripts/011_Battle/001_Battle/003_Battle_ExpAndMoveLearning.rb index 934496aa7..53b1ac65e 100644 --- a/Data/Scripts/011_Battle/001_Battle/003_Battle_ExpAndMoveLearning.rb +++ b/Data/Scripts/011_Battle/001_Battle/003_Battle_ExpAndMoveLearning.rb @@ -125,7 +125,7 @@ class Battle # Scale the gained Exp based on the gainer's level (or not) if Settings::SCALED_EXP_FORMULA exp /= 5 - levelAdjust = (2 * level + 10.0) / (pkmn.level + level + 10.0) + levelAdjust = ((2 * level) + 10.0) / (pkmn.level + level + 10.0) levelAdjust = levelAdjust**5 levelAdjust = Math.sqrt(levelAdjust) exp *= levelAdjust diff --git a/Data/Scripts/011_Battle/001_Battle/005_Battle_ActionSwitching.rb b/Data/Scripts/011_Battle/001_Battle/005_Battle_ActionSwitching.rb index d7f705818..117b70a2d 100644 --- a/Data/Scripts/011_Battle/001_Battle/005_Battle_ActionSwitching.rb +++ b/Data/Scripts/011_Battle/001_Battle/005_Battle_ActionSwitching.rb @@ -116,8 +116,8 @@ class Battle @scene.pbPartyScreen(idxBattler, canCancel) { |idxParty, partyScene| if checkLaxOnly next false if !pbCanSwitchLax?(idxBattler, idxParty, partyScene) - else - next false if !pbCanSwitch?(idxBattler, idxParty, partyScene) + elsif !pbCanSwitch?(idxBattler, idxParty, partyScene) + next false end if shouldRegister next false if idxParty < 0 || !pbRegisterSwitch(idxBattler, idxParty) diff --git a/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb b/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb index 1550977bf..f1ee974a9 100644 --- a/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb +++ b/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb @@ -53,9 +53,9 @@ class Battle::Battler # Stat up animation and message @battle.pbCommonAnimation("StatUp", self) if showAnim arrStatTexts = [ - _INTL("{1}'s {2} rose!", pbThis, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} rose sharply!", pbThis, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} rose drastically!", pbThis, GameData::Stat.get(stat).name) + _INTL("{1}'s {2} rose!", pbThis, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} rose sharply!", pbThis, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} rose drastically!", pbThis, GameData::Stat.get(stat).name) ] @battle.pbDisplay(arrStatTexts[[increment - 1, 2].min]) # Trigger abilities upon stat gain @@ -77,15 +77,15 @@ class Battle::Battler @battle.pbCommonAnimation("StatUp", self) if showAnim if user.index == @index arrStatTexts = [ - _INTL("{1}'s {2} raised its {3}!", pbThis, cause, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} sharply raised its {3}!", pbThis, cause, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} drastically raised its {3}!", pbThis, cause, GameData::Stat.get(stat).name) + _INTL("{1}'s {2} raised its {3}!", pbThis, cause, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} sharply raised its {3}!", pbThis, cause, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} drastically raised its {3}!", pbThis, cause, GameData::Stat.get(stat).name) ] else arrStatTexts = [ - _INTL("{1}'s {2} raised {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), - _INTL("{1}'s {2} sharply raised {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), - _INTL("{1}'s {2} drastically raised {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name) + _INTL("{1}'s {2} raised {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), + _INTL("{1}'s {2} sharply raised {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), + _INTL("{1}'s {2} drastically raised {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name) ] end @battle.pbDisplay(arrStatTexts[[increment - 1, 2].min]) @@ -218,9 +218,9 @@ class Battle::Battler # Stat down animation and message @battle.pbCommonAnimation("StatDown", self) if showAnim arrStatTexts = [ - _INTL("{1}'s {2} fell!", pbThis, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} harshly fell!", pbThis, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} severely fell!", pbThis, GameData::Stat.get(stat).name) + _INTL("{1}'s {2} fell!", pbThis, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} harshly fell!", pbThis, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} severely fell!", pbThis, GameData::Stat.get(stat).name) ] @battle.pbDisplay(arrStatTexts[[increment - 1, 2].min]) # Trigger abilities upon stat loss @@ -259,15 +259,15 @@ class Battle::Battler @battle.pbCommonAnimation("StatDown", self) if showAnim if user.index == @index arrStatTexts = [ - _INTL("{1}'s {2} lowered its {3}!", pbThis, cause, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} harshly lowered its {3}!", pbThis, cause, GameData::Stat.get(stat).name), - _INTL("{1}'s {2} severely lowered its {3}!", pbThis, cause, GameData::Stat.get(stat).name) + _INTL("{1}'s {2} lowered its {3}!", pbThis, cause, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} harshly lowered its {3}!", pbThis, cause, GameData::Stat.get(stat).name), + _INTL("{1}'s {2} severely lowered its {3}!", pbThis, cause, GameData::Stat.get(stat).name) ] else arrStatTexts = [ - _INTL("{1}'s {2} lowered {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), - _INTL("{1}'s {2} harshly lowered {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), - _INTL("{1}'s {2} severely lowered {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name) + _INTL("{1}'s {2} lowered {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), + _INTL("{1}'s {2} harshly lowered {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name), + _INTL("{1}'s {2} severely lowered {3}'s {4}!", user.pbThis, cause, pbThis(true), GameData::Stat.get(stat).name) ] end @battle.pbDisplay(arrStatTexts[[increment - 1, 2].min]) diff --git a/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb b/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb index 7430b7d1c..a04882f9a 100644 --- a/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb +++ b/Data/Scripts/011_Battle/002_Battler/006_Battler_AbilityAndItem.rb @@ -119,13 +119,10 @@ class Battle::Battler else pbRaiseStatStageByCause(stat, increment, self, abilityName) end + elsif Battle::Scene::USE_ABILITY_SPLASH + @battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) else - if Battle::Scene::USE_ABILITY_SPLASH - @battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) - else - @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", - pbThis, abilityName, move.name)) - end + @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", pbThis, abilityName, move.name)) end @battle.pbHideAbilitySplash(self) end @@ -149,13 +146,10 @@ class Battle::Battler else @battle.pbDisplay(_INTL("{1}'s {2} restored its HP.", pbThis, abilityName)) end + elsif Battle::Scene::USE_ABILITY_SPLASH + @battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) else - if Battle::Scene::USE_ABILITY_SPLASH - @battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) - else - @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", - pbThis, abilityName, move.name)) - end + @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", pbThis, abilityName, move.name)) end @battle.pbHideAbilitySplash(self) end diff --git a/Data/Scripts/011_Battle/003_Move/002_Move_Usage.rb b/Data/Scripts/011_Battle/003_Move/002_Move_Usage.rb index 5f198e84c..93b949086 100644 --- a/Data/Scripts/011_Battle/003_Move/002_Move_Usage.rb +++ b/Data/Scripts/011_Battle/003_Move/002_Move_Usage.rb @@ -298,12 +298,10 @@ class Battle::Move else @battle.pbDisplay(_INTL("{1} landed a critical hit, wishing to be praised!", user.pbThis)) end + elsif numTargets > 1 + @battle.pbDisplay(_INTL("A critical hit on {1}!", target.pbThis(true))) else - if numTargets > 1 - @battle.pbDisplay(_INTL("A critical hit on {1}!", target.pbThis(true))) - else - @battle.pbDisplay(_INTL("A critical hit!")) - end + @battle.pbDisplay(_INTL("A critical hit!")) end end # Effectiveness message, for moves with 1 hit diff --git a/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb b/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb index 81da306e4..e3e78db88 100644 --- a/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb +++ b/Data/Scripts/011_Battle/003_Move/003_Move_UsageCalculations.rb @@ -283,7 +283,7 @@ class Battle::Move baseDmg = [(baseDmg * multipliers[:base_damage_multiplier]).round, 1].max atk = [(atk * multipliers[:attack_multiplier]).round, 1].max defense = [(defense * multipliers[:defense_multiplier]).round, 1].max - damage = (((2.0 * user.level / 5 + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2 + damage = ((((2.0 * user.level / 5) + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2 damage = [(damage * multipliers[:final_damage_multiplier]).round, 1].max target.damageState.calcDamage = damage end diff --git a/Data/Scripts/011_Battle/003_Move/004_Move_BaseEffects.rb b/Data/Scripts/011_Battle/003_Move/004_Move_BaseEffects.rb index 4dd023cd5..25bc4f912 100644 --- a/Data/Scripts/011_Battle/003_Move/004_Move_BaseEffects.rb +++ b/Data/Scripts/011_Battle/003_Move/004_Move_BaseEffects.rb @@ -130,7 +130,7 @@ class Battle::Move::MultiStatUpMove < Battle::Move showAnim = true for i in 0...@statUp.length / 2 next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self) - if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim) + if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim) showAnim = false end end @@ -140,7 +140,7 @@ class Battle::Move::MultiStatUpMove < Battle::Move showAnim = true for i in 0...@statUp.length / 2 next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self) - if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim) + if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim) showAnim = false end end @@ -156,7 +156,7 @@ class Battle::Move::StatDownMove < Battle::Move showAnim = true for i in 0...@statDown.length / 2 next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self) - if user.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user, showAnim) + if user.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim) showAnim = false end end @@ -255,7 +255,7 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move showMirrorArmorSplash = true for i in 0...@statDown.length / 2 next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self) - if target.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user, + if target.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim, false, (showMirrorArmorSplash) ? 1 : 3) showAnim = false end diff --git a/Data/Scripts/011_Battle/003_Move/006_MoveEffects_BattlerStats.rb b/Data/Scripts/011_Battle/003_Move/006_MoveEffects_BattlerStats.rb index a789764ce..03c5df771 100644 --- a/Data/Scripts/011_Battle/003_Move/006_MoveEffects_BattlerStats.rb +++ b/Data/Scripts/011_Battle/003_Move/006_MoveEffects_BattlerStats.rb @@ -440,14 +440,14 @@ class Battle::Move::LowerUserDefSpDef1RaiseUserAtkSpAtkSpd2 < Battle::Move showAnim = true for i in 0...@statDown.length / 2 next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self) - if user.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user, showAnim) + if user.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim) showAnim = false end end showAnim = true for i in 0...@statUp.length / 2 next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self) - if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim) + if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim) showAnim = false end end @@ -1385,7 +1385,7 @@ class Battle::Move::LowerPoisonedTargetAtkSpAtkSpd1 < Battle::Move showMirrorArmorSplash = true for i in 0...@statDown.length / 2 next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self) - if target.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user, + if target.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim, false, (showMirrorArmorSplash) ? 1 : 3) showAnim = false end diff --git a/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb b/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb index 2d3a5b8ab..8f1b7c88b 100644 --- a/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb +++ b/Data/Scripts/011_Battle/003_Move/008_MoveEffects_MoveAttributes.rb @@ -379,13 +379,13 @@ class Battle::Move::RandomPowerDoublePowerIfTargetUnderground < Battle::Move def pbOnStartUse(user, targets) baseDmg = [10, 30, 50, 70, 90, 110, 150] magnitudes = [ - 4, - 5, 5, - 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, - 9, 9, - 10 + 4, + 5, 5, + 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, + 9, 9, + 10 ] magni = magnitudes[@battle.pbRandom(magnitudes.length)] @magnitudeDmg = baseDmg[magni - 4] @@ -710,11 +710,9 @@ class Battle::Move::StartWeakenElectricMoves < Battle::Move @battle.pbDisplay(_INTL("But it failed!")) return true end - else - if @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] } - @battle.pbDisplay(_INTL("But it failed!")) - return true - end + elsif @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] } + @battle.pbDisplay(_INTL("But it failed!")) + return true end return false end @@ -739,11 +737,9 @@ class Battle::Move::StartWeakenFireMoves < Battle::Move @battle.pbDisplay(_INTL("But it failed!")) return true end - else - if @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] } - @battle.pbDisplay(_INTL("But it failed!")) - return true - end + elsif @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] } + @battle.pbDisplay(_INTL("But it failed!")) + return true end return false end @@ -1359,7 +1355,7 @@ def pbHiddenPower(pkmn) power |= (iv[:SPEED] & 2) << 2 power |= (iv[:SPECIAL_ATTACK] & 2) << 3 power |= (iv[:SPECIAL_DEFENSE] & 2) << 4 - power = powerMin + (powerMax - powerMin) * power / 63 + power = powerMin + ((powerMax - powerMin) * power / 63) end return [type, power] end @@ -1372,41 +1368,41 @@ class Battle::Move::TypeAndPowerDependOnUserBerry < Battle::Move def initialize(battle, move) super @typeArray = { - :NORMAL => [:CHILANBERRY], - :FIRE => [:CHERIBERRY, :BLUKBERRY, :WATMELBERRY, :OCCABERRY], - :WATER => [:CHESTOBERRY, :NANABBERRY, :DURINBERRY, :PASSHOBERRY], - :ELECTRIC => [:PECHABERRY, :WEPEARBERRY, :BELUEBERRY, :WACANBERRY], - :GRASS => [:RAWSTBERRY, :PINAPBERRY, :RINDOBERRY, :LIECHIBERRY], - :ICE => [:ASPEARBERRY, :POMEGBERRY, :YACHEBERRY, :GANLONBERRY], - :FIGHTING => [:LEPPABERRY, :KELPSYBERRY, :CHOPLEBERRY, :SALACBERRY], - :POISON => [:ORANBERRY, :QUALOTBERRY, :KEBIABERRY, :PETAYABERRY], - :GROUND => [:PERSIMBERRY, :HONDEWBERRY, :SHUCABERRY, :APICOTBERRY], - :FLYING => [:LUMBERRY, :GREPABERRY, :COBABERRY, :LANSATBERRY], - :PSYCHIC => [:SITRUSBERRY, :TAMATOBERRY, :PAYAPABERRY, :STARFBERRY], - :BUG => [:FIGYBERRY, :CORNNBERRY, :TANGABERRY, :ENIGMABERRY], - :ROCK => [:WIKIBERRY, :MAGOSTBERRY, :CHARTIBERRY, :MICLEBERRY], - :GHOST => [:MAGOBERRY, :RABUTABERRY, :KASIBBERRY, :CUSTAPBERRY], - :DRAGON => [:AGUAVBERRY, :NOMELBERRY, :HABANBERRY, :JABOCABERRY], - :DARK => [:IAPAPABERRY, :SPELONBERRY, :COLBURBERRY, :ROWAPBERRY, :MARANGABERRY], - :STEEL => [:RAZZBERRY, :PAMTREBERRY, :BABIRIBERRY], - :FAIRY => [:ROSELIBERRY, :KEEBERRY] + :NORMAL => [:CHILANBERRY], + :FIRE => [:CHERIBERRY, :BLUKBERRY, :WATMELBERRY, :OCCABERRY], + :WATER => [:CHESTOBERRY, :NANABBERRY, :DURINBERRY, :PASSHOBERRY], + :ELECTRIC => [:PECHABERRY, :WEPEARBERRY, :BELUEBERRY, :WACANBERRY], + :GRASS => [:RAWSTBERRY, :PINAPBERRY, :RINDOBERRY, :LIECHIBERRY], + :ICE => [:ASPEARBERRY, :POMEGBERRY, :YACHEBERRY, :GANLONBERRY], + :FIGHTING => [:LEPPABERRY, :KELPSYBERRY, :CHOPLEBERRY, :SALACBERRY], + :POISON => [:ORANBERRY, :QUALOTBERRY, :KEBIABERRY, :PETAYABERRY], + :GROUND => [:PERSIMBERRY, :HONDEWBERRY, :SHUCABERRY, :APICOTBERRY], + :FLYING => [:LUMBERRY, :GREPABERRY, :COBABERRY, :LANSATBERRY], + :PSYCHIC => [:SITRUSBERRY, :TAMATOBERRY, :PAYAPABERRY, :STARFBERRY], + :BUG => [:FIGYBERRY, :CORNNBERRY, :TANGABERRY, :ENIGMABERRY], + :ROCK => [:WIKIBERRY, :MAGOSTBERRY, :CHARTIBERRY, :MICLEBERRY], + :GHOST => [:MAGOBERRY, :RABUTABERRY, :KASIBBERRY, :CUSTAPBERRY], + :DRAGON => [:AGUAVBERRY, :NOMELBERRY, :HABANBERRY, :JABOCABERRY], + :DARK => [:IAPAPABERRY, :SPELONBERRY, :COLBURBERRY, :ROWAPBERRY, :MARANGABERRY], + :STEEL => [:RAZZBERRY, :PAMTREBERRY, :BABIRIBERRY], + :FAIRY => [:ROSELIBERRY, :KEEBERRY] } @damageArray = { - 60 => [:CHERIBERRY, :CHESTOBERRY, :PECHABERRY, :RAWSTBERRY, :ASPEARBERRY, - :LEPPABERRY, :ORANBERRY, :PERSIMBERRY, :LUMBERRY, :SITRUSBERRY, - :FIGYBERRY, :WIKIBERRY, :MAGOBERRY, :AGUAVBERRY, :IAPAPABERRY, - :RAZZBERRY, :OCCABERRY, :PASSHOBERRY, :WACANBERRY, :RINDOBERRY, - :YACHEBERRY, :CHOPLEBERRY, :KEBIABERRY, :SHUCABERRY, :COBABERRY, - :PAYAPABERRY, :TANGABERRY, :CHARTIBERRY, :KASIBBERRY, :HABANBERRY, - :COLBURBERRY, :BABIRIBERRY, :CHILANBERRY, :ROSELIBERRY], - 70 => [:BLUKBERRY, :NANABBERRY, :WEPEARBERRY, :PINAPBERRY, :POMEGBERRY, - :KELPSYBERRY, :QUALOTBERRY, :HONDEWBERRY, :GREPABERRY, :TAMATOBERRY, - :CORNNBERRY, :MAGOSTBERRY, :RABUTABERRY, :NOMELBERRY, :SPELONBERRY, - :PAMTREBERRY], - 80 => [:WATMELBERRY, :DURINBERRY, :BELUEBERRY, :LIECHIBERRY, :GANLONBERRY, - :SALACBERRY, :PETAYABERRY, :APICOTBERRY, :LANSATBERRY, :STARFBERRY, - :ENIGMABERRY, :MICLEBERRY, :CUSTAPBERRY, :JABOCABERRY, :ROWAPBERRY, - :KEEBERRY, :MARANGABERRY] + 60 => [:CHERIBERRY, :CHESTOBERRY, :PECHABERRY, :RAWSTBERRY, :ASPEARBERRY, + :LEPPABERRY, :ORANBERRY, :PERSIMBERRY, :LUMBERRY, :SITRUSBERRY, + :FIGYBERRY, :WIKIBERRY, :MAGOBERRY, :AGUAVBERRY, :IAPAPABERRY, + :RAZZBERRY, :OCCABERRY, :PASSHOBERRY, :WACANBERRY, :RINDOBERRY, + :YACHEBERRY, :CHOPLEBERRY, :KEBIABERRY, :SHUCABERRY, :COBABERRY, + :PAYAPABERRY, :TANGABERRY, :CHARTIBERRY, :KASIBBERRY, :HABANBERRY, + :COLBURBERRY, :BABIRIBERRY, :CHILANBERRY, :ROSELIBERRY], + 70 => [:BLUKBERRY, :NANABBERRY, :WEPEARBERRY, :PINAPBERRY, :POMEGBERRY, + :KELPSYBERRY, :QUALOTBERRY, :HONDEWBERRY, :GREPABERRY, :TAMATOBERRY, + :CORNNBERRY, :MAGOSTBERRY, :RABUTABERRY, :NOMELBERRY, :SPELONBERRY, + :PAMTREBERRY], + 80 => [:WATMELBERRY, :DURINBERRY, :BELUEBERRY, :LIECHIBERRY, :GANLONBERRY, + :SALACBERRY, :PETAYABERRY, :APICOTBERRY, :LANSATBERRY, :STARFBERRY, + :ENIGMABERRY, :MICLEBERRY, :CUSTAPBERRY, :JABOCABERRY, :ROWAPBERRY, + :KEEBERRY, :MARANGABERRY] } end @@ -1469,23 +1465,23 @@ class Battle::Move::TypeDependsOnUserPlate < Battle::Move def initialize(battle, move) super @itemTypes = { - :FISTPLATE => :FIGHTING, - :SKYPLATE => :FLYING, - :TOXICPLATE => :POISON, - :EARTHPLATE => :GROUND, - :STONEPLATE => :ROCK, - :INSECTPLATE => :BUG, - :SPOOKYPLATE => :GHOST, - :IRONPLATE => :STEEL, - :FLAMEPLATE => :FIRE, - :SPLASHPLATE => :WATER, - :MEADOWPLATE => :GRASS, - :ZAPPLATE => :ELECTRIC, - :MINDPLATE => :PSYCHIC, - :ICICLEPLATE => :ICE, - :DRACOPLATE => :DRAGON, - :DREADPLATE => :DARK, - :PIXIEPLATE => :FAIRY + :FISTPLATE => :FIGHTING, + :SKYPLATE => :FLYING, + :TOXICPLATE => :POISON, + :EARTHPLATE => :GROUND, + :STONEPLATE => :ROCK, + :INSECTPLATE => :BUG, + :SPOOKYPLATE => :GHOST, + :IRONPLATE => :STEEL, + :FLAMEPLATE => :FIRE, + :SPLASHPLATE => :WATER, + :MEADOWPLATE => :GRASS, + :ZAPPLATE => :ELECTRIC, + :MINDPLATE => :PSYCHIC, + :ICICLEPLATE => :ICE, + :DRACOPLATE => :DRAGON, + :DREADPLATE => :DARK, + :PIXIEPLATE => :FAIRY } end @@ -1509,23 +1505,23 @@ class Battle::Move::TypeDependsOnUserMemory < Battle::Move def initialize(battle, move) super @itemTypes = { - :FIGHTINGMEMORY => :FIGHTING, - :FLYINGMEMORY => :FLYING, - :POISONMEMORY => :POISON, - :GROUNDMEMORY => :GROUND, - :ROCKMEMORY => :ROCK, - :BUGMEMORY => :BUG, - :GHOSTMEMORY => :GHOST, - :STEELMEMORY => :STEEL, - :FIREMEMORY => :FIRE, - :WATERMEMORY => :WATER, - :GRASSMEMORY => :GRASS, - :ELECTRICMEMORY => :ELECTRIC, - :PSYCHICMEMORY => :PSYCHIC, - :ICEMEMORY => :ICE, - :DRAGONMEMORY => :DRAGON, - :DARKMEMORY => :DARK, - :FAIRYMEMORY => :FAIRY + :FIGHTINGMEMORY => :FIGHTING, + :FLYINGMEMORY => :FLYING, + :POISONMEMORY => :POISON, + :GROUNDMEMORY => :GROUND, + :ROCKMEMORY => :ROCK, + :BUGMEMORY => :BUG, + :GHOSTMEMORY => :GHOST, + :STEELMEMORY => :STEEL, + :FIREMEMORY => :FIRE, + :WATERMEMORY => :WATER, + :GRASSMEMORY => :GRASS, + :ELECTRICMEMORY => :ELECTRIC, + :PSYCHICMEMORY => :PSYCHIC, + :ICEMEMORY => :ICE, + :DRAGONMEMORY => :DRAGON, + :DARKMEMORY => :DARK, + :FAIRYMEMORY => :FAIRY } end @@ -1549,10 +1545,10 @@ class Battle::Move::TypeDependsOnUserDrive < Battle::Move def initialize(battle, move) super @itemTypes = { - :SHOCKDRIVE => :ELECTRIC, - :BURNDRIVE => :FIRE, - :CHILLDRIVE => :ICE, - :DOUSEDRIVE => :WATER + :SHOCKDRIVE => :ELECTRIC, + :BURNDRIVE => :FIRE, + :CHILLDRIVE => :ICE, + :DOUSEDRIVE => :WATER } end diff --git a/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb b/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb index ca0eca685..d593d52a8 100644 --- a/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb +++ b/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb @@ -677,63 +677,63 @@ class Battle::Move::UseLastMoveUsed < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - # Struggle, Belch - "Struggle", - "FailsIfUserNotConsumedBerry", # Belch # Not listed on Bulbapedia - # Moves that affect the moveset - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - "TransformUserIntoTarget", # Transform - # Counter moves - "CounterPhysicalDamage", # Counter - "CounterSpecialDamage", # Mirror Coat - "CounterDamagePlusHalf", # Metal Burst # Not listed on Bulbapedia - # Helping Hand, Feint (always blacklisted together, don't know why) - "PowerUpAllyMove", # Helping Hand - "RemoveProtections", # Feint - # Protection moves - "ProtectUser", # Detect, Protect - "ProtectUserSideFromPriorityMoves", # Quick Guard # Not listed on Bulbapedia - "ProtectUserSideFromMultiTargetDamagingMoves", # Wide Guard # Not listed on Bulbapedia - "UserEnduresFaintingThisTurn", # Endure - "ProtectUserSideFromDamagingMovesIfUserFirstTurn", # Mat Block - "ProtectUserSideFromStatusMoves", # Crafty Shield # Not listed on Bulbapedia - "ProtectUserFromDamagingMovesKingsShield", # King's Shield - "ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield - "ProtectUserBanefulBunker", # Baneful Bunker - # Moves that call other moves - "UseLastMoveUsedByTarget", # Mirror Move - "UseLastMoveUsed", # Copycat (this move) - "UseMoveTargetIsAboutToUse", # Me First - "UseMoveDependingOnEnvironment", # Nature Power # Not listed on Bulbapedia - "UseRandomUserMoveIfAsleep", # Sleep Talk - "UseRandomMoveFromUserParty", # Assist - "UseRandomMove", # Metronome - # Move-redirecting and stealing moves - "BounceBackProblemCausingStatusMoves", # Magic Coat # Not listed on Bulbapedia - "StealAndUseBeneficialStatusMove", # Snatch - "RedirectAllMovesToUser", # Follow Me, Rage Powder - "RedirectAllMovesToTarget", # Spotlight - # Set up effects that trigger upon KO - "ReduceAttackerMovePPTo0IfUserFaints", # Grudge # Not listed on Bulbapedia - "AttackerFaintsIfUserFaints", # Destiny Bond - # Held item-moving moves - "UserTakesTargetItem", # Covet, Thief - "UserTargetSwapItems", # Switcheroo, Trick - "TargetTakesUserItem", # Bestow - # Moves that start focussing at the start of the round - "FailsIfUserDamagedThisTurn", # Focus Punch - "UsedAfterUserTakesPhysicalDamage", # Shell Trap - "BurnAttackerBeforeUserActs", # Beak Blast - # Event moves that do nothing - "DoesNothingFailsIfNoAlly", # Hold Hands - "DoesNothingCongratulations" # Celebrate + # Struggle, Belch + "Struggle", + "FailsIfUserNotConsumedBerry", # Belch # Not listed on Bulbapedia + # Moves that affect the moveset + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + "TransformUserIntoTarget", # Transform + # Counter moves + "CounterPhysicalDamage", # Counter + "CounterSpecialDamage", # Mirror Coat + "CounterDamagePlusHalf", # Metal Burst # Not listed on Bulbapedia + # Helping Hand, Feint (always blacklisted together, don't know why) + "PowerUpAllyMove", # Helping Hand + "RemoveProtections", # Feint + # Protection moves + "ProtectUser", # Detect, Protect + "ProtectUserSideFromPriorityMoves", # Quick Guard # Not listed on Bulbapedia + "ProtectUserSideFromMultiTargetDamagingMoves", # Wide Guard # Not listed on Bulbapedia + "UserEnduresFaintingThisTurn", # Endure + "ProtectUserSideFromDamagingMovesIfUserFirstTurn", # Mat Block + "ProtectUserSideFromStatusMoves", # Crafty Shield # Not listed on Bulbapedia + "ProtectUserFromDamagingMovesKingsShield", # King's Shield + "ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield + "ProtectUserBanefulBunker", # Baneful Bunker + # Moves that call other moves + "UseLastMoveUsedByTarget", # Mirror Move + "UseLastMoveUsed", # Copycat (this move) + "UseMoveTargetIsAboutToUse", # Me First + "UseMoveDependingOnEnvironment", # Nature Power # Not listed on Bulbapedia + "UseRandomUserMoveIfAsleep", # Sleep Talk + "UseRandomMoveFromUserParty", # Assist + "UseRandomMove", # Metronome + # Move-redirecting and stealing moves + "BounceBackProblemCausingStatusMoves", # Magic Coat # Not listed on Bulbapedia + "StealAndUseBeneficialStatusMove", # Snatch + "RedirectAllMovesToUser", # Follow Me, Rage Powder + "RedirectAllMovesToTarget", # Spotlight + # Set up effects that trigger upon KO + "ReduceAttackerMovePPTo0IfUserFaints", # Grudge # Not listed on Bulbapedia + "AttackerFaintsIfUserFaints", # Destiny Bond + # Held item-moving moves + "UserTakesTargetItem", # Covet, Thief + "UserTargetSwapItems", # Switcheroo, Trick + "TargetTakesUserItem", # Bestow + # Moves that start focussing at the start of the round + "FailsIfUserDamagedThisTurn", # Focus Punch + "UsedAfterUserTakesPhysicalDamage", # Shell Trap + "BurnAttackerBeforeUserActs", # Beak Blast + # Event moves that do nothing + "DoesNothingFailsIfNoAlly", # Hold Hands + "DoesNothingCongratulations" # Celebrate ] if Settings::MECHANICS_GENERATION >= 6 @moveBlacklist += [ - # Target-switching moves - "SwitchOutTargetStatusMove", # Roar, Whirlwind - "SwitchOutTargetDamagingMove" # Circle Throw, Dragon Tail + # Target-switching moves + "SwitchOutTargetStatusMove", # Roar, Whirlwind + "SwitchOutTargetDamagingMove" # Circle Throw, Dragon Tail ] end end @@ -793,18 +793,18 @@ class Battle::Move::UseMoveTargetIsAboutToUse < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - "UserTakesTargetItem", # Covet, Thief - # Struggle, Belch - "Struggle", # Struggle - "FailsIfUserNotConsumedBerry", # Belch - # Counter moves - "CounterPhysicalDamage", # Counter - "CounterSpecialDamage", # Mirror Coat - "CounterDamagePlusHalf", # Metal Burst - # Moves that start focussing at the start of the round - "FailsIfUserDamagedThisTurn", # Focus Punch - "UsedAfterUserTakesPhysicalDamage", # Shell Trap - "BurnAttackerBeforeUserActs" # Beak Blast + "UserTakesTargetItem", # Covet, Thief + # Struggle, Belch + "Struggle", # Struggle + "FailsIfUserNotConsumedBerry", # Belch + # Counter moves + "CounterPhysicalDamage", # Counter + "CounterSpecialDamage", # Mirror Coat + "CounterDamagePlusHalf", # Metal Burst + # Moves that start focussing at the start of the round + "FailsIfUserDamagedThisTurn", # Focus Punch + "UsedAfterUserTakesPhysicalDamage", # Shell Trap + "BurnAttackerBeforeUserActs" # Beak Blast ] end @@ -897,83 +897,83 @@ class Battle::Move::UseRandomMove < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - "FlinchTargetFailsIfUserNotAsleep", # Snore - "TargetActsNext", # After You - "TargetActsLast", # Quash - "TargetUsesItsLastUsedMoveAgain", # Instruct - # Struggle, Belch - "Struggle", # Struggle - "FailsIfUserNotConsumedBerry", # Belch - # Moves that affect the moveset - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - "TransformUserIntoTarget", # Transform - # Counter moves - "CounterPhysicalDamage", # Counter - "CounterSpecialDamage", # Mirror Coat - "CounterDamagePlusHalf", # Metal Burst # Not listed on Bulbapedia - # Helping Hand, Feint (always blacklisted together, don't know why) - "PowerUpAllyMove", # Helping Hand - "RemoveProtections", # Feint - # Protection moves - "ProtectUser", # Detect, Protect - "ProtectUserSideFromPriorityMoves", # Quick Guard - "ProtectUserSideFromMultiTargetDamagingMoves", # Wide Guard - "UserEnduresFaintingThisTurn", # Endure - "ProtectUserSideFromDamagingMovesIfUserFirstTurn", # Mat Block - "ProtectUserSideFromStatusMoves", # Crafty Shield - "ProtectUserFromDamagingMovesKingsShield", # King's Shield - "ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield - "ProtectUserBanefulBunker", # Baneful Bunker - # Moves that call other moves - "UseLastMoveUsedByTarget", # Mirror Move - "UseLastMoveUsed", # Copycat - "UseMoveTargetIsAboutToUse", # Me First - "UseMoveDependingOnEnvironment", # Nature Power - "UseRandomUserMoveIfAsleep", # Sleep Talk - "UseRandomMoveFromUserParty", # Assist - "UseRandomMove", # Metronome - # Move-redirecting and stealing moves - "BounceBackProblemCausingStatusMoves", # Magic Coat # Not listed on Bulbapedia - "StealAndUseBeneficialStatusMove", # Snatch - "RedirectAllMovesToUser", # Follow Me, Rage Powder - "RedirectAllMovesToTarget", # Spotlight - # Set up effects that trigger upon KO - "ReduceAttackerMovePPTo0IfUserFaints", # Grudge # Not listed on Bulbapedia - "AttackerFaintsIfUserFaints", # Destiny Bond - # Held item-moving moves - "UserTakesTargetItem", # Covet, Thief - "UserTargetSwapItems", # Switcheroo, Trick - "TargetTakesUserItem", # Bestow - # Moves that start focussing at the start of the round - "FailsIfUserDamagedThisTurn", # Focus Punch - "UsedAfterUserTakesPhysicalDamage", # Shell Trap - "BurnAttackerBeforeUserActs", # Beak Blast - # Event moves that do nothing - "DoesNothingFailsIfNoAlly", # Hold Hands - "DoesNothingCongratulations" # Celebrate + "FlinchTargetFailsIfUserNotAsleep", # Snore + "TargetActsNext", # After You + "TargetActsLast", # Quash + "TargetUsesItsLastUsedMoveAgain", # Instruct + # Struggle, Belch + "Struggle", # Struggle + "FailsIfUserNotConsumedBerry", # Belch + # Moves that affect the moveset + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + "TransformUserIntoTarget", # Transform + # Counter moves + "CounterPhysicalDamage", # Counter + "CounterSpecialDamage", # Mirror Coat + "CounterDamagePlusHalf", # Metal Burst # Not listed on Bulbapedia + # Helping Hand, Feint (always blacklisted together, don't know why) + "PowerUpAllyMove", # Helping Hand + "RemoveProtections", # Feint + # Protection moves + "ProtectUser", # Detect, Protect + "ProtectUserSideFromPriorityMoves", # Quick Guard + "ProtectUserSideFromMultiTargetDamagingMoves", # Wide Guard + "UserEnduresFaintingThisTurn", # Endure + "ProtectUserSideFromDamagingMovesIfUserFirstTurn", # Mat Block + "ProtectUserSideFromStatusMoves", # Crafty Shield + "ProtectUserFromDamagingMovesKingsShield", # King's Shield + "ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield + "ProtectUserBanefulBunker", # Baneful Bunker + # Moves that call other moves + "UseLastMoveUsedByTarget", # Mirror Move + "UseLastMoveUsed", # Copycat + "UseMoveTargetIsAboutToUse", # Me First + "UseMoveDependingOnEnvironment", # Nature Power + "UseRandomUserMoveIfAsleep", # Sleep Talk + "UseRandomMoveFromUserParty", # Assist + "UseRandomMove", # Metronome + # Move-redirecting and stealing moves + "BounceBackProblemCausingStatusMoves", # Magic Coat # Not listed on Bulbapedia + "StealAndUseBeneficialStatusMove", # Snatch + "RedirectAllMovesToUser", # Follow Me, Rage Powder + "RedirectAllMovesToTarget", # Spotlight + # Set up effects that trigger upon KO + "ReduceAttackerMovePPTo0IfUserFaints", # Grudge # Not listed on Bulbapedia + "AttackerFaintsIfUserFaints", # Destiny Bond + # Held item-moving moves + "UserTakesTargetItem", # Covet, Thief + "UserTargetSwapItems", # Switcheroo, Trick + "TargetTakesUserItem", # Bestow + # Moves that start focussing at the start of the round + "FailsIfUserDamagedThisTurn", # Focus Punch + "UsedAfterUserTakesPhysicalDamage", # Shell Trap + "BurnAttackerBeforeUserActs", # Beak Blast + # Event moves that do nothing + "DoesNothingFailsIfNoAlly", # Hold Hands + "DoesNothingCongratulations" # Celebrate ] @moveBlacklistSignatures = [ - :SNARL, - # Signature moves - :DIAMONDSTORM, # Diancie (Gen 6) - :FLEURCANNON, # Magearna (Gen 7) - :FREEZESHOCK, # Black Kyurem (Gen 5) - :HYPERSPACEFURY, # Hoopa Unbound (Gen 6) - :HYPERSPACEHOLE, # Hoopa Confined (Gen 6) - :ICEBURN, # White Kyurem (Gen 5) - :LIGHTOFRUIN, # Eternal Flower Floette (Gen 6) - :MINDBLOWN, # Blacephalon (Gen 7) - :PHOTONGEYSER, # Necrozma (Gen 7) - :PLASMAFISTS, # Zeraora (Gen 7) - :RELICSONG, # Meloetta (Gen 5) - :SECRETSWORD, # Keldeo (Gen 5) - :SPECTRALTHIEF, # Marshadow (Gen 7) - :STEAMERUPTION, # Volcanion (Gen 6) - :TECHNOBLAST, # Genesect (Gen 5) - :THOUSANDARROWS, # Zygarde (Gen 6) - :THOUSANDWAVES, # Zygarde (Gen 6) - :VCREATE # Victini (Gen 5) + :SNARL, + # Signature moves + :DIAMONDSTORM, # Diancie (Gen 6) + :FLEURCANNON, # Magearna (Gen 7) + :FREEZESHOCK, # Black Kyurem (Gen 5) + :HYPERSPACEFURY, # Hoopa Unbound (Gen 6) + :HYPERSPACEHOLE, # Hoopa Confined (Gen 6) + :ICEBURN, # White Kyurem (Gen 5) + :LIGHTOFRUIN, # Eternal Flower Floette (Gen 6) + :MINDBLOWN, # Blacephalon (Gen 7) + :PHOTONGEYSER, # Necrozma (Gen 7) + :PLASMAFISTS, # Zeraora (Gen 7) + :RELICSONG, # Meloetta (Gen 5) + :SECRETSWORD, # Keldeo (Gen 5) + :SPECTRALTHIEF, # Marshadow (Gen 7) + :STEAMERUPTION, # Volcanion (Gen 6) + :TECHNOBLAST, # Genesect (Gen 5) + :THOUSANDARROWS, # Zygarde (Gen 6) + :THOUSANDWAVES, # Zygarde (Gen 6) + :VCREATE # Victini (Gen 5) ] end @@ -1012,82 +1012,82 @@ class Battle::Move::UseRandomMoveFromUserParty < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - # Struggle, Belch - "Struggle", # Struggle - "FailsIfUserNotConsumedBerry", # Belch - # Moves that affect the moveset - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - "TransformUserIntoTarget", # Transform - # Counter moves - "CounterPhysicalDamage", # Counter - "CounterSpecialDamage", # Mirror Coat - "CounterDamagePlusHalf", # Metal Burst # Not listed on Bulbapedia - # Helping Hand, Feint (always blacklisted together, don't know why) - "PowerUpAllyMove", # Helping Hand - "RemoveProtections", # Feint - # Protection moves - "ProtectUser", # Detect, Protect - "ProtectUserSideFromPriorityMoves", # Quick Guard # Not listed on Bulbapedia - "ProtectUserSideFromMultiTargetDamagingMoves", # Wide Guard # Not listed on Bulbapedia - "UserEnduresFaintingThisTurn", # Endure - "ProtectUserSideFromDamagingMovesIfUserFirstTurn", # Mat Block - "ProtectUserSideFromStatusMoves", # Crafty Shield # Not listed on Bulbapedia - "ProtectUserFromDamagingMovesKingsShield", # King's Shield - "ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield - "ProtectUserBanefulBunker", # Baneful Bunker - # Moves that call other moves - "UseLastMoveUsedByTarget", # Mirror Move - "UseLastMoveUsed", # Copycat - "UseMoveTargetIsAboutToUse", # Me First -# "UseMoveDependingOnEnvironment", # Nature Power # See below - "UseRandomUserMoveIfAsleep", # Sleep Talk - "UseRandomMoveFromUserParty", # Assist - "UseRandomMove", # Metronome - # Move-redirecting and stealing moves - "BounceBackProblemCausingStatusMoves", # Magic Coat # Not listed on Bulbapedia - "StealAndUseBeneficialStatusMove", # Snatch - "RedirectAllMovesToUser", # Follow Me, Rage Powder - "RedirectAllMovesToTarget", # Spotlight - # Set up effects that trigger upon KO - "ReduceAttackerMovePPTo0IfUserFaints", # Grudge # Not listed on Bulbapedia - "AttackerFaintsIfUserFaints", # Destiny Bond - # Target-switching moves -# "SwitchOutTargetStatusMove", # Roar, Whirlwind # See below - "SwitchOutTargetDamagingMove", # Circle Throw, Dragon Tail - # Held item-moving moves - "UserTakesTargetItem", # Covet, Thief - "UserTargetSwapItems", # Switcheroo, Trick - "TargetTakesUserItem", # Bestow - # Moves that start focussing at the start of the round - "FailsIfUserDamagedThisTurn", # Focus Punch - "UsedAfterUserTakesPhysicalDamage", # Shell Trap - "BurnAttackerBeforeUserActs", # Beak Blast - # Event moves that do nothing - "DoesNothingFailsIfNoAlly", # Hold Hands - "DoesNothingCongratulations" # Celebrate + # Struggle, Belch + "Struggle", # Struggle + "FailsIfUserNotConsumedBerry", # Belch + # Moves that affect the moveset + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + "TransformUserIntoTarget", # Transform + # Counter moves + "CounterPhysicalDamage", # Counter + "CounterSpecialDamage", # Mirror Coat + "CounterDamagePlusHalf", # Metal Burst # Not listed on Bulbapedia + # Helping Hand, Feint (always blacklisted together, don't know why) + "PowerUpAllyMove", # Helping Hand + "RemoveProtections", # Feint + # Protection moves + "ProtectUser", # Detect, Protect + "ProtectUserSideFromPriorityMoves", # Quick Guard # Not listed on Bulbapedia + "ProtectUserSideFromMultiTargetDamagingMoves", # Wide Guard # Not listed on Bulbapedia + "UserEnduresFaintingThisTurn", # Endure + "ProtectUserSideFromDamagingMovesIfUserFirstTurn", # Mat Block + "ProtectUserSideFromStatusMoves", # Crafty Shield # Not listed on Bulbapedia + "ProtectUserFromDamagingMovesKingsShield", # King's Shield + "ProtectUserFromTargetingMovesSpikyShield", # Spiky Shield + "ProtectUserBanefulBunker", # Baneful Bunker + # Moves that call other moves + "UseLastMoveUsedByTarget", # Mirror Move + "UseLastMoveUsed", # Copycat + "UseMoveTargetIsAboutToUse", # Me First +# "UseMoveDependingOnEnvironment", # Nature Power # See below + "UseRandomUserMoveIfAsleep", # Sleep Talk + "UseRandomMoveFromUserParty", # Assist + "UseRandomMove", # Metronome + # Move-redirecting and stealing moves + "BounceBackProblemCausingStatusMoves", # Magic Coat # Not listed on Bulbapedia + "StealAndUseBeneficialStatusMove", # Snatch + "RedirectAllMovesToUser", # Follow Me, Rage Powder + "RedirectAllMovesToTarget", # Spotlight + # Set up effects that trigger upon KO + "ReduceAttackerMovePPTo0IfUserFaints", # Grudge # Not listed on Bulbapedia + "AttackerFaintsIfUserFaints", # Destiny Bond + # Target-switching moves +# "SwitchOutTargetStatusMove", # Roar, Whirlwind # See below + "SwitchOutTargetDamagingMove", # Circle Throw, Dragon Tail + # Held item-moving moves + "UserTakesTargetItem", # Covet, Thief + "UserTargetSwapItems", # Switcheroo, Trick + "TargetTakesUserItem", # Bestow + # Moves that start focussing at the start of the round + "FailsIfUserDamagedThisTurn", # Focus Punch + "UsedAfterUserTakesPhysicalDamage", # Shell Trap + "BurnAttackerBeforeUserActs", # Beak Blast + # Event moves that do nothing + "DoesNothingFailsIfNoAlly", # Hold Hands + "DoesNothingCongratulations" # Celebrate ] if Settings::MECHANICS_GENERATION >= 6 @moveBlacklist += [ - # Moves that call other moves - "UseMoveDependingOnEnvironment", # Nature Power - # Two-turn attacks - "TwoTurnAttack", # Razor Wind # Not listed on Bulbapedia - "TwoTurnAttackOneTurnInSun", # Solar Beam, Solar Blade # Not listed on Bulbapedia - "TwoTurnAttackParalyzeTarget", # Freeze Shock # Not listed on Bulbapedia - "TwoTurnAttackBurnTarget", # Ice Burn # Not listed on Bulbapedia - "TwoTurnAttackFlinchTarget", # Sky Attack # Not listed on Bulbapedia - "TwoTurnAttackChargeRaiseUserDefense1", # Skull Bash # Not listed on Bulbapedia - "TwoTurnAttackInvulnerableInSky", # Fly - "TwoTurnAttackInvulnerableUnderground", # Dig - "TwoTurnAttackInvulnerableUnderwater", # Dive - "TwoTurnAttackInvulnerableInSkyParalyzeTarget", # Bounce - "TwoTurnAttackInvulnerableRemoveProtections", # Shadow Force/Phantom Force - "TwoTurnAttackInvulnerableInSkyTargetCannotAct", # Sky Drop - "AllBattlersLoseHalfHPUserSkipsNextTurn", # Shadow Half - "TwoTurnAttackRaiseUserSpAtkSpDefSpd2", # Geomancy # Not listed on Bulbapedia - # Target-switching moves - "SwitchOutTargetStatusMove" # Roar, Whirlwind + # Moves that call other moves + "UseMoveDependingOnEnvironment", # Nature Power + # Two-turn attacks + "TwoTurnAttack", # Razor Wind # Not listed on Bulbapedia + "TwoTurnAttackOneTurnInSun", # Solar Beam, Solar Blade # Not listed on Bulbapedia + "TwoTurnAttackParalyzeTarget", # Freeze Shock # Not listed on Bulbapedia + "TwoTurnAttackBurnTarget", # Ice Burn # Not listed on Bulbapedia + "TwoTurnAttackFlinchTarget", # Sky Attack # Not listed on Bulbapedia + "TwoTurnAttackChargeRaiseUserDefense1", # Skull Bash # Not listed on Bulbapedia + "TwoTurnAttackInvulnerableInSky", # Fly + "TwoTurnAttackInvulnerableUnderground", # Dig + "TwoTurnAttackInvulnerableUnderwater", # Dive + "TwoTurnAttackInvulnerableInSkyParalyzeTarget", # Bounce + "TwoTurnAttackInvulnerableRemoveProtections", # Shadow Force/Phantom Force + "TwoTurnAttackInvulnerableInSkyTargetCannotAct", # Sky Drop + "AllBattlersLoseHalfHPUserSkipsNextTurn", # Shadow Half + "TwoTurnAttackRaiseUserSpAtkSpDefSpd2", # Geomancy # Not listed on Bulbapedia + # Target-switching moves + "SwitchOutTargetStatusMove" # Roar, Whirlwind ] end end @@ -1127,41 +1127,41 @@ class Battle::Move::UseRandomUserMoveIfAsleep < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - "MultiTurnAttackPreventSleeping", # Uproar - "MultiTurnAttackBideThenReturnDoubleDamage", # Bide - # Struggle, Belch - "Struggle", # Struggle # Not listed on Bulbapedia - "FailsIfUserNotConsumedBerry", # Belch - # Moves that affect the moveset (except Transform) - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - # Moves that call other moves - "UseLastMoveUsedByTarget", # Mirror Move - "UseLastMoveUsed", # Copycat - "UseMoveTargetIsAboutToUse", # Me First - "UseMoveDependingOnEnvironment", # Nature Power # Not listed on Bulbapedia - "UseRandomUserMoveIfAsleep", # Sleep Talk - "UseRandomMoveFromUserParty", # Assist - "UseRandomMove", # Metronome - # Two-turn attacks - "TwoTurnAttack", # Razor Wind - "TwoTurnAttackOneTurnInSun", # Solar Beam, Solar Blade - "TwoTurnAttackParalyzeTarget", # Freeze Shock - "TwoTurnAttackBurnTarget", # Ice Burn - "TwoTurnAttackFlinchTarget", # Sky Attack - "TwoTurnAttackChargeRaiseUserDefense1", # Skull Bash - "TwoTurnAttackInvulnerableInSky", # Fly - "TwoTurnAttackInvulnerableUnderground", # Dig - "TwoTurnAttackInvulnerableUnderwater", # Dive - "TwoTurnAttackInvulnerableInSkyParalyzeTarget", # Bounce - "TwoTurnAttackInvulnerableRemoveProtections", # Shadow Force/Phantom Force - "TwoTurnAttackInvulnerableInSkyTargetCannotAct", # Sky Drop - "AllBattlersLoseHalfHPUserSkipsNextTurn", # Shadow Half - "TwoTurnAttackRaiseUserSpAtkSpDefSpd2", # Geomancy - # Moves that start focussing at the start of the round - "FailsIfUserDamagedThisTurn", # Focus Punch - "UsedAfterUserTakesPhysicalDamage", # Shell Trap - "BurnAttackerBeforeUserActs" # Beak Blast + "MultiTurnAttackPreventSleeping", # Uproar + "MultiTurnAttackBideThenReturnDoubleDamage", # Bide + # Struggle, Belch + "Struggle", # Struggle # Not listed on Bulbapedia + "FailsIfUserNotConsumedBerry", # Belch + # Moves that affect the moveset (except Transform) + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + # Moves that call other moves + "UseLastMoveUsedByTarget", # Mirror Move + "UseLastMoveUsed", # Copycat + "UseMoveTargetIsAboutToUse", # Me First + "UseMoveDependingOnEnvironment", # Nature Power # Not listed on Bulbapedia + "UseRandomUserMoveIfAsleep", # Sleep Talk + "UseRandomMoveFromUserParty", # Assist + "UseRandomMove", # Metronome + # Two-turn attacks + "TwoTurnAttack", # Razor Wind + "TwoTurnAttackOneTurnInSun", # Solar Beam, Solar Blade + "TwoTurnAttackParalyzeTarget", # Freeze Shock + "TwoTurnAttackBurnTarget", # Ice Burn + "TwoTurnAttackFlinchTarget", # Sky Attack + "TwoTurnAttackChargeRaiseUserDefense1", # Skull Bash + "TwoTurnAttackInvulnerableInSky", # Fly + "TwoTurnAttackInvulnerableUnderground", # Dig + "TwoTurnAttackInvulnerableUnderwater", # Dive + "TwoTurnAttackInvulnerableInSkyParalyzeTarget", # Bounce + "TwoTurnAttackInvulnerableRemoveProtections", # Shadow Force/Phantom Force + "TwoTurnAttackInvulnerableInSkyTargetCannotAct", # Sky Drop + "AllBattlersLoseHalfHPUserSkipsNextTurn", # Shadow Half + "TwoTurnAttackRaiseUserSpAtkSpDefSpd2", # Geomancy + # Moves that start focussing at the start of the round + "FailsIfUserDamagedThisTurn", # Focus Punch + "UsedAfterUserTakesPhysicalDamage", # Shell Trap + "BurnAttackerBeforeUserActs" # Beak Blast ] end @@ -1220,13 +1220,13 @@ class Battle::Move::ReplaceMoveThisBattleWithTargetLastMoveUsed < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - "UseRandomMove", # Metronome - # Struggle - "Struggle", # Struggle - # Moves that affect the moveset - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - "TransformUserIntoTarget" # Transform + "UseRandomMove", # Metronome + # Struggle + "Struggle", # Struggle + # Moves that affect the moveset + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + "TransformUserIntoTarget" # Transform ] end @@ -1271,9 +1271,9 @@ class Battle::Move::ReplaceMoveWithTargetLastMoveUsed < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - "ReplaceMoveWithTargetLastMoveUsed", # Sketch (this move) - # Struggle - "Struggle" # Struggle + "ReplaceMoveWithTargetLastMoveUsed", # Sketch (this move) + # Struggle + "Struggle" # Struggle ] end diff --git a/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb b/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb index e9d0114e6..9bf0c6efc 100644 --- a/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb +++ b/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb @@ -545,44 +545,44 @@ class Battle::Move::TargetUsesItsLastUsedMoveAgain < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - "MultiTurnAttackBideThenReturnDoubleDamage", # Bide - "ProtectUserFromDamagingMovesKingsShield", # King's Shield - "TargetUsesItsLastUsedMoveAgain", # Instruct (this move) - # Struggle - "Struggle", # Struggle - # Moves that affect the moveset - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - "TransformUserIntoTarget", # Transform - # Moves that call other moves - "UseLastMoveUsedByTarget", # Mirror Move - "UseLastMoveUsed", # Copycat - "UseMoveTargetIsAboutToUse", # Me First - "UseMoveDependingOnEnvironment", # Nature Power - "UseRandomUserMoveIfAsleep", # Sleep Talk - "UseRandomMoveFromUserParty", # Assist - "UseRandomMove", # Metronome - # Moves that require a recharge turn - "AttackAndSkipNextTurn", # Hyper Beam - # Two-turn attacks - "TwoTurnAttack", # Razor Wind - "TwoTurnAttackOneTurnInSun", # Solar Beam, Solar Blade - "TwoTurnAttackParalyzeTarget", # Freeze Shock - "TwoTurnAttackBurnTarget", # Ice Burn - "TwoTurnAttackFlinchTarget", # Sky Attack - "TwoTurnAttackChargeRaiseUserDefense1", # Skull Bash - "TwoTurnAttackInvulnerableInSky", # Fly - "TwoTurnAttackInvulnerableUnderground", # Dig - "TwoTurnAttackInvulnerableUnderwater", # Dive - "TwoTurnAttackInvulnerableInSkyParalyzeTarget", # Bounce - "TwoTurnAttackInvulnerableRemoveProtections", # Shadow Force, Phantom Force - "TwoTurnAttackInvulnerableInSkyTargetCannotAct", # Sky Drop - "AllBattlersLoseHalfHPUserSkipsNextTurn", # Shadow Half - "TwoTurnAttackRaiseUserSpAtkSpDefSpd2", # Geomancy - # Moves that start focussing at the start of the round - "FailsIfUserDamagedThisTurn", # Focus Punch - "UsedAfterUserTakesPhysicalDamage", # Shell Trap - "BurnAttackerBeforeUserActs" # Beak Blast + "MultiTurnAttackBideThenReturnDoubleDamage", # Bide + "ProtectUserFromDamagingMovesKingsShield", # King's Shield + "TargetUsesItsLastUsedMoveAgain", # Instruct (this move) + # Struggle + "Struggle", # Struggle + # Moves that affect the moveset + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + "TransformUserIntoTarget", # Transform + # Moves that call other moves + "UseLastMoveUsedByTarget", # Mirror Move + "UseLastMoveUsed", # Copycat + "UseMoveTargetIsAboutToUse", # Me First + "UseMoveDependingOnEnvironment", # Nature Power + "UseRandomUserMoveIfAsleep", # Sleep Talk + "UseRandomMoveFromUserParty", # Assist + "UseRandomMove", # Metronome + # Moves that require a recharge turn + "AttackAndSkipNextTurn", # Hyper Beam + # Two-turn attacks + "TwoTurnAttack", # Razor Wind + "TwoTurnAttackOneTurnInSun", # Solar Beam, Solar Blade + "TwoTurnAttackParalyzeTarget", # Freeze Shock + "TwoTurnAttackBurnTarget", # Ice Burn + "TwoTurnAttackFlinchTarget", # Sky Attack + "TwoTurnAttackChargeRaiseUserDefense1", # Skull Bash + "TwoTurnAttackInvulnerableInSky", # Fly + "TwoTurnAttackInvulnerableUnderground", # Dig + "TwoTurnAttackInvulnerableUnderwater", # Dive + "TwoTurnAttackInvulnerableInSkyParalyzeTarget", # Bounce + "TwoTurnAttackInvulnerableRemoveProtections", # Shadow Force, Phantom Force + "TwoTurnAttackInvulnerableInSkyTargetCannotAct", # Sky Drop + "AllBattlersLoseHalfHPUserSkipsNextTurn", # Shadow Half + "TwoTurnAttackRaiseUserSpAtkSpDefSpd2", # Geomancy + # Moves that start focussing at the start of the round + "FailsIfUserDamagedThisTurn", # Focus Punch + "UsedAfterUserTakesPhysicalDamage", # Shell Trap + "BurnAttackerBeforeUserActs" # Beak Blast ] end @@ -771,26 +771,26 @@ class Battle::Move::DisableTargetUsingDifferentMove < Battle::Move def initialize(battle, move) super @moveBlacklist = [ - "DisableTargetUsingDifferentMove", # Encore - # Struggle - "Struggle", # Struggle - # Moves that affect the moveset - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - "TransformUserIntoTarget", # Transform - # Moves that call other moves (see also below) - "UseLastMoveUsedByTarget" # Mirror Move + "DisableTargetUsingDifferentMove", # Encore + # Struggle + "Struggle", # Struggle + # Moves that affect the moveset + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + "TransformUserIntoTarget", # Transform + # Moves that call other moves (see also below) + "UseLastMoveUsedByTarget" # Mirror Move ] if Settings::MECHANICS_GENERATION >= 7 @moveBlacklist += [ - # Moves that call other moves -# "UseLastMoveUsedByTarget", # Mirror Move # See above - "UseLastMoveUsed", # Copycat - "UseMoveTargetIsAboutToUse", # Me First - "UseMoveDependingOnEnvironment", # Nature Power - "UseRandomUserMoveIfAsleep", # Sleep Talk - "UseRandomMoveFromUserParty", # Assist - "UseRandomMove" # Metronome + # Moves that call other moves +# "UseLastMoveUsedByTarget", # Mirror Move # See above + "UseLastMoveUsed", # Copycat + "UseMoveTargetIsAboutToUse", # Me First + "UseMoveDependingOnEnvironment", # Nature Power + "UseRandomUserMoveIfAsleep", # Sleep Talk + "UseRandomMoveFromUserParty", # Assist + "UseRandomMove" # Metronome ] end end diff --git a/Data/Scripts/011_Battle/004_Scene/001_Battle_Scene.rb b/Data/Scripts/011_Battle/004_Scene/001_Battle_Scene.rb index 97eac2766..34b726007 100644 --- a/Data/Scripts/011_Battle/004_Scene/001_Battle_Scene.rb +++ b/Data/Scripts/011_Battle/004_Scene/001_Battle_Scene.rb @@ -64,11 +64,11 @@ class Battle::Scene # Shift depending on index (no shifting needed for sideSize of 1) case sideSize when 2 - ret[0] += [-48, 48, 32, -32][2 * index + side] - ret[1] += [ 0, 0, 0, -16][2 * index + side] + ret[0] += [-48, 48, 32, -32][(2 * index) + side] + ret[1] += [ 0, 0, 0, -16][(2 * index) + side] when 3 - ret[0] += [-80, 80, 0, 0, 80, -80][2 * index + side] - ret[1] += [ 0, 0, 0, -8, 0, -16][2 * index + side] + ret[0] += [-80, 80, 0, 0, 80, -80][(2 * index) + side] + ret[1] += [ 0, 0, 0, -8, 0, -16][(2 * index) + side] end return ret end diff --git a/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb b/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb index b698cd463..4b629e207 100644 --- a/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb +++ b/Data/Scripts/011_Battle/004_Scene/002_Scene_Initialize.rb @@ -83,7 +83,7 @@ class Battle::Scene # Wild battle, so set up the Pokémon sprite(s) accordingly if @battle.wildBattle? @battle.pbParty(1).each_with_index do |pkmn, i| - index = i * 2 + 1 + index = (i * 2) + 1 pbChangePokemon(index, pkmn) pkmnSprite = @sprites["pokemon_#{index}"] pkmnSprite.tone = Tone.new(-80, -80, -80) diff --git a/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb b/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb index 56c174d11..4a06e3cdc 100644 --- a/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb +++ b/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb @@ -6,11 +6,11 @@ class Battle::Scene def pbCommandMenu(idxBattler, firstAction) shadowTrainer = (GameData::Type.exists?(:SHADOW) && @battle.trainerBattle?) cmds = [ - _INTL("What will\n{1} do?", @battle.battlers[idxBattler].name), - _INTL("Fight"), - _INTL("Bag"), - _INTL("Pokémon"), - (shadowTrainer) ? _INTL("Call") : (firstAction) ? _INTL("Run") : _INTL("Cancel") + _INTL("What will\n{1} do?", @battle.battlers[idxBattler].name), + _INTL("Fight"), + _INTL("Bag"), + _INTL("Pokémon"), + (shadowTrainer) ? _INTL("Call") : (firstAction) ? _INTL("Run") : _INTL("Cancel") ] ret = pbCommandMenuEx(idxBattler, cmds, (shadowTrainer) ? 2 : (firstAction) ? 0 : 1) ret = 4 if ret == 3 && shadowTrainer # Convert "Run" to "Call" diff --git a/Data/Scripts/011_Battle/004_Scene/004_Scene_PlayAnimations.rb b/Data/Scripts/011_Battle/004_Scene/004_Scene_PlayAnimations.rb index a638bf8da..171081d8d 100644 --- a/Data/Scripts/011_Battle/004_Scene/004_Scene_PlayAnimations.rb +++ b/Data/Scripts/011_Battle/004_Scene/004_Scene_PlayAnimations.rb @@ -28,7 +28,7 @@ class Battle::Scene # shiny animation(s) # Set up data box animation for i in 0...@battle.sideSizes[1] - idxBattler = 2 * i + 1 + idxBattler = (2 * i) + 1 next if !@battle.battlers[idxBattler] dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, idxBattler) @animations.push(dataBoxAnim) @@ -43,7 +43,7 @@ class Battle::Scene # Show shiny animation for wild Pokémon if @battle.showAnims for i in 0...@battle.sideSizes[1] - idxBattler = 2 * i + 1 + idxBattler = (2 * i) + 1 next if !@battle.battlers[idxBattler] || !@battle.battlers[idxBattler].shiny? if Settings::SUPER_SHINY && @battle.battlers[idxBattler].super_shiny? pbCommonAnimation("SuperShiny", @battle.battlers[idxBattler]) @@ -58,13 +58,14 @@ class Battle::Scene # Animates a party lineup appearing for the given side #============================================================================= def pbShowPartyLineup(side, fullAnim = false) - @animations.push(Animation::LineupAppear.new( - @sprites, @viewport, side, @battle.pbParty(side), @battle.pbPartyStarts(side), fullAnim - )) - if !fullAnim - while inPartyAnimation? - pbUpdate - end + @animations.push( + Animation::LineupAppear.new(@sprites, @viewport, side, + @battle.pbParty(side), @battle.pbPartyStarts(side), + fullAnim) + ) + return if fullAnim + while inPartyAnimation? + pbUpdate end end @@ -298,13 +299,13 @@ class Battle::Scene #============================================================================= def pbLevelUp(pkmn, _battler, oldTotalHP, oldAttack, oldDefense, oldSpAtk, oldSpDef, oldSpeed) pbTopRightWindow( - _INTL("Max. HP+{1}\r\nAttack+{2}\r\nDefense+{3}\r\nSp. Atk+{4}\r\nSp. Def+{5}\r\nSpeed+{6}", - pkmn.totalhp - oldTotalHP, pkmn.attack - oldAttack, pkmn.defense - oldDefense, - pkmn.spatk - oldSpAtk, pkmn.spdef - oldSpDef, pkmn.speed - oldSpeed) + _INTL("Max. HP+{1}\r\nAttack+{2}\r\nDefense+{3}\r\nSp. Atk+{4}\r\nSp. Def+{5}\r\nSpeed+{6}", + pkmn.totalhp - oldTotalHP, pkmn.attack - oldAttack, pkmn.defense - oldDefense, + pkmn.spatk - oldSpAtk, pkmn.spdef - oldSpDef, pkmn.speed - oldSpeed) ) pbTopRightWindow( - _INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", - pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed) + _INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", + pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed) ) end @@ -541,7 +542,7 @@ class Battle::Scene end animPlayer.setLineTransform( FOCUSUSER_X, FOCUSUSER_Y, FOCUSTARGET_X, FOCUSTARGET_Y, - oldUserX, oldUserY - userHeight / 2, oldTargetX, oldTargetY - targetHeight / 2 + oldUserX, oldUserY - (userHeight / 2), oldTargetX, oldTargetY - (targetHeight / 2) ) # Play the animation animPlayer.start diff --git a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb index 8a7610fc8..554405c59 100644 --- a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb +++ b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb @@ -106,11 +106,11 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase USE_GRAPHICS = true # Lists of which button graphics to use in different situations/types of battle. MODES = [ - [0, 2, 1, 3], # 0 = Regular battle - [0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run" - [0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run" - [5, 7, 6, 3], # 3 = Safari Zone - [0, 8, 1, 3] # 4 = Bug Catching Contest + [0, 2, 1, 3], # 0 = Regular battle + [0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run" + [0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run" + [5, 7, 6, 3], # 3 = Safari Zone + [0, 8, 1, 3] # 4 = Bug Catching Contest ] def initialize(viewport, z) @@ -137,7 +137,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase button = SpriteWrapper.new(viewport) button.bitmap = @buttonBitmap.bitmap button.x = self.x + Graphics.width - 260 - button.x += (i.even? ? 0 : @buttonBitmap.width / 2 - 4) + button.x += (i.even? ? 0 : (@buttonBitmap.width / 2) - 4) button.y = self.y + 6 button.y += (((i / 2) == 0) ? 0 : BUTTON_HEIGHT - 4) button.src_rect.width = @buttonBitmap.width / 2 @@ -218,10 +218,10 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase TYPE_ICON_HEIGHT = 28 # Text colours of PP of selected move PP_COLORS = [ - Color.new(248, 72, 72), Color.new(136, 48, 48), # Red, zero PP - Color.new(248, 136, 32), Color.new(144, 72, 24), # Orange, 1/4 of total PP or less - Color.new(248, 192, 0), Color.new(144, 104, 0), # Yellow, 1/2 of total PP or less - TEXT_BASE_COLOR, TEXT_SHADOW_COLOR # Black, more than 1/2 of total PP + Color.new(248, 72, 72), Color.new(136, 48, 48), # Red, zero PP + Color.new(248, 136, 32), Color.new(144, 72, 24), # Orange, 1/4 of total PP or less + Color.new(248, 192, 0), Color.new(144, 104, 0), # Yellow, 1/2 of total PP or less + TEXT_BASE_COLOR, TEXT_SHADOW_COLOR # Black, more than 1/2 of total PP ] def initialize(viewport, z) @@ -247,7 +247,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase button = SpriteWrapper.new(viewport) button.bitmap = @buttonBitmap.bitmap button.x = self.x + 4 - button.x += (i.even? ? 0 : @buttonBitmap.width / 2 - 4) + button.x += (i.even? ? 0 : (@buttonBitmap.width / 2) - 4) button.y = self.y + 6 button.y += (((i / 2) == 0) ? 0 : BUTTON_HEIGHT - 4) button.src_rect.width = @buttonBitmap.width / 2 @@ -278,7 +278,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase @megaButton = SpriteWrapper.new(viewport) @megaButton.bitmap = @megaEvoBitmap.bitmap @megaButton.x = self.x + 120 - @megaButton.y = self.y - @megaEvoBitmap.height / 2 + @megaButton.y = self.y - (@megaEvoBitmap.height / 2) @megaButton.src_rect.height = @megaEvoBitmap.height / 2 addSprite("megaButton", @megaButton) # Create Shift button @@ -354,7 +354,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase textPos = [] @buttons.each_with_index do |button, i| next if !@visibility["button_#{i}"] - x = button.x - self.x + button.src_rect.width / 2 + x = button.x - self.x + (button.src_rect.width / 2) y = button.y - self.y + 2 moveNameBase = TEXT_BASE_COLOR if GET_MOVE_TEXT_COLOR_FROM_MOVE_BUTTON && moves[i].display_type(@battler) @@ -414,7 +414,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase ppFraction = [(4.0 * move.pp / move.total_pp).ceil, 3].min textPos = [] textPos.push([_INTL("PP: {1}/{2}", move.pp, move.total_pp), - 448, 44, 2, PP_COLORS[ppFraction * 2], PP_COLORS[ppFraction * 2 + 1]]) + 448, 44, 2, PP_COLORS[ppFraction * 2], PP_COLORS[(ppFraction * 2) + 1]]) pbDrawTextPositions(@infoOverlay.bitmap, textPos) end end @@ -454,11 +454,11 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase # Lists of which button graphics to use in different situations/types of battle. MODES = [ - [0, 2, 1, 3], # 0 = Regular battle - [0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run" - [0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run" - [5, 7, 6, 3], # 3 = Safari Zone - [0, 8, 1, 3] # 4 = Bug Catching Contest + [0, 2, 1, 3], # 0 = Regular battle + [0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run" + [0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run" + [5, 7, 6, 3], # 3 = Safari Zone + [0, 8, 1, 3] # 4 = Bug Catching Contest ] CMD_BUTTON_WIDTH_SMALL = 170 TEXT_BASE_COLOR = Color.new(240, 248, 224) @@ -467,7 +467,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase def initialize(viewport, z, sideSizes) super(viewport) @sideSizes = sideSizes - maxIndex = (@sideSizes[0] > @sideSizes[1]) ? (@sideSizes[0] - 1) * 2 : @sideSizes[1] * 2 - 1 + maxIndex = (@sideSizes[0] > @sideSizes[1]) ? (@sideSizes[0] - 1) * 2 : (@sideSizes[1] * 2) - 1 @smallButtons = (@sideSizes.max > 2) self.x = 0 self.y = Graphics.height - 96 @@ -483,7 +483,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase # NOTE: Battler indexes go from left to right from the perspective of # that side's trainer, so inc is different for each side for the # same value of i/2. - inc = (i.even?) ? i / 2 : numButtons - 1 - i / 2 + inc = (i.even?) ? i / 2 : numButtons - 1 - (i / 2) button = SpriteWrapper.new(viewport) button.bitmap = @buttonBitmap.bitmap button.src_rect.width = (@smallButtons) ? CMD_BUTTON_WIDTH_SMALL : @buttonBitmap.width / 2 @@ -536,7 +536,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase sel ||= (@mode == 1) buttonType = (i.even?) ? 1 : 2 end - buttonType = 2 * buttonType + ((@smallButtons) ? 1 : 0) + buttonType = (2 * buttonType) + ((@smallButtons) ? 1 : 0) button.src_rect.x = (sel) ? @buttonBitmap.width / 2 : 0 button.src_rect.y = buttonType * BUTTON_HEIGHT button.z = self.z + ((sel) ? 3 : 2) @@ -546,7 +546,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase textpos = [] @buttons.each_with_index do |button, i| next if !button || nil_or_empty?(@texts[i]) - x = button.x - self.x + button.src_rect.width / 2 + x = button.x - self.x + (button.src_rect.width / 2) y = button.y - self.y + 2 textpos.push([@texts[i], x, y, 2, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR]) end diff --git a/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb b/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb index 1afa12678..ace6ba022 100644 --- a/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb +++ b/Data/Scripts/011_Battle/004_Scene/006_Battle_Scene_Objects.rb @@ -96,7 +96,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper @contents = BitmapWrapper.new(@databoxBitmap.width, @databoxBitmap.height) self.bitmap = @contents self.visible = false - self.z = 150 + ((@battler.index) / 2) * 5 + self.z = 150 + ((@battler.index / 2) * 5) pbSetSystemFont(self.bitmap) end @@ -538,9 +538,9 @@ class Battle::Scene::BattlerSprite < RPG::Sprite return if !@_iconBitmap pbSetOrigin if @index.even? - self.z = 50 + 5 * @index / 2 + self.z = 50 + (5 * @index / 2) else - self.z = 50 - 5 * (@index + 1) / 2 + self.z = 50 - (5 * (@index + 1) / 2) end # Set original position p = Battle::Scene.pbBattlerPosition(@index, @sideSize) diff --git a/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb b/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb index 7eff14012..fef655c7a 100644 --- a/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb +++ b/Data/Scripts/011_Battle/004_Scene/007_Battle_Scene_BaseAnimation.rb @@ -102,7 +102,7 @@ module Battle::Scene::Animation::BallAnimationMixin ball.setVisible(7, true) ballStartX = traSprite.x ballStartX -= ball.totalDuration * (Graphics.width / (2 * 16)) if !safariThrow - ballStartY = traSprite.y - traSprite.bitmap.height / 2 + ballStartY = traSprite.y - (traSprite.bitmap.height / 2) return ballStartX, ballStartY end # Back sprite is animated, make the Poké Ball track the trainer's hand @@ -166,13 +166,13 @@ module Battle::Scene::Animation::BallAnimationMixin # throw). Instead, that throw animation and initialDelay are designed # to make sure the Ball's trajectory starts at the same position. ball.setVisible(delay, true) - a = 2 * startY - 4 * midY + 2 * endY - b = 4 * midY - 3 * startY - endY + a = (2 * startY) - (4 * midY) + (2 * endY) + b = (4 * midY) - (3 * startY) - endY c = startY for i in 1..duration - t = i.to_f / duration # t ranges from 0 to 1 - x = startX + (endX - startX) * t # Linear in t - y = a * t**2 + b * t + c # Quadratic in t + t = i.to_f / duration # t ranges from 0 to 1 + x = startX + ((endX - startX) * t) # Linear in t + y = (a * (t**2)) + (b * t) + c # Quadratic in t ball.moveXY(delay + i - 1, 1, x, y) end createBallTumbling(ball, delay, duration) diff --git a/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb b/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb index 8734a8eeb..b079d7586 100644 --- a/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb +++ b/Data/Scripts/011_Battle/004_Scene/008_Battle_Scene_Animations.rb @@ -28,7 +28,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation end else # Wild battle @battle.pbParty(1).each_with_index do |_pkmn, i| - idxBattler = 2 * i + 1 + idxBattler = (2 * i) + 1 makeSlideSprite("pokemon_#{idxBattler}", -1, appearTime, PictureOrigin::Bottom) end end @@ -71,7 +71,7 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation def createProcesses for i in 0...@sideSize - idxBattler = 2 * i + 1 + idxBattler = (2 * i) + 1 next if !@sprites["pokemon_#{idxBattler}"] battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::Bottom) battler.moveTone(0, 4, Tone.new(0, 0, 0, 0)) @@ -112,7 +112,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation ballY = barY - 30 barX -= bar.bitmap.width end - ballXdiff = 32 * (1 - 2 * @side) + ballXdiff = 32 * (1 - (2 * @side)) bar.x = barX bar.y = barY bar.opacity = 255 @@ -155,7 +155,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation bar.moveDelta(0, 8, -dir * Graphics.width / 2, 0) delay = bar.totalDuration for i in 0...Battle::Scene::NUM_BALLS - createBall(i, (@fullAnim) ? delay + i * 2 : 0, dir) + createBall(i, (@fullAnim) ? delay + (i * 2) : 0, dir) end end @@ -287,7 +287,7 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation # Make new trainer sprite move on-screen if @sprites["trainer_#{@idxTrainer + 1}"] trainerX, trainerY = Battle::Scene.pbTrainerPosition(1) - trainerX += 64 + Graphics.width / 4 + trainerX += 64 + (Graphics.width / 4) newTrainer = addSprite(@sprites["trainer_#{@idxTrainer + 1}"], PictureOrigin::Bottom) newTrainer.setVisible(delay, true) newTrainer.setXY(delay, trainerX, trainerY) @@ -342,7 +342,7 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation for i in 0...Battle::Scene::NUM_BALLS next if !@sprites["partyBall_0_#{i}"] || !@sprites["partyBall_0_#{i}"].visible partyBall = addSprite(@sprites["partyBall_0_#{i}"]) - partyBall.moveDelta(delay + 2 * i, 16, -Graphics.width, 0) if @fullAnim + partyBall.moveDelta(delay + (2 * i), 16, -Graphics.width, 0) if @fullAnim partyBall.moveOpacity(delay, 12, 0) partyBall.setVisible(delay + 12, false) partyBall.setOpacity(delay + 12, 255) @@ -387,7 +387,7 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation for i in 0...Battle::Scene::NUM_BALLS next if !@sprites["partyBall_1_#{i}"] || !@sprites["partyBall_1_#{i}"].visible partyBall = addSprite(@sprites["partyBall_1_#{i}"]) - partyBall.moveDelta(delay + 2 * i, 16, Graphics.width, 0) if @fullAnim + partyBall.moveDelta(delay + (2 * i), 16, Graphics.width, 0) if @fullAnim partyBall.moveOpacity(delay, 12, 0) partyBall.setVisible(delay + 12, false) partyBall.setOpacity(delay + 12, 255) @@ -782,12 +782,12 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to delay -= t if i == 0 if i > 0 - ball.setZoomXY(delay, 100 + 5 * (5 - i), 100 - 5 * (5 - i)) # Squish + ball.setZoomXY(delay, 100 + (5 * (5 - i)), 100 - (5 * (5 - i))) # Squish ball.moveZoom(delay, 2, 100) # Unsquish - ball.moveXY(delay, t, ballEndX, ballGroundY - (ballGroundY - ballEndY) / d) + ball.moveXY(delay, t, ballEndX, ballGroundY - ((ballGroundY - ballEndY) / d)) end ball.moveXY(delay + t, t, ballEndX, ballGroundY) - ball.setSE(delay + 2 * t, "Battle ball drop", 100 - i * 7) + ball.setSE(delay + (2 * t), "Battle ball drop", 100 - (i * 7)) delay = ball.totalDuration end battler.setXY(ball.totalDuration, ballEndX, ballGroundY) @@ -795,9 +795,9 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation delay = ball.totalDuration + 12 for i in 0...[@numShakes, 3].min ball.setSE(delay, "Battle ball shake") - ball.moveXY(delay, 2, ballEndX - 2 * (4 - i), ballGroundY) + ball.moveXY(delay, 2, ballEndX - (2 * (4 - i)), ballGroundY) ball.moveAngle(delay, 2, 5 * (4 - i)) # positive means counterclockwise - ball.moveXY(delay + 2, 4, ballEndX + 2 * (4 - i), ballGroundY) + ball.moveXY(delay + 2, 4, ballEndX + (2 * (4 - i)), ballGroundY) ball.moveAngle(delay + 2, 4, -5 * (4 - i)) # negative means clockwise ball.moveXY(delay + 6, 2, ballEndX, ballGroundY) ball.moveAngle(delay + 6, 2, 0) diff --git a/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb b/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb index 3e4434d44..1990cbc48 100644 --- a/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb +++ b/Data/Scripts/011_Battle/005_AI/002_AI_Item.rb @@ -29,24 +29,24 @@ class Battle::AI pkmn = battler.pokemon # Item categories hpItems = { - :POTION => 20, - :SUPERPOTION => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 60 : 50, - :HYPERPOTION => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 120 : 200, - :MAXPOTION => 999, - :BERRYJUICE => 20, - :SWEETHEART => 20, - :FRESHWATER => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 30 : 50, - :SODAPOP => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 50 : 60, - :LEMONADE => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 70 : 80, - :MOOMOOMILK => 100, - :ORANBERRY => 10, - :SITRUSBERRY => battler.totalhp / 4, - :ENERGYPOWDER => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 60 : 50, - :ENERGYROOT => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 120 : 200 + :POTION => 20, + :SUPERPOTION => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 60 : 50, + :HYPERPOTION => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 120 : 200, + :MAXPOTION => 999, + :BERRYJUICE => 20, + :SWEETHEART => 20, + :FRESHWATER => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 30 : 50, + :SODAPOP => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 50 : 60, + :LEMONADE => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 70 : 80, + :MOOMOOMILK => 100, + :ORANBERRY => 10, + :SITRUSBERRY => battler.totalhp / 4, + :ENERGYPOWDER => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 60 : 50, + :ENERGYROOT => (Settings::REBALANCED_HEALING_ITEM_AMOUNTS) ? 120 : 200 } hpItems[:RAGECANDYBAR] = 20 if !Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS fullRestoreItems = [ - :FULLRESTORE + :FULLRESTORE ] oneStatusItems = [ # Preferred over items that heal all status problems :AWAKENING, :CHESTOBERRY, :BLUEFLUTE, @@ -56,43 +56,43 @@ class Battle::AI :ICEHEAL, :ASPEARBERRY ] allStatusItems = [ - :FULLHEAL, :LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE, - :SHALOURSABLE, :BIGMALASADA, :PEWTERCRUNCHIES, :LUMBERRY, :HEALPOWDER + :FULLHEAL, :LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE, + :SHALOURSABLE, :BIGMALASADA, :PEWTERCRUNCHIES, :LUMBERRY, :HEALPOWDER ] allStatusItems.push(:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS xItems = { - :XATTACK => [:ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XATTACK2 => [:ATTACK, 2], - :XATTACK3 => [:ATTACK, 3], - :XATTACK6 => [:ATTACK, 6], - :XDEFENSE => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XDEFENSE2 => [:DEFENSE, 2], - :XDEFENSE3 => [:DEFENSE, 3], - :XDEFENSE6 => [:DEFENSE, 6], - :XDEFEND => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XDEFEND2 => [:DEFENSE, 2], - :XDEFEND3 => [:DEFENSE, 3], - :XDEFEND6 => [:DEFENSE, 6], - :XSPATK => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XSPATK2 => [:SPECIAL_ATTACK, 2], - :XSPATK3 => [:SPECIAL_ATTACK, 3], - :XSPATK6 => [:SPECIAL_ATTACK, 6], - :XSPECIAL => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XSPECIAL2 => [:SPECIAL_ATTACK, 2], - :XSPECIAL3 => [:SPECIAL_ATTACK, 3], - :XSPECIAL6 => [:SPECIAL_ATTACK, 6], - :XSPDEF => [:SPECIAL_DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XSPDEF2 => [:SPECIAL_DEFENSE, 2], - :XSPDEF3 => [:SPECIAL_DEFENSE, 3], - :XSPDEF6 => [:SPECIAL_DEFENSE, 6], - :XSPEED => [:SPEED, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XSPEED2 => [:SPEED, 2], - :XSPEED3 => [:SPEED, 3], - :XSPEED6 => [:SPEED, 6], - :XACCURACY => [:ACCURACY, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], - :XACCURACY2 => [:ACCURACY, 2], - :XACCURACY3 => [:ACCURACY, 3], - :XACCURACY6 => [:ACCURACY, 6] + :XATTACK => [:ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XATTACK2 => [:ATTACK, 2], + :XATTACK3 => [:ATTACK, 3], + :XATTACK6 => [:ATTACK, 6], + :XDEFENSE => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XDEFENSE2 => [:DEFENSE, 2], + :XDEFENSE3 => [:DEFENSE, 3], + :XDEFENSE6 => [:DEFENSE, 6], + :XDEFEND => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XDEFEND2 => [:DEFENSE, 2], + :XDEFEND3 => [:DEFENSE, 3], + :XDEFEND6 => [:DEFENSE, 6], + :XSPATK => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XSPATK2 => [:SPECIAL_ATTACK, 2], + :XSPATK3 => [:SPECIAL_ATTACK, 3], + :XSPATK6 => [:SPECIAL_ATTACK, 6], + :XSPECIAL => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XSPECIAL2 => [:SPECIAL_ATTACK, 2], + :XSPECIAL3 => [:SPECIAL_ATTACK, 3], + :XSPECIAL6 => [:SPECIAL_ATTACK, 6], + :XSPDEF => [:SPECIAL_DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XSPDEF2 => [:SPECIAL_DEFENSE, 2], + :XSPDEF3 => [:SPECIAL_DEFENSE, 3], + :XSPDEF6 => [:SPECIAL_DEFENSE, 6], + :XSPEED => [:SPEED, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XSPEED2 => [:SPEED, 2], + :XSPEED3 => [:SPEED, 3], + :XSPEED6 => [:SPEED, 6], + :XACCURACY => [:ACCURACY, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1], + :XACCURACY2 => [:ACCURACY, 2], + :XACCURACY3 => [:ACCURACY, 3], + :XACCURACY6 => [:ACCURACY, 6] } losthp = battler.totalhp - battler.hp preferFullRestore = (battler.hp <= battler.totalhp * 2 / 3 && diff --git a/Data/Scripts/011_Battle/005_AI/004_AI_Move.rb b/Data/Scripts/011_Battle/005_AI/004_AI_Move.rb index 77204db7d..1cffeab05 100644 --- a/Data/Scripts/011_Battle/005_AI/004_AI_Move.rb +++ b/Data/Scripts/011_Battle/005_AI/004_AI_Move.rb @@ -176,18 +176,15 @@ class Battle::AI miss = false if user.hasActiveAbility?(:NOGUARD) || target.hasActiveAbility?(:NOGUARD) if miss && pbRoughStat(user, :SPEED, skill) > pbRoughStat(target, :SPEED, skill) # Knows what can get past semi-invulnerability - if target.effects[PBEffects::SkyDrop] >= 0 + if target.effects[PBEffects::SkyDrop] >= 0 || + target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky", + "TwoTurnAttackInvulnerableInSkyParalyzeTarget", + "TwoTurnAttackInvulnerableInSkyTargetCannotAct") miss = false if move.hitsFlyingTargets? - else - if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky", - "TwoTurnAttackInvulnerableInSkyParalyzeTarget", - "TwoTurnAttackInvulnerableInSkyTargetCannotAct") - miss = false if move.hitsFlyingTargets? - elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground") - miss = false if move.hitsDiggingTargets? - elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater") - miss = false if move.hitsDivingTargets? - end + elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground") + miss = false if move.hitsDiggingTargets? + elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater") + miss = false if move.hitsDivingTargets? end end score -= 80 if miss diff --git a/Data/Scripts/011_Battle/005_AI/005_AI_Move_EffectScores.rb b/Data/Scripts/011_Battle/005_AI/005_AI_Move_EffectScores.rb index 9894c16d7..f83b3df13 100644 --- a/Data/Scripts/011_Battle/005_AI/005_AI_Move_EffectScores.rb +++ b/Data/Scripts/011_Battle/005_AI/005_AI_Move_EffectScores.rb @@ -28,10 +28,8 @@ class Battle::AI score -= 50 end end - else - if skill >= PBTrainerAI.mediumSkill - score -= 90 if move.statusMove? - end + elsif skill >= PBTrainerAI.mediumSkill + score -= 90 if move.statusMove? end #--------------------------------------------------------------------------- when "SleepTargetNextTurn" @@ -63,10 +61,8 @@ class Battle::AI score += 10 if pbRoughStat(target, :SPECIAL_DEFENSE, skill) > 100 score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :TOXICBOOST]) end - else - if skill >= PBTrainerAI.mediumSkill - score -= 90 if move.statusMove? - end + elsif skill >= PBTrainerAI.mediumSkill + score -= 90 if move.statusMove? end #--------------------------------------------------------------------------- when "ParalyzeTarget", "ParalyzeTargetIfNotTypeImmune", @@ -89,10 +85,8 @@ class Battle::AI if skill >= PBTrainerAI.highSkill score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :QUICKFEET]) end - else - if skill >= PBTrainerAI.mediumSkill - score -= 90 if move.statusMove? - end + elsif skill >= PBTrainerAI.mediumSkill + score -= 90 if move.statusMove? end #--------------------------------------------------------------------------- when "BurnTarget", "BurnFlinchTarget", "TwoTurnAttackBurnTarget" @@ -101,10 +95,8 @@ class Battle::AI if skill >= PBTrainerAI.highSkill score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :QUICKFEET, :FLAREBOOST]) end - else - if skill >= PBTrainerAI.mediumSkill - score -= 90 if move.statusMove? - end + elsif skill >= PBTrainerAI.mediumSkill + score -= 90 if move.statusMove? end #--------------------------------------------------------------------------- when "FreezeTarget", "FreezeTargetAlwaysHitsInHail", "FreezeFlinchTarget" @@ -113,10 +105,8 @@ class Battle::AI if skill >= PBTrainerAI.highSkill score -= 20 if target.hasActiveAbility?(:MARVELSCALE) end - else - if skill >= PBTrainerAI.mediumSkill - score -= 90 if move.statusMove? - end + elsif skill >= PBTrainerAI.mediumSkill + score -= 90 if move.statusMove? end #--------------------------------------------------------------------------- when "FlinchTarget" @@ -159,10 +149,8 @@ class Battle::AI when "ConfuseTarget", "ConfuseTargetAlwaysHitsInRainHitsTargetInSky" if target.pbCanConfuse?(user, false) score += 30 - else - if skill >= PBTrainerAI.mediumSkill - score -= 90 if move.statusMove? - end + elsif skill >= PBTrainerAI.mediumSkill + score -= 90 if move.statusMove? end #--------------------------------------------------------------------------- when "AttractTarget" @@ -274,8 +262,8 @@ class Battle::AI else score -= user.stages[:DEFENSE] * 20 end - else - score += 20 if user.stages[:DEFENSE] < 0 + elsif user.stages[:DEFENSE] < 0 + score += 20 end #--------------------------------------------------------------------------- when "RaiseUserSpeed1" @@ -290,8 +278,8 @@ class Battle::AI score += 30 if aspeed < ospeed && aspeed * 2 > ospeed end end - else - score += 20 if user.stages[:SPEED] < 0 + elsif user.stages[:SPEED] < 0 + score += 20 end #--------------------------------------------------------------------------- when "RaiseUserSpAtk1" @@ -341,8 +329,8 @@ class Battle::AI else score -= user.stages[:SPECIAL_DEFENSE] * 20 end - else - score += 20 if user.stages[:SPECIAL_DEFENSE] < 0 + elsif user.stages[:SPECIAL_DEFENSE] < 0 + score += 20 end #--------------------------------------------------------------------------- when "RaiseUserEvasion1" @@ -352,8 +340,8 @@ class Battle::AI else score -= user.stages[:EVASION] * 10 end - else - score += 20 if user.stages[:EVASION] < 0 + elsif user.stages[:EVASION] < 0 + score += 20 end #--------------------------------------------------------------------------- when "RaiseUserCriticalHitRate2" @@ -363,8 +351,8 @@ class Battle::AI else score += 30 end - else - score += 30 if user.effects[PBEffects::FocusEnergy] < 2 + elsif user.effects[PBEffects::FocusEnergy] < 2 + score += 30 end #--------------------------------------------------------------------------- when "RaiseUserAtkDef1" @@ -858,15 +846,15 @@ class Battle::AI when "RaiseTargetSpAtk1ConfuseTarget" if !target.pbCanConfuse?(user, false) score -= 90 - else - score += 30 if target.stages[:SPECIAL_ATTACK] < 0 + elsif target.stages[:SPECIAL_ATTACK] < 0 + score += 30 end #--------------------------------------------------------------------------- when "RaiseTargetAttack2ConfuseTarget" if !target.pbCanConfuse?(user, false) score -= 90 - else - score += 30 if target.stages[:ATTACK] < 0 + elsif target.stages[:ATTACK] < 0 + score += 30 end #--------------------------------------------------------------------------- when "LowerTargetAttack1" @@ -909,8 +897,8 @@ class Battle::AI else score += target.stages[:DEFENSE] * 20 end - else - score += 20 if target.stages[:DEFENSE] > 0 + elsif target.stages[:DEFENSE] > 0 + score += 20 end #--------------------------------------------------------------------------- when "LowerTargetSpeed1", "LowerTargetSpeed1WeakerInGrassyTerrain" @@ -925,8 +913,8 @@ class Battle::AI score += 30 if aspeed < ospeed && aspeed * 2 > ospeed end end - else - score += 20 if user.stages[:SPEED] > 0 + elsif user.stages[:SPEED] > 0 + score += 20 end #--------------------------------------------------------------------------- when "LowerTargetSpAtk1" @@ -969,8 +957,8 @@ class Battle::AI else score += target.stages[:SPECIAL_DEFENSE] * 20 end - else - score += 20 if target.stages[:SPECIAL_DEFENSE] > 0 + elsif target.stages[:SPECIAL_DEFENSE] > 0 + score += 20 end #--------------------------------------------------------------------------- when "LowerTargetAccuracy1", "LowerTargetAccuracy2", "LowerTargetAccuracy3" @@ -980,8 +968,8 @@ class Battle::AI else score += target.stages[:ACCURACY] * 10 end - else - score += 20 if target.stages[:ACCURACY] > 0 + elsif target.stages[:ACCURACY] > 0 + score += 20 end #--------------------------------------------------------------------------- when "LowerTargetEvasion1", "LowerTargetEvasion2", "LowerTargetEvasion3" @@ -991,8 +979,8 @@ class Battle::AI else score += target.stages[:EVASION] * 10 end - else - score += 20 if target.stages[:EVASION] > 0 + elsif target.stages[:EVASION] > 0 + score += 20 end #--------------------------------------------------------------------------- when "LowerTargetEvasion1RemoveSideEffects" @@ -1002,8 +990,8 @@ class Battle::AI else score += target.stages[:EVASION] * 10 end - else - score += 20 if target.stages[:EVASION] > 0 + elsif target.stages[:EVASION] > 0 + score += 20 end score += 30 if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0 || target.pbOwnSide.effects[PBEffects::Reflect] > 0 || @@ -1294,10 +1282,10 @@ class Battle::AI #--------------------------------------------------------------------------- when "ReplaceMoveThisBattleWithTargetLastMoveUsed" moveBlacklist = [ - "Struggle", # Struggle - "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic - "ReplaceMoveWithTargetLastMoveUsed", # Sketch - "UseRandomMove" # Metronome + "Struggle", # Struggle + "ReplaceMoveThisBattleWithTargetLastMoveUsed", # Mimic + "ReplaceMoveWithTargetLastMoveUsed", # Sketch + "UseRandomMove" # Metronome ] if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed score -= 90 @@ -1316,8 +1304,8 @@ class Battle::AI #--------------------------------------------------------------------------- when "ReplaceMoveWithTargetLastMoveUsed" moveBlacklist = [ - "Struggle", # Struggle - "ReplaceMoveWithTargetLastMoveUsed" # Sketch + "Struggle", # Struggle + "ReplaceMoveWithTargetLastMoveUsed" # Sketch ] if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed score -= 90 @@ -1393,25 +1381,25 @@ class Battle::AI end if !new_type envtypes = { - :None => :NORMAL, - :Grass => :GRASS, - :TallGrass => :GRASS, - :MovingWater => :WATER, - :StillWater => :WATER, - :Puddle => :WATER, - :Underwater => :WATER, - :Cave => :ROCK, - :Rock => :GROUND, - :Sand => :GROUND, - :Forest => :BUG, - :ForestGrass => :BUG, - :Snow => :ICE, - :Ice => :ICE, - :Volcano => :FIRE, - :Graveyard => :GHOST, - :Sky => :FLYING, - :Space => :DRAGON, - :UltraSpace => :PSYCHIC + :None => :NORMAL, + :Grass => :GRASS, + :TallGrass => :GRASS, + :MovingWater => :WATER, + :StillWater => :WATER, + :Puddle => :WATER, + :Underwater => :WATER, + :Cave => :ROCK, + :Rock => :GROUND, + :Sand => :GROUND, + :Forest => :BUG, + :ForestGrass => :BUG, + :Snow => :ICE, + :Ice => :ICE, + :Volcano => :FIRE, + :Graveyard => :GHOST, + :Sky => :FLYING, + :Space => :DRAGON, + :UltraSpace => :PSYCHIC } new_type = envtypes[@battle.environment] new_type = nil if !GameData::Type.exists?(new_type) @@ -1918,15 +1906,15 @@ class Battle::AI score -= 90 elsif skill >= PBTrainerAI.mediumSkill && target.pbHasType?(:GRASS) score -= 90 - else - score += 60 if user.turnCount == 0 + elsif user.turnCount == 0 + score += 60 end #--------------------------------------------------------------------------- when "HealUserByHalfOfDamageDone" if skill >= PBTrainerAI.highSkill && target.hasActiveAbility?(:LIQUIDOOZE) score -= 70 - else - score += 20 if user.hp <= user.totalhp / 2 + elsif user.hp <= user.totalhp / 2 + score += 20 end #--------------------------------------------------------------------------- when "HealUserByHalfOfDamageDoneIfTargetAsleep" @@ -1934,16 +1922,15 @@ class Battle::AI score -= 100 elsif skill >= PBTrainerAI.highSkill && target.hasActiveAbility?(:LIQUIDOOZE) score -= 70 - else - score += 20 if user.hp <= user.totalhp / 2 + elsif user.hp <= user.totalhp / 2 + score += 20 end #--------------------------------------------------------------------------- when "HealTargetHalfOfTotalHP" if user.opposes?(target) score -= 100 - else - score += 20 if target.hp < target.totalhp / 2 && - target.effects[PBEffects::Substitute] == 0 + elsif target.hp < target.totalhp / 2 && target.effects[PBEffects::Substitute] == 0 + score += 20 end #--------------------------------------------------------------------------- when "UserFaintsExplosive" @@ -1979,8 +1966,8 @@ class Battle::AI when "StartPerishCountsForAllBattlers" if @battle.pbAbleNonActiveCount(user.idxOwnSide) == 0 score -= 90 - else - score -= 90 if target.effects[PBEffects::PerishSong] > 0 + elsif target.effects[PBEffects::PerishSong] > 0 + score -= 90 end #--------------------------------------------------------------------------- when "ReduceAttackerMovePPTo0IfUserFaints" @@ -2125,13 +2112,11 @@ class Battle::AI when "TargetTakesUserItem" if !user.item || target.item score -= 90 + elsif user.hasActiveItem?([:FLAMEORB, :TOXICORB, :STICKYBARB, :IRONBALL, + :CHOICEBAND, :CHOICESCARF, :CHOICESPECS]) + score += 50 else - if user.hasActiveItem?([:FLAMEORB, :TOXICORB, :STICKYBARB, :IRONBALL, - :CHOICEBAND, :CHOICESCARF, :CHOICESPECS]) - score += 50 - else - score -= 80 - end + score -= 80 end #--------------------------------------------------------------------------- when "UserConsumeTargetBerry", "DestroyTargetBerryOrGem" @@ -2160,8 +2145,8 @@ class Battle::AI when "StartNegateHeldItems" if @battle.field.effects[PBEffects::MagicRoom] > 0 score -= 90 - else - score += 30 if !user.item && target.item + elsif !user.item && target.item + score += 30 end #--------------------------------------------------------------------------- when "RecoilQuarterOfDamageDealt" @@ -2245,39 +2230,30 @@ class Battle::AI when "AddSpikesToFoeSide" if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3 score -= 90 + elsif user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) } + score -= 90 # Opponent can't switch in any Pokemon else - if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) } - # Opponent can't switch in any Pokemon - score -= 90 - else - score += 10 * @battle.pbAbleNonActiveCount(user.idxOpposingSide) - score += [40, 26, 13][user.pbOpposingSide.effects[PBEffects::Spikes]] - end + score += 10 * @battle.pbAbleNonActiveCount(user.idxOpposingSide) + score += [40, 26, 13][user.pbOpposingSide.effects[PBEffects::Spikes]] end #--------------------------------------------------------------------------- when "AddToxicSpikesToFoeSide" if user.pbOpposingSide.effects[PBEffects::ToxicSpikes] >= 2 score -= 90 + elsif user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) } + score -= 90 # Opponent can't switch in any Pokemon else - if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) } - # Opponent can't switch in any Pokemon - score -= 90 - else - score += 8 * @battle.pbAbleNonActiveCount(user.idxOpposingSide) - score += [26, 13][user.pbOpposingSide.effects[PBEffects::ToxicSpikes]] - end + score += 8 * @battle.pbAbleNonActiveCount(user.idxOpposingSide) + score += [26, 13][user.pbOpposingSide.effects[PBEffects::ToxicSpikes]] end #--------------------------------------------------------------------------- when "AddStealthRocksToFoeSide" if user.pbOpposingSide.effects[PBEffects::StealthRock] score -= 90 + elsif user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) } + score -= 90 # Opponent can't switch in any Pokemon else - if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) } - # Opponent can't switch in any Pokemon - score -= 90 - else - score += 10 * @battle.pbAbleNonActiveCount(user.idxOpposingSide) - end + score += 10 * @battle.pbAbleNonActiveCount(user.idxOpposingSide) end #--------------------------------------------------------------------------- when "GrassPledge" @@ -2360,10 +2336,9 @@ class Battle::AI score += avg / 2 if user.effects[PBEffects::Stockpile] >= 3 score -= 80 - else - # More preferable if user also has Spit Up/Swallow - score += 20 if user.pbHasMoveFunction?("PowerDependsOnUserStockpile", - "HealUserDependingOnUserStockpile") # Spit Up, Swallow + elsif user.pbHasMoveFunction?("PowerDependsOnUserStockpile", + "HealUserDependingOnUserStockpile") # Spit Up, Swallow + score += 20 # More preferable if user also has Spit Up/Swallow end #--------------------------------------------------------------------------- when "PowerDependsOnUserStockpile" @@ -2557,8 +2532,8 @@ class Battle::AI when "HoopaRemoveProtectionsBypassSubstituteLowerUserDef1" if !user.isSpecies?(:HOOPA) || user.form != 1 score -= 100 - else - score += 20 if target.stages[:DEFENSE] > 0 + elsif target.stages[:DEFENSE] > 0 + score += 20 end #--------------------------------------------------------------------------- when "LowerTargetSpAtk2", "LowerTargetSpAtk3" @@ -2657,8 +2632,8 @@ class Battle::AI ospeed = pbRoughStat(target, :SPEED, skill) if aspeed > ospeed score -= 90 - else - score += 30 if target.pbHasMoveType?(:FIRE) + elsif target.pbHasMoveType?(:FIRE) + score += 30 end #--------------------------------------------------------------------------- when "ProtectUserSideFromDamagingMovesIfUserFirstTurn" @@ -2715,8 +2690,8 @@ class Battle::AI when "HealUserByThreeQuartersOfDamageDone" if skill >= PBTrainerAI.highSkill && target.hasActiveAbility?(:LIQUIDOOZE) score -= 80 - else - score += 40 if user.hp <= user.totalhp / 2 + elsif user.hp <= user.totalhp / 2 + score += 40 end #--------------------------------------------------------------------------- when "RaiseTargetAttack1" @@ -2776,8 +2751,8 @@ class Battle::AI when "CureTargetBurn" if target.opposes?(user) score -= 40 if target.status == :BURN - else - score += 40 if target.status == :BURN + elsif target.status == :BURN + score += 40 end #--------------------------------------------------------------------------- when "CureTargetStatusHealUserHalfOfTotalHP" diff --git a/Data/Scripts/011_Battle/005_AI/006_AI_Move_Utilities.rb b/Data/Scripts/011_Battle/005_AI/006_AI_Move_Utilities.rb index 8f4edf386..938d827d0 100644 --- a/Data/Scripts/011_Battle/005_AI/006_AI_Move_Utilities.rb +++ b/Data/Scripts/011_Battle/005_AI/006_AI_Move_Utilities.rb @@ -562,7 +562,7 @@ class Battle::AI baseDmg = [(baseDmg * multipliers[:base_damage_multiplier]).round, 1].max atk = [(atk * multipliers[:attack_multiplier]).round, 1].max defense = [(defense * multipliers[:defense_multiplier]).round, 1].max - damage = (((2.0 * user.level / 5 + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2 + damage = ((((2.0 * user.level / 5) + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2 damage = [(damage * multipliers[:final_damage_multiplier]).round, 1].max # "AI-specific calculations below" # Increased critical hit rates diff --git a/Data/Scripts/011_Battle/006_Other battle code/005_Battle_CatchAndStoreMixin.rb b/Data/Scripts/011_Battle/006_Other battle code/005_Battle_CatchAndStoreMixin.rb index 8d2ec5d4d..a21cc2e39 100644 --- a/Data/Scripts/011_Battle/006_Other battle code/005_Battle_CatchAndStoreMixin.rb +++ b/Data/Scripts/011_Battle/006_Other battle code/005_Battle_CatchAndStoreMixin.rb @@ -154,7 +154,7 @@ module Battle::CatchAndStoreMixin # First half of the shakes calculation a = battler.totalhp b = battler.hp - x = ((3 * a - 2 * b) * catch_rate.to_f) / (3 * a) + x = (((3 * a) - (2 * b)) * catch_rate.to_f) / (3 * a) # Calculation modifiers if battler.status == :SLEEP || battler.status == :FROZEN x *= 2.5 diff --git a/Data/Scripts/011_Battle/006_Other battle code/007_BattleAnimationPlayer.rb b/Data/Scripts/011_Battle/006_Other battle code/007_BattleAnimationPlayer.rb index 24ba70f07..333321c3a 100644 --- a/Data/Scripts/011_Battle/006_Other battle code/007_BattleAnimationPlayer.rb +++ b/Data/Scripts/011_Battle/006_Other battle code/007_BattleAnimationPlayer.rb @@ -45,8 +45,8 @@ end def repositionY(x1, y1, x2, y2, tx, ty) dx = x2 - x1 dy = y2 - y1 - x = x1 + tx * dx.to_f - y = y1 + ty * dy.to_f + x = x1 + (tx * dx.to_f) + y = y1 + (ty * dy.to_f) return [x, y] end @@ -134,10 +134,10 @@ def pbConvertRPGAnimation(animation) end if animation.position == 3 # Screen point = transformPoint( - -160, 80, 160, -80, - Battle::Scene::FOCUSUSER_X, Battle::Scene::FOCUSUSER_Y, - Battle::Scene::FOCUSTARGET_X, Battle::Scene::FOCUSTARGET_Y, - data[j, 1], data[j, 2] + -160, 80, 160, -80, + Battle::Scene::FOCUSUSER_X, Battle::Scene::FOCUSUSER_Y, + Battle::Scene::FOCUSTARGET_X, Battle::Scene::FOCUSTARGET_Y, + data[j, 1], data[j, 2] ) cel = pbCreateCel(point[0], point[1], data[j, 0]) else @@ -219,11 +219,9 @@ class RPG::Animation timing = RPG::Animation::Timing.new othertiming = otherAnim.timings[i] timing.frame = frame + othertiming.frame - timing.se = RPG::AudioFile.new( - othertiming.se.name.clone, - othertiming.se.volume, - othertiming.se.pitch - ) + timing.se = RPG::AudioFile.new(othertiming.se.name.clone, + othertiming.se.volume, + othertiming.se.pitch) timing.flash_scope = othertiming.flash_scope timing.flash_color = othertiming.flash_color.clone timing.flash_duration = othertiming.flash_duration @@ -571,20 +569,20 @@ class PBAnimation < Array next if frame < i.frame || frame > i.frame + i.duration fraction = (frame - i.frame).to_f / i.duration if bgGraphic.bitmap != nil - bgGraphic.ox = oldbg[0] - (i.bgX - oldbg[0]) * fraction if i.bgX != nil - bgGraphic.oy = oldbg[1] - (i.bgY - oldbg[1]) * fraction if i.bgY != nil - bgGraphic.opacity = oldbg[2] + (i.opacity - oldbg[2]) * fraction if i.opacity != nil - cr = (i.colorRed != nil) ? oldbg[3].red + (i.colorRed - oldbg[3].red) * fraction : oldbg[3].red - cg = (i.colorGreen != nil) ? oldbg[3].green + (i.colorGreen - oldbg[3].green) * fraction : oldbg[3].green - cb = (i.colorBlue != nil) ? oldbg[3].blue + (i.colorBlue - oldbg[3].blue) * fraction : oldbg[3].blue - ca = (i.colorAlpha != nil) ? oldbg[3].alpha + (i.colorAlpha - oldbg[3].alpha) * fraction : oldbg[3].alpha + bgGraphic.ox = oldbg[0] - ((i.bgX - oldbg[0]) * fraction) if i.bgX != nil + bgGraphic.oy = oldbg[1] - ((i.bgY - oldbg[1]) * fraction) if i.bgY != nil + bgGraphic.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity != nil + cr = (i.colorRed != nil) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red + cg = (i.colorGreen != nil) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green + cb = (i.colorBlue != nil) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue + ca = (i.colorAlpha != nil) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha bgGraphic.color = Color.new(cr, cg, cb, ca) else - bgColor.opacity = oldbg[2] + (i.opacity - oldbg[2]) * fraction if i.opacity != nil - cr = (i.colorRed != nil) ? oldbg[3].red + (i.colorRed - oldbg[3].red) * fraction : oldbg[3].red - cg = (i.colorGreen != nil) ? oldbg[3].green + (i.colorGreen - oldbg[3].green) * fraction : oldbg[3].green - cb = (i.colorBlue != nil) ? oldbg[3].blue + (i.colorBlue - oldbg[3].blue) * fraction : oldbg[3].blue - ca = (i.colorAlpha != nil) ? oldbg[3].alpha + (i.colorAlpha - oldbg[3].alpha) * fraction : oldbg[3].alpha + bgColor.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity != nil + cr = (i.colorRed != nil) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red + cg = (i.colorGreen != nil) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green + cb = (i.colorBlue != nil) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue + ca = (i.colorAlpha != nil) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha bgColor.color = Color.new(cr, cg, cb, ca) end when 4 @@ -592,20 +590,20 @@ class PBAnimation < Array next if frame < i.frame || frame > i.frame + i.duration fraction = (frame - i.frame).to_f / i.duration if foGraphic.bitmap != nil - foGraphic.ox = oldfo[0] - (i.bgX - oldfo[0]) * fraction if i.bgX != nil - foGraphic.oy = oldfo[1] - (i.bgY - oldfo[1]) * fraction if i.bgY != nil - foGraphic.opacity = oldfo[2] + (i.opacity - oldfo[2]) * fraction if i.opacity != nil - cr = (i.colorRed != nil) ? oldfo[3].red + (i.colorRed - oldfo[3].red) * fraction : oldfo[3].red - cg = (i.colorGreen != nil) ? oldfo[3].green + (i.colorGreen - oldfo[3].green) * fraction : oldfo[3].green - cb = (i.colorBlue != nil) ? oldfo[3].blue + (i.colorBlue - oldfo[3].blue) * fraction : oldfo[3].blue - ca = (i.colorAlpha != nil) ? oldfo[3].alpha + (i.colorAlpha - oldfo[3].alpha) * fraction : oldfo[3].alpha + foGraphic.ox = oldfo[0] - ((i.bgX - oldfo[0]) * fraction) if i.bgX != nil + foGraphic.oy = oldfo[1] - ((i.bgY - oldfo[1]) * fraction) if i.bgY != nil + foGraphic.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity != nil + cr = (i.colorRed != nil) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red + cg = (i.colorGreen != nil) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green + cb = (i.colorBlue != nil) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue + ca = (i.colorAlpha != nil) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha foGraphic.color = Color.new(cr, cg, cb, ca) else - foColor.opacity = oldfo[2] + (i.opacity - oldfo[2]) * fraction if i.opacity != nil - cr = (i.colorRed != nil) ? oldfo[3].red + (i.colorRed - oldfo[3].red) * fraction : oldfo[3].red - cg = (i.colorGreen != nil) ? oldfo[3].green + (i.colorGreen - oldfo[3].green) * fraction : oldfo[3].green - cb = (i.colorBlue != nil) ? oldfo[3].blue + (i.colorBlue - oldfo[3].blue) * fraction : oldfo[3].blue - ca = (i.colorAlpha != nil) ? oldfo[3].alpha + (i.colorAlpha - oldfo[3].alpha) * fraction : oldfo[3].alpha + foColor.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity != nil + cr = (i.colorRed != nil) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red + cg = (i.colorGreen != nil) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green + cb = (i.colorBlue != nil) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue + ca = (i.colorAlpha != nil) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha foColor.color = Color.new(cr, cg, cb, ca) end end @@ -648,16 +646,16 @@ def pbSpriteSetAnimFrame(sprite, frame, user = nil, target = nil, inEditor = fal sprite.zoom_x = frame[AnimFrame::ZOOMX] / 100.0 sprite.zoom_y = frame[AnimFrame::ZOOMY] / 100.0 sprite.color.set( - frame[AnimFrame::COLORRED], - frame[AnimFrame::COLORGREEN], - frame[AnimFrame::COLORBLUE], - frame[AnimFrame::COLORALPHA] + frame[AnimFrame::COLORRED], + frame[AnimFrame::COLORGREEN], + frame[AnimFrame::COLORBLUE], + frame[AnimFrame::COLORALPHA] ) sprite.tone.set( - frame[AnimFrame::TONERED], - frame[AnimFrame::TONEGREEN], - frame[AnimFrame::TONEBLUE], - frame[AnimFrame::TONEGRAY] + frame[AnimFrame::TONERED], + frame[AnimFrame::TONEGREEN], + frame[AnimFrame::TONEBLUE], + frame[AnimFrame::TONEGRAY] ) sprite.ox = sprite.src_rect.width / 2 sprite.oy = sprite.src_rect.height / 2 diff --git a/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb b/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb index 650034802..b5a457fbc 100644 --- a/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb +++ b/Data/Scripts/011_Battle/006_Other battle code/008_Battle_AbilityEffects.rb @@ -925,13 +925,11 @@ Battle::AbilityEffects::MoveImmunity.add(:FLASHFIRE, battle.pbDisplay(_INTL("The power of {1}'s Fire-type moves rose because of its {2}!", target.pbThis(true), target.abilityName)) end + elsif Battle::Scene::USE_ABILITY_SPLASH + battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) else - if Battle::Scene::USE_ABILITY_SPLASH - battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true))) - else - battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", - target.pbThis, target.abilityName, move.name)) - end + battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", + target.pbThis, target.abilityName, move.name)) end battle.pbHideAbilitySplash(target) end @@ -2604,8 +2602,8 @@ Battle::AbilityEffects::OnSwitchIn.add(:ANTICIPATION, next if Effectiveness.ineffective?(eff) next if !Effectiveness.super_effective?(eff) && !["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function) - else - next if !["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function) + elsif !["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function) + next end found = true break @@ -2857,8 +2855,8 @@ Battle::AbilityEffects::OnSwitchIn.add(:INTIMIDATE, check_item = true if b.hasActiveAbility?(:CONTRARY) check_item = false if b.statStageAtMax?(:ATTACK) - else - check_item = false if b.statStageAtMin?(:ATTACK) + elsif b.statStageAtMin?(:ATTACK) + check_item = false end check_ability = b.pbLowerAttackStatStageIntimidate(battler) b.pbAbilitiesOnIntimidated if check_ability diff --git a/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb b/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb index 276b6e165..8507b1a91 100644 --- a/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb +++ b/Data/Scripts/011_Battle/006_Other battle code/009_Battle_ItemEffects.rb @@ -922,7 +922,7 @@ Battle::ItemEffects::DamageCalcFromUser.copy(:METALCOAT, :IRONPLATE) Battle::ItemEffects::DamageCalcFromUser.add(:METRONOME, proc { |item, user, target, move, mults, baseDmg, type| - met = 1 + 0.2 * [user.effects[PBEffects::Metronome], 5].min + met = 1 + (0.2 * [user.effects[PBEffects::Metronome], 5].min) mults[:final_damage_multiplier] *= met } ) @@ -1030,10 +1030,8 @@ Battle::ItemEffects::DamageCalcFromUser.add(:SOULDEW, next if !user.isSpecies?(:LATIAS) && !user.isSpecies?(:LATIOS) if Settings::SOUL_DEW_POWERS_UP_TYPES mults[:final_damage_multiplier] *= 1.2 if [:DRAGON, :PSYCHIC].include?(type) - else - if move.specialMove? && !user.battle.rules["souldewclause"] - mults[:attack_multiplier] *= 1.5 - end + elsif move.specialMove? && !user.battle.rules["souldewclause"] + mults[:attack_multiplier] *= 1.5 end } ) diff --git a/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb b/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb index fad28f979..cb0613d1f 100644 --- a/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb +++ b/Data/Scripts/011_Battle/007_Other battle types/001_SafariBattle.rb @@ -113,7 +113,7 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation traSprite = @sprites["player_1"] ballPos = Battle::Scene.pbBattlerPosition(@battler.index, batSprite.sideSize) ballStartX = traSprite.x - ballStartY = traSprite.y - traSprite.bitmap.height / 2 + ballStartY = traSprite.y - (traSprite.bitmap.height / 2) ballMidX = 0 # Unused in arc calculation ballMidY = 122 ballEndX = ballPos[0] - 40 @@ -178,11 +178,11 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation batSprite = @sprites["pokemon_#{@battler.index}"] traSprite = @sprites["player_1"] ballStartX = traSprite.x - ballStartY = traSprite.y - traSprite.bitmap.height / 2 + ballStartY = traSprite.y - (traSprite.bitmap.height / 2) ballMidX = 0 # Unused in arc calculation ballMidY = 122 ballEndX = batSprite.x - ballEndY = batSprite.y - batSprite.bitmap.height / 2 + ballEndY = batSprite.y - (batSprite.bitmap.height / 2) # Set up trainer sprite trainer = addSprite(traSprite, PictureOrigin::Bottom) # Set up bait sprite @@ -242,13 +242,12 @@ class Battle::Scene end def pbSafariCommandMenu(index) - pbCommandMenuEx(index, [ - _INTL("What will\n{1} throw?", @battle.pbPlayer.name), - _INTL("Ball"), - _INTL("Bait"), - _INTL("Rock"), - _INTL("Run") - ], 3) + pbCommandMenuEx(index, + [_INTL("What will\n{1} throw?", @battle.pbPlayer.name), + _INTL("Ball"), + _INTL("Bait"), + _INTL("Rock"), + _INTL("Run")], 3) end def pbThrowBait @@ -324,10 +323,8 @@ class SafariBattle @player = [player] @party2 = party2 @sideSizes = [1, 1] - @battlers = [ - Battle::FakeBattler.new(self, 0), - Battle::FakeBattler.new(self, 1) - ] + @battlers = [Battle::FakeBattler.new(self, 0), + Battle::FakeBattler.new(self, 1)] @rules = {} @ballCount = 0 end diff --git a/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb b/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb index 1fed48415..4f71968d9 100644 --- a/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb +++ b/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb @@ -45,13 +45,12 @@ class BugContestBattle < Battle end def pbCommandMenu(idxBattler, _firstAction) - return @scene.pbCommandMenuEx(idxBattler, [ - _INTL("Sport Balls: {1}", @ballCount), - _INTL("Fight"), - _INTL("Ball"), - _INTL("Pokémon"), - _INTL("Run") - ], 4) + return @scene.pbCommandMenuEx(idxBattler, + [_INTL("Sport Balls: {1}", @ballCount), + _INTL("Fight"), + _INTL("Ball"), + _INTL("Pokémon"), + _INTL("Run")], 4) end def pbConsumeItemInBag(_item, _idxBattler) diff --git a/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb b/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb index 2b72ead13..f37ce8c53 100644 --- a/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb +++ b/Data/Scripts/011_Battle/007_Other battle types/004_BattleArenaBattle.rb @@ -241,15 +241,15 @@ class Battle::Scene window.contents.clear pbSetSystemFont(window.contents) textpos = [ - [battler1.name, 64, -6, 2, Color.new(248, 0, 0), Color.new(208, 208, 200)], - [_INTL("VS"), 144, -6, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [battler2.name, 224, -6, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Mind"), 144, 42, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Skill"), 144, 74, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Body"), 144, 106, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [sprintf("%d", total1), 64, 154, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [_INTL("Judgment"), 144, 154, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], - [sprintf("%d", total2), 224, 154, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)] + [battler1.name, 64, -6, 2, Color.new(248, 0, 0), Color.new(208, 208, 200)], + [_INTL("VS"), 144, -6, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [battler2.name, 224, -6, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Mind"), 144, 42, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Skill"), 144, 74, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Body"), 144, 106, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [sprintf("%d", total1), 64, 154, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [_INTL("Judgment"), 144, 154, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)], + [sprintf("%d", total2), 224, 154, 2, Color.new(72, 72, 72), Color.new(208, 208, 200)] ] pbDrawTextPositions(window.contents, textpos) images = [] diff --git a/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb b/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb index 7799c2aff..82354e8f7 100644 --- a/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb +++ b/Data/Scripts/012_Overworld/001_Overworld visuals/001_Overworld_Weather.rb @@ -245,8 +245,8 @@ module RPG return end if @weatherTypes[weather_type][0].category == :Rain && index.odd? # Splash - sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width * 2) - sprite.y = @oy - sprite.bitmap.height + rand(Graphics.height + sprite.bitmap.height * 2) + sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + (sprite.bitmap.width * 2)) + sprite.y = @oy - sprite.bitmap.height + rand(Graphics.height + (sprite.bitmap.height * 2)) lifetimes[index] = (rand(30...50)) * 0.01 # 0.3-0.5 seconds else x_speed = @weatherTypes[weather_type][0].particle_delta_x @@ -255,14 +255,14 @@ module RPG if gradient.abs >= 1 # Position sprite to the right of the screen sprite.x = @ox + Graphics.width + rand(Graphics.width) - sprite.y = @oy + Graphics.height - rand(Graphics.height + sprite.bitmap.height - Graphics.width / gradient) - distance_to_cover = sprite.x - @ox - Graphics.width / 2 + sprite.bitmap.width + rand(Graphics.width * 8 / 5) + sprite.y = @oy + Graphics.height - rand(Graphics.height + sprite.bitmap.height - (Graphics.width / gradient)) + distance_to_cover = sprite.x - @ox - (Graphics.width / 2) + sprite.bitmap.width + rand(Graphics.width * 8 / 5) lifetimes[index] = (distance_to_cover.to_f / x_speed).abs else # Position sprite to the top of the screen - sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width - gradient * Graphics.height) + sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width - (gradient * Graphics.height)) sprite.y = @oy - sprite.bitmap.height - rand(Graphics.height) - distance_to_cover = @oy - sprite.y + Graphics.height / 2 + rand(Graphics.height * 8 / 5) + distance_to_cover = @oy - sprite.y + (Graphics.height / 2) + rand(Graphics.height * 8 / 5) lifetimes[index] = (distance_to_cover.to_f / y_speed).abs end end @@ -333,8 +333,8 @@ module RPG def update_tile_position(sprite, index) return if !sprite || !sprite.bitmap || !sprite.visible - sprite.x = @tile_x.round + (index % @tiles_wide) * sprite.bitmap.width - sprite.y = @tile_y.round + (index / @tiles_wide) * sprite.bitmap.height + sprite.x = @tile_x.round + ((index % @tiles_wide) * sprite.bitmap.width) + sprite.y = @tile_y.round + ((index / @tiles_wide) * sprite.bitmap.height) sprite.x += @tiles_wide * sprite.bitmap.width if sprite.x - @ox < -sprite.bitmap.width sprite.y -= @tiles_tall * sprite.bitmap.height if sprite.y - @oy > Graphics.height sprite.visible = true @@ -372,10 +372,10 @@ module RPG @fade_time < [FADE_NEW_TONE_END - @time_shift, 0].max weather_max = @target_max fract = (@fade_time - [FADE_NEW_TONE_START - @time_shift, 0].max) / (FADE_NEW_TONE_END - FADE_NEW_TONE_START) - tone_red = @target_tone.red + (1 - fract) * (@old_tone.red - @target_tone.red) - tone_green = @target_tone.green + (1 - fract) * (@old_tone.green - @target_tone.green) - tone_blue = @target_tone.blue + (1 - fract) * (@old_tone.blue - @target_tone.blue) - tone_gray = @target_tone.gray + (1 - fract) * (@old_tone.gray - @target_tone.gray) + tone_red = @target_tone.red + ((1 - fract) * (@old_tone.red - @target_tone.red)) + tone_green = @target_tone.green + ((1 - fract) * (@old_tone.green - @target_tone.green)) + tone_blue = @target_tone.blue + ((1 - fract) * (@old_tone.blue - @target_tone.blue)) + tone_gray = @target_tone.gray + ((1 - fract) * (@old_tone.gray - @target_tone.gray)) else tone_red = @viewport.tone.red tone_green = @viewport.tone.green diff --git a/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb b/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb index 273618774..5f3002cea 100644 --- a/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb +++ b/Data/Scripts/012_Overworld/001_Overworld visuals/002_Overworld_Overlays.rb @@ -153,12 +153,12 @@ class LightEffect_Basic < LightEffect super if (Object.const_defined?(:ScreenPosHelper) rescue false) @light.x = ScreenPosHelper.pbScreenX(@event) - @light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2 + @light.y = ScreenPosHelper.pbScreenY(@event) - (Game_Map::TILE_HEIGHT / 2) @light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event) @light.zoom_y = @light.zoom_x else @light.x = @event.screen_x - @light.y = @event.screen_y - Game_Map::TILE_HEIGHT / 2 + @light.y = @event.screen_y - (Game_Map::TILE_HEIGHT / 2) end @light.tone = $game_screen.tone end @@ -188,12 +188,12 @@ class LightEffect_DayNight < LightEffect if @light.opacity > 0 if (Object.const_defined?(:ScreenPosHelper) rescue false) @light.x = ScreenPosHelper.pbScreenX(@event) - @light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2 + @light.y = ScreenPosHelper.pbScreenY(@event) - (Game_Map::TILE_HEIGHT / 2) @light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event) @light.zoom_y = ScreenPosHelper.pbScreenZoomY(@event) else @light.x = @event.screen_x - @light.y = @event.screen_y - Game_Map::TILE_HEIGHT / 2 + @light.y = @event.screen_y - (Game_Map::TILE_HEIGHT / 2) end @light.tone.set($game_screen.tone.red, $game_screen.tone.green, diff --git a/Data/Scripts/012_Overworld/001_Overworld.rb b/Data/Scripts/012_Overworld/001_Overworld.rb index 00f34d775..538375305 100644 --- a/Data/Scripts/012_Overworld/001_Overworld.rb +++ b/Data/Scripts/012_Overworld/001_Overworld.rb @@ -286,8 +286,8 @@ Events.onMapSceneChange += proc { |_sender, e| if $PokemonGlobal.mapTrail[1] for i in 0...Settings::NO_SIGNPOSTS.length / 2 nosignpost = true if Settings::NO_SIGNPOSTS[2 * i] == $PokemonGlobal.mapTrail[1] && - Settings::NO_SIGNPOSTS[2 * i + 1] == $game_map.map_id - nosignpost = true if Settings::NO_SIGNPOSTS[2 * i + 1] == $PokemonGlobal.mapTrail[1] && + Settings::NO_SIGNPOSTS[(2 * i) + 1] == $game_map.map_id + nosignpost = true if Settings::NO_SIGNPOSTS[(2 * i) + 1] == $PokemonGlobal.mapTrail[1] && Settings::NO_SIGNPOSTS[2 * i] == $game_map.map_id break if nosignpost end @@ -378,7 +378,7 @@ def pbEventCanReachPlayer?(event, player, distance) end if real_distance > 0 real_distance.times do |i| - return false if !event.can_move_from_coordinate?(event.x + i * delta_x, event.y + i * delta_y, event.direction) + return false if !event.can_move_from_coordinate?(event.x + (i * delta_x), event.y + (i * delta_y), event.direction) end end return true diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb index c9bcdc46d..ca955008b 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb @@ -182,8 +182,8 @@ def pbGetEnvironment tile_environment = terrainTag.battle_environment if ret == :Forest && [:Grass, :TallGrass].include?(tile_environment) ret = :ForestGrass - else - ret = tile_environment if tile_environment + elsif tile_environment + ret = tile_environment end return ret end @@ -383,13 +383,14 @@ def pbTrainerBattleCore(*args) foeParty = [] foePartyStarts = [] for arg in args - if arg.is_a?(NPCTrainer) + case arg + when NPCTrainer foeTrainers.push(arg) foePartyStarts.push(foeParty.length) arg.party.each { |pkmn| foeParty.push(pkmn) } foeEndSpeeches.push(arg.lose_text) foeItems.push(arg.items) - elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)] + when Array # [trainer type, trainer name, ID, speech (optional)] trainer = pbLoadTrainer(arg[0], arg[1], arg[2]) pbMissingTrainer(arg[0], arg[1], arg[2]) if !trainer return 0 if !trainer @@ -530,8 +531,8 @@ def pbDoubleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1, setBattleRule("double") # Perform the battle decision = pbTrainerBattleCore( - [trainerID1, trainerName1, trainerPartyID1, endSpeech1], - [trainerID2, trainerName2, trainerPartyID2, endSpeech2] + [trainerID1, trainerName1, trainerPartyID1, endSpeech1], + [trainerID2, trainerName2, trainerPartyID2, endSpeech2] ) # Return true if the player won the battle, and false if any other result return (decision == 1) @@ -547,9 +548,9 @@ def pbTripleTrainerBattle(trainerID1, trainerName1, trainerPartyID1, endSpeech1, setBattleRule("triple") # Perform the battle decision = pbTrainerBattleCore( - [trainerID1, trainerName1, trainerPartyID1, endSpeech1], - [trainerID2, trainerName2, trainerPartyID2, endSpeech2], - [trainerID3, trainerName3, trainerPartyID3, endSpeech3] + [trainerID1, trainerName1, trainerPartyID1, endSpeech1], + [trainerID2, trainerName2, trainerPartyID2, endSpeech2], + [trainerID3, trainerName3, trainerPartyID3, endSpeech3] ) # Return true if the player won the battle, and false if any other result return (decision == 1) @@ -644,38 +645,38 @@ def pbPickup(pkmn) return unless rand(100) < 10 # 10% chance # Common items to find (9 items from this list are added to the pool) pickupList = pbDynamicItemList( - :POTION, - :ANTIDOTE, - :SUPERPOTION, - :GREATBALL, - :REPEL, - :ESCAPEROPE, - :FULLHEAL, - :HYPERPOTION, - :ULTRABALL, - :REVIVE, - :RARECANDY, - :SUNSTONE, - :MOONSTONE, - :HEARTSCALE, - :FULLRESTORE, - :MAXREVIVE, - :PPUP, - :MAXELIXIR + :POTION, + :ANTIDOTE, + :SUPERPOTION, + :GREATBALL, + :REPEL, + :ESCAPEROPE, + :FULLHEAL, + :HYPERPOTION, + :ULTRABALL, + :REVIVE, + :RARECANDY, + :SUNSTONE, + :MOONSTONE, + :HEARTSCALE, + :FULLRESTORE, + :MAXREVIVE, + :PPUP, + :MAXELIXIR ) # Rare items to find (2 items from this list are added to the pool) pickupListRare = pbDynamicItemList( - :HYPERPOTION, - :NUGGET, - :KINGSROCK, - :FULLRESTORE, - :ETHER, - :IRONBALL, - :DESTINYKNOT, - :ELIXIR, - :DESTINYKNOT, - :LEFTOVERS, - :DESTINYKNOT + :HYPERPOTION, + :NUGGET, + :KINGSROCK, + :FULLRESTORE, + :ETHER, + :IRONBALL, + :DESTINYKNOT, + :ELIXIR, + :DESTINYKNOT, + :LEFTOVERS, + :DESTINYKNOT ) return if pickupList.length < 18 return if pickupListRare.length < 11 @@ -709,7 +710,7 @@ end def pbHoneyGather(pkmn) return if !GameData::Item.exists?(:HONEY) return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER) || pkmn.hasItem? - chance = 5 + ((pkmn.level - 1) / 10) * 5 + chance = 5 + (((pkmn.level - 1) / 10) * 5) return unless rand(100) < chance pkmn.item = :HONEY end diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb b/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb index 87ccd10b8..9a09dc265 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/002_Overworld_BattleIntroAnim.rb @@ -155,7 +155,7 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil) Input.update pbUpdateSceneMap timer += Graphics.delta_s - viewport.color.alpha = 255 * (1 - timer / 0.4) + viewport.color.alpha = 255 * (1 - (timer / 0.4)) break if viewport.color.alpha <= 0 end viewport.dispose @@ -267,9 +267,9 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50 flash.opacity -= 52 * 20 / Graphics.frame_rate if flash.opacity > 0 bar1.ox -= 32 * 20 / Graphics.frame_rate bar2.ox += 32 * 20 / Graphics.frame_rate - if i >= animTime / 2 && i < slideInTime + animTime / 2 - player.x = xoffset * (i + 1 - slideInTime - animTime / 2) / slideInTime - trainer.x = xoffset * (slideInTime - i - 1 + animTime / 2) / slideInTime + if i >= animTime / 2 && i < slideInTime + (animTime / 2) + player.x = xoffset * (i + 1 - slideInTime - (animTime / 2)) / slideInTime + trainer.x = xoffset * (slideInTime - i - 1 + (animTime / 2)) / slideInTime end pbWait(1) end @@ -283,10 +283,10 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50 trainer.tone = Tone.new(0, 0, 0) trainername = foe[0].name textpos = [ - [$player.name, Graphics.width / 4, (Graphics.height / 1.5) + 4, 2, - Color.new(248, 248, 248), Color.new(72, 72, 72)], - [trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 4, 2, - Color.new(248, 248, 248), Color.new(72, 72, 72)] + [$player.name, Graphics.width / 4, (Graphics.height / 1.5) + 4, 2, + Color.new(248, 248, 248), Color.new(72, 72, 72)], + [trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 4, 2, + Color.new(248, 248, 248), Color.new(72, 72, 72)] ] pbDrawTextPositions(overlay.bitmap, textpos) # Fade out flash, shudder Vs logo and expand it, and then fade to black diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb b/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb index 92c25ddb0..d70a0969d 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb @@ -114,7 +114,7 @@ class PokemonEncounters return true if pbPokeRadarOnShakingGrass # Get base encounter chance and minimum steps grace period encounter_chance = @step_chances[enc_type].to_f - min_steps_needed = (8 - encounter_chance / 10).clamp(0, 8).to_f + min_steps_needed = (8 - (encounter_chance / 10)).clamp(0, 8).to_f # Apply modifiers to the encounter chance and the minimum steps amount if triggered_by_step encounter_chance += @chance_accumulator / 200 @@ -168,7 +168,7 @@ class PokemonEncounters # after a previous wild encounter if triggered_by_step && @step_count < min_steps_needed @step_count += 1 - return false if rand(100) >= encounter_chance * 5 / (@step_chances[enc_type] + @chance_accumulator / 200) + return false if rand(100) >= encounter_chance * 5 / (@step_chances[enc_type] + (@chance_accumulator / 200)) end # Decide whether the wild encounter should actually happen return true if rand(100) < encounter_chance @@ -429,7 +429,7 @@ def pbGenerateWildPokemon(species, level, isRoamer = false) shiny_retries.times do break if genwildpoke.shiny? genwildpoke.shiny = nil # Make it recalculate shininess - genwildpoke.personalID = rand(2**16) | rand(2**16) << 16 + genwildpoke.personalID = rand(2**16) | (rand(2**16) << 16) end end # Give Pokérus diff --git a/Data/Scripts/012_Overworld/003_Overworld_Time.rb b/Data/Scripts/012_Overworld/003_Overworld_Time.rb index a89c78bce..a85d82460 100644 --- a/Data/Scripts/012_Overworld/003_Overworld_Time.rb +++ b/Data/Scripts/012_Overworld/003_Overworld_Time.rb @@ -138,19 +138,19 @@ end def moonphase(time = nil) # in UTC time = pbGetTimeNow if !time transitions = [ - 1.8456618033125, - 5.5369854099375, - 9.2283090165625, - 12.9196326231875, - 16.6109562298125, - 20.3022798364375, - 23.9936034430625, - 27.6849270496875 + 1.8456618033125, + 5.5369854099375, + 9.2283090165625, + 12.9196326231875, + 16.6109562298125, + 20.3022798364375, + 23.9936034430625, + 27.6849270496875 ] yy = time.year - ((12 - time.mon) / 10.0).floor - j = (365.25 * (4712 + yy)).floor + (((time.mon + 9) % 12) * 30.6 + 0.5).floor + time.day + 59 + j = (365.25 * (4712 + yy)).floor + ((((time.mon + 9) % 12) * 30.6) + 0.5).floor + time.day + 59 j -= (((yy / 100.0) + 49).floor * 0.75).floor - 38 if j > 2299160 - j += (((time.hour * 60) + time.min * 60) + time.sec) / 86400.0 + j += (((time.hour * 60) + (time.min * 60)) + time.sec) / 86400.0 v = (j - 2451550.1) / 29.530588853 v = ((v - v.floor) + (v < 0 ? 1 : 0)) ag = v * 29.53 @@ -164,22 +164,22 @@ end # 0 is Aries, 11 is Pisces. Month is 1 if January, and so on. def zodiac(month, day) time = [ - 3, 21, 4, 19, # Aries - 4, 20, 5, 20, # Taurus - 5, 21, 6, 20, # Gemini - 6, 21, 7, 20, # Cancer - 7, 23, 8, 22, # Leo - 8, 23, 9, 22, # Virgo - 9, 23, 10, 22, # Libra - 10, 23, 11, 21, # Scorpio - 11, 22, 12, 21, # Sagittarius - 12, 22, 1, 19, # Capricorn - 1, 20, 2, 18, # Aquarius - 2, 19, 3, 20 # Pisces + 3, 21, 4, 19, # Aries + 4, 20, 5, 20, # Taurus + 5, 21, 6, 20, # Gemini + 6, 21, 7, 20, # Cancer + 7, 23, 8, 22, # Leo + 8, 23, 9, 22, # Virgo + 9, 23, 10, 22, # Libra + 10, 23, 11, 21, # Scorpio + 11, 22, 12, 21, # Sagittarius + 12, 22, 1, 19, # Capricorn + 1, 20, 2, 18, # Aquarius + 2, 19, 3, 20 # Pisces ] for i in 0...12 - return i if month == time[i * 4] && day >= time[i * 4 + 1] - return i if month == time[i * 4 + 2] && day <= time[i * 4 + 3] + return i if month == time[i * 4] && day >= time[(i * 4) + 1] + return i if month == time[(i * 4) + 2] && day <= time[(i * 4) + 3] end return 0 end @@ -212,13 +212,13 @@ def pbIsWeekday(wdayVariable, *arg) end if wdayVariable > 0 $game_variables[wdayVariable] = [ - _INTL("Sunday"), - _INTL("Monday"), - _INTL("Tuesday"), - _INTL("Wednesday"), - _INTL("Thursday"), - _INTL("Friday"), - _INTL("Saturday") + _INTL("Sunday"), + _INTL("Monday"), + _INTL("Tuesday"), + _INTL("Wednesday"), + _INTL("Thursday"), + _INTL("Friday"), + _INTL("Saturday") ][wday] $game_map.need_refresh = true if $game_map end @@ -258,8 +258,7 @@ def pbGetMonthName(month) end def pbGetAbbrevMonthName(month) - return ["", - _INTL("Jan."), + return [_INTL("Jan."), _INTL("Feb."), _INTL("Mar."), _INTL("Apr."), @@ -270,7 +269,7 @@ def pbGetAbbrevMonthName(month) _INTL("Sep."), _INTL("Oct."), _INTL("Nov."), - _INTL("Dec.")][month] + _INTL("Dec.")][month - 1] end #=============================================================================== @@ -287,12 +286,10 @@ def pbIsSeason(seasonVariable, *arg) ret = true if wd == thisseason end if seasonVariable > 0 - $game_variables[seasonVariable] = [ - _INTL("Spring"), - _INTL("Summer"), - _INTL("Autumn"), - _INTL("Winter") - ][thisseason] + $game_variables[seasonVariable] = [_INTL("Spring"), + _INTL("Summer"), + _INTL("Autumn"), + _INTL("Winter")][thisseason] $game_map.need_refresh = true if $game_map end return ret diff --git a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb index 76cd3da5b..2273bffaf 100644 --- a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb +++ b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb @@ -89,9 +89,9 @@ def pbHiddenMoveAnimation(pokemon) end strobebitmap.dispose interp = RectInterpolator.new( - Rect.new(0, Graphics.height / 2, Graphics.width, 0), - Rect.new(0, (Graphics.height - bg.bitmap.height) / 2, Graphics.width, bg.bitmap.height), - Graphics.frame_rate / 4 + Rect.new(0, Graphics.height / 2, Graphics.width, 0), + Rect.new(0, (Graphics.height - bg.bitmap.height) / 2, Graphics.width, bg.bitmap.height), + Graphics.frame_rate / 4 ) ptinterp = nil phase = 1 @@ -109,9 +109,9 @@ def pbHiddenMoveAnimation(pokemon) if interp.done? phase = 2 ptinterp = PointInterpolator.new( - Graphics.width + (sprite.bitmap.width / 2), bg.bitmap.height / 2, - Graphics.width / 2, bg.bitmap.height / 2, - Graphics.frame_rate * 4 / 10 + Graphics.width + (sprite.bitmap.width / 2), bg.bitmap.height / 2, + Graphics.width / 2, bg.bitmap.height / 2, + Graphics.frame_rate * 4 / 10 ) end when 2 # Slide Pokémon sprite in from right to centre @@ -129,9 +129,9 @@ def pbHiddenMoveAnimation(pokemon) if frames > Graphics.frame_rate * 3 / 4 phase = 4 ptinterp = PointInterpolator.new( - Graphics.width / 2, bg.bitmap.height / 2, - -(sprite.bitmap.width / 2), bg.bitmap.height / 2, - Graphics.frame_rate * 4 / 10 + Graphics.width / 2, bg.bitmap.height / 2, + -(sprite.bitmap.width / 2), bg.bitmap.height / 2, + Graphics.frame_rate * 4 / 10 ) frames = 0 end @@ -143,9 +143,9 @@ def pbHiddenMoveAnimation(pokemon) phase = 5 sprite.visible = false interp = RectInterpolator.new( - Rect.new(0, (Graphics.height - bg.bitmap.height) / 2, Graphics.width, bg.bitmap.height), - Rect.new(0, Graphics.height / 2, Graphics.width, 0), - Graphics.frame_rate / 4 + Rect.new(0, (Graphics.height - bg.bitmap.height) / 2, Graphics.width, bg.bitmap.height), + Rect.new(0, Graphics.height / 2, Graphics.width, 0), + Graphics.frame_rate / 4 ) end when 5 # Shrink viewport height from full to zero @@ -159,15 +159,15 @@ def pbHiddenMoveAnimation(pokemon) strobe.ox = strobe.viewport.rect.x strobe.oy = strobe.viewport.rect.y if !strobe.visible # Initial placement of strobes - randomY = 16 * (1 + rand(bg.bitmap.height / 16 - 2)) - strobe.y = randomY + (Graphics.height - bg.bitmap.height) / 2 + randomY = 16 * (1 + rand((bg.bitmap.height / 16) - 2)) + strobe.y = randomY + ((Graphics.height - bg.bitmap.height) / 2) strobe.x = rand(Graphics.width) strobe.visible = true elsif strobe.x < Graphics.width # Move strobe right strobe.x += strobeSpeed else # Strobe is off the screen, reposition it to the left of the screen - randomY = 16 * (1 + rand(bg.bitmap.height / 16 - 2)) - strobe.y = randomY + (Graphics.height - bg.bitmap.height) / 2 + randomY = 16 * (1 + rand((bg.bitmap.height / 16) - 2)) + strobe.y = randomY + ((Graphics.height - bg.bitmap.height) / 2) strobe.x = -strobe.bitmap.width - rand(Graphics.width / 4) end end @@ -236,15 +236,13 @@ def pbSmashEvent(event) elsif event.name[/smashrock/i] pbSEPlay("Rock Smash", 80) end - pbMoveRoute(event, [ - PBMoveRoute::Wait, 2, - PBMoveRoute::TurnLeft, - PBMoveRoute::Wait, 2, - PBMoveRoute::TurnRight, - PBMoveRoute::Wait, 2, - PBMoveRoute::TurnUp, - PBMoveRoute::Wait, 2 - ]) + pbMoveRoute(event, [PBMoveRoute::Wait, 2, + PBMoveRoute::TurnLeft, + PBMoveRoute::Wait, 2, + PBMoveRoute::TurnRight, + PBMoveRoute::Wait, 2, + PBMoveRoute::TurnUp, + PBMoveRoute::Wait, 2]) pbWait(Graphics.frame_rate * 4 / 10) event.erase $PokemonMap.addErasedEvent(event.id) if $PokemonMap @@ -397,8 +395,8 @@ Events.onAction += proc { |_sender, _e| $map_factory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive pbSurfacing end - else - pbDive if $game_player.terrain_tag.can_dive + elsif $game_player.terrain_tag.can_dive + pbDive end } diff --git a/Data/Scripts/012_Overworld/006_Overworld_BerryPlants.rb b/Data/Scripts/012_Overworld/006_Overworld_BerryPlants.rb index fb48695dc..6b2b010b0 100644 --- a/Data/Scripts/012_Overworld/006_Overworld_BerryPlants.rb +++ b/Data/Scripts/012_Overworld/006_Overworld_BerryPlants.rb @@ -84,15 +84,12 @@ class BerryPlantData data = GameData::BerryPlant.get(@berry_id) if @new_mechanics return [data.maximum_yield * (5 - @yield_penalty) / 5, data.minimum_yield].max - else - if @watering_count > 0 - ret = (data.maximum_yield - data.minimum_yield) * (@watering_count - 1) - ret += rand(1 + data.maximum_yield - data.minimum_yield) - return (ret / 4) + data.minimum_yield - else - return data.minimum_yield - end + elsif @watering_count > 0 + ret = (data.maximum_yield - data.minimum_yield) * (@watering_count - 1) + ret += rand(1 + data.maximum_yield - data.minimum_yield) + return (ret / 4) + data.minimum_yield end + return data.minimum_yield end # Old mechanics only update a plant when its map is loaded. New mechanics @@ -138,7 +135,7 @@ class BerryPlantData # Update how long plant has been alive for old_growth_stage = @growth_stage @time_alive = new_time_alive - @growth_stage = 1 + @time_alive / time_per_stage + @growth_stage = 1 + (@time_alive / time_per_stage) @growth_stage += 1 if replanted? # Replants start at stage 2 @time_last_updated = time_now.to_i # Record watering (old mechanics), and apply drying out per hour (new mechanics) diff --git a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb index 24f6868c5..760502c83 100644 --- a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb +++ b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb @@ -244,7 +244,7 @@ class DayCare shiny_retries.times do break if egg.shiny? egg.shiny = nil # Make it recalculate shininess - egg.personalID = rand(2**16) | rand(2**16) << 16 + egg.personalID = rand(2**16) | (rand(2**16) << 16) end end diff --git a/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb b/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb index 65026d40d..dc7e0716b 100644 --- a/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb +++ b/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb @@ -118,7 +118,7 @@ module RandomDungeonGenerator def paint_corridor(tile, x, y, width, height) for j in 0...height for i in 0...width - tile[(y + j) * CELL_WIDTH + (x + i)] = DungeonTile::CORRIDOR + tile[((y + j) * CELL_WIDTH) + (x + i)] = DungeonTile::CORRIDOR end end end @@ -129,25 +129,25 @@ module RandomDungeonGenerator when TURN_NONE for y in 0...CELL_HEIGHT for x in 0...CELL_WIDTH - dungeon[x + dstX, y + dstY] = tile_layout[y * CELL_WIDTH + x] + dungeon[x + dstX, y + dstY] = tile_layout[(y * CELL_WIDTH) + x] end end when TURN_LEFT for y in 0...CELL_HEIGHT for x in 0...CELL_WIDTH - dungeon[y + dstX, CELL_WIDTH - 1 - x + dstY] = tile_layout[y * CELL_WIDTH + x] + dungeon[y + dstX, CELL_WIDTH - 1 - x + dstY] = tile_layout[(y * CELL_WIDTH) + x] end end when TURN_RIGHT for y in 0...CELL_HEIGHT for x in 0...CELL_WIDTH - dungeon[CELL_HEIGHT - 1 - y + dstX, x + dstY] = tile_layout[y * CELL_WIDTH + x] + dungeon[CELL_HEIGHT - 1 - y + dstX, x + dstY] = tile_layout[(y * CELL_WIDTH) + x] end end when TURN_BACK for y in 0...CELL_HEIGHT for x in 0...CELL_WIDTH - dungeon[CELL_WIDTH - 1 - x + dstX, CELL_HEIGHT - 1 - y + dstY] = tile_layout[y * CELL_WIDTH + x] + dungeon[CELL_WIDTH - 1 - x + dstX, CELL_HEIGHT - 1 - y + dstY] = tile_layout[(y * CELL_WIDTH) + x] end end end @@ -164,8 +164,8 @@ module RandomDungeonGenerator width = rand(ROOM_MIN_WIDTH..ROOM_MAX_WIDTH) height = rand(ROOM_MIN_HEIGHT..ROOM_MAX_HEIGHT) return false if width <= 0 || height <= 0 - centerX = CELL_WIDTH / 2 + rand(5) - 2 - centerY = CELL_HEIGHT / 2 + rand(5) - 2 + centerX = (CELL_WIDTH / 2) + rand(5) - 2 + centerY = (CELL_HEIGHT / 2) + rand(5) - 2 x = centerX - (width / 2) y = centerY - (height / 2) rect = [x, y, width, height] @@ -244,17 +244,17 @@ module RandomDungeonGenerator def getVisited(x, y) return false if x < 0 || y < 0 || x >= cellWidth || x >= cellHeight - return (@cells[y * cellWidth + x] & EdgeMasks::VISITED) != 0 + return (@cells[(y * cellWidth) + x] & EdgeMasks::VISITED) != 0 end def setVisited(x, y) return if x < 0 || y < 0 || x >= cellWidth || x >= cellHeight - @cells[y * cellWidth + x] |= EdgeMasks::VISITED + @cells[(y * cellWidth) + x] |= EdgeMasks::VISITED end def clearVisited(x, y) return if x < 0 || y < 0 || x >= cellWidth || x >= cellHeight - @cells[y * cellWidth + x] &= ~EdgeMasks::VISITED + @cells[(y * cellWidth) + x] &= ~EdgeMasks::VISITED end def clearAllCells @@ -265,12 +265,12 @@ module RandomDungeonGenerator def getEdgeNode(x, y, edge) return false if x < 0 || y < 0 || x >= nodeWidth || y >= nodeHeight - return @nodes[y * nodeWidth + x].getEdge(edge) + return @nodes[(y * nodeWidth) + x].getEdge(edge) end def setEdgeNode(x, y, edge) return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight - @nodes[y * nodeWidth + x].setEdge(edge) + @nodes[(y * nodeWidth) + x].setEdge(edge) e = 0 nx = x ny = y @@ -291,7 +291,7 @@ module RandomDungeonGenerator return end return if nx < 0 || ny < 0 || nx >= nodeWidth || ny >= nodeHeight - @nodes[ny * nodeWidth + nx].setEdge(e) + @nodes[(ny * nodeWidth) + nx].setEdge(e) end def setAllEdges @@ -302,7 +302,7 @@ module RandomDungeonGenerator def clearEdgeNode(x, y, edge) return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight - @nodes[y * nodeWidth + x].clearEdge(edge) + @nodes[(y * nodeWidth) + x].clearEdge(edge) e = 0 nx = x ny = y @@ -323,7 +323,7 @@ module RandomDungeonGenerator raise ArgumentError.new end return if nx < 0 || ny < 0 || nx >= nodeWidth || ny >= nodeHeight - @nodes[ny * nodeWidth + nx].clearEdge(e) + @nodes[(ny * nodeWidth) + nx].clearEdge(e) end def clearAllEdges @@ -334,7 +334,7 @@ module RandomDungeonGenerator def isBlockedNode?(x, y) return false if x < 0 || y < 0 || x >= nodeWidth || y >= nodeHeight - return @nodes[y * nodeWidth + x].isBlocked? + return @nodes[(y * nodeWidth) + x].isBlocked? end def getEdgePattern(x, y) @@ -483,22 +483,22 @@ module RandomDungeonGenerator end def [](x, y) - return @array[y * @width + x] + return @array[(y * @width) + x] end def []=(x, y, value) - @array[y * @width + x] = value + @array[(y * @width) + x] = value end def value(x, y) return DungeonTile::VOID if x < 0 || y < 0 || x >= @width || y >= @height - return @array[y * @width + x] + return @array[(y * @width) + x] end # Unused def get(x, y) return false if x < 0 || y < 0 || x >= @width || y >= @height - return @array[y * @width + x] != DungeonTile::VOID + return @array[(y * @width) + x] != DungeonTile::VOID end # Unused @@ -553,8 +553,8 @@ module RandomDungeonGenerator def generate self.clear - maxWidth = @width - BUFFER_X * 2 - maxHeight = @height - BUFFER_Y * 2 + maxWidth = @width - (BUFFER_X * 2) + maxHeight = @height - (BUFFER_Y * 2) cellWidth = DungeonMaze::CELL_WIDTH cellHeight = DungeonMaze::CELL_HEIGHT return if maxWidth < 0 || maxHeight < 0 @@ -576,7 +576,7 @@ module RandomDungeonGenerator for x in 0...maxWidth / cellWidth pattern = maze.getEdgePattern(x, y) next if !DungeonMaze.paint_cell_contents( - self, BUFFER_X + x * cellWidth, BUFFER_Y + y * cellHeight, + self, BUFFER_X + (x * cellWidth), BUFFER_Y + (y * cellHeight), corridor_patterns[pattern], DungeonMaze::TURN_NONE ) roomcount += 1 @@ -605,7 +605,7 @@ module RandomDungeonGenerator for j in 0...map.height nb = TileDrawingHelper.tableNeighbors(tbl, i, j) tile = TileDrawingHelper::NEIGHBORS_TO_AUTOTILE_INDEX[nb] - map.data[i, j, 0] = tile + 48 * (tbl[i, j]) + map.data[i, j, 0] = tile + (48 * (tbl[i, j])) map.data[i, j, 1] = 0 map.data[i, j, 2] = 0 end @@ -638,8 +638,8 @@ module RandomDungeonGenerator # @param x_cells [Integer] the number of cells wide the dungeon will be # @param y_cells [Intenger] the number of cells tall the dungeon will be def self.generate_test_dungeon(x_cells = 4, y_cells = 4) - dungeon = Dungeon.new(Dungeon::BUFFER_X * 2 + DungeonMaze::CELL_WIDTH * x_cells, - Dungeon::BUFFER_Y * 2 + DungeonMaze::CELL_HEIGHT * y_cells) + dungeon = Dungeon.new((Dungeon::BUFFER_X * 2) + (DungeonMaze::CELL_WIDTH * x_cells), + (Dungeon::BUFFER_Y * 2) + (DungeonMaze::CELL_HEIGHT * y_cells)) dungeon.generate echoln dungeon.write end diff --git a/Data/Scripts/013_Items/001_Item_Utilities.rb b/Data/Scripts/013_Items/001_Item_Utilities.rb index 024fe7504..abbe02464 100644 --- a/Data/Scripts/013_Items/001_Item_Utilities.rb +++ b/Data/Scripts/013_Items/001_Item_Utilities.rb @@ -319,7 +319,7 @@ def pbGainExpFromExpCandy(pkmn, base_amt, qty, scene) if qty > 1 (qty - 1).times { pkmn.changeHappiness("vitamin") } end - pbChangeExp(pkmn, pkmn.exp + base_amt * qty, scene) + pbChangeExp(pkmn, pkmn.exp + (base_amt * qty), scene) scene.pbHardRefresh return true end @@ -351,10 +351,8 @@ def pbBattleHPItem(pkmn, battler, restoreHP, scene) if battler.pbRecoverHP(restoreHP) > 0 scene.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis)) end - else - if pbItemRestoreHP(pkmn, restoreHP) > 0 - scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name)) - end + elsif pbItemRestoreHP(pkmn, restoreHP) > 0 + scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name)) end return true end @@ -814,35 +812,27 @@ def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0) if scene.pbConfirm(_INTL("Would you like to switch the two items?")) $bag.remove(item) if !$bag.add(pkmn.item) - if !$bag.add(item) - raise _INTL("Could't re-store deleted item in Bag somehow") - end + raise _INTL("Couldn't re-store deleted item in Bag somehow") if !$bag.add(item) scene.pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed.")) - else - if GameData::Item.get(item).is_mail? - if pbWriteMail(item, pkmn, pkmnid, scene) - pkmn.item = item - scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname)) - return true - else - if !$bag.add(item) - raise _INTL("Couldn't re-store deleted item in Bag somehow") - end - end - else + elsif GameData::Item.get(item).is_mail? + if pbWriteMail(item, pkmn, pkmnid, scene) pkmn.item = item scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname)) return true + elsif !$bag.add(item) + raise _INTL("Couldn't re-store deleted item in Bag somehow") end + else + pkmn.item = item + scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname)) + return true end end - else - if !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, scene) - $bag.remove(item) - pkmn.item = item - scene.pbDisplay(_INTL("{1} is now holding the {2}.", pkmn.name, newitemname)) - return true - end + elsif !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, scene) + $bag.remove(item) + pkmn.item = item + scene.pbDisplay(_INTL("{1} is now holding the {2}.", pkmn.name, newitemname)) + return true end return false end diff --git a/Data/Scripts/013_Items/002_Item_Effects.rb b/Data/Scripts/013_Items/002_Item_Effects.rb index 1a9341131..5f2945ae6 100644 --- a/Data/Scripts/013_Items/002_Item_Effects.rb +++ b/Data/Scripts/013_Items/002_Item_Effects.rb @@ -943,11 +943,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:POMEGBERRY, proc { |item, pkmn| }) ItemHandlers::UseOnPokemon.add(:POMEGBERRY, proc { |item, qty, pkmn, scene| - next pbRaiseHappinessAndLowerEV(pkmn, scene, :HP, qty, [ - _INTL("{1} adores you! Its base HP fell!", pkmn.name), - _INTL("{1} became more friendly. Its base HP can't go lower.", pkmn.name), - _INTL("{1} became more friendly. However, its base HP fell!", pkmn.name) - ]) + next pbRaiseHappinessAndLowerEV( + pkmn, scene, :HP, qty, [ + _INTL("{1} adores you! Its base HP fell!", pkmn.name), + _INTL("{1} became more friendly. Its base HP can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base HP fell!", pkmn.name) + ] + ) }) ItemHandlers::UseOnPokemonMaximum.add(:KELPSYBERRY, proc { |item, pkmn| @@ -955,11 +957,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:KELPSYBERRY, proc { |item, pkmn| }) ItemHandlers::UseOnPokemon.add(:KELPSYBERRY, proc { |item, qty, pkmn, scene| - next pbRaiseHappinessAndLowerEV(pkmn, scene, :ATTACK, qty, [ - _INTL("{1} adores you! Its base Attack fell!", pkmn.name), - _INTL("{1} became more friendly. Its base Attack can't go lower.", pkmn.name), - _INTL("{1} became more friendly. However, its base Attack fell!", pkmn.name) - ]) + next pbRaiseHappinessAndLowerEV( + pkmn, scene, :ATTACK, qty, [ + _INTL("{1} adores you! Its base Attack fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Attack can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Attack fell!", pkmn.name) + ] + ) }) ItemHandlers::UseOnPokemonMaximum.add(:QUALOTBERRY, proc { |item, pkmn| @@ -967,11 +971,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:QUALOTBERRY, proc { |item, pkmn| }) ItemHandlers::UseOnPokemon.add(:QUALOTBERRY, proc { |item, qty, pkmn, scene| - next pbRaiseHappinessAndLowerEV(pkmn, scene, :DEFENSE, qty, [ - _INTL("{1} adores you! Its base Defense fell!", pkmn.name), - _INTL("{1} became more friendly. Its base Defense can't go lower.", pkmn.name), - _INTL("{1} became more friendly. However, its base Defense fell!", pkmn.name) - ]) + next pbRaiseHappinessAndLowerEV( + pkmn, scene, :DEFENSE, qty, [ + _INTL("{1} adores you! Its base Defense fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Defense can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Defense fell!", pkmn.name) + ] + ) }) ItemHandlers::UseOnPokemonMaximum.add(:HONDEWBERRY, proc { |item, pkmn| @@ -979,11 +985,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:HONDEWBERRY, proc { |item, pkmn| }) ItemHandlers::UseOnPokemon.add(:HONDEWBERRY, proc { |item, qty, pkmn, scene| - next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_ATTACK, qty, [ - _INTL("{1} adores you! Its base Special Attack fell!", pkmn.name), - _INTL("{1} became more friendly. Its base Special Attack can't go lower.", pkmn.name), - _INTL("{1} became more friendly. However, its base Special Attack fell!", pkmn.name) - ]) + next pbRaiseHappinessAndLowerEV( + pkmn, scene, :SPECIAL_ATTACK, qty, [ + _INTL("{1} adores you! Its base Special Attack fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Special Attack can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Special Attack fell!", pkmn.name) + ] + ) }) ItemHandlers::UseOnPokemonMaximum.add(:GREPABERRY, proc { |item, pkmn| @@ -991,11 +999,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:GREPABERRY, proc { |item, pkmn| }) ItemHandlers::UseOnPokemon.add(:GREPABERRY, proc { |item, qty, pkmn, scene| - next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_DEFENSE, qty, [ - _INTL("{1} adores you! Its base Special Defense fell!", pkmn.name), - _INTL("{1} became more friendly. Its base Special Defense can't go lower.", pkmn.name), - _INTL("{1} became more friendly. However, its base Special Defense fell!", pkmn.name) - ]) + next pbRaiseHappinessAndLowerEV( + pkmn, scene, :SPECIAL_DEFENSE, qty, [ + _INTL("{1} adores you! Its base Special Defense fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Special Defense can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Special Defense fell!", pkmn.name) + ] + ) }) ItemHandlers::UseOnPokemonMaximum.add(:TAMATOBERRY, proc { |item, pkmn| @@ -1003,11 +1013,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:TAMATOBERRY, proc { |item, pkmn| }) ItemHandlers::UseOnPokemon.add(:TAMATOBERRY, proc { |item, qty, pkmn, scene| - next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPEED, qty, [ - _INTL("{1} adores you! Its base Speed fell!", pkmn.name), - _INTL("{1} became more friendly. Its base Speed can't go lower.", pkmn.name), - _INTL("{1} became more friendly. However, its base Speed fell!", pkmn.name) - ]) + next pbRaiseHappinessAndLowerEV( + pkmn, scene, :SPEED, qty, [ + _INTL("{1} adores you! Its base Speed fell!", pkmn.name), + _INTL("{1} became more friendly. Its base Speed can't go lower.", pkmn.name), + _INTL("{1} became more friendly. However, its base Speed fell!", pkmn.name) + ] + ) }) ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE, proc { |item, qty, pkmn, scene| diff --git a/Data/Scripts/013_Items/003_Item_BattleEffects.rb b/Data/Scripts/013_Items/003_Item_BattleEffects.rb index b9a891723..47c94a46b 100644 --- a/Data/Scripts/013_Items/003_Item_BattleEffects.rb +++ b/Data/Scripts/013_Items/003_Item_BattleEffects.rb @@ -49,8 +49,8 @@ ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_pok if battle.pbOpposingBattlerCount > 1 && !(GameData::Item.get(item).is_snag_ball? && battle.trainerBattle?) if battle.pbOpposingBattlerCount == 2 scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are two Pokémon!")) if showMessages - else - scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are more than one Pokémon!")) if showMessages + elsif showMessages + scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are more than one Pokémon!")) end next false end diff --git a/Data/Scripts/013_Items/004_Item_Phone.rb b/Data/Scripts/013_Items/004_Item_Phone.rb index 1745c2122..f3f478bb0 100644 --- a/Data/Scripts/013_Items/004_Item_Phone.rb +++ b/Data/Scripts/013_Items/004_Item_Phone.rb @@ -150,7 +150,7 @@ Events.onMapUpdate += proc { |_sender, _e| next if !num[0] || num.length != 8 # if not visible or not a trainer # Reset time to next can-battle if necessary if num[4] == 0 - num[3] = 20 * 60 + rand(20 * 60) # 20-40 minutes + num[3] = rand(20...40) * 60 # 20-40 minutes num[4] = 1 end # Count down time to next can-battle diff --git a/Data/Scripts/013_Items/005_Item_PokeRadar.rb b/Data/Scripts/013_Items/005_Item_PokeRadar.rb index b320b764a..5ac14eb37 100644 --- a/Data/Scripts/013_Items/005_Item_PokeRadar.rb +++ b/Data/Scripts/013_Items/005_Item_PokeRadar.rb @@ -66,11 +66,11 @@ def pbPokeRadarHighlightGrass(showmessage = true) if r <= (i + 1) * 2 x = $game_player.x - i - 1 + r y = $game_player.y - i - 1 - elsif r <= (i + 1) * 6 - 2 + elsif r <= ((i + 1) * 6) - 2 x = [$game_player.x + i + 1, $game_player.x - i - 1][r % 2] - y = $game_player.y - i + ((r - 1 - (i + 1) * 2) / 2).floor + y = $game_player.y - i + ((r - 1 - ((i + 1) * 2)) / 2).floor else - x = $game_player.x - i + r - (i + 1) * 6 + x = $game_player.x - i + r - ((i + 1) * 6) y = $game_player.y + i + 1 end # Add tile to grasses array if it's a valid grass tile @@ -81,7 +81,7 @@ def pbPokeRadarHighlightGrass(showmessage = true) # Choose a rarity for the grass (0=normal, 1=rare, 2=shiny) s = (rand(100) < 25) ? 1 : 0 if $game_temp.poke_radar_data && $game_temp.poke_radar_data[2] > 0 - v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - [$game_temp.poke_radar_data[2], 40].min * 200, 200].max + v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - ([$game_temp.poke_radar_data[2], 40].min * 200), 200].max v = (65536 / v.to_f).ceil s = 2 if rand(65536) < v end @@ -164,7 +164,7 @@ EncounterModifier.register(proc { |encounter| $game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring } if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining if rarity == 2 || - rand(100) < 58 + ring * 10 + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0) + rand(100) < 58 + (ring * 10) + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0) # Continue the chain encounter = [$game_temp.poke_radar_data[0], $game_temp.poke_radar_data[1]] $game_temp.force_single_battle = true @@ -186,8 +186,8 @@ EncounterModifier.register(proc { |encounter| encounter = pbPokeRadarGetEncounter(rarity) $game_temp.force_single_battle = true end - else # Encounter triggered by stepping in non-rustling grass - pbPokeRadarCancel if encounter + elsif encounter # Encounter triggered by stepping in non-rustling grass + pbPokeRadarCancel end next encounter }) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb index 79db48876..dc386abca 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb @@ -61,55 +61,55 @@ end def pbSpindaSpots(pkmn, bitmap) spot1 = [ - [0, 0, 1, 1, 1, 1, 0, 0], - [0, 1, 1, 1, 1, 1, 1, 0], - [1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1], - [0, 1, 1, 1, 1, 1, 1, 0], - [0, 0, 1, 1, 1, 1, 0, 0] + [0, 0, 1, 1, 1, 1, 0, 0], + [0, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1], + [0, 1, 1, 1, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 1, 0, 0] ] spot2 = [ - [0, 0, 1, 1, 1, 0, 0], - [0, 1, 1, 1, 1, 1, 0], - [1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1], - [0, 1, 1, 1, 1, 1, 0], - [0, 0, 1, 1, 1, 0, 0] + [0, 0, 1, 1, 1, 0, 0], + [0, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1], + [0, 1, 1, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 0, 0] ] spot3 = [ - [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], - [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], - [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], - [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], - [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], - [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0] + [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], + [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0] ] spot4 = [ - [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], - [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], - [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], - [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], - [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], - [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0] + [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0] ] id = pkmn.personalID h = (id >> 28) & 15 @@ -215,11 +215,11 @@ MultipleForms.register(:CHERRIM, { MultipleForms.register(:ROTOM, { "onSetForm" => proc { |pkmn, form, oldForm| form_moves = [ - :OVERHEAT, # Heat (microwave oven) - :HYDROPUMP, # Wash (washing machine) - :BLIZZARD, # Frost (refrigerator) - :AIRSLASH, # Fan (electric fan) - :LEAFSTORM # Mow (lawn mower) + :OVERHEAT, # Heat (microwave oven) + :HYDROPUMP, # Wash (washing machine) + :BLIZZARD, # Frost (refrigerator) + :AIRSLASH, # Fan (electric fan) + :LEAFSTORM # Mow (lawn mower) ] # Find a known move that should be forgotten old_move_index = -1 @@ -277,23 +277,23 @@ MultipleForms.register(:ARCEUS, { "getForm" => proc { |pkmn| next nil if !pkmn.hasAbility?(:MULTITYPE) typeArray = { - 1 => [:FISTPLATE, :FIGHTINIUMZ], - 2 => [:SKYPLATE, :FLYINIUMZ], - 3 => [:TOXICPLATE, :POISONIUMZ], - 4 => [:EARTHPLATE, :GROUNDIUMZ], - 5 => [:STONEPLATE, :ROCKIUMZ], - 6 => [:INSECTPLATE, :BUGINIUMZ], - 7 => [:SPOOKYPLATE, :GHOSTIUMZ], - 8 => [:IRONPLATE, :STEELIUMZ], - 10 => [:FLAMEPLATE, :FIRIUMZ], - 11 => [:SPLASHPLATE, :WATERIUMZ], - 12 => [:MEADOWPLATE, :GRASSIUMZ], - 13 => [:ZAPPLATE, :ELECTRIUMZ], - 14 => [:MINDPLATE, :PSYCHIUMZ], - 15 => [:ICICLEPLATE, :ICIUMZ], - 16 => [:DRACOPLATE, :DRAGONIUMZ], - 17 => [:DREADPLATE, :DARKINIUMZ], - 18 => [:PIXIEPLATE, :FAIRIUMZ] + 1 => [:FISTPLATE, :FIGHTINIUMZ], + 2 => [:SKYPLATE, :FLYINIUMZ], + 3 => [:TOXICPLATE, :POISONIUMZ], + 4 => [:EARTHPLATE, :GROUNDIUMZ], + 5 => [:STONEPLATE, :ROCKIUMZ], + 6 => [:INSECTPLATE, :BUGINIUMZ], + 7 => [:SPOOKYPLATE, :GHOSTIUMZ], + 8 => [:IRONPLATE, :STEELIUMZ], + 10 => [:FLAMEPLATE, :FIRIUMZ], + 11 => [:SPLASHPLATE, :WATERIUMZ], + 12 => [:MEADOWPLATE, :GRASSIUMZ], + 13 => [:ZAPPLATE, :ELECTRIUMZ], + 14 => [:MINDPLATE, :PSYCHIUMZ], + 15 => [:ICICLEPLATE, :ICIUMZ], + 16 => [:DRACOPLATE, :DRAGONIUMZ], + 17 => [:DREADPLATE, :DARKINIUMZ], + 18 => [:PIXIEPLATE, :FAIRIUMZ] } ret = 0 typeArray.each do |f, items| @@ -394,7 +394,7 @@ MultipleForms.copy(:SCATTERBUG, :SPEWPA, :VIVILLON) MultipleForms.register(:FURFROU, { "getForm" => proc { |pkmn| if !pkmn.time_form_set || - pbGetTimeNow.to_i > pkmn.time_form_set.to_i + 60 * 60 * 24 * 5 # 5 days + pbGetTimeNow.to_i > pkmn.time_form_set.to_i + (60 * 60 * 24 * 5) # 5 days next 0 end }, @@ -447,7 +447,7 @@ MultipleForms.register(:ZYGARDE, { MultipleForms.register(:HOOPA, { "getForm" => proc { |pkmn| if !pkmn.time_form_set || - pbGetTimeNow.to_i > pkmn.time_form_set.to_i + 60 * 60 * 24 * 3 # 3 days + pbGetTimeNow.to_i > pkmn.time_form_set.to_i + (60 * 60 * 24 * 3) # 3 days next 0 end }, @@ -482,23 +482,23 @@ MultipleForms.register(:SILVALLY, { "getForm" => proc { |pkmn| next nil if !pkmn.hasAbility?(:RKSSYSTEM) typeArray = { - 1 => [:FIGHTINGMEMORY], - 2 => [:FLYINGMEMORY], - 3 => [:POISONMEMORY], - 4 => [:GROUNDMEMORY], - 5 => [:ROCKMEMORY], - 6 => [:BUGMEMORY], - 7 => [:GHOSTMEMORY], - 8 => [:STEELMEMORY], - 10 => [:FIREMEMORY], - 11 => [:WATERMEMORY], - 12 => [:GRASSMEMORY], - 13 => [:ELECTRICMEMORY], - 14 => [:PSYCHICMEMORY], - 15 => [:ICEMEMORY], - 16 => [:DRAGONMEMORY], - 17 => [:DARKMEMORY], - 18 => [:FAIRYMEMORY] + 1 => [:FIGHTINGMEMORY], + 2 => [:FLYINGMEMORY], + 3 => [:POISONMEMORY], + 4 => [:GROUNDMEMORY], + 5 => [:ROCKMEMORY], + 6 => [:BUGMEMORY], + 7 => [:GHOSTMEMORY], + 8 => [:STEELMEMORY], + 10 => [:FIREMEMORY], + 11 => [:WATERMEMORY], + 12 => [:GRASSMEMORY], + 13 => [:ELECTRICMEMORY], + 14 => [:PSYCHICMEMORY], + 15 => [:ICEMEMORY], + 16 => [:DRAGONMEMORY], + 17 => [:DARKMEMORY], + 18 => [:FAIRYMEMORY] } ret = 0 typeArray.each do |f, items| @@ -596,7 +596,7 @@ MultipleForms.register(:MILCERY, { sweets = [:STRAWBERRYSWEET, :BERRYSWEET, :LOVESWEET, :STARSWEET, :CLOVERSWEET, :FLOWERSWEET, :RIBBONSWEET] if sweets.include?(pkmn.item_id) - next sweets.index(pkmn.item_id) + (pkmn.personalID % num_flavors) * sweets.length + next sweets.index(pkmn.item_id) + ((pkmn.personalID % num_flavors) * sweets.length) end next 0 } diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb index 373ab88aa..e07a11716 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb @@ -76,18 +76,18 @@ class PokemonStorage def allWallpapers return [ - # Basic wallpapers - _INTL("Forest"), _INTL("City"), _INTL("Desert"), _INTL("Savanna"), - _INTL("Crag"), _INTL("Volcano"), _INTL("Snow"), _INTL("Cave"), - _INTL("Beach"), _INTL("Seafloor"), _INTL("River"), _INTL("Sky"), - _INTL("Poké Center"), _INTL("Machine"), _INTL("Checks"), _INTL("Simple"), - # Special wallpapers - _INTL("Space"), _INTL("Backyard"), _INTL("Nostalgic 1"), _INTL("Torchic"), - _INTL("Trio 1"), _INTL("PikaPika 1"), _INTL("Legend 1"), _INTL("Team Galactic 1"), - _INTL("Distortion"), _INTL("Contest"), _INTL("Nostalgic 2"), _INTL("Croagunk"), - _INTL("Trio 2"), _INTL("PikaPika 2"), _INTL("Legend 2"), _INTL("Team Galactic 2"), - _INTL("Heart"), _INTL("Soul"), _INTL("Big Brother"), _INTL("Pokéathlon"), - _INTL("Trio 3"), _INTL("Spiky Pika"), _INTL("Kimono Girl"), _INTL("Revival") + # Basic wallpapers + _INTL("Forest"), _INTL("City"), _INTL("Desert"), _INTL("Savanna"), + _INTL("Crag"), _INTL("Volcano"), _INTL("Snow"), _INTL("Cave"), + _INTL("Beach"), _INTL("Seafloor"), _INTL("River"), _INTL("Sky"), + _INTL("Poké Center"), _INTL("Machine"), _INTL("Checks"), _INTL("Simple"), + # Special wallpapers + _INTL("Space"), _INTL("Backyard"), _INTL("Nostalgic 1"), _INTL("Torchic"), + _INTL("Trio 1"), _INTL("PikaPika 1"), _INTL("Legend 1"), _INTL("Team Galactic 1"), + _INTL("Distortion"), _INTL("Contest"), _INTL("Nostalgic 2"), _INTL("Croagunk"), + _INTL("Trio 2"), _INTL("PikaPika 2"), _INTL("Legend 2"), _INTL("Team Galactic 2"), + _INTL("Heart"), _INTL("Soul"), _INTL("Big Brother"), _INTL("Pokéathlon"), + _INTL("Trio 3"), _INTL("Spiky Pika"), _INTL("Kimono Girl"), _INTL("Revival") ] end diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index e15123103..c416a5b0c 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -1071,12 +1071,12 @@ class Pokemon # @return [Integer] the maximum HP of this Pokémon def calcHP(base, level, iv, ev) return 1 if base == 1 # For Shedinja - return ((base * 2 + iv + (ev / 4)) * level / 100).floor + level + 10 + return (((base * 2) + iv + (ev / 4)) * level / 100).floor + level + 10 end # @return [Integer] the specified stat of this Pokémon (not used for total HP) def calcStat(base, level, iv, ev, nat) - return ((((base * 2 + iv + (ev / 4)) * level / 100).floor + 5) * nat / 100).floor + return (((((base * 2) + iv + (ev / 4)) * level / 100).floor + 5) * nat / 100).floor end # Recalculates this Pokémon's stats. @@ -1179,9 +1179,10 @@ class Pokemon @iv[s.id] = rand(IV_STAT_LIMIT + 1) @ev[s.id] = 0 end - if owner.is_a?(Owner) + case owner + when Owner @owner = owner - elsif owner.is_a?(Player) || owner.is_a?(NPCTrainer) + when Player, NPCTrainer @owner = Owner.new_from_trainer(owner) else @owner = Owner.new(0, '', 2, 2) @@ -1195,7 +1196,7 @@ class Pokemon @timeReceived = pbGetTimeNow.to_i @timeEggHatched = nil @fused = nil - @personalID = rand(2**16) | rand(2**16) << 16 + @personalID = rand(2**16) | (rand(2**16) << 16) @hp = 1 @totalhp = 1 calc_stats diff --git a/Data/Scripts/014_Pokemon/004_Pokemon_Move.rb b/Data/Scripts/014_Pokemon/004_Pokemon_Move.rb index 5a7d4d131..bd36c8ccd 100644 --- a/Data/Scripts/014_Pokemon/004_Pokemon_Move.rb +++ b/Data/Scripts/014_Pokemon/004_Pokemon_Move.rb @@ -43,7 +43,7 @@ class Pokemon # @return [Integer] total PP def total_pp max_pp = GameData::Move.get(@id).total_pp - return max_pp + max_pp * @ppup / 5 + return max_pp + (max_pp * @ppup / 5) end alias totalpp total_pp diff --git a/Data/Scripts/015_Trainers and player/001_Trainer.rb b/Data/Scripts/015_Trainers and player/001_Trainer.rb index cfaa47427..3f7283e60 100644 --- a/Data/Scripts/015_Trainers and player/001_Trainer.rb +++ b/Data/Scripts/015_Trainers and player/001_Trainer.rb @@ -34,7 +34,7 @@ class Trainer # Random ID other than this Trainer's ID def make_foreign_ID loop do - ret = rand(2**16) | rand(2**16) << 16 + ret = rand(2**16) | (rand(2**16) << 16) return ret if ret != @id end return 0 @@ -168,7 +168,7 @@ class Trainer def initialize(name, trainer_type) @trainer_type = GameData::TrainerType.get(trainer_type).id @name = name - @id = rand(2**16) | rand(2**16) << 16 + @id = rand(2**16) | (rand(2**16) << 16) @language = pbGetLanguage @party = [] end diff --git a/Data/Scripts/015_Trainers and player/002_Trainer_LoadAndNew.rb b/Data/Scripts/015_Trainers and player/002_Trainer_LoadAndNew.rb index daa298461..0ca08164f 100644 --- a/Data/Scripts/015_Trainers and player/002_Trainer_LoadAndNew.rb +++ b/Data/Scripts/015_Trainers and player/002_Trainer_LoadAndNew.rb @@ -14,8 +14,8 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true) for i in 0...Settings::MAX_PARTY_SIZE if i == 0 pbMessage(_INTL("Please enter the first Pokémon.", i)) - else - break if !pbConfirmMessage(_INTL("Add another Pokémon?")) + elsif !pbConfirmMessage(_INTL("Add another Pokémon?")) + break end loop do species = pbChooseSpeciesList @@ -42,10 +42,12 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true) :pokemon => [] } party.each do |pkmn| - trainer_hash[:pokemon].push({ - :species => pkmn[0], - :level => pkmn[1] - }) + trainer_hash[:pokemon].push( + { + :species => pkmn[0], + :level => pkmn[1] + } + ) end # Add trainer's data to records trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]] diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb index f85770799..5e2acda69 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb @@ -89,8 +89,8 @@ class PokemonEggHatch_Scene @pokemon.species_data.apply_metrics_to_sprite(@sprites["pokemon"], 1) @sprites["hatch"].visible = false for i in 1..fadeTime - @sprites["pokemon"].tone = Tone.new(255 - i * toneDiff, 255 - i * toneDiff, 255 - i * toneDiff) - @sprites["overlay"].opacity = 255 - i * toneDiff + @sprites["pokemon"].tone = Tone.new(255 - (i * toneDiff), 255 - (i * toneDiff), 255 - (i * toneDiff)) + @sprites["overlay"].opacity = 255 - (i * toneDiff) updateScene end @sprites["pokemon"].tone = Tone.new(0, 0, 0) diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb index 2eda75cb9..123c2b886 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb @@ -34,13 +34,13 @@ class SpriteMetafile def initialize(viewport = nil) @metafile = [] @values = [ - viewport, - Tone.new(0, 0, 0, 0), Rect.new(0, 0, 0, 0), - true, - 0, 0, 0, 0, 0, 100, 100, - 0, false, 0, 255, 0, - Color.new(0, 0, 0, 0), Color.new(0, 0, 0, 0), - 0 + viewport, + Tone.new(0, 0, 0, 0), Rect.new(0, 0, 0, 0), + true, + 0, 0, 0, 0, 0, 100, 100, + 0, false, 0, 255, 0, + Color.new(0, 0, 0, 0), Color.new(0, 0, 0, 0), + 0 ] end diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb index 13a08d0a7..635637edf 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb @@ -93,8 +93,8 @@ class PokemonTrade_Scene pictureBall.moveXY(delay, 6, Graphics.width / 2, -32) # Play animation pbRunPictures( - [picturePoke, pictureBall], - [@sprites["rsprite1"], spriteBall] + [picturePoke, pictureBall], + [@sprites["rsprite1"], spriteBall] ) spriteBall.dispose end @@ -124,12 +124,12 @@ class PokemonTrade_Scene d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to delay -= t if i == 0 if i > 0 - pictureBall.setZoomXY(delay, 100 + 5 * (5 - i), 100 - 5 * (5 - i)) # Squish + pictureBall.setZoomXY(delay, 100 + (5 * (5 - i)), 100 - (5 * (5 - i))) # Squish pictureBall.moveZoom(delay, 2, 100) # Unsquish - pictureBall.moveXY(delay, t, Graphics.width / 2, y - 100 / d) + pictureBall.moveXY(delay, t, Graphics.width / 2, y - (100 / d)) end pictureBall.moveXY(delay + t, t, Graphics.width / 2, y) - pictureBall.setSE(delay + 2 * t, "Battle ball drop") + pictureBall.setSE(delay + (2 * t), "Battle ball drop") delay = pictureBall.totalDuration end picturePoke.setXY(delay, Graphics.width / 2, y) @@ -150,8 +150,8 @@ class PokemonTrade_Scene picturePoke.setSE(delay, cry) if cry # Play animation pbRunPictures( - [picturePoke, pictureBall], - [@sprites["rsprite2"], spriteBall] + [picturePoke, pictureBall], + [@sprites["rsprite2"], spriteBall] ) spriteBall.dispose end diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb b/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb index d48827e49..dddb157e6 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/006_UI_HallOfFame.rb @@ -139,10 +139,10 @@ class HallOfFame_Scene def xpointformula(battlernumber) ret = 0 if !SINGLEROW - ret = 32 + 160 * xpositionformula(battlernumber) + ret = 32 + (160 * xpositionformula(battlernumber)) else - ret = (60 * (battlernumber / 2) + 48) * (xpositionformula(battlernumber) - 1) - ret += Graphics.width / 2 - 56 + ret = ((60 * (battlernumber / 2)) + 48) * (xpositionformula(battlernumber) - 1) + ret += (Graphics.width / 2) - 56 end return ret end @@ -150,9 +150,9 @@ class HallOfFame_Scene def ypointformula(battlernumber) ret = 0 if !SINGLEROW - ret = 32 + 128 * ypositionformula(battlernumber) / 2 + ret = 32 + (128 * ypositionformula(battlernumber) / 2) else - ret = 96 - 8 * (battlernumber / 2) + ret = 96 - (8 * (battlernumber / 2)) end return ret end @@ -311,16 +311,16 @@ class HallOfFame_Scene dexnumber = _ISPRINTF("No. {1:03d}", number) end textPositions = [ - [dexnumber, 32, Graphics.height - 86, 0, BASECOLOR, SHADOWCOLOR], - [pokename, Graphics.width - 192, Graphics.height - 86, 2, BASECOLOR, SHADOWCOLOR], - [_INTL("Lv. {1}", pokemon.egg? ? "?" : pokemon.level), - 64, Graphics.height - 54, 0, BASECOLOR, SHADOWCOLOR], - [_INTL("IDNo.{1}", pokemon.egg? ? "?????" : idno), - Graphics.width - 192, Graphics.height - 54, 2, BASECOLOR, SHADOWCOLOR] + [dexnumber, 32, Graphics.height - 86, 0, BASECOLOR, SHADOWCOLOR], + [pokename, Graphics.width - 192, Graphics.height - 86, 2, BASECOLOR, SHADOWCOLOR], + [_INTL("Lv. {1}", pokemon.egg? ? "?" : pokemon.level), + 64, Graphics.height - 54, 0, BASECOLOR, SHADOWCOLOR], + [_INTL("IDNo.{1}", pokemon.egg? ? "?????" : idno), + Graphics.width - 192, Graphics.height - 54, 2, BASECOLOR, SHADOWCOLOR] ] if (hallNumber > -1) - textPositions.push([_INTL("Hall of Fame No."), Graphics.width / 2 - 104, -6, 0, BASECOLOR, SHADOWCOLOR]) - textPositions.push([hallNumber.to_s, Graphics.width / 2 + 104, -6, 1, BASECOLOR, SHADOWCOLOR]) + textPositions.push([_INTL("Hall of Fame No."), (Graphics.width / 2) - 104, -6, 0, BASECOLOR, SHADOWCOLOR]) + textPositions.push([hallNumber.to_s, (Graphics.width / 2) + 104, -6, 1, BASECOLOR, SHADOWCOLOR]) end pbDrawTextPositions(overlay, textPositions) end diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/007_UI_Credits.rb b/Data/Scripts/016_UI/001_Non-interactive UI/007_UI_Credits.rb index a7cce5dde..5e857f86f 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/007_UI_Credits.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/007_UI_Credits.rb @@ -118,14 +118,14 @@ _END_ pcred = PluginManager.credits(plugin) plugin_credits << "\"#{plugin}\" v.#{PluginManager.version(plugin)} by:\n" if pcred.size >= 5 - plugin_credits << pcred[0] + "\n" + plugin_credits << (pcred[0] + "\n") i = 1 until i >= pcred.size - plugin_credits << pcred[i] + "" + (pcred[i + 1] || "") + "\n" + plugin_credits << (pcred[i] + "" + (pcred[i + 1] || "") + "\n") i += 2 end else - pcred.each { |name| plugin_credits << name + "\n" } + pcred.each { |name| plugin_credits << (name + "\n") } end plugin_credits << "\n" end @@ -148,7 +148,7 @@ _END_ credit_bitmap = Bitmap.new(Graphics.width, @bitmap_height + 16) pbSetSystemFont(credit_bitmap) for j in 0...lines_per_bitmap - line = credit_lines[i * lines_per_bitmap + j] + line = credit_lines[(i * lines_per_bitmap) + j] next if !line line = line.split("") xpos = 0 @@ -156,29 +156,29 @@ _END_ linewidth = Graphics.width for k in 0...line.length if line.length > 1 - xpos = (k == 0) ? 0 : 20 + Graphics.width / 2 + xpos = (k == 0) ? 0 : 20 + (Graphics.width / 2) align = (k == 0) ? 2 : 0 # Right align : left align - linewidth = Graphics.width / 2 - 20 + linewidth = (Graphics.width / 2) - 20 end credit_bitmap.font.color = TEXT_SHADOW_COLOR - credit_bitmap.draw_text(xpos, j * 32 + 12, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos, (j * 32) + 12, linewidth, 32, line[k], align) credit_bitmap.font.color = TEXT_OUTLINE_COLOR - credit_bitmap.draw_text(xpos + 2, j * 32 + 2, linewidth, 32, line[k], align) - credit_bitmap.draw_text(xpos, j * 32 + 2, linewidth, 32, line[k], align) - credit_bitmap.draw_text(xpos - 2, j * 32 + 2, linewidth, 32, line[k], align) - credit_bitmap.draw_text(xpos + 2, j * 32 + 4, linewidth, 32, line[k], align) - credit_bitmap.draw_text(xpos - 2, j * 32 + 4, linewidth, 32, line[k], align) - credit_bitmap.draw_text(xpos + 2, j * 32 + 6, linewidth, 32, line[k], align) - credit_bitmap.draw_text(xpos, j * 32 + 6, linewidth, 32, line[k], align) - credit_bitmap.draw_text(xpos - 2, j * 32 + 6, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos + 2, (j * 32) + 2, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos, (j * 32) + 2, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos - 2, (j * 32) + 2, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos + 2, (j * 32) + 4, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos - 2, (j * 32) + 4, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos + 2, (j * 32) + 6, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos, (j * 32) + 6, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos - 2, (j * 32) + 6, linewidth, 32, line[k], align) credit_bitmap.font.color = TEXT_BASE_COLOR - credit_bitmap.draw_text(xpos, j * 32 + 4, linewidth, 32, line[k], align) + credit_bitmap.draw_text(xpos, (j * 32) + 4, linewidth, 32, line[k], align) end end credit_sprite = Sprite.new(text_viewport) credit_sprite.bitmap = credit_bitmap credit_sprite.z = 9998 - credit_sprite.oy = @realOY - @bitmap_height * i + credit_sprite.oy = @realOY - (@bitmap_height * i) @credit_sprites[i] = credit_sprite end #------------------------------- @@ -245,6 +245,6 @@ _END_ return if cancel? return if last? @realOY += SCROLL_SPEED * delta - @credit_sprites.each_with_index { |s, i| s.oy = @realOY - @bitmap_height * i } + @credit_sprites.each_with_index { |s, i| s.oy = @realOY - (@bitmap_height * i) } end end diff --git a/Data/Scripts/016_UI/001_UI_PauseMenu.rb b/Data/Scripts/016_UI/001_UI_PauseMenu.rb index db8b5c616..81f7b095a 100644 --- a/Data/Scripts/016_UI/001_UI_PauseMenu.rb +++ b/Data/Scripts/016_UI/001_UI_PauseMenu.rb @@ -143,8 +143,8 @@ class PokemonPauseMenu @scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount)) end commands[cmdQuit = commands.length] = _INTL("Quit Contest") - else - commands[cmdSave = commands.length] = _INTL("Save") if $game_system && !$game_system.save_disabled + elsif $game_system && !$game_system.save_disabled + commands[cmdSave = commands.length] = _INTL("Save") end commands[cmdOption = commands.length] = _INTL("Options") commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG @@ -160,23 +160,21 @@ class PokemonPauseMenu screen.pbStartScreen @scene.pbRefresh } + elsif $player.pokedex.accessible_dexes.length == 1 + $PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0] + pbFadeOutIn { + scene = PokemonPokedex_Scene.new + screen = PokemonPokedexScreen.new(scene) + screen.pbStartScreen + @scene.pbRefresh + } else - if $player.pokedex.accessible_dexes.length == 1 - $PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0] - pbFadeOutIn { - scene = PokemonPokedex_Scene.new - screen = PokemonPokedexScreen.new(scene) - screen.pbStartScreen - @scene.pbRefresh - } - else - pbFadeOutIn { - scene = PokemonPokedexMenu_Scene.new - screen = PokemonPokedexMenuScreen.new(scene) - screen.pbStartScreen - @scene.pbRefresh - } - end + pbFadeOutIn { + scene = PokemonPokedexMenu_Scene.new + screen = PokemonPokedexMenuScreen.new(scene) + screen.pbStartScreen + @scene.pbRefresh + } end elsif cmdPokemon >= 0 && command == cmdPokemon pbPlayDecisionSE @@ -243,14 +241,12 @@ class PokemonPauseMenu else pbShowMenu end + elsif pbConfirmMessage(_INTL("Would you like to end the Contest now?")) + @scene.pbEndScene + pbBugContestState.pbStartJudging + return else - if pbConfirmMessage(_INTL("Would you like to end the Contest now?")) - @scene.pbEndScene - pbBugContestState.pbStartJudging - return - else - pbShowMenu - end + pbShowMenu end elsif cmdSave >= 0 && command == cmdSave @scene.pbHideMenu diff --git a/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb b/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb index 735a6db33..3a9418c31 100644 --- a/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb +++ b/Data/Scripts/016_UI/002_UI_Pokedex_Menu.rb @@ -23,10 +23,11 @@ class Window_DexesList < Window_CommandPokemon sprintf("%d", @commands2[index][1]), self.baseColor, self.shadowColor, 1) allseen = (@commands2[index][0] >= @commands2[index][2]) allown = (@commands2[index][1] >= @commands2[index][2]) - pbDrawImagePositions(self.contents, [ - ["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 236, rect.y + 2, (allseen) ? 24 : 0, 0, 24, 24], - ["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 332, rect.y + 2, (allown) ? 24 : 0, 24, 24, 24] - ]) + pbDrawImagePositions( + self.contents, + [["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 236, rect.y + 2, (allseen) ? 24 : 0, 0, 24, 24], + ["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 332, rect.y + 2, (allown) ? 24 : 0, 24, 24, 24]] + ) end end end @@ -47,7 +48,7 @@ class PokemonPokedexMenu_Scene @sprites["background"] = IconSprite.new(0, 0, @viewport) @sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_menu")) @sprites["headings"] = Window_AdvancedTextPokemon.newWithSize( - _INTL("SEENOBTAINED"), 286, 136, 208, 64, @viewport + _INTL("SEENOBTAINED"), 286, 136, 208, 64, @viewport ) @sprites["headings"].windowskin = nil @sprites["commands"] = Window_DexesList.new(commands, commands2, Graphics.width - 84) diff --git a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb index 1826a6da2..53827cf2f 100644 --- a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb +++ b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb @@ -169,7 +169,7 @@ class PokedexSearchSelectionSprite < SpriteWrapper self.y = 52 when 1, 2, 3, 4 # Name, type, height, weight self.x = 114 - self.y = 110 + (@index - 1) * 52 + self.y = 110 + ((@index - 1) * 52) when 5 # Color self.x = 382 self.y = 110 @@ -177,7 +177,7 @@ class PokedexSearchSelectionSprite < SpriteWrapper self.x = 420 self.y = 214 when 7, 8, 9 # Reset, start, cancel - self.x = 4 + (@index - 7) * 176 + self.x = 4 + ((@index - 7) * 176) self.y = 334 end else # Parameter screen @@ -207,11 +207,11 @@ class PokedexSearchSelectionSprite < SpriteWrapper case @index when -1 # Blank option if @mode == 3 || @mode == 4 # Height/weight range - self.x = @xstart + (@cmds + 1) * @xgap * (@minmax % 2) - self.y = @ystart + @ygap * ((@minmax + 1) % 2) + self.x = @xstart + ((@cmds + 1) * @xgap * (@minmax % 2)) + self.y = @ystart + (@ygap * ((@minmax + 1) % 2)) else - self.x = @xstart + (@cols - 1) * @xgap - self.y = @ystart + (@cmds / @cols).floor * @ygap + self.x = @xstart + ((@cols - 1) * @xgap) + self.y = @ystart + ((@cmds / @cols).floor * @ygap) end when -2 # OK self.x = 4 @@ -223,19 +223,19 @@ class PokedexSearchSelectionSprite < SpriteWrapper case @mode when 0, 1, 2, 5, 6 # Order, name, type, color, shape if @index >= @cmds - self.x = @xstart + (@cols - 1) * @xgap - self.y = @ystart + (@cmds / @cols).floor * @ygap + self.x = @xstart + ((@cols - 1) * @xgap) + self.y = @ystart + ((@cmds / @cols).floor * @ygap) else - self.x = @xstart + (@index % @cols) * @xgap - self.y = @ystart + (@index / @cols).floor * @ygap + self.x = @xstart + ((@index % @cols) * @xgap) + self.y = @ystart + ((@index / @cols).floor * @ygap) end when 3, 4 # Height, weight if @index >= @cmds - self.x = @xstart + (@cmds + 1) * @xgap * ((@minmax + 1) % 2) + self.x = @xstart + ((@cmds + 1) * @xgap * ((@minmax + 1) % 2)) else - self.x = @xstart + (@index + 1) * @xgap + self.x = @xstart + ((@index + 1) * @xgap) end - self.y = @ystart + @ygap * ((@minmax + 1) % 2) + self.y = @ystart + (@ygap * ((@minmax + 1) % 2)) end end end @@ -424,7 +424,7 @@ class PokemonPokedex_Scene end end textpos = [ - [dexname, Graphics.width / 2, -2, 2, Color.new(248, 248, 248), Color.new(0, 0, 0)] + [dexname, Graphics.width / 2, -2, 2, Color.new(248, 248, 248), Color.new(0, 0, 0)] ] textpos.push([GameData::Species.get(iconspecies).name, 112, 46, 2, base, shadow]) if iconspecies if @searchResults @@ -462,8 +462,8 @@ class PokemonPokedex_Scene overlay.blt(468, y, @sliderbitmap.bitmap, Rect.new(40, 0, 40, 8)) i = 0 while i * 16 < boxheight - 8 - 16 - height = [boxheight - 8 - 16 - i * 16, 16].min - overlay.blt(468, y + 8 + i * 16, @sliderbitmap.bitmap, Rect.new(40, 8, 40, height)) + height = [boxheight - 8 - 16 - (i * 16), 16].min + overlay.blt(468, y + 8 + (i * 16), @sliderbitmap.bitmap, Rect.new(40, 8, 40, height)) i += 1 end overlay.blt(468, y + boxheight - 16, @sliderbitmap.bitmap, Rect.new(40, 24, 40, 16)) @@ -477,17 +477,17 @@ class PokemonPokedex_Scene shadow = Color.new(72, 72, 72) # Write various bits of text textpos = [ - [_INTL("Search Mode"), Graphics.width / 2, -2, 2, base, shadow], - [_INTL("Order"), 136, 52, 2, base, shadow], - [_INTL("Name"), 58, 110, 2, base, shadow], - [_INTL("Type"), 58, 162, 2, base, shadow], - [_INTL("Height"), 58, 214, 2, base, shadow], - [_INTL("Weight"), 58, 266, 2, base, shadow], - [_INTL("Color"), 326, 110, 2, base, shadow], - [_INTL("Shape"), 454, 162, 2, base, shadow], - [_INTL("Reset"), 80, 338, 2, base, shadow, 1], - [_INTL("Start"), Graphics.width / 2, 338, 2, base, shadow, 1], - [_INTL("Cancel"), Graphics.width - 80, 338, 2, base, shadow, 1] + [_INTL("Search Mode"), Graphics.width / 2, -2, 2, base, shadow], + [_INTL("Order"), 136, 52, 2, base, shadow], + [_INTL("Name"), 58, 110, 2, base, shadow], + [_INTL("Type"), 58, 162, 2, base, shadow], + [_INTL("Height"), 58, 214, 2, base, shadow], + [_INTL("Weight"), 58, 266, 2, base, shadow], + [_INTL("Color"), 326, 110, 2, base, shadow], + [_INTL("Shape"), 454, 162, 2, base, shadow], + [_INTL("Reset"), 80, 338, 2, base, shadow, 1], + [_INTL("Start"), Graphics.width / 2, 338, 2, base, shadow, 1], + [_INTL("Cancel"), Graphics.width - 80, 338, 2, base, shadow, 1] ] # Write order, name and color parameters textpos.push([@orderCommands[params[0]], 344, 58, 2, base, shadow, 1]) @@ -549,9 +549,9 @@ class PokemonPokedex_Scene shadow = Color.new(72, 72, 72) # Write various bits of text textpos = [ - [_INTL("Search Mode"), Graphics.width / 2, -2, 2, base, shadow], - [_INTL("OK"), 80, 338, 2, base, shadow, 1], - [_INTL("Cancel"), Graphics.width - 80, 338, 2, base, shadow, 1] + [_INTL("Search Mode"), Graphics.width / 2, -2, 2, base, shadow], + [_INTL("OK"), 80, 338, 2, base, shadow, 1], + [_INTL("Cancel"), Graphics.width - 80, 338, 2, base, shadow, 1] ] title = [_INTL("Order"), _INTL("Name"), _INTL("Type"), _INTL("Height"), _INTL("Weight"), _INTL("Color"), _INTL("Shape")][mode] @@ -615,11 +615,11 @@ class PokemonPokedex_Scene when 2 # Type icons for i in 0...2 if !sel[i] || sel[i] < 0 - textpos.push(["----", 298 + 128 * i, 58, 2, base, shadow, 1]) + textpos.push(["----", 298 + (128 * i), 58, 2, base, shadow, 1]) else type_number = @typeCommands[sel[i]].icon_position typerect = Rect.new(0, type_number * 32, 96, 32) - overlay.blt(250 + 128 * i, 58, @typebitmap.bitmap, typerect) + overlay.blt(250 + (128 * i), 58, @typebitmap.bitmap, typerect) end end when 3 # Height range @@ -677,10 +677,10 @@ class PokemonPokedex_Scene end # Draw selected option(s) button graphic if [3, 4].include?(mode) # Height, weight - xpos1 = xstart + (sel[0] + 1) * xgap + xpos1 = xstart + ((sel[0] + 1) * xgap) xpos1 = xstart if sel[0] < -1 - xpos2 = xstart + (sel[1] + 1) * xgap - xpos2 = xstart + cols * xgap if sel[1] < 0 + xpos2 = xstart + ((sel[1] + 1) * xgap) + xpos2 = xstart + (cols * xgap) if sel[1] < 0 xpos2 = xstart if sel[1] >= cols - 1 ypos1 = ystart + 172 ypos2 = ystart + 28 @@ -698,9 +698,9 @@ class PokemonPokedex_Scene for i in 0...sel.length selrect = Rect.new(0, selbuttony, @selbitmap.bitmap.width, selbuttonheight) if sel[i] >= 0 - overlay.blt(xstart + (sel[i] % cols) * xgap, ystart + (sel[i] / cols).floor * ygap, @selbitmap.bitmap, selrect) + overlay.blt(xstart + ((sel[i] % cols) * xgap), ystart + ((sel[i] / cols).floor * ygap), @selbitmap.bitmap, selrect) else - overlay.blt(xstart + (cols - 1) * xgap, ystart + (cmds.length / cols).floor * ygap, @selbitmap.bitmap, selrect) + overlay.blt(xstart + ((cols - 1) * xgap), ystart + ((cmds.length / cols).floor * ygap), @selbitmap.bitmap, selrect) end end end @@ -708,35 +708,35 @@ class PokemonPokedex_Scene case mode when 0, 1 # Order, name for i in 0...cmds.length - x = xstart + halfwidth + (i % cols) * xgap - y = ystart + 6 + (i / cols).floor * ygap + x = xstart + halfwidth + ((i % cols) * xgap) + y = ystart + 6 + ((i / cols).floor * ygap) textpos.push([cmds[i], x, y, 2, base, shadow, 1]) end if mode != 0 textpos.push([(mode == 1) ? "-" : "----", - xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1]) + xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1]) end when 2 # Type typerect = Rect.new(0, 0, 96, 32) for i in 0...cmds.length typerect.y = @typeCommands[i].icon_position * 32 - overlay.blt(xstart + 14 + (i % cols) * xgap, ystart + 6 + (i / cols).floor * ygap, @typebitmap.bitmap, typerect) + overlay.blt(xstart + 14 + ((i % cols) * xgap), ystart + 6 + ((i / cols).floor * ygap), @typebitmap.bitmap, typerect) end textpos.push(["----", - xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1]) + xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1]) when 5 # Color for i in 0...cmds.length - x = xstart + halfwidth + (i % cols) * xgap - y = ystart + 6 + (i / cols).floor * ygap + x = xstart + halfwidth + ((i % cols) * xgap) + y = ystart + 6 + ((i / cols).floor * ygap) textpos.push([cmds[i].name, x, y, 2, base, shadow, 1]) end textpos.push(["----", - xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1]) + xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1]) when 6 # Shape shaperect = Rect.new(0, 0, 60, 60) for i in 0...cmds.length shaperect.y = @shapeCommands[i].icon_position * 60 - overlay.blt(xstart + 4 + (i % cols) * xgap, ystart + 4 + (i / cols).floor * ygap, @shapebitmap.bitmap, shaperect) + overlay.blt(xstart + 4 + ((i % cols) * xgap), ystart + 4 + ((i / cols).floor * ygap), @shapebitmap.bitmap, shaperect) end end # Draw all text @@ -986,7 +986,7 @@ class PokemonPokedex_Scene else if Input.trigger?(Input::UP) if index == -1 # From blank - index = cmds.length - 1 - (cmds.length - 1) % cols - 1 + index = cmds.length - 1 - ((cmds.length - 1) % cols) - 1 elsif index == -2 # From OK index = ((cmds.length - 1) / cols).floor * cols elsif index == -3 && mode == 0 # From Cancel diff --git a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb index 36b6628da..33f9ca06b 100644 --- a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb +++ b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb @@ -28,11 +28,12 @@ class PokemonPokedexInfo_Scene @sprites["areamap"].y += (Graphics.height + 32 - @sprites["areamap"].bitmap.height) / 2 for hidden in Settings::REGION_MAP_EXTRAS if hidden[0] == @region && hidden[1] > 0 && $game_switches[hidden[1]] - pbDrawImagePositions(@sprites["areamap"].bitmap, [ - ["Graphics/Pictures/#{hidden[4]}", + pbDrawImagePositions( + @sprites["areamap"].bitmap, + [["Graphics/Pictures/#{hidden[4]}", hidden[2] * PokemonRegionMap_Scene::SQUARE_WIDTH, - hidden[3] * PokemonRegionMap_Scene::SQUARE_HEIGHT] - ]) + hidden[3] * PokemonRegionMap_Scene::SQUARE_HEIGHT]] + ) end end @sprites["areahighlight"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport) @@ -218,8 +219,8 @@ class PokemonPokedexInfo_Scene indexText = sprintf("%03d", indexNumber) end textpos = [ - [_INTL("{1}{2} {3}", indexText, " ", species_data.name), - 246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)] + [_INTL("{1}{2} {3}", indexText, " ", species_data.name), + 246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)] ] if @show_battled_count textpos.push([_INTL("Number Battled"), 314, 152, 0, base, shadow]) @@ -261,7 +262,7 @@ class PokemonPokedexInfo_Scene species_data.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position type_rect = Rect.new(0, type_number * 32, 96, 32) - overlay.blt(296 + 100 * i, 120, @typebitmap.bitmap, type_rect) + overlay.blt(296 + (100 * i), 120, @typebitmap.bitmap, type_rect) end else # Write the category @@ -316,16 +317,16 @@ class PokemonPokedexInfo_Scene mapsize = map_metadata.town_map_size if mapsize && mapsize[0] && mapsize[0] > 0 sqwidth = mapsize[0] - sqheight = (mapsize[1].length * 1.0 / mapsize[0]).ceil + sqheight = (mapsize[1].length.to_f / mapsize[0]).ceil for i in 0...sqwidth for j in 0...sqheight - if mapsize[1][i + j * sqwidth, 1].to_i > 0 - points[mappos[1] + i + (mappos[2] + j) * mapwidth] = true + if mapsize[1][i + (j * sqwidth), 1].to_i > 0 + points[mappos[1] + i + ((mappos[2] + j) * mapwidth)] = true end end end else - points[mappos[1] + mappos[2] * mapwidth] = true + points[mappos[1] + (mappos[2] * mapwidth)] = true end end # Draw coloured squares on each square of the region map with a nest @@ -357,10 +358,11 @@ class PokemonPokedexInfo_Scene # Set the text textpos = [] if points.length == 0 - pbDrawImagePositions(overlay, [ - [sprintf("Graphics/Pictures/Pokedex/overlay_areanone"), 108, 188] - ]) - textpos.push([_INTL("Area unknown"), Graphics.width / 2, Graphics.height / 2 - 6, 2, base, shadow]) + pbDrawImagePositions( + overlay, + [[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"), 108, 188]] + ) + textpos.push([_INTL("Area unknown"), Graphics.width / 2, (Graphics.height / 2) - 6, 2, base, shadow]) end textpos.push([pbGetMessage(MessageTypes::RegionNames, @region), 414, 38, 2, base, shadow]) textpos.push([_INTL("{1}'s area", GameData::Species.get(@species).name), @@ -382,8 +384,8 @@ class PokemonPokedexInfo_Scene end end textpos = [ - [GameData::Species.get(@species).name, Graphics.width / 2, Graphics.height - 94, 2, base, shadow], - [formname, Graphics.width / 2, Graphics.height - 62, 2, base, shadow] + [GameData::Species.get(@species).name, Graphics.width / 2, Graphics.height - 94, 2, base, shadow], + [formname, Graphics.width / 2, Graphics.height - 62, 2, base, shadow] ] # Draw all text pbDrawTextPositions(overlay, textpos) diff --git a/Data/Scripts/016_UI/005_UI_Party.rb b/Data/Scripts/016_UI/005_UI_Party.rb index 3d22fa60a..e90a3db5a 100644 --- a/Data/Scripts/016_UI/005_UI_Party.rb +++ b/Data/Scripts/016_UI/005_UI_Party.rb @@ -140,7 +140,7 @@ class PokemonPartyBlankPanel < SpriteWrapper def initialize(_pokemon, index, viewport = nil) super(viewport) self.x = (index % 2) * Graphics.width / 2 - self.y = 16 * (index % 2) + 96 * (index / 2) + self.y = (16 * (index % 2)) + (96 * (index / 2)) @panelbgsprite = AnimatedBitmap.new("Graphics/Pictures/Party/panel_blank") self.bitmap = @panelbgsprite.bitmap @text = nil @@ -177,7 +177,7 @@ class PokemonPartyPanel < SpriteWrapper @active = (index == 0) # true = rounded panel, false = rectangular panel @refreshing = true self.x = (index % 2) * Graphics.width / 2 - self.y = 16 * (index % 2) + 96 * (index / 2) + self.y = (16 * (index % 2)) + (96 * (index / 2)) @panelbgsprite = ChangelingSprite.new(0, 0, viewport) @panelbgsprite.z = self.z if @active # Rounded panel @@ -374,7 +374,7 @@ class PokemonPartyPanel < SpriteWrapper textpos.push([sprintf("% 3d /% 3d", @pokemon.hp, @pokemon.totalhp), 224, 54, 1, basecolor, shadowcolor]) # Draw HP bar if @pokemon.hp > 0 - w = @pokemon.hp * 96 * 1.0 / @pokemon.totalhp + w = @pokemon.hp * 96 / @pokemon.totalhp.to_f w = 1 if w < 1 w = ((w / 2).round) * 2 hpzone = 0 @@ -415,16 +415,14 @@ class PokemonPartyPanel < SpriteWrapper pbDrawImagePositions(@overlaysprite.bitmap, [["Graphics/Pictures/Party/overlay_lv", 20, 70, 0, 0, 22, 14]]) pbSetSmallFont(@overlaysprite.bitmap) - pbDrawTextPositions(@overlaysprite.bitmap, [ - [@pokemon.level.to_s, 42, 57, 0, basecolor, shadowcolor] - ]) + pbDrawTextPositions(@overlaysprite.bitmap, + [[@pokemon.level.to_s, 42, 57, 0, basecolor, shadowcolor]]) end # Draw annotation text if @text && @text.length > 0 pbSetSystemFont(@overlaysprite.bitmap) - pbDrawTextPositions(@overlaysprite.bitmap, [ - [@text, 96, 52, 0, basecolor, shadowcolor] - ]) + pbDrawTextPositions(@overlaysprite.bitmap, + [[@text, 96, 52, 0, basecolor, shadowcolor]]) end end @refreshing = false @@ -514,10 +512,8 @@ class PokemonParty_Scene pbPlayDecisionSE if @sprites["messagebox"].pausing? @sprites["messagebox"].resume end - else - if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) - break - end + elsif Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) + break end end @sprites["messagebox"].visible = false diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index 733905cb9..63513702d 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -78,7 +78,7 @@ class RibbonSelectionSprite < MoveSelectionSprite def refresh w = @movesel.width h = @movesel.height / 2 - self.x = 228 + (self.index % 4) * 68 + self.x = 228 + ((self.index % 4) * 68) self.y = 76 + ((self.index / 4).floor * 68) self.bitmap = @movesel.bitmap if self.preselected @@ -291,7 +291,7 @@ class PokemonSummary_Scene (@markingbitmap.bitmap.width / MARK_WIDTH).times do |i| markrect.x = i * MARK_WIDTH markrect.y = [(markings[i] || 0), mark_variants - 1].min * MARK_HEIGHT - bitmap.blt(x + i * MARK_WIDTH, y, @markingbitmap.bitmap, markrect) + bitmap.blt(x + (i * MARK_WIDTH), y, @markingbitmap.bitmap, markrect) end end @@ -340,10 +340,10 @@ class PokemonSummary_Scene _INTL("MOVES"), _INTL("RIBBONS")][page - 1] textpos = [ - [pagename, 26, 10, 0, base, shadow], - [@pokemon.name, 46, 56, 0, base, shadow], - [@pokemon.level.to_s, 46, 86, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Item"), 66, 312, 0, base, shadow] + [pagename, 26, 10, 0, base, shadow], + [@pokemon.name, 46, 56, 0, base, shadow], + [@pokemon.level.to_s, 46, 86, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Item"), 66, 312, 0, base, shadow] ] # Write the held item's name if @pokemon.hasItem? @@ -381,19 +381,19 @@ class PokemonSummary_Scene if @pokemon.shadowPokemon? shadowfract = @pokemon.heart_gauge.to_f / @pokemon.max_gauge_size imagepos = [ - ["Graphics/Pictures/Summary/overlay_shadow", 224, 240], - ["Graphics/Pictures/Summary/overlay_shadowbar", 242, 280, 0, 0, (shadowfract * 248).floor, -1] + ["Graphics/Pictures/Summary/overlay_shadow", 224, 240], + ["Graphics/Pictures/Summary/overlay_shadowbar", 242, 280, 0, 0, (shadowfract * 248).floor, -1] ] pbDrawImagePositions(overlay, imagepos) end # Write various bits of text textpos = [ - [_INTL("Dex No."), 238, 74, 0, base, shadow], - [_INTL("Species"), 238, 106, 0, base, shadow], - [@pokemon.speciesName, 435, 106, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Type"), 238, 138, 0, base, shadow], - [_INTL("OT"), 238, 170, 0, base, shadow], - [_INTL("ID No."), 238, 202, 0, base, shadow] + [_INTL("Dex No."), 238, 74, 0, base, shadow], + [_INTL("Species"), 238, 106, 0, base, shadow], + [@pokemon.speciesName, 435, 106, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Type"), 238, 138, 0, base, shadow], + [_INTL("OT"), 238, 170, 0, base, shadow], + [_INTL("ID No."), 238, 202, 0, base, shadow] ] # Write the Regional/National Dex number dexnum = 0 @@ -459,16 +459,15 @@ class PokemonSummary_Scene @pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (@pokemon.types.length == 1) ? 402 : 370 + 66 * i + type_x = (@pokemon.types.length == 1) ? 402 : 370 + (66 * i) overlay.blt(type_x, 146, @typebitmap.bitmap, type_rect) end # Draw Exp bar if @pokemon.level < GameData::GrowthRate.max_level w = @pokemon.exp_fraction * 128 w = ((w / 2).round) * 2 - pbDrawImagePositions(overlay, [ - ["Graphics/Pictures/Summary/overlay_exp", 362, 372, 0, 0, w, 6] - ]) + pbDrawImagePositions(overlay, + [["Graphics/Pictures/Summary/overlay_exp", 362, 372, 0, 0, w, 6]]) end end @@ -488,9 +487,9 @@ class PokemonSummary_Scene pbDrawImagePositions(overlay, imagepos) # Write various bits of text textpos = [ - [_INTL("TRAINER MEMO"), 26, 10, 0, base, shadow], - [@pokemon.name, 46, 56, 0, base, shadow], - [_INTL("Item"), 66, 312, 0, base, shadow] + [_INTL("TRAINER MEMO"), 26, 10, 0, base, shadow], + [@pokemon.name, 46, 56, 0, base, shadow], + [_INTL("Item"), 66, 312, 0, base, shadow] ] # Write the held item's name if @pokemon.hasItem? @@ -639,19 +638,19 @@ class PokemonSummary_Scene end # Write various bits of text textpos = [ - [_INTL("HP"), 292, 70, 2, base, statshadows[:HP]], - [sprintf("%d/%d", @pokemon.hp, @pokemon.totalhp), 462, 70, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Attack"), 248, 114, 0, base, statshadows[:ATTACK]], - [sprintf("%d", @pokemon.attack), 456, 114, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Defense"), 248, 146, 0, base, statshadows[:DEFENSE]], - [sprintf("%d", @pokemon.defense), 456, 146, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Sp. Atk"), 248, 178, 0, base, statshadows[:SPECIAL_ATTACK]], - [sprintf("%d", @pokemon.spatk), 456, 178, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Sp. Def"), 248, 210, 0, base, statshadows[:SPECIAL_DEFENSE]], - [sprintf("%d", @pokemon.spdef), 456, 210, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Speed"), 248, 242, 0, base, statshadows[:SPEED]], - [sprintf("%d", @pokemon.speed), 456, 242, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [_INTL("Ability"), 224, 278, 0, base, shadow] + [_INTL("HP"), 292, 70, 2, base, statshadows[:HP]], + [sprintf("%d/%d", @pokemon.hp, @pokemon.totalhp), 462, 70, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Attack"), 248, 114, 0, base, statshadows[:ATTACK]], + [sprintf("%d", @pokemon.attack), 456, 114, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Defense"), 248, 146, 0, base, statshadows[:DEFENSE]], + [sprintf("%d", @pokemon.defense), 456, 146, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Sp. Atk"), 248, 178, 0, base, statshadows[:SPECIAL_ATTACK]], + [sprintf("%d", @pokemon.spatk), 456, 178, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Sp. Def"), 248, 210, 0, base, statshadows[:SPECIAL_DEFENSE]], + [sprintf("%d", @pokemon.spdef), 456, 210, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Speed"), 248, 242, 0, base, statshadows[:SPEED]], + [sprintf("%d", @pokemon.speed), 456, 242, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [_INTL("Ability"), 224, 278, 0, base, shadow] ] # Draw ability name and description ability = @pokemon.ability @@ -663,14 +662,14 @@ class PokemonSummary_Scene pbDrawTextPositions(overlay, textpos) # Draw HP bar if @pokemon.hp > 0 - w = @pokemon.hp * 96 * 1.0 / @pokemon.totalhp + w = @pokemon.hp * 96 / @pokemon.totalhp.to_f w = 1 if w < 1 w = ((w / 2).round) * 2 hpzone = 0 hpzone = 1 if @pokemon.hp <= (@pokemon.totalhp / 2).floor hpzone = 2 if @pokemon.hp <= (@pokemon.totalhp / 4).floor imagepos = [ - ["Graphics/Pictures/Summary/overlay_hp", 360, 110, 0, hpzone * 6, w, 6] + ["Graphics/Pictures/Summary/overlay_hp", 360, 110, 0, hpzone * 6, w, 6] ] pbDrawImagePositions(overlay, imagepos) end @@ -747,10 +746,10 @@ class PokemonSummary_Scene end # Write various bits of text textpos = [ - [_INTL("MOVES"), 26, 10, 0, base, shadow], - [_INTL("CATEGORY"), 20, 116, 0, base, shadow], - [_INTL("POWER"), 20, 148, 0, base, shadow], - [_INTL("ACCURACY"), 20, 180, 0, base, shadow] + [_INTL("MOVES"), 26, 10, 0, base, shadow], + [_INTL("CATEGORY"), 20, 116, 0, base, shadow], + [_INTL("POWER"), 20, 148, 0, base, shadow], + [_INTL("ACCURACY"), 20, 180, 0, base, shadow] ] imagepos = [] # Write move names, types and PP amounts for each known move @@ -792,7 +791,7 @@ class PokemonSummary_Scene @pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (@pokemon.types.length == 1) ? 130 : 96 + 70 * i + type_x = (@pokemon.types.length == 1) ? 130 : 96 + (70 * i) overlay.blt(type_x, 78, @typebitmap.bitmap, type_rect) end end @@ -835,20 +834,20 @@ class PokemonSummary_Scene @sprites["downarrow"].visible = false # Write various bits of text textpos = [ - [_INTL("No. of Ribbons:"), 234, 326, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)], - [@pokemon.numRibbons.to_s, 450, 326, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)] + [_INTL("No. of Ribbons:"), 234, 326, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)], + [@pokemon.numRibbons.to_s, 450, 326, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)] ] # Draw all text pbDrawTextPositions(overlay, textpos) # Show all ribbons imagepos = [] coord = 0 - for i in @ribbonOffset * 4...@ribbonOffset * 4 + 12 + for i in @ribbonOffset * 4...(@ribbonOffset * 4) + 12 break if !@pokemon.ribbons[i] ribbon_data = GameData::Ribbon.get(@pokemon.ribbons[i]) ribn = ribbon_data.icon_position imagepos.push(["Graphics/Pictures/ribbons", - 230 + 68 * (coord % 4), 78 + 68 * (coord / 4).floor, + 230 + (68 * (coord % 4)), 78 + (68 * (coord / 4).floor), 64 * (ribn % 8), 64 * (ribn / 8).floor, 64, 64]) coord += 1 end @@ -870,12 +869,12 @@ class PokemonSummary_Scene desc = ribbonid ? GameData::Ribbon.get(ribbonid).description : "" # Draw the description box imagepos = [ - ["Graphics/Pictures/Summary/overlay_ribbon", 8, 280] + ["Graphics/Pictures/Summary/overlay_ribbon", 8, 280] ] pbDrawImagePositions(overlay, imagepos) # Draw name of selected ribbon textpos = [ - [name, 18, 280, 0, nameBase, nameShadow] + [name, 18, 280, 0, nameBase, nameShadow] ] pbDrawTextPositions(overlay, textpos) # Draw selected ribbon's description @@ -939,21 +938,19 @@ class PokemonSummary_Scene break if !switching @sprites["movepresel"].visible = false switching = false - else - if !@pokemon.shadowPokemon? - if !switching - @sprites["movepresel"].index = selmove - @sprites["movepresel"].visible = true - oldselmove = selmove - switching = true - else - tmpmove = @pokemon.moves[oldselmove] - @pokemon.moves[oldselmove] = @pokemon.moves[selmove] - @pokemon.moves[selmove] = tmpmove - @sprites["movepresel"].visible = false - switching = false - drawSelectedMove(nil, @pokemon.moves[selmove]) - end + elsif !@pokemon.shadowPokemon? + if !switching + @sprites["movepresel"].index = selmove + @sprites["movepresel"].visible = true + oldselmove = selmove + switching = true + else + tmpmove = @pokemon.moves[oldselmove] + @pokemon.moves[oldselmove] = @pokemon.moves[selmove] + @pokemon.moves[selmove] = tmpmove + @sprites["movepresel"].visible = false + switching = false + drawSelectedMove(nil, @pokemon.moves[selmove]) end end elsif Input.trigger?(Input::UP) @@ -1009,7 +1006,7 @@ class PokemonSummary_Scene if !switching if @pokemon.ribbons[selribbon] pbPlayDecisionSE - @sprites["ribbonpresel"].index = selribbon - @ribbonOffset * 4 + @sprites["ribbonpresel"].index = selribbon - (@ribbonOffset * 4) oldselribbon = selribbon @sprites["ribbonpresel"].visible = true switching = true @@ -1056,8 +1053,8 @@ class PokemonSummary_Scene @ribbonOffset = (selribbon / 4).floor - 2 if selribbon >= (@ribbonOffset + 3) * 4 @ribbonOffset = 0 if @ribbonOffset < 0 @ribbonOffset = numRows - 3 if @ribbonOffset > numRows - 3 - @sprites["ribbonsel"].index = selribbon - @ribbonOffset * 4 - @sprites["ribbonpresel"].index = oldselribbon - @ribbonOffset * 4 + @sprites["ribbonsel"].index = selribbon - (@ribbonOffset * 4) + @sprites["ribbonpresel"].index = oldselribbon - (@ribbonOffset * 4) drawSelectedRibbon(@pokemon.ribbons[selribbon]) end end @@ -1083,20 +1080,20 @@ class PokemonSummary_Scene (@markingbitmap.bitmap.width / MARK_WIDTH).times do |i| markrect.x = i * MARK_WIDTH markrect.y = [(markings[i] || 0), mark_variants - 1].min * MARK_HEIGHT - @sprites["markingoverlay"].bitmap.blt(300 + 58 * (i % 3), 154 + 50 * (i / 3), + @sprites["markingoverlay"].bitmap.blt(300 + (58 * (i % 3)), 154 + (50 * (i / 3)), @markingbitmap.bitmap, markrect) end textpos = [ - [_INTL("Mark {1}", pokemon.name), 366, 90, 2, base, shadow], - [_INTL("OK"), 366, 242, 2, base, shadow], - [_INTL("Cancel"), 366, 292, 2, base, shadow] + [_INTL("Mark {1}", pokemon.name), 366, 90, 2, base, shadow], + [_INTL("OK"), 366, 242, 2, base, shadow], + [_INTL("Cancel"), 366, 292, 2, base, shadow] ] pbDrawTextPositions(@sprites["markingoverlay"].bitmap, textpos) redraw = false end # Reposition the cursor - @sprites["markingsel"].x = 284 + 58 * (index % 3) - @sprites["markingsel"].y = 144 + 50 * (index / 3) + @sprites["markingsel"].x = 284 + (58 * (index % 3)) + @sprites["markingsel"].y = 144 + (50 * (index / 3)) case index when 6 # OK @sprites["markingsel"].x = 284 diff --git a/Data/Scripts/016_UI/007_UI_Bag.rb b/Data/Scripts/016_UI/007_UI_Bag.rb index 63c05ebdc..26acab70c 100644 --- a/Data/Scripts/016_UI/007_UI_Bag.rb +++ b/Data/Scripts/016_UI/007_UI_Bag.rb @@ -47,9 +47,9 @@ class Window_PokemonBag < Window_DrawableCommand item > self.top_item + self.page_item_max return Rect.new(0, 0, 0, 0) else - cursor_width = (self.width - self.borderX - (@column_max - 1) * @column_spacing) / @column_max + cursor_width = (self.width - self.borderX - ((@column_max - 1) * @column_spacing)) / @column_max x = item % @column_max * (cursor_width + @column_spacing) - y = item / @column_max * @row_height - @virtualOy + y = (item / @column_max * @row_height) - @virtualOy return Rect.new(x, y, cursor_width, @row_height) end end @@ -76,17 +76,17 @@ class Window_PokemonBag < Window_DrawableCommand shadowColor = Color.new(248, 144, 144) end textpos.push( - [@adapter.getDisplayName(item), rect.x, rect.y - 2, false, baseColor, shadowColor] + [@adapter.getDisplayName(item), rect.x, rect.y - 2, false, baseColor, shadowColor] ) if GameData::Item.get(item).is_important? if @bag.registered?(item) - pbDrawImagePositions(self.contents, [ - ["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24] - ]) + pbDrawImagePositions( + self.contents, + [["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]]) elsif pbCanRegisterItem?(item) - pbDrawImagePositions(self.contents, [ - ["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24] - ]) + pbDrawImagePositions( + self.contents, + [["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]]) end else qty = (@filterlist) ? thispocket[@filterlist[@pocket][index]][1] : thispocket[index][1] @@ -190,7 +190,7 @@ class PokemonBag_Scene @sprites["rightarrow"].y = 76 @sprites["rightarrow"].visible = (!@choosing || numfilledpockets > 1) @sprites["rightarrow"].play - @sprites["itemlist"] = Window_PokemonBag.new(@bag, @filterlist, lastpocket, 168, -8, 314, 40 + 32 + ITEMSVISIBLE * 32) + @sprites["itemlist"] = Window_PokemonBag.new(@bag, @filterlist, lastpocket, 168, -8, 314, 40 + 32 + (ITEMSVISIBLE * 32)) @sprites["itemlist"].viewport = @viewport @sprites["itemlist"].pocket = lastpocket @sprites["itemlist"].index = @bag.last_viewed_index(lastpocket) @@ -270,13 +270,13 @@ class PokemonBag_Scene for i in 1...@bag.pockets.length if @filterlist[i].length == 0 @sprites["pocketicon"].bitmap.blt( - 6 + (i - 1) * 22, 6, @pocketbitmap.bitmap, Rect.new((i - 1) * 20, 28, 20, 20) + 6 + ((i - 1) * 22), 6, @pocketbitmap.bitmap, Rect.new((i - 1) * 20, 28, 20, 20) ) end end end @sprites["pocketicon"].bitmap.blt( - 2 + (@sprites["itemlist"].pocket - 1) * 22, 2, @pocketbitmap.bitmap, + 2 + ((@sprites["itemlist"].pocket - 1) * 22), 2, @pocketbitmap.bitmap, Rect.new((@sprites["itemlist"].pocket - 1) * 28, 0, 28, 28) ) # Refresh the item window @@ -290,9 +290,9 @@ class PokemonBag_Scene overlay = @sprites["overlay"].bitmap overlay.clear # Draw the pocket name - pbDrawTextPositions(overlay, [ - [PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR] - ]) + pbDrawTextPositions( + overlay, + [[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]]) # Draw slider arrows showslider = false if itemlist.top_row > 0 @@ -314,8 +314,8 @@ class PokemonBag_Scene overlay.blt(470, y, @sliderbitmap.bitmap, Rect.new(36, 0, 36, 4)) i = 0 while i * 16 < boxheight - 4 - 18 - height = [boxheight - 4 - 18 - i * 16, 16].min - overlay.blt(470, y + 4 + i * 16, @sliderbitmap.bitmap, Rect.new(36, 4, 36, height)) + height = [boxheight - 4 - 18 - (i * 16), 16].min + overlay.blt(470, y + 4 + (i * 16), @sliderbitmap.bitmap, Rect.new(36, 4, 36, height)) i += 1 end overlay.blt(470, y + boxheight - 18, @sliderbitmap.bitmap, Rect.new(36, 20, 36, 18)) @@ -377,8 +377,7 @@ class PokemonBag_Scene pbPlayCancelSE pbRefresh end - else - # Change pockets + else # Change pockets if Input.trigger?(Input::LEFT) newpocket = itemwindow.pocket loop do @@ -386,8 +385,8 @@ class PokemonBag_Scene break if !@choosing || newpocket == itemwindow.pocket if @filterlist break if @filterlist[newpocket].length > 0 - else - break if @bag.pockets[newpocket].length > 0 + elsif @bag.pockets[newpocket].length > 0 + break end end if itemwindow.pocket != newpocket @@ -404,8 +403,8 @@ class PokemonBag_Scene break if !@choosing || newpocket == itemwindow.pocket if @filterlist break if @filterlist[newpocket].length > 0 - else - break if @bag.pockets[newpocket].length > 0 + elsif @bag.pockets[newpocket].length > 0 + break end end if itemwindow.pocket != newpocket @@ -539,11 +538,10 @@ class PokemonBagScreen elsif cmdDebug >= 0 && command == cmdDebug # Debug command = 0 loop do - command = @scene.pbShowCommands(_INTL("Do what with {1}?", itemname), [ - _INTL("Change quantity"), - _INTL("Make Mystery Gift"), - _INTL("Cancel") - ], command) + command = @scene.pbShowCommands(_INTL("Do what with {1}?", itemname), + [_INTL("Change quantity"), + _INTL("Make Mystery Gift"), + _INTL("Cancel")], command) case command ### Cancel ### when -1, 2 diff --git a/Data/Scripts/016_UI/008_UI_Pokegear.rb b/Data/Scripts/016_UI/008_UI_Pokegear.rb index 65493bf64..49f9cd905 100644 --- a/Data/Scripts/016_UI/008_UI_Pokegear.rb +++ b/Data/Scripts/016_UI/008_UI_Pokegear.rb @@ -42,11 +42,11 @@ class PokegearButton < SpriteWrapper rect.y = @button.height / 2 if @selected self.bitmap.blt(0, 0, @button.bitmap, rect) textpos = [ - [@name, self.bitmap.width / 2, 4, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)] + [@name, self.bitmap.width / 2, 4, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)] ] pbDrawTextPositions(self.bitmap, textpos) imagepos = [ - [sprintf("Graphics/Pictures/Pokegear/icon_" + @image), 18, 10] + [sprintf("Graphics/Pictures/Pokegear/icon_" + @image), 18, 10] ] pbDrawImagePositions(self.bitmap, imagepos) end diff --git a/Data/Scripts/016_UI/009_UI_RegionMap.rb b/Data/Scripts/016_UI/009_UI_RegionMap.rb index 235822468..6405ca659 100644 --- a/Data/Scripts/016_UI/009_UI_RegionMap.rb +++ b/Data/Scripts/016_UI/009_UI_RegionMap.rb @@ -116,9 +116,9 @@ class PokemonRegionMap_Scene @sprites["map2"].x = @sprites["map"].x @sprites["map2"].y = @sprites["map"].y end - pbDrawImagePositions(@sprites["map2"].bitmap, [ - ["Graphics/Pictures/#{graphic[4]}", graphic[2] * SQUARE_WIDTH, graphic[3] * SQUARE_HEIGHT] - ]) + pbDrawImagePositions( + @sprites["map2"].bitmap, + [["Graphics/Pictures/#{graphic[4]}", graphic[2] * SQUARE_WIDTH, graphic[3] * SQUARE_HEIGHT]]) end @sprites["mapbottom"] = MapBottomSprite.new(@viewport) @sprites["mapbottom"].mapname = pbGetMessage(MessageTypes::RegionNames, mapindex) @@ -163,11 +163,11 @@ class PokemonRegionMap_Scene end def point_x_to_screen_x(x) - return -SQUARE_WIDTH / 2 + (x * SQUARE_WIDTH) + (Graphics.width - @sprites["map"].bitmap.width) / 2 + return (-SQUARE_WIDTH / 2) + (x * SQUARE_WIDTH) + ((Graphics.width - @sprites["map"].bitmap.width) / 2) end def point_y_to_screen_y(y) - return -SQUARE_HEIGHT / 2 + (y * SQUARE_HEIGHT) + (Graphics.height - @sprites["map"].bitmap.height) / 2 + return (-SQUARE_HEIGHT / 2) + (y * SQUARE_HEIGHT) + ((Graphics.height - @sprites["map"].bitmap.height) / 2) end def location_shown?(point) @@ -248,9 +248,9 @@ class PokemonRegionMap_Scene return if @fly_map || !Settings::CAN_FLY_FROM_TOWN_MAP || !pbCanFly? @sprites["help"].bitmap.clear text = (@mode == 0) ? _INTL("ACTION: Fly") : _INTL("ACTION: Cancel Fly") - pbDrawTextPositions(@sprites["help"].bitmap, [ - [text, Graphics.width - 16, -8, 1, Color.new(248, 248, 248), Color.new(0, 0, 0)] - ]) + pbDrawTextPositions( + @sprites["help"].bitmap, + [[text, Graphics.width - 16, -8, 1, Color.new(248, 248, 248), Color.new(0, 0, 0)]]) @sprites.each do |key, sprite| next if !key.include?("point") sprite.visible = (@mode == 1) diff --git a/Data/Scripts/016_UI/010_UI_Phone.rb b/Data/Scripts/016_UI/010_UI_Phone.rb index de4611980..553a0ccca 100644 --- a/Data/Scripts/016_UI/010_UI_Phone.rb +++ b/Data/Scripts/016_UI/010_UI_Phone.rb @@ -64,8 +64,8 @@ class PokemonPhoneScene @sprites["icon"].setBitmap(filename) charwidth = @sprites["icon"].bitmap.width charheight = @sprites["icon"].bitmap.height - @sprites["icon"].x = 86 - charwidth / 8 - @sprites["icon"].y = 134 - charheight / 8 + @sprites["icon"].x = 86 - (charwidth / 8) + @sprites["icon"].y = 134 - (charheight / 8) @sprites["icon"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4) for trainer in @trainers if trainer.length == 4 @@ -78,7 +78,7 @@ class PokemonPhoneScene end @sprites["list"].commands = commands for i in 0...@sprites["list"].page_item_max - @sprites["rematch[#{i}]"] = IconSprite.new(468, 62 + i * 32, @viewport) + @sprites["rematch[#{i}]"] = IconSprite.new(468, 62 + (i * 32), @viewport) j = i + @sprites["list"].top_item next if j >= commands.length trainer = @trainers[j] @@ -115,8 +115,8 @@ class PokemonPhoneScene @sprites["icon"].setBitmap(filename) charwidth = @sprites["icon"].bitmap.width charheight = @sprites["icon"].bitmap.height - @sprites["icon"].x = 86 - charwidth / 8 - @sprites["icon"].y = 134 - charheight / 8 + @sprites["icon"].x = 86 - (charwidth / 8) + @sprites["icon"].y = 134 - (charheight / 8) @sprites["icon"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4) mapname = (trainer[2]) ? pbGetMapNameFromId(trainer[2]) : "" @sprites["bottom"].text = "" + mapname diff --git a/Data/Scripts/016_UI/011_UI_Jukebox.rb b/Data/Scripts/016_UI/011_UI_Jukebox.rb index 9ad789ad9..4d9202f83 100644 --- a/Data/Scripts/016_UI/011_UI_Jukebox.rb +++ b/Data/Scripts/016_UI/011_UI_Jukebox.rb @@ -14,7 +14,7 @@ class PokemonJukebox_Scene @sprites["background"] = IconSprite.new(0, 0, @viewport) @sprites["background"].setBitmap("Graphics/Pictures/jukeboxbg") @sprites["header"] = Window_UnformattedTextPokemon.newWithSize( - _INTL("Jukebox"), 2, -18, 128, 64, @viewport + _INTL("Jukebox"), 2, -18, 128, 64, @viewport ) @sprites["header"].baseColor = Color.new(248, 248, 248) @sprites["header"].shadowColor = Color.new(0, 0, 0) diff --git a/Data/Scripts/016_UI/012_UI_TrainerCard.rb b/Data/Scripts/016_UI/012_UI_TrainerCard.rb index e63a758f6..8f4d83a94 100644 --- a/Data/Scripts/016_UI/012_UI_TrainerCard.rb +++ b/Data/Scripts/016_UI/012_UI_TrainerCard.rb @@ -49,25 +49,25 @@ class PokemonTrainerCard_Scene $PokemonGlobal.startTime.day, $PokemonGlobal.startTime.year) textPositions = [ - [_INTL("Name"), 34, 58, 0, baseColor, shadowColor], - [$player.name, 302, 58, 1, baseColor, shadowColor], - [_INTL("ID No."), 332, 58, 0, baseColor, shadowColor], - [sprintf("%05d", $player.public_ID), 468, 58, 1, baseColor, shadowColor], - [_INTL("Money"), 34, 106, 0, baseColor, shadowColor], - [_INTL("${1}", $player.money.to_s_formatted), 302, 106, 1, baseColor, shadowColor], - [_INTL("Pokédex"), 34, 154, 0, baseColor, shadowColor], - [sprintf("%d/%d", $player.pokedex.owned_count, $player.pokedex.seen_count), 302, 154, 1, baseColor, shadowColor], - [_INTL("Time"), 34, 202, 0, baseColor, shadowColor], - [time, 302, 202, 1, baseColor, shadowColor], - [_INTL("Started"), 34, 250, 0, baseColor, shadowColor], - [starttime, 302, 250, 1, baseColor, shadowColor] + [_INTL("Name"), 34, 58, 0, baseColor, shadowColor], + [$player.name, 302, 58, 1, baseColor, shadowColor], + [_INTL("ID No."), 332, 58, 0, baseColor, shadowColor], + [sprintf("%05d", $player.public_ID), 468, 58, 1, baseColor, shadowColor], + [_INTL("Money"), 34, 106, 0, baseColor, shadowColor], + [_INTL("${1}", $player.money.to_s_formatted), 302, 106, 1, baseColor, shadowColor], + [_INTL("Pokédex"), 34, 154, 0, baseColor, shadowColor], + [sprintf("%d/%d", $player.pokedex.owned_count, $player.pokedex.seen_count), 302, 154, 1, baseColor, shadowColor], + [_INTL("Time"), 34, 202, 0, baseColor, shadowColor], + [time, 302, 202, 1, baseColor, shadowColor], + [_INTL("Started"), 34, 250, 0, baseColor, shadowColor], + [starttime, 302, 250, 1, baseColor, shadowColor] ] pbDrawTextPositions(overlay, textPositions) x = 72 region = pbGetCurrentRegion(0) # Get the current region imagePositions = [] for i in 0...8 - if $player.badges[i + region * 8] + if $player.badges[i + (region * 8)] imagePositions.push(["Graphics/Pictures/Trainer Card/icon_badges", x, 310, i * 32, region * 32, 32, 32]) end x += 48 diff --git a/Data/Scripts/016_UI/013_UI_Load.rb b/Data/Scripts/016_UI/013_UI_Load.rb index 7dbf71fdd..a20140ec7 100644 --- a/Data/Scripts/016_UI/013_UI_Load.rb +++ b/Data/Scripts/016_UI/013_UI_Load.rb @@ -58,7 +58,7 @@ class PokemonLoadPanel < SpriteWrapper if @isContinue self.bitmap.blt(0, 0, @bgbitmap.bitmap, Rect.new(0, (@selected) ? 111 * 2 : 0, @bgbitmap.width, 111 * 2)) else - self.bitmap.blt(0, 0, @bgbitmap.bitmap, Rect.new(0, 111 * 2 * 2 + ((@selected) ? 23 * 2 : 0), @bgbitmap.width, 23 * 2)) + self.bitmap.blt(0, 0, @bgbitmap.bitmap, Rect.new(0, (111 * 2 * 2) + ((@selected) ? 23 * 2 : 0), @bgbitmap.width, 23 * 2)) end textpos = [] if @isContinue @@ -140,7 +140,7 @@ class PokemonLoad_Scene @sprites["panel#{oldi}"].pbRefresh @sprites["panel#{newi}"].selected = true @sprites["panel#{newi}"].pbRefresh - while @sprites["panel#{newi}"].y > Graphics.height - 40 * 2 + while @sprites["panel#{newi}"].y > Graphics.height - (40 * 2) for i in 0...@commands.length @sprites["panel#{i}"].y -= 24 * 2 end @@ -171,15 +171,15 @@ class PokemonLoad_Scene @sprites["player"] = TrainerWalkingCharSprite.new(filename, @viewport) charwidth = @sprites["player"].bitmap.width charheight = @sprites["player"].bitmap.height - @sprites["player"].x = 56 * 2 - charwidth / 8 - @sprites["player"].y = 56 * 2 - charheight / 8 + @sprites["player"].x = (56 * 2) - (charwidth / 8) + @sprites["player"].y = (56 * 2) - (charheight / 8) @sprites["player"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4) end for i in 0...trainer.party.length @sprites["party#{i}"] = PokemonIconSprite.new(trainer.party[i], @viewport) @sprites["party#{i}"].setOffset(PictureOrigin::Center) - @sprites["party#{i}"].x = (167 + 33 * (i % 2)) * 2 - @sprites["party#{i}"].y = (56 + 25 * (i / 2)) * 2 + @sprites["party#{i}"].x = (167 + (33 * (i % 2))) * 2 + @sprites["party#{i}"].y = (56 + (25 * (i / 2))) * 2 @sprites["party#{i}"].z = 99999 end end diff --git a/Data/Scripts/016_UI/015_UI_Options.rb b/Data/Scripts/016_UI/015_UI_Options.rb index 359cd3e7a..d3c813b44 100644 --- a/Data/Scripts/016_UI/015_UI_Options.rb +++ b/Data/Scripts/016_UI/015_UI_Options.rb @@ -207,7 +207,8 @@ class Window_PokemonOption < Window_DrawableCommand pbDrawShadowText(self.contents, rect.x, rect.y, optionwidth, rect.height, optionname, @nameBaseColor, @nameShadowColor) return if index == @options.length - if @options[index].is_a?(EnumOption) + case @options[index] + when EnumOption if @options[index].values.length > 1 totalwidth = 0 for value in @options[index].values @@ -229,21 +230,21 @@ class Window_PokemonOption < Window_DrawableCommand pbDrawShadowText(self.contents, rect.x + optionwidth, rect.y, optionwidth, rect.height, optionname, self.baseColor, self.shadowColor) end - elsif @options[index].is_a?(NumberOption) + when NumberOption value = _INTL("Type {1}/{2}", @options[index].optstart + self[index], @options[index].optend - @options[index].optstart + 1) xpos = optionwidth + rect.x pbDrawShadowText(self.contents, xpos, rect.y, optionwidth, rect.height, value, @selBaseColor, @selShadowColor) - elsif @options[index].is_a?(SliderOption) + when SliderOption value = sprintf(" %d", @options[index].optend) sliderlength = optionwidth - self.contents.text_size(value).width xpos = optionwidth + rect.x - self.contents.fill_rect(xpos, rect.y - 2 + rect.height / 2, + self.contents.fill_rect(xpos, rect.y - 2 + (rect.height / 2), optionwidth - self.contents.text_size(value).width, 4, self.baseColor) self.contents.fill_rect( - xpos + (sliderlength - 8) * (@options[index].optstart + self[index]) / @options[index].optend, - rect.y - 8 + rect.height / 2, + xpos + ((sliderlength - 8) * (@options[index].optstart + self[index]) / @options[index].optend), + rect.y - 8 + (rect.height / 2), 8, 16, @selBaseColor ) value = sprintf("%d", @options[index].optstart + self[index]) @@ -301,80 +302,80 @@ class PokemonOption_Scene # setter and a getter for that option. To delete an option, comment it out # or delete it. The game's options may be placed in any order. @PokemonOptions = [ - SliderOption.new(_INTL("Music Volume"), 0, 100, 5, - proc { $PokemonSystem.bgmvolume }, - proc { |value| - if $PokemonSystem.bgmvolume != value - $PokemonSystem.bgmvolume = value - if $game_system.playing_bgm != nil && !inloadscreen - playingBGM = $game_system.getPlayingBGM - $game_system.bgm_pause - $game_system.bgm_resume(playingBGM) - end - end - } - ), - SliderOption.new(_INTL("SE Volume"), 0, 100, 5, - proc { $PokemonSystem.sevolume }, - proc { |value| - if $PokemonSystem.sevolume != value - $PokemonSystem.sevolume = value - if $game_system.playing_bgs != nil - $game_system.playing_bgs.volume = value - playingBGS = $game_system.getPlayingBGS - $game_system.bgs_pause - $game_system.bgs_resume(playingBGS) - end - pbPlayCursorSE - end - } - ), - EnumOption.new(_INTL("Text Speed"), [_INTL("Slow"), _INTL("Normal"), _INTL("Fast")], - proc { $PokemonSystem.textspeed }, - proc { |value| - $PokemonSystem.textspeed = value - MessageConfig.pbSetTextSpeed(MessageConfig.pbSettingToTextSpeed(value)) - } - ), - EnumOption.new(_INTL("Battle Effects"), [_INTL("On"), _INTL("Off")], - proc { $PokemonSystem.battlescene }, - proc { |value| $PokemonSystem.battlescene = value } - ), - EnumOption.new(_INTL("Battle Style"), [_INTL("Switch"), _INTL("Set")], - proc { $PokemonSystem.battlestyle }, - proc { |value| $PokemonSystem.battlestyle = value } - ), - EnumOption.new(_INTL("Default Movement"), [_INTL("Walking"), _INTL("Running")], - proc { $PokemonSystem.runstyle }, - proc { |value| $PokemonSystem.runstyle = value } - ), - NumberOption.new(_INTL("Speech Frame"), 1, Settings::SPEECH_WINDOWSKINS.length, - proc { $PokemonSystem.textskin }, - proc { |value| - $PokemonSystem.textskin = value - MessageConfig.pbSetSpeechFrame("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[value]) - } - ), - NumberOption.new(_INTL("Menu Frame"), 1, Settings::MENU_WINDOWSKINS.length, - proc { $PokemonSystem.frame }, - proc { |value| - $PokemonSystem.frame = value - MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[value]) - } - ), - EnumOption.new(_INTL("Text Entry"), [_INTL("Cursor"), _INTL("Keyboard")], - proc { $PokemonSystem.textinput }, - proc { |value| $PokemonSystem.textinput = value } - ), - EnumOption.new(_INTL("Screen Size"), [_INTL("S"), _INTL("M"), _INTL("L"), _INTL("XL"), _INTL("Full")], - proc { [$PokemonSystem.screensize, 4].min }, - proc { |value| - if $PokemonSystem.screensize != value - $PokemonSystem.screensize = value - pbSetResizeFactor($PokemonSystem.screensize) - end - } - ) + SliderOption.new(_INTL("Music Volume"), 0, 100, 5, + proc { $PokemonSystem.bgmvolume }, + proc { |value| + if $PokemonSystem.bgmvolume != value + $PokemonSystem.bgmvolume = value + if $game_system.playing_bgm != nil && !inloadscreen + playingBGM = $game_system.getPlayingBGM + $game_system.bgm_pause + $game_system.bgm_resume(playingBGM) + end + end + } + ), + SliderOption.new(_INTL("SE Volume"), 0, 100, 5, + proc { $PokemonSystem.sevolume }, + proc { |value| + if $PokemonSystem.sevolume != value + $PokemonSystem.sevolume = value + if $game_system.playing_bgs != nil + $game_system.playing_bgs.volume = value + playingBGS = $game_system.getPlayingBGS + $game_system.bgs_pause + $game_system.bgs_resume(playingBGS) + end + pbPlayCursorSE + end + } + ), + EnumOption.new(_INTL("Text Speed"), [_INTL("Slow"), _INTL("Normal"), _INTL("Fast")], + proc { $PokemonSystem.textspeed }, + proc { |value| + $PokemonSystem.textspeed = value + MessageConfig.pbSetTextSpeed(MessageConfig.pbSettingToTextSpeed(value)) + } + ), + EnumOption.new(_INTL("Battle Effects"), [_INTL("On"), _INTL("Off")], + proc { $PokemonSystem.battlescene }, + proc { |value| $PokemonSystem.battlescene = value } + ), + EnumOption.new(_INTL("Battle Style"), [_INTL("Switch"), _INTL("Set")], + proc { $PokemonSystem.battlestyle }, + proc { |value| $PokemonSystem.battlestyle = value } + ), + EnumOption.new(_INTL("Default Movement"), [_INTL("Walking"), _INTL("Running")], + proc { $PokemonSystem.runstyle }, + proc { |value| $PokemonSystem.runstyle = value } + ), + NumberOption.new(_INTL("Speech Frame"), 1, Settings::SPEECH_WINDOWSKINS.length, + proc { $PokemonSystem.textskin }, + proc { |value| + $PokemonSystem.textskin = value + MessageConfig.pbSetSpeechFrame("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[value]) + } + ), + NumberOption.new(_INTL("Menu Frame"), 1, Settings::MENU_WINDOWSKINS.length, + proc { $PokemonSystem.frame }, + proc { |value| + $PokemonSystem.frame = value + MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[value]) + } + ), + EnumOption.new(_INTL("Text Entry"), [_INTL("Cursor"), _INTL("Keyboard")], + proc { $PokemonSystem.textinput }, + proc { |value| $PokemonSystem.textinput = value } + ), + EnumOption.new(_INTL("Screen Size"), [_INTL("S"), _INTL("M"), _INTL("L"), _INTL("XL"), _INTL("Full")], + proc { [$PokemonSystem.screensize, 4].min }, + proc { |value| + if $PokemonSystem.screensize != value + $PokemonSystem.screensize = value + pbSetResizeFactor($PokemonSystem.screensize) + end + } + ) ] @PokemonOptions = pbAddOnOptions(@PokemonOptions) @sprites["option"] = Window_PokemonOption.new( diff --git a/Data/Scripts/016_UI/016_UI_ReadyMenu.rb b/Data/Scripts/016_UI/016_UI_ReadyMenu.rb index 178a31586..800a73f47 100644 --- a/Data/Scripts/016_UI/016_UI_ReadyMenu.rb +++ b/Data/Scripts/016_UI/016_UI_ReadyMenu.rb @@ -56,7 +56,7 @@ class ReadyMenuButton < SpriteWrapper def refresh sel = (@selected == @index && (@side == 0) == @command[2]) - self.y = (Graphics.height - @button.height / 2) / 2 - (@selected - @index) * (@button.height / 2 + 4) + self.y = ((Graphics.height - (@button.height / 2)) / 2) - ((@selected - @index) * ((@button.height / 2) + 4)) if @command[2] # Pokémon self.x = (sel) ? 0 : -16 @icon.x = self.x + 52 @@ -64,14 +64,14 @@ class ReadyMenuButton < SpriteWrapper else # Item self.x = (sel) ? Graphics.width - @button.width : Graphics.width + 16 - @button.width @icon.x = self.x + 32 - @icon.y = self.y + @button.height / 4 + @icon.y = self.y + (@button.height / 4) end self.bitmap.clear rect = Rect.new(0, (sel) ? @button.height / 2 : 0, @button.width, @button.height / 2) self.bitmap.blt(0, 0, @button.bitmap, rect) textx = (@command[2]) ? 164 : (GameData::Item.get(@command[0]).is_important?) ? 146 : 124 textpos = [ - [@command[1], textx, 16, 2, Color.new(248, 248, 248), Color.new(40, 40, 40), 1] + [@command[1], textx, 16, 2, Color.new(248, 248, 248), Color.new(40, 40, 40), 1] ] if !@command[2] if !GameData::Item.get(@command[0]).is_important? diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index 2350e26bd..dae4f82fe 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -19,11 +19,11 @@ class PokemonBoxIcon < IconSprite self.oy = self.src_rect.height / 2 # 32 self.x += self.src_rect.width / 2 # 32 self.y += self.src_rect.height / 2 # 32 - @release.tween(self, [ - [Interpolator::ZOOM_X, 0], - [Interpolator::ZOOM_Y, 0], - [Interpolator::OPACITY, 0] - ], 100) + @release.tween(self, + [[Interpolator::ZOOM_X, 0], + [Interpolator::ZOOM_Y, 0], + [Interpolator::OPACITY, 0]], + 100) @startRelease = true end @@ -95,7 +95,7 @@ class MosaicPokemonSprite < PokemonSprite @mosaicbitmap2.clear @mosaicbitmap.stretch_blt(Rect.new(0, 0, newWidth, newHeight), @oldbitmap, @oldbitmap.rect) @mosaicbitmap2.stretch_blt( - Rect.new(-@mosaic / 2 + 1, -@mosaic / 2 + 1, @mosaicbitmap2.width, @mosaicbitmap2.height), + Rect.new((-@mosaic / 2) + 1, (-@mosaic / 2) + 1, @mosaicbitmap2.width, @mosaicbitmap2.height), @mosaicbitmap, Rect.new(0, 0, newWidth, newHeight) ) self.bitmap = @mosaicbitmap2 @@ -244,12 +244,12 @@ class PokemonBoxArrow < SpriteWrapper if @grabbingState > 0 if @grabbingState <= 4 * Graphics.frame_rate / 20 @handsprite.changeBitmap((@quickswap) ? "grabq" : "grab") - self.y = @spriteY + 4.0 * @grabbingState * 20 / Graphics.frame_rate + self.y = @spriteY + (4.0 * @grabbingState * 20 / Graphics.frame_rate) @grabbingState += 1 elsif @grabbingState <= 8 * Graphics.frame_rate / 20 @holding = true @handsprite.changeBitmap((@quickswap) ? "fistq" : "fist") - self.y = @spriteY + 4 * (8 * Graphics.frame_rate / 20 - @grabbingState) * 20 / Graphics.frame_rate + self.y = @spriteY + (4 * ((8 * Graphics.frame_rate / 20) - @grabbingState) * 20 / Graphics.frame_rate) @grabbingState += 1 else @grabbingState = 0 @@ -257,13 +257,13 @@ class PokemonBoxArrow < SpriteWrapper elsif @placingState > 0 if @placingState <= 4 * Graphics.frame_rate / 20 @handsprite.changeBitmap((@quickswap) ? "fistq" : "fist") - self.y = @spriteY + 4.0 * @placingState * 20 / Graphics.frame_rate + self.y = @spriteY + (4.0 * @placingState * 20 / Graphics.frame_rate) @placingState += 1 elsif @placingState <= 8 * Graphics.frame_rate / 20 @holding = false @heldpkmn = nil @handsprite.changeBitmap((@quickswap) ? "grabq" : "grab") - self.y = @spriteY + 4 * (8 * Graphics.frame_rate / 20 - @placingState) * 20 / Graphics.frame_rate + self.y = @spriteY + (4 * ((8 * Graphics.frame_rate / 20) - @placingState) * 20 / Graphics.frame_rate) @placingState += 1 else @placingState = 0 @@ -417,7 +417,7 @@ class PokemonBoxSprite < SpriteWrapper for j in 0...PokemonBox::BOX_HEIGHT xval = self.x + 10 for k in 0...PokemonBox::BOX_WIDTH - sprite = @pokemonsprites[j * PokemonBox::BOX_WIDTH + k] + sprite = @pokemonsprites[(j * PokemonBox::BOX_WIDTH) + k] if sprite && !sprite.disposed? sprite.viewport = self.viewport sprite.x = xval @@ -529,14 +529,15 @@ class PokemonBoxPartySprite < SpriteWrapper def refresh @contents.blt(0, 0, @boxbitmap.bitmap, Rect.new(0, 0, 172, 352)) - pbDrawTextPositions(self.bitmap, [ - [_INTL("Back"), 86, 240, 2, Color.new(248, 248, 248), Color.new(80, 80, 80), 1] - ]) + pbDrawTextPositions( + self.bitmap, + [[_INTL("Back"), 86, 240, 2, Color.new(248, 248, 248), Color.new(80, 80, 80), 1]] + ) xvalues = [] # [18, 90, 18, 90, 18, 90] yvalues = [] # [2, 18, 66, 82, 130, 146] for i in 0...Settings::MAX_PARTY_SIZE - xvalues.push(18 + 72 * (i % 2)) - yvalues.push(2 + 16 * (i % 2) + 64 * (i / 2)) + xvalues.push(18 + (72 * (i % 2))) + yvalues.push(2 + (16 * (i % 2)) + (64 * (i / 2))) end @pokemonsprites.delete_if { |sprite| sprite && sprite.disposed? } @pokemonsprites.each { |sprite| sprite.refresh if sprite } @@ -705,8 +706,8 @@ class PokemonStorageScene arrow.x = 207 * 2 arrow.y = 139 * 2 else - arrow.x = (97 + 24 * (selection % PokemonBox::BOX_WIDTH)) * 2 - arrow.y = (8 + 24 * (selection / PokemonBox::BOX_WIDTH)) * 2 + arrow.x = (97 + (24 * (selection % PokemonBox::BOX_WIDTH))) * 2 + arrow.y = (8 + (24 * (selection / PokemonBox::BOX_WIDTH))) * 2 end end @@ -717,9 +718,9 @@ class PokemonStorageScene when -1 # Box name selection = -2 when -2 # Party - selection = PokemonBox::BOX_SIZE - 1 - PokemonBox::BOX_WIDTH * 2 / 3 # 25 + selection = PokemonBox::BOX_SIZE - 1 - (PokemonBox::BOX_WIDTH * 2 / 3) # 25 when -3 # Close Box - selection = PokemonBox::BOX_SIZE - PokemonBox::BOX_WIDTH / 3 # 28 + selection = PokemonBox::BOX_SIZE - (PokemonBox::BOX_WIDTH / 3) # 28 else selection -= PokemonBox::BOX_WIDTH selection = -1 if selection < 0 @@ -735,7 +736,7 @@ class PokemonStorageScene else selection += PokemonBox::BOX_WIDTH if selection >= PokemonBox::BOX_SIZE - if selection < PokemonBox::BOX_SIZE + PokemonBox::BOX_WIDTH / 2 + if selection < PokemonBox::BOX_SIZE + (PokemonBox::BOX_WIDTH / 2) selection = -2 # Party else selection = -3 # Close Box @@ -775,8 +776,8 @@ class PokemonStorageScene xvalues = [] # [200, 272, 200, 272, 200, 272, 236] yvalues = [] # [2, 18, 66, 82, 130, 146, 220] for i in 0...Settings::MAX_PARTY_SIZE - xvalues.push(200 + 72 * (i % 2)) - yvalues.push(2 + 16 * (i % 2) + 64 * (i / 2)) + xvalues.push(200 + (72 * (i % 2))) + yvalues.push(2 + (16 * (i % 2)) + (64 * (i / 2))) end xvalues.push(236) yvalues.push(220) @@ -1325,12 +1326,12 @@ class PokemonStorageScene (@markingbitmap.bitmap.width / MARK_WIDTH).times do |i| markrect.x = i * MARK_WIDTH markrect.y = [(markings[i] || 0), mark_variants - 1].min * MARK_HEIGHT - @sprites["markingoverlay"].bitmap.blt(336 + 58 * (i % 3), 106 + 50 * (i / 3), + @sprites["markingoverlay"].bitmap.blt(336 + (58 * (i % 3)), 106 + (50 * (i / 3)), @markingbitmap.bitmap, markrect) end textpos = [ - [_INTL("OK"), 402, 208, 2, base, shadow, 1], - [_INTL("Cancel"), 402, 272, 2, base, shadow, 1] + [_INTL("OK"), 402, 208, 2, base, shadow, 1], + [_INTL("Cancel"), 402, 272, 2, base, shadow, 1] ] pbDrawTextPositions(@sprites["markingoverlay"].bitmap, textpos) pbMarkingSetArrow(@sprites["arrow"], index) @@ -1392,7 +1393,7 @@ class PokemonStorageScene (@markingbitmap.bitmap.width / MARK_WIDTH).times do |i| markrect.x = i * MARK_WIDTH markrect.y = [(markings[i] || 0), mark_variants - 1].min * MARK_HEIGHT - bitmap.blt(x + i * MARK_WIDTH, y, @markingbitmap.bitmap, markrect) + bitmap.blt(x + (i * MARK_WIDTH), y, @markingbitmap.bitmap, markrect) end end @@ -1401,10 +1402,11 @@ class PokemonStorageScene overlay.clear buttonbase = Color.new(248, 248, 248) buttonshadow = Color.new(80, 80, 80) - pbDrawTextPositions(overlay, [ - [_INTL("Party: {1}", (@storage.party.length rescue 0)), 270, 326, 2, buttonbase, buttonshadow, 1], - [_INTL("Exit"), 446, 326, 2, buttonbase, buttonshadow, 1] - ]) + pbDrawTextPositions( + overlay, + [[_INTL("Party: {1}", (@storage.party.length rescue 0)), 270, 326, 2, buttonbase, buttonshadow, 1], + [_INTL("Exit"), 446, 326, 2, buttonbase, buttonshadow, 1]] + ) pokemon = nil if @screen.pbHeldPokemon pokemon = @screen.pbHeldPokemon @@ -1422,7 +1424,7 @@ class PokemonStorageScene nonshadow = Color.new(224, 224, 224) pokename = pokemon.name textstrings = [ - [pokename, 10, 2, false, base, shadow] + [pokename, 10, 2, false, base, shadow] ] if !pokemon.egg? imagepos = [] @@ -1450,7 +1452,7 @@ class PokemonStorageScene pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (pokemon.types.length == 1) ? 52 : 18 + 70 * i + type_x = (pokemon.types.length == 1) ? 52 : 18 + (70 * i) overlay.blt(type_x, 272, typebitmap.bitmap, type_rect) end drawMarkings(overlay, 70, 240, 128, 20, pokemon.markings) @@ -1588,13 +1590,12 @@ class PokemonStorageScreen end pokemon = @storage[selected[0], selected[1]] next if !pokemon - command = pbShowCommands(_INTL("{1} is selected.", pokemon.name), [ - _INTL("Withdraw"), - _INTL("Summary"), - _INTL("Mark"), - _INTL("Release"), - _INTL("Cancel") - ]) + command = pbShowCommands(_INTL("{1} is selected.", pokemon.name), + [_INTL("Withdraw"), + _INTL("Summary"), + _INTL("Mark"), + _INTL("Release"), + _INTL("Cancel")]) case command when 0 then pbWithdraw(selected, nil) when 1 then pbSummary(selected, nil) @@ -1620,13 +1621,12 @@ class PokemonStorageScreen else pokemon = @storage[-1, selected] next if !pokemon - command = pbShowCommands(_INTL("{1} is selected.", pokemon.name), [ - _INTL("Store"), - _INTL("Summary"), - _INTL("Mark"), - _INTL("Release"), - _INTL("Cancel") - ]) + command = pbShowCommands(_INTL("{1} is selected.", pokemon.name), + [_INTL("Store"), + _INTL("Summary"), + _INTL("Mark"), + _INTL("Release"), + _INTL("Cancel")]) case command when 0 then pbStore([-1, selected], nil) when 1 then pbSummary([-1, selected], nil) @@ -1976,11 +1976,11 @@ class PokemonStorageScreen pokemon = @storage[selected[0], selected[1]] next if !pokemon commands = [ - _INTL("Select"), - _INTL("Summary"), - _INTL("Withdraw"), - _INTL("Item"), - _INTL("Mark") + _INTL("Select"), + _INTL("Summary"), + _INTL("Withdraw"), + _INTL("Item"), + _INTL("Mark") ] commands.push(_INTL("Cancel")) commands[2] = _INTL("Store") if selected[0] == -1 diff --git a/Data/Scripts/016_UI/018_UI_ItemStorage.rb b/Data/Scripts/016_UI/018_UI_ItemStorage.rb index 40918bee6..813bb6e90 100644 --- a/Data/Scripts/016_UI/018_UI_ItemStorage.rb +++ b/Data/Scripts/016_UI/018_UI_ItemStorage.rb @@ -78,7 +78,7 @@ class ItemStorage_Scene @sprites["background"].setBitmap("Graphics/Pictures/pcItembg") @sprites["icon"] = ItemIconSprite.new(50, 334, nil, @viewport) # Item list - @sprites["itemwindow"] = Window_PokemonItemStorage.new(@bag, 98, 14, 334, 32 + ITEMSVISIBLE * 32) + @sprites["itemwindow"] = Window_PokemonItemStorage.new(@bag, 98, 14, 334, 32 + (ITEMSVISIBLE * 32)) @sprites["itemwindow"].viewport = @viewport @sprites["itemwindow"].index = 0 @sprites["itemwindow"].baseColor = ITEMLISTBASECOLOR diff --git a/Data/Scripts/016_UI/019_UI_PC.rb b/Data/Scripts/016_UI/019_UI_PC.rb index 8e77f9334..10ebe7610 100644 --- a/Data/Scripts/016_UI/019_UI_PC.rb +++ b/Data/Scripts/016_UI/019_UI_PC.rb @@ -176,13 +176,13 @@ def pbPCMailbox command = pbShowCommands(nil, commands, -1, command) if command >= 0 && command < $PokemonGlobal.mailbox.length mailIndex = command - commandMail = pbMessage(_INTL("What do you want to do with {1}'s Mail?", - $PokemonGlobal.mailbox[mailIndex].sender), [ - _INTL("Read"), + commandMail = pbMessage( + _INTL("What do you want to do with {1}'s Mail?", $PokemonGlobal.mailbox[mailIndex].sender), + [_INTL("Read"), _INTL("Move to Bag"), _INTL("Give"), - _INTL("Cancel") - ], -1) + _INTL("Cancel")], -1 + ) case commandMail when 0 # Read pbFadeOutIn { @@ -214,11 +214,10 @@ end def pbTrainerPCMenu command = 0 loop do - command = pbMessage(_INTL("What do you want to do?"), [ - _INTL("Item Storage"), - _INTL("Mailbox"), - _INTL("Turn Off") - ], -1, nil, command) + command = pbMessage(_INTL("What do you want to do?"), + [_INTL("Item Storage"), + _INTL("Mailbox"), + _INTL("Turn Off")], -1, nil, command) case command when 0 then pbPCItemStorage when 1 then pbPCMailbox diff --git a/Data/Scripts/016_UI/020_UI_PokeMart.rb b/Data/Scripts/016_UI/020_UI_PokeMart.rb index 7c81404a7..7b9a92d24 100644 --- a/Data/Scripts/016_UI/020_UI_PokeMart.rb +++ b/Data/Scripts/016_UI/020_UI_PokeMart.rb @@ -56,8 +56,8 @@ class PokemonMartAdapter if $game_temp.mart_prices && $game_temp.mart_prices[item] if selling return $game_temp.mart_prices[item][1] if $game_temp.mart_prices[item][1] >= 0 - else - return $game_temp.mart_prices[item][0] if $game_temp.mart_prices[item][0] > 0 + elsif $game_temp.mart_prices[item][0] > 0 + return $game_temp.mart_prices[item][0] end end return GameData::Item.get(item).sell_price if selling diff --git a/Data/Scripts/016_UI/021_UI_MoveRelearner.rb b/Data/Scripts/016_UI/021_UI_MoveRelearner.rb index 6139b203e..df5613e8f 100644 --- a/Data/Scripts/016_UI/021_UI_MoveRelearner.rb +++ b/Data/Scripts/016_UI/021_UI_MoveRelearner.rb @@ -55,11 +55,11 @@ class MoveRelearner_Scene @pokemon.types.each_with_index do |type, i| type_number = GameData::Type.get(type).icon_position type_rect = Rect.new(0, type_number * 28, 64, 28) - type_x = (@pokemon.types.length == 1) ? 400 : 366 + 70 * i + type_x = (@pokemon.types.length == 1) ? 400 : 366 + (70 * i) overlay.blt(type_x, 70, @typebitmap.bitmap, type_rect) end textpos = [ - [_INTL("Teach which move?"), 16, 2, 0, Color.new(88, 88, 80), Color.new(168, 184, 184)] + [_INTL("Teach which move?"), 16, 2, 0, Color.new(88, 88, 80), Color.new(168, 184, 184)] ] imagepos = [] yPos = 76 @@ -82,7 +82,7 @@ class MoveRelearner_Scene yPos += 64 end imagepos.push(["Graphics/Pictures/reminderSel", - 0, 78 + (@sprites["commands"].index - @sprites["commands"].top_item) * 64, + 0, 78 + ((@sprites["commands"].index - @sprites["commands"].top_item) * 64), 0, 0, 258, 72]) selMoveData = GameData::Move.get(@moves[@sprites["commands"].index]) basedamage = selMoveData.display_damage(@pokemon) @@ -119,7 +119,7 @@ class MoveRelearner_Scene pbUpdate if @sprites["commands"].index != oldcmd @sprites["background"].x = 0 - @sprites["background"].y = 78 + (@sprites["commands"].index - @sprites["commands"].top_item) * 64 + @sprites["background"].y = 78 + ((@sprites["commands"].index - @sprites["commands"].top_item) * 64) pbDrawMoveList end if Input.trigger?(Input::BACK) diff --git a/Data/Scripts/016_UI/022_UI_PurifyChamber.rb b/Data/Scripts/016_UI/022_UI_PurifyChamber.rb index e212c73ad..341020281 100644 --- a/Data/Scripts/016_UI/022_UI_PurifyChamber.rb +++ b/Data/Scripts/016_UI/022_UI_PurifyChamber.rb @@ -53,7 +53,7 @@ class PurifyChamberSet attr_reader :facing # Index in list of Pokémon the Shadow Pokémon is facing def partialSum(x) - return (x * x + x) / 2 # pattern: 1, 3, 6, 10, 15, 21, 28, ... + return ((x * x) + x) / 2 # pattern: 1, 3, 6, 10, 15, 21, 28, ... end def length @@ -163,7 +163,7 @@ class PurifyChamber def self.maximumTempo # Calculates the maximum possible tempo x = SETSIZE + 1 - return ((x * x + x) / 2) - 1 + return (((x * x) + x) / 2) - 1 end def initialize @@ -411,7 +411,8 @@ class PurifyChamberScreen if @chamber.setCount(set) == 0 && @chamber.isPurifiableIgnoreRegular?(set) pkmn = @chamber.getShadow(set) @scene.pbDisplay( - _INTL("This {1} is ready to open its heart. However, there must be at least one regular Pokémon in the set to perform a purification ceremony.", pkmn.name) + _INTL("This {1} is ready to open its heart. However, there must be at least one regular Pokémon in the set to perform a purification ceremony.", + pkmn.name) ) end end @@ -447,8 +448,8 @@ class PurifyChamberScreen end commands.push(_INTL("CANCEL")) choice = @scene.pbShowCommands( - _INTL("What shall I do with this {1}?", - heldpkmn ? heldpkmn.name : curpkmn.name), commands + _INTL("What shall I do with this {1}?", heldpkmn ? heldpkmn.name : curpkmn.name), + commands ) if choice == 0 if heldpkmn @@ -610,10 +611,8 @@ class PurifyChamberScreen end else chamber.currentSet = set - cmd = @scene.pbShowCommands( - _INTL("What do you want to do?"), - [_INTL("EDIT"), _INTL("SWITCH"), _INTL("CANCEL")] - ) + cmd = @scene.pbShowCommands(_INTL("What do you want to do?"), + [_INTL("EDIT"), _INTL("SWITCH"), _INTL("CANCEL")]) case cmd when 0 # edit if !pbOpenSetDetail @@ -748,7 +747,7 @@ class DirectFlowDiagram end def setAngle(angle1) - @angle = angle1 - (angle1 / 360).floor * 360 + @angle = angle1 - ((angle1 / 360).floor * 360) end end @@ -831,8 +830,8 @@ class FlowDiagram end def setRange(angle1, angle2) - @startAngle = angle1 - (angle1 / 360).floor * 360 - @endAngle = angle2 - (angle2 / 360).floor * 360 + @startAngle = angle1 - ((angle1 / 360).floor * 360) + @endAngle = angle2 - ((angle2 / 360).floor * 360) if @startAngle == @endAngle && angle1 != angle2 @startAngle = 0 @endAngle = 359.99 @@ -866,7 +865,7 @@ class PurifyChamberSetView < SpriteWrapper for i in 0...PurifyChamber::SETSIZE * 2 @__sprites[i + 1] = PokemonIconSprite.new(nil, viewport) end - @__sprites[1 + PurifyChamber::SETSIZE * 2] = PokemonIconSprite.new(nil, viewport) + @__sprites[1 + (PurifyChamber::SETSIZE * 2)] = PokemonIconSprite.new(nil, viewport) @chamber = chamber refresh end @@ -893,9 +892,9 @@ class PurifyChamberSetView < SpriteWrapper oldcursor = @cursor if @cursor == 0 && points > 0 @cursor = 1 if button == Input::UP - @cursor = points * 1 / 4 + 1 if button == Input::RIGHT - @cursor = points * 2 / 4 + 1 if button == Input::DOWN - @cursor = points * 3 / 4 + 1 if button == Input::LEFT + @cursor = (points * 1 / 4) + 1 if button == Input::RIGHT + @cursor = (points * 2 / 4) + 1 if button == Input::DOWN + @cursor = (points * 3 / 4) + 1 if button == Input::LEFT elsif @cursor > 0 pos = @cursor - 1 if @chamber.setCount(@set) == PurifyChamber::SETSIZE @@ -959,7 +958,7 @@ class PurifyChamberSetView < SpriteWrapper GameData::Type.get(pkmn.types[1]).name), 2, -6, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)]) end - textpos.push([_INTL("FLOW"), 2 + @info.bitmap.width / 2, 18, 0, + textpos.push([_INTL("FLOW"), 2 + (@info.bitmap.width / 2), 18, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)]) # draw heart gauge pbDrawGauge(@info.bitmap, Rect.new(@info.bitmap.width * 3 / 4, 8, @info.bitmap.width * 1 / 4, 8), @@ -1004,11 +1003,11 @@ class PurifyChamberSetView < SpriteWrapper @__sprites[i + 1].pokemon = pkmn checkCursor(i + 1) end - @__sprites[1 + PurifyChamber::SETSIZE * 2].pokemon = @heldpkmn - @__sprites[1 + PurifyChamber::SETSIZE * 2].visible = @view.visible - @__sprites[1 + PurifyChamber::SETSIZE * 2].x = @view.x + 32 - @__sprites[1 + PurifyChamber::SETSIZE * 2].y = @view.y - 6 + 40 - @__sprites[1 + PurifyChamber::SETSIZE * 2].z = 3 + @__sprites[1 + (PurifyChamber::SETSIZE * 2)].pokemon = @heldpkmn + @__sprites[1 + (PurifyChamber::SETSIZE * 2)].visible = @view.visible + @__sprites[1 + (PurifyChamber::SETSIZE * 2)].x = @view.x + 32 + @__sprites[1 + (PurifyChamber::SETSIZE * 2)].y = @view.y - 6 + 40 + @__sprites[1 + (PurifyChamber::SETSIZE * 2)].z = 3 end def getCurrent @@ -1115,7 +1114,7 @@ class PurifyChamberScene addBackgroundOrColoredPlane(@sprites, "bg", "purifychamberbg", Color.new(0, 0, 0), @viewport) @sprites["setwindow"] = Window_PurifyChamberSets.new( - @chamber, 0, 0, 112, Graphics.height, @viewport + @chamber, 0, 0, 112, Graphics.height, @viewport ) @sprites["setview"] = PurifyChamberSetView.new(@chamber, set, @viewport) @sprites["msgwindow"] = Window_AdvancedTextPokemon.new("") diff --git a/Data/Scripts/016_UI/023_UI_MysteryGift.rb b/Data/Scripts/016_UI/023_UI_MysteryGift.rb index 27f84d3e0..c3c98e084 100644 --- a/Data/Scripts/016_UI/023_UI_MysteryGift.rb +++ b/Data/Scripts/016_UI/023_UI_MysteryGift.rb @@ -23,7 +23,8 @@ def pbEditMysteryGift(type, item, id = 0, giftname = "") commands.push(_INTL("[Custom]")) loop do command = pbMessage( - _INTL("Choose a phrase to be where the gift Pokémon was obtained from."), commands, -1 + _INTL("Choose a phrase to be where the gift Pokémon was obtained from."), + commands, -1 ) if command < 0 return nil if pbConfirmMessage(_INTL("Stop editing this gift?")) @@ -73,13 +74,11 @@ def pbEditMysteryGift(type, item, id = 0, giftname = "") newid = pbMessageChooseNumber(_INTL("Choose a unique ID for this gift."), params) if newid == 0 return nil if pbConfirmMessage(_INTL("Stop editing this gift?")) + elsif idlist.include?(newid) + pbMessage(_INTL("That ID is already used by a Mystery Gift.")) else - if idlist.include?(newid) - pbMessage(_INTL("That ID is already used by a Mystery Gift.")) - else - id = newid - break - end + id = newid + break end end end @@ -377,7 +376,7 @@ def pbReceiveMysteryGift(id) end gift = $player.mystery_gifts[index] if gift[1] == 0 # Pokémon - gift[2].personalID = rand(2**16) | rand(2**16) << 16 + gift[2].personalID = rand(2**16) | (rand(2**16) << 16) gift[2].calc_stats time = pbGetTimeNow gift[2].timeReceived = time.getgm.to_i diff --git a/Data/Scripts/016_UI/024_UI_TextEntry.rb b/Data/Scripts/016_UI/024_UI_TextEntry.rb index 7ad4e9264..38d302eae 100644 --- a/Data/Scripts/016_UI/024_UI_TextEntry.rb +++ b/Data/Scripts/016_UI/024_UI_TextEntry.rb @@ -71,8 +71,8 @@ end #=============================================================================== class PokemonEntryScene @@Characters = [ - [("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").scan(/./), "[*]"], - [("0123456789 !@\#$%^&*() ~`-_+={}[] :;'\"<>,.?/ ").scan(/./), "[A]"] + [("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").scan(/./), "[*]"], + [("0123456789 !@\#$%^&*() ~`-_+={}[] :;'\"<>,.?/ ").scan(/./), "[A]"] ] USEKEYBOARD = true @@ -104,13 +104,13 @@ class PokemonEntryScene end if minlength == 0 @sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize( - _INTL("Enter text using the keyboard. Press\nEnter to confirm, or Esc to cancel."), - 32, Graphics.height - 96, Graphics.width - 64, 96, @viewport + _INTL("Enter text using the keyboard. Press\nEnter to confirm, or Esc to cancel."), + 32, Graphics.height - 96, Graphics.width - 64, 96, @viewport ) else @sprites["helpwindow"] = Window_UnformattedTextPokemon.newWithSize( - _INTL("Enter text using the keyboard.\nPress Enter to confirm."), - 32, Graphics.height - 96, Graphics.width - 64, 96, @viewport + _INTL("Enter text using the keyboard.\nPress Enter to confirm."), + 32, Graphics.height - 96, Graphics.width - 64, 96, @viewport ) end @sprites["helpwindow"].letterbyletter = false @@ -131,8 +131,8 @@ class PokemonEntryScene @sprites["subject"] = TrainerWalkingCharSprite.new(filename, @viewport) charwidth = @sprites["subject"].bitmap.width charheight = @sprites["subject"].bitmap.height - @sprites["subject"].x = 44 * 2 - charwidth / 8 - @sprites["subject"].y = 38 * 2 - charheight / 4 + @sprites["subject"].x = (44 * 2) - (charwidth / 8) + @sprites["subject"].y = (38 * 2) - (charheight / 4) end when 2 # Pokémon if pokemon @@ -165,16 +165,16 @@ class PokemonEntryScene @sprites["subject"] = TrainerWalkingCharSprite.new(pokemon.to_s, @viewport) charwidth = @sprites["subject"].bitmap.width charheight = @sprites["subject"].bitmap.height - @sprites["subject"].x = 44 * 2 - charwidth / 8 - @sprites["subject"].y = 38 * 2 - charheight / 4 + @sprites["subject"].x = (44 * 2) - (charwidth / 8) + @sprites["subject"].y = (38 * 2) - (charheight / 4) when 4 # Storage box @sprites["subject"] = TrainerWalkingCharSprite.new(nil, @viewport) @sprites["subject"].altcharset = "Graphics/Pictures/Naming/icon_storage" @sprites["subject"].animspeed = 4 charwidth = @sprites["subject"].bitmap.width charheight = @sprites["subject"].bitmap.height - @sprites["subject"].x = 44 * 2 - charwidth / 8 - @sprites["subject"].y = 26 * 2 - charheight / 2 + @sprites["subject"].x = (44 * 2) - (charwidth / 8) + @sprites["subject"].y = (26 * 2) - (charheight / 2) end pbFadeInAndShow(@sprites) end @@ -321,8 +321,8 @@ class PokemonEntryScene2 @cursortype = 2 else if value >= 0 - @sprite.x = 52 + 32 * (value % PokemonEntryScene2::ROWS) - @sprite.y = 180 + 38 * (value / PokemonEntryScene2::ROWS) + @sprite.x = 52 + (32 * (value % PokemonEntryScene2::ROWS)) + @sprite.y = 180 + (38 * (value / PokemonEntryScene2::ROWS)) @cursortype = 0 end end @@ -388,8 +388,8 @@ class PokemonEntryScene2 textPos = [] for y in 0...COLUMNS for x in 0...ROWS - pos = y * ROWS + x - textPos.push([@@Characters[i][0][pos], 44 + x * 32, 12 + y * 38, 2, + pos = (y * ROWS) + x + textPos.push([@@Characters[i][0][pos], 44 + (x * 32), 12 + (y * 38), 2, Color.new(16, 24, 32), Color.new(160, 160, 160)]) end end @@ -416,8 +416,8 @@ class PokemonEntryScene2 @sprites["subject"] = TrainerWalkingCharSprite.new(filename, @viewport) charwidth = @sprites["subject"].bitmap.width charheight = @sprites["subject"].bitmap.height - @sprites["subject"].x = 88 - charwidth / 8 - @sprites["subject"].y = 76 - charheight / 4 + @sprites["subject"].x = 88 - (charwidth / 8) + @sprites["subject"].y = 76 - (charheight / 4) end when 2 # Pokémon if pokemon @@ -450,16 +450,16 @@ class PokemonEntryScene2 @sprites["subject"] = TrainerWalkingCharSprite.new(pokemon.to_s, @viewport) charwidth = @sprites["subject"].bitmap.width charheight = @sprites["subject"].bitmap.height - @sprites["subject"].x = 88 - charwidth / 8 - @sprites["subject"].y = 76 - charheight / 4 + @sprites["subject"].x = 88 - (charwidth / 8) + @sprites["subject"].y = 76 - (charheight / 4) when 4 # Storage box @sprites["subject"] = TrainerWalkingCharSprite.new(nil, @viewport) @sprites["subject"].altcharset = "Graphics/Pictures/Naming/icon_storage" @sprites["subject"].animspeed = 4 charwidth = @sprites["subject"].bitmap.width charheight = @sprites["subject"].bitmap.height - @sprites["subject"].x = 88 - charwidth / 8 - @sprites["subject"].y = 52 - charheight / 2 + @sprites["subject"].x = 88 - (charwidth / 8) + @sprites["subject"].y = 52 - (charheight / 2) end @sprites["bgoverlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport) pbDoUpdateOverlay @@ -469,7 +469,7 @@ class PokemonEntryScene2 @maxlength = maxlength @maxlength.times { |i| @sprites["blank#{i}"] = SpriteWrapper.new(@viewport) - @sprites["blank#{i}"].x = 160 + 24 * i + @sprites["blank#{i}"].x = 160 + (24 * i) @sprites["blank#{i}"].bitmap = @bitmaps[@bitmaps.length - 1] @blanks[i] = 0 } @@ -502,7 +502,7 @@ class PokemonEntryScene2 def pbDoUpdateOverlay2 overlay = @sprites["overlay"].bitmap overlay.clear - modeIcon = [[_INTL("Graphics/Pictures/Naming/icon_mode"), 44 + @mode * 62, 120, @mode * 60, 0, 60, 44]] + modeIcon = [[_INTL("Graphics/Pictures/Naming/icon_mode"), 44 + (@mode * 62), 120, @mode * 60, 0, 60, 44]] pbDrawImagePositions(overlay, modeIcon) end @@ -513,7 +513,7 @@ class PokemonEntryScene2 bgoverlay.clear pbSetSystemFont(bgoverlay) textPositions = [ - [@helptext, 160, 6, false, Color.new(16, 24, 32), Color.new(168, 184, 184)] + [@helptext, 160, 6, false, Color.new(16, 24, 32), Color.new(168, 184, 184)] ] chars = @helper.textChars x = 166 @@ -587,7 +587,7 @@ class PokemonEntryScene2 return false if m >= ROWS - 1 chset = @@Characters[@mode][0] COLUMNS.times do |i| - return false if chset[i * ROWS + m] != " " + return false if chset[(i * ROWS) + m] != " " end return true end @@ -627,11 +627,11 @@ class PokemonEntryScene2 if @cursorpos < 0 # Controls case @cursorpos when MODE1 then @cursorpos = ROWS * (COLUMNS - 1) - when MODE2 then @cursorpos = ROWS * (COLUMNS - 1) + 2 - when MODE3 then @cursorpos = ROWS * (COLUMNS - 1) + 4 - when MODE4 then @cursorpos = ROWS * (COLUMNS - 1) + 6 - when BACK then @cursorpos = ROWS * (COLUMNS - 1) + 9 - when OK then @cursorpos = ROWS * (COLUMNS - 1) + 11 + when MODE2 then @cursorpos = (ROWS * (COLUMNS - 1)) + 2 + when MODE3 then @cursorpos = (ROWS * (COLUMNS - 1)) + 4 + when MODE4 then @cursorpos = (ROWS * (COLUMNS - 1)) + 6 + when BACK then @cursorpos = (ROWS * (COLUMNS - 1)) + 9 + when OK then @cursorpos = (ROWS * (COLUMNS - 1)) + 11 end elsif @cursorpos < ROWS # Top row of letters case @cursorpos @@ -644,7 +644,7 @@ class PokemonEntryScene2 end else cursordiv = wrapmod(cursordiv - 1, COLUMNS) - @cursorpos = cursordiv * ROWS + cursormod + @cursorpos = (cursordiv * ROWS) + cursormod end elsif Input.repeat?(Input::DOWN) if @cursorpos < 0 # Controls @@ -667,7 +667,7 @@ class PokemonEntryScene2 end else cursordiv = wrapmod(cursordiv + 1, COLUMNS) - @cursorpos = cursordiv * ROWS + cursormod + @cursorpos = (cursordiv * ROWS) + cursormod end end if @cursorpos != oldcursor # Cursor position changed @@ -717,7 +717,7 @@ class PokemonEntryScene2 else cursormod = @cursorpos % ROWS cursordiv = @cursorpos / ROWS - charpos = cursordiv * ROWS + cursormod + charpos = (cursordiv * ROWS) + cursormod chset = @@Characters[@mode][0] if @helper.length >= @maxlength @helper.delete diff --git a/Data/Scripts/017_Minigames/001_Minigame_Duel.rb b/Data/Scripts/017_Minigames/001_Minigame_Duel.rb index a62d66bf2..56cfc7cea 100644 --- a/Data/Scripts/017_Minigames/001_Minigame_Duel.rb +++ b/Data/Scripts/017_Minigames/001_Minigame_Duel.rb @@ -71,14 +71,12 @@ class PokemonDuel end @oldmovespeed = $game_player.move_speed @oldeventspeed = event.move_speed - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::DirectionFixOn - ]) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::DirectionFixOn - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::DirectionFixOn]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::DirectionFixOn]) pbWait(Graphics.frame_rate * 3 / 4) end @@ -117,7 +115,7 @@ class PokemonDuel end end @special[1] = true if action == 3 - pbMessage(_INTL("{1}: {2}", opponent.name, speeches[action * 3 + rand(3)])) + pbMessage(_INTL("{1}: {2}", opponent.name, speeches[(action * 3) + rand(3)])) list = [ _INTL("DEFEND"), _INTL("PRECISE ATTACK"), @@ -127,105 +125,88 @@ class PokemonDuel command = pbMessage(_INTL("Choose a command."), list, 0) @special[0] = true if command == 3 if action == 0 && command == 0 - pbMoveRoute($game_player, [ - PBMoveRoute::ScriptAsync, "moveRight90", - PBMoveRoute::ScriptAsync, "moveLeft90", - PBMoveRoute::ScriptAsync, "moveLeft90", - PBMoveRoute::ScriptAsync, "moveRight90" - ]) - pbMoveRoute(event, [ - PBMoveRoute::ScriptAsync, "moveLeft90", - PBMoveRoute::ScriptAsync, "moveRight90", - PBMoveRoute::ScriptAsync, "moveRight90", - PBMoveRoute::ScriptAsync, "moveLeft90" - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ScriptAsync, "moveRight90", + PBMoveRoute::ScriptAsync, "moveLeft90", + PBMoveRoute::ScriptAsync, "moveLeft90", + PBMoveRoute::ScriptAsync, "moveRight90"]) + pbMoveRoute(event, + [PBMoveRoute::ScriptAsync, "moveLeft90", + PBMoveRoute::ScriptAsync, "moveRight90", + PBMoveRoute::ScriptAsync, "moveRight90", + PBMoveRoute::ScriptAsync, "moveLeft90"]) pbWait(Graphics.frame_rate / 2) pbMessage(_INTL("You study each other's movements...")) elsif action == 0 && command == 1 - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::Forward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::Forward]) pbWait(Graphics.frame_rate * 4 / 10) pbShake(9, 9, 8) pbFlashScreens(false, true) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Backward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Backward]) @hp[1] -= 1 pbMessage(_INTL("Your attack was not blocked!")) elsif action == 0 && command == 2 - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::ScriptAsync, "jumpForward" - ]) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::Backward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::ScriptAsync, "jumpForward"]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::Backward]) pbWait(Graphics.frame_rate) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Backward - ]) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Forward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Backward]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Forward]) pbMessage(_INTL("Your attack was evaded!")) elsif [0, 1, 2].include?(action) && command == 3 - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::ScriptAsync, "jumpForward" - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::ScriptAsync, "jumpForward"]) pbWait(Graphics.frame_rate * 4 / 10) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 5, - PBMoveRoute::Backward, - PBMoveRoute::ChangeSpeed, 2 - ]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 5, + PBMoveRoute::Backward, + PBMoveRoute::ChangeSpeed, 2]) pbWait(Graphics.frame_rate / 2) pbShake(9, 9, 8) pbFlashScreens(false, true) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Backward - ]) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Forward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Backward]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Forward]) @hp[1] -= 3 pbMessage(_INTL("You pierce through the opponent's defenses!")) elsif action == 1 && command == 0 - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::Forward - ]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::Forward]) pbWait(Graphics.frame_rate * 4 / 10) pbShake(9, 9, 8) pbFlashScreens(true, false) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Backward - ]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Backward]) @hp[0] -= 1 pbMessage(_INTL("You fail to block the opponent's attack!")) elsif action == 1 && command == 1 - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::Forward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::Forward]) pbWait(Graphics.frame_rate * 6 / 10) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Backward - ]) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Forward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Backward]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Forward]) pbWait(Graphics.frame_rate * 6 / 10) pbMoveRoute(event, [PBMoveRoute::Backward]) pbMoveRoute($game_player, [PBMoveRoute::Forward]) @@ -235,28 +216,24 @@ class PokemonDuel elsif (action == 1 && command == 2) || (action == 2 && command == 1) || (action == 2 && command == 2) - pbMoveRoute($game_player, [ - PBMoveRoute::Backward, - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::ScriptAsync, "jumpForward" - ]) + pbMoveRoute($game_player, + [PBMoveRoute::Backward, + PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::ScriptAsync, "jumpForward"]) pbWait(Graphics.frame_rate * 8 / 10) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::Forward - ]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::Forward]) pbWait(Graphics.frame_rate * 9 / 10) pbShake(9, 9, 8) pbFlashScreens(true, true) - pbMoveRoute($game_player, [ - PBMoveRoute::Backward, - PBMoveRoute::ChangeSpeed, 2 - ]) - pbMoveRoute(event, [ - PBMoveRoute::Backward, - PBMoveRoute::Backward, - PBMoveRoute::ChangeSpeed, 2 - ]) + pbMoveRoute($game_player, + [PBMoveRoute::Backward, + PBMoveRoute::ChangeSpeed, 2]) + pbMoveRoute(event, + [PBMoveRoute::Backward, + PBMoveRoute::Backward, + PBMoveRoute::ChangeSpeed, 2]) pbWait(Graphics.frame_rate) pbMoveRoute(event, [PBMoveRoute::Forward]) pbMoveRoute($game_player, [PBMoveRoute::Forward]) @@ -264,70 +241,58 @@ class PokemonDuel @hp[1] -= command # Player command pbMessage(_INTL("You hit each other!")) elsif action == 2 && command == 0 - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::Forward - ]) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::ScriptAsync, "jumpBackward" - ]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::Forward]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::ScriptAsync, "jumpBackward"]) pbWait(Graphics.frame_rate) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Forward - ]) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Backward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Forward]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Backward]) pbMessage(_INTL("You evade the opponent's attack!")) elsif action == 3 && [0, 1, 2].include?(command) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::ScriptAsync, "jumpForward" - ]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::ScriptAsync, "jumpForward"]) pbWait(Graphics.frame_rate * 4 / 10) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 5, - PBMoveRoute::Backward, - PBMoveRoute::ChangeSpeed, 2 - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 5, + PBMoveRoute::Backward, + PBMoveRoute::ChangeSpeed, 2]) pbWait(Graphics.frame_rate / 2) pbShake(9, 9, 8) pbFlashScreens(true, false) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Forward - ]) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 2, - PBMoveRoute::Backward - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Forward]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 2, + PBMoveRoute::Backward]) @hp[0] -= 3 pbMessage(_INTL("The opponent pierces through your defenses!")) elsif action == 3 && command == 3 pbMoveRoute($game_player, [PBMoveRoute::Backward]) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::ScriptAsync, "jumpForward" - ]) - pbMoveRoute(event, [ - PBMoveRoute::Wait, 15, - PBMoveRoute::ChangeSpeed, 4, - PBMoveRoute::ScriptAsync, "jumpForward" - ]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::ScriptAsync, "jumpForward"]) + pbMoveRoute(event, + [PBMoveRoute::Wait, 15, + PBMoveRoute::ChangeSpeed, 4, + PBMoveRoute::ScriptAsync, "jumpForward"]) pbWait(Graphics.frame_rate) - pbMoveRoute(event, [ - PBMoveRoute::ChangeSpeed, 5, - PBMoveRoute::Backward, - PBMoveRoute::ChangeSpeed, 2 - ]) - pbMoveRoute($game_player, [ - PBMoveRoute::ChangeSpeed, 5, - PBMoveRoute::Backward, - PBMoveRoute::ChangeSpeed, 2 - ]) + pbMoveRoute(event, + [PBMoveRoute::ChangeSpeed, 5, + PBMoveRoute::Backward, + PBMoveRoute::ChangeSpeed, 2]) + pbMoveRoute($game_player, + [PBMoveRoute::ChangeSpeed, 5, + PBMoveRoute::Backward, + PBMoveRoute::ChangeSpeed, 2]) pbShake(9, 9, 8) pbFlash(Color.new(255, 255, 255, 255), 20) pbFlashScreens(true, true) @@ -343,14 +308,12 @@ class PokemonDuel def pbEndDuel pbWait(Graphics.frame_rate * 3 / 4) - pbMoveRoute($game_player, [ - PBMoveRoute::DirectionFixOff, - PBMoveRoute::ChangeSpeed, @oldmovespeed - ]) - pbMoveRoute(@event, [ - PBMoveRoute::DirectionFixOff, - PBMoveRoute::ChangeSpeed, @oldeventspeed - ]) + pbMoveRoute($game_player, + [PBMoveRoute::DirectionFixOff, + PBMoveRoute::ChangeSpeed, @oldmovespeed]) + pbMoveRoute(@event, + [PBMoveRoute::DirectionFixOff, + PBMoveRoute::ChangeSpeed, @oldeventspeed]) fade_time = Graphics.frame_rate * 4 / 10 alpha_diff = (255.0 / fade_time).ceil fade_time.times do diff --git a/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb b/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb index a915e55fc..8f2622da5 100644 --- a/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb +++ b/Data/Scripts/017_Minigames/002_Minigame_TripleTriad.rb @@ -23,10 +23,10 @@ class TriadCard speed = baseStats[:SPEED] @type = species_data.types[0] @type = species_data.types[1] if @type == :NORMAL && species_data.types[1] - @west = baseStatToValue(attack + speed / 3) - @east = baseStatToValue(defense + hp / 3) - @north = baseStatToValue(spAtk + speed / 3) - @south = baseStatToValue(spDef + hp / 3) + @west = baseStatToValue(attack + (speed / 3)) + @east = baseStatToValue(defense + (hp / 3)) + @north = baseStatToValue(spAtk + (speed / 3)) + @south = baseStatToValue(spDef + (hp / 3)) end def baseStatToValue(stat) @@ -61,22 +61,22 @@ class TriadCard def price maxValue = [@north, @east, @south, @west].max - ret = @north * @north + @east * @east + @south * @south + @west * @west + ret = (@north * @north) + (@east * @east) + (@south * @south) + (@west * @west) ret += maxValue * maxValue * 2 ret *= maxValue ret *= (@north + @east + @south + @west) ret /= 10 # Ranges from 2 to 24,000 # Quantize prices to the next highest "unit" if ret > 10000 - ret = (1 + ret / 1000) * 1000 + ret = (1 + (ret / 1000)) * 1000 elsif ret > 5000 - ret = (1 + ret / 500) * 500 + ret = (1 + (ret / 500)) * 500 elsif ret > 1000 - ret = (1 + ret / 100) * 100 + ret = (1 + (ret / 100)) * 100 elsif ret > 500 - ret = (1 + ret / 50) * 50 + ret = (1 + (ret / 50)) * 50 else - ret = (1 + ret / 10) * 10 + ret = (1 + (ret / 10)) * 10 end return ret end @@ -174,8 +174,8 @@ class TriadScene ) for i in 0...@battle.width * @battle.height @sprites["sprite#{i}"] = SpriteWrapper.new(@viewport) - @sprites["sprite#{i}"].x = Graphics.width / 2 - 118 + (i % 3) * 78 - @sprites["sprite#{i}"].y = 36 + (i / 3) * 94 + @sprites["sprite#{i}"].x = (Graphics.width / 2) - 118 + ((i % 3) * 78) + @sprites["sprite#{i}"].y = 36 + ((i / 3) * 94) @sprites["sprite#{i}"].z = 2 bm = TriadCard.createBack(@battle.board[i].type, true) @bitmaps.push(bm) @@ -190,17 +190,18 @@ class TriadScene for i in 0...@battle.maxCards @sprites["player#{i}"] = Sprite.new(@viewport) @sprites["player#{i}"].x = Graphics.width - 92 - @sprites["player#{i}"].y = 44 + 44 * i + @sprites["player#{i}"].y = 44 + (44 * i) @sprites["player#{i}"].z = 2 @cardIndexes.push(i) end @sprites["overlay"] = Sprite.new(@viewport) @sprites["overlay"].bitmap = BitmapWrapper.new(Graphics.width, Graphics.height) pbSetSystemFont(@sprites["overlay"].bitmap) - pbDrawTextPositions(@sprites["overlay"].bitmap, [ - [@battle.opponentName, 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)], - [@battle.playerName, Graphics.width - 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)] - ]) + pbDrawTextPositions( + @sprites["overlay"].bitmap, + [[@battle.opponentName, 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)], + [@battle.playerName, Graphics.width - 52, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]] + ) @sprites["score"] = Sprite.new(@viewport) @sprites["score"].bitmap = BitmapWrapper.new(Graphics.width, Graphics.height) pbSetSystemFont(@sprites["score"].bitmap) @@ -263,14 +264,14 @@ class TriadScene command = Window_CommandPokemonEx.newWithSize(commands, 0, 0, Graphics.width / 2, Graphics.height - 64, @viewport) @sprites["helpwindow"].text = _INTL("Choose {1} cards to use for this duel.", @battle.maxCards) preview = Sprite.new(@viewport) - preview.x = Graphics.width / 2 + 20 + preview.x = (Graphics.width / 2) + 20 preview.y = 60 preview.z = 4 index = -1 for i in 0...@battle.maxCards @sprites["player#{i}"] = Sprite.new(@viewport) @sprites["player#{i}"].x = Graphics.width - 92 - @sprites["player#{i}"].y = 44 + 44 * i + @sprites["player#{i}"].y = 44 + (44 * i) @sprites["player#{i}"].z = 2 end loop do @@ -348,7 +349,7 @@ class TriadScene for i in 0...@battle.maxCards @sprites["player#{i}"] = Sprite.new(@viewport) @sprites["player#{i}"].x = Graphics.width - 92 - @sprites["player#{i}"].y = 44 + 44 * i + @sprites["player#{i}"].y = 44 + (44 * i) @sprites["player#{i}"].z = 2 @sprites["player#{i}"].bitmap = TriadCard.new(cards[i]).createBitmap(1) @cardBitmaps.push(@sprites["player#{i}"].bitmap) @@ -359,7 +360,7 @@ class TriadScene for i in 0...@battle.maxCards @sprites["opponent#{i}"] = Sprite.new(@viewport) @sprites["opponent#{i}"].x = 12 - @sprites["opponent#{i}"].y = 44 + 44 * i + @sprites["opponent#{i}"].y = 44 + (44 * i) @sprites["opponent#{i}"].z = 2 @sprites["opponent#{i}"].bitmap = @battle.openHand ? TriadCard.new(cards[i]).createBitmap(2) : TriadCard.createBack @opponentCardBitmaps.push(@sprites["opponent#{i}"].bitmap) @@ -458,8 +459,8 @@ class TriadScene y = 44 for i in 0...@cardIndexes.length if i == cardIndex # Card being placed - @sprites["player#{@cardIndexes[i]}"].x = Graphics.width / 2 - 118 + boardX * 78 - @sprites["player#{@cardIndexes[i]}"].y = 36 + boardY * 94 + @sprites["player#{@cardIndexes[i]}"].x = (Graphics.width / 2) - 118 + (boardX * 78) + @sprites["player#{@cardIndexes[i]}"].y = 36 + (boardY * 94) @sprites["player#{@cardIndexes[i]}"].z = 4 else # Other cards in hand @sprites["player#{@cardIndexes[i]}"].x = Graphics.width - 92 @@ -510,7 +511,7 @@ class TriadScene def pbEndPlaceCard(position, cardIndex) spriteIndex = @cardIndexes[cardIndex] - boardIndex = position[1] * @battle.width + position[0] + boardIndex = (position[1] * @battle.width) + position[0] @boardSprites[boardIndex] = @sprites["player#{spriteIndex}"] @boardCards[boardIndex] = TriadCard.new(@playerCards[spriteIndex]) pbRefresh @@ -526,8 +527,8 @@ class TriadScene @opponentCardBitmaps[@opponentCardIndexes[i]] = triadCard.createBitmap(2) sprite.bitmap.dispose if sprite.bitmap sprite.bitmap = @opponentCardBitmaps[@opponentCardIndexes[i]] - sprite.x = Graphics.width / 2 - 118 + position[0] * 78 - sprite.y = 36 + position[1] * 94 + sprite.x = (Graphics.width / 2) - 118 + (position[0] * 78) + sprite.y = 36 + (position[1] * 94) sprite.z = 2 else sprite.x = 12 @@ -540,7 +541,7 @@ class TriadScene def pbEndOpponentPlaceCard(position, cardIndex) spriteIndex = @opponentCardIndexes[cardIndex] - boardIndex = position[1] * @battle.width + position[0] + boardIndex = (position[1] * @battle.width) + position[0] @boardSprites[boardIndex] = @sprites["opponent#{spriteIndex}"] @boardCards[boardIndex] = TriadCard.new(@opponentCards[spriteIndex]) pbRefresh @@ -575,9 +576,10 @@ class TriadScene playerscore += @cardIndexes.length oppscore += @opponentCardIndexes.length end - pbDrawTextPositions(bitmap, [ - [_INTL("{1}-{2}", oppscore, playerscore), Graphics.width / 2, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)] - ]) + pbDrawTextPositions( + bitmap, + [[_INTL("{1}-{2}", oppscore, playerscore), Graphics.width / 2, -2, 2, Color.new(248, 248, 248), Color.new(96, 96, 96)]] + ) end def pbUpdate @@ -613,7 +615,7 @@ class TriadScreen def maxCards numcards = @width * @height if numcards.odd? - numcards = numcards / 2 + 1 + numcards = (numcards / 2) + 1 else numcards = numcards / 2 end @@ -621,15 +623,15 @@ class TriadScreen end def isOccupied?(x, y) - return @board[y * @width + x].owner != 0 + return @board[(y * @width) + x].owner != 0 end def getOwner(x, y) - return @board[y * @width + x].owner + return @board[(y * @width) + x].owner end def getPanel(x, y) - return @board[y * @width + x] + return @board[(y * @width) + x] end def quantity(items, item) @@ -651,14 +653,14 @@ class TriadScreen panels[2] = (@wrapAround ? 0 : @width - 1) if panels[2] > @width - 1 # right panels[5] = (@wrapAround ? @height - 1 : 0) if panels[5] < 0 # top panels[7] = (@wrapAround ? 0 : @height - 1) if panels[7] > @height - 1 # bottom - attacker = attackerParam != nil ? attackerParam : @board[y * @width + x] + attacker = attackerParam != nil ? attackerParam : @board[(y * @width) + x] flips = [] - return nil if attackerParam != nil && @board[y * @width + x].owner != 0 + return nil if attackerParam != nil && @board[(y * @width) + x].owner != 0 return nil if !attacker.card || attacker.owner == 0 for i in 0...4 defenderX = panels[i * 2] - defenderY = panels[i * 2 + 1] - defender = @board[defenderY * @width + defenderX] + defenderY = panels[(i * 2) + 1] + defender = @board[(defenderY * @width) + defenderX] next if !defender.card if attacker.owner != defender.owner attack = attacker.attack(i) @@ -847,7 +849,7 @@ class TriadScreen position = [result[1], result[2]] @scene.pbOpponentPlaceCard(triadCard, position, cardIndex) end - boardIndex = position[1] * @width + position[0] + boardIndex = (position[1] * @width) + position[0] board[boardIndex].card = triadCard board[boardIndex].owner = playerTurn ? 1 : 2 flipBoard(position[0], position[1]) @@ -1084,8 +1086,8 @@ def pbBuyTriads goldwindow.y = 0 goldwindow.z = 99999 preview = Sprite.new - preview.x = Graphics.width * 3 / 4 - 40 - preview.y = Graphics.height / 2 - 48 + preview.x = (Graphics.width * 3 / 4) - 40 + preview.y = (Graphics.height / 2) - 48 preview.z = 4 preview.bitmap = TriadCard.new(commands[cmdwindow.index][3]).createBitmap(1) olditem = commands[cmdwindow.index][3] @@ -1172,8 +1174,8 @@ def pbSellTriads goldwindow.y = 0 goldwindow.z = 99999 preview = Sprite.new - preview.x = Graphics.width * 3 / 4 - 40 - preview.y = Graphics.height / 2 - 48 + preview.x = (Graphics.width * 3 / 4) - 40 + preview.y = (Graphics.height / 2) - 48 preview.z = 4 item = $PokemonGlobal.triads.get_item(cmdwindow.index) preview.bitmap = TriadCard.new(item).createBitmap(1) @@ -1269,7 +1271,7 @@ def pbTriadList cmdwindow = Window_CommandPokemonEx.newWithSize(commands, 0, 0, Graphics.width / 2, Graphics.height) cmdwindow.z = 99999 sprite = Sprite.new - sprite.x = Graphics.width / 2 + 40 + sprite.x = (Graphics.width / 2) + 40 sprite.y = 48 sprite.z = 99999 done = false diff --git a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb index b41d7b26b..4f318f131 100644 --- a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb +++ b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb @@ -73,7 +73,7 @@ class SlotMachineReel < BitmapSprite for i in 0...4 num = @index - i num += @reel.length if num < 0 - self.bitmap.blt(0, @toppos + i * 48, @images.bitmap, Rect.new(@reel[num] * 64, 0, 64, 48)) + self.bitmap.blt(0, @toppos + (i * 48), @images.bitmap, Rect.new(@reel[num] * 64, 0, 64, 48)) end self.bitmap.blt(0, 0, @shading.bitmap, Rect.new(0, 0, 64, 144)) end @@ -246,7 +246,7 @@ class SlotMachineScene @sprites["reel2"] = SlotMachineReel.new(144, 112, difficulty) @sprites["reel3"] = SlotMachineReel.new(224, 112, difficulty) for i in 1..3 - @sprites["button#{i}"] = IconSprite.new(68 + 80 * (i - 1), 260, @viewport) + @sprites["button#{i}"] = IconSprite.new(68 + (80 * (i - 1)), 260, @viewport) @sprites["button#{i}"].setBitmap(sprintf("Graphics/Pictures/Slot Machine/button")) @sprites["button#{i}"].visible = false end @@ -254,7 +254,7 @@ class SlotMachineScene y = [170, 122, 218, 82, 82][i - 1] @sprites["row#{i}"] = IconSprite.new(2, y, @viewport) @sprites["row#{i}"].setBitmap(sprintf("Graphics/Pictures/Slot Machine/line%1d%s", - 1 + i / 2, (i >= 4) ? ((i == 4) ? "a" : "b") : "")) + 1 + (i / 2), (i >= 4) ? ((i == 4) ? "a" : "b") : "")) @sprites["row#{i}"].visible = false end @sprites["light1"] = IconSprite.new(16, 32, @viewport) diff --git a/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb b/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb index 5aed8f4fd..81fc1e127 100644 --- a/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb +++ b/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb @@ -75,7 +75,7 @@ class VoltorbFlip for i in 0...25 x = i if i % 5 == 0 r = rand(squareValues.length) - @squares[i] = [(i - x).abs * 64 + 128, (i / 5).abs * 64, squareValues[r], false] + @squares[i] = [((i - x).abs * 64) + 128, (i / 5).abs * 64, squareValues[r], false] squareValues.delete_at(r) end pbCreateSprites @@ -258,14 +258,14 @@ class VoltorbFlip elsif Input.trigger?(Input::USE) if @cursor[0][3] == 64 # If in mark mode for i in 0...@squares.length - if @index[0] * 64 + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false + if (@index[0] * 64) + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false pbSEPlay("Voltorb Flip mark") end end for i in 0...@marks.length + 1 if @marks[i] == nil - @marks[i] = [@directory + "tiles", @index[0] * 64 + 128, @index[1] * 64, 256, 0, 64, 64] - elsif @marks[i][1] == @index[0] * 64 + 128 && @marks[i][2] == @index[1] * 64 + @marks[i] = [@directory + "tiles", (@index[0] * 64) + 128, @index[1] * 64, 256, 0, 64, 64] + elsif @marks[i][1] == (@index[0] * 64) + 128 && @marks[i][2] == @index[1] * 64 @marks.delete_at(i) @marks.compact! @sprites["mark"].bitmap.clear @@ -278,8 +278,8 @@ class VoltorbFlip # Display the tile for the selected spot icons = [] for i in 0...@squares.length - if @index[0] * 64 + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false - pbAnimateTile(@index[0] * 64 + 128, @index[1] * 64, @squares[i][2]) + if (@index[0] * 64) + 128 == @squares[i][0] && @index[1] * 64 == @squares[i][1] && @squares[i][3] == false + pbAnimateTile((@index[0] * 64) + 128, @index[1] * 64, @squares[i][2]) @squares[i][3] = true # If Voltorb (0), display all tiles on the board if @squares[i][2] == 0 @@ -288,7 +288,7 @@ class VoltorbFlip # Part1 animation = [] for j in 0...3 - animation[0] = icons[0] = [@directory + "tiles", @index[0] * 64 + 128, @index[1] * 64, 704 + (64 * j), 0, 64, 64] + animation[0] = icons[0] = [@directory + "tiles", (@index[0] * 64) + 128, @index[1] * 64, 704 + (64 * j), 0, 64, 64] pbDrawImagePositions(@sprites["animation"].bitmap, animation) pbWait(Graphics.frame_rate / 20) @sprites["animation"].bitmap.clear @@ -296,7 +296,7 @@ class VoltorbFlip # Part2 animation = [] for j in 0...6 - animation[0] = [@directory + "explosion", @index[0] * 64 - 32 + 128, @index[1] * 64 - 32, j * 128, 0, 128, 128] + animation[0] = [@directory + "explosion", (@index[0] * 64) - 32 + 128, (@index[1] * 64) - 32, j * 128, 0, 128, 128] pbDrawImagePositions(@sprites["animation"].bitmap, animation) pbWait(Graphics.frame_rate / 10) @sprites["animation"].bitmap.clear @@ -336,7 +336,7 @@ class VoltorbFlip # Play tile animation animation = [] for j in 0...4 - animation[0] = [@directory + "flipAnimation", @index[0] * 64 - 14 + 128, @index[1] * 64 - 16, j * 92, 0, 92, 96] + animation[0] = [@directory + "flipAnimation", (@index[0] * 64) - 14 + 128, (@index[1] * 64) - 16, j * 92, 0, 92, 96] pbDrawImagePositions(@sprites["animation"].bitmap, animation) pbWait(Graphics.frame_rate / 20) @sprites["animation"].bitmap.clear @@ -441,9 +441,9 @@ class VoltorbFlip numText += num.to_s numImages = numText.split(//)[0...2] for j in 0...2 - @numbers[j] = [@directory + "numbersSmall", 472 + j * 16, i * 64 + 8, numImages[j].to_i * 16, 0, 16, 16] + @numbers[j] = [@directory + "numbersSmall", 472 + (j * 16), (i * 64) + 8, numImages[j].to_i * 16, 0, 16, 16] end - @voltorbNumbers[i] = [@directory + "numbersSmall", 488, i * 64 + 34, voltorbs * 16, 0, 16, 16] + @voltorbNumbers[i] = [@directory + "numbersSmall", 488, (i * 64) + 34, voltorbs * 16, 0, 16, 16] # Display the numbers pbDrawImagePositions(@sprites["numbers"].bitmap, @numbers) pbDrawImagePositions(@sprites["numbers"].bitmap, @voltorbNumbers) @@ -459,7 +459,7 @@ class VoltorbFlip numText += num.to_s numImages = numText.split(//)[0...2] for j in 0...2 - @numbers[j] = [@directory + "numbersSmall", (i * 64) + 152 + j * 16, 328, numImages[j].to_i * 16, 0, 16, 16] + @numbers[j] = [@directory + "numbersSmall", (i * 64) + 152 + (j * 16), 328, numImages[j].to_i * 16, 0, 16, 16] end @voltorbNumbers[i] = [@directory + "numbersSmall", (i * 64) + 168, 354, voltorbs * 16, 0, 16, 16] # Display the numbers @@ -476,7 +476,7 @@ class VoltorbFlip coinText += source.to_s coinImages = coinText.split(//)[0...5] for i in 0...5 - @coins[i] = [@directory + "numbersScore", 6 + i * 24, y, coinImages[i].to_i * 24, 0, 24, 38] + @coins[i] = [@directory + "numbersScore", 6 + (i * 24), y, coinImages[i].to_i * 24, 0, 24, 38] end end diff --git a/Data/Scripts/017_Minigames/006_Minigame_Mining.rb b/Data/Scripts/017_Minigames/006_Minigame_Mining.rb index ccf81fc81..e36b69db3 100644 --- a/Data/Scripts/017_Minigames/006_Minigame_Mining.rb +++ b/Data/Scripts/017_Minigames/006_Minigame_Mining.rb @@ -144,82 +144,82 @@ class MiningGameScene BOARD_WIDTH = 13 BOARD_HEIGHT = 10 ITEMS = [ # Item, probability, graphic x, graphic y, width, height, pattern - [:DOMEFOSSIL, 20, 0, 3, 5, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]], - [:HELIXFOSSIL, 5, 5, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], - [:HELIXFOSSIL, 5, 9, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]], - [:HELIXFOSSIL, 5, 13, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], - [:HELIXFOSSIL, 5, 17, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]], - [:OLDAMBER, 10, 21, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], - [:OLDAMBER, 10, 25, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]], - [:ROOTFOSSIL, 5, 0, 7, 5, 5, [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0]], - [:ROOTFOSSIL, 5, 5, 7, 5, 5, [0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]], - [:ROOTFOSSIL, 5, 10, 7, 5, 5, [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1]], - [:ROOTFOSSIL, 5, 15, 7, 5, 5, [0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0]], - [:SKULLFOSSIL, 20, 20, 7, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0]], - [:ARMORFOSSIL, 20, 24, 7, 5, 4, [0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]], - [:CLAWFOSSIL, 5, 0, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0]], - [:CLAWFOSSIL, 5, 4, 12, 5, 4, [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1]], - [:CLAWFOSSIL, 5, 9, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0]], - [:CLAWFOSSIL, 5, 13, 12, 5, 4, [1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1]], - [:FIRESTONE, 20, 20, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:WATERSTONE, 20, 23, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]], - [:THUNDERSTONE, 20, 26, 11, 3, 3, [0, 1, 1, 1, 1, 1, 1, 1, 0]], - [:LEAFSTONE, 10, 18, 14, 3, 4, [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0]], - [:LEAFSTONE, 10, 21, 14, 4, 3, [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]], - [:MOONSTONE, 10, 25, 14, 4, 2, [0, 1, 1, 1, 1, 1, 1, 0]], - [:MOONSTONE, 10, 27, 16, 2, 4, [1, 0, 1, 1, 1, 1, 0, 1]], - [:SUNSTONE, 20, 21, 17, 3, 3, [0, 1, 0, 1, 1, 1, 1, 1, 1]], - [:OVALSTONE, 150, 24, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:EVERSTONE, 150, 21, 20, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]], - [:STARPIECE, 100, 0, 17, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]], - [:REVIVE, 100, 0, 20, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]], - [:MAXREVIVE, 50, 0, 23, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:RAREBONE, 50, 3, 17, 6, 3, [1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1]], - [:RAREBONE, 50, 3, 20, 3, 6, [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1]], - [:LIGHTCLAY, 100, 6, 20, 4, 4, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1]], - [:HARDSTONE, 200, 6, 24, 2, 2, [1, 1, 1, 1]], - [:HEARTSCALE, 200, 8, 24, 2, 2, [1, 0, 1, 1]], - [:IRONBALL, 100, 9, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:ODDKEYSTONE, 100, 10, 20, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:HEATROCK, 50, 12, 17, 4, 3, [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]], - [:DAMPROCK, 50, 14, 20, 3, 3, [1, 1, 1, 1, 1, 1, 1, 0, 1]], - [:SMOOTHROCK, 50, 17, 18, 4, 4, [0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0]], - [:ICYROCK, 50, 17, 22, 4, 4, [0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1]], - [:REDSHARD, 100, 21, 22, 3, 3, [1, 1, 1, 1, 1, 0, 1, 1, 1]], - [:GREENSHARD, 100, 25, 20, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1]], - [:YELLOWSHARD, 100, 25, 23, 4, 3, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1]], - [:BLUESHARD, 100, 26, 26, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]], - [:INSECTPLATE, 10, 0, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:DREADPLATE, 10, 4, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:DRACOPLATE, 10, 8, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:ZAPPLATE, 10, 12, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:FISTPLATE, 10, 16, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:FLAMEPLATE, 10, 20, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:MEADOWPLATE, 10, 0, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:EARTHPLATE, 10, 4, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:ICICLEPLATE, 10, 8, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:TOXICPLATE, 10, 12, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:MINDPLATE, 10, 16, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:STONEPLATE, 10, 20, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:SKYPLATE, 10, 0, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:SPOOKYPLATE, 10, 4, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:IRONPLATE, 10, 8, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], - [:SPLASHPLATE, 10, 12, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]] + [:DOMEFOSSIL, 20, 0, 3, 5, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]], + [:HELIXFOSSIL, 5, 5, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], + [:HELIXFOSSIL, 5, 9, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]], + [:HELIXFOSSIL, 5, 13, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], + [:HELIXFOSSIL, 5, 17, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]], + [:OLDAMBER, 10, 21, 3, 4, 4, [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], + [:OLDAMBER, 10, 25, 3, 4, 4, [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1]], + [:ROOTFOSSIL, 5, 0, 7, 5, 5, [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0]], + [:ROOTFOSSIL, 5, 5, 7, 5, 5, [0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]], + [:ROOTFOSSIL, 5, 10, 7, 5, 5, [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1]], + [:ROOTFOSSIL, 5, 15, 7, 5, 5, [0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0]], + [:SKULLFOSSIL, 20, 20, 7, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0]], + [:ARMORFOSSIL, 20, 24, 7, 5, 4, [0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0]], + [:CLAWFOSSIL, 5, 0, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0]], + [:CLAWFOSSIL, 5, 4, 12, 5, 4, [1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1]], + [:CLAWFOSSIL, 5, 9, 12, 4, 5, [0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0]], + [:CLAWFOSSIL, 5, 13, 12, 5, 4, [1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1]], + [:FIRESTONE, 20, 20, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:WATERSTONE, 20, 23, 11, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]], + [:THUNDERSTONE, 20, 26, 11, 3, 3, [0, 1, 1, 1, 1, 1, 1, 1, 0]], + [:LEAFSTONE, 10, 18, 14, 3, 4, [0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0]], + [:LEAFSTONE, 10, 21, 14, 4, 3, [0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]], + [:MOONSTONE, 10, 25, 14, 4, 2, [0, 1, 1, 1, 1, 1, 1, 0]], + [:MOONSTONE, 10, 27, 16, 2, 4, [1, 0, 1, 1, 1, 1, 0, 1]], + [:SUNSTONE, 20, 21, 17, 3, 3, [0, 1, 0, 1, 1, 1, 1, 1, 1]], + [:OVALSTONE, 150, 24, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:EVERSTONE, 150, 21, 20, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]], + [:STARPIECE, 100, 0, 17, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]], + [:REVIVE, 100, 0, 20, 3, 3, [0, 1, 0, 1, 1, 1, 0, 1, 0]], + [:MAXREVIVE, 50, 0, 23, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:RAREBONE, 50, 3, 17, 6, 3, [1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1]], + [:RAREBONE, 50, 3, 20, 3, 6, [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1]], + [:LIGHTCLAY, 100, 6, 20, 4, 4, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1]], + [:HARDSTONE, 200, 6, 24, 2, 2, [1, 1, 1, 1]], + [:HEARTSCALE, 200, 8, 24, 2, 2, [1, 0, 1, 1]], + [:IRONBALL, 100, 9, 17, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:ODDKEYSTONE, 100, 10, 20, 4, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:HEATROCK, 50, 12, 17, 4, 3, [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]], + [:DAMPROCK, 50, 14, 20, 3, 3, [1, 1, 1, 1, 1, 1, 1, 0, 1]], + [:SMOOTHROCK, 50, 17, 18, 4, 4, [0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0]], + [:ICYROCK, 50, 17, 22, 4, 4, [0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1]], + [:REDSHARD, 100, 21, 22, 3, 3, [1, 1, 1, 1, 1, 0, 1, 1, 1]], + [:GREENSHARD, 100, 25, 20, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1]], + [:YELLOWSHARD, 100, 25, 23, 4, 3, [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1]], + [:BLUESHARD, 100, 26, 26, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 0]], + [:INSECTPLATE, 10, 0, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:DREADPLATE, 10, 4, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:DRACOPLATE, 10, 8, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:ZAPPLATE, 10, 12, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:FISTPLATE, 10, 16, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:FLAMEPLATE, 10, 20, 26, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:MEADOWPLATE, 10, 0, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:EARTHPLATE, 10, 4, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:ICICLEPLATE, 10, 8, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:TOXICPLATE, 10, 12, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:MINDPLATE, 10, 16, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:STONEPLATE, 10, 20, 29, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:SKYPLATE, 10, 0, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:SPOOKYPLATE, 10, 4, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:IRONPLATE, 10, 8, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], + [:SPLASHPLATE, 10, 12, 32, 4, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]] ] IRON = [ # Graphic x, graphic y, width, height, pattern - [0, 0, 1, 4, [1, 1, 1, 1]], - [1, 0, 2, 4, [1, 1, 1, 1, 1, 1, 1, 1]], - [3, 0, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]], - [3, 2, 4, 1, [1, 1, 1, 1]], - [7, 0, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], - [0, 5, 3, 2, [1, 1, 0, 0, 1, 1]], - [0, 7, 3, 2, [0, 1, 0, 1, 1, 1]], - [3, 5, 3, 2, [0, 1, 1, 1, 1, 0]], - [3, 7, 3, 2, [1, 1, 1, 0, 1, 0]], - [6, 3, 2, 3, [1, 0, 1, 1, 0, 1]], - [8, 3, 2, 3, [0, 1, 1, 1, 1, 0]], - [6, 6, 2, 3, [1, 0, 1, 1, 1, 0]], - [8, 6, 2, 3, [0, 1, 1, 1, 0, 1]] + [0, 0, 1, 4, [1, 1, 1, 1]], + [1, 0, 2, 4, [1, 1, 1, 1, 1, 1, 1, 1]], + [3, 0, 4, 2, [1, 1, 1, 1, 1, 1, 1, 1]], + [3, 2, 4, 1, [1, 1, 1, 1]], + [7, 0, 3, 3, [1, 1, 1, 1, 1, 1, 1, 1, 1]], + [0, 5, 3, 2, [1, 1, 0, 0, 1, 1]], + [0, 7, 3, 2, [0, 1, 0, 1, 1, 1]], + [3, 5, 3, 2, [0, 1, 1, 1, 1, 0]], + [3, 7, 3, 2, [1, 1, 1, 0, 1, 0]], + [6, 3, 2, 3, [1, 0, 1, 1, 0, 1]], + [8, 3, 2, 3, [0, 1, 1, 1, 1, 0]], + [6, 6, 2, 3, [1, 0, 1, 1, 1, 0]], + [8, 6, 2, 3, [0, 1, 1, 1, 0, 1]] ] def update @@ -241,7 +241,7 @@ class MiningGameScene pbDistributeIron for i in 0...BOARD_HEIGHT for j in 0...BOARD_WIDTH - @sprites["tile#{j + i * BOARD_WIDTH}"] = MiningGameTile.new(32 * j, 64 + 32 * i) + @sprites["tile#{j + (i * BOARD_WIDTH)}"] = MiningGameTile.new(32 * j, 64 + (32 * i)) end end @sprites["crack"] = MiningGameCounter.new(0, 4) @@ -293,7 +293,7 @@ class MiningGameScene oy = ITEMS[i[0]][3] rectx = ITEMS[i[0]][4] recty = ITEMS[i[0]][5] - layer.blt(32 * i[1], 64 + 32 * i[2], @itembitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty)) + layer.blt(32 * i[1], 64 + (32 * i[2]), @itembitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty)) end end @@ -319,7 +319,7 @@ class MiningGameScene oy = IRON[i[0]][1] rectx = IRON[i[0]][2] recty = IRON[i[0]][3] - layer.blt(32 * i[1], 64 + 32 * i[2], @ironbitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty)) + layer.blt(32 * i[1], 64 + (32 * i[2]), @ironbitmap.bitmap, Rect.new(32 * ox, 32 * oy, 32 * rectx, 32 * recty)) end end @@ -354,7 +354,7 @@ class MiningGameScene yco = prey + (j / prewidth).floor next if provx + provwidth <= xco || provx > xco || provy + provheight <= yco || provy > yco - return false if provpattern[xco - provx + (yco - provy) * provwidth] == 1 + return false if provpattern[xco - provx + ((yco - provy) * provwidth)] == 1 end end if checkiron # Check other irons as well @@ -372,7 +372,7 @@ class MiningGameScene yco = prey + (j / prewidth).floor next if provx + provwidth <= xco || provx > xco || provy + provheight <= yco || provy > yco - return false if provpattern[xco - provx + (yco - provy) * provwidth] == 1 + return false if provpattern[xco - provx + ((yco - provy) * provwidth)] == 1 end end end @@ -399,12 +399,12 @@ class MiningGameScene hittype = 2 else for i in 0..2 - ytile = i - 1 + position / BOARD_WIDTH + ytile = i - 1 + (position / BOARD_WIDTH) next if ytile < 0 || ytile >= BOARD_HEIGHT for j in 0..2 - xtile = j - 1 + position % BOARD_WIDTH + xtile = j - 1 + (position % BOARD_WIDTH) next if xtile < 0 || xtile >= BOARD_WIDTH - @sprites["tile#{xtile + ytile * BOARD_WIDTH}"].layer -= pattern[j + i * 3] + @sprites["tile#{xtile + (ytile * BOARD_WIDTH)}"].layer -= pattern[j + (i * 3)] end end if @sprites["cursor"].mode == 1 # Hammer @@ -439,7 +439,7 @@ class MiningGameScene next if posy < i[2] || posy >= (i[2] + height) dx = posx - i[1] dy = posy - i[2] - return true if pattern[dx + dy * width] > 0 + return true if pattern[dx + (dy * width)] > 0 end return false end @@ -456,7 +456,7 @@ class MiningGameScene next if posy < i[2] || posy >= (i[2] + height) dx = posx - i[1] dy = posy - i[2] - return true if pattern[dx + dy * width] > 0 + return true if pattern[dx + (dy * width)] > 0 end return false end @@ -472,8 +472,8 @@ class MiningGameScene pattern = ITEMS[index][6] for j in 0...height for k in 0...width - layer = @sprites["tile#{@items[i][1] + k + (@items[i][2] + j) * BOARD_WIDTH}"].layer - revealed = false if layer > 0 && pattern[k + j * width] > 0 + layer = @sprites["tile#{@items[i][1] + k + ((@items[i][2] + j) * BOARD_WIDTH)}"].layer + revealed = false if layer > 0 && pattern[k + (j * width)] > 0 break if !revealed end break if !revealed @@ -491,12 +491,12 @@ class MiningGameScene for i in 1..halfFlashTime * 2 for index in revealed burieditem = @items[index] - revealeditems.bitmap.blt(32 * burieditem[1], 64 + 32 * burieditem[2], + revealeditems.bitmap.blt(32 * burieditem[1], 64 + (32 * burieditem[2]), @itembitmap.bitmap, Rect.new(32 * ITEMS[burieditem[0]][2], 32 * ITEMS[burieditem[0]][3], 32 * ITEMS[burieditem[0]][4], 32 * ITEMS[burieditem[0]][5])) if i > halfFlashTime - revealeditems.color = Color.new(255, 255, 255, (halfFlashTime * 2 - i) * alphaDiff) + revealeditems.color = Color.new(255, 255, 255, ((halfFlashTime * 2) - i) * alphaDiff) else revealeditems.color = Color.new(255, 255, 255, i * alphaDiff) end @@ -575,7 +575,7 @@ class MiningGameScene newmode = (@sprites["cursor"].mode + 1) % 2 @sprites["cursor"].mode = newmode @sprites["tool"].src_rect.set(newmode * 68, 0, 68, 100) - @sprites["tool"].y = 254 - 144 * newmode + @sprites["tool"].y = 254 - (144 * newmode) elsif Input.trigger?(Input::USE) # Hit pbHit elsif Input.trigger?(Input::BACK) # Quit diff --git a/Data/Scripts/017_Minigames/007_Minigame_TilePuzzles.rb b/Data/Scripts/017_Minigames/007_Minigame_TilePuzzles.rb index cb6a1895b..604f5e4c4 100644 --- a/Data/Scripts/017_Minigames/007_Minigame_TilePuzzles.rb +++ b/Data/Scripts/017_Minigames/007_Minigame_TilePuzzles.rb @@ -43,13 +43,13 @@ class TilePuzzleCursor < BitmapSprite self.bitmap.clear x = (Graphics.width - (@tilewidth * @boardwidth)) / 2 if @position >= @boardwidth * @boardheight - x = (x - (@tilewidth * (@boardwidth / 2).ceil)) / 2 - 10 + x = ((x - (@tilewidth * (@boardwidth / 2).ceil)) / 2) - 10 if (@position % @boardwidth) >= (@boardwidth / 2).ceil - x = Graphics.width - x - @tilewidth * @boardwidth + x = Graphics.width - x - (@tilewidth * @boardwidth) end end x += @tilewidth * (@position % @boardwidth) - y = (Graphics.height - (@tileheight * @boardheight)) / 2 - 32 + y = ((Graphics.height - (@tileheight * @boardheight)) / 2) - 32 y += @tileheight * ((@position % (@boardwidth * @boardheight)) / @boardwidth) self.tone = Tone.new(0, (@holding ? 64 : 0), (@holding ? 64 : 0), 0) # Cursor @@ -57,8 +57,8 @@ class TilePuzzleCursor < BitmapSprite expand = (@holding) ? 0 : 4 for i in 0...4 self.bitmap.blt( - x + (i % 2) * (@tilewidth - @cursorbitmap.width / 4) + expand * (((i % 2) * 2) - 1), - y + (i / 2) * (@tileheight - @cursorbitmap.height / 2) + expand * (((i / 2) * 2) - 1), + x + ((i % 2) * (@tilewidth - (@cursorbitmap.width / 4))) + (expand * (((i % 2) * 2) - 1)), + y + ((i / 2) * (@tileheight - (@cursorbitmap.height / 2))) + (expand * (((i / 2) * 2) - 1)), @cursorbitmap.bitmap, Rect.new((i % 2) * @cursorbitmap.width / 4, (i / 2) * @cursorbitmap.height / 2, @cursorbitmap.width / 4, @cursorbitmap.height / 2) @@ -68,14 +68,14 @@ class TilePuzzleCursor < BitmapSprite # Arrows if @selected || @game == 3 expand = (@game == 3) ? 0 : 4 - xin = [(@tilewidth - @cursorbitmap.width / 4) / 2, -expand, - @tilewidth - @cursorbitmap.width / 4 + expand, (@tilewidth - @cursorbitmap.width / 4) / 2] - yin = [@tileheight - @cursorbitmap.height / 2 + expand, (@tileheight - @cursorbitmap.height / 2) / 2, - (@tileheight - @cursorbitmap.height / 2) / 2, -expand] + xin = [(@tilewidth - (@cursorbitmap.width / 4)) / 2, -expand, + @tilewidth - (@cursorbitmap.width / 4) + expand, (@tilewidth - (@cursorbitmap.width / 4)) / 2] + yin = [@tileheight - (@cursorbitmap.height / 2) + expand, (@tileheight - (@cursorbitmap.height / 2)) / 2, + (@tileheight - (@cursorbitmap.height / 2)) / 2, -expand] for i in 0...4 if @arrows[i] self.bitmap.blt(x + xin[i], y + yin[i], @cursorbitmap.bitmap, - Rect.new(@cursorbitmap.width / 2 + (i % 2) * (@cursorbitmap.width / 4), + Rect.new((@cursorbitmap.width / 2) + ((i % 2) * (@cursorbitmap.width / 4)), (i / 2) * (@cursorbitmap.height / 2), @cursorbitmap.width / 4, @cursorbitmap.height / 2)) end @@ -96,7 +96,7 @@ class TilePuzzleScene def update xtop = (Graphics.width - (@tilewidth * @boardwidth)) / 2 - ytop = (Graphics.height - (@tileheight * @boardheight)) / 2 + @tileheight / 2 - 32 + ytop = ((Graphics.height - (@tileheight * @boardheight)) / 2) + (@tileheight / 2) - 32 for i in 0...@boardwidth * @boardheight pos = -1 for j in 0...@tiles.length @@ -112,13 +112,13 @@ class TilePuzzleScene thisx = xtop if pos >= 0 if pos >= @boardwidth * @boardheight - thisx = (xtop - (@tilewidth * (@boardwidth / 2).ceil)) / 2 - 10 + thisx = ((xtop - (@tilewidth * (@boardwidth / 2).ceil)) / 2) - 10 if (pos % @boardwidth) >= (@boardwidth / 2).ceil - thisx = Graphics.width - thisx - @tilewidth * @boardwidth + thisx = Graphics.width - thisx - (@tilewidth * @boardwidth) end end - @sprites["tile#{i}"].x = thisx + @tilewidth * (pos % @boardwidth) + @tilewidth / 2 - @sprites["tile#{i}"].y = ytop + @tileheight * ((pos % (@boardwidth * @boardheight)) / @boardwidth) + @sprites["tile#{i}"].x = thisx + (@tilewidth * (pos % @boardwidth)) + (@tilewidth / 2) + @sprites["tile#{i}"].y = ytop + (@tileheight * ((pos % (@boardwidth * @boardheight)) / @boardwidth)) next if @game == 3 rotatebitmaps = [@tilebitmap, @tilebitmap1, @tilebitmap2, @tilebitmap3] @sprites["tile#{i}"].bitmap.clear @@ -173,7 +173,7 @@ class TilePuzzleScene @sprites["tile#{i}"] = BitmapSprite.new(@tilewidth, @tileheight, @viewport) @sprites["tile#{i}"].ox = @tilewidth / 2 @sprites["tile#{i}"].oy = @tileheight / 2 - break if @game == 3 && i >= @boardwidth * @boardheight - 1 + break if @game == 3 && i >= (@boardwidth * @boardheight) - 1 @sprites["tile#{i}"].bitmap.blt(0, 0, @tilebitmap.bitmap, Rect.new(@tilewidth * (i % @boardwidth), @tileheight * (i / @boardwidth), @tilewidth, @tileheight)) end @@ -210,17 +210,16 @@ class TilePuzzleScene num = 0 blank = -1 for i in 0...ret.length - 1 - blank = i if ret[i] == @boardwidth * @boardheight - 1 + blank = i if ret[i] == (@boardwidth * @boardheight) - 1 for j in i...ret.length - num += 1 if ret[j] < ret[i] && ret[i] != @boardwidth * @boardheight - 1 && - ret[j] != @boardwidth * @boardheight - 1 + num += 1 if ret[j] < ret[i] && ret[i] != (@boardwidth * @boardheight) - 1 && + ret[j] != (@boardwidth * @boardheight) - 1 end end if @boardwidth.odd? ret = pbShuffleTiles if num.odd? - else - ret = pbShuffleTiles if !((num.even? && (@boardheight - (blank / @boardwidth)).odd?) || - (num.odd? && (@boardheight - (blank / @boardwidth)).even?)) + elsif num.even? == (@boardheight - (blank / @boardwidth)).even? + ret = pbShuffleTiles end end if @game == 1 || @game == 2 @@ -242,7 +241,7 @@ class TilePuzzleScene def pbDefaultCursorPosition if @game == 3 for i in 0...@boardwidth * @boardheight - return i if @tiles[i] == @boardwidth * @boardheight - 1 + return i if @tiles[i] == (@boardwidth * @boardheight) - 1 end end return 0 @@ -255,16 +254,14 @@ class TilePuzzleScene when 4 if pos >= @boardwidth * @boardheight if pos % @boardwidth == (@boardwidth / 2).ceil - pos = ((pos % (@boardwidth * @boardheight)) / @boardwidth) * @boardwidth + @boardwidth - 1 + pos = (((pos % (@boardwidth * @boardheight)) / @boardwidth) * @boardwidth) + @boardwidth - 1 else pos -= 1 end + elsif (pos % @boardwidth) == 0 + pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil - 1 else - if (pos % @boardwidth) == 0 - pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil - 1 - else - pos -= 1 - end + pos -= 1 end when 6 if pos >= @boardwidth * @boardheight @@ -273,12 +270,10 @@ class TilePuzzleScene else pos += 1 end + elsif pos % @boardwidth >= @boardwidth - 1 + pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil else - if pos % @boardwidth >= @boardwidth - 1 - pos = (((pos / @boardwidth) + @boardheight) * @boardwidth) + (@boardwidth / 2).ceil - else - pos += 1 - end + pos += 1 end when 8 pos -= @boardwidth @@ -420,7 +415,7 @@ class TilePuzzleScene cursor += (@boardwidth * dist) end for i in 0...@boardheight - tiles.push(cursor - i * dist * @boardwidth) + tiles.push(cursor - (i * dist * @boardwidth)) end else dist = dir - 5 @@ -429,7 +424,7 @@ class TilePuzzleScene cursor -= dist end for i in 0...@boardwidth - tiles.push(cursor + i * dist) + tiles.push(cursor + (i * dist)) end end # Shift tiles @@ -508,7 +503,7 @@ class TilePuzzleScene if pbCheckWin @sprites["cursor"].visible = false if @game == 3 - extratile = @sprites["tile#{@boardwidth * @boardheight - 1}"] + extratile = @sprites["tile#{(@boardwidth * @boardheight) - 1}"] extratile.bitmap.clear extratile.bitmap.blt(0, 0, @tilebitmap.bitmap, Rect.new(@tilewidth * (@boardwidth - 1), @tileheight * (@boardheight - 1), diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/002_Challenge_Data.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/002_Challenge_Data.rb index 0ca054fb8..bb7340943 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/002_Challenge_Data.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/002_Challenge_Data.rb @@ -203,7 +203,7 @@ class PBPokemon def createPokemon(level, iv, trainer) pkmn = Pokemon.new(@species, level, trainer, false) pkmn.item = @item - pkmn.personalID = rand(2**16) | rand(2**16) << 16 + pkmn.personalID = rand(2**16) | (rand(2**16) << 16) pkmn.nature = nature pkmn.happiness = 0 pkmn.moves.push(Pokemon::Move.new(self.convertMove(@move1))) diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb index 448f63ca2..dd13968a1 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb @@ -7,21 +7,21 @@ def pbBattleChallengeTrainer(win_count, bttrainers) # This table's start points and lengths are based on a bttrainers size of 300. # They are scaled based on the actual size of bttrainers later. table = [ # Each value is [minimum win count, range start point, range length] - [ 0, 0, 100], # 0-100 - [ 6, 80, 40], # 80-120 - [ 7, 80, 40], # 80-120 - [13, 120, 20], # 120-140 - [14, 100, 40], # 100-140 - [20, 140, 20], # 140-160 - [21, 120, 40], # 120-160 - [27, 160, 20], # 160-180 - [28, 140, 40], # 140-180 - [34, 180, 20], # 180-200 - [35, 160, 40], # 160-200 - [41, 200, 20], # 200-220 - [42, 180, 40], # 180-220 - [48, 220, 40], # 220-260 - [49, 200, 100] # 200-300 - This line is used for all higher win_counts + [ 0, 0, 100], # 0-100 + [ 6, 80, 40], # 80-120 + [ 7, 80, 40], # 80-120 + [13, 120, 20], # 120-140 + [14, 100, 40], # 100-140 + [20, 140, 20], # 140-160 + [21, 120, 40], # 120-160 + [27, 160, 20], # 160-180 + [28, 140, 40], # 140-180 + [34, 180, 20], # 180-200 + [35, 160, 40], # 160-200 + [41, 200, 20], # 200-220 + [42, 180, 40], # 180-220 + [48, 220, 40], # 220-260 + [49, 200, 100] # 200-300 - This line is used for all higher win_counts ] slot = nil table.each { |val| slot = val if val[0] <= win_count && (!slot || slot[0] < val[0]) } @@ -99,25 +99,25 @@ def pbBattleFactoryPokemon(rules, win_count, swap_count, rentals) # Group 1 is 0 - 173. Group 2 is 174 - 371. Group 3 is 372 - 881. if level == GameData::GrowthRate.max_level # Open Level (Level 100) table = [ - [372, 491], # Group 3 (first quarter) - [492, 610], # Group 3 (second quarter) - [611, 729], # Group 3 (third quarter) - [730, 849], # Group 3 (fourth quarter) - [372, 881], # All of Group 3 - [372, 881], # All of Group 3 - [372, 881], # All of Group 3 - [372, 881] # This line is used for all higher sets (all of Group 3) + [372, 491], # Group 3 (first quarter) + [492, 610], # Group 3 (second quarter) + [611, 729], # Group 3 (third quarter) + [730, 849], # Group 3 (fourth quarter) + [372, 881], # All of Group 3 + [372, 881], # All of Group 3 + [372, 881], # All of Group 3 + [372, 881] # This line is used for all higher sets (all of Group 3) ] else table = [ - [ 0, 173], # Group 1 - [174, 272], # Group 2 (first half) - [273, 371], # Group 2 (second half) - [372, 491], # Group 3 (first quarter) - [492, 610], # Group 3 (second quarter) - [611, 729], # Group 3 (third quarter) - [730, 849], # Group 3 (fourth quarter) - [372, 881] # This line is used for all higher sets (all of Group 3) + [ 0, 173], # Group 1 + [174, 272], # Group 2 (first half) + [273, 371], # Group 2 (second half) + [372, 491], # Group 3 (first quarter) + [492, 610], # Group 3 (second quarter) + [611, 729], # Group 3 (third quarter) + [730, 849], # Group 3 (fourth quarter) + [372, 881] # This line is used for all higher sets (all of Group 3) ] end pokemonNumbers[0] = table[set][0] * btpokemon.length / 881 diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb index d96718d0f..a5235d4f4 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb @@ -229,12 +229,10 @@ class BattleSwapScreen end end end - else + elsif @scene.pbConfirm(_INTL("Quit swapping?")) # Canceled - if @scene.pbConfirm(_INTL("Quit swapping?")) - @scene.pbEndScene - return false - end + @scene.pbEndScene + return false end end end diff --git a/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb b/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb index defb575ac..cc8062d19 100644 --- a/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb +++ b/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb @@ -52,9 +52,10 @@ class PokemonRuleSet maxLevel = GameData::GrowthRate.max_level num = self.suggestedNumber for rule in @pokemonRules - if rule.is_a?(MinimumLevelRestriction) + case rule + when MinimumLevelRestriction minLevel = rule.level - elsif rule.is_a?(MaximumLevelRestriction) + when MaximumLevelRestriction maxLevel = rule.level end end @@ -203,8 +204,8 @@ class PokemonRuleSet next if isPokemonValid?(pkmn) if pkmn error.push(_INTL("{1} is not allowed.", pkmn.name)) if error - else - error.push(_INTL("This team is not allowed.")) if error + elsif error + error.push(_INTL("This team is not allowed.")) end return false end diff --git a/Data/Scripts/018_Alternate battle modes/002_BugContest.rb b/Data/Scripts/018_Alternate battle modes/002_BugContest.rb index 495a23180..dfe419c6f 100644 --- a/Data/Scripts/018_Alternate battle modes/002_BugContest.rb +++ b/Data/Scripts/018_Alternate battle modes/002_BugContest.rb @@ -5,14 +5,14 @@ class BugContestState attr_reader :timer CONTESTANT_NAMES = [ - _INTL("Bug Catcher Ed"), - _INTL("Bug Catcher Benny"), - _INTL("Bug Catcher Josh"), - _INTL("Camper Barry"), - _INTL("Cool Trainer Nick"), - _INTL("Lass Abby"), - _INTL("Picnicker Cindy"), - _INTL("Youngster Samuel") + _INTL("Bug Catcher Ed"), + _INTL("Bug Catcher Benny"), + _INTL("Bug Catcher Josh"), + _INTL("Camper Barry"), + _INTL("Cool Trainer Nick"), + _INTL("Lass Abby"), + _INTL("Picnicker Cindy"), + _INTL("Youngster Samuel") ] TIME_ALLOWED = Settings::BUG_CONTEST_TIME @@ -30,7 +30,7 @@ class BugContestState def expired? return false if !undecided? return false if TIME_ALLOWED <= 0 - curtime = @timer + TIME_ALLOWED * Graphics.frame_rate + curtime = @timer + (TIME_ALLOWED * Graphics.frame_rate) curtime = [curtime - Graphics.frame_count, 0].max return (curtime <= 0) end diff --git a/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/001_ChallengeGenerator_Data.rb b/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/001_ChallengeGenerator_Data.rb index 9b252df7d..26154d8c7 100644 --- a/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/001_ChallengeGenerator_Data.rb +++ b/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/001_ChallengeGenerator_Data.rb @@ -68,15 +68,15 @@ end def pbArrangeByTier(pokemonlist, rule) tiers = [ - withRestr(rule, 0, 500, 0), - withRestr(rule, 380, 500, 0), - withRestr(rule, 400, 555, 0), - withRestr(rule, 400, 555, 0), - withRestr(rule, 400, 555, 0), - withRestr(rule, 400, 555, 0), - withRestr(rule, 580, 680, 1), - withRestr(rule, 500, 680, 0), - withRestr(rule, 580, 680, 2) + withRestr(rule, 0, 500, 0), + withRestr(rule, 380, 500, 0), + withRestr(rule, 400, 555, 0), + withRestr(rule, 400, 555, 0), + withRestr(rule, 400, 555, 0), + withRestr(rule, 400, 555, 0), + withRestr(rule, 580, 680, 1), + withRestr(rule, 500, 680, 0), + withRestr(rule, 580, 680, 2) ] tierPokemon = [] tiers.length.times do diff --git a/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/002_ChallengeGenerator_Pokemon.rb b/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/002_ChallengeGenerator_Pokemon.rb index cfa7939da..87689d895 100644 --- a/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/002_ChallengeGenerator_Pokemon.rb +++ b/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/002_ChallengeGenerator_Pokemon.rb @@ -196,15 +196,15 @@ def pbRandomPokemonFromRule(rules, trainer) $legalMovesLevel = level $legalMoves[species] = pbGetLegalMoves2(species, level) if !$legalMoves[species] itemlist = [ - :ORANBERRY, :SITRUSBERRY, :ADAMANTORB, :BABIRIBERRY, - :BLACKSLUDGE, :BRIGHTPOWDER, :CHESTOBERRY, :CHOICEBAND, - :CHOICESCARF, :CHOICESPECS, :CHOPLEBERRY, :DAMPROCK, - :DEEPSEATOOTH, :EXPERTBELT, :FLAMEORB, :FOCUSSASH, - :FOCUSBAND, :HEATROCK, :LEFTOVERS, :LIFEORB, :LIGHTBALL, - :LIGHTCLAY, :LUMBERRY, :OCCABERRY, :PETAYABERRY, :SALACBERRY, - :SCOPELENS, :SHEDSHELL, :SHELLBELL, :SHUCABERRY, :LIECHIBERRY, - :SILKSCARF, :THICKCLUB, :TOXICORB, :WIDELENS, :YACHEBERRY, - :HABANBERRY, :SOULDEW, :PASSHOBERRY, :QUICKCLAW, :WHITEHERB + :ORANBERRY, :SITRUSBERRY, :ADAMANTORB, :BABIRIBERRY, + :BLACKSLUDGE, :BRIGHTPOWDER, :CHESTOBERRY, :CHOICEBAND, + :CHOICESCARF, :CHOICESPECS, :CHOPLEBERRY, :DAMPROCK, + :DEEPSEATOOTH, :EXPERTBELT, :FLAMEORB, :FOCUSSASH, + :FOCUSBAND, :HEATROCK, :LEFTOVERS, :LIFEORB, :LIGHTBALL, + :LIGHTCLAY, :LUMBERRY, :OCCABERRY, :PETAYABERRY, :SALACBERRY, + :SCOPELENS, :SHEDSHELL, :SHELLBELL, :SHUCABERRY, :LIECHIBERRY, + :SILKSCARF, :THICKCLUB, :TOXICORB, :WIDELENS, :YACHEBERRY, + :HABANBERRY, :SOULDEW, :PASSHOBERRY, :QUICKCLAW, :WHITEHERB ] # Most used: Leftovers, Life Orb, Choice Band, Choice Scarf, Focus Sash item = nil diff --git a/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/004_ChallengeGenerator_BattleSim.rb b/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/004_ChallengeGenerator_BattleSim.rb index 0d6126a9f..4f0917e85 100644 --- a/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/004_ChallengeGenerator_BattleSim.rb +++ b/Data/Scripts/018_Alternate battle modes/003_Battle Frontier generator/004_ChallengeGenerator_BattleSim.rb @@ -146,7 +146,7 @@ class PlayerRatingElo def winChancePercent return @estimatedRating if @estimatedRating - x = (1 + 10.0**((@rating - 1600.0) / 400.0)) + x = (1 + (10.0**((@rating - 1600.0) / 400.0))) @estimatedRating = (x == 0 ? 1.0 : 1.0 / x) return @estimatedRating end @@ -156,7 +156,7 @@ class PlayerRatingElo stake = 0 matches.length.times do score = (match.score == -1) ? 0.5 : match.score - e = (1 + 10.0**((@rating - match.opponentRating) / 400.0)) + e = (1 + (10.0**((@rating - match.opponentRating) / 400.0))) stake += match.kValue * (score - e) end @rating += stake @@ -184,7 +184,7 @@ 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(100000.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 @@ -192,7 +192,7 @@ class PlayerRating rds = @deviation * @deviation sqr = Math.sqrt(15.905694331435 * (rds + 221781.21786254)) inner = (1500.0 - @rating) * Math::PI / sqr - @estimatedRating = (10000.0 / (1.0 + (10.0**inner)) + 0.5) / 100.0 + @estimatedRating = ((10000.0 / (1.0 + (10.0**inner))) + 0.5) / 100.0 end return @estimatedRating end @@ -202,7 +202,7 @@ class PlayerRating deviation = deviation2 rating = rating2 if matches.length == 0 - setDeviation2(Math.sqrt(deviation * deviation + volatility * volatility)) + setDeviation2(Math.sqrt((deviation * deviation) + (volatility * volatility))) return end g = [] @@ -228,10 +228,10 @@ class PlayerRating end volatility = getUpdatedVolatility(volatility, deviation, variance, sum, system) # Update deviation - t = deviation * deviation + volatility * volatility - deviation = 1.0 / Math.sqrt(1.0 / t + 1.0 / variance) + t = (deviation * deviation) + (volatility * volatility) + deviation = 1.0 / Math.sqrt((1.0 / t) + (1.0 / variance)) # Update rating - rating = rating + deviation * deviation * sum + rating = rating + (deviation * deviation * sum) setRating2(rating) setDeviation2(deviation) setVolatility2(volatility) @@ -254,7 +254,7 @@ class PlayerRating def getGFactor(deviation) # deviation is not yet in glicko2 deviation /= 173.7178 - return 1.0 / Math.sqrt(1.0 + (3.0 * deviation * deviation) / (Math::PI * Math::PI)) + return 1.0 / Math.sqrt(1.0 + ((3.0 * deviation * deviation) / (Math::PI * Math::PI))) end def getEFactor(rating, opponentRating, g) @@ -291,8 +291,8 @@ class PlayerRating d = squDevplusVar + e squD = d * d i = improvement / d - h1 = -(x0 - a) / squSystem - 0.5 * e * i * i - h2 = -1.0 / squSystem - 0.5 * e * squDevplusVar / squD + h1 = (-(x0 - a) / squSystem) - (0.5 * e * i * i) + h2 = (-1.0 / squSystem) - (0.5 * e * squDevplusVar / squD) h2 += 0.5 * squVariance * e * (squDevplusVar - e) / (squD * d) x1 = x0 x0 -= h1 / h2 diff --git a/Data/Scripts/019_Utilities/001_Utilities.rb b/Data/Scripts/019_Utilities/001_Utilities.rb index 03dd59fa3..a5d526576 100644 --- a/Data/Scripts/019_Utilities/001_Utilities.rb +++ b/Data/Scripts/019_Utilities/001_Utilities.rb @@ -450,14 +450,12 @@ def pbMoveTutorChoose(move, movelist = nil, bymachine = false, oneusemachine = f pbMessage(_INTL("{1} can't learn {2}.", pokemon.name, movename)) { screen.pbUpdate } elsif !pokemon.compatible_with_move?(move) pbMessage(_INTL("{1} can't learn {2}.", pokemon.name, movename)) { screen.pbUpdate } - else - if pbLearnMove(pokemon, move, false, bymachine) { screen.pbUpdate } - $stats.moves_taught_by_item += 1 if bymachine - $stats.moves_taught_by_tutor += 1 if !bymachine - pokemon.add_first_move(move) if oneusemachine - ret = true - break - end + elsif pbLearnMove(pokemon, move, false, bymachine) { screen.pbUpdate } + $stats.moves_taught_by_item += 1 if bymachine + $stats.moves_taught_by_tutor += 1 if !bymachine + pokemon.add_first_move(move) if oneusemachine + ret = true + break end end screen.pbEndScene @@ -470,7 +468,7 @@ def pbConvertItemToItem(variable, array) pbSet(variable, nil) for i in 0...(array.length / 2) next if item != array[2 * i] - pbSet(variable, array[2 * i + 1]) + pbSet(variable, array[(2 * i) + 1]) return end end @@ -480,7 +478,7 @@ def pbConvertItemToPokemon(variable, array) pbSet(variable, nil) for i in 0...(array.length / 2) next if item != array[2 * i] - pbSet(variable, GameData::Species.get(array[2 * i + 1]).id) + pbSet(variable, GameData::Species.get(array[(2 * i) + 1]).id) return end end diff --git a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb index 946b0bf3e..6da1d54a9 100644 --- a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb +++ b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb @@ -207,7 +207,7 @@ def pbSize(pkmn) spiv = pkmn.iv[:SPEED] & 15 m = pkmn.personalID & 0xFF n = (pkmn.personalID >> 8) & 0xFF - s = (((ativ ^ dfiv) * hpiv) ^ m) * 256 + (((saiv ^ sdiv) * spiv) ^ n) + 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] @@ -225,7 +225,7 @@ def pbSize(pkmn) elsif s < 65410 then xyz = [1500, 2, 65210] else xyz = [1700, 1, 65510] end - return (((s - xyz[2]) / xyz[1] + xyz[0]).floor * baseheight / 10).floor + return ((((s - xyz[2]) / xyz[1]) + xyz[0]).floor * baseheight / 10).floor end #=============================================================================== diff --git a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb index ab7d948c7..b31cb9caf 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb @@ -473,10 +473,10 @@ module TrainerBattleProperty def self.set(settingname, oldsetting) return nil if !oldsetting properties = [ - [_INTL("Trainer Type"), TrainerTypeProperty, _INTL("Name of the trainer type for this Trainer.")], - [_INTL("Trainer Name"), StringProperty, _INTL("Name of the Trainer.")], - [_INTL("Version"), LimitProperty.new(9999), _INTL("Number used to distinguish Trainers with the same name and trainer type.")], - [_INTL("Lose Text"), StringProperty, _INTL("Message shown in battle when the Trainer is defeated.")] + [_INTL("Trainer Type"), TrainerTypeProperty, _INTL("Name of the trainer type for this Trainer.")], + [_INTL("Trainer Name"), StringProperty, _INTL("Name of the Trainer.")], + [_INTL("Version"), LimitProperty.new(9999), _INTL("Number used to distinguish Trainers with the same name and trainer type.")], + [_INTL("Lose Text"), StringProperty, _INTL("Message shown in battle when the Trainer is defeated.")] ] Settings::MAX_PARTY_SIZE.times do |i| properties.push([_INTL("Pokémon {1}", i + 1), TrainerPokemonProperty, _INTL("A Pokémon owned by the Trainer.")]) @@ -566,11 +566,10 @@ def pbTrainerBattleEditor end else # New trainer tr_type = nil - ret = pbMessage(_INTL("First, define the new trainer's type."), [ - _INTL("Use existing type"), - _INTL("Create new type"), - _INTL("Cancel") - ], 3) + ret = pbMessage(_INTL("First, define the new trainer's type."), + [_INTL("Use existing type"), + _INTL("Create new type"), + _INTL("Cancel")], 3) case ret when 0 tr_type = pbListScreen(_INTL("TRAINER TYPE"), TrainerTypeLister.new(0, false)) @@ -596,10 +595,12 @@ def pbTrainerBattleEditor :pokemon => [] } t[3].each do |pkmn| - trainer_hash[:pokemon].push({ - :species => pkmn[0], - :level => pkmn[1] - }) + trainer_hash[:pokemon].push( + { + :species => pkmn[0], + :level => pkmn[1] + } + ) end # Add trainer's data to records trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]] @@ -640,41 +641,39 @@ module TrainerPokemonProperty Pokemon::MAX_MOVES.times do |i| oldsetting.push((initsetting[:moves]) ? initsetting[:moves][i] : nil) end - oldsetting.concat([ - initsetting[:ability], - initsetting[:ability_index], - initsetting[:item], - initsetting[:nature], - initsetting[:iv], - initsetting[:ev], - initsetting[:happiness], - initsetting[:poke_ball] - ]) + oldsetting.concat([initsetting[:ability], + initsetting[:ability_index], + initsetting[:item], + initsetting[:nature], + initsetting[:iv], + initsetting[:ev], + initsetting[:happiness], + initsetting[:poke_ball]]) max_level = GameData::GrowthRate.max_level pkmn_properties = [ - [_INTL("Species"), SpeciesProperty, _INTL("Species of the Pokémon.")], - [_INTL("Level"), NonzeroLimitProperty.new(max_level), _INTL("Level of the Pokémon (1-{1}).", max_level)], - [_INTL("Name"), StringProperty, _INTL("Name of the Pokémon.")], - [_INTL("Form"), LimitProperty2.new(999), _INTL("Form of the Pokémon.")], - [_INTL("Gender"), GenderProperty, _INTL("Gender of the Pokémon.")], - [_INTL("Shiny"), BooleanProperty2, _INTL("If set to true, the Pokémon is a different-colored Pokémon.")], - [_INTL("SuperShiny"), BooleanProperty2, _INTL("Whether the Pokémon is super shiny (shiny with a special shininess animation).")], - [_INTL("Shadow"), BooleanProperty2, _INTL("If set to true, the Pokémon is a Shadow Pokémon.")] + [_INTL("Species"), SpeciesProperty, _INTL("Species of the Pokémon.")], + [_INTL("Level"), NonzeroLimitProperty.new(max_level), _INTL("Level of the Pokémon (1-{1}).", max_level)], + [_INTL("Name"), StringProperty, _INTL("Name of the Pokémon.")], + [_INTL("Form"), LimitProperty2.new(999), _INTL("Form of the Pokémon.")], + [_INTL("Gender"), GenderProperty, _INTL("Gender of the Pokémon.")], + [_INTL("Shiny"), BooleanProperty2, _INTL("If set to true, the Pokémon is a different-colored Pokémon.")], + [_INTL("SuperShiny"), BooleanProperty2, _INTL("Whether the Pokémon is super shiny (shiny with a special shininess animation).")], + [_INTL("Shadow"), BooleanProperty2, _INTL("If set to true, the Pokémon is a Shadow Pokémon.")] ] Pokemon::MAX_MOVES.times do |i| pkmn_properties.push([_INTL("Move {1}", i + 1), MovePropertyForSpecies.new(oldsetting), _INTL("A move known by the Pokémon. Leave all moves blank (use Z key to delete) for a wild moveset.")]) end - pkmn_properties.concat([ - [_INTL("Ability"), AbilityProperty, _INTL("Ability of the Pokémon. Overrides the ability index.")], + pkmn_properties.concat( + [[_INTL("Ability"), AbilityProperty, _INTL("Ability of the Pokémon. Overrides the ability index.")], [_INTL("Ability index"), LimitProperty2.new(99), _INTL("Ability index. 0=first ability, 1=second ability, 2+=hidden ability.")], [_INTL("Held item"), ItemProperty, _INTL("Item held by the Pokémon.")], [_INTL("Nature"), GameDataProperty.new(:Nature), _INTL("Nature of the Pokémon.")], [_INTL("IVs"), IVsProperty.new(Pokemon::IV_STAT_LIMIT), _INTL("Individual values for each of the Pokémon's stats.")], [_INTL("EVs"), EVsProperty.new(Pokemon::EV_STAT_LIMIT), _INTL("Effort values for each of the Pokémon's stats.")], [_INTL("Happiness"), LimitProperty2.new(255), _INTL("Happiness of the Pokémon (0-255).")], - [_INTL("Poké Ball"), BallProperty.new(oldsetting), _INTL("The kind of Poké Ball the Pokémon is kept in.")] - ]) + [_INTL("Poké Ball"), BallProperty.new(oldsetting), _INTL("The kind of Poké Ball the Pokémon is kept in.")]] + ) pbPropertyList(settingname, oldsetting, pkmn_properties, false) return nil if !oldsetting[0] # Species is nil ret = { @@ -871,18 +870,18 @@ def pbItemEditor battle_use_array = [_INTL("Can't use in battle")] GameData::Item::SCHEMA["BattleUse"][2].each { |key, value| battle_use_array[value] = key if !battle_use_array[value] } item_properties = [ - [_INTL("ID"), ReadOnlyProperty, _INTL("ID of this item (used as a symbol like :XXX).")], - [_INTL("Name"), ItemNameProperty, _INTL("Name of this item as displayed by the game.")], - [_INTL("NamePlural"), ItemNameProperty, _INTL("Plural name of this item as displayed by the game.")], - [_INTL("Pocket"), PocketProperty, _INTL("Pocket in the Bag where this item is stored.")], - [_INTL("Price"), LimitProperty.new(999999), _INTL("Purchase price of this item.")], - [_INTL("SellPrice"), LimitProperty.new(999999), _INTL("Sell price of this item. If blank, is half the purchase price.")], - [_INTL("Description"), StringProperty, _INTL("Description of this item")], - [_INTL("FieldUse"), EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")], - [_INTL("BattleUse"), EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")], - [_INTL("Consumable"), BooleanProperty, _INTL("Whether this item is consumed after use.")], - [_INTL("Flags"), StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")], - [_INTL("Move"), MoveProperty, _INTL("Move taught by this HM, TM or TR.")] + [_INTL("ID"), ReadOnlyProperty, _INTL("ID of this item (used as a symbol like :XXX).")], + [_INTL("Name"), ItemNameProperty, _INTL("Name of this item as displayed by the game.")], + [_INTL("NamePlural"), ItemNameProperty, _INTL("Plural name of this item as displayed by the game.")], + [_INTL("Pocket"), PocketProperty, _INTL("Pocket in the Bag where this item is stored.")], + [_INTL("Price"), LimitProperty.new(999999), _INTL("Purchase price of this item.")], + [_INTL("SellPrice"), LimitProperty.new(999999), _INTL("Sell price of this item. If blank, is half the purchase price.")], + [_INTL("Description"), StringProperty, _INTL("Description of this item")], + [_INTL("FieldUse"), EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")], + [_INTL("BattleUse"), EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")], + [_INTL("Consumable"), BooleanProperty, _INTL("Whether this item is consumed after use.")], + [_INTL("Flags"), StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")], + [_INTL("Move"), MoveProperty, _INTL("Move taught by this HM, TM or TR.")] ] pbListScreenBlock(_INTL("Items"), ItemLister.new(0, true)) { |button, item| if item @@ -1003,45 +1002,45 @@ end #=============================================================================== def pbPokemonEditor species_properties = [ - [_INTL("ID"), ReadOnlyProperty, _INTL("The ID of the Pokémon.")], - [_INTL("Name"), LimitStringProperty.new(Pokemon::MAX_NAME_SIZE), _INTL("Name of the Pokémon.")], - [_INTL("FormName"), StringProperty, _INTL("Name of this form of the Pokémon.")], - [_INTL("Category"), StringProperty, _INTL("Kind of Pokémon species.")], - [_INTL("Pokédex"), StringProperty, _INTL("Description of the Pokémon as displayed in the Pokédex.")], - [_INTL("Type 1"), TypeProperty, _INTL("Pokémon's type. If same as Type 2, this Pokémon has a single type.")], - [_INTL("Type 2"), TypeProperty, _INTL("Pokémon's type. If same as Type 1, this Pokémon has a single type.")], - [_INTL("BaseStats"), BaseStatsProperty, _INTL("Base stats of the Pokémon.")], - [_INTL("EVs"), EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")], - [_INTL("BaseExp"), LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")], - [_INTL("GrowthRate"), GameDataProperty.new(:GrowthRate), _INTL("Pokémon's growth rate.")], - [_INTL("GenderRatio"), GameDataProperty.new(:GenderRatio), _INTL("Proportion of males to females for this species.")], - [_INTL("CatchRate"), LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")], - [_INTL("Happiness"), LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")], - [_INTL("Moves"), LevelUpMovesProperty, _INTL("Moves which the Pokémon learns while levelling up.")], - [_INTL("TutorMoves"), EggMovesProperty.new, _INTL("Moves which the Pokémon can be taught by TM/HM/Move Tutor.")], - [_INTL("EggMoves"), EggMovesProperty.new, _INTL("Moves which the Pokémon can learn via breeding.")], - [_INTL("Ability 1"), AbilityProperty, _INTL("One ability which the Pokémon can have.")], - [_INTL("Ability 2"), AbilityProperty, _INTL("Another ability which the Pokémon can have.")], - [_INTL("HiddenAbility 1"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], - [_INTL("HiddenAbility 2"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], - [_INTL("HiddenAbility 3"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], - [_INTL("HiddenAbility 4"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], - [_INTL("WildItemCommon"), GameDataPoolProperty.new(:Item), _INTL("Item(s) commonly held by wild Pokémon of this species.")], - [_INTL("WildItemUncommon"), GameDataPoolProperty.new(:Item), _INTL("Item(s) uncommonly held by wild Pokémon of this species.")], - [_INTL("WildItemRare"), GameDataPoolProperty.new(:Item), _INTL("Item(s) rarely held by wild Pokémon of this species.")], - [_INTL("EggGroup 1"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")], - [_INTL("EggGroup 2"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")], - [_INTL("HatchSteps"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")], - [_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")], - [_INTL("Offspring"), GameDataPoolProperty.new(:Species), _INTL("All possible species that an egg can be when breeding for an egg of this species (if blank, the egg can only be this species).")], - [_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")], - [_INTL("Height"), NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")], - [_INTL("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")], - [_INTL("Color"), GameDataProperty.new(:BodyColor), _INTL("Pokémon's body color.")], - [_INTL("Shape"), GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")], - [_INTL("Habitat"), GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")], - [_INTL("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")], - [_INTL("Flags"), StringListProperty, _INTL("Words/phrases that distinguish this species from others.")] + [_INTL("ID"), ReadOnlyProperty, _INTL("The ID of the Pokémon.")], + [_INTL("Name"), LimitStringProperty.new(Pokemon::MAX_NAME_SIZE), _INTL("Name of the Pokémon.")], + [_INTL("FormName"), StringProperty, _INTL("Name of this form of the Pokémon.")], + [_INTL("Category"), StringProperty, _INTL("Kind of Pokémon species.")], + [_INTL("Pokédex"), StringProperty, _INTL("Description of the Pokémon as displayed in the Pokédex.")], + [_INTL("Type 1"), TypeProperty, _INTL("Pokémon's type. If same as Type 2, this Pokémon has a single type.")], + [_INTL("Type 2"), TypeProperty, _INTL("Pokémon's type. If same as Type 1, this Pokémon has a single type.")], + [_INTL("BaseStats"), BaseStatsProperty, _INTL("Base stats of the Pokémon.")], + [_INTL("EVs"), EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")], + [_INTL("BaseExp"), LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")], + [_INTL("GrowthRate"), GameDataProperty.new(:GrowthRate), _INTL("Pokémon's growth rate.")], + [_INTL("GenderRatio"), GameDataProperty.new(:GenderRatio), _INTL("Proportion of males to females for this species.")], + [_INTL("CatchRate"), LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")], + [_INTL("Happiness"), LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")], + [_INTL("Moves"), LevelUpMovesProperty, _INTL("Moves which the Pokémon learns while levelling up.")], + [_INTL("TutorMoves"), EggMovesProperty.new, _INTL("Moves which the Pokémon can be taught by TM/HM/Move Tutor.")], + [_INTL("EggMoves"), EggMovesProperty.new, _INTL("Moves which the Pokémon can learn via breeding.")], + [_INTL("Ability 1"), AbilityProperty, _INTL("One ability which the Pokémon can have.")], + [_INTL("Ability 2"), AbilityProperty, _INTL("Another ability which the Pokémon can have.")], + [_INTL("HiddenAbility 1"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], + [_INTL("HiddenAbility 2"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], + [_INTL("HiddenAbility 3"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], + [_INTL("HiddenAbility 4"), AbilityProperty, _INTL("A secret ability which the Pokémon can have.")], + [_INTL("WildItemCommon"), GameDataPoolProperty.new(:Item), _INTL("Item(s) commonly held by wild Pokémon of this species.")], + [_INTL("WildItemUncommon"), GameDataPoolProperty.new(:Item), _INTL("Item(s) uncommonly held by wild Pokémon of this species.")], + [_INTL("WildItemRare"), GameDataPoolProperty.new(:Item), _INTL("Item(s) rarely held by wild Pokémon of this species.")], + [_INTL("EggGroup 1"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")], + [_INTL("EggGroup 2"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")], + [_INTL("HatchSteps"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")], + [_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")], + [_INTL("Offspring"), GameDataPoolProperty.new(:Species), _INTL("All possible species that an egg can be when breeding for an egg of this species (if blank, the egg can only be this species).")], + [_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")], + [_INTL("Height"), NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")], + [_INTL("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")], + [_INTL("Color"), GameDataProperty.new(:BodyColor), _INTL("Pokémon's body color.")], + [_INTL("Shape"), GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")], + [_INTL("Habitat"), GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")], + [_INTL("Generation"), LimitProperty.new(99999), _INTL("The number of the generation the Pokémon debuted in.")], + [_INTL("Flags"), StringListProperty, _INTL("Words/phrases that distinguish this species from others.")] ] pbListScreenBlock(_INTL("Pokémon species"), SpeciesLister.new(0, false)) { |button, species| if species @@ -1116,39 +1115,39 @@ def pbPokemonEditor hidden_abilities = [data[19], data[20], data[21], data[22]].uniq.compact # Hidden abilities # Construct species hash species_hash = { - :id => spec.id, - :name => data[1], - :form_name => data[2], - :category => data[3], - :pokedex_entry => data[4], - :types => types, # 5, 6 - :base_stats => data[7], - :evs => data[8], - :base_exp => data[9], - :growth_rate => data[10], - :gender_ratio => data[11], - :catch_rate => data[12], - :happiness => data[13], - :moves => data[14], - :tutor_moves => data[15], - :egg_moves => data[16], - :abilities => abilities, # 17, 18 - :hidden_abilities => hidden_abilities, # 19, 20, 21, 22 - :wild_item_common => data[23], - :wild_item_uncommon => data[24], - :wild_item_rare => data[25], - :egg_groups => egg_groups, # 26, 27 - :hatch_steps => data[28], - :incense => data[29], - :offspring => data[30], - :evolutions => data[31], - :height => data[32], - :weight => data[33], - :color => data[34], - :shape => data[35], - :habitat => data[36], - :generation => data[37], - :flags => data[38] + :id => spec.id, + :name => data[1], + :form_name => data[2], + :category => data[3], + :pokedex_entry => data[4], + :types => types, # 5, 6 + :base_stats => data[7], + :evs => data[8], + :base_exp => data[9], + :growth_rate => data[10], + :gender_ratio => data[11], + :catch_rate => data[12], + :happiness => data[13], + :moves => data[14], + :tutor_moves => data[15], + :egg_moves => data[16], + :abilities => abilities, # 17, 18 + :hidden_abilities => hidden_abilities, # 19, 20, 21, 22 + :wild_item_common => data[23], + :wild_item_uncommon => data[24], + :wild_item_rare => data[25], + :egg_groups => egg_groups, # 26, 27 + :hatch_steps => data[28], + :incense => data[29], + :offspring => data[30], + :evolutions => data[31], + :height => data[32], + :weight => data[33], + :color => data[34], + :shape => data[35], + :habitat => data[36], + :generation => data[37], + :flags => data[38] } # Add species' data to records GameData::Species.register(species_hash) diff --git a/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb b/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb index f45f6da11..c05e18b19 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/002_EditorScreens_TerrainTags.rb @@ -53,7 +53,7 @@ class PokemonTilesetScene @x = 0 @y = 0 @top_y = 0 - @height = (@tileset.terrain_tags.xsize - TILESET_START_ID) / TILES_PER_ROW + 1 + @height = ((@tileset.terrain_tags.xsize - TILESET_START_ID) / TILES_PER_ROW) + 1 draw_tiles draw_overlay end @@ -71,7 +71,7 @@ class PokemonTilesetScene @sprites["tileset"].bitmap.clear for yy in 0...@visible_height autotile_row = (@top_y == 0 && yy == 0) # Autotiles - id_y_offset = (autotile_row) ? 0 : TILESET_START_ID + (@top_y + yy - 1) * TILES_PER_ROW + id_y_offset = (autotile_row) ? 0 : TILESET_START_ID + ((@top_y + yy - 1) * TILES_PER_ROW) for xx in 0...TILES_PER_ROW id_x_offset = (autotile_row) ? xx * TILES_PER_AUTOTILE : xx @tilehelper.bltTile(@sprites["tileset"].bitmap, xx * TILE_SIZE, yy * TILE_SIZE, @@ -88,7 +88,7 @@ class PokemonTilesetScene for xx in 0...TILES_PER_ROW tile_id = tile_ID_from_coordinates(xx, @top_y + yy) terr = @tileset.terrain_tags[tile_id] - textpos.push(["#{terr}", xx * TILE_SIZE + TILE_SIZE / 2, yy * TILE_SIZE - 6, 2, TEXT_COLOR, TEXT_SHADOW_COLOR]) + textpos.push(["#{terr}", (xx * TILE_SIZE) + (TILE_SIZE / 2), (yy * TILE_SIZE) - 6, 2, TEXT_COLOR, TEXT_SHADOW_COLOR]) end end pbDrawTextPositions(@sprites["overlay"].bitmap, textpos) @@ -105,16 +105,16 @@ class PokemonTilesetScene def draw_tile_details overlay = @sprites["overlay"].bitmap - tile_x = Graphics.width * 3 / 4 - TILE_SIZE - tile_y = Graphics.height / 2 - TILE_SIZE + tile_x = (Graphics.width * 3 / 4) - TILE_SIZE + tile_y = (Graphics.height / 2) - TILE_SIZE tile_id = tile_ID_from_coordinates(@x, @y) || 0 # Draw tile (at 200% size) @tilehelper.bltSmallTile(overlay, tile_x, tile_y, TILE_SIZE * 2, TILE_SIZE * 2, tile_id) # Draw box around tile image - overlay.fill_rect(tile_x - 1, tile_y - 1, TILE_SIZE * 2 + 2, 1, Color.new(255, 255, 255)) - overlay.fill_rect(tile_x - 1, tile_y - 1, 1, TILE_SIZE * 2 + 2, Color.new(255, 255, 255)) - overlay.fill_rect(tile_x - 1, tile_y + TILE_SIZE * 2, TILE_SIZE * 2 + 2, 1, Color.new(255, 255, 255)) - overlay.fill_rect(tile_x + TILE_SIZE * 2, tile_y - 1, 1, TILE_SIZE * 2 + 2, Color.new(255, 255, 255)) + overlay.fill_rect(tile_x - 1, tile_y - 1, (TILE_SIZE * 2) + 2, 1, Color.new(255, 255, 255)) + overlay.fill_rect(tile_x - 1, tile_y - 1, 1, (TILE_SIZE * 2) + 2, Color.new(255, 255, 255)) + overlay.fill_rect(tile_x - 1, tile_y + (TILE_SIZE * 2), (TILE_SIZE * 2) + 2, 1, Color.new(255, 255, 255)) + overlay.fill_rect(tile_x + (TILE_SIZE * 2), tile_y - 1, 1, (TILE_SIZE * 2) + 2, Color.new(255, 255, 255)) # Write terrain tag info about selected tile terrain_tag = @tileset.terrain_tags[tile_id] || 0 if GameData::TerrainTag.exists?(terrain_tag) @@ -123,8 +123,8 @@ class PokemonTilesetScene terrain_tag_name = terrain_tag.to_s end textpos = [ - [_INTL("Terrain Tag:"), tile_x + TILE_SIZE, tile_y + TILE_SIZE * 2 + 10, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)], - [terrain_tag_name, tile_x + TILE_SIZE, tile_y + TILE_SIZE * 2 + 42, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)] + [_INTL("Terrain Tag:"), tile_x + TILE_SIZE, tile_y + (TILE_SIZE * 2) + 10, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)], + [terrain_tag_name, tile_x + TILE_SIZE, tile_y + (TILE_SIZE * 2) + 42, 2, Color.new(248, 248, 248), Color.new(40, 40, 40)] ] # Draw all text pbDrawTextPositions(overlay, textpos) @@ -132,7 +132,7 @@ class PokemonTilesetScene def tile_ID_from_coordinates(x, y) return x * TILES_PER_AUTOTILE if y == 0 # Autotile - return TILESET_START_ID + (y - 1) * TILES_PER_ROW + x + return TILESET_START_ID + ((y - 1) * TILES_PER_ROW) + x end def set_terrain_tag_for_tile_ID(i, value) @@ -183,10 +183,10 @@ class PokemonTilesetScene update_cursor_position(0, @visible_height) elsif Input.trigger?(Input::ACTION) commands = [ - _INTL("Go to bottom"), - _INTL("Go to top"), - _INTL("Change tileset"), - _INTL("Cancel") + _INTL("Go to bottom"), + _INTL("Go to top"), + _INTL("Change tileset"), + _INTL("Cancel") ] case pbShowCommands(nil, commands, -1) when 0 diff --git a/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb b/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb index a44808c43..f477c214e 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/003_EditorScreens_MapConnections.rb @@ -110,9 +110,9 @@ class RegionMapSprite bitmap = AnimatedBitmap.new("Graphics/Pictures/#{@map[1]}").deanimate retbitmap = BitmapWrapper.new(bitmap.width / 2, bitmap.height / 2) retbitmap.stretch_blt( - Rect.new(0, 0, bitmap.width / 2, bitmap.height / 2), - bitmap, - Rect.new(0, 0, bitmap.width, bitmap.height) + Rect.new(0, 0, bitmap.width / 2, bitmap.height / 2), + bitmap, + Rect.new(0, 0, bitmap.width, bitmap.height) ) bitmap.dispose return retbitmap @@ -172,8 +172,8 @@ class MapScreenScene if conn[0] == id b = sprites.any? { |i| i == conn[3] } if !b - x = (conn[1] - conn[4]) * 4 + dispx - y = (conn[2] - conn[5]) * 4 + dispy + x = ((conn[1] - conn[4]) * 4) + dispx + y = ((conn[2] - conn[5]) * 4) + dispy setMapSpritePos(conn[3], x, y) sprites.push(conn[3]) putNeighbors(conn[3], sprites) @@ -181,8 +181,8 @@ class MapScreenScene elsif conn[3] == id b = sprites.any? { |i| i == conn[0] } if !b - x = (conn[4] - conn[1]) * 4 + dispx - y = (conn[5] - conn[2]) * 4 + dispy + x = ((conn[4] - conn[1]) * 4) + dispx + y = ((conn[5] - conn[2]) * 4) + dispy setMapSpritePos(conn[0], x, y) sprites.push(conn[3]) putNeighbors(conn[0], sprites) @@ -375,16 +375,9 @@ class MapScreenScene def getMapRect(mapid) sprite = getMapSprite(mapid) - if sprite - return [ - sprite.x, - sprite.y, - sprite.x + sprite.bitmap.width, - sprite.y + sprite.bitmap.height - ] - else - return nil - end + return nil if !sprite + return [sprite.x, sprite.y, + sprite.x + sprite.bitmap.width, sprite.y + sprite.bitmap.height] end def onDoubleClick(map_id) @@ -455,12 +448,10 @@ class MapScreenScene end @sprites["title"].text = _INTL("D: Help") end + elsif mapid >= 0 + @sprites["title"].text = _ISPRINTF("D: Help [{1:03d}: {2:s}]", mapid, @mapinfos[mapid].name) else - if mapid >= 0 - @sprites["title"].text = _ISPRINTF("D: Help [{1:03d}: {2:s}]", mapid, @mapinfos[mapid].name) - else - @sprites["title"].text = _INTL("D: Help") - end + @sprites["title"].text = _INTL("D: Help") end end diff --git a/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb b/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb index 95c0fa492..951abe659 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb @@ -306,13 +306,13 @@ class SpritePositioner def pbMenu refresh - cw = Window_CommandPokemon.new([ - _INTL("Set Ally Position"), + cw = Window_CommandPokemon.new( + [_INTL("Set Ally Position"), _INTL("Set Enemy Position"), _INTL("Set Shadow Size"), _INTL("Set Shadow Position"), - _INTL("Auto-Position Sprites") - ]) + _INTL("Auto-Position Sprites")] + ) cw.x = Graphics.width - cw.width cw.y = Graphics.height - cw.height cw.viewport = @viewport @@ -340,7 +340,7 @@ class SpritePositioner pbFadeInAndShow(@sprites) { update } @starting = false end - cw = Window_CommandPokemonEx.newEmpty(0, 0, 260, 32 + 24 * 6, @viewport) + cw = Window_CommandPokemonEx.newEmpty(0, 0, 260, 32 + (24 * 6), @viewport) cw.rowHeight = 24 pbSetSmallFont(cw.contents) cw.x = Graphics.width - cw.width diff --git a/Data/Scripts/020_Debug/002_Animation editor/001_AnimEditor_SceneElements.rb b/Data/Scripts/020_Debug/002_Animation editor/001_AnimEditor_SceneElements.rb index aee3d7210..5df2d072f 100644 --- a/Data/Scripts/020_Debug/002_Animation editor/001_AnimEditor_SceneElements.rb +++ b/Data/Scripts/020_Debug/002_Animation editor/001_AnimEditor_SceneElements.rb @@ -222,7 +222,7 @@ class AnimationWindow < SpriteWrapper @contents.clear @contents.fill_rect(0, 0, @contents.width, @contents.height, Color.new(180, 180, 180)) @contents.blt(0, 0, @arrows.bitmap, Rect.new(0, 0, arrowwidth, 96)) - @contents.blt(arrowwidth + NUMFRAMES * 96, 0, @arrows.bitmap, + @contents.blt(arrowwidth + (NUMFRAMES * 96), 0, @arrows.bitmap, Rect.new(arrowwidth, 0, arrowwidth, 96)) havebitmap = (self.animbitmap && !self.animbitmap.disposed?) if havebitmap @@ -238,9 +238,9 @@ class AnimationWindow < SpriteWrapper end end for i in 0...NUMFRAMES - drawrect(@contents, arrowwidth + i * 96, 0, 96, 96, Color.new(100, 100, 100)) + drawrect(@contents, arrowwidth + (i * 96), 0, 96, 96, Color.new(100, 100, 100)) if @start + i == @selected && havebitmap - drawborder(@contents, arrowwidth + i * 96, 0, 96, 96, Color.new(255, 0, 0)) + drawborder(@contents, arrowwidth + (i * 96), 0, 96, 96, Color.new(255, 0, 0)) end end end @@ -258,7 +258,7 @@ class AnimationWindow < SpriteWrapper arrowwidth = @arrows.bitmap.width / 2 maxindex = (self.animbitmap.height / 192) * 5 left = Rect.new(0, 0, arrowwidth, 96) - right = Rect.new(arrowwidth + NUMFRAMES * 96, 0, arrowwidth, 96) + right = Rect.new(arrowwidth + (NUMFRAMES * 96), 0, arrowwidth, 96) left.x += self.x left.y += self.y right.x += self.x @@ -266,7 +266,7 @@ class AnimationWindow < SpriteWrapper swatchrects = [] repeattime = Input.time?(Input::MOUSELEFT) / 1000 for i in 0...NUMFRAMES - swatchrects.push(Rect.new(arrowwidth + i * 96 + self.x, self.y, 96, 96)) + swatchrects.push(Rect.new(arrowwidth + (i * 96) + self.x, self.y, 96, 96)) end for i in 0...NUMFRAMES if swatchrects[i].contains(mousepos[0], mousepos[1]) @@ -410,7 +410,7 @@ class SpriteFrame < InvalidatableSprite @contents.fill_rect(63, 0, 1, 64, color) # Determine frame number graphic to use from @iconbitmap yoffset = (@previous) ? (NUM_ROWS + 1) * 16 : 0 # 1 is for padlock icon - bmrect = Rect.new((@id % 10) * 16, yoffset + (@id / 10) * 16, 16, 16) + bmrect = Rect.new((@id % 10) * 16, yoffset + ((@id / 10) * 16), 16, 16) @contents.blt(0, 0, @iconbitmap.bitmap, bmrect) # Draw padlock if frame is locked if @locked && !@previous @@ -986,8 +986,8 @@ class BitmapDisplayWindow < SpriteWindow_Base return if !bmap ww = bmap.width wh = bmap.height - sx = self.contents.width * 1.0 / ww - sy = self.contents.height * 1.0 / wh + sx = self.contents.width / ww.to_f + sy = self.contents.height / wh.to_f if sx > sy ww = sy * ww wh = self.contents.height diff --git a/Data/Scripts/020_Debug/002_Animation editor/002_AnimEditor_ControlsButtons.rb b/Data/Scripts/020_Debug/002_Animation editor/002_AnimEditor_ControlsButtons.rb index 7ee56b7fe..804c8a950 100644 --- a/Data/Scripts/020_Debug/002_Animation editor/002_AnimEditor_ControlsButtons.rb +++ b/Data/Scripts/020_Debug/002_Animation editor/002_AnimEditor_ControlsButtons.rb @@ -829,12 +829,8 @@ class ControlWindow < SpriteWindow_Base mousepos = Mouse.getMousePos return false if !mousepos return false if i < 0 || i >= @controls.length - rc = Rect.new( - @controls[i].parentX, - @controls[i].parentY, - @controls[i].width, - @controls[i].height - ) + rc = Rect.new(@controls[i].parentX, @controls[i].parentY, + @controls[i].width, @controls[i].height) return rc.contains(mousepos[0], mousepos[1]) end diff --git a/Data/Scripts/020_Debug/002_Animation editor/003_AnimEditor_Interpolation.rb b/Data/Scripts/020_Debug/002_Animation editor/003_AnimEditor_Interpolation.rb index 530657059..fe9754d5d 100644 --- a/Data/Scripts/020_Debug/002_Animation editor/003_AnimEditor_Interpolation.rb +++ b/Data/Scripts/020_Debug/002_Animation editor/003_AnimEditor_Interpolation.rb @@ -117,7 +117,7 @@ class PointPath len = @points.length dx = @points[len - 2][0] - @points[len - 1][0] dy = @points[len - 2][1] - @points[len - 1][1] - dist = Math.sqrt(dx * dx + dy * dy) + dist = Math.sqrt((dx * dx) + (dy * dy)) @distances.push(dist) @totaldist += dist end @@ -171,8 +171,8 @@ class PointPath distT = 1.0 - ((curdist - distForT) / dist) dx = @points[i + 1][0] - @points[i][0] dy = @points[i + 1][1] - @points[i][1] - ret = [@points[i][0] + dx * distT, - @points[i][1] + dy * distT] + ret = [@points[i][0] + (dx * distT), + @points[i][1] + (dy * distT)] break end end @@ -188,9 +188,9 @@ def catmullRom(p1, p2, p3, p4, t) # p1=prevPoint, p2=startPoint, p3=endPoint, p4=nextPoint, t is from 0 through 1 t2 = t * t t3 = t2 * t - return 0.5 * (2 * p2 + t * (p3 - p1) + - t2 * (2 * p1 - 5 * p2 + 4 * p3 - p4) + - t3 * (p4 - 3 * p3 + 3 * p2 - p1)) + return 0.5 * ((2 * p2) + (t * (p3 - p1)) + + (t2 * ((2 * p1) - (5 * p2) + (4 * p3) - p4)) + + (t3 * (p4 - (3 * p3) + (3 * p2) - p1))) end def getCatmullRomPoint(src, t) @@ -275,10 +275,10 @@ def pbDefinePath(canvas) points.push(point) end curve = [ - ControlPointSprite.new(true, canvas.viewport), - ControlPointSprite.new(false, canvas.viewport), - ControlPointSprite.new(false, canvas.viewport), - ControlPointSprite.new(true, canvas.viewport) + ControlPointSprite.new(true, canvas.viewport), + ControlPointSprite.new(false, canvas.viewport), + ControlPointSprite.new(false, canvas.viewport), + ControlPointSprite.new(true, canvas.viewport) ] showline = false sliderwin2.visible = false @@ -321,10 +321,10 @@ def pbDefinePath(canvas) if !showline curve[1].visible = true curve[2].visible = true - curve[1].x = curve[0].x + 0.3333 * (curve[3].x - curve[0].x) - curve[1].y = curve[0].y + 0.3333 * (curve[3].y - curve[0].y) - curve[2].x = curve[0].x + 0.6666 * (curve[3].x - curve[0].x) - curve[2].y = curve[0].y + 0.6666 * (curve[3].y - curve[0].y) + curve[1].x = curve[0].x + (0.3333 * (curve[3].x - curve[0].x)) + curve[1].y = curve[0].y + (0.3333 * (curve[3].y - curve[0].y)) + curve[2].x = curve[0].x + (0.6666 * (curve[3].x - curve[0].x)) + curve[2].y = curve[0].y + (0.6666 * (curve[3].y - curve[0].y)) end showline = true end diff --git a/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb b/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb index 9f32747e0..16a6d47d9 100644 --- a/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb +++ b/Data/Scripts/020_Debug/002_Animation editor/005_AnimEditor_Functions.rb @@ -154,11 +154,10 @@ def pbAnimList(animations, canvas, animwin) next end if Input.trigger?(Input::USE) && animations.length > 0 - cmd2 = pbShowCommands(helpwindow, [ - _INTL("Load Animation"), - _INTL("Rename"), - _INTL("Delete") - ], -1) + cmd2 = pbShowCommands(helpwindow, + [_INTL("Load Animation"), + _INTL("Rename"), + _INTL("Delete")], -1) case cmd2 when 0 # Load Animation canvas.loadAnimation(animations[cmdwin.index]) @@ -223,12 +222,8 @@ def pbSetTone(cel, previewsprite) okbutton = sliderwin2.addButton(_INTL("OK")) cancelbutton = sliderwin2.addButton(_INTL("Cancel")) loop do - previewsprite.tone.set( - sliderwin2.value(0), - sliderwin2.value(1), - sliderwin2.value(2), - sliderwin2.value(3) - ) + previewsprite.tone.set(sliderwin2.value(0), sliderwin2.value(1), + sliderwin2.value(2), sliderwin2.value(3)) Graphics.update Input.update sliderwin2.update @@ -257,12 +252,8 @@ def pbSetFlash(cel, previewsprite) okbutton = sliderwin2.addButton(_INTL("OK")) cancelbutton = sliderwin2.addButton(_INTL("Cancel")) loop do - previewsprite.tone.set( - sliderwin2.value(0), - sliderwin2.value(1), - sliderwin2.value(2), - sliderwin2.value(3) - ) + previewsprite.tone.set(sliderwin2.value(0), sliderwin2.value(1), + sliderwin2.value(2), sliderwin2.value(3)) Graphics.update Input.update sliderwin2.update @@ -1030,11 +1021,11 @@ def animationEditorMain(animation) next elsif Input.trigger?(Input::MOUSERIGHT) && sliderwin.hittest?(0) # Right mouse button commands = [ - _INTL("Copy Frame"), - _INTL("Paste Frame"), - _INTL("Clear Frame"), - _INTL("Insert Frame"), - _INTL("Delete Frame") + _INTL("Copy Frame"), + _INTL("Paste Frame"), + _INTL("Clear Frame"), + _INTL("Insert Frame"), + _INTL("Delete Frame") ] hit = pbTrackPopupMenu(commands) case hit @@ -1067,13 +1058,13 @@ def animationEditorMain(animation) mousepos = Mouse.getMousePos mousepos = [0, 0] if !mousepos commands = [ - _INTL("Properties..."), - _INTL("Cut"), - _INTL("Copy"), - _INTL("Paste"), - _INTL("Delete"), - _INTL("Renumber..."), - _INTL("Extrapolate Path...") + _INTL("Properties..."), + _INTL("Cut"), + _INTL("Copy"), + _INTL("Paste"), + _INTL("Delete"), + _INTL("Renumber..."), + _INTL("Extrapolate Path...") ] hit = pbTrackPopupMenu(commands) case hit diff --git a/Data/Scripts/020_Debug/002_Editor_DataTypes.rb b/Data/Scripts/020_Debug/002_Editor_DataTypes.rb index 8bf62406d..c06686d7c 100644 --- a/Data/Scripts/020_Debug/002_Editor_DataTypes.rb +++ b/Data/Scripts/020_Debug/002_Editor_DataTypes.rb @@ -667,8 +667,8 @@ module MapSizeProperty def self.set(settingname, oldsetting) oldsetting = [0, ""] if !oldsetting properties = [ - [_INTL("Width"), NonzeroLimitProperty.new(30), _INTL("The width of this map in Region Map squares.")], - [_INTL("Valid Squares"), StringProperty, _INTL("A series of 1s and 0s marking which squares are part of this map (1=part, 0=not part).")] + [_INTL("Width"), NonzeroLimitProperty.new(30), _INTL("The width of this map in Region Map squares.")], + [_INTL("Valid Squares"), StringProperty, _INTL("A series of 1s and 0s marking which squares are part of this map (1=part, 0=not part).")] ] pbPropertyList(settingname, oldsetting, properties, false) return oldsetting @@ -792,9 +792,7 @@ module RegionMapCoordsProperty ret = [] for i in 0...mapdata.length next if !mapdata[i] - ret.push( - [i, pbGetMessage(MessageTypes::RegionNames, i)] - ) + ret.push([i, pbGetMessage(MessageTypes::RegionNames, i)]) end return ret end diff --git a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb index b33ee04bc..1acbff691 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb @@ -813,12 +813,10 @@ DebugMenuCommands.register("dexlists", { dexindex = dexescmd - 1 if dexindex < 0 # Toggle Pokédex ownership $player.has_pokedex = !$player.has_pokedex - else # Toggle Regional Dex accessibility - if $player.pokedex.unlocked?(dexindex) - $player.pokedex.lock(dexindex) - else - $player.pokedex.unlock(dexindex) - end + elsif $player.pokedex.unlocked?(dexindex) # Toggle Regional Dex accessibility + $player.pokedex.lock(dexindex) + else + $player.pokedex.unlock(dexindex) end end } @@ -888,7 +886,7 @@ DebugMenuCommands.register("randomid", { "name" => _INTL("Randomize Player ID"), "description" => _INTL("Generate a random new ID for the player."), "effect" => proc { - $player.id = rand(2**16) | rand(2**16) << 16 + $player.id = rand(2**16) | (rand(2**16) << 16) pbMessage(_INTL("The player's ID was changed to {1} (full ID: {2}).", $player.public_ID, $player.id)) } }) diff --git a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb index 6b6e36b0c..ff0d48d97 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb @@ -127,7 +127,8 @@ def pbDebugSetVariable(id, diff) end def pbDebugVariableScreen(id) - if $game_variables[id].is_a?(Numeric) + case $game_variables[id] + when Numeric value = $game_variables[id] params = ChooseNumberParams.new params.setDefaultValue(value) @@ -137,7 +138,7 @@ def pbDebugVariableScreen(id) $game_variables[id] = [value, 99999999].min $game_variables[id] = [$game_variables[id], -99999999].max $game_map.need_refresh = true - elsif $game_variables[id].is_a?(String) + when String value = pbMessageFreeText(_INTL("Set variable {1}.", id), $game_variables[id], false, 250, Graphics.width) $game_variables[id] = value @@ -184,9 +185,10 @@ def pbDebugVariables(mode) when "" $game_variables[current_id] = 0 else - if $game_variables[current_id].is_a?(Numeric) + case $game_variables[current_id] + when Numeric $game_variables[current_id] = 0 - elsif $game_variables[current_id].is_a?(String) + when String $game_variables[current_id] = "" end end @@ -739,7 +741,7 @@ def pbCheckTileValidity(tile_id, map, tilesets, passages) return false if !tile_id if tile_id > 0 && tile_id < 384 # Check for defined autotile - autotile_id = tile_id / 48 - 1 + autotile_id = (tile_id / 48) - 1 autotile_name = tilesets[map.tileset_id].autotile_names[autotile_id] return true if autotile_name && autotile_name != "" else diff --git a/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb index 0c4905f7f..c050f49ab 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/005_Debug_PokemonCommands.rb @@ -358,7 +358,7 @@ PokemonDebugMenuCommands.register("hiddenvalues", { end end when 2 # Randomise pID - pkmn.personalID = rand(2**16) | rand(2**16) << 16 + pkmn.personalID = rand(2**16) | (rand(2**16) << 16) pkmn.calc_stats screen.pbRefreshSingle(pkmnid) end @@ -1034,7 +1034,7 @@ PokemonDebugMenuCommands.register("ownership", { val = pbMessageChooseNumber( _INTL("Set the new ID (max. 65535)."), params ) { screen.pbUpdate } - pkmn.owner.id = val | val << 16 + pkmn.owner.id = val | (val << 16) end end next false @@ -1173,11 +1173,12 @@ PokemonDebugMenuCommands.register("duplicate", { "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| if screen.pbConfirm(_INTL("Are you sure you want to copy this Pokémon?")) clonedpkmn = pkmn.clone - if screen.is_a?(PokemonPartyScreen) + case screen + when PokemonPartyScreen pbStorePokemon(clonedpkmn) screen.pbHardRefresh screen.pbDisplay(_INTL("The Pokémon was duplicated.")) - elsif screen.is_a?(PokemonStorageScreen) + when PokemonStorageScreen if screen.storage.pbMoveCaughtToParty(clonedpkmn) if pkmnid[0] != -1 screen.pbDisplay(_INTL("The duplicated Pokémon was moved to your party.")) @@ -1205,10 +1206,11 @@ PokemonDebugMenuCommands.register("delete", { "name" => _INTL("Delete"), "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| if screen.pbConfirm(_INTL("Are you sure you want to delete this Pokémon?")) - if screen.is_a?(PokemonPartyScreen) + case screen + when PokemonPartyScreen screen.party.delete_at(pkmnid) screen.pbHardRefresh - elsif screen.is_a?(PokemonStorageScreen) + when PokemonStorageScreen screen.scene.pbRelease(pkmnid, heldpoke) (heldpoke) ? screen.heldpkmn = nil : screen.storage.pbDelete(pkmnid[0], pkmnid[1]) screen.scene.pbRefresh diff --git a/Data/Scripts/020_Debug/003_Debug menus/008_Debug_BattlerCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/008_Debug_BattlerCommands.rb index df9c9b17e..af3a9f55c 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/008_Debug_BattlerCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/008_Debug_BattlerCommands.rb @@ -411,12 +411,10 @@ BattlerDebugMenuCommands.register("settypes", { end battler.types.compact! end + elsif cmd < max_main_types + battler.types[cmd] = new_type else - if cmd < max_main_types - battler.types[cmd] = new_type - else - battler.effects[PBEffects::Type3] = new_type - end + battler.effects[PBEffects::Type3] = new_type end end end diff --git a/Data/Scripts/020_Debug/003_Debug menus/009_Debug_BattleExtraCode.rb b/Data/Scripts/020_Debug/003_Debug menus/009_Debug_BattleExtraCode.rb index 991b76ce0..aa25118f1 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/009_Debug_BattleExtraCode.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/009_Debug_BattleExtraCode.rb @@ -124,44 +124,44 @@ module Battle::DebugVariables } SIDE_EFFECTS = { - PBEffects::AuroraVeil => { name: "Aurora Veil duration", default: 0 }, - PBEffects::CraftyShield => { name: "Crafty Shield applies this round", default: false }, - PBEffects::EchoedVoiceCounter => { name: "Echoed Voice rounds used (max. 5)", default: 0, max: 5 }, - PBEffects::EchoedVoiceUsed => { name: "Echoed Voice used this round", default: false }, - PBEffects::LastRoundFainted => { name: "Round when side's battler last fainted", default: -2 }, # Treated as -1, isn't a battler index - PBEffects::LightScreen => { name: "Light Screen duration", default: 0 }, - PBEffects::LuckyChant => { name: "Lucky Chant duration", default: 0 }, - PBEffects::MatBlock => { name: "Mat Block applies this round", default: false }, - PBEffects::Mist => { name: "Mist duration", default: 0 }, - PBEffects::QuickGuard => { name: "Quick Guard applies this round", default: false }, - PBEffects::Rainbow => { name: "Rainbow duration", default: 0 }, - PBEffects::Reflect => { name: "Reflect duration", default: 0 }, - PBEffects::Round => { name: "Round was used this round", default: false }, - PBEffects::Safeguard => { name: "Safeguard duration", default: 0 }, - PBEffects::SeaOfFire => { name: "Sea Of Fire duration", default: 0 }, - PBEffects::Spikes => { name: "Spikes layers (0-3)", default: 0, max: 3 }, - PBEffects::StealthRock => { name: "Stealth Rock exists", default: false }, - PBEffects::StickyWeb => { name: "Sticky Web exists", default: false }, - PBEffects::Swamp => { name: "Swamp duration", default: 0 }, - PBEffects::Tailwind => { name: "Tailwind duration", default: 0 }, - PBEffects::ToxicSpikes => { name: "Toxic Spikes layers (0-2)", default: 0, max: 2 }, - PBEffects::WideGuard => { name: "Wide Guard applies this round", default: false } + PBEffects::AuroraVeil => { name: "Aurora Veil duration", default: 0 }, + PBEffects::CraftyShield => { name: "Crafty Shield applies this round", default: false }, + PBEffects::EchoedVoiceCounter => { name: "Echoed Voice rounds used (max. 5)", default: 0, max: 5 }, + PBEffects::EchoedVoiceUsed => { name: "Echoed Voice used this round", default: false }, + PBEffects::LastRoundFainted => { name: "Round when side's battler last fainted", default: -2 }, # Treated as -1, isn't a battler index + PBEffects::LightScreen => { name: "Light Screen duration", default: 0 }, + PBEffects::LuckyChant => { name: "Lucky Chant duration", default: 0 }, + PBEffects::MatBlock => { name: "Mat Block applies this round", default: false }, + PBEffects::Mist => { name: "Mist duration", default: 0 }, + PBEffects::QuickGuard => { name: "Quick Guard applies this round", default: false }, + PBEffects::Rainbow => { name: "Rainbow duration", default: 0 }, + PBEffects::Reflect => { name: "Reflect duration", default: 0 }, + PBEffects::Round => { name: "Round was used this round", default: false }, + PBEffects::Safeguard => { name: "Safeguard duration", default: 0 }, + PBEffects::SeaOfFire => { name: "Sea Of Fire duration", default: 0 }, + PBEffects::Spikes => { name: "Spikes layers (0-3)", default: 0, max: 3 }, + PBEffects::StealthRock => { name: "Stealth Rock exists", default: false }, + PBEffects::StickyWeb => { name: "Sticky Web exists", default: false }, + PBEffects::Swamp => { name: "Swamp duration", default: 0 }, + PBEffects::Tailwind => { name: "Tailwind duration", default: 0 }, + PBEffects::ToxicSpikes => { name: "Toxic Spikes layers (0-2)", default: 0, max: 2 }, + PBEffects::WideGuard => { name: "Wide Guard applies this round", default: false } } FIELD_EFFECTS = { - PBEffects::AmuletCoin => { name: "Amulet Coin doubling prize money", default: false }, - PBEffects::FairyLock => { name: "Fairy Lock trapping duration", default: 0 }, - PBEffects::FusionBolt => { name: "Fusion Bolt was used", default: false }, - PBEffects::FusionFlare => { name: "Fusion Flare was used", default: false }, - PBEffects::Gravity => { name: "Gravity duration", default: 0 }, - PBEffects::HappyHour => { name: "Happy Hour doubling prize money", default: false }, - PBEffects::IonDeluge => { name: "Ion Deluge making moves Electric", default: false }, - PBEffects::MagicRoom => { name: "Magic Room duration", default: 0 }, - PBEffects::MudSportField => { name: "Mud Sport duration (Gen 6+)", default: 0 }, - PBEffects::PayDay => { name: "Pay Day additional prize money", default: 0, max: Settings::MAX_MONEY }, - PBEffects::TrickRoom => { name: "Trick Room duration", default: 0 }, - PBEffects::WaterSportField => { name: "Water Sport duration (Gen 6+)", default: 0 }, - PBEffects::WonderRoom => { name: "Wonder Room duration", default: 0 } + PBEffects::AmuletCoin => { name: "Amulet Coin doubling prize money", default: false }, + PBEffects::FairyLock => { name: "Fairy Lock trapping duration", default: 0 }, + PBEffects::FusionBolt => { name: "Fusion Bolt was used", default: false }, + PBEffects::FusionFlare => { name: "Fusion Flare was used", default: false }, + PBEffects::Gravity => { name: "Gravity duration", default: 0 }, + PBEffects::HappyHour => { name: "Happy Hour doubling prize money", default: false }, + PBEffects::IonDeluge => { name: "Ion Deluge making moves Electric", default: false }, + PBEffects::MagicRoom => { name: "Magic Room duration", default: 0 }, + PBEffects::MudSportField => { name: "Mud Sport duration (Gen 6+)", default: 0 }, + PBEffects::PayDay => { name: "Pay Day additional prize money", default: 0, max: Settings::MAX_MONEY }, + PBEffects::TrickRoom => { name: "Trick Room duration", default: 0 }, + PBEffects::WaterSportField => { name: "Water Sport duration (Gen 6+)", default: 0 }, + PBEffects::WonderRoom => { name: "Wonder Room duration", default: 0 } } end diff --git a/Data/Scripts/020_Debug/003_Editor_Listers.rb b/Data/Scripts/020_Debug/003_Editor_Listers.rb index c0232e9fb..c0073116f 100644 --- a/Data/Scripts/020_Debug/003_Editor_Listers.rb +++ b/Data/Scripts/020_Debug/003_Editor_Listers.rb @@ -123,7 +123,7 @@ class GraphicsLister @sprite = IconSprite.new(0, 0) @sprite.bitmap = nil @sprite.x = Graphics.width * 3 / 4 - @sprite.y = (Graphics.height - 64) / 2 + 64 + @sprite.y = ((Graphics.height - 64) / 2) + 64 @sprite.z = 2 @folder = folder @selection = selection @@ -308,7 +308,7 @@ class MapLister @sprite = SpriteWrapper.new @sprite.bitmap = nil @sprite.x = Graphics.width * 3 / 4 - @sprite.y = (Graphics.height - 64) / 2 + 64 + @sprite.y = ((Graphics.height - 64) / 2) + 64 @sprite.z = -2 @commands = [] @maps = pbMapTree @@ -477,7 +477,7 @@ end #=============================================================================== class TrainerTypeLister def initialize(selection = 0, includeNew = false) - @sprite = IconSprite.new(Graphics.width * 3 / 4, (Graphics.height - 64) / 2 + 64) + @sprite = IconSprite.new(Graphics.width * 3 / 4, ((Graphics.height - 64) / 2) + 64) @sprite.z = 2 @selection = selection @commands = [] diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 49f435d40..78d16d0f9 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -321,7 +321,8 @@ module Compiler end def checkEnumField(ret, enumer) - if enumer.is_a?(Module) + case enumer + when Module begin if nil_or_empty?(ret) || !enumer.const_defined?(ret) raise _INTL("Undefined value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport) @@ -330,7 +331,7 @@ module Compiler raise _INTL("Incorrect value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport) end return enumer.const_get(ret.to_sym) - elsif enumer.is_a?(Symbol) || enumer.is_a?(String) + when Symbol, String if !Kernel.const_defined?(enumer.to_sym) && GameData.const_defined?(enumer.to_sym) enumer = GameData.const_get(enumer.to_sym) begin @@ -351,13 +352,13 @@ module Compiler raise _INTL("Incorrect value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport) end return enumer.const_get(ret.to_sym) - elsif enumer.is_a?(Array) + when Array idx = findIndex(enumer) { |item| ret == item } if idx < 0 raise _INTL("Undefined value {1} (expected one of: {2})\r\n{3}", ret, enumer.inspect, FileLineData.linereport) end return idx - elsif enumer.is_a?(Hash) + when Hash value = enumer[ret] if value == nil raise _INTL("Undefined value {1} (expected one of: {2})\r\n{3}", ret, enumer.keys.inspect, FileLineData.linereport) @@ -368,10 +369,11 @@ module Compiler end def checkEnumFieldOrNil(ret, enumer) - if enumer.is_a?(Module) + case enumer + when Module return nil if nil_or_empty?(ret) || !(enumer.const_defined?(ret) rescue false) return enumer.const_get(ret.to_sym) - elsif enumer.is_a?(Symbol) || enumer.is_a?(String) + when Symbol, String if GameData.const_defined?(enumer.to_sym) enumer = GameData.const_get(enumer.to_sym) return nil if nil_or_empty?(ret) || !enumer.exists?(ret.to_sym) @@ -380,11 +382,11 @@ module Compiler enumer = Object.const_get(enumer.to_sym) return nil if nil_or_empty?(ret) || !(enumer.const_defined?(ret) rescue false) return enumer.const_get(ret.to_sym) - elsif enumer.is_a?(Array) + when Array idx = findIndex(enumer) { |item| ret == item } return nil if idx < 0 return idx - elsif enumer.is_a?(Hash) + when Hash return enumer[ret] end return nil @@ -568,14 +570,15 @@ module Compiler case schema[1][i, 1] when "e", "E" # Enumerable enumer = schema[2 + i] - if enumer.is_a?(Array) + case enumer + when Array file.write(enumer[value]) - elsif enumer.is_a?(Symbol) || enumer.is_a?(String) + when Symbol, String mod = Object.const_get(enumer.to_sym) file.write(getConstantName(mod, value)) - elsif enumer.is_a?(Module) + when Module file.write(getConstantName(enumer, value)) - elsif enumer.is_a?(Hash) + when Hash for key in enumer.keys if enumer[key] == value file.write(key) @@ -585,18 +588,19 @@ module Compiler end when "y", "Y" # Enumerable or integer enumer = schema[2 + i] - if enumer.is_a?(Array) + case enumer + when Array if enumer[value] != nil file.write(enumer[value]) else file.write(value) end - elsif enumer.is_a?(Symbol) || enumer.is_a?(String) + when Symbol, String mod = Object.const_get(enumer.to_sym) file.write(getConstantNameOrValue(mod, value)) - elsif enumer.is_a?(Module) + when Module file.write(getConstantNameOrValue(enumer, value)) - elsif enumer.is_a?(Hash) + when Hash hasenum = false for key in enumer.keys if enumer[key] == value @@ -756,48 +760,48 @@ module Compiler return if !$DEBUG begin dataFiles = [ - "abilities.dat", - "berry_plants.dat", - "encounters.dat", - "items.dat", - "map_connections.dat", - "map_metadata.dat", - "metadata.dat", - "moves.dat", - "phone.dat", - "player_metadata.dat", - "regional_dexes.dat", - "ribbons.dat", - "shadow_pokemon.dat", - "species.dat", - "species_metrics.dat", - "town_map.dat", - "trainer_lists.dat", - "trainer_types.dat", - "trainers.dat", - "types.dat" + "abilities.dat", + "berry_plants.dat", + "encounters.dat", + "items.dat", + "map_connections.dat", + "map_metadata.dat", + "metadata.dat", + "moves.dat", + "phone.dat", + "player_metadata.dat", + "regional_dexes.dat", + "ribbons.dat", + "shadow_pokemon.dat", + "species.dat", + "species_metrics.dat", + "town_map.dat", + "trainer_lists.dat", + "trainer_types.dat", + "trainers.dat", + "types.dat" ] textFiles = [ - "abilities.txt", - "battle_facility_lists.txt", - "berry_plants.txt", - "encounters.txt", - "items.txt", - "map_connections.txt", - "map_metadata.txt", - "metadata.txt", - "moves.txt", - "phone.txt", - "pokemon.txt", - "pokemon_forms.txt", - "pokemon_metrics.txt", - "regional_dexes.txt", - "ribbons.txt", - "shadow_pokemon.txt", - "town_map.txt", - "trainer_types.txt", - "trainers.txt", - "types.txt" + "abilities.txt", + "battle_facility_lists.txt", + "berry_plants.txt", + "encounters.txt", + "items.txt", + "map_connections.txt", + "map_metadata.txt", + "metadata.txt", + "moves.txt", + "phone.txt", + "pokemon.txt", + "pokemon_forms.txt", + "pokemon_metrics.txt", + "regional_dexes.txt", + "ribbons.txt", + "shadow_pokemon.txt", + "town_map.txt", + "trainer_types.txt", + "trainers.txt", + "types.txt" ] latestDataTime = 0 latestTextTime = 0 diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index 308ee6dba..d109178de 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -1585,12 +1585,12 @@ module Compiler def compile_battle_tower_trainers(filename) sections = [] requiredtypes = { - "Type" => [0, "e", :TrainerType], - "Name" => [1, "s"], - "BeginSpeech" => [2, "s"], - "EndSpeechWin" => [3, "s"], - "EndSpeechLose" => [4, "s"], - "PokemonNos" => [5, "*u"] + "Type" => [0, "e", :TrainerType], + "Name" => [1, "s"], + "BeginSpeech" => [2, "s"], + "EndSpeechWin" => [3, "s"], + "EndSpeechLose" => [4, "s"], + "PokemonNos" => [5, "*u"] } trainernames = [] beginspeech = [] diff --git a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb index 545654b5e..6a4669134 100644 --- a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb @@ -117,10 +117,10 @@ module Compiler def push_move_route(list, character, route, indent = 0) route = generate_move_route(route) if route.is_a?(Array) for i in 0...route.list.length - list.push(RPG::EventCommand.new( - (i == 0) ? 209 : 509, indent, - (i == 0) ? [character, route] : [route.list[i - 1]] - )) + list.push( + RPG::EventCommand.new((i == 0) ? 209 : 509, indent, + (i == 0) ? [character, route] : [route.list[i - 1]]) + ) end end @@ -307,7 +307,7 @@ module Compiler def getEventFromXY(mapID, x, y) return nil if x < 0 || y < 0 mapPositions = @mapxy[mapID] - return mapPositions[y * @mapWidths[mapID] + x] if mapPositions + return mapPositions[(y * @mapWidths[mapID]) + x] if mapPositions map = getMap(mapID) return nil if !map @mapWidths[mapID] = map.width @@ -315,10 +315,10 @@ module Compiler mapPositions = [] width = map.width for e in map.events.values - mapPositions[e.y * width + e.x] = e if e + mapPositions[(e.y * width) + e.x] = e if e end @mapxy[mapID] = mapPositions - return mapPositions[y * width + x] + return mapPositions[(y * width) + x] end def getEventFromID(mapID, id) @@ -783,22 +783,27 @@ module Compiler if transferCommand.length == 1 && !list.any? { |cmd| cmd.code == 208 } # Change Transparent Flag # Rewrite penultimate page list.clear - push_move_route_and_wait(list, 0, [ # Move Route for door opening - PBMoveRoute::PlaySE, RPG::AudioFile.new("Door enter"), PBMoveRoute::Wait, 2, + push_move_route_and_wait( # Move Route for door opening + list, 0, + [PBMoveRoute::PlaySE, RPG::AudioFile.new("Door enter"), PBMoveRoute::Wait, 2, PBMoveRoute::TurnLeft, PBMoveRoute::Wait, 2, PBMoveRoute::TurnRight, PBMoveRoute::Wait, 2, - PBMoveRoute::TurnUp, PBMoveRoute::Wait, 2 - ]) - push_move_route_and_wait(list, -1, [ # Move Route for player entering door - PBMoveRoute::ThroughOn, PBMoveRoute::Up, PBMoveRoute::ThroughOff - ]) + PBMoveRoute::TurnUp, PBMoveRoute::Wait, 2] + ) + push_move_route_and_wait( # Move Route for player entering door + list, -1, + [PBMoveRoute::ThroughOn, PBMoveRoute::Up, PBMoveRoute::ThroughOff] + ) push_event(list, 208, [0]) # Change Transparent Flag (invisible) push_script(list, "Followers.follow_into_door") push_event(list, 210, [], indent) # Wait for Move's Completion - push_move_route_and_wait(list, 0, [PBMoveRoute::Wait, 2, # Move Route for door closing - PBMoveRoute::TurnRight, PBMoveRoute::Wait, 2, - PBMoveRoute::TurnLeft, PBMoveRoute::Wait, 2, - PBMoveRoute::TurnDown, PBMoveRoute::Wait, 2]) + push_move_route_and_wait( # Move Route for door closing + list, 0, + [PBMoveRoute::Wait, 2, + PBMoveRoute::TurnRight, PBMoveRoute::Wait, 2, + PBMoveRoute::TurnLeft, PBMoveRoute::Wait, 2, + PBMoveRoute::TurnDown, PBMoveRoute::Wait, 2] + ) push_event(list, 223, [Tone.new(-255, -255, -255), 6]) # Change Screen Color Tone push_wait(list, 8) # Wait push_event(list, 208, [1]) # Change Transparent Flag (visible) @@ -811,17 +816,21 @@ module Compiler push_branch(list, "get_self.onEvent?") # Conditional Branch push_event(list, 208, [0], 1) # Change Transparent Flag (invisible) push_script(list, "Followers.hide_followers", 1) - push_move_route_and_wait(list, 0, [ # Move Route for setting door to open - PBMoveRoute::TurnLeft, PBMoveRoute::Wait, 6 - ], 1) + push_move_route_and_wait( # Move Route for setting door to open + list, 0, + [PBMoveRoute::TurnLeft, PBMoveRoute::Wait, 6], + 1 + ) push_event(list, 208, [1], 1) # Change Transparent Flag (visible) push_move_route_and_wait(list, -1, [PBMoveRoute::Down], 1) # Move Route for player exiting door push_script(list, "Followers.put_followers_on_player", 1) - push_move_route_and_wait(list, 0, [ # Move Route for door closing - PBMoveRoute::TurnUp, PBMoveRoute::Wait, 2, + push_move_route_and_wait( # Move Route for door closing + list, 0, + [PBMoveRoute::TurnUp, PBMoveRoute::Wait, 2, PBMoveRoute::TurnRight, PBMoveRoute::Wait, 2, - PBMoveRoute::TurnDown, PBMoveRoute::Wait, 2 - ], 1) + PBMoveRoute::TurnDown, PBMoveRoute::Wait, 2], + 1 + ) push_branch_end(list, 1) push_script(list, "setTempSwitchOn(\"A\")") push_end(list)