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

109 lines
3.6 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Kalki (Blessings)
//:: kalki.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Reduces the armor class of all party members by 1
for the duration of the combat.
Level 1 Priest spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 1 Priest support spell that targets
the entire party.
*/
//:://////////////////////////////////////////////
//:: 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: Improve AC and attack rolls for all party members
// Spellcast Hook Code
if (!X2PreSpellCastCode()) return;
// Set spell school for proper record keeping
PRCSetSchool(SPELL_SCHOOL_ENCHANTMENT);
// Declare major variables
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nMetaMagic = PRCGetMetaMagicFeat();
// Calculate duration (based on caster level)
float fDuration = TurnsToSeconds(nCasterLevel); // 1 turn per level
// Check for Extend Spell metamagic
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
{
fDuration *= 2; // Duration is +100%
}
// Create visual effects
effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HOLY);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
// Create the blessing effects
effect eAC = EffectACIncrease(1, AC_DEFLECTION_BONUS); // Improve AC by 1
effect eAttack = EffectAttackIncrease(1); // +1 to attack rolls
effect eSave = EffectSavingThrowIncrease(SAVING_THROW_ALL, 1, SAVING_THROW_TYPE_FEAR); // +1 to saves vs fear
// Link the effects
effect eLink = EffectLinkEffects(eAC, eAttack);
eLink = EffectLinkEffects(eLink, eSave);
eLink = EffectLinkEffects(eLink, eDur);
// Apply the area effect
location lCaster = GetLocation(oCaster);
float fRange = FeetToMeters(50.0);
// Apply visual effect at caster location
effect eImpact = EffectVisualEffect(VFX_FNF_LOS_HOLY_30);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, lCaster);
// Get the first target in the radius around the caster
object oTarget = MyFirstObjectInShape(SHAPE_SPHERE, fRange, lCaster);
int nAffected = 0;
while (GetIsObjectValid(oTarget))
{
// Only affect friendly targets
if (GetIsReactionTypeFriendly(oTarget) || GetFactionEqual(oTarget))
{
// Fire spell cast at event for target
SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId(), FALSE));
// Apply random delay for visual effect
float fDelay = PRCGetRandomDelay(0.4, 1.1);
// Apply the effects
DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, fDuration, TRUE, GetSpellId(), nCasterLevel));
DelayCommand(fDelay, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
// Increment affected count
nAffected++;
}
// Get the next target in the specified area around the caster
oTarget = MyNextObjectInShape(SHAPE_SPHERE, fRange, lCaster);
}
// Notify the caster
if (nAffected > 0)
{
FloatingTextStringOnCreature("KALKI: Blessed " + IntToString(nAffected) + " allies!", oCaster, TRUE);
}
else
{
FloatingTextStringOnCreature("KALKI: No allies affected", oCaster, TRUE);
}
// Clean up spell school variable
PRCSetSchool();
}