赞 | 4 |
VIP | 0 |
好人卡 | 0 |
积分 | 79 |
经验 | 15725 |
最后登录 | 2024-11-30 |
在线时间 | 1349 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 7852
- 在线时间
- 1349 小时
- 注册时间
- 2015-8-15
- 帖子
- 754
|
本帖最后由 金芒芒 于 2023-11-16 13:24 编辑
这是菜刀王的脚本
- class Spr_map_head < RPG::Spriet#地图精灵头像类< RPG::精灵
- def initialize(ary,x,y,宽=640,间隔=0)#定义初始(人名,x,y,宽=640,间隔=0)
- super()
- self.bitmap = Bitmap.new(640,480)
- self.z = 180
- refresh(ary,x,y,横,间隔)#刷新(人名,x,y,横,间隔)
- end
- def refresh(ary,x,y,宽=640,间隔=0)#定义(人名,x,y,宽=640,间隔=0)
- self.bitmap.clear#自己位图明确的
- a,b = x,y
- for i in ary.flatten #用于我在进制。压平
- bit = RPG::Cache.picture("头像#{i}") ;w,h = bit.width,bit.height
- (b += h + 间隔 ; a = x) if a + w + 间隔 >= 宽
- self.bitmap.blt(a,b,bit,Rect.new(0,0,w,h))
- a += w + 间隔
- end
- end
- end
- class Interpreter #解释程序类
- def 显示头像(ary,x,y,宽=640,间隔=0)
- if @head_spr.nil?
- @head_spr = Spr_map_head.new(ary,x,y,宽,间隔)
- else
- @head_spr.refresh(ary,x,y,宽,间隔)
- end
- end
- def 关闭头像
- return if @head_spr.nil?
- @head_spr.dispose ;@head_spr.bitmap.dispose ; @head_spr = nil
- end
- end
复制代码
这是原来作者的脚本#============================================================================== # ■ 事件头上显血条 RMXP #-------------------------------------------------------------------------- # 作者:后知后觉 # 日期:2012-6-26 # 版本:1.0 # 申明:刺夜之枪定制 # [url]http://bbs.66rpg.com/thread-237126-1-1.html[/url] #============================================================================== #============================================================================== # ■ Sprite_Character #============================================================================== class Sprite_Character < RPG::Sprite if $creat_bar #-------------------------------------------------------------------------- # ● 参数设置 #-------------------------------------------------------------------------- # 设置图片文件名.不想要底图就让底图完全透明或设置为 "" # 图片放在 Graphics/Pictures/ 文件夹下 HPBarFileName = "HPBar" HPBarBackFileName = "HPBarBack" MPBarFileName = "MPBar" MPBarBackFileName = "MPBarBack" # 设置需要显示 HP 条的事件 id ShowHPBarEventID = [] for i in 1..$EFS_Number_Teammate-1 ShowHPBarEventID << $Team_Fighter[i].eventId end # 设置需要显示 MP 条的事件 id ShowMPBarEventID = [] # 设置当开关打开后.对应的条消失 # 这是一个哈希表, =>符号左边的为“键”,右边的为“值” # 键=>值 与 键=>值 之间用半角的 , 号分开 # 键为事件id,值为开关id ShowBarSwitchID = {1 => 1, 3 => 2, 5 => 3, 7 => 4, 9 => 5, 11 => 6, 13 => 7, 15 => 8, 17 => 9, 19 => 10} # 设置 hp 和 mhp 对应的变量id # 键为事件id 值为一个数组. # 数组中左边数字为 hp变量id,右边的数字为mhp变量id HPVariableID = {1 => [26,141], 11 => [31,146], 3 => [27,142], 13 => [32,147], 5 => [28,143], 15 => [33,148], 7 => [29,144], 17 => [34,149], 9 => [30,145], 19 => [35,150]} # 设置 mp 和 mmp 的变量id.方法同上 MPVariableID = {1 => [138,139]} #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- alias hzhj_old_init_make_event_param_bar initialize def initialize(*args) @hp_sprite = Sprite.new(args[0]) @hp_back_sprite = Sprite.new(args[0]) @mp_sprite = Sprite.new(args[0]) @mp_back_sprite = Sprite.new(args[0]) @param_sprites = [] @param_sprites << @hp_sprite @param_sprites << @hp_back_sprite @param_sprites << @mp_sprite @param_sprites << @mp_back_sprite @hp_sprite.bitmap = RPG::Cache.picture(HPBarFileName) @hp_back_sprite.bitmap = RPG::Cache.picture(HPBarBackFileName) @mp_sprite.bitmap = RPG::Cache.picture(MPBarFileName) @mp_back_sprite.bitmap = RPG::Cache.picture(MPBarBackFileName) hzhj_old_init_make_event_param_bar(*args) end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- alias hzhj_old_dispose_make_event_param_bar dispose unless $@ def dispose @param_sprites.each{|sprite|sprite.dispose} hzhj_old_dispose_make_event_param_bar end #-------------------------------------------------------------------------- # ● 获取事件 HP #-------------------------------------------------------------------------- def event_hp event_mhp - $game_variables[HPVariableID[@character.id][0]] end #-------------------------------------------------------------------------- # ● 获取事件 MHP #-------------------------------------------------------------------------- def event_mhp $game_variables[HPVariableID[@character.id][1]] end #-------------------------------------------------------------------------- # ● 获取事件 MP #-------------------------------------------------------------------------- def event_mp $game_variables[MPVariableID[@character.id][0]] end #-------------------------------------------------------------------------- # ● 获取事件 MMP #-------------------------------------------------------------------------- def event_mmp [$game_variables[MPVariableID[@character.id][1]], 1].max end #-------------------------------------------------------------------------- # ● 判断是否显示 HP 条 #-------------------------------------------------------------------------- def show_hp_bar? ShowHPBarEventID.include?(@character.id) && !$game_switches[ShowBarSwitchID[@character.id]] && event_hp > 0 end #-------------------------------------------------------------------------- # ● 判断是否显示 MP 条 #-------------------------------------------------------------------------- def show_mp_bar? ShowMPBarEventID.include?(@character.id) end #-------------------------------------------------------------------------- # ● 更新画面 #-------------------------------------------------------------------------- alias hzhj_old_update_make_event_param_bar update def update hzhj_old_update_make_event_param_bar unless @character.is_a?(Game_Event) @param_sprites.each{|sprite|sprite.visible = false} else # 刷新 HP 可见状态 if show_hp_bar? @hp_sprite.visible = @hp_back_sprite.visible = true # 刷新坐标 @param_sprites.each do |sprite| sprite.ox = sprite.bitmap.width / 2 sprite.oy = sprite.bitmap.height sprite.x = x sprite.y = y - 52 sprite.z = z end @hp_sprite.z += 1 @mp_sprite.z += 1 # 计算 HP 显示区域 hpw = (@hp_sprite.bitmap.width * 1.0 * event_hp / event_mhp).round hpw = [[hpw, @hp_sprite.bitmap.width].min, 0].max hph = @hp_sprite.bitmap.height @hp_sprite.src_rect.set(0, 0, hpw, hph) # 刷新 MP 可见状态 @mp_sprite.visible = @mp_back_sprite.visible = show_mp_bar? # MP 可见的情况 if show_mp_bar? # 修正 HP 坐标 @hp_sprite.y -= (@mp_sprite.oy + 1) @hp_back_sprite.y = @hp_sprite.y # 计算 MP 显示区域 mpw = (@mp_sprite.bitmap.width * 1.0 * event_mp / event_mmp).round mpw = [[mpw, @mp_sprite.bitmap.width].min, 0].max mph = @mp_sprite.bitmap.height @mp_sprite.src_rect.set(0, 0, mpw, mph) end else @param_sprites.each{|sprite|sprite.visible = false} end end end end # ============= create bar end
#==============================================================================
# ■ 事件头上显血条 RMXP
#--------------------------------------------------------------------------
# 作者:后知后觉
# 日期:2012-6-26
# 版本:1.0
# 申明:刺夜之枪定制
# [url]http://bbs.66rpg.com/thread-237126-1-1.html[/url]
#==============================================================================
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < RPG::Sprite
if $creat_bar
#--------------------------------------------------------------------------
# ● 参数设置
#--------------------------------------------------------------------------
# 设置图片文件名.不想要底图就让底图完全透明或设置为 ""
# 图片放在 Graphics/Pictures/ 文件夹下
HPBarFileName = "HPBar"
HPBarBackFileName = "HPBarBack"
MPBarFileName = "MPBar"
MPBarBackFileName = "MPBarBack"
# 设置需要显示 HP 条的事件 id
ShowHPBarEventID = []
for i in 1..$EFS_Number_Teammate-1
ShowHPBarEventID << $Team_Fighter[i].eventId
end
# 设置需要显示 MP 条的事件 id
ShowMPBarEventID = []
# 设置当开关打开后.对应的条消失
# 这是一个哈希表, =>符号左边的为“键”,右边的为“值”
# 键=>值 与 键=>值 之间用半角的 , 号分开
# 键为事件id,值为开关id
ShowBarSwitchID = {1 => 1, 3 => 2, 5 => 3, 7 => 4, 9 => 5,
11 => 6, 13 => 7, 15 => 8, 17 => 9, 19 => 10}
# 设置 hp 和 mhp 对应的变量id
# 键为事件id 值为一个数组.
# 数组中左边数字为 hp变量id,右边的数字为mhp变量id
HPVariableID = {1 => [26,141], 11 => [31,146],
3 => [27,142], 13 => [32,147],
5 => [28,143], 15 => [33,148],
7 => [29,144], 17 => [34,149],
9 => [30,145], 19 => [35,150]}
# 设置 mp 和 mmp 的变量id.方法同上
MPVariableID = {1 => [138,139]}
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
alias hzhj_old_init_make_event_param_bar initialize
def initialize(*args)
@hp_sprite = Sprite.new(args[0])
@hp_back_sprite = Sprite.new(args[0])
@mp_sprite = Sprite.new(args[0])
@mp_back_sprite = Sprite.new(args[0])
@param_sprites = []
@param_sprites << @hp_sprite
@param_sprites << @hp_back_sprite
@param_sprites << @mp_sprite
@param_sprites << @mp_back_sprite
@hp_sprite.bitmap = RPG::Cache.picture(HPBarFileName)
@hp_back_sprite.bitmap = RPG::Cache.picture(HPBarBackFileName)
@mp_sprite.bitmap = RPG::Cache.picture(MPBarFileName)
@mp_back_sprite.bitmap = RPG::Cache.picture(MPBarBackFileName)
hzhj_old_init_make_event_param_bar(*args)
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias hzhj_old_dispose_make_event_param_bar dispose unless $@
def dispose
@param_sprites.each{|sprite|sprite.dispose}
hzhj_old_dispose_make_event_param_bar
end
#--------------------------------------------------------------------------
# ● 获取事件 HP
#--------------------------------------------------------------------------
def event_hp
event_mhp - $game_variables[HPVariableID[@character.id][0]]
end
#--------------------------------------------------------------------------
# ● 获取事件 MHP
#--------------------------------------------------------------------------
def event_mhp
$game_variables[HPVariableID[@character.id][1]]
end
#--------------------------------------------------------------------------
# ● 获取事件 MP
#--------------------------------------------------------------------------
def event_mp
$game_variables[MPVariableID[@character.id][0]]
end
#--------------------------------------------------------------------------
# ● 获取事件 MMP
#--------------------------------------------------------------------------
def event_mmp
[$game_variables[MPVariableID[@character.id][1]], 1].max
end
#--------------------------------------------------------------------------
# ● 判断是否显示 HP 条
#--------------------------------------------------------------------------
def show_hp_bar?
ShowHPBarEventID.include?(@character.id) &&
!$game_switches[ShowBarSwitchID[@character.id]] &&
event_hp > 0
end
#--------------------------------------------------------------------------
# ● 判断是否显示 MP 条
#--------------------------------------------------------------------------
def show_mp_bar?
ShowMPBarEventID.include?(@character.id)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
alias hzhj_old_update_make_event_param_bar update
def update
hzhj_old_update_make_event_param_bar
unless @character.is_a?(Game_Event)
@param_sprites.each{|sprite|sprite.visible = false}
else
# 刷新 HP 可见状态
if show_hp_bar?
@hp_sprite.visible = @hp_back_sprite.visible = true
# 刷新坐标
@param_sprites.each do |sprite|
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height
sprite.x = x
sprite.y = y - 52
sprite.z = z
end
@hp_sprite.z += 1
@mp_sprite.z += 1
# 计算 HP 显示区域
hpw = (@hp_sprite.bitmap.width * 1.0 * event_hp / event_mhp).round
hpw = [[hpw, @hp_sprite.bitmap.width].min, 0].max
hph = @hp_sprite.bitmap.height
@hp_sprite.src_rect.set(0, 0, hpw, hph)
# 刷新 MP 可见状态
@mp_sprite.visible = @mp_back_sprite.visible = show_mp_bar?
# MP 可见的情况
if show_mp_bar?
# 修正 HP 坐标
@hp_sprite.y -= (@mp_sprite.oy + 1)
@hp_back_sprite.y = @hp_sprite.y
# 计算 MP 显示区域
mpw = (@mp_sprite.bitmap.width * 1.0 * event_mp / event_mmp).round
mpw = [[mpw, @mp_sprite.bitmap.width].min, 0].max
mph = @mp_sprite.bitmap.height
@mp_sprite.src_rect.set(0, 0, mpw, mph)
end
else
@param_sprites.each{|sprite|sprite.visible = false}
end
end
end
end # ============= create bar
end
这是现在要改的脚本#============================================================================== # ■ 事件头上显血条 RMXP #-------------------------------------------------------------------------- # 作者:后知后觉 # 日期:2012-6-26 # 版本:1.0 # 申明:刺夜之枪定制 正太君改 # [url]http://bbs.66rpg.com/thread-237126-1-1.html[/url] #============================================================================== #============================================================================== # ■ Sprite_Character #============================================================================== class Sprite_Character < RPG::Sprite #-------------------------------------------------------------------------- # ● 参数设置 正太君改 #-------------------------------------------------------------------------- # 设置图片文件名.不想要底图就让底图完全透明或设置为 "" # 图片放在 Graphics/Pictures/ 文件夹下 HPBarFileName = "HPBar" HPBarBackFileName = "HPBarBack" MPBarFileName = "MPBar" MPBarBackFileName = "MPBarBack" # 设置显示友军血条的开关号 #TeamHPBarSwitchID = 5 # 设置显示敌军血条的开关号 #EnemyHPBarSwitchID = 6 # 设置显示血条的开关号 HPBarSwitchID = 5 #禁止显示血条 开关 HPBarDOESNOTSwitchID = 6 # 被攻击后血条显示多久 HPbarTimeDisplay = 60 #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- #别名hzhj旧初始化使事件参数栏初始化 alias hzhj_old_init_make_event_param_bar initialize def initialize(*args)#定义初始化(*参数) @hp_sprite = Sprite.new(args[0])#@hp精灵=精灵.新(参数[0]) @hp_back_sprite = Sprite.new(args[0])#@hp后台精灵 = 精灵.新(参数[0]) @mp_sprite = Sprite.new(args[0]) @mp_back_sprite = Sprite.new(args[0]) @param_sprites = []#@参数精灵=[] @param_sprites << @hp_sprite# @参数精灵 << @hp精灵 @param_sprites << @hp_back_sprite# @参数精灵=@hp后台精灵 @param_sprites << @mp_sprite @param_sprites << @mp_back_sprite #@hp精灵。位图 = RPG::Cache.picture(HPBarFileName)绿色 @hp_sprite.bitmap = RPG::Cache.picture(HPBarFileName) #@hp后台精灵.位图= RPG::Cache.picture(HPBarBackFileName)#黑色 @hp_back_sprite.bitmap = RPG::Cache.picture(HPBarBackFileName)#黑色 @mp_sprite.bitmap = RPG::Cache.picture(MPBarFileName) @mp_back_sprite.bitmap = RPG::Cache.picture(MPBarBackFileName) #别名hzhj旧初始化使事件参数栏(*参数) hzhj_old_init_make_event_param_bar(*args) end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- #别名hzhj旧的布置使事件参数栏布置除非$@ alias hzhj_old_dispose_make_event_param_bar dispose unless $@ def dispose#定义可用 #@参数精灵。每个{|精灵|精灵.释放} @param_sprites.each{|sprite|sprite.dispose} #hzhj旧的布置生成事件参数栏 hzhj_old_dispose_make_event_param_bar end #-------------------------------------------------------------------------- # ● 获取事件 HP # 正太君改 #-------------------------------------------------------------------------- def event_hp#定义事件hp return 0 if @character.nil?#如果@角色,则返回0。无 return @character.hp#返回角色HP end #-------------------------------------------------------------------------- # ● 获取事件 MHP # 正太君改 #-------------------------------------------------------------------------- def event_mhp#定义事件MHP return 0 if @character.nil?#如果@角色,则返回0。无 return @character.hp_max#返回角色HP最大值 end #-------------------------------------------------------------------------- # ● 获取事件 MP # 正太君改 #-------------------------------------------------------------------------- def event_mp return 0 if @character.nil? return @character.sp if @character.is_a?(EFS_Hero) return @character.ammo #return @character.get_group.morale end #-------------------------------------------------------------------------- # ● 获取事件 MMP # 正太君改 #-------------------------------------------------------------------------- def event_mmp return 0 if @character.nil? return @character.sp_max if @character.is_a?(EFS_Hero) return @character.ammo_max #return 100 end #-------------------------------------------------------------------------- # ● 判断是否显示 HP 条 #-------------------------------------------------------------------------- def show_hp_bar?#是否显示hp栏? #return false if @character.is_a?(EFS_Hero) # 如果$场景,则返回假的。efs故事模式 return false if $scene.efs_story_mode #如果事件hp>0&&@角色已删除 &&表示与,意为同时都要满足。&&逻辑运算符,并且是双目运算符 if event_hp > 0 && !@character.removed #返回$游戏开关[HPBarSwitchID]||@角色.hp计数器>0 return $game_switches[HPBarSwitchID] || @character.hp_counter > 0 #) && ! $game_switches[HPBarDOESNOTSwitchID] else #否则 return false#返回假的 end end #-------------------------------------------------------------------------- # ● 判断是否显示 MP 条 #-------------------------------------------------------------------------- def show_mp_bar? #return false if @character.is_a?(EFS_Hero) return false if $scene.efs_story_mode if event_mmp > 0 && !@character.removed return $game_switches[HPBarSwitchID] || @character.hp_counter > 0 #) && ! $game_switches[HPBarDOESNOTSwitchID] else return false end end #-------------------------------------------------------------------------- # ● 更新画面 #-------------------------------------------------------------------------- #别名hzhj旧更新使事件参数栏更新 alias hzhj_old_update_make_event_param_bar update def update #定义更新 #hzhj旧更新生成事件参数栏 hzhj_old_update_make_event_param_bar #如果@角色.是_a?(EFS_战斗者) # @参数精灵。每个{|精灵|精灵.可见=假的} @param_sprites.each{|sprite|sprite.visible = false} else # 刷新 HP 可见状态 if show_hp_bar? #如果显示hp栏? #@hp精灵。可见=@hp后台精灵可见=真 @hp_sprite.visible = @hp_back_sprite.visible = true # @hp精灵。bitmap=角色扮演::缓存图片(“HPBar-E”)如果@角色。团队!=1. @hp_sprite.bitmap = RPG::Cache.picture("HPBar-E") if @character.team != 1 #wtf you doing #减少计数 # 除非$游戏切换[HPBarSwitchID] unless $game_switches[HPBarSwitchID] #如果@角色。hp计数器==hp条形时间显示 if @character.hp_counter == HPbarTimeDisplay @param_sprites.each do |sprite| #@参数精灵。每个做|精灵| sprite.opacity = 255 #精灵不透明度=255 end #els if@字符。hp计数器< HPbarTimeDisplay /3 elsif @character.hp_counter < HPbarTimeDisplay/3 @param_sprites.each do |sprite|#@参数精灵。每个做|精灵| ##精灵不透明度-=255/(HPbarTimeDisplay/3) sprite.opacity -= 255/(HPbarTimeDisplay/3) end end #@性格。hp计数器-=1 @character.hp_counter -= 1 else#否则 @param_sprites.each do |sprite|#@参数精灵。每个做|精灵| sprite.opacity = 255#精灵不透明度=255 end end # 刷新坐标 @param_sprites.each do |sprite|#@参数精灵。每个做|精灵| #team_num = 5 #for i in 0..team_num-1 sprite.ox = sprite.bitmap.width / 2#精灵ox=精灵位图宽度/2 sprite.oy = sprite.bitmap.height#精灵.oy=精灵。位图高度 # a=[87,174,261,348,435,609,696,783,870,957] # if !a.empty? # for i in 0.. @team_groups.size-1 #for i in 1..5 # $team_group[i] = [] # 87 # @item_icon[i].x = 5+ i%4 *86 #x=1*@event_id sprite.x = 115+x*87 #x#+a#[0] # a.delete_at(0) # end # sprite.x = x #sprite.y = y - 52 # p sprite.x #sprite.opacity = 255 # shif = @character.is_cal#盖印图层=@角色。是计算函数 sprite.y =y - (shif ? 82 : 52)#精灵.y=y-(盖印图层?82:52) sprite.z = z#精灵.z = z end # @hp_sprite.x += 87 @hp_sprite.z += 1#hp_精灵.z = z @mp_sprite.z += 1 # 计算 HP 显示区域 #hp宽=(@hp 精灵.位图.宽*1.0*事件hp/事件mhp)。圆形的 hpw = (@hp_sprite.bitmap.width * 1.0 * event_hp / event_mhp).round # hp宽=[hp宽,@hp精灵位图宽度].最小值,0].最大值 hpw = [[hpw, @hp_sprite.bitmap.width].min, 0].max hph = @hp_sprite.bitmap.height#hp高=@hp精灵位图高度 #@hp精灵。src矩形。集合(0,0,hp宽,hp高) @hp_sprite.src_rect.set(0, 0, hpw, hph) # 刷新 MP 可见状态 @mp_sprite.visible = @mp_back_sprite.visible = (show_mp_bar? and event_mmp > 0) # 正太君改 if show_mp_bar? # 修正 HP 坐标 @hp_sprite.y -= (@mp_sprite.oy + 1) @hp_back_sprite.y = @hp_sprite.y # 计算 MP 显示区域 if event_mmp > 0 # 正太君改 mpw = (@mp_sprite.bitmap.width * 1.0 * event_mp / event_mmp).round mpw = [[mpw, @mp_sprite.bitmap.width].min, 0].max mph = @mp_sprite.bitmap.height @mp_sprite.src_rect.set(0, 0, mpw, mph) end end else @param_sprites.each{|sprite|sprite.visible = false} end end end end
#==============================================================================
# ■ 事件头上显血条 RMXP
#--------------------------------------------------------------------------
# 作者:后知后觉
# 日期:2012-6-26
# 版本:1.0
# 申明:刺夜之枪定制 正太君改
# [url]http://bbs.66rpg.com/thread-237126-1-1.html[/url]
#==============================================================================
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# ● 参数设置 正太君改
#--------------------------------------------------------------------------
# 设置图片文件名.不想要底图就让底图完全透明或设置为 ""
# 图片放在 Graphics/Pictures/ 文件夹下
HPBarFileName = "HPBar"
HPBarBackFileName = "HPBarBack"
MPBarFileName = "MPBar"
MPBarBackFileName = "MPBarBack"
# 设置显示友军血条的开关号
#TeamHPBarSwitchID = 5
# 设置显示敌军血条的开关号
#EnemyHPBarSwitchID = 6
# 设置显示血条的开关号
HPBarSwitchID = 5
#禁止显示血条 开关
HPBarDOESNOTSwitchID = 6
# 被攻击后血条显示多久
HPbarTimeDisplay = 60
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
#别名hzhj旧初始化使事件参数栏初始化
alias hzhj_old_init_make_event_param_bar initialize
def initialize(*args)#定义初始化(*参数)
@hp_sprite = Sprite.new(args[0])#@hp精灵=精灵.新(参数[0])
@hp_back_sprite = Sprite.new(args[0])#@hp后台精灵 = 精灵.新(参数[0])
@mp_sprite = Sprite.new(args[0])
@mp_back_sprite = Sprite.new(args[0])
@param_sprites = []#@参数精灵=[]
@param_sprites << @hp_sprite# @参数精灵 << @hp精灵
@param_sprites << @hp_back_sprite# @参数精灵=@hp后台精灵
@param_sprites << @mp_sprite
@param_sprites << @mp_back_sprite
#@hp精灵。位图 = RPG::Cache.picture(HPBarFileName)绿色
@hp_sprite.bitmap = RPG::Cache.picture(HPBarFileName)
#@hp后台精灵.位图= RPG::Cache.picture(HPBarBackFileName)#黑色
@hp_back_sprite.bitmap = RPG::Cache.picture(HPBarBackFileName)#黑色
@mp_sprite.bitmap = RPG::Cache.picture(MPBarFileName)
@mp_back_sprite.bitmap = RPG::Cache.picture(MPBarBackFileName)
#别名hzhj旧初始化使事件参数栏(*参数)
hzhj_old_init_make_event_param_bar(*args)
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
#别名hzhj旧的布置使事件参数栏布置除非$@
alias hzhj_old_dispose_make_event_param_bar dispose unless $@
def dispose#定义可用
#@参数精灵。每个{|精灵|精灵.释放}
@param_sprites.each{|sprite|sprite.dispose}
#hzhj旧的布置生成事件参数栏
hzhj_old_dispose_make_event_param_bar
end
#--------------------------------------------------------------------------
# ● 获取事件 HP # 正太君改
#--------------------------------------------------------------------------
def event_hp#定义事件hp
return 0 if @character.nil?#如果@角色,则返回0。无
return @character.hp#返回角色HP
end
#--------------------------------------------------------------------------
# ● 获取事件 MHP # 正太君改
#--------------------------------------------------------------------------
def event_mhp#定义事件MHP
return 0 if @character.nil?#如果@角色,则返回0。无
return @character.hp_max#返回角色HP最大值
end
#--------------------------------------------------------------------------
# ● 获取事件 MP # 正太君改
#--------------------------------------------------------------------------
def event_mp
return 0 if @character.nil?
return @character.sp if @character.is_a?(EFS_Hero)
return @character.ammo
#return @character.get_group.morale
end
#--------------------------------------------------------------------------
# ● 获取事件 MMP # 正太君改
#--------------------------------------------------------------------------
def event_mmp
return 0 if @character.nil?
return @character.sp_max if @character.is_a?(EFS_Hero)
return @character.ammo_max
#return 100
end
#--------------------------------------------------------------------------
# ● 判断是否显示 HP 条
#--------------------------------------------------------------------------
def show_hp_bar?#是否显示hp栏?
#return false if @character.is_a?(EFS_Hero)
# 如果$场景,则返回假的。efs故事模式
return false if $scene.efs_story_mode
#如果事件hp>0&&@角色已删除 &&表示与,意为同时都要满足。&&逻辑运算符,并且是双目运算符
if event_hp > 0 && !@character.removed
#返回$游戏开关[HPBarSwitchID]||@角色.hp计数器>0
return $game_switches[HPBarSwitchID] || @character.hp_counter > 0 #) && ! $game_switches[HPBarDOESNOTSwitchID]
else #否则
return false#返回假的
end
end
#--------------------------------------------------------------------------
# ● 判断是否显示 MP 条
#--------------------------------------------------------------------------
def show_mp_bar?
#return false if @character.is_a?(EFS_Hero)
return false if $scene.efs_story_mode
if event_mmp > 0 && !@character.removed
return $game_switches[HPBarSwitchID] || @character.hp_counter > 0 #) && ! $game_switches[HPBarDOESNOTSwitchID]
else
return false
end
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
#别名hzhj旧更新使事件参数栏更新
alias hzhj_old_update_make_event_param_bar update
def update #定义更新
#hzhj旧更新生成事件参数栏
hzhj_old_update_make_event_param_bar
#如果@角色.是_a?(EFS_战斗者)
# @参数精灵。每个{|精灵|精灵.可见=假的}
@param_sprites.each{|sprite|sprite.visible = false}
else
# 刷新 HP 可见状态
if show_hp_bar? #如果显示hp栏?
#@hp精灵。可见=@hp后台精灵可见=真
@hp_sprite.visible = @hp_back_sprite.visible = true
# @hp精灵。bitmap=角色扮演::缓存图片(“HPBar-E”)如果@角色。团队!=1.
@hp_sprite.bitmap = RPG::Cache.picture("HPBar-E") if @character.team != 1 #wtf you doing
#减少计数
# 除非$游戏切换[HPBarSwitchID]
unless $game_switches[HPBarSwitchID]
#如果@角色。hp计数器==hp条形时间显示
if @character.hp_counter == HPbarTimeDisplay
@param_sprites.each do |sprite| #@参数精灵。每个做|精灵|
sprite.opacity = 255 #精灵不透明度=255
end
#els if@字符。hp计数器< HPbarTimeDisplay /3
elsif @character.hp_counter < HPbarTimeDisplay/3
@param_sprites.each do |sprite|#@参数精灵。每个做|精灵|
##精灵不透明度-=255/(HPbarTimeDisplay/3)
sprite.opacity -= 255/(HPbarTimeDisplay/3)
end
end
#@性格。hp计数器-=1
@character.hp_counter -= 1
else#否则
@param_sprites.each do |sprite|#@参数精灵。每个做|精灵|
sprite.opacity = 255#精灵不透明度=255
end
end
# 刷新坐标
@param_sprites.each do |sprite|#@参数精灵。每个做|精灵|
#team_num = 5
#for i in 0..team_num-1
sprite.ox = sprite.bitmap.width / 2#精灵ox=精灵位图宽度/2
sprite.oy = sprite.bitmap.height#精灵.oy=精灵。位图高度
# a=[87,174,261,348,435,609,696,783,870,957]
# if !a.empty?
# for i in 0.. @team_groups.size-1 #for i in 1..5
# $team_group[i] = []
# 87
# @item_icon[i].x = 5+ i%4 *86
#x=1*@event_id
sprite.x = 115+x*87 #x#+a#[0]
# a.delete_at(0)
# end
# sprite.x = x
#sprite.y = y - 52
# p sprite.x
#sprite.opacity = 255
# shif = @character.is_cal#盖印图层=@角色。是计算函数
sprite.y =y - (shif ? 82 : 52)#精灵.y=y-(盖印图层?82:52)
sprite.z = z#精灵.z = z
end
# @hp_sprite.x += 87
@hp_sprite.z += 1#hp_精灵.z = z
@mp_sprite.z += 1
# 计算 HP 显示区域
#hp宽=(@hp 精灵.位图.宽*1.0*事件hp/事件mhp)。圆形的
hpw = (@hp_sprite.bitmap.width * 1.0 * event_hp / event_mhp).round
# hp宽=[hp宽,@hp精灵位图宽度].最小值,0].最大值
hpw = [[hpw, @hp_sprite.bitmap.width].min, 0].max
hph = @hp_sprite.bitmap.height#hp高=@hp精灵位图高度
#@hp精灵。src矩形。集合(0,0,hp宽,hp高)
@hp_sprite.src_rect.set(0, 0, hpw, hph)
# 刷新 MP 可见状态
@mp_sprite.visible = @mp_back_sprite.visible = (show_mp_bar? and event_mmp > 0) # 正太君改
if show_mp_bar?
# 修正 HP 坐标
@hp_sprite.y -= (@mp_sprite.oy + 1)
@hp_back_sprite.y = @hp_sprite.y
# 计算 MP 显示区域
if event_mmp > 0 # 正太君改
mpw = (@mp_sprite.bitmap.width * 1.0 * event_mp / event_mmp).round
mpw = [[mpw, @mp_sprite.bitmap.width].min, 0].max
mph = @mp_sprite.bitmap.height
@mp_sprite.src_rect.set(0, 0, mpw, mph)
end
end
else
@param_sprites.each{|sprite|sprite.visible = false}
end
end
end
end
|
|