11-21-2008, 01:00 PM
(This post was last modified: 05-12-2017, 02:26 AM by DerVVulfman.)
Part 2
Code:
#==============================================================================
# ** Window_Equip_Parameter
#==============================================================================
class Window_Equip_Parameter < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(640, 192, 320, 288)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.opacity = 255
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_parameter(@actor, 0, 0, 0)
draw_actor_parameter(@actor, 0, 32, 1)
draw_actor_parameter(@actor, 0, 64, 2)
draw_actor_parameter(@actor, 0, 96, 3)
draw_actor_parameter(@actor, 0, 128, 4)
draw_actor_parameter(@actor, 0, 160, 5)
draw_actor_parameter(@actor, 0, 192, 6)
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 0, 36, 32, ">>", 2)
if @new_atk > @actor.atk
color = plus_color
elsif @new_atk < @actor.atk
color = minus_color
else
color = normal_color
end
self.contents.font.color = color
self.contents.draw_text(206, 0, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 32, 36, 32, ">>", 2)
if @new_pdef > @actor.pdef
color = plus_color
elsif @new_pdef < @actor.pdef
color = minus_color
else
color = normal_color
end
self.contents.font.color = color
self.contents.draw_text(206, 32, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64, 36, 32, ">>", 2)
if @new_mdef > @actor.mdef
color = plus_color
elsif @new_mdef < @actor.mdef
color = minus_color
else
color = normal_color
end
self.contents.font.color = color
self.contents.draw_text(206, 64, 36, 32, @new_mdef.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96, 36, 32, ">>", 2)
if @new_str > @actor.str
color = plus_color
elsif @new_str < @actor.str
color = minus_color
else
color = normal_color
end
self.contents.font.color = color
self.contents.draw_text(206, 96, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 36, 32, ">>", 2)
if @new_dex > @actor.dex
color = plus_color
elsif @new_dex < @actor.dex
color = minus_color
else
color = normal_color
end
self.contents.font.color = color
self.contents.draw_text(206, 128, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 160, 36, 32, ">>", 2)
if @new_agi > @actor.agi
color = plus_color
elsif @new_agi < @actor.agi
color = minus_color
else
color = normal_color
end
self.contents.font.color = color
self.contents.draw_text(206, 160, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 192, 36, 32, ">>", 2)
if @new_int > @actor.int
color = plus_color
elsif @new_int < @actor.int
color = minus_color
else
color = normal_color
end
self.contents.font.color = color
self.contents.draw_text(206, 192, 36, 32, @new_int.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Set parameters after changing equipment
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ** Window_Equipment
#==============================================================================
class Window_Equipment < Window_Selectable
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(640, 192, 320, 288)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 255
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = special_color
self.contents.draw_text(0, 0, 160, 32, $data_system.words.weapon)
self.contents.draw_text(0, 48, 160, 32, $data_system.words.armor1)
self.contents.draw_text(0, 96, 160, 32, $data_system.words.armor2)
self.contents.draw_text(0, 144, 160, 32, $data_system.words.armor3)
self.contents.draw_text(0, 192, 160, 32, $data_system.words.armor4)
draw_item_name(@data[0], 0, 24)
draw_item_name(@data[1], 0, 72)
draw_item_name(@data[2], 0, 120)
draw_item_name(@data[3], 0, 168)
draw_item_name(@data[4], 0, 216)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(-4, 24 + @index * 48, self.width - 96, 30)
end
end
end
#==============================================================================
# ** Window_Equipment_Status
#==============================================================================
class Window_Equipment_Status < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(640, 64, 320, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.opacity = 255
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 0, 0)
draw_actor_hp_bar(@actor, 0, 32)
draw_actor_sp_bar(@actor, 0, 64)
draw_actor_level(@actor, 160, 0)
end
end
#==============================================================================
# ** Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(960, 64, 320, 416)
self.opacity = 255
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
@data.push(nil)
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
(0...@item_max-1).each {|i| draw_item(i)}
self.contents.font.color = system_color
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.contents.draw_text(4, (@item_max - 1) * 32, 100, 32, "Unequip")
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
#--------------------------------------------------------------------------
# * Item Max
#--------------------------------------------------------------------------
def item_max
return @item_max
end
end
#==============================================================================
# ** Window_EquipHelp
#==============================================================================
class Window_EquipHelp < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize
super(640, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.opacity = 255
end
#--------------------------------------------------------------------------
# * Set Text
#--------------------------------------------------------------------------
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
end
#==============================================================================
# ** Window_Status_Parameter
#==============================================================================
class Window_Status_Parameter < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(640, 64, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.opacity = 255
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 156, 64)
draw_actor_name(@actor, 0, 0)
draw_actor_class(@actor, 0, 32)
draw_actor_level(@actor, 0, 64)
draw_actor_hp_bar(@actor, 0, 96, 172)
draw_actor_sp_bar(@actor, 0, 128, 172)
draw_actor_parameter(@actor, 0, 160, 0)
draw_actor_parameter(@actor, 0, 192, 1)
draw_actor_parameter(@actor, 0, 224, 2)
draw_actor_parameter(@actor, 0, 256, 3)
draw_actor_parameter(@actor, 0, 288, 4)
draw_actor_parameter(@actor, 0, 320, 5)
draw_actor_parameter(@actor, 0, 352, 6)
end
end
#==============================================================================
# ** Window_Status_Equipment
#==============================================================================
class Window_Status_Equipment < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(960, 192, 320, 288)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.opacity = 255
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.font.color = special_color
self.contents.draw_text(0, 0, 160, 34, $data_system.words.weapon)
self.contents.draw_text(0, 48, 160, 32, $data_system.words.armor1)
self.contents.draw_text(0, 96, 160, 32, $data_system.words.armor2)
self.contents.draw_text(0, 144, 160, 32, $data_system.words.armor3)
self.contents.draw_text(0, 192, 160, 32, $data_system.words.armor4)
self.contents.font.color = normal_color
draw_item_name($data_weapons[@actor.weapon_id], 0, 24)
draw_item_name($data_armors[@actor.armor1_id], 0, 72)
draw_item_name($data_armors[@actor.armor2_id], 0, 120)
draw_item_name($data_armors[@actor.armor3_id], 0, 168)
draw_item_name($data_armors[@actor.armor4_id], 0, 216)
end
end
#==============================================================================
# ** Window_Status_Exp
#==============================================================================
class Window_Status_Exp < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(960, 64, 320, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.opacity = 255
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 128, 32, "State:")
draw_actor_state(@actor, 192, 0)
draw_actor_current_exp(@actor, 0, 32)
draw_actor_exp_bar(@actor, 0, 64)
end
end
#==============================================================================
# ** Window_Status_Help
#==============================================================================
class Window_Status_Help < Window_Base
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(640, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = CMS::Font_Name
self.contents.font.size = CMS::Font_Size
self.opacity = 255
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if @actor.id == 1
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Aluxes' Status Overview.")
end
if @actor.id == 2
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Basil's Status Overview.")
end
if @actor.id == 3
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Cyrus' Status Overview.")
end
if @actor.id == 4
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Dorothy's Status Overview.")
end
if @actor.id == 5
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Esttele's Status Overview.")
end
if @actor.id == 6
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Felix's Status Overview.")
end
if @actor.id == 7
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Gloria's Status Overview.")
end
if @actor.id == 8
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "Hilda's Status Overview.")
end
end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@update_frame = 0
@spriteset = Spriteset_Map.new
@viewport = Viewport.new(0, 0, 640, 480)
@viewport.tone = Tone.new(0, 0, 0,166)
@command_window = Window_New_Command.new(@menu_index)
@command_window.index = @menu_index
@command_window.x = 640
@command_window.y = 0
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
@status_window = Window_Menu_Status.new
@status_window.x = -480
@status_window.y = 0
@player_stats_window = Window_Player_Status.new
@player_stats_window.x = 0
@player_stats_window.y = 480
if $game_party.actors.size == 1
@window_sprite1 = Window_Sprite1.new
@window_sprite1.frame_update
elsif $game_party.actors.size == 2
@window_sprite1 = Window_Sprite1.new
@window_sprite1.frame_update
@window_sprite2 = Window_Sprite2.new
@window_sprite2.frame_update
elsif $game_party.actors.size == 3
@window_sprite1 = Window_Sprite1.new
@window_sprite1.frame_update
@window_sprite2 = Window_Sprite2.new
@window_sprite2.frame_update
@window_sprite3 = Window_Sprite3.new
@window_sprite3.frame_update
elsif $game_party.actors.size == 4
@window_sprite1 = Window_Sprite1.new
@window_sprite1.frame_update
@window_sprite2 = Window_Sprite2.new
@window_sprite2.frame_update
@window_sprite3 = Window_Sprite3.new
@window_sprite3.frame_update
@window_sprite4 = Window_Sprite4.new
@window_sprite4.frame_update
end
@command_exit_window = Window_New_Command_Exit.new(@menu_index)
@command_exit_window.index = @menu_index
Graphics.transition(CMS::Transition_Wait, CMS::Transition)
loop do
Graphics.update
Input.update
@update_frame += 1
if @update_frame == 10
@update_frame = 0
if $game_party.actors.size == 1
@window_sprite1.frame_update
elsif $game_party.actors.size == 2
@window_sprite1.frame_update
@window_sprite2.frame_update
elsif $game_party.actors.size == 3
@window_sprite1.frame_update
@window_sprite2.frame_update
@window_sprite3.frame_update
elsif $game_party.actors.size == 4
@window_sprite1.frame_update
@window_sprite2.frame_update
@window_sprite3.frame_update
@window_sprite4.frame_update
end
end
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@viewport.dispose
@command_window.dispose
@status_window.dispose
@player_stats_window.dispose
@command_exit_window.dispose
if $game_party.actors.size == 1
@window_sprite1.dispose
elsif $game_party.actors.size == 2
@window_sprite1.dispose
@window_sprite2.dispose
elsif $game_party.actors.size == 3
@window_sprite1.dispose
@window_sprite2.dispose
@window_sprite3.dispose
elsif $game_party.actors.size == 4
@window_sprite1.dispose
@window_sprite2.dispose
@window_sprite3.dispose
@window_sprite4.dispose
end
end
#--------------------------------------------------------------------------
# * Defining the delay
#--------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@command_window.update
@status_window.update
@player_stats_window.update
@command_exit_window.update
if @command_window.x > 480
@command_window.x -= 40
end
if @player_stats_window.y > 384
@player_stats_window.y -= 32
end
if @status_window.x < 0
@status_window.x += 40
end
if $game_party.actors.size == 1
if @window_sprite1.x < 0
@window_sprite1.x += 40
end
elsif $game_party.actors.size == 2
if @window_sprite1.x < 0
@window_sprite1.x += 40
end
if @window_sprite2.x < 0
@window_sprite2.x += 40
end
elsif $game_party.actors.size == 3
if @window_sprite1.x < 0
@window_sprite1.x += 40
end
if @window_sprite2.x < 0
@window_sprite2.x += 40
end
if @window_sprite3.x < 0
@window_sprite3.x += 40
end
elsif $game_party.actors.size == 4
if @window_sprite1.x < 0
@window_sprite1.x += 40
end
if @window_sprite2.x < 0
@window_sprite2.x += 40
end
if @window_sprite3.x < 0
@window_sprite3.x += 40
end
if @window_sprite4.x < 0
@window_sprite4.x += 40
end
end
#------------------------------------------------------------------------
# If command window is active: call update_command
#------------------------------------------------------------------------
if @command_window.active
update_command
return
end
#------------------------------------------------------------------------
# If exit command window is active: call update_command
#------------------------------------------------------------------------
if @command_exit_window.active
if @command_exit_window.x > 480
@command_exit_window.x -= 40
end
update_exit
return
end
#------------------------------------------------------------------------
# If status window is active: call update_status
#------------------------------------------------------------------------
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
loop do
if @command_window.x < 640
@command_window.x += 40
end
if @player_stats_window.y < 480
@player_stats_window.y += 32
end
if @status_window.x > -480
@status_window.x -= 60
end
if $game_party.actors.size == 1
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
elsif $game_party.actors.size == 2
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
elsif $game_party.actors.size == 3
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
elsif $game_party.actors.size == 4
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
if @window_sprite4.x > -480
@window_sprite4.x -= 60
end
end
delay(0.01)
if @command_window.x >= 640
if @status_window.x <= -480
break
end
end
end
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
$game_system.se_play($data_system.decision_se)
@command_exit_window.visible = true
@command_exit_window.active = true
@command_exit_window.index = 0
@command_window.active = false
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.x < 640
@command_window.x += 40
end
if @player_stats_window.y < 480
@player_stats_window.y += 32
end
if @status_window.x > -480
@status_window.x -= 60
end
if $game_party.actors.size == 1
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
elsif $game_party.actors.size == 2
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
elsif $game_party.actors.size == 3
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
elsif $game_party.actors.size == 4
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
if @window_sprite4.x > -480
@window_sprite4.x -= 60
end
end
delay(0.01)
if @command_window.x >= 640
if @status_window.x <= -480
break
end
end
end
$scene = Scene_New_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.x < 640
@command_window.x += 40
end
if @player_stats_window.y < 480
@player_stats_window.y += 32
end
if @status_window.x > -480
@status_window.x -= 60
end
if $game_party.actors.size == 1
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
elsif $game_party.actors.size == 2
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
elsif $game_party.actors.size == 3
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
elsif $game_party.actors.size == 4
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
if @window_sprite4.x > -480
@window_sprite4.x -= 60
end
end
delay(0.01)
if @command_window.x >= 640
if @status_window.x <= -480
break
end
end
end
$scene = Scene_New_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.x < 640
@command_window.x += 40
end
if @player_stats_window.y < 480
@player_stats_window.y += 32
end
if @status_window.x > -480
@status_window.x -= 60
end
if $game_party.actors.size == 1
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
elsif $game_party.actors.size == 2
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
elsif $game_party.actors.size == 3
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
elsif $game_party.actors.size == 4
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
if @window_sprite4.x > -480
@window_sprite4.x -= 60
end
end
delay(0.01)
if @command_window.x >= 640
if @status_window.x <= -480
break
end
end
end
$scene = Scene_New_Status.new(@status_window.index)
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when exit window is active)
#--------------------------------------------------------------------------
def update_exit
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
loop do
if @command_exit_window.x < 640
@command_exit_window.x += 40
end
delay(0.01)
if @command_exit_window.x >= 640
break
end
end
@command_window.active = true
@command_exit_window.active = false
return
end
if Input.trigger?(Input::C)
case @command_exit_window.index
when 0
command_to_title
when 1
command_cancel
when 2
command_shutdown
end
return
end
end
def command_to_title
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = Scene_Title.new
end
def command_cancel
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.x < 640
@command_window.x += 60
end
if @player_stats_window.y < 480
@player_stats_window.y += 32
end
if @status_window.x > -480
@status_window.x -= 60
end
if $game_party.actors.size == 1
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
elsif $game_party.actors.size == 2
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
elsif $game_party.actors.size == 3
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
elsif $game_party.actors.size == 4
if @window_sprite1.x > -480
@window_sprite1.x -= 60
end
if @window_sprite2.x > -480
@window_sprite2.x -= 60
end
if @window_sprite3.x > -480
@window_sprite3.x -= 60
end
if @window_sprite4.x > -480
@window_sprite4.x -= 60
end
end
if @command_exit_window.x < 640
@command_exit_window.x += 40
end
delay(0.01)
if @command_window.x >= 640
if @status_window.x <= -480
if @command_exit_window.x >= 640
break
end
end
end
end
$scene = Scene_Map.new
end
def command_shutdown
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
end
end
#==============================================================================
# ** Scene_New_Skill
#==============================================================================
class Scene_New_Skill
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@viewport = Viewport.new(0, 0, 640, 480)
@viewport.tone = Tone.new(0, 0, 0,166)
@actor = $game_party.actors[@actor_index]
@help_window = Window_SkillHelp.new
@status_window = Window_Skill_Status.new(@actor)
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@detail_window = Window_Skill_Detail.new(@skill_window.skill)
@target_window = Window_Skill_Target.new
@target_window.x = 640
@target_window.active = false
Graphics.transition(CMS::Transition_Wait, CMS::Transition)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@viewport.dispose
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
@detail_window.dispose
end
#--------------------------------------------------------------------------
# * Defining the delay
#--------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
@detail_window.update
if @help_window.x > 0
@help_window.x -= 40
end
if @status_window.x > 0
@status_window.x -= 40
end
if @skill_window.x > 320
@skill_window.x -= 40
end
if @detail_window.x > 0
@detail_window.x -= 40
end
#------------------------------------------------------------------------
# If skill window is active: call update_skill
#------------------------------------------------------------------------
if @skill_window.active
update_skill
return
end
#------------------------------------------------------------------------
# If skill target is active: call update_target
#------------------------------------------------------------------------
if @target_window.active
if @target_window.x > 320
@target_window.x -= 40
end
update_target
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
@detail_window.refresh(@skill_window.skill)
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
loop do
if @help_window.x < 640
@help_window.x += 60
end
if @status_window.x < 640
@status_window.x += 60
end
if @skill_window.x < 640
@skill_window.x += 60
end
if @detail_window.x < 640
@detail_window.x += 60
end
delay(0.01)
if @help_window.x >= 640
if @status_window.x >= 640
if @skill_window.x >= 640
if @detail_window.x >= 640
break
end
end
end
end
end
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @skill.scope >= 3
@skill_window.active = false
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
if $game_party.actors.size == 1
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_New_Skill.new(@actor_index)
end
return
end
if Input.trigger?(Input::L)
if $game_party.actors.size == 1
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_New_Skill.new(@actor_index)
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
loop do
if @target_window.x < 640
@target_window.x += 40
end
delay(0.01)
if @target_window.x >= 640
break
end
end
@skill_window.active = true
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# ** Scene_New_Equip
#==============================================================================
class Scene_New_Equip
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@viewport = Viewport.new(0, 0, 640, 480)
@viewport.tone = Tone.new(0, 0, 0,166)
@actor = $game_party.actors[@actor_index]
@help_window = Window_EquipHelp.new
@left_window = Window_Equip_Parameter.new(@actor)
@left_window.visible = false
@stats_window = Window_Equipment_Status.new(@actor)
@right_window = Window_Equipment.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@right_window.index = @equip_index
refresh
Graphics.transition(CMS::Transition_Wait, CMS::Transition)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@viewport.dispose
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
@stats_window.dispose
end
#--------------------------------------------------------------------------
# * Defining the delay
#--------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@left_window.update
@right_window.update
@item_window.update
@stats_window.update
if @stats_window.x > 0
@stats_window.x -= 40
end
if @help_window.x > 0
@help_window.x -= 40
end
if @left_window.x > 0
@left_window.x -= 40
end
if @right_window.x > 0
@right_window.x -= 40
end
if @item_window1.x > 320
@item_window1.x -= 40
end
if @item_window2.x > 320
@item_window2.x -= 40
end
if @item_window3.x > 320
@item_window3.x -= 40
end
if @item_window4.x > 320
@item_window4.x -= 40
end
if @item_window5.x > 320
@item_window5.x -= 40
end
refresh
#------------------------------------------------------------------------
# If right window is active: call update_right
#------------------------------------------------------------------------
if @right_window.active
update_right
return
end
#------------------------------------------------------------------------
# If item window is active: call update_item
#------------------------------------------------------------------------
if @item_window.active
update_item
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)
loop do
if @stats_window.x < 640
@stats_window.x += 60
end
if @help_window.x < 640
@help_window.x += 60
end
if @left_window.x < 640
@left_window.x += 60
end
if @right_window.x < 640
@right_window.x += 60
end
if @item_window1.x < 640
@item_window1.x += 60
end
if @item_window2.x < 640
@item_window2.x += 60
end
if @item_window3.x < 640
@item_window3.x += 60
end
if @item_window4.x < 640
@item_window4.x += 60
end
if @item_window5.x < 640
@item_window5.x += 60
end
delay(0.01)
if @stats_window.x >= 640
if @help_window.x >= 640
if @left_window.x >= 640
if @right_window.x >= 640
if @item_window1.x >= 640
if @item_window2.x >= 640
if @item_window3.x >= 640
if @item_window4.x >= 640
if @item_window5.x >= 640
break
end
end
end
end
end
end
end
end
end
end
@left_window.visible = false
$scene = Scene_Menu.new(2)
return
end
if Input.trigger?(Input::C)
if @actor.equip_fix?(@right_window.index)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@right_window.active = false
@right_window.visible = false
@item_window.active = true
@item_window.index = 0
@left_window.visible = true
return
end
if Input.trigger?(Input::R)
if $game_party.actors.size == 1
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_New_Equip.new(@actor_index, @right_window.index)
end
return
end
if Input.trigger?(Input::L)
if $game_party.actors.size == 1
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_New_Equip.new(@actor_index, @right_window.index)
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@right_window.active = true
@right_window.visible = true
@item_window.active = false
@item_window.index = -1
@left_window.visible = false
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
item = @item_window.item
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
@right_window.active = true
@right_window.visible = true
@left_window.visible = false
@item_window.active = false
@item_window.index = -1
@right_window.refresh
@item_window.refresh
return
end
end
end
#==============================================================================
# ** Scene_New_Status
#==============================================================================
class Scene_New_Status
#--------------------------------------------------------------------------
# * Initialization
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@viewport = Viewport.new(0, 0, 640, 480)
@viewport.tone = Tone.new(0, 0, 0,166)
@actor = $game_party.actors[@actor_index]
@status_para_window = Window_Status_Parameter.new(@actor)
@status_equipment_window = Window_Status_Equipment.new(@actor)
@status_help_window = Window_Status_Help.new(@actor)
@status_exp_window = Window_Status_Exp.new(@actor)
Graphics.transition(CMS::Transition_Wait, CMS::Transition)
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@viewport.dispose
@status_para_window.dispose
@status_equipment_window.dispose
@status_help_window.dispose
@status_exp_window.dispose
end
#--------------------------------------------------------------------------
# * Defining the delay
#--------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if @status_para_window.x > 0
@status_para_window.x -= 40
end
if @status_help_window.x > 0
@status_help_window.x -= 40
end
if @status_equipment_window.x > 320
@status_equipment_window.x -= 40
end
if @status_exp_window.x > 320
@status_exp_window.x -= 40
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
loop do
if @status_para_window.x < 640
@status_para_window.x += 60
end
if @status_help_window.x < 640
@status_help_window.x += 60
end
if @status_equipment_window.x < 640
@status_equipment_window.x += 60
end
if @status_exp_window.x < 640
@status_exp_window.x += 60
end
delay(0.01)
if @status_para_window.x >= 640
if @status_help_window.x >= 640
if @status_equipment_window.x >= 640
if @status_exp_window.x >= 640
break
end
end
end
end
end
$scene = Scene_Menu.new(3)
return
end
if Input.trigger?(Input::R)
if $game_party.actors.size == 1
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_New_Status.new(@actor_index)
end
return
end
if Input.trigger?(Input::L)
if $game_party.actors.size == 1
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_New_Status.new(@actor_index)
end
return
end
end
end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end