Started by MarkHest, November 03, 2013, 06:18:23 pm
#===============================================================================# HP/SP Reversal# Author gameus# Version 1.0#-------------------------------------------------------------------------------# Intro:# Uses skills to take SP and convert it to HP or vica versa. The way it's setup# is if the target is hit with one of these skills, it takes their HP/SP and# turns it into the other stat. The skill itself doesn't affect the caster# itself other than taking SP from the skill cost.## Features:# Use a fixed rate or a percentage# Skills can work on enemies or allies# Easy Setup## Setting Up:# To define a skill as HP to SP, add the id to the HP2SP array.# Do the same for SP to HP skills, except add it to SP2HP array.# To define the skills rate as "fixed" or "percentage", just set the skill# to the desired rate in the config below. (Examples are provided)## To define the amount of HP or SP to convert, all you do is go into the# database and set the skill's "Power" attribute. e.g.# If you have a skill that converts 100 HP to SP, make sure it's setup in the# config:# HP2SP = {# skill_id => :fixed,# }# Then you go to the database and set teh power to 100. If it's a percentage,# You just set the power to the percentage you want. e.g. 25% is 25 power.## It is not possible to kill the target by converting HP to SP, but you can# deplete all of the SP converting it to HP## Compatibility:# Not tested with SDK# Not tested with any other skill add-ons but it should work## Credits:# gameus ~ creating it# Mark Hest ~ Requesting it#===============================================================================module HPSP # These are skills that convert HP to SP HP2SP = { 59 => :fixed, 60 => :percent, } # These are skills that convert SP to HP SP2HP = { 57 => :fixed, 58 => :percent, } # Ignore everything below. def self.has?(skill_id) return (HP2SP.include?(skill_id) || SP2HP.include?(skill_id)) end def self.type(skill_id) return nil if !self.has?(skill_id) return :hp if HP2SP.include?(skill_id) return :sp if SP2HP.include?(skill_id) endendclass Game_Battler alias gg_convert_hpmp_skill_effect_lat skill_effect def skill_effect(user, skill) if HPSP.has?(skill.id) type = HPSP.type(skill.id) rate = type == :hp ? HPSP::HP2SP[skill.id] : HPSP::SP2HP[skill.id] amount = rate == :fixed ? skill.power : (skill.power * 0.01) if type == :hp && self.hp > 1 amount = (rate == :fixed ? [self.hp - 1, amount].min : self.hp * amount).ceil self.hp -= amount.to_i self.sp += amount.to_i self.damage = "-#{amount} +#{amount}" elsif type == :sp && self.sp > 0 amount = (rate == :fixed ? [self.sp, amount].min : self.sp * amount).ceil self.hp += amount.to_i self.sp -= amount.to_i self.damage = "+#{amount} -#{amount}" else return false end return true end return gg_convert_hpmp_skill_effect_lat(user, skill) endend
Quote from: Some guy on FacebookLife is like a penis. It's short but it feels so long when it gets hard.
Quote from: Steven WinterburnBefore you diagnose yourself with depression or low self-esteem, first make sure that you are not, in fact, just surrounded by assholes.