33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
# Hector_Tudors.js — cast_totem() (satır 1999)
|
||
|
||
[← Hector_Tudors.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
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);
|
||
}
|
||
```
|