Scene_Battle 4

Publié le par chindan

#============================================
# ¡ö 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
# ¥¢¥¯¥¿©`¤ò·Çßx’k×´‘B¤ËÔO¶¨
@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 = []
# ¥¢¥¯¥·¥ç¥ó¤Î·N„e¤Ç·Öáª
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
Publicité

Publié dans poubelle

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article