Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==============================================================================
- # ▼▼▼▼▼▼ TroyZ - Guard Rate Mods ▼▼▼▼▼▼
- # ==============================================================================
- # Script by : Agung Prasetyo(TroyZ)
- # Contact me by : - Email agung.endisnear.xyz@gmail.com
- # - Forum RPGMakerID, username TroyZ
- # - Handphone 085756289121
- # Engine : VXAce
- # Level : Easy
- # Version : 1.0
- # ------------------------------------------------------------------------------
- # Change Logs :
- # 10 June 2013 : Version 1.0 released
- # ------------------------------------------------------------------------------
- # How this work :
- # As default, the damage will be reduced by half when guarding. This script
- # allows you to change the default damage reduced when guarding.
- # ------------------------------------------------------------------------------
- # How to use :
- # Place it between material and main. Use this notetag :
- # <guard rate: x>
- # To apply custom damage reducer when guarding. Only applies to actors and enemies.
- # For example, this notetag goes into the first actor in the database :
- # <guard rate: 3>
- # Means that, income damage when guarding will be divided by 3
- # ------------------------------------------------------------------------------
- # Who to credit :
- # - Allah swt. : For the chance of living that he has given to me.
- # - Nabi Muhammad saw. : As a leader and messenger and prophet of Islam.
- # I'm proud to be your follower. :)
- # - Agung Prasetyo(TroyZ) : Thats me, of course, the ones that made this script. :P
- # ------------------------------------------------------------------------------
- # License :
- # - Free Game : Just credit those names above.
- # - Commercial Game : Same as free game's license + the full version of your
- # commercially game given to me free of charge. :P
- # ------------------------------------------------------------------------------
- $imported = {} if $imported.nil?
- $imported[:TroyZ_GuardRateMods] = true
- # ------------------------------------------------------------------------------
- # Configuration of script starts here
- # ------------------------------------------------------------------------------
- module AGUNG
- module GUARD_RATE
- GUARD_RATE_DEFAULT = 2 # when guarding, damage will be divided by this
- # default number
- end
- module NOTETAGS_GUARD_RATE
- GUARD_RATE = /<(?:GUARD RATE|guard rate):[ ]*(\d+)>/i
- end
- end
- # ------------------------------------------------------------------------------
- # End of configuration
- # ------------------------------------------------------------------------------
- module DataManager
- # ----------------------------------------------------------------------------
- # Alias method, for notetags using
- # ----------------------------------------------------------------------------
- class << self
- alias agung_load_guard_rate_dbase_x load_database
- end
- def self.load_database
- agung_load_guard_rate_dbase_x
- agung_load_guard_rate_notetags_x
- end
- # ----------------------------------------------------------------------------
- # New method, to use notetags
- # ----------------------------------------------------------------------------
- def self.agung_load_guard_rate_notetags_x
- [$data_actors,$data_enemies].each do |dbase|
- dbase.compact.each do |groups|
- groups.agung_load_guard_rate_x
- end
- end
- end
- end
- class RPG::Actor < RPG::BaseItem
- # ----------------------------------------------------------------------------
- # New accessor, to store guard rate
- # ----------------------------------------------------------------------------
- attr_accessor :guard_rate
- # ----------------------------------------------------------------------------
- # New method, to load guard rate notetags
- # ----------------------------------------------------------------------------
- def agung_load_guard_rate_x
- @guard_rate = AGUNG::GUARD_RATE::GUARD_RATE_DEFAULT
- self.note.split(/[\r\n]+/).each { |baris|
- case baris
- when AGUNG::NOTETAGS_GUARD_RATE::GUARD_RATE
- @guard_rate = $1.to_i
- end
- }
- end
- end
- class RPG::Enemy < RPG::BaseItem
- # ----------------------------------------------------------------------------
- # New accessor, to store guard rate
- # ----------------------------------------------------------------------------
- attr_accessor :guard_rate
- # ----------------------------------------------------------------------------
- # New method, to load guard rate notetags
- # ----------------------------------------------------------------------------
- def agung_load_guard_rate_x
- @guard_rate = AGUNG::GUARD_RATE::GUARD_RATE_DEFAULT
- self.note.split(/[\r\n]+/).each { |baris|
- case baris
- when AGUNG::NOTETAGS_GUARD_RATE::GUARD_RATE
- @guard_rate = $1.to_i
- end
- }
- end
- end
- class Game_Battler < Game_BattlerBase
- # ----------------------------------------------------------------------------
- # Overwrite method, to check who is guarding, and calculate the rate damage
- # ----------------------------------------------------------------------------
- def apply_guard(damage)
- return damage / (damage > 0 && guard? ? $data_actors[id].guard_rate * grd : 1) if actor?
- return damage / (damage > 0 && guard? ? $data_enemies[@enemy_id].guard_rate * grd : 1) if enemy?
- damage / (damage > 0 && guard? ? 2 * grd : 1)
- end
- end
- # ------------------------------------------------------------------------------
- # END OF SCRIPT
- # ------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement