Advertisement
Dekita

$D13x Elemental Control v1.0

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