赞 | 6 |
VIP | 0 |
好人卡 | 3 |
积分 | 14 |
经验 | 12282 |
最后登录 | 2022-8-15 |
在线时间 | 295 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1373
- 在线时间
- 295 小时
- 注册时间
- 2014-6-24
- 帖子
- 100
|
现有的吸血脚本:
#============================================================================== # - 普通攻击简易吸血 - # 只有学会特定技能的角色或敌人才可以吸血; # 敌人要设置发动特技的条件,一个永远不被打开的开关; # 为了方便起见,技能id越大视为吸血效果越好。 #============================================================================== module Battler_XiXue Attack_Setup = {} #---------------------------------------------------------------------------- # Attack_Setup[技能id] = [回复率, 触发概率, 分散度] #---------------------------------------------------------------------------- Attack_Setup[113] = [20, 100, 1] Attack_Setup[114] = [30, 100, 1] end #============================================================================== # - Game_Battler #============================================================================== class Game_Battler #---------------------------------------------------------------------------- # 应用普通攻击效果 #---------------------------------------------------------------------------- alias :attack_effect_xixue_old :attack_effect def attack_effect(attacker) attack_effect_xixue_old(attacker) #-------------------------------------------------------------------------- # 吸血判断 #-------------------------------------------------------------------------- if attacker.is_a?(Game_Actor) jj = attacker.skills & Battler_XiXue::Attack_Setup.keys else s = [] for i in $data_enemies[attacker.id].actions s << i.skill_id end jj = s & Battler_XiXue::Attack_Setup.keys end #-------------------------------------------------------------------------- # 吸血效果 #-------------------------------------------------------------------------- if jj.size > 0 d = Battler_XiXue::Attack_Setup[jj.max] if self.damage.is_a?(Numeric) and self.damage > 0 and rand(100) < d[1] attacker.damage = 0 - self.damage * d[0] / 100 d = attacker.damage * d[2] / 100 d += 1 if d == 0 f = 0 - d e = 0 - f v = [*e..f] attacker.damage += v[rand(v.size)] attacker.hp -= attacker.damage end end end end #============================================================================== # - Scene_Battle 显示吸血效果 默认用 #============================================================================== class Scene_Battle alias :update_phase4_step5_xixue_old :update_phase4_step5 def update_phase4_step5 update_phase4_step5_xixue_old if @active_battler.damage @active_battler.damage_pop = true end end end =begin #============================================================================== # - Scene_Battle 显示吸血效果 真移位用 #============================================================================== class Scene_Battle alias :update_phase4_step4_xixue_old :update_phase4_step4 def update_phase4_step4 if @active_battler.damage @active_battler.damage_pop = true end update_phase4_step4_xixue_old end end #============================================================================== # - Scene_Battle 显示吸血效果(字体颜色) 真移位追加 #============================================================================== class Bitmap def draw_number(x, y, number,o,picture = RPG::Cache.system("number")) w = picture.width / 10 h = picture.height / 5 rect = Rect.new(0,0,w,h) if number.is_a?(Numeric) rect.set(0,h*2,w,h) if number < 0 number = number.abs end number = number.to_s array = number.split(//) for i in 0...array.size array[i] = array[i].to_i end case o when 1 x += 81 - (array.size * 9) when 2 end if number == "Miss" self.blt(x,y,picture,Rect.new(0,h*3,picture.width,h)) return end for sz in array rect.x = sz * w self.blt(x,y,picture,rect) x += w end end end module RPG class Sprite < ::Sprite def damage(value, critical) dispose_damage bitmap = Bitmap.new(160, 48) bitmap.font.name = "Arial Black" bitmap.font.size = 32 if value.is_a?(Numeric) and value < 0 bitmap.font.color.set(176, 255, 144) else bitmap.font.color.set(255, 255, 255) end bitmap.draw_number(0, 12, value, 1) if critical bitmap.font.size = 20 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1) bitmap.font.color.set(255, 255, 255) bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) end @_damage_sprite = ::Sprite.new(self.viewport) @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 @_damage_sprite.oy = 20 @_damage_sprite.x = self.x @_damage_sprite.y = self.y - self.oy / 2 @_damage_sprite.z = 3000 @_damage_duration = 40 end end end =end
#==============================================================================
# - 普通攻击简易吸血 -
# 只有学会特定技能的角色或敌人才可以吸血;
# 敌人要设置发动特技的条件,一个永远不被打开的开关;
# 为了方便起见,技能id越大视为吸血效果越好。
#==============================================================================
module Battler_XiXue
Attack_Setup = {}
#----------------------------------------------------------------------------
# Attack_Setup[技能id] = [回复率, 触发概率, 分散度]
#----------------------------------------------------------------------------
Attack_Setup[113] = [20, 100, 1]
Attack_Setup[114] = [30, 100, 1]
end
#==============================================================================
# - Game_Battler
#==============================================================================
class Game_Battler
#----------------------------------------------------------------------------
# 应用普通攻击效果
#----------------------------------------------------------------------------
alias :attack_effect_xixue_old :attack_effect
def attack_effect(attacker)
attack_effect_xixue_old(attacker)
#--------------------------------------------------------------------------
# 吸血判断
#--------------------------------------------------------------------------
if attacker.is_a?(Game_Actor)
jj = attacker.skills & Battler_XiXue::Attack_Setup.keys
else
s = []
for i in $data_enemies[attacker.id].actions
s << i.skill_id
end
jj = s & Battler_XiXue::Attack_Setup.keys
end
#--------------------------------------------------------------------------
# 吸血效果
#--------------------------------------------------------------------------
if jj.size > 0
d = Battler_XiXue::Attack_Setup[jj.max]
if self.damage.is_a?(Numeric) and self.damage > 0 and rand(100) < d[1]
attacker.damage = 0 - self.damage * d[0] / 100
d = attacker.damage * d[2] / 100
d += 1 if d == 0
f = 0 - d
e = 0 - f
v = [*e..f]
attacker.damage += v[rand(v.size)]
attacker.hp -= attacker.damage
end
end
end
end
#==============================================================================
# - Scene_Battle 显示吸血效果 默认用
#==============================================================================
class Scene_Battle
alias :update_phase4_step5_xixue_old :update_phase4_step5
def update_phase4_step5
update_phase4_step5_xixue_old
if @active_battler.damage
@active_battler.damage_pop = true
end
end
end
=begin
#==============================================================================
# - Scene_Battle 显示吸血效果 真移位用
#==============================================================================
class Scene_Battle
alias :update_phase4_step4_xixue_old :update_phase4_step4
def update_phase4_step4
if @active_battler.damage
@active_battler.damage_pop = true
end
update_phase4_step4_xixue_old
end
end
#==============================================================================
# - Scene_Battle 显示吸血效果(字体颜色) 真移位追加
#==============================================================================
class Bitmap
def draw_number(x, y, number,o,picture = RPG::Cache.system("number"))
w = picture.width / 10
h = picture.height / 5
rect = Rect.new(0,0,w,h)
if number.is_a?(Numeric)
rect.set(0,h*2,w,h) if number < 0
number = number.abs
end
number = number.to_s
array = number.split(//)
for i in 0...array.size
array[i] = array[i].to_i
end
case o
when 1
x += 81 - (array.size * 9)
when 2
end
if number == "Miss"
self.blt(x,y,picture,Rect.new(0,h*3,picture.width,h))
return
end
for sz in array
rect.x = sz * w
self.blt(x,y,picture,rect)
x += w
end
end
end
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_number(0, 12, value, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
end
end
=end
自行修改 Attack_Setup[技能id] = [回复率, 触发概率, 分散度]
持续回血有点麻烦,但可以实现,楼主请跟着我的步骤修改脚本:
搜索 Game_Battler 3 “应用连续伤害效果” 也可以全局搜索def slip_damage_effect
将def slip_damage_effect # 设置伤害 self.damage = self.maxhp / 10 # 分散 if self.damage.abs > 0 amp = [self.damage.abs * 15 / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # HP 的伤害减法运算 self.hp -= self.damage # 过程结束 return true end
def slip_damage_effect
# 设置伤害
self.damage = self.maxhp / 10
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# HP 的伤害减法运算
self.hp -= self.damage
# 过程结束
return true
end
改为:def slip_damage_effect # 设定伤害 if self.state?(20) # 持续回血的状态 self.damage = -150#(每回合自动回血量) else self.damage = self.hp / 10 end # 分散 if self.damage.abs > 0 amp = [self.damage.abs * 15 / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # HP 的伤害减法运算 self.hp -= self.damage # 过程结束 return true end
def slip_damage_effect
# 设定伤害
if self.state?(20) # 持续回血的状态
self.damage = -150#(每回合自动回血量)
else
self.damage = self.hp / 10
end
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# HP 的伤害减法运算
self.hp -= self.damage
# 过程结束
return true
end
还有,该状态必须勾选“连续伤害”,比如你要制作一个能持续回血的技能,那么技能就要附加这个状态才行
|
评分
-
查看全部评分
|