Advertisement
Dekita

$D13x Stat Control 1.2

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