121 lines
3.9 KiB
Plaintext
121 lines
3.9 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Bamatu (Prayer)
|
|
//:: bamatu.nss
|
|
//:: Copyright (c) 2025 WizardryEE Project
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Reduces the armor class of all party members by 4
|
|
for the duration of the combat.
|
|
Level 3 Priest spell.
|
|
|
|
In Wizardry: Proving Grounds of the Mad Overlord,
|
|
this is a Level 3 Priest support spell that targets
|
|
the entire party.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: WizardryEE Project
|
|
//:: Created On: April 26, 2025
|
|
//:://////////////////////////////////////////////
|
|
|
|
#include "prc_inc_spells"
|
|
#include "prc_sp_func"
|
|
|
|
void main()
|
|
{
|
|
// Spell implementation for WizardryEE
|
|
// Core functionality: Haste effect for all party members
|
|
|
|
// 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();
|
|
|
|
// Ensure minimum caster level
|
|
if (nCasterLevel < 3) nCasterLevel = 3; // Minimum level 3 for this spell
|
|
|
|
// Calculate duration (based on caster level)
|
|
int nDuration = nCasterLevel;
|
|
float fDuration = RoundsToSeconds(nDuration);
|
|
|
|
// Check for Extend Spell metamagic
|
|
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
|
|
{
|
|
fDuration *= 2; // Duration is +100%
|
|
}
|
|
|
|
// Create the haste effect
|
|
effect eHaste = EffectHaste();
|
|
effect eVis = EffectVisualEffect(VFX_IMP_HASTE);
|
|
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
|
|
effect eLink = EffectLinkEffects(eHaste, 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))
|
|
{
|
|
// Remove any existing haste or similar effects
|
|
if (GetHasSpellEffect(SPELL_EXPEDITIOUS_RETREAT, oTarget))
|
|
{
|
|
PRCRemoveSpellEffects(SPELL_EXPEDITIOUS_RETREAT, oCaster, oTarget);
|
|
}
|
|
|
|
if (GetHasSpellEffect(SPELL_HASTE, oTarget))
|
|
{
|
|
PRCRemoveSpellEffects(SPELL_HASTE, oCaster, oTarget);
|
|
}
|
|
|
|
if (GetHasSpellEffect(SPELL_MASS_HASTE, oTarget))
|
|
{
|
|
PRCRemoveSpellEffects(SPELL_MASS_HASTE, oCaster, 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("BAMATU: Hasted " + IntToString(nAffected) + " allies for " + IntToString(nDuration) + " rounds!", oCaster, TRUE);
|
|
}
|
|
else
|
|
{
|
|
FloatingTextStringOnCreature("BAMATU: No allies affected", oCaster, TRUE);
|
|
}
|
|
|
|
// Clean up spell school variable
|
|
PRCSetSchool();
|
|
} |