99 lines
3.5 KiB
Plaintext
99 lines
3.5 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Ice Storm
|
|
//:: NW_S0_IceStorm
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Everyone in the area takes 3d6 Bludgeoning
|
|
and 2d6 Cold damage.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Sept 12, 2001
|
|
//:://////////////////////////////////////////////
|
|
|
|
#include "X0_I0_SPELLS"
|
|
|
|
|
|
// Get a random location in a given area based on a given object,
|
|
// the specified distance away.
|
|
// If no object is given, will use a random object in the area.
|
|
// If that is not available, will use the roughly-center point
|
|
// of the area.
|
|
// If distance is set to 0.0, a random distance will be used.
|
|
location ElvGetRandomLocation(object oArea, object oSource=OBJECT_INVALID, float fDist=0.0)
|
|
{
|
|
location lStart;
|
|
|
|
if (!GetIsObjectValid(oSource)) {
|
|
lStart = GetCenterPointOfArea(oArea);
|
|
} else {
|
|
lStart = GetLocation(oSource);
|
|
}
|
|
|
|
float fAngle; float fOrient;
|
|
|
|
if (fDist == 0.0) {
|
|
int nRoll = Random(3);
|
|
switch (nRoll) {
|
|
case 0:
|
|
fDist = DISTANCE_MEDIUM; break;
|
|
case 1:
|
|
fDist = DISTANCE_LARGE; break;
|
|
case 2:
|
|
fDist = DISTANCE_HUGE; break;
|
|
}
|
|
}
|
|
|
|
fAngle = IntToFloat(Random(360));
|
|
|
|
fOrient = IntToFloat(Random(360));
|
|
|
|
return GenerateNewLocationFromLocation(lStart,
|
|
fDist,
|
|
fAngle,
|
|
fOrient);
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
{
|
|
//Declare major variables
|
|
int nDamageBludge, nDamageIce;
|
|
float fDelay;
|
|
effect eExplode = EffectVisualEffect(VFX_FNF_ICESTORM); //USE THE ICESTORM FNF
|
|
effect eVis = EffectVisualEffect(VFX_IMP_FROST_S);
|
|
effect eDamBludge, eDamIce;
|
|
//Get the spell target location as opposed to the spell target.
|
|
location lTarget = ElvGetRandomLocation(GetArea(OBJECT_SELF), OBJECT_SELF, 2.0f);
|
|
//Apply the ice storm VFX 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_GARGANTUAN, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE);
|
|
//Cycle through the targets within the spell shape until an invalid object is captured.
|
|
while (GetIsObjectValid(oTarget))
|
|
{
|
|
|
|
fDelay = GetRandomDelay(0.75, 2.25);
|
|
|
|
//Roll damage for each target
|
|
nDamageBludge = d20(16);
|
|
nDamageIce = d20(12);
|
|
|
|
//Set the damage effect
|
|
eDamBludge = EffectDamage(nDamageBludge, DAMAGE_TYPE_BLUDGEONING);
|
|
eDamIce = EffectDamage(nDamageIce, DAMAGE_TYPE_COLD);
|
|
// Apply effects to the currently selected target.
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamBludge, oTarget));
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamIce, oTarget));
|
|
//This visual effect is applied to the target object not the location as above. This visual effect
|
|
//represents the impact that erupts on the target not on the ground.
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
|
|
|
|
//Select the next target within the spell shape.
|
|
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE);
|
|
}
|
|
}
|
|
|