Jump to content
kal

Ruby/RGSS3 questions that don't deserve their own thread

Recommended Posts

I dunno if anyone would be familiar with the spellmaker from the early Elder Scrolls games, but if so, I'm curious to know if there's a script or script system that emulates this.

Share this post


Link to post
Share on other sites

How would I make a status that damages the battler with the state whenever they deal damage to another battler?
Sorta like a bleed status that makes you take recoil damage for trying to fight through it.
I imagine there might be a way to do this with yanfly lunatic states, using "<while effect: string>", but I don't know how to identify when the user is specifically dealing damage to a target.

Share this post


Link to post
Share on other sites
2 minutes ago, roninator2 said:

I believe Thorn damage is what you want. There is code for this around somewhere.

https://alistairengine.wordpress.com/2015/07/18/thorn-aura-addon/

Allows the battler to take damage when attacking the member with the thorn aura.

That is the opposite of what I am asking for

I'm asking for a debuff state that makes the person with the state take damage when they deal damage.
It essentially makes it so all of their attacks work like double edge from pokemon.

Share this post


Link to post
Share on other sites
On 9/23/2022 at 7:15 AM, Placebo said:

That is the opposite of what I am asking for

I just tried to reverse the thorn effect.

Try this. Use <bleed X>

Spoiler

#===============================================================================
# AE - Alistair Engine
#===============================================================================
# Code Snippet: Bleed Effect - reverse from Thorn Aura by Roninator2
# Version: 1.0
#
# Changelog:
# 1.0 - First Version
#===============================================================================
# Instructions:
# Place the code snippet into YEA - Lunatic States above the part where it says
# "Stop editing past this point". That's somewhere around line 188 by default.
#
#===NOTETAGS===================================================================
#---> States <---
#
# <bleed x>
# This will perform x damage to the user when acting
#
# <bleed_percent x%>
# This will damage x% of the users max hp.
#
# Recommended effect: <begin effect> or <while effect>
# e.g. <begin effect: bleed_percent 4%>
#===SCRIPT=CALLS================================================================
#
# | NONE
#
#===============================================================================


#  You should copy everything that's below this line! Don't copy my header, it will just unneccesarily bloat
#  your script!

      when /BLEED_PERCENT[ ](\d+)[%]/i
        bleed = (user.mhp * ($1.to_i * 0.01)).round
        target = user
        target.perform_damage_effect
        text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:hp_dmg], bleed.group)
        target.create_popup(text, "HP_DMG")
        target.hp -= bleed
        target.create_popup(state.name, "WEAK_ELE")
        target.perform_collapse_effect if target.hp <= 0

      when /BLEED[ ](\d+)/i
        bleed = $1.to_i
        target = user
        target.perform_damage_effect
        text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:hp_dmg], bleed.group)
        target.create_popup(text, "HP_DMG")
        target.hp -= bleed
        target.create_popup(state.name, "WEAK_ELE")
        target.perform_collapse_effect if target.hp <= 0

 

Requires Yanfly Lunatic states script. Add the code to the lunatic script.

*

Never mind, now I see that you want this to apply only when they successfully hit the enemy. Missed that part.

Edited by roninator2

Share this post


Link to post
Share on other sites
On 9/23/2022 at 4:39 AM, Placebo said:

How would I make a status that damages the battler with the state whenever they deal damage to another battler?
Sorta like a bleed status that makes you take recoil damage for trying to fight through it.
I imagine there might be a way to do this with yanfly lunatic states, using "<while effect: string>", but I don't know how to identify when the user is specifically dealing damage to a target.

I know exactly what would work for this.
A standalone script by Craze.
It's called Regrowth Options, and it's all I'd need for this.
Use this tag in the state's notebox:
<deal hp regrowth: -v>
Or this one for percentages:
<deal hp regrowth: -v%>
(replace 'hp' with 'mp' or 'tp' for damage to those as needed)
This will also work for making restoring tags:
<deal hp regrowth: +v>
Or this one for percentages:
<deal hp regrowth: +v%>
(replace 'hp' with 'mp' or 'tp' for restoration to those as needed)
Caveat:
If the damage dealer is also in a 'muddled' state (attacking allies/self), this will still have an effect.

Spoiler

#==============================================================================
# 
# ▼ Craze's Script Asylum - Regrowth Options v1.02
# -- Last Updated: 2012.02.23
# -- Level: Normal
# -- Requires: n/a
# -- Special thanks: Yanfly; this script is partially built off of TP Manager
#                    with his permission (note: this script is stand-alone)
# 
#==============================================================================

$imported = {} if $imported.nil?
$imported["CRZ-RegrowthOptions"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.02.23 - Added "weak" and "resist" regrowth effects
# 2012.02.10 - Fixed issues with buff/debuff-based regrowth
# 2012.02.07 - Finished Script
# 2012.02.05 - Started Script
# 
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Ever wanted to have accessories that caused you to recover MP when killing
# foes, or built your TP as you dodged to help out rogue-type characters?
# Think it would be cool to cause White Mages to regenerate a little MP whenever
# they fully heal an ally, or for the Berserk state to build more TP with each
# hit while damaging the attacker's HP? Maybe you want an enemy that will kill
# itself if it ever misses with an attack?
# 
# Now you can have those, and so much more! Reward your players for fulfilling
# certain conditions in order to grow their HP, MP and TP - or punish them
# with the ability to make evil new states.
#
# -----------------------------------------------------------------------------
# Actor/Class/Weapon/Armor/Enemy/State Notetags - 
# These notetags go in the those noteboxes in the database.
# All effects stack from all sources.
# -----------------------------------------------------------------------------
# <effect stat regrowth: +x> <effect stat regrowth: -x> 
# <effect stat regrowth: +x%> <effect stat regrowth: -x%>
# When [effect] is triggered, [stat] is raised or lowered by x or x%.
# Possible [stat] strings: hp, mp, tp
# Possible [effect] strings: 
#      hit, deal, success - Whenever a hit is landed by the character
#      suffer, take, damage - Whenever a hit is landed on the character
#      heal - Whenever the character performs direct healing
#      healed, takeheal - Whenever the character is the target of direct healing
#      fullheal - Whenever the character tops off another battler's HP directly
#      miss - Whenever the character does not land an attack
#      evade, dodge, eva - Whenever the character is missed by an attack
#      crit, critical, cri - Whenever the character deals a critical hit
#      takecrit, takecritical, takecri - Whenever the character suffers a 
#                                        critical hit
#      inflict, state, dealstate, addstate - Whenever the character inflicts
#                                            a state on a foe
#      gainstate, takestate - Whenever the character is inflicted with a state
#                             by a foe
#      buff, addbuff - Whenever the character adds a buff to a battler
#      buffed, takebuff - Whenever the character has a buff added to them
#      debuff, adddebuff - Whenever the character adds a debuff to a battler
#      debuffed, takedebuff - Whenever the character has a debuff added to them
#      kill, slay, ko - Whenever the character lands the killing blow on a foe
#      weak - Whenever the character hits an elemental weakness
#      resist - Whenever the character hits an elemental resistance
# 
# Ex.:
# <kill tp regrowth: +10>
# If the character lands the killing blow on a foe, they will build 10 TP
# <suffer mp regrowth: -3>
# Whenever the character is hit, they will also lose 3 MP
# <fullheal hp regrowth: +10%>
# By directly healing an ally to 100%, the healing character will be healed 10%
# <debuffed mp regrowth: -5%>
# For every debuff applied to the character, they will also lose 5% MP
# <kill hp regrowth: -100%>
# If the afflicted character kills any foes, they will instantly die themselves
# 
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
# 
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# Works with YEA TP Manager and Battle Engine Ace.
# Is built off of, but does not require, TP Manager.
# Put this BELOW Craze's Accuracy Overflow script.
#
# Aliased methods:
#   Game_Battler
#      execute_damage
#      item_effect_add_state
#      item_apply
#      add_buff
#      add_debuff
#
#==============================================================================

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

module CRZ
  module REGEXP
  module BASEITEM
    
    REGROW_SET = /<(.*)[ ](.*)[ ]REGROWTH:[ ]([\+\-]\d+)>/i
    REGROW_PER = /<(.*)[ ](.*)[ ]REGROWTH:[ ]([\+\-]\d+)([%%])>/i
    
  end # BASEITEM
  end # REGEXP
end # CRZ


#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_regrow_opts load_database; end
  def self.load_database
    load_database_regrow_opts
    load_notetags_regrow_opts
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_ele_rate
  #--------------------------------------------------------------------------
  def self.load_notetags_regrow_opts
    groups = [$data_enemies, $data_actors,
      $data_classes, $data_weapons, $data_armors, $data_states]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_regrow_opts
      end
    end
  end
  
end # DataManager


#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :regrowth_set_rates
  attr_accessor :regrowth_per_rates
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_regrow_opts
  #--------------------------------------------------------------------------
  def load_notetags_regrow_opts
    @regrowth_set_rates = {}
      @regrowth_set_rates[:hp_hit] = 0
      @regrowth_set_rates[:mp_hit] = 0
      @regrowth_set_rates[:tp_hit] = 0
      
      @regrowth_set_rates[:hp_take] = 0
      @regrowth_set_rates[:mp_take] = 0
      @regrowth_set_rates[:tp_take] = 0
      
      @regrowth_set_rates[:hp_heal] = 0
      @regrowth_set_rates[:mp_heal] = 0
      @regrowth_set_rates[:tp_heal] = 0
      
      @regrowth_set_rates[:hp_takeheal] = 0
      @regrowth_set_rates[:mp_takeheal] = 0
      @regrowth_set_rates[:tp_takeheal] = 0
      
      @regrowth_set_rates[:hp_fullheal] = 0
      @regrowth_set_rates[:mp_fullheal] = 0
      @regrowth_set_rates[:tp_fullheal] = 0
      
      @regrowth_set_rates[:hp_miss] = 0
      @regrowth_set_rates[:mp_miss] = 0
      @regrowth_set_rates[:tp_miss] = 0
      
      @regrowth_set_rates[:hp_evade] = 0
      @regrowth_set_rates[:mp_evade] = 0
      @regrowth_set_rates[:tp_evade] = 0
      
      @regrowth_set_rates[:hp_crit] = 0
      @regrowth_set_rates[:mp_crit] = 0
      @regrowth_set_rates[:tp_crit] = 0
      
      @regrowth_set_rates[:hp_takecrit] = 0
      @regrowth_set_rates[:mp_takecrit] = 0
      @regrowth_set_rates[:tp_takecrit] = 0
      
      @regrowth_set_rates[:hp_state] = 0
      @regrowth_set_rates[:mp_state] = 0
      @regrowth_set_rates[:tp_state] = 0
      
      @regrowth_set_rates[:hp_takestate] = 0
      @regrowth_set_rates[:mp_takestate] = 0
      @regrowth_set_rates[:tp_takestate] = 0
      
      @regrowth_set_rates[:hp_buff] = 0
      @regrowth_set_rates[:mp_buff] = 0
      @regrowth_set_rates[:tp_buff] = 0
      
      @regrowth_set_rates[:hp_takebuff] = 0
      @regrowth_set_rates[:mp_takebuff] = 0
      @regrowth_set_rates[:tp_takebuff] = 0
      
      @regrowth_set_rates[:hp_debuff] = 0
      @regrowth_set_rates[:mp_debuff] = 0
      @regrowth_set_rates[:tp_debuff] = 0
      
      @regrowth_set_rates[:hp_takedebuff] = 0
      @regrowth_set_rates[:mp_takedebuff] = 0
      @regrowth_set_rates[:tp_takedebuff] = 0
      
      @regrowth_set_rates[:hp_kill] = 0
      @regrowth_set_rates[:mp_kill] = 0
      @regrowth_set_rates[:tp_kill] = 0
      
      @regrowth_set_rates[:hp_weak] = 0
      @regrowth_set_rates[:mp_weak] = 0
      @regrowth_set_rates[:tp_weak] = 0
      
      @regrowth_set_rates[:hp_resist] = 0
      @regrowth_set_rates[:mp_resist] = 0
      @regrowth_set_rates[:tp_resist] = 0
      
    @regrowth_per_rates = {}
      @regrowth_per_rates[:hp_hit] = 0
      @regrowth_per_rates[:mp_hit] = 0
      @regrowth_per_rates[:tp_hit] = 0
      
      @regrowth_per_rates[:hp_take] = 0
      @regrowth_per_rates[:mp_take] = 0
      @regrowth_per_rates[:tp_take] = 0
      
      @regrowth_per_rates[:hp_heal] = 0
      @regrowth_per_rates[:mp_heal] = 0
      @regrowth_per_rates[:tp_heal] = 0
      
      @regrowth_per_rates[:hp_takeheal] = 0
      @regrowth_per_rates[:mp_takeheal] = 0
      @regrowth_per_rates[:tp_takeheal] = 0
      
      @regrowth_per_rates[:hp_fullheal] = 0
      @regrowth_per_rates[:mp_fullheal] = 0
      @regrowth_per_rates[:tp_fullheal] = 0
      
      @regrowth_per_rates[:hp_miss] = 0
      @regrowth_per_rates[:mp_miss] = 0
      @regrowth_per_rates[:tp_miss] = 0
      
      @regrowth_per_rates[:hp_evade] = 0
      @regrowth_per_rates[:mp_evade] = 0
      @regrowth_per_rates[:tp_evade] = 0
      
      @regrowth_per_rates[:hp_crit] = 0
      @regrowth_per_rates[:mp_crit] = 0
      @regrowth_per_rates[:tp_crit] = 0
      
      @regrowth_per_rates[:hp_takecrit] = 0
      @regrowth_per_rates[:mp_takecrit] = 0
      @regrowth_per_rates[:tp_takecrit] = 0
      
      @regrowth_per_rates[:hp_state] = 0
      @regrowth_per_rates[:mp_state] = 0
      @regrowth_per_rates[:tp_state] = 0
      
      @regrowth_per_rates[:hp_takestate] = 0
      @regrowth_per_rates[:mp_takestate] = 0
      @regrowth_per_rates[:tp_takestate] = 0
      
      @regrowth_per_rates[:hp_buff] = 0
      @regrowth_per_rates[:mp_buff] = 0
      @regrowth_per_rates[:tp_buff] = 0
      
      @regrowth_per_rates[:hp_takebuff] = 0
      @regrowth_per_rates[:mp_takebuff] = 0
      @regrowth_per_rates[:tp_takebuff] = 0
      
      @regrowth_per_rates[:hp_debuff] = 0
      @regrowth_per_rates[:mp_debuff] = 0
      @regrowth_per_rates[:tp_debuff] = 0
      
      @regrowth_per_rates[:hp_takedebuff] = 0
      @regrowth_per_rates[:mp_takedebuff] = 0
      @regrowth_per_rates[:tp_takedebuff] = 0
      
      @regrowth_per_rates[:hp_kill] = 0
      @regrowth_per_rates[:mp_kill] = 0
      @regrowth_per_rates[:tp_kill] = 0
      
      @regrowth_per_rates[:hp_weak] = 0
      @regrowth_per_rates[:mp_weak] = 0
      @regrowth_per_rates[:tp_weak] = 0
      
      @regrowth_per_rates[:hp_resist] = 0
      @regrowth_per_rates[:mp_resist] = 0
      @regrowth_per_rates[:tp_resist] = 0
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when CRZ::REGEXP::BASEITEM::REGROW_SET
        case $1.upcase
        when "HIT", "DEAL", "SUCCESS"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_hit] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_hit] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_hit] += $3.to_i
          end
        when "TAKE", "DAMAGE", "SUFFER"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_take] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_take] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_take] += $3.to_i
          end
        when "HEAL"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_heal] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_heal] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_heal] += $3.to_i
          end
        when "TAKEHEAL", "HEALED"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takeheal] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takeheal] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takeheal] += $3.to_i
          end
        when "FULLHEAL"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_fullheal] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_fullheal] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_fullheal] += $3.to_i
          end
        when "MISS"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_miss] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_miss] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_miss] += $3.to_i
          end
        when "EVADE", "DODGE", "EVA"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_evade] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_evade] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_evade] += $3.to_i
          end
        when "CRIT", "CRITICAL", "CRI"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_crit] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_crit] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_crit] += $3.to_i
          end
        when "TAKECRIT", "TAKECRITICAL", "TAKECRI"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takecrit] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takecrit] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takecrit] += $3.to_i
          end
        when "STATE", "DEALSTATE", "ADDSTATE", "INFLICT"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_state] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_state] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_state] += $3.to_i
          end
        when "TAKESTATE", "GAINSTATE"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takestate] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takestate] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takestate] += $3.to_i
          end
        when "BUFF", "ADDBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_buff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_buff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_buff] += $3.to_i
          end
        when "BUFFED", "TAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takebuff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takebuff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takebuff] += $3.to_i
          end
        when "DEBUFF", "ADDDEBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_debuff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_debuff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_debuff] += $3.to_i
          end
        when "DEBUFFED", "DETAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takedebuff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takedebuff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takedebuff] += $3.to_i
          end
        when "KILL", "SLAY", "KO"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_kill] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_kill] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_kill] += $3.to_i
          end
        when "WEAK"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_weak] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_weak] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_weak] += $3.to_i
          end
        when "RESIST"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_resist] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_resist] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_resist] += $3.to_i
          end
        end
      when CRZ::REGEXP::BASEITEM::REGROW_PER
        case $1.upcase
        when "HIT", "DEAL", "SUCCESS"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_hit] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_hit] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_hit] += $3.to_i
          end
        when "TAKE", "DAMAGE", "SUFFER"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_take] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_take] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_take] += $3.to_i
          end
        when "HEAL"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_heal] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_heal] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_heal] += $3.to_i
          end
        when "TAKEHEAL", "HEALED"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takeheal] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takeheal] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takeheal] += $3.to_i
          end
        when "FULLHEAL"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_fullheal] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_fullheal] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_fullheal] += $3.to_i
          end
        when "MISS"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_miss] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_miss] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_miss] += $3.to_i
          end
        when "EVADE", "DODGE", "EVA"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_evade] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_evade] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_evade] += $3.to_i
          end
        when "CRIT", "CRITICAL", "CRI"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_crit] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_crit] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_crit] += $3.to_i
          end
        when "TAKECRIT", "TAKECRITICAL", "TAKECRI"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takecrit] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takecrit] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takecrit] += $3.to_i
          end
        when "STATE", "DEALSTATE", "ADDSTATE", "INFLICT"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_state] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_state] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_state] += $3.to_i
          end
        when "TAKESTATE", "GAINSTATE"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takestate] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takestate] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takestate] += $3.to_i
          end
        when "BUFF", "ADDBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_buff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_buff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_buff] += $3.to_i
          end
        when "BUFFED", "TAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takebuff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takebuff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takebuff] += $3.to_i
          end
        when "DEBUFF", "ADDDEBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_debuff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_debuff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_debuff] += $3.to_i
          end
        when "DEBUFFED", "DETAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takedebuff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takedebuff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takedebuff] += $3.to_i
          end
        when "KILL", "SLAY", "KO"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_kill] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_kill] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_kill] += $3.to_i
          end
        when "WEAK"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_weak] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_weak] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_weak] += $3.to_i
          end
        when "RESIST"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_resist] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_resist] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_resist] += $3.to_i
          end
        end
      end # case note line stuff
    } # self.note.split
    #---
  end
  
end # RPG::BaseItem

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  attr_accessor   :subject
  
end # Scene_Battle

#==============================================================================
# ■ Game_Battler
#==============================================================================

class Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: make_regrowth
  #--------------------------------------------------------------------------
  def make_regrowth(user, act)
    return unless SceneManager.scene_is?(Scene_Battle)
    if user.actor?
      for equip in user.equips
        unless equip.nil?
        regrowth_effect_set(user, act, equip.regrowth_set_rates)
        regrowth_effect_per(user, act, equip.regrowth_per_rates); end
      end
      # Get rates from Actor/Class
      regrowth_effect_set(user, act, user.actor.regrowth_set_rates)
      regrowth_effect_per(user, act, user.actor.regrowth_per_rates)
      regrowth_effect_set(user, act, user.class.regrowth_set_rates)
      regrowth_effect_per(user, act, user.class.regrowth_per_rates)
    else # Enemy
      regrowth_effect_set(user, act, user.enemy.regrowth_set_rates)
      regrowth_effect_per(user, act, user.enemy.regrowth_per_rates)
    end # user.actor? 
    # Get rates from States
    for state in user.states
      regrowth_effect_set(user, act, state.regrowth_set_rates)
      regrowth_effect_per(user, act, state.regrowth_per_rates)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: regrowth_effect_set
  #--------------------------------------------------------------------------
  def regrowth_effect_set(user, act, rates)
    case act
    when "HIT"
      user.hp = user.hp + rates[:hp_hit]
      user.mp = user.mp + rates[:mp_hit]
      user.tp = user.tp + rates[:tp_hit]
    when "TAKE"
      user.hp = user.hp + rates[:hp_take]
      user.mp = user.mp + rates[:mp_take]
      user.tp = user.tp + rates[:tp_take]
    when "HEAL"
      user.hp = user.hp + rates[:hp_heal]
      user.mp = user.mp + rates[:mp_heal]
      user.tp = user.tp + rates[:tp_heal]
    when "FULLHEAL"
      user.hp = user.hp + rates[:hp_fullheal]
      user.mp = user.mp + rates[:mp_fullheal]
      user.tp = user.tp + rates[:tp_fullheal]
    when "TAKEHEAL"
      user.hp = user.hp + rates[:hp_takeheal]
      user.mp = user.mp + rates[:mp_takeheal]
      user.tp = user.tp + rates[:tp_takeheal]
    when "MISS"
      user.hp = user.hp + rates[:hp_miss]
      user.mp = user.mp + rates[:mp_miss]
      user.tp = user.tp + rates[:tp_miss]
    when "EVADE"
      user.hp = user.hp + rates[:hp_evade]
      user.mp = user.mp + rates[:mp_evade]
      user.tp = user.tp + rates[:tp_evade]
    when "CRIT"
      user.hp = user.hp + rates[:hp_crit]
      user.mp = user.mp + rates[:mp_crit]
      user.tp = user.tp + rates[:tp_crit]
    when "TAKECRIT"
      user.hp = user.hp + rates[:hp_takecrit]
      user.mp = user.mp + rates[:mp_takecrit]
      user.tp = user.tp + rates[:tp_takecrit]
    when "STATE"
      user.hp = user.hp + rates[:hp_state]
      user.mp = user.mp + rates[:mp_state]
      user.tp = user.tp + rates[:tp_state]
    when "TAKESTATE"
      user.hp = user.hp + rates[:hp_takestate]
      user.mp = user.mp + rates[:mp_takestate]
      user.tp = user.tp + rates[:tp_takestate]
    when "BUFF"
      user.hp = user.hp + rates[:hp_buff]
      user.mp = user.mp + rates[:mp_buff]
      user.tp = user.tp + rates[:tp_buff]
    when "TAKEBUFF"
      user.hp = user.hp + rates[:hp_takebuff]
      user.mp = user.mp + rates[:mp_takebuff]
      user.tp = user.tp + rates[:tp_takebuff]
    when "DEBUFF"
      user.hp = user.hp + rates[:hp_debuff]
      user.mp = user.mp + rates[:mp_debuff]
      user.tp = user.tp + rates[:tp_debuff]
    when "TAKEDEBUFF"
      user.hp = user.hp + rates[:hp_takedebuff]
      user.mp = user.mp + rates[:mp_takedebuff]
      user.tp = user.tp + rates[:tp_takedebuff]
    when "KILL"
      user.hp = user.hp + rates[:hp_kill]
      user.mp = user.mp + rates[:mp_kill]
      user.tp = user.tp + rates[:tp_kill]
    when "WEAK"
      user.hp = user.hp + rates[:hp_weak]
      user.mp = user.mp + rates[:mp_weak]
      user.tp = user.tp + rates[:tp_weak]
    when "RESIST"
      user.hp = user.hp + rates[:hp_resist]
      user.mp = user.mp + rates[:mp_resist]
      user.tp = user.tp + rates[:tp_resist]
    end
    user.add_state(death_state_id) if user.hp <= 0
    user.mp = [user.mp, 0].max
    user.tp = [user.tp, 0].max
  end
  
  #--------------------------------------------------------------------------
  # new method: regrowth_effect_per
  #--------------------------------------------------------------------------
  def regrowth_effect_per(user, act, rates)
    case act
    when "HIT"
      user.hp = user.hp + (rates[:hp_hit] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_hit] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_hit] * user.max_tp / 100)
    when "TAKE"
      user.hp = user.hp + (rates[:hp_take] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_take] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_take] * user.max_tp / 100)
    when "HEAL"
      user.hp = user.hp + (rates[:hp_heal] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_heal] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_heal] * user.max_tp / 100)
    when "FULLHEAL"
      user.hp = user.hp + (rates[:hp_fullheal] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_fullheal] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_fullheal] * user.max_tp / 100)
    when "TAKEHEAL"
      user.hp = user.hp + (rates[:hp_takeheal] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takeheal] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takeheal] * user.max_tp / 100)
    when "MISS"
      user.hp = user.hp + (rates[:hp_miss] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_miss] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_miss] * user.max_tp / 100)
    when "EVADE"
      user.hp = user.hp + (rates[:hp_evade] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_evade] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_evade] * user.max_tp / 100)
    when "CRIT"
      user.hp = user.hp + (rates[:hp_crit] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_crit] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_crit] * user.max_tp / 100)
    when "TAKECRIT"
      user.hp = user.hp + (rates[:hp_takecrit] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takecrit] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takecrit] * user.max_tp / 100)
    when "STATE"
      user.hp = user.hp + (rates[:hp_state] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_state] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_state] * user.max_tp / 100)
    when "TAKESTATE"
      user.hp = user.hp + (rates[:hp_takestate] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takestate] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takestate] * user.max_tp / 100)
    when "BUFF"
      user.hp = user.hp + (rates[:hp_buff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_buff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_buff] * user.max_tp / 100)
    when "TAKEBUFF"
      user.hp = user.hp + (rates[:hp_takebuff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takebuff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takebuff] * user.max_tp / 100)
    when "DEBUFF"
      user.hp = user.hp + (rates[:hp_debuff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_debuff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_debuff] * user.max_tp / 100)
    when "TAKEDEBUFF"
      user.hp = user.hp + (rates[:hp_takedebuff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takedebuff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takedebuff] * user.max_tp / 100)
    when "KILL"
      user.hp = user.hp + (rates[:hp_kill] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_kill] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_kill] * user.max_tp / 100)
    when "WEAK"
      user.hp = user.hp + (rates[:hp_weak] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_weak] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_weak] * user.max_tp / 100)
    when "RESIST"
      user.hp = user.hp + (rates[:hp_resist] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_resist] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_resist] * user.max_tp / 100)
    end
    user.add_state(death_state_id) if user.hp <= 0
    user.mp = [user.mp, 0].max
    user.tp = [user.tp, 0].max
  end
  
  #--------------------------------------------------------------------------
  # alias method: execute_damage
  #--------------------------------------------------------------------------
  alias game_battler_execute_damage_regrowth_opts execute_damage
  def execute_damage(user)
    ph = self.hp
    game_battler_execute_damage_regrowth_opts(user)
    return unless $game_party.in_battle
#   @result.restore_damage if $imported["YEA-BattleEngine"]
    if @result.hp_damage > 0
      make_regrowth(user, "HIT")
      make_regrowth(self, "TAKE")
    elsif @result.hp_damage < 0
      make_regrowth(user, "HEAL")
      make_regrowth(self, "TAKEHEAL")
      make_regrowth(user, "FULLHEAL") if (self.hp >= self.mhp) and self.hp != ph
    end
    if @result.mp_damage > 0
      make_regrowth(user, "HIT")
      make_regrowth(self, "TAKE")
    elsif @result.mp_damage < 0
      make_regrowth(user, "HEAL")
      make_regrowth(self, "TAKEHEAL")
    end
    make_regrowth(user, "KILL") if self.hp <= 0 # kill_enemy
    return #unless $imported["YEA-BattleEngine"]
#   @result.store_damage
#   @result.clear_damage_values
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_apply
  #--------------------------------------------------------------------------
  alias game_battler_item_apply_regrowth_opts item_apply
  def item_apply(user, item)
    game_battler_item_apply_regrowth_opts(user, item)
    return unless $game_party.in_battle
    erate = item_element_rate(user, item)
    make_regrowth(user, "WEAK") if erate > 1
    make_regrowth(user, "RESIST") if erate < 1
    if @result.critical
      make_regrowth(user, "CRIT")
      make_regrowth(self, "TAKECRIT")
    end
    return if @result.hit?
    make_regrowth(user, "MISS")
    make_regrowth(self, "EVADE")
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_add_state
  #--------------------------------------------------------------------------
  alias game_battler_item_effect_add_state_regrowth_opts item_effect_add_state
  def item_effect_add_state(user, item, effect)
    original_states = states.clone
    game_battler_item_effect_add_state_regrowth_opts(user, item, effect)
    return unless $game_party.in_battle
    if original_states != states && opponents_unit.members.include?(user)
      make_regrowth(user, "STATE")
      make_regrowth(self, "TAKESTATE")
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_buff
  #--------------------------------------------------------------------------
  alias game_battler_add_buff_regrowth_opts add_buff
  def add_buff(param_id, turns)
    original_buffs = @buffs[param_id]
    game_battler_add_buff_regrowth_opts(param_id, turns)
    return unless $game_party.in_battle
    if original_buffs < @buffs[param_id]
      make_regrowth(SceneManager.scene.subject, "BUFF")
      make_regrowth(self, "TAKEBUFF")
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_debuff
  #--------------------------------------------------------------------------
  alias game_battler_add_debuff_regrowth_opts add_debuff
  def add_debuff(param_id, turns)
    original_buffs = @buffs[param_id]
    game_battler_add_debuff_regrowth_opts(param_id, turns)
    return unless $game_party.in_battle
    if original_buffs > @buffs[param_id]
      make_regrowth(SceneManager.scene.subject, "DEBUFF")
      make_regrowth(self, "TAKEDEBUFF")
    end
  end
  
end # Game_Battler

#==============================================================================
# 
# ▼ End of File
# 
#==============================================================================

 

All in one script! Yep! No need for multiple scripts.

Share this post


Link to post
Share on other sites
On 9/24/2022 at 7:39 AM, PhoenixSoul said:

I know exactly what would work for this.
A standalone script by Craze.
It's called Regrowth Options, and it's all I'd need for this.
Use this tag in the state's notebox:
<deal hp regrowth: -v>
 Or this one for percentages:
<deal hp regrowth: -v%>
(replace 'hp' with 'mp' or 'tp' for damage to those as needed)
This will also work for making restoring tags:
<deal hp regrowth: +v>
Or this one for percentages:
<deal hp regrowth: +v%>
(replace 'hp' with 'mp' or 'tp' for restoration to those as needed)
Caveat:
If the damage dealer is also in a 'muddled' state (attacking allies/self), this will still have an effect.

  Hide contents


#==============================================================================
# 
# ▼ Craze's Script Asylum - Regrowth Options v1.02
# -- Last Updated: 2012.02.23
# -- Level: Normal
# -- Requires: n/a
# -- Special thanks: Yanfly; this script is partially built off of TP Manager
#                    with his permission (note: this script is stand-alone)
# 
#==============================================================================

$imported = {} if $imported.nil?
$imported["CRZ-RegrowthOptions"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.02.23 - Added "weak" and "resist" regrowth effects
# 2012.02.10 - Fixed issues with buff/debuff-based regrowth
# 2012.02.07 - Finished Script
# 2012.02.05 - Started Script
# 
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Ever wanted to have accessories that caused you to recover MP when killing
# foes, or built your TP as you dodged to help out rogue-type characters?
# Think it would be cool to cause White Mages to regenerate a little MP whenever
# they fully heal an ally, or for the Berserk state to build more TP with each
# hit while damaging the attacker's HP? Maybe you want an enemy that will kill
# itself if it ever misses with an attack?
# 
# Now you can have those, and so much more! Reward your players for fulfilling
# certain conditions in order to grow their HP, MP and TP - or punish them
# with the ability to make evil new states.
#
# -----------------------------------------------------------------------------
# Actor/Class/Weapon/Armor/Enemy/State Notetags - 
# These notetags go in the those noteboxes in the database.
# All effects stack from all sources.
# -----------------------------------------------------------------------------
# <effect stat regrowth: +x> <effect stat regrowth: -x> 
# <effect stat regrowth: +x%> <effect stat regrowth: -x%>
# When [effect] is triggered, [stat] is raised or lowered by x or x%.
# Possible [stat] strings: hp, mp, tp
# Possible [effect] strings: 
#      hit, deal, success - Whenever a hit is landed by the character
#      suffer, take, damage - Whenever a hit is landed on the character
#      heal - Whenever the character performs direct healing
#      healed, takeheal - Whenever the character is the target of direct healing
#      fullheal - Whenever the character tops off another battler's HP directly
#      miss - Whenever the character does not land an attack
#      evade, dodge, eva - Whenever the character is missed by an attack
#      crit, critical, cri - Whenever the character deals a critical hit
#      takecrit, takecritical, takecri - Whenever the character suffers a 
#                                        critical hit
#      inflict, state, dealstate, addstate - Whenever the character inflicts
#                                            a state on a foe
#      gainstate, takestate - Whenever the character is inflicted with a state
#                             by a foe
#      buff, addbuff - Whenever the character adds a buff to a battler
#      buffed, takebuff - Whenever the character has a buff added to them
#      debuff, adddebuff - Whenever the character adds a debuff to a battler
#      debuffed, takedebuff - Whenever the character has a debuff added to them
#      kill, slay, ko - Whenever the character lands the killing blow on a foe
#      weak - Whenever the character hits an elemental weakness
#      resist - Whenever the character hits an elemental resistance
# 
# Ex.:
# <kill tp regrowth: +10>
# If the character lands the killing blow on a foe, they will build 10 TP
# <suffer mp regrowth: -3>
# Whenever the character is hit, they will also lose 3 MP
# <fullheal hp regrowth: +10%>
# By directly healing an ally to 100%, the healing character will be healed 10%
# <debuffed mp regrowth: -5%>
# For every debuff applied to the character, they will also lose 5% MP
# <kill hp regrowth: -100%>
# If the afflicted character kills any foes, they will instantly die themselves
# 
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
# 
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# Works with YEA TP Manager and Battle Engine Ace.
# Is built off of, but does not require, TP Manager.
# Put this BELOW Craze's Accuracy Overflow script.
#
# Aliased methods:
#   Game_Battler
#      execute_damage
#      item_effect_add_state
#      item_apply
#      add_buff
#      add_debuff
#
#==============================================================================

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

module CRZ
  module REGEXP
  module BASEITEM
    
    REGROW_SET = /<(.*)[ ](.*)[ ]REGROWTH:[ ]([\+\-]\d+)>/i
    REGROW_PER = /<(.*)[ ](.*)[ ]REGROWTH:[ ]([\+\-]\d+)([%%])>/i
    
  end # BASEITEM
  end # REGEXP
end # CRZ


#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_regrow_opts load_database; end
  def self.load_database
    load_database_regrow_opts
    load_notetags_regrow_opts
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_ele_rate
  #--------------------------------------------------------------------------
  def self.load_notetags_regrow_opts
    groups = [$data_enemies, $data_actors,
      $data_classes, $data_weapons, $data_armors, $data_states]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_regrow_opts
      end
    end
  end
  
end # DataManager


#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :regrowth_set_rates
  attr_accessor :regrowth_per_rates
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_regrow_opts
  #--------------------------------------------------------------------------
  def load_notetags_regrow_opts
    @regrowth_set_rates = {}
      @regrowth_set_rates[:hp_hit] = 0
      @regrowth_set_rates[:mp_hit] = 0
      @regrowth_set_rates[:tp_hit] = 0
      
      @regrowth_set_rates[:hp_take] = 0
      @regrowth_set_rates[:mp_take] = 0
      @regrowth_set_rates[:tp_take] = 0
      
      @regrowth_set_rates[:hp_heal] = 0
      @regrowth_set_rates[:mp_heal] = 0
      @regrowth_set_rates[:tp_heal] = 0
      
      @regrowth_set_rates[:hp_takeheal] = 0
      @regrowth_set_rates[:mp_takeheal] = 0
      @regrowth_set_rates[:tp_takeheal] = 0
      
      @regrowth_set_rates[:hp_fullheal] = 0
      @regrowth_set_rates[:mp_fullheal] = 0
      @regrowth_set_rates[:tp_fullheal] = 0
      
      @regrowth_set_rates[:hp_miss] = 0
      @regrowth_set_rates[:mp_miss] = 0
      @regrowth_set_rates[:tp_miss] = 0
      
      @regrowth_set_rates[:hp_evade] = 0
      @regrowth_set_rates[:mp_evade] = 0
      @regrowth_set_rates[:tp_evade] = 0
      
      @regrowth_set_rates[:hp_crit] = 0
      @regrowth_set_rates[:mp_crit] = 0
      @regrowth_set_rates[:tp_crit] = 0
      
      @regrowth_set_rates[:hp_takecrit] = 0
      @regrowth_set_rates[:mp_takecrit] = 0
      @regrowth_set_rates[:tp_takecrit] = 0
      
      @regrowth_set_rates[:hp_state] = 0
      @regrowth_set_rates[:mp_state] = 0
      @regrowth_set_rates[:tp_state] = 0
      
      @regrowth_set_rates[:hp_takestate] = 0
      @regrowth_set_rates[:mp_takestate] = 0
      @regrowth_set_rates[:tp_takestate] = 0
      
      @regrowth_set_rates[:hp_buff] = 0
      @regrowth_set_rates[:mp_buff] = 0
      @regrowth_set_rates[:tp_buff] = 0
      
      @regrowth_set_rates[:hp_takebuff] = 0
      @regrowth_set_rates[:mp_takebuff] = 0
      @regrowth_set_rates[:tp_takebuff] = 0
      
      @regrowth_set_rates[:hp_debuff] = 0
      @regrowth_set_rates[:mp_debuff] = 0
      @regrowth_set_rates[:tp_debuff] = 0
      
      @regrowth_set_rates[:hp_takedebuff] = 0
      @regrowth_set_rates[:mp_takedebuff] = 0
      @regrowth_set_rates[:tp_takedebuff] = 0
      
      @regrowth_set_rates[:hp_kill] = 0
      @regrowth_set_rates[:mp_kill] = 0
      @regrowth_set_rates[:tp_kill] = 0
      
      @regrowth_set_rates[:hp_weak] = 0
      @regrowth_set_rates[:mp_weak] = 0
      @regrowth_set_rates[:tp_weak] = 0
      
      @regrowth_set_rates[:hp_resist] = 0
      @regrowth_set_rates[:mp_resist] = 0
      @regrowth_set_rates[:tp_resist] = 0
      
    @regrowth_per_rates = {}
      @regrowth_per_rates[:hp_hit] = 0
      @regrowth_per_rates[:mp_hit] = 0
      @regrowth_per_rates[:tp_hit] = 0
      
      @regrowth_per_rates[:hp_take] = 0
      @regrowth_per_rates[:mp_take] = 0
      @regrowth_per_rates[:tp_take] = 0
      
      @regrowth_per_rates[:hp_heal] = 0
      @regrowth_per_rates[:mp_heal] = 0
      @regrowth_per_rates[:tp_heal] = 0
      
      @regrowth_per_rates[:hp_takeheal] = 0
      @regrowth_per_rates[:mp_takeheal] = 0
      @regrowth_per_rates[:tp_takeheal] = 0
      
      @regrowth_per_rates[:hp_fullheal] = 0
      @regrowth_per_rates[:mp_fullheal] = 0
      @regrowth_per_rates[:tp_fullheal] = 0
      
      @regrowth_per_rates[:hp_miss] = 0
      @regrowth_per_rates[:mp_miss] = 0
      @regrowth_per_rates[:tp_miss] = 0
      
      @regrowth_per_rates[:hp_evade] = 0
      @regrowth_per_rates[:mp_evade] = 0
      @regrowth_per_rates[:tp_evade] = 0
      
      @regrowth_per_rates[:hp_crit] = 0
      @regrowth_per_rates[:mp_crit] = 0
      @regrowth_per_rates[:tp_crit] = 0
      
      @regrowth_per_rates[:hp_takecrit] = 0
      @regrowth_per_rates[:mp_takecrit] = 0
      @regrowth_per_rates[:tp_takecrit] = 0
      
      @regrowth_per_rates[:hp_state] = 0
      @regrowth_per_rates[:mp_state] = 0
      @regrowth_per_rates[:tp_state] = 0
      
      @regrowth_per_rates[:hp_takestate] = 0
      @regrowth_per_rates[:mp_takestate] = 0
      @regrowth_per_rates[:tp_takestate] = 0
      
      @regrowth_per_rates[:hp_buff] = 0
      @regrowth_per_rates[:mp_buff] = 0
      @regrowth_per_rates[:tp_buff] = 0
      
      @regrowth_per_rates[:hp_takebuff] = 0
      @regrowth_per_rates[:mp_takebuff] = 0
      @regrowth_per_rates[:tp_takebuff] = 0
      
      @regrowth_per_rates[:hp_debuff] = 0
      @regrowth_per_rates[:mp_debuff] = 0
      @regrowth_per_rates[:tp_debuff] = 0
      
      @regrowth_per_rates[:hp_takedebuff] = 0
      @regrowth_per_rates[:mp_takedebuff] = 0
      @regrowth_per_rates[:tp_takedebuff] = 0
      
      @regrowth_per_rates[:hp_kill] = 0
      @regrowth_per_rates[:mp_kill] = 0
      @regrowth_per_rates[:tp_kill] = 0
      
      @regrowth_per_rates[:hp_weak] = 0
      @regrowth_per_rates[:mp_weak] = 0
      @regrowth_per_rates[:tp_weak] = 0
      
      @regrowth_per_rates[:hp_resist] = 0
      @regrowth_per_rates[:mp_resist] = 0
      @regrowth_per_rates[:tp_resist] = 0
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when CRZ::REGEXP::BASEITEM::REGROW_SET
        case $1.upcase
        when "HIT", "DEAL", "SUCCESS"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_hit] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_hit] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_hit] += $3.to_i
          end
        when "TAKE", "DAMAGE", "SUFFER"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_take] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_take] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_take] += $3.to_i
          end
        when "HEAL"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_heal] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_heal] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_heal] += $3.to_i
          end
        when "TAKEHEAL", "HEALED"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takeheal] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takeheal] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takeheal] += $3.to_i
          end
        when "FULLHEAL"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_fullheal] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_fullheal] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_fullheal] += $3.to_i
          end
        when "MISS"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_miss] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_miss] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_miss] += $3.to_i
          end
        when "EVADE", "DODGE", "EVA"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_evade] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_evade] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_evade] += $3.to_i
          end
        when "CRIT", "CRITICAL", "CRI"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_crit] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_crit] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_crit] += $3.to_i
          end
        when "TAKECRIT", "TAKECRITICAL", "TAKECRI"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takecrit] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takecrit] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takecrit] += $3.to_i
          end
        when "STATE", "DEALSTATE", "ADDSTATE", "INFLICT"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_state] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_state] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_state] += $3.to_i
          end
        when "TAKESTATE", "GAINSTATE"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takestate] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takestate] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takestate] += $3.to_i
          end
        when "BUFF", "ADDBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_buff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_buff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_buff] += $3.to_i
          end
        when "BUFFED", "TAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takebuff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takebuff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takebuff] += $3.to_i
          end
        when "DEBUFF", "ADDDEBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_debuff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_debuff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_debuff] += $3.to_i
          end
        when "DEBUFFED", "DETAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_takedebuff] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_takedebuff] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_takedebuff] += $3.to_i
          end
        when "KILL", "SLAY", "KO"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_kill] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_kill] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_kill] += $3.to_i
          end
        when "WEAK"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_weak] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_weak] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_weak] += $3.to_i
          end
        when "RESIST"
          case $2.upcase
          when "HP"; @regrowth_set_rates[:hp_resist] += $3.to_i
          when "MP"; @regrowth_set_rates[:mp_resist] += $3.to_i
          when "TP"; @regrowth_set_rates[:tp_resist] += $3.to_i
          end
        end
      when CRZ::REGEXP::BASEITEM::REGROW_PER
        case $1.upcase
        when "HIT", "DEAL", "SUCCESS"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_hit] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_hit] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_hit] += $3.to_i
          end
        when "TAKE", "DAMAGE", "SUFFER"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_take] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_take] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_take] += $3.to_i
          end
        when "HEAL"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_heal] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_heal] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_heal] += $3.to_i
          end
        when "TAKEHEAL", "HEALED"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takeheal] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takeheal] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takeheal] += $3.to_i
          end
        when "FULLHEAL"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_fullheal] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_fullheal] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_fullheal] += $3.to_i
          end
        when "MISS"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_miss] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_miss] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_miss] += $3.to_i
          end
        when "EVADE", "DODGE", "EVA"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_evade] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_evade] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_evade] += $3.to_i
          end
        when "CRIT", "CRITICAL", "CRI"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_crit] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_crit] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_crit] += $3.to_i
          end
        when "TAKECRIT", "TAKECRITICAL", "TAKECRI"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takecrit] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takecrit] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takecrit] += $3.to_i
          end
        when "STATE", "DEALSTATE", "ADDSTATE", "INFLICT"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_state] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_state] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_state] += $3.to_i
          end
        when "TAKESTATE", "GAINSTATE"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takestate] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takestate] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takestate] += $3.to_i
          end
        when "BUFF", "ADDBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_buff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_buff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_buff] += $3.to_i
          end
        when "BUFFED", "TAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takebuff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takebuff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takebuff] += $3.to_i
          end
        when "DEBUFF", "ADDDEBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_debuff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_debuff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_debuff] += $3.to_i
          end
        when "DEBUFFED", "DETAKEBUFF"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_takedebuff] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_takedebuff] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_takedebuff] += $3.to_i
          end
        when "KILL", "SLAY", "KO"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_kill] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_kill] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_kill] += $3.to_i
          end
        when "WEAK"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_weak] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_weak] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_weak] += $3.to_i
          end
        when "RESIST"
          case $2.upcase
          when "HP"; @regrowth_per_rates[:hp_resist] += $3.to_i
          when "MP"; @regrowth_per_rates[:mp_resist] += $3.to_i
          when "TP"; @regrowth_per_rates[:tp_resist] += $3.to_i
          end
        end
      end # case note line stuff
    } # self.note.split
    #---
  end
  
end # RPG::BaseItem

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  attr_accessor   :subject
  
end # Scene_Battle

#==============================================================================
# ■ Game_Battler
#==============================================================================

class Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: make_regrowth
  #--------------------------------------------------------------------------
  def make_regrowth(user, act)
    return unless SceneManager.scene_is?(Scene_Battle)
    if user.actor?
      for equip in user.equips
        unless equip.nil?
        regrowth_effect_set(user, act, equip.regrowth_set_rates)
        regrowth_effect_per(user, act, equip.regrowth_per_rates); end
      end
      # Get rates from Actor/Class
      regrowth_effect_set(user, act, user.actor.regrowth_set_rates)
      regrowth_effect_per(user, act, user.actor.regrowth_per_rates)
      regrowth_effect_set(user, act, user.class.regrowth_set_rates)
      regrowth_effect_per(user, act, user.class.regrowth_per_rates)
    else # Enemy
      regrowth_effect_set(user, act, user.enemy.regrowth_set_rates)
      regrowth_effect_per(user, act, user.enemy.regrowth_per_rates)
    end # user.actor? 
    # Get rates from States
    for state in user.states
      regrowth_effect_set(user, act, state.regrowth_set_rates)
      regrowth_effect_per(user, act, state.regrowth_per_rates)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: regrowth_effect_set
  #--------------------------------------------------------------------------
  def regrowth_effect_set(user, act, rates)
    case act
    when "HIT"
      user.hp = user.hp + rates[:hp_hit]
      user.mp = user.mp + rates[:mp_hit]
      user.tp = user.tp + rates[:tp_hit]
    when "TAKE"
      user.hp = user.hp + rates[:hp_take]
      user.mp = user.mp + rates[:mp_take]
      user.tp = user.tp + rates[:tp_take]
    when "HEAL"
      user.hp = user.hp + rates[:hp_heal]
      user.mp = user.mp + rates[:mp_heal]
      user.tp = user.tp + rates[:tp_heal]
    when "FULLHEAL"
      user.hp = user.hp + rates[:hp_fullheal]
      user.mp = user.mp + rates[:mp_fullheal]
      user.tp = user.tp + rates[:tp_fullheal]
    when "TAKEHEAL"
      user.hp = user.hp + rates[:hp_takeheal]
      user.mp = user.mp + rates[:mp_takeheal]
      user.tp = user.tp + rates[:tp_takeheal]
    when "MISS"
      user.hp = user.hp + rates[:hp_miss]
      user.mp = user.mp + rates[:mp_miss]
      user.tp = user.tp + rates[:tp_miss]
    when "EVADE"
      user.hp = user.hp + rates[:hp_evade]
      user.mp = user.mp + rates[:mp_evade]
      user.tp = user.tp + rates[:tp_evade]
    when "CRIT"
      user.hp = user.hp + rates[:hp_crit]
      user.mp = user.mp + rates[:mp_crit]
      user.tp = user.tp + rates[:tp_crit]
    when "TAKECRIT"
      user.hp = user.hp + rates[:hp_takecrit]
      user.mp = user.mp + rates[:mp_takecrit]
      user.tp = user.tp + rates[:tp_takecrit]
    when "STATE"
      user.hp = user.hp + rates[:hp_state]
      user.mp = user.mp + rates[:mp_state]
      user.tp = user.tp + rates[:tp_state]
    when "TAKESTATE"
      user.hp = user.hp + rates[:hp_takestate]
      user.mp = user.mp + rates[:mp_takestate]
      user.tp = user.tp + rates[:tp_takestate]
    when "BUFF"
      user.hp = user.hp + rates[:hp_buff]
      user.mp = user.mp + rates[:mp_buff]
      user.tp = user.tp + rates[:tp_buff]
    when "TAKEBUFF"
      user.hp = user.hp + rates[:hp_takebuff]
      user.mp = user.mp + rates[:mp_takebuff]
      user.tp = user.tp + rates[:tp_takebuff]
    when "DEBUFF"
      user.hp = user.hp + rates[:hp_debuff]
      user.mp = user.mp + rates[:mp_debuff]
      user.tp = user.tp + rates[:tp_debuff]
    when "TAKEDEBUFF"
      user.hp = user.hp + rates[:hp_takedebuff]
      user.mp = user.mp + rates[:mp_takedebuff]
      user.tp = user.tp + rates[:tp_takedebuff]
    when "KILL"
      user.hp = user.hp + rates[:hp_kill]
      user.mp = user.mp + rates[:mp_kill]
      user.tp = user.tp + rates[:tp_kill]
    when "WEAK"
      user.hp = user.hp + rates[:hp_weak]
      user.mp = user.mp + rates[:mp_weak]
      user.tp = user.tp + rates[:tp_weak]
    when "RESIST"
      user.hp = user.hp + rates[:hp_resist]
      user.mp = user.mp + rates[:mp_resist]
      user.tp = user.tp + rates[:tp_resist]
    end
    user.add_state(death_state_id) if user.hp <= 0
    user.mp = [user.mp, 0].max
    user.tp = [user.tp, 0].max
  end
  
  #--------------------------------------------------------------------------
  # new method: regrowth_effect_per
  #--------------------------------------------------------------------------
  def regrowth_effect_per(user, act, rates)
    case act
    when "HIT"
      user.hp = user.hp + (rates[:hp_hit] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_hit] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_hit] * user.max_tp / 100)
    when "TAKE"
      user.hp = user.hp + (rates[:hp_take] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_take] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_take] * user.max_tp / 100)
    when "HEAL"
      user.hp = user.hp + (rates[:hp_heal] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_heal] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_heal] * user.max_tp / 100)
    when "FULLHEAL"
      user.hp = user.hp + (rates[:hp_fullheal] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_fullheal] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_fullheal] * user.max_tp / 100)
    when "TAKEHEAL"
      user.hp = user.hp + (rates[:hp_takeheal] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takeheal] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takeheal] * user.max_tp / 100)
    when "MISS"
      user.hp = user.hp + (rates[:hp_miss] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_miss] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_miss] * user.max_tp / 100)
    when "EVADE"
      user.hp = user.hp + (rates[:hp_evade] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_evade] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_evade] * user.max_tp / 100)
    when "CRIT"
      user.hp = user.hp + (rates[:hp_crit] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_crit] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_crit] * user.max_tp / 100)
    when "TAKECRIT"
      user.hp = user.hp + (rates[:hp_takecrit] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takecrit] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takecrit] * user.max_tp / 100)
    when "STATE"
      user.hp = user.hp + (rates[:hp_state] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_state] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_state] * user.max_tp / 100)
    when "TAKESTATE"
      user.hp = user.hp + (rates[:hp_takestate] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takestate] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takestate] * user.max_tp / 100)
    when "BUFF"
      user.hp = user.hp + (rates[:hp_buff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_buff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_buff] * user.max_tp / 100)
    when "TAKEBUFF"
      user.hp = user.hp + (rates[:hp_takebuff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takebuff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takebuff] * user.max_tp / 100)
    when "DEBUFF"
      user.hp = user.hp + (rates[:hp_debuff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_debuff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_debuff] * user.max_tp / 100)
    when "TAKEDEBUFF"
      user.hp = user.hp + (rates[:hp_takedebuff] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_takedebuff] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_takedebuff] * user.max_tp / 100)
    when "KILL"
      user.hp = user.hp + (rates[:hp_kill] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_kill] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_kill] * user.max_tp / 100)
    when "WEAK"
      user.hp = user.hp + (rates[:hp_weak] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_weak] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_weak] * user.max_tp / 100)
    when "RESIST"
      user.hp = user.hp + (rates[:hp_resist] * user.mhp / 100)
      user.mp = user.mp + (rates[:mp_resist] * user.mmp / 100)
      user.tp = user.tp + (rates[:tp_resist] * user.max_tp / 100)
    end
    user.add_state(death_state_id) if user.hp <= 0
    user.mp = [user.mp, 0].max
    user.tp = [user.tp, 0].max
  end
  
  #--------------------------------------------------------------------------
  # alias method: execute_damage
  #--------------------------------------------------------------------------
  alias game_battler_execute_damage_regrowth_opts execute_damage
  def execute_damage(user)
    ph = self.hp
    game_battler_execute_damage_regrowth_opts(user)
    return unless $game_party.in_battle
#   @result.restore_damage if $imported["YEA-BattleEngine"]
    if @result.hp_damage > 0
      make_regrowth(user, "HIT")
      make_regrowth(self, "TAKE")
    elsif @result.hp_damage < 0
      make_regrowth(user, "HEAL")
      make_regrowth(self, "TAKEHEAL")
      make_regrowth(user, "FULLHEAL") if (self.hp >= self.mhp) and self.hp != ph
    end
    if @result.mp_damage > 0
      make_regrowth(user, "HIT")
      make_regrowth(self, "TAKE")
    elsif @result.mp_damage < 0
      make_regrowth(user, "HEAL")
      make_regrowth(self, "TAKEHEAL")
    end
    make_regrowth(user, "KILL") if self.hp <= 0 # kill_enemy
    return #unless $imported["YEA-BattleEngine"]
#   @result.store_damage
#   @result.clear_damage_values
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_apply
  #--------------------------------------------------------------------------
  alias game_battler_item_apply_regrowth_opts item_apply
  def item_apply(user, item)
    game_battler_item_apply_regrowth_opts(user, item)
    return unless $game_party.in_battle
    erate = item_element_rate(user, item)
    make_regrowth(user, "WEAK") if erate > 1
    make_regrowth(user, "RESIST") if erate < 1
    if @result.critical
      make_regrowth(user, "CRIT")
      make_regrowth(self, "TAKECRIT")
    end
    return if @result.hit?
    make_regrowth(user, "MISS")
    make_regrowth(self, "EVADE")
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_effect_add_state
  #--------------------------------------------------------------------------
  alias game_battler_item_effect_add_state_regrowth_opts item_effect_add_state
  def item_effect_add_state(user, item, effect)
    original_states = states.clone
    game_battler_item_effect_add_state_regrowth_opts(user, item, effect)
    return unless $game_party.in_battle
    if original_states != states && opponents_unit.members.include?(user)
      make_regrowth(user, "STATE")
      make_regrowth(self, "TAKESTATE")
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_buff
  #--------------------------------------------------------------------------
  alias game_battler_add_buff_regrowth_opts add_buff
  def add_buff(param_id, turns)
    original_buffs = @buffs[param_id]
    game_battler_add_buff_regrowth_opts(param_id, turns)
    return unless $game_party.in_battle
    if original_buffs < @buffs[param_id]
      make_regrowth(SceneManager.scene.subject, "BUFF")
      make_regrowth(self, "TAKEBUFF")
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_debuff
  #--------------------------------------------------------------------------
  alias game_battler_add_debuff_regrowth_opts add_debuff
  def add_debuff(param_id, turns)
    original_buffs = @buffs[param_id]
    game_battler_add_debuff_regrowth_opts(param_id, turns)
    return unless $game_party.in_battle
    if original_buffs > @buffs[param_id]
      make_regrowth(SceneManager.scene.subject, "DEBUFF")
      make_regrowth(self, "TAKEDEBUFF")
    end
  end
  
end # Game_Battler

#==============================================================================
# 
# ▼ End of File
# 
#==============================================================================

 

All in one script! Yep! No need for multiple scripts.

have a strange issue with this

<kill hp regrowth: -100%>
this notetag causes it to, mostly correctly, kill the enemy when they kill a party member, however their sprite doesn't disappear, I simply see that they get inflicted with the death state and can no longer target them.


<deal hp regrowth: -100%>

this notetag seemingly does nothing

Share this post


Link to post
Share on other sites
17 hours ago, Placebo said:

<deal hp regrowth: -100%>

this notetag seemingly does nothing

Try using 'hit' instead of 'deal'.

17 hours ago, Placebo said:

have a strange issue with this

<kill hp regrowth: -100%>
this notetag causes it to, mostly correctly, kill the enemy when they kill a party member, however their sprite doesn't disappear, I simply see that they get inflicted with the death state and can no longer target them.

There may be script conflict that causes this; it's not an issue on my end.

Share this post


Link to post
Share on other sites
8 hours ago, PhoenixSoul said:

There may be script conflict that causes this; it's not an issue on my end.

Actually, I just tried it in an empty project, and it had the same issue

Share this post


Link to post
Share on other sites
16 hours ago, Placebo said:

Actually, I just tried it in an empty project, and it had the same issue

Weird. I dunno what to say then...

Share this post


Link to post
Share on other sites
9 hours ago, PhoenixSoul said:

Weird. I dunno what to say then...

How about a bandaid fix: how could I edit the script so that the damage dealt will never put the battler below 1 HP?

Edited by Placebo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted