Last active
October 8, 2017 07:03
-
-
Save tkc49/ed6f76f259bcfc83d3455943a8307c57 to your computer and use it in GitHub Desktop.
Magikcraft Spells, by tkc49.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function arain(radius, typ){ | |
radius = parseInt(radius) || 20; | |
typ = typ || "ANVIL"; | |
for (var i = 0; i < 200; i++) { | |
rndAnvil(radius, typ); | |
} | |
} | |
function rndAnvil(radius,typ) { | |
var height = radius; | |
rndBlock(radius, height).setType(org.bukkit.Material[typ]) | |
} | |
// Standard Normal variate using Box-Muller transform. | |
//http://stackoverflow.com/questions/25582882/javascript-math-random-normal-distribution-gaussian-bell-curve | |
function randn_bm() { | |
var u = 1 - Math.random(); // Subtraction to flip [0, 1) to (0, 1]. | |
var v = 1 - Math.random(); | |
return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v ); | |
} | |
function rnorm_unit(count) { | |
var ret = 0; | |
for (var i = 0; i < count; i++) { | |
ret += Math.random(); | |
} | |
return ret/count; | |
} | |
function rnorm(mean, sd) { | |
return randn_bm() * sd + mean; | |
} | |
function runif(from, to) { | |
return scale(Math.random(), from, to); | |
} | |
function scale(r, from, to) { | |
return Math.floor(r*(to - from)+from) | |
} | |
function rndBlock(radius, height) { | |
return magik.getSender().location.getBlock().getRelative(rnorm(0, radius/5), height+runif(0, radius*3), rnorm(0, radius/5)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function cam_capture(seconds = "--help", fps = 20) { | |
if (seconds === "--help") { | |
magik.dixit("Usage: /cast cam_capture [secs]"); | |
magik.dixit("Usage: /cast cam_capture [secs] [fps]"); | |
return; | |
} | |
global.film = {}; | |
film.frames = []; | |
film.metadata = { | |
fps, | |
seconds | |
}; | |
const interval = 1000 / fps; | |
const totalFrames = fps * seconds; | |
magik.dixit(`Recording ${seconds}s at ${fps} fps`); | |
let count = 0; | |
const camera = magik.setInterval(()=>{ | |
const location = magik.getSender().getLocation(); | |
film.frames.push(location); | |
count ++; | |
if (count > totalFrames) { | |
magik.clearInterval(camera); | |
magik.dixit('Finished recording!'); | |
} | |
}, interval); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function comet(){ | |
const Fireball = magik.type('entity.Fireball'); | |
const TNT = magik.type("entity.EntityType").PRIMED_TNT; | |
const sender = magik.getSender(); | |
magik.dixit(sender.getName); | |
//var arrow = player.getWorld().spawnEntity(sender.location, org.bukkit.entity.EntityType.ZOMBIE); | |
for (var i = 0; i < 50; i++) { | |
const loc = rndBlock(15,15).location; | |
const arrow = sender.getWorld().spawnEntity(loc, TNT); | |
// //arrow.setShooter(sender); | |
// var v = sender.getEyeLocation().getDirection().multiply(2); | |
// v.setX(0); | |
// v.setY(0); | |
// v.setZ(0); | |
// //arrow.setVelocity(v); | |
// //arrow.setMetadata("ArrowType", new MyMetadata(this, "stick")); | |
} | |
} | |
function randn_bm() { | |
const u = 1 - Math.random(); // Subtraction to flip [0, 1) to (0, 1]. | |
const v = 1 - Math.random(); | |
return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v ); | |
} | |
function rnorm_unit(count) { | |
let ret = 0; | |
for (let i = 0; i < count; i++) { | |
ret += Math.random(); | |
} | |
return ret/count; | |
} | |
function rnorm(mean, sd) { | |
return randn_bm() * sd + mean; | |
} | |
function runif(from, to) { | |
return scale(Math.random(), from, to); | |
} | |
function scale(r, from, to) { | |
return Math.floor(r*(to - from)+from) | |
} | |
function rndBlock(radius, height) { | |
return magik.getSender().getLocation().getBlock().getRelative(rnorm(0, radius/5), rnorm(0, radius/5), rnorm(0, radius/5)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function feedme(){ | |
magik.satio(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
$count = 0; | |
function fireboal() { | |
fire(); | |
} | |
function fire(){ | |
magik.setTimeout(function(){ | |
magik.infierno(); | |
}, 2000); | |
$count++; | |
if($count <= 3){ | |
fire(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function fireworks() { | |
// 見てる先を取得 | |
var there = magik.aspecto(); | |
magik.doNTimes( | |
function () { | |
// fireworkをローンチする | |
magik.stella(there); | |
//magik.iacta(name); | |
}, 1000, 300); | |
//magik.iacta(name); | |
magik.stella(there); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function fly() { | |
magik.volare(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function jump() { | |
magik.ex | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function lightning() { | |
magik.shakti(); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function rocket() { | |
const there = magik.aspecto(); | |
// magik.stella (there); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magik = magikcraft.io; | |
function test() { | |
magik.dixit(sender.getName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment