Vampiric Weapons
From PocketWiki
- Return to the VX Scripts
- Return to the Shanghai's Scripts
Contents |
| Vampiric Weapons | |
|---|---|
| | |
| Link | Vampiric Weapons |
| Last Update | 2010.07.22 |
| Author(s) | Shanghai |
| $imported | $imported["VampiricWeapons"] |
| Terms of Usage | |
| This script can be used for both non-commercial and commercial games. Credit does not need to be due for a Shanghai Simple Script as these are things that were created within less than an hour anyway. | |
| Version History | |
| 2010.07.22 - Small bugfix update.
2010.06.21 - Finished Script | |
| Discussion and FAQ | |
Introduction
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
These tags go into weapon or enemy noteboxes:
<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.
Script Code
#=============================================================================== # # 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 # #===============================================================================
- Return to the VX Scripts
- Return to the Shanghai's Scripts
