Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Vampiric Weapons
- # Last Date Updated: 2010.06.21
- # Level: Normal
- #
- # This script gives some weapons the vampiric trait. Vampiric weapons will
- # absorb HP damage rather than deal it straight out. Siphonic weapons are also
- # available and they drain MP instead of HP. Vampiric and siphonic weapons
- # cannot drain more than the enemy has HP or MP. This attribute will also affect
- # physical attack skills or items unless they already have absorbing.
- #===============================================================================
- # 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.
- #
- # <vampiric: x%>
- # Place this tag into a weapon's notebox and it will become a vampiric weapon.
- # This tag will drain x% of the hp damage. Place this inside of an enemy's
- # notebox and it will also gain vampiric properties.
- #
- # <siphonic: x>
- # Place this tag into a weapon's notebox and it will deal mp damage with attacks
- # which the attacker will recover. Place this inside of an enemy's notebox and
- # it will also gain siphonic properties.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["VampiricWeapons"] = true
- #==============================================================================
- # RPG::Weapon
- #==============================================================================
- class RPG::Weapon < RPG::BaseItem
- #--------------------------------------------------------------------------
- # * Vampiric
- #--------------------------------------------------------------------------
- def vampiric
- return @vampiric if @vampiric != nil
- @vampiric = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:VAMPIRIC|vampire):[ ]*(\d+)([%%])>/i
- @vampiric = $1.to_i
- end
- }
- return @vampiric
- end
- #--------------------------------------------------------------------------
- # * Siphonic
- #--------------------------------------------------------------------------
- def siphonic
- return @siphonic if @siphonic != nil
- @siphonic = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:SIPHONIC|siphon):[ ]*(\d+)>/i
- @siphonic = $1.to_i
- end
- }
- return @siphonic
- end
- end
- #==============================================================================
- # RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # * Vampiric
- #--------------------------------------------------------------------------
- def vampiric
- return @vampiric if @vampiric != nil
- @vampiric = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:VAMPIRIC|vampire):[ ]*(\d+)([%%])>/i
- @vampiric = $1.to_i
- end
- }
- return @vampiric
- end
- #--------------------------------------------------------------------------
- # * Siphonic
- #--------------------------------------------------------------------------
- def siphonic
- return @siphonic if @siphonic != nil
- @siphonic = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:SIPHONIC|siphon):[ ]*(\d+)>/i
- @siphonic = $1.to_i
- end
- }
- return @siphonic
- end
- end
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Clear Variable for Storing Action Results
- #--------------------------------------------------------------------------
- alias clear_action_results_sss_vampire_weapons clear_action_results unless $@
- def clear_action_results
- clear_action_results_sss_vampire_weapons
- @vampiric = 0
- @siphonic = 0
- end
- #--------------------------------------------------------------------------
- # * Calculation of Damage From Normal Attack
- #--------------------------------------------------------------------------
- alias make_attack_damage_value_sss_vampire_weapons make_attack_damage_value
- def make_attack_damage_value(attacker)
- make_attack_damage_value_sss_vampire_weapons(attacker)
- @vampiric = [@hp_damage * attacker.vampiric_rate / 100, self.hp].min
- @mp_damage += attacker.siphonic_rate
- @siphonic = [@mp_damage, self.mp, attacker.siphonic_rate].min
- end
- #--------------------------------------------------------------------------
- # * Calculation of Damage Caused by Skills or Items
- #--------------------------------------------------------------------------
- alias make_obj_damage_value_sss_vampire_weapons make_obj_damage_value
- def make_obj_damage_value(user, obj)
- make_obj_damage_value_sss_vampire_weapons(user, obj)
- return if @absorbed
- return unless obj.physical_attack
- @vampiric = [@hp_damage * user.vampiric_rate / 100, self.hp].min
- @mp_damage += user.siphonic_rate
- @siphonic = [@mp_damage, self.mp, user.siphonic_rate].min
- end
- #--------------------------------------------------------------------------
- # * Damage Reflection
- #--------------------------------------------------------------------------
- alias execute_damage_sss_vampire_weapons execute_damage unless $@
- def execute_damage(user)
- execute_damage_sss_vampire_weapons(user)
- user.hp += @vampiric if @vampiric > 0
- user.mp += @siphonic if @siphonic > 0
- if $imported["BattleEngineMelody"] and @vampiric > 0
- value = sprintf(YEM::BATTLE_ENGINE::POPUP_SETTINGS[:hp_heal], @vampiric)
- rules = "HP_HEAL"
- user.create_popup(value, rules)
- end
- if $imported["BattleEngineMelody"] and @siphonic > 0
- value = sprintf(YEM::BATTLE_ENGINE::POPUP_SETTINGS[:mp_heal], @siphonic)
- rules = "MP_HEAL"
- user.create_popup(value, rules)
- end
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Vampiric Rate
- #--------------------------------------------------------------------------
- def vampiric_rate
- result = 0
- for weapon in weapons.compact
- result += weapon.vampiric
- end
- return [result, 0].max
- end
- #--------------------------------------------------------------------------
- # * Siphonic Rate
- #--------------------------------------------------------------------------
- def siphonic_rate
- result = 0
- for weapon in weapons.compact
- result += weapon.siphonic
- end
- return [result, 0].max
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Vampiric Rate
- #--------------------------------------------------------------------------
- def vampiric_rate
- return [enemy.vampiric, 0].max
- end
- #--------------------------------------------------------------------------
- # * Siphonic Rate
- #--------------------------------------------------------------------------
- def siphonic_rate
- return [enemy.siphonic, 0].max
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement