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

Project1

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

[已经解决] 脚本错误

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
280 小时
注册时间
2011-7-22
帖子
24
跳转到指定楼层
1
发表于 2014-10-6 12:31:30 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 904109589 于 2014-10-6 13:28 编辑

貌似是状态的附加上有问题吧,该怎么解决?
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Buff & State Manager v1.07
  4. # -- Last Updated: 2012.01.26
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-Buff&StateManager"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.26 - Bug Fixed: Remaining turns aren't drawn in excess.
  15. # 2012.01.23 - Compatibility Update: Doppelganger
  16. # 2012.01.11 - Compatibility Update: Field State Effects
  17. # 2012.01.09 - Bug Fixed: Remaining turns weren't drawn properly again.
  18. # 2012.01.07 - Bug Fixed: Remaining turns weren't drawn properly.
  19. # 2011.12.30 - Bug Fixed: Decimals are no longer shown on states turns.
  20. # 2011.12.28 - Added <state x turn: +y> for actors, classes, weapons, armours,
  21. #              enemies, and states.
  22. # 2011.12.27 - Started Script and Finished.
  23. #
  24. #==============================================================================
  25. # ▼ Introduction
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # This script alters some of the basic mechanics revolving behind states,
  28. # buffs, and debuffs that aren't adjustable within RPG Maker VX Ace by default
  29. # such as being able to affect the turns remaining on a state, buff, or debuff
  30. # without affecting anything else or even adjusting how many times a buff (or
  31. # debuff) can be applied to an actor.
  32. #
  33. #==============================================================================
  34. # ▼ Instructions
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # To install this script, open up your script editor and copy/paste this script
  37. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  38. #
  39. # -----------------------------------------------------------------------------
  40. # Actor Notetags - These notetags go in the actors notebox in the database.
  41. # -----------------------------------------------------------------------------
  42. # <max buff stat: +x>
  43. # <max buff stat: -x>
  44. # Increases or decreases the maximum times that particular stat can be buffed
  45. # by x. Note that the max increase here is still limited by the module constant
  46. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  47. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  48. #
  49. # <max debuff stat: +x>
  50. # <max debuff stat: -x>
  51. # Increases or decreases the maximum times that particular stat can be debuffed
  52. # by x. Note that the max decrease here is still limited by the module constant
  53. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  54. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  55. #
  56. # <state x turn: +y>
  57. # <state x turn: -y>
  58. # When the battler is affected by state x, additional modifiers are made to the
  59. # number of turns remaining for state x by y amount. The modifiers cannot
  60. # reduce turns to under 0.
  61. #
  62. # -----------------------------------------------------------------------------
  63. # Class Notetags - These notetags go in the class notebox in the database.
  64. # -----------------------------------------------------------------------------
  65. # <max buff stat: +x>
  66. # <max buff stat: -x>
  67. # Increases or decreases the maximum times that particular stat can be buffed
  68. # by x. Note that the max increase here is still limited by the module constant
  69. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  70. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  71. #
  72. # <max debuff stat: +x>
  73. # <max debuff stat: -x>
  74. # Increases or decreases the maximum times that particular stat can be debuffed
  75. # by x. Note that the max decrease here is still limited by the module constant
  76. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  77. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  78. #
  79. # <state x turn: +y>
  80. # <state x turn: -y>
  81. # When the battler is affected by state x, additional modifiers are made to the
  82. # number of turns remaining for state x by y amount. The modifiers cannot
  83. # reduce turns to under 0.
  84. #
  85. # -----------------------------------------------------------------------------
  86. # Skill Notetags - These notetags go in the skill notebox in the database.
  87. # -----------------------------------------------------------------------------
  88. # <state x turn: +y>
  89. # <state x turn: -y>
  90. # If the target is affected by state x, this will alter the turns remaining on
  91. # that state by y turns if the state can be removed by turns. If the state goes
  92. # under 0 turns, the state will be removed.
  93. #
  94. # <buff stat turn: +x>
  95. # <buff stat turn: -x>
  96. # If the target's stat is buffed, this will alter the turns remaining on that
  97. # buff by x turns. If the buff's remaining turns go under 0, the buff will be
  98. # removed.
  99. #
  100. # <debuff stat turn: +x>
  101. # <debuff stat turn: -x>
  102. # If the target's stat is debuffed, this will alter the turns remaining on that
  103. # debuff by x turns. If the debuff's remaining turns go under 0, the debuff
  104. # will be removed.
  105. #
  106. # -----------------------------------------------------------------------------
  107. # Item Notetags - These notetags go in the item notebox in the database.
  108. # -----------------------------------------------------------------------------
  109. # <state x turn: +y>
  110. # <state x turn: -y>
  111. # If the target is affected by state x, this will alter the turns remaining on
  112. # that state by y turns if the state can be removed by turns. If the state goes
  113. # under 0 turns, the state will be removed.
  114. #
  115. # <buff stat turn: +x>
  116. # <buff stat turn: -x>
  117. # If the target's stat is buffed, this will alter the turns remaining on that
  118. # buff by x turns. If the buff's remaining turns go under 0, the buff will be
  119. # removed.
  120. #
  121. # <debuff stat turn: +x>
  122. # <debuff stat turn: -x>
  123. # If the target's stat is debuffed, this will alter the turns remaining on that
  124. # debuff by x turns. If the debuff's remaining turns go under 0, the debuff
  125. # will be removed.
  126. #
  127. # -----------------------------------------------------------------------------
  128. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  129. # -----------------------------------------------------------------------------
  130. # <max buff stat: +x>
  131. # <max buff stat: -x>
  132. # Increases or decreases the maximum times that particular stat can be buffed
  133. # by x. Note that the max increase here is still limited by the module constant
  134. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  135. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  136. #
  137. # <max debuff stat: +x>
  138. # <max debuff stat: -x>
  139. # Increases or decreases the maximum times that particular stat can be debuffed
  140. # by x. Note that the max decrease here is still limited by the module constant
  141. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  142. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  143. #
  144. # <state x turn: +y>
  145. # <state x turn: -y>
  146. # When the battler is affected by state x, additional modifiers are made to the
  147. # number of turns remaining for state x by y amount. The modifiers cannot
  148. # reduce turns to under 0.
  149. #
  150. # -----------------------------------------------------------------------------
  151. # Armour Notetags - These notetags go in the armour notebox in the database.
  152. # -----------------------------------------------------------------------------
  153. # <max buff stat: +x>
  154. # <max buff stat: -x>
  155. # Increases or decreases the maximum times that particular stat can be buffed
  156. # by x. Note that the max increase here is still limited by the module constant
  157. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  158. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  159. #
  160. # <max debuff stat: +x>
  161. # <max debuff stat: -x>
  162. # Increases or decreases the maximum times that particular stat can be debuffed
  163. # by x. Note that the max decrease here is still limited by the module constant
  164. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  165. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  166. #
  167. # <state x turn: +y>
  168. # <state x turn: -y>
  169. # When the battler is affected by state x, additional modifiers are made to the
  170. # number of turns remaining for state x by y amount. The modifiers cannot
  171. # reduce turns to under 0.
  172. #
  173. # -----------------------------------------------------------------------------
  174. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  175. # -----------------------------------------------------------------------------
  176. # <max buff stat: +x>
  177. # <max buff stat: -x>
  178. # Increases or decreases the maximum times that particular stat can be buffed
  179. # by x. Note that the max increase here is still limited by the module constant
  180. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  181. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  182. #
  183. # <max debuff stat: +x>
  184. # <max debuff stat: -x>
  185. # Increases or decreases the maximum times that particular stat can be debuffed
  186. # by x. Note that the max decrease here is still limited by the module constant
  187. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  188. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  189. #
  190. # <state x turn: +y>
  191. # <state x turn: -y>
  192. # When the battler is affected by state x, additional modifiers are made to the
  193. # number of turns remaining for state x by y amount. The modifiers cannot
  194. # reduce turns to under 0.
  195. #
  196. # -----------------------------------------------------------------------------
  197. # State Notetags - These notetags go in the states notebox in the database.
  198. # -----------------------------------------------------------------------------
  199. # <max buff stat: +x>
  200. # <max buff stat: -x>
  201. # Increases or decreases the maximum times that particular stat can be buffed
  202. # by x. Note that the max increase here is still limited by the module constant
  203. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  204. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  205. #
  206. # <max debuff stat: +x>
  207. # <max debuff stat: -x>
  208. # Increases or decreases the maximum times that particular stat can be debuffed
  209. # by x. Note that the max decrease here is still limited by the module constant
  210. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  211. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  212. #
  213. # <reapply ignore>
  214. # If this state is cast on a battler with the state already applied, turns
  215. # remaining will not be reset nor will turns be added on.
  216. #
  217. # <reapply reset>
  218. # If this state is cast on a battler with the state already applied, the turns
  219. # will be reset to the default amount of turns the state normally starts with.
  220. #
  221. # <reapply total>
  222. # If this state is cast on a battler with the state already applied, the turns
  223. # will be added on to the current amount of turns remaining giving the battler
  224. # a total of the remaining turns with the default turns for the state.
  225. #
  226. # <state x turn: +y>
  227. # <state x turn: -y>
  228. # When the battler is affected by state x, additional modifiers are made to the
  229. # number of turns remaining for state x by y amount. The modifiers cannot
  230. # reduce turns to under 0.
  231. #
  232. #==============================================================================
  233. # ▼ Compatibility
  234. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  235. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  236. # it will run with RPG Maker VX without adjusting.
  237. #
  238. #==============================================================================

  239. module YEA
  240.   module BUFF_STATE_MANAGER
  241.    
  242.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  243.     # - Draw Remaining Turns -
  244.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  245.     # This setting will cause the game to show the number of turns remaining
  246.     # for a state in battle (if the state will remove itself through turns).
  247.     # Adjust the settings below to change the font size and the y coordinate
  248.     # adjustment to where the turns remaining appear if you so desire.
  249.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  250.     SHOW_REMAINING_TURNS = true     # Show the turns remaining?
  251.     TURNS_REMAINING_SIZE = 10       # Font size used for turns remaining.
  252.     TURNS_REMAINING_Y    = -4       # Adjusts location of the text.
  253.    
  254.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  255.     # - Buff Settings -
  256.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  257.     # These settings adjust how buffs play out in your game and the way they
  258.     # modify a battler's stats such as the maximum times a stat can be buffed
  259.     # and the buff boost formula. Note that these maximums apply to both buffs
  260.     # and debuffs.
  261.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  262.     DEFAULT_BUFF_LIMIT = 2     # Normal times you can buff a stat. Default: 2
  263.     MAXIMUM_BUFF_LIMIT = 2     # Maximum times you can buff a stat. Default: 2
  264.    
  265.     # This is the formula used to apply the rate used for buffs and debuffs.
  266.     BUFF_BOOST_FORMULA = "buff_level(param_id) * 0.25 + 1.0"
  267.    
  268.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  269.     # - Reapplying State Settings -
  270.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  271.     # These settings adjust how the rules apply to states when they are
  272.     # reapplied onto an actor with the state already intact. If you wish to
  273.     # have specific states use different rules, use notetags to have them
  274.     # adjust turns differently.
  275.     #   0 - Ignored. Default VX setting.
  276.     #   1 - Turns reset back to existing turns. Default VX Ace Setting.
  277.     #   2 - Default turns added onto existing turns.
  278.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  279.     REAPPLY_STATE_RULES = 1
  280.    
  281.   end # BUFF_STATE_MANAGER
  282. end # YEA

  283. #==============================================================================
  284. # ▼ Editting anything past this point may potentially result in causing
  285. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  286. # halitosis so edit at your own risk.
  287. #==============================================================================

  288. module YEA
  289.   module REGEXP
  290.   module BASEITEM
  291.    
  292.     MAX_BUFF = /<(?:MAX_BUFF|max buff)[ ](.*):[ ]([\+\-]\d+)>/i
  293.     MAX_DEBUFF = /<(?:MAX_DEBUFF|max debuff)[ ](.*):[ ]([\+\-]\d+)>/i
  294.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  295.     STATE_REAPPLY_IGNORE = /<(?:REAPPLY_IGNORE|reapply ignore)>/i
  296.     STATE_REAPPLY_RESET = /<(?:REAPPLY_RESET|reapply reset)>/i
  297.     STATE_REAPPLY_TOTAL = /<(?:REAPPLY_TOTAL|reapply total)>/i
  298.    
  299.   end # BASEITEM
  300.   module USABLEITEM
  301.    
  302.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  303.     CHANGE_BUFF_TURN = /<(?:buff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  304.     CHANGE_DEBUFF_TURN = /<(?:debuff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  305.    
  306.   end # USABLEITEM
  307.   end # REGEXP
  308. end # YEA

  309. #==============================================================================
  310. # ■ DataManager
  311. #==============================================================================

  312. module DataManager
  313.   
  314.   #--------------------------------------------------------------------------
  315.   # alias method: load_database
  316.   #--------------------------------------------------------------------------
  317.   class <<self; alias load_database_bsm load_database; end
  318.   def self.load_database
  319.     load_database_bsm
  320.     load_notetags_bsm
  321.   end
  322.   
  323.   #--------------------------------------------------------------------------
  324.   # new method: load_notetags_bsm
  325.   #--------------------------------------------------------------------------
  326.   def self.load_notetags_bsm
  327.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  328.       $data_enemies, $data_states, $data_skills, $data_items]
  329.     for group in groups
  330.       for obj in group
  331.         next if obj.nil?
  332.         obj.load_notetags_bsm
  333.       end
  334.     end
  335.   end
  336.   
  337. end # DataManager

  338. #==============================================================================
  339. # ■ RPG::BaseItem
  340. #==============================================================================

  341. class RPG::BaseItem
  342.   
  343.   #--------------------------------------------------------------------------
  344.   # public instance variables
  345.   #--------------------------------------------------------------------------
  346.   attr_accessor :max_buff
  347.   attr_accessor :max_debuff
  348.   attr_accessor :change_state_turns
  349.   attr_accessor :state_reapply_rules
  350.   
  351.   #--------------------------------------------------------------------------
  352.   # common cache: load_notetags_bsm
  353.   #--------------------------------------------------------------------------
  354.   def load_notetags_bsm
  355.     @change_state_turns = {}
  356.     @max_buff = {
  357.       0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0 }
  358.     @max_debuff = {
  359.       0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0 }
  360.     if self.is_a?(RPG::State)
  361.       @state_reapply_rules = YEA::BUFF_STATE_MANAGER::REAPPLY_STATE_RULES
  362.     end
  363.     #---
  364.     self.note.split(/[\r\n]+/).each { |line|
  365.       case line
  366.       #---
  367.       when YEA::REGEXP::BASEITEM::MAX_BUFF
  368.         case $1.upcase
  369.         when "MAXHP", "MHP", "HP"
  370.           @max_buff[0] = $2.to_i
  371.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  372.           @max_buff[1] = $2.to_i
  373.         when "ATK"
  374.           @max_buff[2] = $2.to_i
  375.         when "DEF"
  376.           @max_buff[3] = $2.to_i
  377.         when "MAT", "INT", "SPI"
  378.           @max_buff[4] = $2.to_i
  379.         when "MDF", "RES"
  380.           @max_buff[5] = $2.to_i
  381.         when "AGI"
  382.           @max_buff[6] = $2.to_i
  383.         when "LUK"
  384.           @max_buff[7] = $2.to_i
  385.         when "ALL"
  386.           for i in 0...8; @max_buff[i] = $2.to_i; end
  387.         end
  388.       #---
  389.       when YEA::REGEXP::BASEITEM::MAX_DEBUFF
  390.         case $1.upcase
  391.         when "MAXHP", "MHP", "HP"
  392.           @max_debuff[0] = $2.to_i
  393.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  394.           @max_debuff[1] = $2.to_i
  395.         when "ATK"
  396.           @max_debuff[2] = $2.to_i
  397.         when "DEF"
  398.           @max_debuff[3] = $2.to_i
  399.         when "MAT", "INT", "SPI"
  400.           @max_debuff[4] = $2.to_i
  401.         when "MDF", "RES"
  402.           @max_debuff[5] = $2.to_i
  403.         when "AGI"
  404.           @max_debuff[6] = $2.to_i
  405.         when "LUK"
  406.           @max_debuff[7] = $2.to_i
  407.         when "ALL"
  408.           for i in 0...8; @max_debuff[i] = $2.to_i; end
  409.         end
  410.       #---
  411.       when YEA::REGEXP::BASEITEM::CHANGE_STATE_TURN
  412.         @change_state_turns[$1.to_i] = $2.to_i
  413.       #---
  414.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_IGNORE
  415.         next unless self.is_a?(RPG::State)
  416.         @state_reapply_rules = 0
  417.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_RESET
  418.         next unless self.is_a?(RPG::State)
  419.         @state_reapply_rules = 1
  420.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_TOTAL
  421.         next unless self.is_a?(RPG::State)
  422.         @state_reapply_rules = 2
  423.       #---
  424.       end
  425.     } # self.note.split
  426.     #---
  427.   end
  428.   
  429. end # RPG::BaseItem

  430. #==============================================================================
  431. # ■ RPG::UsableItem
  432. #==============================================================================

  433. class RPG::UsableItem < RPG::BaseItem
  434.   
  435.   #--------------------------------------------------------------------------
  436.   # public instance variables
  437.   #--------------------------------------------------------------------------
  438.   attr_accessor :change_state_turns
  439.   attr_accessor :change_buff_turns
  440.   attr_accessor :change_debuff_turns
  441.   
  442.   #--------------------------------------------------------------------------
  443.   # common cache: load_notetags_bsm
  444.   #--------------------------------------------------------------------------
  445.   def load_notetags_bsm
  446.     @change_state_turns = {}
  447.     @change_buff_turns = {}
  448.     @change_debuff_turns = {}
  449.     #---
  450.     self.note.split(/[\r\n]+/).each { |line|
  451.       case line
  452.       #---
  453.       when YEA::REGEXP::USABLEITEM::CHANGE_STATE_TURN
  454.         @change_state_turns[$1.to_i] = $2.to_i
  455.       when YEA::REGEXP::USABLEITEM::CHANGE_BUFF_TURN
  456.         case $1.upcase
  457.         when "MAXHP", "MHP", "HP"
  458.           @change_buff_turns[0] = $2.to_i
  459.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  460.           @change_buff_turns[1] = $2.to_i
  461.         when "ATK"
  462.           @change_buff_turns[2] = $2.to_i
  463.         when "DEF"
  464.           @change_buff_turns[3] = $2.to_i
  465.         when "MAT", "INT", "SPI"
  466.           @change_buff_turns[4] = $2.to_i
  467.         when "MDF", "RES"
  468.           @change_buff_turns[5] = $2.to_i
  469.         when "AGI"
  470.           @change_buff_turns[6] = $2.to_i
  471.         when "LUK"
  472.           @change_buff_turns[7] = $2.to_i
  473.         when "ALL"
  474.           for i in 0...8; @change_buff_turns[i] = $2.to_i; end
  475.         end
  476.       when YEA::REGEXP::USABLEITEM::CHANGE_DEBUFF_TURN
  477.         case $1.upcase
  478.         when "MAXHP", "MHP", "HP"
  479.           @change_debuff_turns[0] = $2.to_i
  480.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  481.           @change_debuff_turns[1] = $2.to_i
  482.         when "ATK"
  483.           @change_debuff_turns[2] = $2.to_i
  484.         when "DEF"
  485.           @change_debuff_turns[3] = $2.to_i
  486.         when "MAT", "INT", "SPI"
  487.           @change_debuff_turns[4] = $2.to_i
  488.         when "MDF", "RES"
  489.           @change_debuff_turns[5] = $2.to_i
  490.         when "AGI"
  491.           @change_debuff_turns[6] = $2.to_i
  492.         when "LUK"
  493.           @change_debuff_turns[7] = $2.to_i
  494.         when "ALL"
  495.           for i in 0...8; @change_debuff_turns[i] = $2.to_i; end
  496.         end
  497.       end
  498.     } # self.note.split
  499.     #---
  500.   end
  501.   
  502. end # class RPG::UsableItem

  503. #==============================================================================
  504. # ■ Game_BattlerBase
  505. #==============================================================================

  506. class Game_BattlerBase
  507.   
  508.   #--------------------------------------------------------------------------
  509.   # overwrite method: param_buff_rate
  510.   #--------------------------------------------------------------------------
  511.   def param_buff_rate(param_id)
  512.     return eval(YEA::BUFF_STATE_MANAGER::BUFF_BOOST_FORMULA)
  513.   end
  514.   
  515.   #--------------------------------------------------------------------------
  516.   # new method: max_buff_limit
  517.   #--------------------------------------------------------------------------
  518.   def max_buff_limit(param_id)
  519.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  520.     if actor?
  521.       n += self.actor.max_buff[param_id]
  522.       n += self.class.max_buff[param_id]
  523.       for equip in equips
  524.         next if equip.nil?
  525.         n += equip.max_buff[param_id]
  526.       end
  527.     else
  528.       n += self.enemy.max_buff[param_id]
  529.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  530.         n += self.class.max_buff[param_id]
  531.       end
  532.     end
  533.     for state in states
  534.       next if state.nil?
  535.       n += state.max_buff[param_id]
  536.     end
  537.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  538.   end
  539.   
  540.   #--------------------------------------------------------------------------
  541.   # new method: max_debuff_limit
  542.   #--------------------------------------------------------------------------
  543.   def max_debuff_limit(param_id)
  544.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  545.     if actor?
  546.       n += self.actor.max_debuff[param_id]
  547.       n += self.class.max_debuff[param_id]
  548.       for equip in equips
  549.         next if equip.nil?
  550.         n += equip.max_debuff[param_id]
  551.       end
  552.     else
  553.       n += self.enemy.max_debuff[param_id]
  554.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  555.         n += self.class.max_debuff[param_id]
  556.       end
  557.     end
  558.     for state in states
  559.       next if state.nil?
  560.       n += state.max_debuff[param_id]
  561.     end
  562.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # overwrite method: buff_icon_index
  567.   #--------------------------------------------------------------------------
  568.   def buff_icon_index(buff_level, param_id)
  569.     if buff_level > 0
  570.       return ICON_BUFF_START + ([buff_level - 1, 1].min) * 8 + param_id
  571.     elsif buff_level < 0
  572.       return ICON_DEBUFF_START + ([-buff_level - 1, -1].max) * 8 + param_id
  573.     else
  574.       return 0
  575.     end
  576.   end
  577.   
  578.   #--------------------------------------------------------------------------
  579.   # new method: buff_turns
  580.   #--------------------------------------------------------------------------
  581.   def buff_turns(param_id)
  582.     return @buff_turns.include?(param_id) ? @buff_turns[param_id] : 0
  583.   end
  584.   
  585.   #--------------------------------------------------------------------------
  586.   # new method: buff_level
  587.   #--------------------------------------------------------------------------
  588.   def buff_level(param_id)
  589.     return 0 if @buffs[param_id].nil?
  590.     buff_maximum = max_buff_limit(param_id)
  591.     debuff_maximum = max_debuff_limit(param_id)
  592.     return [[@buffs[param_id], buff_maximum].min, -debuff_maximum].max
  593.   end
  594.   
  595.   #--------------------------------------------------------------------------
  596.   # new method: buff_change_turns
  597.   #--------------------------------------------------------------------------
  598.   def buff_change_turns(param_id, value)
  599.     @buff_turns[param_id] = 0 if @buff_turns[param_id].nil?
  600.     @buff_turns[param_id] = [value, 0].max
  601.   end
  602.   
  603.   #--------------------------------------------------------------------------
  604.   # new method: state_turns
  605.   #--------------------------------------------------------------------------
  606.   def state_turns(state_id)
  607.     state_id = state_id.id if state_id.is_a?(RPG::State)
  608.     return @state_turns.include?(state_id) ? @state_turns[state_id] : 0
  609.   end
  610.   
  611.   #--------------------------------------------------------------------------
  612.   # new method: state_steps
  613.   #--------------------------------------------------------------------------
  614.   def state_steps(state_id)
  615.     state_id = state_id.id if state_id.is_a?(RPG::State)
  616.     return @state_steps.include?(state_id) ? @state_steps[state_id] : 0
  617.   end
  618.   
  619.   #--------------------------------------------------------------------------
  620.   # new method: state_change_turns
  621.   #--------------------------------------------------------------------------
  622.   def state_change_turns(state_id, value)
  623.     state_id = state_id.id if state_id.is_a?(RPG::State)
  624.     @state_turns[state_id] = 0 if @state_turns[state_id].nil?
  625.     @state_turns[state_id] = [value, 0].max
  626.   end
  627.   
  628.   #--------------------------------------------------------------------------
  629.   # new method: state_turn_mod
  630.   #--------------------------------------------------------------------------
  631.   def state_turn_mod(state_id)
  632.     return 0 if $data_states[state_id].nil?
  633.     state = $data_states[state_id]
  634.     n = state.min_turns + rand(1 + [state.max_turns - state.min_turns, 0].max)
  635.     if actor?
  636.       if self.actor.change_state_turns.include?(state_id)
  637.         n += self.actor.change_state_turns[state_id]
  638.       end
  639.       if self.class.change_state_turns.include?(state_id)
  640.         n += self.class.change_state_turns[state_id]
  641.       end
  642.       for equip in equips
  643.         next if equip.nil?
  644.         next unless equip.change_state_turns.include?(state_id)
  645.         n += equip.change_state_turns[state_id]
  646.       end
  647.     else
  648.       if self.enemy.change_state_turns.include?(state_id)
  649.         n += self.enemy.change_state_turns[state_id]
  650.       end
  651.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  652.         if self.class.change_state_turns.include?(state_id)
  653.           n += self.class.change_state_turns[state_id]
  654.         end
  655.       end
  656.     end
  657.     for state in states
  658.       next if state.nil?
  659.       next unless state.change_state_turns.include?(state_id)
  660.       n += state.change_state_turns[state_id]
  661.     end
  662.     return [n, 0].max
  663.   end
  664.   
  665. end # Game_BattlerBase

  666. #==============================================================================
  667. # ■ Game_Battler
  668. #==============================================================================

  669. class Game_Battler < Game_BattlerBase
  670.   
  671.   #--------------------------------------------------------------------------
  672.   # overwrite method: buff_max?
  673.   #--------------------------------------------------------------------------
  674.   def buff_max?(param_id)
  675.     return @buffs[param_id] == max_buff_limit(param_id)
  676.   end
  677.   
  678.   #--------------------------------------------------------------------------
  679.   # overwrite method: debuff_max?
  680.   #--------------------------------------------------------------------------
  681.   def debuff_max?(param_id)
  682.     return @buffs[param_id] == -max_debuff_limit(param_id)
  683.   end
  684.   
  685.   #--------------------------------------------------------------------------
  686.   # overwrite method: add_state
  687.   #--------------------------------------------------------------------------
  688.   def add_state(state_id)
  689.     return if $data_states[state_id].nil?
  690.     state_rules = $data_states[state_id].state_reapply_rules
  691.     return if state_rules == 0 && state?(state_id)
  692.     if state_addable?(state_id)
  693.       add_new_state(state_id) unless state?(state_id)
  694.       reset_state_counts(state_id) if state_rules == 1
  695.       total_state_counts(state_id) if state_rules == 2
  696.       @result.added_states.push(state_id).uniq!
  697.     end
  698.   end
  699.   
  700.   #--------------------------------------------------------------------------
  701.   # overwrite method: state_removed?
  702.   #--------------------------------------------------------------------------
  703.   def state_removed?(state_id)
  704.     return false
  705.   end
  706.   
  707.   #--------------------------------------------------------------------------
  708.   # overwrite method: reset_state_counts
  709.   #--------------------------------------------------------------------------
  710.   def reset_state_counts(state_id)
  711.     state = $data_states[state_id]
  712.     @state_turns[state_id] = state_turn_mod(state_id)
  713.     @state_steps[state_id] = state.steps_to_remove
  714.   end
  715.   
  716.   #--------------------------------------------------------------------------
  717.   # new method: total_state_counts
  718.   #--------------------------------------------------------------------------
  719.   def total_state_counts(state_id)
  720.     state = $data_states[state_id]
  721.     value = state_turn_mod(state_id)
  722.     state_change_turns(state_id, value + state_turns(state_id))
  723.   end
  724.   
  725.   #--------------------------------------------------------------------------
  726.   # alias method: item_user_effect
  727.   #--------------------------------------------------------------------------
  728.   alias game_battler_item_user_effect_bsm item_user_effect
  729.   def item_user_effect(user, item)
  730.     game_battler_item_user_effect_bsm(user, item)
  731.     apply_state_turn_changes(user, item)
  732.     apply_buff_turn_changes(user, item)
  733.     apply_debuff_turn_changes(user, item)
  734.   end
  735.   
  736.   #--------------------------------------------------------------------------
  737.   # new method: apply_state_turn_changes
  738.   #--------------------------------------------------------------------------
  739.   def apply_state_turn_changes(user, item)
  740.     return if item.nil?
  741.     return unless $game_party.in_battle
  742.     for key in item.change_state_turns
  743.       state_id = key[0]
  744.       next if field_state?(state_id)
  745.       next unless state?(state_id)
  746.       next unless $data_states[state_id].auto_removal_timing > 0
  747.       state_change_turns(state_id, key[1] + state_turns(state_id))
  748.       remove_state(state_id) if state_turns(state_id) <= 0
  749.       @result.success = true
  750.     end
  751.   end
  752.   
  753.   #--------------------------------------------------------------------------
  754.   # new method: field_state?
  755.   #--------------------------------------------------------------------------
  756.   def field_state?(state_id)
  757.     return false unless $imported["YEA-FieldStateEffects"]
  758.     return false unless $game_party.in_battle
  759.     return false unless SceneManager.scene_is?(Scene_Battle)
  760.     return BattleManager.field_state?(state_id)
  761.   end
  762.   
  763.   #--------------------------------------------------------------------------
  764.   # new method: apply_buff_turn_changes
  765.   #--------------------------------------------------------------------------
  766.   def apply_buff_turn_changes(user, item)
  767.     return if item.nil?
  768.     return unless $game_party.in_battle
  769.     for key in item.change_buff_turns
  770.       param_id = key[0]
  771.       next unless buff?(param_id)
  772.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  773.       remove_buff(param_id) if buff_turns(param_id) < 0
  774.       @result.success = true
  775.     end
  776.   end
  777.   
  778.   #--------------------------------------------------------------------------
  779.   # new method: apply_debuff_turn_changes
  780.   #--------------------------------------------------------------------------
  781.   def apply_debuff_turn_changes(user, item)
  782.     return if item.nil?
  783.     return unless $game_party.in_battle
  784.     for key in item.change_debuff_turns
  785.       param_id = key[0]
  786.       next unless debuff?(param_id)
  787.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  788.       remove_buff(param_id) if buff_turns(param_id) < 0
  789.       @result.success = true
  790.     end
  791.   end
  792.   
  793. end # Game_Battler

  794. #==============================================================================
  795. # ■ Window_Base
  796. #==============================================================================

  797. class Window_Base < Window
  798.   
  799.   #--------------------------------------------------------------------------
  800.   # alias method: draw_actor_icons
  801.   #--------------------------------------------------------------------------
  802.   alias window_base_draw_actor_icons_bsm draw_actor_icons
  803.   def draw_actor_icons(actor, dx, dy, dw = 96)
  804.     window_base_draw_actor_icons_bsm(actor, dx, dy, dw)
  805.     draw_actor_icon_turns(actor, dx, dy, dw)
  806.   end
  807.   
  808.   #--------------------------------------------------------------------------
  809.   # new method: draw_actor_icon_turns
  810.   #--------------------------------------------------------------------------
  811.   def draw_actor_icon_turns(actor, dx, dy, dw)
  812.     return unless YEA::BUFF_STATE_MANAGER::SHOW_REMAINING_TURNS
  813.     return unless SceneManager.scene_is?(Scene_Battle)
  814.     reset_font_settings
  815.     contents.font.out_color.alpha = 255
  816.     contents.font.bold = true
  817.     contents.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE
  818.     bx = dx
  819.     dy += YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y
  820.     #---
  821.     for state in actor.states
  822.       break if dx + 24 >= dw + bx
  823.       next if state.icon_index <= 0
  824.       turns = actor.state_turns(state.id).to_i
  825.       if $imported["YEA-FieldStateEffects"] &&
  826.       BattleManager.field_state?(state.id)
  827.         turns = BattleManager.field_state_turns(state.id)
  828.       end
  829.       if state.auto_removal_timing > 0 && turns < 100
  830.         draw_text(dx, dy, 24, line_height, turns, 2)
  831.       end
  832.       dx += 24
  833.     end
  834.     #---
  835.     for i in 0...8
  836.       break if dx + 24 >= dw + bx
  837.       next if actor.buff_icon_index(actor.buff_level(i), i) == 0
  838.       turns = actor.buff_turns(i).to_i
  839.       draw_text(dx, dy, 24, line_height, turns, 2) if turns < 100
  840.       dx += 24
  841.     end
  842.     #---
  843.     contents.font.out_color = Font.default_out_color
  844.     reset_font_settings
  845.   end
  846.   
  847. end # Window_Base

  848. #==============================================================================
  849. #
  850. # ▼ End of File
  851. #
  852. #==============================================================================
复制代码
704行吧···

QQ图片20141006123041.jpg (58.35 KB, 下载次数: 17)

QQ图片20141006123041.jpg

QQ图片20141006123052.jpg (18.84 KB, 下载次数: 17)

QQ图片20141006123052.jpg

Lv1.梦旅人

梦石
0
星屑
98
在线时间
1617 小时
注册时间
2013-8-15
帖子
4459
2
发表于 2014-10-6 12:35:35 | 只看该作者
一般来提问区的都是脚本报错...所以标题就别这样
首先...一般也不是直接发截图的...一般是
  1. 这样发脚本然后告诉触触哪里坏了,用了什么脚本?
复制代码
复制代码
神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
280 小时
注册时间
2011-7-22
帖子
24
3
 楼主| 发表于 2014-10-6 12:43:52 | 只看该作者
好吧
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Buff & State Manager v1.07
  4. # -- Last Updated: 2012.01.26
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-Buff&StateManager"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.26 - Bug Fixed: Remaining turns aren't drawn in excess.
  15. # 2012.01.23 - Compatibility Update: Doppelganger
  16. # 2012.01.11 - Compatibility Update: Field State Effects
  17. # 2012.01.09 - Bug Fixed: Remaining turns weren't drawn properly again.
  18. # 2012.01.07 - Bug Fixed: Remaining turns weren't drawn properly.
  19. # 2011.12.30 - Bug Fixed: Decimals are no longer shown on states turns.
  20. # 2011.12.28 - Added <state x turn: +y> for actors, classes, weapons, armours,
  21. #              enemies, and states.
  22. # 2011.12.27 - Started Script and Finished.
  23. #
  24. #==============================================================================
  25. # ▼ Introduction
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # This script alters some of the basic mechanics revolving behind states,
  28. # buffs, and debuffs that aren't adjustable within RPG Maker VX Ace by default
  29. # such as being able to affect the turns remaining on a state, buff, or debuff
  30. # without affecting anything else or even adjusting how many times a buff (or
  31. # debuff) can be applied to an actor.
  32. #
  33. #==============================================================================
  34. # ▼ Instructions
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # To install this script, open up your script editor and copy/paste this script
  37. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  38. #
  39. # -----------------------------------------------------------------------------
  40. # Actor Notetags - These notetags go in the actors notebox in the database.
  41. # -----------------------------------------------------------------------------
  42. # <max buff stat: +x>
  43. # <max buff stat: -x>
  44. # Increases or decreases the maximum times that particular stat can be buffed
  45. # by x. Note that the max increase here is still limited by the module constant
  46. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  47. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  48. #
  49. # <max debuff stat: +x>
  50. # <max debuff stat: -x>
  51. # Increases or decreases the maximum times that particular stat can be debuffed
  52. # by x. Note that the max decrease here is still limited by the module constant
  53. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  54. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  55. #
  56. # <state x turn: +y>
  57. # <state x turn: -y>
  58. # When the battler is affected by state x, additional modifiers are made to the
  59. # number of turns remaining for state x by y amount. The modifiers cannot
  60. # reduce turns to under 0.
  61. #
  62. # -----------------------------------------------------------------------------
  63. # Class Notetags - These notetags go in the class notebox in the database.
  64. # -----------------------------------------------------------------------------
  65. # <max buff stat: +x>
  66. # <max buff stat: -x>
  67. # Increases or decreases the maximum times that particular stat can be buffed
  68. # by x. Note that the max increase here is still limited by the module constant
  69. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  70. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  71. #
  72. # <max debuff stat: +x>
  73. # <max debuff stat: -x>
  74. # Increases or decreases the maximum times that particular stat can be debuffed
  75. # by x. Note that the max decrease here is still limited by the module constant
  76. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  77. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  78. #
  79. # <state x turn: +y>
  80. # <state x turn: -y>
  81. # When the battler is affected by state x, additional modifiers are made to the
  82. # number of turns remaining for state x by y amount. The modifiers cannot
  83. # reduce turns to under 0.
  84. #
  85. # -----------------------------------------------------------------------------
  86. # Skill Notetags - These notetags go in the skill notebox in the database.
  87. # -----------------------------------------------------------------------------
  88. # <state x turn: +y>
  89. # <state x turn: -y>
  90. # If the target is affected by state x, this will alter the turns remaining on
  91. # that state by y turns if the state can be removed by turns. If the state goes
  92. # under 0 turns, the state will be removed.
  93. #
  94. # <buff stat turn: +x>
  95. # <buff stat turn: -x>
  96. # If the target's stat is buffed, this will alter the turns remaining on that
  97. # buff by x turns. If the buff's remaining turns go under 0, the buff will be
  98. # removed.
  99. #
  100. # <debuff stat turn: +x>
  101. # <debuff stat turn: -x>
  102. # If the target's stat is debuffed, this will alter the turns remaining on that
  103. # debuff by x turns. If the debuff's remaining turns go under 0, the debuff
  104. # will be removed.
  105. #
  106. # -----------------------------------------------------------------------------
  107. # Item Notetags - These notetags go in the item notebox in the database.
  108. # -----------------------------------------------------------------------------
  109. # <state x turn: +y>
  110. # <state x turn: -y>
  111. # If the target is affected by state x, this will alter the turns remaining on
  112. # that state by y turns if the state can be removed by turns. If the state goes
  113. # under 0 turns, the state will be removed.
  114. #
  115. # <buff stat turn: +x>
  116. # <buff stat turn: -x>
  117. # If the target's stat is buffed, this will alter the turns remaining on that
  118. # buff by x turns. If the buff's remaining turns go under 0, the buff will be
  119. # removed.
  120. #
  121. # <debuff stat turn: +x>
  122. # <debuff stat turn: -x>
  123. # If the target's stat is debuffed, this will alter the turns remaining on that
  124. # debuff by x turns. If the debuff's remaining turns go under 0, the debuff
  125. # will be removed.
  126. #
  127. # -----------------------------------------------------------------------------
  128. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  129. # -----------------------------------------------------------------------------
  130. # <max buff stat: +x>
  131. # <max buff stat: -x>
  132. # Increases or decreases the maximum times that particular stat can be buffed
  133. # by x. Note that the max increase here is still limited by the module constant
  134. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  135. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  136. #
  137. # <max debuff stat: +x>
  138. # <max debuff stat: -x>
  139. # Increases or decreases the maximum times that particular stat can be debuffed
  140. # by x. Note that the max decrease here is still limited by the module constant
  141. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  142. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  143. #
  144. # <state x turn: +y>
  145. # <state x turn: -y>
  146. # When the battler is affected by state x, additional modifiers are made to the
  147. # number of turns remaining for state x by y amount. The modifiers cannot
  148. # reduce turns to under 0.
  149. #
  150. # -----------------------------------------------------------------------------
  151. # Armour Notetags - These notetags go in the armour notebox in the database.
  152. # -----------------------------------------------------------------------------
  153. # <max buff stat: +x>
  154. # <max buff stat: -x>
  155. # Increases or decreases the maximum times that particular stat can be buffed
  156. # by x. Note that the max increase here is still limited by the module constant
  157. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  158. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  159. #
  160. # <max debuff stat: +x>
  161. # <max debuff stat: -x>
  162. # Increases or decreases the maximum times that particular stat can be debuffed
  163. # by x. Note that the max decrease here is still limited by the module constant
  164. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  165. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  166. #
  167. # <state x turn: +y>
  168. # <state x turn: -y>
  169. # When the battler is affected by state x, additional modifiers are made to the
  170. # number of turns remaining for state x by y amount. The modifiers cannot
  171. # reduce turns to under 0.
  172. #
  173. # -----------------------------------------------------------------------------
  174. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  175. # -----------------------------------------------------------------------------
  176. # <max buff stat: +x>
  177. # <max buff stat: -x>
  178. # Increases or decreases the maximum times that particular stat can be buffed
  179. # by x. Note that the max increase here is still limited by the module constant
  180. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  181. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  182. #
  183. # <max debuff stat: +x>
  184. # <max debuff stat: -x>
  185. # Increases or decreases the maximum times that particular stat can be debuffed
  186. # by x. Note that the max decrease here is still limited by the module constant
  187. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  188. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  189. #
  190. # <state x turn: +y>
  191. # <state x turn: -y>
  192. # When the battler is affected by state x, additional modifiers are made to the
  193. # number of turns remaining for state x by y amount. The modifiers cannot
  194. # reduce turns to under 0.
  195. #
  196. # -----------------------------------------------------------------------------
  197. # State Notetags - These notetags go in the states notebox in the database.
  198. # -----------------------------------------------------------------------------
  199. # <max buff stat: +x>
  200. # <max buff stat: -x>
  201. # Increases or decreases the maximum times that particular stat can be buffed
  202. # by x. Note that the max increase here is still limited by the module constant
  203. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  204. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  205. #
  206. # <max debuff stat: +x>
  207. # <max debuff stat: -x>
  208. # Increases or decreases the maximum times that particular stat can be debuffed
  209. # by x. Note that the max decrease here is still limited by the module constant
  210. # MAXIMUM_BUFF_LIMIT. Replace "stat" with "MAXHP", "MAXMP", "ATK", "DEF",
  211. # "MAT", "MDF", "AGI", "LUK", or "ALL" for those respective stats.
  212. #
  213. # <reapply ignore>
  214. # If this state is cast on a battler with the state already applied, turns
  215. # remaining will not be reset nor will turns be added on.
  216. #
  217. # <reapply reset>
  218. # If this state is cast on a battler with the state already applied, the turns
  219. # will be reset to the default amount of turns the state normally starts with.
  220. #
  221. # <reapply total>
  222. # If this state is cast on a battler with the state already applied, the turns
  223. # will be added on to the current amount of turns remaining giving the battler
  224. # a total of the remaining turns with the default turns for the state.
  225. #
  226. # <state x turn: +y>
  227. # <state x turn: -y>
  228. # When the battler is affected by state x, additional modifiers are made to the
  229. # number of turns remaining for state x by y amount. The modifiers cannot
  230. # reduce turns to under 0.
  231. #
  232. #==============================================================================
  233. # ▼ Compatibility
  234. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  235. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  236. # it will run with RPG Maker VX without adjusting.
  237. #
  238. #==============================================================================

  239. module YEA
  240.   module BUFF_STATE_MANAGER
  241.    
  242.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  243.     # - Draw Remaining Turns -
  244.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  245.     # This setting will cause the game to show the number of turns remaining
  246.     # for a state in battle (if the state will remove itself through turns).
  247.     # Adjust the settings below to change the font size and the y coordinate
  248.     # adjustment to where the turns remaining appear if you so desire.
  249.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  250.     SHOW_REMAINING_TURNS = true     # Show the turns remaining?
  251.     TURNS_REMAINING_SIZE = 10       # Font size used for turns remaining.
  252.     TURNS_REMAINING_Y    = -4       # Adjusts location of the text.
  253.    
  254.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  255.     # - Buff Settings -
  256.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  257.     # These settings adjust how buffs play out in your game and the way they
  258.     # modify a battler's stats such as the maximum times a stat can be buffed
  259.     # and the buff boost formula. Note that these maximums apply to both buffs
  260.     # and debuffs.
  261.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  262.     DEFAULT_BUFF_LIMIT = 2     # Normal times you can buff a stat. Default: 2
  263.     MAXIMUM_BUFF_LIMIT = 2     # Maximum times you can buff a stat. Default: 2
  264.    
  265.     # This is the formula used to apply the rate used for buffs and debuffs.
  266.     BUFF_BOOST_FORMULA = "buff_level(param_id) * 0.25 + 1.0"
  267.    
  268.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  269.     # - Reapplying State Settings -
  270.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  271.     # These settings adjust how the rules apply to states when they are
  272.     # reapplied onto an actor with the state already intact. If you wish to
  273.     # have specific states use different rules, use notetags to have them
  274.     # adjust turns differently.
  275.     #   0 - Ignored. Default VX setting.
  276.     #   1 - Turns reset back to existing turns. Default VX Ace Setting.
  277.     #   2 - Default turns added onto existing turns.
  278.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  279.     REAPPLY_STATE_RULES = 1
  280.    
  281.   end # BUFF_STATE_MANAGER
  282. end # YEA

  283. #==============================================================================
  284. # ▼ Editting anything past this point may potentially result in causing
  285. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  286. # halitosis so edit at your own risk.
  287. #==============================================================================

  288. module YEA
  289.   module REGEXP
  290.   module BASEITEM
  291.    
  292.     MAX_BUFF = /<(?:MAX_BUFF|max buff)[ ](.*):[ ]([\+\-]\d+)>/i
  293.     MAX_DEBUFF = /<(?:MAX_DEBUFF|max debuff)[ ](.*):[ ]([\+\-]\d+)>/i
  294.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  295.     STATE_REAPPLY_IGNORE = /<(?:REAPPLY_IGNORE|reapply ignore)>/i
  296.     STATE_REAPPLY_RESET = /<(?:REAPPLY_RESET|reapply reset)>/i
  297.     STATE_REAPPLY_TOTAL = /<(?:REAPPLY_TOTAL|reapply total)>/i
  298.    
  299.   end # BASEITEM
  300.   module USABLEITEM
  301.    
  302.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  303.     CHANGE_BUFF_TURN = /<(?:buff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  304.     CHANGE_DEBUFF_TURN = /<(?:debuff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  305.    
  306.   end # USABLEITEM
  307.   end # REGEXP
  308. end # YEA

  309. #==============================================================================
  310. # ■ DataManager
  311. #==============================================================================

  312. module DataManager
  313.   
  314.   #--------------------------------------------------------------------------
  315.   # alias method: load_database
  316.   #--------------------------------------------------------------------------
  317.   class <<self; alias load_database_bsm load_database; end
  318.   def self.load_database
  319.     load_database_bsm
  320.     load_notetags_bsm
  321.   end
  322.   
  323.   #--------------------------------------------------------------------------
  324.   # new method: load_notetags_bsm
  325.   #--------------------------------------------------------------------------
  326.   def self.load_notetags_bsm
  327.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  328.       $data_enemies, $data_states, $data_skills, $data_items]
  329.     for group in groups
  330.       for obj in group
  331.         next if obj.nil?
  332.         obj.load_notetags_bsm
  333.       end
  334.     end
  335.   end
  336.   
  337. end # DataManager

  338. #==============================================================================
  339. # ■ RPG::BaseItem
  340. #==============================================================================

  341. class RPG::BaseItem
  342.   
  343.   #--------------------------------------------------------------------------
  344.   # public instance variables
  345.   #--------------------------------------------------------------------------
  346.   attr_accessor :max_buff
  347.   attr_accessor :max_debuff
  348.   attr_accessor :change_state_turns
  349.   attr_accessor :state_reapply_rules
  350.   
  351.   #--------------------------------------------------------------------------
  352.   # common cache: load_notetags_bsm
  353.   #--------------------------------------------------------------------------
  354.   def load_notetags_bsm
  355.     @change_state_turns = {}
  356.     @max_buff = {
  357.       0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0 }
  358.     @max_debuff = {
  359.       0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0 }
  360.     if self.is_a?(RPG::State)
  361.       @state_reapply_rules = YEA::BUFF_STATE_MANAGER::REAPPLY_STATE_RULES
  362.     end
  363.     #---
  364.     self.note.split(/[\r\n]+/).each { |line|
  365.       case line
  366.       #---
  367.       when YEA::REGEXP::BASEITEM::MAX_BUFF
  368.         case $1.upcase
  369.         when "MAXHP", "MHP", "HP"
  370.           @max_buff[0] = $2.to_i
  371.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  372.           @max_buff[1] = $2.to_i
  373.         when "ATK"
  374.           @max_buff[2] = $2.to_i
  375.         when "DEF"
  376.           @max_buff[3] = $2.to_i
  377.         when "MAT", "INT", "SPI"
  378.           @max_buff[4] = $2.to_i
  379.         when "MDF", "RES"
  380.           @max_buff[5] = $2.to_i
  381.         when "AGI"
  382.           @max_buff[6] = $2.to_i
  383.         when "LUK"
  384.           @max_buff[7] = $2.to_i
  385.         when "ALL"
  386.           for i in 0...8; @max_buff[i] = $2.to_i; end
  387.         end
  388.       #---
  389.       when YEA::REGEXP::BASEITEM::MAX_DEBUFF
  390.         case $1.upcase
  391.         when "MAXHP", "MHP", "HP"
  392.           @max_debuff[0] = $2.to_i
  393.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  394.           @max_debuff[1] = $2.to_i
  395.         when "ATK"
  396.           @max_debuff[2] = $2.to_i
  397.         when "DEF"
  398.           @max_debuff[3] = $2.to_i
  399.         when "MAT", "INT", "SPI"
  400.           @max_debuff[4] = $2.to_i
  401.         when "MDF", "RES"
  402.           @max_debuff[5] = $2.to_i
  403.         when "AGI"
  404.           @max_debuff[6] = $2.to_i
  405.         when "LUK"
  406.           @max_debuff[7] = $2.to_i
  407.         when "ALL"
  408.           for i in 0...8; @max_debuff[i] = $2.to_i; end
  409.         end
  410.       #---
  411.       when YEA::REGEXP::BASEITEM::CHANGE_STATE_TURN
  412.         @change_state_turns[$1.to_i] = $2.to_i
  413.       #---
  414.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_IGNORE
  415.         next unless self.is_a?(RPG::State)
  416.         @state_reapply_rules = 0
  417.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_RESET
  418.         next unless self.is_a?(RPG::State)
  419.         @state_reapply_rules = 1
  420.       when YEA::REGEXP::BASEITEM::STATE_REAPPLY_TOTAL
  421.         next unless self.is_a?(RPG::State)
  422.         @state_reapply_rules = 2
  423.       #---
  424.       end
  425.     } # self.note.split
  426.     #---
  427.   end
  428.   
  429. end # RPG::BaseItem

  430. #==============================================================================
  431. # ■ RPG::UsableItem
  432. #==============================================================================

  433. class RPG::UsableItem < RPG::BaseItem
  434.   
  435.   #--------------------------------------------------------------------------
  436.   # public instance variables
  437.   #--------------------------------------------------------------------------
  438.   attr_accessor :change_state_turns
  439.   attr_accessor :change_buff_turns
  440.   attr_accessor :change_debuff_turns
  441.   
  442.   #--------------------------------------------------------------------------
  443.   # common cache: load_notetags_bsm
  444.   #--------------------------------------------------------------------------
  445.   def load_notetags_bsm
  446.     @change_state_turns = {}
  447.     @change_buff_turns = {}
  448.     @change_debuff_turns = {}
  449.     #---
  450.     self.note.split(/[\r\n]+/).each { |line|
  451.       case line
  452.       #---
  453.       when YEA::REGEXP::USABLEITEM::CHANGE_STATE_TURN
  454.         @change_state_turns[$1.to_i] = $2.to_i
  455.       when YEA::REGEXP::USABLEITEM::CHANGE_BUFF_TURN
  456.         case $1.upcase
  457.         when "MAXHP", "MHP", "HP"
  458.           @change_buff_turns[0] = $2.to_i
  459.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  460.           @change_buff_turns[1] = $2.to_i
  461.         when "ATK"
  462.           @change_buff_turns[2] = $2.to_i
  463.         when "DEF"
  464.           @change_buff_turns[3] = $2.to_i
  465.         when "MAT", "INT", "SPI"
  466.           @change_buff_turns[4] = $2.to_i
  467.         when "MDF", "RES"
  468.           @change_buff_turns[5] = $2.to_i
  469.         when "AGI"
  470.           @change_buff_turns[6] = $2.to_i
  471.         when "LUK"
  472.           @change_buff_turns[7] = $2.to_i
  473.         when "ALL"
  474.           for i in 0...8; @change_buff_turns[i] = $2.to_i; end
  475.         end
  476.       when YEA::REGEXP::USABLEITEM::CHANGE_DEBUFF_TURN
  477.         case $1.upcase
  478.         when "MAXHP", "MHP", "HP"
  479.           @change_debuff_turns[0] = $2.to_i
  480.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  481.           @change_debuff_turns[1] = $2.to_i
  482.         when "ATK"
  483.           @change_debuff_turns[2] = $2.to_i
  484.         when "DEF"
  485.           @change_debuff_turns[3] = $2.to_i
  486.         when "MAT", "INT", "SPI"
  487.           @change_debuff_turns[4] = $2.to_i
  488.         when "MDF", "RES"
  489.           @change_debuff_turns[5] = $2.to_i
  490.         when "AGI"
  491.           @change_debuff_turns[6] = $2.to_i
  492.         when "LUK"
  493.           @change_debuff_turns[7] = $2.to_i
  494.         when "ALL"
  495.           for i in 0...8; @change_debuff_turns[i] = $2.to_i; end
  496.         end
  497.       end
  498.     } # self.note.split
  499.     #---
  500.   end
  501.   
  502. end # class RPG::UsableItem

  503. #==============================================================================
  504. # ■ Game_BattlerBase
  505. #==============================================================================

  506. class Game_BattlerBase
  507.   
  508.   #--------------------------------------------------------------------------
  509.   # overwrite method: param_buff_rate
  510.   #--------------------------------------------------------------------------
  511.   def param_buff_rate(param_id)
  512.     return eval(YEA::BUFF_STATE_MANAGER::BUFF_BOOST_FORMULA)
  513.   end
  514.   
  515.   #--------------------------------------------------------------------------
  516.   # new method: max_buff_limit
  517.   #--------------------------------------------------------------------------
  518.   def max_buff_limit(param_id)
  519.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  520.     if actor?
  521.       n += self.actor.max_buff[param_id]
  522.       n += self.class.max_buff[param_id]
  523.       for equip in equips
  524.         next if equip.nil?
  525.         n += equip.max_buff[param_id]
  526.       end
  527.     else
  528.       n += self.enemy.max_buff[param_id]
  529.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  530.         n += self.class.max_buff[param_id]
  531.       end
  532.     end
  533.     for state in states
  534.       next if state.nil?
  535.       n += state.max_buff[param_id]
  536.     end
  537.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  538.   end
  539.   
  540.   #--------------------------------------------------------------------------
  541.   # new method: max_debuff_limit
  542.   #--------------------------------------------------------------------------
  543.   def max_debuff_limit(param_id)
  544.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  545.     if actor?
  546.       n += self.actor.max_debuff[param_id]
  547.       n += self.class.max_debuff[param_id]
  548.       for equip in equips
  549.         next if equip.nil?
  550.         n += equip.max_debuff[param_id]
  551.       end
  552.     else
  553.       n += self.enemy.max_debuff[param_id]
  554.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  555.         n += self.class.max_debuff[param_id]
  556.       end
  557.     end
  558.     for state in states
  559.       next if state.nil?
  560.       n += state.max_debuff[param_id]
  561.     end
  562.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # overwrite method: buff_icon_index
  567.   #--------------------------------------------------------------------------
  568.   def buff_icon_index(buff_level, param_id)
  569.     if buff_level > 0
  570.       return ICON_BUFF_START + ([buff_level - 1, 1].min) * 8 + param_id
  571.     elsif buff_level < 0
  572.       return ICON_DEBUFF_START + ([-buff_level - 1, -1].max) * 8 + param_id
  573.     else
  574.       return 0
  575.     end
  576.   end
  577.   
  578.   #--------------------------------------------------------------------------
  579.   # new method: buff_turns
  580.   #--------------------------------------------------------------------------
  581.   def buff_turns(param_id)
  582.     return @buff_turns.include?(param_id) ? @buff_turns[param_id] : 0
  583.   end
  584.   
  585.   #--------------------------------------------------------------------------
  586.   # new method: buff_level
  587.   #--------------------------------------------------------------------------
  588.   def buff_level(param_id)
  589.     return 0 if @buffs[param_id].nil?
  590.     buff_maximum = max_buff_limit(param_id)
  591.     debuff_maximum = max_debuff_limit(param_id)
  592.     return [[@buffs[param_id], buff_maximum].min, -debuff_maximum].max
  593.   end
  594.   
  595.   #--------------------------------------------------------------------------
  596.   # new method: buff_change_turns
  597.   #--------------------------------------------------------------------------
  598.   def buff_change_turns(param_id, value)
  599.     @buff_turns[param_id] = 0 if @buff_turns[param_id].nil?
  600.     @buff_turns[param_id] = [value, 0].max
  601.   end
  602.   
  603.   #--------------------------------------------------------------------------
  604.   # new method: state_turns
  605.   #--------------------------------------------------------------------------
  606.   def state_turns(state_id)
  607.     state_id = state_id.id if state_id.is_a?(RPG::State)
  608.     return @state_turns.include?(state_id) ? @state_turns[state_id] : 0
  609.   end
  610.   
  611.   #--------------------------------------------------------------------------
  612.   # new method: state_steps
  613.   #--------------------------------------------------------------------------
  614.   def state_steps(state_id)
  615.     state_id = state_id.id if state_id.is_a?(RPG::State)
  616.     return @state_steps.include?(state_id) ? @state_steps[state_id] : 0
  617.   end
  618.   
  619.   #--------------------------------------------------------------------------
  620.   # new method: state_change_turns
  621.   #--------------------------------------------------------------------------
  622.   def state_change_turns(state_id, value)
  623.     state_id = state_id.id if state_id.is_a?(RPG::State)
  624.     @state_turns[state_id] = 0 if @state_turns[state_id].nil?
  625.     @state_turns[state_id] = [value, 0].max
  626.   end
  627.   
  628.   #--------------------------------------------------------------------------
  629.   # new method: state_turn_mod
  630.   #--------------------------------------------------------------------------
  631.   def state_turn_mod(state_id)
  632.     return 0 if $data_states[state_id].nil?
  633.     state = $data_states[state_id]
  634.     n = state.min_turns + rand(1 + [state.max_turns - state.min_turns, 0].max)
  635.     if actor?
  636.       if self.actor.change_state_turns.include?(state_id)
  637.         n += self.actor.change_state_turns[state_id]
  638.       end
  639.       if self.class.change_state_turns.include?(state_id)
  640.         n += self.class.change_state_turns[state_id]
  641.       end
  642.       for equip in equips
  643.         next if equip.nil?
  644.         next unless equip.change_state_turns.include?(state_id)
  645.         n += equip.change_state_turns[state_id]
  646.       end
  647.     else
  648.       if self.enemy.change_state_turns.include?(state_id)
  649.         n += self.enemy.change_state_turns[state_id]
  650.       end
  651.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  652.         if self.class.change_state_turns.include?(state_id)
  653.           n += self.class.change_state_turns[state_id]
  654.         end
  655.       end
  656.     end
  657.     for state in states
  658.       next if state.nil?
  659.       next unless state.change_state_turns.include?(state_id)
  660.       n += state.change_state_turns[state_id]
  661.     end
  662.     return [n, 0].max
  663.   end
  664.   
  665. end # Game_BattlerBase

  666. #==============================================================================
  667. # ■ Game_Battler
  668. #==============================================================================

  669. class Game_Battler < Game_BattlerBase
  670.   
  671.   #--------------------------------------------------------------------------
  672.   # overwrite method: buff_max?
  673.   #--------------------------------------------------------------------------
  674.   def buff_max?(param_id)
  675.     return @buffs[param_id] == max_buff_limit(param_id)
  676.   end
  677.   
  678.   #--------------------------------------------------------------------------
  679.   # overwrite method: debuff_max?
  680.   #--------------------------------------------------------------------------
  681.   def debuff_max?(param_id)
  682.     return @buffs[param_id] == -max_debuff_limit(param_id)
  683.   end
  684.   
  685.   #--------------------------------------------------------------------------
  686.   # overwrite method: add_state
  687.   #--------------------------------------------------------------------------
  688.   def add_state(state_id)
  689.     return if $data_states[state_id].nil?
  690.     state_rules = $data_states[state_id].state_reapply_rules
  691.     return if state_rules == 0 && state?(state_id)
  692.     if state_addable?(state_id)
  693.       add_new_state(state_id) unless state?(state_id)
  694.       reset_state_counts(state_id) if state_rules == 1
  695.       total_state_counts(state_id) if state_rules == 2
  696.       @result.added_states.push(state_id).uniq!
  697.     end
  698.   end
  699.   
  700.   #--------------------------------------------------------------------------
  701.   # overwrite method: state_removed?
  702.   #--------------------------------------------------------------------------
  703.   def state_removed?(state_id)
  704.     return false
  705.   end
  706.   
  707.   #--------------------------------------------------------------------------
  708.   # overwrite method: reset_state_counts
  709.   #--------------------------------------------------------------------------
  710.   def reset_state_counts(state_id)
  711.     state = $data_states[state_id]
  712.     @state_turns[state_id] = state_turn_mod(state_id)
  713.     @state_steps[state_id] = state.steps_to_remove
  714.   end
  715.   
  716.   #--------------------------------------------------------------------------
  717.   # new method: total_state_counts
  718.   #--------------------------------------------------------------------------
  719.   def total_state_counts(state_id)
  720.     state = $data_states[state_id]
  721.     value = state_turn_mod(state_id)
  722.     state_change_turns(state_id, value + state_turns(state_id))
  723.   end
  724.   
  725.   #--------------------------------------------------------------------------
  726.   # alias method: item_user_effect
  727.   #--------------------------------------------------------------------------
  728.   alias game_battler_item_user_effect_bsm item_user_effect
  729.   def item_user_effect(user, item)
  730.     game_battler_item_user_effect_bsm(user, item)
  731.     apply_state_turn_changes(user, item)
  732.     apply_buff_turn_changes(user, item)
  733.     apply_debuff_turn_changes(user, item)
  734.   end
  735.   
  736.   #--------------------------------------------------------------------------
  737.   # new method: apply_state_turn_changes
  738.   #--------------------------------------------------------------------------
  739.   def apply_state_turn_changes(user, item)
  740.     return if item.nil?
  741.     return unless $game_party.in_battle
  742.     for key in item.change_state_turns
  743.       state_id = key[0]
  744.       next if field_state?(state_id)
  745.       next unless state?(state_id)
  746.       next unless $data_states[state_id].auto_removal_timing > 0
  747.       state_change_turns(state_id, key[1] + state_turns(state_id))
  748.       remove_state(state_id) if state_turns(state_id) <= 0
  749.       @result.success = true
  750.     end
  751.   end
  752.   
  753.   #--------------------------------------------------------------------------
  754.   # new method: field_state?
  755.   #--------------------------------------------------------------------------
  756.   def field_state?(state_id)
  757.     return false unless $imported["YEA-FieldStateEffects"]
  758.     return false unless $game_party.in_battle
  759.     return false unless SceneManager.scene_is?(Scene_Battle)
  760.     return BattleManager.field_state?(state_id)
  761.   end
  762.   
  763.   #--------------------------------------------------------------------------
  764.   # new method: apply_buff_turn_changes
  765.   #--------------------------------------------------------------------------
  766.   def apply_buff_turn_changes(user, item)
  767.     return if item.nil?
  768.     return unless $game_party.in_battle
  769.     for key in item.change_buff_turns
  770.       param_id = key[0]
  771.       next unless buff?(param_id)
  772.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  773.       remove_buff(param_id) if buff_turns(param_id) < 0
  774.       @result.success = true
  775.     end
  776.   end
  777.   
  778.   #--------------------------------------------------------------------------
  779.   # new method: apply_debuff_turn_changes
  780.   #--------------------------------------------------------------------------
  781.   def apply_debuff_turn_changes(user, item)
  782.     return if item.nil?
  783.     return unless $game_party.in_battle
  784.     for key in item.change_debuff_turns
  785.       param_id = key[0]
  786.       next unless debuff?(param_id)
  787.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  788.       remove_buff(param_id) if buff_turns(param_id) < 0
  789.       @result.success = true
  790.     end
  791.   end
  792.   
  793. end # Game_Battler

  794. #==============================================================================
  795. # ■ Window_Base
  796. #==============================================================================

  797. class Window_Base < Window
  798.   
  799.   #--------------------------------------------------------------------------
  800.   # alias method: draw_actor_icons
  801.   #--------------------------------------------------------------------------
  802.   alias window_base_draw_actor_icons_bsm draw_actor_icons
  803.   def draw_actor_icons(actor, dx, dy, dw = 96)
  804.     window_base_draw_actor_icons_bsm(actor, dx, dy, dw)
  805.     draw_actor_icon_turns(actor, dx, dy, dw)
  806.   end
  807.   
  808.   #--------------------------------------------------------------------------
  809.   # new method: draw_actor_icon_turns
  810.   #--------------------------------------------------------------------------
  811.   def draw_actor_icon_turns(actor, dx, dy, dw)
  812.     return unless YEA::BUFF_STATE_MANAGER::SHOW_REMAINING_TURNS
  813.     return unless SceneManager.scene_is?(Scene_Battle)
  814.     reset_font_settings
  815.     contents.font.out_color.alpha = 255
  816.     contents.font.bold = true
  817.     contents.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE
  818.     bx = dx
  819.     dy += YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y
  820.     #---
  821.     for state in actor.states
  822.       break if dx + 24 >= dw + bx
  823.       next if state.icon_index <= 0
  824.       turns = actor.state_turns(state.id).to_i
  825.       if $imported["YEA-FieldStateEffects"] &&
  826.       BattleManager.field_state?(state.id)
  827.         turns = BattleManager.field_state_turns(state.id)
  828.       end
  829.       if state.auto_removal_timing > 0 && turns < 100
  830.         draw_text(dx, dy, 24, line_height, turns, 2)
  831.       end
  832.       dx += 24
  833.     end
  834.     #---
  835.     for i in 0...8
  836.       break if dx + 24 >= dw + bx
  837.       next if actor.buff_icon_index(actor.buff_level(i), i) == 0
  838.       turns = actor.buff_turns(i).to_i
  839.       draw_text(dx, dy, 24, line_height, turns, 2) if turns < 100
  840.       dx += 24
  841.     end
  842.     #---
  843.     contents.font.out_color = Font.default_out_color
  844.     reset_font_settings
  845.   end
  846.   
  847. end # Window_Base

  848. #==============================================================================
  849. #
  850. # ▼ End of File
  851. #
  852. #==============================================================================
复制代码
704行吧···

点评

编辑到主楼吧  发表于 2014-10-6 13:14
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
280 小时
注册时间
2011-7-22
帖子
24
4
 楼主| 发表于 2014-10-6 14:08:24 | 只看该作者
额,自己解决了,就不用麻烦了
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-1-3 06:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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