120 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			120 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
//::///////////////////////////////////////////////
 | 
						|
//:: Fire Storm
 | 
						|
//:: NW_S0_FireStm
 | 
						|
//:: Copyright (c) 2001 Bioware Corp.
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
/*
 | 
						|
    Creates a zone of destruction around the caster
 | 
						|
    within which all living creatures are pummeled
 | 
						|
    with fire.
 | 
						|
*/
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
//:: Created By: Preston Watamaniuk
 | 
						|
//:: Created On: April 11, 2001
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
//:: VFX Pass By: Preston W, On: June 21, 2001
 | 
						|
 | 
						|
 | 
						|
#include "ke_spell_factor"
 | 
						|
 | 
						|
#include "X0_I0_SPELLS"
 | 
						|
#include "x2_inc_spellhook"
 | 
						|
 | 
						|
void main()
 | 
						|
{
 | 
						|
 | 
						|
/*
 | 
						|
  Spellcast Hook Code
 | 
						|
  Added 2003-06-20 by Georg
 | 
						|
  If you want to make changes to all spells,
 | 
						|
  check x2_inc_spellhook.nss to find out more
 | 
						|
 | 
						|
*/
 | 
						|
 | 
						|
    if (!X2PreSpellCastCode())
 | 
						|
    {
 | 
						|
    // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
// End of Spell Cast Hook
 | 
						|
 | 
						|
 | 
						|
    //Declare major variables
 | 
						|
    int nMetaMagic = GetMetaMagicFeat();
 | 
						|
    int nDamage;
 | 
						|
    int nDamage2;
 | 
						|
    int nCasterLevel = GetCasterLevel(OBJECT_SELF);
 | 
						|
    if(nCasterLevel > 60)
 | 
						|
    {
 | 
						|
        nCasterLevel == 60;
 | 
						|
    }
 | 
						|
    effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
 | 
						|
    effect eFireStorm = EffectVisualEffect(VFX_FNF_FIRESTORM);
 | 
						|
    float fDelay;
 | 
						|
    //Apply Fire and Forget Visual in the area;
 | 
						|
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eFireStorm, GetLocation(OBJECT_SELF));
 | 
						|
    //Declare the spell shape, size and the location.  Capture the first target object in the shape.
 | 
						|
    object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, GetLocation(OBJECT_SELF), 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))
 | 
						|
    {
 | 
						|
        //This spell smites everyone who is more than 2 meters away from the caster.
 | 
						|
        //if (GetDistanceBetween(oTarget, OBJECT_SELF) > 2.0)
 | 
						|
        //{
 | 
						|
            if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF) && oTarget != OBJECT_SELF)
 | 
						|
            {
 | 
						|
                fDelay = GetRandomDelay(1.5, 2.5);
 | 
						|
                //Fire cast spell at event for the specified target
 | 
						|
                SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_FIRE_STORM));
 | 
						|
                //Make SR check, and appropriate saving throw(s).
 | 
						|
                if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay))
 | 
						|
                {
 | 
						|
                      //Roll Damage
 | 
						|
                      nDamage = ((d8(nCasterLevel))*2)+80;
 | 
						|
                      //Enter Metamagic conditions
 | 
						|
                      if (nMetaMagic == METAMAGIC_MAXIMIZE)
 | 
						|
                      {
 | 
						|
                         nDamage = ((8*(nCasterLevel))*2)+80;//Damage is at max
 | 
						|
                      }
 | 
						|
                      else if (nMetaMagic == METAMAGIC_EMPOWER)
 | 
						|
                      {
 | 
						|
                         nDamage = nDamage + (nDamage/2);//Damage/Healing is +50%
 | 
						|
                      }
 | 
						|
 | 
						|
                      //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 nDamage3 = FloatToInt(fDamage);
 | 
						|
 | 
						|
               // Done and remember to change nDamage with nDamage2 below :) //
 | 
						|
                      //Save versus both holy and fire damage
 | 
						|
                      nDamage2 = GetReflexAdjustedDamage(nDamage3/2, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_DIVINE);
 | 
						|
                      nDamage = GetReflexAdjustedDamage(nDamage3/2, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_FIRE);
 | 
						|
                    if(nDamage > 0)
 | 
						|
                    {
 | 
						|
                          // Apply effects to the currently selected target.  For this spell we have used
 | 
						|
                          //both Divine and Fire damage.
 | 
						|
                          effect eDivine = EffectDamage(nDamage2, DAMAGE_TYPE_DIVINE);
 | 
						|
                          effect eFire = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
 | 
						|
                          DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFire, oTarget));
 | 
						|
                          DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDivine, oTarget));
 | 
						|
                          DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            //}
 | 
						|
        }
 | 
						|
        //Select the next target within the spell shape.
 | 
						|
        oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, GetLocation(OBJECT_SELF), OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
 | 
						|
    }
 | 
						|
}
 |