Advertisement
Dekita

$D13x Statistic Control v1.6

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