From 05d362701555512b067fc2f45ee7b393cd779adc Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 9 May 2021 16:48:47 +0100 Subject: [PATCH] Fixed event movement checks ignoring ledges if they're not on the top layer, fixed Sketch not working, fixed a couple of other minor bugs, Rubocop-suggested tweaks --- .../001_Switches and Variables/001_Game_Temp.rb | 2 -- Data/Scripts/004_Game classes/004_Game_Map.rb | 5 +++-- Data/Scripts/004_Game classes/006_Game_MapFactory.rb | 12 +++++------- .../004_Game classes/012_Game_DependentEvents.rb | 2 -- .../Scripts/005_Sprites/009_Sprite_DynamicShadows.rb | 8 ++++---- .../007_Objects and windows/008_AnimatedBitmap.rb | 2 +- Data/Scripts/007_Objects and windows/009_Planes.rb | 2 -- Data/Scripts/007_Objects and windows/011_Messages.rb | 2 -- Data/Scripts/008_Audio/001_Audio.rb | 3 --- .../011_Battle/002_Move/005_Move_Effects_000-07F.rb | 2 +- .../003_Battle/005_Battle_Action_AttacksPriority.rb | 1 - .../001_Overworld visuals/001_Overworld_Weather.rb | 4 ---- .../001_Overworld_BattleStarting.rb | 1 - .../012_Overworld/008_Overworld_RandomDungeons.rb | 3 +-- Data/Scripts/013_Items/005_Item_PokeRadar.rb | 1 - Data/Scripts/016_UI/020_UI_PokeMart.rb | 4 ++-- Data/Scripts/016_UI/022_UI_PurifyChamber.rb | 3 +-- .../001_ChallengeGenerator_Data.rb | 1 - .../002_ChallengeGenerator_Pokemon.rb | 2 +- .../001_AnimEditor_SceneElements.rb | 9 +-------- Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb | 2 +- 21 files changed, 21 insertions(+), 50 deletions(-) diff --git a/Data/Scripts/004_Game classes/001_Switches and Variables/001_Game_Temp.rb b/Data/Scripts/004_Game classes/001_Switches and Variables/001_Game_Temp.rb index 6c0c6fcd2..981a54638 100644 --- a/Data/Scripts/004_Game classes/001_Switches and Variables/001_Game_Temp.rb +++ b/Data/Scripts/004_Game classes/001_Switches and Variables/001_Game_Temp.rb @@ -24,8 +24,6 @@ class Game_Temp attr_accessor :to_title # return to title screen flag attr_accessor :fadestate # for sprite hashes attr_accessor :background_bitmap - attr_accessor :message_window_showing - attr_accessor :transition_processing attr_accessor :mart_prices #----------------------------------------------------------------------------- # * Object Initialization diff --git a/Data/Scripts/004_Game classes/004_Game_Map.rb b/Data/Scripts/004_Game classes/004_Game_Map.rb index c431fe8ac..864f30739 100644 --- a/Data/Scripts/004_Game classes/004_Game_Map.rb +++ b/Data/Scripts/004_Game classes/004_Game_Map.rb @@ -205,8 +205,9 @@ class Game_Map for j in [2, 1, 0] facing_tile_id = data[newx, newy, j] return false if facing_tile_id == nil - return false if GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id]).ledge - break + facing_terrain = GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id]) + return false if facing_terrain.ledge + break if facing_terrain.id != :None && !facing_terrain.ignore_passability end end # Regular passability checks diff --git a/Data/Scripts/004_Game classes/006_Game_MapFactory.rb b/Data/Scripts/004_Game classes/006_Game_MapFactory.rb index 43d022fa7..9c4dcf6ce 100644 --- a/Data/Scripts/004_Game classes/006_Game_MapFactory.rb +++ b/Data/Scripts/004_Game classes/006_Game_MapFactory.rb @@ -30,13 +30,11 @@ class PokemonMapFactory @mapIndex = 0 if !@mapIndex || @mapIndex<0 return @maps[@mapIndex] if @maps[@mapIndex] raise "No maps in save file... (mapIndex=#{@mapIndex})" if @maps.length==0 - for i in 0...@maps.length - if @maps[i] - echoln("Using next map, may be incorrect (mapIndex=#{@mapIndex}, length=#{@maps.length})") - return @maps[i] - end - raise "No maps in save file... (all maps empty; mapIndex=#{@mapIndex})" + if @maps[0] + echoln("Using next map, may be incorrect (mapIndex=#{@mapIndex}, length=#{@maps.length})") + return @maps[0] end + raise "No maps in save file... (all maps empty; mapIndex=#{@mapIndex})" end def hasMap?(id) @@ -256,7 +254,7 @@ class PokemonMapFactory posX = thisX + conn[1] - conn[4] + otherX posY = thisY + conn[2] - conn[5] + otherY return [posX, posY] - else + elsif conn[1] == otherMapID posX = thisX + conn[4] - conn[1] + otherX posY = thisY + conn[5] - conn[2] + otherY return [posX, posY] diff --git a/Data/Scripts/004_Game classes/012_Game_DependentEvents.rb b/Data/Scripts/004_Game classes/012_Game_DependentEvents.rb index c92207cc4..a0618ba65 100644 --- a/Data/Scripts/004_Game classes/012_Game_DependentEvents.rb +++ b/Data/Scripts/004_Game classes/012_Game_DependentEvents.rb @@ -303,8 +303,6 @@ class DependentEvents newFollower.moveto(mapTile[1],mapTile[2]) newEventData[3]=mapTile[1] newEventData[4]=mapTile[2] - if mapTile[0]==leader.map.map_id - end end end end diff --git a/Data/Scripts/005_Sprites/009_Sprite_DynamicShadows.rb b/Data/Scripts/005_Sprites/009_Sprite_DynamicShadows.rb index 6c1f86cde..7ac04ed7a 100644 --- a/Data/Scripts/005_Sprites/009_Sprite_DynamicShadows.rb +++ b/Data/Scripts/005_Sprites/009_Sprite_DynamicShadows.rb @@ -66,10 +66,10 @@ class Sprite_Shadow < RPG::Sprite sy = (@character.direction - 2) / 2 * @ch if self.angle > 90 || angle < -90 case @character.direction - when 2 then sy = (8- 2) / 2 * @ch - when 4 then sy = (6- 2) / 2 * @ch - when 6 then sy = (4- 2) / 2 * @ch - when 8 then sy = (2- 2) / 2 * @ch + when 2 then sy = @ch * 3 + when 4 then sy = @ch * 2 + when 6 then sy = @ch + when 8 then sy = 0 end end self.src_rect.set(sx, sy, @cw, @ch) diff --git a/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb b/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb index 0ea8c29c9..16c99a4f8 100644 --- a/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb +++ b/Data/Scripts/007_Objects and windows/008_AnimatedBitmap.rb @@ -226,9 +226,9 @@ class GifBitmap @gifbitmaps = [bitmap] @gifdelays = [1] else +=begin tmpBase = File.basename(full_path) + "_tmp_" filestring = pbGetFileString(filestrName) if filestring -=begin Dir.chdir(ENV["TEMP"]) { # navigate to temp folder since game might be on a CD-ROM if filestring && filestring[0] == 0x47 && GifLibrary::PngDll result = GifLibrary::GifToPngFilesInMemory.call(filestring, diff --git a/Data/Scripts/007_Objects and windows/009_Planes.rb b/Data/Scripts/007_Objects and windows/009_Planes.rb index 6b677d1e5..26258bc24 100644 --- a/Data/Scripts/007_Objects and windows/009_Planes.rb +++ b/Data/Scripts/007_Objects and windows/009_Planes.rb @@ -174,8 +174,6 @@ class ColoredPlane < LargePlane super end - def update; super; end - def setPlaneColor(value) self.bitmap.fill_rect(0,0,self.bitmap.width,self.bitmap.height,value) self.refresh diff --git a/Data/Scripts/007_Objects and windows/011_Messages.rb b/Data/Scripts/007_Objects and windows/011_Messages.rb index 8f752024a..22e9ae76b 100644 --- a/Data/Scripts/007_Objects and windows/011_Messages.rb +++ b/Data/Scripts/007_Objects and windows/011_Messages.rb @@ -4,7 +4,6 @@ class Scene_Map def updatemini oldmws=$game_temp.message_window_showing - oldvis=false $game_temp.message_window_showing=true loop do $game_map.update @@ -619,7 +618,6 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil) controls[i][2] = textlen end text = textchunks.join("") - unformattedText = toUnformattedText(text) signWaitCount = 0 signWaitTime = Graphics.frame_rate/2 haveSpecialClose = false diff --git a/Data/Scripts/008_Audio/001_Audio.rb b/Data/Scripts/008_Audio/001_Audio.rb index aafeda6d9..c0ebc8301 100644 --- a/Data/Scripts/008_Audio/001_Audio.rb +++ b/Data/Scripts/008_Audio/001_Audio.rb @@ -38,9 +38,6 @@ def oggfiletime(file) fgetdw = proc { |file| (file.eof? ? 0 : (file.read(4).unpack("V")[0] || 0)) } - fgetw = proc { |file| - (file.eof? ? 0 : (file.read(2).unpack("v")[0] || 0)) - } pages = [] page = nil loop do diff --git a/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb b/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb index a64539655..791c2b54e 100644 --- a/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb +++ b/Data/Scripts/011_Battle/002_Move/005_Move_Effects_000-07F.rb @@ -1752,7 +1752,7 @@ class PokeBattle_Move_05D < PokeBattle_Move if !lastMoveData || user.pbHasMove?(target.lastRegularMoveUsed) || @moveBlacklist.include?(lastMoveData.function_code) || - lastMoveData.type = :SHADOW + lastMoveData.type == :SHADOW @battle.pbDisplay(_INTL("But it failed!")) return true end diff --git a/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb b/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb index 37dca6763..9487bf0af 100644 --- a/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb +++ b/Data/Scripts/011_Battle/003_Battle/005_Battle_Action_AttacksPriority.rb @@ -88,7 +88,6 @@ class PokeBattle_Battle def pbChoseMoveFunctionCode?(idxBattler,code) return false if @battlers[idxBattler].fainted? - idxMove = @choices[idxBattler][1] if @choices[idxBattler][0]==:UseMove && @choices[idxBattler][1] return @choices[idxBattler][2].function == code end 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 f29a77465..6180ee2cd 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 @@ -322,10 +322,6 @@ module RPG def update_tile_position(sprite, index) return if !sprite || !sprite.bitmap || !sprite.visible - weather_type = @type - if @fading && @fade_time >= [FADE_OLD_TONE_END - @time_shift, 0].max - weather_type = @target_type - end sprite.x = (@ox + @tile_x + (index % @tiles_wide) * sprite.bitmap.width).round sprite.y = (@oy + @tile_y + (index / @tiles_wide) * sprite.bitmap.height).round sprite.x += @tiles_wide * sprite.bitmap.width if sprite.x - @ox < -sprite.bitmap.width 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 4f8bb59b8..7551eb8e7 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 @@ -485,7 +485,6 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil, setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer # Perform the battle if $PokemonTemp.waitingTrainer - waitingTrainer = $PokemonTemp.waitingTrainer decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer, [trainerID,trainerName,trainerPartyID,endSpeech] ) diff --git a/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb b/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb index 1860a0893..4df5b34cf 100644 --- a/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb +++ b/Data/Scripts/012_Overworld/008_Overworld_RandomDungeons.rb @@ -346,8 +346,7 @@ class Maze end end - def generateWallGrowthMaze(minWall = nil, maxWall = nil) - minWall = 0 if !minWall + def generateWallGrowthMaze(minWall = 0, maxWall = nil) maxWall = cellWidth if !maxWall nlist = buildNodeList() return if nlist.length == 0 diff --git a/Data/Scripts/013_Items/005_Item_PokeRadar.rb b/Data/Scripts/013_Items/005_Item_PokeRadar.rb index 15830401e..3b2068b73 100644 --- a/Data/Scripts/013_Items/005_Item_PokeRadar.rb +++ b/Data/Scripts/013_Items/005_Item_PokeRadar.rb @@ -135,7 +135,6 @@ def pbPokeRadarGetEncounter(rarity = 0) # If there are any exclusives, first have a chance of encountering those if array.length > 0 rnd = rand(100) - chance = 0 array.each do |enc| rnd -= enc[1] next if rnd >= 0 diff --git a/Data/Scripts/016_UI/020_UI_PokeMart.rb b/Data/Scripts/016_UI/020_UI_PokeMart.rb index 1384371e9..87d9058b5 100644 --- a/Data/Scripts/016_UI/020_UI_PokeMart.rb +++ b/Data/Scripts/016_UI/020_UI_PokeMart.rb @@ -413,9 +413,9 @@ class PokemonMart_Scene itemprice = @adapter.getPrice(item, !@buying) itemprice /= 2 if !@buying pbDisplay(helptext, true) - using (numwindow = Window_AdvancedTextPokemon.new("")) { # Showing number of items + using(numwindow = Window_AdvancedTextPokemon.new("")) { # Showing number of items qty = @adapter.getQuantity(item) - using (inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag + using(inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag pbPrepareWindow(numwindow) pbPrepareWindow(inbagwindow) numwindow.viewport = @viewport diff --git a/Data/Scripts/016_UI/022_UI_PurifyChamber.rb b/Data/Scripts/016_UI/022_UI_PurifyChamber.rb index 3ee5e43e8..423cb9a5e 100644 --- a/Data/Scripts/016_UI/022_UI_PurifyChamber.rb +++ b/Data/Scripts/016_UI/022_UI_PurifyChamber.rb @@ -84,7 +84,6 @@ end #=============================================================================== class PurifyChamberSet attr_reader :shadow # The Shadow Pokémon in the middle - attr_reader :list # The other Pokémon placed around attr_reader :facing # Index in list of Pokémon the Shadow Pokémon is facing def partialSum(x) @@ -596,8 +595,8 @@ class PurifyChamberScreen if @chamber.isPurifiable?(set) # if ready for purification purifiables.push(set) end - return purifiables.length>0 end + return purifiables.length>0 end def pbDoPurify 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 243a8d04a..e90d3a17f 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 @@ -250,7 +250,6 @@ def pbGenerateChallenge(rule, tag) yield(nil) if gameCount / teams.length >= 12 for team in teams - games = team.games team.updateRating end break 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 0befd6e26..86febd4df 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 @@ -340,7 +340,7 @@ def pbRandomPokemonFromRule(rules, trainer) break end end - if item == :LIGHTCLAY && !moves.any? { |m| m == :LIGHTSCREEN || m = :REFLECT } + if item == :LIGHTCLAY && !moves.any? { |m| m == :LIGHTSCREEN || m == :REFLECT } item = :LEFTOVERS end if item == :BLACKSLUDGE 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 8d87f4e28..d0f7a1509 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 @@ -141,7 +141,7 @@ def pbTrackPopupMenu(commands) menuwindow.update hit=menuwindow.hittest menuwindow.index=hit if hit>=0 - if Input.trigger?(Input::MOUSELEFT) || Input.trigger?(Input::MOUSELEFT) # Left or right button + if Input.trigger?(Input::MOUSELEFT) || Input.trigger?(Input::MOUSERIGHT) # Left or right button menuwindow.dispose return hit end @@ -349,13 +349,6 @@ class InvalidatableSprite < Sprite # the sprite is invalid, to allow it to be explicitly called. def refresh end - - # Updates the logic on the sprite, for example, in response - # to user input, and invalidates it if necessary. This should - # be called only once per frame. - def update - super - end end diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index 9fd6231e5..26d27c3fb 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -140,7 +140,7 @@ module Compiler f.write("\#-------------------------------\r\n") f.write("[#{type.id_number}]\r\n") f.write("Name = #{type.real_name}\r\n") - f.write("InternalName = #{type.id.to_s}\r\n") + f.write("InternalName = #{type.id}\r\n") f.write("IsPseudoType = true\r\n") if type.pseudo_type f.write("IsSpecialType = true\r\n") if type.special? f.write("Weaknesses = #{type.weaknesses.join(",")}\r\n") if type.weaknesses.length > 0