Últimos temas
» Necesito Charas de Aves para VX
por ChronoTXT Hoy a las 2:17 am

» Ayuda con el temporizador
por navivy Ayer a las 9:44 pm

» Eventos comunes que siga en todo los mapas
por navivy Ayer a las 5:11 pm

» [MV]Butterfly Paradox
por DopellSerch Mar Sep 17, 2019 6:29 am

» INSANE (juego de terror y puzzles)
por GRECO21 Lun Sep 16, 2019 4:25 am

» [Engine Vx Ace] Forzar Cerraduras (Versión 1.3)
por IvalteK_Dev Dom Sep 15, 2019 10:48 pm

» Como cambio esto?...
por Shy_Cream Dom Sep 15, 2019 9:05 pm

» [MV] ¿Cómo mover un sprite?
por DopellSerch Dom Sep 15, 2019 8:14 pm

» Zaza no konpasu (La Brújula de Zaza) [VXACE]
por Pocari Dom Sep 15, 2019 7:17 pm

» Pokemon Destiny
por Xaveguex Dom Sep 15, 2019 7:07 pm

» El Dia Z - Demo
por EdwarPlay Sáb Sep 14, 2019 8:08 pm

» Animación Habilidad de Enemigos RPGMAKER VX ACE
por Metatron Sáb Sep 14, 2019 3:16 am


[VX] Yanfly Custom Dmg Formulas

Ir abajo

[VX] Yanfly Custom Dmg Formulas Empty [VX] Yanfly Custom Dmg Formulas

Mensaje por KRiZaLiD el Miér Mar 27, 2019 3:30 am

Yanfly Engine RD - Custom Dmg Formulas RD

Por fin pude encontrar este script perdido, estaba posteado en el muerto foro VX y su creador no tiene actualizada su página web y tiene links caídos.

¿Para qué sirve este script?
Las fórmulas de daño en el sistema de batalla predeterminado están preestablecidas y, si bien son fáciles de modificar en conjunto, son difíciles de modificar para cada habilidad por separado y es por eso que este script existe. Hay varias formas de usar este script, y cada sección se explica dentro del script.

Código:
#===============================================================================
#
# Yanfly Engine RD - Custom Dmg Formulas RD
# Last Date Updated: 2009.06.10
# Level: Easy, Normal, Hard, Lunatic
#
# The damage formulas in the default battle system are preset and while they're
# easy to modify as a whole, they're difficult to modify for each separate skill
# and that's why this script exists. There's multiple ways to use this script,
# and each section is explained below.
#
#===============================================================================
# Updates:
# ----------------------------------------------------------------------------
# o 2009.06.10 - Compatibility with Enemy Level Control.
# o 2009.04.19 - Compatibility functionality with Custom Element Affinity.
# o 2009.04.18 - Added critical_damage.
#                Improved REGEXP cache.
# o 2009.04.14 - Added common_damage_apply and common_critical.
#                Added <critical x> and <no crit>.
# o 2009.04.12 - Improved note tags.
# o 2009.03.29 - Started script.
#===============================================================================
# How to Use: Easy Mode
#===============================================================================
#
# Modify the module values under Battle, Natk, Skill, and the like to change the
# multipliers related to the field you wish to affect. For instance, changing
# ATK_X from 4 to 6 will make the damage multiplied by 6 instead of 4. Easy.
#
#===============================================================================
# How to Use: Normal Mode
#===============================================================================
#
# Throw these tags into the Notebox for the skills. Each one will have a
# different effect on how the skill operates. The skill's basic functions will
# still be retained such as its default Attack F, Spirit F, variance, etc. The
# order the multipliers will be applied will follow the arithmetic order of
# operations: Multiplication, Division, Addition, Subtraction.
#
# <atk_f x>, <spi_f x>, x = multiplier
# This will overwrite the default Attack F and Spirit F multiplier to whatever
# value you input for x. This function exists in the event that you wish to have
# more than 200 for Attack F or Spirit F.
#
# <def_f x>, <agi_f x>, x = multiplier
# This will create similar multipliers for the Defense and Agility stats if you
# decide to use them in the default skill damage formula. Like the original,
# 100 will be 100% multiplier and 200 will be 200% multiplier.
#
# <hp_hi x>, <hp_lo x>, <mp_hi x>, <mp_lo x> x = multiplier
# HP_Hi and MP_Hi will deal more damage depending on how much HP or MP the user
# has. HP_Lo and MP_Lo will deal more damage depending on how low the HP or MP
# is compared to the max HP or max MP. Multiplier applied like usual. 100:100%
#
# <mul level>, <div level>, <add level> <sub level>
# These do their respective functions of multiplying, dividing, adding, and
# subtracting by the user's level value. There is no modifier for them. If the
# skill is used by a monster, this part of the formula will be ignored.
#
#===============================================================================
# How to Use: Hard Mode
#===============================================================================
#
# Using the variable modifier tags are a little bit different. The amount the
# usual damage is affected is dependent on the value of the variable itself. The
# term variable refers to the variables used in the event editor under Control
# Variables. The order the variable modifiers are applied to the damage formula
# will follow the order of operations: multiplication, division, addition, and
# then subtraction.
#
# <mulvar x>, <divvar x>, <addvar x>, <subvar x>, x = ID of variable
# This will multiply, divide, add, or subtract the damage before variance by the
# variable represented by x. Use Control Variable in the event editor to change
# the value of the variable in question.
#
# <critical x>
# This returns a chance for the skill to issue a critical hit. If this tag
# exists, then it will override the battler's default ability to critically hit.
#
# <no crit>
# This prevents the skill from receiving a critical hit if it's in the notebox.
#
#===============================================================================
#
# Compatibility
# - Works With: Yanfly Engine, Custom Element Affinity
# - Overwrites: Game_Battler, make_attack_damage_value
# - Overwrites: Game_Battler, make_obj_damage_value
# - Overwrites: Game_Battler, calc_hp_recovery
# - Overwrites: Game_Battler, apply_guard
# - Overwrites: Game_Battler, slip_damage_effect
#
#===============================================================================

$imported = {} if $imported == nil
$imported["CustomDmgFormulaRD"] = true

module YE
 
  module BATTLE
   
  #--------------------------------------------------------------------------
  # Modify the values below to adjust the damage formula modifiers to change
  # various battle aspects.
  #--------------------------------------------------------------------------
   
    module NATK # Normal Attacks Default Formula Modifier
      ATK_X = 2        # Multiplier for attacker's power.
      AGI_X = 0        # Multiplier for attacker's agility.
      SPI_X = 0        # Multiplier for attacker's spirit.
      DEF_X = 1        # Multiplier for defender's defense.
      MIN_DMG = 1      # Minimum damage allowed from a normal attack.
      VARYDMG = 10    # Random number applied to normal attacks.
    end # module Normal Attacks
   
    module CRIT
      # This is the damage modifier for critical hit. First, it's multiplied
      # by CRIT_MOD and then divided by CRIT_DIV.
      CRIT_MOD = 300
      CRIT_DIV = 100
     
      # This allows whether criticals will occur for normal attacks and skills.
      # Note that custom skills will need criticals to be applied manually.
      CRIT_NORMAL = true
      CRIT_SKILL  = true
    end
   
    module SKILL # Skill Damage Formula Modifier
      ATK_F = 2    # Caster's Attack F multiplier for skills.
      DEF_F = 2    # Caster's Defense F multiplier for skills.
      SPI_F = 2    # Caster's Spirit F multiplier for skills.
      AGI_F = 2    # Caster's Agility F multiplier for skills.
      ATK_D = 1    # Defender's defense multiplier against Attack.
      DEF_D = 1    # Defender's defense multiplier against Defense.
      SPI_D = 1    # Defender's defense multiplier against Spirit.
      AGI_D = 1    # Defender's defense multiplier against Agility.
    end # module Skills
   
    module OTHER # Other effects
      PHARMACIST  = 2  # If Pharmacist is checked, item effectiveness modifier.
      GUARD_NORMAL = 2  # Normal damage reduction modifier.
      GUARD_SUPER  = 4  # Super damage reduction modifier.
      SLIP_MAXHP_X = 5 # This is the percentage of the max HP for damage dealt.
      SLIP_FIELDMG = 1 # This is how much damage is dealt when on the field.
    end # module Other
   
  end # module BATTLE
 
end # module YE

#===============================================================================
# Lunatic Mode: Advanced Custom Damage Formulas
#===============================================================================
#
# First off, add the <custom x> tag into the skill's notebox. x will be the
# custom damage formula's ID you'll be using. Then, go down in the script below
# and add your damage formulas where you want them done.
#
# Caster          Defender        Description
# -----------------------------------------------------------------------------
# user.hp          self.hp          Brings up the current HP.
# user.maxhp      self.maxhp      Brings up the maximum HP.
# user.mp          self.mp          Brings up the current MP.
# user.maxmp      self.maxmp      Brings up the maximum MP.
# user.atk        self.atk        Brings up the Attack value.
# user.def        self.def        Brings up the Defense value.
# user.spi        self.spi        Brings up the Spirit value.
# user.agi        self.agi        Brings up the Agility value.
# user.hit        self.hit        Brings up the Hit Rate value.
# user.eva        self.eva        Brings up the Evasion value.
# obj.base_damage                  Brings up the Skill's base damage.
# obj.atk_f                        Brings up the Skill's attack modifier.
# obj.spi_f                        Brings up the Skill's spirit modifier.
# obj.variance                      Brings up the Skill's variance value.
#
# user.level      self.level      Brings up the current level. Note that if
#                                  you use this, add "if user.is_a?(Game_Actor)" or
#                                  "if self.is_a?(Game_Actor)" after the formula
#                                  since monsters don't have levels.
#
# Here's the basic math operators involved with custom damage formula creation.
# Note that it still follows the typical order of operations. Multiplication and
# division will occur before addition and subtract. Use parenthesis if you need
# do it the other way around.
#
# Operator    Description
# -----------------------------------------------------------------------------
# **          This returns powering.
# Math.exp(x)  This returns to the e power.
# Math.sqrt(x) This returns a square root.
# *            Multiplication.
# /            Division.
# +            Addition.
# -            Subtraction.
# %            Remainder.
# rand(x)      This returns a random number.
# .floor      Rounds down a variable.
# .ceil        Rounds up a variable.
#
# Reminder!
# Remember to set the damage delivered in the "damage" variable. If you use
# other crap like I do, just keep a "damage = whatever" line near the end of
# your formula in case you're forgetful like me.
#
# "def common_damage_apply" now adjusts all damage one final time for all
# situations. You can alter it however you like to fit in extra damage boosts
# for places you don't want to perform tedious work over.
#
# "def common_critical" also functions similarly to common_damage_apply. For
# this, the ultimate goal is to come up with different ways to turn on @critical
# and return after that.
#
# "def critical_damage" is the portion that affects damage modification for
# every and all critical hits. Adjust as you see fit.
#
#===============================================================================

class Game_Battler
 
  def run_cdf(user, obj, formula)
    @heal_skill = false # Is this a heal skill?
    @ignore_def = false # Ignore defense off.
    @ignore_ele = false # Ignore elements off.
    @ignore_var = false # Ignore variance off.
    @ignore_blk = false # Ignore blocking off.
    @critical  = false # Turns critical hit off.
    hp_dmg = 0
    mp_dmg = 0
    damage = 0
    case formula
   
    #---------------------------------------------------------------------------
    # //////////////////////////////////////////////////////////////////////////
    # This is where you begin adding in your own formulas.
    #---------------------------------------------------------------------------
   
    when 1 # This is custom damage formula number one
      damage = user.level * user.maxhp
      @ignore_def = true
     
    when 2 # This is custom damage formula number two
      damage = user.level * user.maxmp * user.mp
      @ignore_def = true
     
    when 3 # This is custom damage formula number three
      damage = 0
      @ignore_def = true
   
    when 4 # This is custom damage formula number four.
      damage = self.maxhp
      @ignore_def = true
     
    #---------------------------------------------------------------------------
    # This is the part you guys shouldn't touch afterwards.
    # //////////////////////////////////////////////////////////////////////////
    #---------------------------------------------------------------------------
    end
    if @heal_skill == false
      damage = YE::BATTLE::NATK::MIN_DMG if damage < YE::BATTLE::NATK::MIN_DMG
    end
    damage = common_damage_apply(damage)
    unless @ignore_def
      damage -= self.def * YE::BATTLE::SKILL::ATK_D * obj.atk_f / 100
      damage -= self.def * YE::BATTLE::SKILL::DEF_D * obj.def_f / 100
      damage -= self.def * YE::BATTLE::SKILL::SPI_D * obj.spi_f / 100
      damage -= self.def * YE::BATTLE::SKILL::AGI_D * obj.agi_f / 100
    end
    unless @ignore_ele
      if $imported["CustomElementAffinity"]
        damage *= elements_max_rate(obj.element_set, user)
      else
        damage *= elements_max_rate(obj.element_set)
      end
      damage /= 100
    end
    common_critical(user, obj)
    @critical = false if prevent_critical
    @critical = false if obj.no_crit
    if @critical
      damage = critical_damage(damage)
    end
    if @ignore_var == false
      damage = apply_variance(damage, obj.variance)
    end
    if @ignore_blk == false
      damage = apply_guard(damage)
    end
    if obj.damage_to_mp
      @mp_damage = damage
    else
      @hp_damage = damage
    end
    @mp_damage += mp_dmg
    @hp_damage += hp_dmg
  end
 
  #-----------------------------------------------------------------------------
  #-----This is the common damage applying. Allows for additional damage script.
  def common_damage_apply(damage)
    if damage > 0
      # Damaging
    else
      # Healing
    end
    return damage
  end
  #-----------------------------------------------------------------------------
 
  #-----------------------------------------------------------------------------
  #-----This is the common critical applying. Allows for different requirements.
  def common_critical(user, skill = nil)
    if skill == nil
      # Regular Attack
    else
      # Skill Effect
    end
    #---
  end
  #-----------------------------------------------------------------------------
 
  #-----------------------------------------------------------------------------
  #-----This is the damage adjustment for critical hits.
  def critical_damage(damage)
    damage *= YE::BATTLE::CRIT::CRIT_MOD
    damage /= YE::BATTLE::CRIT::CRIT_DIV
    return damage
  end
  #-----------------------------------------------------------------------------
 
end

#===============================================================================
# Don't touch anything past here or else your computer will explode and you will
# be a very sad person.
#===============================================================================

module YE
  module REGEXP
    module BASEITEM
      CUSTOMDMF = /<(?:CUSTOM|custom damage)[ ]*(\d+)>/i
      ATK_F_TAG = /<(?:ATK_F|atk f)[ ]*(\d+)>/i
      DEF_F_TAG = /<(?:DEF_F|def f)[ ]*(\d+)>/i
      SPI_F_TAG = /<(?:SPI_F|spi f)[ ]*(\d+)>/i
      AGI_F_TAG = /<(?:AGI_F|agi f)[ ]*(\d+)>/i
      HP_HI_TAG = /<(?:HP_HI|hp hi)[ ]*(\d+)>/i
      HP_LO_TAG = /<(?:HP_LO|hp lo)[ ]*(\d+)>/i
      MP_HI_TAG = /<(?:MP_HI|mp hi)[ ]*(\d+)>/i
      MP_LO_TAG = /<(?:MP_LO|mp lo)[ ]*(\d+)>/i
      MUL_LEVEL = /<(?:MUL_LEVEL|mul level)>/i
      DIV_LEVEL = /<(?:DIV_LEVEL|div level)>/i
      ADD_LEVEL = /<(?:ADD_LEVEL|add level)>/i
      SUB_LEVEL = /<(?:SUB_LEVEL|sub level)>/i
      MUL_VARIABLE = /<(?:MULVAR|mul var)[ ]*(\d+)>/i
      DIV_VARIABLE = /<(?:DIVVAR|div var)[ ]*(\d+)>/i
      ADD_VARIABLE = /<(?:ADDVAR|add var)[ ]*(\d+)>/i
      SUB_VARIABLE = /<(?:SUBVAR|sub var)[ ]*(\d+)>/i
      NO_CRIT  = /<(?:NO_CRIT|no crit)>/i
      CRITICAL = /<(?:CRITICAL|critical hit)[ ]*(\d+)>/i
    end
  end # module REGEXP
end # module YE

#===============================================================================
# RPG::BaseItem
#===============================================================================

class RPG::BaseItem
 
  #--------------------------------------------------------------------------
  # Yanfly_Cache_CDF
  #--------------------------------------------------------------------------
  def yanfly_cache_cdf
    @acdf = 0; @newatk_f = 0; @def_f = 0; @newspi_f = 0; @agi_f = 0
    @hp_hi = 0; @hp_lo = 0; @mp_hi = 0; @mp_lo = 0; @mul_level = false
    @div_level = false; @add_level = false; @sub_level = false
    @mul_var = 0; @div_var = 0; @add_var = 0; @sub_var = 0
    @no_crit = false; @critical_chance = 0
   
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when YE::REGEXP::BASEITEM::CUSTOMDMF
        @acdf = $1.to_i
       
      when YE::REGEXP::BASEITEM::ATK_F_TAG
        @newatk_f = $1.to_i
      when YE::REGEXP::BASEITEM::DEF_F_TAG
        @def_f = $1.to_i
      when YE::REGEXP::BASEITEM::SPI_F_TAG
        @newspi_f = $1.to_i
      when YE::REGEXP::BASEITEM::AGI_F_TAG
        @agi_f = $1.to_i
         
      when YE::REGEXP::BASEITEM::HP_HI_TAG
        @hp_hi = $1.to_i
      when YE::REGEXP::BASEITEM::HP_LO_TAG
        @hp_lo = $1.to_i
      when YE::REGEXP::BASEITEM::MP_HI_TAG
        @mp_hi = $1.to_i
      when YE::REGEXP::BASEITEM::MP_LO_TAG
        @mp_lo = $1.to_i
       
      when YE::REGEXP::BASEITEM::MUL_LEVEL
        @mul_level = true
      when YE::REGEXP::BASEITEM::DIV_LEVEL
        @div_level = true
      when YE::REGEXP::BASEITEM::ADD_LEVEL
        @add_level = true
      when YE::REGEXP::BASEITEM::SUB_LEVEL
        @sub_level = true
       
      when YE::REGEXP::BASEITEM::MUL_VARIABLE
        @mul_var = $1.to_i
      when YE::REGEXP::BASEITEM::DIV_VARIABLE
        @div_var = $1.to_i
      when YE::REGEXP::BASEITEM::ADD_VARIABLE
        @add_var = $1.to_i
      when YE::REGEXP::BASEITEM::SUB_VARIABLE
        @sub_var = $1.to_i
       
      when YE::REGEXP::BASEITEM::NO_CRIT
        @no_crit = true
      when YE::REGEXP::BASEITEM::CRITICAL
        @critical_chance = $1.to_i
     
      end
    }
  end # end yanfly_cache_cdf
 
  #--------------------------------------------------------------------------
  # Advanced Custom Damage Formula Check
  #--------------------------------------------------------------------------
  def acdf
    yanfly_cache_cdf if @acdf == nil
    return @acdf
  end
 
  #--------------------------------------------------------------------------
  # Attack F, Defense F, Spirit F, and Agility F Values
  #--------------------------------------------------------------------------
  def newatk_f
    yanfly_cache_cdf if @newatk_f == nil
    return @newatk_f
  end
 
  def def_f
    yanfly_cache_cdf if @def_f == nil
    return @def_f
  end
 
  def newspi_f
    yanfly_cache_cdf if @newspi_f == nil
    return @newspi_f
  end
 
  def agi_f
    yanfly_cache_cdf if @agi_f == nil
    return @agi_f
  end
 
  #--------------------------------------------------------------------------
  # HP/MP Hi/Lo F Values
  #--------------------------------------------------------------------------
  def hp_hi
    yanfly_cache_cdf if @hp_hi == nil
    return @hp_hi
  end
 
  def hp_lo
    yanfly_cache_cdf if @hp_lo == nil
    return @hp_lo
  end
 
  def mp_hi
    yanfly_cache_cdf if @mp_hi == nil
    return @mp_hi
  end
 
  def mp_lo
    yanfly_cache_cdf if @mp_lo == nil
    return @mp_lo
  end
 
  #--------------------------------------------------------------------------
  # Level Mod Values
  #--------------------------------------------------------------------------
  def mul_level
    yanfly_cache_cdf if @mul_level == nil
    return @mul_level
  end
 
  def div_level
    yanfly_cache_cdf if @div_level == nil
    return @div_level
  end
 
  def add_level
    yanfly_cache_cdf if @add_level == nil
    return @add_level
  end
 
  def sub_level
    yanfly_cache_cdf if @sub_level == nil
    return @sub_level
  end
 
  #--------------------------------------------------------------------------
  # Modify Variable Checker
  #--------------------------------------------------------------------------
  def mul_variable
    yanfly_cache_cdf if @mul_var == nil
    return @mul_var
  end
 
  def div_variable
    yanfly_cache_cdf if @div_var == nil
    return @div_var
  end
 
  def add_variable
    yanfly_cache_cdf if @add_var == nil
    return @add_var
  end
 
  def sub_variable
    yanfly_cache_cdf if @sub_var == nil
    return @sub_var
  end
 
  #--------------------------------------------------------------------------
  # No Crit
  #--------------------------------------------------------------------------
  def no_crit
    yanfly_cache_cdf if @no_crit == nil
    return @no_crit
  end
 
  #--------------------------------------------------------------------------
  # Critical Hit Chance Skill
  #--------------------------------------------------------------------------
  def critical_chance
    yanfly_cache_cdf if @critical_chance == nil
    return @critical_chance
  end
 
end # end RPG::BaseItem

#===============================================================================
# Game_Battler
#===============================================================================

class Game_Battler
 
  #--------------------------------------------------------------------------
  # make_attack_damage_value
  #--------------------------------------------------------------------------
  def make_attack_damage_value(attacker)
    damage = attacker.atk * YE::BATTLE::NATK::ATK_X
    damage += attacker.spi * YE::BATTLE::NATK::SPI_X
    damage += attacker.agi * YE::BATTLE::NATK::AGI_X
    damage -= self.def * YE::BATTLE::NATK::DEF_X
    damage = YE::BATTLE::NATK::MIN_DMG if damage < YE::BATTLE::NATK::MIN_DMG
    if $imported["CustomElementAffinity"]
      damage *= elements_max_rate(attacker.element_set, attacker)
    else
      damage *= elements_max_rate(attacker.element_set)
    end
    damage /= 100
    damage = common_damage_apply(damage)
    if (damage > 0) and YE::BATTLE::CRIT::CRIT_NORMAL
      @critical = (rand(100) < attacker.cri)
      common_critical(attacker)
      @critical = false if prevent_critical
      if @critical
        damage = critical_damage(damage)
      end
    end
    damage = apply_variance(damage, YE::BATTLE::NATK::VARYDMG)
    damage = apply_guard(damage)
    @hp_damage = damage
  end
 
  #--------------------------------------------------------------------------
  # make_obj_damage_value
  #--------------------------------------------------------------------------
  def make_obj_damage_value(user, obj)
    if obj.acdf > 0
      run_cdf(user, obj, obj.acdf)
    else
      damage = obj.base_damage
      if damage > 0
        #--------------------------------------------------------------------
       
        # Level-based damage
        if obj.mul_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage *= user.level
        end
        if obj.div_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage /= user.level
        end
       
        # Variable Modifiers damage
        if obj.mul_variable > 0
          damage *= $game_variables[obj.mul_variable]
        end
        if obj.div_variable > 0
          damage /= $game_variables[obj.div_variable]
        end
       
        # Check for New Attack F
        if obj.newatk_f > 0
          damage += user.atk * YE::BATTLE::SKILL::ATK_F * obj.newatk_f / 100
          damage -= self.def * YE::BATTLE::SKILL::ATK_D * obj.newatk_f / 100 unless obj.ignore_defense
        else
          damage += user.atk * YE::BATTLE::SKILL::ATK_F * obj.atk_f / 100
          damage -= self.def * YE::BATTLE::SKILL::ATK_D * obj.atk_f / 100 unless obj.ignore_defense
        end
       
        # Check for Defense F
        if obj.def_f > 0
          damage += user.def * YE::BATTLE::SKILL::DEF_F * obj.def_f / 100
          damage -= self.def * YE::BATTLE::SKILL::DEF_D * obj.def_f / 100 unless obj.ignore_defense
        end
       
        # Check for New Spirit F
        if obj.newspi_f > 0
          damage += user.def * YE::BATTLE::SKILL::SPI_F * obj.newspi_f / 100
          damage -= self.def * YE::BATTLE::SKILL::SPI_D * obj.newspi_f / 100 unless obj.ignore_defense
        else
          damage += user.spi * YE::BATTLE::SKILL::SPI_F * obj.spi_f / 100
          damage -= self.spi * YE::BATTLE::SKILL::SPI_D * obj.spi_f / 100 unless obj.ignore_defense
        end
       
        # Check for Agility F
        if obj.agi_f > 0
          damage += user.def * YE::BATTLE::SKILL::AGI_F * obj.agi_f / 100
          damage -= self.def * YE::BATTLE::SKILL::AGI_D * obj.agi_f / 100 unless obj.ignore_defense
        end
       
        # HP-based damage
        damage += user.hp * obj.hp_hi / 100 if obj.hp_hi > 0
        damage += (user.maxhp - user.hp) * obj.hp_lo / 100 if obj.hp_lo > 0
       
        # MP-based damage
        damage += user.mp * obj.mp_hi / 100 if obj.mp_hi > 0
        damage += (user.maxmp - user.mp) * obj.mp_lo / 100 if obj.mp_lo > 0
       
        # Level-based damage
        if obj.add_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage += user.level
        end
        if obj.sub_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage -= user.level
        end
       
        # Variable Modifiers damage
        if obj.add_variable > 0
          damage += $game_variables[obj.add_variable]
        end
        if obj.sub_variable > 0
          damage -= $game_variables[obj.sub_variable]
        end
       
        # Check minimum damage.       
        damage = YE::BATTLE::NATK::MIN_DMG if damage < YE::BATTLE::NATK::MIN_DMG
        #--------------------------------------------------------------------
       
      elsif damage < 0
        #--------------------------------------------------------------------
        # Level-based Healing
        if obj.mul_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage *= user.level
        end
        if obj.div_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage /= user.level
        end
       
        # Variable Modifiers Healing
        if obj.mul_variable > 0
          damage *= $game_variables[obj.mul_variable]
        end
        if obj.div_variable > 0
          damage /= $game_variables[obj.div_variable]
        end
       
        # Check for New Attack F
        if obj.newatk_f > 0
          damage -= user.atk * YE::BATTLE::SKILL::ATK_F * obj.newatk_f / 100
        else
          damage -= user.atk * YE::BATTLE::SKILL::ATK_F * obj.atk_f / 100
        end
       
        # Check for Defense F
        if obj.def_f > 0
          damage -= user.def * YE::BATTLE::SKILL::DEF_F * obj.def_f / 100
        end
       
        # Check for New Spirit F
        if obj.newspi_f > 0
          damage -= user.spi * YE::BATTLE::SKILL::SPI_F * obj.newspi_f / 100
        else
          damage -= user.spi * YE::BATTLE::SKILL::SPI_F * obj.spi_f / 100
        end
       
        # Check for Agility F
        if obj.agi_f > 0
          damage -= user.def * YE::BATTLE::SKILL::AGI_F * obj.agi_f / 100
        end
       
        # HP-based healing
        damage -= user.hp * obj.hp_hi / 100 if obj.hp_hi > 0
        damage -= (user.maxhp - user.hp) * obj.hp_lo / 100 if obj.hp_lo > 0
       
        # MP-based healing
        damage -= user.mp * obj.mp_hi / 100 if obj.mp_hi > 0
        damage -= (user.maxmp - user.mp) * obj.mp_lo / 100 if obj.mp_lo > 0
       
        # Level-based healing
        if obj.add_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage += user.level
        end
        if obj.sub_level and (user.is_a?(Game_Actor) or $imported["EnemyLevelControl"])
          damage -= user.level
        end
       
        # Variable Modifiers healing
        if obj.add_variable > 0
          damage += $game_variables[obj.add_variable]
        end
        if obj.sub_variable > 0
          damage -= $game_variables[obj.sub_variable]
        end
        #--------------------------------------------------------------------
      end
      damage = common_damage_apply(damage)
      if $imported["CustomElementAffinity"]
        damage *= elements_max_rate(obj.element_set, user)
      else
        damage *= elements_max_rate(obj.element_set)
      end
      damage /= 100
      if (damage > 0) and YE::BATTLE::CRIT::CRIT_SKILL
        if obj.critical_chance > 0
          @critical = (rand(100) < obj.critical_chance)
        else
          @critical = (rand(100) < user.cri)
        end
      end
      common_critical(user, obj)
      @critical = false if prevent_critical
      @critical = false if obj.no_crit
      if @critical
        damage *= YE::BATTLE::CRIT::CRIT_MOD
        damage /= YE::BATTLE::CRIT::CRIT_DIV
      end
      damage = apply_variance(damage, obj.variance)
      damage = apply_guard(damage)
      if obj.damage_to_mp 
        @mp_damage = damage
      else
        @hp_damage = damage
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # Calculating HP Recovery Amount From an Item
  #--------------------------------------------------------------------------
  def calc_hp_recovery(user, item)
    result = maxhp * item.hp_recovery_rate / 100 + item.hp_recovery
    result *= YE::BATTLE::OTHER::PHARMACIST if user.pharmacology   
    # Pharmacology doubles the effect
    return result
  end
 
  #--------------------------------------------------------------------------
  # Applying Guard Adjustment
  #    damage : Damage
  #--------------------------------------------------------------------------
  def apply_guard(damage)
    if damage > 0 and guarding?                   
      # Determine if guarding
      damage /= super_guard ? YE::BATTLE::OTHER::GUARD_SUPER : YE::BATTLE::OTHER::GUARD_NORMAL
      # Reduce damage
    end
    return damage
  end
 
  #--------------------------------------------------------------------------
  # Application of Slip Damage Effects
  #--------------------------------------------------------------------------
  if $imported["SlipDamageExtension"] == false
    def slip_damage_effect
      if slip_damage? and @hp > 0
        @hp_damage = apply_variance(maxhp / YE::BATTLE::OTHER::SLIP_MAXHP_X, YE::BATTLE::OTHER::SLIP_FIELDMG)
        @hp_damage = @hp - 1 if @hp_damage >= @hp
        self.hp -= @hp_damage
      end
    end
  end
 
end # Game_Battler

#===============================================================================
#
# END OF FILE
#
#===============================================================================


Créditos para Yanfly
Espero que les sirva a los veteranos como yo que aún usan VX. Aunque lo dudo, creo que soy el único que usa el VX...

En fin, saludos
KRiZ

_________________
Mi Proyecto:
[VX] Yanfly Custom Dmg Formulas VqJJJp

[VX] Yanfly Custom Dmg Formulas AnrEWG[VX] Yanfly Custom Dmg Formulas UqGVnKv

KRiZaLiD apoya:
[VX] Yanfly Custom Dmg Formulas 3gqmui[VX] Yanfly Custom Dmg Formulas GJ7qjn[VX] Yanfly Custom Dmg Formulas ZhwnH1[VX] Yanfly Custom Dmg Formulas NT6Pp7[VX] Yanfly Custom Dmg Formulas WXmSrO[VX] Yanfly Custom Dmg Formulas CKEALv
KRiZaLiD
KRiZaLiD
Moderador
Moderador

Masculino
Chile
RPG Maker : Vx
Mensajes : 856
Monedas : 4331
Reputación : 110
Edad : 34
Localización : Florida (pueblo fantasma), Chile

Volver arriba Ir abajo

[VX] Yanfly Custom Dmg Formulas Empty Re: [VX] Yanfly Custom Dmg Formulas

Mensaje por Muzgar el Miér Mar 27, 2019 6:12 pm

¿VX? ¿Eso se come?

Ahora en serio, muchas gracias por el aporte Kriz, no es fácil encontrar ciertos scripts, sobretodo los que están tan perdidos como este. Pero los de VX.... aún son una tortura mayor (Maldito buscador que si pones Maker VX te busca automáticamente los de Ace)

Muchas gracias por el aporte.

_________________
[VX] Yanfly Custom Dmg Formulas 8jqSjBi
[VX] Yanfly Custom Dmg Formulas A4IkPGg
Apoya wild wars poniendo esta barra en tu firma
[VX] Yanfly Custom Dmg Formulas 6Q3Q0PD

Muzgar apoya a...
Spoiler:
[VX] Yanfly Custom Dmg Formulas PZdiBZY
[VX] Yanfly Custom Dmg Formulas 2d82ir5
Muzgar
Muzgar
Admin
Admin

Rmakercom
RPG Maker : Ace
Mensajes : 1406
Monedas : 1347
Reputación : 181

Volver arriba Ir abajo

Volver arriba


 
Permisos de este foro:
No puedes responder a temas en este foro.