module BattleManager
#--------------------------------------------------------------------------
# ● 战斗开始
#--------------------------------------------------------------------------
def self.battle_start
$game_system.battle_count += 1
$game_party.on_battle_start
$game_troop.on_battle_start
$game_troop.enemy_names.each do |name|
$game_message.add(sprintf(Vocab::Emerge, name))
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))
end
wait_for_message
end
#--------------------------------------------------------------------------
# ● 遇敌时的处理
#--------------------------------------------------------------------------
def self.on_encounter
@preemptive = false
@surprise = false
end
#--------------------------------------------------------------------------
# ● 回合开始
#--------------------------------------------------------------------------
def self.turn_start(members)
@phase = :turn
clear_actor
$game_troop.increase_turn(members)
make_action_orders(members)
end
#--------------------------------------------------------------------------
# ● 生成行动顺序
#--------------------------------------------------------------------------
def self.make_action_orders(members)
@action_battlers = []
for iii in $game_party.members
if members.include?(iii)
@action_battlers.push(iii) unless @surprise
end
end
for iii in $game_troop.members
if members.include?(iii)
@action_battlers.push(iii) unless @preemptive
end
end
@action_battlers.each {|battler| battler.make_speed }
@action_battlers.sort! {|a,b| b.speed - a.speed }
end
end
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● 增加回合
#--------------------------------------------------------------------------
def increase_turn(members)
troop.pages.each {|page| @event_flags= false if page.span == 1 }
turnmax = []
for iii in members
turnmax.push(iii.turn_count)
end
@turn_count = turnmax.max
end
end