2025-04-30 12:23:15 -04:00

139 lines
4.9 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Manifo (Statue)
//:: manifo.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Attempts to paralyze a monster group.
Level 2 Priest spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 2 Priest disable spell that targets
a monster group.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
#include "prc_inc_spells"
#include "prc_add_spell_dc"
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Paralyze a group of monsters
// Spellcast Hook Code
if (!X2PreSpellCastCode()) return;
// Set spell school for proper record keeping
PRCSetSchool(SPELL_SCHOOL_ENCHANTMENT);
// Declare major variables
object oCaster = OBJECT_SELF;
object oTarget = PRCGetSpellTargetObject();
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nMetaMagic = PRCGetMetaMagicFeat();
int nPenetr = nCasterLevel + SPGetPenetr();
// Make sure duration does not equal 0
if (nCasterLevel < 1)
nCasterLevel = 2; // Minimum level 2 for this spell
// Calculate duration
int nDuration = nCasterLevel;
// Check Extend metamagic feat
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
nDuration *= 2; // Duration is +100%
// Create the paralysis effects
effect eParalyze = EffectParalyze();
effect eVis = EffectVisualEffect(VFX_IMP_HOLD_PERSON);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
effect eDur2 = EffectVisualEffect(VFX_DUR_PARALYZED);
effect eDur3 = EffectVisualEffect(VFX_DUR_PARALYZE_HOLD);
// Link the effects
effect eLink = EffectLinkEffects(eDur2, eDur);
eLink = EffectLinkEffects(eLink, eParalyze);
eLink = EffectLinkEffects(eLink, eDur3);
// Get the target location
location lTarget = GetLocation(oTarget);
// Declare the spell shape, size and the location
object oAffected = MyFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lTarget, TRUE, OBJECT_TYPE_CREATURE);
// Track affected targets
int nAffected = 0;
// Cycle through the targets within the spell shape
while (GetIsObjectValid(oAffected))
{
// Check if target is valid (hostile)
if (spellsIsTarget(oAffected, SPELL_TARGET_STANDARDHOSTILE, oCaster))
{
// Fire cast spell at event for the specified target
SignalEvent(oAffected, EventSpellCastAt(oCaster, GetSpellId()));
// Make SR check
if (!PRCDoResistSpell(oCaster, oAffected, nPenetr))
{
// Make Will save
if (!PRCMySavingThrow(SAVING_THROW_WILL, oAffected, PRCGetSaveDC(oAffected, oCaster)))
{
// Check for immunity to paralysis
if (!GetIsImmune(oAffected, IMMUNITY_TYPE_PARALYSIS))
{
// Apply the paralysis effect
int nScaledDuration = PRCGetScaledDuration(nDuration, oAffected);
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oAffected, RoundsToSeconds(nScaledDuration), TRUE, -1, nCasterLevel);
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oAffected);
// Set paralysis condition flag
SetLocalInt(oAffected, "CONDITION_PARALYZED", 1);
// Notify success
FloatingTextStringOnCreature(GetName(oAffected) + " is paralyzed!", oCaster, TRUE);
// Increment affected count
nAffected++;
}
else
{
// Notify immunity
FloatingTextStringOnCreature(GetName(oAffected) + " is immune to paralysis!", oCaster, TRUE);
}
}
else
{
// Notify save
FloatingTextStringOnCreature(GetName(oAffected) + " resisted paralysis!", oCaster, TRUE);
}
}
else
{
// Notify SR
FloatingTextStringOnCreature(GetName(oAffected) + " has spell resistance!", oCaster, TRUE);
}
}
// Get next target in the shape
oAffected = MyNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, lTarget, TRUE, OBJECT_TYPE_CREATURE);
}
// Final notification
if (nAffected > 0)
{
FloatingTextStringOnCreature("MANIFO: Paralyzed " + IntToString(nAffected) + " enemies!", oCaster, TRUE);
}
else
{
FloatingTextStringOnCreature("MANIFO: No enemies affected", oCaster, TRUE);
}
// Clean up spell school variable
PRCSetSchool();
}