#==============================================================================
# ** Window Class Changing
#==============================================================================
class Window_Class_Changing < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 160, 320)
# Sets Cursor Height
self.cursor_height = 72
# Sets Index
self.index = 0
# Animated Sprite Counters
@pose, @frame = 0, 0
# Window Contents
self.contents = Bitmap.new(width - 32, height - 32)
# Refreshes Window Contents
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clears Contents
contents.clear
# Duplicates Actors
@actors = $game_party.actors.dup
# Checks Actors List
@actors.push(nil) until @actors.size > 3
# Sets Up Item Max
@item_max = @actors.size
# Draw Actors Info
contents.clear
for i in 0...@item_max
actor = @actors
y = i * 72
# Draws Animated Sprite
if actor == nil
draw_sprite(20, y + 66, "Empty", 0, @pose, @frame, false)
contents.font.color = disabled_color
contents.draw_text(32, y + 2, contents.width - 40, 24, "", 2)
contents.draw_text(32, y + 24, contents.width - 40, 24, "Empty", 2)
contents.draw_text(32, y + 46, contents.width - 40, 24, "", 2)
else
draw_sprite(20, y + 66, actor.character_name, actor.character_hue , @pose, @frame, false)
contents.font.color = normal_color
# Draws Name
contents.draw_text(32, y + 2, contents.width - 40, 24, actor.name, 2)
# Draws Class
contents.draw_text(32, y + 24, contents.width - 40, 24, $data_classes[actor.class_id].name, 2)
# Draws Level
contents.draw_text(32, y + 46, contents.width - 40, 24, "Level: #{actor.level}", 2)
end
end
end
# Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh
end
#--------------------------------------------------------------------------
# Update Pose
# direction : 0 - Left 1 - Right
#--------------------------------------------------------------------------
def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
refresh
end
end
#==============================================================================
# ** Window Character Status
#==============================================================================
class Window_Character_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize
super(160, 64, 480, 416)
# Animation Varaibles
@pose, @frame = 0, 0
# Window Contents
self.contents = Bitmap.new(width - 32, height - 32)
# Refreshes Contents
refresh($game_party.actors[0])
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor)
# Clears Contents
contents.clear
# Stores Actor
@actor = actor
if actor == nil
draw_sprite(contents.width / 2, contents.height / 2, "Empty", 0, @pose, @frame, false)
# Draws Empty Text
contents.font.size = 48
contents.font.color = system_color
contents.font.color.alpha = disabled_color.alpha
contents.draw_text(0, contents.height / 2, contents.width, 48, "Empty Position", 1)
else
draw_sprite(40, 80, actor.character_name, actor.character_hue , @pose, @frame, false)
contents.font.size = 22
contents.font.color = normal_color
# Draws Name
contents.draw_text(-8, 4, 96, 24, actor.name, 1)
# Draws State
state = make_battler_state_text(actor, 112, true)
contents.font.color = actor.hp == 0 ? knockout_color : normal_color
contents.draw_text(96, 8, 96, 24, state, 1)
# Draws Class
contents.font.color = system_color
contents.draw_text(96, 32, 96, 24, actor.class_name, 1)
# Draws Level
contents.font.color = system_color
contents.draw_text(96, 56, 96, 24, "Level :")
contents.font.color = normal_color
contents.draw_text(96, 56, 96, 24, actor.level.to_s, 2)
# Draws Experience
contents.font.color = system_color
contents.draw_text(224, 8, 224, 24, "Experience :")
contents.font.color = normal_color
contents.draw_text(216, 8, 224, 24, actor.exp_s, 2)
# Next Level Experience
contents.font.color = system_color
contents.draw_text(224, 32, 224, 24, "Next Level :")
contents.font.color = normal_color
contents.draw_text(216, 32, 224, 24, actor.next_rest_exp_s, 2)
contents.font.color = system_color
contents.draw_text(40, 126, 224, 24, "HP")
contents.font.color = normal_color
contents.draw_text(32, 126, 224, 24, "#{actor.hp} / #{actor.maxhp}", 2)
# Draws SP Bar
contents.font.color = system_color
contents.draw_text(40, 158, 224, 24, "SP")
contents.font.color = normal_color
contents.draw_text(32, 158, 224, 24, "#{actor.sp} / #{actor.maxsp}", 2)
# Draws Equiped Items
draw_item_name($data_weapons[actor.weapon_id], 36, 190, 224, 2, 0)
draw_item_name($data_armors[actor.armor1_id], 36, 222, 224, 2, 1)
draw_item_name($data_armors[actor.armor2_id], 36, 254, 224, 2, 2)
draw_item_name($data_armors[actor.armor3_id], 36, 286, 224, 2, 3)
draw_item_name($data_armors[actor.armor4_id], 36, 318, 224, 2, 4)
# Draws Stats
stat_names = [$data_system.words.str, $data_system.words.dex, $data_system.words.agi,
$data_system.words.int, $data_system.words.atk, $data_system.words.pdef, $data_system.words.mdef, "Evasion"]
stats = [actor.str, actor.dex, actor.agi, actor.int, actor.atk, actor.pdef, actor.mdef, actor.eva]
for i in 0...stats.size
contents.font.color = system_color
contents.draw_text(278, 108 + i * 32, 170, 24, stat_names)
contents.font.color = normal_color
contents.draw_text(270, 108 + i * 32, 170, 24, stats.to_s, 2)
end
end
end
#--------------------------------------------------------------------------
# Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh(@actor)
end
#--------------------------------------------------------------------------
# Update Pose
# direction : 0 - Left 1 - Right
#--------------------------------------------------------------------------
def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
refresh(@actor)
end
end
#==============================================================================
# ** Window_Class_Status
#==============================================================================
class Window_Class_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(160, 64, 480, 416)
# Creates Contents
self.contents = Bitmap.new(width - 32, height - 32)
# Animation Varaibles
@pose, @frame = 0, 0
# Refreshes Contents
refresh($game_party.actors[0], $data_classes[1])
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor, current_class)
# Clears Contents
contents.clear
# Requirements Met (For Return)
@requirements_met = true
# Stores Variables for Refreshing
@actor = actor
@current_class = current_class
# Draws Actors Info
contents.font.size = 22
contents.font.color = normal_color
# Draws Name of Actor
contents.draw_text(0, 4, contents.width / 3, 24, actor.name, 1)
# Draws Actor Sprite
draw_sprite(contents.width / 6, 82, actor.character_name, actor.character_hue , @pose, @frame, false)
# Current Class
contents.font.color = system_color
contents.draw_text(contents.width / 3 + 4, 4, contents.width / 3, 24, actor.class_name, 1)
# Current Level
contents.draw_text(contents.width / 3 + 4, 30, contents.width / 3, 24, "Level :")
contents.font.color = normal_color
contents.draw_text(contents.width / 3 - 4, 30, contents.width / 3, 24, actor.level.to_s, 2)
# Current Experience
contents.font.color = system_color
contents.draw_text(contents.width / 3 + 4, 56, contents.width / 3, 24, "Experience :")
contents.font.color = normal_color
contents.draw_text(contents.width / 3 - 4, 56, contents.width / 3, 24, actor.exp_s, 2)
# Checks to Make Sure Current Class isn't Nil
if current_class == nil
contents.font.size = 32
contents.font.color = system_color
contents.draw_text(0, contents.width / 2 - 18, contents.width, 36, "Return to Actors", 1)
else
contents.font.size = 22
contents.font.color = normal_color
# Next Class
contents.font.color = system_color
contents.draw_text(contents.width / 3 * 2 + 4 , 4, contents.width / 3, 26, current_class.name, 1)
# Next Level
contents.draw_text(contents.width / 3 * 2 + 4, 30, contents.width / 3, 26, "Level :")
contents.font.color = normal_color
contents.draw_text(contents.width / 3 * 2 - 4, 30, contents.width / 3, 26, actor.class_levels[current_class.id].to_s, 2)
# Next Experience
contents.font.color = system_color
contents.draw_text(contents.width / 3 * 2 + 4, 56, contents.width / 3, 26, "Experience :")
contents.font.color = normal_color
contents.draw_text(contents.width / 3 * 2 - 4, 56, contents.width / 3, 26, actor.class_exp[current_class.id].to_s, 2)
pos = current_class.position == 0 ? "Front Row" : current_class.position == 1 ? "Middle Row" : "Back Row"
contents.draw_text(0, 96, contents.width, 24, "#{current_class.name}: #{pos}", 1)
contents.font.color = system_color
# Draws Class Requirements
contents.draw_text(0, 120, contents.width, 24, "Requirements", 1)
contents.draw_text(4, 144, contents.width, 24, "Sex Requirement:")
# Sex Requirements
contents.font.color = normal_color
sex_req = current_class.sex_requirements
if sex_req == 0 or sex_req == actor.sex
contents.font.color = normal_color
else
contents.font.color = disabled_color
end
contents.draw_text(32, 168, contents.width, 24, sex_req == 0 ? "None" : sex_req == 1 ? "Male" : "Female")
contents.draw_text(- 8, 168, contents.width, 24, actor.sex == 1 ? "Male" : "Female", 2)
# Checks if Requirements met
@requirements_met = false unless sex_req == 0 or sex_req == actor.sex
# Class Level Requirements
contents.font.color = system_color
contents.draw_text(4, 192, contents.width, 24, "Class Requirement:")
contents.draw_text(32, 216, contents.width, 24, "Class")
contents.draw_text(160, 216, contents.width, 24, "Req. Level")
contents.draw_text(-8, 216, contents.width, 24, "Current Level", 2)
contents.font.color = normal_color
# Class Requirement Arrays
classes, level_reqs, levels = [], [], []
current_class.level_requirements.each_key { |key|
classes.push($data_classes[key].name)
level_reqs.push(current_class.level_requirements[key])
levels.push(actor.class_levels[$data_classes[key].id]) }
for i in 0...classes.size
if levels >= level_reqs
contents.font.color = normal_color
else
contents.font.color = disabled_color
@requirements_met = false
end
contents.draw_text(32, 240 + i * 24, contents.width, 24, classes)
contents.draw_text(160, 240 + i * 24, contents.width, 24, level_reqs.to_s)
contents.draw_text(-8, 240 + i * 24, contents.width, 24, levels.to_s, 2)
end
end
end
#--------------------------------------------------------------------------
# Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh(@actor, @current_class)
end
#--------------------------------------------------------------------------
# Check Requirements
#--------------------------------------------------------------------------
def check
return @requirements_met
end
end
#==============================================================================
# ** Scene Party Changer
#==============================================================================
class Scene_Party_Changer
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Current Phase
@phase = 0
# Frame Update (For Sprite Animations)
@update_frame = 0
# Help Window
@help_window = Window_Help.new
@help_window.set_text("Select Member To Transfer to Reserves", 1)
@help_window.z = 9999
# Active Party Window
@active_actors_window = Window_Party_Changing.new
@active_actors_window.refresh($game_party.actors)
@active_actors_window.y = 64
# Reserve Party Window
@reserver_actors_window = Window_Party_Changing.new
@reserver_actors_window.refresh($game_party.reserve_actors)
@reserver_actors_window.y = 352
@reserver_actors_window.active = false
# Active Party Sprites
@active_actors_sprites = Window_Member_Sprites.new
@active_actors_sprites.refresh($game_party.actors)
@active_actors_sprites.update_cursor_rect(0)
# Reserve Party Sprites
@reserve_actors_sprites = Window_Member_Sprites.new(160, 384, 480)
@reserve_actors_sprites.refresh($game_party.reserve_actors)
@reserve_actors_sprites.update_cursor_rect(0)
# Scene Objects
@objects = [@help_window, @active_actors_window, @reserver_actors_window,
@active_actors_sprites, @reserve_actors_sprites]
Graphics.transition
# Main loop
while $scene == self
# Update game screen
Graphics.update
# Update input information
Input.update
# Objects Update
@objects.each {|x| x.update}
# Animated Sprites Update
@update_frame += 1
if @update_frame == 10
@update_frame = 0
@objects.each {|x| x.frame_update unless x == @help_window}
end
# Updates Poses
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@objects.each {|x| x.update_pose(0) unless x == @help_window}
elsif Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@objects.each {|x| x.update_pose(1) unless x == @help_window}
end
# Frame update
@phase == 0 ? active_update : reserve_update
end
# Prepare for transition
Graphics.freeze
# Disposes Objects
@objects.each {|x| x.dispose}
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def active_update
# Slides Windows
@active_actors_window.y += 8 if @active_actors_window.y < 64
@reserver_actors_window.y += 8 if @reserver_actors_window.y < 352
# Updates Cursor Rectangles
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
@active_actors_sprites.update_cursor_rect(@active_actors_window.index)
# Exits Scene
elsif Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
# Selects Party Spot to Switch Spot With
elsif Input.trigger?(Input::C)
actor = $game_party.actors[@active_actors_window.index]
if $game_party.reserve_actors.size == 0
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text("No Reserve Actors to Switch With", 1)
else
$game_system.se_play($data_system.decision_se)
@active_actors_window.active = false
@reserver_actors_window.active = true
text = actor == nil ?
"Select Member to Add to Party" : "Select Member to Switch Spots with #{actor.name}"
@help_window.set_text(text, 1)
@phase = 1
end
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def reserve_update
# Slides Windows
@active_actors_window.y -= 8 if @active_actors_window.y > -192
@reserver_actors_window.y -= 8 if @reserver_actors_window.y > 96
# Updates Cursor Rectangles
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
@reserve_actors_sprites.update_cursor_rect(@reserver_actors_window.index)
# Returns to Main Phase
elsif Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@help_window.set_text("Select Member To Transfer to Reserves", 1)
@active_actors_window.active = true
@reserver_actors_window.active = false
@phase = 0
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
active_member = $game_party.actors[@active_actors_window.index]
reserve_member = $game_party.reserve_actors[@reserver_actors_window.index]
$game_party.move_to_reserve(active_member.id) unless active_member == nil
$game_party.move_to_party(reserve_member.id)
[@active_actors_window, @active_actors_sprites].each {|x| x.refresh($game_party.actors)}
[@reserver_actors_window, @reserve_actors_sprites].each {|x| x.refresh($game_party.reserve_actors)}
@active_actors_window.active = true
@reserver_actors_window.active = false
@phase = 0
end
end
end
#==============================================================================
# ** Scene Class Changer
#==============================================================================
class Scene_Class_Changer
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Updates Actors Class Arrays
for actor in $game_party.actors
actor.update_classes
end
# Frame Update (For Sprite Animations)
@update_frame = 0
# Help Window
@help_window = Window_Help.new
@help_window.set_text("Select Actor to Change Class", 1)
# Actors Window
@actors_window = Window_Class_Changing.new
# Class Window
commands = ["Back"]
for job in $data_classes
commands.push(job.name) unless job == nil
end
@class_window = Window_Command.new(160, commands)
@class_window.y = 64
@class_window.height = 320
@class_window.active = @class_window.visible = false
# Sprites Window
@sprites_window = Window_Member_Sprites.new
@sprites_window.refresh($game_party.actors)
@sprites_window.frame_update
@sprites_window.update_cursor_rect(0)
# Character Window
@character_status_window = Window_Character_Status.new
# Class Window
@class_status_window = Window_Class_Status.new
@class_status_window.visible = false
# Scene Objects
@objects = [@help_window, @actors_window, @class_window, @sprites_window,
@character_status_window, @class_status_window]
Graphics.transition
# Main loop
while $scene == self
# Update game screen
Graphics.update
# Update input information
Input.update
# Objects Update
@objects.each {|x| x.update}
# Animated Sprites Update
@update_frame += 1
if @update_frame == 5
@update_frame = 0
[@actors_window, @sprites_window, @character_status_window, @class_status_window].each {|x| x.frame_update unless x.visible == false}
end
# Frame update
update
end
# Prepare for transition
Graphics.freeze
# Disposes Objects
@objects.each {|x| x.dispose}
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Sets Disabled and Undisabled Items
if @class_window.active
for i in 1...$data_classes.size
if check_class($game_party.actors[@actors_window.index], $data_classes)
@class_window.undisable_item(i)
else
@class_window.disable_item(i)
end
end
end
# Updates Actor Cursor Rectangle
@sprites_window.update_cursor_rect(@actors_window.index)
# ~ Input Processing ~
if Input.trigger?(Input::RIGHT)
for actor in $game_party.actors
end
end
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
if @character_status_window.visible
@character_status_window.refresh($game_party.actors[@actors_window.index])
else
@class_status_window.refresh($game_party.actors[@actors_window.index], $data_classes[@class_window.index])
end
elsif Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @actors_window.active
$scene = Scene_Map.new
else
@class_window.index = 0
@actors_window.visible = @actors_window.active = true
@class_window.visible = @class_window.active = false
@character_status_window.visible = true
@class_status_window.visible = false
@character_status_window.refresh($game_party.actors[@actors_window.index])
end
elsif Input.trigger?(Input::C)
if @actors_window.active
if $game_party.actors[@actors_window.index] == nil
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@actors_window.visible = @actors_window.active = false
@class_window.visible = @class_window.active = true
@index = @actors_window.index
@class_status_window.refresh($game_party.actors[@index], $data_classes[@class_window.index])
@character_status_window.visible = false
@class_status_window.visible = true
@help_window.set_text("Select Class to Change #{$game_party.actors[@index].name} To", 1)
end
else
if @class_window.index == 0
$game_system.se_play($data_system.decision_se)
@actors_window.visible = @actors_window.active = true
@class_window.visible = @class_window.active = false
@character_status_window.refresh($game_party.actors[@actors_window.index])
@character_status_window.visible = true
@class_status_window.visible = false
@help_window.set_text("Select Actor to Change Class", 1)
else
if @class_status_window.check
$game_system.se_play($data_system.decision_se)
class_ = $data_classes[@class_window.index]
$game_party.actors[@index].switch_class(class_.id)
@help_window.set_text("#{$game_party.actors[@index].name} Changed to a #{class_.name}", 1)
else
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text("Class Requirements Not Met", 1)
end
end
end
end
end
#--------------------------------------------------------------------------
# * Check Class
#--------------------------------------------------------------------------
def check_class(actor, job)
requirements_met = true
sex_req = job.sex_requirements
requirements_met = false unless sex_req == 0 or sex_req == actor.sex
classes, level_reqs, levels = [], [], []
job.level_requirements.each_key { |key|
classes.push($data_classes[key].name)
level_reqs.push(job.level_requirements[key])
levels.push(actor.class_levels[$data_classes[key].id]) }
for i in 0...classes.size
unless levels >= level_reqs
requirements_met = false
end
end
return requirements_met
end
end