스테이터스(상태) 관련한 다양한 세팅이 가능합니다.
자세한 내용은 내부 주석을 참고
#===============================================================================
#
# Yanfly Engine RD - Custom Status Properties
# Last Date Updated: 2009.06.24
# Level: Normal, Hard, Lunatic
#
# Status effects seriously don't get enough love in RPG's, both commercial and
# RPG Maker projects. This script will provide more than your bread and butter
# status effect traits. Here are some things this script can do.
#
# - Status effects can raise MaxHP and MaxMP by percentile and set values. Or
# even lower them if that's what's desired.
# - HP and MP degeneration if the usual slip damage is too heavy or light. You
# can even create HP and MP regeneration.
# - If the attack, defense, spirit, and agility rate limit of 200% is too low
# for you, you can break the limit and go to something absurd like 1,000,000%.
# - A status effect that prevents the battler from dying even if the battler is
# at 0 HP, essentially granting the battler a form of immortality.
# - Status effects that greatly reduce HP and/or MP damage given to battlers.
# They can even completely nullify HP and/or MP damage.
# - Can convert a portion of the received HP damage into MP damage and vice
# versa: MP to HP damage.
# - Make battlers vanish from battle and have them return to battle after the
# status effect wears off.
# - A condition similar to berserk and confused, but makes allows the battler
# to use skills using auto battle AI.
# - Custom status effect properties that trigger during any of these five
# situations: applying, while the status is on, when status leaves naturally,
# upon removal, and reacting to attack and skill damage.
# - State stacking. Some effects will stack. The amount they stack will depend
# on the effect the states will produce. Explained below.
#
# I hope you find different ways to use these status effects to spice up one of
# the most overlooked mechanics in many, many RPG's out there.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.05.12 - Three more Lunatic effect types:
# Begin Effect: Occurs at the start of a turn.
# Shock Effect: Occurs after taking an attack or turn.
# Close Effect: Occurs at the end of a turn.
# o 2009.05.02 - Aliased regen and degen to slip_damage_effect rather than
# remove states auto since it provides more compatibility.
# o 2009.04.28 - State stacking capabilities added.
# o 2009.04.23 - Improved functionality on HECO stat minimums.
# o 2009.04.19 - Upgrade Pack 1
# Added shorter way to use atk/def/spi/agi_f rates.
# Added a state-type hash for the module. Optional usage.
# Included Add/Sub set values for atk/def/spi/agi.
# Included Per/Add/Sub for Hit/Eva/Cri/Odds.
# Included Undead HP/MP. Added Absorb HP/MP.
# Included Death Upon HP/MP Damage/Healing.
# Included HP/MP Pain/Healing Rates.
# Included Super Guard, Pharmacology, Fast Attack, Anti-State.
# Included Double EXP Gain, Half MP Cost, Prevent Critical.
# o 2009.04.18 - Improved REGEXP cache.
# o 2009.04.15 - Finished script and publicized.
# o 2009.04.13 - Started script.
#===============================================================================
# How to Use: Normal Mode
#===============================================================================
#
# Simply input these into the States Notebox and you'll get the effects you're
# looking for. These directly affect stats and don't do anything else funky that
# you don't have to worry about.
#
# <max stack x>
# By default, everything has a maximum stack of of 1. Stacking a state more than
# once will increase its effect. For states that increase by a percentile, the
# stack effect will increase its effect after a difference with 100. This means
# that if a state with 110% attack rate gets stacked, the 10% gets multipled
# instead of the full 110%. Stacking it twice will get 120%. Thrice nets 130%.
# Set changes will stack completely. +50ATK will stack as +100, then +150, and
# so on. Max stack will set the maximum amount of times the state can stack.
# States that can be stacked will be marked as <<STACKABLE>>.
#
# <maxhp per x>, <maxhp add x>, <maxhp sub x>
# <maxmp per x>, <maxmp add x>, <maxmp sub x>
# Sets rate for MaxHP or MP by x percentage, adds x value, or subtracts x value.
# <<STACKABLE>>
#
# <hp degen per x>, <hp degen set x>, <hp regen per x>, <hp regen set x>
# Causes battler to gain or lose HP by x percentage or x amount each turn.
# <<STACKABLE>>
#
# <mp degen per x>, <mp degen set x>, <mp regen per x>, <mp regen set x>
# Causes battler to gain or lose HP by x percentage or x amount each turn.
# <<STACKABLE>>
#
# <atk per x>, <def per x>, <spi per x>, <agi per x>
# <atk add x>, <def add x>, <spi add x>, <agi add x>
# <atk sub x>, <def sub x>, <spi sub x>, <agi sub x>
# These raise and lower the respective stat by a percentile value if using "per"
# or a static value if using "add" or "sub" tags. Value changed is equal to x.
# <<STACKABLE>>
#
# <hit per x>, <hit add x>, <hit sub x>
# <eva per x>, <eva add x>, <eva sub x>
# <cri per x>, <cri add x>, <cri sub x>
# <odds per x>, <odds add x>, <odds sub x>
# These raise and lower the HECO stats by a percentile value if using "per" or
# a static value if using "add" or "sub" tags. Value changed is equal to x.
# <<STACKABLE>>
#
#===============================================================================
# How to Use: Hard Mode
#===============================================================================
#
# Input these into the state notebox as well. These perform unique traits so
# be alert as to what to expect.
#
# <immortality>
# Causes the character affected to be immortal so long as it's on. Immortal
# characters can go to 0 HP but still be able to act. If a character is at 0 HP,
# and the status effect is removed, then that character will die.
#
# <vanish>
# Vanish will remove a character from battle for a bit (until the status effect
# is removed). Until then, that character cannot be targetted, attacked, or
# anything. Even if you target the vanished character with a skill/item, it will
# pick someone else. If there are no other allies but the character is vanished,
# the battle will end as a game over or victory depending on which side has
# insufficient battlers.
#
# <auto battle>
# Causes the character to act as if auto battle is checked. Auto battle will
# make the character attack on its own, but willing to use skills unlike berserk
# and confuse. If the character becomes berserk or confused while having auto
# battle, it won't do anything other than attack, just like normally berserk or
# confused. Once removed, character becomes controllable again.
#
# <half mp cost>
# This gives the battler a Half MP Cost effect. Pretty much the same effect as
# if the battler was equipping a Half MP Cost piece of equipment.
#
# <super guard>
# If the battler defends, damage received will be taken as one quarter of its
# original damage. This is the same effect as if Super Guard was checked under
# the Actors tab in the database.
#
# <pharmacology>
# This doubles the effectiveness of items. It's essentially the same as having
# Pharamcology checked under the Actors tab in the database.
#
# <double exp gain>
# This allows the actor to get double experience if the state is on. It's
# essentially the same as having Double Exp Gain checked in an equip.
#
# <fast attack>
# This raises the initiative for the battler if it is performing a regular
# attack (unless you customize that). It's essentially the same as having a
# weapon with fast attack checked.
#
# <prevent critical>
# Attacks cannot cause critical hits against the battler. This is the same as
# having armour with Prevent Critical checked.
#
# <anti state>
# This prevents the battler from gaining any more states until the anti-state
# is off. States can still be removed but cannot be added onto the battler.
#
# <absorb hp>, <absorb mp>
# If the battler deals HP damage or MP damage (for the respective states),
# all damage is converted to absorbed damage regardless of HP or MP type. This
# does not affect undead.
#
# <death on hp dmg>, <death on mp dmg>
# If dealt any HP or MP damage (for the respective tags, the affected battler
# will die instantly (or if the battler is immortal, HP dropped to 0).
#
# <death on hp heal>, <death on mp heal>
# Similar to the above, if healed for HP or MP, the affected battler will die
# instantly (or if the battler is immortal, HP will be dropped to 0).
#
# ------------------------------------------------------------
# The following are mods that affect damage taken.
# ------------------------------------------------------------
#
# <hp pain rate x>, <hp heal rate x>
# This raises or lowers the amount of HP damage or healing the battler will
# take in. This is calculated above the rest of the HP modifying attributes.
# <<STACKABLE>>
#
# <super armour>
# Reduces damage dealt to character by adjustable values down below. Super
# does not reduce damage dealt to the character outside of the normal battle
# mechanics and directly adjusting character HP.
#
# <invincible hp>
# When a character is invincible, that character cannot take HP damage at all.
# The character can still die via directly applying the death status and will
# still take HP degen damage. Use with <immortality> if you want an unkillable
# and undamagable status effect.
#
# <hpdmg to mpdmg x>
# Shifts x percent of HP damage over to MP damage. All of this occurs after the
# react effects and HP damage reductions. If there isn't enough MP, it'll go
# back to HP for remaining damage. Both HP and MP damage will show.
#
# <undead hp x>
# If the target's HP is to be healed, that recovery is converted into damage.
# x is the percentage of the damage dealt. For example, if a battler is to be
# healed for 100, <undead hp 80> would make the battler take 80 damage with no
# HP recovered. <undead hp 100> would allow for 100% conversion. This ignores
# any kind of super armour and invincible HP properties. This also prevents
# absorption for both HP and MP.
#
# <mp pain rate x>, <mp heal rate x>
# This raises or lowers the amount of MP damage or healing the battler will
# take in. This is calculated above the rest of the MP modifying attributes.
# <<STACKABLE>>
#
# <super barrier>
# Functions similar to super armour, but reduces MP damage instead. Does not
# reduce MP damage dealt to character outside of normal battle mechanics and
# directly adjusting character MP.
#
# <invincible mp>
# Just like the effect for its HP counterpart, this prevents any MP damage at
# all if dealt. This does not protect against manually lowering MP and skills
# that cost MP will still lower MP.
#
# <mpdmg to hpdmg x>
# Pretty much the opposite of its HP counterpart, this will convert a percent of
# any potential MP damage to HP damage. This will not kill the battler, but will
# leave the battler at 1 HP minimum.
#
# <undead mp x>
# Similar to <undead hp x>, this converts MP recovery into MP damage by x
# percentage. For example, if the battler is to be healed for 100 MP, the tag
# <undead mp 75> would make the battler take 75 MP damage instead. This ignores
# any super barrier and invincible MP properties. This also prevents absorption
# for both HP and MP.
#
#===============================================================================
#
# Compatibility
# - Works With: KGC LimitBreak
# - Alias: Game_Battler, initialize, maxhp, maxmp, atk, def, spi, agi
# - Alias: Game_Battler, add_state, remove_state, remove_states_auto
# - Alias: Game_Battler, execute_damage, slip_damage_effect
# - Alias: Game_Actor, hit, eva, cri, odds, a lot of equip traits
# - Alias: Game_Enemy, hit, eva, cri, odds
# - Alias: Scene_Battle, start
# - Overwrites: Game_Actor, state_probability
# - Overwrites: Game_Enemy, state_probability
#
#===============================================================================
$imported = {} if $imported == nil
$imported["CustomStatusProperties"] = true
module YE
module BATTLE
# This part allows you to quickly change the state probability success
# rate rankings without needing to do too much in the core script.
STATE_A = 100
STATE_B = 80
STATE_C = 60
STATE_D = 40
STATE_E = 20
STATE_F = 0
# These values determine how much HP damage that status effects with the
# super armour property reduces HP damage by.
SUPER_ARMOUR_PER = 90 # Reduces HP damage by 90%.
SUPER_ARMOUR_SUB = 50 # Reduces HP damage by 50 HP.
SUPER_ARMOUR_MIN = 1 # Minimum HP damage given to super armour.
# These values determine how much MP damage that status effects with the
# super barrier property reduces MP damage by.
SUPER_BARRIER_PER = 80 # Reduces MP damage by 80%.
SUPER_BARRIER_SUB = 10 # Reduces MP damage by 10 MP.
SUPER_BARRIER_MIN = 1 # Minimum MP damage given to the super barrier.
end #module BATTLE
module HASH
# This part is entirely optional, but it helps categorize status effects
# if you ever decide to clump them together in mass. I do this since it's
# easier to find if a state belongs to a certain collection of elements.
STATE_TYPE = { # Input the states into any category you want here.
"Death" => [ 1],
"Conditions" => [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"Buffs" => [ 9, 10, 11, 12],
"Debuffs" => [13, 14, 15, 16],
} # Do not remove this
end #module HASH
end #module YE
#===============================================================================
# How to Use: Lunatic Mode
#===============================================================================
#
# This section is for all the lunatic scripters out there who want to do a bit
# more with your status effects. Put these into your status effect's notebox
# and then head over to the next section to script your own custom effects.
#
# <apply effect x>
# Apply effects occur whenever states are added to the battler. These also
# trigger from the event editor. Find "run_apply_effect" to script your own
# custom effects.
#
# <begin effect x>
# Begin effects occur at the start of a turn. These will always trigger so long
# as the state exists on the battler. Find "run_begin_effect" to script your
# own begin effects.
#
# <while effect x>
# While effects occur each turn after the battler performs an action. These
# do not trigger from the event editor and do not trigger if the battler is
# vanished. Find "run_while_effect" to script your own custom effects.
#
# <react effect x>
# React effects occur whenever the battler is the target of an attack or skill.
# The effect does not trigger if it's just a script dealing damage to it without
# an attack or skill base. Find "run_react_effect" to script your own effects.
# Be careful about scripting react effects to cause damage since it can make an
# endless chain of react effects. Apply anti_react if needed.
#
# <shock effect x>
# Shock effects after the battler has finished taking an attack unlike the react
# effect where it triggers before an attack. Find "run_shock_effect" to script
# your own shock effects.
#
# <close effect x>
# Close effects occur at the end of a turn. These will always trigger so long
# as the state exists on the battler. Find "run_close_effect" to script your
# own close effects.
#
# <leave effect x>
# Leave effects occur if the status effect leaves naturally after the turn
# limit is up. These won't trigger if you manually erase them. Erase effects
# will still occur even after a leave effect. Find "run_leave_effect" to script
# your own custom effects.
#
# <erase effect x>
# Erase effects occur whenever states are removed from the battler. Like the
# apply effects, these trigger with the event editor. Find "run_erase_effect"
# to script your own custom effects.
#
# ------------------------------------------------------------------------------
# There are functions unique to this script for Game_Battler:
# ------------------------------------------------------------------------------
# msgwait
# Causes $scene_battle to wait 30 frames. If you want it to wait more, change
# it to msgwait(x) where x is the frames you want it to wait.
#
# status_damage(hp_dmg, mp_dmg, target, attacker, anti_react = true,
# absorb = false)
# This allows you to damage the target and display it properly with death
# animations and all if you decide for that to be the custom effect. Set the
# anti_react flag to true (it's true by default) to prevent endless react
# chains and potentially put your game into an endless loop.
#
# set_state_turns(state_id, new_turns)
# This allows you to manually adjust the state's turns. Note that if you set
# it to zero or lower, it'll be readjusted to 1 to prevent bugs.
#
# state_turns?(state_id)
# This returns whatever number of turns is left for the state.
#
#===============================================================================
class Game_Battler
def run_apply_effect(state)
state_effect_id = state.apply_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state apply effects
#---------------------------------------------------------------------------
when 1
self.hp = self.mp
text = sprintf("%s's HP becomes %s's MP!", self.name, self.name)
$message__window.add_instant_text(text)
msgwait
when 2
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
def run_begin_effect(state)
state_effect_id = state.begin_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state apply effects
#---------------------------------------------------------------------------
when 1
text = "It's the start of the turn!"
$message__window.add_instant_text(text)
msgwait
when 2
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
def run_while_effect(state)
state_effect_id = state.while_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state while effects
#---------------------------------------------------------------------------
when 1
self.hp += self.mp
text = sprintf("%s heals %d HP!", self.name, self.mp)
$message__window.add_instant_text(text)
msgwait
when 2
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
def run_react_effect(state)
state_effect_id = state.react_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state react effects
#---------------------------------------------------------------------------
when 1
if @hp_damage > 0
self.add_state(9)
end
when 2
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
def run_shock_effect(state)
state_effect_id = state.shock_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state shock effects
#---------------------------------------------------------------------------
when 1
when 2
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
def run_close_effect(state)
state_effect_id = state.close_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state close effects
#---------------------------------------------------------------------------
when 1
text = "It's the end of the turn!"
$message__window.add_instant_text(text)
msgwait
when 2
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
def run_leave_effect(state)
state_effect_id = state.leave_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state leave effects
#---------------------------------------------------------------------------
when 1
self.mp += self.maxmp / 2
text = sprintf("%s's recovers %d MP!", self.name, self.maxhp / 2)
$message__window.add_instant_text(text)
msgwait
when 2
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
def run_erase_effect(state)
state_effect_id = state.erase_effect
line_number = $message__window.line_number if $game_temp.in_battle
case state_effect_id
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own state erase effects
#---------------------------------------------------------------------------
when 1
self.hp = self.maxhp
text = sprintf("%s's HP becomes %d!", self.name, self.maxhp)
$message__window.add_instant_text(text)
msgwait
when 2
text = "A poisonous gas appears!"
$message__window.add_instant_text(text)
$scene.display_animation($game_troop.existing_members, 31)
$scene.wait_for_animation
mini_line = $message__window.line_number
hpdmg = self.atk + self.spi
for member in self.action.opponents_unit.existing_members
status_damage(hpdmg, 0, member, self, true, true)
$message__window.back_to(mini_line)
end
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------
end
$message__window.back_to(line_number) if $game_temp.in_battle
end
end # Game_Battler
#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================
module YE
module REGEXP
module STATE
# These adjust State Stacking
MAX_STACK = /<(?:MAX_STACK|max stack)[ ]*(d+)>/i
# These adjust MaxHP and MaxMP.
MAXHP_PER = /<(?:MAXHP_PER|maxhp per)[ ]*(d+)>/i
MAXMP_PER = /<(?:MAXMP_PER|maxmp per)[ ]*(d+)>/i
MAXHP_ADD = /<(?:MAXHP_ADD|maxhp add)[ ]*(d+)>/i
MAXMP_ADD = /<(?:MAXMP_ADD|maxmp add)[ ]*(d+)>/i
MAXHP_SUB = /<(?:MAXHP_SUB|maxhp sub)[ ]*(d+)>/i
MAXMP_SUB = /<(?:MAXMP_SUB|maxmp sub)[ ]*(d+)>/i
# These adjust Attack, Defense, Spirit, and Agility.
ATK_PER = /<(?:NEW_ATK_RATE|new atk rate|ATK_PER|atk per)[ ]*(d+)>/i
DEF_PER = /<(?:NEW_DEF_RATE|new def rate|DEF_PER|def per)[ ]*(d+)>/i
SPI_PER = /<(?:NEW_SPI_RATE|new spi rate|SPI_PER|spi per)[ ]*(d+)>/i
AGI_PER = /<(?:NEW_AGI_RATE|new agi rate|AGI_PER|agi per)[ ]*(d+)>/i
ATK_ADD = /<(?:ATK_ADD|atk add)[ ]*(d+)>/i
DEF_ADD = /<(?:DEF_ADD|def add)[ ]*(d+)>/i
SPI_ADD = /<(?:SPI_ADD|spi add)[ ]*(d+)>/i
AGI_ADD = /<(?:AGI_ADD|agi add)[ ]*(d+)>/i
ATK_SUB = /<(?:ATK_SUB|atk sub)[ ]*(d+)>/i
DEF_SUB = /<(?:DEF_SUB|def sub)[ ]*(d+)>/i
SPI_SUB = /<(?:SPI_SUB|spi sub)[ ]*(d+)>/i
AGI_SUB = /<(?:AGI_SUB|agi sub)[ ]*(d+)>/i
# These adjust Hit, Evasion, Critical, and Odds
if $imported["LimitBreak"]
HECOLIMIT = KGC::LimitBreak::ACTOR_PARAMETER_LIMIT
else
HECOLIMIT = 999
end
HIT_PER = /<(?:HIT_PER|hit per)[ ]*(d+)>/i
HIT_ADD = /<(?:HIT_ADD|hit add)[ ]*(d+)>/i
HIT_SUB = /<(?:HIT_SUB|hit sub)[ ]*(d+)>/i
EVA_PER = /<(?:EVA_PER|eva per)[ ]*(d+)>/i
EVA_ADD = /<(?:EVA_ADD|eva add)[ ]*(d+)>/i
EVA_SUB = /<(?:EVA_SUB|eva sub)[ ]*(d+)>/i
CRI_PER = /<(?:CRI_PER|cri per)[ ]*(d+)>/i
CRI_ADD = /<(?:CRI_ADD|cri add)[ ]*(d+)>/i
CRI_SUB = /<(?:CRI_SUB|cri sub)[ ]*(d+)>/i
ODDS_PER = /<(?:ODDS_PER|odds per)[ ]*(d+)>/i
ODDS_ADD = /<(?:ODDS_ADD|odds add)[ ]*(d+)>/i
ODDS_SUB = /<(?:ODDS_SUB|odds sub)[ ]*(d+)>/i
# These adjust HP/MP Degen and Regen.
HP_DEGEN_PER = /<(?:HP_DEGEN_PER|hp degen per)[ ]*(d+)>/i
HP_DEGEN_SET = /<(?:HP_DEGEN_SET|hp degen set)[ ]*(d+)>/i
HP_REGEN_PER = /<(?:HP_REGEN_PER|hp regen per)[ ]*(d+)>/i
HP_REGEN_SET = /<(?:HP_REGEN_SET|hp regen set)[ ]*(d+)>/i
MP_DEGEN_PER = /<(?:MP_DEGEN_PER|mp degen per)[ ]*(d+)>/i
MP_DEGEN_SET = /<(?:MP_DEGEN_SET|mp degen set)[ ]*(d+)>/i
MP_REGEN_PER = /<(?:MP_REGEN_PER|mp regen per)[ ]*(d+)>/i
MP_REGEN_SET = /<(?:MP_REGEN_SET|mp regen set)[ ]*(d+)>/i
# These are the unique effects.
IMMORTALITY = /<(?:IMMORTALITY|immortality)>/i
VANISH = /<(?:VANISH|vanish)>/i
AUTO_BATTLE = /<(?:AUTO_BATTLE|auto battle)>/i
HALF_MP_COST = /<(?:HALF_MP_COST|half mp cost)>/i
SUPER_GUARD = /<(?:SUPER_GUARD|super guard)>/i
PHARMA = /<(?:PHARMACOLOGY|pharmacology)>/i
DOUBLE_EXP = /<(?:DOUBLE_EXP_GAIN|double exp gain)>/i
FAST_ATTACK = /<(?:FAST_ATTACK|fast attack)>/i
PREVENT_CRIT = /<(?:PREVENT_CRITICAL|prevent critical)>/i
ANTI_STATE = /<(?:ANTI_STATE|anti state)>/i
ABSORB_HP = /<(?:ABSORB_HP|absorb hp)>/i
ABSORB_MP = /<(?:ABSORB_MP|absorb mp)>/i
DEATH_HPDMG = /<(?:DEATH_ON_HP_DMG|death on hp dmg)>/i
DEATH_MPDMG = /<(?:DEATH_ON_MP_DMG|death on mp dmg)>/i
DEATH_HPHEAL = /<(?:DEATH_ON_HP_HEAL|death on hp heal)>/i
DEATH_MPHEAL = /<(?:DEATH_ON_MP_HEAL|death on mp heal)>/i
# This affects damage taken.
HP_PAIN_RATE = /<(?:HP_PAIN_RATE|hp pain rate[ ]*(d+))>/i
HP_HEAL_RATE = /<(?:HP_HEAL_RATE|hp heal rate[ ]*(d+))>/i
MP_PAIN_RATE = /<(?:MP_PAIN_RATE|mp pain rate[ ]*(d+))>/i
MP_HEAL_RATE = /<(?:MP_HEAL_RATE|mp heal rate[ ]*(d+))>/i
UNDEAD_HP = /<(?:UNDEAD_HP|undead hp[ ]*(d+))>/i
UNDEAD_MP = /<(?:UNDEAD_MP|undead mp[ ]*(d+))>/i
SUPER_ARMOUR = /<(?:SUPER_ARMOUR|super armour|super armor)>/i
SUPER_BARRIER = /<(?:SUPER_BARRIER|super barrier)>/i
INVINCIBLE_HP = /<(?:INVINCIBLE_HP|invincibility_hp)>/i
INVINCIBLE_MP = /<(?:INVINCIBLE_MP|invincibility_mp)>/i
HPDMG_MPDMG = /<(?:HPDMG_TO_MPDMG|hpdmg to mpdmg[ ]*(d+))>/i
MPDMG_HPDMG = /<(?:MPDMG_TO_HPDMG|mpdmg to hpdmg[ ]*(d+))>/i
# These here are the custom state effects.
APPLY_EFFECT = /<(?:APPLY_EFFECT|apply effect)[ ]*(d+)>/i
WHILE_EFFECT = /<(?:WHILE_EFFECT|while effect)[ ]*(d+)>/i
LEAVE_EFFECT = /<(?:LEAVE_EFFECT|leave effect)[ ]*(d+)>/i
ERASE_EFFECT = /<(?:ERASE_EFFECT|erase effect)[ ]*(d+)>/i
REACT_EFFECT = /<(?:REACT_EFFECT|react effect)[ ]*(d+)>/i
SHOCK_EFFECT = /<(?:SHOCK_EFFECT|shock effect)[ ]*(d+)>/i
CLOSE_EFFECT = /<(?:CLOSE_EFFECT|close effect)[ ]*(d+)>/i
BEGIN_EFFECT = /<(?:BEGIN_EFFECT|begin effect)[ ]*(d+)>/i
end #module STATE
end # module REGEXP
end # module YE
#===============================================================================
# RPG::State
#===============================================================================
class RPG::State
#--------------------------------------------------------------------------
# Yanfly_Cache_CSP
#--------------------------------------------------------------------------
def yanfly_cache_csp
@maxhp_per = 100; @maxhp_set = 0; @maxmp_per = 100; @maxmp_set = 0
@atk_per = 100; @def_per = 100; @spi_per = 100; @agi_per = 100
@atk_set = 0; @def_set = 0; @spi_set = 0; @agi_set = 0
@hit_per = 100; @hit_set = 0; @eva_per = 100; @eva_set = 0
@cri_per = 100; @cri_set = 0; @odds_per = 100; @odds_set = 0
@apply_effect = 0; @while_effect = 0; @leave_effect = 0; @erase_effect = 0
@react_effect = 0; @half_mp_cost = false; @super_guard = false
@hp_degen_per = 0; @hp_degen_set = 0; @hp_regen_per = 0; @hp_regen_set = 0
@mp_degen_per = 0; @mp_degen_set = 0; @mp_regen_per = 0; @mp_regen_set = 0
@immortality = false; @vanish = false; @auto_battle = false;
@pharmacology = false; @double_exp_gain = false; @fast_attack = false
@prevent_critical = false; @anti_state = false; @super_armour = false
@absorb_hp = false; @absorb_mp = false; @super_barrier = false
@invincible_hp = false; @invincible_mp = false; @hpdmg_mpdmg = 0;
@mpdmg_hpdmg = 0; @undead_hp = 0; @undead_mp = 0; @death_hpdmg = false;
@death_mpdmg = false; @death_hpheal = false; @death_mpheal = false;
@hp_pain_rate = 0; @mp_pain_rate = 0; @hp_heal_rate = 0; @mp_heal_rate = 0
@max_stack = 1; @shock_effect = 0; @close_effect = 0; @begin_effect = 0
self.note.split(/[rn]+/).each { |line|
case line
when YE::REGEXP::STATE::MAX_STACK
@max_stack = $1.to_i
when YE::REGEXP::STATE::MAXHP_PER
@maxhp_per = $1.to_i
when YE::REGEXP::STATE::MAXHP_ADD
@maxhp_set = $1.to_i
when YE::REGEXP::STATE::MAXHP_SUB
@maxhp_set = $1.to_i * -1
when YE::REGEXP::STATE::MAXMP_PER
@maxmp_per = $1.to_i
when YE::REGEXP::STATE::MAXMP_ADD
@maxmp_set = $1.to_i
when YE::REGEXP::STATE::MAXMP_SUB
@maxmp_set = $1.to_i * -1
when YE::REGEXP::STATE::ATK_PER
@atk_per = $1.to_i
when YE::REGEXP::STATE::ATK_ADD
@atk_set = $1.to_i
when YE::REGEXP::STATE::ATK_SUB
@atk_set = $1.to_i * -1
when YE::REGEXP::STATE::DEF_PER
@def_per = $1.to_i
when YE::REGEXP::STATE::DEF_ADD
@def_set = $1.to_i
when YE::REGEXP::STATE::DEF_SUB
@def_set = $1.to_i * -1
when YE::REGEXP::STATE::SPI_PER
@spi_per = $1.to_i
when YE::REGEXP::STATE::SPI_ADD
@spi_set = $1.to_i
when YE::REGEXP::STATE::SPI_SUB
@spi_set = $1.to_i
when YE::REGEXP::STATE::AGI_PER
@agi_per = $1.to_i
when YE::REGEXP::STATE::AGI_ADD
@agi_set = $1.to_i
when YE::REGEXP::STATE::AGI_SUB
@agi_set = $1.to_i * -1
when YE::REGEXP::STATE::HIT_PER
@hit_per = $1.to_i
when YE::REGEXP::STATE::HIT_ADD
@hit_set = $1.to_i
when YE::REGEXP::STATE::HIT_SUB
@hit_set = $1.to_i * -1
when YE::REGEXP::STATE::EVA_PER
@eva_per = $1.to_i
when YE::REGEXP::STATE::EVA_ADD
@eva_set = $1.to_i
when YE::REGEXP::STATE::EVA_SUB
@eva_set = $1.to_i * -1
when YE::REGEXP::STATE::CRI_PER
@cri_per = $1.to_i
when YE::REGEXP::STATE::CRI_ADD
@cri_set = $1.to_i
when YE::REGEXP::STATE::CRI_SUB
@cri_set = $1.to_i * -1
when YE::REGEXP::STATE::ODDS_PER
@odds_per = $1.to_i
when YE::REGEXP::STATE::ODDS_ADD
@odds_set = $1.to_i
when YE::REGEXP::STATE::ODDS_SUB
@odds_set = $1.to_i * -1
when YE::REGEXP::STATE::APPLY_EFFECT
@apply_effect = $1.to_i
when YE::REGEXP::STATE::WHILE_EFFECT
@while_effect = $1.to_i
when YE::REGEXP::STATE::LEAVE_EFFECT
@leave_effect = $1.to_i
when YE::REGEXP::STATE::ERASE_EFFECT
@erase_effect = $1.to_i
when YE::REGEXP::STATE::REACT_EFFECT
@react_effect = $1.to_i
when YE::REGEXP::STATE::SHOCK_EFFECT
@shock_effect = $1.to_i
when YE::REGEXP::STATE::CLOSE_EFFECT
@close_effect = $1.to_i
when YE::REGEXP::STATE::BEGIN_EFFECT
@begin_effect = $1.to_i
when YE::REGEXP::STATE::HP_DEGEN_PER
@hp_degen_per = $1.to_i
when YE::REGEXP::STATE::HP_DEGEN_SET
@hp_degen_set = $1.to_i
when YE::REGEXP::STATE::HP_REGEN_PER
@hp_regen_per = $1.to_i
when YE::REGEXP::STATE::HP_REGEN_SET
@hp_regen_set = $1.to_i
when YE::REGEXP::STATE::MP_DEGEN_PER
@mp_degen_per = $1.to_i
when YE::REGEXP::STATE::MP_DEGEN_SET
@mp_degen_set = $1.to_i
when YE::REGEXP::STATE::MP_REGEN_PER
@mp_regen_per = $1.to_i
when YE::REGEXP::STATE::MP_REGEN_SET
@mp_regen_set = $1.to_i
when YE::REGEXP::STATE::IMMORTALITY
@immortality = true
when YE::REGEXP::STATE::VANISH
@vanish = true
when YE::REGEXP::STATE::AUTO_BATTLE
@auto_battle = true
when YE::REGEXP::STATE::HALF_MP_COST
@half_mp_cost = true
when YE::REGEXP::STATE::SUPER_GUARD
@super_guard = true
when YE::REGEXP::STATE::PHARMA
@pharmacology = true
when YE::REGEXP::STATE::DOUBLE_EXP
@double_exp_gain = true
when YE::REGEXP::STATE::FAST_ATTACK
@fast_attack = true
when YE::REGEXP::STATE::PREVENT_CRIT
@prevent_critical = true
when YE::REGEXP::STATE::ANTI_STATE
@anti_state = true
when YE::REGEXP::STATE::ABSORB_HP
@absorb_hp = true
when YE::REGEXP::STATE::ABSORB_MP
@absorb_mp = true
when YE::REGEXP::STATE::SUPER_ARMOUR
@super_armour = true
when YE::REGEXP::STATE::SUPER_BARRIER
@super_barrier = true
when YE::REGEXP::STATE::INVINCIBLE_HP
@invincible_hp = true
when YE::REGEXP::STATE::INVINCIBLE_MP
@invincible_mp = true
when YE::REGEXP::STATE::HPDMG_MPDMG
@hpdmg_mpdmg = $1.to_i
@hpdmg_mpdmg = 100 if @hpdmg_mpdmg > 100
when YE::REGEXP::STATE::MPDMG_HPDMG
@mpdmg_hpdmg = $1.to_i
@mpdmg_hpdmg = 100 if @mpdmg_hpdmg > 100
when YE::REGEXP::STATE::UNDEAD_HP
@undead_hp = $1.to_i
when YE::REGEXP::STATE::UNDEAD_MP
@undead_mp = $1.to_i
when YE::REGEXP::STATE::DEATH_HPDMG
@death_hpdmg = true
when YE::REGEXP::STATE::DEATH_MPDMG
@death_mpdmg = true
when YE::REGEXP::STATE::DEATH_HPHEAL
@death_hpheal = true
when YE::REGEXP::STATE::DEATH_MPHEAL
@death_mpheal = true
when YE::REGEXP::STATE::HP_PAIN_RATE
@hp_pain_rate = $1.to_i
when YE::REGEXP::STATE::MP_PAIN_RATE
@mp_pain_rate = $1.to_i
when YE::REGEXP::STATE::HP_HEAL_RATE
@hp_heal_rate = $1.to_i
when YE::REGEXP::STATE::MP_HEAL_RATE
@mp_heal_rate = $1.to_i
end
}
end # end yanfly_cache_csp
#--------------------------------------------------------------------------
# max stack
#--------------------------------------------------------------------------
def max_stack
yanfly_cache_csp if @max_stack == nil
return @max_stack
end
#--------------------------------------------------------------------------
# maxhp mods
#--------------------------------------------------------------------------
def maxhp_per
yanfly_cache_csp if @maxhp_per == nil
return @maxhp_per
end
def maxhp_set
yanfly_cache_csp if @maxhp_set == nil
return @maxhp_set
end
#--------------------------------------------------------------------------
# maxmp mods
#--------------------------------------------------------------------------
def maxmp_per
yanfly_cache_csp if @maxmp_per == nil
return @maxmp_per
end
def maxmp_set
yanfly_cache_csp if @maxmp_set == nil
return @maxmp_set
end
#--------------------------------------------------------------------------
# New Stat Rates
#--------------------------------------------------------------------------
def atk_per
yanfly_cache_csp if @atk_per == nil
return @atk_per
end
def def_per
yanfly_cache_csp if @def_per == nil
return @def_per
end
def spi_per
yanfly_cache_csp if @spi_per == nil
return @spi_per
end
def agi_per
yanfly_cache_csp if @agi_per == nil
return @agi_per
end
def atk_set
yanfly_cache_csp if @atk_set == nil
return @atk_set
end
def def_set
yanfly_cache_csp if @def_set == nil
return @def_set
end
def spi_set
yanfly_cache_csp if @spi_set == nil
return @spi_set
end
def agi_set
yanfly_cache_csp if @agi_set == nil
return @agi_set
end
#--------------------------------------------------------------------------
# Hit, Eva, Cri, Odds
#--------------------------------------------------------------------------
def hit_per
yanfly_cache_csp if @hit_per == nil
return @hit_per
end
def hit_set
yanfly_cache_csp if @hit_set == nil
return @hit_set
end
def eva_per
yanfly_cache_csp if @eva_per == nil
return @eva_per
end
def eva_set
yanfly_cache_csp if @eva_set == nil
return @eva_set
end
def cri_per
yanfly_cache_csp if @cri_per == nil
return @cri_per
end
def cri_set
yanfly_cache_csp if @cri_set == nil
return @cri_set
end
def odds_per
yanfly_cache_csp if @odds_per == nil
return @odds_per
end
def odds_set
yanfly_cache_csp if @odds_set == nil
return @odds_set
end
#--------------------------------------------------------------------------
# Custom Apply Effect
#--------------------------------------------------------------------------
def apply_effect
yanfly_cache_csp if @apply_effect == nil
return @apply_effect
end
#--------------------------------------------------------------------------
# Custom While Effect
#--------------------------------------------------------------------------
def while_effect
yanfly_cache_csp if @while_effect == nil
return @while_effect
end
#--------------------------------------------------------------------------
# Custom Leave Effect
#--------------------------------------------------------------------------
def leave_effect
yanfly_cache_csp if @leave_effect == nil
return @leave_effect
end
#--------------------------------------------------------------------------
# Custom Erase Effect
#--------------------------------------------------------------------------
def erase_effect
yanfly_cache_csp if @erase_effect == nil
return @erase_effect
end
#--------------------------------------------------------------------------
# Custom React Effect
#--------------------------------------------------------------------------
def react_effect
yanfly_cache_csp if @react_effect == nil
return @react_effect
end
#--------------------------------------------------------------------------
# Custom Shock Effect
#--------------------------------------------------------------------------
def shock_effect
yanfly_cache_csp if @shock_effect == nil
return @shock_effect
end
#--------------------------------------------------------------------------
# Custom Close Effect
#--------------------------------------------------------------------------
def close_effect
yanfly_cache_csp if @close_effect == nil
return @close_effect
end
#--------------------------------------------------------------------------
# Custom Begin Effect
#--------------------------------------------------------------------------
def begin_effect
yanfly_cache_csp if @begin_effect == nil
return @begin_effect
end
#--------------------------------------------------------------------------
# HP Degen/Regen
#--------------------------------------------------------------------------
def hp_degen_per
yanfly_cache_csp if @hp_degen_per == nil
return @hp_degen_per
end
def hp_degen_set
yanfly_cache_csp if @hp_degen_set == nil
return @hp_degen_set
end
def hp_regen_per
yanfly_cache_csp if @hp_regen_per == nil
return @hp_regen_per
end
def hp_regen_set
yanfly_cache_csp if @hp_regen_set == nil
return @hp_regen_set
end
def dr_hp?
return true if hp_degen_per > 0
return true if hp_regen_per > 0
return true if hp_degen_set > 0
return true if hp_regen_set > 0
end
#--------------------------------------------------------------------------
# MP Degen/Regen
#--------------------------------------------------------------------------
def mp_degen_per
yanfly_cache_csp if @mp_degen_per == nil
return @mp_degen_per
end
def mp_degen_set
yanfly_cache_csp if @mp_degen_set == nil
return @mp_degen_set
end
def mp_regen_per
yanfly_cache_csp if @mp_regen_per == nil
return @mp_regen_per
end
def mp_regen_set
yanfly_cache_csp if @mp_regen_set == nil
return @mp_regen_set
end
def dr_mp?
return true if mp_degen_per > 0
return true if mp_regen_per > 0
return true if mp_degen_set > 0
return true if mp_regen_set > 0
end
#--------------------------------------------------------------------------
# Immortality
#--------------------------------------------------------------------------
def immortality
yanfly_cache_csp if @immortality == nil
return @immortality
end
#--------------------------------------------------------------------------
# Vanish
#--------------------------------------------------------------------------
def vanish
yanfly_cache_csp if @vanish == nil
return @vanish
end
#--------------------------------------------------------------------------
# Auto Battle
#--------------------------------------------------------------------------
def auto_battle
yanfly_cache_csp if @auto_battle == nil
return @auto_battle
end
#--------------------------------------------------------------------------
# Half MP Cost
#--------------------------------------------------------------------------
def half_mp_cost
yanfly_cache_csp if @half_mp_cost == nil
return @half_mp_cost
end
#--------------------------------------------------------------------------
# Super Guard
#--------------------------------------------------------------------------
def super_guard
yanfly_cache_csp if @super_guard == nil
return @super_guard
end
#--------------------------------------------------------------------------
# Pharmacology
#--------------------------------------------------------------------------
def pharmacology
yanfly_cache_csp if @pharmacology == nil
return @pharmacology
end
#--------------------------------------------------------------------------
# Double EXP Gain
#--------------------------------------------------------------------------
def double_exp_gain
yanfly_cache_csp if @double_exp_gain == nil
return @double_exp_gain
end
#--------------------------------------------------------------------------
# Fast Attack
#--------------------------------------------------------------------------
def fast_attack
yanfly_cache_csp if @fast_attack == nil
return @fast_attack
end
#--------------------------------------------------------------------------
# Prevent Critical
#--------------------------------------------------------------------------
def prevent_critical
yanfly_cache_csp if @prevent_critical == nil
return @prevent_critical
end
#--------------------------------------------------------------------------
# Anti State
#--------------------------------------------------------------------------
def anti_state
yanfly_cache_csp if @anti_state == nil
return @anti_state
end
#--------------------------------------------------------------------------
# Absorb HP/MP
#--------------------------------------------------------------------------
def absorb_hp
yanfly_cache_csp if @absorb_hp == nil
return @absorb_hp
end
def absorb_mp
yanfly_cache_csp if @absorb_mp == nil
return @absorb_mp
end
#--------------------------------------------------------------------------
# super_armour
#--------------------------------------------------------------------------
def super_armour
yanfly_cache_csp if @super_armour == nil
return @super_armour
end
#--------------------------------------------------------------------------
# super_barrier
#--------------------------------------------------------------------------
def super_barrier
yanfly_cache_csp if @super_barrier == nil
return @super_barrier
end
#--------------------------------------------------------------------------
# invincible_hp
#--------------------------------------------------------------------------
def invincible_hp
yanfly_cache_csp if @invincible_hp == nil
return @invincible_hp
end
#--------------------------------------------------------------------------
# invincible_mp
#--------------------------------------------------------------------------
def invincible_mp
yanfly_cache_csp if @invincible_mp == nil
return @invincible_mp
end
#--------------------------------------------------------------------------
# HP Damage to MP Damage
#--------------------------------------------------------------------------
def hpdmg_mpdmg
yanfly_cache_csp if @hpdmg_mpdmg == nil
return @hpdmg_mpdmg
end
#--------------------------------------------------------------------------
# MP Damage to HP Damage
#--------------------------------------------------------------------------
def mpdmg_hpdmg
yanfly_cache_csp if @mpdmg_hpdmg == nil
return @mpdmg_hpdmg
end
#--------------------------------------------------------------------------
# Undead HP/MP
#--------------------------------------------------------------------------
def undead_hp
yanfly_cache_csp if @undead_hp == nil
return @undead_hp
end
def undead_mp
yanfly_cache_csp if @undead_mp == nil
return @undead_mp
end
#--------------------------------------------------------------------------
# death on hp/mp damage/heal
#--------------------------------------------------------------------------
def death_hpdmg
yanfly_cache_csp if @death_hpdmg == nil
return @death_hpdmg
end
def death_mpdmg
yanfly_cache_csp if @death_mpdmg == nil
return @death_mpdmg
end
def death_hpheal
yanfly_cache_csp if @death_hpheal == nil
return @death_hpheal
end
def death_mpheal
yanfly_cache_csp if @death_mpheal == nil
return @death_mpheal
end
#--------------------------------------------------------------------------
# HP/MP Pain/Heal Rate
#--------------------------------------------------------------------------
def hp_pain_rate
yanfly_cache_csp if @hp_pain_rate == nil
return @hp_pain_rate
end
def mp_pain_rate
yanfly_cache_csp if @mp_pain_rate == nil
return @mp_pain_rate
end
def hp_heal_rate
yanfly_cache_csp if @hp_heal_rate == nil
return @hp_heal_rate
end
def mp_heal_rate
yanfly_cache_csp if @mp_heal_rate == nil
return @mp_heal_rate
end
end #end RPG::State
#===============================================================================
# Game_Actor
#===============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# alias auto_battle
#--------------------------------------------------------------------------
alias auto_battle_csp auto_battle unless $@
def auto_battle
for state in states
return true if state.auto_battle
end
return auto_battle_csp
end
#--------------------------------------------------------------------------
# alias half_mp_cost
#--------------------------------------------------------------------------
alias half_mp_cost_csp half_mp_cost unless $@
def half_mp_cost
for state in states
return true if state.half_mp_cost
end
return half_mp_cost_csp
end
#--------------------------------------------------------------------------
# alias super_guard
#--------------------------------------------------------------------------
alias super_guard_csp super_guard unless $@
def super_guard
for state in states
return true if state.super_guard
end
return super_guard_csp
end
#--------------------------------------------------------------------------
# alias pharmacology
#--------------------------------------------------------------------------
alias pharmacology_csp pharmacology unless $@
def pharmacology
for state in states
return true if state.pharmacology
end
return pharmacology_csp
end
#--------------------------------------------------------------------------
# alias double_exp_gain
#--------------------------------------------------------------------------
alias double_exp_gain_csp double_exp_gain unless $@
def double_exp_gain
for state in states
return true if state.double_exp_gain
end
return double_exp_gain_csp
end
#--------------------------------------------------------------------------
# alias fast_attack
#--------------------------------------------------------------------------
alias fast_attack_csp fast_attack unless $@
def fast_attack
for state in states
return true if state.fast_attack
end
return fast_attack_csp
end
#--------------------------------------------------------------------------
# alias prevent_critical
#--------------------------------------------------------------------------
alias prevent_critical_csp prevent_critical unless $@
def prevent_critical
for state in states
return true if state.prevent_critical
end
return prevent_critical_csp
end
#--------------------------------------------------------------------------
# Added State Success Rate
#--------------------------------------------------------------------------
def state_probability(state_id)
if $data_states[state_id].nonresistance
return 100
else
a = YE::BATTLE::STATE_A
b = YE::BATTLE::STATE_B
c = YE::BATTLE::STATE_C
d = YE::BATTLE::STATE_D
e = YE::BATTLE::STATE_E
f = YE::BATTLE::STATE_F
rank = self.class.state_ranks[state_id]
return [0,a,b,c,d,e,f][rank]
end
end
#--------------------------------------------------------------------------
# alias hit/eva/cri/odds for actors
#--------------------------------------------------------------------------
alias hit_actor_csp hit unless $@
def hit
n = hit_actor_csp
states.each { |state|
id = state.id
n *= (state.hit_per + ((state.hit_per - 100) * state_stack(id))) / 100.0
n += state.hit_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 0].max, limit].min
return n
end
alias eva_actor_csp eva unless $@
def eva
n = eva_actor_csp
states.each { |state|
id = state.id
n *= (state.eva_per + ((state.eva_per - 100) * state_stack(id))) / 100.0
n += state.eva_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 0].max, limit].min
return n
end
alias cri_actor_csp cri unless $@
def cri
n = cri_actor_csp
states.each { |state|
id = state.id
n *= (state.cri_per + ((state.cri_per - 100) * state_stack(id))) / 100.0
n += state.cri_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 0].max, limit].min
return n
end
alias odds_actor_csp odds unless $@
def odds
n = odds_actor_csp
states.each { |state|
id = state.id
n *= (state.odds_per + ((state.odds_per - 100) * state_stack(id))) / 100.0
n += state.odds_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 1].max, limit].min
return n
end
end #Game_Actor
#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# alias hit/eva/cri/odds for enemies
#--------------------------------------------------------------------------
alias hit_enemy_csp hit unless $@
def hit
n = hit_enemy_csp
states.each { |state|
id = state.id
n *= (state.hit_per + ((state.hit_per - 100) * state_stack(id))) / 100.0
n += state.hit_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 1].max, limit].min
return n
end
alias eva_enemy_csp eva unless $@
def eva
n = eva_enemy_csp
states.each { |state|
id = state.id
n *= (state.eva_per + ((state.eva_per - 100) * state_stack(id))) / 100.0
n += state.eva_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 1].max, limit].min
return n
end
alias cri_enemy_csp cri unless $@
def cri
n = cri_enemy_csp
states.each { |state|
id = state.id
n *= (state.cri_per + ((state.cri_per - 100) * state_stack(id))) / 100.0
n += state.cri_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 1].max, limit].min
return n
end
alias odds_enemy_csp odds unless $@
def odds
n = odds_enemy_csp
states.each { |state|
id = state.id
n *= (state.odds_per + ((state.odds_per - 100) * state_stack(id))) / 100.0
n += state.odds_set * (state_stack(id) + 1)
}
limit = YE::REGEXP::STATE::HECOLIMIT
n = [[Integer(n), 1].max, limit].min
return n
end
#--------------------------------------------------------------------------
# Overwrite State Probability
#--------------------------------------------------------------------------
def state_probability(state_id)
if $data_states[state_id].nonresistance
return 100
else
a = YE::BATTLE::STATE_A
b = YE::BATTLE::STATE_B
c = YE::BATTLE::STATE_C
d = YE::BATTLE::STATE_D
e = YE::BATTLE::STATE_E
f = YE::BATTLE::STATE_F
rank = enemy.state_ranks[state_id]
return [0,a,b,c,d,e,f][rank]
end
end
end # game_enemy
#===============================================================================
# Game_Battler
#===============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :state_stack # This affects state stacking.
#--------------------------------------------------------------------------
# state stack
#--------------------------------------------------------------------------
def state_stack(state_id)
@state_stack = {} if @state_stack == nil
@state_stack[state_id] = 0 if @state_stack[state_id] == nil
if @state_stack[state_id] > $data_states[state_id].max_stack - 1
@state_stack[state_id] = $data_states[state_id].max_stack - 1
end
@state_stack[state_id] = 0 if @state_stack[state_id] < 0
return @state_stack[state_id]
end
#--------------------------------------------------------------------------
# state stack up
#--------------------------------------------------------------------------
def state_stack_up(state_id, up = 1)
return unless self.state?(state_id)
@state_stack = {} if @state_stack == nil
@state_stack[state_id] = 0 if @state_stack[state_id] == nil
@state_stack[state_id] += up
end
#--------------------------------------------------------------------------
# reset state stack
#--------------------------------------------------------------------------
def reset_state_stack(state_id)
@state_stack = {} if @state_stack == nil
@state_stack[state_id] = 0
end
#--------------------------------------------------------------------------
# alias maxhp
#--------------------------------------------------------------------------
alias maxhp_csp maxhp unless $@
def maxhp
n = maxhp_csp
states.each { |state|
id = state.id
n *= (state.maxhp_per + ((state.maxhp_per - 100) * state_stack(id))) / 100.0
n += state.maxhp_set * (state_stack(id) + 1)
}
n = [[Integer(n), 1].max, maxhp_limit].min
@hp = n if @hp > n
return n
end
#--------------------------------------------------------------------------
# alias maxmp
#--------------------------------------------------------------------------
alias maxmp_csp maxmp unless $@
def maxmp
n = maxmp_csp
states.each { |state|
id = state.id
n *= (state.maxmp_per + ((state.maxmp_per - 100) * state_stack(id))) / 100.0
n += state.maxmp_set * (state_stack(id) + 1)
}
limit = (defined?(maxmp_limit) ? maxmp_limit : 9999)
n = [[Integer(n), 0].max, limit].min
@mp = n if @mp > n
return n
end
#--------------------------------------------------------------------------
# alias attack
#--------------------------------------------------------------------------
alias atk_csp atk unless $@
def atk
n = atk_csp
states.each { |state|
id = state.id
n /= state.atk_rate / 100.00
n *= (state.atk_rate + ((state.atk_rate - 100) * state_stack(id))) / 100.0
n *= (state.atk_per + ((state.atk_per - 100) * state_stack(id))) / 100.0
n += state.atk_set * (state_stack(id) + 1)
}
limit = (defined?(parameter_limit) ? parameter_limit : 999)
n = [[Integer(n), 1].max, limit].min
return n
end
#--------------------------------------------------------------------------
# alias defense
#--------------------------------------------------------------------------
alias def_csp def
def def
n = def_csp
states.each { |state|
id = state.id
n /= state.def_rate / 100.00
n *= (state.def_rate + ((state.def_rate - 100) * state_stack(id))) / 100.0
n *= (state.def_per + ((state.def_per - 100) * state_stack(id))) / 100.0
n += state.def_set * (state_stack(id) + 1)
}
limit = (defined?(parameter_limit) ? parameter_limit : 999)
n = [[Integer(n), 1].max, limit].min
return n
end
#--------------------------------------------------------------------------
# alias spirit
#--------------------------------------------------------------------------
alias spi_csp spi unless $@
def spi
n = spi_csp
states.each { |state|
id = state.id
n /= state.spi_rate / 100.00
n *= (state.spi_rate + ((state.spi_rate - 100) * state_stack(id))) / 100.0
n *= (state.spi_per + ((state.spi_per - 100) * state_stack(id))) / 100.0
n += state.spi_set * (state_stack(id) + 1)
}
limit = (defined?(parameter_limit) ? parameter_limit : 999)
n = [[Integer(n), 1].max, limit].min
return n
end
#--------------------------------------------------------------------------
# alias agility
#--------------------------------------------------------------------------
alias agi_csp agi unless $@
def agi
n = agi_csp
states.each { |state|
id = state.id
n /= state.agi_rate / 100.00
n *= (state.agi_rate + ((state.agi_rate - 100) * state_stack(id))) / 100.0
n *= (state.agi_per + ((state.agi_per - 100) * state_stack(id))) / 100.0
n += state.agi_set * (state_stack(id) + 1)
}
limit = (defined?(parameter_limit) ? parameter_limit : 999)
n = [[Integer(n), 1].max, limit].min
return n
end
#--------------------------------------------------------------------------
# absorb hp/mp
#--------------------------------------------------------------------------
def absorb_hp
for state in states
if state.absorb_hp
return true
end
end
return false
end
def absorb_mp
for state in states
if state.absorb_mp
return true
end
end
return false
end
#--------------------------------------------------------------------------
# death on hp/mp damage/heal
#--------------------------------------------------------------------------
def death_hpdmg
for state in states
if state.death_hpdmg
return true
end
end
return false
end
def death_mpdmg
for state in states
if state.death_mpdmg
return true
end
end
return false
end
def death_hpheal
for state in states
if state.death_hpheal
return true
end
end
return false
end
def death_mpheal
for state in states
if state.death_mpheal
return true
end
end
return false
end
#--------------------------------------------------------------------------
# alias super_guard
#--------------------------------------------------------------------------
alias super_guard_battler_csp super_guard unless $@
def super_guard
for state in states
return true if state.super_guard
end
return super_guard_battler_csp
end
#--------------------------------------------------------------------------
# alias half_mp_cost
#--------------------------------------------------------------------------
alias half_mp_cost_battler_csp half_mp_cost unless $@
def half_mp_cost
for state in states
return true if state.half_mp_cost
end
return half_mp_cost_battler_csp
end
#--------------------------------------------------------------------------
# alias fast_attack
#--------------------------------------------------------------------------
alias fast_attack_battler_csp fast_attack unless $@
def fast_attack
for state in states
return true if state.fast_attack
end
return fast_attack_battler_csp
end
#--------------------------------------------------------------------------
# alias prevent_critical
#--------------------------------------------------------------------------
alias prevent_critical_battler_csp prevent_critical unless $@
def prevent_critical
for state in states
return true if state.prevent_critical
end
return prevent_critical_battler_csp
end
#--------------------------------------------------------------------------
# anti_state
#--------------------------------------------------------------------------
def anti_state
for state in states
return true if state.anti_state
end
return false
end
#--------------------------------------------------------------------------
# overwrite apply_state_changes
#--------------------------------------------------------------------------
def apply_state_changes(obj)
plus = obj.plus_state_set
minus = obj.minus_state_set
for i in plus
next if state_resist?(i)
next if dead?
next if i == 1 and @immortal
if state?(i)
@remained_states.push(i)
state_stack_up(i) if rand(100) < state_probability(i)
next
end
if rand(100) < state_probability(i)
add_state(i)
@added_states.push(i)
end
end
for i in minus
next unless state?(i)
remove_state(i)
@removed_states.push(i)
end
for i in @added_states & @removed_states
@added_states.delete(i)
@removed_states.delete(i)
end
end
#--------------------------------------------------------------------------
# alias add state
#--------------------------------------------------------------------------
alias add_state_csp add_state unless $@
def add_state(state_id)
state = $data_states[state_id]
return if state == nil
return if state_ignore?(state_id)
return if self.anti_state
state_stack_up(state_id) if state?(state_id)
#---
add_state_csp(state_id)
#---
state = $data_states[state_id]
unless @hidden
run_apply_effect(state) if state.apply_effect > 0
end
apply_hidden(state) if state.vanish
@immortal = true if state.immortality
end
#--------------------------------------------------------------------------
# apply_hidden
#--------------------------------------------------------------------------
def apply_hidden(hidden_state)
@hidden = true
for state in states
if state != hidden_state
if state_turns?(state.id) != nil and state_turns?(state.id) > 0
remove_state(state.id)
end
end
end
@hidden = true
end
#--------------------------------------------------------------------------
# alias remove state
#--------------------------------------------------------------------------
alias remove_state_csp remove_state unless $@
def remove_state(state_id)
reset_state_stack(state_id)
remove_state_csp(state_id)
state = $data_states[state_id]
#---
unless @hidden
run_erase_effect(state) if state.erase_effect > 0
end
#---
if state.immortality
remove_immortal = false
for state in states
remove_immortal = true if state.immortality
break if state.immortality
end
@immortal = remove_immortal
end
#---
if state.vanish
@hidden = false
end
#---
end
#--------------------------------------------------------------------------
# alias remove states auto
#--------------------------------------------------------------------------
alias remove_states_auto_csp remove_states_auto unless $@
def remove_states_auto
clear_action_results
for state in states
unless @hidden
run_while_effect(state) if state.while_effect > 0
end
end
for i in @state_turns.keys.clone
if @state_turns[i] == 0
unless @hidden
run_leave_effect($data_states[i]) if $data_states[i].leave_effect > 0
end
end
end
remove_states_auto_csp
end
#--------------------------------------------------------------------------
# alias slip damage effect
#--------------------------------------------------------------------------
alias slip_damage_effect_csp slip_damage_effect unless $@
def slip_damage_effect
for state in states
unless @hidden or dead?
degen_regen(state) if state.dr_hp? or state.dr_mp?
end
end
slip_damage_effect_csp
for state in states
run_close_effect(state) if state.close_effect > 0
end
end
#--------------------------------------------------------------------------
# alias execute damage
#--------------------------------------------------------------------------
alias execute_damage_csp execute_damage unless $@
def execute_damage(user, anti_react = false)
if @hidden
@hp_damage = 0
@mp_damage = 0
end
@undead = false
react_states = []
hp_rate_states = []
hp_dmg_states = []
hp_con_states = []
mp_rate_states = []
mp_dmg_states = []
mp_con_states = []
for state in states # push into categories to reduce unnecessary checks
react_states.push(state) if state.react_effect > 0
hp_rate_states.push(state) if state.hp_pain_rate > 0
hp_rate_states.push(state) if state.hp_heal_rate > 0
hp_dmg_states.push(state) if state.super_armour
hp_dmg_states.push(state) if state.invincible_hp
hp_con_states.push(state) if state.hpdmg_mpdmg > 0
hp_con_states.push(state) if state.undead_hp > 0
mp_rate_states.push(state) if state.mp_pain_rate > 0
mp_rate_states.push(state) if state.mp_heal_rate > 0
mp_dmg_states.push(state) if state.super_barrier
mp_dmg_states.push(state) if state.invincible_mp
mp_con_states.push(state) if state.mpdmg_hpdmg > 0
mp_con_states.push(state) if state.undead_mp > 0
end
for state in react_states # first go for react effects
unless @hidden
run_react_effect(state) if state.react_effect > 0 and not anti_react
end
end
for state in hp_rate_states # go for HP rate adjustment
hp_rate_effect(1, state) if state.hp_pain_rate > 0
hp_rate_effect(2, state) if state.hp_heal_rate > 0
end
for state in hp_dmg_states # go for HP effects
super_armour_effect if state.super_armour
@hp_damage = 0 if state.invincible_hp and @hp_damage > 0
end
for state in hp_con_states # go for HP<->MP effects
run_hpdmg_mpdmg(state.hpdmg_mpdmg) if @hp_damage > 0
undead_effect_hp(state.undead_hp) if state.undead_hp > 0
end
for state in mp_rate_states # go for MP rate adjustment
mp_rate_effect(1, state) if state.mp_pain_rate > 0
mp_rate_effect(2, state) if state.mp_heal_rate > 0
end
for state in mp_dmg_states # go for MP effects
super_barrier_effect if state.super_barrier
@mp_damage = 0 if state.invincible_mp and @mp_damage > 0
end
for state in mp_con_states # go for MP<->HP effects
run_mpdmg_hpdmg(state.mpdmg_hpdmg) if @mp_damage > 0
undead_effect_mp(state.undead_hp) if state.undead_mp > 0
end
@absorbed = true if user.absorb_hp and @hp_damage > 0
@absorbed = true if user.absorb_mp and @mp_damage > 0
@absorbed = false if @undead
#--------------
execute_damage_csp(user)
#--------------
self.hp = 0 if @hp_damage > 0 and self.death_hpdmg
self.hp = 0 if @mp_damage > 0 and self.death_mpdmg
self.hp = 0 if @hp_damage < 0 and self.death_hpheal
self.hp = 0 if @mp_damage < 0 and self.death_mpheal
end
#--------------------------------------------------------------------------
# HP/MP Rate Effect
#--------------------------------------------------------------------------
def hp_rate_effect(rate_case, state)
if rate_case == 1
rate = state.hp_pain_rate
if @hp_damage > 0
@hp_damage *= (rate + ((rate - 100) * state_stack(id)))
@hp_damage /= 100
end
else
rate = state.hp_heal_rate
if @hp_damage < 0
@hp_damage *= (rate + ((rate - 100) * state_stack(id)))
@hp_damage /= 100
end
end
end
def mp_rate_effect(rate_case, state)
if rate_case == 1
rate = state.mp_pain_rate
if @mp_damage > 0
@mp_damage *= (rate + ((rate - 100) * state_stack(id)))
@mp_damage /= 100
end
else
rate = state.mp_heal_rate
if @mp_damage < 0
@mp_damage *= (rate + ((rate - 100) * state_stack(id)))
@mp_damage /= 100
end
end
end
#--------------------------------------------------------------------------
# Undead HP/MP effects
#--------------------------------------------------------------------------
def undead_effect_hp(rate)
if @hp_damage < 0
@hp_damage *= -1
@hp_damage *= rate
@hp_damage /= 100
end
@undead = true
end
def undead_effect_mp(rate)
if @mp_damage < 0
@mp_damage *= -1
@mp_damage *= rate
@mp_damage /= 100
end
@undead = true
end
#--------------------------------------------------------------------------
# HP Damage to MP Damage
#--------------------------------------------------------------------------
def run_hpdmg_mpdmg(percent)
hpdmg = @hp_damage * (100 - percent) / 100
mpdmg = @mp_damage + @hp_damage - hpdmg
if mpdmg > self.mp
extra = mpdmg - self.mp
mpdmg = self.mp
hpdmg += extra
end
@hp_damage = hpdmg
@mp_damage = mpdmg
end
#--------------------------------------------------------------------------
# MP Damage to HP Damage
#--------------------------------------------------------------------------
def run_mpdmg_hpdmg(percent)
mpdmg = @mp_damage * (100 - percent) / 100
hpdmg = @hp_damage + @mp_damage - mpdmg
if hpdmg > (self.hp + 1)
extra = hpdmg - self.hp - 1
hpdmg = self.hp - 1
mpdmg += extra
end
@hp_damage = hpdmg
@mp_damage = mpdmg
end
#--------------------------------------------------------------------------
# Super Armour Effect
#--------------------------------------------------------------------------
def super_armour_effect
if @hp_damage > 0
@hp_damage *= YE::BATTLE::SUPER_ARMOUR_PER
@hp_damage /= 100
@hp_damage -= YE::BATTLE::SUPER_ARMOUR_SUB
min_dmg = YE::BATTLE::SUPER_ARMOUR_MIN
@hp_damage = min_dmg if @hp_damage < min_dmg
@hp_damage = 1
end
end
#--------------------------------------------------------------------------
# Super Barrier Effect
#--------------------------------------------------------------------------
def super_barrier_effect
if @mp_damage > 0
@mp_damage *= YE::BATTLE::SUPER_BARRIER_PER
@mp_damage /= 100
@mp_damage -= YE::BATTLE::SUPER_BARRIER_SUB
min_dmg = YE::BATTLE::SUPER_BARRIER_MIN
@mp_damage = min_dmg if @mp_damage < min_dmg
@mp_damage = 1
end
end
#--------------------------------------------------------------------------
# HP/MP Degen/Regen
#--------------------------------------------------------------------------
def degen_regen(state)
id = state.id
if state.dr_hp? and not @hidden
dr_hp = 0
if state.hp_degen_per > 0
dr_hp += self.maxhp * (state.hp_degen_per * (state_stack(id) + 1)) / 100
end
if state.hp_regen_per > 0
dr_hp -= self.maxhp * (state.hp_regen_per * (state_stack(id) + 1)) / 100
end
if state.hp_degen_set > 0
dr_hp += state.hp_degen_set * (state_stack(id) + 1)
end
if state.hp_regen_set > 0
dr_hp -= state.hp_regen_set * (state_stack(id) + 1)
end
dr_hp = self.hp - 1 if dr_hp > self.hp
self.hp -= dr_hp
end
if state.dr_mp? and not @hidden
dr_mp = 0
if state.mp_degen_per > 0
dr_mp += self.maxmp * (state.mp_degen_per * (state_stack(id) + 1)) / 100
end
if state.mp_regen_per > 0
dr_mp -= self.maxmp * (state.mp_regen_per * (state_stack(id) + 1)) / 100
end
if state.mp_degen_set > 0
dr_mp += state.mp_degen_set * (state_stack(id) + 1)
end
if state.mp_regen_set > 0
dr_mp -= state.mp_regen_set * (state_stack(id) + 1)
end
self.mp -= dr_mp
end
end
#--------------------------------------------------------------------------
# hp_damage=, mp_damage=, set_absorb_true
#--------------------------------------------------------------------------
def hp_damage=(value)
@hp_damage = value
end
def mp_damage=(value)
@mp_damage = value
end
def set_absorb_true
@absorbed = true
end
#--------------------------------------------------------------------------
# status_damage
#--------------------------------------------------------------------------
def status_damage(hp_dmg, mp_dmg, target, attacker, anti_react = true,
absorb = false)
target.hp_damage = hp_dmg
target.mp_damage = mp_dmg
target.set_absorb_true if absorb
target.execute_damage(attacker, anti_react)
$scene.display_damage(target)
$scene.display_added_states(target)
end
#--------------------------------------------------------------------------
# msgwait
#--------------------------------------------------------------------------
def msgwait(value = 0)
if value > 0
$scene.wait(value)
elsif $imported["CustomSkillEffects"]
$scene.wait(YE::BATTLE::MSGWAIT)
else
$scene.wait(30)
end
end
#--------------------------------------------------------------------------
# state_turns
#--------------------------------------------------------------------------
def set_state_turns(state_id, new_turns)
new_turns = 1 if new turns <= 0
@state_turns[state_id] = new_turns
end
def state_turns?(state_id)
return @state_turns[state_id]
end
end
#===============================================================================
# Scene_Battle
#===============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias start
#--------------------------------------------------------------------------
alias start_csp start unless $@
def start
start_csp
$message__window = @message_window
end
#--------------------------------------------------------------------------
# return active battler
#--------------------------------------------------------------------------
def active_battler
return @active_battler
end
#--------------------------------------------------------------------------
# alias start main
#--------------------------------------------------------------------------
alias start_main_csp start_main unless $@
def start_main
start_main_csp
for member in $game_party.existing_members
for state in member.states
member.run_begin_effect(state) if state.begin_effect > 0
end
end
for member in $game_troop.members
for state in member.states
member.run_begin_effect(state) if state.begin_effect > 0
end
end
end
#--------------------------------------------------------------------------
# alias display_damage
#--------------------------------------------------------------------------
alias display_damage_csp display_damage unless $@
def display_damage(target, obj = nil)
display_damage_csp(target, obj)
for state in target.states
target.run_shock_effect(state) if state.shock_effect > 0
end
end
end #Scene_Battle
#===============================================================================
#
# END OF FILE
#
#===============================================================================