#==============================================================================
#
# Yanfly 6 - Elemental Amplifiers
# --- Last Date Updated: 2011.10.26
# --- Level: Normal
# Requires: n/a
#
#==============================================================================
$imported = {} if $imported == nil
$imported["Y6-ElementAmplify"] = true
#==============================================================================
# Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# o 2011.10.26 - Bugfix'd ignoring amp modifiers didn't work on consumables.
# o 2011.10.24 - Started Script and Finished.
#
#==============================================================================
# Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Weapons, armours, status effects, and enemies can now have elemental
# amplifiers, which strengthens the elemental damage dealt. The multiplier is
# applied after elemental weaknesses/strengths are calculated, so the damage
# becomes multiplicatively stronger (or weaker if you decide to use the effects
# to weaken damage).
#
# Additionally, there are amplification modifiers that can be applied to
# healing and nonelemental damage. There are also tags which can have items
# and skills ignore elemental amplifiers.
#
#==============================================================================
# Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials but above ¥ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill and Item Tags - Insert the following tags into Skill or Item noteboxes.
# -----------------------------------------------------------------------------
# <ignore amplifiers>
# This will cause the skill/item to ignore amplifier modifications when it
# is calculating damage.
#
# -----------------------------------------------------------------------------
# Equipment Tags - Insert the following tags into Weapon or Armour noteboxes.
# -----------------------------------------------------------------------------
# <amplify element x: +y%>
# This will increase damage dealt when element x is involved by y%.
#
# <amplify heal: +x%>
# This will increase healing done by x%.
#
# <amplify nonelement: +x%>
# This will increase non-elemental damage dealt by y%.
#
# -----------------------------------------------------------------------------
# State Tags - Insert the following tags into State noteboxes.
# -----------------------------------------------------------------------------
# <amplify element x: +y%>
# This will increase damage dealt when element x is involved by y%.
#
# <amplify heal: +x%>
# This will increase healing done by x%.
#
# <amplify nonelement: +x%>
# This will increase non-elemental damage dealt by y%.
#
# -----------------------------------------------------------------------------
# Enemy Tags - Insert the following tags into Enemy noteboxes.
# -----------------------------------------------------------------------------
# <amplify element x: +y%>
# This will increase damage dealt when element x is involved by y%.
#
# <amplify heal: +x%>
# This will increase healing done by x%.
#
# <amplify nonelement: +x%>
# This will increase non-elemental damage dealt by y%.
#
#==============================================================================
# Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Note: This script may not work with former Yanfly Engine scripts.
# Use Yanfly Engine 6 scripts to work with this if available.
#==============================================================================
module Y6
module ELEMENT
#--------------------------------------------------------------------------
# - Amplification Settings -
#--------------------------------------------------------------------------
# This section adjusts the multipliers that revolve around amplifying
# elemental damage. By default, with no amplifiers, the modifier is 100.
# Every 1% increase from an amplifier will increase the multiplier by +1
# and every -1% decrease from an amplifier will decrease it by -1. This
# effect is capped as a whole (for all the elements applied).
#--------------------------------------------------------------------------
MAXIMUM_AMPLIFY = 200 # Maximum multiplier of 200%.
MINIMUM_AMPLIFY = 10 # Minimum multiplier of 10%.
end # ELEMENT
end # Y6
#==============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis
# so edit at your own risk.
#==============================================================================
module Y6
module REGEXP
module BASEITEM
ELE_AMP =
/<(?:AMPLIFY_ELEMENT|amplify element|amp)[ ](\d+):[ ]*([\+\-]\d+)([%“])>/i
HEAL_AMP =
/<(?:AMPLIFY_HEAL|amplify heal|amp heal):[ ]*([\+\-]\d+)([%“])>/i
NON_AMP =
/<(?:AMPLIFY_NONELEMENT|amplify nonelement|amp non):[ ]*([\+\-]\d+)([%“])>/i
IGNORE_AMP = /<(?:IGNORE_AMPLIFIERS|ignore amplifiers|ignore amp)>/i
end # BASEITEM
module STATE
ELE_AMP =
/<(?:AMPLIFY_ELEMENT|amplify element|amp)[ ](\d+):[ ]*([\+\-]\d+)([%“])>/i
HEAL_AMP =
/<(?:AMPLIFY_HEAL|amplify heal|amp heal):[ ]*([\+\-]\d+)([%“])>/i
NON_AMP =
/<(?:AMPLIFY_NONELEMENT|amplify nonelement|amp non):[ ]*([\+\-]\d+)([%“])>/i
end # STATE
module ENEMY
ELE_AMP =
/<(?:AMPLIFY_ELEMENT|amplify element|amp)[ ](\d+):[ ]*([\+\-]\d+)([%“])>/i
HEAL_AMP =
/<(?:AMPLIFY_HEAL|amplify heal|amp heal):[ ]*([\+\-]\d+)([%“])>/i
NON_AMP =
/<(?:AMPLIFY_NONELEMENT|amplify nonelement|amp non):[ ]*([\+\-]\d+)([%“])>/i
end # ENEMY
end # REGEXP
end # Y6
#==============================================================================
# ** RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :element_amplify
attr_accessor :heal_amplify
attr_accessor :ignore_amplify
#--------------------------------------------------------------------------
# common cache: y6_cache_baseitem_ea
#--------------------------------------------------------------------------
def y6_cache_baseitem_ea
return if @cached_baseitem_ea
@cached_baseitem_ea = true
#---
@element_amplify = {}
@heal_amplify = 0
@non_amplify = 0
@ignore_amplify = false
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when Y6::REGEXP::BASEITEM::ELE_AMP
@element_amplify[$1.to_i] = $2.to_i
when Y6::REGEXP::BASEITEM::HEAL_AMP
@heal_amplify = $1.to_i
when Y6::REGEXP::BASEITEM::NON_AMP
@element_amplify[0] = $2.to_i
when Y6::REGEXP::BASEITEM::IGNORE_AMP
@ignore_amplify = true
#---
end
} # self.note.split
end # y6_cache_baseitem_ea
end # RPG::BaseItem
#==============================================================================
# ** RPG::State
#==============================================================================
class RPG::State
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :element_amplify
attr_accessor :heal_amplify
#--------------------------------------------------------------------------
# common cache: y6_cache_state_ea
#--------------------------------------------------------------------------
def y6_cache_state_ea
return if @cached_state_ea
@cached_state_ea = true
#---
@element_amplify = {}
@heal_amplify = 0
@non_amplify = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when Y6::REGEXP::STATE::ELE_AMP
@element_amplify[$1.to_i] = $2.to_i
when Y6::REGEXP::STATE::HEAL_AMP
@heal_amplify = $1.to_i
when Y6::REGEXP::STATE::NON_AMP
@element_amplify[0] = $2.to_i
#---
end
} # self.note.split
end # y6_cache_state_ea
end # RPG::State
#==============================================================================
# ** RPG::Enemy
#==============================================================================
class RPG::Enemy
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :element_amplify
attr_accessor :heal_amplify
#--------------------------------------------------------------------------
# common cache: y6_cache_enemy_ea
#--------------------------------------------------------------------------
def y6_cache_enemy_ea
return if @cached_enemy_ea
@cached_enemy_ea = true
#---
@element_amplify = {}
@heal_amplify = 0
@non_amplify = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when Y6::REGEXP::ENEMY::ELE_AMP
@element_amplify[$1.to_i] = $2.to_i
when Y6::REGEXP::ENEMY::HEAL_AMP
@heal_amplify = $1.to_i
when Y6::REGEXP::ENEMY::NON_AMP
@element_amplify[0] = $2.to_i
#---
end
} # self.note.split
end # y6_cache_enemy_ea
end # RPG::State
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# alias method: load_bt_database
#--------------------------------------------------------------------------
alias load_bt_database_ea load_bt_database unless $@
def load_bt_database
load_bt_database_ea
load_ea_cache
end
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
alias load_database_ea load_database unless $@
def load_database
load_database_ea
load_ea_cache
end
#--------------------------------------------------------------------------
# new method: load_ea_cache
#--------------------------------------------------------------------------
def load_ea_cache
groups = [$data_items, $data_skills, $data_weapons, $data_armors,
$data_states, $data_enemies]
for group in groups
for obj in group
next if obj == nil
obj.y6_cache_baseitem_ea if obj.is_a?(RPG::BaseItem)
obj.y6_cache_state_ea if obj.is_a?(RPG::State)
obj.y6_cache_enemy_ea if obj.is_a?(RPG::Enemy)
end
end
end
end # Scene_Title
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# alias method: make_attack_damage_value
#--------------------------------------------------------------------------
alias make_attack_damage_value_ea make_attack_damage_value unless $@
def make_attack_damage_value(attacker)
make_attack_damage_value_ea(attacker)
apply_elemental_amplification(attacker, attacker)
end
#--------------------------------------------------------------------------
# alias method: make_obj_damage_value
#--------------------------------------------------------------------------
alias make_obj_damage_value_ea make_obj_damage_value unless $@
def make_obj_damage_value(user, obj)
make_obj_damage_value_ea(user, obj)
apply_elemental_amplification(user, obj) unless obj.ignore_amplify
end
#--------------------------------------------------------------------------
# new method: apply_elemental_amplification
#--------------------------------------------------------------------------
def apply_elemental_amplification(user, obj)
n = 100
maximum = Y6::ELEMENT::MAXIMUM_AMPLIFY
minimum = Y6::ELEMENT::MINIMUM_AMPLIFY
element_set = obj.element_set
for element_id in element_set
n += user.elemental_amplifier(element_id)
end
if !obj.is_a?(Game_Battler) and obj.base_damage > 0 and element_set == []
n += user.elemental_amplifier(0)
end
n += user.heal_amplifier if !obj.is_a?(Game_Battler) and obj.base_damage < 0
n = [[n, maximum].min, minimum].max
@hp_damage = @hp_damage * n / 100
@mp_damage = @mp_damage * n / 100
end
#--------------------------------------------------------------------------
# new method: elemental_amplifier
#--------------------------------------------------------------------------
def elemental_amplifier(element_id)
n = 0
#---
for state in states
next if state.nil?
next if state.element_amplify[element_id].nil?
n += state.element_amplify[element_id]
end
if actor?
for equip in equips
next if equip.nil?
next if equip.element_amplify[element_id].nil?
n += equip.element_amplify[element_id]
end
else
unless enemy.element_amplify[element_id].nil?
n += enemy.element_amplify[element_id]
end
end
#---
return n
end
#--------------------------------------------------------------------------
# new method: heal_amplifier
#--------------------------------------------------------------------------
def heal_amplifier
n = 0
#---
for state in states
next if state.nil?
n += state.heal_amplify
end
if actor?
for equip in equips
next if equip.nil?
n += equip.heal_amplify
end
else
n += enemy.heal_amplify
end
#---
return n
end
end # Game_Battler
#===============================================================================
#
# END OF FILE
#
#===============================================================================