From 463bacc977552744d969df5185c7913a599b9c6d Mon Sep 17 00:00:00 2001 From: landgreen Date: Sat, 21 Nov 2020 08:13:15 -0800 Subject: [PATCH] dielectric polarization mod rail gun: dielectric polarization - firing the rail gun damages nearby mobs block hole mobs are no longer visible before they activate striker mobs teleport more often final boss: laser does no damage for 2 seconds after it begins spawns 2 waves of mobs each spawn cycle (was 3) --- js/bullet.js | 89 +++++++++++++++++++++++----------------------------- js/level.js | 12 +++---- js/mods.js | 19 ++++++++++- js/spawn.js | 50 ++++++++++++++++------------- todo.txt | 11 +------ 5 files changed, 94 insertions(+), 87 deletions(-) diff --git a/js/bullet.js b/js/bullet.js index d3090bb..229d056 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -2924,9 +2924,46 @@ const b = { name: "rail gun", description: "use energy to launch a high-speed dense rod
hold left mouse to charge, release to fire", ammo: 0, - ammoPack: 3.5, + ammoPack: 3.25, have: false, fire() { + function pushAway(range) { //push away blocks when firing + for (let i = 0, len = mob.length; i < len; ++i) { + const SUB = Vector.sub(mob[i].position, mech.pos) + const DISTANCE = Vector.magnitude(SUB) + if (DISTANCE < range) { + const DEPTH = Math.min(range - DISTANCE, 1500) + const FORCE = Vector.mult(Vector.normalise(SUB), 0.001 * Math.sqrt(DEPTH) * mob[i].mass) + mob[i].force.x += FORCE.x; + mob[i].force.y += FORCE.y; + if (mod.isRailAreaDamage) { + mob[i].force.x += 2 * FORCE.x; + mob[i].force.y += 2 * FORCE.y; + const damage = b.dmgScale * 0.1 * Math.sqrt(DEPTH) + mob[i].damage(damage); + mob[i].locatePlayer(); + game.drawList.push({ //add dmg to draw queue + x: mob[i].position.x, + y: mob[i].position.y, + radius: Math.log(2 * damage + 1.1) * 40, + color: "rgba(100,0,200,0.25)", + time: game.drawTime + }); + } + } + } + for (let i = 0, len = body.length; i < len; ++i) { + const SUB = Vector.sub(body[i].position, mech.pos) + const DISTANCE = Vector.magnitude(SUB) + if (DISTANCE < range) { + const DEPTH = Math.min(range - DISTANCE, 500) + const FORCE = Vector.mult(Vector.normalise(SUB), 0.002 * Math.sqrt(DEPTH) * body[i].mass) + body[i].force.x += FORCE.x; + body[i].force.y += FORCE.y - body[i].mass * game.g * 1.5; //kick up a bit to give them some arc + } + } + } + if (mod.isCapacitor) { if (mech.energy > 0.16 || mod.isRailEnergyGain) { mech.energy += 0.16 * (mod.isRailEnergyGain ? 6 : -1) @@ -3012,29 +3049,7 @@ const b = { player.force.x -= KNOCK * Math.cos(mech.angle) player.force.y -= KNOCK * Math.sin(mech.angle) * 0.35 //reduce knock back in vertical direction to stop super jumps - //push away blocks when firing - let range = 450 - for (let i = 0, len = body.length; i < len; ++i) { - const SUB = Vector.sub(body[i].position, mech.pos) - const DISTANCE = Vector.magnitude(SUB) - - if (DISTANCE < range) { - const DEPTH = Math.min(range - DISTANCE, 300) - const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * body[i].mass) - body[i].force.x += FORCE.x; - body[i].force.y += FORCE.y - body[i].mass * (game.g * 1.5); //kick up a bit to give them some arc - } - } - for (let i = 0, len = mob.length; i < len; ++i) { - const SUB = Vector.sub(mob[i].position, mech.pos) - const DISTANCE = Vector.magnitude(SUB) - if (DISTANCE < range) { - const DEPTH = Math.min(range - DISTANCE, 300) - const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * mob[i].mass) - mob[i].force.x += 1.5 * FORCE.x; - mob[i].force.y += 1.5 * FORCE.y; - } - } + pushAway(800) } else { mech.fireCDcycle = mech.cycle + Math.floor(120); } @@ -3112,31 +3127,7 @@ const b = { const KNOCK = ((mech.crouch) ? 0.1 : 0.5) * this.charge * this.charge player.force.x -= KNOCK * Math.cos(mech.angle) player.force.y -= KNOCK * Math.sin(mech.angle) * 0.35 //reduce knock back in vertical direction to stop super jumps - - //push away blocks when firing - let range = 900 * this.charge - for (let i = 0, len = body.length; i < len; ++i) { - const SUB = Vector.sub(body[i].position, mech.pos) - const DISTANCE = Vector.magnitude(SUB) - - if (DISTANCE < range) { - const DEPTH = Math.min(range - DISTANCE, 300) - const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * body[i].mass) - body[i].force.x += FORCE.x; - body[i].force.y += FORCE.y - body[i].mass * (game.g * 1.5); //kick up a bit to give them some arc - } - } - for (let i = 0, len = mob.length; i < len; ++i) { - const SUB = Vector.sub(mob[i].position, mech.pos) - const DISTANCE = Vector.magnitude(SUB) - - if (DISTANCE < range) { - const DEPTH = Math.min(range - DISTANCE, 300) - const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * mob[i].mass) - mob[i].force.x += 1.5 * FORCE.x; - mob[i].force.y += 1.5 * FORCE.y; - } - } + pushAway(1200 * this.charge) } else { // charging on mouse down mech.fireCDcycle = Infinity //can't fire until mouse is released const previousCharge = this.charge diff --git a/js/level.js b/js/level.js index 9b14bc9..bc5abde 100644 --- a/js/level.js +++ b/js/level.js @@ -13,14 +13,14 @@ const level = { start() { if (level.levelsCleared === 0) { //this code only runs on the first level // game.enableConstructMode() //used to build maps in testing mode - // level.difficultyIncrease(26) + // level.difficultyIncrease(8) // game.zoomScale = 1000; // game.setZoom(); // mech.setField("wormhole") - // b.giveGuns("missiles") + // b.giveGuns("rail gun") // mod.is3Missiles = true - // mod.giveMod("neutron bomb") - // mod.giveMod("super ball") + // mod.giveMod("dielectric polarization") + // mod.giveMod("capacitor bank") level.intro(); //starting level // level.testing(); //not in rotation @@ -145,7 +145,7 @@ const level = { // spawn.bomberBoss(2900, -500) // spawn.launcherBoss(1200, -500) // spawn.laserTargetingBoss(1600, -400) - // spawn.spawner(1600, -500) + spawn.striker(1600, -500) // spawn.shooter(1700, -120) // spawn.bomberBoss(1400, -500) // spawn.sniper(1800, -120) @@ -156,7 +156,7 @@ const level = { // spawn.nodeBoss(1200, -500, "launcher") // spawn.snakeBoss(1200, -500) - spawn.powerUpBoss(2900, -500) + // spawn.powerUpBoss(2900, -500) // spawn.randomMob(1600, -500) }, template() { diff --git a/js/mods.js b/js/mods.js index 8691cc2..384fee4 100644 --- a/js/mods.js +++ b/js/mods.js @@ -2448,6 +2448,22 @@ const mod = { mod.isRailEnergyGain = false; } }, + { + name: "dielectric polarization", + description: "firing the rail gun damages nearby mobs", + maxCount: 1, + count: 0, + allowed() { + return mod.haveGunCheck("rail gun") + }, + requires: "rail gun", + effect() { + mod.isRailAreaDamage = true; + }, + remove() { + mod.isRailAreaDamage = false; + } + }, { name: "capacitor bank", description: "the rail gun no longer takes time to charge
rail gun rods are 66% less massive", @@ -3298,5 +3314,6 @@ const mod = { isMineSentry: null, isIncendiary: null, overfillDrain: null, - isNeutronSlow: null + isNeutronSlow: null, + isRailAreaDamage: null } \ No newline at end of file diff --git a/js/spawn.js b/js/spawn.js index 7abda2b..3e404d3 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -2,21 +2,21 @@ const spawn = { pickList: ["starter", "starter"], fullPickList: [ - "hopper", "hopper", "hopper", "hopper", - "shooter", "shooter", "shooter", - "chaser", "chaser", + "hopper", "hopper", "hopper", + "shooter", "shooter", "striker", "striker", "laser", "laser", "exploder", "exploder", "stabber", "stabber", "launcher", "launcher", + "springer", "springer", + "sucker", "sucker", + "chaser", "sniper", "spinner", "grower", - "springer", "beamer", "focuser", - "sucker", "spawner", "ghoster", "sneaker", @@ -173,7 +173,7 @@ const spawn = { this.modeSuck() this.modeLasers() } - me.spawnInterval = 302 + me.spawnInterval = 362 me.modeSpawns = function() { if (!(this.cycle % this.spawnInterval) && !mech.isBodiesAsleep && mob.length < 40) { if (this.mode !== 3) Matter.Body.setAngularVelocity(this, 0.1) @@ -265,7 +265,7 @@ const spawn = { } if (this.cycle < 240) { //damage scales up over 2 seconds to give player time to move const scale = this.cycle / 240 - const dmg = 0.14 * game.dmgScale * scale + const dmg = (this.cycle < 120) ? 0 : 0.14 * game.dmgScale * scale ctx.beginPath(); this.laser(this.vertices[0], this.angle + Math.PI / 6, dmg); this.laser(this.vertices[1], this.angle + 3 * Math.PI / 6, dmg); @@ -354,7 +354,7 @@ const spawn = { vertexCollision(where, look, body); if (!mech.isCloak) vertexCollision(where, look, [player]); if (best.who && best.who === player && mech.immuneCycle < mech.cycle) { - mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles + mech.immuneCycle = mech.cycle + 60 + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles mech.damage(dmg); game.drawList.push({ //add dmg to draw queue x: best.x, @@ -743,18 +743,18 @@ const spawn = { } } }, - sucker(x, y, radius = 40 + Math.ceil(Math.random() * 50)) { + sucker(x, y, radius = 30 + Math.ceil(Math.random() * 25)) { radius = 9 + radius / 8; //extra small - mobs.spawn(x, y, 6, radius, "#000"); + mobs.spawn(x, y, 6, radius, "transparent"); let me = mob[mob.length - 1]; me.stroke = "transparent"; //used for drawSneaker me.eventHorizon = radius * 23; //required for blackhole me.seeAtDistance2 = (me.eventHorizon + 200) * (me.eventHorizon + 200); //vision limit is event horizon - me.accelMag = 0.0001 * game.accelScale; + me.accelMag = 0.00009 * game.accelScale; me.frictionAir = 0.025; me.collisionFilter.mask = cat.player | cat.bullet me.memory = Infinity; - Matter.Body.setDensity(me, 0.004); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.setDensity(me, 0.008); //extra dense //normal is 0.001 //makes effective life much larger me.do = function() { //keep it slow, to stop issues from explosion knock backs if (this.speed > 5) { @@ -1535,8 +1535,8 @@ const spawn = { striker(x, y, radius = 14 + Math.ceil(Math.random() * 25)) { mobs.spawn(x, y, 5, radius, "rgb(221,102,119)"); let me = mob[mob.length - 1]; - me.accelMag = 0.0003 * game.accelScale; - me.g = 0.0002; //required if using 'gravity' + me.accelMag = 0.00034 * game.accelScale; + me.g = 0.00015; //required if using 'gravity' me.frictionStatic = 0; me.friction = 0; me.delay = 90 * game.CDScale; @@ -1564,18 +1564,26 @@ const spawn = { } this.checkStatus(); this.attraction(); - if (this.seePlayer.recall && this.cd < game.cycle) { - const dist = Vector.sub(this.seePlayer.position, this.position); - const distMag = Vector.magnitude(dist); - if (distMag < 400) { + if (this.cd < game.cycle) { + if (this.seePlayer.recall) { + const dist = Vector.sub(this.seePlayer.position, this.position); + const distMag = Vector.magnitude(dist); this.cd = game.cycle + this.delay; ctx.beginPath(); ctx.moveTo(this.position.x, this.position.y); - Matter.Body.translate(this, Vector.mult(Vector.normalise(dist), distMag - 20 - radius)); + if (distMag < 400) { + Matter.Body.translate(this, Vector.mult(Vector.normalise(dist), distMag - 20 - radius)); + } else { + Matter.Body.translate(this, Vector.mult(Vector.normalise(dist), 300)); + } ctx.lineTo(this.position.x, this.position.y); - ctx.lineWidth = radius * 2; + ctx.lineWidth = radius * 2.1; ctx.strokeStyle = this.fill; //"rgba(0,0,0,0.5)"; //'#000' ctx.stroke(); + Matter.Body.setVelocity(this, { + x: this.velocity.x * 0.5, + y: this.velocity.y * 0.5 + }); } } }; @@ -2200,7 +2208,7 @@ const spawn = { mobs.spawn(x, y, 8, radius, "rgb(55,170,170)"); let me = mob[mob.length - 1]; me.isBoss = true; - me.accelMag = 0.0008 * game.accelScale; + me.accelMag = 0.00075 * game.accelScale; me.memory = 250; me.laserRange = 500; Matter.Body.setDensity(me, 0.0015 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger diff --git a/todo.txt b/todo.txt index d4efe00..68ec275 100644 --- a/todo.txt +++ b/todo.txt @@ -1,11 +1,5 @@ *********** NEXT PATCH *********** -power up boss no longer slows down after each time you kill it - - fear the power up boss - -holding down the field button will stop nano-scale field from converting energy into bullets - energy costs have been increased a bit - nano scale can now use mod - supercapacitor ************** BUGS ************** @@ -23,14 +17,11 @@ holding down the field button will stop nano-scale field from converting energy after sticking to the top right corner of a wall notes: had only gun mine, mod mine reclamation, field plasma, -(repeatable almost everytime) bug - mines spawn extra mines when fired at thin map wall while jumping +(repeatable almost every time) bug - mines spawn extra mines when fired at thin map wall while jumping ************** TODO ************** -mod - railgun's push effect is increased, and it does some damage to nearby mobs - maybe only triggers at max energy - Laser mod: For each reflection of laser, damage increases by 10% new power up - increase damage and fire speed, for 15 seconds