Files

1.3 KiB
Raw Permalink Blame History

bariskeser_skills.js — cast_totem() (satır 2009)

← bariskeser_skills.js · ← Master

function cast_totem(c) {
    var p = c.getPlayer(); if (!p) return;
    if (guard(p, "totem")) return;
    var w = c.getWorld(), pos = p.getPosition();
    var tx = pos.x, ty = pos.y, tz = pos.z;
    title(p, "§a§lŞİFA TOTEMİ", "§2dikildi");
    w.playSound("minecraft:block.beacon.activate", tx, ty, tz, 1.5, 1.6);

    var t = 0, DUR = 120;
    function loop(ctx) {
        var ww = ctx.getWorld(), caster = ctx.getPlayer();
        showHead(ww, tx, ty + 0.5, tz, 1.4, 2);
        showHead(ww, tx, ty + 1.7, tz, 1.2, 2);
        fx(ww, "happyVillager", tx, ty + 1, tz, 6, 0.5, 0.8, 0.5, 0.05);
        fx(ww, "heart", tx, ty + 1.5, tz, 2, 0.4, 0.5, 0.4, 0);
        var cp = caster.getPosition();
        if (dist3(cp.x, cp.y, cp.z, tx, ty, tz) < 6 && t % 10 === 0) {
            try { var mx = caster.getMaxHp(), hp = caster.getHp(); if (hp < mx) caster.setHp(Math.min(mx, hp + 2)); } catch (e) {}
            fx(ww, "heart", cp.x, cp.y + 1.2, cp.z, 2, 0.4, 0.5, 0.4, 0);
        }
        t++;
        if (t >= DUR) { fx(ww, "largesmoke", tx, ty + 1, tz, 15, 0.4, 0.6, 0.4, 0.05); return; }
        ctx.scheduleScript(2, loop);
    }
    c.scheduleScript(1, loop);
}