The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: SoulPour777 on March 02, 2015, 02:12:17 PM

Title: Reverse Damage Effect
Post by: SoulPour777 on March 02, 2015, 02:12:17 PM
Reverse Damage Effect
Version: 1
Author: Soulpour777
Date: March 2, 2015

Description


A script that reverses the attack into recovery instead. When you are being attacked by the enemy, you will be able to nullify the damage and reverse it through the effort of a state.

Features


Instructions

Note Tags:
 
<reverse_effect>
put this on your State Note box to have the reverse effect. The state that has this note tag allows you to reverse the damage.

Script


Code: [Select]
# ============================================================================ #
#                         ◆ Reverse Damage Effect ◆
#                             Author: Soulpour777
# ---------------------------------------------------------------------------- #
# Description: A script that reverses the attack into recovery instead. When
# you are being attacked by the enemy, you will be able to nullify the damage
# and reverse it through the effort of a state.
# ---------------------------------------------------------------------------- #
# Note Tags:
# <reverse_effect>
# ^ put this on your State Note box to have the reverse effect. The state that
# has this note tag allows you to reverse the damage.
# ---------------------------------------------------------------------------- #
# Terms of Use:
# You are free to SHARE and REMIX the script as long as its for a
# Non-Commercial script. If you are going / planning to use it for a commercial
# use, please contact me for more information.
# ============================================================================ #

($imported ||= {})[:soulpour_reverse_damage] = {
  :name => 'Reverse Damage Effect',
  :version => '1.0.0',
  :author => ['Soulpour777'],
  :date => '2015-02-27',
  :id => :soulpour_reverse_damage,
  :enabled => true
}

($imported[:SCRIPT_LIST] ||= []) << $imported[:soulpour_reverse_damage]

module Soul
  module ReverseDamageEffect
    State_RegEx = /<(?:REVERSE_EFFECT|reverse_effect)>/i
    Nullify_HP = 1000
    Nullify_MP = 1000
    Nullify_TP = 100
  end
end

class RPG::State
  #--------------------------------------------------------------------------
  # * Reverse Damage Effect
  #--------------------------------------------------------------------------
  def create_reverse_effect
    @damage_effect = false

    self.note.each_line { |line|
      case line
      when Soul::ReverseDamageEffect::State_RegEx
        @damage_effect = true
        puts @damage_effect
      end
    }
  end
  #--------------------------------------------------------------------------
  # * Reverse Damage?
  #--------------------------------------------------------------------------
  def reverse_dmg?
    create_reverse_effect if @damage_effect == nil
    return @damage_effect
  end
 
end

class Game_ActionResult
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias soul_reverse_dmg_action_result make_damage
  #--------------------------------------------------------------------------
  # * Reversed?
  #--------------------------------------------------------------------------
  def reversed?
    $game_party.members.each do |member|
      member.states.each{ |state| return true if state.reverse_dmg?}
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Create Damage
  #--------------------------------------------------------------------------
  def make_damage(value, item)
    soul_reverse_dmg_action_result(value, item)
    if reversed?
      $game_party.members.each do |member|
        @mp_damage += -Soul::ReverseDamageEffect::Nullify_MP
        @hp_damage += -Soul::ReverseDamageEffect::Nullify_HP
        @tp_damage += -Soul::ReverseDamageEffect::Nullify_TP
      end
    end
  end
end

Credit



Support


Please PM or comment for any questions.

Known Compatibility Issues

N / A

Terms of Use


(https://infinitytears.files.wordpress.com/2014/01/notice-banner.jpg?w=640)
Title: Re: Reverse Damage Effect
Post by: VianoceGames on March 02, 2015, 05:56:54 PM
This is awesome! Reminds me of that one tower in FFVI with the healing jars or w/e they're called. It has been ages since I played that game.
Title: Re: Reverse Damage Effect
Post by: yuyu! on March 02, 2015, 07:10:57 PM
Another great script. Thanks, soulpourr! :D