//:://///////////////////////////////////////////// //:: Calfo (X-ray Vision) //:: calfo.nss //:: Copyright (c) 2025 WizardryEE Project //::////////////////////////////////////////////// /* Determines the type of trap on a chest with 95% accuracy. Level 2 Priest spell. In Wizardry: Proving Grounds of the Mad Overlord, this is a Level 2 Priest field spell that targets the caster, allowing them to identify traps. */ //::////////////////////////////////////////////// //:: Created By: WizardryEE Project //:: Created On: April 26, 2025 //::////////////////////////////////////////////// void main() { // Spell implementation for WizardryEE // Core functionality: Identify traps on chests // 1. Get caster information object oCaster = OBJECT_SELF; // 2. Calculate duration (based on caster level) int nCasterLevel = GetLevelByClass(CLASS_TYPE_CLERIC, oCaster); if (nCasterLevel < 1) nCasterLevel = 2; // Minimum level 2 for this spell float fDuration = TurnsToSeconds(nCasterLevel); // Lasts for turns equal to caster level // 3. Create the trap detection effect effect eVis = EffectVisualEffect(VFX_IMP_MAGICAL_VISION); effect eDur = EffectVisualEffect(VFX_DUR_MAGICAL_SIGHT); // 4. Apply to the caster ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oCaster); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, oCaster, fDuration); // 5. Identify traps in the area object oArea = GetArea(oCaster); object oChest = GetFirstObjectInArea(oArea); while (GetIsObjectValid(oChest)) { // If the object is a chest/container if (GetObjectType(oChest) == OBJECT_TYPE_PLACEABLE && GetStringLeft(GetResRef(oChest), 5) == "chest") { // Check if it's trapped if (GetTrapDetectedBy(oChest, oCaster) || GetIsTrapped(oChest)) { // 95% chance to correctly identify if (Random(100) < 95) { // Determine trap type based on local variables or tags string sTrapName = "Unknown Trap"; // Example trap detection logic - would be customized for actual implementation if (GetLocalInt(oChest, "TRAP_POISON") == 1) sTrapName = "Poison Needle"; else if (GetLocalInt(oChest, "TRAP_FIRE") == 1) sTrapName = "Fire Trap"; else if (GetLocalInt(oChest, "TRAP_ACID") == 1) sTrapName = "Acid Trap"; else if (GetLocalInt(oChest, "TRAP_SHOCK") == 1) sTrapName = "Shock Trap"; else if (GetLocalInt(oChest, "TRAP_GAS") == 1) sTrapName = "Gas Trap"; else if (GetLocalInt(oChest, "TRAP_EXPLOSIVE") == 1) sTrapName = "Explosive Runes"; else if (GetLocalInt(oChest, "TRAP_ALARM") == 1) sTrapName = "Alarm"; // Notify the caster FloatingTextStringOnCreature("Trap Detected: " + sTrapName, oCaster, TRUE); // Mark as detected SetTrapDetectedBy(oChest, oCaster); } else { // 5% chance to misidentify FloatingTextStringOnCreature("Trap Detection Failed", oCaster, TRUE); } } } oChest = GetNextObjectInArea(oArea); } }