查看: 3404|回复: 0

[已经过期] 关于吸血技能脚本

[复制链接]
梦石
0
星屑
1618
在线时间
267 小时
注册时间
2019-1-18
回帖
129
发表于 2019-8-8 10:08:25 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
如题,我现在有一个用于做吸血技能的脚本,但我想让不同的吸血技能吸血的比例也不同,这要怎么做?求大佬解答
脚本如下:
  1. module CLD99
  2.   module Dracula

  3.     DRAIN_SKILL_ID = [68]
  4.     # 领悟了此ID技能后,所有攻击带吸血

  5.     DRAIN_RATE = 0.05
  6.     # 因上面的情况允许吸血时的比例

  7.   end
  8. end

  9. class Game_Battler
  10.   include CLD99::Dracula  
  11.   #--------------------------------------------------------------------------
  12.   # ● [追加]是否所有攻击带吸血
  13.   #--------------------------------------------------------------------------
  14.   def dracula?
  15.     puts @skills
  16.     CLD99::Dracula::DRAIN_SKILL_ID.any?{|id| @skills.include?(id)}
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● [别名修改]计算伤害
  20.   #--------------------------------------------------------------------------
  21.   alias :make_damage_value_for_dracula :make_damage_value
  22.   def make_damage_value(user, item)
  23.     make_damage_value_for_dracula(user, item)
  24.     @result.make_dracula(item) if user.actor? && user.dracula?
  25.   end
  26. end

  27. class Game_ActionResult
  28.   attr_reader :dracula
  29.   #--------------------------------------------------------------------------
  30.   # ● [追加]计算吸血
  31.   #--------------------------------------------------------------------------
  32.   def make_dracula(item)
  33.     return if item.damage.drain? # 自带吸血的技能不参与
  34.     return if @hp_damage < 0     # 回复类技能不参与
  35.     @hp_drain = (@hp_damage * CLD99::Dracula::DRAIN_RATE).to_i
  36.     @dracula = true
  37.   end  
  38.   #--------------------------------------------------------------------------
  39.   # ● [别名修改]获取 HP 伤害的文字
  40.   #--------------------------------------------------------------------------
  41.   alias hp_damage_text_for_dracula hp_damage_text
  42.   def hp_damage_text
  43.     if @dracula
  44. @dracula = false
  45.       fmt = "对%s造成了%s伤害,吸收了%s%s"
  46.       return sprintf(fmt, @battler.name, @hp_damage, @hp_drain, Vocab.hp)
  47.     end
  48.     hp_damage_text_for_dracula
  49.   end
  50. end

  51. class Window_BattleLog
  52.   #--------------------------------------------------------------------------
  53.   # ● 显示 HP 伤害
  54.   #--------------------------------------------------------------------------
  55.   alias :display_hp_damage_for_dracula :display_hp_damage
  56.   def display_hp_damage(target, item)
  57.     target.perform_damage_effect if target.result.dracula
  58.     display_hp_damage_for_dracula(target, item)
  59.   end
  60. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部