Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var x = 6; // max amount of aliens being spawned
- // define ships here
- // deleted
- // ship defining ends
- // ship pushes but i deleted them
- var vocabulary = [
- { text: "", icon:"", key:"A" },
- ];
- var map =
- "95555555555555555555555555555555555555555555555555555555555555555555559\n"+ //// 1
- "5 5\n"+
- "5 5\n"+
- "5 5\n"+
- "5 5\n"+
- "5 5\n"+ // 5
- "5 9999999999999999999999999999999999999999999999999999999999999999999 5\n"+
- "5 9999999999999999999999999999999999999999999999999999999999999999999 5\n"+
- "5 99 2 123456789 99 5\n"+
- "5 99456 9 7 9 123456789 99 99 5\n"+
- "5 99 6 9 2 17 9 5 5 5 99 5\n"+ //// 10
- "5 99 7 3 7 2 9 6 7 6 4 6 3 1 99 5\n"+
- "5 99 3 5765611 5 2 9 9999 7 91 9 7 8 9 99 5\n"+
- "5 99 8 5 5556 54 14 1 2 77501 54 1 7 6 2 99 5\n"+
- "5 99 28 7060040 91 72 08 15 45 77 502 3 9 3 99 5\n"+
- "5 99 6 978 5 3 97 3 2 21 6 1 5 8 21 05 91 972 99 5\n"+ // 15
- "5 99 12 97 9 957 958 3 8 70 5 98749 84 5 72 13 9 28 99 5\n"+
- "5 99 9 9 9 988 9 897 4 123456789 1 55 9 58 34 3 36 99 5\n"+
- "5 99 9638 9 5 83 345 9999 1 341 8 4 9 8 99 5\n"+
- "5 99 9 6 8 7 4 3 84 9 2 4 47 8 99 5\n"+
- "5 99 9 8 8 6 69 3 384 994 71 995 9 95 1 1 7 3 99 5\n"+ //// 20
- "5 99 9 8 8 9 28 2 94 3 92 48 9 9 9 7 99 5\n"+
- "5 99 6 5 3 9 8 9 99 5\n"+
- "5 9999999999999999999999999999999999999999999999999999999999999999999 5\n"+
- "5 9999999999999999999999999999999999999999999999999999999999999999999 5\n"+
- "5 5 976559988 5\n"+ // 25
- "5 9 595 876879678 5\n"+
- "5 5 967678678 5\n"+
- "5 5 76978678 5\n"+
- "5 9 595 6789786 5\n"+
- "5 5 67967967967 5\n"+ //// 30
- "5 5\n"+
- "5 5\n"+
- "5 5 5\n"+
- "5 595 5\n"+
- "5 9 999 5 5\n"+ // 35
- "5 9 9 5\n"+
- "5 999999 9 5\n"+
- "5 9 5\n"+
- "5 9999999999 9 5\n"+
- "5 999999999999999999 9 5\n"+ //// 40
- "5 9 59999999 9 5 5\n"+
- "5 999999995635999999999999 9 595 5\n"+
- "5 999999998765 9 5 5 5\n"+
- "5 5 9 595 5\n"+
- "5 595 9 5 5\n"+ // 45
- "5 5 9 5\n"+
- "5 9 5\n"+
- "5 5 714269876247634676 5\n"+
- "5 595 9817498993264869386 5\n"+
- "5 5 87623846289746873646 5\n"+ //// 50
- "5 5 82364872638766 9 5\n"+
- "5 595 9 5\n"+
- "5 5 9 5 5\n"+
- "5 5 9 595 5\n"+
- "5 595 9874534788888999 976769 5 5\n"+ // 55
- "5 999999999999999999999 5 999999 9875979 779 5\n"+
- "5 999999999999999999999 9999 98589 9999 5\n"+
- "5 9999999999 999999 999 9 999 9999 9 5\n"+
- "5 9999999999 999999 9999999 9 99 9999 99 5\n"+
- "5 99999999999999 999999 5 999999999 9 9999 5\n"+ //// 60
- "5 999999999999 9999 595 999999999 9 5\n"+
- "5 9999 9999 9999 5 9999222999999 5\n"+
- "5 9999 99 9999 9999 5656 29999 5\n"+
- "5 9999 99 9999 999 9999 99992229999 5 5\n"+
- "5 9999 99 9999 999 9999 5 999999999 595 5\n"+ // 65
- "5 9999 99 99954599 595 999999999 5 5\n"+
- "5 9999999999935699 5 9999999 5\n"+
- "5 999999999999999999999 999 5\n"+
- "5 5\n"+
- "55555555555555555555555555555555555555555555555555555555555555555555555" ; //// 70
- //1234567890123456789012345678901234567890123456789012345678901234567890
- //0 1 2 3 ! 4 5 6 7
- this.options = {
- map_name: "",
- root_mode: "unspecified",
- reset_tree: false,
- // ships:
- // asteroids
- crystal_value: 5,
- asteroids_strength: 0.6,
- // ships
- starting_ship: 101,
- starting_ship_maxed: true,
- max_players: 120,
- max_level: 8,
- healing_enabled: true,
- lives: 5,
- friendly_colors: 0,
- healing_ratio: 2,
- release_crystal: true,
- // custom game settings
- rcs_roggle: true,
- friction_ratio: 1,
- speed_mod: 1,
- shield_regen_factor: 1,
- power_regen_factor: 1,
- // secondaries
- weapons_store: true,
- auto_refill: true,
- projectile_speed: 1,
- weapon_drop: 0.1,
- mines_self_destroy: false,
- mines_destroy_delay: 99,
- // map
- map_id: 5000,
- radar_zoom: 1,
- custom_map: map,
- map_size: 70,
- // misc
- survival_time: 99,
- survival_level: 8,
- vocabulary: vocabulary
- };
- randint = function(max,min=0) {
- return Math.floor(Math.random(min) * Math.floor(max));
- };
- randAlien = function(lien) {
- for (var i=0; i<lien; i++) {
- nx = (Math.random()-0.5) * game.options.map_size*10 ;
- ny = (Math.random()-0.5) * game.options.map_size*10 ;
- var x = randint(20);
- var mxlvl = 3;
- if (x > 9){
- switch(x){
- case 20:
- break;
- case 12:
- break;
- case 19:
- break;
- case 15:
- break;
- case 16:
- mxlvl = 2;
- break;
- case 18:
- break;
- case 13:
- break;
- default:
- game.addAlien({code:x,level:randint(mxlvl),x:nx,y:ny,crystal_drop:randint(200),weapon_drop:randsc()}) ;
- }
- }
- }
- } ;
- randsecondary = function(lien) {
- for (var i=0; i<lien; i++) {
- nx = (Math.random()-0.5) * game.options.map_size*10 ;
- ny = (Math.random()-0.5) * game.options.map_size*10 ;
- var x = randint(21);
- var mxlvl = 3;
- if (x > 9){
- switch (x){
- case 10:
- game.addCollectible({code:x,x:ny,y:nx}) ;
- break;
- case 11:
- game.addCollectible({code:x,x:ny,y:nx}) ;
- break;
- case 12:
- game.addCollectible({code:x,x:ny,y:nx}) ;
- break;
- case 20:
- game.addCollectible({code:x,x:ny,y:nx}) ;
- break;
- case 21:
- game.addCollectible({code:x,x:ny,y:nx}) ;
- break;
- default:
- break;
- }
- }
- }
- };
- randsc = function() {
- while (true){
- var v = randint(21);
- var mxlvl = 3;
- if (v > 9){
- switch (x){
- case 10:
- return v;
- case 11:
- return v;
- case 12:
- return v;
- case 20:
- return v;
- case 21:
- return v;
- default:
- continue;
- }
- }
- }
- };
- torp = function(torps){
- for (var i=0; i<torps; i++) {
- game.addCollectible({code: 12, x: 0, y: 0});
- }
- };
- say = function(saysWhat, instructor = "Zoltar"){
- for(var i=0; i<game.ships.length; i++){
- game.ships[i].instructorSays(saysWhat, instructor);
- }
- };
- hide = function(){
- for(var i=0; i<game.ships.length; i++){
- game.ships[i].hideInstructor();
- }
- };
- init = function(lvl,who=0){
- if (lvl < 199){
- gem = 20;
- }
- else if (lvl < 299){
- gem = 80;
- }
- else if (lvl < 399){
- gem = 180;
- }
- else if (lvl < 499){
- gem = 320;
- }
- else if (lvl < 599){
- gem = 500;
- }
- else if (lvl < 699){
- gem = 720;
- }
- else if (lvl < 710){
- gem = 980;
- }
- else if (lvl > 715){
- gem = 999999;
- }
- game.ships[who].set({
- type:lvl,
- stats:88888888,
- shield:1000,
- crystals:gem
- });
- };
- statl = function(dam,rate,speed,shield){
- for(var i=0; i<game.aliens.length; i++)
- game.aliens[i].set({
- damage: dam,
- rate: rate,
- laser_speed: speed,
- shield: shield
- });
- };
- killaliens = function(){
- for(var i=0; i<game.aliens.length; i++)
- game.aliens[i].set({
- kill:true
- });
- };
- kill = function(who){
- game.ships[who].set({kill:true});
- };
- massset = function(id){
- for(var z=0; z<game.ships.length; z++)
- set(id,z);
- };
- alien = function(code,lvl,qw,wdp,poin){
- game.addAlien({
- code:code,
- level:lvl,
- crystal_drop:qw,
- weapon_drop: wdp,
- points:poin
- });
- };
- alienwave = function(amm,code,lvl,qw,wdp,poin){
- for (var i=0; i<amm; i++) {
- alien(code,lvl,qw,wdp,poin);
- }
- };
- maxout = function(wot){
- game.ships[wot].set({stats:99999999});
- };
- set = function(code,shi=0){
- if (code < 710){
- game.ships[shi].set({type:code});
- }
- else if (code > 710){
- game.ships[shi].set({type:code});
- gems(shi,999999)
- }
- };
- sun = function(wat){
- game.ships[wat].set({x:0,y:0,vx:0,vy:0});
- };
- tp = function(xx,yy){
- game.ships[0].set({x:xx,y:yy});
- };
- tpto = function(who){
- ship = game.ships[who];
- game.ships[0].set({x:ship.x,y:ship.y});
- };
- sunall = function(){
- for(var i=0; i<game.ships.length; i++)
- game.ships[i].set({x:0,y:0});
- };
- sunaliens = function(){
- for(var i=0; i<game.aliens.length; i++)
- game.aliens[i].set({x:0,y:0});
- };
- drain = function(who){
- game.ships[who].set({
- shield:1,
- crystals:0
- });
- };
- heal = function(who){
- game.ships[who].set({
- shield:999
- });
- };
- team = function(who,uh){
- game.ships[who].set({team:uh});
- };
- color = function(who,uh){
- game.ships[who].set({hue:uh});
- };
- oof = function(heh){
- game.addAsteroid({
- size: 100,
- vx: heh
- });
- };
- check = function(who,how){
- game.ships[who].set({score:how});
- };
- playerList = function(){
- for(var i = 0; i<game.ships.length; i++)
- game.modding.terminal.echo(i+" - "+game.ships[i]);
- }; // //
- kick = function(i,reason="Unspecified."){
- game.ships[i].gameover({"You were kicked for reason: ":reason,"Your name: ":ship.name,"Kicked by:":game.ships[0].name,"Score: ":ship.score});
- }; // //
- rType = function(){
- var a = randint(7)
- switch (a){
- case 0:
- return 101;
- case 1:
- var r = randint(1)
- switch (r){
- case 0: return 201;
- case 1: return 202;
- }
- game.modding.terminal.echo("something went wrong while trying to assign a random type")
- return 101
- case 2:
- var r = randint(4)
- switch (r){
- case 0: return 301;
- case 1: return 302;
- case 2: return 303;
- case 3: return 304;
- }
- game.modding.terminal.echo("something went wrong while trying to assign a random type")
- return 101
- case 3:
- var r = randint(6)
- switch (r){
- case 0: return 401;
- case 1: return 402;
- case 2: return 403;
- case 3: return 404;
- case 4: return 405;
- case 5: return 406;
- }
- game.modding.terminal.echo("something went wrong while trying to assign a random type")
- return 101
- case 4:
- var r = randint(7)
- switch (r){
- case 0: return 501;
- case 1: return 502;
- case 2: return 503;
- case 3: return 504;
- case 4: return 505;
- case 5: return 506;
- case 6: return 507;
- }
- game.modding.terminal.echo("something went wrong while trying to assign a random type")
- return 101
- case 5:
- var r = randint(8)
- switch (r){
- case 0: return 601;
- case 1: return 602;
- case 2: return 603;
- case 3: return 604;
- case 4: return 605;
- case 5: return 606;
- case 6: return 607;
- case 7: return 608;
- }
- game.modding.terminal.echo("something went wrong while trying to assign a random type")
- return 101
- case 6:
- var r = randint(4)
- switch (r){
- case 0: return 701;
- case 1: return 702;
- case 2: return 703;
- case 3: return 704;
- }
- game.modding.terminal.echo("something went wrong while trying to assign a random type")
- return 101
- default:
- game.modding.terminal.echo("something went wrong while trying to assign a random type")
- return 101;
- }
- }
- randomize = function(){
- randAlien(randint(50))
- for(var i = 0; i<game.ships.length; i++){
- game.ships[i].set({
- type:rType(),
- x: (Math.random()-.5) * game.ships[i].game.options.map_size*10,
- y: (Math.random()-.5) * game.ships[i].game.options.map_size*10,
- crystals: randint(720),
- stats: randint(66666666),
- generator: randint(300),
- score: randint(10000),
- angle: randint(360)
- })
- }
- }
- restart = function(){
- killaliens()
- for(var i = 0; i<game.ships.length; i++){
- game.ships[i].set({
- type:101,
- x: (Math.random()-.5) * game.ships[i].game.options.map_size*10,
- y: (Math.random()-.5) * game.ships[i].game.options.map_size*10,
- crystals: 0,
- stats: 11111111,
- generator: 0,
- score: randint(0),
- vx: 0,
- vy: 0,
- invulnerable: 250
- })
- msg(i,'The game was restarted.')
- }
- }
- di = function(q){
- game.ships[q].set({
- healing:true
- });
- };
- en = function(q){
- game.ships[q].set({
- healing:false
- });
- };
- idle = function(w){
- game.ships[w].set({
- idle: true
- });
- };
- idlent = function(w){
- game.ships[w].set({
- idle: false
- });
- };
- info = function(){
- game.modding.terminal.echo('Total amount of aliens:'+game.aliens.length)
- game.modding.terminal.echo('Total amount of players:'+game.ships.length)
- for(nn=0;nn<game.ships.length;nn++)
- game.modding.terminal.echo(nn+": "+game.ships[nn].name+', type: '+game.ships[nn].type);
- }; // //
- gems = function(who,how){
- game.ships[who].set({
- crystals:how
- });
- };
- msg = function(who,what){
- game.ships[who].intermission({"Message:":what,"Message sent by:":game.ships[0].name})
- };
- msgall = function(what){
- for(nn=0;nn<game.ships.length;nn++){
- game.ships[nn].intermission({"Global message:":what,"Message sent by:":game.ships[0].name})
- }
- };
- var gem_button = {
- id: "gem_button",
- position: [2,50,8,14],
- clickable: true,
- shortcut: "M",
- visible: false,
- components: []
- };
- var GiveGems = function(ship) {
- var lvl = ship.type
- var multiplier = 4
- var gemAdd = 5;
- if (lvl < 199){
- gemLim = 20;
- var gemAdd = 3*multiplier;
- }
- else if (lvl < 299){
- var gemLim = 80;
- var gemAdd = 3*multiplier;
- }
- else if (lvl < 399){
- var gemLim = 180;
- var gemAdd = 3*multiplier;
- }
- else if (lvl < 499){
- var gemLim = 320;
- var gemAdd = 6*multiplier;
- }
- else if (lvl < 599){
- var gemLim = 500;
- var gemAdd = 9*multiplier;
- }
- else if (lvl < 699){
- var gemLim = 720;
- var gemAdd = 12*multiplier;
- }
- else if (lvl < 790){
- var gemLim = 980;
- var gemAdd = 16*multiplier;
- }
- else if (lvl > 790){
- var gemLim = 999999;
- var gemAdd = 99999;
- }
- var newcr = ship.crystals+gemAdd;
- if (newcr > gemLim){
- var newcr = gemLim;
- }
- ship.set({
- crystals:newcr,
- generator:0,
- stats:88888888,
- });
- } ;
- var reset_button = {
- id: "reset_button",
- position: [2,50,8,14],
- clickable: true,
- shortcut: "R",
- visible: false,
- components: []
- };
- var Reset = function(ship) {
- ship.set({
- type:101,
- x: (Math.random()-.5) * ship.game.options.map_size*10,
- y: (Math.random()-.5) * ship.game.options.map_size*10,
- crystals: 0,
- stats: 11111111,
- generator: 0,
- score: 0,
- vx: 0,
- vy: 0,
- invulnerable: 250
- })
- }
- var hi_button = {
- id: "hi_button",
- position: [2,50,8,14],
- clickable: true,
- shortcut: "I",
- visible: false,
- components: []
- };
- var healer_button = {
- id: "healer_button",
- position: [2,50,8,14],
- clickable: true,
- shortcut: "P",
- visible: false,
- components: []
- };
- var toggleHeal = function(ship) {
- ship.set({healing:!ship.healing})
- }
- this.tick = function(game) {
- if (game.aliens.length<x){
- randAlien(1);
- };
- if (game.step%60==0){
- for (var i=0;i<game.ships.length;i++){
- var ship = game.ships[i];
- if (!ship.custom.buttons_installed){
- ship.custom.buttons_installed = true
- ship.setUIComponent(gem_button);
- ship.setUIComponent(hi_button);
- ship.setUIComponent(reset_button);
- ship.setUIComponent(healer_button);
- }
- }
- }
- };
- this.event = function(event,game){
- switch (event.name){
- case "ui_component_clicked":
- var ship = event.ship ;
- var component = event.id ;
- if (component == "gem_button"){
- GiveGems(ship);
- } else
- if (component == "reset_button"){
- Reset(ship);
- } else
- if (component == "hi_button"){
- game.modding.terminal.echo(ship.name+" says Hi!")
- } else
- if (component == "healer_button"){
- toggleHeal(ship)
- }
- break;
- }
- };
- GSPrtp = (who) => {
- game.ships[who].set({
- x: (Math.random()-0.5) * game.options.map_size*10,
- y: (Math.random()-0.5) * game.options.map_size*10,
- invulnerable: 400,
- shield: 1000,
- generator: 1000,
- crystals: 720
- });
- msg(who,'GSP has started!');
- for (var i = 0; i<7; i++)
- game.addCollectible({code:randsc(),x:game.ships[who].x,y:game.ships[who].y});
- };
- gsp = () => {
- for(var i = 0; i<game.ships.length; i++){
- GSPrtp(i);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement