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
This commit is contained in:
landgreen
2021-09-28 05:02:03 -07:00
parent e39bc7c0fc
commit 1eb58afb9d
8 changed files with 58 additions and 45 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -146,7 +146,7 @@
<table id="control-table"> <table id="control-table">
<tr> <tr>
<th>FIRE</th> <th>FIRE</th>
<td></td> <td id='key-fire' class='key-input'>F</td>
<td class='key-used'>MouseLeft</td> <td class='key-used'>MouseLeft</td>
<td></td> <td></td>
</tr> </tr>

View File

@@ -106,8 +106,9 @@ function collisionChecks(event) {
// (obj === player) && // (obj === player) &&
!(tech.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned)) !(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 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 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); m.damage(dmg);
return return

View File

@@ -665,7 +665,7 @@ const input = {
right: false, right: false,
isPauseKeyReady: true, isPauseKeyReady: true,
key: { key: {
// fire: "ShiftLeft", fire: "KeyF",
field: "Space", field: "Space",
up: "KeyW", // jump up: "KeyW", // jump
down: "KeyS", // crouch down: "KeyS", // crouch
@@ -678,7 +678,7 @@ const input = {
}, },
setDefault() { setDefault() {
input.key = { input.key = {
// fire: "ShiftLeft", fire: "KeyF",
field: "Space", field: "Space",
up: "KeyW", // jump up: "KeyW", // jump
down: "KeyS", // crouch down: "KeyS", // crouch
@@ -695,6 +695,7 @@ const input = {
function cleanText(text) { function cleanText(text) {
return text.replace('Key', '').replace('Digit', '') 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-field").innerHTML = cleanText(input.key.field)
document.getElementById("key-up").innerHTML = cleanText(input.key.up) document.getElementById("key-up").innerHTML = cleanText(input.key.up)
document.getElementById("key-down").innerHTML = cleanText(input.key.down) document.getElementById("key-down").innerHTML = cleanText(input.key.down)
@@ -718,6 +719,7 @@ const input = {
focus: null, focus: null,
setTextFocus() { setTextFocus() {
const backgroundColor = "#fff" const backgroundColor = "#fff"
document.getElementById("key-fire").style.background = backgroundColor
document.getElementById("key-field").style.background = backgroundColor document.getElementById("key-field").style.background = backgroundColor
document.getElementById("key-up").style.background = backgroundColor document.getElementById("key-up").style.background = backgroundColor
document.getElementById("key-down").style.background = backgroundColor document.getElementById("key-down").style.background = backgroundColor
@@ -736,6 +738,7 @@ const input = {
event.code === "ArrowLeft" || event.code === "ArrowLeft" ||
event.code === "ArrowUp" || event.code === "ArrowUp" ||
event.code === "ArrowDown" || event.code === "ArrowDown" ||
event.code === input.key.fire ||
event.code === input.key.field || event.code === input.key.field ||
event.code === input.key.up || event.code === input.key.up ||
event.code === input.key.down || event.code === input.key.down ||
@@ -747,6 +750,9 @@ const input = {
event.code === input.key.testing event.code === input.key.testing
)) { )) {
switch (input.focus.id) { switch (input.focus.id) {
case "key-fire":
input.key.fire = event.code
break;
case "key-field": case "key-field":
input.key.field = event.code input.key.field = event.code
break; break;
@@ -818,6 +824,9 @@ window.addEventListener("keyup", function(event) {
case "ArrowDown": case "ArrowDown":
input.down = false input.down = false
break; break;
case input.key.fire:
input.fire = false
break
case input.key.field: case input.key.field:
input.field = false input.field = false
break break
@@ -842,6 +851,10 @@ window.addEventListener("keydown", function(event) {
case "ArrowDown": case "ArrowDown":
input.down = true input.down = true
break; break;
case input.key.fire:
// event.preventDefault();
input.fire = true
break
case input.key.field: case input.key.field:
event.preventDefault(); event.preventDefault();
input.field = true input.field = true

View File

@@ -1168,7 +1168,7 @@ const mobs = {
m.setMaxHealth(); m.setMaxHealth();
} }
} }
if (tech.cloakDuplication) { if (tech.cloakDuplication && !this.isBoss) {
tech.cloakDuplication -= 0.01 tech.cloakDuplication -= 0.01
powerUps.setDupChance(); //needed after adjusting duplication chance powerUps.setDupChance(); //needed after adjusting duplication chance
} }

View File

@@ -2027,7 +2027,7 @@ const m = {
}, },
{ {
name: "time dilation", name: "time dilation",
description: "use <strong class='color-f'>energy</strong> to <strong style='letter-spacing: 1px;'>stop time</strong><br><strong>move</strong> and <strong>fire</strong> while time is stopped<br>mobs still do <strong class='color-harm'>harm</strong> while time is stopped", description: "use <strong class='color-f'>energy</strong> to <strong style='letter-spacing: 1px;'>stop time</strong><br><strong>move</strong> and <strong>fire</strong> while time is stopped<br>mobs do <strong>50%</strong> <strong class='color-harm'>harm</strong> while time is stopped",
effect: () => { effect: () => {
// m.fieldMeterColor = "#000" // m.fieldMeterColor = "#000"
m.fieldFire = true; 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" name: "metamaterial cloaking", //"weak photonic coupling" "electromagnetically induced transparency" "optical non-coupling" "slow light field" "electro-optic transparency"
description: "when not firing activate a <strong class='color-cloaked'>cloaking</strong> effect<br>if a mob has <strong>not died</strong> in the last <strong>3 seconds</strong><br>increase <strong class='color-d'>damage</strong> by <strong>300%</strong>", description: "when not firing activate a <strong class='color-cloaked'>cloaking</strong> effect<br><strong>+333%</strong> <strong class='color-d'>damage</strong> if a mob hasn't recently <strong>died</strong><br>mobs do <strong>50%</strong> <strong class='color-harm'>harm</strong> while you're <strong class='color-cloaked'>cloaked</strong>",
effect: () => { effect: () => {
m.fieldFire = true; m.fieldFire = true;
m.fieldMeterColor = "#333"; m.fieldMeterColor = "#333";
@@ -2156,30 +2156,26 @@ const m = {
} }
if (tech.isCloakStun) { //stun nearby mobs after exiting cloak if (tech.isCloakStun) { //stun nearby mobs after exiting cloak
let isMobsAround = false let isMobsAround = false
const stunRange = m.fieldDrawRadius * 1.3 const stunRange = m.fieldDrawRadius * 1.4
const drain = 0.25 * m.energy const drain = 0.1
const stunTime = 180
if (m.energy > drain) {
for (let i = 0, len = mob.length; i < len; ++i) { for (let i = 0, len = mob.length; i < len; ++i) {
if ( if (Vector.magnitude(Vector.sub(mob[i].position, m.pos)) < stunRange && Matter.Query.ray(map, mob[i].position, m.pos).length === 0) {
Vector.magnitude(Vector.sub(mob[i].position, m.pos)) < stunRange &&
Matter.Query.ray(map, mob[i].position, m.pos).length === 0
) {
isMobsAround = true isMobsAround = true
mobs.statusStun(mob[i], 120 + drain * 360) mobs.statusStun(mob[i], stunTime)
} }
} }
if (isMobsAround && m.energy > drain) { if (isMobsAround) {
m.energy -= drain m.energy -= drain
simulation.drawList.push({ simulation.drawList.push({
x: m.pos.x, x: m.pos.x,
y: m.pos.y, y: m.pos.y,
radius: stunRange, radius: stunRange,
color: "hsla(0,50%,100%,0.6)", color: "hsla(0,50%,100%,0.8)",
time: 4 time: 7
}); });
// 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) let inPlayer = Matter.Query.region(mob, player.bounds)
if (inPlayer.length > 0) { if (inPlayer.length > 0) {
for (let i = 0; i < inPlayer.length; i++) { for (let i = 0; i < inPlayer.length; i++) {
if (m.energy > 0) { if (m.energy > 0 && inPlayer[i].shield) m.energy -= 0.012;
if (inPlayer[i].shield) { //shields drain player energy
m.energy -= 0.012;
} else {
m.energy -= 0.005;
}
}
} }
} }
} else { } else {

View File

@@ -6042,18 +6042,18 @@
}, },
{ {
name: "no-cloning theorem", name: "no-cloning theorem",
description: `<strong>50%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>mob</strong> <strong>dies</strong>, lose <strong>1%</strong> <strong class='color-dup'>duplication</strong> chance`, description: `<strong>42%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>mob</strong> <strong>dies</strong>, lose <strong>1%</strong> <strong class='color-dup'>duplication</strong> chance`,
isFieldTech: true, isFieldTech: true,
maxCount: 1, maxCount: 1,
count: 0, count: 0,
frequency: 2, frequency: 2,
frequencyDefault: 2, frequencyDefault: 2,
allowed() { 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", requires: "cloaking, wormhole or time dilation and below 100% duplication chance",
effect() { effect() {
tech.cloakDuplication = 0.5 tech.cloakDuplication = 0.42
powerUps.setDupChance(); //needed after adjusting duplication chance powerUps.setDupChance(); //needed after adjusting duplication chance
}, },
@@ -6127,7 +6127,7 @@
// }, // },
{ {
name: "boson composite", name: "boson composite",
description: "<strong>intangible</strong> to <strong class='color-block'>blocks</strong> and mobs while <strong class='color-cloaked'>cloaked</strong><br>passing through <strong>mobs</strong> drains your <strong class='color-f'>energy</strong>", description: "<strong>intangible</strong> to <strong class='color-block'>blocks</strong> and mobs while <strong class='color-cloaked'>cloaked</strong><br>passing through <strong>shields</strong> drains your <strong class='color-f'>energy</strong>",
isFieldTech: true, isFieldTech: true,
maxCount: 1, maxCount: 1,
count: 0, count: 0,
@@ -6149,7 +6149,7 @@
}, },
{ {
name: "dazzler", name: "dazzler",
description: "<strong class='color-cloaked'>decloaking</strong> <strong>stuns</strong> nearby mobs<br>drains <strong>25%</strong> of your stored <strong class='color-f'>energy</strong>", description: "<strong class='color-cloaked'>decloaking</strong> <strong>stuns</strong> nearby mobs<br>and drains 10 <strong class='color-f'>energy</strong>",
isFieldTech: true, isFieldTech: true,
maxCount: 1, maxCount: 1,
count: 0, count: 0,

View File

@@ -1,11 +1,20 @@
******************************************************** NEXT PATCH ************************************************** ******************************************************** NEXT PATCH **************************************************
metamaterial cloaking field 300% -> 333% damage pausing time or being cloaked gives you 50% harm reduction from mob collisions
no-cloning theorem 43% -> 50% duplication
symbiosis lose 2% -> 1% max health 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 ******************************************************** ******************************************************** 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 JUNK tech: planetesimals game inside n-gon
https://codepen.io/lilgreenland/pen/jrMvaB?editors=0010 https://codepen.io/lilgreenland/pen/jrMvaB?editors=0010