99 lines
3.3 KiB
Plaintext
99 lines
3.3 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Milwa (Light)
|
|
//:: milwa.nss
|
|
//:: Copyright (c) 2025 WizardryEE Project
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Summons a softly glowing light that increases vision
|
|
and reveals secret doors.
|
|
Level 1 Priest spell.
|
|
|
|
In Wizardry: Proving Grounds of the Mad Overlord,
|
|
this is a Level 1 Priest field/support spell that
|
|
targets the 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: Create light and reveal secret doors with Search bonus
|
|
|
|
// Spellcast Hook Code
|
|
if (!X2PreSpellCastCode()) return;
|
|
|
|
// Set spell school for proper record keeping
|
|
PRCSetSchool(SPELL_SCHOOL_EVOCATION);
|
|
|
|
// 1. Get caster and target information
|
|
object oCaster = OBJECT_SELF;
|
|
object oTarget = PRCGetSpellTargetObject();
|
|
|
|
// 2. Calculate duration (based on caster level)
|
|
int nCasterLevel = PRCGetCasterLevel(oCaster);
|
|
if (nCasterLevel < 1) nCasterLevel = 1;
|
|
|
|
// Duration is hours equal to caster level
|
|
float fDuration = HoursToSeconds(nCasterLevel);
|
|
|
|
// Check for Extend Spell metamagic
|
|
int nMetaMagic = PRCGetMetaMagicFeat();
|
|
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
|
|
{
|
|
fDuration *= 2; // Duration is +100%
|
|
}
|
|
|
|
// 3. Create the light effect and Search skill bonus
|
|
effect eLight = EffectVisualEffect(VFX_DUR_LIGHT_WHITE_20);
|
|
effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HOLY);
|
|
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
|
|
|
|
// Add Search skill bonus (similar to extrathf.nss but only for Search)
|
|
effect eSearch = EffectSkillIncrease(SKILL_SEARCH, 10);
|
|
|
|
// Link the effects
|
|
effect eLink = EffectLinkEffects(eLight, eSearch);
|
|
eLink = EffectLinkEffects(eLink, eDur);
|
|
|
|
// 4. Apply to the caster (light follows the party)
|
|
SignalEvent(oTarget, EventSpellCastAt(oCaster, GetSpellId(), FALSE));
|
|
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
|
|
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, fDuration, TRUE, -1, nCasterLevel);
|
|
|
|
// 5. Reveal secret doors in the area
|
|
// This would typically involve a search check or revealing
|
|
// hidden objects in the area around the party
|
|
object oArea = GetArea(oTarget);
|
|
object oDoor = GetFirstObjectInArea(oArea);
|
|
|
|
while (GetIsObjectValid(oDoor))
|
|
{
|
|
// If the object is a secret door
|
|
if (GetObjectType(oDoor) == OBJECT_TYPE_DOOR && GetLocalInt(oDoor, "SECRET_DOOR"))
|
|
{
|
|
// Make it visible/discoverable
|
|
SetLocalInt(oDoor, "REVEALED", TRUE);
|
|
|
|
// Visual effect at door location
|
|
location lDoor = GetLocation(oDoor);
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_DISPEL), lDoor);
|
|
}
|
|
|
|
oDoor = GetNextObjectInArea(oArea);
|
|
}
|
|
|
|
// Set flag to indicate MILWA is active
|
|
SetLocalInt(oTarget, "MILWA_ACTIVE", 1);
|
|
|
|
// Notify the caster
|
|
FloatingTextStringOnCreature("MILWA: Light spell active!", oTarget, TRUE);
|
|
|
|
// Clean up spell school variable
|
|
PRCSetSchool();
|
|
} |