PRC8/nwn/nwnprc/trunk/smp/phs_s_disruptwpa.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

89 lines
3.2 KiB
Plaintext

/*:://////////////////////////////////////////////
//:: Spell Name Disrupting Weapon: On Hit
//:: Spell FileName PHS_S_DisruptWpA
//:://////////////////////////////////////////////
//:: In Game Spell desctiption
//:://////////////////////////////////////////////
Transmutation
Level: Clr 5
Components: V, S
Casting Time: 1 standard action
Range: Touch
Targets: One melee weapon
Duration: 1 round/level
Saving Throw: Will negates (harmless, object); see text
Spell Resistance: Yes (harmless, object)
This spell makes a melee weapon deadly to undead. Any undead creature with
HD equal to or less than your caster level must succeed on a Will save or be
destroyed utterly if struck in combat with this weapon. Spell resistance
does not apply against the destruction effect.
//:://////////////////////////////////////////////
//:: Spell Effects Applied / Notes
//:://////////////////////////////////////////////
Special On hit effect that kills undead.
Sets a local on the weapon for the caster level, as well.
Quote: x2_s3_darkfire
We need to use this property because we can not
add random elemental damage to a weapon in any
other way and implementation should be as close
as possible to the book.
Behavior:
The casterlevel is set as a variable on the
weapon, so if players leave and rejoin, it
is lost (and the script will just assume a
minimal caster level).
We set the DC onto the weapon as a local int. PHS_S_DisruptWpA has the
actual "On hit" stuff.
This will:
- Check caster item (jsut in case)
- declare only what is needed when, to save some CPU time.
- Get the caster level of the item being cast, the DC is set on the weapon itself
- Make sure they are Undead, not immune to spells and under our HD.
- Get spell save DC
- Do the will save
- Kill it (CurrentHP + 10 damage, divine) (um, only if they fail the save!).
//:://////////////////////////////////////////////
//:: Created By: Jasperre
//::////////////////////////////////////////////*/
#include "PHS_INC_SPELLS"
void main()
{
// On hit part of the spell.
// This needs to make sure it was an item that calls it.
object oItem = GetSpellCastItem();
if(!GetIsObjectValid(oItem)) return;
// Declare major variables
object oTarget = GetSpellTargetObject(); // Should be object self.
// We use the base GetCasterLevel(OBJECT_SELF) to get the item's caster stuff.
int nCasterLevel = GetCasterLevel(OBJECT_SELF);
// Check HD, Racial type and Immunity to spells
if(GetHitDice(oTarget) <= nCasterLevel &&
GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD &&
// Make sure they are not immune to spells
!PHS_TotalSpellImmunity(oTarget))
{
// We get the spell save DC off the item being used to attack!
int nSpellSaveDC = GetLocalInt(oItem, "PHS_DISRUPTING_WEAPON_DC");
// If they fail a will save...
if(!WillSave(oTarget, nSpellSaveDC))
{
// Declare effects
effect eVis = EffectVisualEffect(VFX_IMP_DIVINE_STRIKE_HOLY);
// Apply death effect.
PHS_ApplyDeathByDamageAndVFX(oTarget, eVis, DAMAGE_TYPE_POSITIVE);
}
}
}