//:://///////////////////////////////////////////// //:: Sunbeam //:: s_Sunbeam.nss //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// //:: All creatures in the beam are struck blind and suffer 4d6 points of damage. (A successful //:: Reflex save negates the blindness and reduces the damage by half.) Creatures to whom sunlight //:: is harmful or unnatural suffer double damage. //:: //:: Undead creatures caught within the ray are dealt 1d6 points of damage per caster level //:: (maximum 20d6), or half damage if a Reflex save is successful. In addition, the ray results in //:: the total destruction of undead creatures specifically affected by sunlight if they fail their saves. //::////////////////////////////////////////////// //:: Created By: Keith Soleski //:: Created On: Feb 22, 2001 //::////////////////////////////////////////////// //:: Last Modified By: Keith Soleski, On: March 21, 2001 //:: VFX Pass By: Preston W, On: June 25, 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 int nMetaMagic = GetMetaMagicFeat(); effect eVis = EffectVisualEffect(VFX_IMP_DEATH); effect eVis2 = EffectVisualEffect(VFX_IMP_SUNSTRIKE); effect eStrike = EffectVisualEffect(VFX_FNF_SUNBEAM); effect eDam; effect eBlind = EffectBlindness(); effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE); effect eLink = EffectLinkEffects(eBlind, eDur); int nCasterLevel= GetCasterLevel(OBJECT_SELF); int nDamage; int nOrgDam; int nMax; float fDelay; int nBlindLength = 3; //Limit caster level if (nCasterLevel > 40) { nCasterLevel = 40; } ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eStrike, GetSpellTargetLocation()); //Get the first target in the spell area object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, GetSpellTargetLocation()); while(GetIsObjectValid(oTarget)) { // Make a faction check if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF)) { fDelay = GetRandomDelay(1.0, 2.0); //Fire cast spell at event for the specified target SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_SUNBEAM)); //Make an SR check if ( ! MyResistSpell(OBJECT_SELF, oTarget, 1.0)) { //Check if the target is an undead if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD) { //Roll damage and save nDamage = d8(nCasterLevel); nMax = 8; } else { //Roll damage and save . nDamage = d8(3); nOrgDam = nDamage; nMax = 8; nCasterLevel = 3; //Get the adjusted damage due to Reflex Save, Evasion or Improved Evasion } nDamage = ((d10(nCasterLevel))*2)+100; //Do metamagic checks if (nMetaMagic == METAMAGIC_EMPOWER) { nDamage = nDamage + (nDamage/2); } //Check that a reflex save was made. if(MySavingThrow(SAVING_THROW_REFLEX, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_DIVINE, OBJECT_SELF, 1.0) == 0) { DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(nBlindLength))); } else { nDamage = GetReflexAdjustedDamage(nDamage, oTarget, 0, SAVING_THROW_TYPE_DIVINE); } //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_DIVINE); if(nDamage > 0) { //Apply the damage effect and VFX impact DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget)); DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget)); } } } //Get the next target in the spell area oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, GetSpellTargetLocation()); } }