赞 | 5 |
VIP | 0 |
好人卡 | 2 |
积分 | 36 |
经验 | 24079 |
最后登录 | 2024-11-22 |
在线时间 | 1891 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3606
- 在线时间
- 1891 小时
- 注册时间
- 2010-6-19
- 帖子
- 1211
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
论坛上找的战斗显示敌人生命,效果为,敌人的血条总和在一个血条上面显示,但是有一个BUG,
如图:
战斗开始出现血条,但是如果有隐藏的敌人,血条也是会把隐藏敌人的血量也加进去,这样就导致,
如果敌人中途没出现,然后对面的怪物全死光了,结束战斗的时候,血条还有血量显示,
正常的话应该是,敌人隐藏的时候【隐藏敌人的血量先不加进去】,隐藏目标出现的时候,总血量更新一下,
然后把新出来的目标的血量加进去~
#------------------------------------------------------------------------------ # 显示敌方剩余战斗力 #============================================================================== #-------------------------------------------------------------------------- # □ 常数设置 #-------------------------------------------------------------------------- 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] 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
#------------------------------------------------------------------------------
# 显示敌方剩余战斗力
#==============================================================================
#--------------------------------------------------------------------------
# □ 常数设置
#--------------------------------------------------------------------------
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]
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
|
|