2025-04-26 15:20:45 -04:00

83 lines
2.5 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Badios (Harm)
//:: badios.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Causes 1d8 (1-8) points of damage to a monster.
Level 1 Priest spell.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
#include "prc_inc_spells"
#include "prc_add_spell_dc"
void main()
{
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
SetLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR", SPELL_SCHOOL_NECROMANCY);
/*
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
object oCaster = OBJECT_SELF;
int CasterLvl = PRCGetCasterLevel(OBJECT_SELF);
int nMetaMagic = PRCGetMetaMagicFeat();
int nDamage;
float fDelay;
effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
effect eDam;
//Get the spell target
object oTarget = PRCGetSpellTargetObject();
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_HARM));
//Make SR check
if (!PRCDoResistSpell(OBJECT_SELF, oTarget, CasterLvl))
{
//Roll damage
nDamage = d8(1);
//Resolve metamagic
if (nMetaMagic & METAMAGIC_MAXIMIZE)
{
nDamage = 8;
}
if (nMetaMagic & METAMAGIC_EMPOWER)
{
nDamage = nDamage + (nDamage / 2);
}
//Set the damage effect
eDam = PRCEffectDamage(oTarget, nDamage, DAMAGE_TYPE_NEGATIVE);
//Apply the VFX impact and damage effect
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
PRCBonusDamage(oTarget);
}
}
DeleteLocalInt(OBJECT_SELF, "X2_L_LAST_SPELLSCHOOL_VAR");
// Getting rid of the local integer storing the spellschool name
}