72 lines
2.5 KiB
Plaintext
72 lines
2.5 KiB
Plaintext
|
//::///////////////////////////////////////////////
|
||
|
//:: Badi (Death)
|
||
|
//:: badi.nss
|
||
|
//:: Copyright (c) 2025 WizardryEE Project
|
||
|
//:://////////////////////////////////////////////
|
||
|
/*
|
||
|
Attempts to kill a monster.
|
||
|
Level 5 Priest spell.
|
||
|
|
||
|
In Wizardry: Proving Grounds of the Mad Overlord,
|
||
|
this is a Level 5 Priest attack spell that targets
|
||
|
one monster.
|
||
|
*/
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Created By: WizardryEE Project
|
||
|
//:: Created On: April 26, 2025
|
||
|
//:://////////////////////////////////////////////
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
// Spell implementation for WizardryEE
|
||
|
// Core functionality: Attempt instant death on a 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. Calculate save DC based on caster level
|
||
|
int nCasterLevel = GetLevelByClass(CLASS_TYPE_CLERIC, oCaster);
|
||
|
if (nCasterLevel < 1) nCasterLevel = 5; // Minimum level 5 for this spell
|
||
|
int nDC = 10 + nCasterLevel;
|
||
|
|
||
|
// 5. Create the death effect
|
||
|
effect eDeath = EffectDeath();
|
||
|
effect eVis = EffectVisualEffect(45); // Death visual effect
|
||
|
|
||
|
// 6. Apply the effects
|
||
|
// Signal spell cast at event
|
||
|
SignalEvent(oTarget, EventSpellCastAt(oCaster, 24)); // Death spell ID
|
||
|
|
||
|
// Allow saving throw to resist
|
||
|
if (!FortitudeSave(oTarget, nDC, 3)) // 3 = Death saving throw type
|
||
|
{
|
||
|
// Apply the visual and death effects
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget);
|
||
|
|
||
|
// Notify success
|
||
|
FloatingTextStringOnCreature("BADI: " + GetName(oTarget) + " is killed!", oCaster, TRUE);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// Notify resistance
|
||
|
FloatingTextStringOnCreature(GetName(oTarget) + " resisted death!", oCaster, TRUE);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// Notify if no valid target
|
||
|
FloatingTextStringOnCreature("BADI: No valid target found", oCaster, TRUE);
|
||
|
}
|
||
|
}
|