Auteur: Yukihiro matsumoto
#============================================
# Scene_Battle (ָx 4)
#----------------------------------------------
# Хȥ뻭΄IФ饹Ǥ
#============================================
class Scene_Battle
#------------------------------------------
# ᥤե`_ʼ
#------------------------------------------
def start_phase4
# ե` 4
@phase = 4
# `
$game_temp.battle_turn += 1
# Хȥ륤٥Ȥȫک`
for index in 0...$data_troops[@troop_id].pages.size
# ٥ȥک`ȡ
page = $data_troops[@troop_id].pages[index]
# Υک`Υѥ [`] Έ
if page.span == 1
# gМgߥե饰ꥢ
$game_temp.battle_event_flags[index] = false
end
end
# `xk״BO
@actor_index = -1
@active_battler = nil
# ѩ`ƥޥɥɥЄ
@party_command_window.active = false
@party_command_window.visible = false
# `ޥɥɥo
@actor_command_window.active = false
@actor_command_window.visible = false
# ᥤե`ե饰å
$game_temp.battle_main_phase = true
# ͥߩ`
for enemy in $game_troop.enemies
enemy.make_action
end
# Є
make_action_orders
# ƥå 1
@phase4_step = 1
end
#------------------------------------------
# Є
#------------------------------------------
def make_action_orders
# @action_battlers ڻ
@action_battlers = []
# ͥߩ` @action_battlers
for enemy in $game_troop.enemies
@action_battlers.push(enemy)
end
# ` @action_battlers
for actor in $game_party.actors
@action_battlers.push(actor)
end
# ȫTΥԩ`ɤQ
for battler in @action_battlers
battler.make_action_speed
end
# ԩ`ɤδ혤ˁK椨
@action_battlers.sort! {|a,b|
b.current_action.speed - a.current_action.speed }
end
#------------------------------------------
# ե` (ᥤե`)
#------------------------------------------
def update_phase4
case @phase4_step
when 1
update_phase4_step1
when 2
update_phase4_step2
when 3
update_phase4_step3
when 4
update_phase4_step4
when 5
update_phase4_step5
when 6
update_phase4_step6
end
end
#------------------------------------------
# ե` (ᥤե` ƥå 1 : ʂ)
#------------------------------------------
def update_phase4_step1
# إץɥL
@help_window.visible = false
# ٔж
if judge
# ޤϔΈ : åɽK
return
end
# ƤƤХȥ`ڤʤ
if $game_temp.forcing_battler == nil
# Хȥ륤٥Ȥåȥå
setup_battle_event
# Хȥ륤٥ȌgФΈ
if $game_system.battle_interpreter.running?
return
end
end
# ƤƤХȥ`ڤ
if $game_temp.forcing_battler != nil
# ^ӤޤƄ
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
# δЄӥХȥ`ڤʤ (ȫTЄӤ)
if @action_battlers.size == 0
# ѩ`ƥޥɥե`_ʼ
start_phase2
return
end
# ˥` ID ӥ٥ ID ڻ
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
# δЄӥХȥ`Ф^饷ե
@active_battler = @action_battlers.shift
# ǤˑL⤵Ƥ
if @active_battler.index == nil
return
end
# åץ`
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
# Ʃ`Ȼ
@active_battler.remove_states_auto
# Ʃ`ɥեå
@status_window.refresh
# ƥå 2
@phase4_step = 2
end
#------------------------------------------
# ե` (ᥤե` ƥå 2 : _ʼ)
#------------------------------------------
def update_phase4_step2
# ƥǤʤ
unless @active_battler.current_action.forcing
# Ƽs [ͨĤ] [ζͨĤ] Έ
if @active_battler.restriction == 2 or @active_battler.restriction == 3
# ˹ĤO
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
# Ƽs [ЄӤǤʤ] Έ
if @active_battler.restriction == 4
# ƌΥХȥ`ꥢ
$game_temp.forcing_battler = nil
# ƥå 1
@phase4_step = 1
return
end
end
# Хȥ`ꥢ
@target_battlers = []
# ηNeǷ
case @active_battler.current_action.kind
when 0 #
make_basic_action_result
when 1 #
make_skill_action_result
when 2 # ƥ
make_item_action_result
end
# ƥå 3
if @phase4_step == 2
@phase4_step = 3
end
end
#------------------------------------------
# Y
#------------------------------------------
def make_basic_action_result
# ĤΈ
if @active_battler.current_action.basic == 0
# ˥` ID O
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# ЄӂȥХȥ`ͥߩ`Έ
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# ЄӂȥХȥ``Έ
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
# ȥХȥ`ФO
@target_battlers = [target]
# ͨĤ΄m
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
# Έ
if @active_battler.current_action.basic == 1
# إץɥ "" ʾ
@help_window.set_text($data_system.words.guard, 1)
return
end
# ӤΈ
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# إץɥ "Ӥ" ʾ
@help_window.set_text("Escape", 1)
# Ӥ
@active_battler.escape
return
end
# Τ⤷ʤΈ
if @active_battler.current_action.basic == 3
# ƌΥХȥ`ꥢ
$game_temp.forcing_battler = nil
# ƥå 1
@phase4_step = 1
return
end
end
#------------------------------------------
# ޤϥƥΌȥХȥ`O
# scope : ޤϥƥ΄
#------------------------------------------
def set_target_battlers(scope)
# ЄӂȥХȥ`ͥߩ`Έ
if @active_battler.is_a?(Game_Enemy)
# Ƿ
case scope
when 1 # g
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # ȫ
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 3 # ζg
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # ζȫ
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5 # ζg (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 # ζȫ (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7 # ʹ
@target_battlers.push(@active_battler)
end
end
# ЄӂȥХȥ``Έ
if @active_battler.is_a?(Game_Actor)
# Ƿ
case scope
when 1 # g
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # ȫ
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3 # ζg
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # ζȫ
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 5 # ζg (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 # ζȫ (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
end
when 7 # ʹ
@target_battlers.push(@active_battler)
end
end
end
#------------------------------------------
# 륢 Y
#------------------------------------------
def make_skill_action_result
# ȡ
@skill = $data_skills[@active_battler.current_action.skill_id]
# ƥǤʤ
unless @active_battler.current_action.forcing
# SP ФʤɤʹäǤʤʤä
unless @active_battler.skill_can_use?(@skill.id)
# ƌΥХȥ`ꥢ
$game_temp.forcing_battler = nil
# ƥå 1
@phase4_step = 1
return
end
end
# SP M
@active_battler.sp -= @skill.sp_cost
# Ʃ`ɥեå
@status_window.refresh
# إץɥ˥ʾ
@help_window.set_text(@skill.name, 1)
# ˥` ID O
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# ٥ ID O
@common_event_id = @skill.common_event_id
# ȥХȥ`O
set_target_battlers(@skill.scope)
# ΄m
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#------------------------------------------
# ƥॢ Y
#------------------------------------------
def make_item_action_result
# ƥȡ
@item = $data_items[@active_battler.current_action.item_id]
# ƥФʤɤʹäǤʤʤä
unless $game_party.item_can_use?(@item.id)
# ƥå 1
@phase4_step = 1
return
end
# ƷΈ
if @item.consumable
# ʹäƥ 1 p餹
$game_party.lose_item(@item.id, 1)
end
# إץɥ˥ƥʾ
@help_window.set_text(@item.name, 1)
# ˥` ID O
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# ٥ ID O
@common_event_id = @item.common_event_id
# Q
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# ȥХȥ`O
set_target_battlers(@item.scope)
# ƥ΄m
for target in @target_battlers
target.item_effect(@item)
end
end
#------------------------------------------
# ե` (ᥤե` ƥå 3 : Єӂȥ˥`)
#------------------------------------------
def update_phase4_step3
# Єӂȥ˥` (ID 0 ΈϤϰץեå)
if @animation1_id == 0
@active_battler.white_flash = true
else
@active_battler.animation_id = @animation1_id
@active_battler.animation_hit = true
end
# ƥå 4
@phase4_step = 4
end
#------------------------------------------
# ե` (ᥤե` ƥå 4 : ȥ˥`)
#------------------------------------------
def update_phase4_step4
# ȥ˥`
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Rat")
end
# ˥`Lˤ餺 8 ե`
@wait_count = 8
# ƥå 5
@phase4_step = 5
end
#------------------------------------------
# ե` (ᥤե` ƥå 5 : `ʾ)
#------------------------------------------
def update_phase4_step5
# إץɥL
@help_window.visible = false
# Ʃ`ɥեå
@status_window.refresh
# `ʾ
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
end
end
# ƥå 6
@phase4_step = 6
end
#------------------------------------------
# ե` (ᥤե` ƥå 6 : եå)
#------------------------------------------
def update_phase4_step6
# ƌΥХȥ`ꥢ
$game_temp.forcing_battler = nil
# ٥ ID ЄΈ
if @common_event_id > 0
# ٥Ȥåȥå
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
# ƥå 1
@phase4_step = 1
end
end |
|