| 赞 | 10 |
| VIP | |
| 好人卡 | |
| 积分 | 16 |
| 经验 | |
| 最后登录 | 2026-5-15 |
| 在线时间 | 267 小时 |
- 梦石
- 0
- 星屑
- 1618
- 在线时间
- 267 小时
- 注册时间
- 2019-1-18
- 回帖
- 129
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
如题,我现在有一个用于做吸血技能的脚本,但我想让不同的吸血技能吸血的比例也不同,这要怎么做?求大佬解答
脚本如下:
[pre lang="ruby"]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[/pre] |
|