WizardryEE/Content/spells/loktofeit.nss
2025-04-26 15:20:45 -04:00

70 lines
2.2 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Loktofeit (Recall)
//:: loktofeit.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Causes all party members to be transported back to
town, minus all of their equipment and most of
their gold.
Level 6 Priest spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 6 Priest field spell that affects
the entire party.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Transport party to town
// 1. Get caster information
object oCaster = OBJECT_SELF;
// 2. Create the teleport effect
effect eVis = EffectVisualEffect(46); // Teleport visual effect
// 3. Process each party member
object oMember = GetFirstPC();
while (GetIsObjectValid(oMember))
{
// Apply visual effect before teleport
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oMember);
// Remove equipment
object oItem = GetFirstItemInInventory(oMember);
while (GetIsObjectValid(oItem))
{
// Remove the item
DestroyObject(oItem);
oItem = GetNextItemInInventory(oMember);
}
// Remove most gold (leave 10%)
int nGold = GetGold(oMember);
int nGoldToKeep = nGold / 10; // Keep 10%
TakeGoldFromCreature(nGold, oMember, TRUE);
GiveGoldToCreature(oMember, nGoldToKeep);
// Set location to town
location lTown = GetLocation(GetWaypointByTag("WP_TOWN_ENTRANCE"));
// Teleport to town
AssignCommand(oMember, JumpToLocation(lTown));
// Notify the player
string sLostGold = IntToString(nGold - nGoldToKeep);
FloatingTextStringOnCreature("Lost " + sLostGold + " gold and all equipment!", oMember, TRUE);
// Get next party member
oMember = GetNextPC();
}
// Final notification
FloatingTextStringOnCreature("LOKTOFEIT: Party recalled to town!", oCaster, TRUE);
}