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

87 lines
2.8 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Halito (Little Fire)
//:: halito.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Causes 1d8 (1-8) points of fire damage to a monster.
Level 1 Mage spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 1 Mage attack spell that targets
one monster.
*/
//:://////////////////////////////////////////////
//:: 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 fire damage
// Spellcast Hook Code
if (!X2PreSpellCastCode()) return;
// Set spell school for proper record keeping
PRCSetSchool(SPELL_SCHOOL_EVOCATION);
// 1. Get caster information
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nMetaMagic = PRCGetMetaMagicFeat();
int nPenetr = nCasterLevel + SPGetPenetr();
// 2. Get the target
object oTarget = PRCGetSpellTargetObject();
// 3. Check if target is valid and is an enemy
if (GetIsObjectValid(oTarget) && spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, oCaster))
{
// Signal spell cast at event
SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId()));
// Make SR check
if (!PRCDoResistSpell(oCaster, oTarget, nPenetr))
{
// 4. Calculate damage
int nDamage = d8(1); // 1d8 fire damage
// Apply metamagic
if (CheckMetaMagic(nMetaMagic, METAMAGIC_MAXIMIZE))
nDamage = 8; // Maximum damage
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EMPOWER))
nDamage += nDamage / 2; // +50% damage
// Add bonus damage per die
nDamage += SpellDamagePerDice(oCaster, 1);
// 5. Create the damage effect
effect eDamage = PRCEffectDamage(oTarget, nDamage, DAMAGE_TYPE_FIRE);
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_S);
// 6. Apply the effects
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);
// Apply any bonus damage effects
PRCBonusDamage(oTarget);
// 7. Notify the caster
FloatingTextStringOnCreature("HALITO: " + IntToString(nDamage) + " fire damage to " + GetName(oTarget), oCaster, TRUE);
}
}
else
{
// Notify if no valid target
FloatingTextStringOnCreature("HALITO: No valid target found", oCaster, TRUE);
}
// Clean up spell school variable
PRCSetSchool();
}