HiddenTradition_PRC8/_module/nss/murderholefire.nss
2024-06-20 15:47:42 -04:00

60 lines
2.6 KiB
Plaintext

#include "NW_I0_SPELLS"
#include "prc_inc_spells"
void Explode(location lTarget, int nDice)
{
effect eExplode = EffectVisualEffect(VFX_FNF_FIREBALL);
int nDamage;
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
effect eDam;
float fDelay;
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_LARGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
//Cycle through the targets within the spell shape until an invalid object is captured.
while (GetIsObjectValid(oTarget))
{
if (oTarget != OBJECT_SELF)
{
if (!PRCDoResistSpell(OBJECT_SELF, oTarget))
{
//Roll damage for each target
nDamage = d20(nDice);
//Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, 18, SAVING_THROW_TYPE_FIRE);
//Set the damage effect
eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
fDelay = GetDistanceBetweenLocations(lTarget,GetLocation(oTarget))/20;
if(nDamage > 0)
{
// 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));
}
}
}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
}
void main()
{
effect eAOE = EffectAreaOfEffect(AOE_PER_GREASE,"mholeenter","mholehb","mholeexit");
object oPC = GetEnteringObject();
location lTarget = GetLocation(oPC);
if (!GetIsReactionTypeFriendly(oPC))
{
float nDuration = 2.0;
effect eImpact = EffectVisualEffect(VFX_FNF_GAS_EXPLOSION_GREASE);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, lTarget);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget, nDuration);
FloatingTextStringOnCreature("Oil is sprayed from above.",oPC);
}
DelayCommand(0.5,Explode(lTarget,4));
}