//#include "inc_mod_constant"
#include "inc_misc_tools"
void main()
    {
    object oPC = GetLastRespawnButtonPresser();
    object oLuckBlade = GetItemPossessedBy(oPC,"ssword602");
    object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
    object oToken = GetItemPossessedBy(oPC,"DeathToken");
    if (GetIsObjectValid(oLuckBlade) && GetLocalInt(oLuckBlade,"iUses") > 0)
        {
        SetLocalInt(oLuckBlade,"iUses",GetLocalInt(oLuckBlade,"iUses")-1);
        }
    else
        {
        //Erase Bank Account
        DeleteCampaignVariable(CAMPAIGN,"Bank"+GetName(oPC),oPC); // Clears the PC's bank account.
        //Remove ALL effects
        effect eEffect = GetFirstEffect(oPC);
        while (GetIsEffectValid(eEffect))
            {
            RemoveEffect(oPC,eEffect);
            eEffect = GetNextEffect(oPC);
            }
        // Reset Character to level 1.
        //DestroyObject(oSkin,0.1);
        SetXP(oPC,0);
        }
    SetItemCursedFlag(oToken,FALSE);
    DestroyObject(oToken);
    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
    DelayCommand(0.5,AssignCommand(oPC,ActionJumpToLocation(GetStartingLocation())));
    }
