Rune_PRC8/_module/nss/cha_drain.nss
Jaysyn904 d1c309ae63 Initial commit
Initial commit
2024-09-13 09:10:39 -04:00

52 lines
1.3 KiB
Plaintext

#include "nw_i0_spells"
#include "prc_inc_spells"
void DoAbilityDamage(object oTarget, object oCaster)
{
effect eImp = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eImp,oTarget);
// Cha Damage
int nDC = 10 + GetHitDice(oCaster) /2 + GetAbilityModifier(ABILITY_CHARISMA,oCaster);
int nDam = 2;
int nHeal = 10;
int nType = ABILITY_CHARISMA;
if ( PRCMySavingThrow(SAVING_THROW_FORT,oTarget,nDC,SAVING_THROW_TYPE_NONE,oCaster) )
{
nDam = 1;
nHeal = 5;
}
effect eDam = EffectAbilityDecrease(nType,nDam);
eDam = SupernaturalEffect(eDam);
eDam = ExtraordinaryEffect(eDam);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eDam,oTarget);
if ( GetIsImmune(oTarget,IMMUNITY_TYPE_ABILITY_DECREASE) )
return;
effect eHeal = EffectHeal(nHeal);
effect eHealVis = EffectVisualEffect(VFX_IMP_HEALING_S);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eHeal,oCaster);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eHealVis,oCaster);
}
void main()
{
object oTarget = PRCGetSpellTargetObject();
object oCaster = OBJECT_SELF;
/* int bIsPoisoned = GetLocalInt(oTarget,"IsPoisoned");
if ( bIsPoisoned )
return; */
DelayCommand(0.1,DoAbilityDamage(oTarget,oCaster));
}