Files

50 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Jade.js — runShockwave() (satır 381)
[← Jade.js](index.md) · [← Master](../../wiki.md)
```javascript
function runShockwave(c) {
var world = c.getWorld();
var radius = c.getValue("shockwaveRadius");
var cx = c.getValue("hitCx");
var cy = c.getValue("hitCy");
var cz = c.getValue("hitCz");
if (radius === null || cx === null || cy === null || cz === null) {
return;
}
var maxRadius = SPELL_CONFIG.CRATER_RADIUS + 5.0;
if (radius > maxRadius) {
return;
}
var p1 = SPELL_CONFIG.PARTOKE_EXPLODE_1; // Note: Original script has a typo here or uses config
var p2 = SPELL_CONFIG.PARTICLE_EXPLODE_3;
// Use SPELL_CONFIG.PARTICLE_EXPLODE_1 instead of p1 to avoid potential runtime reference error if misspelled in older contexts
p1 = SPELL_CONFIG.PARTICLE_EXPLODE_1;
var count = Math.floor(radius * 5.5);
if (count > 200) count = 200;
for (var i = 0; i < count; i++) {
var angle = (i / count) * 2.0 * Math.PI;
var px = cx + radius * Math.cos(angle);
var pz = cz + radius * Math.sin(angle);
spawnSpellParticle(world, p1, px, cy + 0.15, pz, 1, 0, 0, 0, 0);
if (Math.random() < 0.35) {
spawnSpellParticle(world, p2, px, cy + 0.15, pz, 1, 0, 0, 0, 0);
}
}
if (Math.floor(radius) % 8 === 0) {
world.playSound("minecraft:entity.enderdragon.flap", cx, cy, cz, 2.5, 1.2);
}
c.setValue("shockwaveRadius", radius + 4.5);
c.scheduleScript("runShockwave", 1);
}
```