#==============================================================================
# Scene_CMSSave
#==============================================================================
class Scene_CMSSave < Scene_Save
def on_cancel
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(9)
end
end
#==============================================================================
# Scene_CMSLoad
#==============================================================================
class Scene_CMSLoad < Scene_Load
def on_cancel
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(10)
end
end
#==============================================================================
# ** Window_Command_Scroll
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command_Scroll < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands, height)
# Compute window height from command quantity
super(0, 0, width, height)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
#==============================================================================
# Window_CMSCommand EDIT 12345
#==============================================================================
class Window_CMSCommand < Window_Command_Scroll
attr_reader :continue
def initialize(index, continue)
@background = 'CMSCommand'
commands = [$data_system.words.item, 'Equipment', $data_system.words.equip,
$data_system.words.skill, 'Status', 'Hotkeys', 'AI Behavior',
'AI Triggers', 'Options', 'Save', 'Load', 'Exit']
super(180, commands, 320)
@continue, self.index, self.x, self.y, self.z = continue, index, 972, 0, 999
end
def draw_item(i, color)
self.contents.fill_rect(0, i*32, 148, 32, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon("CMS/commandmenu#{i}")
opacity = (color == normal_color ? 255 : 128)
self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = color
self.contents.draw_text(32, i*32, 148, 32, @commands[i])
end
end
#==============================================================================
# Scene_Menu EDIT 12345
#==============================================================================
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
@actor_index = @target_index = -1
@viewport1 = Viewport.new(0, 0, 640, 480)
@moved = false
end
def main
if BlizzCFG::MAP_BACKGROUND
@spriteset = Spriteset_Map.new
elsif BlizzCFG::CMS_EDITION
@spriteset = Sprite.new
@spriteset.bitmap = RPG::Cache.picture("CMS/#{BlizzCFG::CMS_EDITION}/CMSFullscreen")
end
continue = ((1..BlizzCFG::SAVE_FILES_NUMBER).any? {|i|
FileTest.exist?("#{BlizzCFG::SAVE_NAME}#{i}.#{BlizzCFG::SAVE_EXTENSION}")})
@command_window = Window_CMSCommand.new(@menu_index, continue)
(0...8).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
@command_window.disable_item(9) if $game_system.save_disabled
@info_window = Window_CMSInfo.new
@status_windows, @target_windows = [], []
$game_party.actors.each {|actor|
@status_windows.push(Window_CMSMenuStatus.new(actor))}
@help_window = Window_Help.new
@help_window.x, @help_window.y, @help_window.z = 0, -368, 9999
Graphics.transition
loop do
Graphics.update
Input.update
update
break if @scene != nil || $scene != self
end
loop do
Graphics.update
(@status_windows + [@command_window, @info_window]).each {|win| win.update}
move_da_outro
break if @status_windows[0].x <= - 512
end
Graphics.freeze
(@status_windows + @target_windows + [@command_window, @info_window,
@help_window, @spriteset]).each {|obj| obj.dispose if obj != nil}
del_sort if @sort_window != nil
del_status if @playerstatus_window != nil
del_equip if @left_window != nil
del_skill if @skill_window != nil
del_end if @end_window != nil
del_items if @item_choose_window != nil
del_items if @equips_window != nil
del_options if @options_window != nil
if @scene.is_a?(Scene_Title)
Graphics.transition(25)
Graphics.freeze
end
$scene = @scene
end
def update_command #EDIT 12345
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.actors.size == 0 && @command_window.index < 5
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_ITEM_SCENE
@scene = Scene_Item.new
else
@item_choose_window = Window_CMSChooseItem.new
@items_window1 = Window_NormalItem.new
@items_window2 = Window_QuestItem.new
@items_window1.help_window = @items_window2.help_window = @help_window
@command_window.active = false
@help_window.x, @help_window.y = 0, -576
@help_window.set_text('')
@help_window.visible = false
items_refresh
end
when 1..4
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_windows.each {|win| win.active = true}
@actor_index = 0
when 5
$game_system.se_play($data_system.decision_se)
@scene = Scene_Hotkeys.new
when 6
$game_system.se_play($data_system.decision_se)
@scene = Scene_AI_Behavior.new
when 7
$game_system.se_play($data_system.decision_se)
@scene = Scene_AI_Triggers.new
when 8
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_OPTIONS_SCENE
@scene = Scene_Options.new
else
@options_window = Window_CMSOptions.new
@command_window.active = false
end
when 9
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@scene = Scene_CMSSave.new
Graphics.transition(0)
end
when 10
if @command_window.continue
$game_system.se_play($data_system.decision_se)
@scene = Scene_CMSLoad.new
Graphics.transition(0)
else
$game_system.se_play($data_system.buzzer_se)
end
when 11
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_END_SCENE
@scene = Scene_End.new
else
@command_window.active = false
@end_window = Window_CMSEndCommand.new
end
end
end
end
end
#==============================================================================
# Scene_Hotkeys
#------------------------------------------------------------------------------
# This class handles the skill/item hotkey processing.
#==============================================================================
class Scene_Hotkeys
def initialize
super
end
#----------------------------------------------------------------------------
# main
# The main processing method.
#----------------------------------------------------------------------------
def main
# create spriteset
@spriteset = Spriteset_Map.new
# create viewport
@view = Viewport.new(0, 0, 640, 480)
# create HUD if HUD is turned on and HUD active
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
# if ASSIGNMENT is turned
if BlizzABS::Config::HOTKEYS
# create assignment display
@hotkeys = Hotkey_Assignment.new
# set z position
@hotkeys.z = 5000
end
# if MINIMAP is turned on and minimap active
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
# create HUD
@minimap = Minimap.new
end
# create sprite
@choice = Sprite.new
# create bitmap
@choice.bitmap = $BlizzABS.cache.image('menu_arrow')
# set x, y and z positions
@choice.x, @choice.y, @choice.z, @choice.opacity = 160, 40, 500, 128
# set x position offset
@choice.ox = -8
# set active flag
@active = true
# set index
@index = 0
# set up mode flag
@up_mode = true
# create modified skill window
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
# create modified item window
@item_window = Window_Item_Hotkey.new
# set last active
@last_active = true
# transtition
Graphics.transition
# loop
loop do
# update game screen
Graphics.update
# update input
Input.update
# frame update
update
# stop if chosen an option
break if $scene != self
end
# freeze screen
Graphics.freeze
# delet spriteset
@spriteset.dispose
# delete HUD elements that exist
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
# delete choice sprite
@choice.dispose
# delete skill window
@skill_window.dispose
# delete item window
@item_window.dispose
# delete viewport
@view.dispose
end
#----------------------------------------------------------------------------
# update
# The update processing method.
#----------------------------------------------------------------------------
def update
# update choice sprite
@choice.update
# update skill window
@skill_window.update
# update item window
@item_window.update
# update hotkey assignment display if existing
@hotkeys.update if @hotkeys != nil
# move by 2 or 1 whether active in direction depending on @up_mode
@choice.oy += (@up_mode ? (@active ? 2 : 1) : (@active ? -2 : -1))
# set new @up_mode if necesseray depending on @up_mode
@up_mode = (@up_mode ? (@choice.oy < 8) : (@choice.oy <= -8))
# if select button pressed
if $game_system.select_button && Input.trigger?(Input::Select)
# switch to next actor
@skill_window.switch_actor
# if active
elsif @active
# set choice offset always to a number dividable with 2
@choice.oy = @choice.oy / 2 * 2
# update hotkey selection
update_choice
# if skill window is active
elsif @skill_window.active
# update skill selection
update_skill
# if item window is active
elsif @item_window.active
# update item selection
update_item
end
end
#----------------------------------------------------------------------------
# update_choice
# Updates input during the hotkey selection.
#----------------------------------------------------------------------------
def update_choice
# set x position
@choice.x = 146 + @index * 28
# if pressed B
if Input.trigger?(Input::B)
# play cancel sound
$game_system.se_play($data_system.cancel_se)
# go back to menu
$scene = Scene_Menu.new(5)
# if C is pressed
elsif Input.trigger?(Input::C)
# play sound
$game_system.se_play($data_system.decision_se)
# not active
@active = false
# the one that was active the last time is now active
@skill_window.active = @last_active
@item_window.active = (!@last_active)
# if RIGHT is being pressed
elsif Input.repeat?(Input::RIGHT)
# if RIGHT is pressed or index is less than 9
if Input.trigger?(Input::RIGHT) || @index < 9
# play sound
$game_system.se_play($data_system.cursor_se)
# set new index
@index = (@index + 1) % 10
end
# if LEFT is being pressed
elsif Input.repeat?(Input::LEFT)
# if LEFT is pressed or index is equal or greater than 1
if Input.trigger?(Input::LEFT) || @index >= 1
# play sound
$game_system.se_play($data_system.cursor_se)
# set new index
@index = (@index + 9) % 10
end
end
end
#----------------------------------------------------------------------------
# update_skill
# Updates input during the skill selection.
#----------------------------------------------------------------------------
def update_skill
# set last active
@last_active = true
# if B is pressed
if Input.trigger?(Input::B)
# play cancel sound
$game_system.se_play($data_system.cancel_se)
# set active
@active = true
# skill window is not active
@skill_window.active = false
# delete cursor
@skill_window.cursor_rect.empty
# if C is pressd
elsif Input.trigger?(Input::C)
# play sound
$game_system.se_play($data_system.decision_se)
# if last position
if @skill_window.index == @skill_window.item_max - 1
# remove hotkey assigmnent from skill
$game_player.skill_hotkeys[(@index+1)%10] = 0
else
# set skill to hotkey
$game_player.skill_hotkeys[(@index+1)%10] = @skill_window.skill.id
end
# remove hotkey assigmnent from item
$game_player.item_hotkeys[(@index+1)%10] = 0
# draw hotkey display if hotkey display exists
@hotkeys.draw(@index+1) if @hotkeys != nil
# set active
@active = true
# skill window is not active
@skill_window.active = false
# delete cursor
@skill_window.cursor_rect.empty
# if RIGHT or LEFT is pressed
elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
# play sound
$game_system.se_play($data_system.cursor_se)
# item window is active
@item_window.active = true
# skill window is not active
@skill_window.active = false
# delete cursor
@skill_window.cursor_rect.empty
end
end
#----------------------------------------------------------------------------
# update_item
# Updates input during the item selection.
#----------------------------------------------------------------------------
def update_item
# set last active
@last_active = false
# if B is pressed
if Input.trigger?(Input::B)
# play cancel sound
$game_system.se_play($data_system.cancel_se)
# set active
@active = true
# item window is not active
@item_window.active = false
# delete cursor
@item_window.cursor_rect.empty
# if C is pressed
elsif Input.trigger?(Input::C)
# play sound
$game_system.se_play($data_system.decision_se)
# if last position
if @item_window.index == @item_window.item_max - 1
# remove hotkey assigmnent from item
$game_player.item_hotkeys[(@index+1)%10] = 0
else
# set item to hotkey
$game_player.item_hotkeys[(@index+1)%10] = @item_window.item.id
end
# remove hotkey assigmnent from skill
$game_player.skill_hotkeys[(@index+1)%10] = 0
# draw hotkey display if hotkey display exists
@hotkeys.draw(@index+1) if @hotkeys != nil
# set active
@active = true
# item window is not active
@item_window.active = false
# delete cursor
@item_window.cursor_rect.empty
# if RIGHT or LEFT is pressed
elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
# play sound
$game_system.se_play($data_system.cursor_se)
# skill window is active
@skill_window.active = true
# item window is not active
@item_window.active = false
# delete cursor
@item_window.cursor_rect.empty
end
end
end
#==============================================================================
# Scene_AI_Behavior
#------------------------------------------------------------------------------
# This class processes handling of the scene where ally behavior can be set
# up which is used by the Ally Combat AI.
#==============================================================================
class Scene_AI_Behavior
#----------------------------------------------------------------------------
# Initialization
# tone - screen background tone
# index - actor party index
#----------------------------------------------------------------------------
def initialize(index = 0, command_window_index = 0)
# base data
@index = index
# get battler
@actor = $BlizzABS.battlers[index].battler
# command window index
@command_window_index = command_window_index
end
#----------------------------------------------------------------------------
# main
# The main processing method.
#----------------------------------------------------------------------------
def main
# create spriteset
@spriteset = Spriteset_Map.new
# create viewport
@view = Viewport.new(0, 0, 640, 480)
# create command window
@command_window = Window_Command.new(160, BlizzABS::Cache::CommandsAIBehavior)
# command window coordinates
@command_window.x = 480
# command window initial index
@command_window.index = @command_window_index
# get map actor
map_actor = $BlizzABS.battlers[@index]
# create behavior window
@behavior_window = Window_Behavior.new(@actor, map_actor)
# transition
Graphics.transition
# loop
loop do
# update game screen
Graphics.update
# update input
Input.update
# update the scene
update
# stop if frame update
break if $scene != self
end
# freeze screen
Graphics.freeze
# delete command window
@command_window.dispose
# delete behavior window
@behavior_window.dispose
# delete spriteset
@spriteset.dispose
# delete viewport
@view.dispose
end
#----------------------------------------------------------------------------
# update_command
# The command window update processing method.
#----------------------------------------------------------------------------
def update_command
# update command window
@command_window.update
# if B is pressed
if Input.trigger?(Input::B)
# play cancel sound
$game_system.se_play($data_system.cancel_se)
# create map scene
$scene = Scene_Menu.new(6)
# if C is pressed
elsif Input.trigger?(Input::C)
# which option
case @command_window.index
when 0
# play sound
$game_system.se_play($data_system.decision_se)
# deactivate command window
@command_window.active = false
# activate behavior window
@behavior_window.active = true
when 1
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set next index
@index = (@index + 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Behavior.new(@index, @command_window.index)
when 2
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set previous index
@index = (@index + battlers.size - 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + battlers.size - 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Behavior.new(@index, @command_window.index)
when 3
# play sound
$game_system.se_play($data_system.decision_se)
# create map scene
$scene = Scene_Map.new
end
# if R is pressed
elsif Input.trigger?(Input::R)
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set next index
@index = (@index + 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Behavior.new(@index, @command_window.index)
# if L is pressed
elsif Input.trigger?(Input::L)
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set previous index
@index = (@index + battlers.size - 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + battlers.size - 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Behavior.new(@index, @command_window.index)
end
end
end
#==============================================================================
# Scene_AI_Triggers
#------------------------------------------------------------------------------
# This class processes handling of the scene where ally action triggers can be
# set up which is used by the Ally Trigger AI.
#==============================================================================
class Scene_AI_Triggers
#----------------------------------------------------------------------------
# Initialization
# tone - screen background tone
# index - actor party index
#----------------------------------------------------------------------------
def initialize(index = 0, command_window_index = 0)
# data
@index, @actor = index, $BlizzABS.battlers[index].battler
# command window index
@command_window_index = command_window_index
# status effect names
@states = [BlizzABS::Cache::WORDNormalState]
(1...$data_states.size).each {|id| @states.push($data_states[id].name)}
end
#----------------------------------------------------------------------------
# main
# The main processing method.
#----------------------------------------------------------------------------
def main
# create spriteset
@spriteset = Spriteset_Map.new
# create viewport
@view = Viewport.new(0, 0, 640, 480)
# create command window
@command_window = Window_Command.new(160, BlizzABS::Cache::CommandsAITrigger)
# command window coordinates
@command_window.x = 480
# command window initial index
@command_window.index = @command_window_index
# create trigger command window
@tcommand_window = Window_Command.new(160, BlizzABS::Cache::CommandsTrigger)
# trigger command window coordinates
@tcommand_window.x = 480
@tcommand_window.y = @command_window.height
# trigger command window no cursor
@tcommand_window.index = -1
# trigger command window not active
@tcommand_window.active = false
# create name window
@name_window = Window_Base.new(480, 416, 160, 64)
# create bitmap
@name_window.contents = Bitmap.new(@name_window.width - 32,
@name_window.height - 32)
# if using Dyna Edition scripts
if $fontface != nil
# set font name and size
@name_window.contents.font.name = $fontface
@name_window.contents.font.size = $fontsize
# if using PK Edition 2
elsif $defaultfonttype != nil
# set font name and size
@name_window.contents.font.name = $defaultfonttype
@name_window.contents.font.size = $defaultfontsize
end
# draw actor name
@name_window.draw_actor_name(@actor, 4, 0)
# update trigger command display
check_triggers
# creat triggers window
@triggers_window = Window_Triggers.new(@actor)
# transition
Graphics.transition
# loop
loop do
# update game screen
Graphics.update
# update input
Input.update
# update the scene
update
# stop if frame update
break if $scene != self
end
# freeze screen
Graphics.freeze
# delete command window
@command_window.dispose
# delete trigger command window
@tcommand_window.dispose
# delete triggers window
@triggers_window.dispose
# delete name window
@name_window.dispose
# delete spriteset
@spriteset.dispose
# delete viewport
@view.dispose
end
#----------------------------------------------------------------------------
# update_command
# The command window update processing method.
#----------------------------------------------------------------------------
def update_command
# update command window
@command_window.update
# if B is pressed
if Input.trigger?(Input::B)
# play cancel sound
$game_system.se_play($data_system.cancel_se)
# create map scene
$scene = Scene_Menu.new(7)
# if C is pressed
elsif Input.trigger?(Input::C)
# which option
case @command_window.index
when 0
# play sound
$game_system.se_play($data_system.decision_se)
# deactivate command window
@command_window.active = false
# activate trigger command window
@tcommand_window.active = true
# set cursor
@tcommand_window.index = 0
when 1
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set next index
@index = (@index + 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Triggers.new(@index, @command_window.index)
when 2
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set next index
@index = (@index + battlers.size - 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + battlers.size - 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Triggers.new(@index, @command_window.index)
when 3
# play sound
$game_system.se_play($data_system.decision_se)
# create map scene
$scene = Scene_Map.new
end
# if R is pressed
elsif Input.trigger?(Input::R)
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set next index
@index = (@index + 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Triggers.new(@index, @command_window.index)
# if L is pressed
elsif Input.trigger?(Input::L)
# play sound
$game_system.se_play($data_system.decision_se)
# get all AI actors
battlers = $BlizzABS.battlers
# set next index
@index = (@index + battlers.size - 1) % battlers.size
# if battler not valid
while battlers[@index].battler == nil
# try to find one that is
@index = (@index + battlers.size - 1) % battlers.size
end
# create hotkey assignment scene with the current screen tint
$scene = Scene_AI_Triggers.new(@index, @command_window.index)
end
end
end