From d81eff43fceb1a38f942f8e239399cad3e462074 Mon Sep 17 00:00:00 2001 From: landgreen Date: Mon, 4 Oct 2021 05:37:03 -0700 Subject: [PATCH] slashBoss new boss: slasherBoss - radially waving short distance lasers aerogel 250%->150% foam damage bug fixes --- .DS_Store | Bin 6148 -> 6148 bytes js/bullet.js | 2 +- js/level.js | 12 +++--- js/player.js | 2 +- js/spawn.js | 107 +++++++++++++++++++++++++++++++++++++++++++++++---- js/tech.js | 4 +- todo.txt | 13 ++++--- 7 files changed, 116 insertions(+), 24 deletions(-) diff --git a/.DS_Store b/.DS_Store index f787002ddd9a5ef85b0d65bd6a54b32e9cf290e1..43348f1006eebd247f3ce0e4968296ffefe11894 100644 GIT binary patch delta 21 ccmZoMXffEJ#mtnlcCrq$A7jJjYUWN6087&bxBvhE delta 21 ccmZoMXffEJ#mp4&b+Qh#AEUwMYUWN608CE?oB#j- diff --git a/js/bullet.js b/js/bullet.js index 05c5a5e..b099ac9 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -2835,7 +2835,7 @@ const b = { inertia: Infinity, frictionAir: 0.003, dmg: 0, //damage on impact - damage: (tech.isFastFoam ? 0.033 : 0.011) * (tech.isBulletTeleport ? 1.43 : 1), //damage done over time + damage: (tech.isFastFoam ? 0.0275 : 0.011) * (tech.isBulletTeleport ? 1.43 : 1), //damage done over time scale: 1 - 0.006 / tech.isBulletsLastLonger * (tech.isFastFoam ? 1.65 : 1), classType: "bullet", collisionFilter: { diff --git a/js/level.js b/js/level.js index 1e492ec..017b440 100644 --- a/js/level.js +++ b/js/level.js @@ -15,7 +15,7 @@ const level = { // localSettings.levelsClearedLastGame = 10 // level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why // simulation.isHorizontalFlipped = true - // m.setField("time dilation") + // m.setField("pilot wave") // b.giveGuns("harpoon") // tech.giveTech("toggling harpoon") // tech.giveTech("filament") @@ -1623,14 +1623,14 @@ const level = { spawn.mapRect(x + 550, y + -10 - 640, 900, 25); //raised floor spawn.mapRect(x + 450, y + -20 - 640, 1100, 25); spawn.mapRect(x + 450, y + -675 - 640, 1100, 25); //chamber ceiling - powerUps.spawn(x + 998, y - 333 - 640, "tech", false); + powerUps.directSpawn(x + 998, y - 333 - 640, "tech", false); spawn.mapVertex(x + 1000, y + -0, "575 0 -575 0 -450 -100 450 -100"); //base } else { //lower chamber spawn.mapRect(x + 400, y + -10, 1200, 50); //raised floor spawn.mapRect(x + 450, y + -20, 1100, 50); spawn.mapRect(x + 450, y + -675, 1100, 25); //chamber ceiling spawn.mapRect(x + 550, y + -685, 900, 25); - powerUps.spawn(x + 998, y - 333, "tech", false); + powerUps.directSpawn(x + 998, y - 333, "tech", false); } const powerUp1 = powerUp[powerUp.length - 1] powerUp1.holdPosition = { x: powerUp1.position.x, y: powerUp1.position.y } @@ -2300,13 +2300,13 @@ const level = { // spawn.laserBombingBoss(1900, -500) // for (let i = 0; i < 5; i++) spawn.focuser(1900, -500) - spawn.slasher(1900, -500) - // spawn.sneaker(1900, -500, 200) + spawn.slashBoss(1900, -500) + // spawn.ghoster(1900, -500, 200) // spawn.shield(mob[mob.length - 1], 1900, -500, 1); // mob[mob.length - 1].isShielded = true // spawn.growBossCulture(1200, -500) // spawn.laserTargetingBoss(1600, -400) - // spawn.focuser(1600, -500) + // spawn.blinkBoss(1600, -500) // spawn.laserTargetingBoss(1700, -120) // spawn.bomberBoss(1400, -500) // spawn.laser(1800, -120) diff --git a/js/player.js b/js/player.js index 7333ab4..743b340 100644 --- a/js/player.js +++ b/js/player.js @@ -2385,7 +2385,7 @@ const m = { // }, { name: "pilot wave", - description: "use energy to push blocks with your mouse
blocks can collide with intangible mobs
field radius decreases out of line of sight", + description: "use energy to push blocks with your mouse
blocks can't collide with intangible mobs
field radius decreases out of line of sight", effect: () => { m.fieldPhase = 0; m.fieldPosition = { diff --git a/js/spawn.js b/js/spawn.js index 74bce3b..6046699 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -1,8 +1,8 @@ //main object for spawning things in a level const spawn = { nonCollideBossList: ["cellBossCulture", "bomberBoss", "powerUpBoss", "orbitalBoss", "spawnerBossCulture", "growBossCulture"], - randomLevelBoss(x, y, options = ["shieldingBoss", "orbitalBoss", "historyBoss", "shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss", "powerUpBoss", "snakeBoss", "streamBoss", "pulsarBoss", "spawnerBossCulture", "grenadierBoss", "growBossCulture", "blinkBoss", "snakeSpitBoss", "laserBombingBoss", "blockBoss"]) { - // other bosses: suckerBoss, laserBoss, tetherBoss, //these need a particular level to work so they are not included in the random pool + // other bosses: suckerBoss, laserBoss, tetherBoss, //these need a particular level to work so they are not included in the random pool + randomLevelBoss(x, y, options = ["shieldingBoss", "orbitalBoss", "historyBoss", "shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss", "powerUpBoss", "snakeBoss", "streamBoss", "pulsarBoss", "spawnerBossCulture", "grenadierBoss", "growBossCulture", "blinkBoss", "snakeSpitBoss", "laserBombingBoss", "blockBoss", "slashBoss"]) { spawn[options[Math.floor(Math.random() * options.length)]](x, y) }, pickList: ["starter", "starter"], @@ -2644,7 +2644,6 @@ const spawn = { Composite.add(engine.world, me.constraint); }, 2000); //add in a delay in case the level gets flipped left right - me.isBoss = true; // me.startingPosition = { // x: x, @@ -2655,13 +2654,15 @@ const spawn = { // me.torque -= me.inertia * 0.002 spawn.spawnOrbitals(me, radius + 50 + 200 * Math.random()) Matter.Body.setDensity(me, 0.03); //extra dense //normal is 0.001 //makes effective life much larger + me.damageReduction = 0.25 + me.isBoss = true; + // spawn.shield(me, x, y, 1); //not working, not sure why me.onDeath = function() { powerUps.spawnBossPowerUp(this.position.x, this.position.y) }; me.rotateVelocity = Math.min(0.0045, 0.0015 * simulation.accelScale * simulation.accelScale) * (level.levelsCleared > 8 ? 1 : -1) * (simulation.isHorizontalFlipped ? -1 : 1) - me.damageReduction = 0.25 me.do = function() { // this.armor(); this.fill = '#' + Math.random().toString(16).substr(-6); //flash colors @@ -2912,11 +2913,99 @@ const spawn = { } }; }, + slashBoss(x, y, radius = 70) { + const sides = 9 + Math.floor(Math.min(12, 0.2 * simulation.difficulty)) + const coolBends = [-1.8, 0, 0, 0.9, 1.2] + const bendFactor = coolBends[Math.floor(Math.random() * coolBends.length)]; + mobs.spawn(x, y, sides, radius, "rgb(201,202,225)"); + let me = mob[mob.length - 1]; + Matter.Body.rotate(me, 2 * Math.PI * Math.random()); + me.accelMag = 0.00037 * Math.sqrt(simulation.accelScale); + me.frictionAir = 0.01; + me.swordRadiusMax = 450 + 7 * simulation.difficulty; + me.laserAngle = 0; + me.swordDamage = 0.0015 * simulation.dmgScale + + spawn.shield(me, x, y, 1); + Matter.Body.setDensity(me, 0.005); //extra dense //normal is 0.001 //makes effective life much larger + me.damageReduction = 0.12 + me.isBoss = true; + me.onDamage = function() {}; + me.onDeath = function() { + powerUps.spawnBossPowerUp(this.position.x, this.position.y) + }; + me.do = function() { + this.checkStatus(); + this.seePlayerByHistory(60); + this.attraction(); + //traveling laser + if (!m.isBodiesAsleep) this.laserAngle += 0.03 + for (let i = 0, len = this.vertices.length; i < len; i++) { + // this.laserSword(this.vertices[1], this.angle + laserAngle); + const bend = bendFactor * Math.cos(this.laserAngle + 2 * Math.PI * i / len) + const long = this.swordRadiusMax * Math.sin(this.laserAngle + 2 * Math.PI * i / len) + if (long > 0) this.laserSword(this.vertices[i], bend + this.angle + (i + 0.5) / sides * 2 * Math.PI, Math.abs(long)); + } + }; + me.laserSword = function(where, angle, length) { + 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) best = { x: results.x, y: results.y, dist2: dist2, who: domain[i], v1: vertices[0], v2: vertices[len] }; + } + } + }; + best = { x: null, y: null, dist2: Infinity, who: null, v1: null, v2: null }; + const look = { x: where.x + length * Math.cos(angle), y: where.y + length * Math.sin(angle) }; + // vertexCollision(where, look, body); // vertexCollision(where, look, mob); + vertexCollision(where, look, map); + if (!m.isCloak) vertexCollision(where, look, [playerBody, playerHead]); + if (best.who && (best.who === playerBody || best.who === playerHead) && m.immuneCycle < m.cycle) { + // m.immuneCycle = m.cycle + tech.collisionImmuneCycles + 60; //player is immune to damage for an extra second + m.damage(this.swordDamage); + simulation.drawList.push({ //add dmg to draw queue + x: best.x, + y: best.y, + radius: this.swordDamage * 1500, + color: "rgba(80,0,255,0.5)", + time: 20 + }); + } + if (best.dist2 === Infinity) best = look; + ctx.beginPath(); //draw beam + ctx.moveTo(where.x, where.y); + ctx.lineTo(best.x, best.y); + ctx.strokeStyle = "rgba(100,100,255,0.1)"; // Purple path + ctx.lineWidth = 10; + ctx.stroke(); + ctx.strokeStyle = "rgba(100,100,255,0.5)"; // Purple path + ctx.lineWidth = 2; + // ctx.stroke(); + ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]); + ctx.stroke(); // Draw it + ctx.setLineDash([]); + } + }, slasher(x, y, radius = 36 + Math.ceil(Math.random() * 25)) { mobs.spawn(x, y, 5, radius, "rgb(201,202,225)"); let me = mob[mob.length - 1]; Matter.Body.rotate(me, 2 * Math.PI * Math.random()); - me.accelMag = 0.00085 * simulation.accelScale; + me.accelMag = 0.0008 * simulation.accelScale; me.torqueMagnitude = 0.00002 * me.inertia * (Math.random() > 0.5 ? -1 : 1); me.frictionStatic = 0; me.friction = 0; @@ -2925,9 +3014,9 @@ const spawn = { me.cd = 0; me.swordRadius = 0; me.swordRadiusMax = 350 + 5 * simulation.difficulty; - me.swordRadiusGrowRate = me.swordRadiusMax * (0.02 + 0.0008 * simulation.difficulty) + me.swordRadiusGrowRate = me.swordRadiusMax * (0.018 + 0.0006 * simulation.difficulty) me.isSlashing = false; - me.swordDamage = 0.07 * simulation.dmgScale + me.swordDamage = 0.05 * simulation.dmgScale const laserAngle = 3 * Math.PI / 5 const seeDistance2 = 200000 spawn.shield(me, x, y); @@ -3020,7 +3109,9 @@ const spawn = { ctx.stroke(); ctx.strokeStyle = "rgba(100,100,255,0.5)"; // Purple path ctx.lineWidth = 4; - ctx.stroke(); + ctx.setLineDash([70 + 300 * Math.random(), 55 * Math.random()]); + ctx.stroke(); // Draw it + ctx.setLineDash([]); } }, sneaker(x, y, radius = 15 + Math.ceil(Math.random() * 10)) { diff --git a/js/tech.js b/js/tech.js index 2e54e1b..9890536 100644 --- a/js/tech.js +++ b/js/tech.js @@ -637,7 +637,7 @@ }, { name: "kinetic bombardment", - description: "increase damage by up to 33%
at a distance of 40 steps from the target", + description: "increase damage by up to 33% at a distance
of up to 50 player widths from the target", maxCount: 1, count: 0, frequency: 2, @@ -4932,7 +4932,7 @@ }, { name: "aerogel", - description: "foam bubbles float and dissipate 50% faster
increase foam damage per second by 200%", + description: "foam bubbles float and dissipate 50% faster
increase foam damage per second by 150%", isGunTech: true, maxCount: 1, count: 0, diff --git a/todo.txt b/todo.txt index 471d34b..0b81b17 100644 --- a/todo.txt +++ b/todo.txt @@ -1,17 +1,18 @@ ******************************************************** NEXT PATCH ************************************************** -new mob: slasher - it's basically a jedi +new boss: slasherBoss - radially waving short distance lasers -harpoon: +33% damage, +33% delay after firing -time dilation reverted 50% -> 0% collision harm reduction -time dilation can no longer get tech: symbiosis -nano-scale: can access tokamak and discrete optimization -cache: 11x -> 13x ammo +aerogel 250%->150% foam damage bug fixes ******************************************************** TODO ******************************************************** +slasherBoss + sine wave of lasers that travel around vertexes + 10+ sided + low laser damage, but it doesn't trigger damage immunity + slasher compute fastest direction to rotate towards player cross product