#==============================================================================
# 显示头像的战斗信息框 by 沉影不器
#------------------------------------------------------------------------------
# 功能: 给战斗信息框添加头像显示
#
# 由于敌人没有头像,目前vx素材又少,用战斗图装凑合着显示
# 超过96*96的战斗图,取战斗图顶部居中的96*96方框图像
#==============================================================================
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle < Scene_Base
attr_reader :active_battler
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘敌人脸谱图像
#--------------------------------------------------------------------------
def draw_enemy_face(actor, x, y, size = 96)
draw_battler(actor.battler_name, actor.battler_hue, x, y, size)
end
#--------------------------------------------------------------------------
# ● 描绘战斗图
#--------------------------------------------------------------------------
def draw_battler(battler_name, battler_hue, x, y, size = 96)
@battler_name = battler_name
@battler_hue = battler_hue
bitmap = Cache.battler(@battler_name, @battler_hue).clone
rect = Rect.new(0, 0, 0, 0)
rect.x = [bitmap.width/2 - 48, 0].max
rect.width = size
rect.height = size
self.contents.blt(x, y, bitmap, rect)
bitmap.dispose
end
end
#==============================================================================
# ■ Window_BattleMessage
#------------------------------------------------------------------------------
# 在战斗中显示消息的窗口。附加有普通消息窗口的功能、显示战斗进行中提示的
# 的机能。
#==============================================================================
class Window_BattleMessage < Window_Message
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@lines.size
draw_line(i)
end
return unless $scene.is_a?(Scene_Battle)
if $scene.active_battler != nil
battler = $scene.active_battler
if battler.is_a?(Game_Enemy)
draw_enemy_face($scene.active_battler, 0, 0, 96)
else
draw_actor_face($scene.active_battler, 0, 0, 96)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘行
# index : 行编号
#--------------------------------------------------------------------------
def draw_line(index)
rect = Rect.new(0, 0, 0, 0)
rect.x += 4 + 96
rect.y += index * WLH
rect.width = contents.width - 8
rect.height = WLH
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.draw_text(rect, @lines[index])
end
end
效果:



原RGSS2效果对比:
