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

68 lines
2.1 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Mogref (Body Iron)
//:: mogref.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Reduces the armor class of the caster by 2
for the duration of the combat.
Level 1 Mage spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 1 Mage support spell that targets
the caster.
*/
//:://////////////////////////////////////////////
//:: 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 caster's AC by 2
// Spellcast Hook Code
if (!X2PreSpellCastCode()) return;
// Set spell school for proper record keeping
PRCSetSchool(SPELL_SCHOOL_TRANSMUTATION);
// Declare major variables
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nMetaMagic = PRCGetMetaMagicFeat();
// Calculate duration (rounds equal to caster level)
int nDuration = nCasterLevel;
// Apply metamagic
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
{
nDuration *= 2; // Duration is +100%
}
// Create the AC improvement effect (lower AC is better in D&D)
effect eAC = EffectACIncrease(2, AC_NATURAL_BONUS);
effect eVis = EffectVisualEffect(VFX_IMP_AC_BONUS);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
// Link the effects
effect eLink = EffectLinkEffects(eAC, eDur);
// Signal spell cast at event
SignalEvent(oCaster, EventSpellCastAt(oCaster, GetSpellId(), FALSE));
// Apply the effects
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oCaster);
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oCaster, RoundsToSeconds(nDuration), TRUE, -1, nCasterLevel);
// Notify the caster
FloatingTextStringOnCreature("MOGREF: AC improved by 2 for " + IntToString(nDuration) + " rounds", oCaster, TRUE);
// Clean up spell school variable
PRCSetSchool();
}