#==============================================================================
#
# ▼ Yanfly Engine Ace - 战斗信息记录 v1.02
# -- 最后更新: 2012.01.24
# -- 使用难度: 简单
# -- 需要脚本: 无
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-CombatLogDisplay"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.24 - Bug Fixed: Confirm window crash with Battle Command List.
# 2012.01.16 - Prevented subsequent line inserts.
# 2011.12.10 - Started Script and Finished.
#
#==============================================================================
# ▼ 介绍
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 有时候战斗信息跳的太快了,玩家根本来不及看,很可能错过重要的战斗信息。
# 本脚本提供战斗信息记录的功能,玩家可以在角色行动时在"战斗/撤退"窗口中点击
# 相应指令来回顾之前的全部战斗信息.
#
#==============================================================================
# ▼ 安装方式
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
# 脚本页/槽中.记得保存你的工程以使脚本生效.
#
#==============================================================================
# ▼ 兼容性
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
#
#==============================================================================
module YEA
module COMBAT_LOG
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - 战斗信息设置 -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMMAND_NAME = "记录" # 战斗信息记录的指令名.
LINE_COLOUR = 0 # 拆分动作行的颜色.
LINE_COLOUR_ALPHA = 48 # 拆分动作行的不透明度.
TEXT_BATTLE_START = "\\c[4]战斗开始!" # 战斗开始的文本.
TEXT_TURN_NUMBER = "\\c[4]回合数: \\c[6]%d" # 回合数的文本.
end # COMBAT_LOG
end # YEA
#==============================================================================
# ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
# 所以编辑了后果自负。
#==============================================================================
#==============================================================================
# ■ Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# new method: combatlog_window=
#--------------------------------------------------------------------------
def combatlog_window=(window)
@combatlog_window = window
end
#--------------------------------------------------------------------------
# new method: combatlog
#--------------------------------------------------------------------------
def combatlog(text)
return if @combatlog_window.nil?
return if text == ""
@combatlog_window.add_line(text)
end
#--------------------------------------------------------------------------
# alias method: add_text
#--------------------------------------------------------------------------
alias window_battlelog_add_text_cld add_text
def add_text(text)
combatlog(text)
window_battlelog_add_text_cld(text)
end
#--------------------------------------------------------------------------
# alias method: replace_text
#--------------------------------------------------------------------------
alias window_battlelog_replace_text_cld replace_text
def replace_text(text)
combatlog(text)
window_battlelog_replace_text_cld(text)
end
#--------------------------------------------------------------------------
# Start Ace Battle Engine Compatibility
#--------------------------------------------------------------------------
if $imported["YEA-BattleEngine"]
#--------------------------------------------------------------------------
# alias method: display_current_state
#--------------------------------------------------------------------------
alias window_battlelog_display_current_state_cld display_current_state
def display_current_state(subject)
window_battlelog_display_current_state_cld(subject)
return if YEA::BATTLE::MSG_CURRENT_STATE
return if subject.most_important_state_text.empty?
combatlog(subject.name + subject.most_important_state_text)
end
#--------------------------------------------------------------------------
# alias method: display_use_item
#--------------------------------------------------------------------------
alias window_battlelog_display_use_item_cld display_use_item
def display_use_item(subject, item)
window_battlelog_display_use_item_cld(subject, item)
return if YEA::BATTLE::MSG_CURRENT_ACTION
if item.is_a?(RPG::Skill)
combatlog(subject.name + item.message1)
unless item.message2.empty?
combatlog(item.message2)
end
else
combatlog(sprintf(Vocab::UseItem, subject.name, item.name))
end
end
#--------------------------------------------------------------------------
# alias method: display_counter
#--------------------------------------------------------------------------
alias window_battlelog_display_counter_cld display_counter
def display_counter(target, item)
window_battlelog_display_counter_cld(target, item)
return if YEA::BATTLE::MSG_COUNTERATTACK
combatlog(sprintf(Vocab::CounterAttack, target.name))
end
#--------------------------------------------------------------------------
# alias method: display_reflection
#--------------------------------------------------------------------------
alias window_battlelog_display_reflection_cld display_reflection
def display_reflection(target, item)
window_battlelog_display_reflection_cld(target, item)
return if YEA::BATTLE::MSG_REFLECT_MAGIC
combatlog(sprintf(Vocab::MagicReflection, target.name))
end
#--------------------------------------------------------------------------
# alias method: display_substitute
#--------------------------------------------------------------------------
alias window_battlelog_display_substitute_cld display_substitute
def display_substitute(substitute, target)
window_battlelog_display_substitute_cld(substitute, target)
return if YEA::BATTLE::MSG_SUBSTITUTE_HIT
combatlog(sprintf(Vocab::Substitute, substitute.name, target.name))
end
#--------------------------------------------------------------------------
# alias method: display_failure
#--------------------------------------------------------------------------
alias window_battlelog_display_failure_cld display_failure
def display_failure(target, item)
window_battlelog_display_failure_cld(target, item)
return if YEA::BATTLE::MSG_FAILURE_HIT
if target.result.hit? && !target.result.success
combatlog(sprintf(Vocab::ActionFailure, target.name))
end
end
#--------------------------------------------------------------------------
# alias method: display_critical
#--------------------------------------------------------------------------
alias window_battlelog_display_critical_cld display_critical
def display_critical(target, item)
window_battlelog_display_critical_cld(target, item)
return if YEA::BATTLE::MSG_CRITICAL_HIT
if target.result.critical
text = target.actor? ? Vocab::CriticalToActor : Vocab::CriticalToEnemy
combatlog(text)
end
end
#--------------------------------------------------------------------------
# alias method: display_miss
#--------------------------------------------------------------------------
alias window_battlelog_display_miss_cld display_miss
def display_miss(target, item)
window_battlelog_display_miss_cld(target, item)
return if YEA::BATTLE::MSG_HIT_MISSED
if !item || item.physical?
fmt = target.actor? ? Vocab::ActorNoHit : Vocab::EnemyNoHit
else
fmt = Vocab::ActionFailure
end
combatlog(sprintf(fmt, target.name))
end
#--------------------------------------------------------------------------
# alias method: display_evasion
#--------------------------------------------------------------------------
alias window_battlelog_display_evasion_cld display_evasion
def display_evasion(target, item)
window_battlelog_display_evasion_cld(target, item)
return if YEA::BATTLE::MSG_EVASION
if !item || item.physical?
fmt = Vocab::Evasion
else
fmt = Vocab::MagicEvasion
end
combatlog(sprintf(fmt, target.name))
end
#--------------------------------------------------------------------------
# alias method: display_hp_damage
#--------------------------------------------------------------------------
alias window_battlelog_display_hp_damage_cld display_hp_damage
def display_hp_damage(target, item)
window_battlelog_display_hp_damage_cld(target, item)
return if YEA::BATTLE::MSG_HP_DAMAGE
return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
combatlog(target.result.hp_damage_text)
end
#--------------------------------------------------------------------------
# alias method: display_mp_damage
#--------------------------------------------------------------------------
alias window_battlelog_display_mp_damage_cld display_mp_damage
def display_mp_damage(target, item)
window_battlelog_display_mp_damage_cld(target, item)
return if YEA::BATTLE::MSG_MP_DAMAGE
combatlog(target.result.mp_damage_text)
end
#--------------------------------------------------------------------------
# alias method: display_tp_damage
#--------------------------------------------------------------------------
alias window_battlelog_display_tp_damage_cld display_tp_damage
def display_tp_damage(target, item)
window_battlelog_display_tp_damage_cld(target, item)
return if YEA::BATTLE::MSG_TP_DAMAGE
combatlog(target.result.tp_damage_text)
end
#--------------------------------------------------------------------------
# alias method: display_added_states
#--------------------------------------------------------------------------
alias window_battlelog_display_added_states_cld display_added_states
def display_added_states(target)
window_battlelog_display_added_states_cld(target)
return if YEA::BATTLE::MSG_ADDED_STATES
target.result.added_state_objects.each do |state|
state_msg = target.actor? ? state.message1 : state.message2
next if state_msg.empty?
combatlog(target.name + state_msg)
end
end
#--------------------------------------------------------------------------
# alias method: display_removed_states
#--------------------------------------------------------------------------
alias window_battlelog_display_removed_states_cld display_removed_states
def display_removed_states(target)
window_battlelog_display_removed_states_cld(target)
return if YEA::BATTLE::MSG_REMOVED_STATES
target.result.removed_state_objects.each do |state|
next if state.message4.empty?
combatlog(target.name + state.message4)
end
end
#--------------------------------------------------------------------------
# alias method: display_buffs
#--------------------------------------------------------------------------
alias window_battlelog_display_buffs_cld display_buffs
def display_buffs(target, buffs, fmt)
window_battlelog_display_buffs_cld(target, buffs, fmt)
return if YEA::BATTLE::MSG_CHANGED_BUFFS
buffs.each do |param_id|
combatlog(sprintf(fmt, target.name, Vocab::param(param_id)))
end
end
#--------------------------------------------------------------------------
# End Ace Battle Engine Compatibility
#--------------------------------------------------------------------------
end # $imported["YEA-BattleEngine"]
end # Window_BattleLog
#==============================================================================
# ■ Window_CombatLog
#==============================================================================
class Window_CombatLog < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
@data = []
super(0, 0, Graphics.width, Graphics.height-120)
deactivate
hide
end
#--------------------------------------------------------------------------
# add_line
#--------------------------------------------------------------------------
def add_line(text)
return if text == "-" && @data[@data.size - 1] == "-"
@data.push(text)
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# item_max
#--------------------------------------------------------------------------
def item_max; return @data.size; end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
text = @data[index]
return if text.nil?
rect = item_rect_for_text(index)
if text == "-"
draw_horz_line(rect.y)
else
draw_text_ex(rect.x, rect.y, text)
end
end
#--------------------------------------------------------------------------
# draw_horz_line
#--------------------------------------------------------------------------
def draw_horz_line(y)
line_y = y + line_height / 2 - 1
contents.fill_rect(4, line_y, contents_width-8, 2, line_colour)
end
#--------------------------------------------------------------------------
# line_colour
#--------------------------------------------------------------------------
def line_colour
colour = text_color(YEA::COMBAT_LOG::LINE_COLOUR)
colour.alpha = YEA::COMBAT_LOG::LINE_COLOUR_ALPHA
return colour
end
#--------------------------------------------------------------------------
# show
#--------------------------------------------------------------------------
def show
super
refresh
activate
select([item_max-1, 0].max)
end
#--------------------------------------------------------------------------
# hide
#--------------------------------------------------------------------------
def hide
deactivate
super
end
end # Window_CombatLog
#==============================================================================
# ■ Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# alias method: make_command_list
#--------------------------------------------------------------------------
alias window_partycommand_make_command_list_cld make_command_list
def make_command_list
window_partycommand_make_command_list_cld
return if $imported["YEA-BattleCommandList"]
add_command(YEA::COMBAT_LOG::COMMAND_NAME, :combatlog)
end
end # Window_PartyCommand
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: create_log_window
#--------------------------------------------------------------------------
alias scene_battle_create_log_window_cld create_log_window
def create_log_window
scene_battle_create_log_window_cld
create_combatlog_window
end
#--------------------------------------------------------------------------
# new method: create_combatlog_window
#--------------------------------------------------------------------------
def create_combatlog_window
@combatlog_window = Window_CombatLog.new
@log_window.combatlog_window = @combatlog_window
@combatlog_window.set_handler(:cancel, method(:close_combatlog))
@combatlog_window.add_line("-")
@combatlog_window.add_line(YEA::COMBAT_LOG::TEXT_BATTLE_START)
@combatlog_window.add_line("-")
end
#--------------------------------------------------------------------------
# new method: open_combatlog
#--------------------------------------------------------------------------
def open_combatlog
@combatlog_window.show
end
#--------------------------------------------------------------------------
# new method: close_combatlog
#--------------------------------------------------------------------------
def close_combatlog
@combatlog_window.hide
if $imported["YEA-BattleCommandList"]
if !@confirm_command_window.nil? && @confirm_command_window.visible
@confirm_command_window.activate
else
@party_command_window.activate
end
else
@party_command_window.activate
end
end
#--------------------------------------------------------------------------
# alias method: create_party_command_window
#--------------------------------------------------------------------------
alias create_party_command_window_cld create_party_command_window
def create_party_command_window
create_party_command_window_cld
@party_command_window.set_handler(:combatlog, method(:open_combatlog))
end
#--------------------------------------------------------------------------
# alias method: turn_start
#--------------------------------------------------------------------------
alias scene_battle_turn_start_cld turn_start
def turn_start
scene_battle_turn_start_cld
@combatlog_window.add_line("-")
text = sprintf(YEA::COMBAT_LOG::TEXT_TURN_NUMBER, $game_troop.turn_count)
@combatlog_window.add_line(text)
@combatlog_window.add_line("-")
end
#--------------------------------------------------------------------------
# alias method: execute_action
#--------------------------------------------------------------------------
alias scene_battle_execute_action_cld execute_action
def execute_action
@combatlog_window.add_line("-")
scene_battle_execute_action_cld
@combatlog_window.add_line("-")
end
#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
alias scene_battle_turn_end_cld turn_end
def turn_end
scene_battle_turn_end_cld
@combatlog_window.add_line("-")
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================