module CLD99 module Dracula DRAIN_STATE_ID = 23 # 获得此ID状态后,所有攻击带吸血 DRAIN_RATE = 0.1 # 因上面的情况允许吸血时的比例 end end class Game_Battler #-------------------------------------------------------------------------- # ● [追加]是否所有攻击带吸血 #-------------------------------------------------------------------------- def dracula? state?(CLD99::Dracula::DRAIN_STATE_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伤害,吸收了%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_STATE_ID = 23
# 获得此ID状态后,所有攻击带吸血
DRAIN_RATE = 0.1
# 因上面的情况允许吸血时的比例
end
end
class Game_Battler
#--------------------------------------------------------------------------
# ● [追加]是否所有攻击带吸血
#--------------------------------------------------------------------------
def dracula?
state?(CLD99::Dracula::DRAIN_STATE_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伤害,吸收了%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
[已经解决] 如何做一个使攻击能吸血的被动技能?
拿以前的被动技能版改的状态版,试试看看能不能用吧
|