Advertisement
Dekita

$D13x Stat Control 1.3

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