Rewrote Pokémon storage screen code

This commit is contained in:
Maruno17
2024-10-13 23:41:42 +01:00
parent 61b6bb5aeb
commit 89c344dc00
15 changed files with 2523 additions and 173 deletions

View File

@@ -231,7 +231,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
dims = [0, 0]
cwidth = (maxwidth < 0) ? Graphics.width : maxwidth
chars = getFormattedTextForDims(self.contents, 0, 0,
cwidth - self.borderX - 2 - 6, -1, text, @lineHeight, true)
cwidth - self.borderX - SpriteWindow_Base::TEXT_PADDING, -1, text, @lineHeight, true)
chars.each do |ch|
dims[0] = [dims[0], ch[1] + ch[3]].max
dims[1] = [dims[1], ch[2] + ch[4]].max
@@ -244,7 +244,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
oldstarting = @starting
@starting = true
self.width = (width < 0) ? Graphics.width : width
self.height = dims[1] + self.borderY
self.height = dims[1] + self.borderY + 2 # TEXT OFFSET
@starting = oldstarting
redrawText
end
@@ -953,7 +953,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
new_top_row = [[new_top_row, self.row_max - self.page_row_max].min, 0].max
if self.top_row != new_top_row
self.top_row = new_top_row
# dorefresh = true
dorefresh = true
end
# End of code
cursor_width = (self.width - self.borderX) / @column_max

View File

@@ -147,7 +147,7 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig
elsif isspace
hadspace = true
end
texty = (lineheight * y) + yDst + yStart
texty = (lineheight * y) + yDst + yStart - 2 # TEXT OFFSET
# Push character
if heightDst < 0 || yStart < yDst + heightDst
havenl = true if isWaitChar(textchars[position])

View File

@@ -123,6 +123,21 @@ class PokemonIconSprite < Sprite
def pokemon=(value)
@pokemon = value
# Check if the bitmap needs to be reloaded
new_values = nil
if @pokemon
new_values = {
:species => @pokemon.species,
:form => @pokemon.form,
:gender => @pokemon.gender,
:shiny => @pokemon.shiny?,
:shadow => @pokemon.shadowPokemon?,
:egg => @pokemon.egg?
}
end
return if @pokemon_values == new_values
@pokemon_values = new_values
# Reload the bitmap
@animBitmap&.dispose
@animBitmap = nil
if !@pokemon

View File

@@ -60,13 +60,13 @@ class PokemonStorage
attr_accessor :currentBox
attr_writer :unlockedWallpapers
BASICWALLPAPERQTY = 16
BASIC_WALLPAPER_COUNT = 16
def initialize(maxBoxes = Settings::NUM_STORAGE_BOXES, maxPokemon = PokemonBox::BOX_SIZE)
@boxes = []
maxBoxes.times do |i|
@boxes[i] = PokemonBox.new(_INTL("Box {1}", i + 1), maxPokemon)
@boxes[i].background = i % BASICWALLPAPERQTY
@boxes[i].background = i % BASIC_WALLPAPER_COUNT
end
@currentBox = 0
@boxmode = -1
@@ -76,6 +76,11 @@ class PokemonStorage
end
end
# NOTE: These wallpaper names are shown in a list in the storage screen that
# is a fixed width. The names should be kept relatively short; longer
# names will get shrunk to fit the width of the list, and that looks bad.
# NOTE: The order these wallpapers are listed determines the number in their
# filenames.
def allWallpapers
return [
# Basic wallpapers
@@ -85,9 +90,9 @@ class PokemonStorage
_INTL("Poké Center"), _INTL("Machine"), _INTL("Checks"), _INTL("Simple"),
# Special wallpapers
_INTL("Space"), _INTL("Backyard"), _INTL("Nostalgic 1"), _INTL("Torchic"),
_INTL("Trio 1"), _INTL("PikaPika 1"), _INTL("Legend 1"), _INTL("Team Galactic 1"),
_INTL("Trio 1"), _INTL("PikaPika 1"), _INTL("Legend 1"), _INTL("Galactic 1"),
_INTL("Distortion"), _INTL("Contest"), _INTL("Nostalgic 2"), _INTL("Croagunk"),
_INTL("Trio 2"), _INTL("PikaPika 2"), _INTL("Legend 2"), _INTL("Team Galactic 2"),
_INTL("Trio 2"), _INTL("PikaPika 2"), _INTL("Legend 2"), _INTL("Galactic 2"),
_INTL("Heart"), _INTL("Soul"), _INTL("Big Brother"), _INTL("Pokéathlon"),
_INTL("Trio 3"), _INTL("Spiky Pika"), _INTL("Kimono Girl"), _INTL("Revival")
]
@@ -100,25 +105,22 @@ class PokemonStorage
def isAvailableWallpaper?(i)
@unlockedWallpapers = [] if !@unlockedWallpapers
return true if i < BASICWALLPAPERQTY
return true if i < BASIC_WALLPAPER_COUNT
return true if @unlockedWallpapers[i]
return false
end
def availableWallpapers
ret = [[], []] # Names, IDs
papers = allWallpapers
@unlockedWallpapers = [] if !@unlockedWallpapers
papers.length.times do |i|
next if !isAvailableWallpaper?(i)
ret[0].push(papers[i])
ret[1].push(i)
ret = {}
allWallpapers.each_with_index do |paper, i|
ret[i] = paper if isAvailableWallpaper?(i)
end
return ret
end
def party
$player.party
return $player.party
end
def party=(_value)

View File

@@ -1267,13 +1267,19 @@ class PurifyChamberScene
pbRefresh
end
# TODO: Depending on which position is selected, make Shadow Pokémon/non-Shadow
# Pokémon in UI::PokemonStorage semi-transparent and don't let them be
# selected.
# TODO: Don't let eggs be selected.
# TODO: Don't let the last able Pokémon in the party be selected.
def pbChoosePokemon
visible = pbFadeOutAndHide(@sprites)
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
pos = screen.pbChoosePokemon
pos = nil
pbFadeOutInWithUpdate(@sprites) do
screen = UI::PokemonStorage.new($PokemonStorage, mode: :choose_pokemon)
screen.main
pos = screen.result
pbRefresh
pbFadeInAndShow(@sprites, visible)
end
return pos
end
end

View File

@@ -779,6 +779,8 @@ def pbEnterNPCName(helptext, minlength, maxlength, initialText = "", id = 0, nof
return pbEnterText(helptext, minlength, maxlength, initialText, 3, id, nofadeout)
end
# TODO: maxlength for this is 16, so the entry screen should support showing 16
# characters.
def pbEnterBoxName(helptext, minlength, maxlength, initialText = "", nofadeout = false)
return pbEnterText(helptext, minlength, maxlength, initialText, 4, nil, nofadeout)
end

View File

@@ -340,6 +340,7 @@ module UI
end
def initialize_message_box
# TODO: It looks like :message_box isn't used anywhere.
@sprites[:message_box] = Window_AdvancedTextPokemon.new("")
@sprites[:message_box].viewport = @viewport
@sprites[:message_box].z = 2000
@@ -385,10 +386,14 @@ module UI
#---------------------------------------------------------------------------
def position_speech_box(text = "")
pbBottomLeftLines(@sprites[:speech_box], 2)
end
def show_message(text)
@sprites[:speech_box].visible = true
@sprites[:speech_box].text = text
pbBottomLeftLines(@sprites[:speech_box], 2)
position_speech_box(text)
yielded = false
loop do
Graphics.update
@@ -414,7 +419,7 @@ module UI
ret = false
@sprites[:speech_box].visible = true
@sprites[:speech_box].text = text
pbBottomLeftLines(@sprites[:speech_box], 2)
position_speech_box(text)
using(cmd_window = Window_CommandPokemon.new([_INTL("Yes"), _INTL("No")])) do
cmd_window.z = @viewport.z + 1
cmd_window.visible = false
@@ -444,6 +449,40 @@ module UI
return ret
end
def show_confirm_serious_message(text)
ret = false
@sprites[:speech_box].visible = true
@sprites[:speech_box].text = text
position_speech_box(text)
using(cmd_window = Window_CommandPokemon.new([_INTL("No"), _INTL("Yes")])) do
cmd_window.z = @viewport.z + 1
cmd_window.visible = false
pbBottomRight(cmd_window)
cmd_window.y -= @sprites[:speech_box].height
cmd_window.visible = true if !@sprites[:speech_box].busy?
loop do
Graphics.update
Input.update
update_visuals
cmd_window.visible = true if !@sprites[:speech_box].busy?
cmd_window.update
if !@sprites[:speech_box].busy?
if Input.trigger?(Input::BACK)
pbPlayCancelSE
ret = false
break
elsif Input.trigger?(Input::USE) && @sprites[:speech_box].resume
pbPlayDecisionSE
ret = (cmd_window.index == 1)
break
end
end
end
end
@sprites[:speech_box].visible = false
return ret
end
# Used for dialogue.
# align: Where the command window is in relation to the message window.
# :horizontal is side by side, :vertical is command window above.
@@ -547,7 +586,7 @@ module UI
def choose_number_as_money_multiplier(help_text, money_per_unit, maximum, init_value = 1)
@sprites[:speech_box].visible = true
@sprites[:speech_box].text = help_text
pbBottomLeftLines(@sprites[:speech_box], 2)
position_speech_box(text)
# Show the help text
loop do
Graphics.update
@@ -701,6 +740,10 @@ module UI
alias pbConfirm show_confirm_message
def show_confirm_serious_message(text)
return @visuals.show_confirm_serious_message(text)
end
def show_choice_message(text, options, initial_index = 0)
return @visuals.show_choice_message(text, options, initial_index)
end

View File

@@ -766,10 +766,6 @@ class UI::Party < UI::BaseScreen
#-----------------------------------------------------------------------------
def set_index(new_index)
@visuals.set_index(new_index)
end
def pokemon
return (index < @party.length) ? @party[index] : nil
end
@@ -778,6 +774,10 @@ class UI::Party < UI::BaseScreen
return @visuals.can_access_storage?
end
def set_index(new_index)
@visuals.set_index(new_index)
end
def set_help_text(text)
@visuals.set_help_text(text)
end
@@ -1306,9 +1306,7 @@ UIActionHandlers.add(UI::Party::SCREEN_ID, :clear_sub_mode, {
UIActionHandlers.add(UI::Party::SCREEN_ID, :open_storage, {
:effect => proc { |screen|
pbFadeOutInWithUpdate(screen.sprites) do
storage_scene = PokemonStorageScene.new
storage_screen = PokemonStorageScreen.new(storage_scene, $PokemonStorage)
storage_screen.pbStartScreen(0)
UI::PokemonStorage.new($PokemonStorage, mode: :organize).main
screen.refresh_party
screen.refresh
end

View File

@@ -181,6 +181,7 @@ class UI::PokemonSummaryVisuals < UI::BaseVisuals
:draw_page_icons,
:draw_poke_ball,
:draw_pokemon_name,
:draw_party_icons,
:draw_markings,
:draw_egg_memo
]

File diff suppressed because it is too large Load Diff

View File

@@ -24,10 +24,7 @@ module UI::PC
command = 0
loop do
choice = pbMessage(_INTL("Which PC should be accessed?"), command_list, -1, nil, command)
if choice < 0
pbPlayCloseMenuSE
break
end
break if choice < 0
break if commands[choice]["effect"].call
end
pbSEPlay("PC close")
@@ -220,9 +217,7 @@ MenuHandlers.add(:pc_menu, :pokemon_storage, {
when :organize
pbPlayDecisionSE
pbFadeOutIn do
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
screen.pbStartScreen(0)
UI::PokemonStorage.new($PokemonStorage, mode: :organize).main
end
when :withdraw
if $PokemonStorage.party_full?
@@ -231,9 +226,7 @@ MenuHandlers.add(:pc_menu, :pokemon_storage, {
end
pbPlayDecisionSE
pbFadeOutIn do
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
screen.pbStartScreen(1)
UI::PokemonStorage.new($PokemonStorage, mode: :withdraw).main
end
when :deposit
if $player.able_pokemon_count <= 1
@@ -242,9 +235,7 @@ MenuHandlers.add(:pc_menu, :pokemon_storage, {
end
pbPlayDecisionSE
pbFadeOutIn do
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
screen.pbStartScreen(2)
UI::PokemonStorage.new($PokemonStorage, mode: :deposit).main
end
else
break

View File

@@ -501,6 +501,13 @@ class PokemonBoxPartySprite < Sprite
refresh
end
def z=(value)
super
Settings::MAX_PARTY_SIZE.times do |i|
@pokemonsprites[i].z = value + 1 if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
end
end
def color=(value)
super
Settings::MAX_PARTY_SIZE.times do |i|
@@ -565,7 +572,7 @@ class PokemonBoxPartySprite < Sprite
sprite.viewport = self.viewport
sprite.x = self.x + xvalues[j]
sprite.y = self.y + yvalues[j]
sprite.z = 1
sprite.z = self.z + 1
end
end
@@ -1254,8 +1261,7 @@ class PokemonStorageScene
pbPartySetArrow(@sprites["arrow"], @selection)
pbUpdateOverlay(@selection, @storage.party)
else
screen = UI::PokemonSummary.new(@storage.boxes[selected[0]].pokemon, selected[1]).main
@selection = screen.result
@selection = UI::PokemonSummary.new(@storage.boxes[selected[0]].pokemon, selected[1]).main
pbSetArrow(@sprites["arrow"], @selection)
pbUpdateOverlay(@selection)
end

View File

@@ -149,7 +149,7 @@ end
#
#===============================================================================
module PokemonDebugMixin
def pokemon_debug_menu(pkmn, pkmnid, heldpoke = nil, settingUpBattle = false)
def pokemon_debug_menu(pkmn, pkmnid, settingUpBattle = false)
# Get all commands
commands = CommandMenuList.new
MenuHandlers.each_available(:pokemon_debug_menu) do |option, hash, name|
@@ -170,7 +170,7 @@ module PokemonDebugMixin
if commands.hasSubMenu?(cmd)
commands.currentList = cmd
command = 0
elsif MenuHandlers.call(:pokemon_debug_menu, cmd, "effect", pkmn, pkmnid, heldpoke, settingUpBattle, self)
elsif MenuHandlers.call(:pokemon_debug_menu, cmd, "effect", pkmn, pkmnid, settingUpBattle, self)
break
end
end
@@ -178,6 +178,73 @@ module PokemonDebugMixin
end
end
#===============================================================================
#
#===============================================================================
class UI::Party
include PokemonDebugMixin
end
#===============================================================================
#
#===============================================================================
class UI::PokemonStorage
include PokemonDebugMixin
def choose_move(pkmn, message)
move_names = []
pkmn.moves.each do |move|
next if !move || !move.id
if move.total_pp <= 0
move_names.push(_INTL("{1} (PP: ---)", move.name))
else
move_names.push(_INTL("{1} (PP: {2}/{3})", move.name, move.pp, move.total_pp))
end
end
return show_menu(message, move_names)
end
end
#===============================================================================
#
#===============================================================================
class UI::PartyDebugVisuals < UI::BaseVisuals
def initialize_background; end
def initialize_overlay; end
def choose_number(help_text, maximum, init_value = 1)
old_letter_by_letter = @sprites[:speech_box].letterbyletter
@sprites[:speech_box].letterbyletter = false
ret = super
@sprites[:speech_box].letterbyletter = old_letter_by_letter
return ret
end
end
class UI::PartyDebug < UI::BaseScreen
include PokemonDebugMixin
def initialize_visuals
@visuals = UI::PartyDebugVisuals.new
end
def choose_move(pkmn, message, index = 0)
# TODO: The move names can get rather wide, making the message box rather
# thin. It's just about acceptable, but maybe the choice window needs
# to be displayed above the message box instead of to the right of it.
move_names = []
pkmn.moves.each do |move|
next if !move || !move.id
if move.total_pp <= 0
move_names.push(_INTL("{1} (PP: ---)", move.name))
else
move_names.push(_INTL("{1} (PP: {2}/{3})", move.name, move.pp, move.total_pp))
end
end
return show_menu(message, move_names, index)
end
end
#===============================================================================
#
#===============================================================================
@@ -405,60 +472,6 @@ module Battle::DebugMixin
end
end
#===============================================================================
#
#===============================================================================
class UI::Party
include PokemonDebugMixin
end
#===============================================================================
#
#===============================================================================
class PokemonStorageScreen
include PokemonDebugMixin
end
#===============================================================================
#
#===============================================================================
class UI::PartyDebugVisuals < UI::BaseVisuals
def initialize_background; end
def initialize_overlay; end
def choose_number(help_text, maximum, init_value = 1)
old_letter_by_letter = @sprites[:speech_box].letterbyletter
@sprites[:speech_box].letterbyletter = false
ret = super
@sprites[:speech_box].letterbyletter = old_letter_by_letter
return ret
end
end
class UI::PartyDebug < UI::BaseScreen
include PokemonDebugMixin
def initialize_visuals
@visuals = UI::PartyDebugVisuals.new
end
def choose_move(pkmn, message, index = 0)
# TODO: The move names can get rather wide, making the message box rather
# thin. It's just about acceptable, but maybe the choice window needs
# to be displayed above the message box instead of to the right of it.
move_names = []
pkmn.moves.each do |move|
next if !move || !move.id
if move.total_pp <= 0
move_names.push(_INTL("{1} (PP: ---)", move.name))
else
move_names.push(_INTL("{1} (PP: {2}/{3})", move.name, move.pp, move.total_pp))
end
end
return show_menu(message, move_names, index)
end
end
#===============================================================================
#
#===============================================================================

View File

@@ -221,35 +221,35 @@ MenuHandlers.add(:debug_menu, :storage_wallpapers, {
"description" => _INTL("Unlock and lock special wallpapers used in Pokémon storage."),
"effect" => proc {
w = $PokemonStorage.allWallpapers
if w.length <= PokemonStorage::BASICWALLPAPERQTY
if w.length <= PokemonStorage::BASIC_WALLPAPER_COUNT
pbMessage(_INTL("There are no special wallpapers defined."))
else
next
end
paperscmd = 0
unlockarray = $PokemonStorage.unlockedWallpapers
loop do
paperscmds = []
paperscmds.push(_INTL("Unlock all"))
paperscmds.push(_INTL("Lock all"))
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
(PokemonStorage::BASIC_WALLPAPER_COUNT...w.length).each do |i|
paperscmds.push((unlockarray[i] ? "[Y]" : "[ ]") + " " + w[i])
end
paperscmd = pbShowCommands(nil, paperscmds, -1, paperscmd)
break if paperscmd < 0
case paperscmd
when 0 # Unlock all
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
(PokemonStorage::BASIC_WALLPAPER_COUNT...w.length).each do |i|
unlockarray[i] = true
end
when 1 # Lock all
(PokemonStorage::BASICWALLPAPERQTY...w.length).each do |i|
(PokemonStorage::BASIC_WALLPAPER_COUNT...w.length).each do |i|
unlockarray[i] = false
end
else
paperindex = paperscmd - 2 + PokemonStorage::BASICWALLPAPERQTY
paperindex = paperscmd - 2 + PokemonStorage::BASIC_WALLPAPER_COUNT
unlockarray[paperindex] = !$PokemonStorage.unlockedWallpapers[paperindex]
end
end
end
}
})
@@ -355,7 +355,7 @@ MenuHandlers.add(:debug_menu, :test_wild_battle_advanced, {
else # Edit a Pokémon
if pbConfirmMessage(_INTL("Change this Pokémon?"))
scr = UI::PartyDebug.new
scr.pokemon_debug_menu(pkmn[pkmnCmd], -1, nil, true)
scr.pokemon_debug_menu(pkmn[pkmnCmd], -1, true)
scr.silent_end_screen
elsif pbConfirmMessage(_INTL("Delete this Pokémon?"))
pkmn.delete_at(pkmnCmd)
@@ -711,9 +711,7 @@ MenuHandlers.add(:debug_menu, :open_storage, {
"description" => _INTL("Opens the Pokémon storage boxes in Organize Boxes mode."),
"effect" => proc {
pbFadeOutIn do
scene = PokemonStorageScene.new
screen = PokemonStorageScreen.new(scene, $PokemonStorage)
screen.pbStartScreen(0)
UI::PokemonStorage.new($PokemonStorage, mode: :organize).main
end
}
})

View File

@@ -10,7 +10,7 @@ MenuHandlers.add(:pokemon_debug_menu, :hp_status_menu, {
MenuHandlers.add(:pokemon_debug_menu, :set_hp, {
"name" => _INTL("Set HP"),
"parent" => :hp_status_menu,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
if pkmn.egg?
screen.show_message(_INTL("{1} is an egg.", pkmn.name))
next false
@@ -30,7 +30,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_hp, {
MenuHandlers.add(:pokemon_debug_menu, :set_status, {
"name" => _INTL("Set status"),
"parent" => :hp_status_menu,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
if pkmn.egg?
screen.show_message(_INTL("{1} is an egg.", pkmn.name))
next false
@@ -78,7 +78,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_status, {
MenuHandlers.add(:pokemon_debug_menu, :full_heal, {
"name" => _INTL("Fully heal"),
"parent" => :hp_status_menu,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
if pkmn.egg?
screen.show_message(_INTL("{1} is an egg.", pkmn.name))
else
@@ -92,7 +92,7 @@ MenuHandlers.add(:pokemon_debug_menu, :full_heal, {
MenuHandlers.add(:pokemon_debug_menu, :make_fainted, {
"name" => _INTL("Make fainted"),
"parent" => :hp_status_menu,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
if pkmn.egg?
screen.show_message(_INTL("{1} is an egg.", pkmn.name))
else
@@ -106,7 +106,7 @@ MenuHandlers.add(:pokemon_debug_menu, :make_fainted, {
MenuHandlers.add(:pokemon_debug_menu, :set_pokerus, {
"name" => _INTL("Set Pokérus"),
"parent" => :hp_status_menu,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:random_strain => _INTL("Give random strain"),
:non_infectious => _INTL("Make not infectious"),
@@ -153,7 +153,7 @@ MenuHandlers.add(:pokemon_debug_menu, :level_stats, {
MenuHandlers.add(:pokemon_debug_menu, :set_level, {
"name" => _INTL("Set level"),
"parent" => :level_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
if pkmn.egg?
screen.show_message(_INTL("{1} is an egg.", pkmn.name))
next false
@@ -174,7 +174,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_level, {
MenuHandlers.add(:pokemon_debug_menu, :set_exp, {
"name" => _INTL("Set Exp"),
"parent" => :level_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
if pkmn.egg?
screen.show_message(_INTL("{1} is an egg.", pkmn.name))
next false
@@ -201,7 +201,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_exp, {
MenuHandlers.add(:pokemon_debug_menu, :hidden_values, {
"name" => _INTL("EV/IV/personal ID..."),
"parent" => :level_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:set_evs => _INTL("Set EVs"),
:set_ivs => _INTL("Set IVs"),
@@ -315,7 +315,7 @@ MenuHandlers.add(:pokemon_debug_menu, :hidden_values, {
MenuHandlers.add(:pokemon_debug_menu, :set_happiness, {
"name" => _INTL("Set happiness"),
"parent" => :level_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
params = ChooseNumberParams.new
params.setRange(0, 255)
params.setDefaultValue(pkmn.happiness)
@@ -336,7 +336,7 @@ MenuHandlers.add(:pokemon_debug_menu, :contest_stats, {
MenuHandlers.add(:pokemon_debug_menu, :set_beauty, {
"name" => _INTL("Set Beauty"),
"parent" => :contest_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
params = ChooseNumberParams.new
params.setRange(0, 255)
params.setDefaultValue(pkmn.beauty)
@@ -352,7 +352,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_beauty, {
MenuHandlers.add(:pokemon_debug_menu, :set_cool, {
"name" => _INTL("Set Cool"),
"parent" => :contest_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
params = ChooseNumberParams.new
params.setRange(0, 255)
params.setDefaultValue(pkmn.cool)
@@ -368,7 +368,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_cool, {
MenuHandlers.add(:pokemon_debug_menu, :set_cute, {
"name" => _INTL("Set Cute"),
"parent" => :contest_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
params = ChooseNumberParams.new
params.setRange(0, 255)
params.setDefaultValue(pkmn.cute)
@@ -384,7 +384,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_cute, {
MenuHandlers.add(:pokemon_debug_menu, :set_smart, {
"name" => _INTL("Set Smart"),
"parent" => :contest_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
params = ChooseNumberParams.new
params.setRange(0, 255)
params.setDefaultValue(pkmn.smart)
@@ -400,7 +400,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_smart, {
MenuHandlers.add(:pokemon_debug_menu, :set_tough, {
"name" => _INTL("Set Tough"),
"parent" => :contest_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
params = ChooseNumberParams.new
params.setRange(0, 255)
params.setDefaultValue(pkmn.tough)
@@ -416,7 +416,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_tough, {
MenuHandlers.add(:pokemon_debug_menu, :set_sheen, {
"name" => _INTL("Set Sheen"),
"parent" => :contest_stats,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
params = ChooseNumberParams.new
params.setRange(0, 255)
params.setDefaultValue(pkmn.sheen)
@@ -441,7 +441,7 @@ MenuHandlers.add(:pokemon_debug_menu, :moves, {
MenuHandlers.add(:pokemon_debug_menu, :teach_move, {
"name" => _INTL("Teach move"),
"parent" => :moves,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
move = pbChooseMoveList
if move
pbLearnMove(pkmn, move)
@@ -456,7 +456,7 @@ MenuHandlers.add(:pokemon_debug_menu, :teach_move, {
MenuHandlers.add(:pokemon_debug_menu, :forget_move, {
"name" => _INTL("Forget move"),
"parent" => :moves,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
move_index = screen.choose_move(pkmn, _INTL("Choose move to forget."))
if move_index >= 0
move_name = pkmn.moves[move_index].name
@@ -471,7 +471,7 @@ MenuHandlers.add(:pokemon_debug_menu, :forget_move, {
MenuHandlers.add(:pokemon_debug_menu, :reset_moves, {
"name" => _INTL("Reset moves"),
"parent" => :moves,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
pkmn.reset_moves
screen.refresh
screen.show_message(_INTL("{1}'s moves were reset.", pkmn.name))
@@ -482,7 +482,7 @@ MenuHandlers.add(:pokemon_debug_menu, :reset_moves, {
MenuHandlers.add(:pokemon_debug_menu, :set_move_pp, {
"name" => _INTL("Set move PP..."),
"parent" => :moves,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
cmd = nil
loop do
commands = {}
@@ -539,7 +539,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_move_pp, {
MenuHandlers.add(:pokemon_debug_menu, :set_initial_moves, {
"name" => _INTL("Reset initial moves"),
"parent" => :moves,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
pkmn.record_first_moves
screen.refresh
screen.show_message(_INTL("{1}'s current moves were set as its first-known moves.", pkmn.name))
@@ -554,7 +554,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_initial_moves, {
MenuHandlers.add(:pokemon_debug_menu, :set_item, {
"name" => _INTL("Set item"),
"parent" => :main,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:change_item => _INTL("Change item"),
:delete_item => _INTL("Remove item")
@@ -589,7 +589,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_item, {
MenuHandlers.add(:pokemon_debug_menu, :set_ability, {
"name" => _INTL("Set ability"),
"parent" => :main,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:set_ability_index => _INTL("Set possible ability"),
:give_any_ability => _INTL("Set any ability"),
@@ -641,7 +641,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_ability, {
MenuHandlers.add(:pokemon_debug_menu, :set_nature, {
"name" => _INTL("Set nature"),
"parent" => :main,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {}
GameData::Nature.each do |nature|
if nature.stat_changes.length == 0
@@ -676,7 +676,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_nature, {
MenuHandlers.add(:pokemon_debug_menu, :set_gender, {
"name" => _INTL("Set gender"),
"parent" => :main,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
if pkmn.singleGendered?
screen.show_message(_INTL("{1} is single-gendered or genderless.", pkmn.speciesName))
next false
@@ -713,7 +713,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_gender, {
MenuHandlers.add(:pokemon_debug_menu, :species_and_form, {
"name" => _INTL("Species/form..."),
"parent" => :main,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:set_species => _INTL("Set species"),
:set_form => _INTL("Set form"),
@@ -731,6 +731,7 @@ MenuHandlers.add(:pokemon_debug_menu, :species_and_form, {
if species && species != pkmn.species
pbPlayDecisionSE
pkmn.species = species
pkmn.gender = nil
pkmn.calc_stats
$player.pokedex.register(pkmn) if !setting_up_battle && !pkmn.egg?
screen.refresh
@@ -790,7 +791,7 @@ MenuHandlers.add(:pokemon_debug_menu, :cosmetic, {
MenuHandlers.add(:pokemon_debug_menu, :set_shininess, {
"name" => _INTL("Set shininess"),
"parent" => :cosmetic,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:make_shiny => _INTL("Make shiny"),
:make_super_shiny => _INTL("Make super shiny"),
@@ -826,7 +827,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_shininess, {
MenuHandlers.add(:pokemon_debug_menu, :set_pokeball, {
"name" => _INTL("Set Poké Ball"),
"parent" => :cosmetic,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {}
cmd = nil
GameData::Item.each do |item|
@@ -848,7 +849,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_pokeball, {
MenuHandlers.add(:pokemon_debug_menu, :set_ribbons, {
"name" => _INTL("Set ribbons"),
"parent" => :cosmetic,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
cmd = nil
loop do
commands = {}
@@ -876,7 +877,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_ribbons, {
MenuHandlers.add(:pokemon_debug_menu, :set_nickname, {
"name" => _INTL("Set nickname"),
"parent" => :cosmetic,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:rename => _INTL("Rename"),
:clear_name => _INTL("Erase name")
@@ -905,7 +906,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_nickname, {
MenuHandlers.add(:pokemon_debug_menu, :ownership, {
"name" => _INTL("Ownership..."),
"parent" => :cosmetic,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:make_players => _INTL("Make player's"),
:set_ot_name => _INTL("Set OT's name"),
@@ -960,7 +961,7 @@ MenuHandlers.add(:pokemon_debug_menu, :ownership, {
MenuHandlers.add(:pokemon_debug_menu, :set_discardable, {
"name" => _INTL("Set discardable"),
"parent" => :main,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
cmd = nil
loop do
commands = {
@@ -992,7 +993,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_egg, {
"name" => _INTL("Set egg"),
"parent" => :main,
"always_show" => false,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
commands = {
:make_egg => _INTL("Make egg"),
:make_pokemon => _INTL("Make Pokémon"),
@@ -1036,7 +1037,7 @@ MenuHandlers.add(:pokemon_debug_menu, :set_egg, {
MenuHandlers.add(:pokemon_debug_menu, :shadow_pkmn, {
"name" => _INTL("Shadow Pkmn..."),
"parent" => :main,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
# TODO: Option to make not a Shadow Pokémon.
commands = {
:make_shadow => _INTL("Make Shadow"),
@@ -1079,7 +1080,7 @@ MenuHandlers.add(:pokemon_debug_menu, :mystery_gift, {
"name" => _INTL("Mystery Gift"),
"parent" => :main,
"always_show" => false,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
pbCreateMysteryGift(0, pkmn)
next false
}
@@ -1089,7 +1090,7 @@ MenuHandlers.add(:pokemon_debug_menu, :duplicate, {
"name" => _INTL("Duplicate"),
"parent" => :main,
"always_show" => false,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
next false if !screen.show_confirm_message(_INTL("Are you sure you want to copy this Pokémon?"))
cloned_pkmn = pkmn.clone
case screen
@@ -1097,9 +1098,9 @@ MenuHandlers.add(:pokemon_debug_menu, :duplicate, {
pbStorePokemon(cloned_pkmn) # Add to party, or to storage if party is full
screen.refresh_party
screen.refresh
when PokemonStorageScreen
when UI::PokemonStorage
if screen.storage.pbMoveCaughtToParty(cloned_pkmn)
screen.show_message(_INTL("The duplicated Pokémon was moved to your party.")) if party_index[0] != -1
screen.show_message(_INTL("The duplicated Pokémon was moved to your party.")) if party_index[0] >= 0
else
old_box = screen.storage.currentBox
new_box = screen.storage.pbStoreCaught(cloned_pkmn)
@@ -1120,15 +1121,15 @@ MenuHandlers.add(:pokemon_debug_menu, :delete, {
"name" => _INTL("Delete"),
"parent" => :main,
"always_show" => false,
"effect" => proc { |pkmn, party_index, held_pkmn, setting_up_battle, screen|
"effect" => proc { |pkmn, party_index, setting_up_battle, screen|
next false if !screen.show_confirm_message(_INTL("Are you sure you want to delete this Pokémon?"))
case screen
when UI::Party
screen.party.delete_at(party_index)
screen.refresh_party
when PokemonStorageScreen
screen.scene.pbRelease(party_index, held_pkmn)
(held_pkmn) ? screen.heldpkmn = nil : screen.storage.pbDelete(party_index[0], party_index[1])
when UI::PokemonStorage
screen.visuals.release_pokemon(true)
screen.storage.pbDelete(party_index[0], party_index[1]) if !screen.holding_pokemon?
end
screen.refresh
next true