module BattleLogObserver
def self.observe(log_window, user, item, targets)
case user
when Game_Actor
observe_actor(log_window, user, item, targets)
end
end
def self.observe_actor(log_window, user, item, targets)
case item
when RPG::Skill
observe_actor_skill(log_window, user, item, targets)
end
end
def self.observe_actor_skill(log_window, user, item, targets)
case item.id
when 1
text = sprintf("尚余药水:%s瓶", $game_party.item_number($data_items[1]))
else return
end
log_window.display_observe_text(text)
end
end
class Scene_Battle
alias invoke_item_for_special_log invoke_item
def invoke_item(target, item)
invoke_item_for_special_log(target, item)
BattleLogObserver.observe(@log_window, @subject, item, target)
end
end
class Window_BattleLog
#--------------------------------------------------------------------------
# ● 删除一行文字
#--------------------------------------------------------------------------
def back_one
@last_pops ||= []
@last_pops << @lines.pop
refresh
end
#--------------------------------------------------------------------------
# ● 返回指定行
#--------------------------------------------------------------------------
def back_to(line_number)
@last_pops ||= []
@last_pops << @lines.pop while @lines.size > line_number
refresh
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
alias clear_for_clearing_last_pop clear
def clear
clear_for_clearing_last_pop
@last_pops && @last_pops.clear
end
def display_observe_text(text)
@last_pops ||= []
@last_pops.reverse_each {|old_text| add_text(old_text) }
add_text(text)
wait
@last_pops.size.times { back_one }
back_one
end
end