[XP] Spike Damage

Started by G_G, March 21, 2010, 09:01:15 am

Previous topic - Next topic

G_G

March 21, 2010, 09:01:15 am Last Edit: March 21, 2010, 11:19:59 am by Hellfire's G_G
Spike Damage
Authors: game_guy
Version: 1.1
Type: Damage Add-On
Key Term: Battle Add-on



Introduction

Anytime an attacker is inflicted with a "Spike" state and attacks it'll take a part of the damage it dealt to the target. Kind of like in pokemon games.
Example: You set damage rate to 40 percent. Attacker will take 40 percent of the damage dealt to him.


Features


  • Deals some damage to attacker
  • Set how much damage in percent



Screenshots

N/A


Demo

MediaFire


Script

Spoiler: ShowHide

#===============================================================================
# Spike States
# Author game_guy
# Version 1.1
#-------------------------------------------------------------------------------
# Intro:
# Anytime an attacker is inflicted with a "Spike" state and attacks it'll take
# a part of the damage it dealt to the target. Kind of like in pokemon games.
#
# Features:
# Deals some damage to attacker
# Set how much damage in percent
# Different percents for different states
#
# Instructions:
# SpikeStates ~ Add any state ID that will be considered a Spike state.
# DmgPercent ~ Any number. It'll the damage dealt to the target, and get the
#              percent and deal it back to the attacker.
#
# Credits:
# game_guy ~ For making it
# Pokemon ~ For inspiring me to make it/the idea
#===============================================================================
module GameGuy
  SpikeStates = [17, 18]
  DmgPercent = 40
  def self.statesdmg(id)
    case id
    # Setup State Damage
    #===================================
    # Use
    # when state_id then return percent_damage
    # when 17 then return 40
    #===================================
    when 17 then return 40
    when 18 then return 20
    end
    return 0
  end
end
class Game_Battler
  alias gg_spike_attack_effect_lat attack_effect
  def attack_effect(attacker)
    temphp = self.hp
    result = gg_spike_attack_effect_lat(attacker)
    state = 0
    GameGuy::SpikeStates.any? {|i|
    if attacker.states.include?(i)
      state = i
    end}
    if GameGuy::SpikeStates.any? {|i| attacker.states.include?(i)} && result
      temphp -= self.hp
      dmg = temphp.to_f / 100 * GameGuy.statesdmg(state)
      dmg = dmg.floor
      attacker.hp -= dmg
    end
  end
end



Instructions

In the script.


Compatibility

Not tested with SDK.
Tested with Blizz-Abs/Side View Battle System


Credits and Thanks


  • game_guy ~ For making it
  • Pokemon ~ For inspiring me to make it/the idea



Author's Notes

Enjoy!

Sase

If you use a negative value it will heal the attacker instead?

(Hexamin)

Any way you can make this as a reversal?  I.E., if the player has the status, then anyone that attacks the attacker gets damaged?

Oh, and, I think it'd be a quick edit, but allowing each state to have its own damage?  State 1: 40%, State 2: 30%, etc., using whatever the user defines.

Then again, I could throw in a quick fix to implement that... using...


dmg = temphp.to_f / (GameGuy::DmgPercent * i * 5)


and setting DmgPercent to 1.  I believe that'd make it so state 1 would have a 5%, state 2 10%, state 3 15%, etc., etc., but there's probably an easier configuration of it anyway.


Good script though.  ^_^
Max 1111101000; characters remaining: 1110111000

Aqua

Ahahahaha...
I was looking for something like this a long time ago XP

G_G

Updated. You can set the damage percent to multiple states now.

(Hexamin)

awww, i love you! <3 *lvlup*
Max 1111101000; characters remaining: 1110111000

AresWarrior

This a great script! I have one question though. You say this works if the actor has the state inflicted. Well if I wanted to make a skill do this, how would I make it so that the skill adds the state to the actor? btw, the Demo link isn't working for me.

G_G

You can do this in the database. Go to the Skills tab. Then select the skill and go to the right side where it says State Change. Check the box next to the Spike state and make sure its a + sign in the box.

AresWarrior

but doesnt that make the enemy have the state and not the actor using it?

G_G

Change the target of the skill to the actor. But why would you want the Actor taking damage on purpose?

Starrodkirby86

Like in Pokemon: Double-Edge, Take Down, etc.

High power-moves with a catch. I don't see any problem in that...? There's many good reasons...

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




G_G

Oh I see now xD I was just kind of confused.

djskagnetti

Hi, great script as always.
I'm making a spell called Masochist that uses your Spike Damage, when cast on an enemy it does damage equal to percentage specified to the enemy when it attacks with a basic physical attack.
As a test I put the percentage of damage at 5000%.  It works, and testing it out on some enemies that do a few hundred physical damage with about 500 hps, as expected it kills them when they hit the character.
But - the enemy dies first, and then the animation and attack damage are shown on the character.  So it's like - enemy turns into red vapor and disappears (death), then sword strike animation and damage dealt to character it was attacking.
Is there a way to make it so it does the attack animation and damage dealt to the character the monster is attacking first, and then the damage % from the Spike Damage spell is done to the monster?

Also, is there a way to show the damage on the monster the spell inflicts?
Thanks!