Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $imported = {} if $imported.nil?
- $imported["HBK-SSPG"] = 1.0
- #==============================================================================
- # ■ SIMPLE STUPID PARAM GROWTH ver1.0
- # by HBK61
- # Requires: N/A
- # Rewrites method: N/A
- # Aliases method:
- # Data_Manager.load_database
- # Game_Actor.setup
- # Game_Battler.item_apply
- #==============================================================================
- # This simple-stupid script is intended to change default parameters (usually
- # called stats) by performing skils on battle.
- #
- # The basic idea is to make a character gain progress point for each action
- # and when he reach specified point, he will gain parameters.
- #
- # However, I give more options like growth chance, growth multiplier by actor,
- # growth multiplier by class, etc. in case you like to use more detailed
- # calculation.
- #
- #==============================================================================
- # ver1.0 2013.01.21 add notetags for various items
- # compacting syntax
- # make target calculation more simple
- #
- # ver0.9a 2012.08.16 fix class coefficient doesn't being calculated
- # fix bug that make game crash when GBAII is active
- #
- # ver0.9 2012.08.?? initial release
- #==============================================================================
- # TERMS OF USE
- #==============================================================================
- # Just don't claim this script as yours. No need to credit me in game :>
- #
- #==============================================================================
- # INSTRUCTIONS
- #==============================================================================
- ## TARGET = value
- # Is a target for the actor progress to gain parameters. After an actor's
- # progress point reach TARGET, he/she will gain parameters as declared in
- # PARAM_ADD then his/her progress point will be reset. You can set this TARGET
- # value to be dynamic or static. If TARGET_ADD is set more than 0.0, then the
- # TARGET will be increased by TARGET_ADD each time an actor's progress reaches
- # it.
- #-----------------------------------------------------------------------------
- ## PARAM_ADD = [mhp, mmp, atk, def, mat, mdf, agi, luk]
- # How much parameters you get after you progress passed TARGET.
- # For example you want your actor to get 5 MHP and 3 MMP and the other
- # parameters to 1 after he/she passed the TARGET, just set
- # PARAM_ADD = [5, 3, 1, 1, 1, 1, 1, 1]
- #-----------------------------------------------------------------------------
- ## GROW_CHANCE[param_id] = value
- # is random factor for the growth progress. Default value is 1.0 means 100%
- # chance your will get progress point on each parameters.
- #-----------------------------------------------------------------------------
- ## Actor Multiplier ##
- # <param_multiplier stat: 1.0>
- # replace stat with mhp, mmp, atk, def, mat, mdf, agi, luk
- #
- # Will decide how much progress point you will gain depend on each actor.
- # Total growth point per action comes from multiplying Class Multiplier &
- # Actor Multiplier.
- #
- ## Class Multiplier ##
- # <param_multiplier stat: 1.0>
- # replace stat with mhp, mmp, atk, def, mat, mdf, agi, luk
- #
- # Will decide how much progress point you will gain for each class.
- # This features is useful in case you want specific class to gain its
- # parameter progress more rapidly than another class.
- # Lets say you want Warrior to have higher ATK progress than Priest.
- # Total growth point per action comes from multiplying Actor Multiplier &
- # Class Multiplier.
- #-----------------------------------------------------------------------------
- ## GBAST, GBEST, GBAA, GBAE, GBAA_Include_Item
- #
- # You can see that I'm not creative in giving name, that's why I use
- # abbreviations in my module:P
- #-----------------------------------------------------------------------------
- # GBAST = Grow By Actor's Skill Hit Type (Certain Hit, Physical, Magical)
- # GBEST = Grow By Enemy's Skill Hit Type (Certain Hit, Physical, Magical)
- # GBAA = Grow By All - Actor
- # GBAE = Grow By All - Enemy
- # GBAA_Include_Item = Using item will grow parameter defined in GBAA
- #
- # Please look at examples below for instruction how to use this feature.
- #-----------------------------------------------------------------------------
- ## DISPLAY_GAIN
- # Will display a message whenever an actor gain a parameter. In case you're
- # In the middle of a battle, the parameter will be actually added once the
- # battle end.
- #
- #==============================================================================
- # NOTE
- #==============================================================================
- #* Each calculation is performed independently.
- # For example you set GBAS[3] = [0] and GBAST[1] = [0] where skill 3 is
- # categorized as skill type 1, MHP progress calculation will be performed
- # twice.
- # Another example: you set GBAS[3] = [0,0]
- # This will result MHP progress calculation performed twice as well.
- #
- #* The actor will actually gain parameters after battle ends.
- #
- #* MHP doesn't change your current HP. For example you get 90/100 HP and gain
- # 10 MHP on a battle. After battle ends, your HP will be 90/110.
- #
- # PS: Sorry for my poor English and confusing instructions XD
- #==============================================================================
- # CREDITS FROM ME
- #==============================================================================
- # Yanfly for his Ace Debug Engine... Helps me a lot for testing :D
- # Rei_Fan49 for compacting the scripts
- #==============================================================================
- module HBK
- module SSPG
- # Declaration of Constants. Leave it as it is!
- GBAST = []
- GBEST = []
- GBAA = []
- GBAE = []
- #----------------------------------------------------------------------------
- # CONFIGURATIONS
- TARGET = 20
- TARGET_ADD = [
- 2.0, # <= MHP
- 1.0, # <= MMP
- 0.5, # <= ATK
- 0.5, # <= DEF
- 0.5, # <= MAT
- 0.5, # <= MDF
- 0.5, # <= AGI
- 0.5, # <= LUK
- ] # <= Don't delete this!
- PARAM_ADD = [
- 10, # <= MHP
- 5, # <= MMP
- 1, # <= ATK
- 1, # <= DEF
- 1, # <= MAT
- 1, # <= MDF
- 1, # <= AGI
- 1, # <= LUK
- ]
- GROW_CHANCE = [
- 1.0, # <= MHP
- 1.0, # <= MMP
- 1.0, # <= ATK
- 1.0, # <= DEF
- 1.0, # <= MAT
- 1.0, # <= MDF
- 1.0, # <= AGI
- 1.0, # <= LUK
- ] # <= Don't delete this!
- # GBAST/GBEST[skill_id/skill_hit_type] = [param1, param2, etc]
- GBAST[2] = [1,4] # will grow MMP and MAT when actor use any skill with hit type 2 (Magical)
- GBEST[2] = [5,6] # will grow MDF and AGI when enemy use any skill with hit type 2 (Magical)
- # GBAE/GBAA = [param_id 1, param_id 2]
- GBAA = [6,7] # will grow AGI and LUK when any skill is performed by actor.
- GBAE = [6] # will grow AGI when any skill is performed by enemy.
- # using items will be considered GBAA (default: false).
- GBAA_Include_Item = false
- # will display message window parameter gain (default: true).
- DISPLAY_GAIN = true
- # just a simple stupid way to track actor's progress on Ace console window.
- DISPLAY_CONSOLE = true
- #----------------------------------------------------------------------------
- # END OF CONFIGURATION
- #==============================================================================
- # WARNING!
- # Don't edit anything below this point unless you know what you're doing :>
- #==============================================================================
- end #module SSPG
- #-----------------------------------------------------------------------------
- module REGEX
- PARAM_MULTIPLIER = /<param_multiplier\s+(mhp|mmp|atk|def|mat|mdf|agi|luk)\s*:\s*(\d+.\d+)>/i
- ENEMY_GROW_PARAM = /<enemy_skill_grow\s*:\s*(mhp|mmp|atk|def|mat|mdf|agi|luk)>/i
- ACTOR_GROW_PARAM = /<actor_skill_grow\s*:\s*(mhp|mmp|atk|def|mat|mdf|agi|luk)>/i
- end
- end #module REGEX
- module DataManager
- class <<self
- alias hbk_sspg_load_database load_database
- end
- def self.load_database
- hbk_sspg_load_database
- hbk_sspg_scan_notes
- end
- def self.hbk_sspg_scan_notes
- groups = [$data_actors,$data_classes,$data_skills]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.hbk_sspg_scan_notes
- end
- end
- end
- end # DataManager
- class RPG::Actor < RPG::BaseItem
- def hbk_sspg_scan_notes
- @param_multiplier = []
- self.note.split(/[\r\n]+/).each {|line|
- case line
- when HBK::REGEX::PARAM_MULTIPLIER
- case $1
- when 'mhp'
- @param_multiplier[0] = $2.to_f
- when 'mmp'
- @param_multiplier[1] = $2.to_f
- when 'atk'
- @param_multiplier[2] = $2.to_f
- when 'def'
- @param_multiplier[3] = $2.to_f
- when 'mat'
- @param_multiplier[4] = $2.to_f
- when 'mdf'
- @param_multiplier[5] = $2.to_f
- when 'agi'
- @param_multiplier[6] = $2.to_f
- when 'luk'
- @param_multiplier[7] = $2.to_f
- end
- end
- }
- end
- attr_accessor :param_multiplier
- end #RPG::Actor
- class RPG::Class < RPG::BaseItem
- def hbk_sspg_scan_notes
- @param_multiplier = []
- self.note.split(/[\r\n]+/).each {|line|
- case line
- when HBK::REGEX::PARAM_MULTIPLIER
- case $1
- when 'mhp'
- @param_multiplier[0] = $2.to_f
- when 'mmp'
- @param_multiplier[1] = $2.to_f
- when 'atk'
- @param_multiplier[2] = $2.to_f
- when 'def'
- @param_multiplier[3] = $2.to_f
- when 'mat'
- @param_multiplier[4] = $2.to_f
- when 'mdf'
- @param_multiplier[5] = $2.to_f
- when 'agi'
- @param_multiplier[6] = $2.to_f
- when 'luk'
- @param_multiplier[7] = $2.to_f
- end
- end
- }
- end
- attr_accessor :param_multiplier
- end #RPG::Class
- class RPG::Skill < RPG::UsableItem
- def hbk_sspg_scan_notes
- @actor_grow_param = []
- @enemy_grow_param = []
- self.note.split(/[\r\n]+/).each {|line|
- case line
- when HBK::REGEX::ACTOR_GROW_PARAM
- case $1
- when 'mhp'
- @actor_grow_param.push(0)
- when 'mmp'
- @actor_grow_param.push(1)
- when 'atk'
- @actor_grow_param.push(2)
- when 'def'
- @actor_grow_param.push(3)
- when 'mat'
- @actor_grow_param.push(4)
- when 'mdf'
- @actor_grow_param.push(5)
- when 'agi'
- @actor_grow_param.push(6)
- when 'luk'
- @actor_grow_param.push(7)
- end
- end
- }
- self.note.split(/[\r\n]+/).each {|line|
- case line
- when HBK::REGEX::ENEMY_GROW_PARAM
- case $1
- when 'mhp'
- @enemy_grow_param.push(0)
- when 'mmp'
- @enemy_grow_param.push(1)
- when 'atk'
- @enemy_grow_param.push(2)
- when 'def'
- @enemy_grow_param.push(3)
- when 'mat'
- @enemy_grow_param.push(4)
- when 'mdf'
- @enemy_grow_param.push(5)
- when 'agi'
- @enemy_grow_param.push(6)
- when 'luk'
- @enemy_grow_param.push(7)
- end
- end
- }
- end
- attr_accessor :actor_grow_param, :enemy_grow_param
- end #RPG::Skill
- class Game_Battler;include HBK;end
- class Game_Actor < Game_Battler
- alias hbk_sspg_setup setup
- attr_accessor :actor_multiplier, :class_multiplier, :cur_progress, :tgt_progress
- def setup(actor_id)
- hbk_sspg_setup(actor_id)
- @cur_progress = []
- @tgt_progress = []
- @actor_multiplier = [1.0] * 8
- setup_param_grow
- setup_actor_multiplier(actor_id)
- end
- def setup_param_grow
- n = HBK::SSPG::TARGET
- @cur_progress = [0] * 8
- @tgt_progress = [n] * 8
- end
- def setup_actor_multiplier(actor_id)
- (0..7).each {|i|
- @actor_multiplier[i] = actor.param_multiplier[i] if actor.param_multiplier[i]
- }
- end
- def param_grow(param_id)
- cm = self.class.param_multiplier
- (0..7).each {|i|
- cm[i] = 1.0 if cm[i].nil?
- }
- grow = @actor_multiplier[param_id] * cm[param_id]
- if rand < HBK::SSPG::GROW_CHANCE[param_id]
- if @cur_progress[param_id] < (@tgt_progress[param_id] - grow)
- @cur_progress[param_id] += grow
- if HBK::SSPG::DISPLAY_CONSOLE
- puts (actor.name + "'s " + Vocab::param(param_id) + "AM is " + @actor_multiplier[param_id].to_s)
- puts (actor.name + "'s " + Vocab::param(param_id) + "CM is " + cm[param_id].to_s)
- puts (actor.name + "'s " + Vocab::param(param_id) + "grow is " + grow.to_s)
- puts (actor.name + "'s " + Vocab::param(param_id) + " current progress is " + @cur_progress[param_id].to_s)
- puts (actor.name + "'s " + Vocab::param(param_id) + " target progress is " + @tgt_progress[param_id].to_s + "\n\n")
- end
- else
- n = HBK::SSPG::TARGET_ADD[param_id]
- @cur_progress[param_id] -= @tgt_progress[param_id]
- @tgt_progress[param_id] += n
- if HBK::SSPG::PARAM_ADD[param_id] >= 1
- add_param(param_id, HBK::SSPG::PARAM_ADD[param_id])
- if HBK::SSPG::DISPLAY_GAIN
- $game_message.add(actor.name + " " + Vocab::param(param_id) + " is increased by " + HBK::SSPG::PARAM_ADD[param_id].to_s + "!")
- end
- end
- end
- end
- end #param_grow
- end #Game_Actor
- class Game_Battler < Game_BattlerBase
- alias hbk_item_apply item_apply
- def item_apply(user, item)
- hbk_item_apply(user, item)
- if item.is_a?(RPG::Skill)
- a = item.actor_grow_param
- b = HBK::SSPG::GBAST[item.hit_type]
- c = item.enemy_grow_param
- d = HBK::SSPG::GBEST[item.hit_type]
- e = HBK::SSPG::GBAA
- f = HBK::SSPG::GBAE
- bool = HBK::SSPG::GBAA_Include_Item
- _growparam = []
- _user = nil
- if user.is_a?(Game_Actor)
- _growparam = [a,b,e]
- _user = user
- elsif user.is_a?(Game_Enemy)
- _growparam = [c,d,f]
- _user = self
- end
- _growparam.each { |param_plus|
- unless param_plus.nil?
- param_plus.each { |n|
- _user.param_grow(n) if !n.nil? && n < 8
- }
- end
- }
- elsif user.is_a?(Game_Actor)
- user.param_grow(n) if bool && n < 8
- end
- end #item_apply
- end #Game_Battler
Advertisement
Add Comment
Please, Sign In to add comment