The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: Ahnez67 on July 07, 2011, 09:01:55 PM

Title: Damage Cap and Damage Multiplier
Post by: Ahnez67 on July 07, 2011, 09:01:55 PM
Damage Cap / Damage Multiplier
Version: 1.0b
Author: Ahnez67
Date: 07.7.2011

Version History



Planned Future Versions


Description


(Damage Cap)

 This script allows you to set the max damage that one attack can cause.
 This works much like Final Fantasy, where attacks can't deal more than 9,999 damage.
 
 V1.0b

 Now, enemies and actors have separated Damage Caps.
Ex: You can make your party deal 99,999 damage, while enemies can't cause more than 9,999 damage.


(Skill Damage Formula)

 You can change the damage formula for Skills.
 Basically, it changes the "Attack F" and "Skill F" Formula.
 By default, Attack/Skill F works as multipliers based on character's Strength and Spirit.
 You can change the formula multiplier with the NEWATKF and NEWSKLF
 The formula works like this:
 -> Attack F divided by NEWATKF = Attack multiplier.
 -> Skill F divided by NEWSKLF = Attack multiplier.
 (And Sadly, Attack F and Skill F can't surpass 200...)

 Example:
 
 An skill has 100 Attack F and 200 Skill F
 The NEWATKF is 100 and NEWSKLF is 100
 
 Then, it will cause this damage:

 Attack F divided by NEWATKF => 100 / 100 = 1
 Skill F divided by NEWSKLF => 200 / 100 = 2

 Then, the skill attack power will be 1 Time the actor's Strength plus 2 times the actor's Spirit

Features


Screenshots

Not really applicable

Instructions

Place the Script above Main, but below the default Scripts
 Change the Damage Cap and the Enemy Damage Cap
 
 You can change the Damage Caps with this Script Call:

 DAMAGECAP::ABSCAP::DAMAGE_CAP = new damage cap
 DAMAGECAP::ABSCAP::ENEMYCAP = new enemies' Damage Cap

 And you can change the NEWATKF and NEWSKLF with this Script Calls:

 DAMAGECAP::ABSCAP::NEWATKF = new NEWATKF
 DAMAGECAP::ABSCAP::NEWSKLF = new NEWSKLF

Script


Code: [Select]
#------------------------------------------------------------------
#-----------------------AHNEZ67 DAMAGE CAP-------------------------
#-----------------------AHNEZ67 SKILL DMG FORMULA------------------
#------------------------------------------------------------------
#------------------------------------------------------------------
#-----Description (Damage Cap)-------------------------------------
#
# This script allows you to set the max damage that one attack can cause.
# This works much like Final Fantasy, where attacks can't deal more than 9,999
#damage.
#
# NEW: V1,0b
# You can set a Damage Cap for actors and a diferent Damage Cap for Enemies
#
#
#
#-----Description (Skill Damage Formula)
#
# You can change the damage formula for Skills.
# Basically, it changes the "Attack F" and "Skill F" Formula.
# By default, Attack/Skill F works as multipliers based on character's Strength
#and Spirit.
# You can change the formula multiplier with the NEWATKF and NEWSKLF
# The formula works like this:
# -> Attack F divided by NEWATKF = Attack multiplier.
# -> Skill F divided by NEWSKLF = Attack multiplier.
#
# Example:
#
# An skill has 100 Attack F and 200 Skill F
# The NEWATKF is 100 and NEWSKLF is 100
#
# Then, it will cause this damage:
#
# Attack F divided by NEWATKF => 100 / 100 = 1
# Skill F divided by NEWSKLF => 200 / 100 = 2
#
# Then, the skill attack power will be 1 Time the actor's Strength plus 2 times
#the actor's Spirit
#
# Sadly, Attack F and Skill F can't surpass 200...
#
#-----Instructions-------------------------------------------------
#
# Place the Script above Main, but below the default Scripts
# Change the Damage Cap
#
# You can change the Damage Cap with this Script Call:
#
# DAMAGECAP::ABSCAP::DAMAGE_CAP = new damage cap
# DAMAGECAP::ABSCAP::ENEMYCAP = new enemies' Damage Cap
#
# And you can change the NEWATKF and NEWSKLF with this Script Calls:
#
# DAMAGECAP::ABSCAP::NEWATKF = new NEWATKF
# DAMAGECAP::ABSCAP::NEWSKLF = new NEWSKLF
#
#


#CONFIGURATION \/ \/

module DAMAGECAP
  module ABSCAP
    DAMAGE_CAP = 9999 #Damage cap
    ENEMYCAP = 9999 #Damage cap for Enemies
    NEWATKF = 100 # Attack F multiplier
    NEWSKLF = 100 # Skill F multiplier
  end
end
#END OF THE CONFIGURATION /\ /\

class Game_battler
  def make_attack_damage_value(attacker)
    damage = attacker.atk * 4 - self.def * 2     
    damage = 0 if damage < 0                     
    damage *= elements_max_rate(attacker.element_set)
    damage /= 100
    if damage == 0                             
      damage = rand(2)                   
    elsif damage > 0                       
      @critical = (rand(100) < attacker.cri)     
      @critical = false if prevent_critical         
      damage *= 3 if @critical                   
    end
    damage = apply_variance(damage, 20)         
    damage = apply_guard(damage)                   
    damage = DAMAGECAP::ABSCAP::DAMAGE_CAP if damage > DAMAGECAP::ABSCAP::DAMAGE_CAP
    @hp_damage = damage                           
  end

  def make_obj_damage_value(user, obj)
    damage = obj.base_damage                     
    if damage > 0                               
      damage += user.atk * 4 * obj.atk_f / DAMAGECAP::ABSCAP::NEWATKF   
      damage += user.spi * 2 * obj.spi_f / DAMAGECAP::ABSCAP::NEWSKLF     
      unless obj.ignore_defense                   
        damage -= self.def * 2 * obj.atk_f / DAMAGECAP::ABSCAP::NEWATKF   
        damage -= self.spi * 1 * obj.spi_f / DAMAGECAP::ABSCAP::NEWSKLF   
      end
      damage = 0 if damage < 0                   
    elsif damage < 0                             
      damage -= user.atk * 4 * obj.atk_f / DAMAGECAP::ABSCAP::NEWATKF     
      damage -= user.spi * 2 * obj.spi_f / DAMAGECAP::ABSCAP::NEWSKLF     
    end
    damage *= elements_max_rate(obj.element_set)   
    damage /= 100
    damage = apply_variance(damage, obj.variance)   
    damage = apply_guard(damage)                   
    if obj.damage_to_mp 
      damage = DAMAGECAP::ABSCAP::DAMAGE_CAP if damage > DAMAGECAP::ABSCAP::DAMAGE_CAP
      @mp_damage = damage                           
    else
       damage = Damagecap::ABSCAP::MAXDMGCP if damage > Damagecap::ABSCAP::MAXDMGCP and user.is_a?(Game_Actor)
      damage = Damagecap::ABSCAP::ENEMYCAP if damage > Damagecap::ABSCAP::ENEMYCAP and user.is_a?(Game_Enemy)
      @hp_damage = damage                     
    end
  end
end

Credit




Support


Post here if you encounter any problem with this script

Known Compatibility Issues

None know. Can be uncompatible with other custom damage formulas

Demo


There's no Demo version of this Script. It's not really necessary for such simple Script.

---------------------------------------------------------------------------------------
No credits needed. But it was made by me.
Commercial and non-Commercial games are all the same for me. You are free to use and edit it as you wish
Title: Re: Damage Cap and Damage Multiplier
Post by: digdarkevil on November 06, 2011, 11:21:00 PM
Sounds interesting, il give it a try
 ;8
Title: Re: Damage Cap and Damage Multiplier
Post by: Ahnez67 on November 09, 2011, 04:19:01 PM
Version 1.0b

*You can set two different Damage Caps. One for Actors, and one for Enemies.