92 lines
3.3 KiB
Plaintext
92 lines
3.3 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Mamorlis (Terror)
|
|
//:: mamorlis.nss
|
|
//:: Copyright (c) 2025 WizardryEE Project
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Attempts to frighten and disperse all monsters.
|
|
Level 5 Mage spell.
|
|
|
|
In Wizardry: Proving Grounds of the Mad Overlord,
|
|
this is a Level 5 Mage disable spell that targets
|
|
all monsters.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: WizardryEE Project
|
|
//:: Created On: April 26, 2025
|
|
//:://////////////////////////////////////////////
|
|
|
|
void main()
|
|
{
|
|
// Spell implementation for WizardryEE
|
|
// Core functionality: Frighten and disperse all monsters
|
|
|
|
// 1. Get caster information
|
|
object oCaster = OBJECT_SELF;
|
|
|
|
// 2. Calculate save DC based on caster level
|
|
int nCasterLevel = GetLevelByClass(CLASS_TYPE_WIZARD, oCaster);
|
|
if (nCasterLevel < 1) nCasterLevel = 5; // Minimum level 5 for this spell
|
|
int nDC = 10 + nCasterLevel;
|
|
float fDuration = RoundsToSeconds(nCasterLevel);
|
|
|
|
// 3. Create global terror visual effect
|
|
effect eTerrorVis = EffectVisualEffect(48); // Fear visual effect
|
|
location lCaster = GetLocation(oCaster);
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eTerrorVis, lCaster);
|
|
|
|
// 4. Get all creatures in the area
|
|
object oArea = GetArea(oCaster);
|
|
object oTarget = GetFirstObjectInArea(oArea);
|
|
int nAffected = 0;
|
|
|
|
while (GetIsObjectValid(oTarget))
|
|
{
|
|
// Check if target is a valid enemy
|
|
if (GetIsEnemy(oTarget, oCaster) &&
|
|
GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
|
|
{
|
|
// Signal spell cast at event
|
|
SignalEvent(oTarget, EventSpellCastAt(oCaster, 28)); // Fear spell ID
|
|
|
|
// Allow saving throw to resist
|
|
if (!WillSave(oTarget, nDC, 2)) // 2 = Fear saving throw type
|
|
{
|
|
// Create the fear effects
|
|
effect eFear = EffectFrightened();
|
|
effect eVis = EffectVisualEffect(48); // Fear visual effect
|
|
effect eDur = EffectVisualEffect(15); // Negative duration visual effect
|
|
effect eLink = EffectLinkEffects(eFear, eDur);
|
|
|
|
// Apply the fear effect
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, fDuration);
|
|
|
|
// Set fear condition flag
|
|
SetLocalInt(oTarget, "CONDITION_FEARED", 1);
|
|
|
|
// Notify success
|
|
FloatingTextStringOnCreature(GetName(oTarget) + " is terrified!", oCaster, TRUE);
|
|
nAffected++;
|
|
}
|
|
else
|
|
{
|
|
// Notify resistance
|
|
FloatingTextStringOnCreature(GetName(oTarget) + " resisted terror!", oCaster, TRUE);
|
|
}
|
|
}
|
|
|
|
// Get next target in area
|
|
oTarget = GetNextObjectInArea(oArea);
|
|
}
|
|
|
|
// Final notification
|
|
if (nAffected > 0)
|
|
{
|
|
FloatingTextStringOnCreature("MAMORLIS: Terrified " + IntToString(nAffected) + " enemies!", oCaster, TRUE);
|
|
}
|
|
else
|
|
{
|
|
FloatingTextStringOnCreature("MAMORLIS: No enemies affected", oCaster, TRUE);
|
|
}
|
|
} |