48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
// Shdow-device altar: remove black pearl and give a new power for held weapon.
|
|
|
|
#include "prc_x2_itemprop"
|
|
#include "nw_i0_plot"
|
|
|
|
void RemoveEffects2(object oObject)
|
|
{
|
|
effect e = GetFirstEffect(oObject);
|
|
while(GetIsEffectValid(e))
|
|
{
|
|
RemoveEffect(oObject, e);
|
|
e = GetNextEffect(oObject);
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetPCSpeaker();
|
|
|
|
object oGem = GetItemPossessedBy(oPC, "pearl");
|
|
int nStack = GetItemStackSize(oGem);
|
|
if(oGem == OBJECT_INVALID)
|
|
return;
|
|
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
|
|
int nType = GetBaseItemType(oWeapon);
|
|
// if the held item is not a weapon then do nothing
|
|
if(oWeapon == OBJECT_INVALID || !IPGetIsMeleeWeapon(oWeapon))
|
|
return;
|
|
|
|
// Destroy the gem
|
|
if(nStack == 1)
|
|
DestroyObject(oGem);
|
|
else if(nStack > 1)
|
|
{
|
|
nStack--;
|
|
SetItemStackSize(oGem, nStack);
|
|
}
|
|
|
|
// Apply the new effect
|
|
// TODO: add visual effect
|
|
effect eVis = EffectVisualEffect(VFX_IMP_HARM);
|
|
itemproperty ipVis = ItemPropertyVisualEffect(ITEM_VISUAL_EVIL);
|
|
itemproperty ipAb = ItemPropertyOnHitProps(IP_CONST_ONHIT_ABILITYDRAIN, IP_CONST_ONHIT_SAVEDC_24, IP_CONST_ABILITY_STR);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
|
|
DelayCommand(1.0, AddItemProperty(DURATION_TYPE_PERMANENT, ipAb, oWeapon));
|
|
DelayCommand(1.0, AddItemProperty(DURATION_TYPE_PERMANENT, ipVis, oWeapon));
|
|
}
|