Advertisement
Dekita

elecon1.4

Mar 15th, 2014
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.74 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. # <inc atk ele>
  136. # Use this notetag to change whether this skill includes all elemental damage
  137. # it will change from the default setting defined at- Atk_Ele_Inc_All_Dmg
  138. #
  139. # <no ele mod>
  140. # Will make the skill / item have no elemental modification when used.
  141. #
  142. #===============================================================================
  143. # ☆ HELP
  144. #-------------------------------------------------------------------------------
  145. # Remember :
  146. # All Elemental Values work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01
  147. # 1.0 = 100%, 0.01 = 1%,
  148. #
  149. # Also, element id numbers can be found in the database.
  150. #
  151. #===============================================================================
  152. module Ele_Fixx
  153. #===============================================================================
  154. Element={0=>{:atk_ele=>[0,1],:def_ele=>[0,1]}}# << KEEP !!
  155. Notes={}# << Keep
  156.  
  157. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  158. # ☆ Calculation Settings
  159. #--------------------------------------------------------------------------
  160. # This is where you set how the script calculates elemental damage
  161. # Types :
  162. # 0 = Will take the max element modifier as the damage multiplication
  163. # This is also the Vx Ace Default Calculation.
  164. # This will make even the smallest attack elemental modifier count as full
  165. # elemental attack.
  166. #
  167. # 1 = Will calculate only weak and resisted elements, then adds/subtracts
  168. # Them accordingly and adds them onto the default attack for a total
  169. # calculation. (positive or negative)
  170. # RECOMMENDED TYPE.
  171. #
  172. # 2 = Will add each elemental modifier together for the damage multiplication
  173. # This Is An Experimental Calculation ;p
  174. #
  175. # 3 = Will take the average modifier for the damage calculation
  176. # This Is Another Experimental Calculation ;p
  177. #--------------------------------------------------------------------------
  178. DMG_Type = 1
  179. #--------------------------------------------------------------------------
  180. # Make true if you want all damage to increase based on element atk value
  181. # - if false, damage will only increase if you use a skill with that element
  182. #--------------------------------------------------------------------------
  183. Atk_Ele_Inc_All_Dmg = false
  184. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185. # ☆ Limit Settings
  186. #--------------------------------------------------------------------------
  187. # This is where you adjust the settings for the base min and max values
  188. # used for actors / enemies.
  189. #--------------------------------------------------------------------------
  190. #Element[id]={ :atk_ele => [ Min , Max ], :def_ele => [ Min , Max ]}
  191. Element[1] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  192. Element[2] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  193. Element[3] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  194. Element[4] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  195. Element[5] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  196. Element[6] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  197. Element[7] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  198. Element[8] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  199. Element[9] = { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  200. Element[10]= { :atk_ele => [ -2.0 , 2.0 ], :def_ele => [ -2.0 , 2.0 ]}
  201. # << Add more rows here if you have more than 10
  202. # elements in your project :)
  203. # Follow the same format as above, ie Element[ id ] = [ Min , Max ]
  204.  
  205. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  206. # ☆ Notetag Settings
  207. #--------------------------------------------------------------------------
  208. # This is where you adjust the settings for the notetags used in all
  209. # notetaggable items.
  210. # Only modify these if you understand how to.
  211. #--------------------------------------------------------------------------
  212. Notes[:atk_ele] = /<atk ele:(.*),(.*)>/i
  213. Notes[:def_ele] = /<def ele:(.*),(.*)>/i
  214. Notes[:max_atk_ele] = /<max atk ele:(.*),(.*)>/i
  215. Notes[:max_def_ele] = /<max def ele:(.*),(.*)>/i
  216. Notes[:no_element] = /<no ele mod>/i
  217.  
  218. Notes[:atk_ele_dmg] = /<inc atk ele>/i
  219.  
  220. end #####################
  221. # CUSTOMISATION END #
  222. #####################
  223. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  224. # #
  225. # http://dekitarpg.wordpress.com/ #
  226. # #
  227. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  228. #===============================================================================#
  229. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  230. # YES?\.\. #
  231. # OMG, REALLY? \| #
  232. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  233. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  234. #===============================================================================#
  235. module DataManager
  236. #===============================================================================
  237. #---------------------------------------------------------------------------
  238. # Alias List
  239. #---------------------------------------------------------------------------
  240. class << self
  241. alias :lbd_elef_element :load_database
  242. end
  243. #---------------------------------------------------------------------------
  244. # Load Database (alias)
  245. #---------------------------------------------------------------------------
  246. def self.load_database
  247. lbd_elef_element
  248. loa_elef_element
  249. end
  250. #---------------------------------------------------------------------------
  251. # Load Unique Elemental Shit
  252. #---------------------------------------------------------------------------
  253. def self.loa_elef_element
  254. classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
  255. $data_actors , $data_classes, $data_enemies, $data_states ]
  256. for g in classes
  257. for o in g
  258. next if o == nil
  259. o.load_elemental_control
  260. end
  261. end
  262. end
  263.  
  264. end # DataManager
  265.  
  266. #===============================================================================
  267. class RPG::BaseItem
  268. #===============================================================================
  269. #---------------------------------------------------------------------------
  270. # Pi Variables
  271. #---------------------------------------------------------------------------
  272. attr_accessor :atk_ele
  273. attr_accessor :def_ele
  274. attr_accessor :max_atk_ele
  275. attr_accessor :max_def_ele
  276. attr_accessor :include_elem_dmg
  277. #---------------------------------------------------------------------------
  278. # Load Elemental Control
  279. #---------------------------------------------------------------------------
  280. def load_elemental_control
  281. @atk_ele = [0] * $data_system.elements.size
  282. @def_ele = [0] * $data_system.elements.size
  283. @max_atk_ele = [0] * $data_system.elements.size
  284. @max_def_ele = [0] * $data_system.elements.size
  285. @include_elem_dmg = Ele_Fixx::Atk_Ele_Inc_All_Dmg
  286. check_elefixx_notetags
  287. end
  288. #---------------------------------------------------------------------------
  289. # Parse Notes
  290. #---------------------------------------------------------------------------
  291. def check_elefixx_notetags
  292. self.note.split(/[\r\n]+/).each do |line|
  293. case line
  294. when Ele_Fixx::Notes[:atk_ele] then @atk_ele[$1.to_i] = $2.to_f
  295. when Ele_Fixx::Notes[:def_ele] then @def_ele[$1.to_i] = $2.to_f
  296. when Ele_Fixx::Notes[:max_atk_ele] then @max_atk_ele[$1.to_i] = $2.to_f
  297. when Ele_Fixx::Notes[:max_def_ele] then @max_def_ele[$1.to_i] = $2.to_f
  298. when Ele_Fixx::Notes[:atk_ele_dmg] then @include_elem_dmg = !@include_elem_dmg
  299. end
  300. end
  301. end
  302.  
  303. end # << RPG::BaseItem
  304.  
  305. #===============================================================================
  306. class RPG::UsableItem < RPG::BaseItem
  307. #===============================================================================
  308. #---------------------------------------------------------------------------
  309. # Pi Variables
  310. #---------------------------------------------------------------------------
  311. attr_accessor :no_ele_mod
  312. #---------------------------------------------------------------------------
  313. # Load Elemental Control
  314. #---------------------------------------------------------------------------
  315. def load_elemental_control
  316. super
  317. @no_ele_mod = false
  318. check_elefixx_notetags
  319. end
  320. #---------------------------------------------------------------------------
  321. # Parse Notes
  322. #---------------------------------------------------------------------------
  323. def check_elefixx_notetags
  324. super
  325. self.note.split(/[\r\n]+/).each do |line|
  326. case line
  327. when Ele_Fixx::Notes[:no_element]
  328. @no_ele_mod = true
  329. end
  330. end
  331. end
  332.  
  333. end # << RPG::BaseItem
  334.  
  335. #===============================================================================
  336. class Game_BattlerBase
  337. #===============================================================================
  338. #--------------------------------------------------------------------------
  339. # Alias List
  340. #--------------------------------------------------------------------------
  341. alias :sd13x_GB_elems :initialize
  342. #--------------------------------------------------------------------------
  343. # Initialize Data
  344. #--------------------------------------------------------------------------
  345. def initialize(*a,&b)
  346. clear_def_ele_plus
  347. clear_atk_ele_plus
  348. sd13x_GB_elems(*a,&b)
  349. end
  350. #--------------------------------------------------------------------------
  351. # Get Attack Element || Old Method >> features_set(FEATURE_ATK_ELEMENT)
  352. #--------------------------------------------------------------------------
  353. def atk_elements
  354. a = []
  355. $data_system.elements.size.times do |i|
  356. e = atk_element_rate(i)
  357. a << i if e != 0.0
  358. end
  359. a
  360. end
  361. #--------------------------------------------------------------------------
  362. # Get Min Value of Defencive Elements
  363. #--------------------------------------------------------------------------
  364. def def_ele_min(element_id)
  365. return Ele_Fixx::Element[element_id][:def_ele][0]
  366. end
  367. #--------------------------------------------------------------------------
  368. # Get Maximum Value of Defencive Elements
  369. #--------------------------------------------------------------------------
  370. def def_ele_max(element_id)
  371. return Ele_Fixx::Element[element_id][:def_ele][1]
  372. end
  373. #--------------------------------------------------------------------------
  374. # Get Base Element Rate
  375. #--------------------------------------------------------------------------
  376. def def_ele_base(element_id)
  377. features_pi(FEATURE_ELEMENT_RATE, element_id)
  378. end
  379. #--------------------------------------------------------------------------
  380. # Get Real Defencive Element Rate
  381. #--------------------------------------------------------------------------
  382. def element_rate(element_id)
  383. val = ( def_ele_base(element_id) + def_ele_plus(element_id) )
  384. [[val, def_ele_max(element_id)].min, def_ele_min(element_id)].max.to_f
  385. end
  386. #--------------------------------------------------------------------------
  387. # Defencive Elements Plus
  388. #--------------------------------------------------------------------------
  389. def def_ele_plus(element_id)
  390. @def_ele_plus[element_id]
  391. end
  392. #--------------------------------------------------------------------------
  393. # Clear Defencive Elements Plus
  394. #--------------------------------------------------------------------------
  395. def clear_def_ele_plus
  396. @def_ele_plus = [0] * $data_system.elements.size
  397. end
  398. #--------------------------------------------------------------------------
  399. # Add Defencive Elements
  400. #--------------------------------------------------------------------------
  401. def add_def_ele(element_id, value, ref = true)
  402. @def_ele_plus[element_id] += value
  403. refresh if ref
  404. end
  405. #--------------------------------------------------------------------------
  406. # Sub Defencive Elements
  407. #--------------------------------------------------------------------------
  408. def sub_def_ele(element_id, value, ref = true)
  409. @def_ele_plus[element_id] -= value
  410. refresh if ref
  411. end
  412. #--------------------------------------------------------------------------
  413. # Div Defencive Elements
  414. #--------------------------------------------------------------------------
  415. def div_def_ele(element_id, value, ref = true)
  416. @def_ele_plus[element_id] /= value
  417. refresh if ref
  418. end
  419. #--------------------------------------------------------------------------
  420. # Mul Defencive Elements
  421. #--------------------------------------------------------------------------
  422. def mul_def_ele(element_id, value, ref = true)
  423. @def_ele_plus[element_id] *= value
  424. refresh if ref
  425. end
  426. #--------------------------------------------------------------------------
  427. # Mod Defencive Elements
  428. #--------------------------------------------------------------------------
  429. def mod_def_ele(element_id, value, ref = true)
  430. @def_ele_plus[element_id] %= value
  431. refresh if ref
  432. end
  433. #--------------------------------------------------------------------------
  434. # Get Min Value of Attack Elements
  435. #--------------------------------------------------------------------------
  436. def atk_ele_min(element_id)
  437. return Ele_Fixx::Element[element_id][:atk_ele][0]
  438. end
  439. #--------------------------------------------------------------------------
  440. # Get Maximum Value of Attack Elements
  441. #--------------------------------------------------------------------------
  442. def atk_ele_max(element_id)
  443. return Ele_Fixx::Element[element_id][:atk_ele][1]
  444. end
  445. #--------------------------------------------------------------------------
  446. # Get Base Attack Element Rate
  447. #--------------------------------------------------------------------------
  448. def atk_ele_base(element_id)
  449. features_sum(FEATURE_ATK_ELEMENT, element_id)
  450. end
  451. #--------------------------------------------------------------------------
  452. # Get Real Attack Elements Rate
  453. #--------------------------------------------------------------------------
  454. def atk_element_rate(element_id)
  455. val = ( atk_ele_base(element_id) + atk_ele_plus(element_id) )
  456. [[val, atk_ele_max(element_id)].min, atk_ele_min(element_id)].max.to_f
  457. end
  458. #--------------------------------------------------------------------------
  459. # Attack Elements Plus
  460. #--------------------------------------------------------------------------
  461. def atk_ele_plus(element_id)
  462. @atk_ele_plus[element_id]
  463. end
  464. #--------------------------------------------------------------------------
  465. # Clear Attack Elements Plus
  466. #--------------------------------------------------------------------------
  467. def clear_atk_ele_plus
  468. @atk_ele_plus = [0] * $data_system.elements.size
  469. end
  470. #--------------------------------------------------------------------------
  471. # Add Attack Elements
  472. #--------------------------------------------------------------------------
  473. def add_atk_ele(element_id, value, ref = true)
  474. @atk_ele_plus[element_id] += value
  475. refresh if ref
  476. end
  477. #--------------------------------------------------------------------------
  478. # Sub Attack Elements
  479. #--------------------------------------------------------------------------
  480. def sub_atk_ele(element_id, value, ref = true)
  481. @atk_ele_plus[element_id] -= value
  482. refresh if ref
  483. end
  484. #--------------------------------------------------------------------------
  485. # Div Attack Elements
  486. #--------------------------------------------------------------------------
  487. def div_atk_ele(element_id, value, ref = true)
  488. @atk_ele_plus[element_id] /= value
  489. refresh if ref
  490. end
  491. #--------------------------------------------------------------------------
  492. # Mul Attack Elements
  493. #--------------------------------------------------------------------------
  494. def mul_atk_ele(element_id, value, ref = true)
  495. @atk_ele_plus[element_id] *= value
  496. refresh if ref
  497. end
  498. #--------------------------------------------------------------------------
  499. # Mod Attack Elements
  500. #--------------------------------------------------------------------------
  501. def mod_atk_ele(element_id, value, ref = true)
  502. @atk_ele_plus[element_id] %= value
  503. refresh if ref
  504. end
  505.  
  506. end # << Game_BattlerBase
  507.  
  508. #===============================================================================
  509. class Game_Battler < Game_BattlerBase
  510. #===============================================================================
  511. #--------------------------------------------------------------------------
  512. # Get Element Modifier for Skill/Item
  513. #--------------------------------------------------------------------------
  514. def item_element_rate(user, item)
  515. return 1.0 if all_eles.empty?
  516. return 1.0 if item.no_ele_mod
  517. case Ele_Fixx::DMG_Type
  518. # // Default Type
  519. when 0 then var = elements_max_rate(user.atk_elements)
  520. # // $D13x Type
  521. when 1 then var = sD13x_element_rate(user,item)
  522. # // Adding Type
  523. when 2 then var = elements_add_rate(user.atk_elements)
  524. # // Average Type
  525. when 3 then var = elements_ave_rate(user.atk_elements)
  526. end
  527. if user.is_a?(Game_Actor)
  528. p "[ #{user.name} ] << attacker | element rate is = #{var}"
  529. end
  530. return var
  531. end
  532. #--------------------------------------------------------------------------
  533. # Elements Max Rate (For Reference)
  534. #--------------------------------------------------------------------------
  535. # def elements_max_rate(elements)
  536. # elements.inject([0.0]) {|r, i| r.push(element_rate(i)) }.max
  537. # end
  538. #--------------------------------------------------------------------------
  539. # $D13x Element Rate
  540. #--------------------------------------------------------------------------
  541. def sD13x_element_rate(user,item)
  542. atk_eles = user.atk_elements
  543. skl_eles = item.damage.element_id
  544. rate = 1.0
  545. atk_eles.each do |i|
  546. erate = element_rate(i)-1.0
  547. uatkr = 1.0
  548. if item.include_elem_dmg
  549. uatkr = user.atk_element_rate(i)
  550. uatkr = (user.atk_element_rate(i)*2) if skl_eles == i
  551. else
  552. uatkr = user.atk_element_rate(i) if skl_eles == i
  553. end
  554. rate += uatkr * (1.0+erate) if uatkr >= 0.0
  555. rate -= uatkr * (1.0-erate) if uatkr < 0.0
  556. p "#{$data_system.elements[i]} dmg rate is #{rate}" if user.is_a?(Game_Actor)
  557. end
  558. rate
  559. end
  560. #--------------------------------------------------------------------------
  561. # Elements Add Rate
  562. #--------------------------------------------------------------------------
  563. def elements_add_rate(elements)
  564. elements.inject(1.0) {|r, i| r += element_rate(i) - (1.0) }
  565. end
  566. #--------------------------------------------------------------------------
  567. # Elements Average Rate
  568. #--------------------------------------------------------------------------
  569. def elements_ave_rate(elements)
  570. data = elements.inject(0.0) {|r, i| r += element_rate(i) }
  571. (data / (elements.size)).to_f
  572. end
  573.  
  574. end
  575.  
  576. #===============================================================================
  577. class Game_Actor < Game_Battler
  578. #===============================================================================
  579. #--------------------------------------------------------------------------
  580. # Defence Element Max
  581. #--------------------------------------------------------------------------
  582. def def_ele_max(element_id)
  583. base = super
  584. base += actor.max_def_ele[element_id]
  585. base += self.class.max_def_ele[element_id]
  586. base += equips.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  587. base += states.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  588. if $D13x[:Skill_Lv]
  589. base += skills.compact.inject(0) {|r, i| r += (i.max_def_ele[element_id]*
  590. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  591. else
  592. base += skills.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  593. end
  594. base
  595. end
  596. #--------------------------------------------------------------------------
  597. # Defence Element Plus
  598. #--------------------------------------------------------------------------
  599. def def_ele_plus(element_id)
  600. base = super
  601. base += actor.def_ele[element_id]
  602. base += self.class.def_ele[element_id]
  603. base += equips.compact.inject(0) {|r, i| r += (i.def_ele[element_id])}
  604. base += states.compact.inject(0) {|r, i| r += i.def_ele[element_id] }
  605. if $D13x[:Skill_Lv]
  606. base += skills.compact.inject(0) {|r, i| r += (i.def_ele[element_id]*
  607. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  608. else
  609. base += skills.compact.inject(0) {|r, i| r += i.def_ele[element_id] }
  610. end
  611. base
  612. end
  613. #--------------------------------------------------------------------------
  614. # Attack Element Max
  615. #--------------------------------------------------------------------------
  616. def atk_ele_max(element_id)
  617. base = super
  618. base += actor.max_atk_ele[element_id]
  619. base += self.class.max_atk_ele[element_id]
  620. base += equips.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  621. base += states.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  622. if $D13x[:Skill_Lv]
  623. base += skills.compact.inject(0) {|r, i| r += (i.max_atk_ele[element_id]*
  624. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  625. else
  626. base += skills.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  627. end
  628. base
  629. end
  630. #--------------------------------------------------------------------------
  631. # Attack Element Plus
  632. #--------------------------------------------------------------------------
  633. def atk_ele_plus(element_id)
  634. base = super
  635. base += actor.atk_ele[element_id]
  636. base += self.class.atk_ele[element_id]
  637. base += equips.compact.inject(0) {|r, i| r += (i.atk_ele[element_id])}
  638. base += states.compact.inject(0) {|r, i| r += i.atk_ele[element_id] }
  639. if $D13x[:Skill_Lv]
  640. base += skills.compact.inject(0) {|r, i| r += (i.atk_ele[element_id]*
  641. Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_f}
  642. else
  643. base += skills.compact.inject(0) {|r, i| r += i.atk_ele[element_id] }
  644. end
  645. base
  646. end
  647.  
  648. end # << Game_Actor
  649.  
  650. #===============================================================================
  651. class Game_Enemy < Game_Battler
  652. #===============================================================================
  653. #--------------------------------------------------------------------------
  654. # Defence Element Max
  655. #--------------------------------------------------------------------------
  656. def def_ele_max(element_id)
  657. base = super
  658. base += enemy.max_def_ele[element_id]
  659. base += states.compact.inject(0) {|r, i| r += i.max_def_ele[element_id] }
  660. base
  661. end
  662. #--------------------------------------------------------------------------
  663. # Defence Element Plus
  664. #--------------------------------------------------------------------------
  665. def def_ele_plus(element_id)
  666. base = super
  667. base += enemy.def_ele[element_id]
  668. base += states.compact.inject(0) {|r, i| r += i.def_ele[element_id] }
  669. base
  670. end
  671. #--------------------------------------------------------------------------
  672. # Attack Element Max
  673. #--------------------------------------------------------------------------
  674. def atk_ele_max(element_id)
  675. base = super
  676. base += enemy.max_atk_ele[element_id]
  677. base += states.compact.inject(0) {|r, i| r += i.max_atk_ele[element_id] }
  678. base
  679. end
  680. #--------------------------------------------------------------------------
  681. # Attack Element Plus
  682. #--------------------------------------------------------------------------
  683. def atk_ele_plus(element_id)
  684. base = super
  685. base += enemy.atk_ele[element_id]
  686. base += states.compact.inject(0) {|r, i| r += i.atk_ele[element_id] }
  687. base
  688. end
  689.  
  690. end # << Game_Enemy
  691.  
  692. #==============================================================================#
  693. # http://dekitarpg.wordpress.com/ #
  694. #==============================================================================#
  695. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement