加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
我有一个吸血技能的脚本,但这个脚本只能指定一个技能,我能不能让它可以使多个技能带有吸血效果?module CLD99 module Dracula DRAIN_SKILL_ID = 74 # 领悟了此ID技能后,所有攻击带吸血 DRAIN_RATE = 0.1 # 因上面的情况允许吸血时的比例 end end class Game_Battler include CLD99::Dracula #-------------------------------------------------------------------------- # ● [追加]是否所有攻击带吸血 #-------------------------------------------------------------------------- def dracula? puts @skills @skills.include?(CLD99::Dracula::DRAIN_SKILL_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 fmt = "%s造成了%s伤害,吸收了\C[24]%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 = 74
# 领悟了此ID技能后,所有攻击带吸血
DRAIN_RATE = 0.1
# 因上面的情况允许吸血时的比例
end
end
class Game_Battler
include CLD99::Dracula
#--------------------------------------------------------------------------
# ● [追加]是否所有攻击带吸血
#--------------------------------------------------------------------------
def dracula?
puts @skills
@skills.include?(CLD99::Dracula::DRAIN_SKILL_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
fmt = "%s造成了%s伤害,吸收了\C[24]%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
|