Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.0
- ★ Perfect Attack and Defence Levels™ ★
- ================================================================================
- Script Information:
- ====================
- This script is a replica of a feature from an MMORPG game called Pwi (perfect
- world international) called attack and defence levels.
- This basically gives you two new stats called attack level and defence level.
- For each 1 attack level you have above your opponents defence level you deal
- 1% more damage,
- For each 1 defence level you have above your opponents attack level you receive
- 1% less damage,
- If you have 100 defence level and opponent has no attack level NO damage will
- be received.
- NOTE: for now this modification acts as an elemental weakness.
- ================================================================================
- TERMS OF USE:
- ==============
- 1. You MUST give credit to Dekita.
- 2. This script is for NON-Commercial use ONLY!*
- 3. You CANNOT give credit to yourself for Re-posting this script
- or Posting a modified version.*
- 4. Do not Re-Distribute/Re-Post this script.
- 5. You are NOT allowed to convert this script to any other engine,
- E.G converting it from RGSS3 into RGSS2.*
- 6. ENJOY!
- -------------------------------------------------------------------------------
- * = Unless permissions are given by Dekita.
- http://dekitarpg.wordpress.com/
- ================================================================================
- History:
- =========
- D /M /Y
- 15/09/2o12 - improved methods,
- 13/09/2o12 - Finished atl & dfl,
- 12/09/2o12 - Started Script,
- ================================================================================
- Credit and Thanks to :
- =======================
- N/A
- ================================================================================
- Known Bugs:
- ============
- N/A
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- If a new bug is found please contact me at
- http://dekitarpg.wordpress.com/
- ================================================================================
- INSTRUCTIONS:
- ==============
- Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
- ================================================================================
- Script Calls:
- ==============
- inc_atl(actor_id, value)
- inc_dfl(actor_id, value)
- replace actor_id with the id number of the actor (found in the database)
- replace value with the amount you want the stat to increase(can be negative).
- e.g
- inc_atl(1, 10) < This will increase actor 1's atl by 10
- inc_dfl(2, 15) < This will increase actor 2's dfl by 15
- ================================================================================
- NoteTags:
- ==========
- <atl: X>
- <dfl: X>
- Place these notetags into weapon or armor noteboxes to increase actors stats by
- X amount of points when the item is equipped,
- Place these notetags into enemy noteboxes to increase the enemys stats by
- X amount of points.
- Replace X with a value, e.g <atl: 5> will increase attack level by 5
- --------------------------------------------------------------------------------
- <no atl mod>
- <no dfl mod>
- place these notetags into skill and item noteboxes if you DO NOT want to include
- attack and defence levels when that skill/item is used ^_^
- ================================================================================
- Other:
- =======
- you can use attack and defence level in your skill formulas if you want
- by using
- a.atl a.dfl b.atl b.dfl
- .atl will return the value of a/b attack level e.g 50
- .dfl will return the value of a/b defence level e.g 50
- =end #==========================================================================#
- module DPB ; module ATLANDDFL
- #######################
- # CUSTOMISATION BEGIN #
- #######################
- # The vocab for your nice new damage modification stats.
- ATL_VOCAB = "Attack Level" # atl
- DFL_VOCAB = "Defence Level" # dfl
- #####################
- # CUSTOMISATION END #
- end ; end # module #####################
- #===============================================================================#
- # http://dekitarpg.wordpress.com/
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? #
- # WELL SLAP MY FACE AND CALL ME A DRAGON.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- #================================================================================
- # Import:
- #========
- $imported = {} if $imported.nil?
- $imported["DPB-ATLANDDFL"] = true
- #==============================================================================
- module Vocab
- #==============================================================================
- def self.atl ; return DPB::ATLANDDFL::ATL_VOCAB ; end
- def self.dfl ; return DPB::ATLANDDFL::DFL_VOCAB ; end
- end # Vocab
- module DPB ; module REGEXP ; module EQUIPITEM
- INC_ATL = /<atl: (.*)>/i
- INC_DFL = /<dfl: (.*)>/i
- end # EQUIPITEM
- module USEABLEITEMDAMAGE
- EXCLUDE_ATL = /<no atl mod>/i
- EXCLUDE_DFL = /<no dfl mod>/i
- end ; end ; end # USEABLEITEMDAMAGE ; REGEXP ; DPB
- #==============================================================================
- module DataManager
- #==============================================================================
- class <<self; alias load_database_ATL_DFL load_database; end
- def self.load_database
- load_database_ATL_DFL
- load_notetags_ATL_DFL
- end
- def self.load_notetags_ATL_DFL
- groups = [$data_weapons, $data_armors, $data_enemies]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_notetags_ATL_DFL
- end
- end
- end
- end # DataManager
- #==============================================================================
- class RPG::EquipItem < RPG::BaseItem
- #==============================================================================
- attr_accessor :dpbzformulazS
- def load_notetags_ATL_DFL
- @dpbzformulazS = [0] * 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when DPB::REGEXP::EQUIPITEM::INC_ATL
- @dpbzformulazS[0] += $1.to_i
- when DPB::REGEXP::EQUIPITEM::INC_DFL
- @dpbzformulazS[1] += $1.to_i
- end
- } # self.note.split
- end
- end # RPG::EquipItem
- #==============================================================================
- class RPG::Enemy < RPG::BaseItem
- #==============================================================================
- attr_accessor :dpbzformulazS
- def load_notetags_ATL_DFL
- @dpbzformulazS = [0] * 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when DPB::REGEXP::EQUIPITEM::INC_ATL
- @dpbzformulazS[0] += $1.to_i
- when DPB::REGEXP::EQUIPITEM::INC_DFL
- @dpbzformulazS[1] += $1.to_i
- end
- } # self.note.split
- end
- end # RPG::Enemy
- #==============================================================================
- class Game_BattlerBase
- #==============================================================================
- alias dpb_atlanddfl_init initialize
- def initialize(*args, &block)
- clear_dpbzformulaz_plus
- dpb_atlanddfl_init(*args, &block)
- end
- def atl; dpbzformulaz(0); end
- def dfl; dpbzformulaz(1); end
- def dpbzformulaz(dpbzformulaz_id)
- (features_sum(FEATURE_PARAM, dpbzformulaz_id) + dpbzformulaz_plus(dpbzformulaz_id))
- end
- def dpbzformulaz_plus(dpbzformulaz_id)
- @dpbzformulaz_plus[dpbzformulaz_id]
- end
- def clear_dpbzformulaz_plus
- @dpbzformulaz_plus = [0] * 2
- end
- def add_dpbzformulaz(dpbzformulaz_id, value)
- @dpbzformulaz_plus[dpbzformulaz_id] += value
- refresh
- end
- end # Game_BattlerBase
- #==============================================================================
- class Game_Battler < Game_BattlerBase
- #==============================================================================
- alias atlanddfl_item_element_rate item_element_rate
- def item_element_rate(user, item)
- if item.note =~ DPB::REGEXP::USEABLEITEMDAMAGE::EXCLUDE_ATL
- atlval = 1 ; else ; atlval = ((100 + user.atl) * 0.01) ; end # if
- if item.note =~ DPB::REGEXP::USEABLEITEMDAMAGE::EXCLUDE_DFL
- dflval = 1 ; else ; dflval = (1.0 - (dfl * 0.01)) ; end # if
- atlanddfl_item_element_rate(user, item) * atlval * dflval
- end
- end # Game_Battler
- #==============================================================================
- class Game_Actor < Game_Battler
- #==============================================================================
- alias dpbzatlanddflGAsetup setup
- def setup(actor_id)
- dpbzatlanddflGAsetup(actor_id)
- clear_dpbzformulaz_plus
- end
- alias game_actor_atlanddfl_formulaz_plus dpbzformulaz_plus
- def dpbzformulaz_plus(dpbzformulaz_id)
- atlndfl = game_actor_atlanddfl_formulaz_plus(dpbzformulaz_id)
- atlndfl += dpbz_atlanddfl_rate(dpbzformulaz_id)
- return atlndfl
- end
- def dpbz_atlanddfl_rate(dpbzformulaz_id)
- atlndflrate = 0.0
- atlndflrate += equips.compact.inject(0) {|r, i|
- r += i.dpbzformulazS[dpbzformulaz_id] rescue 0 }
- return atlndflrate
- end
- end # Game_Actor
- #==============================================================================
- class Game_Enemy < Game_Battler
- #==============================================================================
- alias game_enemy_formulaz_plus_atlanddfl dpbzformulaz_plus
- def dpbzformulaz_plus(dpbzformulaz_id)
- atlndfl = game_enemy_formulaz_plus_atlanddfl(dpbzformulaz_id)
- atlndfl += enemy.dpbzformulazS[dpbzformulaz_id]
- return atlndfl
- end
- end # Game_Enemy
- #==============================================================================
- class Game_Interpreter
- #==============================================================================
- def inc_atl(actor_id, value)
- actor = $game_actors[actor_id]
- return if actor == nil
- actor.add_dpbzformulaz(0, value)
- end
- def inc_dfl(actor_id, value)
- actor = $game_actors[actor_id]
- return if actor == nil
- actor.add_dpbzformulaz(1, value)
- end
- end# Game_Interpreter
- #===============================================================================#
- # - SCRIPT END - #
- #===============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement