41 lines
1.8 KiB
Markdown
41 lines
1.8 KiB
Markdown
# bariskeser_skills.js — cast_guardians() (satır 1109)
|
||
|
||
[← bariskeser_skills.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function cast_guardians(c) {
|
||
var p = c.getPlayer(); if (!p) return;
|
||
if (guard(p, "guardians")) return;
|
||
var st = p.getStates(), nid = st.getNumber("bk_guard_id") + 1;
|
||
st.setNumber("bk_guard_id", nid);
|
||
var pos = p.getPosition();
|
||
title(p, "§b§lKORUYUCU AVATARLAR", "§3savunma");
|
||
c.getWorld().playSound("minecraft:block.beacon.activate", pos.x, pos.y, pos.z, 1.5, 1.5);
|
||
|
||
var t = 0, DUR = 140, gid = nid, COUNT = 4, gen0 = bkGen(p);
|
||
function loop(ctx) {
|
||
var pl = ctx.getPlayer(); if (!pl) return;
|
||
if (pl.getStates().getNumber("bk_guard_id") !== gid) return;
|
||
if (pl.getStates().getNumber("bk_gen") !== gen0) return;
|
||
if (t >= DUR) return;
|
||
var po = pl.getPosition(), ww = ctx.getWorld();
|
||
var cy = po.y + 0.2, rr = 2.2, aa = t * 0.18;
|
||
for (var g = 0; g < COUNT; g++) {
|
||
var ga = aa + (g / COUNT) * Math.PI * 2;
|
||
var gx = po.x + Math.cos(ga) * rr, gz = po.z + Math.sin(ga) * rr;
|
||
showAvatar(ww, gx, cy, gz, yawTo(po.x - gx, po.z - gz) + 180, 2);
|
||
fx(ww, "endRod", gx, cy + 1, gz, 2, 0.05, 0.05, 0.05, 0.01);
|
||
var es = enemies(ww, gx, cy + 1, gz, 2.2, pl);
|
||
for (var i = 0; i < es.length; i++) {
|
||
hurt(es[i], 5, pl);
|
||
var ep = es[i].getPosition();
|
||
es[i].addMotion((ep.x - po.x) * 0.12, 0.15, (ep.z - po.z) * 0.12);
|
||
}
|
||
}
|
||
if (t % 20 === 0) ww.playSound("minecraft:block.beacon.ambient", po.x, po.y, po.z, 0.5, 1.6);
|
||
t++; ctx.scheduleScript(2, loop);
|
||
}
|
||
c.scheduleScript(1, loop);
|
||
}
|
||
```
|