Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MALEFICS
- // by Malefic Machinations
- var switch_button = {
- id: "switch",
- position: [3.5,31,8,14],
- clickable: true,
- shortcut: "V",
- visible: true,
- components: [
- { type: "box",position:[0,0,100,100],fill:"rgba(68, 85, 102, 0)",stroke:"rgba(204, 221, 238, 0.667)",width:2},
- { type: "text",position:[10,23,80,30],value:"SWITCH",color:"rgba(204, 221, 238, 0.8)"},
- { type: "text",position:[10,45,80,23],value:"SHIP",color:"rgba(204, 221, 238, 0.8)"},
- { type: "text",position:[20,70,60,20],value:"[V]",color:"rgba(204, 221, 238, 0.8)"}
- ]
- };
- var stats_button = {
- id: "stats",
- position: [3.5,48,8,14],
- clickable: true,
- shortcut: "B",
- visible: true,
- components: [
- { type: "box",position:[0,0,100,100],fill:"rgba(68, 85, 102, 0)",stroke:"rgba(204, 221, 238, 0.667)",width:2},
- { type: "text",position:[10,23,80,30],value:"TOGGLE",color:"rgba(204, 221, 238, 0.8)"},
- { type: "text",position:[10,45,80,23],value:"STATS",color:"rgba(204, 221, 238, 0.8)"},
- { type: "text",position:[20,70,60,20],value:"[B]",color:"rgba(204, 221, 238, 0.8)"}
- ]
- };
- var reset_button = {
- id: "reset",
- position: [3.5,65,8,14],
- clickable: true,
- shortcut: "R",
- visible: true,
- components: [
- { type: "box",position:[0,0,100,100],fill:"rgba(68, 85, 102, 0)",stroke:"rgba(204, 221, 238, 0.667)",width:2},
- { type: "text",position:[10,34,80,25],value:"RESET",color:"rgba(204, 221, 238, 0.8)"},
- { type: "text",position:[20,70,60,20],value:"[R]",color:"rgba(204, 221, 238, 0.8)"}
- ]
- };
- var crystals_button = {
- id: "crystals",
- position: [3.5,82,8,14],
- clickable: true,
- shortcut: "M",
- visible: true,
- components: [
- { type: "box",position:[0,0,100,100],fill:"rgba(68, 85, 102, 0)",stroke:"rgba(204, 221, 238, 0.667)",width:2},
- { type: "text",position:[10,34,80,25],value:"CRYSTALS",color:"rgba(204, 221, 238, 0.8)"},
- { type: "text",position:[20,70,60,20],value:"[M]",color:"rgba(204, 221, 238, 0.8)"}
- ]
- };
- var buttons = [stats_button, reset_button, switch_button, crystals_button];
- var ship_list = [
- [101,201,202,301,302,303,304,401,402,403,404,405,406,501,502,503,504,505,506,507,601,602,603,604,605,606,607,608,701,702,703,704]
- ];
- var vocabulary = [
- { text: "You", icon:"\u004e", key:"O" },
- { text: "GG", icon:"\u00a3", key:"G" },
- { text: "Sorry", icon:"\u00a1", key:"S" },
- { text: "No Problem", icon:"\u0047", key:"P" },
- { text: "hmm?", icon:"\u004b", key:"Q" },
- { text: "Wait", icon:"\u0048", key:"T" },
- { text: "Yes", icon:"\u004c", key:"Y" },
- { text: "No", icon:"\u004d", key:"N" },
- { text: "Attack", icon:"\u00b4", key:"A" },
- { text: "Enemy", icon:"\u002b", key:"M" },
- { text: "Heal", icon:"\u0037", key:"H" },
- { text: "Defend", icon:"\u0025", key:"D" },
- { text: "Retreat", icon:"\u00bc", key:"I" },
- { text: "Thanks", icon:"\u0041", key:"X" },
- { text: "Kill", icon:"\u005b", key:"K" },
- { text: "Follow", icon:"\u0050", key:"F" },
- { text: "Me", icon:"\u004f", key:"E" },
- { text: "Base", icon:"\u0034", key:"B" },
- { text: "Upgrade", icon:"\u0078", key:"L" },
- ] ;
- this.options = {
- map_name: "Dueling",
- root_mode: "",
- reset_tree: false,
- max_players: 60,
- vocabulary: vocabulary,
- lives: 5,
- map_size: 70,
- custom_map: [],
- crystal_value: 0,
- asteroids_strength: 3,
- survival_level: 8,
- } ;
- log = function(s){
- game.modding.terminal.echo(s);
- };
- playerList = function(){
- for(nn=0;nn<game.ships.length;nn++)
- log(nn+" - "+game.ships[nn].name);
- } ;
- playerID = function() {
- for (ship of game.ships) echo(ship.id + " : " + ship.name);
- };
- setAll = function() {
- for (ship of game.ships) ship.set({type:101, shield:50000});
- };
- instructorSaysAll = function(saysWhat, instructor = "Zoltar"){
- for(ship of game.ships) ship.instructorSays(saysWhat, instructor);
- };
- hideInstructor = function(){
- for(ship of game.ships) ship.hideInstructor();
- };
- this.tick = function(game) {
- if ( game.step % 30 == 0 ) {
- for (let ship of game.ships) {
- if (!ship.custom.buttons_installed && ship.alive)
- {
- ship.custom.buttons_installed = true;
- for (b in buttons)
- {
- ship.setUIComponent(buttons[b]);
- ship.custom.tree = 0;
- for (let tree = 0; tree < ship_list.length; tree++) {
- if (ship_list[tree].indexOf(ship.type) >= 0) {
- ship.custom.tree = tree;
- break;
- }
- }
- }
- }
- var level = Math.trunc(ship.type / 100);
- if (level < 7) {
- var max_stats = 11111111 * level;
- if (ship.custom.keep_maxed) {
- if (ship.stats != max_stats) {
- ship.set({stats:max_stats});
- }
- }
- } else if (ship.stats > 0) {
- ship.set({stats:0});
- }
- }
- }
- };
- this.event = function(event, game) {
- switch (event.name)
- {
- case "ship_destroyed":
- if (event.killer !== null)
- {
- event.killer.custom.kills = event.killer.custom.kills + 1 || 1;
- }
- break;
- case "ui_component_clicked":
- var ship = event.ship;
- var component = event.id;
- switch (component)
- {
- case "switch":
- var tree = ship.custom.tree;
- var index = -1;
- index = ship_list[tree].indexOf(ship.type);
- if (index >= 0) {
- var new_type;
- var new_stats = 0;
- index = (index + 1) % ship_list[tree].length;
- new_type = ship_list[tree][index];
- var level = Math.trunc(new_type / 100);
- if (level < 7 && ship.custom.keep_maxed)
- {
- var max = 11111111 * level;
- if (ship.stats != max) {
- new_stats = max;
- }
- }
- ship.set({type:new_type,stats:new_stats});
- }
- break;
- case "stats":
- var stats = ship.stats;
- var level = Math.trunc(ship.type / 100);
- var max = 11111111 * level;
- if (level < 7)
- {
- if (stats == max)
- {
- ship.custom.keep_maxed = false;
- ship.set({stats:0});
- } else {
- ship.custom.keep_maxed = true;
- ship.set({stats:max});
- }
- }
- break;
- case "reset":
- var new_stats = ship.custom.keep_maxed ? 11111111 : 0;
- ship.set({type:101,stats:new_stats});
- break;
- case "crystals":
- var level = Math.trunc(ship.type / 100);
- var cargo = 980;
- switch (level) {
- case 1:
- cargo = 20;
- break;
- case 2:
- cargo = 80;
- break;
- case 3:
- cargo = 180;
- break;
- case 4:
- cargo = 320;
- break;
- case 5:
- cargo = 500;
- break;
- case 6:
- cargo = 720;
- break;
- case 7:
- cargo = 980;
- break;
- }
- ship.set({crystals:cargo});
- break;
- }
- break;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement