Advertisement
Dekita

$D13x Weapon DMG Range v1.0

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