Auteur: Yukihiro matsumoto
#============================================
# ‘ Scene_Battle (ͺθ` 2)
#----------------------------------------------
# @ogζΚΜπs€NXΕ·B
#============================================
class Scene_Battle
#------------------------------------------
# vogtF[YJn
#------------------------------------------
def start_phase1
# tF[Y 1 ΙΪs
@phase = 1
# p[eBSυΜANVπNA
$game_party.clear_actions
# ogCxgπZbgAbv
setup_battle_event
end
#------------------------------------------
# t[XV (vogtF[Y)
#------------------------------------------
def update_phase1
# s»θ
if judge
# ά½ΝskΜκ : bhIΉ
return
end
# p[eBR}htF[YJn
start_phase2
end
#------------------------------------------
# p[eBR}htF[YJn
#------------------------------------------
def start_phase2
# tF[Y 2 ΙΪs
@phase = 2
# AN^[πρIπσΤΙέθ
@actor_index = -1
@active_battler = nil
# p[eBR}hEBhEπLψ»
@party_command_window.active = true
@party_command_window.visible = true
# AN^[R}hEBhEπ³ψ»
@actor_command_window.active = false
@actor_command_window.visible = false
# CtF[YtOπNA
$game_temp.battle_main_phase = false
# p[eBSυΜANVπNA
$game_party.clear_actions
# R}hόΝsΒΘκ
unless $game_party.inputable?
# CtF[YJn
start_phase4
end
end
#------------------------------------------
# t[XV (p[eBR}htF[Y)
#------------------------------------------
def update_phase2
# C {^ͺ³κ½κ
if Input.trigger?(Input::C)
# p[eBR}hEBhEΜJ[ΚuΕͺς
case @party_command_window.index
when 0 # ν€
# θ SE πt
$game_system.se_play($data_system.decision_se)
# AN^[R}htF[YJn
start_phase3
when 1 # ¦°ι
# ¦ΒΕΝΘ’κ
if $game_temp.battle_can_escape == false
# uU[ SE πt
$game_system.se_play($data_system.buzzer_se)
return
end
# θ SE πt
$game_system.se_play($data_system.decision_se)
# ¦
update_phase2_escape
end
return
end
end
#------------------------------------------
# t[XV (p[eBR}htF[Y : ¦°ι)
#------------------------------------------
def update_phase2_escape
# Gl~[Μf³½ΟlπvZ
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# AN^[Μf³½ΟlπvZ
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# ¦¬χ»θ
success = rand(100) < 50 * actors_agi / enemies_agi
# ¦¬χΜκ
if success
# ¦ SE πt
$game_system.se_play($data_system.escape_se)
# ogJnOΜ BGM Ιί·
$game_system.bgm_play($game_temp.map_bgm)
# ogIΉ
battle_end(1)
# ¦ΈsΜκ
else
# p[eBSυΜANVπNA
$game_party.clear_actions
# CtF[YJn
start_phase4
end
end
#------------------------------------------
# At^[ogtF[YJn
#------------------------------------------
def start_phase5
# tF[Y 5 ΙΪs
@phase = 5
# ogIΉ ME πt
$game_system.me_play($game_system.battle_end_me)
# ogJnOΜ BGM Ιί·
$game_system.bgm_play($game_temp.map_bgm)
# EXPAS[hAgW[πϊ»
exp = 0
gold = 0
treasures = []
# [v
for enemy in $game_troop.enemies
# Gl~[ͺBκσΤΕΘ’κ
unless enemy.hidden
# lΎ EXPAS[hπΗΑ
exp += enemy.exp
gold += enemy.gold
# gW[o»»θ
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# gW[Μπ 6 ΒάΕΙΐθ
treasures = treasures[0..5]
# EXP lΎ
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# S[hlΎ
$game_party.gain_gold(gold)
# gW[lΎ
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# ogUgEBhEπμ¬
@result_window = Window_BattleResult.new(exp, gold, treasures)
# EFCgJEgπέθ
@phase5_wait_count = 100
end
#------------------------------------------
# t[XV (At^[ogtF[Y)
#------------------------------------------
def update_phase5
# EFCgJEgͺ 0 ζθε«’κ
if @phase5_wait_count > 0
# EFCgJEgπΈη·
@phase5_wait_count -= 1
# EFCgJEgͺ 0 ΙΘΑ½κ
if @phase5_wait_count == 0
# UgEBhEπ¦
@result_window.visible = true
# CtF[YtOπNA
$game_temp.battle_main_phase = false
# Xe[^XEBhEπtbV
@status_window.refresh
end
return
end
# C {^ͺ³κ½κ
if Input.trigger?(Input::C)
# ogIΉ
battle_end(0)
end
end
end |
|