03-03-2008, 04:06 AM
Battle Debugger
by RPG Advocate
by RPG Advocate
Introduction
This script adds many debugging features to the battle system (see images for a list). To access the debug commands during test play or a test battle, press "A"key (Input::X) when you're entering a character's commands. The monster data window shows the monsters' names, HP, and SP. Hidden monsters are shown in the disabled color defined in your scripts.
Originally to use this script, you would have needed to add or replace the pieces of code supplied to Scene_Battle. Then, add the new window classes with the code originallysupplied. Now, it is in one contiguous script.
Demo
>Click<
Script
"script"
Code:
# Battle Debugger
# by RPG Advocate
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Initialize each kind of temporary battle data
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# Initialize battle event interpreter
$game_system.battle_interpreter.setup(nil, 0)
# Prepare troop
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# Make actor command window
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# Make debug command window
d1 = "Change Character HP"
d2 = "Change Character SP"
d3 = "Complete Heal Character"
d4 = "Change Monster HP"
d5 = "Change Monster SP"
d6 = "Complete Heal Monster"
d7 = "Kill All Monsters"
d8 = "Revive All Monsters"
d9 = "Switches/Variables"
d10 = "Hide Monster"
d11 = "Show All Monsters"
d12 = "Item Management"
d13 = "Change Turn Number"
d14 = "End Battle"
debug_commands = [d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13,
d14]
@battledebug_window = Window_Command.new(208, debug_commands)
@battledebug_window.x = 0
@battledebug_window.y = 0
@battledebug_window.z = 5000
@battledebug_window.visible = false
# Make end combat command window
e1 = "End as Victory"
e2 = "End as Escape"
e3 = "End as Defeat"
end_commands = [e1, e2, e3]
@end_window = Window_Command.new(200, end_commands)
@end_window.visible = false
@end_window.active = false
@end_window.visible = false
@end_window.x = 150
@end_window.y = 300
@end_window.z = 5020
# Make other windows
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# Make other debug windows
@debugging = false
@last_sv_index = -1
@sv_index = -1
@selected_entity = -1
@left_window = Window_DebugLeft.new
@right_window = Window_DebugRight.new
@left_window.active = false
@left_window.visible = false
@left_window.z = 5100
@right_window.active = false
@right_window.visible = false
@right_window.z = 5100
count_y = $game_troop.enemies.size * 32 + 64
@count_window = Window_BattleTurn.new(count_y)
@count_window.visible = false
@count_window.z = 5000
@turn_window = Window_InputNumber.new(3)
@turn_window.active = false
@turn_window.visible = false
@turn_window.x = 150
@turn_window.y = 300
@turn_window.z = 5020
@turn_window.opacity = 255
@turn_window.back_opacity = 255
@enemyhp_window = Window_InputNumber.new(6)
@enemyhp_window.active = false
@enemyhp_window.visible = false
@enemyhp_window.x = 150
@enemyhp_window.y = 300
@enemyhp_window.z = 5040
@enemyhp_window.opacity = 255
@enemyhp_window.back_opacity = 255
@value_window = Window_InputNumber.new(4)
@value_window.active = false
@value_window.visible = false
@value_window.x = 150
@value_window.y = 300
@value_window.z = 5040
@value_window.opacity = 255
@value_window.back_opacity = 255
@var_window = Window_InputNumber.new(8)
@var_window.active = false
@var_window.visible = false
@var_window.x = 270
@var_window.y = 164
@var_window.z = 5200
@var_window.opacity = 255
@var_window.back_opacity = 255
@turn_window.opacity = 255
@turn_window.back_opacity = 255
@itemset_window = Window_Dataset.new(1)
@itemset_window.active = false
@itemset_window.visible = false
@itemset_window.x = 208
@itemset_window.y = 0
@itemset_window.z = 6000
@monsterdata_window = Window_MonsterData.new
@monsterdata_window.visible = false
@monsterdata_window.z = 5000
# Make sprite set
@spriteset = Spriteset_Battle.new
# Initialize wait count
@wait_count = 0
# Execute transition
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# Start pre-battle phase
start_phase1
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Refresh map
$game_map.refresh
# Prepare for transition
Graphics.freeze
# Dispose of debug windows
@left_window.dispose
@right_window.dispose
@var_window.dispose
@count_window.dispose
@battledebug_window.dispose
@end_window.dispose
@turn_window.dispose
@enemyhp_window.dispose
@value_window.dispose
@monsterdata_window.dispose
# Dispose of standard windows
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# Dispose of sprite set
@spriteset.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
# If switching from battle test to any screen other than game over screen
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If battle event is running
if $game_system.battle_interpreter.running?
# Update interpreter
$game_system.battle_interpreter.update
# If a battler which is forcing actions doesn't exist
if $game_temp.forcing_battler == nil
# If battle event has finished running
unless $game_system.battle_interpreter.running?
# Rerun battle event set up if battle continues
unless judge
setup_battle_event
end
end
# If not after battle phase
if @phase != 5
# Refresh status window
@status_window.refresh
end
end
end
# Update system (timer) and screen
$game_system.update
$game_screen.update
# If timer has reached 0
if $game_system.timer_working and $game_system.timer == 0
# Abort battle
$game_temp.battle_abort = true
end
# Update debug windows
@left_window.update
@right_window.update
@count_window.update
@end_window.update
@var_window.update
@battledebug_window.update
@turn_window.update
@enemyhp_window.update
@value_window.update
@itemset_window.update
# Update windows
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# Update sprite set
@spriteset.update
# If transition is processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If message window is showing
if $game_temp.message_window_showing
return
end
# If effect is showing
if @spriteset.effect?
return
end
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Switch to title screen
$scene = Scene_Title.new
return
end
# If battle is aborted
if $game_temp.battle_abort
# Return to BGM used before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Battle ends
battle_end(1)
return
end
# If waiting
if @wait_count > 0
# Decrease wait count
@wait_count -= 1
return
end
# If battler forcing an action doesn't exist,
# and battle event is running
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# Branch according to phase
case @phase
when 1 # pre-battle phase
update_phase1
when 2 # party command phase
update_phase2
when 3 # actor command phase
update_phase3
when 4 # main phase
update_phase4
when 5 # after battle phase
update_phase5
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase)
#--------------------------------------------------------------------------
def update_phase3
# If enemy arrow is enabled on debugging window
if @enemy_arrow != nil && @debugging
update_debug_enemy_select
# If actor arrow is enabled on debugging window
elsif @actor_arrow != nil && @debugging
update_debug_actor_select
# If enemy arrow is enabled
elsif @enemy_arrow != nil
update_phase3_enemy_select
# If actor arrow is enabled
elsif @actor_arrow != nil
update_phase3_actor_select
# If skill window is enabled
elsif @skill_window != nil
update_phase3_skill_select
# If item window is enabled
elsif @item_window != nil
update_phase3_item_select
# If actor command window is enabled
elsif @actor_command_window.active
update_phase3_basic_command
elsif @battledebug_window.active
update_battledebug
elsif @end_window.active
update_end
elsif @turn_window.active
update_turn
elsif @itemset_window.active
update_itemset
elsif @enemyhp_window.active
update_enemyhp
elsif @value_window.active
update_value
elsif @left_window.active
update_left
elsif @right_window.active
update_right
elsif @var_window.active
update_var
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
alias bdebug_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
# Original call
bdebug_update_phase3_basic_command
# Update Windows
if Input.trigger?(Input::X) && ($BTEST || $DEBUG)
$game_system.se_play($data_system.decision_se)
@debugging = true
@actor_command_window.active = false
@actor_command_window.visible = false
@battledebug_window.active = true
@battledebug_window.visible = true
@battledebug_window.index = 0
@monsterdata_window.refresh
@count_window.refresh
@count_window.visible = true
@monsterdata_window.visible = true
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when debug window is active)
#--------------------------------------------------------------------------
def update_battledebug
if @battledebug_window.active
@selected_entity = -1
end
if Input.trigger?(Input::B)
@debugging = false
@sv_index = -1
$game_system.se_play($data_system.cancel_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
phase3_setup_command_window
end
if Input.trigger?(Input::C)
case @battledebug_window.index
when 0
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
debug_actor_select
when 1
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
debug_actor_select
when 2
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
debug_actor_select
when 3
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
debug_enemy_select
when 4
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
debug_enemy_select
when 5
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
debug_enemy_select
when 6
$game_system.se_play($data_system.decision_se)
for enemy in $game_troop.enemies
enemy.hp = 0
enemy.immortal = false
@battledebug_window.visible = false
@battledebug_window.active = false
@monsterdata_window.visible = false
@count_window.visible = false
start_phase5
end
when 7
$game_system.se_play($data_system.decision_se)
for enemy in $game_troop.enemies
if enemy.dead? && enemy.hidden == false
enemy.hp += 1
enemy.damage = -1
enemy.damage_pop = true
end
end
@monsterdata_window.refresh
when 8
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@left_window.visible = true
@right_window.visible = true
@left_window.active = true
when 9
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@battledebug_window.visible = false
@monsterdata_window.visible = false
@count_window.visible = false
debug_enemy_select
when 10
$game_system.se_play($data_system.decision_se)
for enemy in $game_troop.enemies
enemy.hidden = false
end
@monsterdata_window.refresh
when 11
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@itemset_window.index = 0
@itemset_window.active = true
@itemset_window.visible = true
when 12
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@turn_window.number = $game_temp.battle_turn + 1
@turn_window.active = true
@turn_window.visible = true
when 13
$game_system.se_play($data_system.decision_se)
@battledebug_window.active = false
@end_window.active = true
@end_window.visible = true
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when end combat window is active)
#--------------------------------------------------------------------------
def update_end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_system.bgm_play($game_temp.map_bgm)
battle_end(@end_window.index)
end
end
#--------------------------------------------------------------------------
# * Frame Update (when turn window is active)
#--------------------------------------------------------------------------
def update_turn
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_temp.battle_turn = @turn_window.number - 1
reset_debug
end
end
#--------------------------------------------------------------------------
# * Frame Update (when left window is active)
#--------------------------------------------------------------------------
def update_left
@sv_index = @left_window.index
if @sv_index != @last_sv_index
@last_sv_index = @left_window.index
@right_window.top_id = @left_window.index * 10 + 1
@right_window.mode = 0
if @right_window.top_id >= $data_system.switches.size
@right_window.mode = 1
s = $data_system.switches.size - 1
loop do
if s % 10 == 0
break
end
s += 1
end
@right_window.top_id -= s
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@left_window.active = false
@right_window.active = true
@right_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@left_window.active = true
@right_window.active = false
@right_window.index = -1
@help_window.contents.clear
return
end
current_id = @right_window.top_id + @right_window.index
if @right_window.mode == 0
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_switches[current_id] = (not $game_switches[current_id])
@right_window.refresh
return
end
end
if @right_window.mode == 1
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
$game_variables[current_id] += 1
if $game_variables[current_id] > 99999999
$game_variables[current_id] = 99999999
end
@right_window.refresh
return
end
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
$game_variables[current_id] -= 1
if $game_variables[current_id] < -99999999
$game_variables[current_id] = -99999999
end
@right_window.refresh
return
end
if Input.repeat?(Input::C)
$game_system.se_play($data_system.decision_se)
current_id = @right_window.top_id + @right_window.index
@variable_edit = current_id
@var_window.number = $game_variables[current_id].abs
@var_window.visible = true
@var_window.active = true
@right_window.active = false
end
if Input.repeat?(Input::X)
$game_system.se_play($data_system.decision_se)
current_id = @right_window.top_id + @right_window.index
$game_variables[current_id] *= -1
@right_window.refresh
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_itemset
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
end
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
$game_party.gain_item(@itemset_window.index + 1, 1)
@itemset_window.refresh
end
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
$game_party.lose_item(@itemset_window.index + 1, 1)
@itemset_window.refresh
end
if Input.repeat?(Input::X)
$game_system.se_play($data_system.cursor_se)
$game_party.lose_item(@itemset_window.index + 1, 10)
@itemset_window.refresh
end
if Input.repeat?(Input::Y)
$game_system.se_play($data_system.cursor_se)
$game_party.gain_item(@itemset_window.index + 1, 10)
@itemset_window.refresh
end
end
#--------------------------------------------------------------------------
# * Frame Update (when variable window is active)
#--------------------------------------------------------------------------
def update_var
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@var_window.visible = false
@var_window.active = false
@right_window.active = true
@right_window.refresh
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[@variable_edit] = @var_window.number
@var_window.visible = false
@var_window.active = false
@right_window.active = true
@right_window.refresh
end
end
#--------------------------------------------------------------------------
# * Frame Update (when enemy hp window is active)
#--------------------------------------------------------------------------
def update_enemyhp
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_troop.enemies[@selected_entity].hp = @enemyhp_window.number
reset_debug
end
end
#--------------------------------------------------------------------------
# * Frame Update (when value window is active)
#--------------------------------------------------------------------------
def update_value
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @battledebug_window.index
when 0
$game_party.actors[@selected_entity].hp = @value_window.number
when 1
$game_party.actors[@selected_entity].sp = @value_window.number
when 4
$game_troop.enemies[@selected_entity].sp = @value_window.number
end
reset_debug
end
end
#--------------------------------------------------------------------------
# * Debug enemy select
#--------------------------------------------------------------------------
def debug_enemy_select
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
@enemy_arrow.help_window = @help_window
end
#--------------------------------------------------------------------------
# * Debug actor select
#--------------------------------------------------------------------------
def debug_actor_select
@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
@actor_arrow.help_window = @help_window
end
#--------------------------------------------------------------------------
# * Frame Update (when enemy targetting is active)
#--------------------------------------------------------------------------
def update_debug_enemy_select
@enemy_arrow.update
@selected_entity = @enemy_arrow.index
@enemyhp_window.x = $game_troop.enemies[@selected_entity].screen_x
@enemyhp_window.y = $game_troop.enemies[@selected_entity].screen_y
@value_window.x = $game_troop.enemies[@selected_entity].screen_x
@value_window.y = $game_troop.enemies[@selected_entity].screen_y
if @enemyhp_window.x >= 494
@enemyhp_window.x = 494
end
if @value_window.x >= 532
@value_window.x = 532
end
if @enemyhp_window.y >= 416
@enemyhp_window.y = 416
end
if @value_window.y >= 416
@value_window.y = 416
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
@enemy_arrow.dispose
@enemy_arrow = nil
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @battledebug_window.index
when 3
@enemyhp_window.number = $game_troop.enemies[@selected_entity].hp
when 4
@value_window.number = $game_troop.enemies[@selected_entity].sp
when 5
value = @enemy_arrow.index
$game_troop.enemies[value].recover_all
$game_troop.enemies[value].damage = "Complete Healing"
$game_troop.enemies[value].damage_pop = true
when 9
value = @enemy_arrow.index
$game_troop.enemies[value].hidden = true
end
end_debug_enemy_select
end
end
#--------------------------------------------------------------------------
# * Frame Update (when actor targetting is active)
#--------------------------------------------------------------------------
def update_debug_actor_select
@actor_arrow.update
@selected_entity = @actor_arrow.index
@value_window.x = $game_party.actors[@selected_entity].screen_x
@value_window.y = $game_party.actors[@selected_entity].screen_y
if @value_window.x >= 532
@value_window.x = 532
end
if @value_window.y >= 416
@value_window.y = 416
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
reset_debug
@actor_arrow.dispose
@actor_arrow = nil
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @battledebug_window.index
when 0
@value_window.number = $game_party.actors[@selected_entity].hp
when 1
@value_window.number = $game_party.actors[@selected_entity].sp
when 2
value = @actor_arrow.index
$game_party.actors[value].recover_all
$game_party.actors[value].damage = "Complete Healing"
$game_party.actors[value].damage_pop = true
end
end_debug_actor_select
end
end
#--------------------------------------------------------------------------
# * End debug enemy select
#--------------------------------------------------------------------------
def end_debug_enemy_select
@monsterdata_window.refresh
@help_window.visible = false
case @battledebug_window.index
when 3
@enemyhp_window.active = true
@enemyhp_window.visible = true
when 4
@value_window.active = true
@value_window.visible = true
when 5
reset_debug
when 9
reset_debug
end
@enemy_arrow.dispose
@enemy_arrow = nil
end
#--------------------------------------------------------------------------
# * End debug actor select
#--------------------------------------------------------------------------
def end_debug_actor_select
@status_window.refresh
@help_window.visible = false
case @battledebug_window.index
when 0
@value_window.active = true
@value_window.visible = true
when 1
@value_window.active = true
@value_window.visible = true
when 2
reset_debug
end
@actor_arrow.dispose
@actor_arrow = nil
end
#--------------------------------------------------------------------------
# * Reset Debug windows
#--------------------------------------------------------------------------
def reset_debug
@status_window.refresh
@monsterdata_window.refresh
@count_window.refresh
@end_window.active = false
@turn_window.active = false
@enemyhp_window.active = false
@value_window.active = false
@itemset_window.active = false
@left_window.active = false
@right_window.active = false
@end_window.visible = false
@turn_window.visible = false
@enemyhp_window.visible = false
@value_window.visible = false
@itemset_window.visible = false
@left_window.visible = false
@right_window.visible = false
@help_window.visible = false
@battledebug_window.active = true
@battledebug_window.visible = true
@monsterdata_window.visible = true
@count_window.visible = true
end
end
#==============================================================================
# ** Window_MonsterData
#------------------------------------------------------------------------------
# This window shows the monster information in the debug system.
#==============================================================================
class Window_MonsterData < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@count = -1
if $game_temp.in_battle == false
lines = 1
@count = 0
else
lines = $game_troop.enemies.size
end
lines += 2
super(208, 0, 432, lines * 32)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
self.contents.font.name = "Arial"
self.contents.font.size = 24
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
if @count >= 0
self.contents.draw_text(4, 0, 200, 32, "No data to display.")
self.contents.draw_text(4, 32, 400, 32,
"Monster data window was called outside of battle.")
return
end
self.contents.fill_rect(0, 32, 400, 1, normal_color)
y = 32
self.contents.draw_text(4, 0, 72, 32, "Name")
self.contents.draw_text(194, 0, 28, 32, "HP")
self.contents.draw_text(334, 0, 28, 32, "SP")
for enemy in $game_troop.enemies
self.contents.font.color = normal_color
name = enemy.name
hp = enemy.hp
max_hp = enemy.maxhp
sp = enemy.sp
max_sp = enemy.maxsp
if hp == 0 && enemy.hidden == false
self.contents.font.color = knockout_color
end
if enemy.hidden == true
self.contents.font.color = disabled_color
end
self.contents.draw_text(4, y, 150, 32, name)
self.contents.font.color = normal_color
if enemy.hidden == true
self.contents.font.color = disabled_color
end
if hp <= max_hp / 4 && enemy.hidden == false
self.contents.font.color = crisis_color
end
if hp == 0 && enemy.hidden == false
self.contents.font.color = knockout_color
end
self.contents.draw_text(132, y, 72, 32, hp.to_s, 2)
self.contents.font.color = normal_color
if enemy.hidden == true
self.contents.font.color = disabled_color
end
self.contents.draw_text(204, y, 6, 32, "/")
self.contents.font.color = normal_color
if enemy.hidden == true
self.contents.font.color = disabled_color
end
self.contents.draw_text(210, y, 72, 32, max_hp.to_s, 2)
if enemy.hidden == true
self.contents.font.color = disabled_color
end
if sp <= max_sp / 4 && enemy.hidden == false
self.contents.font.color = crisis_color
end
if sp == 0 && enemy.hidden == false
self.contents.font.color = knockout_color
end
self.contents.draw_text(296, y, 48, 32, sp.to_s, 2)
self.contents.font.color = normal_color
if enemy.hidden == true
self.contents.font.color = disabled_color
end
self.contents.draw_text(344, y, 6, 32, "/")
self.contents.font.color = normal_color
if enemy.hidden == true
self.contents.font.color = disabled_color
end
self.contents.draw_text(350, y, 48, 32, max_sp.to_s, 2)
y += 32
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if $game_temp.in_battle == false
@count += 1
end
if @count == 100
dispose
end
end
end
#==============================================================================
# ** Window_Battleturn
#------------------------------------------------------------------------------
# This window shows the number of turns in battle in the debug system.
#==============================================================================
class Window_BattleTurn < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# y_coord : y coordinates
#--------------------------------------------------------------------------
def initialize(y_coord)
super(512, y_coord, 128 ,64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
self.contents.font.name = "Arial"
self.contents.font.size = 24
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 50, 32, "Turn")
if $game_temp.in_battle
turn = $game_temp.battle_turn + 1
else
turn = 0
end
self.contents.draw_text(60, 0, 36, 32, turn.to_s, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
end
end
#==============================================================================
# ** Window_Dataset
#------------------------------------------------------------------------------
# This window displays changable information in the debug system.
#==============================================================================
class Window_Dataset < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# type : type
#--------------------------------------------------------------------------
def initialize(type)
super(0, 0, 300, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
self.contents.font.name = "Arial"
self.contents.font.size = 24
@type = type
if @type == 1
@item_max = $data_items.size - 1
end
if @type == 2
@item_max = $data_weapons.size - 1
end
if @type == 3
@item_max = $data_armors.size - 1
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
y = 0
self.contents = Bitmap.new(width - 32, 32 * @item_max)
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.opacity = 255
self.back_opacity = 255
if @type == 1
for i in 1..$data_items.size - 1
draw_item_name($data_items[i], 4, i*32 - 32)
number = $game_party.item_number(i).to_s
self.contents.draw_text(4, i*32 - 32, 262, 32, number, 2)
end
end
if @type == 2
for i in 1..$data_weapons.size - 1
draw_item_name($data_weapons[i], 4, i*32 - 32)
number = $game_party.weapon_number(i).to_s
self.contents.draw_text(4, i*32 - 32, 262, 32, number, 2)
end
end
if @type == 3
for i in 1..$data_armors.size - 1
draw_item_name($data_armors[i], 4, i*32 - 32)
number = $game_party.armor_number(i).to_s
self.contents.draw_text(4, i*32 - 32, 262, 32, number, 2)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
end
end