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

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: chd114
打印 上一主题 下一主题

[RMVA发布] 【国庆补完计划Ⅰ】技能冷却加强版

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1019 小时
注册时间
2012-4-25
帖子
799
11
发表于 2014-10-14 11:28:36 | 只看该作者
chd114 发表于 2014-10-9 21:09
$game_actors[x].skill_cool_add(y,z)就是对X号角色的Y技能的冷却增加Z个回合,Z如果是负的就减少,但是 ...

我的意思是,比如我攻击1号敌人,1号敌人的技能CD(如果在CD中)会加1个回合,如果攻击3号,则3号也是。反过来,敌人也是。

如果是(Y,Z),那恐怕只能对全体敌人使用了
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9275
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

12
 楼主| 发表于 2014-10-14 21:59:47 | 只看该作者
lirn 发表于 2014-10-13 18:28
我的意思是,比如我攻击1号敌人,1号敌人的技能CD(如果在CD中)会加1个回合,如果攻击3号,则3号也是。 ...

我不确定这个系统对敌人能起到很好的效果···周末回家看看
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
92
在线时间
55 小时
注册时间
2009-8-8
帖子
8
13
发表于 2015-7-10 21:53:15 | 只看该作者
想来试试看好不好....
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
25 小时
注册时间
2015-8-8
帖子
6
14
发表于 2017-8-9 08:34:45 | 只看该作者
按照惯例脚本免费工程收费且与脚本有出入————正是这句话每次都勾起了我的好奇心,结果买了一大堆不需要的脚本……
强迫症和好奇心害死人呀。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
15
发表于 2017-8-18 18:32:49 | 只看该作者
拆台了
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Skill Restrictions v1.02
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal, Hard, Lunatic
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SkillRestrictions"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.23 - Compatibility Update: Doppelganger
  17. # 2011.12.12 - Started Script and Finished.
  18. #            - Added cooldown altering notetags for items.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # Sometimes good game balance depends on restriction mechanics. Of these
  24. # mechanics include skill cooldowns, warmups, and the amount of times a skill
  25. # can be used (limited uses). Included in this script are features also to
  26. # lock cooldowns, reduce cooldown rates, change cooldown values for skills,
  27. # skill types, and more. If this isn't enough restriction power, switches may
  28. # be used to restrict skills from being used as well as even code.
  29. #
  30. #==============================================================================
  31. # ▼ Instructions
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # To install this script, open up your script editor and copy/paste this script
  34. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  35. #
  36. # -----------------------------------------------------------------------------
  37. # Actor Notetags - These notetags go in the actors notebox in the database.
  38. # -----------------------------------------------------------------------------
  39. # <cooldown lock>
  40. # A battler afflicted with cooldown lock will not have cooldowns count down
  41. # every turn until the cooldown lock is removed.
  42. #
  43. # <cooldown rate: x%>
  44. # When cooldowns are applied from using skills in battle, the cooldown rate can
  45. # reduce or increase the finalized amount of turns a battler would need to wait
  46. # before being able to use that skill again.
  47. #
  48. # <warmup rate: x%>
  49. # Lowers/Raises the amount of turns needed to pass in battle before the warmup
  50. # skills become available for usage.
  51. #
  52. # -----------------------------------------------------------------------------
  53. # Class Notetags - These notetags go in the class notebox in the database.
  54. # -----------------------------------------------------------------------------
  55. # <cooldown lock>
  56. # A battler afflicted with cooldown lock will not have cooldowns count down
  57. # every turn until the cooldown lock is removed.
  58. #
  59. # <cooldown rate: x%>
  60. # When cooldowns are applied from using skills in battle, the cooldown rate can
  61. # reduce or increase the finalized amount of turns a battler would need to wait
  62. # before being able to use that skill again.
  63. #
  64. # <warmup rate: x%>
  65. # Lowers/Raises the amount of turns needed to pass in battle before the warmup
  66. # skills become available for usage.
  67. #
  68. # -----------------------------------------------------------------------------
  69. # Skill Notetags - These notetags go in the skills notebox in the database.
  70. # -----------------------------------------------------------------------------
  71. # <cooldown: x>
  72. # Causes the skill to have a cooldown of x once it's used in battle. Skills
  73. # with cooldowns cannot be used again until cooldown reaches 0 or until the
  74. # battle is over.
  75. #
  76. # <change cooldown: +x>
  77. # <change cooldown: -x>
  78. # This will cause the target's cooldowns for every skill to increase by x or
  79. # decrease by x. This selects skills indiscriminately.
  80. #
  81. # <skill cooldown x: +y>
  82. # <skill cooldown x: -y>
  83. # This will cause the target's specific skill x to receive a change in cooldown
  84. # by either an increase or decrease of y amount.
  85. #
  86. # <stype cooldown x: +y>
  87. # <stype cooldown x: -y>
  88. # This will cause all of the skills with skill type x to have its cooldowns
  89. # changed by y amount. +y increases cooldown turns while -y decreases turns.
  90. #
  91. # <limited uses: x>
  92. # This will allow the skill to only be usable x times throughout the course of
  93. # battle. Once the skill is used x times, it is disabled until the battle is
  94. # over. This effect only takes place during battle.
  95. #
  96. # <wp: x>
  97. # Causes the skill to be sealed until the x turns pass in battle. There's no
  98. # way to speed up a warmup manually with the exception of warmup rates.
  99. #
  100. # <restrict if switch: x>
  101. # This will restrict the skill if switch x is ON. If switch x is OFF, this
  102. # skill will no longer be restricted.
  103. #
  104. # <restrict any switch: x>
  105. # <restrict any switch: x, x>
  106. # This will restrict the skill if any of the x switches are ON. If all of them
  107. # are off, then the skill will not be restricted.
  108. #
  109. # <restrict all switch: x>
  110. # <restrict all switch: x, x>
  111. # This will restrict the skill if all of the x switches are ON. If any of them
  112. # are off, then the skill will not be restricted.
  113. #
  114. # <restrict eval>
  115. #  string
  116. #  string
  117. # </restrict eval>
  118. # For the more advanced users, replace string with code to determine whether
  119. # or not the skill is restricted. If multiple lines are used, they are all
  120. # considered part of the same line.
  121. #
  122. # -----------------------------------------------------------------------------
  123. # Item Notetags - These notetags go in the items notebox in the database.
  124. # -----------------------------------------------------------------------------
  125. # <change cooldown: +x>
  126. # <change cooldown: -x>
  127. # This will cause the target's cooldowns for every skill to increase by x or
  128. # decrease by x. This selects skills indiscriminately.
  129. #
  130. # <skill cooldown x: +y>
  131. # <skill cooldown x: -y>
  132. # This will cause the target's specific skill x to receive a change in cooldown
  133. # by either an increase or decrease of y amount.
  134. #
  135. # <stype cooldown x: +y>
  136. # <stype cooldown x: -y>
  137. # This will cause all of the skills with skill type x to have its cooldowns
  138. # changed by y amount. +y increases cooldown turns while -y decreases turns.
  139. #
  140. # -----------------------------------------------------------------------------
  141. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  142. # -----------------------------------------------------------------------------
  143. # <cooldown lock>
  144. # A battler afflicted with cooldown lock will not have cooldowns count down
  145. # every turn until the cooldown lock is removed.
  146. #
  147. # <cooldown rate: x%>
  148. # When cooldowns are applied from using skills in battle, the cooldown rate can
  149. # reduce or increase the finalized amount of turns a battler would need to wait
  150. # before being able to use that skill again.
  151. #
  152. # <warmup rate: x%>
  153. # Lowers/Raises the amount of turns needed to pass in battle before the warmup
  154. # skills become available for usage.
  155. #
  156. # -----------------------------------------------------------------------------
  157. # Armour Notetags - These notetags go in the armours notebox in the database.
  158. # -----------------------------------------------------------------------------
  159. # <cooldown lock>
  160. # A battler afflicted with cooldown lock will not have cooldowns count down
  161. # every turn until the cooldown lock is removed.
  162. #
  163. # <cooldown rate: x%>
  164. # When cooldowns are applied from using skills in battle, the cooldown rate can
  165. # reduce or increase the finalized amount of turns a battler would need to wait
  166. # before being able to use that skill again.
  167. #
  168. # <warmup rate: x%>
  169. # Lowers/Raises the amount of turns needed to pass in battle before the warmup
  170. # skills become available for usage.
  171. #
  172. # -----------------------------------------------------------------------------
  173. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  174. # -----------------------------------------------------------------------------
  175. # <cooldown lock>
  176. # A battler afflicted with cooldown lock will not have cooldowns count down
  177. # every turn until the cooldown lock is removed.
  178. #
  179. # <cooldown rate: x%>
  180. # When cooldowns are applied from using skills in battle, the cooldown rate can
  181. # reduce or increase the finalized amount of turns a battler would need to wait
  182. # before being able to use that skill again.
  183. #
  184. # <warmup rate: x%>
  185. # Lowers/Raises the amount of turns needed to pass in battle before the warmup
  186. # skills become available for usage.
  187. #
  188. # -----------------------------------------------------------------------------
  189. # State Notetags - These notetags go in the states notebox in the database.
  190. # -----------------------------------------------------------------------------
  191. # <cooldown lock>
  192. # A battler afflicted with cooldown lock will not have cooldowns count down
  193. # every turn until the cooldown lock is removed.
  194. #
  195. # <cooldown rate: x%>
  196. # When cooldowns are applied from using skills in battle, the cooldown rate can
  197. # reduce or increase the finalized amount of turns a battler would need to wait
  198. # before being able to use that skill again.
  199. #
  200. # <warmup rate: x%>
  201. # Lowers/Raises the amount of turns needed to pass in battle before the warmup
  202. # skills become available for usage.
  203. #
  204. #==============================================================================
  205. # ▼ Compatibility
  206. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  207. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  208. # it will run with RPG Maker VX without adjusting.
  209. #
  210. #==============================================================================
  211.  
  212. module YEA
  213.   module SKILL_RESTRICT
  214.  
  215.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  216.     # - Cooldown Settings -
  217.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  218.     # Skills with cooldowns cannot be used for some number of turns. Adjust the
  219.     # settings here on how cooldowns appear in the menu. Cooldowns are only
  220.     # applied in battle.
  221.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  222.     COOLDOWN_COLOUR = 6          # Colour used from "Window" skin.
  223.     COOLDOWN_SIZE   = 20         # Font size used for cooldowns.
  224.     COOLDOWN_SUFFIX = "%sCD"     # Suffix used for cooldowns.
  225.     COOLDOWN_ICON   = 0          # Icon used for cooldowns. Set 0 to disable.
  226.  
  227.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  228.     # - Warmup Settings -
  229.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  230.     # Skills with warmups are unaffected by cooldowns. They become available to
  231.     # use after a certain number of turns have passed. Warmups are only applied
  232.     # in battle. Cooldown Rates do not affect warmups but Warmup Rates do.
  233.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  234.     WARMUP_COLOUR   = 5          # Colour used from "Window" skin.
  235.     WARMUP_SIZE     = 20         # Font size used for warmups.
  236.     WARMUP_SUFFIX   = "%sWU"     # Suffix used for warmups.
  237.     WARMUP_ICON     = 0          # Icon used for warmups. Set 0 to disable.
  238.  
  239.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  240.     # - Limited Use Settings -
  241.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  242.     # Some skills have limited uses per battle. These limited uses are reset
  243.     # at the start and end of each battle and do not apply when used outside of
  244.     # battle. There are no effects that can affect limited uses.
  245.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  246.     LIMITED_COLOUR  = 8          # Colour used from "Window" skin.
  247.     LIMITED_SIZE    = 16         # Font size used for used up.
  248.     LIMITED_TEXT    = "使用过了"     # Text used for used up.
  249.     LIMITED_ICON    = 0          # Icon used for used up. Set 0 to disable.
  250.  
  251.   end # SKILL_RESTRICT
  252. end # YEA
  253.  
  254. #==============================================================================
  255. # ▼ Editting anything past this point may potentially result in causing
  256. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  257. # halitosis so edit at your own risk.
  258. #==============================================================================
  259.  
  260. module YEA
  261.   module REGEXP
  262.   module BASEITEM
  263.  
  264.     COOLDOWN_RATE = /<(?:COOL_DOWN_RATE|cooldown rate):[ ](\d+)([%])>/i
  265.     COOLDOWN_LOCK = /<(?:COOL_DOWN_LOCK|cooldown lock)>/i
  266.     WARMUP_RATE   = /<(?:WARM_UP_RATE|warmup rate):[ ](\d+)([%%])>/i
  267.  
  268.   end # BASEITEM
  269.   module SKILL
  270.  
  271.     COOLDOWN = /<(?:CD|cd)[ ](\d+)>/i
  272.     WARMUP   = /<(?:WP|wp)[ ](\d+)>/i
  273.     LIMITED_USES = /<(?:LIMITED_USES|limited uses):[ ](\d+)>/i
  274.  
  275.     CHANGE_COOLDOWN = /<(?:CHANGE_COOL_DOWN|change cooldown):[ ]([\+\-]\d+)>/i
  276.     STYPE_COOLDOWN =
  277.       /<(?:STYPE_COOL_DOWN|stype cooldown)[ ](\d+):[ ]([\+\-]\d+)>/i
  278.     SKILL_COOLDOWN =
  279.       /<(?:SKILL_COOL_DOWN|skill cooldown)[ ](\d+):[ ]([\+\-]\d+)>/i
  280.  
  281.     RESTRICT_IF_SWITCH  =
  282.       /<(?:RESTRICT_IF_SWITCH|restrict if switch):[ ](\d+)>/i
  283.     RESTRICT_ANY_SWITCH =
  284.       /<(?:RESTRICT_ANY_SWITCH|restrict any switch):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  285.     RESTRICT_ALL_SWITCH =
  286.       /<(?:RESTRICT_ALL_SWITCH|restrict all switch):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  287.  
  288.     RESTRICT_EVAL_ON  = /<(?:RESTRICT_EVAL|restrict eval)>/i
  289.     RESTRICT_EVAL_OFF = /<\/(?:RESTRICT_EVAL|restrict eval)>/i
  290.  
  291.   end # SKILL
  292.   module ITEM
  293.  
  294.     CHANGE_COOLDOWN = /<(?:CHANGE_COOL_DOWN|change cooldown):[ ]([\+\-]\d+)>/i
  295.     STYPE_COOLDOWN =
  296.       /<(?:STYPE_COOL_DOWN|stype cooldown)[ ](\d+):[ ]([\+\-]\d+)>/i
  297.     SKILL_COOLDOWN =
  298.       /<(?:SKILL_COOL_DOWN|skill cooldown)[ ](\d+):[ ]([\+\-]\d+)>/i
  299.  
  300.   end # ITEM
  301.   end # REGEXP
  302. end # YEA
  303.  
  304. #==============================================================================
  305. # ■ Icon
  306. #==============================================================================
  307.  
  308. module Icon
  309.  
  310.   #--------------------------------------------------------------------------
  311.   # self.cooldown
  312.   #--------------------------------------------------------------------------
  313.   def self.cooldown; return YEA::SKILL_RESTRICT::COOLDOWN_ICON; end
  314.  
  315.   #--------------------------------------------------------------------------
  316.   # self.warmup
  317.   #--------------------------------------------------------------------------
  318.   def self.warmup; return YEA::SKILL_RESTRICT::WARMUP_ICON; end
  319.  
  320.   #--------------------------------------------------------------------------
  321.   # self.limited
  322.   #--------------------------------------------------------------------------
  323.   def self.limited; return YEA::SKILL_RESTRICT::LIMITED_ICON; end
  324.  
  325. end # Icon
  326.  
  327. #==============================================================================
  328. # ■ Numeric
  329. #==============================================================================
  330.  
  331. class Numeric
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # new method: group_digits
  335.   #--------------------------------------------------------------------------
  336.   unless $imported["YEA-CoreEngine"]
  337.   def group; return self.to_s; end
  338.   end # $imported["YEA-CoreEngine"]
  339.  
  340. end # Numeric
  341.  
  342. #==============================================================================
  343. # ■ DataManager
  344. #==============================================================================
  345.  
  346. module DataManager
  347.  
  348.   #--------------------------------------------------------------------------
  349.   # alias method: load_database
  350.   #--------------------------------------------------------------------------
  351.   class <<self; alias load_database_srs load_database; end
  352.   def self.load_database
  353.     load_database_srs
  354.     load_notetags_srs
  355.   end
  356.  
  357.   #--------------------------------------------------------------------------
  358.   # new method: load_notetags_srs
  359.   #--------------------------------------------------------------------------
  360.   def self.load_notetags_srs
  361.     groups = [$data_actors, $data_classes, $data_skills, $data_weapons,
  362.       $data_armors, $data_enemies, $data_states, $data_items]
  363.     for group in groups
  364.       for obj in group
  365.         next if obj.nil?
  366.         obj.load_notetags_srs
  367.       end
  368.     end
  369.   end
  370.  
  371. end # DataManager
  372.  
  373. #==============================================================================
  374. # ■ RPG::BaseItem
  375. #==============================================================================
  376.  
  377. class RPG::BaseItem
  378.  
  379.   #--------------------------------------------------------------------------
  380.   # public instance variables
  381.   #--------------------------------------------------------------------------
  382.   attr_accessor :cooldown_rate
  383.   attr_accessor :cooldown_lock
  384.   attr_accessor :warmup_rate
  385.  
  386.   #--------------------------------------------------------------------------
  387.   # common cache: load_notetags_srs
  388.   #--------------------------------------------------------------------------
  389.   def load_notetags_srs
  390.     @cooldown_rate = 1.0
  391.     @warmup_rate = 1.0
  392.     #---
  393.     self.note.split(/[\r\n]+/).each { |line|
  394.       case line
  395.       #---
  396.       when YEA::REGEXP::BASEITEM::COOLDOWN_RATE
  397.         @cooldown_rate = $1.to_i * 0.01
  398.       when YEA::REGEXP::BASEITEM::COOLDOWN_LOCK
  399.         @cooldown_lock = true
  400.       when YEA::REGEXP::BASEITEM::WARMUP_RATE
  401.         @warmup_rate = $1.to_i * 0.01
  402.       #---
  403.       end
  404.     } # self.note.split
  405.     #---
  406.   end
  407.  
  408. end # RPG::BaseItem
  409.  
  410. #==============================================================================
  411. # ■ RPG::Skill
  412. #==============================================================================
  413.  
  414. class RPG::Skill < RPG::UsableItem
  415.  
  416.   #--------------------------------------------------------------------------
  417.   # public instance variables
  418.   #--------------------------------------------------------------------------
  419.   attr_accessor :cooldown
  420.   attr_accessor :warmup
  421.   attr_accessor :limited_uses
  422.   attr_accessor :change_cooldown
  423.   attr_accessor :skill_cooldown
  424.   attr_accessor :restrict_any_switch
  425.   attr_accessor :restrict_all_switch
  426.   attr_accessor :restrict_eval
  427.  
  428.   #--------------------------------------------------------------------------
  429.   # common cache: load_notetags_srs
  430.   #--------------------------------------------------------------------------
  431.   def load_notetags_srs
  432.     @cooldown = 0
  433.     @warmup = 0
  434.     @limited_uses = 0
  435.     @change_cooldown = {}
  436.     @skill_cooldown = {}
  437.     @restrict_any_switch = []
  438.     @restrict_all_switch = []
  439.     @restrict_eval = ""
  440.     @restrict_eval_on = false
  441.     #---
  442.     self.note.split(/[\r\n]+/).each { |line|
  443.       case line
  444.       #---
  445.       when YEA::REGEXP::SKILL::COOLDOWN
  446.         @cooldown = $1.to_i
  447.       when YEA::REGEXP::SKILL::WARMUP
  448.         @warmup = $1.to_i
  449.       when YEA::REGEXP::SKILL::LIMITED_USES
  450.         @limited_uses = $1.to_i
  451.       #---
  452.       when YEA::REGEXP::SKILL::CHANGE_COOLDOWN
  453.         @change_cooldown[0] = $1.to_i
  454.       when YEA::REGEXP::SKILL::STYPE_COOLDOWN
  455.         @change_cooldown[$1.to_i] = $2.to_i
  456.       when YEA::REGEXP::SKILL::SKILL_COOLDOWN
  457.         @skill_cooldown[$1.to_i] = $2.to_i
  458.       #---
  459.       when YEA::REGEXP::SKILL::RESTRICT_IF_SWITCH
  460.         @restrict_any_switch.push($1.to_i)
  461.       when YEA::REGEXP::SKILL::RESTRICT_ANY_SWITCH
  462.         $1.scan(/\d+/).each { |num|
  463.         @restrict_any_switch.push(num.to_i) if num.to_i > 0 }
  464.       when YEA::REGEXP::SKILL::RESTRICT_ALL_SWITCH
  465.         $1.scan(/\d+/).each { |num|
  466.         @restrict_all_switch.push(num.to_i) if num.to_i > 0 }
  467.       #---
  468.       when YEA::REGEXP::SKILL::RESTRICT_EVAL_ON
  469.         @restrict_eval_on = true
  470.       when YEA::REGEXP::SKILL::RESTRICT_EVAL_OFF
  471.         @restrict_eval_off = true
  472.       else
  473.         @restrict_eval += line.to_s if @restrict_eval_on
  474.       #---
  475.       end
  476.     } # self.note.split
  477.     #---
  478.   end
  479.  
  480. end # RPG::Skill
  481.  
  482. #==============================================================================
  483. # ■ RPG::Item
  484. #==============================================================================
  485.  
  486. class RPG::Item < RPG::UsableItem
  487.  
  488.   #--------------------------------------------------------------------------
  489.   # public instance variables
  490.   #--------------------------------------------------------------------------
  491.   attr_accessor :change_cooldown
  492.   attr_accessor :skill_cooldown
  493.  
  494.   #--------------------------------------------------------------------------
  495.   # common cache: load_notetags_srs
  496.   #--------------------------------------------------------------------------
  497.   def load_notetags_srs
  498.     @change_cooldown = {}
  499.     @skill_cooldown = {}
  500.     #---
  501.     self.note.split(/[\r\n]+/).each { |line|
  502.       case line
  503.       #---
  504.       when YEA::REGEXP::ITEM::CHANGE_COOLDOWN
  505.         @change_cooldown[0] = $1.to_i
  506.       when YEA::REGEXP::ITEM::STYPE_COOLDOWN
  507.         @change_cooldown[$1.to_i] = $2.to_i
  508.       when YEA::REGEXP::ITEM::SKILL_COOLDOWN
  509.         @skill_cooldown[$1.to_i] = $2.to_i
  510.       #---
  511.       end
  512.     } # self.note.split
  513.     #---
  514.   end
  515.  
  516. end # RPG::Item
  517.  
  518. #==============================================================================
  519. # ■ Game_BattlerBase
  520. #==============================================================================
  521.  
  522. class Game_BattlerBase
  523.  
  524.   #--------------------------------------------------------------------------
  525.   # alias method: initialize
  526.   #--------------------------------------------------------------------------
  527.   alias game_battlerbase_initialize_srs initialize
  528.   def initialize
  529.     game_battlerbase_initialize_srs
  530.     reset_cooldowns
  531.     reset_times_used
  532.   end
  533.  
  534.   #--------------------------------------------------------------------------
  535.   # new method: reset_cooldowns
  536.   #--------------------------------------------------------------------------
  537.   def reset_cooldowns
  538.     @cooldown = {}
  539.   end
  540.  
  541.   #--------------------------------------------------------------------------
  542.   # new method: reset_times_used
  543.   #--------------------------------------------------------------------------
  544.   def reset_times_used
  545.     @times_used = {}
  546.   end
  547.  
  548.   #--------------------------------------------------------------------------
  549.   # alias method: skill_conditions_met?
  550.   #--------------------------------------------------------------------------
  551.   alias game_battlerbase_skill_conditions_met_srs skill_conditions_met?
  552.   def skill_conditions_met?(skill)
  553.     return false if skill_restriction?(skill)
  554.     return game_battlerbase_skill_conditions_met_srs(skill)
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # alias method: pay_skill_cost
  559.   #--------------------------------------------------------------------------
  560.   alias game_battlerbase_pay_skill_cost_srs pay_skill_cost
  561.   def pay_skill_cost(skill)
  562.     game_battlerbase_pay_skill_cost_srs(skill)
  563.     pay_skill_cooldown(skill)
  564.   end
  565.  
  566.   #--------------------------------------------------------------------------
  567.   # new method: skill_restriction?
  568.   #--------------------------------------------------------------------------
  569.   def skill_restriction?(skill)
  570.     if $game_party.in_battle
  571.       return true if cooldown?(skill) > 0
  572.       return true if warmup?(skill) > $game_troop.turn_count
  573.       return true if limit_restricted?(skill)
  574.     end
  575.     return true if switch_restricted?(skill)
  576.     return true if restrict_eval?(skill)
  577.     return false
  578.   end
  579.  
  580.   #--------------------------------------------------------------------------
  581.   # new method: cooldown?
  582.   #--------------------------------------------------------------------------
  583.   def cooldown?(skill)
  584.     skill = skill.id if skill.is_a?(RPG::Skill)
  585.     return @cooldown[skill].nil? ? 0 : @cooldown[skill]
  586.   end
  587.  
  588.   #--------------------------------------------------------------------------
  589.   # new method: warmup?(skill)
  590.   #--------------------------------------------------------------------------
  591.   def warmup?(skill)
  592.     skill = skill.id if skill.is_a?(RPG::Skill)
  593.     return [$data_skills[skill].warmup * wur, 0].max.to_i
  594.   end
  595.  
  596.   #--------------------------------------------------------------------------
  597.   # new method: limit_restricted?
  598.   #--------------------------------------------------------------------------
  599.   def limit_restricted?(skill)
  600.     return false if skill.limited_uses <= 0
  601.     return times_used?(skill) >= skill.limited_uses
  602.   end
  603.  
  604.   #--------------------------------------------------------------------------
  605.   # new method: times_used?
  606.   #--------------------------------------------------------------------------
  607.   def times_used?(skill)
  608.     skill = skill.id if skill.is_a?(RPG::Skill)
  609.     return @times_used[skill].nil? ? 0 : @times_used[skill]
  610.   end
  611.  
  612.   #--------------------------------------------------------------------------
  613.   # new method: update_times_used
  614.   #--------------------------------------------------------------------------
  615.   def update_times_used(skill)
  616.     skill = skill.id if skill.is_a?(RPG::Skill)
  617.     reset_times_used if @times_used.nil?
  618.     @times_used[skill] = 0 if @times_used[skill].nil?
  619.     @times_used[skill] += 1
  620.   end
  621.  
  622.   #--------------------------------------------------------------------------
  623.   # new method: cdr
  624.   #--------------------------------------------------------------------------
  625.   def cdr
  626.     n = 1.0
  627.     if actor?
  628.       n *= self.actor.cooldown_rate
  629.       n *= self.class.cooldown_rate
  630.       for equip in equips
  631.         next if equip.nil?
  632.         n *= equip.cooldown_rate
  633.       end
  634.     else
  635.       n *= self.enemy.cooldown_rate
  636.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  637.         n *= self.class.cooldown_rate
  638.       end
  639.     end
  640.     for state in states
  641.       next if state.nil?
  642.       n *= state.cooldown_rate
  643.     end
  644.     return n
  645.   end
  646.  
  647.   #--------------------------------------------------------------------------
  648.   # new method: pay_skill_cooldown
  649.   #--------------------------------------------------------------------------
  650.   def pay_skill_cooldown(skill)
  651.     return unless $game_party.in_battle
  652.     skill = skill.id if skill.is_a?(RPG::Skill)
  653.     set_cooldown(skill, $data_skills[skill].cooldown * cdr)
  654.   end
  655.  
  656.   #--------------------------------------------------------------------------
  657.   # new method: set_cooldown
  658.   #--------------------------------------------------------------------------
  659.   def set_cooldown(skill, amount = 0)
  660.     return unless $game_party.in_battle
  661.     skill = skill.id if skill.is_a?(RPG::Skill)
  662.     @cooldown[skill] = [amount, 0].max.to_i
  663.   end
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # new method: cooldown_lock?
  667.   #--------------------------------------------------------------------------
  668.   def cooldown_lock?
  669.     if actor?
  670.       return true if self.actor.cooldown_lock
  671.       return true if self.class.cooldown_lock
  672.       for equip in equips
  673.         next if equip.nil?
  674.         return true if equip.cooldown_lock
  675.       end
  676.     else
  677.       return true if self.enemy.cooldown_lock
  678.     end
  679.     for state in states
  680.       next if state.nil?
  681.       return true if state.cooldown_lock
  682.     end
  683.     return false
  684.   end
  685.  
  686.   #--------------------------------------------------------------------------
  687.   # new method: update_cooldowns
  688.   #--------------------------------------------------------------------------
  689.   def update_cooldowns(amount = -1, stype_id = 0, skill_id = 0)
  690.     return if cooldown_lock?
  691.     reset_cooldowns if @cooldown.nil?
  692.     for skill in skills
  693.       skill = $data_skills[skill] if !skill.is_a?(RPG::Skill)
  694.       next if stype_id != 0 && skill.stype_id != stype_id
  695.       next if skill_id != 0 && skill.id != skill_id
  696.       set_cooldown(skill, cooldown?(skill) + amount)
  697.     end
  698.   end
  699.  
  700.   #--------------------------------------------------------------------------
  701.   # new method: wur
  702.   #--------------------------------------------------------------------------
  703.   def wur
  704.     n = 1.0
  705.     if actor?
  706.       n *= self.actor.warmup_rate
  707.       n *= self.class.warmup_rate
  708.       for equip in equips
  709.         next if equip.nil?
  710.         n *= equip.warmup_rate
  711.       end
  712.     else
  713.       n *= self.enemy.warmup_rate
  714.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  715.         n *= self.class.warmup_rate
  716.       end
  717.     end
  718.     for state in states
  719.       next if state.nil?
  720.       n *= state.warmup_rate
  721.     end
  722.     return n
  723.   end
  724.  
  725.   #--------------------------------------------------------------------------
  726.   # new method: switch_restricted?
  727.   #--------------------------------------------------------------------------
  728.   def switch_restricted?(skill)
  729.     return true if restrict_any_switch?(skill)
  730.     return true if restrict_all_switch?(skill)
  731.     return false
  732.   end
  733.  
  734.   #--------------------------------------------------------------------------
  735.   # new method: restrict_any_switch?
  736.   #--------------------------------------------------------------------------
  737.   def restrict_any_switch?(skill)
  738.     for switch_id in skill.restrict_any_switch
  739.       return true if $game_switches[switch_id]
  740.     end
  741.     return false
  742.   end
  743.  
  744.   #--------------------------------------------------------------------------
  745.   # new method: restrict_all_switch?
  746.   #--------------------------------------------------------------------------
  747.   def restrict_all_switch?(skill)
  748.     return false if skill.restrict_all_switch == []
  749.     for switch_id in skill.restrict_all_switch
  750.       return false unless $game_switches[switch_id]
  751.     end
  752.     return true
  753.   end
  754.  
  755.   #--------------------------------------------------------------------------
  756.   # new method: restrict_eval?
  757.   #--------------------------------------------------------------------------
  758.   def restrict_eval?(skill)
  759.     return false if skill.restrict_eval == ""
  760.     return eval(skill.restrict_eval)
  761.   end
  762.  
  763. end # Game_BattlerBase
  764.  
  765. #==============================================================================
  766. # ■ Game_Battler
  767. #==============================================================================
  768.  
  769. class Game_Battler < Game_BattlerBase
  770.  
  771.   #--------------------------------------------------------------------------
  772.   # alias method: on_battle_start
  773.   #--------------------------------------------------------------------------
  774.   alias game_battler_on_battle_start_srs on_battle_start
  775.   def on_battle_start
  776.     game_battler_on_battle_start_srs
  777.     reset_cooldowns
  778.     reset_times_used
  779.   end
  780.  
  781.   #--------------------------------------------------------------------------
  782.   # alias method: on_battle_end
  783.   #--------------------------------------------------------------------------
  784.   alias game_battler_on_battle_end_srs on_battle_end
  785.   def on_battle_end
  786.     game_battler_on_battle_end_srs
  787.     reset_cooldowns
  788.     reset_times_used
  789.   end
  790.  
  791.   #--------------------------------------------------------------------------
  792.   # alias method: item_apply
  793.   #--------------------------------------------------------------------------
  794.   alias game_battler_item_apply_srs item_apply
  795.   def item_apply(user, item)
  796.     game_battler_item_apply_srs(user, item)
  797.     updated_limited_uses(user, item)
  798.   end
  799.  
  800.   #--------------------------------------------------------------------------
  801.   # new method: updated_limited_uses
  802.   #--------------------------------------------------------------------------
  803.   def updated_limited_uses(user, item)
  804.     return unless $game_party.in_battle
  805.     return if item.nil?
  806.     return unless item.is_a?(RPG::Skill)
  807.     user.update_times_used(item)
  808.   end
  809.  
  810.   #--------------------------------------------------------------------------
  811.   # alias method: item_user_effect
  812.   #--------------------------------------------------------------------------
  813.   alias game_battler_item_user_effect_srs item_user_effect
  814.   def item_user_effect(user, item)
  815.     game_battler_item_user_effect_srs(user, item)
  816.     apply_cooldown_changes(user, item)
  817.   end
  818.  
  819.   #--------------------------------------------------------------------------
  820.   # new method: apply_cooldown_changes
  821.   #--------------------------------------------------------------------------
  822.   def apply_cooldown_changes(user, item)
  823.     return unless $game_party.in_battle
  824.     return if item.nil?
  825.     #---
  826.     if item.change_cooldown != {}
  827.       for key in item.change_cooldown
  828.         stype_id = key[0]
  829.         update_cooldowns(item.change_cooldown[stype_id], stype_id)
  830.       end
  831.       @result.success = true
  832.     end
  833.     #---
  834.     if item.skill_cooldown != {}
  835.       for key in item.skill_cooldown
  836.         skill_id = key[0]
  837.         update_cooldowns(item.skill_cooldown[skill_id], 0, skill_id)
  838.       end
  839.       @result.success = true
  840.     end
  841.   end
  842.  
  843. end # Game_Battler
  844.  
  845. #==============================================================================
  846. # ■ Game_Enemy
  847. #==============================================================================
  848.  
  849. class Game_Enemy < Game_Battler
  850.  
  851.   #--------------------------------------------------------------------------
  852.   # new method: skills
  853.   #--------------------------------------------------------------------------
  854.   def skills
  855.     data = []
  856.     for action in enemy.actions
  857.       next if data.include?(action.skill_id)
  858.       data.push(action.skill_id)
  859.     end
  860.     return data
  861.   end
  862.  
  863. end # Game_Enemy
  864.  
  865. #==============================================================================
  866. # ■ Game_Unit
  867. #==============================================================================
  868.  
  869. class Game_Unit
  870.  
  871.   #--------------------------------------------------------------------------
  872.   # new method: update_restrictions
  873.   #--------------------------------------------------------------------------
  874.   def update_restrictions
  875.     for member in members; member.update_cooldowns; end
  876.   end
  877.  
  878. end # Game_Unit
  879.  
  880. #==============================================================================
  881. # ■ Window_Base
  882. #==============================================================================
  883.  
  884. class Window_Base < Window
  885.  
  886.   #--------------------------------------------------------------------------
  887.   # new methods: restrict_colours
  888.   #--------------------------------------------------------------------------
  889.   def cooldown_colour; text_color(YEA::SKILL_RESTRICT::COOLDOWN_COLOUR); end;
  890.   def warmup_colour; text_color(YEA::SKILL_RESTRICT::WARMUP_COLOUR); end;
  891.   def limited_colour; text_color(YEA::SKILL_RESTRICT::LIMITED_COLOUR); end;
  892.  
  893. end # Window_Base
  894.  
  895. #==============================================================================
  896. # ■ Window_SkillList
  897. #==============================================================================
  898.  
  899. class Window_SkillList < Window_Selectable
  900.  
  901.   #--------------------------------------------------------------------------
  902.   # alias method: draw_item
  903.   #--------------------------------------------------------------------------
  904.   alias window_skilllist_draw_item_srs draw_item
  905.   def draw_item(index)
  906.     if skill_restriction?(index)
  907.       draw_skill_restriction(index)
  908.     else
  909.       window_skilllist_draw_item_srs(index)
  910.     end
  911.   end
  912.  
  913.   #--------------------------------------------------------------------------
  914.   # new method: skill_restriction?
  915.   #--------------------------------------------------------------------------
  916.   def skill_restriction?(index)
  917.     skill = @data[index]
  918.     return false if @actor.nil?
  919.     return @actor.skill_restriction?(skill)
  920.   end
  921.  
  922.   #--------------------------------------------------------------------------
  923.   # new method: draw_item
  924.   #--------------------------------------------------------------------------
  925.   def draw_skill_restriction(index)
  926.     skill = @data[index]
  927.     rect = item_rect(index)
  928.     rect.width -= 4
  929.     draw_item_name(skill, rect.x, rect.y, enable?(skill))
  930.     if @actor.limit_restricted?(skill)
  931.       draw_skill_limited(rect, skill)
  932.     elsif @actor.cooldown?(skill) > 0
  933.       draw_skill_cooldown(rect, skill)
  934.     elsif warmup_restriction?(skill)
  935.       draw_skill_warmup(rect, skill)
  936.     else
  937.       draw_skill_cost(rect, skill)
  938.     end
  939.   end
  940.  
  941.   #--------------------------------------------------------------------------
  942.   # new method: draw_skill_limited
  943.   #--------------------------------------------------------------------------
  944.   def draw_skill_limited(rect, skill)
  945.     change_color(limited_colour, enable?(skill))
  946.     icon = Icon.limited
  947.     if icon > 0
  948.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  949.       rect.width -= 24
  950.     end
  951.     contents.font.size = YEA::SKILL_RESTRICT::LIMITED_SIZE
  952.     text = YEA::SKILL_RESTRICT::LIMITED_TEXT
  953.     draw_text(rect, text, 2)
  954.     reset_font_settings
  955.   end
  956.  
  957.   #--------------------------------------------------------------------------
  958.   # new method: draw_skill_cooldown
  959.   #--------------------------------------------------------------------------
  960.   def draw_skill_cooldown(rect, skill)
  961.     change_color(cooldown_colour, enable?(skill))
  962.     icon = Icon.cooldown
  963.     if icon > 0
  964.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  965.       rect.width -= 24
  966.     end
  967.     contents.font.size = YEA::SKILL_RESTRICT::COOLDOWN_SIZE
  968.     value = @actor.cooldown?(skill)
  969.     text = sprintf(YEA::SKILL_RESTRICT::COOLDOWN_SUFFIX, value.group)
  970.     draw_text(rect, text, 2)
  971.     reset_font_settings
  972.   end
  973.  
  974.   #--------------------------------------------------------------------------
  975.   # new method: warmup_restriction?
  976.   #--------------------------------------------------------------------------
  977.   def warmup_restriction?(skill)
  978.     return false unless $game_party.in_battle
  979.     return @actor.warmup?(skill) > $game_troop.turn_count
  980.   end
  981.  
  982.   #--------------------------------------------------------------------------
  983.   # new method: draw_skill_warmup
  984.   #--------------------------------------------------------------------------
  985.   def draw_skill_warmup(rect, skill)
  986.     change_color(warmup_colour, enable?(skill))
  987.     icon = Icon.warmup
  988.     if icon > 0
  989.       draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
  990.       rect.width -= 24
  991.     end
  992.     contents.font.size = YEA::SKILL_RESTRICT::WARMUP_SIZE
  993.     value = @actor.warmup?(skill) - $game_troop.turn_count
  994.     text = sprintf(YEA::SKILL_RESTRICT::WARMUP_SUFFIX, value.group)
  995.     draw_text(rect, text, 2)
  996.     reset_font_settings
  997.   end
  998.  
  999. end # Window_SkillList
  1000.  
  1001. #==============================================================================
  1002. # ■ Scene_Battle
  1003. #==============================================================================
  1004.  
  1005. class Scene_Battle < Scene_Base
  1006.  
  1007.   #--------------------------------------------------------------------------
  1008.   # alias method: turn_start
  1009.   #--------------------------------------------------------------------------
  1010.   alias scene_battle_turn_start_srs turn_start
  1011.   def turn_start
  1012.     $game_party.update_restrictions
  1013.     $game_troop.update_restrictions
  1014.     scene_battle_turn_start_srs
  1015.   end
  1016.  
  1017. end # Scene_Battle
  1018.  
  1019. #==============================================================================
  1020. #
  1021. # ▼ End of File
  1022. #
  1023. #==============================================================================


这是yanfly大佬的脚本里面有很多技能CD的方式
如果要更改CD(限伤害公式,数据库不知道应该是self=b user=a)
目标就是self.set_cooldown(技能ID,cooldown?(技能ID)空格(+-*/)1) 比如self.set_cooldown(1,cooldown?(1) +1)就是1号技能+1CD,第一个参数是减少ID的技能,第二个参数是重置为多少cooldown?(X)是调用了X号ID的冷却
攻击者就是把self改为user


LZ你太坑人了150经验,yanfly大佬的程度先达到吧,要CD的拿yanfly大佬的脚本,这位大佬还有很多脚本挺好用的
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 15:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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