Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- TP-Guard System (Simple TP Shield) v1.0
- Script by TheCaliMack and Maliki
- Description
- Your TP is now your GUARD meter. Build it up to block incoming attacks!
- Max TP is set to be the higher value between your HP and your MP, but you may
- adjust it as you see fit.
- This script emulates the Guard mechanic in Dragon Age: Inquisition by replacing
- TP with Guard.
- Use the <skip_guard> notetag on skills and items to have them skip GRD.
- calculations.
- Also, GainTP really functions as percent now when you make the item effects.
- For example, when you set max_tp to 500 and set the gain tp percentage of
- an item or skill, it will fill up with the said percentage, no longer fixed on
- the 100 TP regular limit.
- When it comes to skills, the GainTP% function works by percentage as it would
- in items, but the manual, non-percentage TP input is fixed.
- NOTES ON SCRIPT:
- > TP does not block magical attacks but can be adjusted in the formula below.
- > Individual skills can now ignore Guard with <skip_guard> notetag.
- > DMG_TPGain can manually enable or disable gaining TP from receiving damage.
- > Notes in script allow for customizing damage conversion.
- Terms of Use:
- > Script is for non-commercial use only.
- > For commercial use, please email script-writer in "[email protected]" for the terms
- > Always include TheCaliMack or California Macky AND Maliki if you decide to use this script in your game.
- > Any variant of the script must have these Terms extended to it. That means you must use these Terms stated above as well as your own.
- =end
- module NEILGUARDSYS
- #--------------------------------------------------------------------------
- # DMG_TPGain
- # Gain TP when receiving damage? Set to 'true' to enable.
- #--------------------------------------------------------------------------
- DMG_TPGain = false
- end #module END
- #--------------------------------------------------------------------------
- # SKIP GUARD NOTETAG
- # Default notetag is <skip_guard>. Adjust tag as you see fit.
- #--------------------------------------------------------------------------
- class RPG::UsableItem < RPG::BaseItem
- def skip_guard?
- if @note =~ /<skip_guard>/i
- return true
- else
- return false
- end
- end
- end #RPG::UsableItem END
- class Game_ActionResult
- #--------------------------------------------------------------------------
- # * Create Damage (overwrites make_damage )
- #--------------------------------------------------------------------------
- def make_damage(value, item)
- # value => initial damage
- value2 = value #change this to whatever formula you need
- breaker = value2 - @battler.tp if value2 > @battler.tp
- @critical = false if value == 0
- if item.skip_guard? == false
- if (@battler.tp > value2) && item.damage.to_hp? && !item.damage.recover?
- @tp_damage = value2
- @hp_damage = 0
- @battler.tp = [0, (@battler.tp-@tp_damage)].max.to_i
- Sound.play_magic_evasion
- else
- if value2 >= @battler.tp && item.damage.to_hp? && !item.damage.recover?
- @tp_damage = [@battler.tp, value2].min.to_i
- @battler.tp -= @tp_damage.to_i
- @hp_damage = breaker.to_i
- else
- @hp_damage = value if item.damage.to_hp?
- end
- end
- else #if skip_guard? is true
- @hp_damage = value if item.damage.to_hp?
- end
- @mp_damage = value if item.damage.to_mp?
- @mp_damage = [@battler.mp, @mp_damage].min
- @hp_drain = @hp_damage if item.damage.drain?
- @mp_drain = @mp_damage if item.damage.drain?
- @hp_drain = [@battler.hp, @hp_drain].min
- @success = true if item.damage.to_hp? || @mp_damage != 0
- end
- end #Game_ActionResult END
- #--------------------------------------------------------------------------
- # * Max TP
- # Modify this to suit your needs. Just change the value returned for max_tp
- #--------------------------------------------------------------------------
- class Game_BattlerBase
- def max_tp
- return [param(0), param(1)].max #param(0) is MaxHP. param(1) is MaxMP
- end
- def tp_rate
- @tp.to_f / max_tp
- end
- end #Game_BattlerBase END
- class Game_Battler < Game_BattlerBase
- include NEILGUARDSYS
- def item_effect_gain_tp(user, item, effect)
- value = item_value_recover_tp(user, item, effect)
- self.tp += value
- end
- #--------------------------------------------------------------------------
- # * New method: item_value_recover_tp
- #--------------------------------------------------------------------------
- def item_value_recover_tp(user, item, effect)
- value = effect.value1.to_i * self.max_tp
- value = value / 100 if item.is_a?(RPG::Skill)
- value *= user.pha if item.is_a?(RPG::Item)
- value *= user.tcr
- value
- end
- def charge_tp_by_damage(damage_rate)
- self.tp += 50 * damage_rate * tcr if DMG_TPGain
- end
- end #Game_Battler END
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment