Changes to nw_s0_polarray

:://///////
:: Polar Ray
:: [nw_s0_polarray.nss]
:: Copyright (c) 2006 Obsidian Entertainment, Inc.
:://////////
/*
If the caster succeeds at a ranged touch attack
the target takes 1d6 cold damage/caster level
(max 25d6).
*/
:://////////
:: Created By: Andrew Woo (AFW-OEI)
:: Created On: 06/06/2006
:://////////

#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"
#include "nw_i0_invocatns"

void main()
{
if (!X2PreSpellCastCode())
{ // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}

//Declare major variables
object oTarget = GetSpellTargetObject();
int nCasterLevel = GetCasterLevel(OBJECT_SELF);
int nTouch = TouchAttackRanged(oTarget);

//PKM-OEI: 05.28.07: Do critical hit damage before capping caster level
if (nTouch == TOUCH_ATTACK_RESULT_CRITICAL)
{
nCasterLevel = nCasterLevel*2;
}

if (nCasterLevel > 25) // Cap caster level
nCasterLevel = 25;
else if (nCasterLevel <= 0)
nCasterLevel = 1;
int nMetaMagic = GetMetaMagicFeat();

if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_POLAR_RAY));

if (nTouch != TOUCH_ATTACK_RESULT_MISS)
{ //Make SR Check
if (!(nMetaMagic & METAMAGIC_INVOC_VITRIOLIC_BLAST )) if (MyResistSpell(OBJECT_SELF, oTarget)) return;

Enter Metamagic conditions
int nDam = d6(nCasterLevel);
int nMetaMagic = GetMetaMagicFeat();
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDam = 6 * nCasterLevel ;
Damage is at max
}
else if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDam = nDam + nDam/2; //Damage/Healing is +50%
}

/*////////////*/
// Draco Rayne: Added Eldritch Theurge Spellweave Ability
/*
//////////////*/

//Set damage effect
effect eDam;
effect eVis;
effect eRay;
if ( nMetaMagic & METAMAGIC_INVOC_VITRIOLIC_BLAST )
{
eDam = EffectDamage(nDam, DAMAGE_TYPE_ACID);
eVis = EffectVisualEffect(VFX_HIT_SPELL_ACID);
eRay = EffectBeam(VFX_BEAM_ACID, OBJECT_SELF, BODY_NODE_HAND);
}
else if ( nMetaMagic & METAMAGIC_INVOC_BRIMSTONE_BLAST )
{
eDam = EffectDamage(nDam, DAMAGE_TYPE_FIRE);
eVis = EffectVisualEffect(VFX_HIT_SPELL_FIRE);
eRay = EffectBeam(VFX_BEAM_FIRE, OBJECT_SELF, BODY_NODE_HAND);
}
else if ( nMetaMagic & METAMAGIC_INVOC_UTTERDARK_BLAST )
{
eDam = EffectDamage(nDam, DAMAGE_TYPE_NEGATIVE);
eVis = EffectVisualEffect(VFX_HIT_SPELL_NECROMANCY);
eRay = EffectBeam(VFX_BEAM_NECROMANCY, OBJECT_SELF, BODY_NODE_HAND);
}
else
{
eDam = EffectDamage(nDam, DAMAGE_TYPE_COLD);
eVis = EffectVisualEffect(VFX_HIT_SPELL_ICE);
eRay = EffectBeam(VFX_BEAM_ICE, OBJECT_SELF, BODY_NODE_HAND);
}

//Apply the VFX impact and damage effect
if (( nMetaMagic & METAMAGIC_INVOC_UTTERDARK_BLAST)&&(GetRacialType(oTarget)==RACIAL_TYPE_UNDEAD))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nDam), oTarget);
}
else
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
}

if (GetHasFeat(FEAT_ELDRITCH_SPELLWEAVE))
{
if ( nMetaMagic & METAMAGIC_INVOC_FRIGHTFUL_BLAST ) DoETMetaFrightfulBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_DRAINING_BLAST ) DoETMetaDrainingBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_BESHADOWED_BLAST ) DoETMetaBeshadowedBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_BEWITCHING_BLAST ) DoETMetaBewitchingBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_NOXIOUS_BLAST ) DoETMetaNoxiousBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_BRIMSTONE_BLAST ) DoETMetaBrimstoneBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_VITRIOLIC_BLAST ) DoETMetaVitriolicBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_HELLRIME_BLAST ) DoETMetaHellrimeBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_UTTERDARK_BLAST ) DoETMetaUtterdarkBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_HINDERING_BLAST ) DoETMetaHinderingBlast(OBJECT_SELF, oTarget);
if ( nMetaMagic & METAMAGIC_INVOC_BINDING_BLAST ) DoETMetaBindingBlast(OBJECT_SELF, oTarget);
}

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.7);
}
}
}

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License