#============================================================================
# 〇 地图显示血条
#============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
alias hp_window_start start
def start
hp_window_start
@hp_window = Window_hp.new
@hp_window.refresh
@hp_window.hide
end
alias hp_window_update update
def update
hp_window_update
@hp_window.refresh if @hp_window.need_refresh?
@hp_window.visible = true
#~ @hp_window.visible = $game_switches[1] #控制开关
end
end
class Window_hp < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
@party_hp_rate = []
super(-12, -16, 544 + 12, 416 + 16)
self.opacity = 0
update
end
#--------------------------------------------------------------------------
# ● 绘制 HP
#--------------------------------------------------------------------------
def notext_draw_actor_hp(actor, x, y, width = 124)
draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
end
#--------------------------------------------------------------------------
# ● 绘制全队 HP
#--------------------------------------------------------------------------
def notext_draw_party_hp
$game_party.all_members.each_with_index do |actor, i|
notext_draw_actor_hp(actor, 0, 16 * i)
end
end
#--------------------------------------------------------------------------
# ● 获取全队 HP 的比率
#--------------------------------------------------------------------------
def party_hp_rate
$game_party.all_members.collect {|actor| actor.hp_rate}
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
notext_draw_party_hp
@party_hp_rate = party_hp_rate
end
#--------------------------------------------------------------------------
# ● 判定是否需要刷新
#--------------------------------------------------------------------------
def need_refresh?
!(party_hp_rate == @party_hp_rate)
end
end