Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==============================================================================
- # ▼▼▼▼▼▼ TroyZ - Individual Substitute Rate ▼▼▼▼▼▼
- # ==============================================================================
- # 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 :
- # 8 July 2013 : Version 1.0 released
- # ------------------------------------------------------------------------------
- # How this work :
- # Defaultly, the substitute cover will work when others allies' HP are below 25%
- # of their MaxHP. This script allows you to set the substitute rate individually.
- # ------------------------------------------------------------------------------
- # How to use :
- # Place it between material and main. Use this notetags inside actors and
- # enemies :
- #
- # <substitute rate: x>
- #
- # Actors and enemies that have this notetag will be covered when their HP is
- # below x percent of their MaxHP. For example, an actor has this notetag :
- #
- # <substitute rate: 50>
- #
- # This actor will be covered when this actor's HP is below 50% of it's MaxHP.
- # Remember, substitute cover will ONLY be work when at least there is one allied
- # battler has the substitute special flag.
- # ------------------------------------------------------------------------------
- # Compatibility issues :
- # None yet. If you found some, let me know, and bug fixes will come out soon.
- # ------------------------------------------------------------------------------
- # 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 Muslim.
- # 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.
- # ------------------------------------------------------------------------------
- $imported = {} if $imported.nil?
- $imported[:TroyZ_IndividualSubstituteRate] = true
- # ------------------------------------------------------------------------------
- # There is nothing to config beyond this line
- # ------------------------------------------------------------------------------
- module AGUNG
- module SUBSTITUTE
- SUBSTITUTE_RATE_DEFAULT = 25 # the default substitute rate
- end
- module NOTETAGS_SUBSTITUTE
- SUBSTITUTE_RATE = /<(?:SUBSTITUTE RATE|substitute rate):[ ]*(\d+)>/i
- end
- end
- # ------------------------------------------------------------------------------
- # You shall not pass
- # ------------------------------------------------------------------------------
- module DataManager
- class << self
- alias agung_load_substitute_rate_dbase_x load_database
- end
- def self.load_database
- agung_load_substitute_rate_dbase_x
- agung_load_notetags_substitute_rate_x
- end
- def self.agung_load_notetags_substitute_rate_x
- [$data_actors,$data_enemies].each do |object|
- object.each do |obj|
- next unless obj
- obj.agung_load_notetags_substitute_rate_x
- end
- end
- end
- end
- class RPG::Actor < RPG::BaseItem
- include AGUNG::SUBSTITUTE
- include AGUNG::NOTETAGS_SUBSTITUTE
- attr_accessor :subs_rate
- def agung_load_notetags_substitute_rate_x
- @subs_rate = SUBSTITUTE_RATE_DEFAULT.to_f / 100
- self.note.split(/[\r\n]+/).each { |baris|
- case baris
- when SUBSTITUTE_RATE
- @subs_rate = $1.to_f / 100
- end
- }
- end
- end
- class RPG::Enemy < RPG::BaseItem
- include AGUNG::SUBSTITUTE
- include AGUNG::NOTETAGS_SUBSTITUTE
- attr_accessor :subs_rate
- def agung_load_notetags_substitute_rate_x
- @subs_rate = SUBSTITUTE_RATE_DEFAULT.to_f / 100
- self.note.split(/[\r\n]+/).each { |baris|
- case baris
- when SUBSTITUTE_RATE
- @subs_rate = $1.to_f / 100
- end
- }
- end
- end
- class Game_Actor < Game_Battler
- def subs_rate
- $data_actors[id].subs_rate
- end
- end
- class Game_Enemy < Game_Battler
- def subs_rate
- $data_enemies[@enemy_id].subs_rate
- end
- end
- class Scene_Battle < Scene_Base
- def check_substitute(target, item)
- target.hp <= target.mhp * target.subs_rate && (!item || !item.certain?)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement