Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.1
- ★ 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.
- ================================================================================
- ★☆★☆★☆★☆★☆★☆★☆★ 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.(into other game engines e.g RGSS2)
- 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/ or DekitaRPG@gmail.com
- ================================================================================
- History:
- =========
- D /M /Y
- 19/09/2o12 - Added atl/dfl state mods,
- improved methods,
- 17/09/2o12 - improved m_d_v method,
- 15/09/2o12 - improved methods,
- 13/09/2o12 - Finished atl & dfl,
- 12/09/2o12 - Started Script,
- ================================================================================
- Credit and Thanks to :
- =======================
- ¥ami - for helping me alias make_damage_value the way i needed ^_^
- ================================================================================
- 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 state noteboxes to increase stats by X amount
- of points when state is inflicted.
- 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 ^_^
- ================================================================================
- Skill Formula's:
- =================
- 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
- ================================================================================
- Conditional Branch:
- ====================
- you can use the script option in conditional branches to check actors
- attack and defence levels, simply put either
- $game_actors[x].stat == y
- $game_party.members[x].stat == y
- replace x with actor id and replace y with a value
- replace "stat" with either atl or dfl, examples below
- $game_actors[1].atl == 30
- this will check if actor id [1] has atl(attack level) equal to 30
- $game_party.members[0].dfl == 30
- this will check if the partys member [0] (0 is the party leader) has dfl
- (defence level) equal to 30
- you can also replace "==" with either
- "<=" (below/equal to) or
- ">=" (greater than/equal to)
- =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
- # set this to true for optimize equipments to include atl and dfl
- USE_OPTIMIZE_MOD = true
- # NOTETAG CUSTOMISATION, only change these if you have to for
- # compatability reasons.
- ATL_NOTETAG = /<atl: (.*)>/i
- NO_ATL_NOTETAG = /<no atl mod>/i
- DFL_NOTETAG = /<dfl: (.*)>/i
- NO_DFL_NOTETAG = /<no dfl mod>/i
- #####################
- # 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 = DPB::ATLANDDFL::ATL_NOTETAG
- INC_DFL = DPB::ATLANDDFL::DFL_NOTETAG
- end # EQUIPITEM
- module USEABLEITEMDAMAGE
- EXCLUDE_ATL = DPB::ATLANDDFL::NO_ATL_NOTETAG
- EXCLUDE_DFL = DPB::ATLANDDFL::NO_DFL_NOTETAG
- 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, $data_states]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_notetags_ATL_DFL
- end
- end
- end
- end # DataManager
- #==============================================================================
- class RPG::State < 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::State
- #==============================================================================
- 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::Weapon < RPG::EquipItem
- #==============================================================================
- alias atlanddflperformance performance
- def performance
- atlanddflperformance + atlanddfl_performance
- end
- def atlanddfl_performance
- if DPB::ATLANDDFL::USE_OPTIMIZE_MOD
- (dpbzformulazS[0] * 10) + (dpbzformulazS[1] * 10)
- else
- 0 # //
- end
- end
- end # class
- #==============================================================================
- class RPG::Armor < RPG::EquipItem
- #==============================================================================
- alias atlanddflperformance performance
- def performance
- atlanddflperformance + atlanddfl_performance
- end
- def atlanddfl_performance
- if DPB::ATLANDDFL::USE_OPTIMIZE_MOD
- (dpbzformulazS[0] * 10) + (dpbzformulazS[1] * 10)
- else
- 0 # //
- end
- end
- end # class
- #==============================================================================
- 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_Temp
- #==============================================================================
- attr_reader :temp_atl_dfl_mod_for_user
- attr_reader :temp_atl_dfl_mod_for_item
- alias atlanddflinit initialize
- def initialize
- atlanddflinit
- @temp_atl_dfl_mod_for_user = 0
- @temp_atl_dfl_mod_for_item = 0
- end
- end # class
- #==============================================================================
- class Game_BattlerBase
- #==============================================================================
- FEATURE_DPBzFORMULAZ = 1990
- 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_DPBzFORMULAZ, 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 dflandatlmdv make_damage_value
- def make_damage_value(user, item)
- @temp_atl_dfl_mod_for_user = user
- @temp_atl_dfl_mod_for_item = item
- dflandatlmdv(user, item)
- end
- alias atlanddflapplyguard apply_guard
- def apply_guard(damage)
- user = @temp_atl_dfl_mod_for_user
- item = @temp_atl_dfl_mod_for_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
- atlanddflapplyguard(damage) * 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)
- atlndfl += dpbz_atlanddfl_states_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
- def dpbz_atlanddfl_states_rate(dpbzformulaz_id)
- atlndflrate = 0.0
- atlndflrate += states.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]
- atlndfl += dpbz_atlanddfl_states_rate(dpbzformulaz_id)
- return atlndfl
- end
- def dpbz_atlanddfl_states_rate(dpbzformulaz_id)
- atlndflrate = 0.0
- atlndflrate += states.compact.inject(0) {|r, i|
- r += i.dpbzformulazS[dpbzformulaz_id] rescue 0 }
- return atlndflrate
- 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