94 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| //::///////////////////////////////////////////////
 | |
| //:: Cloudkill: Heartbeat
 | |
| //:: NW_S0_CloudKillC.nss
 | |
| //:: Copyright (c) 2001 Bioware Corp.
 | |
| //:://////////////////////////////////////////////
 | |
| /*
 | |
|     All creatures with 3 or less HD die, those with
 | |
|     4 to 6 HD must make a save Fortitude Save or die.
 | |
|     Those with more than 6 HD take 1d10 Poison damage
 | |
|     every round.
 | |
| */
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Created By: Preston Watamaniuk
 | |
| //:: Created On: May 17, 2001
 | |
| //:://////////////////////////////////////////////
 | |
| 
 | |
| #include "ke_spell_factor"
 | |
| 
 | |
| #include "X0_I0_SPELLS"
 | |
| 
 | |
| void main()
 | |
| {
 | |
| 
 | |
| 
 | |
|     //Declare major variables
 | |
|     int nMetaMagic = GetMetaMagicFeat();
 | |
|     int nCasterLevel = 10;
 | |
|     int nDamage = (d10(nCasterLevel)+50)/2;
 | |
|     effect eDam;
 | |
|     effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
 | |
|     object oTarget;
 | |
|     float fDelay;
 | |
| 
 | |
|     //Enter Metamagic conditions
 | |
|     if (nMetaMagic == METAMAGIC_MAXIMIZE)
 | |
|     {
 | |
|         nDamage = (10*(nCasterLevel)+50)/2;//Damage is at max
 | |
|     }
 | |
|     if (nMetaMagic == METAMAGIC_EMPOWER)
 | |
|     {
 | |
|         nDamage = nDamage + (nDamage/2); //Damage/Healing is +50%
 | |
|     }
 | |
| 
 | |
|    //--------------------------------------------------------------------------
 | |
|     // GZ 2003-Oct-15
 | |
|     // When the caster is no longer there, all functions calling
 | |
|     // GetAreaOfEffectCreator will fail. Its better to remove the barrier then
 | |
|     //--------------------------------------------------------------------------
 | |
|     if (!GetIsObjectValid(GetAreaOfEffectCreator()))
 | |
|     {
 | |
|         DestroyObject(OBJECT_SELF);
 | |
|         return;
 | |
|     }
 | |
| 
 | |
|     //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 damage effect
 | |
|     eDam = EffectDamage(nDamage2, DAMAGE_TYPE_ACID);
 | |
|     //Get the first object in the persistant AOE
 | |
|     oTarget = GetFirstInPersistentObject();
 | |
|     while(GetIsObjectValid(oTarget))
 | |
|     {
 | |
|         fDelay = GetRandomDelay();
 | |
|         if(spellsIsTarget(oTarget,SPELL_TARGET_STANDARDHOSTILE , GetAreaOfEffectCreator()) )
 | |
|         {
 | |
|             //Fire cast spell at event for the specified target
 | |
|             SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_CLOUDKILL));
 | |
|             if(!MyResistSpell(GetAreaOfEffectCreator(), oTarget, fDelay))
 | |
|             {
 | |
|                 //Apply VFX impact and damage
 | |
|                 DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
 | |
|                 DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
 | |
|             }
 | |
|         }
 | |
|         //Get the next target in the AOE
 | |
|         oTarget = GetNextInPersistentObject();
 | |
|     }
 | |
| }
 |