#encoding:utf-8
#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
# 战斗信息文章位置修改。
#==============================================================================
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))# 战斗开始显示的文章(普通遇敌)
$game_message.position = 0 # 显示文章的位置:0上1中2下
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))# 战斗开始显示的文章(先发制人)
$game_message.position = 0
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))# 战斗开始显示的文章(被敌人偷袭)
$game_message.position = 0
end
wait_for_message
end
#--------------------------------------------------------------------------
# ● 勝利時的處理【再定义】
#--------------------------------------------------------------------------
def self.process_victory
play_battle_end_me
replay_bgm_and_bgs
$game_message.add(sprintf(Vocab::Victory, $game_party.name))# 胜利显示的文章
$game_message.position = 0
display_exp
gain_gold
gain_drop_items
gain_exp
SceneManager.return
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# ● 撤退時的處理【再定义】
#--------------------------------------------------------------------------
def self.process_escape
$game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))# 撤退成功的文章
$game_message.position = 0
success = @preemptive ? true : (rand < @escape_ratio)
Sound.play_escape
if success
process_abort
else
@escape_ratio += 0.1
$game_message.add('\.' + Vocab::EscapeFailure)# 撤退失败的文章
$game_message.position = 0
$game_party.clear_actions
end
wait_for_message
return success
end
#--------------------------------------------------------------------------
# ● 全滅時的處理
#--------------------------------------------------------------------------
def self.process_defeat
$game_message.add(sprintf(Vocab::Defeat, $game_party.name))
$game_message.position = 0
wait_for_message
if @can_lose
revive_battle_members
replay_bgm_and_bgs
SceneManager.return
else
SceneManager.goto(Scene_Gameover)
end
battle_end(2)
return true
end
#--------------------------------------------------------------------------
# ● 顯示獲得的經驗值【再定义】
#--------------------------------------------------------------------------
def self.display_exp
if $game_troop.exp_total > 0
text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)
$game_message.add('\.' + text)# 获得经验的文章
$game_message.position = 0
end
end
#--------------------------------------------------------------------------
# ● 顯示獲得的金錢【再定义】
#--------------------------------------------------------------------------
def self.gain_gold
if $game_troop.gold_total > 0
text = sprintf(Vocab::ObtainGold, $game_troop.gold_total)
$game_message.add('\.' + text)# 获得金钱的文章
$game_message.position = 0
$game_party.gain_gold($game_troop.gold_total)
end
wait_for_message
end
#--------------------------------------------------------------------------
# ● 顯示獲得的物品【再定义】
#--------------------------------------------------------------------------
def self.gain_drop_items
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
$game_message.add(sprintf(Vocab::ObtainItem, item.name))# 获得物品的文章
$game_message.position = 0
end
wait_for_message
end
end