#------------------------------------------------------------------------------
# 显示敌方剩余战斗力
#==============================================================================
#--------------------------------------------------------------------------
# □ 常数设置
#--------------------------------------------------------------------------
module ZENITH4
EG_WIDTH = 165+100 # 长度
EG_COLOR = Color.new(255,0,0,255) #(255, 180, 0, 255) # 战力颜色(黄色)
EW_NAME = "敌方剩余生命"
EW_COLOR = Color.new(255, 255, 255, 255) # 文字颜色
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 对象初始化
#--------------------------------------------------------------------------
alias zenith4_initialize initialize
def initialize
@enemy_force = Sprite.new
@enemy_force.bitmap = Bitmap.new(8 + ZENITH4::EG_WIDTH+100, 45)
@enemy_force.x = 185 - (12 + ZENITH4::EG_WIDTH)+200
@enemy_force.y = 6#115
@enemy_force.z = 250
@nrbj = true
zenith4_initialize
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias zenith4_dispose dispose
def dispose
zenith4_dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias zenith4_refresh refresh
def refresh
zenith4_refresh
if @nrbj
@enemy_force.visible = true
@enemy_force.bitmap.clear
x = 4
y = 4
width = ZENITH4::EG_WIDTH
@enemy_force.bitmap.font.size = 18
# 描绘字体样式
@enemy_force.bitmap.font.name = (["黑体"])
@enemy_force.bitmap.font.color = Color.new(0, 0, 0, 255)
# 描绘文字黑底
@enemy_force.bitmap.draw_text(x+1+3+24+50+100, y+1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x-1+3+24+50+100, y-1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x+1+3+24+50+100, y-1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x-1+3+24+50+100, y+1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.font.color = ZENITH4::EW_COLOR
# 描绘文字
@enemy_force.bitmap.draw_text(x+3+24+50+100, y, width, 22, ZENITH4::EW_NAME)
@item_max = $game_troop.enemies.size
enemy_mh = 0
enemy_h = 0
for i in 0...@item_max
enemy = $game_troop.enemies[i]
next if enemy.hidden
enemy_mh += enemy.maxhp
enemy_h += enemy.hp
end
# 底部描绘
@enemy_force.bitmap.fill_rect(x-2+100, y+24, width+2,1, Color.new(152, 160, 88, 255))
@enemy_force.bitmap.fill_rect(x-1+100, y+26, width,3, Color.new(149,149,149,255))
@enemy_force.bitmap.fill_rect(x-2+100, y+30, width+2,1, Color.new(152, 160, 88, 255))
@enemy_force.bitmap.fill_rect(x-3+100, y+24, 1,7, Color.new(152, 160, 88, 255))
@enemy_force.bitmap.fill_rect(x+165+100+100, y+24, 1,7, Color.new(152, 160, 88, 255))
w = width * enemy_h / enemy_mh
# 战力描绘
@enemy_force.bitmap.fill_rect(x-1+100, y+26, w,3, ZENITH4::EG_COLOR)
end
end
def nrxc
@nrbj = false
@enemy_force.bitmap.dispose
@enemy_force.dispose
end
end