package MGSlide import Minigame import PlayerData import Obstacle import EscaperKillers import Orders import Builder import Assets import Coin import Tree constant LEFT_SPOT = vec2(-1540, 7550) constant RIGHT_SPOT = vec2(640, 7550) public class MGSlide extends Minigame RegionData rdata boolean goRight = true var bcount = 0 CallbackPeriodic cb override function getGameRect() returns rect return gg_rct_slidegamearea override function getCamBounds() returns rect return gg_rct_slidegamebounds override function onBegin() bcount = 0 goRight = true rdata = getRegionData(RIGHT_SPOT) gg_rct_slidegamespawn.changeTerrain(CONTROLLABLEICE) generateNewCourse() cb = doPeriodically(12) cb -> int count = 0 for pd in escaperPlayers if pd.escaper != null and pd.escaper.alive if goRight and pd.escaper.getPos().distanceTo2d(RIGHT_SPOT) > 64 pd.escaper.kill(null, KillMode.FORCE) flashEffect(Abilities.frostNovaTarget, pd.escaper.getPos()) else if not goRight and pd.escaper.getPos().distanceTo2d(LEFT_SPOT) > 64 pd.escaper.kill(null, KillMode.FORCE) flashEffect(Abilities.frostNovaTarget, pd.escaper.getPos()) else count++ if count > 0 goRight = not goRight if goRight for i = 0 to 1 new Coin(RIGHT_SPOT, STAFF_PLAYER) else for i = 0 to 1 new Coin(LEFT_SPOT, STAFF_PLAYER) for pd in escaperPlayers if pd.escaper != null and pd.escaper.alive flashEffect(Abilities.polyMorphTarget, pd.escaper.getPos()) printTimedToPlayer("Next round!\n>> |cff8cbfddGet to the other side!", 1, pd.p) generateNewCourse() function generateNewCourse() createFText((goRight ? RIGHT_SPOT : LEFT_SPOT).toVec3(), "12", 12, 2., vec2(0, 0.03)) doPeriodicallyCounted(1, 11) cb -> createFText((goRight ? RIGHT_SPOT : LEFT_SPOT).toVec3(), cb.getCount().toString(), 12, 2., vec2(0, 0.03)) forUnitsInRect(gg_rct_slidegamespawn) u -> let data = u.getEntity() if data != null and not data instanceof Escaper and not data instanceof Builder data.terminate() bcount++ let spawn = gg_rct_slidegamespawn for i = 0 to bcount div 2 gg_rct_slidegamespawn.randomPoint().setTerrainType(UNCONTROLLABLEICE, -1, 1, 0) for i = 0 to bcount * 2 new SmallObstacle(spawn.randomPoint(), STAFF_PLAYER) for i = 0 to bcount new BigObstacle(spawn.randomPoint(), STAFF_PLAYER) for i = 0 to bcount div 2 new Tree(spawn.randomPoint(), STAFF_PLAYER) for i = 0 to bcount new SmallKiller(spawn.randomPoint(), STAFF_PLAYER) .actor.issuePointOrderById(Orders.patrol, spawn.randomPoint()) for i = 0 to bcount div 2 new GlaiveKiller(spawn.randomPoint(), STAFF_PLAYER) .actor.issuePointOrderById(Orders.patrol, spawn.randomPoint()) override function onEnd() forUnitsInRect(rdata.theRect) u -> let data = u.getEntity() if data != null and not data instanceof Escaper and not data instanceof Builder data.terminate() destroy cb override function getStartPosition() returns vec2 return LEFT_SPOT override function getName() returns string return "|cff567eecSlide Fun\n\n|r >> |cff8cbfddGet to the other side in 12 seconds!" init minigames.add(new MGSlide())