39 lines
1.8 KiB
Markdown
39 lines
1.8 KiB
Markdown
# bariskeser_skills.js — cast_disc() (satır 1787)
|
||
|
||
[← bariskeser_skills.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
Parça 1/2 · [sonraki](cast_disc-2.md)
|
||
|
||
```javascript
|
||
function cast_disc(c) {
|
||
var p = c.getPlayer(); if (!p) return;
|
||
if (guard(p, "disc")) return;
|
||
var w = c.getWorld(), pos = p.getPosition(), eh = p.getEyeHeight(), look = p.getLook();
|
||
title(p, "§e§lYÜZ DİSKİ", "§6sektir!");
|
||
w.playSound("minecraft:entity.arrow.shoot", pos.x, pos.y, pos.z, 1.2, 1.0);
|
||
|
||
var hx = pos.x + look.x * 1.5, hy = pos.y + eh, hz = pos.z + look.z * 1.5;
|
||
var dir = { x: look.x, y: look.y, z: look.z }, bounces = 6, hitids = {}, t = 0;
|
||
function loop(ctx) {
|
||
var ww = ctx.getWorld(), caster = ctx.getPlayer(), sp = 1.6;
|
||
hx += dir.x * sp; hy += dir.y * sp; hz += dir.z * sp;
|
||
showHead(ww, hx, hy, hz, 1.8, 2);
|
||
fx(ww, "crit", hx, hy, hz, 4, 0.1, 0.1, 0.1, 0.05);
|
||
var es = enemies(ww, hx, hy, hz, 2.0, caster);
|
||
for (var i = 0; i < es.length; i++) {
|
||
var e = es[i], id; try { id = e.getUniqueId(); } catch (er) { id = "e" + i; }
|
||
if (hitids[id]) continue;
|
||
hitids[id] = true; hurt(e, 12, caster); bounces--;
|
||
var list = ww.getEntities(hx, hy, hz, 12), best = null, bd = 999;
|
||
for (var k = 0; k < list.size(); k++) {
|
||
var e2 = list.get(k);
|
||
if (e2.isSame(caster) || !e2.isLivingBase()) continue;
|
||
var id2; try { id2 = e2.getUniqueId(); } catch (er2) { id2 = "x" + k; }
|
||
if (hitids[id2]) continue;
|
||
var ep = e2.getPosition(), dd = dist3(hx, hy, hz, ep.x, ep.y + 0.9, ep.z);
|
||
if (dd < bd) { bd = dd; best = e2; }
|
||
}
|
||
if (best) {
|
||
var bp = best.getPosition();
|
||
```
|