Implemented Battle Debug Menu (#130)

* initial commit to setup game.ini
* renamed title of masters Game.ini
* reenabled gitignore for Game.ini
* Between Commit
* Finished Battle Debug Menu
* Clean up for pull request
* Manual fixes
* Fixed oversight where numerical min/max wasm't considered
This commit is contained in:
Alexander Pahn
2021-11-24 20:24:13 +01:00
committed by GitHub
parent a9426b0802
commit 7c48148d35
6 changed files with 1449 additions and 2 deletions

View File

@@ -169,6 +169,82 @@ module PokemonDebugMixin
end
end
#===============================================================================
#
#===============================================================================
module BattleDebugMixin
def pbBattleDebug(battle,show_all = true)
registerBattlerCommands(battle)
commands = CommandMenuList.new
BattleDebugMenuCommands.each do |option, hash|
commands.add(option, hash) if show_all || hash["always_show"]
end
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
viewport.z = 99999
sprites = {}
sprites["textbox"] = pbCreateMessageWindow
sprites["textbox"].letterbyletter = false
sprites["cmdwindow"] = Window_CommandPokemonEx.new(commands.list)
cmdwindow = sprites["cmdwindow"]
cmdwindow.x = Graphics.width - cmdwindow.width
cmdwindow.y = Graphics.height-sprites["textbox"].height - cmdwindow.height
cmdwindow.viewport = viewport
cmdwindow.visible = true
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
pbFadeInAndShow(sprites)
ret = -1
refresh = true
loop do
loop do
oldindex = cmdwindow.index
cmdwindow.update
if refresh || cmdwindow.index != oldindex
sprites["textbox"].text = commands.getDesc(cmdwindow.index)
refresh = false
end
Graphics.update
Input.update
if Input.trigger?(Input::BACK)
parent = commands.getParent
if parent
pbPlayCancelSE
commands.currentList = parent[0]
cmdwindow.commands = commands.list
cmdwindow.index = parent[1]
refresh = true
else
ret = -1
break
end
elsif Input.trigger?(Input::USE)
ret = cmdwindow.index
break
end
end
break if ret < 0
cmd = commands.getCommand(ret)
if commands.hasSubMenu?(cmd)
pbPlayDecisionSE
commands.currentList = cmd
cmdwindow.commands = commands.list
cmdwindow.index = 0
refresh = true
else
BattleDebugMenuCommands.call("effect", cmd,battle,sprites)
end
end
pbPlayCloseMenuSE
pbFadeOutAndHide(sprites)
pbDisposeMessageWindow(sprites["textbox"])
pbDisposeSpriteHash(sprites)
viewport.dispose
end
end
#===============================================================================
#
#===============================================================================
@@ -183,3 +259,7 @@ end
class PokemonDebugPartyScreen
include PokemonDebugMixin
end
class PokeBattle_Battle
include BattleDebugMixin
end