From 19c1224796615c96849291d0ade7355ea3c06249 Mon Sep 17 00:00:00 2001 From: landgreen Date: Tue, 31 Mar 2020 19:01:01 -0700 Subject: [PATCH] mod - emp --- js/bullets.js | 57 ++++++++++++++++++++++++++++++++++++++++----------- js/level.js | 24 ++++++++++++++-------- js/player.js | 2 +- js/spawn.js | 8 ++++---- todo.txt | 13 +++--------- 5 files changed, 69 insertions(+), 35 deletions(-) diff --git a/js/bullets.js b/js/bullets.js index 3a205cd..40f2644 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -70,6 +70,7 @@ const b = { isModHarmDamage: null, isModAlphaRadiation: null, modEnergyRegen: null, + isModVacuumShield: null, modOnHealthChange() { //used with acid mod if (b.isModAcidDmg && mech.health > 0.8) { b.modAcidDmg = 0.7 @@ -1026,7 +1027,7 @@ const b = { }, { name: "optimized shell packing", - description: "flak ammo drops contain 2x more shells", + description: "flak ammo drops contain 3x more shells", maxCount: 3, count: 0, allowed() { @@ -1035,7 +1036,7 @@ const b = { requires: "flak", effect() { for (i = 0, len = b.guns.length; i < len; i++) { //find which gun - if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * (2 + this.count); + if (b.guns[i].name === "flak") b.guns[i].ammoPack = b.guns[i].defaultAmmoPack * (3 + this.count); } }, remove() { @@ -1044,6 +1045,22 @@ const b = { } } }, + { + name: "electromagnetic pulse", + description: "vacuum bomb's explosion destroys shields
and does 20% more damage", + maxCount: 1, + count: 0, + allowed() { + return b.haveGunCheck("vacuum bomb") + }, + requires: "vacuum bomb", + effect() { + b.isModVacuumShield = true; + }, + remove() { + b.isModVacuumShield = false; + } + }, { name: "mine reclamation", description: "retrieve ammo from all undetonated mines
and 20% of mines after detonation", @@ -1994,7 +2011,7 @@ const b = { friction: 0.05, frictionAir: 0.0005, restitution: 1, - dmg: 0.13, //damage done in addition to the damage from momentum + dmg: 0.15, //damage done in addition to the damage from momentum lookFrequency: 83 + Math.floor(41 * Math.random()), endCycle: game.cycle + Math.floor((1200 + 420 * Math.random()) * b.isModBulletsLastLonger), classType: "bullet", @@ -2378,8 +2395,10 @@ const b = { // bullet[me].dmg = 0.1 bullet[me].frictionAir = 0.034; bullet[me].do = function () { - const scale = 1 - 0.035 / b.isModBulletsLastLonger - Matter.Body.scale(this, scale, scale); + if (!mech.isBodiesAsleep) { + const scale = 1 - 0.035 / b.isModBulletsLastLonger + Matter.Body.scale(this, scale, scale); + } }; } } @@ -2499,7 +2518,7 @@ const b = { name: "wave beam", //4 description: "emit a sine wave of oscillating particles
particles slowly propagate through solids", ammo: 0, - ammoPack: 100, + ammoPack: 110, have: false, isStarterGun: true, isEasyToAim: false, @@ -2540,7 +2559,7 @@ const b = { for (let i = 0; i < q.length; i++) { slowCheck = 0.3; Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium - let dmg = b.dmgScale * 0.6 / Math.sqrt(q[i].mass) + let dmg = b.dmgScale * 0.45 / Math.sqrt(q[i].mass) q[i].damage(dmg); q[i].foundPlayer(); game.drawList.push({ //add dmg to draw queue @@ -2709,7 +2728,7 @@ const b = { name: "vacuum bomb", //8 description: "fire a bomb that sucks before exploding
click left mouse again to detonate", ammo: 0, - ammoPack: 2, + ammoPack: 3, have: false, isStarterGun: false, isEasyToAim: false, @@ -2726,6 +2745,19 @@ const b = { bullet[me].explodeRad = 440 + Math.floor(Math.random() * 30); bullet[me].onEnd = function () { b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end + + //also damage all mobs + if (b.isModVacuumShield) { + for (let i = 0, len = mob.length; i < len; ++i) { + if (mob[i].shield) { + const dist = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius; + if (dist < this.explodeRad) mob[i].damage(Infinity); + } else if (mob[i].alive && !mob[i].isShielded) { + const dist = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius; + if (dist < this.explodeRad) mob[i].damage(0.8 * b.dmgScale); + } + } + } } bullet[me].onDmg = function () { // this.endCycle = 0; //bullet ends cycle after doing damage //this triggers explosion @@ -2736,14 +2768,13 @@ const b = { bullet[me].do = function () { //extra gravity for harder arcs this.force.y += this.mass * 0.0022; - mech.fireCDcycle = mech.cycle + 10 //can't fire until after the explosion //set armed and sucking status if (!this.isArmed && !game.mouseDown) { this.isArmed = true } else if (this.isArmed && game.mouseDown && !this.isSucking) { this.isSucking = true; - this.endCycle = game.cycle + 35; + this.endCycle = game.cycle + 50; } if (this.isSucking) { @@ -2751,7 +2782,7 @@ const b = { const that = this let mag = 0.1 - function suck(who, radius = that.explodeRad * 3) { + function suck(who, radius = that.explodeRad * 3.5) { for (i = 0, len = who.length; i < len; i++) { const sub = Vector.sub(that.position, who[i].position); const dist = Vector.magnitude(sub); @@ -2783,13 +2814,15 @@ const b = { y: 0 }); //draw suck - const radius = 3 * this.explodeRad * (this.endCycle - game.cycle) / 35 + const radius = 3 * this.explodeRad * (this.endCycle - game.cycle) / 50 ctx.fillStyle = "rgba(0,0,0,0.1)"; ctx.beginPath(); ctx.arc(this.position.x, this.position.y, radius, 0, 2 * Math.PI); ctx.fill(); } } else { + mech.fireCDcycle = mech.cycle + 10 //can't fire until after the explosion + // flashing lights to show armed if (!(game.cycle % 10)) { if (this.isFlashOn) { diff --git a/js/level.js b/js/level.js index f00dd60..be7f942 100644 --- a/js/level.js +++ b/js/level.js @@ -14,7 +14,7 @@ const level = { start() { if (level.levelsCleared === 0) { // level.difficultyIncrease(9) - // b.giveGuns("ice IX") + // b.giveGuns("vacuum bomb") // mech.setField("time dilation field") // mech.energy = 0.1; // b.giveMod("ground state"); @@ -476,21 +476,30 @@ const level = { level.addZone(level.exit.x, level.exit.y, 100, 30, "nextLevel"); spawn.mapRect(level.exit.x, level.exit.y + 25, 100, 100); //exit bump - document.body.style.backgroundColor = "#fff"; + document.body.style.backgroundColor = "#eee"; level.fillBG.push({ x: 2600, y: -600, width: 400, height: 500, - color: "#edf9f9" + color: "#cee" }); + level.fill.push({ + x: -150, + y: -1000, + width: 2750, + height: 1000, + color: "rgba(0,20,40,0.1)" + }); + + const lineColor = "#ddd" level.fillBG.push({ x: 1600, y: -500, width: 100, height: 100, - color: "#eee" + color: lineColor }); level.fillBG.push({ @@ -498,7 +507,7 @@ const level = { y: -283, width: 12, height: 100, - color: "#eee" + color: lineColor }); //faster way to draw a wire @@ -509,7 +518,7 @@ const level = { y: y, width: width, height: height, - color: "#aaa" + color: lineColor }); } else { level.fillBG.push({ @@ -517,11 +526,10 @@ const level = { y: y, width: width, height: height, - color: "#eee" + color: lineColor }); } } - for (let i = 0; i < 3; i++) { wallWire(100 - 10 * i, -1050 - 10 * i, 5, 800); wallWire(100 - 10 * i, -255 - 10 * i, -300, 5); diff --git a/js/player.js b/js/player.js index c1bf9eb..ac06994 100644 --- a/js/player.js +++ b/js/player.js @@ -1366,7 +1366,7 @@ const mech = { } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed mech.grabPowerUp(); mech.lookForPickUp(); - const DRAIN = 0.0005 + const DRAIN = 0.00065 if (mech.energy > DRAIN) { mech.energy -= DRAIN; if (mech.energy < 0) { diff --git a/js/spawn.js b/js/spawn.js index 31c34a6..76a7f45 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -1670,7 +1670,7 @@ const spawn = { if (mech.pos.x > breakingPoint) { this.freeOfWires = true; this.force.x += -0.0006; - this.fill = "#222"; + this.fill = "#111"; } //move mob to player mech.calcLeg(0, 0); @@ -1685,7 +1685,7 @@ const spawn = { ctx.quadraticCurveTo(wireX, 0, this.position.x, this.position.y); ctx.lineWidth = 5; ctx.lineCap = "butt"; - ctx.strokeStyle = "#222"; + ctx.strokeStyle = "#111"; ctx.stroke(); ctx.lineCap = "round"; }; @@ -1719,7 +1719,7 @@ const spawn = { if (mech.pos.x > breakingPoint) { this.freeOfWires = true; this.force.x += -0.0005; - this.fill = "#333"; + this.fill = "#222"; } //move mob to player mech.calcLeg(Math.PI, -3); @@ -1733,7 +1733,7 @@ const spawn = { ctx.moveTo(wireX, wireY); ctx.quadraticCurveTo(wireX, 0, this.position.x, this.position.y); ctx.lineWidth = 5; - ctx.strokeStyle = "#333"; + ctx.strokeStyle = "#222"; ctx.lineCap = "butt"; ctx.stroke(); ctx.lineCap = "round"; diff --git a/todo.txt b/todo.txt index 4f38392..7bb916d 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,9 @@ +mod - electromagnetic pulse - vacuum bomb does 9x damage to shields + ************** TODO - n-gon ************** +cryonics : a mod that increases the freezing time of mobs. mob Boss - time skipper: sends a pulse wave out that will cause time to jump forward 1 second. what about a series of short time skips forward 10 cycles at a time @@ -47,16 +50,6 @@ mod - robot that attack nearby mobs, and delivers a stun status effect settings - auto aim at nearest mob settings - custom keys binding -gun - buff vacuum bomb - it's weak late game - can't spam it faster - bad vs. shields - doesn't scale up to huge groups - buff collision damage? - mod - double explosions? - mod - doesn't suck player in? - mod - DoT damage after exploding - mod - energy recharges faster when not moving lore - a robot (the player) gains self awareness