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

  1. //::///////////////////////////////////////////////
  2. //:: Pulse: Negative
  3. //:: NW_S1_PulsDeath
  4. //:: Copyright (c) 2001 Bioware Corp.
  5. //:://////////////////////////////////////////////
  6. /*
  7.     A wave of energy emanates from the creature which affects
  8.     all within 10ft.  Damage can be reduced by half for all
  9.     damaging variants.  Undead are healed.
  10. */
  11. //:://////////////////////////////////////////////
  12. //:: Created By: Preston Watamaniuk
  13. //:: Created On: May 14, 2000
  14. //:://////////////////////////////////////////////
  15.  
  16. void main()
  17. {
  18.     //Declare major variables
  19.     int nDamage;
  20.     float fDelay;
  21.     effect eVis = EffectVisualEffect(VFX_IMP_HEALING_M);
  22.     effect eVis2 = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
  23.     effect eHowl;
  24.     int nHD = GetHitDice(OBJECT_SELF);
  25.     int nDC = 10 + nHD;
  26.     effect eImpact = EffectVisualEffect(VFX_IMP_PULSE_NEGATIVE);
  27.     ApplyEffectToObject(DURATION_TYPE_INSTANT, eImpact, OBJECT_SELF);
  28.     //Get first target in spell area
  29.     object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, GetLocation(OBJECT_SELF));
  30.     while(GetIsObjectValid(oTarget))
  31.     {
  32.         if(oTarget != OBJECT_SELF)
  33.         {
  34.             //Determine effect delay
  35.             fDelay = GetDistanceBetween(OBJECT_SELF, oTarget)/20;
  36.             //Roll the amount to heal or damage
  37.             nDamage = d4(nHD);
  38.             //If the target is undead
  39.             if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
  40.             {
  41.                 //Make a faction check
  42.                 if(GetIsFriend(oTarget))
  43.                 {
  44.                     //Fire cast spell at event for the specified target
  45.                     SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_PULSE_HOLY, FALSE));
  46.                     //Set heal effect
  47.                     eHowl = EffectHeal(nDamage);
  48.                     //Apply the VFX impact and effects
  49.                     DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHowl, oTarget));
  50.                     DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
  51.                 }
  52.             }
  53.             else
  54.             {
  55.                 if(!GetIsReactionTypeFriendly(oTarget) && GetRacialType(oTarget) != RACIAL_TYPE_UNDEAD)
  56.                 {
  57.                     //Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
  58.                     nDamage = GetReflexAdjustedDamage(nDamage, oTarget, nDC, SAVING_THROW_TYPE_NEGATIVE);
  59.                     //Set damage effect
  60.                     eHowl = EffectDamage(nDamage, DAMAGE_TYPE_NEGATIVE);
  61.                     if(nDamage > 0)
  62.                     {
  63.                         //Fire cast spell at event for the specified target
  64.                         SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_PULSE_HOLY));
  65.                         //Apply the VFX impact and effects
  66.                         DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHowl, oTarget));
  67.                         DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget));
  68.                     }
  69.                 }
  70.             }
  71.         }
  72.         //Get next target in spell area
  73.         oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, GetLocation(OBJECT_SELF));
  74.     }
  75. }
  76.