Consolidated code for the player interacting in the overworld, fixed bad splash screen animations, added ShowQuantity property to items.txt, fixed Quick Draw and Aroma Veil, fixed text alignment in long list of regional Dexes in Pokédex, added better error message in load screen if player's charset is missing

This commit is contained in:
Maruno17
2023-06-12 22:32:41 +01:00
parent 20affb4345
commit 9c2a9130a5
20 changed files with 106 additions and 66 deletions

View File

@@ -125,7 +125,7 @@ class Scene_Map
updateMaps updateMaps
$game_system.update $game_system.update
$game_screen.update $game_screen.update
break unless $game_temp.player_transferring break if !$game_temp.player_transferring
transfer_player(false) transfer_player(false)
break if $game_temp.transition_processing break if $game_temp.transition_processing
end end
@@ -169,7 +169,7 @@ class Scene_Map
updateMaps updateMaps
$game_system.update $game_system.update
$game_screen.update $game_screen.update
break unless $game_temp.player_transferring break if !$game_temp.player_transferring
transfer_player(false) transfer_player(false)
break if $game_temp.transition_processing break if $game_temp.transition_processing
end end
@@ -192,7 +192,7 @@ class Scene_Map
if Input.trigger?(Input::USE) if Input.trigger?(Input::USE)
$game_temp.interact_calling = true $game_temp.interact_calling = true
elsif Input.trigger?(Input::ACTION) elsif Input.trigger?(Input::ACTION)
unless $game_system.menu_disabled || $game_player.moving? if !$game_system.menu_disabled && !$game_player.moving?
$game_temp.menu_calling = true $game_temp.menu_calling = true
$game_temp.menu_beep = true $game_temp.menu_beep = true
end end
@@ -202,7 +202,7 @@ class Scene_Map
$game_temp.debug_calling = true if $DEBUG $game_temp.debug_calling = true if $DEBUG
end end
end end
unless $game_player.moving? if !$game_player.moving?
if $game_temp.menu_calling if $game_temp.menu_calling
call_menu call_menu
elsif $game_temp.debug_calling elsif $game_temp.debug_calling
@@ -213,8 +213,18 @@ class Scene_Map
pbUseKeyItem pbUseKeyItem
elsif $game_temp.interact_calling elsif $game_temp.interact_calling
$game_temp.interact_calling = false $game_temp.interact_calling = false
$game_player.straighten triggered = false
EventHandlers.trigger(:on_player_interact) # Try to trigger an event the player is standing on, and one in front of
# the player
if !$game_temp.in_mini_update
triggered ||= $game_player.check_event_trigger_here([0])
triggered ||= $game_player.check_event_trigger_there([0, 2]) if !triggered
end
# Try to trigger an interaction with a tile
if !triggered
$game_player.straighten
EventHandlers.trigger(:on_player_interact)
end
end end
end end
end end

View File

@@ -84,7 +84,6 @@ class Interpreter
def update def update
@loop_count = 0 @loop_count = 0
loop do loop do
# TODO: Possibly not needed?
@loop_count += 1 @loop_count += 1
if @loop_count > 100 # Call Graphics.update for freeze prevention if @loop_count > 100 # Call Graphics.update for freeze prevention
Graphics.update Graphics.update

View File

@@ -549,12 +549,6 @@ class Game_Player < Game_Character
# No events triggered, try other event triggers upon finishing a step # No events triggered, try other event triggers upon finishing a step
pbOnStepTaken(result) pbOnStepTaken(result)
end end
# Try to manually interact with events
if Input.trigger?(Input::USE) && !$game_temp.in_mini_update
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0, 2])
end
end end
end end

View File

@@ -199,6 +199,7 @@ class PictureEx
def clearProcesses def clearProcesses
@processes = [] @processes = []
@timer_start = nil
end end
def adjustPosition(xOffset, yOffset) def adjustPosition(xOffset, yOffset)
@@ -458,6 +459,7 @@ class PictureEx
end end
# Clear out empty spaces in @processes array caused by finished processes # Clear out empty spaces in @processes array caused by finished processes
@processes.compact! if procEnded @processes.compact! if procEnded
@timer_start = nil if @processes.empty? && @rotate_speed == 0
# Add the constant rotation speed # Add the constant rotation speed
if @rotate_speed != 0 if @rotate_speed != 0
@frameUpdates.push(Processes::ANGLE) if !@frameUpdates.include?(Processes::ANGLE) @frameUpdates.push(Processes::ANGLE) if !@frameUpdates.include?(Processes::ANGLE)

View File

@@ -13,6 +13,7 @@ module GameData
attr_reader :battle_use attr_reader :battle_use
attr_reader :flags attr_reader :flags
attr_reader :consumable attr_reader :consumable
attr_reader :show_quantity
attr_reader :move attr_reader :move
attr_reader :real_description attr_reader :real_description
attr_reader :pbs_file_suffix attr_reader :pbs_file_suffix
@@ -37,6 +38,7 @@ module GameData
"OnBattler" => 3, "OnFoe" => 4, "Direct" => 5}], "OnBattler" => 3, "OnFoe" => 4, "Direct" => 5}],
"Flags" => [:flags, "*s"], "Flags" => [:flags, "*s"],
"Consumable" => [:consumable, "b"], "Consumable" => [:consumable, "b"],
"ShowQuantity" => [:show_quantity, "b"],
"Move" => [:move, "e", :Move], "Move" => [:move, "e", :Move],
"Description" => [:real_description, "q"] "Description" => [:real_description, "q"]
} }
@@ -63,6 +65,7 @@ module GameData
["BattleUse", EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")], ["BattleUse", EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
["Flags", StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")], ["Flags", StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")],
["Consumable", BooleanProperty, _INTL("Whether this item is consumed after use.")], ["Consumable", BooleanProperty, _INTL("Whether this item is consumed after use.")],
["ShowQuantity", BooleanProperty, _INTL("Whether the Bag shows how many of this item are in there.")],
["Move", MoveProperty, _INTL("Move taught by this HM, TM or TR.")], ["Move", MoveProperty, _INTL("Move taught by this HM, TM or TR.")],
["Description", StringProperty, _INTL("Description of this item.")] ["Description", StringProperty, _INTL("Description of this item.")]
] ]
@@ -128,6 +131,7 @@ module GameData
@flags = hash[:flags] || [] @flags = hash[:flags] || []
@consumable = hash[:consumable] @consumable = hash[:consumable]
@consumable = !is_important? if @consumable.nil? @consumable = !is_important? if @consumable.nil?
@show_quantity = hash[:show_quantity]
@move = hash[:move] @move = hash[:move]
@real_description = hash[:real_description] || "???" @real_description = hash[:real_description] || "???"
@pbs_file_suffix = hash[:pbs_file_suffix] || "" @pbs_file_suffix = hash[:pbs_file_suffix] || ""
@@ -193,6 +197,10 @@ module GameData
return !is_important? && @consumable return !is_important? && @consumable
end end
def show_quantity?
return @show_quantity || !is_important?
end
def unlosable?(species, ability) def unlosable?(species, ability)
return false if species == :ARCEUS && ability != :MULTITYPE return false if species == :ARCEUS && ability != :MULTITYPE
return false if species == :SILVALLY && ability != :RKSSYSTEM return false if species == :SILVALLY && ability != :RKSSYSTEM

View File

@@ -199,12 +199,19 @@ class Battle
entry[5] = pri entry[5] = pri
choice[4] = pri choice[4] = pri
end end
# Recalculate sub-priority change caused by ability (but not by item) # NOTE: If the battler's ability at the start of this round was one with
if entry[0].abilityActive? # a PriorityBracketChange handler (i.e. Quick Draw), but it Mega
subPri = Battle::AbilityEffects.triggerPriorityBracketChange(entry[0].ability, entry[0], self) # Evolved and now doesn't have that ability, that old ability's
needRearranging = true if subPri != entry[2] # priority bracket modifier will still apply. Similarly, if its
entry[2] = subPri # old ability did not have a PriorityBracketChange handler but it
end # Mega Evolved and now does have it, it will not apply this round.
# This is because the message saying that it had an effect appears
# before Mega Evolution happens, and recalculating it now would
# make that message inaccurate because Quick Draw only has a
# chance of triggering. However, since Quick Draw is exclusive to
# a species that doesn't Mega Evolve, these circumstances should
# never arise and no one will notice that the priority bracket
# change isn't recalculated when technically it should be.
end end
end end
# Calculate each battler's overall sub-priority, and whether its ability or # Calculate each battler's overall sub-priority, and whether its ability or

View File

@@ -532,15 +532,15 @@ class Battle::Battler
allAllies.each do |b| allAllies.each do |b|
next if !b.hasActiveAbility?(:AROMAVEIL) next if !b.hasActiveAbility?(:AROMAVEIL)
if showMessages if showMessages
@battle.pbShowAbilitySplash(self) @battle.pbShowAbilitySplash(b)
if Battle::Scene::USE_ABILITY_SPLASH if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} is unaffected!", pbThis)) @battle.pbDisplay(_INTL("{1} is unaffected!", pbThis))
else else
@battle.pbDisplay(_INTL("{1}'s {2} prevents romance!", b.pbThis, b.abilityName)) @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!", b.pbThis, b.abilityName))
end end
@battle.pbHideAbilitySplash(self) @battle.pbHideAbilitySplash(b)
end end
return true return false
end end
end end
end end

View File

@@ -143,14 +143,14 @@ class Battle::Move
target.allAllies.each do |b| target.allAllies.each do |b|
next if !b.hasActiveAbility?(:AROMAVEIL) next if !b.hasActiveAbility?(:AROMAVEIL)
if showMessage if showMessage
@battle.pbShowAbilitySplash(target) @battle.pbShowAbilitySplash(b)
if Battle::Scene::USE_ABILITY_SPLASH if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) @battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
else else
@battle.pbDisplay(_INTL("{1} is unaffected because of {2}'s {3}!", @battle.pbDisplay(_INTL("{1} is unaffected because of {2}'s {3}!",
target.pbThis, b.pbThis(true), b.abilityName)) target.pbThis, b.pbThis(true), b.abilityName))
end end
@battle.pbHideAbilitySplash(target) @battle.pbHideAbilitySplash(b)
end end
return true return true
end end

View File

@@ -639,7 +639,6 @@ class Battle::Move::AttractTarget < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message) def pbFailsAgainstTarget?(user, target, show_message)
return false if damagingMove? return false if damagingMove?
return true if !target.pbCanAttract?(user, show_message) return true if !target.pbCanAttract?(user, show_message)
return true if pbMoveFailedAromaVeil?(user, target, show_message)
return false return false
end end

View File

@@ -289,10 +289,10 @@ class Battle::Move::StartNegateHeldItems < Battle::Move
end end
#=============================================================================== #===============================================================================
# The user consumes its held berry and gains its effect. Also, increases the # The user consumes its held berry increases its Defense by 2 stages. It also
# user's Defense by 2 stages. The berry can be consumed even if Unnerve/Magic # gains the berry's effect if it has one. The berry can be consumed even if
# Room apply. Fails if the user is not holding a berry. This move cannot be # Unnerve/Magic Room apply. Fails if the user is not holding a berry. This move
# chosen to be used if the user is not holding a berry. (Stuff Cheeks) # cannot be chosen to be used if the user is not holding a berry. (Stuff Cheeks)
#=============================================================================== #===============================================================================
class Battle::Move::UserConsumeBerryRaiseDefense2 < Battle::Move::StatUpMove class Battle::Move::UserConsumeBerryRaiseDefense2 < Battle::Move::StatUpMove
def initialize(battle, move) def initialize(battle, move)
@@ -319,7 +319,6 @@ class Battle::Move::UserConsumeBerryRaiseDefense2 < Battle::Move::StatUpMove
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
# TODO: Should this return super? It can consume the berry at this point.
return super return super
end end

View File

@@ -275,7 +275,6 @@ HiddenMoveHandlers::UseMove.add(:DIG, proc { |move, pokemon|
# Dive # Dive
#=============================================================================== #===============================================================================
def pbDive def pbDive
return false if $game_player.pbFacingEvent
map_metadata = $game_map.metadata map_metadata = $game_map.metadata
return false if !map_metadata || !map_metadata.dive_map_id return false if !map_metadata || !map_metadata.dive_map_id
move = :DIVE move = :DIVE
@@ -308,7 +307,6 @@ end
def pbSurfacing def pbSurfacing
return if !$PokemonGlobal.diving return if !$PokemonGlobal.diving
return false if $game_player.pbFacingEvent
surface_map_id = nil surface_map_id = nil
GameData::MapMetadata.each do |map_data| GameData::MapMetadata.each do |map_data|
next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id next if !map_data.dive_map_id || map_data.dive_map_id != $game_map.map_id
@@ -683,7 +681,6 @@ HiddenMoveHandlers::UseMove.add(:STRENGTH, proc { |move, pokemon|
# Surf # Surf
#=============================================================================== #===============================================================================
def pbSurf def pbSurf
return false if $game_player.pbFacingEvent
return false if !$game_player.can_ride_vehicle_with_follower? return false if !$game_player.can_ride_vehicle_with_follower?
move = :SURF move = :SURF
movefinder = $player.get_pokemon_with_move(move) movefinder = $player.get_pokemon_with_move(move)

View File

@@ -425,7 +425,8 @@ module RandomDungeon
#=========================================================================== #===========================================================================
def generate def generate
@rng_seed = @parameters.rng_seed || Random.new_seed @rng_seed = @parameters.rng_seed || $PokemonGlobal.dungeon_rng_seed || Random.new_seed
$PokemonGlobal.dungeon_rng_seed = nil
Random.srand(@rng_seed) Random.srand(@rng_seed)
maxWidth = @usable_width - (@buffer_x * 2) maxWidth = @usable_width - (@buffer_x * 2)
maxHeight = @usable_height - (@buffer_y * 2) maxHeight = @usable_height - (@buffer_y * 2)
@@ -1025,7 +1026,8 @@ end
# dungeon. # dungeon.
#=============================================================================== #===============================================================================
class PokemonGlobalMetadata class PokemonGlobalMetadata
attr_writer :dungeon_area, :dungeon_version attr_writer :dungeon_area, :dungeon_version
attr_accessor :dungeon_rng_seed
def dungeon_area def dungeon_area
return @dungeon_area || :none return @dungeon_area || :none
@@ -1070,21 +1072,3 @@ EventHandlers.add(:on_game_map_setup, :random_dungeon,
end end
} }
) )
#===============================================================================
# TODO: Temporary debug function for testing random dungeon generation.
#===============================================================================
MenuHandlers.add(:debug_menu, :test_random_dungeon, {
"name" => _INTL("Test Random Dungeon Generation"),
"parent" => :main,
"description" => _INTL("Generates a random dungeon and echoes it to the console."),
"effect" => proc {
tileset = :cave # :forest # :cave
tileset_data = GameData::DungeonTileset.try_get((tileset == :forest) ? 23 : 7)
params = GameData::DungeonParameters.try_get(tileset)
dungeon = RandomDungeon::Dungeon.new(params.cell_count_x, params.cell_count_y, tileset_data, params)
dungeon.generate
echoln dungeon.rng_seed
echoln dungeon.write
}
})

View File

@@ -7,6 +7,14 @@ ItemHandlers::UseText.add(:BICYCLE, proc { |item|
ItemHandlers::UseText.copy(:BICYCLE, :MACHBIKE, :ACROBIKE) ItemHandlers::UseText.copy(:BICYCLE, :MACHBIKE, :ACROBIKE)
ItemHandlers::UseText.add(:EXPALLOFF, proc { |item|
next _INTL("Turn on")
})
ItemHandlers::UseText.add(:EXPALL, proc { |item|
next _INTL("Turn off")
})
#=============================================================================== #===============================================================================
# UseFromBag handlers # UseFromBag handlers
# Return values: 0 = not used # Return values: 0 = not used

View File

@@ -17,10 +17,10 @@ class Window_DexesList < Window_CommandPokemon
def drawItem(index, count, rect) def drawItem(index, count, rect)
super(index, count, rect) super(index, count, rect)
if index >= 0 && index < @commands2.length if index >= 0 && index < @commands2.length
pbDrawShadowText(self.contents, rect.x + 254, rect.y, 64, rect.height, pbDrawShadowText(self.contents, rect.x + 254, rect.y + (self.contents.text_offset_y || 0),
@commands2[index][0].to_s, self.baseColor, self.shadowColor, 1) 64, rect.height, @commands2[index][0].to_s, self.baseColor, self.shadowColor, 1)
pbDrawShadowText(self.contents, rect.x + 350, rect.y, 64, rect.height, pbDrawShadowText(self.contents, rect.x + 350, rect.y + (self.contents.text_offset_y || 0),
@commands2[index][1].to_s, self.baseColor, self.shadowColor, 1) 64, rect.height, @commands2[index][1].to_s, self.baseColor, self.shadowColor, 1)
allseen = (@commands2[index][0] >= @commands2[index][2]) allseen = (@commands2[index][0] >= @commands2[index][2])
allown = (@commands2[index][1] >= @commands2[index][2]) allown = (@commands2[index][1] >= @commands2[index][2])
pbDrawImagePositions( pbDrawImagePositions(

View File

@@ -78,19 +78,24 @@ class Window_PokemonBag < Window_DrawableCommand
textpos.push( textpos.push(
[@adapter.getDisplayName(item), rect.x, rect.y + 2, :left, baseColor, shadowColor] [@adapter.getDisplayName(item), rect.x, rect.y + 2, :left, baseColor, shadowColor]
) )
if GameData::Item.get(item).is_important? item_data = GameData::Item.get(item)
showing_register_icon = false
if item_data.is_important?
if @bag.registered?(item) if @bag.registered?(item)
pbDrawImagePositions( pbDrawImagePositions(
self.contents, self.contents,
[["Graphics/UI/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]] [["Graphics/UI/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]]
) )
showing_register_icon = true
elsif pbCanRegisterItem?(item) elsif pbCanRegisterItem?(item)
pbDrawImagePositions( pbDrawImagePositions(
self.contents, self.contents,
[["Graphics/UI/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]] [["Graphics/UI/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]]
) )
showing_register_icon = true
end end
else end
if item_data.show_quantity? && !showing_register_icon
qty = (@filterlist) ? thispocket[@filterlist[@pocket][index]][1] : thispocket[index][1] qty = (@filterlist) ? thispocket[@filterlist[@pocket][index]][1] : thispocket[index][1]
qtytext = _ISPRINTF("x{1: 3d}", qty) qtytext = _ISPRINTF("x{1: 3d}", qty)
xQty = rect.x + rect.width - self.contents.text_size(qtytext).width - 16 xQty = rect.x + rect.width - self.contents.text_size(qtytext).width - 16

View File

@@ -168,11 +168,14 @@ class PokemonLoad_Scene
if meta if meta
filename = pbGetPlayerCharset(meta.walk_charset, trainer, true) filename = pbGetPlayerCharset(meta.walk_charset, trainer, true)
@sprites["player"] = TrainerWalkingCharSprite.new(filename, @viewport) @sprites["player"] = TrainerWalkingCharSprite.new(filename, @viewport)
if !@sprites["player"].bitmap
raise _INTL("Player character {1}'s walking charset was not found (filename: \"{2}\").", trainer.character_ID, filename)
end
charwidth = @sprites["player"].bitmap.width charwidth = @sprites["player"].bitmap.width
charheight = @sprites["player"].bitmap.height charheight = @sprites["player"].bitmap.height
@sprites["player"].x = 112 - (charwidth / 8) @sprites["player"].x = 112 - (charwidth / 8)
@sprites["player"].y = 112 - (charheight / 8) @sprites["player"].y = 112 - (charheight / 8)
@sprites["player"].src_rect = Rect.new(0, 0, charwidth / 4, charheight / 4) @sprites["player"].z = 99999
end end
trainer.party.each_with_index do |pkmn, i| trainer.party.each_with_index do |pkmn, i|
@sprites["party#{i}"] = PokemonIconSprite.new(pkmn, @viewport) @sprites["party#{i}"] = PokemonIconSprite.new(pkmn, @viewport)

View File

@@ -38,7 +38,7 @@ class Window_PokemonItemStorage < Window_DrawableCommand
itemname = @adapter.getDisplayName(item) itemname = @adapter.getDisplayName(item)
baseColor = (index == @sortIndex) ? Color.new(248, 24, 24) : self.baseColor baseColor = (index == @sortIndex) ? Color.new(248, 24, 24) : self.baseColor
textpos.push([itemname, rect.x, rect.y, :left, self.baseColor, self.shadowColor]) textpos.push([itemname, rect.x, rect.y, :left, self.baseColor, self.shadowColor])
if !GameData::Item.get(item).is_important? # Not a Key item/HM/TM if GameData::Item.get(item).show_quantity?
qty = _ISPRINTF("x{1: 2d}", @bag[index][1]) qty = _ISPRINTF("x{1: 2d}", @bag[index][1])
sizeQty = self.contents.text_size(qty).width sizeQty = self.contents.text_size(qty).width
xQty = rect.x + rect.width - sizeQty - 2 xQty = rect.x + rect.width - sizeQty - 2

View File

@@ -488,8 +488,7 @@ class BattlePointShopScreen
end end
if added == quantity if added == quantity
$stats.battle_points_spent += price $stats.battle_points_spent += price
# TODO: Add bpshop_items_bought to $stats? $stats.mart_items_bought += quantity
# $stats.bpshop_items_bought += quantity
@adapter.setBP(@adapter.getBP - price) @adapter.setBP(@adapter.getBP - price)
@stock.delete_if { |itm| GameData::Item.get(itm).is_important? && $bag.has?(itm) } @stock.delete_if { |itm| GameData::Item.get(itm).is_important? && $bag.has?(itm) }
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") } pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }

View File

@@ -345,7 +345,10 @@ MenuHandlers.add(:debug_menu, :test_wild_battle_advanced, {
params.setCancelValue(0) params.setCancelValue(0)
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.", level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",
GameData::Species.get(species).name), params) GameData::Species.get(species).name), params)
pkmn.push(pbGenerateWildPokemon(species, level)) if level > 0 if level > 0
pkmn.push(pbGenerateWildPokemon(species, level))
size0 = pkmn.length
end
end end
else # Edit a Pokémon else # Edit a Pokémon
if pbConfirmMessage(_INTL("Change this Pokémon?")) if pbConfirmMessage(_INTL("Change this Pokémon?"))
@@ -354,6 +357,7 @@ MenuHandlers.add(:debug_menu, :test_wild_battle_advanced, {
scr.pbEndScreen scr.pbEndScreen
elsif pbConfirmMessage(_INTL("Delete this Pokémon?")) elsif pbConfirmMessage(_INTL("Delete this Pokémon?"))
pkmn.delete_at(pkmnCmd) pkmn.delete_at(pkmnCmd)
size0 = [pkmn.length, 1].max
end end
end end
end end
@@ -450,6 +454,8 @@ MenuHandlers.add(:debug_menu, :test_trainer_battle_advanced, {
tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2]) tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2])
EventHandlers.trigger(:on_trainer_load, tr) EventHandlers.trigger(:on_trainer_load, tr)
trainers.push([0, tr]) trainers.push([0, tr])
size0 = trainers.length
size1 = trainers.length
end end
else # Edit a trainer else # Edit a trainer
if pbConfirmMessage(_INTL("Change this trainer?")) if pbConfirmMessage(_INTL("Change this trainer?"))
@@ -462,6 +468,8 @@ MenuHandlers.add(:debug_menu, :test_trainer_battle_advanced, {
end end
elsif pbConfirmMessage(_INTL("Delete this trainer?")) elsif pbConfirmMessage(_INTL("Delete this trainer?"))
trainers.delete_at(trainerCmd) trainers.delete_at(trainerCmd)
size0 = [trainers.length, 1].max
size1 = [trainers.length, 1].max
end end
end end
end end

View File

@@ -0,0 +1,18 @@
#===============================================================================
#
#===============================================================================
MenuHandlers.add(:debug_menu, :test_random_dungeon, {
"name" => "Test Random Dungeon Generation",
"parent" => :main,
"description" => "Generates a random dungeon and echoes it to the console.",
"effect" => proc {
# $PokemonGlobal.dungeon_rng_seed = 12345
tileset = :cave # :forest # :cave
tileset_data = GameData::DungeonTileset.try_get((tileset == :forest) ? 23 : 7)
params = GameData::DungeonParameters.try_get(tileset)
dungeon = RandomDungeon::Dungeon.new(params.cell_count_x, params.cell_count_y, tileset_data, params)
dungeon.generate
echoln dungeon.rng_seed
echoln dungeon.write
}
})