//:://///////////////////////////////////////////// //:: Ice Storm //:: NW_S0_IceStorm //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Everyone in the area takes 3d6 Bludgeoning and 2d6 Cold damage. */ //::////////////////////////////////////////////// //:: Created By: Preston Watamaniuk //:: Created On: Sept 12, 2001 //::////////////////////////////////////////////// #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()) { // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell return; } // End of Spell Cast Hook //Declare major variables object oCaster = OBJECT_SELF; int nCasterLvl = GetCasterLevel(oCaster); int nMetaMagic = GetMetaMagicFeat(); int nDamage, nDamage2; int nVariable = nCasterLvl; if (nVariable > 40) { nVariable = 40; } float fDelay; effect eExplode = EffectVisualEffect(VFX_FNF_ICESTORM); //USE THE ICESTORM FNF effect eVis = EffectVisualEffect(VFX_IMP_FROST_S); effect eDam,eDam2, eDam3; //Get the spell target location as opposed to the spell target. location lTarget = GetSpellTargetLocation(); //Apply the ice storm VFX at the location captured above. ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget); //Declare the spell shape, size and the location. Capture the first target object in the shape. object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); //Cycle through the targets within the spell shape until an invalid object is captured. while (GetIsObjectValid(oTarget)) { if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF)) { fDelay = GetRandomDelay(0.75, 2.25); //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_ICE_STORM)); if (!MyResistSpell(OBJECT_SELF, oTarget, fDelay)) { //Roll damage for each target nDamage = (d8(nVariable)+40)/2; nDamage2 = (d8(nVariable)+40)/2; //Resolve metamagic if (nMetaMagic == METAMAGIC_MAXIMIZE) { nDamage = (8*(nVariable)+40)/2; nDamage2 = (8*(nVariable)+40)/2; } else if (nMetaMagic == METAMAGIC_EMPOWER) { nDamage = nDamage + (nDamage / 2); nDamage2 = nDamage2 + (nDamage2 / 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 nDamage3 = FloatToInt(fDamage); int nDamage4 = FloatToInt(fDamage); // Done and remember to change nDamage with nDamage2 below :) // //Set the damage effect eDam = EffectDamage(nDamage3, DAMAGE_TYPE_BLUDGEONING); eDam2 = EffectDamage(nDamage4, DAMAGE_TYPE_COLD); // Apply effects to the currently selected target. DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget)); DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam2, oTarget)); //This visual effect is applied to the target object not the location as above. This visual effect //represents the impact that erupts on the target not on the ground. DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); } } //Select the next target within the spell shape. oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE); } }