#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ? Slip Damage - KGC_SlipDamageExtension ? VX ?
#_/ ? Last Update: 2008/03/29 ?
#_/ ? Translation by Mr. Anonymous ?
#_/-----------------------------------------------------------------------------
#_/ This script allows you to make states with "slip damage" or continual
#_/ damage/recovery outside of battle. This effect is accompanied by a screen
#_/ flash to indictate everytime the actor recieves damage/recovery.
#_/ Recall the "Poisoned" state in Pokemon.
#_/=============================================================================
#_/ ? Instructions For Usage ?
#_/ To make use of this function, you must insert the <slip> tag into the
#_/ "Notes" box located in the States section of the database.
#_/
#_/ Format: <slip [HP/MP] Modifier Rate (%), Steps>
#_/ Where HP/MP: Designate HP or MP damage/recovery.
#_/ Where Modifier: Use [ - ] or damage or [ + ] for recovery.
#_/ Where Rate: The desired amount of damage/recovery.
#_/ Where %: [Optional] You may insert % after rate for Max HP or Max MP.
#_/ Where Steps: The amount of steps it takes for the effect to kick in.
#_/
#_/ Ex: <slip HP -5%, 5>
#_/ For every 5 steps, 5 percent of the actor's max hp is lost.
#_/
#_/ Ex: <slip MP +20, 10>
#_/ For every 10 steps, 20 MP is recovered.
#_/
#_/ Ex: <slip MP -10%>
#_/ After every turn in battle, 10 percent of MP is lost.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#==============================================================================#
# ? Customization ? #
#==============================================================================#
module KGC
module SlipDamageExtension
# ? Damage Indictation Flash ?
# This allows you to change the color of the flash that happens when the
# actor loses or gains health due to the Slip Damage state.
DAMAGE_FLASH_COLOR = Color.new(255, 0, 0, 64)
# This allows you to change the duration (in frames) the flash remains
# on-screen.
DAMAGE_FLASH_DURATION = 4
end
end
#------------------------------------------------------------------------------#
$imported = {} if $imported == nil
$imported["SlipDamageExtension"] = true
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Unless you know what you're doing, it's best not to alter anything beyond #
# this point, as this only affects the tag used for "Notes" in database. #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Whatever word(s) are after the separator ( | ) in the following lines are
# what are used to determine what is searched for in the "Notes" section of a
# skill to see if it is an Steal skill.
# Default Slip Damage State tag is <slip>
module KGC::SlipDamageExtension
# Regular Expression Module
module Regexp
# State Module
module State
# Slip Damage tag string
SLIP_DAMAGE = /<(?:SLIP|slip)\s*([HM]P)?\s*([\-\+]?\d+)([%?])?
(?:\s*,\s*([\-\+]?\d+))?>/ix
end
end
end
#==============================================================================
# ? RPG::State
#==============================================================================
class RPG::State
#--------------------------------------------------------------------------
# ? ????????????????????
#--------------------------------------------------------------------------
def create_slip_damage_extension_cache
@__slip_damage = false
@__slip_damage_hp_rate = 0
@__slip_damage_hp_value = 0
@__slip_damage_hp_map = 0
@__slip_damage_mp_rate = 0
@__slip_damage_mp_value = 0
@__slip_damage_mp_map = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when KGC::SlipDamageExtension::Regexp::State::SLIP_DAMAGE
# ????????
@__slip_damage = true
analyse_slip_damage($~)
end
}
# ??????????????????
unless @__slip_damage
@__slip_damage_hp_rate = 10
@__slip_damage_hp_map = 1
end
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def analyse_slip_damage(match)
# ?????
if match[1] == nil
type = :hp
else
if match[1] =~ /MP/i
type = :mp
else
type = :hp
end
end
# ???????
n = match[2].to_i
# ?? or ????
is_rate = (match[3] != nil)
# ?????????
map_n = (match[4] != nil ? match[4].to_i : 0)
# ???????????
case type
when :hp
if is_rate
@__slip_damage_hp_rate -= n
else
@__slip_damage_hp_value -= n
end
@__slip_damage_hp_map -= map_n
when :mp
if is_rate
@__slip_damage_mp_rate -= n
else
@__slip_damage_mp_value -= n
end
@__slip_damage_mp_map -= map_n
end
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
unless $@
alias slip_damage_KGC_SlipDamageExtension slip_damage
end
def slip_damage
create_slip_damage_extension_cache if @__slip_damage == nil
return (@__slip_damage || slip_damage_KGC_SlipDamageExtension)
end
#--------------------------------------------------------------------------
# ? HP ???????? (??)
#--------------------------------------------------------------------------
def slip_damage_hp_rate
create_slip_damage_extension_cache if @__slip_damage_hp_rate == nil
return @__slip_damage_hp_rate
end
#--------------------------------------------------------------------------
# ? HP ???????? (??)
#--------------------------------------------------------------------------
def slip_damage_hp_value
create_slip_damage_extension_cache if @__slip_damage_hp_value == nil
return @__slip_damage_hp_value
end
#--------------------------------------------------------------------------
# ? HP ???????? (???)
#--------------------------------------------------------------------------
def slip_damage_hp_map
create_slip_damage_extension_cache if @__slip_damage_hp_map == nil
return @__slip_damage_hp_map
end
#--------------------------------------------------------------------------
# ? MP ???????? (??)
#--------------------------------------------------------------------------
def slip_damage_mp_rate
create_slip_damage_extension_cache if @__slip_damage_mp_rate == nil
return @__slip_damage_mp_rate
end
#--------------------------------------------------------------------------
# ? MP ???????? (??)
#--------------------------------------------------------------------------
def slip_damage_mp_value
create_slip_damage_extension_cache if @__slip_damage_mp_value == nil
return @__slip_damage_mp_value
end
#--------------------------------------------------------------------------
# ? MP ???????? (???)
#--------------------------------------------------------------------------
def slip_damage_mp_map
create_slip_damage_extension_cache if @__slip_damage_mp_map == nil
return @__slip_damage_mp_map
end
end
#???????????????????????????????????????
#==============================================================================
# ? Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def slip_damage_effect
return unless slip_damage?
slip_damage_effect_hp
slip_damage_effect_mp
end
#--------------------------------------------------------------------------
# ? HP ?????????????
#--------------------------------------------------------------------------
def slip_damage_effect_hp
return if dead?
n = 0
self.states.each { |state|
next unless state.slip_damage
n += self.maxhp * state.slip_damage_hp_rate / 100
n += state.slip_damage_hp_value
}
return if n == 0
@hp_damage = [n, self.hp - 1].min
self.hp -= @hp_damage
end
#--------------------------------------------------------------------------
# ? MP ?????????????
#--------------------------------------------------------------------------
def slip_damage_effect_mp
return if dead?
n = 0
self.states.each { |state|
next unless state.slip_damage
n += self.maxmp * state.slip_damage_mp_rate / 100
n += state.slip_damage_mp_value
}
return if n == 0
@mp_damage = [n, self.mp - 1].min
self.mp -= @mp_damage
end
#--------------------------------------------------------------------------
# ? ?????????????????
#--------------------------------------------------------------------------
def slip_damage_effect_on_walk
last_hp = self.hp
last_mp = self.mp
self.states.each { |state|
next unless state.slip_damage
self.hp -= state.slip_damage_hp_map
self.mp -= state.slip_damage_mp_map
}
# ????????????????
if self.hp < last_hp || self.mp < last_mp
$game_map.screen.start_flash(
KGC::SlipDamageExtension::DAMAGE_FLASH_COLOR,
KGC::SlipDamageExtension::DAMAGE_FLASH_DURATION)
end
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def do_auto_recovery_on_walk
return if dead?
if auto_hp_recover
self.hp += 1
end
end
end
#???????????????????????????????????????
#==============================================================================
# ? Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ? ?????? 1 ?????????
#--------------------------------------------------------------------------
def on_player_walk
for actor in members
if actor.slip_damage?
actor.slip_damage_effect_on_walk
end
actor.do_auto_recovery_on_walk
end
end
end
Looking to have a script made that would enable the slip damage of states to vary. Preferably through use of note tags. Here's an example of what I had in mind (and I suppose this could be edited into the existing script which I linked above. Also, that script already contains the <slip> function seen in the example):
Example:
<slip -1600>
<atk_f 100>
Where <atk_f> would make the slip damage be affected by the player's attack stat. I'm not sure if it'd matter, but I'd like the amounts to scale exactly as they do with skills. I would like this to be done also with spirit (<spi_f>) and if possible I'd like it to be able to affect skills as well (in case you want a skill to be influenced by more than 200), but also so that if used with a skill, the default set in the database is over-written with what is in the notebox (so that if you have 100 in the database and <atk_f 200> in the notebox, it'll use 200, rather than 100). I don't know if there needs to be a numerical scale to represent acceptable numbers for use or not, but if so, I'd like the scale to be 0 - 999.
The purpose of this is so that you can make those damage or healing over time abilities that don't always do the same amount per tick. It gets pretty boring seeing your max level curse spell always ticking for 5000 when you feel you should be more powerful than that.