PRC8/nwn/nwnprc/trunk/spells/nw_s0_searlght.nss
Jaysyn904 6ec137a24e Updated AMS marker feats
Updated AMS marker feats.  Removed arcane & divine marker feats.  Updated Dread Necromancer for epic progression. Updated weapon baseitem models.  Updated new weapons for crafting & npc equip.
 Updated prefix.  Updated release archive.
2024-02-11 14:01:05 -05:00

140 lines
5.0 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Searing Light
//:: s_SearLght.nss
//:: Copyright (c) 2000 Bioware Corp.
//:://////////////////////////////////////////////
//:: Focusing holy power like a ray of the sun, you project
//:: a blast of light from your open palm. You must succeed
//:: at a ranged touch attack to strike your target. A creature
//:: struck by this ray of light suffers 1d8 points of damage
//:: per two caster levels (maximum 5d8). Undead creatures suffer
//:: 1d6 points of damage per caster level (maximum 10d6), and
//:: undead creatures particularly vulnerable to sunlight, such
//:: as vampires, suffer 1d8 points of damage per caster level
//:: (maximum 10d8). Constructs and inanimate objects suffer only
//:: 1d6 points of damage per two caster levels (maximum 5d6).
//:://////////////////////////////////////////////
//:: Created By: Keith Soleski
//:: Created On: 02/05/2001
//:://////////////////////////////////////////////
//:: VFX Pass By: Preston W, On: June 25, 2001
//:: modified by mr_bumpkin Dec 4, 2003 for PRC stuff
//:: Added hold ray functionality - HackyKid
#include "prc_sp_func"
#include "prc_add_spell_dc"
//Implements the spell impact, put code here
// if called in many places, return TRUE if
// stored charges should be decreased
// eg. touch attack hits
//
// Variables passed may be changed if necessary
int DoSpell(object oCaster, object oTarget, int nCasterLevel, int nEvent)
{
int nMetaMagic = PRCGetMetaMagicFeat();
int nSaveDC = PRCGetSaveDC(oTarget, oCaster);
int nPenetr = nCasterLevel + SPGetPenetr();
int nDamage;
int nMax;
effect eDam;
effect eVis = EffectVisualEffect(VFX_IMP_SUNSTRIKE);
effect eRay = EffectBeam(VFX_BEAM_HOLY, OBJECT_SELF, BODY_NODE_HAND);
if(!GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_SEARING_LIGHT));
eRay = EffectBeam(VFX_BEAM_HOLY, OBJECT_SELF, BODY_NODE_HAND);
//Make an SR Check
if (!PRCDoResistSpell(oCaster, oTarget, nPenetr))
{
//Limit caster level
if (nCasterLevel > 10)
{
nCasterLevel = 10;
}
//Check for racial type undead
if (MyPRCGetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
{
nDamage = d8(nCasterLevel);
nMax = 8;
}
//Check for racial type construct
else if (MyPRCGetRacialType(oTarget) == RACIAL_TYPE_CONSTRUCT)
{
nCasterLevel /= 2;
if(nCasterLevel == 0)
{
nCasterLevel = 1;
}
nDamage = d6(nCasterLevel);
nMax = 6;
}
else
{
nCasterLevel = nCasterLevel/2;
if(nCasterLevel == 0)
{
nCasterLevel = 1;
}
nDamage = d8(nCasterLevel);
nMax = 8;
}
//Make metamagic checks
if ((nMetaMagic & METAMAGIC_MAXIMIZE))
{
nDamage = nMax * nCasterLevel;
}
if ((nMetaMagic & METAMAGIC_EMPOWER))
{
nDamage = nDamage + (nDamage/2);
}
nDamage += SpellDamagePerDice(oCaster, nCasterLevel);
//Set the damage effect
eDam = PRCEffectDamage(oTarget, nDamage, DAMAGE_TYPE_DIVINE);
//Apply the damage effect and VFX impact
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
DelayCommand(0.5, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
//SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.0);
}
}
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.7,FALSE);
return !GetIsReactionTypeFriendly(oTarget); //return TRUE if spell charges should be decremented
}
void main()
{
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
PRCSetSchool(GetSpellSchool(PRCGetSpellId()));
if (!X2PreSpellCastCode()) return;
object oTarget = PRCGetSpellTargetObject();
int nEvent = GetLocalInt(oCaster, PRC_SPELL_EVENT); //use bitwise & to extract flags
if(!nEvent) //normal cast
{
if (GetLocalInt(oCaster, PRC_SPELL_HOLD) && GetHasFeat(FEAT_EF_HOLD_RAY, oCaster) && oCaster == oTarget)
{ //holding the charge, casting spell on self
SetLocalSpellVariables(oCaster, 1); //change 1 to number of charges
return;
}
if (oCaster != oTarget) //cant target self with this spell, only when holding charge
DoSpell(oCaster, oTarget, nCasterLevel, nEvent);
}
else
{
if(nEvent & PRC_SPELL_EVENT_ATTACK)
{
if(DoSpell(oCaster, oTarget, nCasterLevel, nEvent))
DecrementSpellCharges(oCaster);
}
}
PRCSetSchool();
}