Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # ☆ $D13x - Equipment - Weapon DMG Range
- # -- Author : Dekita
- # -- Version : 1.0
- # -- Level : Easy / Normal
- # -- Requires : N/A
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Equip]={}if$D13x[:Equip]==nil
- $D13x[:Equip]['wep_range'] = true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # o8/o3/2o13 - Started, Finished,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script allows for weapons to have a variance, very similar to the
- # variance used in skills/items.
- # The main difference being, its for weapons, not items/skills.
- # eg.
- # axe = high variance, this would make some hits very high and some very low.
- # hammer = low variance, this means the damage is more steady.
- #
- # in short, using this script means different weapon types actually have
- # different damage ranges...
- #
- # you can have different variances for physical/magical/certain hits
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- # Place Under My $D13x Equipment - Individualize Script (if used)
- #
- #===============================================================================
- # ☆ Notetags ( default )
- # For use with Weapons
- #-------------------------------------------------------------------------------
- # <p range: X>
- # <m range: X>
- # <c range: X>
- # Replace X with an integer value, ie 1/2/3/4/5/6...
- #
- #===============================================================================
- module Weapon_Range
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Main Settings
- #--------------------------------------------------------------------------
- # These are the default settings given to weapons (based on weapon type)
- # if they have not been notetagged otherwise.
- # id => [ phys , magi , cert ]
- Type ={
- 1 => [ 40 , 10 , 0 ], # Default = Axe
- 2 => [ 20 , 10 , 0 ], # Default = Claw
- 3 => [ 25 , 10 , 0 ], # Default = Spear
- 4 => [ 20 , 10 , 0 ], # Default = Sword
- 5 => [ 15 , 15 , 0 ], # Default = Katana
- 6 => [ 50 , 20 , 0 ], # Default = Bow
- 7 => [ 10 , 10 , 0 ], # Default = Dagger
- 8 => [ 30 , 10 , 0 ], # Default = Hammer
- 9 => [ 30 , 30 , 0 ], # Default = Staff
- 10 => [ 10 , 10 , 0 ], # Default = Gun
- # << Add more lines here if you have more than 10 weapon types :)
- }# << Keep
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Notetag Settings
- #--------------------------------------------------------------------------
- # These are the default notetags used in the weapon notebox
- # only modify these if you know what your doing.
- # type => /<note vocab:(.*)>/i ,
- Notetags={
- :atk => /<p range:(.*)>/i ,
- :mat => /<m range:(.*)>/i ,
- :cert => /<c range:(.*)>/i ,
- }# << Keep
- end #####################
- # CUSTOMISATION END #
- #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- if !$D13x[:CORE]
- #===============================================================================
- module DataManager
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- class << self
- alias :lbd_unique_wepran :load_database
- end
- #---------------------------------------------------------------------------
- # Load Database (alias)
- #---------------------------------------------------------------------------
- def self.load_database
- lbd_unique_wepran
- loa_unique_wepran
- end
- #---------------------------------------------------------------------------
- # Load Unique Shit
- #---------------------------------------------------------------------------
- def self.loa_unique_shits
- for wep in $data_weapons
- next if wep == nil
- wep.load_unique_wepran
- end
- end
- end # DataManager
- end # if !$D13x[:CORE]
- #==============================================================================
- class RPG::EquipItem < RPG::BaseItem
- #==============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- alias :deki_weapon_range :load_unique_shit if $D13x[:CORE]
- #---------------------------------------------------------------------------
- # Pi Variables
- #---------------------------------------------------------------------------
- attr_accessor :par_range
- #---------------------------------------------------------------------------
- # Load Unique Shit
- #---------------------------------------------------------------------------
- def load_unique_shit
- deki_weapon_range if $D13x[:CORE]
- load_unique_wepran
- end
- #---------------------------------------------------------------------------
- # Load Unique Notes
- #---------------------------------------------------------------------------
- def load_unique_wepran
- @par_range = {:atk=>0,:mat=>0,:cert=>0}
- load_weapon_ranges
- end
- #---------------------------------------------------------------------------
- # Load Weapon Ranges
- #---------------------------------------------------------------------------
- def load_weapon_ranges
- return unless self.is_a?(RPG::Weapon)
- @par_range[:atk] = Weapon_Range::Type[self.wtype_id][0]
- @par_range[:mat] = Weapon_Range::Type[self.wtype_id][1]
- @par_range[:cert] = Weapon_Range::Type[self.wtype_id][2]
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Weapon_Range::Notetags[:atk] then @par_range[:atk] = $1.to_i
- when Weapon_Range::Notetags[:mat] then @par_range[:mat] = $1.to_i
- when Weapon_Range::Notetags[:cert] then @par_range[:cert] = $1.to_i
- end
- end
- end
- end
- #==============================================================================
- class Game_Battler < Game_BattlerBase
- #==============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :_MDV__Range :make_damage_value
- alias :_APV__Range :apply_variance
- #--------------------------------------------------------------------------
- # M.D.V
- #--------------------------------------------------------------------------
- def make_damage_value(user, item)
- @wep_range_user = user
- @wep_range_item = item
- _MDV__Range(user, item)
- end
- #--------------------------------------------------------------------------
- # Apply Variance Mod
- #--------------------------------------------------------------------------
- def apply_variance(damage, variance)
- user = @wep_range_user
- item = @wep_range_item
- orig = _APV__Range(damage, variance)
- orig += apply_weapon_variance(orig,damage,item,user)
- orig
- end
- #--------------------------------------------------------------------------
- # Apply Variance Mod
- #--------------------------------------------------------------------------
- def apply_weapon_variance(orig,damage,item,user)
- return 0 unless user.is_a?(Game_Actor)
- dam = orig
- user.weapons.each do |e|
- next if e == nil
- varii = e.par_range[:atk] if item.physical?
- varii = e.par_range[:mat] if item.magical?
- varii = e.par_range[:cert] if item.certain?
- amp = [damage.abs * varii / 100, 0].max.to_i
- var = rand(amp + 1) + rand(amp + 1) - amp
- dam = dam >= 0 ? dam + var : dam - var
- end
- dam
- end
- end
- #==============================================================================
- class Game_Actor < Game_Battler
- #==============================================================================
- #--------------------------------------------------------------------------
- # ATK Param Range
- #--------------------------------------------------------------------------
- def atk_par_range
- range = param(2)
- weapons.each do |w|
- next if w == nil
- range *= (1+(w.par_range[:atk].to_f/100))
- end
- return range.to_i
- end
- #--------------------------------------------------------------------------
- # MAT Param Range
- #--------------------------------------------------------------------------
- def mat_par_range
- range = param(2)
- weapons.each do |w|
- next if w == nil
- range += (1+(w.par_range[:mat].to_f/100))
- end
- return range.to_i
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement