Advertisement
Dekita

$D13x Weapon DMG Range v1.4

May 30th, 2013
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.70 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Equipment - Weapon DMG Range
  5. # -- Author : Dekita
  6. # -- Version : 1.4
  7. # -- Level : Easy
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Weapon_Range]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 17/o5/2o13 - Small Update,
  21. # 23/o3/2o13 - Compatibility, ($D13x - Equip Scene)
  22. # - Bugfix, (no longer requires $D13x Core)
  23. # 18/o3/2o13 - Changed formula slightly,
  24. # 1o/o3/2o13 - Changed import code,
  25. # o8/o3/2o13 - Started, Finished,
  26. #
  27. #===============================================================================
  28. # ☆ Introduction
  29. #-------------------------------------------------------------------------------
  30. # This script allows for weapons to have a variance, very similar to the
  31. # variance used in skills/items.
  32. # The main difference being, its for weapons, not items/skills.
  33. # eg.
  34. # axe = high variance, this would make some hits very high and some very low.
  35. # hammer = low variance, this means the damage is more steady.
  36. #
  37. # in short, using this script means different weapon types actually have
  38. # different damage ranges...
  39. #
  40. # you can have different variances for physical/magical/certain hits
  41. #
  42. # v1.2+ changes the way the formula calculates the damage variance.
  43. # instead of it being higher or lower (increasing or decreasing the damage)
  44. # the variance is just extra damage added onto the current damage value.
  45. # damage value will no longer be reduced due to this script.
  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. # Place Under My $D13x Equipment - Individualize Script (if used)
  69. #
  70. #===============================================================================
  71. # ☆ Notetags ( default )
  72. # For use with Weapons
  73. #-------------------------------------------------------------------------------
  74. # <p range: X>
  75. # <m range: X>
  76. # <c range: X>
  77. # Replace X with an integer value, ie 1/2/3/4/5/6...
  78. #
  79. #===============================================================================
  80. module Weapon_Range
  81. #===============================================================================
  82.  
  83. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  84. # ☆ Main Settings
  85. #--------------------------------------------------------------------------
  86. # These are the default settings given to weapons (based on weapon type)
  87. # if they have not been notetagged otherwise.
  88. # id => [ phys , magi , cert ]
  89. Type ={
  90. 1 => [ 40 , 10 , 0 ], # Default = Axe
  91. 2 => [ 20 , 10 , 0 ], # Default = Claw
  92. 3 => [ 25 , 10 , 0 ], # Default = Spear
  93. 4 => [ 20 , 10 , 0 ], # Default = Sword
  94. 5 => [ 15 , 15 , 0 ], # Default = Katana
  95. 6 => [ 50 , 20 , 0 ], # Default = Bow
  96. 7 => [ 10 , 10 , 0 ], # Default = Dagger
  97. 8 => [ 30 , 10 , 0 ], # Default = Hammer
  98. 9 => [ 30 , 30 , 0 ], # Default = Staff
  99. 10 => [ 10 , 10 , 0 ], # Default = Gun
  100. # << Add more lines here if you have more than 10 weapon types :)
  101. }# << Keep
  102.  
  103. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104. # ☆ Notetag Settings
  105. #--------------------------------------------------------------------------
  106. # These are the default notetags used in the weapon notebox
  107. # only modify these if you know what your doing.
  108. # type => /<note vocab:(.*)>/i ,
  109. Notetags={
  110. :atk => /<p range:(.*)>/i ,
  111. :mat => /<m range:(.*)>/i ,
  112. :cert => /<c range:(.*)>/i ,
  113. }# << Keep
  114.  
  115. end #####################
  116. # CUSTOMISATION END #
  117. #####################
  118. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  119. # #
  120. # http://dekitarpg.wordpress.com/ #
  121. # #
  122. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  123. #===============================================================================#
  124. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  125. # YES?\.\. #
  126. # OMG, REALLY? \| #
  127. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  128. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  129. #===============================================================================#
  130. module DataManager
  131. #===============================================================================
  132. #---------------------------------------------------------------------------
  133. # Alias List
  134. #---------------------------------------------------------------------------
  135. class << self
  136. alias :lbd_unique_wepran :load_database
  137. end
  138. #---------------------------------------------------------------------------
  139. # Load Database (alias)
  140. #---------------------------------------------------------------------------
  141. def self.load_database
  142. lbd_unique_wepran
  143. loa_unique_wepran
  144. end
  145. #---------------------------------------------------------------------------
  146. # Load Unique Shit
  147. #---------------------------------------------------------------------------
  148. def self.loa_unique_wepran
  149. for wep in $data_weapons
  150. next if wep == nil
  151. wep.load_unique_wepran
  152. end
  153. end
  154.  
  155. end # DataManager
  156.  
  157. #===============================================================================
  158. class RPG::EquipItem < RPG::BaseItem
  159. #===============================================================================
  160. #---------------------------------------------------------------------------
  161. # Pi Variables
  162. #---------------------------------------------------------------------------
  163. attr_accessor :par_range
  164. #---------------------------------------------------------------------------
  165. # Load Unique Notes
  166. #---------------------------------------------------------------------------
  167. def load_unique_wepran
  168. @par_range = {:atk=>0,:mat=>0,:cert=>0}
  169. load_weapon_ranges
  170. end
  171. #---------------------------------------------------------------------------
  172. # Load Weapon Ranges
  173. #---------------------------------------------------------------------------
  174. def load_weapon_ranges
  175. return unless self.is_a?(RPG::Weapon)
  176. @par_range[:atk] = Weapon_Range::Type[self.wtype_id][0] rescue nil
  177. @par_range[:mat] = Weapon_Range::Type[self.wtype_id][1] rescue nil
  178. @par_range[:cert] = Weapon_Range::Type[self.wtype_id][2] rescue nil
  179. self.note.split(/[\r\n]+/).each do |line|
  180. case line
  181. when Weapon_Range::Notetags[:atk] then @par_range[:atk] = $1.to_i
  182. when Weapon_Range::Notetags[:mat] then @par_range[:mat] = $1.to_i
  183. when Weapon_Range::Notetags[:cert] then @par_range[:cert] = $1.to_i
  184. end
  185. end
  186. end
  187.  
  188. end
  189.  
  190. #===============================================================================
  191. class Game_Battler < Game_BattlerBase
  192. #===============================================================================
  193. #--------------------------------------------------------------------------
  194. # Alias List
  195. #--------------------------------------------------------------------------
  196. alias :_MDV__Range :make_damage_value
  197. alias :_APV__Range :apply_variance
  198. #--------------------------------------------------------------------------
  199. # M.D.V
  200. #--------------------------------------------------------------------------
  201. def make_damage_value(user, item)
  202. @wep_range_user = user
  203. @wep_range_item = item
  204. _MDV__Range(user, item)
  205. end
  206. #--------------------------------------------------------------------------
  207. # Apply Variance Mod
  208. #--------------------------------------------------------------------------
  209. def apply_variance(damage, variance)
  210. user = @wep_range_user
  211. item = @wep_range_item
  212. orig = _APV__Range(damage, variance)
  213. orig += apply_weapon_variance(orig,damage,item,user)
  214. orig
  215. end
  216. #--------------------------------------------------------------------------
  217. # Apply Variance Mod
  218. #--------------------------------------------------------------------------
  219. def apply_weapon_variance(orig,damage,item,user)
  220. return 0 unless user.is_a?(Game_Actor)
  221. dam = orig
  222. user.weapons.each do |e|
  223. next if e == nil
  224. varii = e.par_range[:atk] if item.physical?
  225. varii = e.par_range[:mat] if item.magical?
  226. varii = e.par_range[:cert] if item.certain?
  227. amp = [damage.abs * varii / 100, 0].max.to_i
  228. var = rand(amp + 1) #+ rand(amp + 1) - amp
  229. dam = dam >= 0 ? dam + var : dam - var
  230. end
  231. dam
  232. end
  233.  
  234. end
  235.  
  236. #===============================================================================
  237. class Game_Actor < Game_Battler
  238. #===============================================================================
  239. #--------------------------------------------------------------------------
  240. # ATK Param Range
  241. #--------------------------------------------------------------------------
  242. def atk_par_range
  243. range = param(2)
  244. weapons.each do |w|
  245. next if w == nil
  246. range *= (1+(w.par_range[:atk].to_f/100))
  247. end
  248. return range.to_i
  249. end
  250. #--------------------------------------------------------------------------
  251. # MAT Param Range
  252. #--------------------------------------------------------------------------
  253. def mat_par_range
  254. range = param(4)
  255. weapons.each do |w|
  256. next if w == nil
  257. range *= (1+(w.par_range[:mat].to_f/100))
  258. end
  259. return range.to_i
  260. end
  261.  
  262. end
  263.  
  264. #==============================================================================#
  265. # http://dekitarpg.wordpress.com/ #
  266. #==============================================================================#
  267. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement