2025-04-30 12:23:15 -04:00

87 lines
2.7 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()
{
// Spell implementation for WizardryEE
// Core functionality: Deal 1d8 negative energy damage to a monster
// Spellcast Hook Code
if (!X2PreSpellCastCode()) return;
// Set spell school for proper record keeping
PRCSetSchool(SPELL_SCHOOL_NECROMANCY);
// Declare major variables
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nMetaMagic = PRCGetMetaMagicFeat();
int nDamage;
effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
effect eDam;
// Get the spell target
object oTarget = PRCGetSpellTargetObject();
// Verify the target is a hostile creature
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, oCaster))
{
// Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId()));
// Make SR check
if (!PRCDoResistSpell(oCaster, oTarget, nCasterLevel + SPGetPenetr()))
{
// Roll damage - 1d8 negative energy damage
nDamage = d8(1);
// Resolve metamagic
if (CheckMetaMagic(nMetaMagic, METAMAGIC_MAXIMIZE))
{
nDamage = 8; // Maximum damage
}
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EMPOWER))
{
nDamage = nDamage + (nDamage / 2); // +50% damage
}
// Add bonus damage per die
nDamage += SpellDamagePerDice(oCaster, 1);
// 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);
// Apply any bonus damage effects
PRCBonusDamage(oTarget);
// Notify the caster
FloatingTextStringOnCreature("BADIOS: " + IntToString(nDamage) + " negative energy damage to " + GetName(oTarget), oCaster, TRUE);
}
}
else
{
// Notify if no valid target
FloatingTextStringOnCreature("BADIOS: No valid target found", oCaster, TRUE);
}
// Clean up spell school variable
PRCSetSchool();
}