设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2698|回复: 2
打印 上一主题 下一主题

[已经解决] 怎么弄出武器吸血的效果

[复制链接]

Lv2.观梦者

梦石
0
星屑
771
在线时间
83 小时
注册时间
2020-4-10
帖子
55
跳转到指定楼层
1
发表于 2021-2-27 10:02:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
想弄出一个类似tr的吸血飞刀的那种攻击附带吸血的武器,怎么整啊

Lv5.捕梦者

梦石
0
星屑
24287
在线时间
5046 小时
注册时间
2016-3-8
帖子
1618
2
发表于 2021-2-27 10:24:18 | 只看该作者
本帖最后由 alexncf125 于 2021-2-27 10:30 编辑
前置

RUBY 代码复制
  1. =begin
  2. #==============================================================================
  3.  ** Effect: Vampiric Weapon
  4.  Author: Hime
  5.  Date: Nov 9, 2012
  6. ------------------------------------------------------------------------------
  7.  ** Change log
  8.  Nov 9, 2012
  9.    - converted amount drained to an int
  10.  Oct 8, 2012
  11.    - initial release
  12. ------------------------------------------------------------------------------   
  13.  ** Terms of Use
  14.  * Free to use in non-commercial projects
  15.  * Contact me for commercial use
  16.  * No real support. The script is provided as-is
  17.  * Will do bug fixes, but no compatibility patches
  18.  * Features may be requested but no guarantees, especially if it is non-trivial
  19.  * Preserve this header
  20. ------------------------------------------------------------------------------
  21. ** Required
  22.  -Effect Manager ([url]http://www.rpgmakervxace.net/topic/7395-effect-manager/[/url])
  23. ------------------------------------------------------------------------------
  24.  Adds a "vampiric weapon" effect to your equip.
  25.  When a battler has this effect, all attacks will drain HP equal to the damage.
  26.  为武器添加"吸血武器" 的效果.
  27.  当装备了该武器的对象使用攻击或技能命中目标时,吸取目标一定的hp.
  28.  
  29.   Tag your weapon with
  30.   使用备注
  31.     <eff: vampiric_weapon x>
  32.     
  33.  Where x is a percentage of the damage inflicted, as a float
  34.  eg: 0.5 means you will absorb 50% of damage dealt as HP.
  35.  其中 x 代表伤害的百分之多少会被吸收,是一个浮点数
  36.  例如: 0.5 代表你会吸收伤害的 50% ,回复自身该数值的hp.
  37. #==============================================================================
  38. =end
  39. $imported = {} if $imported.nil?
  40. $imported["Effect_VampiricWeapon"] = true
  41. #==============================================================================
  42. # ** Rest of the script
  43. #==============================================================================
  44. module Effect
  45.   module Vampiric_Weapon
  46.     Effect_Manager.register_effect(:vampiric_weapon)
  47.   end
  48. end
  49.  
  50. class Game_Battler < Game_BattlerBase
  51.  
  52.   def effect_vampiric_weapon(user, obj, effect)
  53.     return if user == self
  54.     amount = [@result.hp_damage, @result.old_hp].min
  55.     amount = (amount * (eval(effect.value1[0]) rescue 1)).to_i
  56.     user.hp = [user.hp + amount, user.mhp].min
  57.     self.hp = [self.hp - amount, 0].max
  58.  
  59.     @result.effect_results.push("%s 吸取了 %d HP from %s" %[user.name, amount, self.name])
  60.     @result.success = true
  61.   end
  62.  
  63.   alias :actor_effect_vampiric_weapon_attack :effect_vampiric_weapon
  64.   alias :weapon_effect_vampiric_weapon_attack :effect_vampiric_weapon
  65.   alias :state_effect_vampiric_weapon_attack :effect_vampiric_weapon
  66. end
回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
771
在线时间
83 小时
注册时间
2020-4-10
帖子
55
3
 楼主| 发表于 2021-2-28 09:29:48 | 只看该作者
alexncf125 发表于 2021-2-27 10:24
[fold=前置]=begin
#==============================================================================
* ...

哇!谢谢大佬!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-26 06:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表