home *** CD-ROM | disk | FTP | other *** search
/ PC Zone 125 / DPPCZ0203B.7z / DPPCZ0203B.ISO / Demos / Neverwinter / data1.cab / override / nw_s0_lghtnbolt.nss < prev    next >
Text File  |  2002-09-10  |  4KB  |  91 lines

  1. //::///////////////////////////////////////////////
  2. //:: Lightning Bolt
  3. //:: NW_S0_LightnBolt
  4. //:: Copyright (c) 2001 Bioware Corp.
  5. //:://////////////////////////////////////////////
  6. /*
  7.     Does 1d6 per level in a 5ft tube for 30m
  8. */
  9. //:://////////////////////////////////////////////
  10. //:: Created By: Noel Borstad
  11. //:: Created On:  March 8, 2001
  12. //:://////////////////////////////////////////////
  13. //:: Last Updated By: Preston Watamaniuk, On: May 2, 2001
  14.  
  15. #include "NW_I0_SPELLS"    
  16. void main()
  17. {
  18.     //Declare major variables
  19.     int nCasterLevel = GetCasterLevel(OBJECT_SELF);
  20.     //Limit caster level
  21.     if (nCasterLevel > 10)
  22.     {
  23.         nCasterLevel = 10;
  24.     }
  25.     int nDamage;
  26.     int nMetaMagic = GetMetaMagicFeat();
  27.     //Set the lightning stream to start at the caster's hands
  28.     effect eLightning = EffectBeam(VFX_BEAM_LIGHTNING, OBJECT_SELF, BODY_NODE_HAND);
  29.     effect eVis  = EffectVisualEffect(VFX_IMP_LIGHTNING_S);
  30.     effect eDamage;
  31.     object oTarget = GetSpellTargetObject();
  32.     location lTarget = GetLocation(oTarget);
  33.     object oNextTarget, oTarget2;
  34.     float fDelay;
  35.     int nCnt = 1;
  36.     
  37.     oTarget2 = GetNearestObject(OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nCnt);
  38.     while(GetIsObjectValid(oTarget2) && GetDistanceToObject(oTarget2) <= 30.0)
  39.     {
  40.         //Get first target in the lightning area by passing in the location of first target and the casters vector (position)
  41.         oTarget = GetFirstObjectInShape(SHAPE_SPELLCYLINDER, 30.0, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, GetPosition(OBJECT_SELF));
  42.         while (GetIsObjectValid(oTarget))
  43.         {
  44.            //Exclude the caster from the damage effects
  45.            if (oTarget != OBJECT_SELF && oTarget2 == oTarget)
  46.            {
  47.                 if(!GetIsReactionTypeFriendly(oTarget))
  48.                 {
  49.                    //Fire cast spell at event for the specified target
  50.                    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_LIGHTNING_BOLT));
  51.                    //Make an SR check
  52.                    if (!MyResistSpell(OBJECT_SELF, oTarget))
  53.                    {
  54.                         //Roll damage
  55.                         nDamage =  d6(nCasterLevel);
  56.                         //Enter Metamagic conditions
  57.                         if (nMetaMagic == METAMAGIC_MAXIMIZE)
  58.                         {
  59.                              nDamage = 6 * nCasterLevel;//Damage is at max
  60.                         }
  61.                         if (nMetaMagic == METAMAGIC_EMPOWER)
  62.                         {
  63.                              nDamage = nDamage + (nDamage/2); //Damage/Healing is +50%
  64.                         }
  65.                         //Adjust damage based on Reflex Save, Evasion and Improved Evasion
  66.                         nDamage = GetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(),SAVING_THROW_TYPE_ELECTRICITY);
  67.                         //Set damage effect
  68.                         eDamage = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL);
  69.                         if(nDamage > 0)
  70.                         {
  71.                             fDelay = GetSpellEffectDelay(GetLocation(oTarget), oTarget);
  72.                             //Apply VFX impcat, damage effect and lightning effect
  73.                             ApplyEffectToObject(DURATION_TYPE_INSTANT,eDamage,oTarget);
  74.                             ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oTarget);
  75.                         }
  76.                     }
  77.                     ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eLightning,oTarget,1.0);
  78.                     //Set the currect target as the holder of the lightning effect
  79.                     oNextTarget = oTarget;
  80.                     eLightning = EffectBeam(VFX_BEAM_LIGHTNING, oNextTarget, BODY_NODE_CHEST);
  81.                 }
  82.            }
  83.            //Get the next object in the lightning cylinder
  84.            oTarget = GetNextObjectInShape(SHAPE_SPELLCYLINDER, 30.0, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, GetPosition(OBJECT_SELF));
  85.         }
  86.         nCnt++;
  87.         oTarget2 = GetNearestObject(OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nCnt);
  88.     }
  89. }
  90.  
  91.