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

68 lines
2.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Zilwan (Dispel)
//:: zilwan.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Kills an undead monster.
Level 6 Mage spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 6 Mage attack spell that targets
one undead monster.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Kill an undead monster
// 1. Get caster information
object oCaster = OBJECT_SELF;
// 2. Get the target
object oTarget = GetSpellTargetObject();
if (!GetIsObjectValid(oTarget))
{
// If no specific target, get the nearest enemy
oTarget = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, oCaster, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
}
// 3. Check if target is valid and is an enemy
if (GetIsObjectValid(oTarget) && GetIsEnemy(oTarget, oCaster))
{
// 4. Check if target is undead
int bIsUndead = GetLocalInt(oTarget, "ABILITY_UNDEAD");
if (bIsUndead)
{
// Create the dispel effects
effect eDeath = EffectDeath();
effect eVis = EffectVisualEffect(47); // Holy/Dispel visual effect
// Signal spell cast at event
SignalEvent(oTarget, EventSpellCastAt(oCaster, 40)); // Destroy Undead spell ID
// Apply the visual and death effects
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget);
// Notify success
FloatingTextStringOnCreature("ZILWAN: " + GetName(oTarget) + " is destroyed!", oCaster, TRUE);
}
else
{
// Notify target is not undead
FloatingTextStringOnCreature("ZILWAN: " + GetName(oTarget) + " is not undead!", oCaster, TRUE);
}
}
else
{
// Notify if no valid target
FloatingTextStringOnCreature("ZILWAN: No valid target found", oCaster, TRUE);
}
}