Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Minimum/Maximum TP Requirements for Skills v1.0
- # by Feldherren (with plenty of help from GubiD)
- #
- # For VXAce
- #
- # Ever played Super Robot Wars or Battle of the Youstrass?
- # Sometimes, in these games, attack usability depends on the pilot's will, or
- # morale, which fluctuates over the course of the battle; if the character's
- # in too much of a bad mood, they can't bust out their Super Ultra Finishing
- # Move, even if they meet all other costs
- # This is an attempt at implementing this for VX Ace, allowing skills to have
- # minimum and maximum TP requirements; if TP is lower than or higher than a
- # given value specified in the skill notebox, the skill will be unusable.
- # This is independent of skill TP cost; it only determines whether a skill is
- # available for use.
- #
- # Usage
- # Add <tpmin=[value]> or <tpmax=[value]> to a skill's notebox; this will be the
- # minimum or maximum TP value required to use the skill.
- #
- # Alternatively, you can use the script command [skill].tpmax=[value] to
- # change the requirement for the skill in-game.
- class Game_BattlerBase
- alias skill_conditions_met_tp_min skill_conditions_met?
- #--------------------------------------------------------------------------
- # * Check TP Conditions for Skill
- #--------------------------------------------------------------------------
- def skill_conditions_met?(skill)
- result = skill_conditions_met_tp_min(skill)
- if result && skill.min_tp_cost?
- result = self.tp >= skill.tpmin
- end
- if result && skill.max_tp_cost?
- result = self.tp <= skill.tpmax
- end
- result
- end
- end
- class RPG::Skill < RPG::UsableItem
- def min_tp_cost?
- tpmin != nil
- end
- def max_tp_cost?
- tpmax != nil
- end
- def tpmin
- return @tpmin if @tpmin
- if (match = self.note.match( /^<mintp\s*=\s*(\d+)>/i ))
- return match[1].to_i
- end
- end
- def tpmax
- return @tpmax if @tpmax
- if (match = self.note.match( /^<maxtp\s*=\s*(\d+)>/i ))
- return match[1].to_i
- end
- end
- def tpmin=(val)
- @tpmin=val
- end
- def tpmax=(val)
- @tpmax=val
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement