97 lines
3.1 KiB
Plaintext
97 lines
3.1 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Maporfic (Big Shield)
|
|
//:: maporfic.nss
|
|
//:: Copyright (c) 2025 WizardryEE Project
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Reduces the armor class of all party members by 2
|
|
for the entire expedition.
|
|
Level 4 Priest spell.
|
|
|
|
In Wizardry: Proving Grounds of the Mad Overlord,
|
|
this is a Level 4 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: Reduce AC of all party members by 2 for the entire expedition
|
|
|
|
// Spellcast Hook Code
|
|
if (!X2PreSpellCastCode()) return;
|
|
|
|
// Set spell school for proper record keeping
|
|
PRCSetSchool(SPELL_SCHOOL_ABJURATION);
|
|
|
|
// Declare major variables
|
|
object oCaster = OBJECT_SELF;
|
|
int nCasterLevel = PRCGetCasterLevel(oCaster);
|
|
int nMetaMagic = PRCGetMetaMagicFeat();
|
|
|
|
// Calculate duration (fixed at 24 hours for expedition)
|
|
int nDuration = 24; // 24 hours
|
|
|
|
// Create the AC improvement effect (lower AC is better in D&D)
|
|
effect eAC = EffectACIncrease(2, AC_SHIELD_ENCHANTMENT_BONUS);
|
|
effect eVis = EffectVisualEffect(VFX_IMP_AC_BONUS);
|
|
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
|
|
|
|
// Link the effects
|
|
effect eLink = EffectLinkEffects(eAC, eDur);
|
|
|
|
// Get the first party member
|
|
object oPartyMember = GetFirstFactionMember(oCaster, TRUE);
|
|
int nAffected = 0;
|
|
|
|
// Apply to all party members
|
|
while (GetIsObjectValid(oPartyMember))
|
|
{
|
|
// Remove any existing PORFIC effects
|
|
if (GetLocalInt(oPartyMember, "PORFIC_ACTIVE") == 1)
|
|
{
|
|
// Remove the effect using the PRC framework
|
|
PRCRemoveEffectsFromSpell(oPartyMember, SPELL_MAGE_ARMOR);
|
|
DeleteLocalInt(oPartyMember, "PORFIC_ACTIVE");
|
|
}
|
|
|
|
// Signal spell cast at event
|
|
SignalEvent(oPartyMember, EventSpellCastAt(oCaster, GetSpellId(), FALSE));
|
|
|
|
// Apply the effects
|
|
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPartyMember);
|
|
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPartyMember, HoursToSeconds(nDuration), TRUE, -1, nCasterLevel);
|
|
|
|
// Set the MAPORFIC flag
|
|
SetLocalInt(oPartyMember, "MAPORFIC_ACTIVE", 1);
|
|
|
|
// Notify the target
|
|
FloatingTextStringOnCreature("MAPORFIC: AC improved by 2 for 24 hours", oPartyMember, TRUE);
|
|
|
|
// Increment affected count
|
|
nAffected++;
|
|
|
|
// Get next party member
|
|
oPartyMember = GetNextFactionMember(oCaster, TRUE);
|
|
}
|
|
|
|
// Final notification
|
|
if (nAffected > 0)
|
|
{
|
|
FloatingTextStringOnCreature("MAPORFIC: Protected " + IntToString(nAffected) + " party members!", oCaster, TRUE);
|
|
}
|
|
else
|
|
{
|
|
FloatingTextStringOnCreature("MAPORFIC: No party members affected", oCaster, TRUE);
|
|
}
|
|
|
|
// Clean up spell school variable
|
|
PRCSetSchool();
|
|
} |