module YEAExtraFormulas
ACTOR_FORMULAS = {
#==============================================================================
# ** EDITABLE REGION BELOW
#------------------------------------------------------------------------------
# Change the values in the area below to suit your needs.
#==============================================================================
=begin
Set up your actors below here, like so:
ACTOR_ID => {
:hit_n_value => "n_value_formula_goes_here",
:hit_formula => "formula_goes_here",
},
You can overwrite any of the xparam n_value or formulas set in the original
Yanfly script. Just include the ones you want to change.
=end
# ACTOR_ID => {
1 => { # Martial artist (change the number to the correct actor ID)
:hit_n_value => "(atk + agi) * (2 + $game_variables[1])",
:eva_n_value => "(agi + luk) * (2 + $game_variables[2])",
:cri_n_value => "luk + $game_variables[3]",
:cev_n_value => "agi + luk + $game_variables[4]",
:mev_n_value => "(mdf + luk) * (2 + $game_variables[5])",
:cnt_formula => "base_cnt + $game_variables[6]",
:tgr_formula => "base_tgr - $game_variables[7]",
:grd_formula => "base_grd + $game_variables[5]",
:pha_formula => "base_pha + $game_variables[8]",
:tcr_formula => "base_tcr + $game_variables[9]",
:pdr_formula => "base_pdr - $game_variables[10] - (n / (256.0 + n)) * 0.500 - 0.000",
:mdr_formula => "base_mdr - $game_variables[11] - (n / (256.0 + n)) * 0.500 - 0.000",
:fdr_formula => "base_fdr - $game_variables[12]",
:exr_formula => "base_exr + $game_variables[13]",
},
# ACTOR_ID => {
2 => { # Kid 1 (change the number to the correct actor ID)
:hit_n_value => "(atk + agi) / (2 + $game_variables[14])",
:eva_n_value => "(agi + luk) / (2 + $game_variables[15])",
:cri_n_value => "luk - $game_variables[16]",
:cev_n_value => "agi * 0.75 + luk * 0.25 - $game_variables[17]",
:mev_n_value => "(mdf + luk) / (2 + $game_variables[18])",
:mrf_formula => "base_mrf + $game_variables[19]",
:tgr_formula => "base_tgr + $game_variables[20]",
:grd_formula => "base_grd - $game_variables[21]",
:rec_formula => "base_rec - $game_variables[22]",
:mcr_formula => "base_mcr - $game_variables[23]",
:pdr_formula => "base_pdr + $game_variables[24] - (n / (256.0 + n)) * 0.500 - 0.000",
:mdr_formula => "base_mdr - $game_variables[25] - (n / (256.0 + n)) * 0.500 - 0.000",
:fdr_formula => "base_fdr + $game_variables[26]",
},
# PASTE EXTRA CHARACTERS ABOVE HERE ^ ^ ^
=begin
COPY AND PASTE THIS AS NEEDED:
# ACTOR_ID => {
3 => { # < change the number to the ID of the correct actor
:hit_n_value => "(atk + agi) / (2 + $game_variables[14])",
},
=end
#==============================================================================
# ** END OF EDITABLE REGION
#------------------------------------------------------------------------------
# Please do not edit below this point unless you know what you are doing.
#==============================================================================
}
end
class Game_BattlerBase
include YEAExtraFormulas
def has_custom_formula?(xparam)
return false unless actor? && ACTOR_FORMULAS.key?(@actor_id)
return ACTOR_FORMULAS[@actor_id].key?(:"#{xparam}_formula")
end
def has_custom_n_value?(xparam)
return false unless actor? && ACTOR_FORMULAS.key?(@actor_id)
return ACTOR_FORMULAS[@actor_id].key?(:"#{xparam}_n_value")
end
end
class Game_BattlerBase
xprms = ["hit", "eva", "cri", "cev", "mev", "mrf", "cnt", "hrg", "mrg", "trg", "tgr",
"grd", "rec", "pha", "mcr", "tcr", "pdr", "mdr", "fdr", "exr"]
xprms.each { |xprm|
module_eval(%Q(
alias amn_yea_gamebatbase_#{xprm} #{xprm}
def #{xprm}
base_#{xprm} = game_battlerbase_#{xprm}_epf
return amn_yea_gamebatbase_#{xprm} unless actor? && ACTOR_FORMULAS.key?(@actor_id)
n = eval((ACTOR_FORMULAS[@actor_id].key?(:#{xprm}_n_value) ? ACTOR_FORMULAS[@actor_id] : YEA::XPARAM::FORMULA)[:#{xprm}_n_value])
return eval((ACTOR_FORMULAS[@actor_id].key?(:#{xprm}_formula) ? ACTOR_FORMULAS[@actor_id] : YEA::XPARAM::FORMULA)[:#{xprm}_formula])
end
))
}
end