Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Overkill
- # Last Date Updated: 2010.05.29
- # Level: Normal
- #
- # Overkill an enemy to have the enemy give more EXP or drop unique items. To
- # perform an overkill, an actor must attack an enemy and kill it along with
- # dealing over a required amount of damage.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # <overkill require: x>
- # x is the amount of damage needed to be dealt to the enemy to enable the
- # overkill status for the enemy. Goes into the enemy notebox.
- #
- # <overkill exp: +x>
- # This is how much extra exp is awarded to the party if the enemy is overkilled.
- # Goes into the enemy notebox.
- #
- # <overkill gold: x>
- # This is how much extra gold is awarded if the enemy is overkilled. Goes into
- # the enemy notebox.
- #
- # <overkill item: x>
- # <overkill weapon: x>
- # <overkill armor: x>
- # If the enemy is overkilled, the enemy will drop this extra item, weapon, or
- # armor. Use more of the tag if you want the overkilled enemy to drop more than
- # just one item. Drop 100% the time if overkilled. Goes into the enemy notebox.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["Overkill"] = true
- module SSS
- # This message appears if the enemy is overkilled.
- OVERKILL_MESSAGE = "%s is overkilled!"
- # If using Battle Engine Melody, this popup will appear.
- OVERKILL_POPUP = "OVERKILL!"
- # This is the sound that will play when the collapsed enemy is overkilled.
- OVERKILL_SOUND = RPG::SE.new("Thunder7", 100, 150)
- end
- #==============================================================================
- # ** RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # overkill_requirement
- #--------------------------------------------------------------------------
- def overkill_requirement
- return @overkill_requirement if @overkill_requirement != nil
- @overkill_requirement = @maxhp * 3 / 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_REQUIRE|overkill_require):[ ](\d+)>/i
- @overkill_requirement = $1.to_i
- end
- }
- return @overkill_requirement
- end
- #--------------------------------------------------------------------------
- # overkill_exp
- #--------------------------------------------------------------------------
- def overkill_exp
- return @overkill_exp if @overkill_exp != nil
- @overkill_exp = @exp / 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_EXP|overkill exp):[ ]([\+\-]\d+)>/i
- @overkill_exp = $1.to_i
- end
- }
- return @overkill_exp
- end
- #--------------------------------------------------------------------------
- # overkill_gold
- #--------------------------------------------------------------------------
- def overkill_gold
- return @overkill_gold if @overkill_gold != nil
- @overkill_gold = @exp / 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_GOLD|overkill gold):[ ]([\+\-]\d+)>/i
- @overkill_gold = $1.to_i
- end
- }
- return @overkill_gold
- end
- #--------------------------------------------------------------------------
- # overkill_items
- #--------------------------------------------------------------------------
- def overkill_items
- return @overkill_items.compact if @overkill_items != nil
- @overkill_items = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_ITEM|overkill item):[ ](\d+)>/i
- @overkill_items.push($data_items[$1.to_i])
- when /<(?:OVERKILL_WEAPON|overkill weapon):[ ](\d+)>/i
- @overkill_items.push($data_weapons[$1.to_i])
- when /<(?:OVERKILL_ARMOR|overkill armor):[ ](\d+)>/i
- @overkill_items.push($data_armors[$1.to_i])
- end
- }
- return @overkill_items.compact
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :overkill
- #--------------------------------------------------------------------------
- # * Activate Overkill
- #--------------------------------------------------------------------------
- def activate_overkill
- return unless @hp_damage >= enemy.overkill_requirement
- return unless @hp_damage >= @hp
- return unless @hp == 0
- return if @overkill
- @overkill = true
- if $scene.is_a?(Scene_Battle) and $imported["BattleEngineMelody"]
- popup_text = SSS::OVERKILL_POPUP
- create_popup(popup_text, "WEAK_ELE")
- elsif $scene.is_a?(Scene_Battle) and not $scene.message_window.nil?
- text = sprintf(SSS::OVERKILL_MESSAGE, name)
- $scene.message_window.add_instant_text(text)
- end
- SSS::OVERKILL_SOUND.play
- end
- #--------------------------------------------------------------------------
- # * Get Experience
- #--------------------------------------------------------------------------
- alias exp_sss_overkill exp unless $@
- def exp
- n = exp_sss_overkill
- n += enemy.overkill_exp if @overkill
- return n
- end
- #--------------------------------------------------------------------------
- # * Get Gold
- #--------------------------------------------------------------------------
- alias gold_sss_overkill gold unless $@
- def gold
- n = gold_sss_overkill
- n += enemy.overkill_gold if @overkill
- return n
- end
- end
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Damage Reflection
- #--------------------------------------------------------------------------
- alias execute_damage_sss_overkill execute_damage unless $@
- def execute_damage(user)
- execute_damage_sss_overkill(user)
- return unless user.actor? and self.is_a?(Game_Enemy)
- activate_overkill
- end
- end
- #==============================================================================
- # ** Game_Troop
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # * Create Array of Dropped Items
- #--------------------------------------------------------------------------
- alias make_drop_items_sss_overkill make_drop_items unless $@
- def make_drop_items
- n = make_drop_items_sss_overkill
- for member in dead_members
- next unless member.overkill
- n += member.enemy.overkill_items
- end
- return n
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :message_window
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement