From 62b9d974b4fb0f40ee47ec34852f989975eba30b Mon Sep 17 00:00:00 2001 From: landgreen Date: Wed, 29 Sep 2021 06:27:40 -0700 Subject: [PATCH] duplication animation blackhole mobs can no longer see past stealth adding dup chance has graphics now bug fixes --- .DS_Store | Bin 6148 -> 6148 bytes js/bullet.js | 13 +++++++------ js/index.js | 1 + js/level.js | 7 ++++--- js/mob.js | 2 +- js/player.js | 14 +++++++------- js/powerup.js | 3 ++- js/simulation.js | 37 ++++++++++++++++++++++++++++++++++++- js/spawn.js | 18 +++++++++--------- js/tech.js | 10 +++++++--- todo.txt | 11 +++-------- 11 files changed, 77 insertions(+), 39 deletions(-) diff --git a/.DS_Store b/.DS_Store index 6b8e825d0fe2982b9d2bed16323d3694d30dcbe7..babae7abd3072f5715fa7ddcad9223c8f7ddca45 100644 GIT binary patch delta 21 ccmZoMXffEJ#muDtaIy}wALEA2)y$nD08Fw5=Kufz delta 21 ccmZoMXffEJ#muC(a -1; i--) { //draw wave @@ -4506,7 +4507,7 @@ const b = { ctx.lineWidth = 2 * tech.wavePacketDamage ctx.beginPath(); const end = 1100 * tech.isBulletsLastLonger / Math.sqrt(tech.waveReflections * 0.5) //should equal about 1767 - const damage = 2 * b.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.5 : 1) //damage is lower for large radius mobs, since they feel the waves longer + const damage = 2 * b.dmgScale * tech.wavePacketDamage * tech.waveBeamDamage * (tech.isBulletTeleport ? 1.43 : 1) //damage is lower for large radius mobs, since they feel the waves longer for (let i = this.waves.length - 1; i > -1; i--) { const v1 = Vector.add(this.waves[i].position, Vector.mult(this.waves[i].unit1, this.waves[i].radius)) @@ -4621,7 +4622,7 @@ const b = { slow: 0, amplitude: (input.down ? 5 : 10) * ((this.wavePacketCycle % 2) ? -1 : 1) * Math.sin((this.wavePacketCycle + 1) * 0.088), //0.0968 //0.1012 //0.11 //0.088 //shorten wave packet minDmgSpeed: 0, - dmg: b.dmgScale * tech.waveBeamDamage * tech.wavePacketDamage * (tech.isBulletTeleport ? 1.5 : 1), //also control damage when you divide by mob.mass + dmg: b.dmgScale * tech.waveBeamDamage * tech.wavePacketDamage * (tech.isBulletTeleport ? 1.43 : 1), //also control damage when you divide by mob.mass classType: "bullet", collisionFilter: { category: 0, @@ -5088,7 +5089,7 @@ const b = { //look for closest mob in player's LoS const dir = { x: Math.cos(m.angle), y: Math.sin(m.angle) }; //make a vector for the player's direction of length 1; used in dot product const length = tech.isLargeHarpoon ? 1 + 0.09 * Math.sqrt(this.ammo) : 1 - const totalCycles = 7 * (tech.isFilament ? 1 + 0.009 * Math.min(100, this.ammo) : 1) + const totalCycles = 7 * (tech.isFilament ? 1 + 0.009 * Math.min(100, this.ammo) : 1) * Math.sqrt(length) if (input.down) { for (let i = 0, len = mob.length; i < len; ++i) { if (mob[i].alive && !mob[i].isBadTarget && Matter.Query.ray(map, m.pos, mob[i].position).length === 0) { diff --git a/js/index.js b/js/index.js index 389770c..b3f02fd 100644 --- a/js/index.js +++ b/js/index.js @@ -695,6 +695,7 @@ const input = { function cleanText(text) { return text.replace('Key', '').replace('Digit', '') } + if (!input.key.fire) input.key.fire = "KeyF" document.getElementById("key-fire").innerHTML = cleanText(input.key.fire) document.getElementById("key-field").innerHTML = cleanText(input.key.field) document.getElementById("key-up").innerHTML = cleanText(input.key.up) diff --git a/js/level.js b/js/level.js index 6cd0819..a194bae 100644 --- a/js/level.js +++ b/js/level.js @@ -23,6 +23,7 @@ const level = { // tech.giveTech("all-stars") // for (let i = 0; i < 3; i++) tech.giveTech("super sized") // for (let i = 0; i < 9; i++) tech.giveTech("MIRV") + // tech.isCancelDuplication = true level.intro(); //starting level // level.testing(); //not in rotation, used for testing @@ -2293,7 +2294,7 @@ const level = { spawn.mapRect(5050, -100, 50, 150); spawn.mapRect(4850, -275, 50, 175); // level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why - spawn.starter(1900, -500, 200) //big boy + // spawn.starter(1900, -500, 200) //big boy // spawn.blockGroup(1900, -500) // for (let i = 0; i < 10; ++i) spawn.bodyRect(1600 + 5, -500, 30, 40); // spawn.laserBombingBoss(1900, -500) @@ -2312,11 +2313,11 @@ const level = { // spawn.laserBombingBoss(1600, -500) // spawn.laserTargetingBoss(1600, -500) // spawn.laserBoss(1600, -500) - // spawn.cellBossCulture(1600, -500) + spawn.cellBossCulture(1600, -500) // spawn.nodeGroup(1200, -500, "grenadier") // spawn.nodeGroup(1800, -500, "grenadier") // spawn.nodeGroup(1200, 0, "grenadier") - spawn.snakeBoss(1200, -500) + // spawn.snakeBoss(1200, -500) // spawn.suckerBoss(2900, -500) // spawn.randomMob(1600, -500) }, diff --git a/js/mob.js b/js/mob.js index f487880..0c63e09 100644 --- a/js/mob.js +++ b/js/mob.js @@ -1141,7 +1141,7 @@ const mobs = { this.leaveBody = false; // no body since it turned into the bot } if (tech.isAddRemoveMaxHealth) { - if (this.isBoss) { + if (this.isBoss && this.isDropPowerUp) { for (let i = 0; i < 2; i++) powerUps.spawn(this.position.x, this.position.y, "tech", false) //exit } else { const amount = 0.01 diff --git a/js/player.js b/js/player.js index fe855c2..c0977c2 100644 --- a/js/player.js +++ b/js/player.js @@ -2027,7 +2027,7 @@ const m = { }, { name: "time dilation", - description: "use energy to stop time
move and fire while time is stopped
mobs do 50% harm while time is stopped", + description: "use energy to stop time
while time is stopped you can move and fire
and collisions do 50% less harm", effect: () => { // m.fieldMeterColor = "#000" m.fieldFire = true; @@ -2108,7 +2108,7 @@ const m = { }, { name: "metamaterial cloaking", //"weak photonic coupling" "electromagnetically induced transparency" "optical non-coupling" "slow light field" "electro-optic transparency" - description: "when not firing activate a cloaking effect
+333% damage if a mob hasn't recently died
mobs do 50% harm while you're cloaked", + description: "when not firing activate a cloaking effect
+333% damage if a mob hasn't recently died
collisions do 50% less harm when cloaked", effect: () => { m.fieldFire = true; m.fieldMeterColor = "#333"; @@ -2156,12 +2156,12 @@ const m = { } if (tech.isCloakStun) { //stun nearby mobs after exiting cloak let isMobsAround = false - const stunRange = m.fieldDrawRadius * 1.4 - const drain = 0.1 + const stunRange = m.fieldDrawRadius * 1.5 + const drain = 0.15 const stunTime = 180 if (m.energy > drain) { for (let i = 0, len = mob.length; i < len; ++i) { - if (Vector.magnitude(Vector.sub(mob[i].position, m.pos)) < stunRange && Matter.Query.ray(map, mob[i].position, m.pos).length === 0) { + if (Vector.magnitude(Vector.sub(mob[i].position, m.pos)) < stunRange && Matter.Query.ray(map, mob[i].position, m.pos).length === 0 && !mob[i].isBadTarget) { isMobsAround = true mobs.statusStun(mob[i], stunTime) } @@ -2172,7 +2172,7 @@ const m = { x: m.pos.x, y: m.pos.y, radius: stunRange, - color: "hsla(0,50%,100%,0.8)", + color: "hsla(0,50%,100%,0.7)", time: 7 }); } @@ -2213,7 +2213,7 @@ const m = { let inPlayer = Matter.Query.region(mob, player.bounds) if (inPlayer.length > 0) { for (let i = 0; i < inPlayer.length; i++) { - if (m.energy > 0 && inPlayer[i].shield) m.energy -= 0.012; + if (m.energy > 0 && inPlayer[i].shield) m.energy -= 0.014; } } } else { diff --git a/js/powerup.js b/js/powerup.js index 524d383..40887f0 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -173,7 +173,6 @@ const powerUps = { break } } - ctx.globalAlpha = 0.4 * Math.sin(m.cycle * 0.25) + 0.6 for (let i = 0, len = powerUp.length; i < len; ++i) { ctx.beginPath(); @@ -258,6 +257,8 @@ const powerUps = { if (tech.isCancelDuplication) { tech.cancelCount++ tech.maxDuplicationEvent() + simulation.makeTextLog(`tech.duplicationChance() += ${0.045}`) + simulation.circleFlare(0.045); } if (tech.isCancelRerolls) { for (let i = 0, len = 5 + 5 * Math.random(); i < len; i++) { diff --git a/js/simulation.js b/js/simulation.js index bb4519a..0679ecd 100644 --- a/js/simulation.js +++ b/js/simulation.js @@ -256,7 +256,41 @@ const simulation = { } } }, - lastLogTime: 0, + circleFlare(dup, loops = 100) { + boltNum = dup * 300 + const bolts = [] + colors = [powerUps.research.color, powerUps.ammo.color, powerUps.heal.color, powerUps.tech.color, powerUps.field.color, powerUps.gun.color] + for (let i = 0; i < boltNum; ++i) { + const mag = 4 + 20 * Math.random() + const angle = 2 * Math.PI * Math.random() + bolts.push({ + x: m.pos.x, + y: m.pos.y, + Vx: mag * Math.cos(angle), + Vy: mag * Math.sin(angle), + color: colors[Math.floor(Math.random() * colors.length)] + }) + } + let count = 0 + loop = () => { //draw electricity + if (count++ < loops) requestAnimationFrame(loop) + for (let i = 0, len = bolts.length; i < len; ++i) { + bolts[i].x += bolts[i].Vx + bolts[i].y += bolts[i].Vy + if (Math.random() < 0.2) { + simulation.drawList.push({ + x: bolts[i].x, + y: bolts[i].y, + radius: 1.5 + 5 * Math.random(), + // color: "rgba(0,155,155,0.7)", + color: bolts[i].color, + time: Math.floor(9 + 25 * Math.random() * Math.random()) + }); + } + } + } + requestAnimationFrame(loop) + }, // lastLogTimeBig: 0, boldActiveGunHUD() { if (b.inventory.length > 0) { @@ -314,6 +348,7 @@ const simulation = { } document.getElementById("tech").innerHTML = text }, + lastLogTime: 0, isTextLogOpen: true, // diff --git a/js/spawn.js b/js/spawn.js index ed660b2..3b53316 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -1477,15 +1477,15 @@ const spawn = { y: this.velocity.y * 0.99 }); } - // this.seePlayerCheckByDistance() - if (!(simulation.cycle % this.seePlayerFreq)) { - if (this.distanceToPlayer2() < this.seeAtDistance2) { // ignore cloak for black holes - this.locatePlayer(); - if (!this.seePlayer.yes) this.seePlayer.yes = true; - } else if (this.seePlayer.recall) { - this.lostPlayer(); - } - } + this.seePlayerCheckByDistance() + // if (!(simulation.cycle % this.seePlayerFreq)) { + // if (this.distanceToPlayer2() < this.seeAtDistance2) { // ignore cloak for black holes + // this.locatePlayer(); + // if (!this.seePlayer.yes) this.seePlayer.yes = true; + // } else if (this.seePlayer.recall) { + // this.lostPlayer(); + // } + // } this.checkStatus(); if (this.seePlayer.recall) { //eventHorizon waves in and out diff --git a/js/tech.js b/js/tech.js index 8468a8c..0358128 100644 --- a/js/tech.js +++ b/js/tech.js @@ -3079,6 +3079,7 @@ effect() { tech.duplicateChance += 0.1 powerUps.setDupChance(); //needed after adjusting duplication chance + if (!build.isExperimentSelection) simulation.circleFlare(0.1); tech.addJunkTechToPool(30) }, remove() { @@ -3100,7 +3101,8 @@ requires: "below 100% duplication chance", effect: () => { tech.isStimulatedEmission = true - powerUps.setDupChance(); //needed after adjusting duplication chance + powerUps.setDupChance(0.17); //needed after adjusting duplication chance + if (!build.isExperimentSelection) simulation.circleFlare(0.17); }, remove() { tech.isStimulatedEmission = false @@ -3121,6 +3123,7 @@ effect: () => { tech.isPowerUpsVanish = true powerUps.setDupChance(); //needed after adjusting duplication chance + if (!build.isExperimentSelection) simulation.circleFlare(0.13); }, remove() { tech.isPowerUpsVanish = false @@ -4891,7 +4894,7 @@ }, { name: "uncertainty principle", - description: "foam and wave particle positions are random
increase their damage by 50%", + description: "foam and wave particle positions are random
increase their damage by 43%", isGunTech: true, maxCount: 1, count: 0, @@ -6055,7 +6058,7 @@ effect() { tech.cloakDuplication = 0.42 powerUps.setDupChance(); //needed after adjusting duplication chance - + if (!build.isExperimentSelection) simulation.circleFlare(0.42); }, remove() { tech.cloakDuplication = 0 @@ -6304,6 +6307,7 @@ effect() { tech.wormDuplicate = 0.14 powerUps.setDupChance(); //needed after adjusting duplication chance + if (!build.isExperimentSelection) simulation.circleFlare(0.14); for (let i = 0; i < 4; i++) { if (powerUps.research.count > 0) powerUps.research.changeRerolls(-1) } diff --git a/todo.txt b/todo.txt index b8de4b6..e7eeb9b 100644 --- a/todo.txt +++ b/todo.txt @@ -1,14 +1,9 @@ ******************************************************** NEXT PATCH ************************************************** -pausing time or being cloaked gives you 50% harm reduction from mob collisions - -no-cloning theorem duplication => down to 42%, but no longer removes 1% on bosses -dazzler => drains 25%->10% energy, and it has a 15% bigger radius -boson composite => only drains energy when you touch shields - -'F' key lets you fire, and it can be rebound to other keys - might be some bugs here, I didn't do much testing +blackhole mobs can no longer see past stealth +adding dup chance has graphics now +bug fixes ******************************************************** TODO ********************************************************