86 lines
3.2 KiB
Plaintext
86 lines
3.2 KiB
Plaintext
|
//::///////////////////////////////////////////////
|
||
|
//:: Mabadi (Harming)
|
||
|
//:: mabadi.nss
|
||
|
//:: Copyright (c) 2025 WizardryEE Project
|
||
|
//:://////////////////////////////////////////////
|
||
|
/*
|
||
|
Causes all but 1d8 (1-8) hit points to be removed
|
||
|
from a monster.
|
||
|
Level 6 Priest spell.
|
||
|
|
||
|
In Wizardry: Proving Grounds of the Mad Overlord,
|
||
|
this is a Level 6 Priest attack spell that targets
|
||
|
one monster.
|
||
|
*/
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Created By: WizardryEE Project
|
||
|
//:: Created On: April 26, 2025
|
||
|
//:://////////////////////////////////////////////
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
// Spell implementation for WizardryEE
|
||
|
// Core functionality: Remove all but 1d8 HP from 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 = 6; // Minimum level 6 for this spell
|
||
|
int nDC = 10 + nCasterLevel;
|
||
|
|
||
|
// Signal spell cast at event
|
||
|
SignalEvent(oTarget, EventSpellCastAt(oCaster, 27)); // Harm spell ID
|
||
|
|
||
|
// Allow saving throw to resist
|
||
|
if (!FortitudeSave(oTarget, nDC, 3)) // 3 = Death/Harm saving throw type
|
||
|
{
|
||
|
// 5. Calculate remaining HP
|
||
|
int nCurrentHP = GetCurrentHitPoints(oTarget);
|
||
|
int nRemainingHP = d8(1); // 1d8 HP will remain
|
||
|
int nDamage = nCurrentHP - nRemainingHP;
|
||
|
|
||
|
if (nDamage > 0) // Only apply if we're actually reducing HP
|
||
|
{
|
||
|
// 6. Create the damage effect
|
||
|
effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_NEGATIVE);
|
||
|
effect eVis = EffectVisualEffect(40); // Negative energy visual effect
|
||
|
|
||
|
// 7. Apply the effects
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);
|
||
|
|
||
|
// 8. Notify the caster
|
||
|
FloatingTextStringOnCreature("MABADI: " + GetName(oTarget) + " reduced to " +
|
||
|
IntToString(nRemainingHP) + " hit points!", oCaster, TRUE);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// Target already has very low HP
|
||
|
FloatingTextStringOnCreature("MABADI: " + GetName(oTarget) + " already near death!", oCaster, TRUE);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// Notify resistance
|
||
|
FloatingTextStringOnCreature(GetName(oTarget) + " resisted the harming!", oCaster, TRUE);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// Notify if no valid target
|
||
|
FloatingTextStringOnCreature("MABADI: No valid target found", oCaster, TRUE);
|
||
|
}
|
||
|
}
|