From c085b30af4e15b065f501ceb929053b38802e1d9 Mon Sep 17 00:00:00 2001 From: landgreen Date: Fri, 19 Feb 2021 06:13:33 -0800 Subject: [PATCH] in game music mob effect: freeze - now only slows mobs down all freeze effects are about 50% longer junk tech: music - adds background music to n-gon junk tech: performance - adds fps tracker to n-gon tech: dormancy - if a mob has died in the last 5 seconds increase damage by 50% else decrease damage by 50% tech: torpor - if a mob has died in the last 5 seconds reduce harm by 66% else increase harm by 33% --- .DS_Store | Bin 6148 -> 6148 bytes js/bullet.js | 10 ++-- js/index.js | 4 +- js/mob.js | 7 +-- js/player.js | 19 ++++---- js/simulation.js | 2 +- js/spawn.js | 24 +++++----- js/tech.js | 118 ++++++++++++++++++++++++++++++++++++++++------- style.css | 4 +- todo.txt | 30 +++++++----- 10 files changed, 157 insertions(+), 61 deletions(-) diff --git a/.DS_Store b/.DS_Store index 4cbfe6bf532029a2217aa041cad9ecaa227f2ef7..d4ddd7cca0c183e6cc10a7d8eaee4da5ceddf6d4 100644 GIT binary patch delta 22 dcmZoMXffEJ$;>Qd5RcUuLonvmc|v=4$3n5dcb>1~UKv diff --git a/js/bullet.js b/js/bullet.js index 612b75d..2edbfa6 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -1732,7 +1732,7 @@ const b = { }, beforeDmg(who) { this.endCycle = 0; //bullet ends cycle after doing damage - if (this.isFreeze) mobs.statusSlow(who, 60) + if (this.isFreeze) mobs.statusSlow(who, 90) }, onEnd() { if (tech.isMutualism && this.isMutualismActive && !tech.isEnergyHealth) { @@ -1845,7 +1845,7 @@ const b = { lockedOn: null, isFollowMouse: true, beforeDmg(who) { - mobs.statusSlow(who, 120) + mobs.statusSlow(who, 180) this.endCycle = simulation.cycle // if (tech.isHeavyWater) mobs.statusDoT(who, 0.15, 300) if (tech.iceEnergy && !who.shield && !who.isShielded && who.dropPowerUp && who.alive) { @@ -2549,10 +2549,10 @@ const b = { restitution: 0.5 * (1 + 0.5 * Math.random()), dmg: 0, // 0.14 //damage done in addition to the damage from momentum minDmgSpeed: 2, - lookFrequency: 40 + Math.floor(7 * Math.random()), + lookFrequency: 40 + Math.floor(7 * Math.random()) - 10 * tech.isLaserBotUpgrade, drainThreshold: tech.isEnergyHealth ? 0.6 : 0.4, acceleration: 0.0015 * (1 + 0.3 * Math.random()), - range: 700 * (1 + 0.1 * Math.random()) + 300 * tech.isLaserBotUpgrade, + range: 700 * (1 + 0.1 * Math.random()) + 500 * tech.isLaserBotUpgrade, playerRange: 150 + Math.floor(30 * Math.random()), offPlayer: { x: 0, @@ -3155,7 +3155,7 @@ const b = { }, dmg) //position, velocity, damage if (tech.isIceCrystals) { bullet[bullet.length - 1].beforeDmg = function(who) { - mobs.statusSlow(who, 30) + mobs.statusSlow(who, 60) if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.975) { b.explosion(this.position, 150 + 30 * Math.random()); //makes bullet do explosive damage at end } diff --git a/js/index.js b/js/index.js index 5716862..7884b4e 100644 --- a/js/index.js +++ b/js/index.js @@ -754,9 +754,7 @@ window.addEventListener("keydown", function(event) { simulation.testing = false; simulation.loop = simulation.normalLoop if (simulation.isConstructionMode) document.getElementById("construct").style.display = 'none' - // document.getElementById("text-log").innerHTML = "" - simulation.lastLogTime = 0 //clear text log - // simulation.makeTextLog(`exiting testing mode`); + simulation.makeTextLog("", 0); } else { //if (keys[191]) simulation.testing = true; simulation.loop = simulation.testingLoop diff --git a/js/mob.js b/js/mob.js index 0780166..28f3584 100644 --- a/js/mob.js +++ b/js/mob.js @@ -63,7 +63,6 @@ const mobs = { function applySlow() { if (!who.shield && !who.isShielded && !m.isBodiesAsleep) { if (who.isBoss) cycles = Math.floor(cycles * 0.25) - let i = who.status.length while (i--) { if (who.status[i].type === "slow") who.status.splice(i, 1); //remove other "slow" effects on this mob @@ -71,9 +70,11 @@ const mobs = { who.isSlowed = true; who.status.push({ effect() { + const speedCap = 3 + const drag = 0.95 Matter.Body.setVelocity(who, { - x: 0, - y: 0 + x: Math.min(speedCap, who.velocity.x) * drag, + y: Math.min(speedCap, who.velocity.y) * drag }); Matter.Body.setAngularVelocity(who, 0); ctx.beginPath(); diff --git a/js/player.js b/js/player.js index c4f1ca6..21eea8f 100644 --- a/js/player.js +++ b/js/player.js @@ -473,8 +473,11 @@ const m = { harmReduction() { let dmg = 1 dmg *= m.fieldHarmReduction - if (tech.isBlockHarm && m.isHolding) dmg *= 0.2 + + if (tech.isHarmReduceAfterKill) dmg *= (m.lastKillCycle + 300 > m.cycle) ? 0.33 : 1.33 + if (tech.healthDrain) dmg *= 1 + 2.667 * tech.healthDrain //tech.healthDrain = 0.03 at one stack //cause more damage if (tech.squirrelFx !== 1) dmg *= 1 + (tech.squirrelFx - 1) / 5 //cause more damage + if (tech.isBlockHarm && m.isHolding) dmg *= 0.2 if (tech.isSpeedHarm) dmg *= 1 - Math.min(player.speed * 0.0185, 0.55) if (tech.isSlowFPS) dmg *= 0.8 if (tech.isPiezo) dmg *= 0.85 @@ -688,7 +691,7 @@ const m = { m.defaultFPSCycle = m.cycle + 20 + Math.min(90, Math.floor(200 * dmg)) if (tech.isHarmFreeze) { //freeze all mobs for (let i = 0, len = mob.length; i < len; i++) { - mobs.statusSlow(mob[i], 300) + mobs.statusSlow(mob[i], 450) } } } else { @@ -1311,7 +1314,7 @@ const m = { if (tech.isFreezeMobs) { for (let i = 0, len = mob.length; i < len; ++i) { Matter.Sleeping.set(mob[i], false) - mobs.statusSlow(mob[i], 60) + mobs.statusSlow(mob[i], 90) } } else { wake(mob); @@ -1346,7 +1349,7 @@ const m = { }, fieldUpgrades: [{ name: "field emitter", - description: "use energy to block mobs,
grab power ups, and throw blocks", + description: "use energy to block mobs,
grab power ups, and throw blocks
regen 6 energy per second", effect: () => { m.hold = function() { if (m.isHolding) { @@ -1620,7 +1623,7 @@ const m = { if (m.energy > ICE_DRAIN * 2) { m.energy -= ICE_DRAIN; this.fieldDrawRadius -= 2; - mobs.statusSlow(mob[i], 45) + mobs.statusSlow(mob[i], 60) } else { break; } @@ -2187,7 +2190,7 @@ const m = { if (tech.isFreezeMobs) { for (let i = 0, len = mob.length; i < len; ++i) { if (Vector.magnitude(Vector.sub(mob[i].position, m.fieldPosition)) < m.fieldRadius) { - mobs.statusSlow(mob[i], 120) + mobs.statusSlow(mob[i], 180) } } } @@ -2571,7 +2574,7 @@ const m = { if (!mob[i].freeOfWires) mob[i].freeOfWires = true } m.isShipMode = true - simulation.isCheating = true + // simulation.isCheating = true const points = [ { x: 29.979168754143455, y: 4.748337243898336 }, { x: 27.04503734408824, y: 13.7801138209198 }, @@ -2604,7 +2607,7 @@ const m = { // Matter.Body.setDensity(player, 0.01); //extra dense //normal is 0.001 //makes effective life much larger m.defaultMass = 30 Matter.Body.setMass(player, m.defaultMass); - player.friction = 0.05 + player.friction = 0.01 player.restitution = 0.2 // player.frictionStatic = 0.1 // Matter.Body.setInertia(player, Infinity); //disable rotation diff --git a/js/simulation.js b/js/simulation.js index cc60030..2f11300 100644 --- a/js/simulation.js +++ b/js/simulation.js @@ -262,7 +262,7 @@ const simulation = { } }, lastLogTime: 0, - lastLogTimeBig: 0, + // lastLogTimeBig: 0, boldActiveGunHUD() { if (b.inventory.length > 0) { for (let i = 0, len = b.inventory.length; i < len; ++i) document.getElementById(b.inventory[i]).style.opacity = "0.3"; diff --git a/js/spawn.js b/js/spawn.js index 185f152..f42f68c 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -50,33 +50,33 @@ const spawn = { randomGroup(x, y, chance = 1) { if (spawn.spawnChance(chance) && simulation.difficulty > 2 || chance == Infinity) { //choose from the possible picklist - let pick = this.pickList[Math.floor(Math.random() * this.pickList.length)]; + let pick = spawn.pickList[Math.floor(Math.random() * spawn.pickList.length)]; //is the pick able to be a group? let canBeGroup = false; - for (let i = 0, len = this.allowedGroupList.length; i < len; ++i) { - if (this.allowedGroupList[i] === pick) { + for (let i = 0, len = spawn.allowedGroupList.length; i < len; ++i) { + if (spawn.allowedGroupList[i] === pick) { canBeGroup = true; break; } } if (canBeGroup) { if (Math.random() < 0.55) { - this.nodeGroup(x, y, pick); + spawn.nodeGroup(x, y, pick); } else { - this.lineGroup(x, y, pick); + spawn.lineGroup(x, y, pick); } } else { if (Math.random() < 0.07) { - this[pick](x, y, 90 + Math.random() * 40); //one extra large mob - spawn.spawnOrbitals(mob[mob.length - 1], radius + 50 + 200 * Math.random(), 1) + spawn[pick](x, y, 90 + Math.random() * 40); //one extra large mob + spawn.spawnOrbitals(mob[mob.length - 1], mob[mob.length - 1].radius + 50 + 200 * Math.random(), 1) } else if (Math.random() < 0.35) { - this.blockGroup(x, y) //hidden grouping blocks + spawn.blockGroup(x, y) //hidden grouping blocks } else { pick = (Math.random() < 0.5) ? "randomList" : "random"; if (Math.random() < 0.55) { - this.nodeGroup(x, y, pick); + spawn.nodeGroup(x, y, pick); } else { - this.lineGroup(x, y, pick); + spawn.lineGroup(x, y, pick); } } } @@ -1355,7 +1355,7 @@ const spawn = { me.isBoss = true; 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.0002 * Math.sqrt(simulation.accelScale); + me.accelMag = 0.00022 * Math.sqrt(simulation.accelScale); me.seePlayerFreq = Math.floor(30 * simulation.lookFreqScale); me.memory = 420; me.restitution = 1; @@ -1371,7 +1371,7 @@ const spawn = { } Matter.Body.setDensity(me, 0.023); //extra dense //normal is 0.001 //makes effective life much larger spawn.shield(me, x, y, 1); - spawn.spawnOrbitals(me, radius + 100 + 100 * Math.random()) + spawn.spawnOrbitals(me, radius + 200 + 300 * Math.random()) me.onHit = function() { //run this function on hitting player // this.explode(); diff --git a/js/tech.js b/js/tech.js index c1d4404..fbdc75d 100644 --- a/js/tech.js +++ b/js/tech.js @@ -109,6 +109,7 @@ }, damageFromTech() { let dmg = m.fieldDamage + if (tech.isDamageAfterKill) dmg *= (m.lastKillCycle + 300 > m.cycle) ? 1.5 : 0.5 if (tech.isTechDamage) dmg *= 2 if (tech.isDupDamage) dmg *= 1 + Math.min(1, tech.duplicationChance()) if (tech.isLowEnergyDamage) dmg *= 1 + Math.max(0, 1 - m.energy) * 0.5 @@ -433,7 +434,7 @@ }, { name: "squirrel-cage rotor", - description: "move and jump about 30% faster
but you take 5% more harm", + description: "move and jump about 30% faster
take 5% more harm", maxCount: 9, count: 0, allowed() { @@ -1181,7 +1182,7 @@ }, { name: "complex spin-statistics", - description: `become immune to harm for +1 second
once every 7 seconds`, + description: `become immune to harm for 1 second
once every 7 seconds`, maxCount: 3, count: 0, allowed() { @@ -1248,7 +1249,7 @@ }, { name: "liquid cooling", - description: `freeze all mobs for 5 seconds
after receiving harm`, + description: `freeze all mobs for 7 seconds
after receiving harm`, maxCount: 1, count: 0, allowed() { @@ -1569,9 +1570,9 @@ maxCount: 1, count: 0, allowed() { - return m.maxEnergy > 0.99 + return m.maxEnergy > 0.99 && !tech.isHealthRecovery }, - requires: "max energy >= 1", + requires: "max energy >= 1, not scrap recycling", effect() { tech.isEnergyRecovery = true; }, @@ -1585,9 +1586,9 @@ maxCount: 1, count: 0, allowed() { - return !tech.isEnergyHealth + return !tech.isEnergyHealth && !tech.isEnergyRecovery }, - requires: "not mass-energy equivalence", + requires: "not mass-energy equivalence, waste energy recovery", effect() { tech.isHealthRecovery = true; }, @@ -1595,6 +1596,38 @@ tech.isHealthRecovery = false; } }, + { + name: "dormancy", + description: "if a mob has died in the last 5 seconds
increase damage by 50% else decrease it by 50%", + maxCount: 1, + count: 0, + allowed() { + return true + }, + requires: "", + effect() { + tech.isDamageAfterKill = true; + }, + remove() { + tech.isDamageAfterKill = false; + } + }, + { + name: "torpor", + description: "if a mob has died in the last 5 seconds
reduce harm by 66% else increase it by 50%", + maxCount: 1, + count: 0, + allowed() { + return tech.isDamageAfterKill + }, + requires: "dormancy", + effect() { + tech.isHarmReduceAfterKill = true; + }, + remove() { + tech.isHarmReduceAfterKill = false; + } + }, { name: "negative feedback", description: "increase damage by 6%
for every 10 health below 100", @@ -1628,7 +1661,7 @@ }, { name: "entropy exchange", - description: "heal for 1% of damage done", + description: "heal for 3% of damage done
take 8% more harm", maxCount: 9, count: 0, allowed() { @@ -1636,7 +1669,7 @@ }, requires: "some increased damage, not mass-energy equivalence", effect() { - tech.healthDrain += 0.01; + tech.healthDrain += 0.03; }, remove() { tech.healthDrain = 0; @@ -3090,7 +3123,7 @@ }, { name: "cryodesiccation", - description: "sporangium release 2 more spores
spores freeze mobs for 1 second", + description: "sporangium release 2 more spores
spores freeze mobs for 1.5 second", //
spores do 1/3 damage isGunTech: true, maxCount: 1, @@ -3743,7 +3776,7 @@ tech.giveTech("dynamo-bot upgrade") tech.setTechoNonRefundable("dynamo-bot upgrade") for (let i = 0; i < 2; i++) { - b.orbitBot() + b.dynamoBot() tech.dynamoBotCount++; } simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`) @@ -3753,7 +3786,7 @@ tech.giveTech("dynamo-bot upgrade") tech.setTechoNonRefundable("dynamo-bot upgrade") for (let i = 0; i < 2; i++) { - b.orbitBot() + b.dynamoBot() tech.dynamoBotCount++; } simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`) @@ -4291,7 +4324,58 @@ // remove() {} // }, { - name: "banish", + name: "music", + description: "add music to n-gon", + maxCount: 1, + count: 0, + numberInPool: 0, + isNonRefundable: true, + isExperimentHide: true, + isJunk: true, + allowed() { + return true + }, + requires: "", + effect() { + window.open('https://www.youtube.com/results?search_query=music', '_blank') + }, + remove() {} + }, + { + name: "performance", + description: "display performance stats to n-gon", + maxCount: 1, + count: 0, + numberInPool: 0, + isNonRefundable: true, + isExperimentHide: true, + isJunk: true, + allowed() { + return true + }, + requires: "", + effect() { + (function() { + var script = document.createElement('script'); + script.onload = function() { + var stats = new Stats(); + document.body.appendChild(stats.dom); + requestAnimationFrame(function loop() { + stats.update(); + requestAnimationFrame(loop) + }); + }; + script.src = 'https://unpkg.com/stats.js@0.17.0/build/stats.min.js'; + document.head.appendChild(script); + })() + //move health to the right + document.getElementById("health").style.left = "86px" + document.getElementById("health-bg").style.left = "86px" + }, + remove() {} + }, + { + name: "defragment", description: "erase all junk tech from the possible pool
probably...", maxCount: 1, count: 0, @@ -4496,7 +4580,7 @@ }, { name: "energy investment", - description: "every 10 seconds drain your energy and return it doubled 10 seconds later
lasts 180 seconds", + description: "every 10 seconds drain your energy
return it doubled 10 seconds later
lasts 180 seconds", maxCount: 9, count: 0, numberInPool: 0, @@ -4931,7 +5015,7 @@ }, { name: "quantum black hole", - description: "use all your energy to spawn inside the event horizon of a huge black hole", + description: "use all your energy to
spawn inside the event horizon of a huge black hole", maxCount: 9, count: 0, numberInPool: 0, @@ -5175,5 +5259,7 @@ isBlockHarm: null, foamFutureFire: null, isBotSwap: null, - botSwapCycleIndex: null + botSwapCycleIndex: null, + isDamageAfterKill: null, + isHarmReduceAfterKill: null } \ No newline at end of file diff --git a/style.css b/style.css index 798ac2d..9e2bbc8 100644 --- a/style.css +++ b/style.css @@ -650,8 +650,8 @@ summary { } .junk { - background: hsl(254, 59%, 74%); - border-radius: 35%; + background: hsl(254, 44%, 75%); + border-radius: 25%; /* animation: 3s linear infinite alternate pulse; */ } diff --git a/todo.txt b/todo.txt index 0e7fb96..c9ad888 100644 --- a/todo.txt +++ b/todo.txt @@ -1,12 +1,13 @@ ******************************************************** NEXT PATCH ******************************************************** -ship mode can be found in the experimental menu +mob effect: freeze - now only slows mobs down + all freeze effects are about 50% longer -some mobs now have orbitals at random -new level boss: orbitalBoss +junk tech: music - adds background music to n-gon +junk tech: performance - adds fps tracker to n-gon -most late game bot tech has been buffed -tech: get 2 random bots, also when you switch guns cycle all bots to the same type +tech: dormancy - if a mob has died in the last 5 seconds increase damage by 50% else decrease damage by 50% +tech: torpor - if a mob has died in the last 5 seconds reduce harm by 66% else increase harm by 33% ******************************************************** BUGS ******************************************************** @@ -36,7 +37,19 @@ use the floor of portal sensor on the player? to unstuck player ******************************************************** TODO ******************************************************** -add a shipMode tech that only shows up in experimental mode + +decrease healing effects by 50% +decrease level scaling healing reduction + net effect: healing at difficulty 40 (level 10 hard) should be 25% higher then current levels + +bosses should have 2x health, but only do about 50 health damage + options: + cap all damage at 50 health + this makes high health/energy/harm reduction build much better + make boss flag cut damage done to player by 10x + boss flag cut damage done to boss by 20x <---- + make bosses not have extra density + tech: spawn a bot after taking collision damage @@ -72,7 +85,6 @@ copy time-like foam to other guns? shotgun nail gun - lore: a tutorial / lore intro needs to be optional so it doesn't slow experienced players put something on the intro map @@ -358,10 +370,6 @@ n-gon outreach ideas hacker news - show hacker news post - paste this into console to see fps - javascript:(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//mrdoob.github.io/stats.js/build/stats.min.js';document.head.appendChild(script);})() - - ******************************************************** LORE ******************************************************** cool names for tech