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

109 lines
3.8 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Lomilwa (More Light)
//:: lomilwa.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
More powerful MILWA spell that lasts for the entire
expedition, but is terminated in darkness areas.
Level 3 Priest spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 3 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 stronger light and reveal secret doors with enhanced 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 < 3) nCasterLevel = 3; // Minimum level 3 for this spell
// Duration is fixed at 24 hours (entire expedition)
float fDuration = HoursToSeconds(24);
// Check for Extend Spell metamagic
int nMetaMagic = PRCGetMetaMagicFeat();
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
{
fDuration *= 2; // Duration is +100%
}
// 3. Create the light effect and enhanced Search skill bonus
// Using a stronger light effect (similar to daylight spell)
effect eLight = EffectVisualEffect(VFX_DUR_LIGHT_WHITE_20); // Stronger light visual effect
effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HOLY); // Cast visual effect
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
// Add enhanced Search skill bonus (better than MILWA)
effect eSearch = EffectSkillIncrease(SKILL_SEARCH, 20);
// Link the effects
effect eLink = EffectLinkEffects(eLight, eSearch);
eLink = EffectLinkEffects(eLink, eDur);
// 4. Remove any existing light effects from the MILWA spell
if (GetLocalInt(oTarget, "MILWA_ACTIVE") == 1)
{
// Remove the MILWA effect by applying a new effect
// The game engine will handle removing the previous effect
DeleteLocalInt(oTarget, "MILWA_ACTIVE");
// Remove existing effects from MILWA
RemoveEffectsFromSpell(oTarget, SPELL_LIGHT);
}
// 5. Apply to the target (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);
// 6. Set the LOMILWA flag
SetLocalInt(oTarget, "LOMILWA_ACTIVE", 1);
// 7. Reveal secret doors in the area with enhanced effect
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 (stronger than MILWA)
location lDoor = GetLocation(oDoor);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_DISPEL_GREATER), lDoor);
}
oDoor = GetNextObjectInArea(oArea);
}
// 8. Notify the caster
FloatingTextStringOnCreature("LOMILWA: Enhanced light spell active for 24 hours!", oTarget, TRUE);
// Clean up spell school variable
PRCSetSchool();
}