Files
MAPPET-ULTIMATE-WIKI/scripts/Ae/transparentOwnerMorphNbt-10.md

1.9 KiB
Raw Permalink Blame History

Ae.js — transparentOwnerMorphNbt() (satır 808)

← Ae.js · ← Master

Parça 10/38 · önceki · sonraki

    try { damage = c.getValue("damage"); } catch (e1) {}

    if (damage !== null && damage !== undefined)
    {
        safeCancel(c);
        if (isOwner(subject)) protectOwner(c, subject, state);
        else protectAlly(c, subject, state);
        saveState(state);
        return true;
    }

    var eventHint = false;
    try
    {
        eventHint = c.getValue("potion") != null || c.getValue("effect") != null;
    }
    catch (e2) {}

    if (eventHint)
    {
        safeCancel(c);
        if (isOwner(subject)) protectOwner(c, subject, state);
        else protectAlly(c, subject, state);
        saveState(state);
        return true;
    }

    return false;
}

function forceOwnerProtectionEvent(c)
{
    var state = loadState();
    if (!state.active) return false;

    var subject = getPlayer(c);
    if (!subject || !subject.getName || !isProtectedSideName(subject.getName(), state)) return false;

    safeCancel(c);
    if (isOwner(subject)) protectOwner(c, subject, state);
    else protectAlly(c, subject, state);
    saveState(state);
    return true;
}

function handleProtectedMorphEvent(c)
{
    var state = loadState();
    if (!state.active && !state.ownerVanished) return false;

    var subject = getPlayer(c);
    if (!subject || !subject.getName || !isProtectedSideName(subject.getName(), state)) return false;

    if (isOwner(subject)) return handleOwnerMorphEvent(c, subject, state);

    if (!state.active) return false;

    safeCancel(c);
    protectAlly(c, subject, state);
    saveState(state);
    return true;
}

function handleTargetRestrictionEvent(c)
{
    var state = loadState();
    if (!state.active) return false;