Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- Dekita's v1.0
- ★ Perfect Crit Rate™ ★
- ================================================================================
- Script Information:
- ====================
- This script simply allows for crit rate modification via states / equipment
- it also allows for each actor / enemy to have unique crit rates.
- ================================================================================
- ★☆★☆★☆★☆★☆★☆★☆★ 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
- 22/o1/2o13 - started && finished,
- ================================================================================
- Credit and Thanks to :
- =======================
- ================================================================================
- 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.
- ================================================================================
- Notetags : (actors, enemies, weapons, armors, states)
- ==========
- <crit rate: X>
- Replace X with a float value, e.g 0.5
- =end #=========================================================================#
- module Crit_Rate
- Default_Crit_Rate = 3
- 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.\..\.. #
- #################################################################################
- $imported = {} if $imported.nil?
- $imported[:Dekita_Crit_Mod] = true
- #==============================================================================
- module DataManager
- #==============================================================================
- class << self
- alias :load_crit_notes :load_database
- end
- def self.load_database
- load_crit_notes
- load__crit_rate
- end
- def self.load__crit_rate
- groups = [$data_actors,$data_enemies,$data_weapons,$data_armors,$data_states]
- for group in groups
- for obj in group
- next if obj.nil?
- obj.load_notetags__crit_rates
- end
- end
- end
- end # DataManager
- #==============================================================================
- class RPG::Actor < RPG::BaseItem
- #==============================================================================
- attr_reader :crit_rate_mod
- def load_notetags__crit_rates
- @crit_rate_mod = Crit_Rate::Default_Crit_Rate
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<crit rate: (.*)>/i
- @crit_rate_mod = $1.to_f
- end
- } # self.note.split
- end
- end # RPG::EquipItem
- #==============================================================================
- class RPG::Enemy < RPG::BaseItem
- #==============================================================================
- attr_reader :crit_rate_mod
- def load_notetags__crit_rates
- @crit_rate_mod = Crit_Rate::Default_Crit_Rate
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<crit rate: (.*)>/i
- @crit_rate_mod = $1.to_f
- end
- } # self.note.split
- end
- end # RPG::EquipItem
- #==============================================================================
- class RPG::EquipItem < RPG::BaseItem
- #==============================================================================
- attr_reader :crit_rate_mod
- def load_notetags__crit_rates
- @crit_rate_mod = 0.0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<crit rate: (.*)>/i
- @crit_rate_mod += $1.to_f
- end
- } # self.note.split
- end
- end # RPG::EquipItem
- #==============================================================================
- class RPG::State < RPG::BaseItem
- #==============================================================================
- attr_reader :crit_rate_mod
- def load_notetags__crit_rates
- @crit_rate_mod = 0.0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<crit rate: (.*)>/i
- @crit_rate_mod += $1.to_f
- end
- } # self.note.split
- end
- end # RPG::EquipItem
- #==============================================================================
- class Game_Battler < Game_BattlerBase
- #==============================================================================
- def apply_critical(damage)
- damage * self.crit_rate
- end
- end
- #==============================================================================
- class Game_Actor < Game_Battler
- #==============================================================================
- def crit_rate
- val = actor.crit_rate_mod
- val -= state_mod_crit
- val -= equip_mod_crit
- val <= 1.0 ? val = 1.0 : val = val
- end
- def state_mod_crit
- rlval = 0.0
- rlval += states.compact.inject(0) {|r, i| r += i.crit_rate_mod rescue 0 }
- return rlval
- end
- def equip_mod_crit
- rlval = 0.0
- rlval += equips.compact.inject(0) {|r, i| r += i.crit_rate_mod rescue 0 }
- return rlval
- end
- end # class Game_Actor < Game_Battler
- #==============================================================================
- class Game_Enemy < Game_Battler
- #==============================================================================
- def crit_rate
- val = enemy.crit_rate_mod
- val -= state_mod_crit
- val <= 1.0 ? val = 1.0 : val = val
- end
- def state_mod_crit
- rlval = 0.0
- rlval += states.compact.inject(0) {|r, i| r += i.crit_rate_mod rescue 0 }
- return rlval
- end
- end # class Game_Enemy < Game_Battler
- #===============================================================================#
- # - SCRIPT END - #
- #===============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement