98 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			98 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
//::///////////////////////////////////////////////
 | 
						|
//:: Storm of Vengeance: Heartbeat
 | 
						|
//:: NW_S0_StormVenC.nss
 | 
						|
//:: Copyright (c) 2001 Bioware Corp.
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
/*
 | 
						|
    Creates an AOE that decimates the enemies of
 | 
						|
    the cleric over a 30ft radius around the caster
 | 
						|
*/
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
//:: Created By: Preston Watamaniuk
 | 
						|
//:: Created On: Nov 8, 2001
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
 | 
						|
 | 
						|
#include "ke_spell_factor"
 | 
						|
 | 
						|
#include "X0_I0_SPELLS"
 | 
						|
#include "x2_inc_spellhook"
 | 
						|
 | 
						|
void main()
 | 
						|
{
 | 
						|
 | 
						|
    int nCasterLevel = 18;
 | 
						|
    int nDamage;
 | 
						|
    nDamage = ((d12(nCasterLevel))*2)+120;
 | 
						|
 | 
						|
    //starting the grand circus of importing and converting back and forth //
 | 
						|
 | 
						|
                float fDamage = IntToFloat(nDamage);
 | 
						|
 | 
						|
                // multiplaying damage with fFactor //
 | 
						|
 | 
						|
                float fFactor = CalculateFactor();
 | 
						|
 | 
						|
                fDamage = fDamage * fFactor;
 | 
						|
 | 
						|
                // converting the float damage back to INT damage so we can use it again //
 | 
						|
 | 
						|
                int nDamage2 = FloatToInt(fDamage);
 | 
						|
 | 
						|
               // Done and remember to change nDamage with nDamage2 below :) //
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    //Declare major variables .
 | 
						|
    effect eAcid = EffectDamage(nDamage2/4, DAMAGE_TYPE_ACID);
 | 
						|
    effect eElec = EffectDamage(nDamage2/2, DAMAGE_TYPE_ELECTRICAL);
 | 
						|
    effect eStun = EffectStunned();
 | 
						|
    effect eVisAcid = EffectVisualEffect(VFX_IMP_ACID_S);
 | 
						|
    effect eVisElec = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
 | 
						|
    effect eVisStun = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_DISABLED);
 | 
						|
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
 | 
						|
    effect eLink = EffectLinkEffects(eStun, eVisStun);
 | 
						|
    eLink = EffectLinkEffects(eLink, eDur);
 | 
						|
    float fDelay;
 | 
						|
    //Get first target in spell area
 | 
						|
    object oTarget = GetFirstInPersistentObject(OBJECT_SELF,OBJECT_TYPE_CREATURE);
 | 
						|
    while(GetIsObjectValid(oTarget))
 | 
						|
    {
 | 
						|
        if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, GetAreaOfEffectCreator()))
 | 
						|
        {
 | 
						|
            //Fire cast spell at event for the specified target
 | 
						|
            SignalEvent(oTarget, EventSpellCastAt(GetAreaOfEffectCreator(), SPELL_STORM_OF_VENGEANCE));
 | 
						|
            //Make an SR Check
 | 
						|
            fDelay = GetRandomDelay(0.5, 2.0);
 | 
						|
            if(MyResistSpell(GetAreaOfEffectCreator(), oTarget, fDelay) == 0)
 | 
						|
            {
 | 
						|
                //Make a saving throw check
 | 
						|
                // * if the saving throw is made they still suffer acid damage.
 | 
						|
                // * if they fail the saving throw, they suffer Electrical damage too
 | 
						|
                if(MySavingThrow(SAVING_THROW_REFLEX, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ELECTRICITY, GetAreaOfEffectCreator(), fDelay))
 | 
						|
                {
 | 
						|
                    //Apply the VFX impact and effects
 | 
						|
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisAcid, oTarget));
 | 
						|
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eAcid, oTarget));
 | 
						|
                    if (d2()==1)
 | 
						|
                    {
 | 
						|
                        DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisElec, oTarget));
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    //Apply the VFX impact and effects
 | 
						|
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisAcid, oTarget));
 | 
						|
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eAcid, oTarget));
 | 
						|
                    //Apply the VFX impact and effects
 | 
						|
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisElec, oTarget));
 | 
						|
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eElec, oTarget));
 | 
						|
                    DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(10)));
 | 
						|
                }
 | 
						|
            }
 | 
						|
         }
 | 
						|
        //Get next target in spell area
 | 
						|
        oTarget = GetNextInPersistentObject(OBJECT_SELF,OBJECT_TYPE_CREATURE);
 | 
						|
    }
 | 
						|
}
 |