WizardryEE/Content/spells/latumapic.nss

88 lines
3.3 KiB
Plaintext
Raw Normal View History

//::///////////////////////////////////////////////
//:: Latumapic (Identification)
//:: latumapic.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Identifies a monster group.
Level 3 Priest spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 3 Priest disable spell that targets
a monster group, revealing their true identity.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Identify a monster group
// 1. Get caster information
object oCaster = OBJECT_SELF;
// 2. Get the target monster group
object oTarget = GetSpellTargetObject();
if (!GetIsObjectValid(oTarget))
{
// If no specific target, get the nearest enemy
oTarget = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, oCaster, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
}
// 3. Create the identification effect
effect eVis = EffectVisualEffect(14); // Identification visual effect
// 4. Apply to all monsters in the group
if (GetIsObjectValid(oTarget))
{
// Get the faction/group of the target
object oFaction = GetFactionLeader(oTarget);
// Apply to all members of the faction/group
object oMember = GetFirstFactionMember(oFaction);
while (GetIsObjectValid(oMember))
{
// Only affect enemies
if (GetIsEnemy(oMember, oCaster))
{
// Signal spell cast at event
SignalEvent(oMember, EventSpellCastAt(oCaster, 32, FALSE)); // Identify spell ID
// Apply the visual effect
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oMember);
// Mark as identified
SetLocalInt(oMember, "IDENTIFIED", 1);
// Get monster information
string sName = GetName(oMember);
int nLevel = GetHitDice(oMember);
int nHP = GetCurrentHitPoints(oMember);
int nMaxHP = GetMaxHitPoints(oMember);
// Display monster information to the caster
string sInfo = sName + " (Level " + IntToString(nLevel) + ")\n";
sInfo += "HP: " + IntToString(nHP) + "/" + IntToString(nMaxHP) + "\n";
// Add special abilities or resistances if any
if (GetLocalInt(oMember, "ABILITY_UNDEAD") == 1)
sInfo += "Undead\n";
if (GetLocalInt(oMember, "ABILITY_SPELLCASTER") == 1)
sInfo += "Spellcaster\n";
if (GetLocalInt(oMember, "RESISTANCE_FIRE") == 1)
sInfo += "Fire Resistant\n";
if (GetLocalInt(oMember, "RESISTANCE_COLD") == 1)
sInfo += "Cold Resistant\n";
// Display the information
FloatingTextStringOnCreature(sInfo, oCaster, FALSE);
}
// Get next faction member
oMember = GetNextFactionMember(oFaction);
}
}
}