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

106 lines
3.6 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Dumapic (Clarity)
//:: dumapic.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Identifies the location of the party in the dungeon.
Level 1 Mage spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 1 Mage field spell that helps
with dungeon navigation.
*/
//:://////////////////////////////////////////////
//:: 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: Show party location and increase Lore skill
// Spellcast Hook Code
if (!X2PreSpellCastCode()) return;
// Set spell school for proper record keeping
PRCSetSchool(SPELL_SCHOOL_DIVINATION);
// Declare major variables
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
int nMetaMagic = PRCGetMetaMagicFeat();
// Calculate skill bonus and duration
int nBonus = 10 + nCasterLevel;
int nDuration = 2; // 2 rounds
// Check for Extend Spell metamagic
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
{
nDuration = 4; // Duration is +100%
}
// Create the lore skill increase effect
effect eLore = EffectSkillIncrease(SKILL_LORE, nBonus);
effect eVis = EffectVisualEffect(VFX_IMP_MAGICAL_VISION);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
// Link the effects
effect eLink = EffectLinkEffects(eLore, eDur);
// Make sure the spell has not already been applied
if (!GetHasSpellEffect(SPELL_IDENTIFY, oCaster) && !GetHasSpellEffect(SPELL_LEGEND_LORE, oCaster))
{
// Signal spell cast at event
SignalEvent(oCaster, EventSpellCastAt(oCaster, GetSpellId(), FALSE));
// Apply the effects
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oCaster, RoundsToSeconds(nDuration), TRUE, -1, nCasterLevel);
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oCaster);
}
// Get current dungeon information
object oArea = GetArea(oCaster);
int nLevel = GetLocalInt(oArea, "DUNGEON_LEVEL");
vector vPos = GetPosition(oCaster);
// Convert position to grid coordinates (assuming 10-foot squares)
int nGridX = FloatToInt(vPos.x / 10.0);
int nGridY = FloatToInt(vPos.y / 10.0);
// Get facing direction
float fFacing = GetFacing(oCaster);
string sFacing = "";
// Convert facing angle to cardinal direction
if (fFacing >= 315.0 || fFacing < 45.0) sFacing = "North";
else if (fFacing >= 45.0 && fFacing < 135.0) sFacing = "East";
else if (fFacing >= 135.0 && fFacing < 225.0) sFacing = "South";
else sFacing = "West";
// Build location description
string sLocation = "DUMAPIC: Location Information\n";
sLocation += "Level: " + IntToString(nLevel) + "\n";
sLocation += "Position: " + IntToString(nGridX) + " East, " +
IntToString(nGridY) + " North\n";
sLocation += "Facing: " + sFacing;
// Check for special areas
if (GetLocalInt(oArea, "IS_DARKNESS_ZONE"))
sLocation += "\nIn Darkness Zone";
if (GetLocalInt(oArea, "IS_ANTIMAGIC_ZONE"))
sLocation += "\nIn Anti-Magic Zone";
if (GetLocalInt(oArea, "IS_TRAP_ZONE"))
sLocation += "\nDanger: Trap Zone";
// Display the location information
FloatingTextStringOnCreature(sLocation, oCaster, FALSE);
// Clean up spell school variable
PRCSetSchool();
}