From b50e2ba9cee804cb773ace129dd1cb37ed647b98 Mon Sep 17 00:00:00 2001 From: landgreen Date: Tue, 20 Apr 2021 06:36:22 -0700 Subject: [PATCH] needles, and diffraction diffraction grating only gains 1 extra beam, but no longer gets a damage reduction also the beam split is wider than before needle move twice as fast (was 50, now is 100) and they are 50% longer and 25% thinner damage was improved about 20% delay between each needle in a volley is slightly longer --- .DS_Store | Bin 6148 -> 6148 bytes js/bullet.js | 79 +++++++++++++++++++++------------------------------ js/level.js | 18 +++++------- js/mob.js | 6 +++- js/player.js | 6 ++-- js/spawn.js | 2 +- js/tech.js | 2 +- todo.txt | 37 ++++++------------------ 8 files changed, 59 insertions(+), 91 deletions(-) diff --git a/.DS_Store b/.DS_Store index 75542196521510dd302b310edb93fe208e40bd36..c6d0dcaf0d28017a3177b2321a7b68c206c20fae 100644 GIT binary patch delta 15 WcmZoMXffEJ#mpo$d9x1l4G{n)ssy_L delta 15 WcmZoMXffEJ#mvOzx><+$h6n&8o&;q8 diff --git a/js/bullet.js b/js/bullet.js index 6ae5558..96df8c2 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -1483,26 +1483,12 @@ const b = { color: "rgba(255,0,0,0.5)", time: simulation.drawTime }); - if (tech.isLaserPush) { //push mobs away - // console.log(-0.003 * Math.min(4, best.who.mass), dmg) const index = path.length - 1 - // const force = Vector.mult(Vector.normalise(Vector.sub(path[Math.max(0, index - 1)], path[index])), -0.003 * Math.min(4, best.who.mass)) - // const push = -0.004 / (1 + tech.beamSplitter + tech.wideLaser + tech.historyLaser) - // console.log(push) const force = Vector.mult(Vector.normalise(Vector.sub(path[index], path[Math.max(0, index - 1)])), 0.003 * push * Math.min(6, best.who.mass)) Matter.Body.applyForce(best.who, path[index], force) - // Matter.Body.setVelocity(best.who, { //friction - // x: best.who.velocity.x * 0.7, - // y: best.who.velocity.y * 0.7 - // }); } - } - // ctx.fillStyle = color; //draw mob damage circle - // ctx.beginPath(); - // ctx.arc(path[path.length - 1].x, path[path.length - 1].y, Math.sqrt(damage) * 100, 0, 2 * Math.PI); - // ctx.fill(); }; const reflection = function() { // https://math.stackexchange.com/questions/13261/how-to-get-a-reflection-vector const n = Vector.perp(Vector.normalise(Vector.sub(best.v1, best.v2))); @@ -2317,7 +2303,6 @@ const b = { const velocity = Vector.mult(Vector.normalise(Vector.sub(where, who.position)), speed) velocity.y -= Math.abs(who.position.x - closestMob.position.x) / 150; //gives an arc, but not a good one Matter.Body.setVelocity(who, velocity); - if (isSpin) Matter.Body.setAngularVelocity(who, 2 + 2 * Math.random() * (Math.random() < 0.5 ? -1 : 1)); } }, targetedNail(position, num = 1, speed = 40 + 10 * Math.random(), range = 1200, isRandomAim = true) { @@ -3219,7 +3204,7 @@ const b = { fireNeedles() { function makeNeedle(angle = m.angle) { const me = bullet.length; - bullet[me] = Bodies.rectangle(m.pos.x + 40 * Math.cos(m.angle), m.pos.y + 40 * Math.sin(m.angle), 50, 1, b.fireAttributes(angle)); + bullet[me] = Bodies.rectangle(m.pos.x + 40 * Math.cos(m.angle), m.pos.y + 40 * Math.sin(m.angle), 75, 0.75, b.fireAttributes(angle)); bullet[me].collisionFilter.mask = tech.isNeedleShieldPierce ? cat.body : cat.body | cat.mobShield Matter.Body.setDensity(bullet[me], 0.00001); //0.001 is normal bullet[me].endCycle = simulation.cycle + 180; @@ -3239,14 +3224,14 @@ const b = { } if (!immune) { if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.975) { - b.explosion(this.position, 220 + 30 * Math.random()); //makes bullet do explosive damage at end + b.explosion(this.position, 220 + 50 * Math.random()); //makes bullet do explosive damage at end } this.immuneList.push(who.id) //remember that this needle has hit this mob once already who.foundPlayer(); if (tech.isNailRadiation) { - mobs.statusDoT(who, tech.isFastRadiation ? 9 : 2.25, tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles + mobs.statusDoT(who, tech.isFastRadiation ? 12 : 3, tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles } else { - let dmg = b.dmgScale * 3.5 + let dmg = b.dmgScale * 3.75 if (tech.isCrit && who.isStunned) dmg *= 4 who.damage(dmg, tech.isNeedleShieldPierce); simulation.drawList.push({ //add dmg to draw queue @@ -3267,12 +3252,14 @@ const b = { x: 0, y: 0 }); - this.do = function() {} + this.do = function() { + if (!Matter.Query.collides(this, map).length) this.force.y += this.mass * 0.001; + } } else if (this.speed < 30) { - this.force.y += this.mass * 0.0007; //no gravity until it slows down to improve aiming + this.force.y += this.mass * 0.001; //no gravity until it slows down to improve aiming } }; - const SPEED = 50 + const SPEED = 100 Matter.Body.setVelocity(bullet[me], { x: m.Vx / 2 + SPEED * Math.cos(angle), y: m.Vy / 2 + SPEED * Math.sin(angle) @@ -3285,13 +3272,13 @@ const b = { m.fireCDcycle = m.cycle + 50 * b.fireCD; // cool down makeNeedle() for (let i = 1; i < 4; i++) { //4 total needles - setTimeout(() => { if (!simulation.paused) makeNeedle() }, 40 * i); + setTimeout(() => { if (!simulation.paused) makeNeedle() }, 60 * i); } } else { m.fireCDcycle = m.cycle + 30 * b.fireCD; // cool down makeNeedle() for (let i = 1; i < 3; i++) { //3 total needles - setTimeout(() => { if (!simulation.paused) makeNeedle() }, 40 * i); + setTimeout(() => { if (!simulation.paused) makeNeedle() }, 60 * i); } } @@ -3320,7 +3307,7 @@ const b = { if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.975) { b.explosion(this.position, 300 + 30 * Math.random()); //makes bullet do explosive damage at end } - if (tech.isNailRadiation) mobs.statusDoT(who, 7 * (tech.isFastRadiation ? 12 : 0.3), tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles + if (tech.isNailRadiation) mobs.statusDoT(who, 7 * (tech.isFastRadiation ? 1.4 : 0.35), tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles }; bullet[me].minDmgSpeed = 10 @@ -4483,27 +4470,21 @@ const b = { } else { m.fireCDcycle = m.cycle m.energy -= m.fieldRegen + tech.laserFieldDrain * tech.isLaserDiode - const divergence = m.crouch ? 0.15 : 0.2 - const scale = Math.pow(0.9, tech.beamSplitter) - const pushScale = scale * scale - let dmg = tech.laserDamage * scale //Math.pow(0.9, tech.laserDamage) + // const divergence = m.crouch ? 0.15 : 0.2 + // const scale = Math.pow(0.9, tech.beamSplitter) + // const pushScale = scale * scale + let dmg = tech.laserDamage // * scale //Math.pow(0.9, tech.laserDamage) const where = { x: m.pos.x + 20 * Math.cos(m.angle), y: m.pos.y + 20 * Math.sin(m.angle) } - b.laser(where, { - x: where.x + 3000 * Math.cos(m.angle), - y: where.y + 3000 * Math.sin(m.angle) - }, dmg, tech.laserReflections, false, pushScale) - for (let i = 1; i < 1 + tech.beamSplitter; i++) { + const divergence = m.crouch ? 0.2 : 0.5 + const angle = m.angle - tech.beamSplitter * divergence / 2 + for (let i = 0; i < 1 + tech.beamSplitter; i++) { b.laser(where, { - x: where.x + 3000 * Math.cos(m.angle + i * divergence), - y: where.y + 3000 * Math.sin(m.angle + i * divergence) - }, dmg, tech.laserReflections, false, pushScale) - b.laser(where, { - x: where.x + 3000 * Math.cos(m.angle - i * divergence), - y: where.y + 3000 * Math.sin(m.angle - i * divergence) - }, dmg, tech.laserReflections, false, pushScale) + x: where.x + 3000 * Math.cos(angle + i * divergence), + y: where.y + 3000 * Math.sin(angle + i * divergence) + }, dmg, tech.laserReflections, false) } } }, @@ -4608,12 +4589,18 @@ const b = { let energy = 0.3 * Math.min(m.energy, 1.5) m.energy -= energy * tech.isLaserDiode if (tech.beamSplitter) { - energy *= Math.pow(0.85, tech.beamSplitter) - b.pulse(energy, m.angle) - for (let i = 1; i < 1 + tech.beamSplitter; i++) { - b.pulse(energy, m.angle - i * 0.27) - b.pulse(energy, m.angle + i * 0.27) + // energy *= Math.pow(0.9, tech.beamSplitter) + // b.pulse(energy, m.angle) + // for (let i = 1; i < 1 + tech.beamSplitter; i++) { + // b.pulse(energy, m.angle - i * 0.27) + // b.pulse(energy, m.angle + i * 0.27) + // } + const divergence = m.crouch ? 0.2 : 0.5 + const angle = m.angle - tech.beamSplitter * divergence / 2 + for (let i = 0; i < 1 + tech.beamSplitter; i++) { + b.pulse(energy, angle + i * divergence) } + } else { b.pulse(energy, m.angle) } diff --git a/js/level.js b/js/level.js index 8d3fad9..4e47e2b 100644 --- a/js/level.js +++ b/js/level.js @@ -16,12 +16,12 @@ const level = { // simulation.zoomScale = 1000; // simulation.setZoom(); // m.setField("nano-scale manufacturing") - // b.giveGuns("laser") + // b.giveGuns("nail gun") // tech.isExplodeRadio = true // for (let i = 0; i < 1; i++) tech.giveTech("dynamo-bot") - // tech.giveTech("incendiary ammunition") - // tech.giveTech("flip-flop") - // tech.giveTech("causality bombs") + // tech.giveTech("diffraction grating") + // tech.giveTech("pulse") + // tech.giveTech("needle gun") // tech.giveTech("cardinality") // tech.giveTech("Bayesian statistics") // tech.isExplodeRadio = true; @@ -1113,17 +1113,13 @@ const level = { // spawn.shooterBoss(1900, -500) // spawn.launcherBoss(1200, -500) // spawn.laserTargetingBoss(1600, -400) - spawn.striker(1600, -500) - spawn.striker(1600, -500) - spawn.striker(1600, -500) + // spawn.striker(1600, -500) // spawn.laserTargetingBoss(1700, -120) // spawn.bomberBoss(1400, -500) - spawn.sniper(1800, -120) - spawn.sniper(1800, -120) - spawn.sniper(2800, -120) + // spawn.sniper(1800, -120) // spawn.streamBoss(1600, -500) // spawn.orbitalBoss(1600, -500) - // spawn.spawnerBossCulture(1600, -500) + spawn.cellBossCulture(1600, -500) // spawn.shieldingBoss(1600, -500) // spawn.beamer(1200, -500) // spawn.shield(mob[mob.length - 1], 1800, -120, 1); diff --git a/js/mob.js b/js/mob.js index 8eed00d..19091a6 100644 --- a/js/mob.js +++ b/js/mob.js @@ -1198,7 +1198,11 @@ const mobs = { } Matter.World.remove(engine.world, this); mob.splice(i, 1); - if (tech.isMobBlockFling) b.targetedBlock(body[body.length - 1], true) + if (tech.isMobBlockFling) { + const who = body[body.length - 1] + b.targetedBlock(who, true) + Matter.Body.setAngularVelocity(who, (0.5 + 0.2 * Math.random()) * (Math.random() < 0.5 ? -1 : 1)); + } } else { Matter.World.remove(engine.world, this); mob.splice(i, 1); diff --git a/js/player.js b/js/player.js index 7c2b5bc..b844610 100644 --- a/js/player.js +++ b/js/player.js @@ -1151,14 +1151,14 @@ const m = { const solid = function(that) { const dx = that.position.x - player.position.x; const dy = that.position.y - player.position.y; - if (dx * dx + dy * dy > 10000 && that !== m.holdingTarget) { + if (that.speed < 3 && dx * dx + dy * dy > 10000 && that !== m.holdingTarget) { that.collisionFilter.category = cat.body; //make solid that.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet; //can hit player now } else { - setTimeout(solid, 25, that); + setTimeout(solid, 50, that); } }; - setTimeout(solid, 150, m.holdingTarget); + setTimeout(solid, 500, m.holdingTarget); const charge = Math.min(m.throwCharge / 5, 1) //***** scale throw speed with the first number, 80 ***** diff --git a/js/spawn.js b/js/spawn.js index 18430ab..81c3eb2 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -527,7 +527,7 @@ const spawn = { me.seePlayerFreq = Math.floor(11 + 7 * Math.random()) me.seeAtDistance2 = 1400000; me.cellMassMax = 70 - me.collisionFilter.mask = cat.player | cat.bullet | cat.body //| cat.map | cat.body + me.collisionFilter.mask = cat.player | cat.bullet //| cat.body | cat.map Matter.Body.setDensity(me, 0.00035) // normal density is 0.001 // this reduces life by half and decreases knockback const k = 642 //k=r^2/m me.split = function() { diff --git a/js/tech.js b/js/tech.js index 0b3f2c9..8918adb 100644 --- a/js/tech.js +++ b/js/tech.js @@ -4188,7 +4188,7 @@ }, { name: "diffraction grating", - description: `your laser gains 2 diverging beams
decrease individual beam damage by 10%`, + description: `your laser gains a diverging beam`, isGunTech: true, maxCount: 9, count: 0, diff --git a/todo.txt b/todo.txt index 03dbe85..7b3acc6 100644 --- a/todo.txt +++ b/todo.txt @@ -1,15 +1,12 @@ ******************************************************** NEXT PATCH ******************************************************** -thrown blocks can damage intangible mobs for a couple seconds after they are thrown - they are set to act like bullets for a few seconds after being thrown -all blocks do 50% more damage to mobs and 50% longer stun -blocks do more damage vs. shielded mobs (damage penalty is 40%, was 66%)) -mass driver - damage increase set to 200% (up from 100%) -negative mass field can lift blocks twice as heavy as before with little movement reduction - -tech: flywheel - when mobs die their body is spun and flung at nearby mobs - requires mass driver, no other mob death tech +diffraction grating only gains 1 extra beam, but no longer gets a damage reduction + also the beam split is wider than before +needle move twice as fast (was 50, now is 100) + and they are 50% longer and 25% thinner + damage was improved about 20% + delay between each needle in a volley is slightly longer ******************************************************** BUGS ******************************************************** @@ -41,10 +38,9 @@ fix door.isOpen actually meaning isClosed? ******************************************************** TODO ******************************************************** -chance for the block resulting from a slain enemy to be thrown at the nearest mob. - tech: flywheel - after a mob dies their body is fired towards a nearby mob - requires: block throwing technology? - adjust for gravity +make some bullets move super fast, but do collisions checks in .do() + check for hitting mobs or map with fractional velocity + if velocity is above 40ish import the procedural level generation from one of the older versions of the game as one single level @@ -61,30 +57,15 @@ blocking produces ice-IX standing wave harmonics maybe just a chance to proc for perfect diamagnetism -laser beam splitter should only increase by 1,2,3,4 not 1,3,5 - tech field: while _____ is active take 100% more harm and do 100% more damage while firing or while plasma field is active -make a boss that increases tech.deathSpawns while it is alive - tech.deathSpawns += 2 - on death tech.deathSpawns -= 2 - how to make it clear that the bos is producing the spawns? - boss is make of many spawn-like mobs - but they need to have a different color from spawns - similar to how cellBoss works - with stronger flocking/attracting forces - quantum foam: hold fire to charge up foam, release fire to let go an amount relative to hold long you held fire foam gun fires a bullet that tracks how long mouse is down when mouse is up it streams out a hose of foam based on how long foam was down bullet is small and hidden -make some bullets move super fast, but do collisions checks in .do() - check for hitting mobs or map with fractional velocity - if velocity is above 40ish - flipflop, but toggles after a kill new level: procedural generation