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

@@ -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
#===============================================================================
#
#===============================================================================