789 lines
25 KiB
Plaintext
789 lines
25 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Scarface's Crafting System V1.0
|
|
//:: sfcs_functs_rem
|
|
//::
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
All of the functions to remove item properties -
|
|
DO NOT TOUCH!!!
|
|
*/
|
|
//////////////////////////////////////////////////
|
|
|
|
#include "sfcs_functs"
|
|
#include "x2_inc_itemprop"
|
|
|
|
//:: Declair Functions
|
|
void RemoveACBonus(object oItem);
|
|
void RemoveAcidBonus(object oItem);
|
|
void RemoveAttackBonus(object oItem);
|
|
void RemoveBludgeonBonus(object oItem);
|
|
void RemoveCharismaBonus(object oItem);
|
|
void RemoveColdBonus(object oItem);
|
|
void RemoveConBonus(object oItem);
|
|
void RemoveDexBonus(object oItem);
|
|
void RemoveDivineBonus(object oItem);
|
|
void RemoveEnhancementBonus(object oItem);
|
|
void RemoveFireBonus(object oItem);
|
|
void RemoveHasteBonus(object oItem);
|
|
void RemoveHolyAvengerBonus(object oItem);
|
|
void RemoveKeenBonus(object oItem);
|
|
void RemoveMagicBonus(object oItem);
|
|
void RemoveNegativeBonus(object oItem);
|
|
void RemovePiercingBonus(object oItem);
|
|
void RemoveRegenBonus(object oItem);
|
|
void RemoveSlashingBonus(object oItem);
|
|
void RemoveSonicBonus(object oItem);
|
|
void RemoveStrengthBonus(object oItem);
|
|
void RemoveTrueSeeingBonus(object oItem);
|
|
void RemoveWisdomBonus(object oItem);
|
|
|
|
//:: Functions
|
|
|
|
void RemoveACBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("AC +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove AC bonus
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_AC_BONUS,
|
|
DURATION_TYPE_PERMANENT);
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take AC bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyACBonus(iProp), 0.0,
|
|
X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "AC +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveAcidBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Acid +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove acid damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_ACID);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take acid bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Acid +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveAttackBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Attack +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Check if there are no more Attack Bonuses on the item
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ATTACK_BONUS,
|
|
DURATION_TYPE_PERMANENT);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAttackBonus(iProp), 0.0,
|
|
X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Attack +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveBludgeonBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Bludgeoning +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove bludge damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_BLUDGEONING);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_BLUDGEONING,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Bludgeoning +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveCharismaBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Charisma +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove Charisma bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_ABILITY_CHA);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Charisma bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_CHA,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Charisma +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveColdBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Cold +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove cold damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_COLD);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Cold +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveConstitutionBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Constitution +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove Constitution bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_ABILITY_CON);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Constitution bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_CON,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Constitution +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveDexterityBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Dexterity +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove dexterity bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_ABILITY_DEX);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take strength bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_DEX,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Dexterity +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveDivineBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Divine +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove divine damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_DIVINE);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_DIVINE,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Divine +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveEnhancementBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Enhancement +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove emhancement damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS,
|
|
DURATION_TYPE_PERMANENT);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyEnhancementBonus(iProp), 0.0,
|
|
X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Enhancement +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveFireBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Fire +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove fire damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_FIRE);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Fire +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveHasteBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Haste");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove haste
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_HASTE, DURATION_TYPE_PERMANENT);
|
|
|
|
// Delete local var
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
}
|
|
}
|
|
void RemoveHolyAvengerBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Holy Avenger");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove haste
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_HOLY_AVENGER, DURATION_TYPE_PERMANENT);
|
|
|
|
// Delete local var
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
}
|
|
}
|
|
void RemoveIntellegenceBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Intellegence +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove Intellegence bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_ABILITY_INT);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Intellegence bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_INT,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Intellegence +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveKeenBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Keen");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove keen
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_KEEN, DURATION_TYPE_PERMANENT);
|
|
|
|
// Delete local var
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
}
|
|
}
|
|
void RemoveMagicBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Magical +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove magical damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_MAGICAL);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_MAGICAL,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Magical +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveNegativeBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Negative +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove negative damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_NEGATIVE);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_NEGATIVE,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Negative +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemovePiercingBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Piercing +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove piercing damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_PIERCING);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_PIERCING,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Piercing +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveRegenBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Regeneration +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove Regeneration bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_REGENERATION,
|
|
DURATION_TYPE_PERMANENT);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Regeneration bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyRegeneration(iProp), 0.0,
|
|
X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Regeneration +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveSlashingBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Slashing +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove slashing damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_SLASHING);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SLASHING,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Slashing +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveSonicBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Sonic +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove sonic damage - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_DAMAGETYPE_SONIC);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Attack Bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SONIC,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Sonic +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveStrengthBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Strength +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove strength bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_ABILITY_STR);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take strength bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_STR,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Strength +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveTrueSeeingBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("True Seeing");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove True Seeing
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_TRUE_SEEING, DURATION_TYPE_PERMANENT);
|
|
|
|
// Delete local var
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
}
|
|
}
|
|
void RemoveWisdomBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Wisdom +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove Wisdom bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_ABILITY_WIS);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Wisdom bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_WIS,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Wisdom +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void RemoveIntelligenceBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Intelligence +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
iProp--;
|
|
|
|
// Remove Intelligence bonus - 1
|
|
if (iProp <= 0)
|
|
{
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS,
|
|
DURATION_TYPE_PERMANENT, IP_CONST_ABILITY_INT);
|
|
|
|
// Set local vars
|
|
DeleteLocalString(OBJECT_SELF, sProp);
|
|
DeleteLocalInt(OBJECT_SELF, sProp);
|
|
}
|
|
else
|
|
{
|
|
// Take Intelligence bonus -1
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_INT,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Intelligence +" + IntToString(iProp));
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|