From aa643a6049b2d0f73390a04d9e9090bd06493a38 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Mon, 27 Dec 2021 00:26:45 +0000 Subject: [PATCH] More Rubocop --- .rubocop.yml | 5 + .../001_Debugging/005_Deprecation.rb | 4 +- .../001_Technical/005_PluginManager.rb | 4 +- Data/Scripts/001_Technical/006_RPG_Sprite.rb | 6 +- .../003_Game processing/001_StartGame.rb | 2 +- .../003_Game processing/003_Interpreter.rb | 2 +- .../004_Game_SelfSwitches.rb | 2 +- .../005_Sprites/004_Sprite_Reflection.rb | 2 +- Data/Scripts/005_Sprites/011_PictureEx.rb | 176 +++++++++--------- .../002_MessageConfig.rb | 2 +- .../007_Objects and windows/012_TextEntry.rb | 1 - Data/Scripts/008_Audio/001_Audio.rb | 12 +- Data/Scripts/008_Audio/002_Audio_Play.rb | 10 +- .../001_Battle/002_Battle_StartAndEnd.rb | 11 +- .../001_Battle/006_Battle_ActionUseItem.rb | 6 +- .../002_Battler/004_Battler_Statuses.rb | 5 +- .../002_Battler/005_Battler_StatStages.rb | 12 +- .../002_Battler/007_Battler_UseMove.rb | 2 +- .../003_Move/007_MoveEffects_BattlerOther.rb | 5 +- .../012_MoveEffects_ChangeMoveEffect.rb | 4 +- .../004_Scene/006_Battle_Scene_Objects.rb | 6 +- .../007_Battle_Scene_BaseAnimation.rb | 6 +- .../004_Scene/008_Battle_Scene_Animations.rb | 48 ++--- .../005_AI/006_AI_Move_Utilities.rb | 156 ++++++++-------- .../007_BattleAnimationPlayer.rb | 26 +-- .../001_SafariBattle.rb | 12 +- .../012_Overworld/004_Overworld_FieldMoves.rb | 2 +- Data/Scripts/013_Items/007_Item_Sprites.rb | 16 +- .../003_Pokemon_Sprites.rb | 48 ++--- Data/Scripts/014_Pokemon/001_Pokemon.rb | 2 +- .../015_Trainers and player/001_Trainer.rb | 2 +- .../005_Player_Pokedex.rb | 2 +- .../003_UI_EggHatching.rb | 2 +- .../004_UI_Evolution.rb | 4 +- .../001_Non-interactive UI/005_UI_Trading.rb | 12 +- .../006_UI_HallOfFame.rb | 2 +- Data/Scripts/016_UI/003_UI_Pokedex_Main.rb | 2 +- Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb | 10 +- Data/Scripts/016_UI/005_UI_Party.rb | 2 +- Data/Scripts/016_UI/006_UI_Summary.rb | 6 +- Data/Scripts/016_UI/013_UI_Load.rb | 2 +- Data/Scripts/016_UI/016_UI_ReadyMenu.rb | 2 +- Data/Scripts/016_UI/017_UI_PokemonStorage.rb | 2 +- Data/Scripts/016_UI/021_UI_MoveRelearner.rb | 2 +- Data/Scripts/016_UI/022_UI_PurifyChamber.rb | 2 +- Data/Scripts/016_UI/023_UI_MysteryGift.rb | 2 +- Data/Scripts/016_UI/024_UI_TextEntry.rb | 4 +- .../017_Minigames/003_Minigame_SlotMachine.rb | 2 +- .../017_Minigames/004_Minigame_VoltorbFlip.rb | 6 +- .../004_EditorScreens_SpritePositioning.rb | 4 +- .../001_AnimEditor_SceneElements.rb | 2 +- 51 files changed, 346 insertions(+), 323 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index bcfa65af1..a241762be 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -93,6 +93,11 @@ Style/Documentation: Style/FormatString: EnforcedStyle: sprintf +# String literals are not frozen by default, which makes this comment a +# pointless bit of boilerplate that we neither need nor want. +Style/FrozenStringLiteralComment: + Enabled: false + # RMXP and Essentials use lots of global variables. Style/GlobalVars: Enabled: false diff --git a/Data/Scripts/001_Technical/001_Debugging/005_Deprecation.rb b/Data/Scripts/001_Technical/001_Debugging/005_Deprecation.rb index 04e188a18..913459f22 100644 --- a/Data/Scripts/001_Technical/001_Debugging/005_Deprecation.rb +++ b/Data/Scripts/001_Technical/001_Debugging/005_Deprecation.rb @@ -43,8 +43,8 @@ class Module delimiter = class_method ? '.' : '#' target.define_method(name) do |*args, **kvargs| - alias_name = format('%s%s%s', class_name, delimiter, name) - aliased_method_name = format('%s%s%s', class_name, delimiter, aliased_method) + alias_name = sprintf('%s%s%s', class_name, delimiter, name) + aliased_method_name = sprintf('%s%s%s', class_name, delimiter, aliased_method) Deprecation.warn_method(alias_name, removal_in, aliased_method_name) method(aliased_method).call(*args, **kvargs) end diff --git a/Data/Scripts/001_Technical/005_PluginManager.rb b/Data/Scripts/001_Technical/005_PluginManager.rb index 7accbf02a..b5663c25c 100644 --- a/Data/Scripts/001_Technical/005_PluginManager.rb +++ b/Data/Scripts/001_Technical/005_PluginManager.rb @@ -413,12 +413,12 @@ module PluginManager # -1 if v1 is lower than v2 #----------------------------------------------------------------------------- def self.compare_versions(v1, v2) - d1 = v1.split("") + d1 = v1.chars d1.insert(0, "0") if d1[0] == "." # Turn ".123" into "0.123" while d1[-1] == "." # Turn "123." into "123" d1 = d1[0..-2] end - d2 = v2.split("") + d2 = v2.chars d2.insert(0, "0") if d2[0] == "." # Turn ".123" into "0.123" while d2[-1] == "." # Turn "123." into "123" d2 = d2[0..-2] diff --git a/Data/Scripts/001_Technical/006_RPG_Sprite.rb b/Data/Scripts/001_Technical/006_RPG_Sprite.rb index 40031e38d..981fe1f64 100644 --- a/Data/Scripts/001_Technical/006_RPG_Sprite.rb +++ b/Data/Scripts/001_Technical/006_RPG_Sprite.rb @@ -9,9 +9,9 @@ class SpriteAnimation ["x", "y", "ox", "oy", "viewport", "flash", "src_rect", "opacity", "tone"].each do |def_name| eval <<-__END__ - def #{def_name}(*arg) - @sprite.#{def_name}(*arg) - end + def #{def_name}(*arg) # def x(*arg) + @sprite.#{def_name}(*arg) # @sprite.x(*arg) + end # end __END__ end diff --git a/Data/Scripts/003_Game processing/001_StartGame.rb b/Data/Scripts/003_Game processing/001_StartGame.rb index 3c200c522..0b0fe4b48 100644 --- a/Data/Scripts/003_Game processing/001_StartGame.rb +++ b/Data/Scripts/003_Game processing/001_StartGame.rb @@ -10,7 +10,7 @@ module Game $data_system = load_data('Data/System.rxdata') pbLoadBattleAnimations GameData.load_all - map_file = format('Data/Map%03d.rxdata', $data_system.start_map_id) + map_file = sprintf('Data/Map%03d.rxdata', $data_system.start_map_id) if $data_system.start_map_id == 0 || !pbRgssExists?(map_file) raise _INTL('No starting position was set in the map editor.') end diff --git a/Data/Scripts/003_Game processing/003_Interpreter.rb b/Data/Scripts/003_Game processing/003_Interpreter.rb index a961b0f73..7abde2798 100644 --- a/Data/Scripts/003_Game processing/003_Interpreter.rb +++ b/Data/Scripts/003_Game processing/003_Interpreter.rb @@ -22,7 +22,7 @@ class Interpreter def inspect str = super.chop - str << format(' @event_id: %d>', @event_id) + str << sprintf(' @event_id: %d>', @event_id) return str end diff --git a/Data/Scripts/004_Game classes/001_Switches and Variables/004_Game_SelfSwitches.rb b/Data/Scripts/004_Game classes/001_Switches and Variables/004_Game_SelfSwitches.rb index c67b55d93..f5a3ccdec 100644 --- a/Data/Scripts/004_Game classes/001_Switches and Variables/004_Game_SelfSwitches.rb +++ b/Data/Scripts/004_Game classes/001_Switches and Variables/004_Game_SelfSwitches.rb @@ -16,7 +16,7 @@ class Game_SelfSwitches # key : key #----------------------------------------------------------------------------- def [](key) - return (@data[key] == true) ? true : false + return @data[key] == true end #----------------------------------------------------------------------------- # * Set Self Switch diff --git a/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb b/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb index fddce07d7..993dffba4 100644 --- a/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb +++ b/Data/Scripts/005_Sprites/004_Sprite_Reflection.rb @@ -8,7 +8,7 @@ class Sprite_Reflection @event = event @height = 0 @fixedheight = false - if @event != $game_player && @event&.name[/reflection\((\d+)\)/i] + if @event && @event != $game_player && @event.name[/reflection\((\d+)\)/i] @height = $~[1].to_i || 0 @fixedheight = true end diff --git a/Data/Scripts/005_Sprites/011_PictureEx.rb b/Data/Scripts/005_Sprites/011_PictureEx.rb index d6c908047..8a75607d4 100644 --- a/Data/Scripts/005_Sprites/011_PictureEx.rb +++ b/Data/Scripts/005_Sprites/011_PictureEx.rb @@ -1,38 +1,38 @@ class PictureOrigin - TopLeft = 0 - Center = 1 - TopRight = 2 - BottomLeft = 3 - LowerLeft = 3 - BottomRight = 4 - LowerRight = 4 - Top = 5 - Bottom = 6 - Left = 7 - Right = 8 + TOP_LEFT = 0 + CENTER = 1 + TOP_RIGHT = 2 + BOTTOM_LEFT = 3 + LOWER_LEFT = 3 + BOTTOM_RIGHT = 4 + LOWER_RIGHT = 4 + TOP = 5 + BOTTOM = 6 + LEFT = 7 + RIGHT = 8 end class Processes - XY = 0 - DeltaXY = 1 - Z = 2 - Curve = 3 - Zoom = 4 - Angle = 5 - Tone = 6 - Color = 7 - Hue = 8 - Opacity = 9 - Visible = 10 - BlendType = 11 - SE = 12 - Name = 13 - Origin = 14 - Src = 15 - SrcSize = 16 - CropBottom = 17 + XY = 0 + DELTA_XY = 1 + Z = 2 + CURVE = 3 + ZOOM = 4 + ANGLE = 5 + TONE = 6 + COLOR = 7 + HUE = 8 + OPACITY = 9 + VISIBLE = 10 + BLEND_TYPE = 11 + SE = 12 + NAME = 13 + ORIGIN = 14 + SRC = 15 + SRC_SIZE = 16 + CROP_BOTTOM = 17 end @@ -114,7 +114,7 @@ class PictureEx @visible = true @blend_type = 0 @name = "" - @origin = PictureOrigin::TopLeft + @origin = PictureOrigin::TOP_LEFT @src_rect = Rect.new(0, 0, -1, -1) @cropBottom = -1 @frameUpdates = [] @@ -213,12 +213,12 @@ class PictureEx def moveCurve(delay, duration, x1, y1, x2, y2, x3, y3, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) - @processes.push([Processes::Curve, delay, duration, 0, cb, [@x, @y, x1, y1, x2, y2, x3, y3]]) + @processes.push([Processes::CURVE, delay, duration, 0, cb, [@x, @y, x1, y1, x2, y2, x3, y3]]) end def moveDelta(delay, duration, x, y, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) - @processes.push([Processes::DeltaXY, delay, duration, 0, cb, @x, @y, x, y]) + @processes.push([Processes::DELTA_XY, delay, duration, 0, cb, @x, @y, x, y]) end def setDelta(delay, x, y, cb = nil) @@ -236,7 +236,7 @@ class PictureEx def moveZoomXY(delay, duration, zoom_x, zoom_y, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) - @processes.push([Processes::Zoom, delay, duration, 0, cb, @zoom_x, @zoom_y, zoom_x, zoom_y]) + @processes.push([Processes::ZOOM, delay, duration, 0, cb, @zoom_x, @zoom_y, zoom_x, zoom_y]) end def setZoomXY(delay, zoom_x, zoom_y, cb = nil) @@ -253,7 +253,7 @@ class PictureEx def moveAngle(delay, duration, angle, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) - @processes.push([Processes::Angle, delay, duration, 0, cb, @angle, angle]) + @processes.push([Processes::ANGLE, delay, duration, 0, cb, @angle, angle]) end def setAngle(delay, angle, cb = nil) @@ -263,7 +263,7 @@ class PictureEx def moveTone(delay, duration, tone, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) target = (tone) ? tone.clone : Tone.new(0, 0, 0, 0) - @processes.push([Processes::Tone, delay, duration, 0, cb, @tone.clone, target]) + @processes.push([Processes::TONE, delay, duration, 0, cb, @tone.clone, target]) end def setTone(delay, tone, cb = nil) @@ -273,7 +273,7 @@ class PictureEx def moveColor(delay, duration, color, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) target = (color) ? color.clone : Color.new(0, 0, 0, 0) - @processes.push([Processes::Color, delay, duration, 0, cb, @color.clone, target]) + @processes.push([Processes::COLOR, delay, duration, 0, cb, @color.clone, target]) end def setColor(delay, color, cb = nil) @@ -283,7 +283,7 @@ class PictureEx # Hue changes don't actually work. def moveHue(delay, duration, hue, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) - @processes.push([Processes::Hue, delay, duration, 0, cb, @hue, hue]) + @processes.push([Processes::HUE, delay, duration, 0, cb, @hue, hue]) end # Hue changes don't actually work. @@ -293,7 +293,7 @@ class PictureEx def moveOpacity(delay, duration, opacity, cb = nil) delay, duration = ensureDelayAndDuration(delay, duration) - @processes.push([Processes::Opacity, delay, duration, 0, cb, @opacity, opacity]) + @processes.push([Processes::OPACITY, delay, duration, 0, cb, @opacity, opacity]) end def setOpacity(delay, opacity, cb = nil) @@ -302,13 +302,13 @@ class PictureEx def setVisible(delay, visible, cb = nil) delay = ensureDelay(delay) - @processes.push([Processes::Visible, delay, 0, 0, cb, visible]) + @processes.push([Processes::VISIBLE, delay, 0, 0, cb, visible]) end # Only values of 0 (normal), 1 (additive) and 2 (subtractive) are allowed. def setBlendType(delay, blend, cb = nil) delay = ensureDelayAndDuration(delay) - @processes.push([Processes::BlendType, delay, 0, 0, cb, blend]) + @processes.push([Processes::BLEND_TYPE, delay, 0, 0, cb, blend]) end def setSE(delay, seFile, volume = nil, pitch = nil, cb = nil) @@ -318,28 +318,28 @@ class PictureEx def setName(delay, name, cb = nil) delay = ensureDelay(delay) - @processes.push([Processes::Name, delay, 0, 0, cb, name]) + @processes.push([Processes::NAME, delay, 0, 0, cb, name]) end def setOrigin(delay, origin, cb = nil) delay = ensureDelay(delay) - @processes.push([Processes::Origin, delay, 0, 0, cb, origin]) + @processes.push([Processes::ORIGIN, delay, 0, 0, cb, origin]) end def setSrc(delay, srcX, srcY, cb = nil) delay = ensureDelay(delay) - @processes.push([Processes::Src, delay, 0, 0, cb, srcX, srcY]) + @processes.push([Processes::SRC, delay, 0, 0, cb, srcX, srcY]) end def setSrcSize(delay, srcWidth, srcHeight, cb = nil) delay = ensureDelay(delay) - @processes.push([Processes::SrcSize, delay, 0, 0, cb, srcWidth, srcHeight]) + @processes.push([Processes::SRC_SIZE, delay, 0, 0, cb, srcWidth, srcHeight]) end # Used to cut Pokémon sprites off when they faint and sink into the ground. def setCropBottom(delay, y, cb = nil) delay = ensureDelay(delay) - @processes.push([Processes::CropBottom, delay, 0, 0, cb, y]) + @processes.push([Processes::CROP_BOTTOM, delay, 0, 0, cb, y]) end def update @@ -354,28 +354,28 @@ class PictureEx when Processes::XY process[5] = @x process[6] = @y - when Processes::DeltaXY + when Processes::DELTA_XY process[5] = @x process[6] = @y process[7] += @x process[8] += @y - when Processes::Curve + when Processes::CURVE process[5][0] = @x process[5][1] = @y when Processes::Z process[5] = @z - when Processes::Zoom + when Processes::ZOOM process[5] = @zoom_x process[6] = @zoom_y - when Processes::Angle + when Processes::ANGLE process[5] = @angle - when Processes::Tone + when Processes::TONE process[5] = @tone.clone - when Processes::Color + when Processes::COLOR process[5] = @color.clone - when Processes::Hue + when Processes::HUE process[5] = @hue - when Processes::Opacity + when Processes::OPACITY process[5] = @opacity end end @@ -389,49 +389,49 @@ class PictureEx fra = (process[2] == 0) ? 1 : process[3] # Frame counter dur = (process[2] == 0) ? 1 : process[2] # Total duration of process case process[0] - when Processes::XY, Processes::DeltaXY + when Processes::XY, Processes::DELTA_XY @x = process[5] + (fra * (process[7] - process[5]) / dur) @y = process[6] + (fra * (process[8] - process[6]) / dur) - when Processes::Curve + when Processes::CURVE @x, @y = getCubicPoint2(process[5], fra.to_f / dur) when Processes::Z @z = process[5] + (fra * (process[6] - process[5]) / dur) - when Processes::Zoom + when Processes::ZOOM @zoom_x = process[5] + (fra * (process[7] - process[5]) / dur) @zoom_y = process[6] + (fra * (process[8] - process[6]) / dur) - when Processes::Angle + when Processes::ANGLE @angle = process[5] + (fra * (process[6] - process[5]) / dur) - when Processes::Tone + 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) - when Processes::Color + 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) - when Processes::Hue + when Processes::HUE @hue = (process[6] - process[5]).to_f / dur - when Processes::Opacity + when Processes::OPACITY @opacity = process[5] + (fra * (process[6] - process[5]) / dur) - when Processes::Visible + when Processes::VISIBLE @visible = process[5] - when Processes::BlendType + when Processes::BLEND_TYPE @blend_type = process[5] when Processes::SE pbSEPlay(process[5], process[6], process[7]) - when Processes::Name + when Processes::NAME @name = process[5] - when Processes::Origin + when Processes::ORIGIN @origin = process[5] - when Processes::Src + when Processes::SRC @src_rect.x = process[5] @src_rect.y = process[6] - when Processes::SrcSize + when Processes::SRC_SIZE @src_rect.width = process[5] @src_rect.height = process[6] - when Processes::CropBottom + when Processes::CROP_BOTTOM @cropBottom = process[5] end # Increase frame counter @@ -447,7 +447,7 @@ class PictureEx @processes.compact! if procEnded # Add the constant rotation speed if @rotate_speed != 0 - @frameUpdates.push(Processes::Angle) if !@frameUpdates.include?(Processes::Angle) + @frameUpdates.push(Processes::ANGLE) if !@frameUpdates.include?(Processes::ANGLE) @angle += @rotate_speed while @angle < 0 @angle += 360 @@ -466,52 +466,52 @@ def setPictureSprite(sprite, picture, iconSprite = false) return if picture.frameUpdates.length == 0 picture.frameUpdates.each do |type| case type - when Processes::XY, Processes::DeltaXY + when Processes::XY, Processes::DELTA_XY sprite.x = picture.x.round sprite.y = picture.y.round when Processes::Z sprite.z = picture.z - when Processes::Zoom + when Processes::ZOOM sprite.zoom_x = picture.zoom_x / 100.0 sprite.zoom_y = picture.zoom_y / 100.0 - when Processes::Angle + when Processes::ANGLE sprite.angle = picture.angle - when Processes::Tone + when Processes::TONE sprite.tone = picture.tone - when Processes::Color + when Processes::COLOR sprite.color = picture.color - when Processes::Hue + when Processes::HUE # This doesn't do anything. - when Processes::BlendType + when Processes::BLEND_TYPE sprite.blend_type = picture.blend_type - when Processes::Opacity + when Processes::OPACITY sprite.opacity = picture.opacity - when Processes::Visible + when Processes::VISIBLE sprite.visible = picture.visible - when Processes::Name + when Processes::NAME sprite.name = picture.name if iconSprite && sprite.name != picture.name - when Processes::Origin + when Processes::ORIGIN case picture.origin - when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft + when PictureOrigin::TOP_LEFT, PictureOrigin::LEFT, PictureOrigin::BOTTOM_LEFT sprite.ox = 0 - when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom + when PictureOrigin::TOP, PictureOrigin::CENTER, PictureOrigin::BOTTOM sprite.ox = (sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.src_rect.width / 2 : 0 - when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight + when PictureOrigin::TOP_RIGHT, PictureOrigin::RIGHT, PictureOrigin::BOTTOM_RIGHT sprite.ox = (sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.src_rect.width : 0 end case picture.origin - when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight + when PictureOrigin::TOP_LEFT, PictureOrigin::TOP, PictureOrigin::TOP_RIGHT sprite.oy = 0 - when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right + when PictureOrigin::LEFT, PictureOrigin::CENTER, PictureOrigin::RIGHT sprite.oy = (sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.src_rect.height / 2 : 0 - when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight + when PictureOrigin::BOTTOM_LEFT, PictureOrigin::BOTTOM, PictureOrigin::BOTTOM_RIGHT sprite.oy = (sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.src_rect.height : 0 end - when Processes::Src + when Processes::SRC next unless iconSprite && sprite.src_rect sprite.src_rect.x = picture.src_rect.x sprite.src_rect.y = picture.src_rect.y - when Processes::SrcSize + when Processes::SRC_SIZE next unless iconSprite && sprite.src_rect sprite.src_rect.width = picture.src_rect.width sprite.src_rect.height = picture.src_rect.height diff --git a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb index c5c1cd9b3..933dcaa15 100644 --- a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb +++ b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb @@ -396,7 +396,7 @@ def pbDoEnsureBitmap(bitmap, dwidth, dheight) bitmap&.dispose bitmap = Bitmap.new([1, dwidth].max, [1, dheight].max) (oldfont) ? bitmap.font = oldfont : pbSetSystemFont(bitmap) - bitmap.font.shadow = false if bitmap.font&.respond_to?("shadow") + bitmap.font.shadow = false if bitmap.font.respond_to?("shadow") end return bitmap end diff --git a/Data/Scripts/007_Objects and windows/012_TextEntry.rb b/Data/Scripts/007_Objects and windows/012_TextEntry.rb index 07ece1cd7..1b5a84cbe 100644 --- a/Data/Scripts/007_Objects and windows/012_TextEntry.rb +++ b/Data/Scripts/007_Objects and windows/012_TextEntry.rb @@ -512,7 +512,6 @@ class Window_MultilineTextEntry < SpriteWindow_Base startY = getLineY(@firstline) textchars.each do |text| thisline = text[5] - thiscolumn = text[7] thislength = text[8] textY = text[2] - startY # Don't draw lines before the first or zero-length segments diff --git a/Data/Scripts/008_Audio/001_Audio.rb b/Data/Scripts/008_Audio/001_Audio.rb index e78018c73..23b578651 100644 --- a/Data/Scripts/008_Audio/001_Audio.rb +++ b/Data/Scripts/008_Audio/001_Audio.rb @@ -115,14 +115,14 @@ def getPlayTime2(filename) return -1 if wave != 0x45564157 # "WAVE" fmt = fgetdw.call(file) return -1 if fmt != 0x20746d66 # "fmt " - fmtsize = fgetdw.call(file) - format = fgetw.call(file) - channels = fgetw.call(file) - rate = fgetdw.call(file) + fgetdw.call(file) # fmtsize + fgetw.call(file) # format + fgetw.call(file) # channels + fgetdw.call(file) # rate bytessec = fgetdw.call(file) return -1 if bytessec == 0 - bytessample = fgetw.call(file) - bitssample = fgetw.call(file) + fgetw.call(file) # bytessample + fgetw.call(file) # bitssample data = fgetdw.call(file) return -1 if data != 0x61746164 # "data" datasize = fgetdw.call(file) diff --git a/Data/Scripts/008_Audio/002_Audio_Play.rb b/Data/Scripts/008_Audio/002_Audio_Play.rb index d80c5c5d3..be632542b 100644 --- a/Data/Scripts/008_Audio/002_Audio_Play.rb +++ b/Data/Scripts/008_Audio/002_Audio_Play.rb @@ -58,7 +58,7 @@ def pbBGMPlay(param, volume = nil, pitch = nil) return elsif (RPG.const_defined?(:BGM) rescue false) b = RPG::BGM.new(param.name, param.volume, param.pitch) - if b&.respond_to?("play") + if b.respond_to?("play") b.play return end @@ -108,7 +108,7 @@ def pbMEPlay(param, volume = nil, pitch = nil) return elsif (RPG.const_defined?(:ME) rescue false) b = RPG::ME.new(param.name, param.volume, param.pitch) - if b&.respond_to?("play") + if b.respond_to?("play") b.play return end @@ -125,7 +125,7 @@ def pbMEStop(timeInSeconds = 0.0) if $game_system && timeInSeconds > 0.0 && $game_system.respond_to?("me_fade") $game_system.me_fade(timeInSeconds) return - elsif $game_system&.respond_to?("me_stop") + elsif $game_system.respond_to?("me_stop") $game_system.me_stop(nil) return elsif (RPG.const_defined?(:ME) rescue false) @@ -158,7 +158,7 @@ def pbBGSPlay(param, volume = nil, pitch = nil) return elsif (RPG.const_defined?(:BGS) rescue false) b = RPG::BGS.new(param.name, param.volume, param.pitch) - if b&.respond_to?("play") + if b.respond_to?("play") b.play return end @@ -209,7 +209,7 @@ def pbSEPlay(param, volume = nil, pitch = nil) end if (RPG.const_defined?(:SE) rescue false) b = RPG::SE.new(param.name, param.volume, param.pitch) - if b&.respond_to?("play") + if b.respond_to?("play") b.play return 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 a7fb8df81..11696b6fc 100644 --- a/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb +++ b/Data/Scripts/011_Battle/001_Battle/002_Battle_StartAndEnd.rb @@ -60,10 +60,13 @@ class Battle end sideCounts.each_with_index do |_count, i| if !requireds[i] || requireds[i] == 0 - raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)", - i + 1, @sideSizes[0], @sideSizes[1]) if side == 0 - raise _INTL("Opposing trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)", - i + 1, @sideSizes[0], @sideSizes[1]) if side == 1 + if side == 0 + raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)", + i + 1, @sideSizes[0], @sideSizes[1]) + elsif side == 1 + raise _INTL("Opposing trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)", + i + 1, @sideSizes[0], @sideSizes[1]) + end end next if requireds[i] <= sideCounts[i] # Trainer has enough Pokémon to fill their positions if requireds[i] == 1 diff --git a/Data/Scripts/011_Battle/001_Battle/006_Battle_ActionUseItem.rb b/Data/Scripts/011_Battle/001_Battle/006_Battle_ActionUseItem.rb index 3e43494ac..7a29cb8c4 100644 --- a/Data/Scripts/011_Battle/001_Battle/006_Battle_ActionUseItem.rb +++ b/Data/Scripts/011_Battle/001_Battle/006_Battle_ActionUseItem.rb @@ -9,8 +9,10 @@ class Battle end # Embargo if battler && battler.effects[PBEffects::Embargo] > 0 - scene.pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!", - battler.pbThis(true))) if showMessages + if showMessages + scene.pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!", + battler.pbThis(true))) + end return false end return true diff --git a/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb b/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb index af40beffe..27d35437a 100644 --- a/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb +++ b/Data/Scripts/011_Battle/002_Battler/004_Battler_Statuses.rb @@ -61,8 +61,9 @@ class Battle::Battler case @battle.field.terrain when :Electric if newStatus == :SLEEP - @battle.pbDisplay(_INTL("{1} surrounds itself with electrified terrain!", - pbThis(true))) if showMessages + if showMessages + @battle.pbDisplay(_INTL("{1} surrounds itself with electrified terrain!", pbThis(true))) + end return false end when :Misty 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 52719c498..b8849df1c 100644 --- a/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb +++ b/Data/Scripts/011_Battle/002_Battler/005_Battler_StatStages.rb @@ -14,8 +14,10 @@ class Battle::Battler end # Check the stat stage if statStageAtMax?(stat) - @battle.pbDisplay(_INTL("{1}'s {2} won't go any higher!", - pbThis, GameData::Stat.get(stat).name)) if showFailMsg + if showFailMsg + @battle.pbDisplay(_INTL("{1}'s {2} won't go any higher!", + pbThis, GameData::Stat.get(stat).name)) + end return false end return true @@ -162,8 +164,10 @@ class Battle::Battler end # Check the stat stage if statStageAtMin?(stat) - @battle.pbDisplay(_INTL("{1}'s {2} won't go any lower!", - pbThis, GameData::Stat.get(stat).name)) if showFailMsg + if showFailMsg + @battle.pbDisplay(_INTL("{1}'s {2} won't go any lower!", + pbThis, GameData::Stat.get(stat).name)) + end return false end return true diff --git a/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb b/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb index 096f08f91..6ccf2f8a0 100644 --- a/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb +++ b/Data/Scripts/011_Battle/002_Battler/007_Battler_UseMove.rb @@ -468,7 +468,7 @@ class Battle::Battler @battle.pbHideAbilitySplash(b) if b.damageState.magicBounce newChoice = choice.clone newChoice[3] = user.index - newTargets = pbFindTargets(newChoice ,move, b) + newTargets = pbFindTargets(newChoice, move, b) newTargets = pbChangeTargets(move, b, newTargets) success = false if !move.pbMoveFailed?(b, newTargets) diff --git a/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb b/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb index ff0ce1ca9..6888fe3bd 100644 --- a/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb +++ b/Data/Scripts/011_Battle/003_Move/007_MoveEffects_BattlerOther.rb @@ -1358,8 +1358,9 @@ class Battle::Move::StartGravity < Battle::Move b.effects[PBEffects::SkyDrop] = -1 showMessage = true end - @battle.pbDisplay(_INTL("{1} couldn't stay airborne because of gravity!", - b.pbThis)) if showMessage + if showMessage + @battle.pbDisplay(_INTL("{1} couldn't stay airborne because of gravity!", b.pbThis)) + end end end 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 01b89c8a4..21449dd90 100644 --- a/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb +++ b/Data/Scripts/011_Battle/003_Move/012_MoveEffects_ChangeMoveEffect.rb @@ -607,9 +607,11 @@ class Battle::Move::HealUserDependingOnUserStockpile < Battle::Move @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!", user.pbThis)) showAnim = true if user.effects[PBEffects::StockpileDef] > 0 && - user.pbCanLowerStatStage?(:DEFENSE, user, self) && user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim) + user.pbCanLowerStatStage?(:DEFENSE, user, self) + if user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim) showAnim = false end + end if user.effects[PBEffects::StockpileSpDef] > 0 && user.pbCanLowerStatStage?(:SPECIAL_DEFENSE, user, self) user.pbLowerStatStage(:SPECIAL_DEFENSE, user.effects[PBEffects::StockpileSpDef], user, showAnim) 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 3c9cfa787..38c76a334 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 @@ -255,8 +255,10 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper else s = GameData::Status.get(@battler.status).icon_position end - imagePos.push(["Graphics/Pictures/Battle/icon_statuses", @spriteBaseX + 24, 36, - 0, s * STATUS_ICON_HEIGHT, -1, STATUS_ICON_HEIGHT]) if s >= 0 + if s >= 0 + imagePos.push(["Graphics/Pictures/Battle/icon_statuses", @spriteBaseX + 24, 36, + 0, s * STATUS_ICON_HEIGHT, -1, STATUS_ICON_HEIGHT]) + end end pbDrawImagePositions(self.bitmap, imagePos) refreshHP 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 3322ff64e..fa9b67d5b 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 @@ -17,7 +17,7 @@ class Battle::Scene::Animation def empty?; return @pictureEx.length == 0; end def animDone?; return @animDone; end - def addSprite(s, origin = PictureOrigin::TopLeft) + def addSprite(s, origin = PictureOrigin::TOP_LEFT) num = @pictureEx.length picture = PictureEx.new(s.z) picture.x = s.x @@ -31,7 +31,7 @@ class Battle::Scene::Animation return picture end - def addNewSprite(x, y, name, origin = PictureOrigin::TopLeft) + def addNewSprite(x, y, name, origin = PictureOrigin::TOP_LEFT) num = @pictureEx.length picture = PictureEx.new(num) picture.setXY(0, x, y) @@ -87,7 +87,7 @@ module Battle::Scene::Animation::BallAnimationMixin def addBallSprite(ballX, ballY, poke_ball) file_path = sprintf("Graphics/Battle animations/ball_%s", poke_ball) - ball = addNewSprite(ballX, ballY, file_path, PictureOrigin::Center) + ball = addNewSprite(ballX, ballY, file_path, PictureOrigin::CENTER) @ballSprite = @pictureSprites.last if @ballSprite.bitmap.width >= @ballSprite.bitmap.height @ballSprite.src_rect.width = @ballSprite.bitmap.height / 2 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 c7acd1985..2e6012e63 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 @@ -15,26 +15,26 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation makeSlideSprite("battle_bg2", 0.5, appearTime) end # Bases - makeSlideSprite("base_0", 1, appearTime, PictureOrigin::Bottom) - makeSlideSprite("base_1", -1, appearTime, PictureOrigin::Center) + makeSlideSprite("base_0", 1, appearTime, PictureOrigin::BOTTOM) + makeSlideSprite("base_1", -1, appearTime, PictureOrigin::CENTER) # Player sprite, partner trainer sprite @battle.player.each_with_index do |_p, i| - makeSlideSprite("player_#{i + 1}", 1, appearTime, PictureOrigin::Bottom) + makeSlideSprite("player_#{i + 1}", 1, appearTime, PictureOrigin::BOTTOM) end # Opposing trainer sprite(s) or wild Pokémon sprite(s) if @battle.trainerBattle? @battle.opponent.each_with_index do |_p, i| - makeSlideSprite("trainer_#{i + 1}", -1, appearTime, PictureOrigin::Bottom) + makeSlideSprite("trainer_#{i + 1}", -1, appearTime, PictureOrigin::BOTTOM) end else # Wild battle @battle.pbParty(1).each_with_index do |_pkmn, i| idxBattler = (2 * i) + 1 - makeSlideSprite("pokemon_#{idxBattler}", -1, appearTime, PictureOrigin::Bottom) + makeSlideSprite("pokemon_#{idxBattler}", -1, appearTime, PictureOrigin::BOTTOM) end end # Shadows @battle.battlers.length.times do |i| - makeSlideSprite("shadow_#{i}", (i.even?) ? 1 : -1, appearTime, PictureOrigin::Center) + makeSlideSprite("shadow_#{i}", (i.even?) ? 1 : -1, appearTime, PictureOrigin::CENTER) end # Fading blackness over whole screen blackScreen = addNewSprite(0, 0, "Graphics/Battle animations/black_screen") @@ -73,7 +73,7 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation @sideSize.times do |i| idxBattler = (2 * i) + 1 next if !@sprites["pokemon_#{idxBattler}"] - battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::Bottom) + battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::BOTTOM) battler.moveTone(0, 4, Tone.new(0, 0, 0, 0)) battler.setCallback(10 * i, [@sprites["pokemon_#{idxBattler}"], :pbPlayIntroAnimation]) end @@ -279,7 +279,7 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation delay = 0 # Make old trainer sprite move off-screen first if necessary if @idxTrainer > 0 && @sprites["trainer_#{@idxTrainer}"].visible - oldTrainer = addSprite(@sprites["trainer_#{@idxTrainer}"], PictureOrigin::Bottom) + oldTrainer = addSprite(@sprites["trainer_#{@idxTrainer}"], PictureOrigin::BOTTOM) oldTrainer.moveDelta(delay, 8, Graphics.width / 4, 0) oldTrainer.setVisible(delay + 8, false) delay = oldTrainer.totalDuration @@ -288,7 +288,7 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation if @sprites["trainer_#{@idxTrainer + 1}"] trainerX, trainerY = Battle::Scene.pbTrainerPosition(1) trainerX += 64 + (Graphics.width / 4) - newTrainer = addSprite(@sprites["trainer_#{@idxTrainer + 1}"], PictureOrigin::Bottom) + newTrainer = addSprite(@sprites["trainer_#{@idxTrainer + 1}"], PictureOrigin::BOTTOM) newTrainer.setVisible(delay, true) newTrainer.setXY(delay, trainerX, trainerY) newTrainer.moveDelta(delay, 8, -Graphics.width / 4, 0) @@ -318,7 +318,7 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation pl = @sprites[spriteNameBase + "_#{i}"] i += 1 next if !pl.visible || pl.x < 0 - trainer = addSprite(pl, PictureOrigin::Bottom) + trainer = addSprite(pl, PictureOrigin::BOTTOM) trainer.moveDelta(0, 16, -Graphics.width / 2, 0) # Animate trainer sprite(s) if they have multiple frames if pl.bitmap && !pl.bitmap.disposed? && pl.bitmap.width >= pl.bitmap.height * 2 @@ -371,7 +371,7 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation trSprite = @sprites[spriteNameBase + "_#{i}"] i += 1 next if !trSprite.visible || trSprite.x > Graphics.width - trainer = addSprite(trSprite, PictureOrigin::Bottom) + trainer = addSprite(trSprite, PictureOrigin::BOTTOM) trainer.moveDelta(0, 16, Graphics.width / 2, 0) trainer.setVisible(16, false) end @@ -456,7 +456,7 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation ballBurst(delay, battlerStartX, battlerStartY - 18, poke_ball) ball.moveOpacity(delay + 2, 2, 0) # Set up battler sprite - battler = addSprite(batSprite, PictureOrigin::Bottom) + battler = addSprite(batSprite, PictureOrigin::BOTTOM) battler.setXY(0, battlerStartX, battlerStartY) battler.setZoom(0, 0) battler.setColor(0, col) @@ -464,7 +464,7 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation battlerAppear(battler, delay, battlerEndX, battlerEndY, batSprite, col) if @shadowVisible # Set up shadow sprite - shadow = addSprite(shaSprite, PictureOrigin::Center) + shadow = addSprite(shaSprite, PictureOrigin::CENTER) shadow.setOpacity(0, 0) # Shadow animation shadow.setVisible(delay, @shadowVisible) @@ -520,7 +520,7 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio ballBurst(delay, battlerStartX, battlerStartY - 18, poke_ball) ball.moveOpacity(delay + 2, 2, 0) # Set up battler sprite - battler = addSprite(batSprite, PictureOrigin::Bottom) + battler = addSprite(batSprite, PictureOrigin::BOTTOM) battler.setXY(0, battlerStartX, battlerStartY) battler.setZoom(0, 0) battler.setColor(0, col) @@ -528,7 +528,7 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio battlerAppear(battler, delay, battlerEndX, battlerEndY, batSprite, col) if @shadowVisible # Set up shadow sprite - shadow = addSprite(shaSprite, PictureOrigin::Center) + shadow = addSprite(shaSprite, PictureOrigin::CENTER) shadow.setOpacity(0, 0) # Shadow animation shadow.setVisible(delay, @shadowVisible) @@ -570,7 +570,7 @@ class Battle::Scene::Animation::BattlerRecall < Battle::Scene::Animation battlerEndX = ballPos[0] battlerEndY = ballPos[1] # Set up battler sprite - battler = addSprite(batSprite, PictureOrigin::Bottom) + battler = addSprite(batSprite, PictureOrigin::BOTTOM) battler.setVisible(0, true) battler.setColor(0, col) # Set up Poké Ball sprite @@ -585,7 +585,7 @@ class Battle::Scene::Animation::BattlerRecall < Battle::Scene::Animation battlerAbsorb(battler, delay, battlerEndX, battlerEndY, col) if shaSprite.visible # Set up shadow sprite - shadow = addSprite(shaSprite, PictureOrigin::Center) + shadow = addSprite(shaSprite, PictureOrigin::CENTER) # Shadow animation shadow.moveOpacity(0, 10, 0) shadow.setVisible(delay, false) @@ -609,8 +609,8 @@ class Battle::Scene::Animation::BattlerDamage < Battle::Scene::Animation batSprite = @sprites["pokemon_#{@idxBattler}"] shaSprite = @sprites["shadow_#{@idxBattler}"] # Set up battler/shadow sprite - battler = addSprite(batSprite, PictureOrigin::Bottom) - shadow = addSprite(shaSprite, PictureOrigin::Center) + battler = addSprite(batSprite, PictureOrigin::BOTTOM) + shadow = addSprite(shaSprite, PictureOrigin::CENTER) # Animation delay = 0 case @effectiveness @@ -647,8 +647,8 @@ class Battle::Scene::Animation::BattlerFaint < Battle::Scene::Animation batSprite = @sprites["pokemon_#{@idxBattler}"] shaSprite = @sprites["shadow_#{@idxBattler}"] # Set up battler/shadow sprite - battler = addSprite(batSprite, PictureOrigin::Bottom) - shadow = addSprite(shaSprite, PictureOrigin::Center) + battler = addSprite(batSprite, PictureOrigin::BOTTOM) + shadow = addSprite(shaSprite, PictureOrigin::CENTER) # Get approx duration depending on sprite's position/size. Min 20 frames. battlerTop = batSprite.y - batSprite.height cropY = Battle::Scene.pbBattlerPosition(@idxBattler, @battle.pbSideSize(@idxBattler))[1] @@ -723,7 +723,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation @ballSpriteIndex = (@success) ? @tempSprites.length - 1 : -1 # Set up trainer sprite (only visible in Safari Zone battles) if @showingTrainer && traSprite && traSprite.bitmap.width >= traSprite.bitmap.height * 2 - trainer = addSprite(traSprite, PictureOrigin::Bottom) + trainer = addSprite(traSprite, PictureOrigin::BOTTOM) # Trainer animation ballStartX, ballStartY = trainerThrowingFrames(ball, trainer, traSprite) end @@ -738,7 +738,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation delay = ball.totalDuration + 6 ballOpenUp(ball, delay, @poke_ball, true, false) # Set up battler sprite - battler = addSprite(batSprite, PictureOrigin::Bottom) + battler = addSprite(batSprite, PictureOrigin::BOTTOM) # Poké Ball absorbs battler delay = ball.totalDuration ballBurstCapture(delay, ballEndX, ballEndY, @poke_ball) @@ -751,7 +751,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation battler.setVisible(delay + 5, false) if @shadowVisible # Set up shadow sprite - shadow = addSprite(shaSprite, PictureOrigin::Center) + shadow = addSprite(shaSprite, PictureOrigin::CENTER) # Shadow animation shadow.moveOpacity(delay, 5, 0) shadow.moveZoom(delay, 5, 0) 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 ab6e64fe5..f61e6fcc3 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 @@ -391,20 +391,22 @@ class Battle::AI ) end end - if skill >= PBTrainerAI.bestSkill && target.itemActive? && (target.item && !target.item.is_berry?) - Battle::ItemEffects.triggerDamageCalcFromTarget( - target.item, user, target, move, multipliers, baseDmg, type - ) - end + if skill >= PBTrainerAI.bestSkill && + target.itemActive? && target.item && !target.item.is_berry? + Battle::ItemEffects.triggerDamageCalcFromTarget( + target.item, user, target, move, multipliers, baseDmg, type + ) + end # Global abilities - if skill >= PBTrainerAI.mediumSkill && ((@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) || - (@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)) - if @battle.pbCheckGlobalAbility(:AURABREAK) - multipliers[:base_damage_multiplier] *= 2 / 3.0 - else - multipliers[:base_damage_multiplier] *= 4 / 3.0 - end + if skill >= PBTrainerAI.mediumSkill && + ((@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) || + (@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)) + if @battle.pbCheckGlobalAbility(:AURABREAK) + multipliers[:base_damage_multiplier] *= 2 / 3.0 + else + multipliers[:base_damage_multiplier] *= 4 / 3.0 end + end # Parental Bond if skill >= PBTrainerAI.mediumSkill && user.hasActiveAbility?(:PARENTALBOND) multipliers[:base_damage_multiplier] *= 1.25 @@ -413,9 +415,10 @@ class Battle::AI # TODO # Helping Hand - n/a # Charge - if skill >= PBTrainerAI.mediumSkill && (user.effects[PBEffects::Charge] > 0 && type == :ELECTRIC) - multipliers[:base_damage_multiplier] *= 2 - end + if skill >= PBTrainerAI.mediumSkill && + user.effects[PBEffects::Charge] > 0 && type == :ELECTRIC + multipliers[:base_damage_multiplier] *= 2 + end # Mud Sport and Water Sport if skill >= PBTrainerAI.mediumSkill if type == :ELECTRIC @@ -450,16 +453,16 @@ class Battle::AI end # Badge multipliers if skill >= PBTrainerAI.highSkill && @battle.internalBattle && target.pbOwnedByPlayer? - if move.physicalMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_DEFENSE - multipliers[:defense_multiplier] *= 1.1 - elsif move.specialMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_SPDEF - multipliers[:defense_multiplier] *= 1.1 - end - end + if move.physicalMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_DEFENSE + multipliers[:defense_multiplier] *= 1.1 + elsif move.specialMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_SPDEF + multipliers[:defense_multiplier] *= 1.1 + end + end # Multi-targeting attacks if skill >= PBTrainerAI.highSkill && pbTargetsMultiple?(move, user) - multipliers[:final_damage_multiplier] *= 0.75 - end + multipliers[:final_damage_multiplier] *= 0.75 + end # Weather if skill >= PBTrainerAI.mediumSkill case user.effectiveWeather @@ -487,50 +490,51 @@ class Battle::AI # Critical hits - n/a # Random variance - n/a # STAB - if skill >= PBTrainerAI.mediumSkill && (type && user.pbHasType?(type)) - if user.hasActiveAbility?(:ADAPTABILITY) - multipliers[:final_damage_multiplier] *= 2 - else - multipliers[:final_damage_multiplier] *= 1.5 - end + if skill >= PBTrainerAI.mediumSkill && type && user.pbHasType?(type) + if user.hasActiveAbility?(:ADAPTABILITY) + multipliers[:final_damage_multiplier] *= 2 + else + multipliers[:final_damage_multiplier] *= 1.5 end + end # Type effectiveness if skill >= PBTrainerAI.mediumSkill typemod = pbCalcTypeMod(type, user, target) multipliers[:final_damage_multiplier] *= typemod.to_f / Effectiveness::NORMAL_EFFECTIVE end # Burn - if skill >= PBTrainerAI.highSkill && (user.status == :BURN && move.physicalMove?(type) && - !user.hasActiveAbility?(:GUTS) && - !(Settings::MECHANICS_GENERATION >= 6 && move.function == "DoublePowerIfUserPoisonedBurnedParalyzed")) # Facade - multipliers[:final_damage_multiplier] /= 2 - end + if skill >= PBTrainerAI.highSkill && move.physicalMove?(type) && + user.status == :BURN && !user.hasActiveAbility?(:GUTS) && + !(Settings::MECHANICS_GENERATION >= 6 && + move.function == "DoublePowerIfUserPoisonedBurnedParalyzed") # Facade + multipliers[:final_damage_multiplier] /= 2 + end # Aurora Veil, Reflect, Light Screen - if skill >= PBTrainerAI.highSkill && (!move.ignoresReflect? && !user.hasActiveAbility?(:INFILTRATOR)) - if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0 - if @battle.pbSideBattlerCount(target) > 1 - multipliers[:final_damage_multiplier] *= 2 / 3.0 - else - multipliers[:final_damage_multiplier] /= 2 - end - elsif target.pbOwnSide.effects[PBEffects::Reflect] > 0 && move.physicalMove?(type) - if @battle.pbSideBattlerCount(target) > 1 - multipliers[:final_damage_multiplier] *= 2 / 3.0 - else - multipliers[:final_damage_multiplier] /= 2 - end - elsif target.pbOwnSide.effects[PBEffects::LightScreen] > 0 && move.specialMove?(type) - if @battle.pbSideBattlerCount(target) > 1 - multipliers[:final_damage_multiplier] *= 2 / 3.0 - else - multipliers[:final_damage_multiplier] /= 2 - end + if skill >= PBTrainerAI.highSkill && !move.ignoresReflect? && !user.hasActiveAbility?(:INFILTRATOR) + if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0 + if @battle.pbSideBattlerCount(target) > 1 + multipliers[:final_damage_multiplier] *= 2 / 3.0 + else + multipliers[:final_damage_multiplier] /= 2 + end + elsif target.pbOwnSide.effects[PBEffects::Reflect] > 0 && move.physicalMove?(type) + if @battle.pbSideBattlerCount(target) > 1 + multipliers[:final_damage_multiplier] *= 2 / 3.0 + else + multipliers[:final_damage_multiplier] /= 2 + end + elsif target.pbOwnSide.effects[PBEffects::LightScreen] > 0 && move.specialMove?(type) + if @battle.pbSideBattlerCount(target) > 1 + multipliers[:final_damage_multiplier] *= 2 / 3.0 + else + multipliers[:final_damage_multiplier] /= 2 end end + end # Minimize if skill >= PBTrainerAI.highSkill && (target.effects[PBEffects::Minimize] && move.tramplesMinimize?(2)) - multipliers[:final_damage_multiplier] *= 2 - end + multipliers[:final_damage_multiplier] *= 2 + end # Move-specific base damage modifiers # TODO # Move-specific final damage modifiers @@ -549,16 +553,16 @@ class Battle::AI if c >= 0 && user.abilityActive? c = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.ability, user, target, c) end - if skill >= PBTrainerAI.bestSkill && (c >= 0 && !moldBreaker && target.abilityActive?) - c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c) - end + if skill >= PBTrainerAI.bestSkill && c >= 0 && !moldBreaker && target.abilityActive? + c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c) + end # Item effects that alter critical hit rate if c >= 0 && user.itemActive? c = Battle::ItemEffects.triggerCriticalCalcFromUser(user.item, user, target, c) end - if skill >= PBTrainerAI.bestSkill && (c >= 0 && target.itemActive?) - c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c) - end + if skill >= PBTrainerAI.bestSkill && c >= 0 && target.itemActive? + c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c) + end # Other efffects c = -1 if target.pbOwnSide.effects[PBEffects::LuckyChant] > 0 if c >= 0 @@ -632,22 +636,22 @@ class Battle::AI ) end end - if skill >= PBTrainerAI.bestSkill && (target.abilityActive? && !moldBreaker) - Battle::AbilityEffects.triggerAccuracyCalcFromTarget( - target.ability, modifiers, user, target, move, type - ) - end + if skill >= PBTrainerAI.bestSkill && target.abilityActive? && !moldBreaker + Battle::AbilityEffects.triggerAccuracyCalcFromTarget( + target.ability, modifiers, user, target, move, type + ) + end # Item effects that alter accuracy calculation if skill >= PBTrainerAI.mediumSkill && user.itemActive? - Battle::ItemEffects.triggerAccuracyCalcFromUser( - user.item, modifiers, user, target, move, type - ) - end + Battle::ItemEffects.triggerAccuracyCalcFromUser( + user.item, modifiers, user, target, move, type + ) + end if skill >= PBTrainerAI.bestSkill && target.itemActive? - Battle::ItemEffects.triggerAccuracyCalcFromTarget( - target.item, modifiers, user, target, move, type - ) - end + Battle::ItemEffects.triggerAccuracyCalcFromTarget( + target.item, modifiers, user, target, move, type + ) + end # Other effects, inc. ones that set accuracy_multiplier or evasion_stage to specific values if skill >= PBTrainerAI.mediumSkill if @battle.field.effects[PBEffects::Gravity] > 0 @@ -666,8 +670,8 @@ class Battle::AI user.effects[PBEffects::LockOnPos] == target.index end if skill >= PBTrainerAI.highSkill - if move.function == "BadPoisonTarget" && (Settings::MORE_TYPE_EFFECTS && move.statusMove? && - user.pbHasType?(:POISON)) # Toxic + if move.function == "BadPoisonTarget" && # Toxic + Settings::MORE_TYPE_EFFECTS && move.statusMove? && user.pbHasType?(:POISON) modifiers[:base_accuracy] = 0 end if ["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(move.function) 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 bc198ad3b..b1cb0c0e2 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 @@ -499,8 +499,8 @@ class PBAnimation < Array pbSEPlay(name, i.volume, i.pitch) if name end # if sprite -# sprite.flash(i.flashColor,i.flashDuration*2) if i.flashScope==1 -# sprite.flash(nil,i.flashDuration*2) if i.flashScope==3 +# sprite.flash(i.flashColor, i.flashDuration * 2) if i.flashScope == 1 +# sprite.flash(nil, i.flashDuration * 2) if i.flashScope == 3 # end when 1 # Set background graphic (immediate) if i.name && i.name != "" @@ -509,12 +509,12 @@ class PBAnimation < Array bgGraphic.oy = -i.bgY || 0 bgGraphic.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0) bgGraphic.opacity = i.opacity || 0 - bgColor.opacity = 0 + bgColor.opacity = 0 else bgGraphic.setBitmap(nil) bgGraphic.opacity = 0 - bgColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0) - bgColor.opacity = i.opacity || 0 + bgColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0) + bgColor.opacity = i.opacity || 0 end when 2 # Move/recolour background graphic if bgGraphic.bitmap.nil? @@ -535,12 +535,12 @@ class PBAnimation < Array foGraphic.oy = -i.bgY || 0 foGraphic.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0) foGraphic.opacity = i.opacity || 0 - foColor.opacity = 0 + foColor.opacity = 0 else foGraphic.setBitmap(nil) foGraphic.opacity = 0 - foColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0) - foColor.opacity = i.opacity || 0 + foColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0) + foColor.opacity = i.opacity || 0 end when 4 # Move/recolour foreground graphic if foGraphic.bitmap.nil? @@ -563,12 +563,12 @@ 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? - bgColor.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity != nil + 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) + bgColor.color = Color.new(cr, cg, cb, ca) else 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 @@ -577,14 +577,14 @@ class PBAnimation < Array 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) + bgGraphic.color = Color.new(cr, cg, cb, ca) end when 4 next if !i.duration || i.duration <= 0 next if frame < i.frame || frame > i.frame + i.duration fraction = (frame - i.frame).to_f / i.duration if foGraphic.bitmap.nil? - foColor.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity != nil + 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 @@ -598,7 +598,7 @@ class PBAnimation < Array 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) + foGraphic.color = Color.new(cr, cg, cb, ca) end end 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 043c4f3d4..bcff111af 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 @@ -119,10 +119,10 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation ballEndX = ballPos[0] - 40 ballEndY = ballPos[1] - 4 # Set up trainer sprite - trainer = addSprite(traSprite, PictureOrigin::Bottom) + trainer = addSprite(traSprite, PictureOrigin::BOTTOM) # Set up bait sprite ball = addNewSprite(ballStartX, ballStartY, - "Graphics/Battle animations/safari_bait", PictureOrigin::Center) + "Graphics/Battle animations/safari_bait", PictureOrigin::CENTER) ball.setZ(0, batSprite.z + 1) # Trainer animation if traSprite.bitmap.width >= traSprite.bitmap.height * 2 @@ -138,7 +138,7 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation ball.moveOpacity(delay + 8, 2, 0) ball.setVisible(delay + 10, false) # Set up battler sprite - battler = addSprite(batSprite, PictureOrigin::Bottom) + battler = addSprite(batSprite, PictureOrigin::BOTTOM) # Show Pokémon jumping before eating the bait delay = ball.totalDuration + 3 2.times do @@ -184,10 +184,10 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation ballEndX = batSprite.x ballEndY = batSprite.y - (batSprite.bitmap.height / 2) # Set up trainer sprite - trainer = addSprite(traSprite, PictureOrigin::Bottom) + trainer = addSprite(traSprite, PictureOrigin::BOTTOM) # Set up bait sprite ball = addNewSprite(ballStartX, ballStartY, - "Graphics/Battle animations/safari_rock", PictureOrigin::Center) + "Graphics/Battle animations/safari_rock", PictureOrigin::CENTER) ball.setZ(0, batSprite.z + 1) # Trainer animation if traSprite.bitmap.width >= traSprite.bitmap.height * 2 @@ -205,7 +205,7 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation ball.setVisible(delay + 4, false) # Set up anger sprite anger = addNewSprite(ballEndX - 42, ballEndY - 36, - "Graphics/Battle animations/safari_anger", PictureOrigin::Center) + "Graphics/Battle animations/safari_anger", PictureOrigin::CENTER) anger.setVisible(0, false) anger.setZ(0, batSprite.z + 1) # Show anger appearing diff --git a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb index 4cea205a2..bda89da78 100644 --- a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb +++ b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb @@ -74,7 +74,7 @@ def pbHiddenMoveAnimation(pokemon) bg = Sprite.new(viewport) bg.bitmap = RPG::Cache.picture("hiddenMovebg") sprite = PokemonSprite.new(viewport) - sprite.setOffset(PictureOrigin::Center) + sprite.setOffset(PictureOrigin::CENTER) sprite.setPokemonBitmap(pokemon) sprite.z = 1 sprite.visible = false diff --git a/Data/Scripts/013_Items/007_Item_Sprites.rb b/Data/Scripts/013_Items/007_Item_Sprites.rb index 214d07865..a94e72e7b 100644 --- a/Data/Scripts/013_Items/007_Item_Sprites.rb +++ b/Data/Scripts/013_Items/007_Item_Sprites.rb @@ -42,27 +42,27 @@ class ItemIconSprite < SpriteWrapper @forceitemchange = false end - def setOffset(offset = PictureOrigin::Center) + def setOffset(offset = PictureOrigin::CENTER) @offset = offset changeOrigin end def changeOrigin - @offset = PictureOrigin::Center if !@offset + @offset = PictureOrigin::CENTER if !@offset case @offset - when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight + when PictureOrigin::TOP_LEFT, PictureOrigin::TOP, PictureOrigin::TOP_RIGHT self.oy = 0 - when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right + when PictureOrigin::LEFT, PictureOrigin::CENTER, PictureOrigin::RIGHT self.oy = self.height / 2 - when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight + when PictureOrigin::BOTTOM_LEFT, PictureOrigin::BOTTOM, PictureOrigin::BOTTOM_RIGHT self.oy = self.height end case @offset - when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft + when PictureOrigin::TOP_LEFT, PictureOrigin::LEFT, PictureOrigin::BOTTOM_LEFT self.ox = 0 - when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom + when PictureOrigin::TOP, PictureOrigin::CENTER, PictureOrigin::BOTTOM self.ox = self.width / 2 - when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight + when PictureOrigin::TOP_RIGHT, PictureOrigin::RIGHT, PictureOrigin::BOTTOM_RIGHT self.ox = self.width end end diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb index 45ebe66d3..03ba82d92 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/003_Pokemon_Sprites.rb @@ -20,28 +20,28 @@ class PokemonSprite < SpriteWrapper self.bitmap = nil end - def setOffset(offset = PictureOrigin::Center) + def setOffset(offset = PictureOrigin::CENTER) @offset = offset changeOrigin end def changeOrigin return if !self.bitmap - @offset = PictureOrigin::Center if !@offset + @offset = PictureOrigin::CENTER if !@offset case @offset - when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft + when PictureOrigin::TOP_LEFT, PictureOrigin::LEFT, PictureOrigin::BOTTOM_LEFT self.ox = 0 - when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom + when PictureOrigin::TOP, PictureOrigin::CENTER, PictureOrigin::BOTTOM self.ox = self.bitmap.width / 2 - when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight + when PictureOrigin::TOP_RIGHT, PictureOrigin::RIGHT, PictureOrigin::BOTTOM_RIGHT self.ox = self.bitmap.width end case @offset - when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight + when PictureOrigin::TOP_LEFT, PictureOrigin::TOP, PictureOrigin::TOP_RIGHT self.oy = 0 - when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right + when PictureOrigin::LEFT, PictureOrigin::CENTER, PictureOrigin::RIGHT self.oy = self.bitmap.height / 2 - when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight + when PictureOrigin::BOTTOM_LEFT, PictureOrigin::BOTTOM, PictureOrigin::BOTTOM_RIGHT self.oy = self.bitmap.height end end @@ -138,30 +138,30 @@ class PokemonIconSprite < SpriteWrapper changeOrigin end - def setOffset(offset = PictureOrigin::Center) + def setOffset(offset = PictureOrigin::CENTER) @offset = offset changeOrigin end def changeOrigin return if !self.bitmap - @offset = PictureOrigin::TopLeft if !@offset + @offset = PictureOrigin::TOP_LEFT if !@offset case @offset - when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft + when PictureOrigin::TOP_LEFT, PictureOrigin::LEFT, PictureOrigin::BOTTOM_LEFT self.ox = 0 - when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom + when PictureOrigin::TOP, PictureOrigin::CENTER, PictureOrigin::BOTTOM self.ox = self.src_rect.width / 2 - when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight + when PictureOrigin::TOP_RIGHT, PictureOrigin::RIGHT, PictureOrigin::BOTTOM_RIGHT self.ox = self.src_rect.width end case @offset - when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight + when PictureOrigin::TOP_LEFT, PictureOrigin::TOP, PictureOrigin::TOP_RIGHT self.oy = 0 - when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right + when PictureOrigin::LEFT, PictureOrigin::CENTER, PictureOrigin::RIGHT # NOTE: This assumes the top quarter of the icon is blank, so oy is placed # in the middle of the lower three quarters of the image. self.oy = self.src_rect.height * 5 / 8 - when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight + when PictureOrigin::BOTTOM_LEFT, PictureOrigin::BOTTOM, PictureOrigin::BOTTOM_RIGHT self.oy = self.src_rect.height end end @@ -268,30 +268,30 @@ class PokemonSpeciesIconSprite < SpriteWrapper refresh end - def setOffset(offset = PictureOrigin::Center) + def setOffset(offset = PictureOrigin::CENTER) @offset = offset changeOrigin end def changeOrigin return if !self.bitmap - @offset = PictureOrigin::TopLeft if !@offset + @offset = PictureOrigin::TOP_LEFT if !@offset case @offset - when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft + when PictureOrigin::TOP_LEFT, PictureOrigin::LEFT, PictureOrigin::BOTTOM_LEFT self.ox = 0 - when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom + when PictureOrigin::TOP, PictureOrigin::CENTER, PictureOrigin::BOTTOM self.ox = self.src_rect.width / 2 - when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight + when PictureOrigin::TOP_RIGHT, PictureOrigin::RIGHT, PictureOrigin::BOTTOM_RIGHT self.ox = self.src_rect.width end case @offset - when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight + when PictureOrigin::TOP_LEFT, PictureOrigin::TOP, PictureOrigin::TOP_RIGHT self.oy = 0 - when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right + when PictureOrigin::LEFT, PictureOrigin::CENTER, PictureOrigin::RIGHT # NOTE: This assumes the top quarter of the icon is blank, so oy is placed # in the middle of the lower three quarters of the image. self.oy = self.src_rect.height * 5 / 8 - when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight + when PictureOrigin::BOTTOM_LEFT, PictureOrigin::BOTTOM, PictureOrigin::BOTTOM_RIGHT self.oy = self.src_rect.height end end diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index d95ac2d78..4d4069fab 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -106,7 +106,7 @@ class Pokemon def inspect str = super.chop - str << format(' %s Lv.%s>', @species, @level.to_s || '???') + str << sprintf(' %s Lv.%s>', @species, @level.to_s || '???') return str end diff --git a/Data/Scripts/015_Trainers and player/001_Trainer.rb b/Data/Scripts/015_Trainers and player/001_Trainer.rb index 460caddb8..301643ce0 100644 --- a/Data/Scripts/015_Trainers and player/001_Trainer.rb +++ b/Data/Scripts/015_Trainers and player/001_Trainer.rb @@ -11,7 +11,7 @@ class Trainer def inspect str = super.chop party_str = @party.map { |p| p.species_data.species }.inspect - str << format(' %s @party=%s>', self.full_name, party_str) + str << sprintf(' %s @party=%s>', self.full_name, party_str) return str end diff --git a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb index 57d1e8a1b..28e46bee7 100644 --- a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb +++ b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb @@ -7,7 +7,7 @@ class Player < Trainer def inspect str = super.chop - str << format(' seen: %d, owned: %d>', self.seen_count, self.owned_count) + str << sprintf(' seen: %d, owned: %d>', self.seen_count, self.owned_count) return str end 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 256e3cf6b..3ab0a8377 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 @@ -21,7 +21,7 @@ class PokemonEggHatch_Scene Color.new(248, 248, 248), @viewport) # Create egg sprite/Pokémon sprite @sprites["pokemon"] = PokemonSprite.new(@viewport) - @sprites["pokemon"].setOffset(PictureOrigin::Bottom) + @sprites["pokemon"].setOffset(PictureOrigin::BOTTOM) @sprites["pokemon"].x = Graphics.width / 2 @sprites["pokemon"].y = 264 + 56 # 56 to offset the egg sprite @sprites["pokemon"].setSpeciesBitmap(@pokemon.species, @pokemon.gender, 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 9a153e292..f8e091c5e 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 @@ -498,12 +498,12 @@ class PokemonEvolutionScene addBackgroundOrColoredPlane(@sprites, "background", "evolutionbg", Color.new(248, 248, 248), @bgviewport) rsprite1 = PokemonSprite.new(@viewport) - rsprite1.setOffset(PictureOrigin::Center) + rsprite1.setOffset(PictureOrigin::CENTER) rsprite1.setPokemonBitmap(@pokemon, false) rsprite1.x = Graphics.width / 2 rsprite1.y = (Graphics.height - 64) / 2 rsprite2 = PokemonSprite.new(@viewport) - rsprite2.setOffset(PictureOrigin::Center) + rsprite2.setOffset(PictureOrigin::CENTER) rsprite2.setPokemonBitmapSpecies(@pokemon, @newspecies, false) rsprite2.x = rsprite1.x rsprite2.y = rsprite1.y 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 d86fb86cb..fcba29166 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 @@ -36,14 +36,14 @@ class PokemonTrade_Scene Color.new(248, 248, 248), @viewport) @sprites["rsprite1"] = PokemonSprite.new(@viewport) @sprites["rsprite1"].setPokemonBitmap(@pokemon, false) - @sprites["rsprite1"].setOffset(PictureOrigin::Bottom) + @sprites["rsprite1"].setOffset(PictureOrigin::BOTTOM) @sprites["rsprite1"].x = Graphics.width / 2 @sprites["rsprite1"].y = 264 @sprites["rsprite1"].z = 10 @pokemon.species_data.apply_metrics_to_sprite(@sprites["rsprite1"], 1) @sprites["rsprite2"] = PokemonSprite.new(@viewport) @sprites["rsprite2"].setPokemonBitmap(@pokemon2, false) - @sprites["rsprite2"].setOffset(PictureOrigin::Bottom) + @sprites["rsprite2"].setOffset(PictureOrigin::BOTTOM) @sprites["rsprite2"].x = Graphics.width / 2 @sprites["rsprite2"].y = 264 @sprites["rsprite2"].z = 10 @@ -63,11 +63,11 @@ class PokemonTrade_Scene pictureBall.setXY(0, Graphics.width / 2, 48) pictureBall.setName(0, ballimage) pictureBall.setSrcSize(0, 32, 64) - pictureBall.setOrigin(0, PictureOrigin::Center) + pictureBall.setOrigin(0, PictureOrigin::CENTER) pictureBall.setVisible(0, true) # Starting position of sprite picturePoke.setXY(0, @sprites["rsprite1"].x, @sprites["rsprite1"].y) - picturePoke.setOrigin(0, PictureOrigin::Bottom) + picturePoke.setOrigin(0, PictureOrigin::BOTTOM) picturePoke.setVisible(0, true) # Change Pokémon color picturePoke.moveColor(2, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 255)) @@ -105,10 +105,10 @@ class PokemonTrade_Scene pictureBall.setXY(0, Graphics.width / 2, -32) pictureBall.setName(0, ballimage) pictureBall.setSrcSize(0, 32, 64) - pictureBall.setOrigin(0, PictureOrigin::Center) + pictureBall.setOrigin(0, PictureOrigin::CENTER) pictureBall.setVisible(0, true) # Starting position of sprite - picturePoke.setOrigin(0, PictureOrigin::Bottom) + picturePoke.setOrigin(0, PictureOrigin::BOTTOM) picturePoke.setZoom(0, 0) picturePoke.setColor(0, Color.new(31 * 8, 22 * 8, 30 * 8, 255)) picturePoke.setVisible(0, false) 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 730e34f9b..64daac571 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 @@ -210,7 +210,7 @@ class HallOfFame_Scene ypoint = ypointformula(i) pok = @hallEntry[i] @sprites["pokemon#{i}"] = PokemonSprite.new(@viewport) - @sprites["pokemon#{i}"].setOffset(PictureOrigin::TopLeft) + @sprites["pokemon#{i}"].setOffset(PictureOrigin::TOP_LEFT) @sprites["pokemon#{i}"].setPokemonBitmap(pok) # This method doesn't put the exact coordinates @sprites["pokemon#{i}"].x = xpoint diff --git a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb index 9445f7485..9790c48e9 100644 --- a/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb +++ b/Data/Scripts/016_UI/003_UI_Pokedex_Main.rb @@ -281,7 +281,7 @@ class PokemonPokedex_Scene @sprites["searchbg"].visible = false @sprites["pokedex"] = Window_Pokedex.new(206, 30, 276, 364, @viewport) @sprites["icon"] = PokemonSprite.new(@viewport) - @sprites["icon"].setOffset(PictureOrigin::Center) + @sprites["icon"].setOffset(PictureOrigin::CENTER) @sprites["icon"].x = 112 @sprites["icon"].y = 196 @sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport) diff --git a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb index e4b93d975..20e290451 100644 --- a/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb +++ b/Data/Scripts/016_UI/004_UI_Pokedex_Entry.rb @@ -14,7 +14,7 @@ class PokemonPokedexInfo_Scene @sprites = {} @sprites["background"] = IconSprite.new(0, 0, @viewport) @sprites["infosprite"] = PokemonSprite.new(@viewport) - @sprites["infosprite"].setOffset(PictureOrigin::Center) + @sprites["infosprite"].setOffset(PictureOrigin::CENTER) @sprites["infosprite"].x = 104 @sprites["infosprite"].y = 136 @mapdata = pbLoadTownMapData @@ -40,14 +40,14 @@ class PokemonPokedexInfo_Scene @sprites["areaoverlay"] = IconSprite.new(0, 0, @viewport) @sprites["areaoverlay"].setBitmap("Graphics/Pictures/Pokedex/overlay_area") @sprites["formfront"] = PokemonSprite.new(@viewport) - @sprites["formfront"].setOffset(PictureOrigin::Center) + @sprites["formfront"].setOffset(PictureOrigin::CENTER) @sprites["formfront"].x = 130 @sprites["formfront"].y = 158 @sprites["formback"] = PokemonSprite.new(@viewport) - @sprites["formback"].setOffset(PictureOrigin::Bottom) + @sprites["formback"].setOffset(PictureOrigin::BOTTOM) @sprites["formback"].x = 382 # y is set below as it depends on metrics @sprites["formicon"] = PokemonSpeciesIconSprite.new(nil, @viewport) - @sprites["formicon"].setOffset(PictureOrigin::Center) + @sprites["formicon"].setOffset(PictureOrigin::CENTER) @sprites["formicon"].x = 82 @sprites["formicon"].y = 328 @sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow", 8, 28, 40, 2, @viewport) @@ -99,7 +99,7 @@ class PokemonPokedexInfo_Scene @sprites = {} @sprites["background"] = IconSprite.new(0, 0, @viewport) @sprites["infosprite"] = PokemonSprite.new(@viewport) - @sprites["infosprite"].setOffset(PictureOrigin::Center) + @sprites["infosprite"].setOffset(PictureOrigin::CENTER) @sprites["infosprite"].x = 104 @sprites["infosprite"].y = 136 @sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport) diff --git a/Data/Scripts/016_UI/005_UI_Party.rb b/Data/Scripts/016_UI/005_UI_Party.rb index 7f9708ca1..d2fadbe2d 100644 --- a/Data/Scripts/016_UI/005_UI_Party.rb +++ b/Data/Scripts/016_UI/005_UI_Party.rb @@ -207,7 +207,7 @@ class PokemonPartyPanel < SpriteWrapper @ballsprite.addBitmap("desel", "Graphics/Pictures/Party/icon_ball") @ballsprite.addBitmap("sel", "Graphics/Pictures/Party/icon_ball_sel") @pkmnsprite = PokemonIconSprite.new(pokemon, viewport) - @pkmnsprite.setOffset(PictureOrigin::Center) + @pkmnsprite.setOffset(PictureOrigin::CENTER) @pkmnsprite.active = @active @pkmnsprite.z = self.z + 2 @helditemsprite = HeldItemIconSprite.new(0, 0, @pokemon, viewport) diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index 72398b337..765c41e04 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -122,12 +122,12 @@ class PokemonSummary_Scene @sprites = {} @sprites["background"] = IconSprite.new(0, 0, @viewport) @sprites["pokemon"] = PokemonSprite.new(@viewport) - @sprites["pokemon"].setOffset(PictureOrigin::Center) + @sprites["pokemon"].setOffset(PictureOrigin::CENTER) @sprites["pokemon"].x = 104 @sprites["pokemon"].y = 206 @sprites["pokemon"].setPokemonBitmap(@pokemon) @sprites["pokeicon"] = PokemonIconSprite.new(@pokemon, @viewport) - @sprites["pokeicon"].setOffset(PictureOrigin::Center) + @sprites["pokeicon"].setOffset(PictureOrigin::CENTER) @sprites["pokeicon"].x = 46 @sprites["pokeicon"].y = 92 @sprites["pokeicon"].visible = false @@ -189,7 +189,7 @@ class PokemonSummary_Scene @sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport) pbSetSystemFont(@sprites["overlay"].bitmap) @sprites["pokeicon"] = PokemonIconSprite.new(@pokemon, @viewport) - @sprites["pokeicon"].setOffset(PictureOrigin::Center) + @sprites["pokeicon"].setOffset(PictureOrigin::CENTER) @sprites["pokeicon"].x = 46 @sprites["pokeicon"].y = 92 @sprites["movesel"] = MoveSelectionSprite.new(@viewport, !move_to_learn.nil?) diff --git a/Data/Scripts/016_UI/013_UI_Load.rb b/Data/Scripts/016_UI/013_UI_Load.rb index 52c652396..c23024e85 100644 --- a/Data/Scripts/016_UI/013_UI_Load.rb +++ b/Data/Scripts/016_UI/013_UI_Load.rb @@ -177,7 +177,7 @@ class PokemonLoad_Scene end trainer.party.each_with_index do |pkmn, i| @sprites["party#{i}"] = PokemonIconSprite.new(pkmn, @viewport) - @sprites["party#{i}"].setOffset(PictureOrigin::Center) + @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}"].z = 99999 diff --git a/Data/Scripts/016_UI/016_UI_ReadyMenu.rb b/Data/Scripts/016_UI/016_UI_ReadyMenu.rb index 2b9b3c78b..ad48b1d33 100644 --- a/Data/Scripts/016_UI/016_UI_ReadyMenu.rb +++ b/Data/Scripts/016_UI/016_UI_ReadyMenu.rb @@ -22,7 +22,7 @@ class ReadyMenuButton < SpriteWrapper pbSetSystemFont(self.bitmap) if @command[2] @icon = PokemonIconSprite.new($player.party[@command[3]], viewport) - @icon.setOffset(PictureOrigin::Center) + @icon.setOffset(PictureOrigin::CENTER) else @icon = ItemIconSprite.new(0, 0, @command[0], viewport) end diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index fbd74f5a2..cc8c1d06d 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -598,7 +598,7 @@ class PokemonStorageScene @sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @boxsidesviewport) pbSetSystemFont(@sprites["overlay"].bitmap) @sprites["pokemon"] = AutoMosaicPokemonSprite.new(@boxsidesviewport) - @sprites["pokemon"].setOffset(PictureOrigin::Center) + @sprites["pokemon"].setOffset(PictureOrigin::CENTER) @sprites["pokemon"].x = 90 @sprites["pokemon"].y = 134 @sprites["boxparty"] = PokemonBoxPartySprite.new(@storage.party, @boxsidesviewport) diff --git a/Data/Scripts/016_UI/021_UI_MoveRelearner.rb b/Data/Scripts/016_UI/021_UI_MoveRelearner.rb index a9bd238d7..3f3735730 100644 --- a/Data/Scripts/016_UI/021_UI_MoveRelearner.rb +++ b/Data/Scripts/016_UI/021_UI_MoveRelearner.rb @@ -27,7 +27,7 @@ class MoveRelearner_Scene @sprites = {} addBackgroundPlane(@sprites, "bg", "reminderbg", @viewport) @sprites["pokeicon"] = PokemonIconSprite.new(@pokemon, @viewport) - @sprites["pokeicon"].setOffset(PictureOrigin::Center) + @sprites["pokeicon"].setOffset(PictureOrigin::CENTER) @sprites["pokeicon"].x = 320 @sprites["pokeicon"].y = 84 @sprites["background"] = IconSprite.new(0, 0, @viewport) diff --git a/Data/Scripts/016_UI/022_UI_PurifyChamber.rb b/Data/Scripts/016_UI/022_UI_PurifyChamber.rb index 1b22592ec..decba6c81 100644 --- a/Data/Scripts/016_UI/022_UI_PurifyChamber.rb +++ b/Data/Scripts/016_UI/022_UI_PurifyChamber.rb @@ -860,7 +860,7 @@ class PurifyChamberSetView < SpriteWrapper @directflow.setFlowStrength(1) @__sprites = [] @__sprites[0] = PokemonIconSprite.new(nil, viewport) - PurifyChamber::SETSIZE * 2.times do |i| + (PurifyChamber::SETSIZE * 2).times do |i| @__sprites[i + 1] = PokemonIconSprite.new(nil, viewport) end @__sprites[1 + (PurifyChamber::SETSIZE * 2)] = PokemonIconSprite.new(nil, viewport) diff --git a/Data/Scripts/016_UI/023_UI_MysteryGift.rb b/Data/Scripts/016_UI/023_UI_MysteryGift.rb index 434140398..d39a36302 100644 --- a/Data/Scripts/016_UI/023_UI_MysteryGift.rb +++ b/Data/Scripts/016_UI/023_UI_MysteryGift.rb @@ -277,7 +277,7 @@ def pbDownloadMysteryGift(trainer) sprites["msgwindow"].visible = false if gift[1] == 0 sprite = PokemonSprite.new(viewport) - sprite.setOffset(PictureOrigin::Center) + sprite.setOffset(PictureOrigin::CENTER) sprite.setPokemonBitmap(gift[2]) sprite.x = Graphics.width / 2 sprite.y = -sprite.bitmap.height / 2 diff --git a/Data/Scripts/016_UI/024_UI_TextEntry.rb b/Data/Scripts/016_UI/024_UI_TextEntry.rb index 8c5e9129d..0588b23a0 100644 --- a/Data/Scripts/016_UI/024_UI_TextEntry.rb +++ b/Data/Scripts/016_UI/024_UI_TextEntry.rb @@ -141,7 +141,7 @@ class PokemonEntryScene @sprites["shadow"].x = 33 * 2 @sprites["shadow"].y = 32 * 2 @sprites["subject"] = PokemonIconSprite.new(pokemon, @viewport) - @sprites["subject"].setOffset(PictureOrigin::Center) + @sprites["subject"].setOffset(PictureOrigin::CENTER) @sprites["subject"].x = 88 @sprites["subject"].y = 54 @sprites["gender"] = BitmapSprite.new(32, 32, @viewport) @@ -426,7 +426,7 @@ class PokemonEntryScene2 @sprites["shadow"].x = 66 @sprites["shadow"].y = 64 @sprites["subject"] = PokemonIconSprite.new(pokemon, @viewport) - @sprites["subject"].setOffset(PictureOrigin::Center) + @sprites["subject"].setOffset(PictureOrigin::CENTER) @sprites["subject"].x = 88 @sprites["subject"].y = 54 @sprites["gender"] = BitmapSprite.new(32, 32, @viewport) diff --git a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb index 212f942df..b067787d9 100644 --- a/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb +++ b/Data/Scripts/017_Minigames/003_Minigame_SlotMachine.rb @@ -347,7 +347,7 @@ class SlotMachineScene @wager = 3 (1..5).each do |i| @sprites["row#{i}"].visible = true - end + end end @sprites["reel1"].startSpinning @sprites["reel2"].startSpinning diff --git a/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb b/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb index f70e97cc0..44ad9d625 100644 --- a/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb +++ b/Data/Scripts/017_Minigames/004_Minigame_VoltorbFlip.rb @@ -435,7 +435,7 @@ class VoltorbFlip numText += "0" end numText += num.to_s - numImages = numText.split(//)[0...2] + numImages = numText.chars[0...2] 2.times do |j| @numbers[j] = [@directory + "numbersSmall", 472 + (j * 16), (i * 64) + 8, numImages[j].to_i * 16, 0, 16, 16] end @@ -453,7 +453,7 @@ class VoltorbFlip numText += "0" end numText += num.to_s - numImages = numText.split(//)[0...2] + numImages = numText.chars[0...2] 2.times do |j| @numbers[j] = [@directory + "numbersSmall", (i * 64) + 152 + (j * 16), 328, numImages[j].to_i * 16, 0, 16, 16] end @@ -470,7 +470,7 @@ class VoltorbFlip coinText += "0" end coinText += source.to_s - coinImages = coinText.split(//)[0...5] + coinImages = coinText.chars[0...5] 5.times do |i| @coins[i] = [@directory + "numbersScore", 6 + (i * 24), y, coinImages[i].to_i * 24, 0, 24, 38] 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 cc636fc0f..a224f5e06 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 @@ -72,10 +72,10 @@ class SpritePositioner @sprites["shadow_1"] = IconSprite.new(0, 0, @viewport) @sprites["shadow_1"].z = 3 @sprites["pokemon_0"] = PokemonSprite.new(@viewport) - @sprites["pokemon_0"].setOffset(PictureOrigin::Bottom) + @sprites["pokemon_0"].setOffset(PictureOrigin::BOTTOM) @sprites["pokemon_0"].z = 4 @sprites["pokemon_1"] = PokemonSprite.new(@viewport) - @sprites["pokemon_1"].setOffset(PictureOrigin::Bottom) + @sprites["pokemon_1"].setOffset(PictureOrigin::BOTTOM) @sprites["pokemon_1"].z = 4 @sprites["info"] = Window_UnformattedTextPokemon.new("") @sprites["info"].viewport = @viewport 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 b1e49a551..4a16c2022 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 @@ -802,7 +802,7 @@ class AnimationCanvas < Sprite if Input.trigger?(Input::MOUSELEFT) && mousepos && pbSpriteHitTest(self, mousepos[0], mousepos[1], false, true) selectedcel = -1 - usealpha = (Input.press?(Input::ALT)) ? true : false + usealpha = Input.press?(Input::ALT) PBAnimation::MAX_SPRITES.times do |j| if pbSpriteHitTest(@celsprites[j], mousepos[0], mousepos[1], usealpha, false) selectedcel = j