91 lines
3.2 KiB
Plaintext
91 lines
3.2 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Di (Life)
|
|
//:: di.nss
|
|
//:: Copyright (c) 2025 WizardryEE Project
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Attempts to resurrect a dead party member.
|
|
If successful, the dead character is revived with
|
|
only 1 hit point and decreased Vitality.
|
|
If failed, the dead character is turned to ashes.
|
|
Level 5 Priest spell.
|
|
|
|
In Wizardry: Proving Grounds of the Mad Overlord,
|
|
this is a Level 5 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("DI: No target selected", oCaster, TRUE);
|
|
return;
|
|
}
|
|
|
|
// 3. Check if target is dead
|
|
int bIsDead = GetLocalInt(oTarget, "CONDITION_DEAD");
|
|
int bIsAshes = GetLocalInt(oTarget, "CONDITION_ASHES");
|
|
|
|
if (!bIsDead || bIsAshes)
|
|
{
|
|
// Notify if target is not dead or is already ashes
|
|
FloatingTextStringOnCreature("DI: Target must be dead but not ashes", oCaster, TRUE);
|
|
return;
|
|
}
|
|
|
|
// 4. Calculate resurrection chance based on caster level
|
|
int nCasterLevel = GetLevelByClass(CLASS_TYPE_CLERIC, oCaster);
|
|
if (nCasterLevel < 1) nCasterLevel = 5; // Minimum level 5 for this spell
|
|
int nChance = 50 + (nCasterLevel * 5); // Base 50% + 5% per level
|
|
|
|
// 5. Create the resurrection effects
|
|
effect eVis = EffectVisualEffect(14); // Resurrection visual effect
|
|
effect eHeal = EffectHeal(1); // Heal 1 HP
|
|
|
|
// 6. Attempt resurrection
|
|
if (Random(100) < nChance)
|
|
{
|
|
// Success
|
|
// Remove dead condition
|
|
DeleteLocalInt(oTarget, "CONDITION_DEAD");
|
|
|
|
// Apply resurrection effects
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
|
|
|
|
// Decrease Vitality
|
|
int nVitality = GetLocalInt(oTarget, "STAT_VITALITY");
|
|
SetLocalInt(oTarget, "STAT_VITALITY", nVitality - 1);
|
|
|
|
// Notify success
|
|
FloatingTextStringOnCreature("DI: " + GetName(oTarget) + " has been resurrected!", oCaster, TRUE);
|
|
FloatingTextStringOnCreature("Vitality decreased by 1", oTarget, TRUE);
|
|
}
|
|
else
|
|
{
|
|
// Failure - Turn to ashes
|
|
DeleteLocalInt(oTarget, "CONDITION_DEAD");
|
|
SetLocalInt(oTarget, "CONDITION_ASHES", 1);
|
|
|
|
// Apply visual effect for failure
|
|
effect eFailVis = EffectVisualEffect(45); // Death/Decay visual effect
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eFailVis, oTarget);
|
|
|
|
// Notify failure
|
|
FloatingTextStringOnCreature("DI: " + GetName(oTarget) + " has been turned to ashes!", oCaster, TRUE);
|
|
}
|
|
} |