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

This commit is contained in:
Maruno17
2021-05-09 16:48:47 +01:00
parent 326e2e7929
commit 05d3627015
21 changed files with 21 additions and 50 deletions

View File

@@ -24,8 +24,6 @@ class Game_Temp
attr_accessor :to_title # return to title screen flag attr_accessor :to_title # return to title screen flag
attr_accessor :fadestate # for sprite hashes attr_accessor :fadestate # for sprite hashes
attr_accessor :background_bitmap attr_accessor :background_bitmap
attr_accessor :message_window_showing
attr_accessor :transition_processing
attr_accessor :mart_prices attr_accessor :mart_prices
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# * Object Initialization # * Object Initialization

View File

@@ -205,8 +205,9 @@ class Game_Map
for j in [2, 1, 0] for j in [2, 1, 0]
facing_tile_id = data[newx, newy, j] facing_tile_id = data[newx, newy, j]
return false if facing_tile_id == nil return false if facing_tile_id == nil
return false if GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id]).ledge facing_terrain = GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id])
break return false if facing_terrain.ledge
break if facing_terrain.id != :None && !facing_terrain.ignore_passability
end end
end end
# Regular passability checks # Regular passability checks

View File

@@ -30,13 +30,11 @@ class PokemonMapFactory
@mapIndex = 0 if !@mapIndex || @mapIndex<0 @mapIndex = 0 if !@mapIndex || @mapIndex<0
return @maps[@mapIndex] if @maps[@mapIndex] return @maps[@mapIndex] if @maps[@mapIndex]
raise "No maps in save file... (mapIndex=#{@mapIndex})" if @maps.length==0 raise "No maps in save file... (mapIndex=#{@mapIndex})" if @maps.length==0
for i in 0...@maps.length if @maps[0]
if @maps[i] echoln("Using next map, may be incorrect (mapIndex=#{@mapIndex}, length=#{@maps.length})")
echoln("Using next map, may be incorrect (mapIndex=#{@mapIndex}, length=#{@maps.length})") return @maps[0]
return @maps[i]
end
raise "No maps in save file... (all maps empty; mapIndex=#{@mapIndex})"
end end
raise "No maps in save file... (all maps empty; mapIndex=#{@mapIndex})"
end end
def hasMap?(id) def hasMap?(id)
@@ -256,7 +254,7 @@ class PokemonMapFactory
posX = thisX + conn[1] - conn[4] + otherX posX = thisX + conn[1] - conn[4] + otherX
posY = thisY + conn[2] - conn[5] + otherY posY = thisY + conn[2] - conn[5] + otherY
return [posX, posY] return [posX, posY]
else elsif conn[1] == otherMapID
posX = thisX + conn[4] - conn[1] + otherX posX = thisX + conn[4] - conn[1] + otherX
posY = thisY + conn[5] - conn[2] + otherY posY = thisY + conn[5] - conn[2] + otherY
return [posX, posY] return [posX, posY]

View File

@@ -303,8 +303,6 @@ class DependentEvents
newFollower.moveto(mapTile[1],mapTile[2]) newFollower.moveto(mapTile[1],mapTile[2])
newEventData[3]=mapTile[1] newEventData[3]=mapTile[1]
newEventData[4]=mapTile[2] newEventData[4]=mapTile[2]
if mapTile[0]==leader.map.map_id
end
end end
end end
end end

View File

@@ -66,10 +66,10 @@ class Sprite_Shadow < RPG::Sprite
sy = (@character.direction - 2) / 2 * @ch sy = (@character.direction - 2) / 2 * @ch
if self.angle > 90 || angle < -90 if self.angle > 90 || angle < -90
case @character.direction case @character.direction
when 2 then sy = (8- 2) / 2 * @ch when 2 then sy = @ch * 3
when 4 then sy = (6- 2) / 2 * @ch when 4 then sy = @ch * 2
when 6 then sy = (4- 2) / 2 * @ch when 6 then sy = @ch
when 8 then sy = (2- 2) / 2 * @ch when 8 then sy = 0
end end
end end
self.src_rect.set(sx, sy, @cw, @ch) self.src_rect.set(sx, sy, @cw, @ch)

View File

@@ -226,9 +226,9 @@ class GifBitmap
@gifbitmaps = [bitmap] @gifbitmaps = [bitmap]
@gifdelays = [1] @gifdelays = [1]
else else
=begin
tmpBase = File.basename(full_path) + "_tmp_" tmpBase = File.basename(full_path) + "_tmp_"
filestring = pbGetFileString(filestrName) if filestring filestring = pbGetFileString(filestrName) if filestring
=begin
Dir.chdir(ENV["TEMP"]) { # navigate to temp folder since game might be on a CD-ROM Dir.chdir(ENV["TEMP"]) { # navigate to temp folder since game might be on a CD-ROM
if filestring && filestring[0] == 0x47 && GifLibrary::PngDll if filestring && filestring[0] == 0x47 && GifLibrary::PngDll
result = GifLibrary::GifToPngFilesInMemory.call(filestring, result = GifLibrary::GifToPngFilesInMemory.call(filestring,

View File

@@ -174,8 +174,6 @@ class ColoredPlane < LargePlane
super super
end end
def update; super; end
def setPlaneColor(value) def setPlaneColor(value)
self.bitmap.fill_rect(0,0,self.bitmap.width,self.bitmap.height,value) self.bitmap.fill_rect(0,0,self.bitmap.width,self.bitmap.height,value)
self.refresh self.refresh

View File

@@ -4,7 +4,6 @@
class Scene_Map class Scene_Map
def updatemini def updatemini
oldmws=$game_temp.message_window_showing oldmws=$game_temp.message_window_showing
oldvis=false
$game_temp.message_window_showing=true $game_temp.message_window_showing=true
loop do loop do
$game_map.update $game_map.update
@@ -619,7 +618,6 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
controls[i][2] = textlen controls[i][2] = textlen
end end
text = textchunks.join("") text = textchunks.join("")
unformattedText = toUnformattedText(text)
signWaitCount = 0 signWaitCount = 0
signWaitTime = Graphics.frame_rate/2 signWaitTime = Graphics.frame_rate/2
haveSpecialClose = false haveSpecialClose = false

View File

@@ -38,9 +38,6 @@ def oggfiletime(file)
fgetdw = proc { |file| fgetdw = proc { |file|
(file.eof? ? 0 : (file.read(4).unpack("V")[0] || 0)) (file.eof? ? 0 : (file.read(4).unpack("V")[0] || 0))
} }
fgetw = proc { |file|
(file.eof? ? 0 : (file.read(2).unpack("v")[0] || 0))
}
pages = [] pages = []
page = nil page = nil
loop do loop do

View File

@@ -1752,7 +1752,7 @@ class PokeBattle_Move_05D < PokeBattle_Move
if !lastMoveData || if !lastMoveData ||
user.pbHasMove?(target.lastRegularMoveUsed) || user.pbHasMove?(target.lastRegularMoveUsed) ||
@moveBlacklist.include?(lastMoveData.function_code) || @moveBlacklist.include?(lastMoveData.function_code) ||
lastMoveData.type = :SHADOW lastMoveData.type == :SHADOW
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end

View File

@@ -88,7 +88,6 @@ class PokeBattle_Battle
def pbChoseMoveFunctionCode?(idxBattler,code) def pbChoseMoveFunctionCode?(idxBattler,code)
return false if @battlers[idxBattler].fainted? return false if @battlers[idxBattler].fainted?
idxMove = @choices[idxBattler][1]
if @choices[idxBattler][0]==:UseMove && @choices[idxBattler][1] if @choices[idxBattler][0]==:UseMove && @choices[idxBattler][1]
return @choices[idxBattler][2].function == code return @choices[idxBattler][2].function == code
end end

View File

@@ -322,10 +322,6 @@ module RPG
def update_tile_position(sprite, index) def update_tile_position(sprite, index)
return if !sprite || !sprite.bitmap || !sprite.visible 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.x = (@ox + @tile_x + (index % @tiles_wide) * sprite.bitmap.width).round
sprite.y = (@oy + @tile_y + (index / @tiles_wide) * sprite.bitmap.height).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 sprite.x += @tiles_wide * sprite.bitmap.width if sprite.x - @ox < -sprite.bitmap.width

View File

@@ -485,7 +485,6 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer
# Perform the battle # Perform the battle
if $PokemonTemp.waitingTrainer if $PokemonTemp.waitingTrainer
waitingTrainer = $PokemonTemp.waitingTrainer
decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer, decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer,
[trainerID,trainerName,trainerPartyID,endSpeech] [trainerID,trainerName,trainerPartyID,endSpeech]
) )

View File

@@ -346,8 +346,7 @@ class Maze
end end
end end
def generateWallGrowthMaze(minWall = nil, maxWall = nil) def generateWallGrowthMaze(minWall = 0, maxWall = nil)
minWall = 0 if !minWall
maxWall = cellWidth if !maxWall maxWall = cellWidth if !maxWall
nlist = buildNodeList() nlist = buildNodeList()
return if nlist.length == 0 return if nlist.length == 0

View File

@@ -135,7 +135,6 @@ def pbPokeRadarGetEncounter(rarity = 0)
# If there are any exclusives, first have a chance of encountering those # If there are any exclusives, first have a chance of encountering those
if array.length > 0 if array.length > 0
rnd = rand(100) rnd = rand(100)
chance = 0
array.each do |enc| array.each do |enc|
rnd -= enc[1] rnd -= enc[1]
next if rnd >= 0 next if rnd >= 0

View File

@@ -413,9 +413,9 @@ class PokemonMart_Scene
itemprice = @adapter.getPrice(item, !@buying) itemprice = @adapter.getPrice(item, !@buying)
itemprice /= 2 if !@buying itemprice /= 2 if !@buying
pbDisplay(helptext, true) 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) 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(numwindow)
pbPrepareWindow(inbagwindow) pbPrepareWindow(inbagwindow)
numwindow.viewport = @viewport numwindow.viewport = @viewport

View File

@@ -84,7 +84,6 @@ end
#=============================================================================== #===============================================================================
class PurifyChamberSet class PurifyChamberSet
attr_reader :shadow # The Shadow Pokémon in the middle 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 attr_reader :facing # Index in list of Pokémon the Shadow Pokémon is facing
def partialSum(x) def partialSum(x)
@@ -596,8 +595,8 @@ class PurifyChamberScreen
if @chamber.isPurifiable?(set) # if ready for purification if @chamber.isPurifiable?(set) # if ready for purification
purifiables.push(set) purifiables.push(set)
end end
return purifiables.length>0
end end
return purifiables.length>0
end end
def pbDoPurify def pbDoPurify

View File

@@ -250,7 +250,6 @@ def pbGenerateChallenge(rule, tag)
yield(nil) yield(nil)
if gameCount / teams.length >= 12 if gameCount / teams.length >= 12
for team in teams for team in teams
games = team.games
team.updateRating team.updateRating
end end
break break

View File

@@ -340,7 +340,7 @@ def pbRandomPokemonFromRule(rules, trainer)
break break
end end
end end
if item == :LIGHTCLAY && !moves.any? { |m| m == :LIGHTSCREEN || m = :REFLECT } if item == :LIGHTCLAY && !moves.any? { |m| m == :LIGHTSCREEN || m == :REFLECT }
item = :LEFTOVERS item = :LEFTOVERS
end end
if item == :BLACKSLUDGE if item == :BLACKSLUDGE

View File

@@ -141,7 +141,7 @@ def pbTrackPopupMenu(commands)
menuwindow.update menuwindow.update
hit=menuwindow.hittest hit=menuwindow.hittest
menuwindow.index=hit if hit>=0 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 menuwindow.dispose
return hit return hit
end end
@@ -349,13 +349,6 @@ class InvalidatableSprite < Sprite
# the sprite is invalid, to allow it to be explicitly called. # the sprite is invalid, to allow it to be explicitly called.
def refresh def refresh
end 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 end

View File

@@ -140,7 +140,7 @@ module Compiler
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
f.write("[#{type.id_number}]\r\n") f.write("[#{type.id_number}]\r\n")
f.write("Name = #{type.real_name}\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("IsPseudoType = true\r\n") if type.pseudo_type
f.write("IsSpecialType = true\r\n") if type.special? f.write("IsSpecialType = true\r\n") if type.special?
f.write("Weaknesses = #{type.weaknesses.join(",")}\r\n") if type.weaknesses.length > 0 f.write("Weaknesses = #{type.weaknesses.join(",")}\r\n") if type.weaknesses.length > 0