Updated Release Archive. Fixed Mage-killer prereqs. Removed old LETO & ConvoCC related files. Added organized spell scroll store. Fixed Gloura spellbook. Various TLK fixes. Reorganized Repo. Removed invalid user folders. Added DocGen back in.
126 lines
4.2 KiB
Plaintext
126 lines
4.2 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Enervation
|
|
//:: NW_S0_Enervat.nss
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Target Loses 1d4 levels for 1 hour per caster
|
|
level
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Jan 7, 2002
|
|
//:://////////////////////////////////////////////
|
|
|
|
//:: modified by mr_bumpkin Dec 4, 2003 for PRC stuff
|
|
|
|
//::Added code to maximize for Faith Healing and Blast Infidel
|
|
//::Aaon Graywolf - Jan 7, 2003
|
|
|
|
|
|
#include "prc_inc_sp_tch"
|
|
#include "prc_inc_function"
|
|
#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 nDrain = d4();
|
|
int nDuration = nCasterLevel;
|
|
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
|
|
effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
|
|
|
|
//Undead Gain HP from Enervation
|
|
int nHP = ((nCasterLevel/2) * 5);
|
|
if (nHP > 25)
|
|
{
|
|
nHP = 25;
|
|
}
|
|
|
|
effect eHP = EffectTemporaryHitpoints(nHP);
|
|
|
|
//Enter Metamagic conditions
|
|
int iBlastFaith = BlastInfidelOrFaithHeal(OBJECT_SELF, oTarget, DAMAGE_TYPE_NEGATIVE, TRUE);
|
|
if ((nMetaMagic & METAMAGIC_MAXIMIZE) || iBlastFaith)
|
|
{
|
|
nDrain = 4;//Damage is at max
|
|
}
|
|
if (nMetaMagic & METAMAGIC_EMPOWER)
|
|
{
|
|
nDrain = nDrain + (nDrain/2); //Damage/Healing is +50%
|
|
}
|
|
if (nMetaMagic & METAMAGIC_EXTEND)
|
|
{
|
|
nDuration = nDuration *2; //Duration is +100%
|
|
}
|
|
|
|
effect eDrain = EffectNegativeLevel(nDrain);
|
|
effect eLink = EffectLinkEffects(eDrain, eDur);
|
|
|
|
int iAttackRoll = PRCDoRangedTouchAttack(oTarget);;
|
|
if(iAttackRoll > 0)
|
|
{
|
|
if (MyPRCGetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
|
|
{
|
|
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eHP, oTarget, HoursToSeconds(1),TRUE,-1,nCasterLevel);
|
|
}
|
|
|
|
if(!GetIsReactionTypeFriendly(oTarget))
|
|
{
|
|
//Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_ENERVATION));
|
|
//Resist magic check
|
|
if(!PRCDoResistSpell(OBJECT_SELF, oTarget, nPenetr))
|
|
{
|
|
if(!PRCMySavingThrow(SAVING_THROW_FORT, oTarget, PRCGetSaveDC(oTarget, OBJECT_SELF), SAVING_THROW_TYPE_NEGATIVE))
|
|
{
|
|
//Apply the VFX impact and effects
|
|
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, HoursToSeconds(nDuration),TRUE,-1,nCasterLevel);
|
|
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
|
|
}
|
|
|
|
ApplyTouchAttackDamage(OBJECT_SELF, oTarget, iAttackRoll, 0, DAMAGE_TYPE_NEGATIVE);
|
|
}
|
|
}
|
|
}
|
|
|
|
return iAttackRoll; //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();
|
|
}
|