WizardryEE/Content/spells/masopic.nss
2025-04-26 15:20:45 -04:00

79 lines
2.7 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Masopic (Big Glass)
//:: masopic.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Reduces the armor class of all party members by 4
for the duration of the combat.
Level 6 Mage spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 6 Mage support spell that targets
the entire party.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Reduce party's AC by 4
// 1. Get caster information
object oCaster = OBJECT_SELF;
// 2. Calculate duration (based on caster level)
int nCasterLevel = GetLevelByClass(CLASS_TYPE_WIZARD, oCaster);
if (nCasterLevel < 1) nCasterLevel = 6; // Minimum level 6 for this spell
float fDuration = RoundsToSeconds(nCasterLevel); // Lasts for rounds equal to caster level
// 3. Remove any existing MOGREF/SOPIC effects
object oMember = GetFirstPC();
while (GetIsObjectValid(oMember))
{
if (GetLocalInt(oMember, "MOGREF_ACTIVE") == 1)
{
DeleteLocalInt(oMember, "MOGREF_ACTIVE");
// The game engine would handle removing the effect
}
if (GetLocalInt(oMember, "SOPIC_ACTIVE") == 1)
{
DeleteLocalInt(oMember, "SOPIC_ACTIVE");
// The game engine would handle removing the effect
}
oMember = GetNextPC();
}
// 4. Create the AC reduction effect
effect eAC = EffectACDecrease(4); // Reduce AC by 4 (lower AC is better)
effect eVis = EffectVisualEffect(21); // Shield visual effect
effect eDur = EffectVisualEffect(14); // Duration visual effect
effect eLink = EffectLinkEffects(eAC, eDur);
// 5. Apply to all party members
oMember = GetFirstPC();
while (GetIsObjectValid(oMember))
{
// Signal spell cast at event
SignalEvent(oMember, EventSpellCastAt(oCaster, 58, FALSE)); // Mage Armor spell ID
// Apply the visual and AC effects
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oMember);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oMember, fDuration);
// Set the MASOPIC flag
SetLocalInt(oMember, "MASOPIC_ACTIVE", 1);
// Notify the target
FloatingTextStringOnCreature("AC reduced by 4", oMember, TRUE);
// Get next party member
oMember = GetNextPC();
}
// 6. Final notification
FloatingTextStringOnCreature("MASOPIC: Party AC reduced by 4", oCaster, TRUE);
}