Advertisement
Dekita

$D13x Stat Control 1.1

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