2025-04-26 15:20:45 -04:00

94 lines
3.5 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Kandi (Locate Soul)
//:: kandi.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Identifies the location of missing/dead party members
in the dungeon.
Level 5 Priest spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 5 Priest field spell that helps
locate lost party members.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Locate missing/dead party members
// 1. Get caster information
object oCaster = OBJECT_SELF;
// 2. Create the divination effect
effect eVis = EffectVisualEffect(14); // Divination visual effect
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oCaster);
// 3. Get current dungeon level and coordinates
int nCurrentLevel = GetLocalInt(GetArea(oCaster), "DUNGEON_LEVEL");
vector vCurrentPos = GetPosition(oCaster);
// 4. Search for missing party members
object oMember = GetFirstPC();
int nFound = 0;
while (GetIsObjectValid(oMember))
{
// Check if member is dead or missing
if (GetLocalInt(oMember, "CONDITION_DEAD") == 1 ||
GetLocalInt(oMember, "CONDITION_ASHES") == 1 ||
GetLocalInt(oMember, "CONDITION_MISSING") == 1)
{
nFound++;
// Get member's last known location
int nMemberLevel = GetLocalInt(oMember, "LAST_KNOWN_LEVEL");
vector vMemberPos = Vector(
GetLocalFloat(oMember, "LAST_KNOWN_X"),
GetLocalFloat(oMember, "LAST_KNOWN_Y"),
GetLocalFloat(oMember, "LAST_KNOWN_Z")
);
// Calculate relative direction and distance
float fDist = GetDistanceBetweenLocations(
Location(GetArea(oCaster), vCurrentPos, 0.0),
Location(GetArea(oCaster), vMemberPos, 0.0)
);
string sDirection = "";
if (vMemberPos.x > vCurrentPos.x) sDirection += "east";
else if (vMemberPos.x < vCurrentPos.x) sDirection += "west";
if (vMemberPos.y > vCurrentPos.y) sDirection += "north";
else if (vMemberPos.y < vCurrentPos.y) sDirection += "south";
// Build location description
string sStatus = GetLocalInt(oMember, "CONDITION_DEAD") == 1 ? "dead" :
GetLocalInt(oMember, "CONDITION_ASHES") == 1 ? "ashes" : "missing";
string sLocation = GetName(oMember) + " (" + sStatus + ") is ";
if (nMemberLevel != nCurrentLevel)
{
sLocation += IntToString(abs(nMemberLevel - nCurrentLevel)) + " level";
sLocation += nMemberLevel > nCurrentLevel ? " below" : " above";
sLocation += ", ";
}
sLocation += IntToString(FloatToInt(fDist)) + " steps " + sDirection;
// Display the location information
FloatingTextStringOnCreature(sLocation, oCaster, FALSE);
}
oMember = GetNextPC();
}
// 5. Notify if no one was found
if (nFound == 0)
{
FloatingTextStringOnCreature("KANDI: No missing or dead party members found", oCaster, TRUE);
}
}