Advertisement
Dekita

$D13x Max TP Control v1.0

May 30th, 2013
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.87 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Max TP Control
  5. # -- Author : Dekita
  6. # -- Version : 1.0
  7. # -- Level : Easy / Normal
  8. # -- Requires : $D13x Core v2.0+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:TP_Control]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 22/o5/2o13 - Started, Finished,
  21. #
  22. #===============================================================================
  23. # ☆ Introduction
  24. #-------------------------------------------------------------------------------
  25. # This script simply allows a little more control over TP..
  26. # Mainly having a max TP limit, and the ability to change the limit
  27. # a variety of different ways...
  28. # Such as script calls and notetags, even pairing this script with others from
  29. # the $D13x engine, like ISPDS, Dev SLUD, Equip Sets...
  30. #
  31. # Each Actor can also gain TP differently.
  32. #
  33. #===============================================================================
  34. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  35. #===============================================================================
  36. # 1. You MUST give credit to "Dekita" !!
  37. # 2. You are NOT allowed to repost this script.(or modified versions)
  38. # 3. You are NOT allowed to convert this script.
  39. # 4. You are NOT allowed to use this script for Commercial games.
  40. # 5. ENJOY!
  41. #
  42. # "FINE PRINT"
  43. # By using this script you hereby agree to the above terms and conditions,
  44. # if any violation of the above terms occurs "legal action" may be taken.
  45. # Not understanding the above terms and conditions does NOT mean that
  46. # they do not apply to you.
  47. # If you wish to discuss the terms and conditions in further detail you can
  48. # contact me at http://dekitarpg.wordpress.com/
  49. #
  50. #===============================================================================
  51. # ☆ Instructions
  52. #-------------------------------------------------------------------------------
  53. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  54. #
  55. #===============================================================================
  56. # ☆ Script Calls
  57. #-------------------------------------------------------------------------------
  58. # $game_actors[ACTOR_ID].add_max_tp(value)
  59. # $game_actors[ACTOR_ID].sub_max_tp(value)
  60. # $game_actors[ACTOR_ID].div_max_tp(value)
  61. # $game_actors[ACTOR_ID].mul_max_tp(value)
  62. # $game_actors[ACTOR_ID].mod_max_tp(value)
  63. #
  64. # these are the calculatons for each control type
  65. # add : current stat += value
  66. # sub : current stat -= value
  67. # div : current stat /= value
  68. # mul : current stat *= value
  69. # mod : current stat %= value
  70. #
  71. # These script calls modify the Actor value, other items remain in the same order.
  72. #
  73. #===============================================================================
  74. # ☆ Notetags ( default )
  75. #-------------------------------------------------------------------------------
  76. # <mtp plus: VALUE>
  77. # VALUE = the value to increase the max tp.
  78. # For use with Weapons / Armors / Enemies / Actors / Classes / States / Skills
  79. #
  80. #-------------------------------------------------------------------------------
  81. # <tp cost: X> << FOR SKiLLS 0NLY
  82. # replace X with the tp cost. for when skills have a higher tp cost than 100.
  83. #
  84. #-------------------------------------------------------------------------------
  85. # All Increases and Decreases are stacked, using the following calculation ..
  86. # Base + Actor(or Enemy) + Class(if actor) + Equipment(if actor) + States +
  87. # Skills that modify stats or max stats (ie passive skills)
  88. #
  89. #===============================================================================
  90. module TP_Control
  91. #===============================================================================
  92. TP_Type={}# << Keep
  93.  
  94. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  95. # ☆ TP Type Settings
  96. #-----------------------------------------------------------------------------
  97. TP_Type[0]={
  98. :max__tp => "10",
  99. :preserve => true,
  100. :init_tp => "rand * 25",
  101. :take_dmg => "50 * damage_rate * tcr",
  102. :regen_tp => "100 * trg",
  103. }
  104. #-----------------------------------------------------------------------------
  105. TP_Type[1]={
  106. :max__tp => "100",
  107. :preserve => true,
  108. :init_tp => "rand * 50",
  109. :take_dmg => "50 * damage_rate * tcr",
  110. :regen_tp => "100 * trg",
  111. }
  112. #-----------------------------------------------------------------------------
  113. # Default TP Type id for all actors and enemies
  114. Default_TP_Type = 0
  115. #-----------------------------------------------------------------------------
  116. # Notetag Settings
  117. Notes={
  118. :mtp_increase => /<mtp plus:(.*)>/i ,
  119. :tp_cost => /<tp cost:(.*)>/i ,
  120. }
  121. #####################
  122. # CUSTOMISATION END #
  123. end #####################
  124. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  125. # #
  126. # http://dekitarpg.wordpress.com/ #
  127. # #
  128. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  129. #===============================================================================#
  130. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  131. # YES?\.\. #
  132. # OMG, REALLY? \| #
  133. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  134. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  135. #===============================================================================#
  136. module DataManager
  137. #===============================================================================
  138. #---------------------------------------------------------------------------
  139. # Alias List
  140. #---------------------------------------------------------------------------
  141. class << self
  142. alias :lbd__TPLIM :load_database
  143. end
  144. #---------------------------------------------------------------------------
  145. # Load Database (alias)
  146. #---------------------------------------------------------------------------
  147. def self.load_database
  148. lbd__TPLIM
  149. loa__TMLIM
  150. end
  151. #---------------------------------------------------------------------------
  152. # Load Unique Shit
  153. #---------------------------------------------------------------------------
  154. def self.loa__TMLIM
  155. classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
  156. $data_actors , $data_classes, $data_enemies, $data_states ]
  157. for g in classes
  158. for o in g
  159. next if o == nil
  160. o.loa__TMLIM
  161. end
  162. end
  163. end
  164.  
  165. end # DataManager
  166.  
  167. #===============================================================================
  168. class RPG::BaseItem
  169. #===============================================================================
  170. #-----------------------------------------------------------------------------
  171. # Pi Variables
  172. #-----------------------------------------------------------------------------
  173. attr_accessor :mtp_plus
  174. #-----------------------------------------------------------------------------
  175. # Alias List
  176. #-----------------------------------------------------------------------------
  177. def loa__TMLIM
  178. @mtp_plus = 0
  179. self.note.split(/[\r\n]+/).each do |line|
  180. case line
  181. when TP_Control::Notes[:mtp_increase]
  182. @mtp_plus = $1.to_i
  183. when TP_Control::Notes[:tp_cost]
  184. next unless self.is_a?(RPG::Skill)
  185. @tp_cost = $1.to_i
  186. end
  187. end
  188. end
  189.  
  190. end
  191.  
  192. #===============================================================================
  193. class Game_BattlerBase
  194. #===============================================================================
  195. #-----------------------------------------------------------------------------
  196. # Alias List
  197. #-----------------------------------------------------------------------------
  198. alias :init_tp_control :initialize
  199. #-----------------------------------------------------------------------------
  200. # Initialize
  201. #-----------------------------------------------------------------------------
  202. def initialize(*args, &block)
  203. @tp_type_id = TP_Control::Default_TP_Type
  204. @max_tp_prefix = 0
  205. clear_tp_control
  206. init_tp_control(*args, &block)
  207. end
  208. #-----------------------------------------------------------------------------
  209. # Get TP Data From Main Module
  210. #-----------------------------------------------------------------------------
  211. def tp_type_data(data)
  212. return TP_Control::TP_Type[@tp_type_id][data]
  213. end
  214. #-----------------------------------------------------------------------------
  215. # Atk Lv | Def Lv
  216. #-----------------------------------------------------------------------------
  217. def maximum_tp
  218. base = eval(tp_type_data(:max__tp)) rescue 100
  219. @max_tp_prefix = (base+max_tp_plus).to_i
  220. @max_tp_prefix
  221. end
  222. #-----------------------------------------------------------------------------
  223. # Atk Lv | Def Lv ++
  224. #-----------------------------------------------------------------------------
  225. def max_tp_plus
  226. @max_tp_plus[0]
  227. end
  228. #-----------------------------------------------------------------------------
  229. # Clear Atk Lv | Def Lv
  230. #-----------------------------------------------------------------------------
  231. def clear_tp_control
  232. @max_tp_plus = [0]
  233. end
  234. #-----------------------------------------------------------------------------
  235. # Add Max TP
  236. #-----------------------------------------------------------------------------
  237. def add_max_tp(value, ref = true)
  238. @max_tp_plus[0] += value
  239. refresh if ref
  240. end
  241. #-----------------------------------------------------------------------------
  242. # Sub Max TP
  243. #-----------------------------------------------------------------------------
  244. def sub_max_tp(value, ref = true)
  245. @max_tp_plus[0] -= value
  246. refresh if ref
  247. end
  248. #-----------------------------------------------------------------------------
  249. # Div Max TP
  250. #-----------------------------------------------------------------------------
  251. def div_max_tp(value, ref = true)
  252. @max_tp_plus[0] /= value
  253. refresh if ref
  254. end
  255. #-----------------------------------------------------------------------------
  256. # Mul Max TP
  257. #-----------------------------------------------------------------------------
  258. def mul_max_tp(value, ref = true)
  259. @max_tp_plus[0] *= value
  260. refresh if ref
  261. end
  262. #-----------------------------------------------------------------------------
  263. # Mod Max TP
  264. #-----------------------------------------------------------------------------
  265. def mod_max_tp(value, ref = true)
  266. @max_tp_plus[0] %= value
  267. refresh if ref
  268. end
  269. #-----------------------------------------------------------------------------
  270. # Get Maximum Value of TP (overwrite)
  271. #-----------------------------------------------------------------------------
  272. def max_tp
  273. return maximum_tp
  274. end
  275. #-----------------------------------------------------------------------------
  276. # Get Percentage of TP (overwrite)
  277. #-----------------------------------------------------------------------------
  278. def tp_rate
  279. @tp.to_f / max_tp
  280. end
  281. #-----------------------------------------------------------------------------
  282. # Determine if Preserve TP (overwrite)
  283. #-----------------------------------------------------------------------------
  284. def preserve_tp?
  285. return tp_type_data(:preserve)
  286. end
  287.  
  288. end
  289.  
  290. #===============================================================================
  291. class Game_Battler < Game_BattlerBase
  292. #===============================================================================
  293. #-----------------------------------------------------------------------------
  294. # Initialize TP
  295. #-----------------------------------------------------------------------------
  296. def init_tp
  297. self.tp = eval(tp_type_data(:init_tp))
  298. end
  299. #-----------------------------------------------------------------------------
  300. # Charge TP by Damage Suffered
  301. #-----------------------------------------------------------------------------
  302. def charge_tp_by_damage(damage_rate)
  303. self.tp += eval(tp_type_data(:take_dmg))
  304. end
  305. #-----------------------------------------------------------------------------
  306. # Regenerate TP
  307. #-----------------------------------------------------------------------------
  308. def regenerate_tp
  309. self.tp += eval(tp_type_data(:regen_tp))
  310. end
  311. end
  312.  
  313. #===============================================================================
  314. class Game_Actor < Game_Battler
  315. #===============================================================================
  316. #-----------------------------------------------------------------------------
  317. # Max TP Plus
  318. #-----------------------------------------------------------------------------
  319. def max_tp_plus
  320. base = super
  321. base += actor.mtp_plus
  322. base += self.class.mtp_plus
  323. base += equips.compact.inject(0) {|r, i| r += i.mtp_plus }
  324. base += states.compact.inject(0) {|r, i| r += i.mtp_plus }
  325. if $D13x[:Skill_Lv]
  326. base += skills.compact.inject(0) {|r, i| r += (i.mtp_plus*
  327. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  328. else
  329. base += skills.compact.inject(0) {|r, i| r += i.mtp_plus }
  330. end
  331. base
  332. end
  333.  
  334. end
  335.  
  336. #===============================================================================
  337. class Game_Enemy < Game_Battler
  338. #===============================================================================
  339. #-----------------------------------------------------------------------------
  340. # Max TP Plus
  341. #-----------------------------------------------------------------------------
  342. def max_tp_plus
  343. base = super
  344. base += enemy.mtp_plus
  345. base += states.compact.inject(0) {|r, i| r += i.mtp_plus }
  346. base
  347. end
  348.  
  349. end
  350.  
  351. #==============================================================================#
  352. # http://dekitarpg.wordpress.com/ #
  353. #==============================================================================#
  354. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement