class Game_Party
Battle_Party_Size = 3
Max_Party_Size = 6
def max_party_size
return Max_Party_Size
end
def max_party
return Battle_Party_Size
end
def placement_correctment
if @actors.size <= Battle_Party_Size
return @actors.size
else
return Battle_Party_Size
end
end
def add_actor(actor_id)
actor = $game_actors[actor_id]
if not @actors.include?(actor) and $game_party.actors.size < Max_Party_Size
@actors.push(actor)
$game_player.refresh
end
end
def all_dead?
if $game_party.actors.size == 0
return false
end
for actor in @actors
if actor.hp > 0
return false
end
if actor.index >= 4
return true
end
end
return true
end
end
class Window_BattleStatus < Window_Base
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
unless $game_party.actors.size > $game_party.max_party
@level_up_flags = [false, false, false, false]
else
@level_up_flags = []
for i in 0...$game_party.placement_correctment
@level_up_flags.push(false)
end
end
refresh
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.placement_correctment
actor = $game_party.actors[i]
unless $game_party.actors.size > 4
actor_x = i * 160 + 4
else
actor_x = i * (4 + (640/ $game_party.placement_correctment))
end
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end
class Game_Actor < Game_Battler
def screen_x
if self.index != nil
unless $game_party.actors.size > 4
return self.index * 160 + 80
else
return self.index * (640/ $game_party.placement_correctment) + (80/($game_party.placement_correctment/2))
end
else
return 0
end
end
end
class Scene_Battle
def phase3_next_actor
begin
if @active_battler != nil
@active_battler.blink = false
end
if @actor_index == $game_party.placement_correctment-1
start_phase4
return
end
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
end until @active_battler.inputable?
phase3_setup_command_window
end
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
unless $game_party.actors.size > 4
@actor_command_window.x = @actor_index * 160
else
@actor_command_window.x = @actor_index * (640/$game_party.placement_correctment)
if @actor_command_window.x > 480
@actor_command_window.x = 480
end
end
@actor_command_window.index = 0
end
end
class Scene_Menu
alias party_swap_update_command update_command
def update_command
party_swap_update_command
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@previous_index = @command_window.index
@command_window.index = -1
@command_window.active = false
@status_window.active = true
@status_window.index = @status_window.top_row
return
end
end
alias party_swap_update_status update_status
def update_status
if Input.trigger?(Input::B)
unless @swapee != nil
$game_system.se_play($data_system.cancel_se)
if @command_window.index == -1
@command_window.index = @previous_index
end
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
@swapee = nil
return
end
if Input.trigger?(Input::C) and @command_window.index == -1
unless @swapee != nil
@swapee = @status_window.index
$game_system.se_play($data_system.decision_se)
return
end
if @swapee == @status_window.index
$game_system.se_play($data_system.decision_se)
@swapee = nil
return
end
$game_system.se_play($data_system.decision_se)
party_ids = []
for actor in $game_party.actors
party_ids.push(actor.id)
end
swapee2 = @status_window.index
if @swapee < swapee2
for i in @swapee...party_ids.size
$game_party.remove_actor(party_ids[i])
end
$game_party.add_actor(party_ids[swapee2])
for i in (@swapee + 1)...party_ids.size
unless i == swapee2
$game_party.add_actor(party_ids[i])
else
$game_party.add_actor(party_ids[@swapee])
end
end
else
for i in swapee2...party_ids.size
$game_party.remove_actor(party_ids[i])
end
$game_party.add_actor(party_ids[@swapee])
for i in (swapee2 + 1)...party_ids.size
unless i == @swapee
$game_party.add_actor(party_ids[i])
else
$game_party.add_actor(party_ids[swapee2])
end
end
end
@swapee = nil
@status_window.refresh
return
end
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
if @swapee == nil and @command_window.index == -1
$game_system.se_play($data_system.cursor_se)
@command_window.index = @previous_index
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
end
party_swap_update_status
end
end
class Window_MenuStatus < Window_Selectable
def initialize
unless $game_party.actors.size > 4
super(0, 0, 480, 480)
else
super(0, 0, 480, 160 * $game_party.actors.size)
end
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
alias large_refresh refresh
def refresh
large_refresh
self.height = 480
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 116 - self.oy
self.cursor_rect.set(x, y, cursor_width, 96)
end
def top_row
return self.oy / 116
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 116
end
def page_row_max
return 4
end
end
class Game_Actor < Game_Battler
def exist?
return super == self.index < 4
end
end
class Game_Actor < Game_Battler
def exist?
return super == self.index < $game_party.max_party
end
end
class Scene_Battle
def set_target_battlers(scope)
# If battler performing action is enemy
if @active_battler.is_a?(Game_Enemy)
# Branch by effect scope
case scope
when 1 # single enemy
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # all enemies
for actor in $game_party.actors
if actor.exist? and actor.index < $game_party.max_party
@target_battlers.push(actor)
end
end
when 3 # single ally
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # all allies
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5 # single ally (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # all allies (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7 # user
@target_battlers.push(@active_battler)
end
end
# If battler performing action is actor
if @active_battler.is_a?(Game_Actor)
# Branch by effect scope
case scope
when 1 # single enemy
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # all enemies
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3 # single ally
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # all allies
for actor in $game_party.actors
if actor.exist? and actor.index < 4
@target_battlers.push(actor)
end
end
when 5 # single ally (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # all allies (HP 0)
for actor in $game_party.actors
if actor != nil and (actor.hp0? and actor.index < 4)
@target_battlers.push(actor)
end
end
when 7 # user
@target_battlers.push(@active_battler)
end
end
end
end
class Arrow_Actor < Arrow_Base
def update
super
# Cursor right
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.placement_correctment
end
# Cursor left
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.placement_correctment
end
# Set sprite coordinates
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end
module Constants
Start_From = 1
end
class Game_Enemy < Game_Battler
alias stats_initialize initialize
def initialize(troop_id, member_index)
stats_initialize(troop_id, member_index)
if self.actor_id > 0
actor = $data_actors[self.actor_id]
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
end
end
alias old_name name
def name
text = self.old_name.clone
if (/~(.+?)~/.match(text)) != nil
text.sub!(/~(.*?)~/) { "" }
end
return text
end
def level
text = self.old_name.clone
if (/~(.+?)~/.match(text)) != nil
lvl = $1.to_i
else
lvl = 1
end
return lvl
end
def actor_id
for i in Constants::Start_From...$data_actors.size
if $data_actors[i].name == self.name
return i
end
end
return 0
end
def get_stats
for i in Constants::Start_From...$data_actors.size
if $data_actors[i].name == self.name
return [
$data_actors[i].parameters[0, self.level],
$data_actors[i].parameters[1, self.level],
$data_actors[i].parameters[2, self.level],
$data_actors[i].parameters[3, self.level],
$data_actors[i].parameters[4, self.level],
$data_actors[i].parameters[5, self.level]
]
end
end
return [
$data_enemies[@enemy_id].maxhp,
$data_enemies[@enemy_id].maxsp,
$data_enemies[@enemy_id].str,
$data_enemies[@enemy_id].dex,
$data_enemies[@enemy_id].agi,
$data_enemies[@enemy_id].int
]
end
def base_maxhp
return get_stats[0]
end
def base_maxsp
return get_stats[1]
end
def base_str
return get_stats[2]
end
def base_dex
return get_stats[3]
end
def base_agi
return get_stats[4]
end
def base_int
return get_stats[5]
end
end
class Game_Actors
attr_accessor :reserve_party
alias copies_initialize initialize
def initialize
copies_initialize
@reserve_party = []
end
def [](actor_id)
if actor_id == nil
return nil
end
if actor_id <= Constants::Start_From
if actor_id > 999 or $data_actors[actor_id] == nil
return nil
end
if @data[actor_id] == nil
@data[actor_id] = Game_Actor.new(actor_id)
end
else
if @data[actor_id] == nil
return nil
end
end
return @data[actor_id]
end
def make_actor(actor_id, level)
if actor_id <= Constants::Start_From
return false
end
if @next_id == nil
@next_id = Constants::Start_From + 1
end
@data[@next_id] = Game_Actor.new(actor_id)
@data[@next_id].level = level
@data[@next_id].set_id(@next_id)
@data[@next_id].recover_all
#@reserve_party.push(@next_id)
$game_party.add_actor(@next_id)
@next_id += 1
return true
end
end
class Game_Actor < Game_Battler
def id
return @id
end
def actor_id
return @actor_id
end
def set_id(id)
@id = id
end
end
class Game_Party
def refresh
new_actors = []
for i in 0...@actors.size
if @actors[i].actor_id <= Constants::Start_From
if $data_actors[@actors[i].actor_id] != nil
new_actors.push($game_actors[@actors[i].actor_id])
end
else
if $data_actors[@actors[i].actor_id] != nil
new_actors.push($game_actors[@actors[i].id])
end
end
end
@actors = new_actors
end
end
class Game_Battler
Item_Catch_Base = {
33=>[40, 1], #[ITEM ID] => [CatchRate, HP effect]
34=>[50, 2],
35=>[60, 4],
36=>[200, 0]
}
Catch_Resistence = {
#[MONSTER ID] => [CatchResist]
}
alias acorn_item_effect item_effect
def item_effect(item)
unless Item_Catch_Base[item.id] == nil
x = Item_Catch_Base[item.id][0]
x += (100 - ((100 * self.hp)/self.maxhp)) * Item_Catch_Base[item.id][1]
unless Catch_Resistence[self.id] == nil
x -= Catch_Resistence[self.id]
end
x -= rand(100)
if x > 0
flag = $game_actors.make_actor(self.actor_id, self.level)
if flag
self.hp = 0
end
end
return true
end
return acorn_item_effect(item)
end
end
class Game_Party
Battle_Party_Size = 3
Max_Party_Size = 3
def max_party_size
return Max_Party_Size
end
def max_party
return Battle_Party_Size
end
def placement_correctment
if @actors.size <= Battle_Party_Size
return @actors.size
else
return Battle_Party_Size
end
end
def add_actor(actor_id)
actor = $game_actors[actor_id]
if not @actors.include?(actor) and $game_party.actors.size < Max_Party_Size
@actors.push(actor)
$game_player.refresh
end
end
def all_dead?
if $game_party.actors.size == 0
return false
end
for actor in @actors
if actor.hp > 0
return false
end
if actor.index >= 4
return true
end
end
return true
end
end
class Window_BattleStatus < Window_Base
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
unless $game_party.actors.size > $game_party.max_party
@level_up_flags = [false, false, false, false]
else
@level_up_flags = []
for i in 0...$game_party.placement_correctment
@level_up_flags.push(false)
end
end
refresh
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.placement_correctment
actor = $game_party.actors[i]
unless $game_party.actors.size > 4
actor_x = i * 160 + 4
else
actor_x = i * (4 + (640/ $game_party.placement_correctment))
end
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end
class Game_Actor < Game_Battler
def screen_x
if self.index != nil
unless $game_party.actors.size > 4
return self.index * 160 + 80
else
return self.index * (640/ $game_party.placement_correctment) + (80/($game_party.placement_correctment/2))
end
else
return 0
end
end
end
class Scene_Battle
def phase3_next_actor
begin
if @active_battler != nil
@active_battler.blink = false
end
if @actor_index == $game_party.placement_correctment-1
start_phase4
return
end
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
end until @active_battler.inputable?
phase3_setup_command_window
end
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
unless $game_party.actors.size > 4
@actor_command_window.x = @actor_index * 160
else
@actor_command_window.x = @actor_index * (640/$game_party.placement_correctment)
if @actor_command_window.x > 480
@actor_command_window.x = 480
end
end
@actor_command_window.index = 0
end
end
class Scene_Menu
alias party_swap_update_command update_command
def update_command
party_swap_update_command
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@previous_index = @command_window.index
@command_window.index = -1
@command_window.active = false
@status_window.active = true
@status_window.index = @status_window.top_row
return
end
end
alias party_swap_update_status update_status
def update_status
if Input.trigger?(Input::B)
unless @swapee != nil
$game_system.se_play($data_system.cancel_se)
if @command_window.index == -1
@command_window.index = @previous_index
end
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
@swapee = nil
return
end
if Input.trigger?(Input::C) and @command_window.index == -1
unless @swapee != nil
@swapee = @status_window.index
$game_system.se_play($data_system.decision_se)
return
end
if @swapee == @status_window.index
$game_system.se_play($data_system.decision_se)
@swapee = nil
return
end
$game_system.se_play($data_system.decision_se)
party_ids = []
for actor in $game_party.actors
party_ids.push(actor.id)
end
swapee2 = @status_window.index
if @swapee < swapee2
for i in @swapee...party_ids.size
$game_party.remove_actor(party_ids[i])
end
$game_party.add_actor(party_ids[swapee2])
for i in (@swapee + 1)...party_ids.size
unless i == swapee2
$game_party.add_actor(party_ids[i])
else
$game_party.add_actor(party_ids[@swapee])
end
end
else
for i in swapee2...party_ids.size
$game_party.remove_actor(party_ids[i])
end
$game_party.add_actor(party_ids[@swapee])
for i in (swapee2 + 1)...party_ids.size
unless i == @swapee
$game_party.add_actor(party_ids[i])
else
$game_party.add_actor(party_ids[swapee2])
end
end
end
@swapee = nil
@status_window.refresh
return
end
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
if @swapee == nil and @command_window.index == -1
$game_system.se_play($data_system.cursor_se)
@command_window.index = @previous_index
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
end
party_swap_update_status
end
end
class Window_MenuStatus < Window_Selectable
def initialize
unless $game_party.actors.size > 4
super(0, 0, 480, 480)
else
super(0, 0, 480, 160 * $game_party.actors.size)
end
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
alias large_refresh refresh
def refresh
large_refresh
self.height = 480
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 116 - self.oy
self.cursor_rect.set(x, y, cursor_width, 96)
end
def top_row
return self.oy / 116
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 116
end
def page_row_max
return 4
end
end
class Game_Actor < Game_Battler
def exist?
return super == self.index < 4
end
end
class Game_Actor < Game_Battler
def exist?
return super == self.index < $game_party.max_party
end
end
class Scene_Battle
def set_target_battlers(scope)
# If battler performing action is enemy
if @active_battler.is_a?(Game_Enemy)
# Branch by effect scope
case scope
when 1 # single enemy
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # all enemies
for actor in $game_party.actors
if actor.exist? and actor.index < $game_party.max_party
@target_battlers.push(actor)
end
end
when 3 # single ally
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # all allies
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5 # single ally (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # all allies (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7 # user
@target_battlers.push(@active_battler)
end
end
# If battler performing action is actor
if @active_battler.is_a?(Game_Actor)
# Branch by effect scope
case scope
when 1 # single enemy
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # all enemies
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3 # single ally
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # all allies
for actor in $game_party.actors
if actor.exist? and actor.index < 4
@target_battlers.push(actor)
end
end
when 5 # single ally (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # all allies (HP 0)
for actor in $game_party.actors
if actor != nil and (actor.hp0? and actor.index < 4)
@target_battlers.push(actor)
end
end
when 7 # user
@target_battlers.push(@active_battler)
end
end
end
end
class Arrow_Actor < Arrow_Base
def update
super
# Cursor right
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.placement_correctment
end
# Cursor left
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.placement_correctment
end
# Set sprite coordinates
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end
class Game_Party
Battle_Party_Size = 3
Max_Party_Size = 3
def max_party_size
return Max_Party_Size
end
def max_party
return Battle_Party_Size
end
def placement_correctment
if @actors.size <= Battle_Party_Size
return @actors.size
else
return Battle_Party_Size
end
end
def add_actor(actor_id)
actor = $game_actors[actor_id]
if not @actors.include?(actor) and $game_party.actors.size < Max_Party_Size
@actors.push(actor)
$game_player.refresh
end
end
def all_dead?
if $game_party.actors.size == 0
return false
end
for actor in @actors
if actor.hp > 0
return false
end
if actor.index >= 4
return true
end
end
return true
end
end
class Window_BattleStatus < Window_Base
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
unless $game_party.actors.size > $game_party.max_party
@level_up_flags = [false, false, false, false]
else
@level_up_flags = []
for i in 0...$game_party.placement_correctment
@level_up_flags.push(false)
end
end
refresh
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.placement_correctment
actor = $game_party.actors[i]
unless $game_party.actors.size > 3
actor_x = i * 160 + 4
else
actor_x = i * (4 + (640/ $game_party.placement_correctment))
end
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end
class Game_Actor < Game_Battler
def screen_x
if self.index != nil
unless $game_party.actors.size > 3
return self.index * 160 + 80
else
return self.index * (640/ $game_party.placement_correctment) + (80/($game_party.placement_correctment/2))
end
else
return 0
end
end
end
class Scene_Battle
def phase3_next_actor
begin
if @active_battler != nil
@active_battler.blink = false
end
if @actor_index == $game_party.placement_correctment-1
start_phase4
return
end
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
end until @active_battler.inputable?
phase3_setup_command_window
end
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
unless $game_party.actors.size > 4
@actor_command_window.x = @actor_index * 160
else
@actor_command_window.x = @actor_index * (640/$game_party.placement_correctment)
if @actor_command_window.x > 480
@actor_command_window.x = 480
end
end
@actor_command_window.index = 0
end
end
class Scene_Menu
alias party_swap_update_command update_command
def update_command
party_swap_update_command
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@previous_index = @command_window.index
@command_window.index = -1
@command_window.active = false
@status_window.active = true
@status_window.index = @status_window.top_row
return
end
end
alias party_swap_update_status update_status
def update_status
if Input.trigger?(Input::B)
unless @swapee != nil
$game_system.se_play($data_system.cancel_se)
if @command_window.index == -1
@command_window.index = @previous_index
end
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
@swapee = nil
return
end
if Input.trigger?(Input::C) and @command_window.index == -1
unless @swapee != nil
@swapee = @status_window.index
$game_system.se_play($data_system.decision_se)
return
end
if @swapee == @status_window.index
$game_system.se_play($data_system.decision_se)
@swapee = nil
return
end
$game_system.se_play($data_system.decision_se)
party_ids = []
for actor in $game_party.actors
party_ids.push(actor.id)
end
swapee2 = @status_window.index
if @swapee < swapee2
for i in @swapee...party_ids.size
$game_party.remove_actor(party_ids[i])
end
$game_party.add_actor(party_ids[swapee2])
for i in (@swapee + 1)...party_ids.size
unless i == swapee2
$game_party.add_actor(party_ids[i])
else
$game_party.add_actor(party_ids[@swapee])
end
end
else
for i in swapee2...party_ids.size
$game_party.remove_actor(party_ids[i])
end
$game_party.add_actor(party_ids[@swapee])
for i in (swapee2 + 1)...party_ids.size
unless i == @swapee
$game_party.add_actor(party_ids[i])
else
$game_party.add_actor(party_ids[swapee2])
end
end
end
@swapee = nil
@status_window.refresh
return
end
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
if @swapee == nil and @command_window.index == -1
$game_system.se_play($data_system.cursor_se)
@command_window.index = @previous_index
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
end
party_swap_update_status
end
end
class Window_MenuStatus < Window_Selectable
def initialize
unless $game_party.actors.size > 4
super(0, 0, 480, 480)
else
super(0, 0, 480, 160 * $game_party.actors.size)
end
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
alias large_refresh refresh
def refresh
large_refresh
self.height = 480
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 116 - self.oy
self.cursor_rect.set(x, y, cursor_width, 96)
end
def top_row
return self.oy / 116
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 116
end
def page_row_max
return 4
end
end
class Game_Actor < Game_Battler
def exist?
return super == self.index < 4
end
end
class Game_Actor < Game_Battler
def exist?
return super == self.index < $game_party.max_party
end
end
class Scene_Battle
def set_target_battlers(scope)
# If battler performing action is enemy
if @active_battler.is_a?(Game_Enemy)
# Branch by effect scope
case scope
when 1 # single enemy
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # all enemies
for actor in $game_party.actors
if actor.exist? and actor.index < $game_party.max_party
@target_battlers.push(actor)
end
end
when 3 # single ally
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # all allies
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5 # single ally (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # all allies (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7 # user
@target_battlers.push(@active_battler)
end
end
# If battler performing action is actor
if @active_battler.is_a?(Game_Actor)
# Branch by effect scope
case scope
when 1 # single enemy
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # all enemies
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3 # single ally
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # all allies
for actor in $game_party.actors
if actor.exist? and actor.index < 4
@target_battlers.push(actor)
end
end
when 5 # single ally (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # all allies (HP 0)
for actor in $game_party.actors
if actor != nil and (actor.hp0? and actor.index < 4)
@target_battlers.push(actor)
end
end
when 7 # user
@target_battlers.push(@active_battler)
end
end
end
end
class Arrow_Actor < Arrow_Base
def update
super
# Cursor right
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.placement_correctment
end
# Cursor left
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.placement_correctment
end
# Set sprite coordinates
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y
end
end
end