//:://///////////////////////////////////////////// //:: Lakanito (Suffocation) //:: lakanito.nss //:: Copyright (c) 2025 WizardryEE Project //::////////////////////////////////////////////// /* Kills a monster group. May be resisted at rate of 6% per monster hit point die. Level 6 Mage spell. In Wizardry: Proving Grounds of the Mad Overlord, this is a Level 6 Mage attack spell that targets a monster group. */ //::////////////////////////////////////////////// //:: Created By: WizardryEE Project //:: Created On: April 26, 2025 //::////////////////////////////////////////////// void main() { // Spell implementation for WizardryEE // Core functionality: Kill monster group with HP-based resistance // 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. Check if target is valid and is an enemy if (GetIsObjectValid(oTarget) && GetIsEnemy(oTarget, oCaster)) { // Get the faction/group of the target object oFaction = GetFactionLeader(oTarget); // Create suffocation visual effect at the target location location lTarget = GetLocation(oTarget); effect eSuffocateVis = EffectVisualEffect(47); // Death visual effect ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eSuffocateVis, lTarget); // Apply to all members of the faction/group object oMember = GetFirstFactionMember(oFaction); int nAffected = 0; int nResisted = 0; while (GetIsObjectValid(oMember)) { // Only affect enemies if (GetIsEnemy(oMember, oCaster)) { // Calculate resistance chance based on hit dice int nHitDice = GetHitDice(oMember); int nResistChance = nHitDice * 6; // 6% per hit die // Signal spell cast at event SignalEvent(oMember, EventSpellCastAt(oCaster, 39)); // Death spell ID // Check if monster resists if (Random(100) < nResistChance) { // Monster resisted FloatingTextStringOnCreature(GetName(oMember) + " resisted suffocation!", oCaster, TRUE); nResisted++; } else { // Create the death effect effect eDeath = EffectDeath(); effect eVis = EffectVisualEffect(45); // Death visual effect // Apply the visual and death effects ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oMember); ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oMember); // Notify kill FloatingTextStringOnCreature(GetName(oMember) + " is suffocated!", oCaster, TRUE); nAffected++; } } // Get next faction member oMember = GetNextFactionMember(oFaction); } // Final notification if (nAffected > 0 || nResisted > 0) { string sResult = "LAKANITO: "; if (nAffected > 0) sResult += IntToString(nAffected) + " killed"; if (nAffected > 0 && nResisted > 0) sResult += ", "; if (nResisted > 0) sResult += IntToString(nResisted) + " resisted"; FloatingTextStringOnCreature(sResult, oCaster, TRUE); } else { FloatingTextStringOnCreature("LAKANITO: No enemies affected", oCaster, TRUE); } } else { // Notify if no valid target FloatingTextStringOnCreature("LAKANITO: No valid target found", oCaster, TRUE); } }