AOC_PRC8/_module/nss/vixthrite.nss
Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

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));
}