Advertisement
Dekita

weapon range 1.1

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