Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- #** Quasi Fixed Passive Skills v 1.00
- #==============================================================================
- # Allows Passive Skills to give a fixed value to params.
- # SParams and XParams, are not included.
- #==============================================================================
- # Instructions:
- # Use the Skill Note Tag. Tag is not case sensative, but it is space sensative!
- #
- #------------------------------------------------------------------------------
- # * Skill Note Tag
- #------------------------------------------------------------------------------
- # <fixed_passive>
- # param value
- # </fixed_passive>
- # param can be: MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
- # values can be set to a fixed number or a percent with a % sign
- #
- # * Example
- # <fixed_passive>
- # MHP 50%
- # ATK 1000
- # </fixed_passive>
- #
- # This skill will add 50 percent hp and it will add 1000 atk.
- #
- #==============================================================================#
- # By Quasi (http://quasixi.wordpress.com/)
- # - 3/26/14
- #==============================================================================#
- # ** Stop! Do not edit anything below, unless you know what you **
- # ** are doing! **
- #==============================================================================#
- $imported = {} if $imported.nil?
- $imported["Quasi_Fixed_Passive"] = 1.00
- module Quasi
- def self.param_id(string)
- case string.downcase
- when "mhp"
- 0
- when "mmp"
- 1
- when "atk"
- 2
- when "def"
- 3
- when "mat"
- 4
- when "mdf"
- 5
- when "agi"
- 6
- when "luk"
- 7
- end
- end
- end
- #==============================================================================
- # ** Game_BattlerBase
- #------------------------------------------------------------------------------
- # This base class handles battlers. It mainly contains methods for calculating
- # parameters. It is used as a super class of the Game_Battler class.
- #==============================================================================
- class Game_BattlerBase
- alias quasi_passive_init initialize
- #--------------------------------------------------------------------------
- # * ALIAS Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- quasi_passive_init
- clear_passive_plus
- end
- #--------------------------------------------------------------------------
- # * OVERWRITE Get Parameter
- #--------------------------------------------------------------------------
- def param(param_id)
- value = param_base(param_id) + param_plus(param_id)
- value += @passive_param[param_id]
- value *= @passive_per[param_id]
- value *= param_rate(param_id) * param_buff_rate(param_id)
- [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
- end
- #--------------------------------------------------------------------------
- # * NEW Clear Values Added to Parameter
- #--------------------------------------------------------------------------
- def clear_passive_plus
- @passive_param = [0] * 8
- @passive_per = [1] * 8
- end
- #--------------------------------------------------------------------------
- # * NEW Runs passive
- #--------------------------------------------------------------------------
- def fixed_passive(type, param_id, value, percent)
- case type
- when :param
- @passive_param[param_id] += value if !percent
- @passive_per[param_id] += value/100.0 if percent
- end
- refresh
- end
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It is used within the Game_Actors class
- # ($game_actors) and is also referenced from the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- alias quasi_passive_learn learn_skill
- alias quasi_passive_forget forget_skill
- #--------------------------------------------------------------------------
- # * Learn Skill
- #--------------------------------------------------------------------------
- def learn_skill(skill_id)
- add_fixed_passive(skill_id)
- quasi_passive_learn(skill_id)
- end
- #--------------------------------------------------------------------------
- # * Forget Skill
- # remove passive needs to be above the alias!
- #--------------------------------------------------------------------------
- def forget_skill(skill_id)
- remove_fixed_passive(skill_id)
- quasi_passive_forget(skill_id)
- end
- #--------------------------------------------------------------------------
- # * Add Passive values
- #--------------------------------------------------------------------------
- def add_fixed_passive(skill_id)
- unless skill_learn?($data_skills[skill_id])
- passive = $data_skills[skill_id].quasi_passive
- passive.each {|p| passive_list(p, 1)} if passive
- end
- end
- #--------------------------------------------------------------------------
- # * Removes Passive values
- # Only if skill is known to prevent param to be lowered when skill/passive
- # is not learned.
- #--------------------------------------------------------------------------
- def remove_fixed_passive(skill_id)
- if skill_learn?($data_skills[skill_id])
- passive = $data_skills[skill_id].quasi_passive
- passive.each {|p| passive_list(p, -1)} if passive
- end
- end
- #--------------------------------------------------------------------------
- # * Converts note tag to array [param, value]
- # Checks if it includes % if so, sets percent value to true
- #--------------------------------------------------------------------------
- def passive_list(passive, add)
- param = passive.scan(/\S+/)
- id = Quasi::param_id(param[0].downcase)
- percent = param[1].include?("%")
- value = param[1].delete("%")
- fixed_passive(:param, id, value.to_i*add, percent)
- end
- end
- #==============================================================================
- # ** RPG::Skill
- # * Note Tags
- #==============================================================================
- class RPG::Skill
- def quasi_passive
- if @qpassive.nil?
- if @note =~ /<(?:fixed_passive)>(.*)<\/(?:fixed_passive)>/im
- @qpassive = []
- for p in $1.split("\r\n")
- @qpassive.push(p) if p != ""
- end
- else
- @qpassive = false
- end
- end
- @qpassive
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement