Advertisement
Dekita

Elemental Control v1.4

Mar 15th, 2014
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.87 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Elemental Control
  5. # -- Author : Dekita
  6. # -- Version : 1.4
  7. # -- Level : Easy / Normal
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Elems_Control]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 15/o3/2o14 - Fixed small bug with max attack elements,
  21. # o2/o3/2o14 - Fixed small bug with max attack elements,
  22. # 31/o5/2o13 - Added More Script Call Help Information.
  23. # 26/o3/2o13 - Finished,
  24. # - Fixed Typos,
  25. # 23/o3/2o13 - Started,
  26. #
  27. #===============================================================================
  28. # ☆ Introduction
  29. #-------------------------------------------------------------------------------
  30. # This script is the Elemental Equivalent of my Statistic Control Script.
  31. # This script 'fixes' elements, ie. differentiates between attack and defence
  32. # element types.
  33. # This script also allows Dev's control over elements that would not normally
  34. # be available, such as various script calls to modify the element value
  35. # using simple arithmatic (add/subtract/divide/multiply/modulo),
  36. # As well as actors/classes/enemies/weapons/armors/states/skills notetags.
  37. #
  38. # It also adds Max and Min limits for all elements and gives control over these
  39. # new limitations for both attack and defence.
  40. #
  41. # It also provides new ways of handling the elemental damage modification.
  42. # ie, allows for multiple element damage variances, rather than 1.
  43. #
  44. # Note :
  45. # Elements still work with percentage values, ie 0.01 is 1%, 1.0 is 100%
  46. #
  47. #===============================================================================
  48. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  49. #===============================================================================
  50. # 1. You MUST give credit to "Dekita" !!
  51. # 2. You are NOT allowed to repost this script.(or modified versions)
  52. # 3. You are NOT allowed to convert this script.
  53. # 4. You are NOT allowed to use this script for Commercial games.
  54. # 5. ENJOY!
  55. #
  56. # "FINE PRINT"
  57. # By using this script you hereby agree to the above terms and conditions,
  58. # if any violation of the above terms occurs "legal action" may be taken.
  59. # Not understanding the above terms and conditions does NOT mean that
  60. # they do not apply to you.
  61. # If you wish to discuss the terms and conditions in further detail you can
  62. # contact me at http://dekitarpg.wordpress.com/
  63. #
  64. #===============================================================================
  65. # ☆ Instructions
  66. #-------------------------------------------------------------------------------
  67. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  68. #
  69. #===============================================================================
  70. # ☆ Script Calls
  71. #-------------------------------------------------------------------------------
  72. # $game_actor[id].add_def_ele(element_id, value)
  73. # $game_actor[id].sub_def_ele(element_id, value)
  74. # $game_actor[id].mul_def_ele(element_id, value)
  75. # $game_actor[id].div_def_ele(element_id, value)
  76. # $game_actor[id].mod_def_ele(element_id, value)
  77. #
  78. # $game_actor[id].add_atk_ele(element_id, value)
  79. # $game_actor[id].sub_atk_ele(element_id, value)
  80. # $game_actor[id].mul_atk_ele(element_id, value)
  81. # $game_actor[id].div_atk_ele(element_id, value)
  82. # $game_actor[id].mod_atk_ele(element_id, value)
  83. #
  84. # id = the actors database id
  85. # element_id = the elements database id
  86. # value = the value you with to modify the element with
  87. #
  88. # these are the calculatons for each control type
  89. # add : current stat += value
  90. # sub : current stat -= value
  91. # div : current stat /= value
  92. # mul : current stat *= value
  93. # mod : current stat %= value
  94. #
  95. # These script calls modify the Actor value, other items remain in the same order.
  96. #
  97. # BIG NOTE ::
  98. # By default in Vx Ace the starting element defence is 1.0, this is because the
  99. # calculation is 1.0 * element defence (eg 1.0) which makes the damage normal
  100. # (normal = no resist or weakness) this means, if your elemental defence is 2.0
  101. # you will take 2.0* the damage from elements.
  102. # This means in order to INCREASE your resistance towards a peticular element
  103. # you must REDUCE the defencive element.
  104. # eg.
  105. # add = more elemental damage intake
  106. # sub = less elemental damage intake
  107. #
  108. # Attack elements work as you would expect.
  109. # eg.
  110. # add = more elemental attack value
  111. # sub = less elemental attack value
  112. #
  113. # There is also a third arguement for all the above script calls,
  114. # it is a boolean arguement to determine if the player should be refreshed.
  115. # eg.. $game_actors[1].add_atk_ele(3, 0.05, false)
  116. # this is very helpfull for maintaining FPS when adding LOTS of stats..
  117. # The default to this arguemet is true.
  118. # If you don't understand what this mean, just disregard this information :)
  119. #
  120. #===============================================================================
  121. # ☆ Notetags ( default )
  122. # For use with Weapons / Armors / Enemies / Actors / Classes / States / Skills
  123. #-------------------------------------------------------------------------------
  124. # <atk ele: element_id, value>
  125. # <def ele: element_id, value>
  126. # <max atk ele: element_id, value>
  127. # <max def ele: element_id, value>
  128. #
  129. # element_id = The Element ID from the database
  130. # value = the value you wish to change the element by
  131. #
  132. #-------------------------------------------------------------------------------
  133. # For Skills / Items
  134. #-------------------------------------------------------------------------------
  135. # <no ele mod>
  136. # Will make the skill / item have no elemental modification when used.
  137. #
  138. #===============================================================================
  139. # ☆ HELP
  140. #-------------------------------------------------------------------------------
  141. # Remember :
  142. # All Elemental Values work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01
  143. # 1.0 = 100%, 0.01 = 1%,
  144. #
  145. # Also, element id numbers can be found in the database.
  146. #
  147. #===============================================================================
  148. module Ele_Fixx
  149. #===============================================================================
  150. Element={0=>{:atk_ele=>[0,1],:def_ele=>[0,1]}}# << KEEP !!
  151. Notes={}# << Keep
  152. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  153. # ☆ Calculation Settings
  154. #--------------------------------------------------------------------------
  155. # This is where you set how the script calculates elemental damage
  156. # Types :
  157. # 0 = Will take the max element modifier as the damage multiplication
  158. # This is also the Vx Ace Default Calculation.
  159. # This will make even the smallest attack elemental modifier count as full
  160. # elemental attack.
  161. #
  162. # 1 = Will calculate only weak and resisted elements, then adds/subtracts
  163. # Them accordingly and adds them onto the default attack for a total
  164. # calculation. (positive or negative)
  165. # RECOMMENDED TYPE.
  166. #
  167. # 2 = Will add each elemental modifier together for the damage multiplication
  168. # This Is An Experimental Calculation ;p
  169. #
  170. # 3 = Will take the average modifier for the damage calculation
  171. # This Is Another Experimental Calculation ;p
  172. #--------------------------------------------------------------------------
  173. DMG_Type = 1
  174.  
  175. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  176. # ☆ Limit Settings
  177. #--------------------------------------------------------------------------
  178. # This is where you adjust the settings for the base min and max values
  179. # used for actors / enemies.
  180. #--------------------------------------------------------------------------
  181. #Element[id]={ :atk_ele => [ Min , Max ], :def_ele => [ Min , Max ]}
  182. Element[1] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  183. Element[2] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  184. Element[3] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  185. Element[4] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  186. Element[5] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  187. Element[6] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  188. Element[7] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  189. Element[8] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  190. Element[9] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  191. Element[10]= { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  192. # << Add more rows here if you have more than 10
  193. # elements in your project :)
  194. # Follow the same format as above, ie Element[ id ] = [ Min , Max ]
  195.  
  196. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  197. # ☆ Notetag Settings
  198. #--------------------------------------------------------------------------
  199. # This is where you adjust the settings for the notetags used in all
  200. # notetaggable items.
  201. # Only modify these if you understand how to.
  202. #--------------------------------------------------------------------------
  203. Notes[:atk_ele] = /<atk ele:(.*),(.*)>/i
  204. Notes[:def_ele] = /<def ele:(.*),(.*)>/i
  205. Notes[:max_atk_ele] = /<max atk ele:(.*),(.*)>/i
  206. Notes[:max_def_ele] = /<max def ele:(.*),(.*)>/i
  207. Notes[:no_element] = /<no ele mod>/i
  208.  
  209. end #####################
  210. # CUSTOMISATION END #
  211. #####################
  212. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  213. # #
  214. # http://dekitarpg.wordpress.com/ #
  215. # #
  216. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  217. #===============================================================================#
  218. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  219. # YES?\.\. #
  220. # OMG, REALLY? \| #
  221. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  222. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  223. #===============================================================================#
  224. module DataManager
  225. #===============================================================================
  226. #---------------------------------------------------------------------------
  227. # Alias List
  228. #---------------------------------------------------------------------------
  229. class << self
  230. alias :lbd_elef_element :load_database
  231. end
  232. #---------------------------------------------------------------------------
  233. # Load Database (alias)
  234. #---------------------------------------------------------------------------
  235. def self.load_database
  236. lbd_elef_element
  237. loa_elef_element
  238. end
  239. #---------------------------------------------------------------------------
  240. # Load Unique Elemental Shit
  241. #---------------------------------------------------------------------------
  242. def self.loa_elef_element
  243. classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
  244. $data_actors , $data_classes, $data_enemies, $data_states ]
  245. for g in classes
  246. for o in g
  247. next if o == nil
  248. o.load_elemental_control
  249. end
  250. end
  251. end
  252.  
  253. end # DataManager
  254.  
  255. #===============================================================================
  256. class RPG::BaseItem
  257. #===============================================================================
  258. #---------------------------------------------------------------------------
  259. # Pi Variables
  260. #---------------------------------------------------------------------------
  261. attr_accessor :atk_ele
  262. attr_accessor :def_ele
  263. attr_accessor :max_atk_ele
  264. attr_accessor :max_def_ele
  265. #---------------------------------------------------------------------------
  266. # Load Elemental Control
  267. #---------------------------------------------------------------------------
  268. def load_elemental_control
  269. @atk_ele = [0] * $data_system.elements.size
  270. @def_ele = [0] * $data_system.elements.size
  271. @max_atk_ele = [0] * $data_system.elements.size
  272. @max_def_ele = [0] * $data_system.elements.size
  273. check_elefixx_notetags
  274. end
  275. #---------------------------------------------------------------------------
  276. # Parse Notes
  277. #---------------------------------------------------------------------------
  278. def check_elefixx_notetags
  279. self.note.split(/[\r\n]+/).each do |line|
  280. case line
  281. when Ele_Fixx::Notes[:atk_ele] then @atk_ele[$1.to_i] = $2.to_f
  282. when Ele_Fixx::Notes[:def_ele] then @def_ele[$1.to_i] = $2.to_f
  283. when Ele_Fixx::Notes[:max_atk_ele] then @max_atk_ele[$1.to_i] = $2.to_f
  284. when Ele_Fixx::Notes[:max_def_ele] then @max_def_ele[$1.to_i] = $2.to_f
  285. end
  286. end
  287. end
  288.  
  289. end # << RPG::BaseItem
  290.  
  291. #===============================================================================
  292. class RPG::UsableItem < RPG::BaseItem
  293. #===============================================================================
  294. #---------------------------------------------------------------------------
  295. # Pi Variables
  296. #---------------------------------------------------------------------------
  297. attr_accessor :no_ele_mod
  298. #---------------------------------------------------------------------------
  299. # Load Elemental Control
  300. #---------------------------------------------------------------------------
  301. def load_elemental_control
  302. super
  303. @no_ele_mod = false
  304. check_elefixx_notetags
  305. end
  306. #---------------------------------------------------------------------------
  307. # Parse Notes
  308. #---------------------------------------------------------------------------
  309. def check_elefixx_notetags
  310. super
  311. self.note.split(/[\r\n]+/).each do |line|
  312. case line
  313. when Ele_Fixx::Notes[:no_element]
  314. @no_ele_mod = true
  315. end
  316. end
  317. end
  318.  
  319. end # << RPG::BaseItem
  320.  
  321. #===============================================================================
  322. class Game_BattlerBase
  323. #===============================================================================
  324. #--------------------------------------------------------------------------
  325. # Alias List
  326. #--------------------------------------------------------------------------
  327. alias :sd13x_GB_elems :initialize
  328. #--------------------------------------------------------------------------
  329. # Initialize Data
  330. #--------------------------------------------------------------------------
  331. def initialize(*a,&b)
  332. clear_def_ele_plus
  333. clear_atk_ele_plus
  334. sd13x_GB_elems(*a,&b)
  335. end
  336. #--------------------------------------------------------------------------
  337. # Get Attack Element || Old Method >> features_set(FEATURE_ATK_ELEMENT)
  338. #--------------------------------------------------------------------------
  339. def atk_elements
  340. a = []
  341. $data_system.elements.size.times do |i|
  342. e = atk_element_rate(i)
  343. a << i if e != 0.0
  344. end
  345. a
  346. end
  347. #--------------------------------------------------------------------------
  348. # Get Min Value of Defencive Elements
  349. #--------------------------------------------------------------------------
  350. def def_ele_min(element_id)
  351. return Ele_Fixx::Element[element_id][:def_ele][0]
  352. end
  353. #--------------------------------------------------------------------------
  354. # Get Maximum Value of Defencive Elements
  355. #--------------------------------------------------------------------------
  356. def def_ele_max(element_id)
  357. return Ele_Fixx::Element[element_id][:def_ele][1]
  358. end
  359. #--------------------------------------------------------------------------
  360. # Get Base Element Rate
  361. #--------------------------------------------------------------------------
  362. def def_ele_base(element_id)
  363. features_pi(FEATURE_ELEMENT_RATE, element_id)
  364. end
  365. #--------------------------------------------------------------------------
  366. # Get Real Defencive Element Rate
  367. #--------------------------------------------------------------------------
  368. def element_rate(element_id)
  369. val = ( def_ele_base(element_id) + def_ele_plus(element_id) )
  370. [[val, def_ele_max(element_id)].min, def_ele_min(element_id)].max.to_f
  371. end
  372. #--------------------------------------------------------------------------
  373. # Defencive Elements Plus
  374. #--------------------------------------------------------------------------
  375. def def_ele_plus(element_id)
  376. @def_ele_plus[element_id]
  377. end
  378. #--------------------------------------------------------------------------
  379. # Clear Defencive Elements Plus
  380. #--------------------------------------------------------------------------
  381. def clear_def_ele_plus
  382. @def_ele_plus = [0] * $data_system.elements.size
  383. end
  384. #--------------------------------------------------------------------------
  385. # Add Defencive Elements
  386. #--------------------------------------------------------------------------
  387. def add_def_ele(element_id, value, ref = true)
  388. @def_ele_plus[element_id] += value
  389. refresh if ref
  390. end
  391. #--------------------------------------------------------------------------
  392. # Sub Defencive Elements
  393. #--------------------------------------------------------------------------
  394. def sub_def_ele(element_id, value, ref = true)
  395. @def_ele_plus[element_id] -= value
  396. refresh if ref
  397. end
  398. #--------------------------------------------------------------------------
  399. # Div Defencive Elements
  400. #--------------------------------------------------------------------------
  401. def div_def_ele(element_id, value, ref = true)
  402. @def_ele_plus[element_id] /= value
  403. refresh if ref
  404. end
  405. #--------------------------------------------------------------------------
  406. # Mul Defencive Elements
  407. #--------------------------------------------------------------------------
  408. def mul_def_ele(element_id, value, ref = true)
  409. @def_ele_plus[element_id] *= value
  410. refresh if ref
  411. end
  412. #--------------------------------------------------------------------------
  413. # Mod Defencive Elements
  414. #--------------------------------------------------------------------------
  415. def mod_def_ele(element_id, value, ref = true)
  416. @def_ele_plus[element_id] %= value
  417. refresh if ref
  418. end
  419. #--------------------------------------------------------------------------
  420. # Get Min Value of Attack Elements
  421. #--------------------------------------------------------------------------
  422. def atk_ele_min(element_id)
  423. return Ele_Fixx::Element[element_id][:atk_ele][0]
  424. end
  425. #--------------------------------------------------------------------------
  426. # Get Maximum Value of Attack Elements
  427. #--------------------------------------------------------------------------
  428. def atk_ele_max(element_id)
  429. return Ele_Fixx::Element[element_id][:atk_ele][1]
  430. end
  431. #--------------------------------------------------------------------------
  432. # Get Base Attack Element Rate
  433. #--------------------------------------------------------------------------
  434. def atk_ele_base(element_id)
  435. features_sum(FEATURE_ATK_ELEMENT, element_id)
  436. end
  437. #--------------------------------------------------------------------------
  438. # Get Real Attack Elements Rate
  439. #--------------------------------------------------------------------------
  440. def atk_element_rate(element_id)
  441. val = ( atk_ele_base(element_id) + atk_ele_plus(element_id) )
  442. [[val, atk_ele_max(element_id)].min, atk_ele_min(element_id)].max.to_f
  443. end
  444. #--------------------------------------------------------------------------
  445. # Attack Elements Plus
  446. #--------------------------------------------------------------------------
  447. def atk_ele_plus(element_id)
  448. @atk_ele_plus[element_id]
  449. end
  450. #--------------------------------------------------------------------------
  451. # Clear Attack Elements Plus
  452. #--------------------------------------------------------------------------
  453. def clear_atk_ele_plus
  454. @atk_ele_plus = [0] * $data_system.elements.size
  455. end
  456. #--------------------------------------------------------------------------
  457. # Add Attack Elements
  458. #--------------------------------------------------------------------------
  459. def add_atk_ele(element_id, value, ref = true)
  460. @atk_ele_plus[element_id] += value
  461. refresh if ref
  462. end
  463. #--------------------------------------------------------------------------
  464. # Sub Attack Elements
  465. #--------------------------------------------------------------------------
  466. def sub_atk_ele(element_id, value, ref = true)
  467. @atk_ele_plus[element_id] -= value
  468. refresh if ref
  469. end
  470. #--------------------------------------------------------------------------
  471. # Div Attack Elements
  472. #--------------------------------------------------------------------------
  473. def div_atk_ele(element_id, value, ref = true)
  474. @atk_ele_plus[element_id] /= value
  475. refresh if ref
  476. end
  477. #--------------------------------------------------------------------------
  478. # Mul Attack Elements
  479. #--------------------------------------------------------------------------
  480. def mul_atk_ele(element_id, value, ref = true)
  481. @atk_ele_plus[element_id] *= value
  482. refresh if ref
  483. end
  484. #--------------------------------------------------------------------------
  485. # Mod Attack Elements
  486. #--------------------------------------------------------------------------
  487. def mod_atk_ele(element_id, value, ref = true)
  488. @atk_ele_plus[element_id] %= value
  489. refresh if ref
  490. end
  491.  
  492. end # << Game_BattlerBase
  493.  
  494. #===============================================================================
  495. class Game_Battler < Game_BattlerBase
  496. #===============================================================================
  497. #--------------------------------------------------------------------------
  498. # Get Element Modifier for Skill/Item
  499. #--------------------------------------------------------------------------
  500. def item_element_rate(user, item)
  501. return 1.0 if all_eles.empty?
  502. return 1.0 if item.no_ele_mod
  503. case Ele_Fixx::DMG_Type
  504. # // Default Type
  505. when 0 then var = elements_max_rate(user.atk_elements)
  506. # // $D13x Type
  507. when 1 then var = sD13x_element_rate(user,item)
  508. # // Adding Type
  509. when 2 then var = elements_add_rate(user.atk_elements)
  510. # // Average Type
  511. when 3 then var = elements_ave_rate(user.atk_elements)
  512. end
  513. if user.is_a?(Game_Actor)
  514. p "[ #{user.name} ] << attacker | element rate is = #{var}"
  515. end
  516. return var
  517. end
  518. #--------------------------------------------------------------------------
  519. # Elements Max Rate (For Reference)
  520. #--------------------------------------------------------------------------
  521. # def elements_max_rate(elements)
  522. # elements.inject([0.0]) {|r, i| r.push(element_rate(i)) }.max
  523. # end
  524. #--------------------------------------------------------------------------
  525. # $D13x Element Rate
  526. #--------------------------------------------------------------------------
  527. def sD13x_element_rate(user,item)
  528. atk_eles = user.atk_elements
  529. skl_eles = item.damage.element_id
  530. rate = 1.0
  531. atk_eles.each do |i|
  532. erate = element_rate(i)-1.0
  533. uatkr = user.atk_element_rate(i)
  534. uatkr = (user.atk_element_rate(i)*2) if skl_eles == i
  535. rate += uatkr * (1.0+erate) if uatkr >= 0.0
  536. rate -= uatkr * (1.0-erate) if uatkr < 0.0
  537. p "#{$data_system.elements[i]} dmg rate is #{rate}" if user.is_a?(Game_Actor)
  538. end
  539. rate
  540. end
  541. #--------------------------------------------------------------------------
  542. # Elements Add Rate
  543. #--------------------------------------------------------------------------
  544. def elements_add_rate(elements)
  545. elements.inject(1.0) {|r, i| r += element_rate(i) - (1.0) }
  546. end
  547. #--------------------------------------------------------------------------
  548. # Elements Average Rate
  549. #--------------------------------------------------------------------------
  550. def elements_ave_rate(elements)
  551. data = elements.inject(0.0) {|r, i| r += element_rate(i) }
  552. (data / (elements.size)).to_f
  553. end
  554.  
  555. end
  556.  
  557. #===============================================================================
  558. class Game_Actor < Game_Battler
  559. #===============================================================================
  560. #--------------------------------------------------------------------------
  561. # Defence Element Max
  562. #--------------------------------------------------------------------------
  563. def def_ele_max(element_id)
  564. base = super
  565. base += actor.max_def_ele[element_id]
  566. base += self.class.max_def_ele[element_id]
  567. base += equips.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  568. base += states.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  569. if $D13x[:Skill_Lv]
  570. base += skills.compact.inject(0) {|r, i| r += (i.max_def_ele[element_id]*
  571. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  572. else
  573. base += skills.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  574. end
  575. base
  576. end
  577. #--------------------------------------------------------------------------
  578. # Defence Element Plus
  579. #--------------------------------------------------------------------------
  580. def def_ele_plus(element_id)
  581. base = super
  582. base += actor.def_ele[element_id]
  583. base += self.class.def_ele[element_id]
  584. base += equips.compact.inject(0) {|r, i| r += (i.def_ele[element_id])}
  585. base += states.compact.inject(0) {|r, i| r += i.def_ele[element_id] }
  586. if $D13x[:Skill_Lv]
  587. base += skills.compact.inject(0) {|r, i| r += (i.def_ele[element_id]*
  588. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  589. else
  590. base += skills.compact.inject(0) {|r, i| r += i.def_ele[element_id] }
  591. end
  592. base
  593. end
  594. #--------------------------------------------------------------------------
  595. # Attack Element Max
  596. #--------------------------------------------------------------------------
  597. def atk_ele_max(element_id)
  598. base = super
  599. base += actor.max_atk_ele[element_id]
  600. base += self.class.max_atk_ele[element_id]
  601. base += equips.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  602. base += states.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  603. if $D13x[:Skill_Lv]
  604. base += skills.compact.inject(0) {|r, i| r += (i.max_atk_ele[element_id]*
  605. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  606. else
  607. base += skills.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  608. end
  609. base
  610. end
  611. #--------------------------------------------------------------------------
  612. # Attack Element Plus
  613. #--------------------------------------------------------------------------
  614. def atk_ele_plus(element_id)
  615. base = super
  616. base += actor.atk_ele[element_id]
  617. base += self.class.atk_ele[element_id]
  618. base += equips.compact.inject(0) {|r, i| r += (i.atk_ele[element_id])}
  619. base += states.compact.inject(0) {|r, i| r += i.atk_ele[element_id] }
  620. if $D13x[:Skill_Lv]
  621. base += skills.compact.inject(0) {|r, i| r += (i.atk_ele[element_id]*
  622. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  623. else
  624. base += skills.compact.inject(0) {|r, i| r += i.atk_ele[element_id] }
  625. end
  626. base
  627. end
  628.  
  629. end # << Game_Actor
  630.  
  631. #===============================================================================
  632. class Game_Enemy < Game_Battler
  633. #===============================================================================
  634. #--------------------------------------------------------------------------
  635. # Defence Element Max
  636. #--------------------------------------------------------------------------
  637. def def_ele_max(element_id)
  638. base = super
  639. base += enemy.max_def_ele[element_id]
  640. base += states.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  641. base
  642. end
  643. #--------------------------------------------------------------------------
  644. # Defence Element Plus
  645. #--------------------------------------------------------------------------
  646. def def_ele_plus(element_id)
  647. base = super
  648. base += enemy.def_ele[element_id]
  649. base += states.compact.inject(0) {|r, i| r += i.def_ele[element_id] }
  650. base
  651. end
  652. #--------------------------------------------------------------------------
  653. # Attack Element Max
  654. #--------------------------------------------------------------------------
  655. def atk_ele_max(element_id)
  656. base = super
  657. base += enemy.max_atk_ele[element_id]
  658. base += states.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  659. base
  660. end
  661. #--------------------------------------------------------------------------
  662. # Attack Element Plus
  663. #--------------------------------------------------------------------------
  664. def atk_ele_plus(element_id)
  665. base = super
  666. base += enemy.atk_ele[element_id]
  667. base += states.compact.inject(0) {|r, i| r += i.atk_ele[element_id] }
  668. base
  669. end
  670.  
  671. end # << Game_Enemy
  672.  
  673. #==============================================================================#
  674. # http://dekitarpg.wordpress.com/ #
  675. #==============================================================================#
  676. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement