From 1eb58afb9dbb5e279c932804c9273206bf647172 Mon Sep 17 00:00:00 2001 From: landgreen Date: Tue, 28 Sep 2021 05:02:03 -0700 Subject: [PATCH] f key is bound to fire 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 --- .DS_Store | Bin 6148 -> 6148 bytes index.html | 2 +- js/engine.js | 3 ++- js/index.js | 17 ++++++++++++++-- js/mob.js | 2 +- js/player.js | 54 +++++++++++++++++++++------------------------------ js/tech.js | 10 +++++----- todo.txt | 15 +++++++++++--- 8 files changed, 58 insertions(+), 45 deletions(-) diff --git a/.DS_Store b/.DS_Store index 65d7ea801faf2509a32c39c063621414f24c9165..6b8e825d0fe2982b9d2bed16323d3694d30dcbe7 100644 GIT binary patch delta 14 VcmZoMXffEJ&CIxRvkvnO5db7=1it_P delta 14 VcmZoMXffEJ&CJNYS%>+C2mm0S1RVeX diff --git a/index.html b/index.html index f5789f0..8474635 100644 --- a/index.html +++ b/index.html @@ -146,7 +146,7 @@ - + diff --git a/js/engine.js b/js/engine.js index b5ee26b..3d213f3 100644 --- a/js/engine.js +++ b/js/engine.js @@ -106,8 +106,9 @@ function collisionChecks(event) { // (obj === player) && !(tech.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned)) ) { - mob[k].foundPlayer(); let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * simulation.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0 + if (m.isBodiesAsleep || m.isCloak) dmg *= 0.5 + mob[k].foundPlayer(); if (tech.isRewindAvoidDeath && m.energy > 0.66) { //CPT reversal runs in m.damage, but it stops the rest of the collision code here too m.damage(dmg); return diff --git a/js/index.js b/js/index.js index aa7ae60..389770c 100644 --- a/js/index.js +++ b/js/index.js @@ -665,7 +665,7 @@ const input = { right: false, isPauseKeyReady: true, key: { - // fire: "ShiftLeft", + fire: "KeyF", field: "Space", up: "KeyW", // jump down: "KeyS", // crouch @@ -678,7 +678,7 @@ const input = { }, setDefault() { input.key = { - // fire: "ShiftLeft", + fire: "KeyF", field: "Space", up: "KeyW", // jump down: "KeyS", // crouch @@ -695,6 +695,7 @@ const input = { function cleanText(text) { return text.replace('Key', '').replace('Digit', '') } + 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) document.getElementById("key-down").innerHTML = cleanText(input.key.down) @@ -718,6 +719,7 @@ const input = { focus: null, setTextFocus() { const backgroundColor = "#fff" + document.getElementById("key-fire").style.background = backgroundColor document.getElementById("key-field").style.background = backgroundColor document.getElementById("key-up").style.background = backgroundColor document.getElementById("key-down").style.background = backgroundColor @@ -736,6 +738,7 @@ const input = { event.code === "ArrowLeft" || event.code === "ArrowUp" || event.code === "ArrowDown" || + event.code === input.key.fire || event.code === input.key.field || event.code === input.key.up || event.code === input.key.down || @@ -747,6 +750,9 @@ const input = { event.code === input.key.testing )) { switch (input.focus.id) { + case "key-fire": + input.key.fire = event.code + break; case "key-field": input.key.field = event.code break; @@ -818,6 +824,9 @@ window.addEventListener("keyup", function(event) { case "ArrowDown": input.down = false break; + case input.key.fire: + input.fire = false + break case input.key.field: input.field = false break @@ -842,6 +851,10 @@ window.addEventListener("keydown", function(event) { case "ArrowDown": input.down = true break; + case input.key.fire: + // event.preventDefault(); + input.fire = true + break case input.key.field: event.preventDefault(); input.field = true diff --git a/js/mob.js b/js/mob.js index 0b36c24..f487880 100644 --- a/js/mob.js +++ b/js/mob.js @@ -1168,7 +1168,7 @@ const mobs = { m.setMaxHealth(); } } - if (tech.cloakDuplication) { + if (tech.cloakDuplication && !this.isBoss) { tech.cloakDuplication -= 0.01 powerUps.setDupChance(); //needed after adjusting duplication chance } diff --git a/js/player.js b/js/player.js index 1a18591..fe855c2 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 still do harm while time is stopped", + description: "use energy to stop time
move and fire while time is stopped
mobs do 50%harm while time is stopped", 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
if a mob has not died in the last 3 seconds
increase damage by 300%", + 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", effect: () => { m.fieldFire = true; m.fieldMeterColor = "#333"; @@ -2156,30 +2156,26 @@ const m = { } if (tech.isCloakStun) { //stun nearby mobs after exiting cloak let isMobsAround = false - const stunRange = m.fieldDrawRadius * 1.3 - const drain = 0.25 * m.energy - 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 - ) { - isMobsAround = true - mobs.statusStun(mob[i], 120 + drain * 360) + const stunRange = m.fieldDrawRadius * 1.4 + const drain = 0.1 + 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) { + isMobsAround = true + mobs.statusStun(mob[i], stunTime) + } + } + if (isMobsAround) { + m.energy -= drain + simulation.drawList.push({ + x: m.pos.x, + y: m.pos.y, + radius: stunRange, + color: "hsla(0,50%,100%,0.8)", + time: 7 + }); } - } - if (isMobsAround && m.energy > drain) { - m.energy -= drain - simulation.drawList.push({ - x: m.pos.x, - y: m.pos.y, - radius: stunRange, - color: "hsla(0,50%,100%,0.6)", - time: 4 - }); - // ctx.beginPath(); - // ctx.arc(m.pos.x, m.pos.y, 800, 0, 2 * Math.PI); - // ctx.fillStyle = "#000" - // ctx.fill(); } } } @@ -2217,13 +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) { - if (inPlayer[i].shield) { //shields drain player energy - m.energy -= 0.012; - } else { - m.energy -= 0.005; - } - } + if (m.energy > 0 && inPlayer[i].shield) m.energy -= 0.012; } } } else { diff --git a/js/tech.js b/js/tech.js index ef87681..8468a8c 100644 --- a/js/tech.js +++ b/js/tech.js @@ -6042,18 +6042,18 @@ }, { name: "no-cloning theorem", - description: `50% chance to duplicate spawned power ups
after a mobdies, lose 1%duplication chance`, + description: `42% chance to duplicate spawned power ups
after a mobdies, lose 1%duplication chance`, isFieldTech: true, maxCount: 1, count: 0, frequency: 2, frequencyDefault: 2, allowed() { - return (m.fieldUpgrades[m.fieldMode].name === "wormhole" || m.fieldUpgrades[m.fieldMode].name === "time dilation" || m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking") && tech.duplicationChance() < 1 + return (m.fieldUpgrades[m.fieldMode].name === "time dilation" || m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking") && tech.duplicationChance() < 1 //m.fieldUpgrades[m.fieldMode].name === "wormhole" || }, requires: "cloaking, wormhole or time dilation and below 100% duplication chance", effect() { - tech.cloakDuplication = 0.5 + tech.cloakDuplication = 0.42 powerUps.setDupChance(); //needed after adjusting duplication chance }, @@ -6127,7 +6127,7 @@ // }, { name: "boson composite", - description: "intangible to blocks and mobs while cloaked
passing through mobs drains your energy", + description: "intangible to blocks and mobs while cloaked
passing through shields drains your energy", isFieldTech: true, maxCount: 1, count: 0, @@ -6149,7 +6149,7 @@ }, { name: "dazzler", - description: "decloakingstuns nearby mobs
drains 25% of your stored energy", + description: "decloakingstuns nearby mobs
and drains 10 energy", isFieldTech: true, maxCount: 1, count: 0, diff --git a/todo.txt b/todo.txt index 651bf20..b8de4b6 100644 --- a/todo.txt +++ b/todo.txt @@ -1,11 +1,20 @@ ******************************************************** NEXT PATCH ************************************************** -metamaterial cloaking field 300% -> 333% damage -no-cloning theorem 43% -> 50% duplication -symbiosis lose 2% -> 1% max health +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 + ******************************************************** TODO ******************************************************** +how to make only killing mobs more viable: + reduce damage from mobs that are asleep or unaware of the player when you touch them? + JUNK tech: planetesimals game inside n-gon https://codepen.io/lilgreenland/pen/jrMvaB?editors=0010
FIREF MouseLeft