加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
如题,我现在有一个用于做吸血技能的脚本,但我想让不同的吸血技能吸血的比例也不同,这要怎么做?求大佬解答
脚本如下:
module CLD99 module Dracula DRAIN_SKILL_ID = [68] # 领悟了此ID技能后,所有攻击带吸血 DRAIN_RATE = 0.05 # 因上面的情况允许吸血时的比例 end end class Game_Battler include CLD99::Dracula #-------------------------------------------------------------------------- # ● [追加]是否所有攻击带吸血 #-------------------------------------------------------------------------- def dracula? puts @skills CLD99::Dracula::DRAIN_SKILL_ID.any?{|id| @skills.include?(id)} end #-------------------------------------------------------------------------- # ● [别名修改]计算伤害 #-------------------------------------------------------------------------- alias :make_damage_value_for_dracula :make_damage_value def make_damage_value(user, item) make_damage_value_for_dracula(user, item) @result.make_dracula(item) if user.actor? && user.dracula? end end class Game_ActionResult attr_reader :dracula #-------------------------------------------------------------------------- # ● [追加]计算吸血 #-------------------------------------------------------------------------- def make_dracula(item) return if item.damage.drain? # 自带吸血的技能不参与 return if @hp_damage < 0 # 回复类技能不参与 @hp_drain = (@hp_damage * CLD99::Dracula::DRAIN_RATE).to_i @dracula = true end #-------------------------------------------------------------------------- # ● [别名修改]获取 HP 伤害的文字 #-------------------------------------------------------------------------- alias hp_damage_text_for_dracula hp_damage_text def hp_damage_text if @dracula @dracula = false fmt = "对%s造成了%s伤害,吸收了%s%s" return sprintf(fmt, @battler.name, @hp_damage, @hp_drain, Vocab.hp) end hp_damage_text_for_dracula end end class Window_BattleLog #-------------------------------------------------------------------------- # ● 显示 HP 伤害 #-------------------------------------------------------------------------- alias :display_hp_damage_for_dracula :display_hp_damage def display_hp_damage(target, item) target.perform_damage_effect if target.result.dracula display_hp_damage_for_dracula(target, item) end end
module CLD99
module Dracula
DRAIN_SKILL_ID = [68]
# 领悟了此ID技能后,所有攻击带吸血
DRAIN_RATE = 0.05
# 因上面的情况允许吸血时的比例
end
end
class Game_Battler
include CLD99::Dracula
#--------------------------------------------------------------------------
# ● [追加]是否所有攻击带吸血
#--------------------------------------------------------------------------
def dracula?
puts @skills
CLD99::Dracula::DRAIN_SKILL_ID.any?{|id| @skills.include?(id)}
end
#--------------------------------------------------------------------------
# ● [别名修改]计算伤害
#--------------------------------------------------------------------------
alias :make_damage_value_for_dracula :make_damage_value
def make_damage_value(user, item)
make_damage_value_for_dracula(user, item)
@result.make_dracula(item) if user.actor? && user.dracula?
end
end
class Game_ActionResult
attr_reader :dracula
#--------------------------------------------------------------------------
# ● [追加]计算吸血
#--------------------------------------------------------------------------
def make_dracula(item)
return if item.damage.drain? # 自带吸血的技能不参与
return if @hp_damage < 0 # 回复类技能不参与
@hp_drain = (@hp_damage * CLD99::Dracula::DRAIN_RATE).to_i
@dracula = true
end
#--------------------------------------------------------------------------
# ● [别名修改]获取 HP 伤害的文字
#--------------------------------------------------------------------------
alias hp_damage_text_for_dracula hp_damage_text
def hp_damage_text
if @dracula
@dracula = false
fmt = "对%s造成了%s伤害,吸收了%s%s"
return sprintf(fmt, @battler.name, @hp_damage, @hp_drain, Vocab.hp)
end
hp_damage_text_for_dracula
end
end
class Window_BattleLog
#--------------------------------------------------------------------------
# ● 显示 HP 伤害
#--------------------------------------------------------------------------
alias :display_hp_damage_for_dracula :display_hp_damage
def display_hp_damage(target, item)
target.perform_damage_effect if target.result.dracula
display_hp_damage_for_dracula(target, item)
end
end
|