#==============================================================================
# ** Game_Battler (part 3)
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
#==============================================================================
# JT Note: In case you can't tell, My Game_Battler 3 is a whole different animal
# to the default one. Stuff from Ccoa's New Status FX & KFs Metamagic
# has been transferred here since these scripts usurped my changes to
# the default battle algorithms. (It drove me bonkers figuring out
# why my new algorithms never worked to begin with, LOL)
# Also, I went on a rampage making up cool new skill effects.
# As a result, I now have Dreameater, Coup De Gras, Lifedrain & Demi
# effects here. The QuickAttack effect is seperate.
#==============================================================================
class Game_Battler
# JT - Gah! The Constants! The Constants! So many Constants!
# Protect Changes ------------------------------------------------------------
PROTECT_STATUS = 10 # which status is protect (Shielding Disc)
PROTECT_ANIMATION = 167 # what animation to play when hit
# Shell Changes --------------------------------------------------------------
# Modded by JT -> ADDED NEW SHELL TYPES FOR THE FOUR MAIN ELEMENTS!!
SHELL_STATUS_F = 18 # which status is shell fire
SHELL_STATUS_W = 19 # which status is shell wind
SHELL_STATUS_T = 20 # which status is shell thunder
SHELL_STATUS_I = 21 # which status is shell ice
SHELL_ANIMATION_F = 168 # what animation to play when hit
SHELL_ANIMATION_W = 171 # what animation to play when hit
SHELL_ANIMATION_T = 169 # what animation to play when hit
SHELL_ANIMATION_I = 172 # what animation to play when hit
SHELL_ELEMENT_F = 1 # skills with this element will be halved
SHELL_ELEMENT_W = 6 # skills with this element will be halved
SHELL_ELEMENT_T = 3 # skills with this element will be halved
SHELL_ELEMENT_I = 2 # skills with this element will be halved
# Metamagic Changes ----------------------------------------------------------
# Modded by JT -> Moved from its own script to make compatable with new battle system!!
META_STATE_EMPOWER = 30 # which status is Empower Metamagic
META_STATE_SEEKING = 29 # which status is Seeking Metamagic
META_SKILL_EMPOWER = 148 # which skill uses Empower Metamagic
META_SKILL_SEEKING = 147 # which skill uses Seeking Metamagic
# Dreameater & Coup de Gras Added by JT --------------------------------------
ASLEEP_STATUS = 5 #which status is Asleep; for use with Dreameater
DREAMEAT_ELEMENT = 23 #which element denotes that this is a Dreameater skill
STUNNED_STATUS = 32 #which status is Stunned; for use with Coup De Gras
COUPDEGRAS_ELEMENT= 24 #which element denotes that this is a Coup De Gras skill
#JT Other Cool FX ------------------------------------------------------------
LIFEDRAIN_ELEMENT = 25 #which element denotes that this is a LifeDrain skill
LIFEDRAIN_AMOUNT = 50 #What percent % of the damage caused is returned to the user
DEMI_ELEMENT = 26 #What element denotes that this is a Demi skill
DEMI_AMOUNT = 25 #What percent % of the targets current HP is removed by Demi
# JIM NOTE: Demi can still affected by variance. Give it 0 variance if you don't want this.
#JT Weapon FX ----------------------------------------------------------------
PARRY_ELEMENT = 29 #Which element denotes Parry. Parry weapons might auto-defend.
PIERCE_ELEMENT = 30 #Which element denotes Pierce. Pierce weapons negate defend.
SEEK_ELEMENT = 31 #Which element denotes Seeker. Seeker weapons always hit.
SILVER_ELEMENT = 32 #Which element denotes Silver. Silver weapons also damage MP.
#GILDED_ELEMENT = 33
#DOUBLESTRIKE
#--------------------------------------------------------------------------
# * Determine Usable Skills
# skill_id : skill ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# If there's not enough SP, the skill cannot be used.
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# Unusable if incapacitated
if dead?
return false
end
# If silent, only physical skills can be used
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# Get usable time
occasion = $data_skills[skill_id].occasion
# If in battle
if $game_temp.in_battle
# Usable with [Normal] and [Only Battle]
return (occasion == 0 or occasion == 1)
# If not in battle
else
# Usable with [Normal] and [Only Menu]
return (occasion == 0 or occasion == 2)
end
end
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects
# attacker : battler
#--------------------------------------------------------------------------
def attack_effect(attacker)
# Clear critical flag
self.critical = false
# First hit detection
# JT NOTE: Remember, a weapons ATK is now its Accuracy!!!
# To give more Strength to weapon, have it add STR.
phyhit = (attacker.atk + attacker.dex) #Accuracy + Skill
phyeva = (self.agi + self.eva) #Speed + Luck
phyhitres = (phyhit - phyeva)
# Checking a Hit now generates two random numbers, and then generates
# the Geometric Average of the two. (i.e. a Square Root of (X + Y))
# This means less extreme numbers, and probably higher accuracy in general.
# Also, Weapons with Seeking property always hit.
if attacker.element_set.include?(SEEK_ELEMENT)
hit_result = true
elsif self.cant_evade?
hit_result = true
else
hitx = rand(100)
hity = rand(100)
hitz = 0
hitz = (hitx * hity)
if hitz < 0 #prevents square root from crashing
hitz = 2
end
hit_result = (Math.sqrt(hitz) < phyhitres)
#So lets say 66 & 99 were generated for 85 accuracy.
#Normally 99 would miss, but:
# _________
# V (66 x 99) = 80.8
#hit_result = (rand(100) < phyhitres)
end
# If hit occurs
if hit_result == true
# Calculate basic damage
# JT- New Basic damage method!
#OLDMETHOD: atk = [attacker.atk - self.pdef / 2, 0].max
#OLDMETHOD: self.damage = atk * (20 + attacker.str) / 20
# Its easier to calculate now, as its pretty much just str - pdef
# However, if a weapon is does NOT include the Slashing, Piercing, or
# Bludgeoning elements, it is considered a Magical attack.
if attacker.element_set.include?(58) #Is it a Knife?
atkpow = (attacker.str/2) + (attacker.dex/3) + rand(2) - rand(2)
if attacker.skills.include?(285)#Jeanette DaggerMaster
atkpow *= 1.7
else
atkpow *= 1
end
defpow = self.pdef
elsif attacker.element_set.include?(9) #Does it do Crushing?
atkpow = attacker.str + rand(4) - rand(2)
defpow = self.pdef
elsif attacker.element_set.include?(10) #Does it do Slashing?
atkpow = attacker.str + rand(2) - rand(2)
if attacker.skills.include?(281)#SwordMastery I
atkpow *= 1.15
elsif attacker.skills.include?(282)#SwordMastery II
atkpow *= 1.35
elsif attacker.skills.include?(283)#SwordMastery III
atkpow *= 1.55
else
atkpow *= 1
end
defpow = self.pdef
elsif attacker.element_set.include?(5) #Does it do Piercing?
atkpow = attacker.str + rand(3) - rand(2)
if attacker.skills.include?(278)#SpearMastery I
atkpow *= 1.2
elsif attacker.skills.include?(279)#SpearMastery II
atkpow *= 1.4
elsif attacker.skills.include?(280)#SpearMastery III
atkpow *= 1.6
elsif attacker.skills.include?(285)#Jeanette DaggerMaster
atkpow *= 1.6
else
atkpow *= 1
end
defpow = self.pdef
elsif attacker.is_a?(Game_Enemy)#Enemies always use Power
atkpow = attacker.str + rand(4) - rand(4)
defpow = self.pdef
else #A Magical attack uses Magic Affinity, not Power
atkpow = attacker.int + rand(3) - rand(2)
defpow = self.mdef
end
self.damage = atkpow - defpow
# Element correction
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# If damage value is strictly positive
if self.damage > 0
# Critical correction
# JT- New Critical Method!
#critchance = (attacker.dex / 2) + (attacker.eva + 1) - (attacker.atk/10)
# ie. 20 Skill (Becomes 10) + 6 Luck - 70% Accuracy (Becomes 7) = 9% chance of crit
# Yes, higher accuracy weapons are harder to critical with.
# Higher finesse = Less likely to causing brutal damage. Fair play, right?
critpossibility = ((attacker.dex / 2) + (attacker.eva)) + (10 - (attacker.atk/10))
critdefence = ((self.eva * 2) + (self.agi))
critchance = (critpossibility - critdefence)
if critchance < 1
critchance = 5
end
# But, theres always at least 5% chance of criticalling.
if attacker.element_set.include?(16) #Keen weapons give +10% chance!
critchance += 10
end
critcheck = rand(100)
if critcheck < critchance
self.damage *= 2
#Play extra "w00t I criticalled animation"
critLottery = rand(10)
if critLottery >= 5
if attacker.name == "Risa"
self.animation_id = 702
elsif attacker.name == "Tomlyn"
self.animation_id = 703
elsif attacker.name == "Fortinbras"
self.animation_id = 704
elsif attacker.name == "Jeanette"
self.animation_id = 705
else
self.animation_id = 706
end
else
if attacker.name == "Risa"
self.animation_id = 708
elsif attacker.name == "Tomlyn"
self.animation_id = 709
elsif attacker.name == "Fortinbras"
self.animation_id = 710
elsif attacker.name == "Jeanette"
self.animation_id = 711
else
self.animation_id = 712
end
end
self.animation_hit = true
self.critical = true
$game_switches[519] = true
end
#OLDMETHOD: if rand(100) < 4 * attacker.dex / self.agi
#OLDMETHOD: self.damage *= 2
#OLDMETHOD: self.critical = true
#OLDMETHOD: end
# Guard correction
# Guard can be pierced by a piercing weapon, negating it.
if self.guarding?
self.damage /= 2
if attacker.element_set.include?(PIERCE_ELEMENT)
self.damage *= 2
self.animation_id = 297
self.animation_hit = true
else
self.animation_id = 295
self.animation_hit = true
end
end
#Parrying weapon gives 20% chance of Auto-Guard.
if self.element_set.include?(PARRY_ELEMENT)
parrychance = 0
parrychance = rand(100)
if parrychance > 80
self.damage /= 2
self.animation_id = 296
self.animation_hit = true
end
end
# Allow bloodsucking swords and the like.
if attacker.element_set.include?(LIFEDRAIN_ELEMENT)
percent = LIFEDRAIN_AMOUNT
slurp = self.damage * percent / 100
attacker.hp += slurp
end
# Protect Status Correction
if self.states.include?(PROTECT_STATUS)
self.damage /= 2
self.animation_id = PROTECT_ANIMATION
self.animation_hit = true
end
else
self.damage = "Miss"
hit_result = false
return false
end
# JT- Stupid Healing prevention
if self.damage < 1
self.damage = 0
end
self.damage.truncate
# Dispersion is now included in the main attack.
#if self.damage.abs > 0
# amp = [self.damage.abs * 15 / 100, 1].max
# self.damage += rand(amp+1) + rand(amp+1) - amp
#end
# Second hit detection - JT: There is no longer 2nd hit detect. Eva is included in 1st.
#eva = 8 * self.agi / attacker.dex + self.eva
#hit = self.damage < 0 ? 100 : 100 - eva
#hit = self.cant_evade? ? 100 : hit
#hit_result = (rand(100) < hit)
end
# If hit occurs
if hit_result == true
# State Removed by Shock
remove_states_shock
# Subtract damage from HP
if self.damage != 0 and self.damage >= 1
self.hp -= self.damage
end
#JT- Added a 'No Damage!' string- better than just showing 0.
if self.damage == 0
self.damage = "No Damage!"
end
# State change
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
# When missing
else
# Set damage to "Miss"
self.damage = "Miss"
# Clear critical flag
self.critical = false
end
# End Method
return true
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# Clear critical flag
self.critical = false
# If skill scope is for ally with 1 or more HP, and your own HP = 0,
# or skill scope is for ally with 0, and your own HP = 1 or more
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# End Method
return false
end
# Clear effective flag
effective = false
# Set effective flag if common ID is effective
effective |= skill.common_event_id > 0
# First hit detection
# JT NOTE: Remember, a weapons ATK is now its Accuracy!!!
# To give more Strength to weapon, have it add STR.
# Also, please keep accuracy rounded off to the nearest 10.
if skill.element_set.include?(12) #Physical Attack uses ATK, rather than SKL
sklhit = ((skill.hit / 5) + user.atk + 10) #Hitchance / 5 + Accuracy + 10
skleva = (self.agi + self.eva + 10) #Speed + Luck + 10
sklhitres = (sklhit - skleva)
else
sklhit = (skill.hit + user.dex + 10)
skleva = (self.agi + self.eva + 10)
sklhitres = (sklhit - skleva)
end
#If a Seeking Metamagic is in effect, and skill is not physical, skill always hits
if user.state?(META_STATE_SEEKING) == true and skill.element_set.include?(14)#&& skill.mdef_f > 0
hit_result = true
elsif user.element_set.include?(SEEK_ELEMENT) and skill.element_set.include?(12)
hit_result = true
elsif skill.power == 0 and skill.hit == 100 #And, positive state skills always hit
hit_result = true
elsif skill.element_set.include?(17) #And recovery skills (no, wtf the healing spell missed?)
hit_result = true
elsif skill.element_set.include?(31) #Skills with innate Seeking Quality
hit_result = true
elsif self.cant_evade?
hit_result = true
else
hitx = rand(100)
hity = rand(100)
hitz = 0
hitz = (hitx * hity)
if hitz < 0 #prevents square root from crashing
hitz = 2
end
hit_result = (Math.sqrt(hitz) < sklhitres)
#So lets say 66 & 99 were generated for 85 accuracy.
#Normally 99 would miss, but:
# _________
# V (66 x 99) = 80.8
#hit_result = (rand(100) < phyhitres)
end
#if skill.atk_f > 0
# hit *= user.hit / 100
#end
#hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= sklhit < 100
# If hit occurs.
if hit_result == true
# Calculate power
#power = skill.power + user.atk * skill.atk_f / 100 # OLD ALGORITHM
#All skill powers now work off the assumption they will be percentile based.
#E.g. 100 power skill that utilises only 100% Strength and PDEF in its equations
#hits with roughly the same potency as normal attack.
#Since a skill uses Lumen, however, it should be rare to have a 1.0 power attack.
#Else, whats the point of spending, eh...? Minimum should be like 1.5 (150) or so.
potency = 0
potency += (user.str * skill.str_f / 100) #Power
potency += (user.dex * skill.dex_f / 100) #Skill
potency += (user.agi * skill.agi_f / 100) #Speed
potency += (user.int * skill.int_f / 100) #Magaffinity
potency -= (self.pdef * skill.pdef_f / 100) #Foes Defence
potency -= (self.mdef * skill.mdef_f / 100) #Foes Resistance
multiplier = 0
multiplier = skill.power
powerbase = ((potency * multiplier) / 100) #This helps decimalise
powerup = rand(skill.variance)
powerdown = rand(skill.variance)
powermod = 100 #Create a percentage
powermod += powerup
powermod -= powerdown
powerfinal = 0
powerfinal = ((powerbase * powermod) / 100) #Generate a subtotal
#If you cast Empower the turn before, this spiritual/magical attack will double.
if user.state?(META_STATE_EMPOWER) == true and skill.element_set.include?(13)
rate = 2
self.damage = powerfinal * rate
elsif user.state?(META_STATE_EMPOWER) == true and skill.element_set.include?(14)
rate = 2
self.damage = powerfinal * rate
else
rate = 1
self.damage = powerfinal * rate
end
# Element correction
# Remember that C is now 50% effective. This is counter the fact that spells are
# in general more powerful than physical attacks, per se.
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# If damage value is strictly positive
if self.damage > 0
# Guard correction
# Guard can be pierced by a piercing skill, negating it.
# Parry does not apply to skills.
# Guard does not affect non-physical skills (Use shielding discs)
if self.guarding?
if skill.element_set.include?(12)
self.damage /= 2
if skill.element_set.include?(PIERCE_ELEMENT)
self.damage *= 2
self.animation_id = 297
self.animation_hit = true
else
self.animation_id = 295
self.animation_hit = true
end
end
end
end
if self.damage < 0 and skill.power > 0
# JT- Correction to prevent overpowered enemies healing from low-power skills!
self.damage = 0
end
# ELEMENTAL SHIELD DISC- Modded by JT to include all new types.
if self.states.include?(SHELL_STATUS_F) and skill.element_set.include?(SHELL_ELEMENT_F)
self.damage /= 2
self.animation_id = SHELL_ANIMATION_F
self.animation_hit = true
end
if self.states.include?(SHELL_STATUS_W) and skill.element_set.include?(SHELL_ELEMENT_W)
self.damage /= 2
self.animation_id = SHELL_ANIMATION_W
self.animation_hit = true
end
if self.states.include?(SHELL_STATUS_T) and skill.element_set.include?(SHELL_ELEMENT_T)
self.damage /= 2
self.animation_id = SHELL_ANIMATION_T
self.animation_hit = true
end
if self.states.include?(SHELL_STATUS_I) and skill.element_set.include?(SHELL_ELEMENT_I)
self.damage /= 2
self.animation_id = SHELL_ANIMATION_I
self.animation_hit = true
end
# End of ELEMENTAL DISC changes
# Dreameater/Coup de Gras Changes by JT:
if skill.element_set.include?(DREAMEAT_ELEMENT)
if self.states.include?(ASLEEP_STATUS)
self.damage *= 3
self.animation_id = SHELL_ANIMATION_I
self.animation_hit = true
else
self.damage /= 4
self.animation_id = SHELL_ANIMATION_F
self.animation_hit = true
end
end
if skill.element_set.include?(COUPDEGRAS_ELEMENT)
if self.states.include?(STUNNED_STATUS)
self.damage *= 3
else
self.damage /= 4
end
end
# End of Dreameater/Coup de Gras Changes
# Other cool stuff (Drain, Demi)
# Life Drain Skill- Modify the Percent Value to change
if skill.element_set.include?(LIFEDRAIN_ELEMENT)
percent = LIFEDRAIN_AMOUNT
slurp = self.damage * percent / 100
user.hp += slurp
user.damage = -slurp
end
if skill.element_set.include?(DEMI_ELEMENT)
percent = DEMI_AMOUNT
slurp = self.hp * percent / 100
self.damage = slurp
end
# OLD Dispersion
#if skill.variance > 0 and self.damage.abs > 0
#amp = [self.damage.abs * skill.variance / 100, 1].max
#self.damage += rand(amp+1) + rand(amp+1) - amp
#end
# Second hit detection
#eva = 8 * self.agi / user.dex + self.eva
#hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
#hit = self.cant_evade? ? 100 : hit
#hit_result = (rand(100) < hit)
#Set effective flag if skill is uncertain
effective |= hit < 100
#end
#end
# If hit occurs
if hit_result == true
# If physical attack has power other than 0
if skill.power != 0 or skill.atk_f != 0 #JT changed 'and' operator to 'or'
# State Removed by Shock
remove_states_shock
# Set to effective flag
effective = true
end
# Subtract damage from HP
last_hp = self.hp
if self.damage != nil
self.hp -= self.damage
end
effective |= self.hp != last_hp
# State change
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# If power is 0
if skill.power == 0 and skill.atk_f == 0
# Set damage to an empty string
self.damage = ""
# If state is unchanged
unless @state_changed
# Set damage to "Miss"
self.damage = "Miss"
end
end
if self.damage == 0 and skill.power > 0
self.damage = ""
self.damage = "No Damage!" #JT- Another change 0 to No DMG string. Better.
end
end
#end
# If miss occurs
else
# Set damage to "Miss"
self.damage = "Miss"
end
# If not in battle
unless $game_temp.in_battle
# Set damage to nil
self.damage = nil
end
# Auto removal of Metamagic FX
if user.state?(META_STATE_EMPOWER) == true && skill.mdef_f > 0 && skill.id != META_SKILL_EMPOWER
user.remove_state(META_STATE_EMPOWER)
end
if user.state?(META_STATE_SEEKING) == true && skill.mdef_f > 0 && skill.id != META_SKILL_SEEKING
user.remove_state(META_STATE_SEEKING)
end
# End Method
return effective
end
#--------------------------------------------------------------------------
# * Application of Item Effects
# item : item
#--------------------------------------------------------------------------
def item_effect(item)
# Clear critical flag
self.critical = false
# If item scope is for ally with 1 or more HP, and your own HP = 0,
# or item scope is for ally with 0 HP, and your own HP = 1 or more
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
((item.scope == 5 or item.scope == 6) and self.hp >= 1)
# End Method
return false
end
# Clear effective flag
effective = false
# Set effective flag if common ID is effective
effective |= item.common_event_id > 0
# Determine hit
hit_result = (rand(100) < item.hit)
# Set effective flag is skill is uncertain
effective |= item.hit < 100
# If hit occurs
if hit_result == true
# Calculate amount of recovery
recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
if recover_hp < 0
recover_hp += self.pdef * item.pdef_f / 20
recover_hp += self.mdef * item.mdef_f / 20
recover_hp = [recover_hp, 0].min
end
# Element correction
recover_hp *= elements_correct(item.element_set)
recover_hp /= 100
recover_sp *= elements_correct(item.element_set)
recover_sp /= 100
# Dispersion
if item.variance > 0 and recover_hp.abs > 0
amp = [recover_hp.abs * item.variance / 100, 1].max
recover_hp += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and recover_sp.abs > 0
amp = [recover_sp.abs * item.variance / 100, 1].max
recover_sp += rand(amp+1) + rand(amp+1) - amp
end
# If recovery code is negative
if recover_hp < 0
# Guard correction
if self.guarding?
recover_hp /= 2
end
end
# Set damage value and reverse HP recovery amount
if recover_hp > 0
self.damage = -recover_hp
else
self.damage = recover_hp
end
# HP and SP recovery
# JT Fix: Attack items didn't return a string
last_hp = self.hp
last_sp = self.sp
self.hp += self.damage
self.sp += self.damage
effective |= self.hp != last_hp
effective |= self.sp != last_sp
# State change
@state_changed = false
effective |= states_plus(item.plus_state_set)
effective |= states_minus(item.minus_state_set)
# If parameter value increase is effective
if item.parameter_type > 0 and item.parameter_points != 0
# Branch by parameter
case item.parameter_type
when 1 # Max HP
@maxhp_plus += item.parameter_points
when 2 # Max SP
@maxsp_plus += item.parameter_points
when 3 # Strength
@str_plus += item.parameter_points
when 4 # Dexterity
@dex_plus += item.parameter_points
when 5 # Agility
@agi_plus += item.parameter_points
when 6 # Intelligence
@int_plus += item.parameter_points
end
# Set to effective flag
effective = true
end
# If HP recovery rate and recovery amount are 0
if item.recover_hp_rate == 0 and item.recover_hp == 0
# Set damage to empty string
self.damage = ""
# If SP recovery rate / recovery amount are 0, and parameter increase
# value is ineffective.
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
# If state is unchanged
unless @state_changed
# Set damage to "Miss"
self.damage = "Miss"
end
end
end
# If miss occurs
else
# Set damage to "Miss"
self.damage = "Miss"
end
# If not in battle
unless $game_temp.in_battle
# Set damage to nil
self.damage = nil
end
# End Method
return effective
end
#--------------------------------------------------------------------------
# * Application of Slip Damage Effects
#--------------------------------------------------------------------------
def slip_damage_effect
# Set damage
self.damage = self.maxhp / 10
# Dispersion
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# Subtract damage from HP
self.hp -= self.damage
# End Method
return true
end
#--------------------------------------------------------------------------
# * Calculating Element Correction
# element_set : element
#--------------------------------------------------------------------------
#ORIGINAL
#def elements_correct(element_set)
# If not an element
#if element_set == []
# Return 100
#return 100
#end
# Return the weakest object among the elements given
# * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
# which inherit from this class.
#weakest = 0
#for i in element_set
#weakest = [weakest, self.element_rate(i)].max
#end
#return weakest
#end
#JT - Rewritten Element correction so that it considers an average of all
# of the elements in an attack, and also discounts elements 11+ entirely
def elements_correct(element_set)
false_elements = [11 .. 61] #False elements not included in calculations.
elements = element_set.clone
if elements == []
return 100
end
multiplier = 0
size = 0
for i in elements
unless false_elements.include?(i)
multiplier += self.element_rate(i)
size += 1
end
end
if size == 0
return 100
end
return multiplier/size
end
end