PWE_PRC8/_module/nss/negburst_auto.nss
Jaysyn904 ee1dc35889 Initial Commit
Initial Commit
2025-04-03 10:29:41 -04:00

96 lines
4.4 KiB
Plaintext

#include "prc_inc_spells"
#include "prc_add_spell_dc"
#include "NW_I0_SPELLS"
void main()
{
if (GetIsInCombat()==TRUE)
{
effect MyEffect;
MyEffect = EffectParalyze();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,MyEffect,OBJECT_SELF,12.0);
//Declare major variables
object oCaster = OBJECT_SELF;
int nCasterLvl = 15;
int nMetaMagic = PRCGetMetaMagicFeat();
int nDamage;
float fDelay;
effect eExplode = EffectVisualEffect(VFX_FNF_LOS_EVIL_20); //Replace with Negative Pulse
effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
effect eVisHeal = EffectVisualEffect(VFX_IMP_HEALING_M);
effect eDam, eHeal;
int nStr = nCasterLvl / 4;
if (nStr == 0)
{
nStr = 1;
}
effect eStr = EffectAbilityIncrease(ABILITY_STRENGTH, nStr);
effect eStr_Low = EffectAbilityDecrease(ABILITY_STRENGTH, nStr);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
effect eDur2 = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
effect eGood = EffectLinkEffects(eStr, eDur);
effect eBad = EffectLinkEffects(eStr_Low, eDur2);
//Get the spell target location as opposed to the spell target.
location lTarget = GetLocation(OBJECT_SELF);
//Apply the explosion at the location captured above.
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget);
//Declare the spell shape, size and the location. Capture the first target object in the shape.
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget);
//Cycle through the targets within the spell shape until an invalid object is captured.
while (GetIsObjectValid(oTarget))
{
if(oTarget != OBJECT_SELF)
{
//Roll damage for each target
nDamage = 36;//d6() * nCasterLvl;
if(PRCMySavingThrow(SAVING_THROW_WILL, oTarget, PRCGetSpellSaveDC(), SAVING_THROW_TYPE_NEGATIVE, OBJECT_SELF, fDelay))
{
nDamage /= 2;
}
//Get the distance between the explosion and the target to calculate delay
fDelay = GetDistanceBetweenLocations(lTarget, GetLocation(oTarget))/20;
if(!GetIsReactionTypeFriendly(oTarget))
{
if(MyPRCGetRacialType(oTarget) != RACIAL_TYPE_UNDEAD)
{
if(!PRCDoResistSpell(OBJECT_SELF, oTarget, FloatToInt(fDelay)))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_NEGATIVE_ENERGY_BURST));
//Set the damage effect
eDam = EffectDamage(nDamage, DAMAGE_TYPE_NEGATIVE);
// Apply effects to the currently selected target.
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
//This visual effect is applied to the target object not the location as above. This visual effect
//represents the flame that erupts on the target not on the ground.
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBad, oTarget));
}
}
}
else
{
if(GetIsFriend(oTarget) && MyPRCGetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_NEGATIVE_ENERGY_BURST, FALSE));
//Set the heal effect
eHeal = EffectHeal(nDamage);
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget));
//This visual effect is applied to the target object not the location as above. This visual effect
//represents the flame that erupts on the target not on the ground.
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisHeal, oTarget));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGood, oTarget));
}
}
}
//Select the next target within the spell shape.
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget);
}
}
}