115 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			115 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| //::///////////////////////////////////////////////
 | |
| //:: [Sound Burst]
 | |
| //:: [NW_S0_SndBurst.nss]
 | |
| //:: Copyright (c) 2000 Bioware Corp.
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Does 1d8 damage to all creatures in a 10ft
 | |
| //:: radius.  Will save or the creature is stunned
 | |
| //:: for 1 round.
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Created By: Preston Watamaniuk
 | |
| //:: Created On: Jan 31, 2001
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Last Updated By: Georg Z, Oct. 2003
 | |
| 
 | |
| 
 | |
| #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())
 | |
|     {
 | |
|         return;
 | |
|     }
 | |
|     // End of Spell Cast Hook
 | |
| 
 | |
| 
 | |
|     //Declare major variables
 | |
|     object oTarget;
 | |
|     int nCasterLevel = GetCasterLevel(OBJECT_SELF);
 | |
|     int nMetaMagic = GetMetaMagicFeat();
 | |
|     int nDamage;
 | |
|     effect eStun = EffectStunned();
 | |
|     effect eVis = EffectVisualEffect(VFX_IMP_SONIC);
 | |
|     effect eFNF = EffectVisualEffect(VFX_FNF_SOUND_BURST);
 | |
|     effect eMind = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_NEGATIVE);
 | |
|     effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
 | |
| 
 | |
|     effect eLink = EffectLinkEffects(eStun, eMind);
 | |
|     eLink = EffectLinkEffects(eLink, eDur);
 | |
| 
 | |
|     effect eDam;
 | |
|     location lLoc = GetSpellTargetLocation();
 | |
|     int nDC = GetSpellSaveDC();
 | |
|     //Apply the FNF to the spell location
 | |
|     ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eFNF, lLoc);
 | |
|     //Get the first target in the spell area
 | |
|     oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lLoc);
 | |
|     while (GetIsObjectValid(oTarget))
 | |
|     {
 | |
|         if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
 | |
|         {
 | |
|             //Fire cast spell at event for the specified target
 | |
|             SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_SOUND_BURST));
 | |
|             //Make a SR check
 | |
|             if(!MyResistSpell(OBJECT_SELF, oTarget))
 | |
|             {
 | |
|                 //Roll damage
 | |
|                 nDamage = d4(nCasterLevel)+20;
 | |
|                 //Make a Will roll to avoid being stunned
 | |
|                 if(!/*Will Save*/ MySavingThrow(SAVING_THROW_WILL, oTarget, nDC, SAVING_THROW_TYPE_SONIC))
 | |
|                 {
 | |
|                     ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(2));
 | |
|                 }
 | |
|                 //Make meta magic checks
 | |
|                 if (nMetaMagic == METAMAGIC_MAXIMIZE)
 | |
|                 {
 | |
|                     nDamage = (4*(nCasterLevel))+20;
 | |
|                 }
 | |
|                 if (nMetaMagic == METAMAGIC_EMPOWER)
 | |
|                 {
 | |
|                     nDamage = nDamage + (nDamage/2);
 | |
|                 }
 | |
| 
 | |
|                 //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 :) //
 | |
| 
 | |
| 
 | |
| 
 | |
|                 //Set the damage effect
 | |
|                 eDam = EffectDamage(nDamage2, DAMAGE_TYPE_SONIC);
 | |
|                 //Apply the VFX impact and damage effect
 | |
|                 ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis,oTarget);
 | |
|                 DelayCommand(0.01, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam,oTarget));
 | |
|             }
 | |
|         }
 | |
|         //Get the next target in the spell area
 | |
|         oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lLoc);
 | |
|     }
 | |
| }
 | |
| 
 |