LoT_PRC8/_module/nss/trap_fire_avg.nss
Jaysyn904 ec287507a1 Initial upload
Initial upload.
2023-09-25 21:32:17 -04:00

80 lines
2.7 KiB
Plaintext

void CreateObject2(int nObjectType, string sTemplate, location lLocation, int bUseAppearAnimation=FALSE);
//::///////////////////////////////////////////////
//:: Average Fire Trap
//:: NW_T1_FireAvgC
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Does 8d6 damage to all within 5 ft.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: July 4th, 2001
//:://////////////////////////////////////////////
#include "prc_inc_spells"
#include "NW_I0_SPELLS"
void main()
{
//Declare major variables
int bValid;
object oTarget = GetEnteringObject();
location lTarget = GetLocation(oTarget);
int nDamage;
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
effect eDam;
int nSaveDC = 20;
//Get first object in the target area
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_SMALL, lTarget);
//Cycle through the target area until all object have been targeted
while(GetIsObjectValid(oTarget))
{
if(!GetIsReactionTypeFriendly(oTarget))
{
//Roll damage
nDamage = d6(8);
//Adjust the trap damage based on the feats of the target
if(!MySavingThrow(SAVING_THROW_REFLEX, oTarget, nSaveDC, SAVING_THROW_TYPE_FIRE))
{
if (GetHasFeat(FEAT_IMPROVED_EVASION, oTarget))
{
nDamage /= 2;
}
}
else if (GetHasFeat(FEAT_EVASION, oTarget) || GetHasFeat(FEAT_IMPROVED_EVASION, oTarget))
{
nDamage = 0;
}
else
{
nDamage /= 2;
}
if (nDamage > 0)
{
//Set damage effect
eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
if (nDamage > 0)
{
//Apply effects to the target.
eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
}
}
//Get next target in shape
}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_SMALL, lTarget);
}
//respawn trap
DelayCommand(598.0, CreateObject2(GetObjectType(OBJECT_SELF), GetResRef(OBJECT_SELF), GetLocation(OBJECT_SELF)));
DelayCommand(600.0, DestroyObject(OBJECT_SELF));
}
void CreateObject2(int nObjectType, string sTemplate, location lLocation, int bUseAppearAnimation=FALSE)
{
CreateObject(nObjectType, sTemplate, lLocation, bUseAppearAnimation);
return;
}