97 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			97 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
//::///////////////////////////////////////////////
 | 
						|
//:: Acid Fog: Heartbeat
 | 
						|
//:: NW_S0_AcidFogC.nss
 | 
						|
//:: Copyright (c) 2001 Bioware Corp.
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
/*
 | 
						|
    All creatures within the AoE take 2d6 acid damage
 | 
						|
    per round and upon entering if they fail a Fort Save
 | 
						|
    their movement is halved.
 | 
						|
*/
 | 
						|
//:://////////////////////////////////////////////
 | 
						|
//:: 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 = 12;
 | 
						|
    int nDamage = (d12(nCasterLevel)+60)/2;
 | 
						|
    effect eDam;
 | 
						|
    effect eVis = EffectVisualEffect(VFX_IMP_ACID_S);
 | 
						|
    object oTarget;
 | 
						|
    float fDelay;
 | 
						|
 | 
						|
        //Enter Metamagic conditions
 | 
						|
        if (nMetaMagic == METAMAGIC_MAXIMIZE)
 | 
						|
        {
 | 
						|
            nDamage = (12*(nCasterLevel)+60)/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 the damage effect
 | 
						|
    eDam = EffectDamage(nDamage2, DAMAGE_TYPE_ACID);
 | 
						|
    //Start cycling through the AOE Object for viable targets including doors and placable objects.
 | 
						|
    oTarget = GetFirstInPersistentObject(OBJECT_SELF);
 | 
						|
    while(GetIsObjectValid(oTarget))
 | 
						|
    {
 | 
						|
        if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, GetAreaOfEffectCreator()))
 | 
						|
        {
 | 
						|
            if(!MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ACID, GetAreaOfEffectCreator(), fDelay))
 | 
						|
            {
 | 
						|
                 nDamage = (nDamage2)/2;
 | 
						|
            }
 | 
						|
            fDelay = GetRandomDelay(0.4, 1.2);
 | 
						|
            //Fire cast spell at event for the affected target
 | 
						|
            SignalEvent(oTarget, EventSpellCastAt(GetAreaOfEffectCreator(), SPELL_ACID_FOG));
 | 
						|
            //Spell resistance check
 | 
						|
            if(!MyResistSpell(GetAreaOfEffectCreator(), oTarget, fDelay))
 | 
						|
            {
 | 
						|
               //Apply damage and visuals
 | 
						|
                DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
 | 
						|
                DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
 | 
						|
            }
 | 
						|
        }
 | 
						|
        //Get next target.
 | 
						|
        oTarget = GetNextInPersistentObject(OBJECT_SELF);
 | 
						|
    }
 | 
						|
}
 |