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

Project1

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

[已经过期] 关于某个显示状态剩余回合脚本和状态层数脚本冲突的问题

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2333
在线时间
275 小时
注册时间
2017-7-25
帖子
163
跳转到指定楼层
发表于 2022-7-22 02:00:26 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
300星屑
事情是这样的,刚刚看见隔壁不死鸟大佬的可堆叠状态系统https://rpg.blue/thread-489736-1-1.html
菜鸡寻思着这功能好像超棒的,兴冲冲加进自己的工程里试试,但是……毫无效果
不服气的菜鸡经过一通鼓捣,发现是之前的一个显示状态剩余回合数的脚本和堆叠脚本冲突了,而且又找了几个类似的状态堆叠脚本全都和它冲突
脚本:
  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.     # - Draw Remaining Turns -
  243.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  244.     # This setting will cause the game to show the number of turns remaining
  245.     # for a state in battle (if the state will remove itself through turns).
  246.     # Adjust the settings below to change the font size and the y coordinate
  247.     # adjustment to where the turns remaining appear if you so desire.
  248.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  249.     SHOW_REMAINING_TURNS = true     # Show the turns remaining?
  250.     TURNS_REMAINING_SIZE = 18       # Font size used for turns remaining.
  251.     TURNS_REMAINING_Y    = -4       # Adjusts location of the text.

  252.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  253.     # - Buff Settings -
  254.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  255.     # These settings adjust how buffs play out in your game and the way they
  256.     # modify a battler's stats such as the maximum times a stat can be buffed
  257.     # and the buff boost formula. Note that these maximums apply to both buffs
  258.     # and debuffs.
  259.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  260.     DEFAULT_BUFF_LIMIT = 4     # Normal times you can buff a stat. Default: 2
  261.     MAXIMUM_BUFF_LIMIT = 8     # Maximum times you can buff a stat. Default: 2

  262.     # This is the formula used to apply the rate used for buffs and debuffs.
  263.     BUFF_BOOST_FORMULA = "buff_level(param_id) * 0.25 + 1.0"

  264.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  265.     # - Reapplying State Settings -
  266.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  267.     # These settings adjust how the rules apply to states when they are
  268.     # reapplied onto an actor with the state already intact. If you wish to
  269.     # have specific states use different rules, use notetags to have them
  270.     # adjust turns differently.
  271.     #   0 - Ignored. Default VX setting.
  272.     #   1 - Turns reset back to existing turns. Default VX Ace Setting.
  273.     #   2 - Default turns added onto existing turns.
  274.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  275.     REAPPLY_STATE_RULES = 1

  276.   end # BUFF_STATE_MANAGER
  277. end # YEA

  278. #==============================================================================
  279. # ▼ Editting anything past this point may potentially result in causing
  280. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  281. # halitosis so edit at your own risk.
  282. #==============================================================================

  283. module YEA
  284.   module REGEXP
  285.   module BASEITEM

  286.     MAX_BUFF = /<(?:MAX_BUFF|max buff)[ ](.*):[ ]([\+\-]\d+)>/i
  287.     MAX_DEBUFF = /<(?:MAX_DEBUFF|max debuff)[ ](.*):[ ]([\+\-]\d+)>/i
  288.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  289.     STATE_REAPPLY_IGNORE = /<(?:REAPPLY_IGNORE|reapply ignore)>/i
  290.     STATE_REAPPLY_RESET = /<(?:REAPPLY_RESET|reapply reset)>/i
  291.     STATE_REAPPLY_TOTAL = /<(?:REAPPLY_TOTAL|reapply total)>/i

  292.   end # BASEITEM
  293.   module USABLEITEM

  294.     CHANGE_STATE_TURN = /<(?:state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  295.     CHANGE_BUFF_TURN = /<(?:buff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  296.     CHANGE_DEBUFF_TURN = /<(?:debuff)[ ](.*)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i

  297.   end # USABLEITEM
  298.   end # REGEXP
  299. end # YEA

  300. #==============================================================================
  301. # ■ DataManager
  302. #==============================================================================

  303. module DataManager

  304.   #--------------------------------------------------------------------------
  305.   # alias method: load_database
  306.   #--------------------------------------------------------------------------
  307.   class <<self; alias load_database_bsm load_database; end
  308.   def self.load_database
  309.     load_database_bsm
  310.     load_notetags_bsm
  311.   end

  312.   #--------------------------------------------------------------------------
  313.   # new method: load_notetags_bsm
  314.   #--------------------------------------------------------------------------
  315.   def self.load_notetags_bsm
  316.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  317.       $data_enemies, $data_states, $data_skills, $data_items]
  318.     for group in groups
  319.       for obj in group
  320.         next if obj.nil?
  321.         obj.load_notetags_bsm
  322.       end
  323.     end
  324.   end

  325. end # DataManager

  326. #==============================================================================
  327. # ■ RPG::BaseItem
  328. #==============================================================================

  329. class RPG::BaseItem

  330.   #--------------------------------------------------------------------------
  331.   # public instance variables
  332.   #--------------------------------------------------------------------------
  333.   attr_accessor :max_buff
  334.   attr_accessor :max_debuff
  335.   attr_accessor :change_state_turns
  336.   attr_accessor :state_reapply_rules

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

  414. end # RPG::BaseItem

  415. #==============================================================================
  416. # ■ RPG::UsableItem
  417. #==============================================================================

  418. class RPG::UsableItem < RPG::BaseItem

  419.   #--------------------------------------------------------------------------
  420.   # public instance variables
  421.   #--------------------------------------------------------------------------
  422.   attr_accessor :change_state_turns
  423.   attr_accessor :change_buff_turns
  424.   attr_accessor :change_debuff_turns

  425.   #--------------------------------------------------------------------------
  426.   # common cache: load_notetags_bsm
  427.   #--------------------------------------------------------------------------
  428.   def load_notetags_bsm
  429.     @change_state_turns = {}
  430.     @change_buff_turns = {}
  431.     @change_debuff_turns = {}
  432.     #---
  433.     self.note.split(/[\r\n]+/).each { |line|
  434.       case line
  435.       #---
  436.       when YEA::REGEXP::USABLEITEM::CHANGE_STATE_TURN
  437.         @change_state_turns[$1.to_i] = $2.to_i
  438.       when YEA::REGEXP::USABLEITEM::CHANGE_BUFF_TURN
  439.         case $1.upcase
  440.         when "MAXHP", "MHP", "HP"
  441.           @change_buff_turns[0] = $2.to_i
  442.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  443.           @change_buff_turns[1] = $2.to_i
  444.         when "ATK"
  445.           @change_buff_turns[2] = $2.to_i
  446.         when "DEF"
  447.           @change_buff_turns[3] = $2.to_i
  448.         when "MAT", "INT", "SPI"
  449.           @change_buff_turns[4] = $2.to_i
  450.         when "MDF", "RES"
  451.           @change_buff_turns[5] = $2.to_i
  452.         when "AGI"
  453.           @change_buff_turns[6] = $2.to_i
  454.         when "LUK"
  455.           @change_buff_turns[7] = $2.to_i
  456.         when "ALL"
  457.           for i in 0...8; @change_buff_turns[i] = $2.to_i; end
  458.         end
  459.       when YEA::REGEXP::USABLEITEM::CHANGE_DEBUFF_TURN
  460.         case $1.upcase
  461.         when "MAXHP", "MHP", "HP"
  462.           @change_debuff_turns[0] = $2.to_i
  463.         when "MAXMP", "MMP", "MP", "MAXSP", "SP", "MSP"
  464.           @change_debuff_turns[1] = $2.to_i
  465.         when "ATK"
  466.           @change_debuff_turns[2] = $2.to_i
  467.         when "DEF"
  468.           @change_debuff_turns[3] = $2.to_i
  469.         when "MAT", "INT", "SPI"
  470.           @change_debuff_turns[4] = $2.to_i
  471.         when "MDF", "RES"
  472.           @change_debuff_turns[5] = $2.to_i
  473.         when "AGI"
  474.           @change_debuff_turns[6] = $2.to_i
  475.         when "LUK"
  476.           @change_debuff_turns[7] = $2.to_i
  477.         when "ALL"
  478.           for i in 0...8; @change_debuff_turns[i] = $2.to_i; end
  479.         end
  480.       end
  481.     } # self.note.split
  482.     #---
  483.   end

  484. end # class RPG::UsableItem

  485. #==============================================================================
  486. # ■ Game_BattlerBase
  487. #==============================================================================

  488. class Game_BattlerBase

  489.   #--------------------------------------------------------------------------
  490.   # overwrite method: param_buff_rate
  491.   #--------------------------------------------------------------------------
  492.   def param_buff_rate(param_id)
  493.     return eval(YEA::BUFF_STATE_MANAGER::BUFF_BOOST_FORMULA)
  494.   end

  495.   #--------------------------------------------------------------------------
  496.   # new method: max_buff_limit
  497.   #--------------------------------------------------------------------------
  498.   def max_buff_limit(param_id)
  499.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  500.     if actor?
  501.       n += self.actor.max_buff[param_id]
  502.       n += self.class.max_buff[param_id]
  503.       for equip in equips
  504.         next if equip.nil?
  505.         n += equip.max_buff[param_id]
  506.       end
  507.     else
  508.       n += self.enemy.max_buff[param_id]
  509.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  510.         n += self.class.max_buff[param_id]
  511.       end
  512.     end
  513.     for state in states
  514.       next if state.nil?
  515.       n += state.max_buff[param_id]
  516.     end
  517.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  518.   end

  519.   #--------------------------------------------------------------------------
  520.   # new method: max_debuff_limit
  521.   #--------------------------------------------------------------------------
  522.   def max_debuff_limit(param_id)
  523.     n = YEA::BUFF_STATE_MANAGER::DEFAULT_BUFF_LIMIT
  524.     if actor?
  525.       n += self.actor.max_debuff[param_id]
  526.       n += self.class.max_debuff[param_id]
  527.       for equip in equips
  528.         next if equip.nil?
  529.         n += equip.max_debuff[param_id]
  530.       end
  531.     else
  532.       n += self.enemy.max_debuff[param_id]
  533.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  534.         n += self.class.max_debuff[param_id]
  535.       end
  536.     end
  537.     for state in states
  538.       next if state.nil?
  539.       n += state.max_debuff[param_id]
  540.     end
  541.     return [[n.to_i, 0].max, YEA::BUFF_STATE_MANAGER::MAXIMUM_BUFF_LIMIT].min
  542.   end

  543.   #--------------------------------------------------------------------------
  544.   # overwrite method: buff_icon_index
  545.   #--------------------------------------------------------------------------
  546.   def buff_icon_index(buff_level, param_id)
  547.     if buff_level > 0
  548.       return ICON_BUFF_START + ([buff_level - 1, 1].min) * 8 + param_id
  549.     elsif buff_level < 0
  550.       return ICON_DEBUFF_START + ([-buff_level - 1, -1].max) * 8 + param_id
  551.     else
  552.       return 0
  553.     end
  554.   end

  555.   #--------------------------------------------------------------------------
  556.   # new method: buff_turns
  557.   #--------------------------------------------------------------------------
  558.   def buff_turns(param_id)
  559.     return @buff_turns.include?(param_id) ? @buff_turns[param_id] : 0
  560.   end

  561.   #--------------------------------------------------------------------------
  562.   # new method: buff_level
  563.   #--------------------------------------------------------------------------
  564.   def buff_level(param_id)
  565.     return 0 if @buffs[param_id].nil?
  566.     buff_maximum = max_buff_limit(param_id)
  567.     debuff_maximum = max_debuff_limit(param_id)
  568.     return [[@buffs[param_id], buff_maximum].min, -debuff_maximum].max
  569.   end

  570.   #--------------------------------------------------------------------------
  571.   # new method: buff_change_turns
  572.   #--------------------------------------------------------------------------
  573.   def buff_change_turns(param_id, value)
  574.     @buff_turns[param_id] = 0 if @buff_turns[param_id].nil?
  575.     @buff_turns[param_id] = [value, 0].max
  576.   end

  577.   #--------------------------------------------------------------------------
  578.   # new method: state_turns
  579.   #--------------------------------------------------------------------------
  580.   def state_turns(state_id)
  581.     state_id = state_id.id if state_id.is_a?(RPG::State)
  582.     return @state_turns.include?(state_id) ? @state_turns[state_id] : 0
  583.   end

  584.   #--------------------------------------------------------------------------
  585.   # new method: state_steps
  586.   #--------------------------------------------------------------------------
  587.   def state_steps(state_id)
  588.     state_id = state_id.id if state_id.is_a?(RPG::State)
  589.     return @state_steps.include?(state_id) ? @state_steps[state_id] : 0
  590.   end

  591.   #--------------------------------------------------------------------------
  592.   # new method: state_change_turns
  593.   #--------------------------------------------------------------------------
  594.   def state_change_turns(state_id, value)
  595.     state_id = state_id.id if state_id.is_a?(RPG::State)
  596.     @state_turns[state_id] = 0 if @state_turns[state_id].nil?
  597.     @state_turns[state_id] = [value, 0].max
  598.   end

  599.   #--------------------------------------------------------------------------
  600.   # new method: state_turn_mod
  601.   #--------------------------------------------------------------------------
  602.   def state_turn_mod(state_id)
  603.     return 0 if $data_states[state_id].nil?
  604.     state = $data_states[state_id]
  605.     n = state.min_turns + rand(1 + [state.max_turns - state.min_turns, 0].max)
  606.     if actor?
  607.       if self.actor.change_state_turns.include?(state_id)
  608.         n += self.actor.change_state_turns[state_id]
  609.       end
  610.       if self.class.change_state_turns.include?(state_id)
  611.         n += self.class.change_state_turns[state_id]
  612.       end
  613.       for equip in equips
  614.         next if equip.nil?
  615.         next unless equip.change_state_turns.include?(state_id)
  616.         n += equip.change_state_turns[state_id]
  617.       end
  618.     else
  619.       if self.enemy.change_state_turns.include?(state_id)
  620.         n += self.enemy.change_state_turns[state_id]
  621.       end
  622.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  623.         if self.class.change_state_turns.include?(state_id)
  624.           n += self.class.change_state_turns[state_id]
  625.         end
  626.       end
  627.     end
  628.     for state in states
  629.       next if state.nil?
  630.       next unless state.change_state_turns.include?(state_id)
  631.       n += state.change_state_turns[state_id]
  632.     end
  633.     return [n, 0].max
  634.   end

  635. end # Game_BattlerBase

  636. #==============================================================================
  637. # ■ Game_Battler
  638. #==============================================================================

  639. class Game_Battler < Game_BattlerBase

  640.   #--------------------------------------------------------------------------
  641.   # overwrite method: buff_max?
  642.   #--------------------------------------------------------------------------
  643.   def buff_max?(param_id)
  644.     return @buffs[param_id] == max_buff_limit(param_id)
  645.   end

  646.   #--------------------------------------------------------------------------
  647.   # overwrite method: debuff_max?
  648.   #--------------------------------------------------------------------------
  649.   def debuff_max?(param_id)
  650.     return @buffs[param_id] == -max_debuff_limit(param_id)
  651.   end

  652.   #--------------------------------------------------------------------------
  653.   # overwrite method: add_state
  654.   #--------------------------------------------------------------------------
  655.   def add_state(state_id)
  656.     return if $data_states[state_id].nil?
  657.     state_rules = $data_states[state_id].state_reapply_rules
  658.     return if state_rules == 0 && state?(state_id)
  659.     if state_addable?(state_id)
  660.       add_new_state(state_id) unless state?(state_id)
  661.       reset_state_counts(state_id) if state_rules == 1
  662.       total_state_counts(state_id) if state_rules == 2
  663.       @result.added_states.push(state_id).uniq!
  664.     end
  665.   end

  666.   #--------------------------------------------------------------------------
  667.   # overwrite method: state_removed?
  668.   #--------------------------------------------------------------------------
  669.   def state_removed?(state_id)
  670.     return false
  671.   end

  672.   #--------------------------------------------------------------------------
  673.   # overwrite method: reset_state_counts
  674.   #--------------------------------------------------------------------------
  675.   def reset_state_counts(state_id)
  676.     state = $data_states[state_id]
  677.     @state_turns[state_id] = state_turn_mod(state_id)
  678.     @state_steps[state_id] = state.steps_to_remove
  679.   end

  680.   #--------------------------------------------------------------------------
  681.   # new method: total_state_counts
  682.   #--------------------------------------------------------------------------
  683.   def total_state_counts(state_id)
  684.     state = $data_states[state_id]
  685.     value = state_turn_mod(state_id)
  686.     state_change_turns(state_id, value + state_turns(state_id))
  687.   end

  688.   #--------------------------------------------------------------------------
  689.   # alias method: item_user_effect
  690.   #--------------------------------------------------------------------------
  691.   alias game_battler_item_user_effect_bsm item_user_effect
  692.   def item_user_effect(user, item)
  693.     game_battler_item_user_effect_bsm(user, item)
  694.     apply_state_turn_changes(user, item)
  695.     apply_buff_turn_changes(user, item)
  696.     apply_debuff_turn_changes(user, item)
  697.   end

  698.   #--------------------------------------------------------------------------
  699.   # new method: apply_state_turn_changes
  700.   #--------------------------------------------------------------------------
  701.   def apply_state_turn_changes(user, item)
  702.     return if item.nil?
  703.     return unless $game_party.in_battle
  704.     for key in item.change_state_turns
  705.       state_id = key[0]
  706.       next if field_state?(state_id)
  707.       next unless state?(state_id)
  708.       next unless $data_states[state_id].auto_removal_timing > 0
  709.       state_change_turns(state_id, key[1] + state_turns(state_id))
  710.       remove_state(state_id) if state_turns(state_id) <= 0
  711.       @result.success = true
  712.     end
  713.   end

  714.   #--------------------------------------------------------------------------
  715.   # new method: field_state?
  716.   #--------------------------------------------------------------------------
  717.   def field_state?(state_id)
  718.     return false unless $imported["YEA-FieldStateEffects"]
  719.     return false unless $game_party.in_battle
  720.     return false unless SceneManager.scene_is?(Scene_Battle)
  721.     return BattleManager.field_state?(state_id)
  722.   end

  723.   #--------------------------------------------------------------------------
  724.   # new method: apply_buff_turn_changes
  725.   #--------------------------------------------------------------------------
  726.   def apply_buff_turn_changes(user, item)
  727.     return if item.nil?
  728.     return unless $game_party.in_battle
  729.     for key in item.change_buff_turns
  730.       param_id = key[0]
  731.       next unless buff?(param_id)
  732.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  733.       remove_buff(param_id) if buff_turns(param_id) < 0
  734.       @result.success = true
  735.     end
  736.   end

  737.   #--------------------------------------------------------------------------
  738.   # new method: apply_debuff_turn_changes
  739.   #--------------------------------------------------------------------------
  740.   def apply_debuff_turn_changes(user, item)
  741.     return if item.nil?
  742.     return unless $game_party.in_battle
  743.     for key in item.change_debuff_turns
  744.       param_id = key[0]
  745.       next unless debuff?(param_id)
  746.       buff_change_turns(param_id, key[1] + buff_turns(param_id))
  747.       remove_buff(param_id) if buff_turns(param_id) < 0
  748.       @result.success = true
  749.     end
  750.   end

  751. end # Game_Battler

  752. #==============================================================================
  753. # ■ Window_Base
  754. #==============================================================================

  755. class Window_Base < Window

  756.   #--------------------------------------------------------------------------
  757.   # alias method: draw_actor_icons
  758.   #--------------------------------------------------------------------------
  759.   alias window_base_draw_actor_icons_bsm draw_actor_icons
  760.   def draw_actor_icons(actor, dx, dy, dw = 96)
  761.     window_base_draw_actor_icons_bsm(actor, dx, dy, dw)
  762.     draw_actor_icon_turns(actor, dx, dy, dw)
  763.   end

  764.   #--------------------------------------------------------------------------
  765.   # new method: draw_actor_icon_turns
  766.   #--------------------------------------------------------------------------
  767.   def draw_actor_icon_turns(actor, dx, dy, dw)
  768.     return unless YEA::BUFF_STATE_MANAGER::SHOW_REMAINING_TURNS
  769.     return unless SceneManager.scene_is?(Scene_Battle)
  770.     reset_font_settings
  771.     contents.font.out_color.alpha = 255
  772.     contents.font.bold = true
  773.     contents.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE
  774.     bx = dx
  775.     dy += YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y
  776.     #---
  777.     for state in actor.states
  778.       break if dx + 24 >= dw + bx
  779.       next if state.icon_index <= 0
  780.       turns = actor.state_turns(state.id).to_i
  781.       if $imported["YEA-FieldStateEffects"] &&
  782.       BattleManager.field_state?(state.id)
  783.         turns = BattleManager.field_state_turns(state.id)
  784.       end
  785.       if state.auto_removal_timing > 0 && turns < 100
  786.         draw_text(dx, dy, 24, line_height, turns, 2)
  787.       end
  788.       dx += 24
  789.     end
  790.     #---
  791.     for i in 0...8
  792.       break if dx + 24 >= dw + bx
  793.       next if actor.buff_icon_index(actor.buff_level(i), i) == 0
  794.       turns = actor.buff_turns(i).to_i
  795.       draw_text(dx, dy, 24, line_height, turns, 2) if turns < 100
  796.       dx += 24
  797.     end
  798.     #---
  799.     contents.font.out_color = Font.default_out_color
  800.     reset_font_settings
  801.   end

  802. end # Window_Base

  803. #==============================================================================
  804. #
  805. # ▼ End of File
  806. #
  807. #==============================================================================
复制代码

有没有大佬帮看看是哪里出了问题,万分感谢

Lv3.寻梦者

梦石
0
星屑
2333
在线时间
275 小时
注册时间
2017-7-25
帖子
163
3
 楼主| 发表于 2022-7-22 21:59:07 | 只看该作者
alexncf125 发表于 2022-7-22 07:43
Akahara的状态层数脚本没冲突,
这个脚本用的是自成一套的state_levels而已,
yea显示的可是state_turns

Akahara那个试了几次还是无效,可能是其他脚本的原因,还得再翻翻SHI山
TheoAllen的改了以后可以正常生效了,但是冒出来一个新毛病,一个敌人上叠了几个BUFF,一回合过去剩余时间就跳掉几回合,比如出血持续是5回合,正常来说上完出血下一回合能看到持续是4,但是如果怪身上3个出血,下回合一看持续就剩2了
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
26398
在线时间
5370 小时
注册时间
2016-3-8
帖子
1658
2
发表于 2022-7-22 07:43:43 | 只看该作者
本帖最后由 alexncf125 于 2022-7-22 07:52 编辑
骷髅岛遗老 发表于 2022-7-22 02:20
顺便附上另外两个同样冲突的状态堆叠脚本


Akahara的状态层数脚本没冲突,
这个脚本用的是自成一套的state_levels而已,
yea显示的可是state_turns

TheoAllen的状态堆叠在脚本列表的位置放yea的上方,
之后在yea第708行后加上 && state_maxed?(state_id)
改成add_new_state(state_id) unless state?(state_id) && state_maxed?(state_id)
不过我猜这脚本实现的效果可能不是你想要的效果

如果你只是想要"重复获得状态时会累计层数"的效果
yea那个可以在备注用<reapply total>

# <reapply total>
# If this state is cast on a battler with the state already applied, the turns
# will be added on to the current amount of turns remaining giving the battler
# a total of the remaining turns with the default turns for the state.
如果此状态被施展在已应用状态的战斗者身上,则回合数将添加到当前剩余回合数中,为战斗者提供该状态的默认回合数的总剩余回合数。
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2333
在线时间
275 小时
注册时间
2017-7-25
帖子
163
1
 楼主| 发表于 2022-7-22 02:20:33 | 只看该作者
顺便附上另外两个同样冲突的状态堆叠脚本
  1. # =============================================================================
  2. # 状态层数脚本 By Akahara
  3. # =============================================================================
  4. # 是否时常因为制作层数状态需要复制粘贴好几个无法制作数十层而感到苦恼?
  5. # 为状态新增了max_level和state_levels的概念
  6. # 在状态的备注中填写<level: x>,即该状态上限x层,未填写默认为1层
  7. # 可以通过state_levels(state_id)来制作每层增加数值的效果
  8. # 具体使用方法可以查阅https://rpg.blue/thread-486408-1-1.html
  9. # =============================================================================
  10. class RPG::State < RPG::BaseItem
  11.   attr_accessor :max_level

  12.   def load_level
  13.     @max_level = 1
  14.     note.split(/[\r\n]+/).each do |line|
  15.       if line =~ /<level:[ ]*(\d+)>/i
  16.         @max_level = $1.to_i
  17.       end
  18.     end
  19.   end

  20. end

  21. class << DataManager

  22.   alias theo_levelstate_load_db load_database
  23.   def load_database
  24.     theo_levelstate_load_db
  25.     load_levelstate_db
  26.   end

  27.   def load_levelstate_db
  28.     $data_states.compact.each do |state|
  29.       state.load_level
  30.     end
  31.   end

  32. end

  33. class Game_BattlerBase
  34.   attr_reader   :state_levels  
  35.   alias clear_states_levels clear_states
  36.   def clear_states
  37.     clear_states_levels
  38.     @state_levels = {}
  39.   end

  40.   alias erase_state_levels erase_state
  41.   def erase_state(state_id)
  42.     erase_state_levels(state_id)
  43.     reset_state_levels(state_id)
  44.   end

  45.   def reset_state_levels(state_id)
  46.     @state_levels ||= {}
  47.     @state_levels.delete(state_id)
  48.   end  

  49.   def set_state_levels(state_id)
  50.     @state_levels ||= {}
  51.     @state_levels[state_id] ||= 0   
  52.   end

  53.   def state_levels(state_id)
  54.     @state_levels ||= {}
  55.     d = @state_levels[state_id]
  56.     d ? d : 0
  57.   end
  58. end

  59. class Game_Battler < Game_BattlerBase
  60.   alias akahara_r_20210719 remove_state
  61.   def remove_state(state_id)
  62.     akahara_r_20210719(state_id)
  63.     reset_state_levels(state_id)
  64.   end

  65.   alias akahara_20210719 add_state
  66.   def add_state(state_id)
  67.     akahara_20210719(state_id)
  68.     set_state_levels(state_id)
  69.     if state_addable?(state_id)
  70.       return if $data_states[state_id].max_level <= 1
  71.       if @state_levels[state_id] < 1
  72.         @state_levels[state_id] = 1
  73.         return ;
  74.       end
  75.       if state?(state_id)
  76.         @state_levels[state_id] += 1 if @state_levels[state_id] != $data_states[state_id].max_level
  77.       end
  78.     end
  79.   end
  80. end
复制代码

  1. # =============================================================================
  2. # TheoAllen - 状态堆叠
  3. # Version : 1.0
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. # =============================================================================
  7. ($imported ||= {})[:Theo_StackingState] = true
  8. # =============================================================================
  9. # Change Logs:
  10. # -----------------------------------------------------------------------------
  11. # 2013.10.24 - Finished Script
  12. # =============================================================================
  13. =begin

  14.   介绍 :
  15.   本脚本可以使相同状态效果互相叠加.
  16.   
  17.   使用方法 :
  18.   本脚本放在插件脚本之下,main之上
  19.   状态备注: <stack: n>
  20.   n为最大堆叠数量。
  21.   
  22.   使用条款 :
  23.   署名脚本作者, TheoAllen. 你可以自由编辑此脚本,只要你不声明你是脚本的原作者
  24.   如果你想用此脚本于商业游戏,请和我共享收益.别忘了给我一份免费的游戏拷贝.

  25. =end
  26. # =============================================================================
  27. # 无设定
  28. # =============================================================================
  29. class RPG::State < RPG::BaseItem
  30.   attr_accessor :max_stack

  31.   def load_stack
  32.     @max_stack = 1
  33.     note.split(/[\r\n]+/).each do |line|
  34.       if line =~ /<stack:[ ]*(\d+)>/i
  35.         @max_stack = $1.to_i
  36.       end
  37.     end
  38.   end

  39. end

  40. class << DataManager

  41.   alias theo_stackstate_load_db load_database
  42.   def load_database
  43.     theo_stackstate_load_db
  44.     load_stackstate_db
  45.   end

  46.   def load_stackstate_db
  47.     $data_states.compact.each do |state|
  48.       state.load_stack
  49.     end
  50.   end

  51. end

  52. class Game_Battler < Game_BattlerBase
  53.   # ---------------------------------------------------------------------------
  54.   # Overwrite add state
  55.   # ---------------------------------------------------------------------------
  56.   def add_state(state_id)
  57.     #puts @states.select {|id| id == state_id}.size
  58.     if state_addable?(state_id)
  59.       add_new_state(state_id) unless state?(state_id) && state_maxed?(state_id)
  60.       reset_state_counts(state_id)
  61.       @result.added_states.push(state_id).uniq!
  62.     end
  63.   end

  64.   def state_maxed?(state_id)
  65.     @states.select {|id| id == state_id}.size ==
  66.       $data_states[state_id].max_stack
  67.   end

  68. end
复制代码
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-5 10:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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