WizardryEE/Content/spells/kadorto.nss

102 lines
3.6 KiB
Plaintext
Raw Normal View History

//::///////////////////////////////////////////////
//:: Kadorto (Resurrection)
//:: kadorto.nss
//:: Copyright (c) 2025 WizardryEE Project
//:://////////////////////////////////////////////
/*
Attempts to resurrect a dead party member, even if
they've been turned to ashes. If successful, they
are revived with all hit points. If failed, they
are permanently lost.
Level 7 Priest spell.
In Wizardry: Proving Grounds of the Mad Overlord,
this is a Level 7 Priest healing/field spell that
targets one character.
*/
//:://////////////////////////////////////////////
//:: Created By: WizardryEE Project
//:: Created On: April 26, 2025
//:://////////////////////////////////////////////
void main()
{
// Spell implementation for WizardryEE
// Core functionality: Attempt to resurrect a dead character
// 1. Get caster information
object oCaster = OBJECT_SELF;
// 2. Get the target
object oTarget = GetSpellTargetObject();
if (!GetIsObjectValid(oTarget))
{
// Notify if no target selected
FloatingTextStringOnCreature("KADORTO: No target selected", oCaster, TRUE);
return;
}
// 3. Check if target is dead or ashes
int bIsDead = GetLocalInt(oTarget, "CONDITION_DEAD");
int bIsAshes = GetLocalInt(oTarget, "CONDITION_ASHES");
if (!bIsDead && !bIsAshes)
{
// Notify if target is not dead
FloatingTextStringOnCreature("KADORTO: Target must be dead or ashes", oCaster, TRUE);
return;
}
// 4. Calculate resurrection chance based on caster level
int nCasterLevel = GetLevelByClass(CLASS_TYPE_CLERIC, oCaster);
if (nCasterLevel < 1) nCasterLevel = 7; // Minimum level 7 for this spell
int nChance = 60 + (nCasterLevel * 5); // Base 60% + 5% per level
// Reduce chance if target is ashes
if (bIsAshes)
{
nChance -= 20; // 20% penalty for ashes
}
// 5. Create the resurrection effects
effect eVis = EffectVisualEffect(14); // Resurrection visual effect
effect eHeal = EffectHeal(GetMaxHitPoints(oTarget)); // Full heal
// 6. Attempt resurrection
if (Random(100) < nChance)
{
// Success
// Remove dead/ashes condition
DeleteLocalInt(oTarget, "CONDITION_DEAD");
DeleteLocalInt(oTarget, "CONDITION_ASHES");
// Remove all negative conditions
DeleteLocalInt(oTarget, "CONDITION_PARALYZED");
DeleteLocalInt(oTarget, "CONDITION_POISONED");
DeleteLocalInt(oTarget, "CONDITION_SLEEPING");
DeleteLocalInt(oTarget, "CONDITION_SILENCED");
DeleteLocalInt(oTarget, "CONDITION_BLINDED");
DeleteLocalInt(oTarget, "CONDITION_CONFUSED");
DeleteLocalInt(oTarget, "CONDITION_DISEASED");
// Apply resurrection effects
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
// Notify success
FloatingTextStringOnCreature("KADORTO: " + GetName(oTarget) + " has been resurrected!", oCaster, TRUE);
}
else
{
// Failure - Character is permanently lost
// Apply visual effect for failure
effect eFailVis = EffectVisualEffect(45); // Death/Decay visual effect
ApplyEffectToObject(DURATION_TYPE_INSTANT, eFailVis, oTarget);
// Mark as permanently lost
SetLocalInt(oTarget, "PERMANENTLY_LOST", 1);
// Notify failure
FloatingTextStringOnCreature("KADORTO: " + GetName(oTarget) + " has been permanently lost!", oCaster, TRUE);
}
}