Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Max TP Control
- # -- Author : Dekita
- # -- Version : 1.0
- # -- Level : Easy / Normal
- # -- Requires : $D13x Core v2.0+
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:TP_Control]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 22/o5/2o13 - Started, Finished,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script simply allows a little more control over TP..
- # Mainly having a max TP limit, and the ability to change the limit
- # a variety of different ways...
- # Such as script calls and notetags, even pairing this script with others from
- # the $D13x engine, like ISPDS, Dev SLUD, Equip Sets...
- #
- # Each Actor can also gain TP differently.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ 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.
- # 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/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # $game_actors[ACTOR_ID].add_max_tp(value)
- # $game_actors[ACTOR_ID].sub_max_tp(value)
- # $game_actors[ACTOR_ID].div_max_tp(value)
- # $game_actors[ACTOR_ID].mul_max_tp(value)
- # $game_actors[ACTOR_ID].mod_max_tp(value)
- #
- # these are the calculatons for each control type
- # add : current stat += value
- # sub : current stat -= value
- # div : current stat /= value
- # mul : current stat *= value
- # mod : current stat %= value
- #
- # These script calls modify the Actor value, other items remain in the same order.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- #-------------------------------------------------------------------------------
- # <mtp plus: VALUE>
- # VALUE = the value to increase the max tp.
- # For use with Weapons / Armors / Enemies / Actors / Classes / States / Skills
- #
- #-------------------------------------------------------------------------------
- # <tp cost: X> << FOR SKiLLS 0NLY
- # replace X with the tp cost. for when skills have a higher tp cost than 100.
- #
- #-------------------------------------------------------------------------------
- # All Increases and Decreases are stacked, using the following calculation ..
- # Base + Actor(or Enemy) + Class(if actor) + Equipment(if actor) + States +
- # Skills that modify stats or max stats (ie passive skills)
- #
- #===============================================================================
- module TP_Control
- #===============================================================================
- TP_Type={}# << Keep
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ TP Type Settings
- #-----------------------------------------------------------------------------
- TP_Type[0]={
- :max__tp => "10",
- :preserve => true,
- :init_tp => "rand * 25",
- :take_dmg => "50 * damage_rate * tcr",
- :regen_tp => "100 * trg",
- }
- #-----------------------------------------------------------------------------
- TP_Type[1]={
- :max__tp => "100",
- :preserve => true,
- :init_tp => "rand * 50",
- :take_dmg => "50 * damage_rate * tcr",
- :regen_tp => "100 * trg",
- }
- #-----------------------------------------------------------------------------
- # Default TP Type id for all actors and enemies
- Default_TP_Type = 0
- #-----------------------------------------------------------------------------
- # Notetag Settings
- Notes={
- :mtp_increase => /<mtp plus:(.*)>/i ,
- :tp_cost => /<tp cost:(.*)>/i ,
- }
- #####################
- # CUSTOMISATION END #
- 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.\..\.. #
- #===============================================================================#
- module DataManager
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- class << self
- alias :lbd__TPLIM :load_database
- end
- #---------------------------------------------------------------------------
- # Load Database (alias)
- #---------------------------------------------------------------------------
- def self.load_database
- lbd__TPLIM
- loa__TMLIM
- end
- #---------------------------------------------------------------------------
- # Load Unique Shit
- #---------------------------------------------------------------------------
- def self.loa__TMLIM
- classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
- $data_actors , $data_classes, $data_enemies, $data_states ]
- for g in classes
- for o in g
- next if o == nil
- o.loa__TMLIM
- end
- end
- end
- end # DataManager
- #===============================================================================
- class RPG::BaseItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_accessor :mtp_plus
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- def loa__TMLIM
- @mtp_plus = 0
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when TP_Control::Notes[:mtp_increase]
- @mtp_plus = $1.to_i
- when TP_Control::Notes[:tp_cost]
- next unless self.is_a?(RPG::Skill)
- @tp_cost = $1.to_i
- end
- end
- end
- end
- #===============================================================================
- class Game_BattlerBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :init_tp_control :initialize
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize(*args, &block)
- @tp_type_id = TP_Control::Default_TP_Type
- @max_tp_prefix = 0
- clear_tp_control
- init_tp_control(*args, &block)
- end
- #-----------------------------------------------------------------------------
- # Get TP Data From Main Module
- #-----------------------------------------------------------------------------
- def tp_type_data(data)
- return TP_Control::TP_Type[@tp_type_id][data]
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv
- #-----------------------------------------------------------------------------
- def maximum_tp
- base = eval(tp_type_data(:max__tp)) rescue 100
- @max_tp_prefix = (base+max_tp_plus).to_i
- @max_tp_prefix
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv ++
- #-----------------------------------------------------------------------------
- def max_tp_plus
- @max_tp_plus[0]
- end
- #-----------------------------------------------------------------------------
- # Clear Atk Lv | Def Lv
- #-----------------------------------------------------------------------------
- def clear_tp_control
- @max_tp_plus = [0]
- end
- #-----------------------------------------------------------------------------
- # Add Max TP
- #-----------------------------------------------------------------------------
- def add_max_tp(value, ref = true)
- @max_tp_plus[0] += value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Sub Max TP
- #-----------------------------------------------------------------------------
- def sub_max_tp(value, ref = true)
- @max_tp_plus[0] -= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Div Max TP
- #-----------------------------------------------------------------------------
- def div_max_tp(value, ref = true)
- @max_tp_plus[0] /= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Mul Max TP
- #-----------------------------------------------------------------------------
- def mul_max_tp(value, ref = true)
- @max_tp_plus[0] *= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Mod Max TP
- #-----------------------------------------------------------------------------
- def mod_max_tp(value, ref = true)
- @max_tp_plus[0] %= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Get Maximum Value of TP (overwrite)
- #-----------------------------------------------------------------------------
- def max_tp
- return maximum_tp
- end
- #-----------------------------------------------------------------------------
- # Get Percentage of TP (overwrite)
- #-----------------------------------------------------------------------------
- def tp_rate
- @tp.to_f / max_tp
- end
- #-----------------------------------------------------------------------------
- # Determine if Preserve TP (overwrite)
- #-----------------------------------------------------------------------------
- def preserve_tp?
- return tp_type_data(:preserve)
- end
- end
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Initialize TP
- #-----------------------------------------------------------------------------
- def init_tp
- self.tp = eval(tp_type_data(:init_tp))
- end
- #-----------------------------------------------------------------------------
- # Charge TP by Damage Suffered
- #-----------------------------------------------------------------------------
- def charge_tp_by_damage(damage_rate)
- self.tp += eval(tp_type_data(:take_dmg))
- end
- #-----------------------------------------------------------------------------
- # Regenerate TP
- #-----------------------------------------------------------------------------
- def regenerate_tp
- self.tp += eval(tp_type_data(:regen_tp))
- end
- end
- #===============================================================================
- class Game_Actor < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Max TP Plus
- #-----------------------------------------------------------------------------
- def max_tp_plus
- base = super
- base += actor.mtp_plus
- base += self.class.mtp_plus
- base += equips.compact.inject(0) {|r, i| r += i.mtp_plus }
- base += states.compact.inject(0) {|r, i| r += i.mtp_plus }
- if $D13x[:Skill_Lv]
- base += skills.compact.inject(0) {|r, i| r += (i.mtp_plus*
- Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
- else
- base += skills.compact.inject(0) {|r, i| r += i.mtp_plus }
- end
- base
- end
- end
- #===============================================================================
- class Game_Enemy < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Max TP Plus
- #-----------------------------------------------------------------------------
- def max_tp_plus
- base = super
- base += enemy.mtp_plus
- base += states.compact.inject(0) {|r, i| r += i.mtp_plus }
- base
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement