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

Project1

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

[已经过期] 求该脚本用法及用途

[复制链接]

Lv2.观梦者

梦石
0
星屑
723
在线时间
530 小时
注册时间
2010-6-9
帖子
840
跳转到指定楼层
1
发表于 2014-5-8 22:43:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
试过了,但触发不了效果,翻译出来的东西我理解不了,求指点。
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Buff & State Manager v1.06
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-Buff&StateManager"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.23 - Compatibility Update: Doppelganger
  17. # 2012.01.11 - Compatibility Update: Field State Effects
  18. # 2012.01.09 - Bug Fixed: Remaining turns weren't drawn properly again.
  19. # 2012.01.07 - Bug Fixed: Remaining turns weren't drawn properly.
  20. # 2011.12.30 - Bug Fixed: Decimals are no longer shown on states turns.
  21. # 2011.12.28 - Added <state x turn: +y> for actors, classes, weapons, armours,
  22. #              enemies, and states.
  23. # 2011.12.27 - Started Script and Finished.
  24. #
  25. #==============================================================================
  26. # ▼ Introduction
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # This script alters some of the basic mechanics revolving behind states,
  29. # buffs, and debuffs that aren't adjustable within RPG Maker VX Ace by default
  30. # such as being able to affect the turns remaining on a state, buff, or debuff
  31. # without affecting anything else or even adjusting how many times a buff (or
  32. # debuff) can be applied to an actor.
  33. #
  34. #==============================================================================
  35. # ▼ Instructions
  36. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  37. # To install this script, open up your script editor and copy/paste this script
  38. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Actor Notetags - These notetags go in the actors notebox in the database.
  42. # -----------------------------------------------------------------------------
  43. # <max buff stat: +x>
  44. # <max buff stat: -x>
  45. # Increases or decreases the maximum times that particular stat can be buffed
  46. # by x. Note that the max increase here is still limited by the module constant
  47. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  48. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  49. #
  50. # <max debuff stat: +x>
  51. # <max debuff stat: -x>
  52. # Increases or decreases the maximum times that particular stat can be debuffed
  53. # by x. Note that the max decrease here is still limited by the module constant
  54. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  55. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  56. #
  57. # <state x turn: +y>
  58. # <state x turn: -y>
  59. # When the battler is affected by state x, additional modifiers are made to the
  60. # number of turns remaining for state x by y amount. The modifiers cannot
  61. # reduce turns to under 0.
  62. #
  63. # -----------------------------------------------------------------------------
  64. # Class Notetags - These notetags go in the class notebox in the database.
  65. # -----------------------------------------------------------------------------
  66. # <max buff stat: +x>
  67. # <max buff stat: -x>
  68. # Increases or decreases the maximum times that particular stat can be buffed
  69. # by x. Note that the max increase here is still limited by the module constant
  70. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  71. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  72. #
  73. # <max debuff stat: +x>
  74. # <max debuff stat: -x>
  75. # Increases or decreases the maximum times that particular stat can be debuffed
  76. # by x. Note that the max decrease here is still limited by the module constant
  77. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  78. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  79. #
  80. # <state x turn: +y>
  81. # <state x turn: -y>
  82. # When the battler is affected by state x, additional modifiers are made to the
  83. # number of turns remaining for state x by y amount. The modifiers cannot
  84. # reduce turns to under 0.
  85. #
  86. # -----------------------------------------------------------------------------
  87. # Skill Notetags - These notetags go in the skill notebox in the database.
  88. # -----------------------------------------------------------------------------
  89. # <state x turn: +y>
  90. # <state x turn: -y>
  91. # If the target is affected by state x, this will alter the turns remaining on
  92. # that state by y turns if the state can be removed by turns. If the state goes
  93. # under 0 turns, the state will be removed.
  94. #
  95. # <buff stat turn: +x>
  96. # <buff stat turn: -x>
  97. # If the target's stat is buffed, this will alter the turns remaining on that
  98. # buff by x turns. If the buff's remaining turns go under 0, the buff will be
  99. # removed.
  100. #
  101. # <debuff stat turn: +x>
  102. # <debuff stat turn: -x>
  103. # If the target's stat is debuffed, this will alter the turns remaining on that
  104. # debuff by x turns. If the debuff's remaining turns go under 0, the debuff
  105. # will be removed.
  106. #
  107. # -----------------------------------------------------------------------------
  108. # Item Notetags - These notetags go in the item notebox in the database.
  109. # -----------------------------------------------------------------------------
  110. # <state x turn: +y>
  111. # <state x turn: -y>
  112. # If the target is affected by state x, this will alter the turns remaining on
  113. # that state by y turns if the state can be removed by turns. If the state goes
  114. # under 0 turns, the state will be removed.
  115. #
  116. # <buff stat turn: +x>
  117. # <buff stat turn: -x>
  118. # If the target's stat is buffed, this will alter the turns remaining on that
  119. # buff by x turns. If the buff's remaining turns go under 0, the buff will be
  120. # removed.
  121. #
  122. # <debuff stat turn: +x>
  123. # <debuff stat turn: -x>
  124. # If the target's stat is debuffed, this will alter the turns remaining on that
  125. # debuff by x turns. If the debuff's remaining turns go under 0, the debuff
  126. # will be removed.
  127. #
  128. # -----------------------------------------------------------------------------
  129. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  130. # -----------------------------------------------------------------------------
  131. # <max buff stat: +x>
  132. # <max buff stat: -x>
  133. # Increases or decreases the maximum times that particular stat can be buffed
  134. # by x. Note that the max increase here is still limited by the module constant
  135. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  136. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  137. #
  138. # <max debuff stat: +x>
  139. # <max debuff stat: -x>
  140. # Increases or decreases the maximum times that particular stat can be debuffed
  141. # by x. Note that the max decrease here is still limited by the module constant
  142. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  143. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  144. #
  145. # <state x turn: +y>
  146. # <state x turn: -y>
  147. # When the battler is affected by state x, additional modifiers are made to the
  148. # number of turns remaining for state x by y amount. The modifiers cannot
  149. # reduce turns to under 0.
  150. #
  151. # -----------------------------------------------------------------------------
  152. # Armour Notetags - These notetags go in the armour notebox in the database.
  153. # -----------------------------------------------------------------------------
  154. # <max buff stat: +x>
  155. # <max buff stat: -x>
  156. # Increases or decreases the maximum times that particular stat can be buffed
  157. # by x. Note that the max increase here is still limited by the module constant
  158. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  159. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  160. #
  161. # <max debuff stat: +x>
  162. # <max debuff stat: -x>
  163. # Increases or decreases the maximum times that particular stat can be debuffed
  164. # by x. Note that the max decrease here is still limited by the module constant
  165. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  166. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  167. #
  168. # <state x turn: +y>
  169. # <state x turn: -y>
  170. # When the battler is affected by state x, additional modifiers are made to the
  171. # number of turns remaining for state x by y amount. The modifiers cannot
  172. # reduce turns to under 0.
  173. #
  174. # -----------------------------------------------------------------------------
  175. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  176. # -----------------------------------------------------------------------------
  177. # <max buff stat: +x>
  178. # <max buff stat: -x>
  179. # Increases or decreases the maximum times that particular stat can be buffed
  180. # by x. Note that the max increase here is still limited by the module constant
  181. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  182. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  183. #
  184. # <max debuff stat: +x>
  185. # <max debuff stat: -x>
  186. # Increases or decreases the maximum times that particular stat can be debuffed
  187. # by x. Note that the max decrease here is still limited by the module constant
  188. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  189. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  190. #
  191. # <state x turn: +y>
  192. # <state x turn: -y>
  193. # When the battler is affected by state x, additional modifiers are made to the
  194. # number of turns remaining for state x by y amount. The modifiers cannot
  195. # reduce turns to under 0.
  196. #
  197. # -----------------------------------------------------------------------------
  198. # State Notetags - These notetags go in the states notebox in the database.
  199. # -----------------------------------------------------------------------------
  200. # <max buff stat: +x>
  201. # <max buff stat: -x>
  202. # Increases or decreases the maximum times that particular stat can be buffed
  203. # by x. Note that the max increase here is still limited by the module constant
  204. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  205. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  206. #
  207. # <max debuff stat: +x>
  208. # <max debuff stat: -x>
  209. # Increases or decreases the maximum times that particular stat can be debuffed
  210. # by x. Note that the max decrease here is still limited by the module constant
  211. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  212. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  213. #
  214. # <reapply ignore>
  215. # If this state is cast on a battler with the state already applied, turns
  216. # remaining will not be reset nor will turns be added on.
  217. #
  218. # <reapply reset>
  219. # If this state is cast on a battler with the state already applied, the turns
  220. # will be reset to the default amount of turns the state normally starts with.
  221. #
  222. # <reapply total>
  223. # If this state is cast on a battler with the state already applied, the turns
  224. # will be added on to the current amount of turns remaining giving the battler
  225. # a total of the remaining turns with the default turns for the state.
  226. #
  227. # <state x turn: +y>
  228. # <state x turn: -y>
  229. # When the battler is affected by state x, additional modifiers are made to the
  230. # number of turns remaining for state x by y amount. The modifiers cannot
  231. # reduce turns to under 0.
  232. #
  233. #==============================================================================
  234. # ▼ Compatibility
  235. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  236. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  237. # it will run with RPG Maker VX without adjusting.
  238. #
  239. #==============================================================================
  240.  
  241. module YEA
  242.   module BUFF_STATE_MANAGER
  243.  
  244.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  245.     # - Draw Remaining Turns -
  246.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  247.     # This setting will cause the game to show the number of turns remaining
  248.     # for a state in battle (if the state will remove itself through turns).
  249.     # Adjust the settings below to change the font size and the y coordinate
  250.     # adjustment to where the turns remaining appear if you so desire.
  251.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  252.     SHOW_REMAINING_TURNS = true     # Show the turns remaining?
  253.     TURNS_REMAINING_SIZE = 18       # Font size used for turns remaining.
  254.     TURNS_REMAINING_Y    = -4       # Adjusts location of the text.
  255.  
  256.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  257.     # - Buff Settings -
  258.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  259.     # These settings adjust how buffs play out in your game and the way they
  260.     # modify a battler's stats such as the maximum times a stat can be buffed
  261.     # and the buff boost formula. Note that these maximums apply to both buffs
  262.     # and debuffs.
  263.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  264.     DEFAULT_BUFF_LIMIT = 4     # Normal times you can buff a stat. Default: 2
  265.     MAXIMUM_BUFF_LIMIT = 8     # Maximum times you can buff a stat. Default: 2
  266.  
  267.     # This is the formula used to apply the rate used for buffs and debuffs.
  268.     BUFF_BOOST_FORMULA = "buff_level(param_id) * 0.25 + 1.0"
  269.  
  270.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  271.     # - Reapplying State Settings -
  272.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  273.     # These settings adjust how the rules apply to states when they are
  274.     # reapplied onto an actor with the state already intact. If you wish to
  275.     # have specific states use different rules, use notetags to have them
  276.     # adjust turns differently.
  277.     #   0 - Ignored. Default VX setting.
  278.     #   1 - Turns reset back to existing turns. Default VX Ace Setting.
  279.     #   2 - Default turns added onto existing turns.
  280.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  281.     REAPPLY_STATE_RULES = 1
  282.  
  283.   end # BUFF_STATE_MANAGER
  284. end # YEA
  285.  
  286. #==============================================================================
  287. # ▼ Editting anything past this point may potentially result in causing
  288. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  289. # halitosis so edit at your own risk.
  290. #==============================================================================
  291.  
  292. module YEA
  293.   module REGEXP
  294.   module BASEITEM
  295.  
  296.     MAX_BUFF = /<(?:MAX_BUFF|max buff)[ ](.*):[ ]([\+\-]\d+)>/i
  297.     MAX_DEBUFF = /<(?:MAX_DEBUFF|max debuff)[ ](.*):[ ]([\+\-]\d+)>/i
  298.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  299.     STATE_REAPPLY_IGNORE = /<(?:REAPPLY_IGNORE|reapply ignore)>/i
  300.     STATE_REAPPLY_RESET = /<(?:REAPPLY_RESET|reapply reset)>/i
  301.     STATE_REAPPLY_TOTAL = /<(?:REAPPLY_TOTAL|reapply total)>/i
  302.  
  303.   end # BASEITEM
  304.   module USABLEITEM
  305.  
  306.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  307.     CHANGE_BUFF_TURN = /<(?:buff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  308.     CHANGE_DEBUFF_TURN = /<(?:debuff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  309.  
  310.   end # USABLEITEM
  311.   end # REGEXP
  312. end # YEA
  313.  
  314. #==============================================================================
  315. # ■ DataManager
  316. #==============================================================================
  317.  
  318. module DataManager
  319.  
  320.   #--------------------------------------------------------------------------
  321.   # alias method: load_database
  322.   #--------------------------------------------------------------------------
  323.   class <<self; alias load_database_bsm load_database; end
  324.   def self.load_database
  325.     load_database_bsm
  326.     load_notetags_bsm
  327.   end
  328.  
  329.   #--------------------------------------------------------------------------
  330.   # new method: load_notetags_bsm
  331.   #--------------------------------------------------------------------------
  332.   def self.load_notetags_bsm
  333.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  334.       $data_enemies, $data_states, $data_skills, $data_items]
  335.     for group in groups
  336.       for obj in group
  337.         next if obj.nil?
  338.         obj.load_notetags_bsm
  339.       end
  340.     end
  341.   end
  342.  
  343. end # DataManager
  344.  
  345. #==============================================================================
  346. # ■ RPG::BaseItem
  347. #==============================================================================
  348.  
  349. class RPG::BaseItem
  350.  
  351.   #--------------------------------------------------------------------------
  352.   # public instance variables
  353.   #--------------------------------------------------------------------------
  354.   attr_accessor :max_buff
  355.   attr_accessor :max_debuff
  356.   attr_accessor :change_state_turns
  357.   attr_accessor :state_reapply_rules
  358.  
  359.   #--------------------------------------------------------------------------
  360.   # common cache: load_notetags_bsm
  361.   #--------------------------------------------------------------------------
  362.   def load_notetags_bsm
  363.     @change_state_turns = {}
  364.     @max_buff = {
  365.       0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0 }
  366.     @max_debuff = {
  367.       0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0 }
  368.     if self.is_a?(RPG::State)
  369.       @state_reapply_rules = YEA::BUFF_STATE_MANAGER::REAPPLY_STATE_RULES
  370.     end
  371.     #---
  372.     self.note.split(/[\r\n]+/).each { |line|
  373.       case line
  374.       #---
  375.       when YEA::REGEXP::BASEITEM::MAX_BUFF
  376.         case $1.upcase
  377.         when "MAXHP", "MHP", "HP"
  378.           @max_buff[0] = $2.to_i
  379.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  380.           @max_buff[1] = $2.to_i
  381.         when "ATK"
  382.           @max_buff[2] = $2.to_i
  383.         when "DEF"
  384.           @max_buff[3] = $2.to_i
  385.         when "MAT", "INT", "SPI"
  386.           @max_buff[4] = $2.to_i
  387.         when "MDF", "RES"
  388.           @max_buff[5] = $2.to_i
  389.         when "AGI"
  390.           @max_buff[6] = $2.to_i
  391.         when "LUK"
  392.           @max_buff[7] = $2.to_i
  393.         when "ALL"
  394.           for i in 0...8; @max_buff[i] = $2.to_i; end
  395.         end
  396.       #---
  397.       when YEA::REGEXP::BASEITEM::MAX_DEBUFF
  398.         case $1.upcase
  399.         when "MAXHP", "MHP", "HP"
  400.           @max_debuff[0] = $2.to_i
  401.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  402.           @max_debuff[1] = $2.to_i
  403.         when "ATK"
  404.           @max_debuff[2] = $2.to_i
  405.         when "DEF"
  406.           @max_debuff[3] = $2.to_i
  407.         when "MAT", "INT", "SPI"
  408.           @max_debuff[4] = $2.to_i
  409.         when "MDF", "RES"
  410.           @max_debuff[5] = $2.to_i
  411.         when "AGI"
  412.           @max_debuff[6] = $2.to_i
  413.         when "LUK"
  414.           @max_debuff[7] = $2.to_i
  415.         when "ALL"
  416.           for i in 0...8; @max_debuff[i] = $2.to_i; end
  417.         end
  418.       #---
  419.       when YEA::REGEXP::BASEITEM::CHANGE_STATE_TURN
  420.         @change_state_turns[$1.to_i] = $2.to_i
  421.       #---
  422.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_IGNORE
  423.         next unless self.is_a?(RPG::State)
  424.         @state_reapply_rules = 0
  425.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_RESET
  426.         next unless self.is_a?(RPG::State)
  427.         @state_reapply_rules = 1
  428.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_TOTAL
  429.         next unless self.is_a?(RPG::State)
  430.         @state_reapply_rules = 2
  431.       #---
  432.       end
  433.     } # self.note.split
  434.     #---
  435.   end
  436.  
  437. end # RPG::BaseItem
  438.  
  439. #==============================================================================
  440. # ■ RPG::UsableItem
  441. #==============================================================================
  442.  
  443. class RPG::UsableItem < RPG::BaseItem
  444.  
  445.   #--------------------------------------------------------------------------
  446.   # public instance variables
  447.   #--------------------------------------------------------------------------
  448.   attr_accessor :change_state_turns
  449.   attr_accessor :change_buff_turns
  450.   attr_accessor :change_debuff_turns
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # common cache: load_notetags_bsm
  454.   #--------------------------------------------------------------------------
  455.   def load_notetags_bsm
  456.     @change_state_turns = {}
  457.     @change_buff_turns = {}
  458.     @change_debuff_turns = {}
  459.     #---
  460.     self.note.split(/[\r\n]+/).each { |line|
  461.       case line
  462.       #---
  463.       when YEA::REGEXP::USABLEITEM::CHANGE_STATE_TURN
  464.         @change_state_turns[$1.to_i] = $2.to_i
  465.       when YEA::REGEXP::USABLEITEM::CHANGE_BUFF_TURN
  466.         case $1.upcase
  467.         when "MAXHP", "MHP", "HP"
  468.           @change_buff_turns[0] = $2.to_i
  469.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  470.           @change_buff_turns[1] = $2.to_i
  471.         when "ATK"
  472.           @change_buff_turns[2] = $2.to_i
  473.         when "DEF"
  474.           @change_buff_turns[3] = $2.to_i
  475.         when "MAT", "INT", "SPI"
  476.           @change_buff_turns[4] = $2.to_i
  477.         when "MDF", "RES"
  478.           @change_buff_turns[5] = $2.to_i
  479.         when "AGI"
  480.           @change_buff_turns[6] = $2.to_i
  481.         when "LUK"
  482.           @change_buff_turns[7] = $2.to_i
  483.         when "ALL"
  484.           for i in 0...8; @change_buff_turns[i] = $2.to_i; end
  485.         end
  486.       when YEA::REGEXP::USABLEITEM::CHANGE_DEBUFF_TURN
  487.         case $1.upcase
  488.         when "MAXHP", "MHP", "HP"
  489.           @change_debuff_turns[0] = $2.to_i
  490.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  491.           @change_debuff_turns[1] = $2.to_i
  492.         when "ATK"
  493.           @change_debuff_turns[2] = $2.to_i
  494.         when "DEF"
  495.           @change_debuff_turns[3] = $2.to_i
  496.         when "MAT", "INT", "SPI"
  497.           @change_debuff_turns[4] = $2.to_i
  498.         when "MDF", "RES"
  499.           @change_debuff_turns[5] = $2.to_i
  500.         when "AGI"
  501.           @change_debuff_turns[6] = $2.to_i
  502.         when "LUK"
  503.           @change_debuff_turns[7] = $2.to_i
  504.         when "ALL"
  505.           for i in 0...8; @change_debuff_turns[i] = $2.to_i; end
  506.         end
  507.       end
  508.     } # self.note.split
  509.     #---
  510.   end
  511.  
  512. end # class RPG::UsableItem
  513.  
  514. #==============================================================================
  515. # ■ Game_BattlerBase
  516. #==============================================================================
  517.  
  518. class Game_BattlerBase
  519.  
  520.   #--------------------------------------------------------------------------
  521.   # overwrite method: param_buff_rate
  522.   #--------------------------------------------------------------------------
  523.   def param_buff_rate(param_id)
  524.     return eval(YEA::BUFF_STATE_MANAGER::BUFF_BOOST_FORMULA)
  525.   end
  526.  
  527.   #--------------------------------------------------------------------------
  528.   # new method: max_buff_limit
  529.   #--------------------------------------------------------------------------
  530.   def max_buff_limit(param_id)
  531.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  532.     if actor?
  533.       n += self.actor.max_buff[param_id]
  534.       n += self.class.max_buff[param_id]
  535.       for equip in equips
  536.         next if equip.nil?
  537.         n += equip.max_buff[param_id]
  538.       end
  539.     else
  540.       n += self.enemy.max_buff[param_id]
  541.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  542.         n += self.class.max_buff[param_id]
  543.       end
  544.     end
  545.     for state in states
  546.       next if state.nil?
  547.       n += state.max_buff[param_id]
  548.     end
  549.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  550.   end
  551.  
  552.   #--------------------------------------------------------------------------
  553.   # new method: max_debuff_limit
  554.   #--------------------------------------------------------------------------
  555.   def max_debuff_limit(param_id)
  556.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  557.     if actor?
  558.       n += self.actor.max_debuff[param_id]
  559.       n += self.class.max_debuff[param_id]
  560.       for equip in equips
  561.         next if equip.nil?
  562.         n += equip.max_debuff[param_id]
  563.       end
  564.     else
  565.       n += self.enemy.max_debuff[param_id]
  566.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  567.         n += self.class.max_debuff[param_id]
  568.       end
  569.     end
  570.     for state in states
  571.       next if state.nil?
  572.       n += state.max_debuff[param_id]
  573.     end
  574.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  575.   end
  576.  
  577.   #--------------------------------------------------------------------------
  578.   # overwrite method: buff_icon_index
  579.   #--------------------------------------------------------------------------
  580.   def buff_icon_index(buff_level, param_id)
  581.     if buff_level > 0
  582.       return ICON_BUFF_START + ([buff_level - 1, 1].min) * 8 + param_id
  583.     elsif buff_level < 0
  584.       return ICON_DEBUFF_START + ([-buff_level - 1, -1].max) * 8 + param_id
  585.     else
  586.       return 0
  587.     end
  588.   end
  589.  
  590.   #--------------------------------------------------------------------------
  591.   # new method: buff_turns
  592.   #--------------------------------------------------------------------------
  593.   def buff_turns(param_id)
  594.     return @buff_turns.include?(param_id) ? @buff_turns[param_id] : 0
  595.   end
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # new method: buff_level
  599.   #--------------------------------------------------------------------------
  600.   def buff_level(param_id)
  601.     return 0 if @buffs[param_id].nil?
  602.     buff_maximum = max_buff_limit(param_id)
  603.     debuff_maximum = max_debuff_limit(param_id)
  604.     return [[@buffs[param_id], buff_maximum].min, -debuff_maximum].max
  605.   end
  606.  
  607.   #--------------------------------------------------------------------------
  608.   # new method: buff_change_turns
  609.   #--------------------------------------------------------------------------
  610.   def buff_change_turns(param_id, value)
  611.     @buff_turns[param_id] = 0 if @buff_turns[param_id].nil?
  612.     @buff_turns[param_id] = [value, 0].max
  613.   end
  614.  
  615.   #--------------------------------------------------------------------------
  616.   # new method: state_turns
  617.   #--------------------------------------------------------------------------
  618.   def state_turns(state_id)
  619.     state_id = state_id.id if state_id.is_a?(RPG::State)
  620.     return @state_turns.include?(state_id) ? @state_turns[state_id] : 0
  621.   end
  622.  
  623.   #--------------------------------------------------------------------------
  624.   # new method: state_steps
  625.   #--------------------------------------------------------------------------
  626.   def state_steps(state_id)
  627.     state_id = state_id.id if state_id.is_a?(RPG::State)
  628.     return @state_steps.include?(state_id) ? @state_steps[state_id] : 0
  629.   end
  630.  
  631.   #--------------------------------------------------------------------------
  632.   # new method: state_change_turns
  633.   #--------------------------------------------------------------------------
  634.   def state_change_turns(state_id, value)
  635.     state_id = state_id.id if state_id.is_a?(RPG::State)
  636.     @state_turns[state_id] = 0 if @state_turns[state_id].nil?
  637.     @state_turns[state_id] = [value, 0].max
  638.   end
  639.  
  640.   #--------------------------------------------------------------------------
  641.   # new method: state_turn_mod
  642.   #--------------------------------------------------------------------------
  643.   def state_turn_mod(state_id)
  644.     return 0 if $data_states[state_id].nil?
  645.     state = $data_states[state_id]
  646.     n = state.min_turns + rand(1 + [state.max_turns - state.min_turns, 0].max)
  647.     if actor?
  648.       if self.actor.change_state_turns.include?(state_id)
  649.         n += self.actor.change_state_turns[state_id]
  650.       end
  651.       if self.class.change_state_turns.include?(state_id)
  652.         n += self.class.change_state_turns[state_id]
  653.       end
  654.       for equip in equips
  655.         next if equip.nil?
  656.         next unless equip.change_state_turns.include?(state_id)
  657.         n += equip.change_state_turns[state_id]
  658.       end
  659.     else
  660.       if self.enemy.change_state_turns.include?(state_id)
  661.         n += self.enemy.change_state_turns[state_id]
  662.       end
  663.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  664.         if self.class.change_state_turns.include?(state_id)
  665.           n += self.class.change_state_turns[state_id]
  666.         end
  667.       end
  668.     end
  669.     for state in states
  670.       next if state.nil?
  671.       next unless state.change_state_turns.include?(state_id)
  672.       n += state.change_state_turns[state_id]
  673.     end
  674.     return [n, 0].max
  675.   end
  676.  
  677. end # Game_BattlerBase
  678.  
  679. #==============================================================================
  680. # ■ Game_Battler
  681. #==============================================================================
  682.  
  683. class Game_Battler < Game_BattlerBase
  684.  
  685.   #--------------------------------------------------------------------------
  686.   # overwrite method: buff_max?
  687.   #--------------------------------------------------------------------------
  688.   def buff_max?(param_id)
  689.     return @buffs[param_id] == max_buff_limit(param_id)
  690.   end
  691.  
  692.   #--------------------------------------------------------------------------
  693.   # overwrite method: debuff_max?
  694.   #--------------------------------------------------------------------------
  695.   def debuff_max?(param_id)
  696.     return @buffs[param_id] == -max_debuff_limit(param_id)
  697.   end
  698.  
  699.   #--------------------------------------------------------------------------
  700.   # overwrite method: add_state
  701.   #--------------------------------------------------------------------------
  702.   def add_state(state_id)
  703.     return if $data_states[state_id].nil?
  704.     state_rules = $data_states[state_id].state_reapply_rules
  705.     return if state_rules == 0 && state?(state_id)
  706.     if state_addable?(state_id)
  707.       add_new_state(state_id) unless state?(state_id)
  708.       reset_state_counts(state_id) if state_rules == 1
  709.       total_state_counts(state_id) if state_rules == 2
  710.       @result.added_states.push(state_id).uniq!
  711.     end
  712.   end
  713.  
  714.   #--------------------------------------------------------------------------
  715.   # overwrite method: state_removed?
  716.   #--------------------------------------------------------------------------
  717.   def state_removed?(state_id)
  718.     return false
  719.   end
  720.  
  721.   #--------------------------------------------------------------------------
  722.   # overwrite method: reset_state_counts
  723.   #--------------------------------------------------------------------------
  724.   def reset_state_counts(state_id)
  725.     state = $data_states[state_id]
  726.     @state_turns[state_id] = state_turn_mod(state_id)
  727.     @state_steps[state_id] = state.steps_to_remove
  728.   end
  729.  
  730.   #--------------------------------------------------------------------------
  731.   # new method: total_state_counts
  732.   #--------------------------------------------------------------------------
  733.   def total_state_counts(state_id)
  734.     state = $data_states[state_id]
  735.     value = state_turn_mod(state_id)
  736.     state_change_turns(state_id, value + state_turns(state_id))
  737.   end
  738.  
  739.   #--------------------------------------------------------------------------
  740.   # alias method: item_user_effect
  741.   #--------------------------------------------------------------------------
  742.   alias game_battler_item_user_effect_bsm item_user_effect
  743.   def item_user_effect(user, item)
  744.     game_battler_item_user_effect_bsm(user, item)
  745.     apply_state_turn_changes(user, item)
  746.     apply_buff_turn_changes(user, item)
  747.     apply_debuff_turn_changes(user, item)
  748.   end
  749.  
  750.   #--------------------------------------------------------------------------
  751.   # new method: apply_state_turn_changes
  752.   #--------------------------------------------------------------------------
  753.   def apply_state_turn_changes(user, item)
  754.     return if item.nil?
  755.     return unless $game_party.in_battle
  756.     for key in item.change_state_turns
  757.       state_id = key[0]
  758.       next if field_state?(state_id)
  759.       next unless state?(state_id)
  760.       next unless $data_states[state_id].auto_removal_timing > 0
  761.       state_change_turns(state_id, key[1] + state_turns(state_id))
  762.       remove_state(state_id) if state_turns(state_id) <= 0
  763.       @result.success = true
  764.     end
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # new method: field_state?
  769.   #--------------------------------------------------------------------------
  770.   def field_state?(state_id)
  771.     return false unless $imported["YEA-FieldStateEffects"]
  772.     return false unless $game_party.in_battle
  773.     return false unless SceneManager.scene_is?(Scene_Battle)
  774.     return BattleManager.field_state?(state_id)
  775.   end
  776.  
  777.   #--------------------------------------------------------------------------
  778.   # new method: apply_buff_turn_changes
  779.   #--------------------------------------------------------------------------
  780.   def apply_buff_turn_changes(user, item)
  781.     return if item.nil?
  782.     return unless $game_party.in_battle
  783.     for key in item.change_buff_turns
  784.       param_id = key[0]
  785.       next unless buff?(param_id)
  786.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  787.       remove_buff(param_id) if buff_turns(param_id) < 0
  788.       @result.success = true
  789.     end
  790.   end
  791.  
  792.   #--------------------------------------------------------------------------
  793.   # new method: apply_debuff_turn_changes
  794.   #--------------------------------------------------------------------------
  795.   def apply_debuff_turn_changes(user, item)
  796.     return if item.nil?
  797.     return unless $game_party.in_battle
  798.     for key in item.change_debuff_turns
  799.       param_id = key[0]
  800.       next unless debuff?(param_id)
  801.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  802.       remove_buff(param_id) if buff_turns(param_id) < 0
  803.       @result.success = true
  804.     end
  805.   end
  806.  
  807. end # Game_Battler
  808.  
  809. #==============================================================================
  810. # ■ Window_Base
  811. #==============================================================================
  812.  
  813. class Window_Base < Window
  814.  
  815.   #--------------------------------------------------------------------------
  816.   # alias method: draw_actor_icons
  817.   #--------------------------------------------------------------------------
  818.   alias window_base_draw_actor_icons_bsm draw_actor_icons
  819.   def draw_actor_icons(actor, dx, dy, dw = 96)
  820.     window_base_draw_actor_icons_bsm(actor, dx, dy, dw)
  821.     draw_actor_icon_turns(actor, dx, dy, dw)
  822.   end
  823.  
  824.   #--------------------------------------------------------------------------
  825.   # new method: draw_actor_icon_turns
  826.   #--------------------------------------------------------------------------
  827.   def draw_actor_icon_turns(actor, dx, dy, dw)
  828.     return unless YEA::BUFF_STATE_MANAGER::SHOW_REMAINING_TURNS
  829.     return unless SceneManager.scene_is?(Scene_Battle)
  830.     reset_font_settings
  831.     contents.font.out_color.alpha = 255
  832.     contents.font.bold = true
  833.     contents.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE
  834.     dy += YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y
  835.     #---
  836.     for state in actor.states
  837.       break if dx + 24 > dw + dx
  838.       next if state.icon_index <= 0
  839.       turns = actor.state_turns(state.id).to_i
  840.       if $imported["YEA-FieldStateEffects"] &&
  841.       BattleManager.field_state?(state.id)
  842.         turns = BattleManager.field_state_turns(state.id)
  843.       end
  844.       if state.auto_removal_timing > 0 && turns < 100
  845.         draw_text(dx, dy, 24, line_height, turns, 2)
  846.       end
  847.       dx += 24
  848.     end
  849.     #---
  850.     for i in 0...8
  851.       break if dx + 24 > dx + dw
  852.       next if actor.buff_icon_index(actor.buff_level(i), i) == 0
  853.       turns = actor.buff_turns(i).to_i
  854.       draw_text(dx, dy, 24, line_height, turns, 2) if turns < 100
  855.       dx += 24
  856.     end
  857.     #---
  858.     contents.font.out_color = Font.default_out_color
  859.     reset_font_settings
  860.   end
  861.  
  862. end # Window_Base
  863.  
  864. #==============================================================================
  865. #
  866. # ▼ End of File
  867. #
  868. #==============================================================================
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-12-1 04:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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