113 lines
4.0 KiB
Plaintext
113 lines
4.0 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Montino (Still Air)
|
|
//:: montino.nss
|
|
//:: Copyright (c) 2025 WizardryEE Project
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Attempts to silence a monster group, making it
|
|
impossible for them to cast spells.
|
|
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: Silence a group of monsters
|
|
|
|
// Spellcast Hook Code
|
|
if (!X2PreSpellCastCode()) return;
|
|
|
|
// Set spell school for proper record keeping
|
|
PRCSetSchool(SPELL_SCHOOL_ILLUSION);
|
|
|
|
// 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
|
|
float fDuration = RoundsToSeconds(nCasterLevel);
|
|
|
|
// Check Extend metamagic feat
|
|
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
|
|
fDuration *= 2; // Duration is +100%
|
|
|
|
// Create the silence area effect
|
|
int nAoE = AOE_MOB_SILENCE;
|
|
|
|
// Check if target is valid
|
|
if (GetIsObjectValid(oTarget))
|
|
{
|
|
// If target is hostile, require SR and saving throw
|
|
if (!GetIsFriend(oTarget))
|
|
{
|
|
// Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId()));
|
|
|
|
// Check spell resistance
|
|
if (!PRCDoResistSpell(oCaster, oTarget, nPenetr))
|
|
{
|
|
// Check saving throw
|
|
if (!PRCMySavingThrow(SAVING_THROW_WILL, oTarget, PRCGetSaveDC(oTarget, oCaster)))
|
|
{
|
|
// Create an instance of the AOE Object using the Apply Effect function
|
|
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectAreaOfEffect(nAoE), oTarget, fDuration);
|
|
|
|
// Notify success
|
|
FloatingTextStringOnCreature("MONTINO: " + GetName(oTarget) + " is silenced!", oCaster, TRUE);
|
|
}
|
|
else
|
|
{
|
|
// Notify saving throw success
|
|
FloatingTextStringOnCreature("MONTINO: " + GetName(oTarget) + " resisted silence!", oCaster, TRUE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Notify spell resistance
|
|
FloatingTextStringOnCreature("MONTINO: " + GetName(oTarget) + " has spell resistance!", oCaster, TRUE);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// If target is friendly, no SR or saving throw
|
|
// Fire cast spell at event for the specified target
|
|
SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId(), FALSE));
|
|
|
|
// Create an instance of the AOE Object using the Apply Effect function
|
|
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectAreaOfEffect(nAoE), oTarget, fDuration);
|
|
|
|
// Notify success
|
|
FloatingTextStringOnCreature("MONTINO: " + GetName(oTarget) + " is surrounded by silence!", oCaster, TRUE);
|
|
}
|
|
|
|
// Setup Area Of Effect object
|
|
object oAoE = GetAreaOfEffectObject(GetLocation(oTarget), "VFX_MOB_SILENCE");
|
|
SetAllAoEInts(SPELL_SILENCE, oAoE, PRCGetSaveDC(OBJECT_INVALID, oCaster), 0, nCasterLevel);
|
|
}
|
|
else
|
|
{
|
|
// Notify if no valid target
|
|
FloatingTextStringOnCreature("MONTINO: No valid target found", oCaster, TRUE);
|
|
}
|
|
|
|
// Clean up spell school variable
|
|
PRCSetSchool();
|
|
} |