Advertisement
Dekita

$D13x Stat Control 1.0

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