Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.4
- ★ 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
- 21/10/2o12 - Added atl/dfl gains on lvl up,
- Added Options for Dekita__CORE,
- 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
- # Use these script calls to change the atl/dfl gained for actors upon level up.
- lv_up_atl(actor_id, value)
- lv_up_dfl(actor_id, value)
- ================================================================================
- 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 #
- #######################
- ATL_VOCAB = "Attack Level" # atl
- # Increase Atl on lvl up?
- Gain_Atl_On_Lv = true
- # Default atl gain on lvl up.
- Atl_Lv_Up_Gain = 1
- ATL_NOTETAG = /<atl: (.*)>/i
- NO_ATL_NOTETAG = /<no atl mod>/i
- DFL_VOCAB = "Defence Level" # dfl
- # Increase Dfl on lvl up?
- Gain_Dfl_On_Lv = true
- # Default dfl gain on lvl up.
- Dfl_Lv_Up_Gain = 1
- DFL_NOTETAG = /<dfl: (.*)>/i
- NO_DFL_NOTETAG = /<no dfl mod>/i
- # set this to true for optimize equipments to include atl and dfl
- USE_OPTIMIZE_MOD = true
- # SETTINGS IF USING Dekita__CORE
- # Attack Level
- ATL_Icon = 781
- ATL_Color_1 = Color.new(40, 0, 0)
- ATL_Color_2 = Color.new(255, 120, 0)
- # Defence Level
- DFL_Icon = 681
- DFL_Color_1 = Color.new(0, 0, 40)
- DFL_Color_2 = Color.new(0, 120, 255)
- Draw_Atl_And_Dfl_Gauges = true
- Draw_Atl_And_Dfl_Icons = true
- #####################
- # CUSTOMISATION END #
- #####################
- def self.atls_Gauge_Rate(target, stat)
- if target.is_a?(RPG::EquipItem)
- gauge_rate = self.Get_Equip_atls_Gauge_Rate(target, stat)
- return gauge_rate
- elsif target == false
- return 0
- else
- gauge_rate = self.Get_Actor_atls_Gauge_Rate(target, stat)
- return gauge_rate
- end
- end
- def self.Get_Actor_atls_Gauge_Rate(target, stat)
- return (target.atl.to_f-1)/100 if stat == :vit
- return (target.dfl.to_f-1)/100 if stat == :str
- return 0# nil
- end
- def self.Get_Equip_atls_Gauge_Rate(target, stat)
- return ((target.dpbzformulazS[0].to_f-1)/99).to_f if stat == :atl
- return ((target.dpbzformulazS[1].to_f-1)/99).to_f if stat == :dfl
- return 0# nil
- end
- def self.atls_Value(target, stat)
- return Dekita__CORE::N_A_Vocab if target == false
- return atls_EquipzValue(target, stat) if target.is_a?(RPG::EquipItem)
- return "#{target.atl.to_i}" if stat == :atl
- return "#{target.dfl.to_i}" if stat == :dfl
- return Dekita__CORE::N_A_Vocab
- end
- def self.atls_EquipzValue(target, stat)
- return Dekita__CORE::N_A_Vocab if target == false
- return "#{target.dpbzformulazS[0].to_i}" if stat == :atl && target.is_a?(RPG::EquipItem)
- return "#{target.dpbzformulazS[1].to_i}" if stat == :dfl && target.is_a?(RPG::EquipItem)
- return Dekita__CORE::N_A_Vocab
- end
- def self.atls_Icons(stat)
- return ATL_Icon if stat == :atl
- return DFL_Icon if stat == :dfl
- return 0#nil
- end
- def self.atls_Vocab(stat)
- return ATL_VOCAB if stat == :atl
- return DFL_VOCAB if stat == :dfl
- return "NuLL"#nil
- end
- def self.Get_Gauge_Color_1(stat)
- return ATL_Color_1 if stat == :atl
- return DFL_Color_1 if stat == :dfl
- return Color.new(0, 0, 0)
- end
- def self.Get_Gauge_Color_2(stat)
- return ATL_Color_2 if stat == :atl
- return DFL_Color_2 if stat == :dfl
- return Color.new(0, 0, 0)
- 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[:Dekita__ATL_AND_DFL] = 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
- #==============================================================================
- attr_reader :ATL_Inc_On_Lv
- attr_reader :DFL_Inc_On_Lv
- alias dpbzatlanddflGA_init initialize
- def initialize(actor_id)
- dpbzatlanddflGA_init(actor_id)
- @ATL_Inc_On_Lv = DPB::ATLANDDFL::Atl_Lv_Up_Gain
- @DFL_Inc_On_Lv = DPB::ATLANDDFL::Dfl_Lv_Up_Gain
- end
- alias dpbzatlanddflGAsetup setup
- def setup(actor_id)
- dpbzatlanddflGAsetup(actor_id)
- clear_dpbzformulaz_plus
- end
- alias def_lv_up_atl_dfl level_up
- def level_up
- def_lv_up_atl_dfl
- @dpbzformulaz_plus[0] += @ATL_Inc_On_Lv if DPB::ATLANDDFL::Gain_Atl_On_Lv
- @dpbzformulaz_plus[1] += @DFL_Inc_On_Lv if DPB::ATLANDDFL::Gain_Dfl_On_Lv
- end
- def change_lv_up_atl(value)
- @ATL_Inc_On_Lv = value
- end
- def change_lv_up_dfl(value)
- @DFL_Inc_On_Lv = value
- 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
- def lv_up_atl(actor_id, value)
- actor = $game_actors[actor_id]
- return if actor == nil
- actor.change_lv_up_atl(value)
- end
- def lv_up_dfl(actor_id, value)
- actor = $game_actors[actor_id]
- return if actor == nil
- actor.change_lv_up_dfl(value)
- end
- end# Game_Interpreter
- #===============================================================================#
- # - SCRIPT END - #
- #===============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement