From f3a115b23700c9b8c50abfca97ffb66916dd81f4 Mon Sep 17 00:00:00 2001 From: landgreen Date: Tue, 19 Jul 2022 18:55:27 -0700 Subject: [PATCH] orbital armor finalBoss pushes away things between every phase it's much smaller in black hole phase and very hard to hit timeBoss, shooterBoss, orbitalBoss, laserTargetingBoss have "orbital armor" orbitals have less health and move a bit slower orbitalBoss is slower and has more health blinkBoss does much less collision damage laserTargetingBoss does 2.5x damage but it's laser is only on 1/2 the time URL builds share what mode molecular assembler is on --- js/bullet.js | 3 +- js/index.js | 13 +++ js/level.js | 22 ++-- js/spawn.js | 291 ++++++++++++++++++++++++++------------------------- js/tech.js | 12 +-- todo.txt | 44 +++++--- 6 files changed, 206 insertions(+), 179 deletions(-) diff --git a/js/bullet.js b/js/bullet.js index a7facb4..e82ce17 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -3040,7 +3040,7 @@ const b = { lockedOn: null, delay: 50, cd: simulation.cycle + 10, - dmg: radius * (tech.isMutualism ? 2.5 : 1), + dmg: 0, //radius * (tech.isMutualism ? 2.5 : 1), setDamage() { //dmg is set to zero after doing damage once, and set back to normal after jumping this.dmg = radius * (tech.isMutualism ? 2.5 : 1) //damage done in addition to the damage from momentum //spores do 7 dmg, worms do 18 }, @@ -5587,6 +5587,7 @@ const b = { const angle = m.angle + 0.2 * (Math.random() - 0.5) const speed = (input.down ? 33 : 20) * (1 + 0.1 * Math.random()) b.flea(where, { x: speed * Math.cos(angle), y: speed * Math.sin(angle) }) + bullet[bullet.length - 1].setDamage() } } else if (tech.isSporeWorm) { const where = { x: m.pos.x + 35 * Math.cos(m.angle), y: m.pos.y + 35 * Math.sin(m.angle) } diff --git a/js/index.js b/js/index.js index a509545..6045d04 100644 --- a/js/index.js +++ b/js/index.js @@ -152,6 +152,12 @@ window.addEventListener('load', () => { } if (property === "level") document.getElementById("starting-level").value = Math.max(Number(set[property]) - 1, 0) if (property === "noPower") document.getElementById("no-power-ups").checked = Number(set[property]) + if (property === "molMode") { + simulation.molecularMode = Number(set[property]) + const i = 4 //update experiment text + m.fieldUpgrades[i].description = m.fieldUpgrades[i].setDescription() + document.getElementById(`field-${i}`).innerHTML = `
  ${build.nameLink(m.fieldUpgrades[i].name)}
${m.fieldUpgrades[i].description}` + } // if (property === "seed") { // document.getElementById("seed").placeholder = Math.initialSeed = String(set[property]) // Math.seed = Math.abs(Math.hash(Math.initialSeed)) @@ -590,6 +596,13 @@ ${simulation.isCheating ? "

lore disabled": ""} } } } + url += `&molMode=${encodeURIComponent(simulation.molecularMode)}` + // if (property === "molMode") { + // simulation.molecularMode = Number(set[property]) + // m.fieldUpgrades[i].description = m.fieldUpgrades[i].setDescription() + // document.getElementById(`field-${i}`).innerHTML = `
  ${build.nameLink(m.fieldUpgrades[i].name)}
${m.fieldUpgrades[i].description}` + // } + url += `&field=${encodeURIComponent(m.fieldUpgrades[m.fieldMode].name.trim())}` url += `&difficulty=${simulation.difficultyMode}` if (isCustom) { diff --git a/js/level.js b/js/level.js index 0decdab..1fe8d63 100644 --- a/js/level.js +++ b/js/level.js @@ -36,7 +36,7 @@ const level = { // for (let i = 0; i < 10; i++) powerUps.directSpawn(450, -50, "tech"); // for (let i = 0; i < 10; i++) powerUps.directSpawn(450, -50, "research"); // spawn.starter(1900, -500, 200) - // spawn.powerUpBossBaby(1900, -500) + // spawn.laserTargetingBoss(1900, -500) // for (let i = 0; i < 10; ++i) spawn.grower(1900, -500) // level.testing(); //not in rotation, used for testing // for (let i = 0; i < 7; ++i) powerUps.directSpawn(m.pos.x + 50 * Math.random(), m.pos.y + 50 * Math.random(), "research"); @@ -2902,11 +2902,11 @@ const level = { for (let i = 0; i < 9; ++i) powerUps.spawn(-1800 + 550 * Math.random(), -1700, "ammo") for (let i = 0; i < 3; ++i) powerUps.spawn(-1800 + 550 * Math.random(), -1700, "heal"); const scale = Math.pow(simulation.difficulty, 0.7) //hard around 30, why around 54 - if (Math.random() < 0.07 && simulation.difficulty > 30) { - for (let i = 0, len = scale * 0.25 / 5; i < len; ++i) spawn.timeBoss(-1327 - 200 * i, -1525, 60, false); //spawn 1-2 at difficulty 15 - for (let i = 0, len = scale * 0.1 / 5; i < len; ++i) spawn.bounceBoss(-1327 - 200 * i, -1525, 80, false); - for (let i = 0, len = scale * 0.15 / 5; i < len; ++i) spawn.sprayBoss(-1327 - 200 * i, -1525, 30, false) - for (let i = 0, len = scale * 0.26 / 5; i < len; ++i) spawn.mineBoss(-1327 - 200 * i, -1525, 50, false); + if (Math.random() < 0.07 && simulation.difficulty > 35) { + for (let i = 0, len = scale * 0.25 / 6; i < len; ++i) spawn.timeBoss(-1327 - 200 * i, -1525, 60, false); //spawn 1-2 at difficulty 15 + for (let i = 0, len = scale * 0.1 / 6; i < len; ++i) spawn.bounceBoss(-1327 - 200 * i, -1525, 80, false); + for (let i = 0, len = scale * 0.15 / 6; i < len; ++i) spawn.sprayBoss(-1327 - 200 * i, -1525, 30, false) + for (let i = 0, len = scale * 0.26 / 6; i < len; ++i) spawn.mineBoss(-1327 - 200 * i, -1525, 50, false); } else { if (Math.random() < 0.25) { for (let i = 0, len = scale * 0.25; i < len; ++i) spawn.timeBoss(-1327 - 200 * i, -1525, 80, false); //spawn 1-2 at difficulty 15 @@ -2982,11 +2982,11 @@ const level = { for (let i = 0; i < 9; ++i) powerUps.spawn(1200 + 550 * Math.random(), -1700, "ammo") for (let i = 0; i < 3; ++i) powerUps.spawn(1200 + 550 * Math.random(), -1700, "heal"); const scale = Math.pow(simulation.difficulty, 0.7) //hard around 30, why around 54 - if (Math.random() < 0.07 && simulation.difficulty > 30) { - for (let i = 0, len = scale * 0.25 / 5; i < len; ++i) spawn.timeBoss(1487 + 200 * i, -1525, 60, false); //spawn 1-2 at difficulty 15 - for (let i = 0, len = scale * 0.1 / 5; i < len; ++i) spawn.bounceBoss(1487 + 200 * i, -1525, 80, false); - for (let i = 0, len = scale * 0.15 / 5; i < len; ++i) spawn.sprayBoss(1487 + 200 * i, -1525, 30, false) - for (let i = 0, len = scale * 0.26 / 5; i < len; ++i) spawn.mineBoss(1487 + 200 * i, -1525, 50, false); + if (Math.random() < 0.07 && simulation.difficulty > 35) { + for (let i = 0, len = scale * 0.25 / 6; i < len; ++i) spawn.timeBoss(1487 + 200 * i, -1525, 60, false); //spawn 1-2 at difficulty 15 + for (let i = 0, len = scale * 0.1 / 6; i < len; ++i) spawn.bounceBoss(1487 + 200 * i, -1525, 80, false); + for (let i = 0, len = scale * 0.15 / 6; i < len; ++i) spawn.sprayBoss(1487 + 200 * i, -1525, 30, false) + for (let i = 0, len = scale * 0.26 / 6; i < len; ++i) spawn.mineBoss(1487 + 200 * i, -1525, 50, false); } else { if (Math.random() < 0.25) { for (let i = 0, len = scale * 0.25; i < len; ++i) spawn.timeBoss(1487 + 200 * i, -1525, 80, false); //spawn 1-2 at difficulty 15 diff --git a/js/spawn.js b/js/spawn.js index 93b17ae..50bb7bd 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -339,8 +339,8 @@ const spawn = { me.memory = Infinity; me.hasRunDeathScript = false me.locatePlayer(); - const density = 0.2 - Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger + // const density = 0.2 + Matter.Body.setDensity(me, 0.2); //extra dense //normal is 0.001 //makes effective life much larger // spawn.shield(me, x, y, 1); me.onDeath = function() { if (!this.hasRunDeathScript) { @@ -477,21 +477,28 @@ const spawn = { } }; me.onDamage = function() {}; - me.cycle = 420; + me.cycle = 660; me.endCycle = 780; me.totalCycles = 0 me.mode = 0; me.damageReduction = 0.25 //reset on each new mode + me.pushAway = function(magX = 0.13, magY = 0.05) { + for (let i = 0, len = body.length; i < len; ++i) { //push blocks away horizontally + body[i].force.x += magX * body[i].mass * (body[i].position.x > this.position.x ? 1 : -1) + body[i].force.y -= magY * body[i].mass + } + for (let i = 0, len = bullet.length; i < len; ++i) { //push blocks away horizontally + bullet[i].force.x += magX * bullet[i].mass * (bullet[i].position.x > this.position.x ? 1 : -1) + bullet[i].force.y -= magY * bullet[i].mass + } + for (let i = 0, len = powerUp.length; i < len; ++i) { //push blocks away horizontally + powerUp[i].force.x += magX * powerUp[i].mass * (powerUp[i].position.x > this.position.x ? 1 : -1) + powerUp[i].force.y -= magY * powerUp[i].mass + } + player.force.x += magX * player.mass * (player.position.x > this.position.x ? 1 : -1) + player.force.y -= magY * player.mass + } me.do = function() { - // this.armor(); - // Matter.Body.setPosition(this, { - // x: x, - // y: y - // }); - // Matter.Body.setVelocity(this, { - // x: 0, - // y: 0 - // }); this.modeDo(); //this does different things based on the mode this.checkStatus(); this.cycle++; //switch modes÷ if time isn't paused @@ -501,30 +508,23 @@ const spawn = { this.cycle = 0; this.mode++ this.damageReduction = 0.25 + if (this.totalCycles > 180) this.pushAway(); if (this.mode > 2) { this.mode = 0; this.fill = "#50f"; this.rotateVelocity = Math.abs(this.rotateVelocity) * (player.position.x > this.position.x ? 1 : -1) //rotate so that the player can get away this.modeDo = this.modeLasers //push blocks and player away, since this is the end of suck, and suck causes blocks to fall on the boss and stun it - Matter.Body.scale(this, 10, 10); - Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.scale(this, 1000, 1000); if (!this.isShielded) spawn.shield(this, this.position.x, this.position.y, 1); // regen shield to also prevent stun - for (let i = 0, len = body.length; i < len; ++i) { //push blocks away horizontally - if (body[i].position.x > this.position.x) { - body[i].force.x = 0.5 - } else { - body[i].force.x = -0.5 - } - } } else if (this.mode === 1) { this.fill = "#50f"; // this.fill = "rgb(150,150,255)"; this.modeDo = this.modeSpawns } else if (this.mode === 2) { this.fill = "#000"; this.modeDo = this.modeSuck - Matter.Body.scale(this, 0.1, 0.1); - Matter.Body.setDensity(me, 100 * density); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.scale(this, 0.001, 0.001); + this.damageReduction = 0.000025 } if (tech.isGunCycle) { b.inventoryGun++; @@ -533,10 +533,11 @@ const spawn = { } } } else if (this.mode !== 3) { //all three modes at once + this.pushAway(); this.cycle = 0; - Matter.Body.setDensity(me, 10 * density); //extra dense //normal is 0.001 //makes effective life much larger + this.damageReduction = 0.15 if (this.mode === 2) { - Matter.Body.scale(this, 5, 5); + Matter.Body.scale(this, 500, 500); } else { Matter.Body.scale(this, 0.5, 0.5); } @@ -577,7 +578,7 @@ const spawn = { }); } if (!(this.cycle % 2 * this.spawnInterval) && mob.length < 40) { - const len = (this.totalCycles / 600 + simulation.difficulty / 2 - 30) / 15 + const len = (this.totalCycles / 1000 + simulation.difficulty / 2 - 30) / 15 for (let i = 0; i < len; i++) { spawn.randomLevelBoss(3000 * (simulation.isHorizontalFlipped ? -1 : 1) + 2000 * (Math.random() - 0.5), -1100 + 200 * (Math.random() - 0.5)) } @@ -2667,10 +2668,13 @@ const spawn = { } }, laserTargetingBoss(x, y, radius = 80) { - const color = "#05f" + const color = "#07f" mobs.spawn(x, y, 3, radius, color); let me = mob[mob.length - 1]; me.isBoss = true; + Matter.Body.setDensity(me, 0.004); //extra dense //normal is 0.001 //makes effective life much larger + me.damageReduction = 0.1 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) + me.vertices = Matter.Vertices.rotate(me.vertices, Math.PI, me.position); //make the pointy side of triangle the front Matter.Body.rotate(me, Math.random() * Math.PI * 2); me.accelMag = 0.00018 * Math.sqrt(simulation.accelScale); @@ -2682,18 +2686,15 @@ const spawn = { me.friction = 0; me.lookTorque = 0.000001 * (Math.random() > 0.5 ? -1 : 1); me.fireDir = { x: 0, y: 0 } - Matter.Body.setDensity(me, 0.008); //extra dense //normal is 0.001 //makes effective life much larger spawn.shield(me, x, y, 1); - spawn.spawnOrbitals(me, radius + 200 + 300 * Math.random()) - me.onHit = function() { - //run this function on hitting player - // this.explode(); - }; + // spawn.spawnOrbitals(me, radius + 50 + 100 * Math.random()) + for (let i = 0, len = 2 + 0.3 * Math.sqrt(simulation.difficulty); i < len; i++) spawn.spawnOrbitals(me, radius + 40 + 10 * i, 1); + // me.onHit = function() { }; // spawn.shield(me, x, y, 1); //not working, not sure why me.onDeath = function() { powerUps.spawnBossPowerUp(this.position.x, this.position.y) }; - me.damageReduction = 0.25 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) + me.laserInterval = 100 me.do = function() { // this.armor(); this.seePlayerByLookingAt(); @@ -2702,10 +2703,7 @@ const spawn = { if (this.seePlayer.recall) { //set direction to turn to fire - if (!(simulation.cycle % this.seePlayerFreq)) { - this.fireDir = Vector.normalise(Vector.sub(this.seePlayer.position, this.position)); - // this.fireDir.y -= Math.abs(this.seePlayer.position.x - this.position.x) / 1600; //gives the bullet an arc - } + if (!(simulation.cycle % this.seePlayerFreq)) this.fireDir = Vector.normalise(Vector.sub(this.seePlayer.position, this.position)); //rotate towards fireAngle const angle = this.angle + Math.PI / 2; @@ -2716,90 +2714,95 @@ const spawn = { } else if (c < -threshold) { this.torque -= 0.000004 * this.inertia; } - // if (Math.abs(c) < 0.3) { - // const mag = 0.05 - // this.force.x += mag * Math.cos(this.angle) - // this.force.y += mag * Math.sin(this.angle) - // } - - const vertexCollision = function(v1, v1End, domain) { - for (let i = 0; i < domain.length; ++i) { - let vertices = domain[i].vertices; - const len = vertices.length - 1; - for (let j = 0; j < len; j++) { - results = simulation.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]); + if (simulation.cycle % this.laserInterval > this.laserInterval / 2) { + const vertexCollision = function(v1, v1End, domain) { + for (let i = 0; i < domain.length; ++i) { + let vertices = domain[i].vertices; + const len = vertices.length - 1; + for (let j = 0; j < len; j++) { + results = simulation.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]); + if (results.onLine1 && results.onLine2) { + const dx = v1.x - results.x; + const dy = v1.y - results.y; + const dist2 = dx * dx + dy * dy; + if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) { + best = { + x: results.x, + y: results.y, + dist2: dist2, + who: domain[i], + v1: vertices[j], + v2: vertices[j + 1] + }; + } + } + } + results = simulation.checkLineIntersection(v1, v1End, vertices[0], vertices[len]); if (results.onLine1 && results.onLine2) { const dx = v1.x - results.x; const dy = v1.y - results.y; const dist2 = dx * dx + dy * dy; - if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) { + if (dist2 < best.dist2) { best = { x: results.x, y: results.y, dist2: dist2, who: domain[i], - v1: vertices[j], - v2: vertices[j + 1] + v1: vertices[0], + v2: vertices[len] }; } } } - results = simulation.checkLineIntersection(v1, v1End, vertices[0], vertices[len]); - if (results.onLine1 && results.onLine2) { - const dx = v1.x - results.x; - const dy = v1.y - results.y; - const dist2 = dx * dx + dy * dy; - if (dist2 < best.dist2) { - best = { - x: results.x, - y: results.y, - dist2: dist2, - who: domain[i], - v1: vertices[0], - v2: vertices[len] - }; - } - } + }; + const seeRange = 8000; + best = { + x: null, + y: null, + dist2: Infinity, + who: null, + v1: null, + v2: null + }; + const look = { + x: this.position.x + seeRange * Math.cos(this.angle), + y: this.position.y + seeRange * Math.sin(this.angle) + }; + vertexCollision(this.position, look, map); + vertexCollision(this.position, look, body); + if (!m.isCloak) vertexCollision(this.position, look, [playerBody, playerHead]); + + // hitting player + if ((best.who === playerBody || best.who === playerHead) && m.immuneCycle < m.cycle) { + const dmg = 0.006 * simulation.dmgScale; + m.damage(dmg); + //draw damage + ctx.fillStyle = color; + ctx.beginPath(); + ctx.arc(best.x, best.y, dmg * 1500, 0, 2 * Math.PI); + ctx.fill(); } - }; - - const seeRange = 8000; - best = { - x: null, - y: null, - dist2: Infinity, - who: null, - v1: null, - v2: null - }; - const look = { - x: this.position.x + seeRange * Math.cos(this.angle), - y: this.position.y + seeRange * Math.sin(this.angle) - }; - vertexCollision(this.position, look, map); - vertexCollision(this.position, look, body); - if (!m.isCloak) vertexCollision(this.position, look, [playerBody, playerHead]); - - // hitting player - if ((best.who === playerBody || best.who === playerHead) && m.immuneCycle < m.cycle) { - const dmg = 0.002 * simulation.dmgScale; - m.damage(dmg); - //draw damage - ctx.fillStyle = color; + //draw beam + if (best.dist2 === Infinity) best = look; ctx.beginPath(); - ctx.arc(best.x, best.y, dmg * 10000, 0, 2 * Math.PI); + ctx.moveTo(this.vertices[1].x, this.vertices[1].y); + ctx.lineTo(best.x, best.y); + ctx.strokeStyle = color; + ctx.lineWidth = 3; + ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]); + ctx.stroke(); + ctx.setLineDash([]); + + ctx.beginPath(); + ctx.arc(this.vertices[1].x, this.vertices[1].y, 1 + 0.3 * (this.laserInterval - simulation.cycle % this.laserInterval), 0, 2 * Math.PI); //* this.fireCycle / this.fireDelay + ctx.fillStyle = color; + ctx.fill(); + } else { + ctx.beginPath(); + ctx.arc(this.vertices[1].x, this.vertices[1].y, 1 + 0.3 * (simulation.cycle % this.laserInterval), 0, 2 * Math.PI); //* this.fireCycle / this.fireDelay + ctx.fillStyle = color; ctx.fill(); } - //draw beam - if (best.dist2 === Infinity) best = look; - ctx.beginPath(); - ctx.moveTo(this.vertices[1].x, this.vertices[1].y); - ctx.lineTo(best.x, best.y); - ctx.strokeStyle = color; - ctx.lineWidth = 3; - ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]); - ctx.stroke(); - ctx.setLineDash([]); } }; }, @@ -2959,8 +2962,9 @@ const spawn = { mobs.spawn(x, y, 5, 50, "rgb(0,235,255)"); //"rgb(221,102,119)" let me = mob[mob.length - 1]; Matter.Body.rotate(me, Math.PI * 0.1); - Matter.Body.setDensity(me, 0.018); //extra dense //normal is 0.001 //makes effective life much larger + Matter.Body.setDensity(me, 0.003); //extra dense //normal is 0.001 //makes effective life much larger me.isBoss = true; + me.damageReduction = 0.04 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.frictionStatic = 0; me.friction = 0; @@ -2994,7 +2998,6 @@ const spawn = { } powerUps.spawnBossPowerUp(this.position.x, this.position.y) } - me.damageReduction = 0.25 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.do = function() { // this.armor(); this.seePlayerByHistory() @@ -3695,13 +3698,13 @@ const spawn = { let me = mob[mob.length - 1]; me.isBoss = true; me.inertia = Infinity; //no rotation - me.burstFireFreq = 22 + Math.floor(15 * simulation.CDScale) - me.burstTotalPhases = 3.5 + Math.floor(1.5 / simulation.CDScale) + me.burstFireFreq = 22 + Math.floor(13 * simulation.CDScale) + me.burstTotalPhases = 3 + Math.floor(1.4 / simulation.CDScale) me.frictionStatic = 0; me.friction = 0; me.frictionAir = 0; me.restitution = 1 - spawn.spawnOrbitals(me, radius + 50 + 125 * Math.random(), 1) + // spawn.spawnOrbitals(me, radius + 50 + 125 * Math.random(), 1) Matter.Body.setDensity(me, 0.002 + 0.0001 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger me.damageReduction = 0.09 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.startingDamageReduction = me.damageReduction @@ -3744,8 +3747,8 @@ const spawn = { if (this.speed < 0.01) { Matter.Body.setVelocity(this, Vector.mult(Vector.normalise(Vector.sub(player.position, this.position)), 0.1)); } else { - if (Math.abs(this.velocity.y) < 10) Matter.Body.setVelocity(this, { x: this.velocity.x, y: this.velocity.y * 1.05 }); - if (Math.abs(this.velocity.x) < 8) Matter.Body.setVelocity(this, { x: this.velocity.x * 1.05, y: this.velocity.y }); + if (Math.abs(this.velocity.y) < 9) Matter.Body.setVelocity(this, { x: this.velocity.x, y: this.velocity.y * 1.03 }); + if (Math.abs(this.velocity.x) < 7) Matter.Body.setVelocity(this, { x: this.velocity.x * 1.03, y: this.velocity.y }); } } me.burstFire = function() { @@ -3798,10 +3801,10 @@ const spawn = { // Matter.Body.rotate(me, 2 * Math.PI * Math.random()); me.isBoss = true; Matter.Body.setDensity(me, 0.001); //normal is 0.001 - me.inertia = Infinity; me.damageReduction = 0.04 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.startingDamageReduction = me.damageReduction me.isInvulnerable = false + me.inertia = Infinity; me.frictionAir = 0.01 me.restitution = 1 me.friction = 0 @@ -3858,10 +3861,10 @@ const spawn = { // this.isInvulnerable = true // this.damageReduction = 0 } else { - if (Math.abs(this.velocity.y) < 11) { + if (Math.abs(this.velocity.y) < 10) { Matter.Body.setVelocity(this, { x: this.velocity.x, y: this.velocity.y * 1.03 }); } - if (Math.abs(this.velocity.x) < 8) { + if (Math.abs(this.velocity.x) < 7) { Matter.Body.setVelocity(this, { x: this.velocity.x * 1.03, y: this.velocity.y }); } } @@ -3926,7 +3929,7 @@ const spawn = { this.death(); //hit player if (Vector.magnitude(Vector.sub(this.position, player.position)) < this.explodeRange && m.immuneCycle < m.cycle) { - m.damage(0.015 * simulation.dmgScale * (tech.isRadioactiveResistance ? 0.25 : 1)); + m.damage(0.01 * simulation.dmgScale * (tech.isRadioactiveResistance ? 0.25 : 1)); m.energy -= 0.15 * (tech.isRadioactiveResistance ? 0.25 : 1) if (m.energy < 0) m.energy = 0 } @@ -3954,9 +3957,9 @@ const spawn = { Matter.Body.rotate(me, 2 * Math.PI * Math.random()); me.isBoss = true; Matter.Body.setDensity(me, 0.003); //normal is 0.001 - me.inertia = Infinity; me.damageReduction = 0.1 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.startingDamageReduction = me.damageReduction + me.inertia = Infinity; me.isInvulnerable = false me.frictionAir = 0.01 me.restitution = 1 @@ -4036,7 +4039,7 @@ const spawn = { me.isBoss = true; Matter.Body.setDensity(me, 0.001); //normal is 0.001 me.inertia = Infinity; - me.damageReduction = 0.06 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) + me.damageReduction = 0.05 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.startingDamageReduction = me.damageReduction me.isInvulnerable = false me.frictionAir = 0.01 @@ -4045,8 +4048,8 @@ const spawn = { me.collisionFilter.mask = cat.bullet | cat.player | cat.body | cat.map | cat.mob Matter.Body.setVelocity(me, { x: 10 * (Math.random() - 0.5), y: 10 * (Math.random() - 0.5) }); me.seePlayer.recall = 1; - spawn.spawnOrbitals(me, radius + 25, 1) - + // for (let i = 0; i < 4; i++) spawn.spawnOrbitals(me, radius + 25, 1) + for (let i = 0, len = 2 + 0.3 * Math.sqrt(simulation.difficulty); i < len; i++) spawn.spawnOrbitals(me, radius + 10 + 10 * i, 1); // me.skipRate = 1 + Math.floor(simulation.difficulty*0.02) // spawn.shield(me, x, y, 1); @@ -4054,7 +4057,7 @@ const spawn = { if (this.health < this.nextHealthThreshold) { this.health = this.nextHealthThreshold - 0.01 this.nextHealthThreshold = Math.floor(this.health * 4) / 4 //0.75,0.5,0.25 - this.invulnerableCount = 300 + simulation.difficulty * 4 //how long does invulnerable time last + this.invulnerableCount = 420 + simulation.difficulty * 5 //how long does invulnerable time last this.isInvulnerable = true this.damageReduction = 0 // requestAnimationFrame(() => { simulation.timePlayerSkip(300) }); //wrapping in animation frame prevents errors, probably @@ -4091,7 +4094,10 @@ const spawn = { } //time dilation if (!simulation.isTimeSkipping) { - requestAnimationFrame(() => { simulation.timePlayerSkip(3) }); //wrapping in animation frame prevents errors, probably + requestAnimationFrame(() => { + simulation.timePlayerSkip(2) + m.walk_cycle += m.flipLegs * m.Vx //makes the legs look like they are moving fast + }); //wrapping in animation frame prevents errors, probably // if (!(simulation.cycle % 10)) //draw invulnerable @@ -4121,7 +4127,7 @@ const spawn = { mobs.spawn(x, y, sides, radius, "rgb(255,0,155)"); let me = mob[mob.length - 1]; me.stroke = "transparent"; - Matter.Body.setDensity(me, 0.00003); //normal is 0.001 + Matter.Body.setDensity(me, 0.00001); //normal is 0.001 me.timeLeft = 360 + Math.floor(180 * Math.random()) me.inertia = Infinity; me.damageReduction = 1 @@ -4676,35 +4682,28 @@ const spawn = { }, 2000); //add in a delay in case the level gets flipped left right me.isBoss = true; + Matter.Body.setDensity(me, 0.008 + 0.0003 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger + me.damageReduction = 0.25 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.vertices = Matter.Vertices.rotate(me.vertices, Math.PI, me.position); //make the pointy side of triangle the front me.isVerticesChange = true me.memory = 240; - // me.homePosition = { - // x: x, - // y: y - // }; me.fireFreq = 0.025; me.noseLength = 0; me.fireAngle = 0; me.accelMag = 0.005 * simulation.accelScale; me.frictionAir = 0.05; me.lookTorque = 0.000006 * (Math.random() > 0.5 ? -1 : 1); - me.fireDir = { - x: 0, - y: 0 - }; + me.fireDir = { x: 0, y: 0 }; setTimeout(() => { - spawn.spawnOrbitals(me, radius + 25, 1); - spawn.spawnOrbitals(me, radius + 75, 1); + // spawn.spawnOrbitals(me, radius + 200 + 50 * Math.random(), 1); + for (let i = 0, len = 3 + 0.5 * Math.sqrt(simulation.difficulty); i < len; i++) spawn.spawnOrbitals(me, radius + 40 + 10 * i, 1); + }, 100); //have to wait a sec so the tether constraint doesn't attach to an orbital - Matter.Body.setDensity(me, 0.008 + 0.0003 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger me.onDeath = function() { if (isSpawnBossPowerUp) powerUps.spawnBossPowerUp(this.position.x, this.position.y) // this.vertices = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //helps collisions functions work better after vertex have been changed }; - - me.damageReduction = 0.25 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.do = function() { // this.armor(); this.seePlayerByLookingAt(); @@ -5961,8 +5960,9 @@ const spawn = { if (Math.random() < chance) { // simulation.difficulty = 50 const len = Math.floor(Math.min(15, 3 + Math.sqrt(simulation.difficulty))) // simulation.difficulty = 40 on hard mode level 10 - const speed = (0.007 + 0.003 * Math.random() + 0.004 * Math.sqrt(simulation.difficulty)) * ((Math.random() < 0.5) ? 1 : -1) - for (let i = 0; i < len; i++) spawn.orbital(who, radius, i / len * 2 * Math.PI, speed) + const speed = (0.003 + 0.004 * Math.random() + 0.002 * Math.sqrt(simulation.difficulty)) * ((Math.random() < 0.5) ? 1 : -1) + const offSet = 6.28 * Math.random() + for (let i = 0; i < len; i++) spawn.orbital(who, radius, i / len * 2 * Math.PI + offSet, speed) } }, orbital(who, radius, phase, speed) { @@ -5970,7 +5970,7 @@ const spawn = { mobs.spawn(who.position.x, who.position.y, 8, 12, "rgb(255,0,150)"); let me = mob[mob.length - 1]; me.stroke = "transparent"; - Matter.Body.setDensity(me, 0.1); //normal is 0.001 + Matter.Body.setDensity(me, 0.01); //normal is 0.001 me.leaveBody = false; me.isDropPowerUp = false; me.isBadTarget = true; @@ -5996,7 +5996,7 @@ const spawn = { //damage player if (Matter.Query.collides(this, [player]).length > 0 && !(m.isCloak && tech.isIntangible) && m.immuneCycle < m.cycle) { m.immuneCycle = m.cycle + tech.collisionImmuneCycles; //player is immune to damage for 30 cycles - const dmg = 0.035 * simulation.dmgScale + const dmg = 0.03 * simulation.dmgScale m.damage(dmg); simulation.drawList.push({ //add dmg to draw queue x: this.position.x, @@ -6016,17 +6016,19 @@ const spawn = { let me = mob[mob.length - 1]; me.isBoss = true; Matter.Body.setDensity(me, 0.0017 + 0.0002 * Math.sqrt(simulation.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger + me.damageReduction = 0.1 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) + me.stroke = "transparent"; //used for drawGhost me.seeAtDistance2 = 2000000; me.collisionFilter.mask = cat.bullet | cat.player | cat.body | cat.map me.memory = Infinity; me.frictionAir = 0.04; - me.accelMag = 0.0007 * simulation.accelScale + me.accelMag = 0.0002 + 0.00015 * simulation.accelScale spawn.shield(me, x, y, 1); const rangeInnerVsOuter = Math.random() - let speed = (0.009 + 0.0011 * Math.sqrt(simulation.difficulty)) * ((Math.random() < 0.5) ? 1 : -1) - let range = radius + 300 + 200 * rangeInnerVsOuter + nodes * 7 + let speed = (0.006 + 0.001 * Math.sqrt(simulation.difficulty)) * ((Math.random() < 0.5) ? 1 : -1) + let range = radius + 350 + 200 * rangeInnerVsOuter + nodes * 7 for (let i = 0; i < nodes; i++) spawn.orbital(me, range, i / nodes * 2 * Math.PI, speed) const orbitalIndexes = [] //find indexes for all the current nodes for (let i = 0; i < nodes; i++) orbitalIndexes.push(mob.length - 1 - i) @@ -6037,10 +6039,11 @@ const spawn = { for (let j = 0; j < nodes; j++) { for (let i = 0, len = subNodes; i < len; i++) spawn.orbital(mob[orbitalIndexes[j]], range, i / len * 2 * Math.PI, speed) } + for (let i = 0, len = 3 + 0.5 * Math.sqrt(simulation.difficulty); i < len; i++) spawn.spawnOrbitals(me, radius + 40 + 10 * i, 1); + me.onDeath = function() { powerUps.spawnBossPowerUp(this.position.x, this.position.y) }; - me.damageReduction = 0.18 / (tech.isScaleMobsWithDuplication ? 1 + tech.duplicationChance() : 1) me.do = function() { this.seePlayerByHistory(); this.checkStatus(); diff --git a/js/tech.js b/js/tech.js index 28c4031..f47aed5 100644 --- a/js/tech.js +++ b/js/tech.js @@ -234,25 +234,25 @@ const tech = { if (tech.isEnergyLoss) dmg *= 1.55 if (tech.OccamDamage) dmg *= tech.OccamDamage if (tech.isTechDebt) dmg *= Math.max(41 / (tech.totalCount + 21), 4 - 0.15 * tech.totalCount) - if (tech.isAxion && tech.isHarmMACHO) dmg *= 2 - m.harmReduction() if (tech.isFlipFlopDamage && tech.isFlipFlopOn) dmg *= 1.555 if (tech.isAnthropicDamage && tech.isDeathAvoidedThisLevel) dmg *= 2.3703599 if (tech.isDupDamage) dmg *= 1 + Math.min(1, tech.duplicationChance()) - if (tech.isLowEnergyDamage) dmg *= 1 + 0.7 * Math.max(0, 1 - m.energy) if (tech.isDamageForGuns) dmg *= 1 + 0.13 * b.inventory.length if (tech.isLowHealthDmg) dmg *= 1 + Math.max(0, 1 - m.health) * 0.5 if (tech.isHarmDamage && m.lastHarmCycle + 600 > m.cycle) dmg *= 3; + if (tech.isOneGun && b.inventory.length < 2) dmg *= 1.25 if (tech.isAcidDmg && m.health > 1) dmg *= 1.35; + if (tech.isRerollDamage) dmg *= 1 + 0.038 * powerUps.research.count + if (tech.isBotDamage) dmg *= 1 + 0.06 * b.totalBots() if (tech.restDamage > 1 && player.speed < 1) dmg *= tech.restDamage + if (tech.isLowEnergyDamage) dmg *= 1 + 0.7 * Math.max(0, 1 - m.energy) if (tech.isEnergyDamage) dmg *= 1 + m.energy * 0.125; if (tech.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.007 - if (tech.isRerollDamage) dmg *= 1 + 0.038 * powerUps.research.count - if (tech.isOneGun && b.inventory.length < 2) dmg *= 1.25 if (tech.isNoFireDamage && m.cycle > m.fireCDcycle + 120) dmg *= 2 if (tech.isSpeedDamage) dmg *= 1 + Math.min(0.66, player.speed * 0.0165) - if (tech.isBotDamage) dmg *= 1 + 0.06 * b.totalBots() if (tech.isDamageAfterKillNoRegen && m.lastKillCycle + 300 > m.cycle) dmg *= 1.6 if (m.isSneakAttack && m.cycle > m.lastKillCycle + 240) dmg *= tech.sneakAttackDmg + if (tech.isAxion && tech.isHarmMACHO) dmg *= 2 - m.harmReduction() return dmg * tech.slowFire * tech.aimDamage }, duplicationChance() { @@ -4255,7 +4255,7 @@ const tech = { frequency: 1, frequencyDefault: 1, allowed() { - return (tech.haveGunCheck("shotgun") && !tech.isNailShot && !tech.isIceShot && !tech.isRivets && !tech.isFoamShot && !tech.isSporeWorm && !tech.isSporeFlea && !tech.isNeedles) || (tech.haveGunCheck("super balls") && !tech.isFoamBall) || (tech.isRivets && !tech.isNailCrit) || (m.fieldUpgrades[m.fieldMode].name === "molecular assembler" && simulation.molecularMode === 1) || (tech.haveGunCheck("drones") && !tech.isForeverDrones && !tech.isDroneRadioactive && !tech.isDroneTeleport) + return (tech.haveGunCheck("shotgun") && !tech.isNailShot && !tech.isIceShot && !tech.isRivets && !tech.isFoamShot && !tech.isSporeWorm && !tech.isSporeFlea && !tech.isNeedles) || (tech.haveGunCheck("super balls") && !tech.isFoamBall) || (tech.isRivets && !tech.isNailCrit) || (m.fieldUpgrades[m.fieldMode].name === "molecular assembler" && simulation.molecularMode === 3) || (tech.haveGunCheck("drones") && !tech.isForeverDrones && !tech.isDroneRadioactive && !tech.isDroneTeleport) }, requires: "shotgun, super balls, rivets, drones, not irradiated drones, burst drones, polyurethane", effect() { diff --git a/todo.txt b/todo.txt index 497df36..35ee9e5 100644 --- a/todo.txt +++ b/todo.txt @@ -1,36 +1,46 @@ ******************************************************** NEXT PATCH ************************************************** -siphonaptera makes shotgun fire fleas -colony 37% -> 50% more stuff in sporangium -foam bullets have a +7% slow effect - about +7% damage for some foam tech -laser diode 33% -> 40% less energy cost -free-electron laser 200% -> 225% damage +finalBoss pushes away things between every phase + it's much smaller in black hole phase and very hard to hit -extra clicks in experiment and unified field theory pause now switches molecular fab types +timeBoss, shooterBoss, orbitalBoss, laserTargetingBoss have "orbital armor" + orbitals have less health and move a bit slower + orbitalBoss is slower and has more health +blinkBoss does much less collision damage +laserTargetingBoss does 2.5x damage but it's laser is only on 1/2 the time -bug fixes - mob stun graphics is more consistent and less like mob invincibility +URL builds share what mode molecular assembler is on *********************************************************** TODO ***************************************************** +make final Boss hidden for the mob spawning phase? + +tech for molecular assembler that generates research? + +show damage and defense in game? + defense and damage without difficulty included? + update every: 15 cycles?, 30?, 10? + make a m.damage variable that stores the player damage for all slow changing tech + update m.damage variable when: + new tech + flipFlip triggers + duplicationChance changes + add or remove guns + player health changes + research changes + bot count changes + tech ______ effect that last until you get hit field or bots can check your health every cycle and see if it lower if it's high update the health check value effect: +damage until getting hit for cloaking field -fleas - add very short (2 cycle) delay after each landing -> hop - zero velocity while on short delay? try it? - flea tech: - add a delay to flea jumping also +dmg - make plasma ball power up and block pick up still work when you have no no energy make a unique CD var for plasma ball? -wormhole tech: entropic gravity - gain defense for each research - requires wormhole or negative mass field or pilot wave +tech: entropic gravity - gain defense for each research + requires wormhole or pilot wave or negative mass field? testChamber2 mechanics