Main Menu
  • Welcome to The RPG Maker Resource Kit.

Improved Damage

Started by Lecode, December 12, 2010, 02:46:34 PM

0 Members and 1 Guest are viewing this topic.

Lecode

Improved Damage
Version: 1.5
Author: Lecode
Date: November 30, 2010
Above all
I do not speak English.Sorry

Version History




  • <Version 1.0>- Creation damage effect
  • <Version 1.5>- Correct a damage effect

Description



This script will change the damage received on a target that has a specific state.See instruction for exemple =)

Features


  • The damage effect are: Demi_damage,Quart_damage,vulne_damage,invulne_damage and gourman_damage

Screenshots



Instructions

Place the following code in the box score of a state:


<demi_damage>
When the target has this condition, the damage it receives is divided by 2.

<quart_damage>
When the target has this condition, the damage it receives is divided by 3.

<vulne_damage>
When the target has this condition, it becomes vulnerable and the damage it receives is multiplied by 2.

<invulne_damage>
When the target has this condition, it becomes invulnerable and the damage it receives is 0.

<gourman_damage>
When the target has this state, once it gets damage, the user absorbed the damage.

For exemple:
A skill deal normaly 50 damage.When the actor have the stat with <demi_damage>,he received 25 damage.
See the Demo for more exemple.

Script



=================================
###Improved Damage
#By Lecode or Lecode234(French forum)
#Novembre 30 2010
#Translate instruction to English
#=================================
=begin
Place the following code in the box score of a state:


<demi_damage>
When the target has this condition, the damage it receives is divided by 2.

<quart_damage>
When the target has this condition, the damage it receives is divided by 3.

<vulne_damage>
When the target has this condition, it becomes vulnerable and the damage it receives is multiplied by 2.

<invulne_damage>
When the target has this condition, it becomes invulnerable and the damage it receives is 0.

<gourman_damage>
When the target has this state, once it gets damage, the user absorbed the damage.
=end
#==========================================================================

$imported = {} if $imported == nil
$imported["Advanced damage"] = true

module Lecode_Demi_DAMAGE
  module DemiDamage
    module Regexp
      module State
        DEMI_DAMAGE = /<(?:DEMI_DAMAGE|demi_damage)>/i
          QUART_DAMAGE = /<(?:QUART_DAMAGE|quart_damage)>/i
          VULNE_DAMAGE = /<(?:VULNE_DAMAGE|vulne_damage)>/i
          INVULNE_DAMAGE = /<(?:INVULNE_DAMAGE|invulne_damage)>/i
           GOURMAN_DAMAGE = /<(?:GOURMAN_DAMAGE|gourman_damage)>/i
      end
    end
  end
end

#====================================================
class RPG::State
  #--------------------------------------------------------------------------
  # cache DEMI_DAMAGE
  #--------------------------------------------------------------------------
  def create_DEMI_DAMAGE_cache
    @DEMI_DAMAGE = false

    self.note.each_line { |line|
      case line
      when Lecode_Demi_DAMAGE::DemiDamage::Regexp::State::DEMI_DAMAGE
        @DEMI_DAMAGE = true
      end
    }
  end
    #--------------------------------------------------------------------------
  # cache QUART_DAMAGE
  #--------------------------------------------------------------------------
  def create_QUART_DAMAGE_cache
    @QUART_DAMAGE = false

    self.note.each_line { |line|
      case line
      when Lecode_Demi_DAMAGE::DemiDamage::Regexp::State::QUART_DAMAGE 
        @QUART_DAMAGE = true
      end
    }
  end
   #--------------------------------------------------------------------------
  # cache VULNE_DAMAGE
  #--------------------------------------------------------------------------
  def create_VULNE_DAMAGE_cache
    @VULNE_DAMAGE = false

    self.note.each_line { |line|
      case line
      when Lecode_Demi_DAMAGE::DemiDamage::Regexp::State::VULNE_DAMAGE
        @VULNE_DAMAGE = true
      end
    }
end
  #--------------------------------------------------------------------------
  # cache INVULNE_DAMAGE
  #--------------------------------------------------------------------------
  def create_INVULNE_DAMAGE_cache
    @INVULNE_DAMAGE = false

    self.note.each_line { |line|
      case line
      when Lecode_Demi_DAMAGE::DemiDamage::Regexp::State::INVULNE_DAMAGE 
        @INVULNE_DAMAGE = true
      end
    }
  end
   #--------------------------------------------------------------------------
  # cache GOURMAN_DAMAGE
  #--------------------------------------------------------------------------
  def create_GOURMAN_DAMAGE_cache
    @GOURMAN_DAMAGE = false

    self.note.each_line { |line|
      case line
      when Lecode_Demi_DAMAGE::DemiDamage::Regexp::State::GOURMAN_DAMAGE 
        @GOURMAN_DAMAGE = true
      end
    }
  end
  ######################################################################
  #####################################################################
  #--------------------------------------------------------------------------
  # Si DEMI_DAMAGE
  #--------------------------------------------------------------------------
  def DEMI_DAMAGE?
    create_DEMI_DAMAGE_cache if @DEMI_DAMAGE == nil
    return @DEMI_DAMAGE
  end
  #--------------------------------------------------------------------------
  # Si QUART_DAMAGE
  #--------------------------------------------------------------------------
  def QUART_DAMAGE?
    create_QUART_DAMAGE_cache if @QUART_DAMAGE == nil
    return @QUART_DAMAGE
  end
  #--------------------------------------------------------------------------
  # Si VULNE_DAMAGE
  #--------------------------------------------------------------------------
  def VULNE_DAMAGE?
    create_VULNE_DAMAGE_cache if @VULNE_DAMAGE == nil
    return @VULNE_DAMAGE
  end
#--------------------------------------------------------------------------
  # Si INVLUNE_DAMAGE
  #--------------------------------------------------------------------------
  def INVULNE_DAMAGE?
    create_INVULNE_DAMAGE_cache if @INVULNE_DAMAGE == nil
    return @INVULNE_DAMAGE
  end
  #--------------------------------------------------------------------------
  # Si INVLUNE_DAMAGE
  #--------------------------------------------------------------------------
  def GOURMAN_DAMAGE?
    create_GOURMAN_DAMAGE_cache if @GOURMAN_DAMAGE == nil
    return @GOURMAN_DAMAGE
  end
end

#--------------------------------------------------------------------------


#=========================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # Si DEMI_DAMAGE est appliquer dans un etat
  #--------------------------------------------------------------------------
  def DEMI_DAMAGE?
    self.states.each { |state|
      return true if state.DEMI_DAMAGE?
    }
    return false
  end
  #--------------------------------------------------------------------------
  # Si QUART_DAMAGE est appliquer dans un etat
  #--------------------------------------------------------------------------
  def QUART_DAMAGE?
    self.states.each { |state|
      return true if state.QUART_DAMAGE?
    }
    return false
  end
   #--------------------------------------------------------------------------
  # Si VULNE_DAMAGE est appliquer dans un etat
  #--------------------------------------------------------------------------
  def VULNE_DAMAGE?
    self.states.each { |state|
      return true if state.VULNE_DAMAGE?
    }
    return false
  end
   #--------------------------------------------------------------------------
  # Si INVULNE_DAMAGE est appliquer dans un etat
  #--------------------------------------------------------------------------
  def INVULNE_DAMAGE?
    self.states.each { |state|
      return true if state.INVULNE_DAMAGE?
    }
    return false
  end
    #--------------------------------------------------------------------------
  # Si GOURMAN_DAMAGE est appliquer dans un etat
  #--------------------------------------------------------------------------
  def GOURMAN_DAMAGE?
    self.states.each { |state|
      return true if state.GOURMAN_DAMAGE?
    }
    return false
  end
  #--------------------------------------------------------------------------
  # Execute les degats en fonction des condition
  #     user : The user of the damaging command
  #    @hp_damage, @mp_damage, @absorbed
  #--------------------------------------------------------------------------
  alias execute_damage_Lecode_Demi_DAMAGE_DemiDamage execute_damage
  def execute_damage(user)
    if DEMI_DAMAGE?
      @hp_damage = @hp_damage / 2
      @mp_damage = @mp_damage / 2
    end
   
      if QUART_DAMAGE?
      @hp_damage = @hp_damage / 3
      @mp_damage = @mp_damage / 3
    end
   
      if VULNE_DAMAGE?
       
        if @hp_damage < 0 #Verifit si les degats son negatif (soin)
            @hp_damage = @hp_damage #les degats ne sont pas doublé
            else
      @hp_damage = @hp_damage * 2
      @mp_damage = @mp_damage
    end
   
    end
   
     if INVULNE_DAMAGE?
      @hp_damage = 0
      @mp_damage = 0
    end
   
    if GOURMAN_DAMAGE?
     @absorbed = @hp_damage * 2
    end
   
    # Run original process
    execute_damage_Lecode_Demi_DAMAGE_DemiDamage(user)
  end
end



Credit




  • Lecode(or Lecode234)

Thanks


  • Tomy(KGC)
  • Yerd(Yanfly)

Support



Post here.

Known Compatibility Issues

Compatible with any type of battle!

Demo



See below

Author's Notes



You can create your condition has effect.
Just search the script.
You will soon understand the system.

Restrictions

Non-commercial games script!

modern algebra


Lecode