Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.0
- ★ Advanced Regen™ ★
- ================================================================================
- Script Information:
- ====================
- This script allows for more advanced regeneration features for states.
- for example , elements resistance / weakness can now be taken into account
- for each state. This allows for poison states to be of a poison element,
- and if target absorbs poison element, the regen effects would be reversed ie.
- absorbed.
- each actor and enemy can also have various regen amounts.
- this allows for bosses ect to regen less / more than regular enemies.
- ================================================================================
- ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- ================================================================================
- 1. You must give credit to "Dekita"
- 2. You are NOT allowed to repost this script.(or modified versions)
- 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
- 4. You are NOT allowed to use this script for Commercial games.
- 5. ENJOY!
- "FINE PRINT"
- By using this script you hereby agree to the above terms and conditions,
- if any violation of the above terms occurs "legal action" may be taken.
- Not understanding the above terms and conditions does NOT mean that
- they do not apply to you.
- If you wish to discuss the terms and conditions in further detail you can
- contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
- ================================================================================
- History:
- =========
- D /M /Y
- 26/o1/2o13 - started && finished,
- ================================================================================
- Credit and Thanks to :
- =======================
- Liak - for giving me the inspiration :p
- ================================================================================
- Known Bugs:
- ============
- N/A
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- If a new bug is found please contact me at
- http://dekitarpg.wordpress.com/
- ================================================================================
- INSTRUCTIONS:
- ==============
- Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
- ================================================================================
- Notetags :
- ===========
- States:
- <hp_regen: X>
- <mp_regen: X>
- <tp_regen: X>
- X = a flaot value, e.g 0.1. CAN BE NEGATIVE e.g -0.1
- This decideds the % of hp/mp/tp to be regenerated/depleted when this state
- is inflicted.
- <regen ele: element_id>
- element_id = the id of the element (from the database)
- This is used for the elemental modifier for all regen effects within the
- state (providing the settings in the moule are true )
- Actors / Enemies:
- <hp_regen: X>
- <mp_regen: X>
- <tp_regen: X>
- X = a flaot value, default = 1.0
- you can use this to make actors/enemies overall regen rates differ
- e.g
- <hp_regen: 0.1>
- would mean that all hp regenerated from states that have advanced regen effects
- would be multiplied by 0.1 before the damage is dealt. this enabled you to
- have lower regen effects for bosses ect..
- =end #=========================================================================#
- module Advanced_Regen
- Mp_Regen_Checks_Elements = true
- Tp_Regen_Checks_Elements = true
- end #####################
- # CUSTOMISATION END #
- #################################################################################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #################################################################################
- $imported = {} if $imported.nil?
- $imported[:Dekita_Adv_Regen] = true
- #==============================================================================
- module DataManager
- #==============================================================================
- class << self
- alias :load_database_regen :load_database
- end
- def self.load_database
- load_database_regen
- load_notetags_regen
- end
- def self.load_notetags_regen
- groups = [$data_actors, $data_enemies, $data_states]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_notetags_regen
- end
- end
- end
- end # DataManager
- #==============================================================================
- class RPG::Actor < RPG::BaseItem
- #==============================================================================
- attr_reader :hp_regen_rate
- attr_reader :mp_regen_rate
- attr_reader :tp_regen_rate
- def load_notetags_regen
- @hp_regen_rate = 1.0
- @mp_regen_rate = 1.0
- @tp_regen_rate = 1.0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<hp_regen: (.*)>/i
- @hp_regen_rate = $1.to_f
- when /<mp_regen: (.*)>/i
- @mp_regen_rate = $1.to_f
- when /<tp_regen: (.*)>/i
- @tp_regen_rate = $1.to_f
- end
- } # self.note.split
- end
- end
- #==============================================================================
- class RPG::Enemy < RPG::BaseItem
- #==============================================================================
- attr_reader :hp_regen_rate
- attr_reader :mp_regen_rate
- attr_reader :tp_regen_rate
- def load_notetags_regen
- @hp_regen_rate = 1.0
- @mp_regen_rate = 1.0
- @tp_regen_rate = 1.0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<hp_regen: (.*)>/i
- @hp_regen_rate = $1.to_f
- when /<mp_regen: (.*)>/i
- @mp_regen_rate = $1.to_f
- when /<tp_regen: (.*)>/i
- @tp_regen_rate = $1.to_f
- end
- } # self.note.split
- end
- end
- #==============================================================================
- class RPG::State < RPG::BaseItem
- #==============================================================================
- attr_reader :adv_hp_regen
- attr_reader :adv_mp_regen
- attr_reader :adv_tp_regen
- attr_reader :regen_element_id
- def load_notetags_regen
- @adv_hp_regen = [false, nil]
- @adv_mp_regen = [false, nil]
- @adv_tp_regen = [false, nil]
- @regen_element_id = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<hp_regen: (.*)>/i
- @adv_hp_regen = [true, $1.to_f]
- when /<mp_regen: (.*)>/i
- @adv_mp_regen = [true, $1.to_f]
- when /<tp_regen: (.*)>/i
- @adv_tp_regen = [true, $1.to_f]
- when /<regen ele: (\d+)>/i
- @regen_element_id = $1.to_i
- #---
- end
- } # self.note.split
- #---
- end
- end
- #==============================================================================
- class Game_Battler < Game_BattlerBase
- #==============================================================================
- def advanced_hp_regen(state)
- e = state.regen_element_id == 0 ? 1.0 :
- element_rate(state.regen_element_id)
- state_hrg = state.adv_hp_regen[1] * e
- damage = -(mhp * state_hrg * self.hp_regen_rate).to_i
- perform_map_damage_effect if $game_party.in_battle && damage > 0
- @result.hp_damage = [damage, max_slip_damage].min
- self.hp -= @result.hp_damage
- end
- def advanced_mp_regen(state)
- if Advanced_Regen::Mp_Regen_Checks_Elements
- e = state.regen_element_id == 0 ? 1.0 :
- element_rate(state.regen_element_id)
- state_mrg = state.adv_mp_regen[1] * e
- else
- state_mrg = state.adv_mp_regen[1]
- end
- damage = -(mmp * state_mrg * self.mp_regen_rate).to_i
- @result.mp_damage = [damage, max_slip_damage].min
- self.mp -= @result.mp_damage
- end
- def advanced_tp_regen(state)
- if Advanced_Regen::Tp_Regen_Checks_Elements
- e = state.regen_element_id == 0 ? 1.0 :
- element_rate(state.regen_element_id)
- state_trg = state.adv_tp_regen[1] * e
- else
- state_trg = state.adv_tp_regen[1]
- end
- damage = (100 * state_trg * self.tp_regen_rate).to_i
- self.tp += damage
- end
- alias :adv_regenerate_all :regenerate_all
- def regenerate_all
- adv_regenerate_all
- if alive?
- @states.each {|id|
- advanced_hp_regen($data_states[id]) if $data_states[id].adv_hp_regen[0]
- advanced_mp_regen($data_states[id]) if $data_states[id].adv_mp_regen[0]
- advanced_tp_regen($data_states[id]) if $data_states[id].adv_tp_regen[0]
- }
- end
- end
- end
- #==============================================================================
- class Game_Actor < Game_Battler
- #==============================================================================
- def hp_regen_rate
- actor.hp_regen_rate
- end
- def mp_regen_rate
- actor.mp_regen_rate
- end
- def tp_regen_rate
- actor.tp_regen_rate
- end
- end
- #==============================================================================
- class Game_Enemy < Game_Battler
- #==============================================================================
- def hp_regen_rate
- enemy.hp_regen_rate
- end
- def mp_regen_rate
- enemy.mp_regen_rate
- end
- def tp_regen_rate
- enemy.tp_regen_rate
- end
- end
- #===============================================================================#
- # - SCRIPT END - #
- #===============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement