Advertisement
Dekita

$D13x Weapon DMG Range v1.2

Mar 20th, 2013
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.04 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # ☆ $D13x - Equipment - Weapon DMG Range
  4. # -- Author : Dekita
  5. # -- Version : 1.2
  6. # -- Level : Easy / Normal
  7. # -- Requires : N/A
  8. # -- Engine : RPG Maker VX Ace.
  9. #
  10. #===============================================================================
  11. # ☆ Import
  12. #-------------------------------------------------------------------------------
  13. $D13x={}if$D13x==nil
  14. $D13x[:Weapon_Range]=true
  15. #===============================================================================
  16. # ☆ Updates
  17. #-------------------------------------------------------------------------------
  18. # D /M /Y
  19. # 18/o3/2o13 - Changed formula slightly,
  20. # 1o/o3/2o13 - Changed import code,
  21. # o8/o3/2o13 - Started, Finished,
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This script allows for weapons to have a variance, very similar to the
  27. # variance used in skills/items.
  28. # The main difference being, its for weapons, not items/skills.
  29. # eg.
  30. # axe = high variance, this would make some hits very high and some very low.
  31. # hammer = low variance, this means the damage is more steady.
  32. #
  33. # in short, using this script means different weapon types actually have
  34. # different damage ranges...
  35. #
  36. # you can have different variances for physical/magical/certain hits
  37. #
  38. # v1.2+ changes the way the formula calculates the damage variance.
  39. # instead of it being higher or lower (increasing or decreasing the damage)
  40. # the variance is just extra damage added onto the current damage value.
  41. # damage value will no longer be reduced due to this script.
  42. #
  43. #===============================================================================
  44. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  45. #===============================================================================
  46. # 1. You MUST give credit to "Dekita" !!
  47. # 2. You are NOT allowed to repost this script.(or modified versions)
  48. # 3. You are NOT allowed to convert this script.
  49. # 4. You are NOT allowed to use this script for Commercial games.
  50. # 5. ENJOY!
  51. #
  52. # "FINE PRINT"
  53. # By using this script you hereby agree to the above terms and conditions,
  54. # if any violation of the above terms occurs "legal action" may be taken.
  55. # Not understanding the above terms and conditions does NOT mean that
  56. # they do not apply to you.
  57. # If you wish to discuss the terms and conditions in further detail you can
  58. # contact me at http://dekitarpg.wordpress.com/
  59. #
  60. #===============================================================================
  61. # ☆ Instructions
  62. #-------------------------------------------------------------------------------
  63. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  64. # Place Under My $D13x Equipment - Individualize Script (if used)
  65. #
  66. #===============================================================================
  67. # ☆ Notetags ( default )
  68. # For use with Weapons
  69. #-------------------------------------------------------------------------------
  70. # <p range: X>
  71. # <m range: X>
  72. # <c range: X>
  73. # Replace X with an integer value, ie 1/2/3/4/5/6...
  74. #
  75. #===============================================================================
  76. module Weapon_Range
  77. #===============================================================================
  78.  
  79. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  80. # ☆ Main Settings
  81. #--------------------------------------------------------------------------
  82. # These are the default settings given to weapons (based on weapon type)
  83. # if they have not been notetagged otherwise.
  84. # id => [ phys , magi , cert ]
  85. Type ={
  86. 1 => [ 40 , 10 , 0 ], # Default = Axe
  87. 2 => [ 20 , 10 , 0 ], # Default = Claw
  88. 3 => [ 25 , 10 , 0 ], # Default = Spear
  89. 4 => [ 20 , 10 , 0 ], # Default = Sword
  90. 5 => [ 15 , 15 , 0 ], # Default = Katana
  91. 6 => [ 50 , 20 , 0 ], # Default = Bow
  92. 7 => [ 10 , 10 , 0 ], # Default = Dagger
  93. 8 => [ 30 , 10 , 0 ], # Default = Hammer
  94. 9 => [ 30 , 30 , 0 ], # Default = Staff
  95. 10 => [ 10 , 10 , 0 ], # Default = Gun
  96. # << Add more lines here if you have more than 10 weapon types :)
  97. }# << Keep
  98.  
  99. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  100. # ☆ Notetag Settings
  101. #--------------------------------------------------------------------------
  102. # These are the default notetags used in the weapon notebox
  103. # only modify these if you know what your doing.
  104. # type => /<note vocab:(.*)>/i ,
  105. Notetags={
  106. :atk => /<p range:(.*)>/i ,
  107. :mat => /<m range:(.*)>/i ,
  108. :cert => /<c range:(.*)>/i ,
  109. }# << Keep
  110.  
  111. end #####################
  112. # CUSTOMISATION END #
  113. #####################
  114. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  115. # #
  116. # http://dekitarpg.wordpress.com/ #
  117. # #
  118. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  119. #===============================================================================#
  120. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  121. # YES?\.\. #
  122. # OMG, REALLY? \| #
  123. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  124. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  125. #===============================================================================#
  126.  
  127. if !$D13x[:CORE]
  128. #===============================================================================
  129. module DataManager
  130. #===============================================================================
  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_shits
  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. end # if !$D13x[:CORE]
  157.  
  158. #==============================================================================
  159. class RPG::EquipItem < RPG::BaseItem
  160. #==============================================================================
  161. #---------------------------------------------------------------------------
  162. # Alias List
  163. #---------------------------------------------------------------------------
  164. alias :deki_weapon_range :load_unique_shit if $D13x[:CORE]
  165. #---------------------------------------------------------------------------
  166. # Pi Variables
  167. #---------------------------------------------------------------------------
  168. attr_accessor :par_range
  169. #---------------------------------------------------------------------------
  170. # Load Unique Shit
  171. #---------------------------------------------------------------------------
  172. def load_unique_shit
  173. deki_weapon_range if $D13x[:CORE]
  174. load_unique_wepran
  175. end
  176. #---------------------------------------------------------------------------
  177. # Load Unique Notes
  178. #---------------------------------------------------------------------------
  179. def load_unique_wepran
  180. @par_range = {:atk=>0,:mat=>0,:cert=>0}
  181. load_weapon_ranges
  182. end
  183. #---------------------------------------------------------------------------
  184. # Load Weapon Ranges
  185. #---------------------------------------------------------------------------
  186. def load_weapon_ranges
  187. return unless self.is_a?(RPG::Weapon)
  188. @par_range[:atk] = Weapon_Range::Type[self.wtype_id][0]
  189. @par_range[:mat] = Weapon_Range::Type[self.wtype_id][1]
  190. @par_range[:cert] = Weapon_Range::Type[self.wtype_id][2]
  191. self.note.split(/[\r\n]+/).each do |line|
  192. case line
  193. when Weapon_Range::Notetags[:atk] then @par_range[:atk] = $1.to_i
  194. when Weapon_Range::Notetags[:mat] then @par_range[:mat] = $1.to_i
  195. when Weapon_Range::Notetags[:cert] then @par_range[:cert] = $1.to_i
  196. end
  197. end
  198. end
  199.  
  200. end
  201.  
  202. #==============================================================================
  203. class Game_Battler < Game_BattlerBase
  204. #==============================================================================
  205. #--------------------------------------------------------------------------
  206. # Alias List
  207. #--------------------------------------------------------------------------
  208. alias :_MDV__Range :make_damage_value
  209. alias :_APV__Range :apply_variance
  210. #--------------------------------------------------------------------------
  211. # M.D.V
  212. #--------------------------------------------------------------------------
  213. def make_damage_value(user, item)
  214. @wep_range_user = user
  215. @wep_range_item = item
  216. _MDV__Range(user, item)
  217. end
  218. #--------------------------------------------------------------------------
  219. # Apply Variance Mod
  220. #--------------------------------------------------------------------------
  221. def apply_variance(damage, variance)
  222. user = @wep_range_user
  223. item = @wep_range_item
  224. orig = _APV__Range(damage, variance)
  225. orig += apply_weapon_variance(orig,damage,item,user)
  226. orig
  227. end
  228. #--------------------------------------------------------------------------
  229. # Apply Variance Mod
  230. #--------------------------------------------------------------------------
  231. def apply_weapon_variance(orig,damage,item,user)
  232. return 0 unless user.is_a?(Game_Actor)
  233. dam = orig
  234. user.weapons.each do |e|
  235. next if e == nil
  236. varii = e.par_range[:atk] if item.physical?
  237. varii = e.par_range[:mat] if item.magical?
  238. varii = e.par_range[:cert] if item.certain?
  239. amp = [damage.abs * varii / 100, 0].max.to_i
  240. var = rand(amp + 1) #+ rand(amp + 1) - amp
  241. dam = dam >= 0 ? dam + var : dam - var
  242. end
  243. dam
  244. end
  245.  
  246. end
  247.  
  248. #==============================================================================
  249. class Game_Actor < Game_Battler
  250. #==============================================================================
  251. #--------------------------------------------------------------------------
  252. # ATK Param Range
  253. #--------------------------------------------------------------------------
  254. def atk_par_range
  255. range = param(2)
  256. weapons.each do |w|
  257. next if w == nil
  258. range *= (1+(w.par_range[:atk].to_f/100))
  259. end
  260. return range.to_i
  261. end
  262. #--------------------------------------------------------------------------
  263. # MAT Param Range
  264. #--------------------------------------------------------------------------
  265. def mat_par_range
  266. range = param(2)
  267. weapons.each do |w|
  268. next if w == nil
  269. range += (1+(w.par_range[:mat].to_f/100))
  270. end
  271. return range.to_i
  272. end
  273.  
  274. end
  275.  
  276. #==============================================================================#
  277. # http://dekitarpg.wordpress.com/ #
  278. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement