Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Attack | Defence Levels
- # -- Author : Dekita
- # -- Version : 1.4
- # -- Level : Easy / Normal
- # -- Requires : N/A
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Atk_Def_Lvs]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 17/o3/2o14 - Added Vocanicon Module,
- # 31/o5/2o13 - Added More Help Info For Script Calls.
- # 20/o5/2o13 - Complete Rewrite Of Old Script, (Moved to $D13x Engine v1.0)
- # 21/10/2o12 - Finished v1.4, (Perfect Atl & Dfl(old script))
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script is a replica of a feature from an MMORPG called PWi.
- # You now have two new stats, atl (attack lv) and dfl (defence lv).
- #
- # For every 1 atl (Attack Level) you have above your targets dfl (Defence Level)
- # you will deal 1% more damage.
- #
- # For every 1 dfl (Defence Level) you have above your targets atl (Attack Level)
- # you will take 1% less damage.
- # The same rule applies for actor and enemies.
- #
- # You can increase your Atk Lv / Def Lv a number of different ways,
- # via notetags, script calls && other scripts (like my distribution system).
- #
- # NOTE : Place this script above $D13x Damage Limits !!
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ 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 "
- # " $D13x Statistic Control "
- # " $D13x Elements Control "
- #
- # Place Above >>
- # " ▼ Main "
- # " $D13x Equipment Sets"
- # " $D13x Dev Stat Lvl Up Distribution"
- # " $D13x Learn Skill Reqs "
- # " $D13x Equip Reqs"
- #
- # Placing this script in this order will prevent bugs / faults / FPS drop.
- # NONE of the above scripts are required for this script to work !!
- #
- #===============================================================================
- # ☆ Notetags ( default )
- # For : Weapons / Armors / Enemies / Actors / Classes / States / Skills / Items
- #-------------------------------------------------------------------------------
- # <atl: value>
- # <dfl: value>
- # use these notetags to increase the atl / dfl of an item, eg. give to an equip
- # for it to increase a stat when equipped..
- #
- # <max atl: value>
- # <max dfl: value>
- # use these notetags to increase the MAX atl / dfl of an item,
- # eg. give to an skill for it to increase the max atl / dfl when learned..
- #
- # <no atl>
- # <no dfl>
- # use these notetag to change whether atl or dfl can be ignored, eg. if actor
- # (or enemy) has a state that has <no atl> attack level modification will not
- # happen.
- #
- #-------------------------------------------------------------------------------
- # All Increases and Decreases are stacked, using the following calculation ..
- # Base + Actor(or Enemy) + Class(if actor) + Equipment(if actor) + States +
- # Skills that modify stats or max stats (ie passive skills) (if actor)
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # $game_actor[ACTOR_ID].add_atl(VALUE)
- # $game_actor[ACTOR_ID].sub_atl(VALUE)
- # $game_actor[ACTOR_ID].div_atl(VALUE)
- # $game_actor[ACTOR_ID].mul_atl(VALUE)
- # $game_actor[ACTOR_ID].mod_atl(VALUE)
- # ^- Script calls to control Attack Level
- #
- # $game_actor[ACTOR_ID].add_dfl(VALUE)
- # $game_actor[ACTOR_ID].sub_dfl(VALUE)
- # $game_actor[ACTOR_ID].div_dfl(VALUE)
- # $game_actor[ACTOR_ID].mul_dfl(VALUE)
- # $game_actor[ACTOR_ID].mod_dfl(VALUE)
- # ^- Script calls to control Defence Level
- #
- # these are the calculatons for each control type
- # add : current stat += value
- # sub : current stat -= value
- # div : current stat /= value
- # mul : current stat *= value
- # mod : current stat %= value
- #
- # These script calls modify the Actor value, other items remain in the same order.
- #
- # There is also a second arguement for all the above script calls,
- # it is a boolean arguement to determine if the player should be refreshed.
- # eg.. $game_actors[1].mul_atl(10, false)
- # this is very helpfull for maintaining FPS when adding LOTS of stats..
- # The default to this arguemet is true.
- # If you don't understand what this mean, just disregard this information :)
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # You can use atl and dfl in your skilll formulas and conditional branches...
- # Here is an example for a skill formula
- # [(a.atk+a.atl*2) - (b.def+b.dfl*1.5), 0].min
- #
- # Here is an example for a conditional branch
- # $game_actors[ACTOR_ID].atl > 5
- # ^- Checks if actor (ACTOR_ID) has atl to a value greater than 5
- #
- # $game_actors[ACTOR_ID].atl <= 5
- # ^- Checks if actor (ACTOR_ID) has atl to a value lower than or equal to 5
- #
- #===============================================================================
- module Atl_Dfl
- #===============================================================================
- # Limits = [ min , max ]
- Atl_Limits = [ 0 , 99 ]
- Dfl_Limits = [ 0 , 99 ]
- Notes={
- :atk_lvl => /<atl:(.*)>/i,
- :def_lvl => /<dfl:(.*)>/i,
- :no_atk_ => /<no atl>/i,
- :no_atk_ => /<no dfl>/i,
- :max_atk => /<max atl:(.*)>/i,
- :max_def => /<max dfl:(.*)>/i,
- }
- #####################
- # CUSTOMISATION END #
- end #####################
- #===============================================================================
- module Vocanicon
- #===============================================================================
- Atk_Level = ["Attack Lv" , Text_Color::White , 105, 0]
- Def_Level = ["Defence Lv" , Text_Color::White , 106, 0]
- #####################
- # CUSTOMISATION END #
- 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.\..\.. #
- #===============================================================================#
- module Atl_Dfl
- #===============================================================================
- Atl_Name = Vocanicon::Atk_Level[0] ; Dfl_Name = Vocanicon::Def_Level[0]
- end
- #===============================================================================
- module DataManager
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- class <<self
- alias :ldb_atk_level :load_database
- end
- #-----------------------------------------------------------------------------
- # Load Database
- #-----------------------------------------------------------------------------
- def self.load_database
- ldb_atk_level
- loa_atk_level
- end
- #-----------------------------------------------------------------------------
- # Load Attack Level
- #-----------------------------------------------------------------------------
- def self.loa_atk_level
- classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
- $data_actors , $data_classes, $data_enemies, $data_states ]
- for g in classes
- for o in g
- next if o == nil
- o.load_attack_level
- end
- end
- end
- end
- #===============================================================================
- class RPG::BaseItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_accessor :atk_level
- attr_accessor :def_level
- attr_accessor :atk_level_limit
- attr_accessor :def_level_limit
- attr_accessor :ignore_atl
- attr_accessor :ignore_dfl
- #-----------------------------------------------------------------------------
- # Load Attack Level
- #-----------------------------------------------------------------------------
- def load_attack_level
- @atk_level = 0
- @def_level = 0
- @ignore_atl = false
- @ignore_dfl = false
- @atk_level_limit = 0
- @def_level_limit = 0
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Atl_Dfl::Notes[:atk_lvl] then @atk_level = $1.to_i
- when Atl_Dfl::Notes[:def_lvl] then @def_level = $1.to_i
- when Atl_Dfl::Notes[:no_atk_] then @ignore_atl = true
- when Atl_Dfl::Notes[:no_def_] then @ignore_dfl = true
- when Atl_Dfl::Notes[:max_atk] then @atk_level_limit = $1.to_i
- when Atl_Dfl::Notes[:max_def] then @def_level_limit = $1.to_i
- end
- end
- end
- end
- #===============================================================================
- class RPG::Weapon < RPG::EquipItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :atk_level_perf :performance
- #-----------------------------------------------------------------------------
- # Performance
- #-----------------------------------------------------------------------------
- def performance
- atk_level_perf + atk_levl_performance
- end
- #-----------------------------------------------------------------------------
- # Attack Level Performance
- #-----------------------------------------------------------------------------
- def atk_levl_performance
- @atk_level + @def_level * 10
- end
- end
- #===============================================================================
- class RPG::Armor < RPG::EquipItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :atk_level_perf :performance
- #-----------------------------------------------------------------------------
- # Performance
- #-----------------------------------------------------------------------------
- def performance
- atk_level_perf + atk_levl_performance
- end
- #-----------------------------------------------------------------------------
- # Attack Level Performance
- #-----------------------------------------------------------------------------
- def atk_levl_performance
- @atk_level + @def_level * 10
- end
- end
- #===============================================================================
- class Game_BattlerBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Atl | Dfl Feature Code
- #-----------------------------------------------------------------------------
- F_atk_level = 19052013
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :init_atk_level :initialize
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize(*args, &block)
- @atl_dfl_prefix = [0] * 2
- clear_atl_dfl_plus
- init_atk_level(*args, &block)
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv
- #-----------------------------------------------------------------------------
- def atl ; atl_dfl(0) ; end
- def dfl ; atl_dfl(1) ; end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv Min
- #-----------------------------------------------------------------------------
- def atl_dfl_min(id)
- return Atl_Dfl::Atl_Limits[0] if id == 0
- return Atl_Dfl::Dfl_Limits[0] if id == 1
- return 0
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv Max
- #-----------------------------------------------------------------------------
- def atl_dfl_max(id)
- return Atl_Dfl::Atl_Limits[1] if id == 0
- return Atl_Dfl::Dfl_Limits[1] if id == 1
- return 0
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv
- #-----------------------------------------------------------------------------
- def atl_dfl(id)
- valu = features_sum(F_atk_level, id) + atl_dfl_plus(id)
- newv = [[valu, atl_dfl_max(id)].min, atl_dfl_min(id)].max
- @atl_dfl_prefix[id] = newv.to_i
- @atl_dfl_prefix[id]
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv ++
- #-----------------------------------------------------------------------------
- def atl_dfl_plus(id)
- @atl_dfl_plus[id]
- end
- #-----------------------------------------------------------------------------
- # Clear Atk Lv | Def Lv
- #-----------------------------------------------------------------------------
- def clear_atl_dfl_plus
- @atl_dfl_plus = [0] * 2
- end
- #-----------------------------------------------------------------------------
- # Add Atk Lv
- #-----------------------------------------------------------------------------
- def add_atl(value, ref = true)
- @atl_dfl_plus[0] += value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Sub Atk Lv
- #-----------------------------------------------------------------------------
- def sub_atl(value, ref = true)
- @atl_dfl_plus[0] -= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Div Atk Lv
- #-----------------------------------------------------------------------------
- def div_atl(value, ref = true)
- @atl_dfl_plus[0] /= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Mul Atk Lv
- #-----------------------------------------------------------------------------
- def mul_atl(value, ref = true)
- @atl_dfl_plus[0] *= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Mod Atk Lv
- #-----------------------------------------------------------------------------
- def mod_atl(value, ref = true)
- @atl_dfl_plus[0] %= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Add Dfl Lv
- #-----------------------------------------------------------------------------
- def add_dfl(value, ref = true)
- @atl_dfl_plus[1] += value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Sub Dfl Lv
- #-----------------------------------------------------------------------------
- def sub_dfl(value, ref = true)
- @atl_dfl_plus[1] -= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Div Dfl Lv
- #-----------------------------------------------------------------------------
- def div_dfl(value, ref = true)
- @atl_dfl_plus[1] /= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Mul Dfl Lv
- #-----------------------------------------------------------------------------
- def mul_dfl(value, ref = true)
- @atl_dfl_plus[1] *= value
- refresh if ref
- end
- #-----------------------------------------------------------------------------
- # Mod Dfl Lv
- #-----------------------------------------------------------------------------
- def mod_dfl(value, ref = true)
- @atl_dfl_plus[1] %= value
- refresh if ref
- end
- end # Game_BattlerBase
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :dflandatlmdv :make_damage_value
- alias :atlanddflapplyguard :apply_guard
- #-----------------------------------------------------------------------------
- # 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
- #-----------------------------------------------------------------------------
- # Apply Guard
- #-----------------------------------------------------------------------------
- def apply_guard(damage)
- newd = (atlanddflapplyguard(damage)*apply_atl_dfl_mod)
- # p "DMG After Atk/Dfl Mod = #{newd}" if @temp_atl_dfl_mod_for_user.is_a?(Game_Actor)
- newd
- end
- #-----------------------------------------------------------------------------
- # Apply Atk Lv || Def Lv Damage Mod
- #-----------------------------------------------------------------------------
- def apply_atl_dfl_mod
- user = @temp_atl_dfl_mod_for_user
- item = @temp_atl_dfl_mod_for_item
- atlval = ((100 + user.atl) * 0.01)
- atlval = 1 if user.can_ignore_atl || item.ignore_atl
- dflval = (1.0 - (dfl * 0.01))
- dflval = 1 if user.can_ignore_dfl || item.ignore_dfl
- newdam = (atlval*dflval)
- newdam
- end
- end
- #===============================================================================
- class Game_Actor < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Can Ignore ATL Mod
- #-----------------------------------------------------------------------------
- def can_ignore_atl
- return true if actor.ignore_atl
- return true if self.class.ignore_atl
- equips.each do |e|
- next unless e
- return true if e.ignore_atl
- end
- states.each do |st|
- next unless st
- return true if st.ignore_atl
- end
- skills.each do |sk|
- next unless sk
- return true if sk.ignore_atl
- end
- return false
- end
- #-----------------------------------------------------------------------------
- # Can Ignore DFL Mod
- #-----------------------------------------------------------------------------
- def can_ignore_dfl
- return true if actor.ignore_dfl
- return true if self.class.ignore_dfl
- equips.each do |e|
- next unless e
- return true if e.ignore_dfl
- end
- states.each do |st|
- next unless st
- return true if st.ignore_dfl
- end
- skills.each do |sk|
- next unless sk
- return true if sk.ignore_dfl
- end
- return false
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv ++
- #-----------------------------------------------------------------------------
- def atl_dfl_plus(id)
- base = super(id)
- base += atl_level_plus_mods if id == 0
- base += dfl_level_plus_mods if id == 1
- base
- end
- #-----------------------------------------------------------------------------
- # Atk Lv ++ Modifications
- #-----------------------------------------------------------------------------
- def atl_level_plus_mods
- base = 0
- base += actor.atk_level
- base += self.class.atk_level
- base += equips.compact.inject(0) {|r, i| r += i.atk_level }
- base += states.compact.inject(0) {|r, i| r += i.atk_level }
- if $D13x[:Skill_Lv]
- base += skills.compact.inject(0) {|r, i| r += (i.atk_level*
- Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_i}
- else
- base += skills.compact.inject(0) {|r, i| r += i.atk_level }
- end
- base
- end
- #-----------------------------------------------------------------------------
- # Def Lv ++ Modifications
- #-----------------------------------------------------------------------------
- def dfl_level_plus_mods
- base = 0
- base += actor.def_level
- base += self.class.def_level
- base += equips.compact.inject(0) {|r, i| r += i.def_level }
- base += states.compact.inject(0) {|r, i| r += i.def_level }
- if $D13x[:Skill_Lv]
- base += skills.compact.inject(0) {|r, i| r += (i.def_level*
- Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_i}
- else
- base += skills.compact.inject(0) {|r, i| r += i.def_level }
- end
- base
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv Max
- #-----------------------------------------------------------------------------
- def atl_dfl_max(id)
- base = super(id)
- case id
- when 0 then base += calc_atl_mods_max
- when 1 then base += calc_dfl_mods_max
- end
- base
- end
- #-----------------------------------------------------------------------------
- # Calculate Atk Lv Max
- #-----------------------------------------------------------------------------
- def calc_atl_mods_max
- base = actor.atk_level_limit
- base += self.class.atk_level_limit
- base += equips.compact.inject(0) {|r, i| r += i.atk_level_limit }
- base += states.compact.inject(0) {|r, i| r += i.atk_level_limit }
- if $D13x[:Skill_Lv]
- base += skills.compact.inject(0) {|r, i| r += (i.atk_level_limit*
- Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_i}
- else
- base += skills.compact.inject(0) {|r, i| r += i.atk_level_limit }
- end
- base
- end
- #-----------------------------------------------------------------------------
- # Calculate Def Lv Max
- #-----------------------------------------------------------------------------
- def calc_dfl_mods_max
- base = actor.def_level_limit
- base += self.class.def_level_limit
- base += equips.compact.inject(0) {|r, i| r += i.def_level_limit }
- base += states.compact.inject(0) {|r, i| r += i.def_level_limit }
- if $D13x[:Skill_Lv]
- base += skills.compact.inject(0) {|r, i| r += (i.def_level_limit*
- Skill_Levels::Exp_Set[i.exp_set][@skills_lv[i.id]][2] ).to_i}
- else
- base += skills.compact.inject(0) {|r, i| r += i.def_level_limit }
- end
- base
- end
- end
- #===============================================================================
- class Game_Enemy < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Can Ignore ATL Mod
- #-----------------------------------------------------------------------------
- def can_ignore_atl
- return true if enemy.ignore_atl
- states.each do |st|
- next unless st
- return true if st.ignore_atl
- end
- return false
- end
- #-----------------------------------------------------------------------------
- # Can Ignore DFL Mod
- #-----------------------------------------------------------------------------
- def can_ignore_dfl
- return true if enemy.ignore_dfl
- states.each do |st|
- next unless st
- return true if st.ignore_dfl
- end
- return false
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv ++
- #-----------------------------------------------------------------------------
- def atl_dfl_plus(id)
- base = super(id)
- base += atl_level_plus_mods if id == 0
- base += dfl_level_plus_mods if id == 1
- base
- end
- #-----------------------------------------------------------------------------
- # Atk Lv ++ Modifications
- #-----------------------------------------------------------------------------
- def atl_level_plus_mods
- base = 0
- base += enemy.atk_level
- base += states.compact.inject(0) {|r, i| r += i.atk_level }
- base
- end
- #-----------------------------------------------------------------------------
- # Def Lv ++ Modifications
- #-----------------------------------------------------------------------------
- def dfl_level_plus_mods
- base = 0
- base += enemy.def_level
- base += states.compact.inject(0) {|r, i| r += i.def_level }
- base
- end
- #-----------------------------------------------------------------------------
- # Atk Lv | Def Lv Max
- #-----------------------------------------------------------------------------
- def atl_dfl_max(id)
- base = super(id)
- case id
- when 0 then base += calc_atl_mods_max
- when 1 then base += calc_dfl_mods_max
- end
- base
- end
- #-----------------------------------------------------------------------------
- # Calculate Atk Lv Max
- #-----------------------------------------------------------------------------
- def calc_atl_mods_max
- base = enemy.atk_level_limit
- base += states.compact.inject(0) {|r, i| r += i.atk_level_limit }
- base
- end
- #-----------------------------------------------------------------------------
- # Calculate Def Lv Max
- #-----------------------------------------------------------------------------
- def calc_dfl_mods_max
- base = enemy.def_level_limit
- base += states.compact.inject(0) {|r, i| r += i.def_level_limit }
- base
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement