Advertisement
Dekita

stat control v1.7

Mar 27th, 2014
578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.67 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Statistic Control
  5. # -- Author : Dekita
  6. # -- Version : 1.7
  7. # -- Level : Easy / Normal
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Stats_Control]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # ??/o3/2o14 - Small change to code,
  21. # 31/o5/2o13 - Added More Help Info For Script Calls.
  22. # 19/o4/2o13 - Small bugfixx, (<stat limit:X> notetag)
  23. # 12/o4/2o13 - Small Bugfix, (require :Dev_SLUD)
  24. # 28/o3/2o13 - Small Efficiency Update,
  25. # 25/o3/2o13 - Compatibility, (Elements Control)
  26. # 23/o3/2o13 - Fixed Bug, (default equip params)
  27. # 2o/o3/2o13 - Compatibility - Skill Levels
  28. # 13/o3/2o13 - updated import method,
  29. # 12/o3/2o13 - Finished,
  30. # 1o/o3/2o13 - Started
  31. #
  32. #===============================================================================
  33. # ☆ Introduction
  34. #-------------------------------------------------------------------------------
  35. # This Script 'fixes' actor statistics, ie. params / xparams / sparams
  36. # and allows the stats to be increased/decreased by a steady value rather
  37. # than a percentage of the current value as it offers more control and
  38. # flexibility, also I prefer it this way.
  39. # It also adds min and max limits for x/s-params and gives control over these
  40. # new limitations, as well as the standard params.
  41. #
  42. # You are allowed the use of some new ways to control these stats
  43. # using actors/classes/enemies/weapons/armors/states/skills notetags
  44. # and some script calls.
  45. # e.g
  46. # an actor knowing a certain skill can controls statistics (using notetags).
  47. # you can use script calls to decrease/increase/multiply/divide x/s-params.
  48. #
  49. # Note :
  50. # x/s-Params still work with percentage values, ie 0.01 is 1%, 1.0 is 100%
  51. #
  52. # This Script also overwrites the default level up/down method to be a little
  53. # more flexible.
  54. # It does the same to the learn skill and initialize skill methods.
  55. # And also acts as a base for some other actor related scripts of mine.
  56. #
  57. # in short : this is a limiter / limit-breaker script with bonuses :p
  58. #
  59. #===============================================================================
  60. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  61. #===============================================================================
  62. # 1. You MUST give credit to "Dekita" !!
  63. # 2. You are NOT allowed to repost this script.(or modified versions)
  64. # 3. You are NOT allowed to convert this script.
  65. # 4. You are NOT allowed to use this script for Commercial games.
  66. # 5. ENJOY!
  67. #
  68. # "FINE PRINT"
  69. # By using this script you hereby agree to the above terms and conditions,
  70. # if any violation of the above terms occurs "legal action" may be taken.
  71. # Not understanding the above terms and conditions does NOT mean that
  72. # they do not apply to you.
  73. # If you wish to discuss the terms and conditions in further detail you can
  74. # contact me at http://dekitarpg.wordpress.com/
  75. #
  76. #===============================================================================
  77. # ☆ Instructions
  78. #-------------------------------------------------------------------------------
  79. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  80. # Place Under My $D13x - Core Script. (if used)
  81. #
  82. #===============================================================================
  83. # ☆ Notetags ( default )
  84. # For use with Weapons / Armors / Enemies / Actors / Classes / States / Skills
  85. #-------------------------------------------------------------------------------
  86. # <stat: value>
  87. # stat = mhp, mmp, agi, luk, cri ect...
  88. # value = the value for that equip/enemy/skill/state/whatever..
  89. # e.g
  90. # <agi: 4> would add 4 agility onto the notetagged item
  91. # <cri: 0.04> would add 4% crit rate onto the notetagged item
  92. # Also, value can be negative e.g <stat: -0.05>
  93. #
  94. # <stat limit: max>
  95. # Used to modify the stat maximum limit
  96. # stat limit = hit, atk, pha, def, exr ect...
  97. # max = the value for that equip/enemy/ect
  98. #
  99. #-------------------------------------------------------------------------------
  100. # IMPORTANT :
  101. # The settings below are the default settings, ie. the base settings.
  102. # If you want to have a lower max stat than the default, you must make
  103. # the notetags value for that actor (or whatever) be negative, ie. reduced
  104. # from the default stat settings.
  105. # If you want to increase simply use the notetag and the value will be added
  106. # onto the default value.
  107. # This is the same for all note-taggable items.
  108. #
  109. # All Increases and Decreases are stacked, using the following calculation ..
  110. # Base + Actor(or Enemy) + Class(if actor) + Equipment(if actor) + States +
  111. # Skills that modify stats or max stats (ie passive skills)
  112. #
  113. #===============================================================================
  114. # ☆ Script Calls
  115. #-------------------------------------------------------------------------------
  116. # $game_actors[id].add_param(param_id, value) << From Default Engine .
  117. # $game_actors[id].sub_param(param_id, value)
  118. # $game_actors[id].div_param(param_id, value)
  119. # $game_actors[id].mul_param(param_id, value)
  120. # $game_actors[id].mod_param(param_id, value)
  121. #
  122. # $game_actors[id].add_xparam(xparam_id, value)
  123. # $game_actors[id].sub_xparam(xparam_id, value)
  124. # $game_actors[id].div_xparam(xparam_id, value)
  125. # $game_actors[id].mul_xparam(xparam_id, value)
  126. # $game_actors[id].mod_xparam(xparam_id, value)
  127. #
  128. # $game_actors[id].add_sparam(xparam_id, value)
  129. # $game_actors[id].sub_sparam(xparam_id, value)
  130. # $game_actors[id].div_sparam(xparam_id, value)
  131. # $game_actors[id].mul_sparam(xparam_id, value)
  132. # $game_actors[id].mod_sparam(xparam_id, value)
  133. #
  134. # these are the calculatons for each control type
  135. # add : current stat += value
  136. # sub : current stat -= value
  137. # div : current stat /= value
  138. # mul : current stat *= value
  139. # mod : current stat %= value
  140. #
  141. # These script calls modify the Actor value, other items remain in the same order.
  142. #
  143. # There is also a third arguement for all the above script calls,
  144. # it is a boolean arguement to determine if the player should be refreshed.
  145. # eg.. $game_actors[1].add_param(0, 50, false)
  146. # this is very helpfull for maintaining FPS when adding LOTS of stats..
  147. # The default to this arguemet is true.
  148. # If you don't understand what this mean, just disregard this information :)
  149. #
  150. #===============================================================================
  151. # ☆ HELP
  152. #-------------------------------------------------------------------------------
  153. # PARAMS : # XPARAMS : # SPARAMS : #
  154. # stat = id # stat = id # stat = id #
  155. # mhp = 0 # hit = 0 # tgr = 0 #
  156. # mmp = 1 # eva = 1 # grd = 1 #
  157. # atk = 2 # cri = 2 # rec = 2 #
  158. # def = 3 # cev = 3 # pha = 3 #
  159. # mat = 4 # mev = 4 # mcr = 4 #
  160. # mdf = 5 # mrf = 5 # tcr = 5 #
  161. # agi = 6 # cnt = 6 # pdr = 6 #
  162. # luk = 7 # hrg = 7 # mdr = 7 #
  163. # # mrg = 8 # fdr = 8 #
  164. # # trg = 9 # exr = 9 #
  165. #-------------------------------------------------------------------------------
  166. # Remember :
  167. # All Params work with integer values, eg. 1, 5, 123, 653, 198123
  168. # All x/s-Params work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01
  169. # 1.0 = 100%, 0.01 = 1%,
  170. #
  171. #===============================================================================
  172. # ☆ For Scripters
  173. #-------------------------------------------------------------------------------
  174. # This script creates new params ( Pi Variables ) and uses them (when possible)
  175. # to modify the base params (the VX Ace default engine ones)
  176. # These new params are :
  177. # pars = [0] * 8
  178. # xpars = [0] * 10
  179. # spars = [0] * 10
  180. # max_pars = [0] * 8
  181. # max_xpars = [0] * 10
  182. # max_spars = [0] * 10
  183. # They are the same for all classes.
  184. #
  185. #===============================================================================
  186. module Par_Fixx
  187. #===============================================================================
  188. Notes={}# << Keep
  189. Stats={}# << Keep
  190.  
  191. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  192. # ☆ Display Settings
  193. #--------------------------------------------------------------------------
  194. # Make this false if you do not wish to display text when an actor levels down
  195. Show_Level_Down = true
  196.  
  197. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  198. # ☆ Statistics Settings
  199. #--------------------------------------------------------------------------
  200. # This is where you adjust the settings for the base min and max values
  201. # used for actors / enemies.
  202. #--------------------------------------------------------------------------
  203. # Stats[:id]= [ min , max ]
  204. # Params
  205. Stats[:mhp] = [ 0 , 99999 ]
  206. Stats[:mmp] = [ 0 , 99999 ]
  207. Stats[:atk] = [ 1 , 9999 ]
  208. Stats[:def] = [ 1 , 9999 ]
  209. Stats[:mat] = [ 1 , 9999 ]
  210. Stats[:mdf] = [ 1 , 9999 ]
  211. Stats[:agi] = [ 1 , 9999 ]
  212. Stats[:luk] = [ 1 , 9999 ]
  213. # x-Params
  214. Stats[:hit] = [ 0.0 , 0.99 ]
  215. Stats[:eva] = [ 0.0 , 0.99 ]
  216. Stats[:cri] = [ 0.0 , 0.99 ]
  217. Stats[:cev] = [ 0.0 , 0.99 ]
  218. Stats[:mev] = [ 0.0 , 0.99 ]
  219. Stats[:mrf] = [ 0.0 , 0.99 ]
  220. Stats[:cnt] = [ 0.0 , 0.99 ]
  221. Stats[:hrg] = [-0.99 , 0.99 ]
  222. Stats[:mrg] = [-0.99 , 0.99 ]
  223. Stats[:trg] = [-0.99 , 0.99 ]
  224. # s-Params
  225. Stats[:tgr] = [ 0.0 , 2.0 ]
  226. Stats[:grd] = [ 0.0 , 2.0 ]
  227. Stats[:rec] = [ 0.0 , 2.0 ]
  228. Stats[:pha] = [ 0.0 , 2.0 ]
  229. Stats[:mcr] = [ 0.0 , 2.0 ]
  230. Stats[:tcr] = [ 0.0 , 2.0 ]
  231. Stats[:pdr] = [ 0.0 , 2.0 ]
  232. Stats[:mdr] = [ 0.0 , 2.0 ]
  233. Stats[:fdr] = [ 0.0 , 2.0 ]
  234. Stats[:exr] = [ 0.0 , 2.0 ]
  235.  
  236. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  237. # ☆ Notetag Settings
  238. #-----------------------------------------------------------------------------
  239. # This is where you adjust the settings for the notetags used in all
  240. # notetaggable items.
  241. # Only modify this if you understand how to.
  242. #-----------------------------------------------------------------------------
  243. # Notes[:id]= [ <stat: value> , <stat limit: max> ]
  244. # Params :
  245. Notes[:mhp] = [ /<mhp:(.*)>/i , /<mhp limit:(.*)>/i ]
  246. Notes[:mmp] = [ /<mmp:(.*)>/i , /<mmp limit:(.*)>/i ]
  247. Notes[:atk] = [ /<atk:(.*)>/i , /<atk limit:(.*)>/i ]
  248. Notes[:def] = [ /<def:(.*)>/i , /<def limit:(.*)>/i ]
  249. Notes[:mat] = [ /<mat:(.*)>/i , /<mat limit:(.*)>/i ]
  250. Notes[:mdf] = [ /<mdf:(.*)>/i , /<mdf limit:(.*)>/i ]
  251. Notes[:agi] = [ /<agi:(.*)>/i , /<agi limit:(.*)>/i ]
  252. Notes[:luk] = [ /<luk:(.*)>/i , /<luk limit:(.*)>/i ]
  253. # x-Params :
  254. Notes[:hit] = [ /<hit:(.*)>/i , /<hit limit:(.*)>/i ]
  255. Notes[:eva] = [ /<eva:(.*)>/i , /<eva limit:(.*)>/i ]
  256. Notes[:cri] = [ /<cri:(.*)>/i , /<cri limit:(.*)>/i ]
  257. Notes[:cev] = [ /<cev:(.*)>/i , /<cev limit:(.*)>/i ]
  258. Notes[:mev] = [ /<mev:(.*)>/i , /<mev limit:(.*)>/i ]
  259. Notes[:mrf] = [ /<mrf:(.*)>/i , /<mrf limit:(.*)>/i ]
  260. Notes[:cnt] = [ /<cnt:(.*)>/i , /<cnt limit:(.*)>/i ]
  261. Notes[:hrg] = [ /<hrg:(.*)>/i , /<hrg limit:(.*)>/i ]
  262. Notes[:mrg] = [ /<mrg:(.*)>/i , /<mrg limit:(.*)>/i ]
  263. Notes[:trg] = [ /<trg:(.*)>/i , /<trg limit:(.*)>/i ]
  264. # s-Params :
  265. Notes[:tgr] = [ /<tgr:(.*)>/i , /<tgr limit:(.*)>/i ]
  266. Notes[:grd] = [ /<grd:(.*)>/i , /<grd limit:(.*)>/i ]
  267. Notes[:rec] = [ /<rec:(.*)>/i , /<rec limit:(.*)>/i ]
  268. Notes[:pha] = [ /<pha:(.*)>/i , /<pha limit:(.*)>/i ]
  269. Notes[:mcr] = [ /<mcr:(.*)>/i , /<mcr limit:(.*)>/i ]
  270. Notes[:tcr] = [ /<tcr:(.*)>/i , /<tcr limit:(.*)>/i ]
  271. Notes[:pdr] = [ /<pdr:(.*)>/i , /<pdr limit:(.*)>/i ]
  272. Notes[:mdr] = [ /<mdr:(.*)>/i , /<mdr limit:(.*)>/i ]
  273. Notes[:fdr] = [ /<fdr:(.*)>/i , /<fdr limit:(.*)>/i ]
  274. Notes[:exr] = [ /<exr:(.*)>/i , /<exr limit:(.*)>/i ]
  275.  
  276. end#<< Keep
  277. module Vocab#<< Keep
  278. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  279. # ☆ Vocab Settings
  280. #-----------------------------------------------------------------------------
  281. # This is where you change the text shown when actors level down or
  282. # forget skills, sprintf format.
  283. LevelDown = "%s has fell back to %s %s!"
  284. ForgetSkill = "%s's requirements are no longer met!"
  285.  
  286. #####################
  287. # CUSTOMISATION END #
  288. end #####################
  289. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  290. # #
  291. # http://dekitarpg.wordpress.com/ #
  292. # #
  293. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  294. # The following code is protected under the 2013 Dekita Data Protection Act. #
  295. # Ie. The “Do Not Fucking Look” Law. #
  296. # Breaking This One And Only Rule WILL Result in Me Raping Your USB Port. #
  297. # That is all ! #
  298. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  299. #===============================================================================#
  300. module DataManager
  301. #===============================================================================
  302. #---------------------------------------------------------------------------
  303. # Alias List
  304. #---------------------------------------------------------------------------
  305. class << self
  306. alias :lbd_unique_stats :load_database
  307. end
  308. #---------------------------------------------------------------------------
  309. # Load Database (alias)
  310. #---------------------------------------------------------------------------
  311. def self.load_database
  312. lbd_unique_stats
  313. loa_unique_stats
  314. end
  315. #---------------------------------------------------------------------------
  316. # Load Unique Shit
  317. #---------------------------------------------------------------------------
  318. def self.loa_unique_stats
  319. classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
  320. $data_actors , $data_classes, $data_enemies, $data_states ]
  321. for g in classes
  322. for o in g
  323. next if o == nil
  324. o.load_stat_control
  325. end
  326. end
  327. end
  328.  
  329. end # DataManager
  330.  
  331. #===============================================================================
  332. class RPG::BaseItem
  333. #===============================================================================
  334. #---------------------------------------------------------------------------
  335. # Pi Variables
  336. #---------------------------------------------------------------------------
  337. attr_accessor :pars
  338. attr_accessor :xpars
  339. attr_accessor :spars
  340. attr_accessor :max_pars
  341. attr_accessor :max_spars
  342. attr_accessor :max_xpars
  343. #---------------------------------------------------------------------------
  344. # Load Stat Control
  345. #---------------------------------------------------------------------------
  346. def load_stat_control
  347. @pars = [0] * 8
  348. @xpars = [0] * 10
  349. @spars = [0] * 10
  350. @max_pars = [0] * 8
  351. @max_xpars = [0] * 10
  352. @max_spars = [0] * 10
  353. check_parfixx_notetags
  354. end
  355. #---------------------------------------------------------------------------
  356. # Parse Notes
  357. #---------------------------------------------------------------------------
  358. def check_parfixx_notetags
  359. self.note.split(/[\r\n]+/).each do |line|
  360. case line
  361. when Par_Fixx::Notes[:mhp][0] then @pars[0] = $1.to_i
  362. when Par_Fixx::Notes[:mmp][0] then @pars[1] = $1.to_i
  363. when Par_Fixx::Notes[:atk][0] then @pars[2] = $1.to_i
  364. when Par_Fixx::Notes[:def][0] then @pars[3] = $1.to_i
  365. when Par_Fixx::Notes[:mat][0] then @pars[4] = $1.to_i
  366. when Par_Fixx::Notes[:mdf][0] then @pars[5] = $1.to_i
  367. when Par_Fixx::Notes[:agi][0] then @pars[6] = $1.to_i
  368. when Par_Fixx::Notes[:luk][0] then @pars[7] = $1.to_i
  369. when Par_Fixx::Notes[:hit][0] then @xpars[0] = $1.to_f
  370. when Par_Fixx::Notes[:eva][0] then @xpars[1] = $1.to_f
  371. when Par_Fixx::Notes[:cri][0] then @xpars[2] = $1.to_f
  372. when Par_Fixx::Notes[:cev][0] then @xpars[3] = $1.to_f
  373. when Par_Fixx::Notes[:mev][0] then @xpars[4] = $1.to_f
  374. when Par_Fixx::Notes[:mrf][0] then @xpars[5] = $1.to_f
  375. when Par_Fixx::Notes[:cnt][0] then @xpars[6] = $1.to_f
  376. when Par_Fixx::Notes[:hrg][0] then @xpars[7] = $1.to_f
  377. when Par_Fixx::Notes[:mrg][0] then @xpars[8] = $1.to_f
  378. when Par_Fixx::Notes[:trg][0] then @xpars[9] = $1.to_f
  379. when Par_Fixx::Notes[:tgr][0] then @spars[0] = $1.to_f
  380. when Par_Fixx::Notes[:grd][0] then @spars[1] = $1.to_f
  381. when Par_Fixx::Notes[:rec][0] then @spars[2] = $1.to_f
  382. when Par_Fixx::Notes[:pha][0] then @spars[3] = $1.to_f
  383. when Par_Fixx::Notes[:mcr][0] then @spars[4] = $1.to_f
  384. when Par_Fixx::Notes[:tcr][0] then @spars[5] = $1.to_f
  385. when Par_Fixx::Notes[:pdr][0] then @spars[6] = $1.to_f
  386. when Par_Fixx::Notes[:mdr][0] then @spars[7] = $1.to_f
  387. when Par_Fixx::Notes[:fdr][0] then @spars[8] = $1.to_f
  388. when Par_Fixx::Notes[:exr][0] then @spars[9] = $1.to_f
  389. when Par_Fixx::Notes[:mhp][1] then @max_pars[0] = $1.to_i
  390. when Par_Fixx::Notes[:mmp][1] then @max_pars[1] = $1.to_i
  391. when Par_Fixx::Notes[:atk][1] then @max_pars[2] = $1.to_i
  392. when Par_Fixx::Notes[:def][1] then @max_pars[3] = $1.to_i
  393. when Par_Fixx::Notes[:mat][1] then @max_pars[4] = $1.to_i
  394. when Par_Fixx::Notes[:mdf][1] then @max_pars[5] = $1.to_i
  395. when Par_Fixx::Notes[:agi][1] then @max_pars[6] = $1.to_i
  396. when Par_Fixx::Notes[:luk][1] then @max_pars[7] = $1.to_i
  397. when Par_Fixx::Notes[:hit][1] then @max_xpars[0] = $1.to_f
  398. when Par_Fixx::Notes[:eva][1] then @max_xpars[1] = $1.to_f
  399. when Par_Fixx::Notes[:cri][1] then @max_xpars[2] = $1.to_f
  400. when Par_Fixx::Notes[:cev][1] then @max_xpars[3] = $1.to_f
  401. when Par_Fixx::Notes[:mev][1] then @max_xpars[4] = $1.to_f
  402. when Par_Fixx::Notes[:mrf][1] then @max_xpars[5] = $1.to_f
  403. when Par_Fixx::Notes[:cnt][1] then @max_xpars[6] = $1.to_f
  404. when Par_Fixx::Notes[:hrg][1] then @max_xpars[7] = $1.to_f
  405. when Par_Fixx::Notes[:mrg][1] then @max_xpars[8] = $1.to_f
  406. when Par_Fixx::Notes[:trg][1] then @max_xpars[9] = $1.to_f
  407. when Par_Fixx::Notes[:tgr][1] then @max_spars[0] = $1.to_f
  408. when Par_Fixx::Notes[:grd][1] then @max_spars[1] = $1.to_f
  409. when Par_Fixx::Notes[:rec][1] then @max_spars[2] = $1.to_f
  410. when Par_Fixx::Notes[:pha][1] then @max_spars[3] = $1.to_f
  411. when Par_Fixx::Notes[:mcr][1] then @max_spars[4] = $1.to_f
  412. when Par_Fixx::Notes[:tcr][1] then @max_spars[5] = $1.to_f
  413. when Par_Fixx::Notes[:pdr][1] then @max_spars[6] = $1.to_f
  414. when Par_Fixx::Notes[:mdr][1] then @max_spars[7] = $1.to_f
  415. when Par_Fixx::Notes[:fdr][1] then @max_spars[8] = $1.to_f
  416. when Par_Fixx::Notes[:exr][1] then @max_spars[9] = $1.to_f
  417. end
  418. end
  419. end
  420.  
  421. end # << RPG::BaseItem
  422.  
  423. #===============================================================================
  424. class Game_BattlerBase
  425. #===============================================================================
  426. #--------------------------------------------------------------------------
  427. # Alias List
  428. #--------------------------------------------------------------------------
  429. alias :sd13x_GB_init :initialize
  430. #--------------------------------------------------------------------------
  431. # Initialize Data
  432. #--------------------------------------------------------------------------
  433. def initialize(*a,&b)
  434. clear_xparam_plus
  435. clear_sparam_plus
  436. sd13x_GB_init(*a,&b)
  437. end
  438. #--------------------------------------------------------------------------
  439. # Get Reduced Value of Parameter
  440. #--------------------------------------------------------------------------
  441. def param_min(param_id)
  442. case param_id
  443. when 0 then return Par_Fixx::Stats[:mhp][0]
  444. when 1 then return Par_Fixx::Stats[:mmp][0]
  445. when 2 then return Par_Fixx::Stats[:atk][0]
  446. when 3 then return Par_Fixx::Stats[:def][0]
  447. when 4 then return Par_Fixx::Stats[:mat][0]
  448. when 5 then return Par_Fixx::Stats[:mdf][0]
  449. when 6 then return Par_Fixx::Stats[:agi][0]
  450. when 7 then return Par_Fixx::Stats[:luk][0]
  451. end
  452. end
  453. #--------------------------------------------------------------------------
  454. # Get Maximum Value of Parameter
  455. #--------------------------------------------------------------------------
  456. def param_max(param_id)
  457. case param_id
  458. when 0 then return Par_Fixx::Stats[:mhp][1]
  459. when 1 then return Par_Fixx::Stats[:mmp][1]
  460. when 2 then return Par_Fixx::Stats[:atk][1]
  461. when 3 then return Par_Fixx::Stats[:def][1]
  462. when 4 then return Par_Fixx::Stats[:mat][1]
  463. when 5 then return Par_Fixx::Stats[:mdf][1]
  464. when 6 then return Par_Fixx::Stats[:agi][1]
  465. when 7 then return Par_Fixx::Stats[:luk][1]
  466. end
  467. end
  468. #--------------------------------------------------------------------------
  469. # Add To Parameter
  470. #--------------------------------------------------------------------------
  471. def add_param(param_id, value, ref = true)
  472. @param_plus[param_id] += value
  473. refresh if ref
  474. end
  475. #--------------------------------------------------------------------------
  476. # Subtract from Parameter
  477. #--------------------------------------------------------------------------
  478. def sub_param(param_id, value, ref = true)
  479. @param_plus[param_id] -= value
  480. refresh if ref
  481. end
  482. #--------------------------------------------------------------------------
  483. # Divide Parameter By Value
  484. #--------------------------------------------------------------------------
  485. def div_param(param_id, value, ref = true)
  486. @param_plus[param_id] /= value
  487. refresh if ref
  488. end
  489. #--------------------------------------------------------------------------
  490. # Multiply Parameter By Value
  491. #--------------------------------------------------------------------------
  492. def mul_param(param_id, value, ref = true)
  493. @param_plus[param_id] *= value
  494. refresh if ref
  495. end
  496. #--------------------------------------------------------------------------
  497. # Divide Parameter By Value
  498. #--------------------------------------------------------------------------
  499. def mod_param(param_id, value, ref = true)
  500. @param_plus[param_id] %= value
  501. refresh if ref
  502. end
  503. #--------------------------------------------------------------------------
  504. # Get Min Value of xParameter
  505. #--------------------------------------------------------------------------
  506. def xparam_min(xparam_id)
  507. case xparam_id
  508. when 0 then return Par_Fixx::Stats[:hit][0]
  509. when 1 then return Par_Fixx::Stats[:eva][0]
  510. when 2 then return Par_Fixx::Stats[:cri][0]
  511. when 3 then return Par_Fixx::Stats[:cev][0]
  512. when 4 then return Par_Fixx::Stats[:mev][0]
  513. when 5 then return Par_Fixx::Stats[:mrf][0]
  514. when 6 then return Par_Fixx::Stats[:cnt][0]
  515. when 7 then return Par_Fixx::Stats[:hrg][0]
  516. when 8 then return Par_Fixx::Stats[:mrg][0]
  517. when 9 then return Par_Fixx::Stats[:trg][0]
  518. end
  519. end
  520. #--------------------------------------------------------------------------
  521. # Get Maximum Value of xParameter
  522. #--------------------------------------------------------------------------
  523. def xparam_max(xparam_id)
  524. case xparam_id
  525. when 0 then return Par_Fixx::Stats[:hit][1]
  526. when 1 then return Par_Fixx::Stats[:eva][1]
  527. when 2 then return Par_Fixx::Stats[:cri][1]
  528. when 3 then return Par_Fixx::Stats[:cev][1]
  529. when 4 then return Par_Fixx::Stats[:mev][1]
  530. when 5 then return Par_Fixx::Stats[:mrf][1]
  531. when 6 then return Par_Fixx::Stats[:cnt][1]
  532. when 7 then return Par_Fixx::Stats[:hrg][1]
  533. when 8 then return Par_Fixx::Stats[:mrg][1]
  534. when 9 then return Par_Fixx::Stats[:trg][1]
  535. end
  536. end
  537. #--------------------------------------------------------------------------
  538. # Get Base xParam Value (from features)
  539. #--------------------------------------------------------------------------
  540. def xparam_base(xparam_id)
  541. features_sum(FEATURE_XPARAM, xparam_id)
  542. end
  543. #--------------------------------------------------------------------------
  544. # Get Real xParam Value
  545. #--------------------------------------------------------------------------
  546. def xparam(xpar_id)
  547. val = (xparam_base(xpar_id) + xparam_plus(xpar_id))
  548. [[val, xparam_max(xpar_id)].min, xparam_min(xpar_id)].max.to_f
  549. end
  550. #--------------------------------------------------------------------------
  551. # xParam Plus
  552. #--------------------------------------------------------------------------
  553. def xparam_plus(xparam_id)
  554. @xparam_plus[xparam_id]
  555. end
  556. #--------------------------------------------------------------------------
  557. # Clear xParam Plus
  558. #--------------------------------------------------------------------------
  559. def clear_xparam_plus
  560. @xparam_plus = [0] * 10
  561. end
  562. #--------------------------------------------------------------------------
  563. # Add xParam
  564. #--------------------------------------------------------------------------
  565. def add_xparam(xparam_id, value, ref = true)
  566. @xparam_plus[xparam_id] += value
  567. refresh if ref
  568. end
  569. #--------------------------------------------------------------------------
  570. # Sub xParam
  571. #--------------------------------------------------------------------------
  572. def sub_xparam(xparam_id, value, ref = true)
  573. @xparam_plus[xparam_id] -= value
  574. refresh if ref
  575. end
  576. #--------------------------------------------------------------------------
  577. # Div xParam
  578. #--------------------------------------------------------------------------
  579. def div_xparam(xparam_id, value, ref = true)
  580. @xparam_plus[xparam_id] /= value
  581. refresh if ref
  582. end
  583. #--------------------------------------------------------------------------
  584. # Mul xParam
  585. #--------------------------------------------------------------------------
  586. def mul_xparam(xparam_id, value, ref = true)
  587. @xparam_plus[xparam_id] *= value
  588. refresh if ref
  589. end
  590. #--------------------------------------------------------------------------
  591. # Mod xParam
  592. #--------------------------------------------------------------------------
  593. def mod_xparam(xparam_id, value, ref = true)
  594. @xparam_plus[xparam_id] %= value
  595. refresh if ref
  596. end
  597. #--------------------------------------------------------------------------
  598. # Get Min Value of sParameter
  599. #--------------------------------------------------------------------------
  600. def sparam_min(sparam_id)
  601. case sparam_id
  602. when 0 then return Par_Fixx::Stats[:tgr][0]
  603. when 1 then return Par_Fixx::Stats[:grd][0]
  604. when 2 then return Par_Fixx::Stats[:rec][0]
  605. when 3 then return Par_Fixx::Stats[:pha][0]
  606. when 4 then return Par_Fixx::Stats[:mcr][0]
  607. when 5 then return Par_Fixx::Stats[:tcr][0]
  608. when 6 then return Par_Fixx::Stats[:pdr][0]
  609. when 7 then return Par_Fixx::Stats[:mdr][0]
  610. when 8 then return Par_Fixx::Stats[:fdr][0]
  611. when 9 then return Par_Fixx::Stats[:exr][0]
  612. end
  613. end
  614. #--------------------------------------------------------------------------
  615. # Get Maximum Value of xParameter
  616. #--------------------------------------------------------------------------
  617. def sparam_max(sparam_id)
  618. case sparam_id
  619. when 0 then return Par_Fixx::Stats[:tgr][1]
  620. when 1 then return Par_Fixx::Stats[:grd][1]
  621. when 2 then return Par_Fixx::Stats[:rec][1]
  622. when 3 then return Par_Fixx::Stats[:pha][1]
  623. when 4 then return Par_Fixx::Stats[:mcr][1]
  624. when 5 then return Par_Fixx::Stats[:tcr][1]
  625. when 6 then return Par_Fixx::Stats[:pdr][1]
  626. when 7 then return Par_Fixx::Stats[:mdr][1]
  627. when 8 then return Par_Fixx::Stats[:fdr][1]
  628. when 9 then return Par_Fixx::Stats[:exr][1]
  629. end
  630. end
  631. #--------------------------------------------------------------------------
  632. # Get Base sParam Value (from features)
  633. #--------------------------------------------------------------------------
  634. def sparam_base(sparam_id)
  635. features_pi(FEATURE_SPARAM, sparam_id)
  636. end
  637. #--------------------------------------------------------------------------
  638. # Get Real sParam Value
  639. #--------------------------------------------------------------------------
  640. def sparam(spar_id)
  641. val = (sparam_base(spar_id) + sparam_plus(spar_id))
  642. [[val, sparam_max(spar_id)].min, sparam_min(spar_id)].max.to_f
  643. end
  644. #--------------------------------------------------------------------------
  645. # sParam Plus
  646. #--------------------------------------------------------------------------
  647. def sparam_plus(sparam_id)
  648. @sparam_plus[sparam_id]
  649. end
  650. #--------------------------------------------------------------------------
  651. # Clear sParam Plus
  652. #--------------------------------------------------------------------------
  653. def clear_sparam_plus
  654. @sparam_plus = [0] * 10
  655. end
  656. #--------------------------------------------------------------------------
  657. # Add sParam Plus
  658. #--------------------------------------------------------------------------
  659. def add_sparam(sparam_id, value, ref = true)
  660. @sparam_plus[sparam_id] += value
  661. refresh if ref
  662. end
  663. #--------------------------------------------------------------------------
  664. # Sub sParam
  665. #--------------------------------------------------------------------------
  666. def sub_sparam(sparam_id, value, ref = true)
  667. @sparam_plus[sparam_id] -= value
  668. refresh if ref
  669. end
  670. #--------------------------------------------------------------------------
  671. # Div sParam
  672. #--------------------------------------------------------------------------
  673. def div_sparam(sparam_id, value, ref = true)
  674. @sparam_plus[sparam_id] /= value
  675. refresh if ref
  676. end
  677. #--------------------------------------------------------------------------
  678. # Mul sParam
  679. #--------------------------------------------------------------------------
  680. def mul_sparam(sparam_id, value, ref = true)
  681. @sparam_plus[sparam_id] *= value
  682. refresh if ref
  683. end
  684. #--------------------------------------------------------------------------
  685. # Mod sParam
  686. #--------------------------------------------------------------------------
  687. def mod_sparam(sparam_id, value, ref = true)
  688. @sparam_plus[sparam_id] %= value
  689. refresh if ref
  690. end
  691.  
  692. end # << Game_BattlerBase
  693.  
  694. #===============================================================================
  695. class Game_Actor < Game_Battler
  696. #===============================================================================
  697. #--------------------------------------------------------------------------
  698. # Alias List
  699. #--------------------------------------------------------------------------
  700. alias :change_exp_sD13x :change_exp
  701. #--------------------------------------------------------------------------
  702. # Change Experience | show : Level up display flag
  703. #--------------------------------------------------------------------------
  704. def change_exp(exp, show)
  705. inf = [@level, skills]
  706. change_exp_sD13x(exp, show)
  707. deki_change_exp(inf)
  708. end
  709. #--------------------------------------------------------------------------
  710. # Change Experience | (Level Down display)
  711. #--------------------------------------------------------------------------
  712. def deki_change_exp(i)
  713. return unless Par_Fixx::Show_Level_Down
  714. return unless i[0] > @level
  715. display_level_down( i[1] - skills )
  716. refresh
  717. end
  718. #--------------------------------------------------------------------------
  719. # * Show Level Down Message | old_skills : Array of forgotten skills
  720. #--------------------------------------------------------------------------
  721. def display_level_down(old_skills)
  722. $game_message.new_page
  723. $game_message.add(sprintf(Vocab::LevelDown, @name, Vocab::level, @level))
  724. old_skills.each do |skill|
  725. $game_message.add(sprintf(Vocab::ForgetSkill, skill.name))
  726. end
  727. end
  728. #--------------------------------------------------------------------------
  729. # Level Up (overwrite)
  730. #--------------------------------------------------------------------------
  731. def level_up
  732. increase_level
  733. determine_stat_inc_type if $D13x[:Dev_SLUD]
  734. lv_up_learn_skill
  735. end
  736. #--------------------------------------------------------------------------
  737. # Increase level
  738. #--------------------------------------------------------------------------
  739. def increase_level
  740. @level += 1
  741. end
  742. #--------------------------------------------------------------------------
  743. # Initialize Skills
  744. #--------------------------------------------------------------------------
  745. def init_skills
  746. @skills = []
  747. @skills_list = []
  748. self.class.learnings.each do |lning|
  749. learn_skill(lning.skill_id) if learn_skill_conditions_met?(lning)
  750. end
  751. end
  752. #--------------------------------------------------------------------------
  753. # Level Up Learn Skill
  754. #--------------------------------------------------------------------------
  755. def lv_up_learn_skill
  756. self.class.learnings.each do |lning|
  757. learn_skill(lning.skill_id) if learn_skill_conditions_met?(lning)
  758. end
  759. end
  760. #--------------------------------------------------------------------------
  761. # Level Down (overwrite)
  762. #--------------------------------------------------------------------------
  763. def level_down
  764. reduce_level
  765. lv_down_extra
  766. end
  767. #--------------------------------------------------------------------------
  768. # Reduce Level
  769. #--------------------------------------------------------------------------
  770. def reduce_level
  771. @level -= 1
  772. end
  773. #--------------------------------------------------------------------------
  774. # Level Down Extra Shit
  775. #--------------------------------------------------------------------------
  776. def lv_down_extra
  777. end
  778. #--------------------------------------------------------------------------
  779. # Get Learning Skill Conditions
  780. #--------------------------------------------------------------------------
  781. def learn_skill_conditions_met?(learning, mult = 1.0)
  782. return false if @level < (learning.level * mult).to_i
  783. return false if @skills_list.include?(learning.skill_id)
  784. return true
  785. end
  786. #--------------------------------------------------------------------------
  787. # Param Max
  788. #--------------------------------------------------------------------------
  789. def param_max(param_id)
  790. base = super
  791. base += actor.max_pars[param_id]
  792. base += self.class.max_pars[param_id]
  793. base += equips.compact.inject(0) {|r, i| r += i.max_pars[param_id] }
  794. base += states.compact.inject(0) {|r, i| r += i.max_pars[param_id] }
  795. if $D13x[:Skill_Lv]
  796. base += skills.compact.inject(0) {|r, i| r += (i.max_pars[param_id]*
  797. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_i}
  798. else
  799. base += skills.compact.inject(0) {|r, i| r += i.max_pars[param_id] }
  800. end
  801. base
  802. end
  803. #--------------------------------------------------------------------------
  804. # Param Plus
  805. #--------------------------------------------------------------------------
  806. def param_plus(param_id)
  807. base = super
  808. base += actor.pars[param_id]
  809. base += self.class.pars[param_id]
  810. base += equips.compact.inject(0) {|r, i| r += (i.pars[param_id]+i.params[param_id])}
  811. base += states.compact.inject(0) {|r, i| r += i.pars[param_id] }
  812. if $D13x[:Skill_Lv]
  813. base += skills.compact.inject(0) {|r, i| r += (i.pars[param_id]*
  814. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_i}
  815. else
  816. base += skills.compact.inject(0) {|r, i| r += i.pars[param_id] }
  817. end
  818. base
  819. end
  820. #--------------------------------------------------------------------------
  821. # xParam Max
  822. #--------------------------------------------------------------------------
  823. def xparam_max(xparam_id)
  824. base = super
  825. base += actor.max_xpars[xparam_id]
  826. base += self.class.max_xpars[xparam_id]
  827. base += equips.compact.inject(0) {|r, i| r += i.max_xpars[xparam_id] }
  828. base += states.compact.inject(0) {|r, i| r += i.max_xpars[xparam_id] }
  829. if $D13x[:Skill_Lv]
  830. base += skills.compact.inject(0) {|r, i| r += (i.max_xpars[xparam_id]*
  831. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  832. else
  833. base += skills.compact.inject(0) {|r, i| r += i.max_xpars[xparam_id] }
  834. end
  835. base
  836. end
  837. #--------------------------------------------------------------------------
  838. # xParam Plus
  839. #--------------------------------------------------------------------------
  840. def xparam_plus(xparam_id)
  841. base = super
  842. base += actor.xpars[xparam_id]
  843. base += self.class.xpars[xparam_id]
  844. base += equips.compact.inject(0) {|r, i| r += i.xpars[xparam_id] }
  845. base += states.compact.inject(0) {|r, i| r += i.xpars[xparam_id] }
  846. if $D13x[:Skill_Lv]
  847. base += skills.compact.inject(0) {|r, i| r += (i.xpars[xparam_id]*
  848. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  849. else
  850. base += skills.compact.inject(0) {|r, i| r += i.xpars[xparam_id] }
  851. end
  852. base
  853. end
  854. #--------------------------------------------------------------------------
  855. # sParam Max
  856. #--------------------------------------------------------------------------
  857. def sparam_max(sparam_id)
  858. base = super
  859. base += actor.max_spars[sparam_id]
  860. base += self.class.max_spars[sparam_id]
  861. base += equips.compact.inject(0) {|r, i| r += i.max_spars[sparam_id] }
  862. base += states.compact.inject(0) {|r, i| r += i.max_spars[sparam_id] }
  863. if $D13x[:Skill_Lv]
  864. base += skills.compact.inject(0) {|r, i| r += (i.max_spars[sparam_id]*
  865. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  866. else
  867. base += skills.compact.inject(0) {|r, i| r += i.max_spars[sparam_id] }
  868. end
  869. base
  870. end
  871. #--------------------------------------------------------------------------
  872. # sParam Plus
  873. #--------------------------------------------------------------------------
  874. def sparam_plus(sparam_id)
  875. base = super
  876. base += actor.spars[sparam_id]
  877. base += self.class.spars[sparam_id]
  878. base += equips.compact.inject(0) {|r, i| r += i.spars[sparam_id] }
  879. base += states.compact.inject(0) {|r, i| r += i.spars[sparam_id] }
  880. if $D13x[:Skill_Lv]
  881. base += skills.compact.inject(0) {|r, i| r += (i.spars[sparam_id]*
  882. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  883. else
  884. base += skills.compact.inject(0) {|r, i| r += i.spars[sparam_id] }
  885. end
  886. base
  887. end
  888.  
  889. end # << Game_Actor
  890.  
  891. #===============================================================================
  892. class Game_Enemy < Game_Battler
  893. #===============================================================================
  894. #--------------------------------------------------------------------------
  895. # Param Max
  896. #--------------------------------------------------------------------------
  897. def param_max(param_id)
  898. base = super
  899. base += enemy.max_pars[param_id]
  900. base += states.compact.inject(0) {|r, i| r += i.max_pars[param_id] }
  901. base
  902. end
  903. #--------------------------------------------------------------------------
  904. # Param Plus
  905. #--------------------------------------------------------------------------
  906. def param_plus(param_id)
  907. base = super
  908. base += enemy.pars[param_id]
  909. base += states.compact.inject(0) {|r, i| r += i.pars[param_id] }
  910. base
  911. end
  912. #--------------------------------------------------------------------------
  913. # xParam Max
  914. #--------------------------------------------------------------------------
  915. def xparam_max(xparam_id)
  916. base = super
  917. base += enemy.max_xpars[xparam_id]
  918. base += states.compact.inject(0) {|r, i| r += i.max_xpars[xparam_id] }
  919. base
  920. end
  921. #--------------------------------------------------------------------------
  922. # xParam Plus
  923. #--------------------------------------------------------------------------
  924. def xparam_plus(xparam_id)
  925. base = super
  926. base += enemy.xpars[xparam_id]
  927. base += states.compact.inject(0) {|r, i| r += i.xpars[xparam_id] }
  928. base
  929. end
  930. #--------------------------------------------------------------------------
  931. # sParam Max
  932. #--------------------------------------------------------------------------
  933. def sparam_max(sparam_id)
  934. base = super
  935. base += enemy.max_spars[sparam_id]
  936. base += states.compact.inject(0) {|r, i| r += i.max_spars[sparam_id] }
  937. base
  938. end
  939. #--------------------------------------------------------------------------
  940. # sParam Plus
  941. #--------------------------------------------------------------------------
  942. def sparam_plus(sparam_id)
  943. base = super
  944. base += enemy.spars[sparam_id]
  945. base += states.compact.inject(0) {|r, i| r += i.spars[sparam_id] }
  946. base
  947. end
  948.  
  949. end # << Game_Enemy
  950.  
  951. #==============================================================================#
  952. # http://dekitarpg.wordpress.com/ #
  953. #==============================================================================#
  954. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement