Advertisement
mrbubble

Auto-Life Effect

Jul 10th, 2012
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 25.79 KB | None | 0 0
  1. #==============================================================================
  2. # ++ Auto-Life Effect ++                                        v1.8 (7/12/12)
  3. #==============================================================================
  4. # Script by:
  5. #     Mr. Bubble ( http://mrbubblewand.wordpress.com/ )
  6. # Thanks:
  7. #     Yanfly, script and design references
  8. #     Mithran, regexp examples
  9. #--------------------------------------------------------------------------
  10. # This script is my attempt to replicate the well-known status effect
  11. # "Auto-Life" a.k.a. "Reraise", "Life 3", "Lifeline", etc. in VX Ace.
  12. # Auto-life automatically revives battlers when they are Incapacitated
  13. # in battle.
  14. #
  15. # This effect is limited to equipment and states. Auto-life revive
  16. # checks are done after the action that killed battler is completed.
  17. #
  18. # Be aware that the customization module in this script allows you to
  19. # assign a Game Switch that disables all auto-life effects in-game. This
  20. # is useful for evented battles.
  21. #
  22. # If you experience bug or oddities related to auto-life, please report
  23. # them to me.
  24. #--------------------------------------------------------------------------
  25. #   ++ Changelog ++
  26. #--------------------------------------------------------------------------
  27. # v1.8 : Removed debug remnant. (7/12/2012)
  28. # v1.7 : Fixed F8 crash with YEA Battle Engine. (7/12/2012)
  29. # v1.6 : Fixed a typo which caused an error. (7/12/2012)
  30. # v1.5 : 'Attack Times+' issues should be fixed now.
  31. #      : New option added in customization module.
  32. #      : Auto-life checks are now also done at the end of turn. (7/11/2012)
  33. # v1.4 : Compatibility update for 'Guts Effects' (7/11/2012)
  34. # v1.3 : Efficiency update. (7/11/2012)
  35. # v1.2 : autolifeable flags are now reset before each battle. (7/10/2012)
  36. # v1.1 : DISABLE_AUTOLIFE_SWITCH_ID should now work. (7/10/2012)
  37. # v1.0 : Initial release. (7/10/2012)
  38. #--------------------------------------------------------------------------
  39. #   ++ Installation ++
  40. #--------------------------------------------------------------------------
  41. # Install this script in the Materials section in your project's
  42. # script editor.
  43. #
  44. # Install this script below any scripts that modify the default
  45. # battle system in you script editor.
  46. #==============================================================================
  47. #   ++ Auto-Life Notetags ++
  48. #==============================================================================
  49. # The following Notetags are for States, Weapons, and Armors.
  50. #
  51. # Note: Some tags are given shorter tags for typing convenience. You only
  52. #       need to use one <tag> from a given group for a notebox.
  53. #
  54. # <autolife>
  55. #   This tag provides an in-battle auto-life effect to the state or equipment.
  56. #   This tag will use all default auto-life values as defined in the
  57. #   customization module in this script.
  58. #    
  59. # <custom autolife>
  60. # setting
  61. # setting
  62. # </custom autolife>
  63. #   This tag allows you create auto-life equipment and states with custom
  64. #   values. You can add as many settings between the <custom> tags as you
  65. #   like. Any settings you do not include will use the default values
  66. #   defined in the customization module. The following settings are available:
  67. #  
  68. #     chance: n%
  69. #       This setting defines the chance of auto-life triggering when
  70. #       the battler dies where n is a percentage value between 0.1 ~ 100.0.
  71. #      
  72. #     hp recovery: n%
  73. #     hp: n%
  74. #       This setting defines the amount of HP the battler recovers when
  75. #       auto-life is triggered where n is the percentage rate recovered
  76. #       based on MAX HP. If set to 0%, the battler will regain at least
  77. #       1 HP.
  78. #      
  79. #     mp recovery: n%
  80. #     mp: n%
  81. #       This setting defines the amount of MP the battler recovers when
  82. #       auto-life is triggered where n is the percentage rate recovered
  83. #       based on MAX MP.
  84. #      
  85. #     animation id: id
  86. #     ani id: id
  87. #       This setting defines the database animation used on the battler
  88. #       when auto-life is triggered where id is the animation ID number
  89. #       found in your database.
  90. #      
  91. #     break: n%
  92. #       This setting defines the chance of the piece of equipment breaking
  93. #       when auto-life is triggered where n is a percentage value between
  94. #       0.0 ~ 100.0. This setting is only for equipment.
  95. #      
  96. # Here is an example of a custom autolife tag:
  97. #
  98. #   <custom autolife>
  99. #   chance: 50%
  100. #   hp: 5%
  101. #   ani id: 41
  102. #   </custom autolife>
  103. #
  104. # The settings "mp recovery" and "break" would use their default values
  105. # since they are not included in this example tag.
  106. #--------------------------------------------------------------------------
  107. #   ++ Compatibility ++
  108. #--------------------------------------------------------------------------
  109. # This script has built-in compatibility with the following scripts:
  110. #
  111. #     -Guts Effect
  112. #     -YEA Battle Engine
  113. #
  114. # This script aliases the following default VXA methods:
  115. #
  116. #     BattleManager#judge_win_loss
  117. #
  118. #     Game_BattlerBase#initialize
  119. #
  120. #     Game_Battler#on_battle_end
  121. #     Game_Battler#on_battle_start
  122. #     Game_Battler#die
  123. #
  124. #     Scene_Battle#process_action
  125. #     Scene_Battle#process_action_end
  126. #     Scene_Battle#turn_end
  127. #    
  128. # There are no default method overwrites.
  129. #
  130. # Requests for compatibility with other scripts are welcome.
  131. #--------------------------------------------------------------------------
  132. #      Compatibility Notes
  133. #--------------------------------------------------------------------------
  134. # If 'Auto-Life Effects' and 'Guts Effects' are installed in the same
  135. # project, auto-life effects will always take precdence over guts
  136. # effects.
  137. #--------------------------------------------------------------------------
  138. #   ++ Terms and Conditions ++
  139. #--------------------------------------------------------------------------
  140. # Please do not repost this script elsewhere without permission.
  141. # Free for non-commercial use. For commercial use, contact me first.
  142. #
  143. # Newest versions of this script can be found at
  144. #                                           http://mrbubblewand.wordpress.com/
  145. #==============================================================================
  146.  
  147. $imported = {} if $imported.nil?
  148. $imported["BubsAutoLife"] = true
  149.  
  150. #==========================================================================
  151. # ++ START OF USER CUSTOMIZATION MODULE ++
  152. #==========================================================================
  153. module Bubs
  154.   #==========================================================================
  155.   # ++ Auto-Life Settings
  156.   #==========================================================================
  157.   module AutoLife
  158.   #--------------------------------------------------------------------------
  159.   #   Disable Auto-life Switch ID Setting     !! IMPORTANT SETTING !!
  160.   #--------------------------------------------------------------------------
  161.   # This setting defines the switch ID number used to determine if revival
  162.   # by auto-life is allowed in battle. This is useful for evented battles and
  163.   # such. If the ID is set to 0, no game switches will be used.
  164.   #
  165.   # If the switch is ON, all auto-life effects are disabled.
  166.   # If the switch is OFF, any auto-life effects are allowed.
  167.   DISABLE_AUTOLIFE_SWITCH_ID = 0
  168.  
  169.   #--------------------------------------------------------------------------
  170.   #   Default Auto-life Settings
  171.   #--------------------------------------------------------------------------
  172.   # These settings determine the default values for auto-life effects on
  173.   # equipment and states.  
  174.   AUTOLIFE_DEFAULTS = {
  175.     :hp_rate  => 10.0,  # HP Recovery Rate (%)
  176.     :mp_rate  => 10.0,  # MP Recovery Rate (%)
  177.     :chance   => 100.0, # Auto-life chance (%)
  178.     :break    => 100.0, # Item break chance, equipment only (%)
  179.     :ani_id   => 42,    # Animation ID number
  180.   } # <-- Do not delete.
  181.  
  182.   #--------------------------------------------------------------------------
  183.   #   Check Auto-life Triggers After Each Action
  184.   #--------------------------------------------------------------------------
  185.   # true  : Auto-life checks can be done after each complete action.
  186.   # false : Auto-life checks are done only at the end of turn.
  187.   CHECK_AFTER_EACH_ACTION = true
  188.  
  189.   #--------------------------------------------------------------------------
  190.   #   Auto-life Effect Text Setting
  191.   #--------------------------------------------------------------------------
  192.   # This setting defines the battle message that displays when auto-life
  193.   # successfuly triggers.
  194.   #
  195.   # %s is automatically replaced by the battler's name.
  196.   AUTOLIFE_EFFECT_TEXT = "%s resurrects!"
  197.  
  198.   #--------------------------------------------------------------------------
  199.   #   Item Break Text Setting
  200.   #--------------------------------------------------------------------------
  201.   # This determines the message that displays when an item breaks after
  202.   # triggering auto-life
  203.   #
  204.   # The first %s is automatically replaced by the battler's name.
  205.   # The second %s is automatically replaced by the item's name.
  206.   ITEM_BREAK_TEXT = "%s's %s breaks!"
  207.  
  208.   #--------------------------------------------------------------------------
  209.   #   Item Break Sound Effect Setting
  210.   #--------------------------------------------------------------------------
  211.   # This setting defines the sound effect used when the Item Break Text
  212.   # is displayed in-battle.
  213.   #
  214.   #                "filename", Volume, Pitch
  215.   ITEM_BREAK_SE = [ "Attack2",     80,   100]
  216.  
  217.   end # module AutoLife
  218. end # module Bubs
  219.  
  220. #==========================================================================
  221. # ++ END OF USER CUSTOMIZATION MODULE ++
  222. #==========================================================================
  223.  
  224.  
  225.  
  226. #==============================================================================
  227. # ++ Vocab
  228. #==============================================================================
  229. module Vocab
  230.   AutoLifeItemBreak = Bubs::AutoLife::ITEM_BREAK_TEXT
  231.   AutoLifeEffect = Bubs::AutoLife::AUTOLIFE_EFFECT_TEXT
  232. end # module Vocab
  233.  
  234. #==============================================================================
  235. # ++ Sound
  236. #==============================================================================
  237. module Sound
  238.   def self.play_autolife_item_break
  239.     Audio.se_play("/Audio/SE/" + Bubs::AutoLife::ITEM_BREAK_SE[0],
  240.                 Bubs::AutoLife::ITEM_BREAK_SE[1],
  241.                 Bubs::AutoLife::ITEM_BREAK_SE[2])
  242.   end
  243. end # module Sound
  244.  
  245.  
  246. #==========================================================================
  247. # ++ Bubs::Regexp
  248. #==========================================================================
  249. module Bubs
  250.   module Regexp
  251.     module BaseItem
  252.       AUTOLIFE = /<AUTO[\s-]?LIFE>/i
  253.       AUTOLIFE_START = /<CUSTOM[\s]?AUTO[\s-]?LIFE>/i
  254.       AUTOLIFE_END = /<\/CUSTOM[\s]?AUTO[\s-]?LIFE>/i
  255.     end # module BaseItem
  256.   end # module Regexp
  257. end # module Bubs
  258.  
  259.  
  260. #==========================================================================
  261. # ++ DataManager
  262. #==========================================================================
  263. module DataManager
  264.   #--------------------------------------------------------------------------
  265.   # alias : load_database
  266.   #--------------------------------------------------------------------------
  267.   class << self; alias load_database_bubs_autolife load_database; end
  268.   def self.load_database
  269.     load_database_bubs_autolife # alias
  270.     load_notetags_bubs_autolife
  271.   end
  272.  
  273.   #--------------------------------------------------------------------------
  274.   # new method : load_notetags_bubs_bof_guts
  275.   #--------------------------------------------------------------------------
  276.   def self.load_notetags_bubs_autolife
  277.     groups = [$data_weapons, $data_armors, $data_states]
  278.     for group in groups
  279.       for obj in group
  280.         next if obj.nil?
  281.         obj.load_notetags_bubs_autolife
  282.       end # for obj
  283.     end # for group
  284.   end # def
  285.  
  286. end # module DataManager
  287.  
  288.  
  289. #==========================================================================
  290. # ++ BattleManager
  291. #==========================================================================
  292. module BattleManager
  293.   class << self; alias judge_win_loss_bubs_autolife judge_win_loss; end
  294.   #--------------------------------------------------------------------------
  295.   # alias : judge_win_loss
  296.   #--------------------------------------------------------------------------
  297.   def self.judge_win_loss
  298.     if @phase
  299.       return process_abort   if aborting?
  300.       return false           if autolifeable_members
  301.     end
  302.     judge_win_loss_bubs_autolife # alias
  303.   end
  304.  
  305.   #--------------------------------------------------------------------------
  306.   # new method : autolifeable_members
  307.   #--------------------------------------------------------------------------
  308.   def self.autolifeable_members
  309.     $game_party.battle_members.each do |actor|
  310.       return true if actor.autolifeable
  311.     end
  312.    
  313.     $game_troop.members.each do |enemy|
  314.       return true if enemy.autolifeable
  315.     end
  316.    
  317.     return false
  318.   end # self
  319.  
  320. end # module BattleManager
  321.  
  322.  
  323. #==========================================================================
  324. # ++ RPG::BaseItem
  325. #==========================================================================
  326. # A superclass of actor, class, skill, item, weapon, armor, enemy, and state.
  327. class RPG::BaseItem
  328.   #--------------------------------------------------------------------------
  329.   # public instance variables
  330.   #--------------------------------------------------------------------------
  331.   attr_accessor :autolife
  332.   attr_accessor :autolife_chance
  333.   attr_accessor :autolife_hp_recovery_rate
  334.   attr_accessor :autolife_mp_recovery_rate
  335.   attr_accessor :autolife_animation_id
  336.   attr_accessor :autolife_break_chance
  337.  
  338.   #--------------------------------------------------------------------------
  339.   # common cache : load_notetags_bubs_autolife
  340.   #--------------------------------------------------------------------------
  341.   def load_notetags_bubs_autolife
  342.     @autolife = false
  343.     @autolife_chance           = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:chance]
  344.     @autolife_break_chance     = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:break]
  345.     @autolife_hp_recovery_rate = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:hp_rate]
  346.     @autolife_mp_recovery_rate = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:mp_rate]
  347.     @autolife_animation_id     = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:ani_id]
  348.    
  349.     autolife_tag = false
  350.  
  351.     self.note.split(/[\r\n]+/).each { |line|
  352.       case line
  353.       when Bubs::Regexp::BaseItem::AUTOLIFE
  354.         @autolife = true
  355.       when Bubs::Regexp::BaseItem::AUTOLIFE_START
  356.         @autolife = true
  357.         autolife_tag = true
  358.       when Bubs::Regexp::BaseItem::AUTOLIFE_END
  359.         autolife_tag = false
  360.       else
  361.         next unless autolife_tag
  362.         case line.upcase
  363.        
  364.         when /CHANCE:\s*([+]?\d+\.?\d*)[%]?/i
  365.           @autolife_chance = $1.to_f
  366.          
  367.         when /BREAK:\s*([+]?\d+\.?\d*)[%]?/i
  368.           @autolife_break_chance = $1.to_f
  369.          
  370.         when /HP\s*(?:RECOVERY)?:\s*([+]?\d+\.?\d*)[%]?/i
  371.           @autolife_hp_recovery_rate = $1.to_f
  372.          
  373.         when /MP\s*(?:RECOVERY)?:\s*([+]?\d+\.?\d*)[%]?/i
  374.           @autolife_mp_recovery_rate = $1.to_f
  375.          
  376.         when /(?:ANIMATION|ANI)\s*(?:ID)?:\s*(\d+)/i
  377.           @autolife_animation_id = $1.to_i
  378.  
  379.         end # case
  380.       end # else
  381.      
  382.     } # self.note.split
  383.   end # def
  384.  
  385. end # RPG::BaseItem
  386.  
  387.  
  388. #==============================================================================
  389. # ++ Window_BattleLog
  390. #==============================================================================
  391. class Window_BattleLog < Window_Selectable  
  392.   #--------------------------------------------------------------------------
  393.   # new method : display_guts_text
  394.   #--------------------------------------------------------------------------
  395.   def display_autolife_text(target)
  396.     add_text(sprintf(Vocab::AutoLifeEffect, target.name))
  397.     wait
  398.   end # def display_guts_text
  399.  
  400.   #--------------------------------------------------------------------------
  401.   # new method : display_autolife_item_break_text
  402.   #--------------------------------------------------------------------------
  403.   def display_autolife_item_break_text(target, item)
  404.     Sound.play_autolife_item_break
  405.     add_text(sprintf(Vocab::AutoLifeItemBreak, target.name, item.name))
  406.     wait
  407.   end # def display_guts_text
  408. end # class Window_BattleLog
  409.  
  410.  
  411. #==========================================================================
  412. # ++ Game_BattlerBase
  413. #==========================================================================
  414. class Game_BattlerBase
  415.   #--------------------------------------------------------------------------
  416.   # public instance variables
  417.   #--------------------------------------------------------------------------
  418.   attr_accessor :autolifeable         # autolife check flag
  419.   attr_accessor :autolife_state_id    # save state id before actor dies
  420.   #--------------------------------------------------------------------------
  421.   # alias : initialize
  422.   #--------------------------------------------------------------------------
  423.   alias initialize_bubs_autolife initialize
  424.   def initialize
  425.     initialize_bubs_autolife # alias
  426.    
  427.     @autolifeable = false
  428.     @autolife_state_id = 0
  429.   end
  430. end # class Game_BattlerBase
  431.  
  432.  
  433. #==============================================================================
  434. # ++ Game_Battler
  435. #==============================================================================
  436. class Game_Battler < Game_BattlerBase
  437.   #--------------------------------------------------------------------------
  438.   # alias : die
  439.   #--------------------------------------------------------------------------
  440.   alias die_bubs_autolife die
  441.   def die
  442.     @autolifeable = true
  443.     @autolife_state_id = determine_autolife_state_id
  444.    
  445.     die_bubs_autolife # alias
  446.   end # def die
  447.  
  448.   #--------------------------------------------------------------------------
  449.   # alias : on_battle_end
  450.   #--------------------------------------------------------------------------
  451.   alias on_battle_end_bubs_autolife on_battle_end
  452.   def on_battle_end
  453.     @autolifeable = false
  454.    
  455.     on_battle_end_bubs_autolife # alias
  456.   end # def on_battle_end
  457.  
  458.   #--------------------------------------------------------------------------
  459.   # alias : on_battle_start
  460.   #--------------------------------------------------------------------------
  461.   alias on_battle_start_bubs_autolife on_battle_start
  462.   def on_battle_start
  463.     @autolifeable = false
  464.    
  465.     on_battle_start_bubs_autolife # alias
  466.   end # def on_battle_start
  467.  
  468.   #--------------------------------------------------------------------------
  469.   # new method : determine_autolife_item
  470.   #--------------------------------------------------------------------------
  471.   def determine_autolife_item
  472.     # States
  473.     if @autolife_state_id != 0
  474.       id = @autolife_state_id
  475.       @autolife_state_id = 0
  476.       return $data_states[id]
  477.     end
  478.     # Actor equips
  479.     if actor?
  480.       for equip in equips
  481.         next if equip.nil?
  482.         return equip if activate_autolife?(equip)
  483.       end # for
  484.     end # if
  485.    
  486.     return nil
  487.   end # def determine_autolife_item
  488.  
  489.   #--------------------------------------------------------------------------
  490.   # new method : determine_autolife_state_id
  491.   #--------------------------------------------------------------------------
  492.   # All states are wiped out upon dying so this method returns
  493.   # the id number of the state that successfully triggers autolife.
  494.   def determine_autolife_state_id
  495.     for state in states
  496.       next if state.nil?
  497.       return state.id if activate_autolife?(state)
  498.     end # for
  499.     return 0
  500.   end
  501.  
  502.   #--------------------------------------------------------------------------
  503.   # new method : apply_autolife_effects
  504.   #--------------------------------------------------------------------------
  505.   def apply_autolife_effects(item)
  506.     revive
  507.     autolife_recovery(item)
  508.     remove_autolife_state(item)
  509.   end
  510.  
  511.   #--------------------------------------------------------------------------
  512.   # new method : remove_autolife_item
  513.   #--------------------------------------------------------------------------
  514.   def remove_autolife_item(item)
  515.     return unless actor?
  516.     discard_equip(item) if item.is_a?(RPG::EquipItem)
  517.   end
  518.  
  519.   #--------------------------------------------------------------------------
  520.   # new method : remove_autolife_state
  521.   #--------------------------------------------------------------------------
  522.   def remove_autolife_state(item)
  523.     remove_state(item.id) if item.is_a?(RPG::State)
  524.   end
  525.  
  526.   #--------------------------------------------------------------------------
  527.   # new method : autolife_recovery
  528.   #--------------------------------------------------------------------------
  529.   def autolife_recovery(item)
  530.     self.hp += (mhp * (item.autolife_hp_recovery_rate * 0.01)).to_i
  531.     self.mp += (mmp * (item.autolife_mp_recovery_rate * 0.01)).to_i
  532.   end
  533.  
  534.   #--------------------------------------------------------------------------
  535.   # new method : autolife_disabled?
  536.   #--------------------------------------------------------------------------
  537.   def autolife_disabled?
  538.     return false
  539.   end
  540.  
  541.   #--------------------------------------------------------------------------
  542.   # new method : activate_autolife?
  543.   #--------------------------------------------------------------------------
  544.   def activate_autolife?(item)
  545.     return false unless item.autolife
  546.     rand < (item.autolife_chance * 0.01)
  547.   end
  548.  
  549. end # class Game_Battler
  550.  
  551.  
  552. #==============================================================================
  553. # ++ Scene_Battle
  554. #==============================================================================
  555. class Scene_Battle < Scene_Base
  556.   #--------------------------------------------------------------------------
  557.   # alias : process_action
  558.   #--------------------------------------------------------------------------
  559.   alias process_action_bubs_autolife process_action
  560.   def process_action
  561.     process_action_bubs_autolife # alias
  562.    
  563.     # process_action_end never gets called if the last party member is
  564.     # killed by an enemy with more Action Time+ actions in queue.
  565.     # This clears all actions of all battlers
  566.     if !@subject.nil?
  567.       if @subject.current_action && $game_party.all_dead?
  568.         all_battle_members.each do |battler|
  569.           battler.clear_actions
  570.         end
  571.       end
  572.     end
  573.   end # def process_action
  574.  
  575.   #--------------------------------------------------------------------------
  576.   # alias : process_action_end
  577.   #--------------------------------------------------------------------------
  578.   alias process_action_end_bubs_autolife process_action_end
  579.   def process_action_end
  580.     if Bubs::AutoLife::CHECK_AFTER_EACH_ACTION
  581.       process_autolife_check
  582.     end
  583.    
  584.     process_action_end_bubs_autolife # alias
  585.   end # def process_action_end
  586.  
  587.   #--------------------------------------------------------------------------
  588.   # alias : turn_end
  589.   #--------------------------------------------------------------------------
  590.   alias turn_end_bubs_autolife turn_end
  591.   def turn_end
  592.     process_autolife_check
  593.    
  594.     turn_end_bubs_autolife # alias
  595.   end # def turn_end
  596.    
  597.   #--------------------------------------------------------------------------
  598.   # new method : process_autolife_check
  599.   #--------------------------------------------------------------------------
  600.   def process_autolife_check
  601.     all_battle_members.each do |battler|
  602.       determine_autolife(battler)
  603.       determine_guts(battler) if $imported["BubsGuts"]
  604.     end
  605.   end # def process_autolife_check
  606.  
  607.   #--------------------------------------------------------------------------
  608.   # new method : determine_autolife
  609.   #--------------------------------------------------------------------------
  610.   def determine_autolife(battler)
  611.     return unless battler.autolifeable
  612.     battler.autolifeable = false
  613.     return if $game_switches[Bubs::AutoLife::DISABLE_AUTOLIFE_SWITCH_ID]
  614.     return unless battler.dead?
  615.     return if battler.autolife_disabled?
  616.     item = battler.determine_autolife_item
  617.     return if item.nil?
  618.    
  619.     @log_window.clear
  620.     # Display general autolife text
  621.     @log_window.display_autolife_text(battler)
  622.     # Heal battler
  623.     battler.apply_autolife_effects(item)
  624.     @status_window.refresh
  625.     # Play animation on battler
  626.     show_animation([battler], item.autolife_animation_id)
  627.     determine_autolife_item_break(battler, item)
  628.    
  629.     wait(35)
  630.     @log_window.clear
  631.   end # def apply_guts_effects
  632.  
  633.   #--------------------------------------------------------------------------
  634.   # new method : determine_autolife_item_break
  635.   #--------------------------------------------------------------------------
  636.   def determine_autolife_item_break(battler, item)
  637.     return unless item.is_a?(RPG::EquipItem)
  638.     return unless (rand < (item.autolife_break_chance * 0.01))
  639.     @log_window.display_autolife_item_break_text(battler, item)
  640.     battler.discard_equip(item)
  641.   end
  642.  
  643.   #--------------------------------------------------------------------------
  644.   # new method : clear_all_autolifeable_flags
  645.   #--------------------------------------------------------------------------
  646.   def clear_all_autolifeable_flags
  647.     all_battle_members.each do |member|
  648.       member.autolifeable = false
  649.     end
  650.   end
  651.  
  652.   if $imported["YEA-BattleEngine"]
  653.   #--------------------------------------------------------------------------
  654.   # alias : debug_kill_all
  655.   #--------------------------------------------------------------------------
  656.   alias debug_kill_all_bubs_autolife debug_kill_all
  657.   def debug_kill_all
  658.     debug_kill_all_bubs_autolife # alias
  659.    
  660.     clear_all_autolifeable_flags
  661.   end
  662.   end # if $imported["YEA-BattleEngine"]
  663.  
  664. end # class Scene_Battle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement