From c7c837672e25014c6dda4e235fd0d4221474e4d3 Mon Sep 17 00:00:00 2001 From: landgreen Date: Thu, 29 Jul 2021 05:46:30 -0700 Subject: [PATCH] restitution tech: restitution: thrown blocks are bouncy and blocks do 150% more damage the tech previously named restitution is now named buckling after getting a bot upgrade, future bot tech will be for the upgraded bot type (doesn't effect tech that gives random bots) bug fixes --- .DS_Store | Bin 6148 -> 6148 bytes js/bullet.js | 16 ++--- js/engine.js | 2 +- js/level.js | 2 - js/player.js | 10 +-- js/tech.js | 179 +++++++++++++++++++++++++++++++++++++-------------- todo.txt | 26 +++++--- 7 files changed, 162 insertions(+), 73 deletions(-) diff --git a/.DS_Store b/.DS_Store index 2b50f2e4aac24c212bdd911458aa11932013fbaa..7482e0a1af1882d9c434b18e23b383fcb2933782 100644 GIT binary patch delta 15 WcmZoMXffEJ#mrP)yjh3&h6n&C$pr)e delta 15 WcmZoMXffEJ#mto5yjh3&h6n&Cxdj9O diff --git a/js/bullet.js b/js/bullet.js index a1c34bb..796b64c 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -2384,7 +2384,7 @@ const b = { //aoe damage to mobs for (let i = 0, len = mob.length; i < len; i++) { if (Vector.magnitude(Vector.sub(mob[i].position, this.position)) < this.radioRadius + mob[i].radius) { - let dmg = b.dmgScale * 0.1 * tech.droneRadioDamage //neutron bombs dmg = 0.09 + let dmg = 0.11 * b.dmgScale * tech.droneRadioDamage //neutron bombs dmg = 0.09 if (Matter.Query.ray(map, mob[i].position, this.position).length > 0) dmg *= 0.25 //reduce damage if a wall is in the way if (mob[i].shield) dmg *= 3 // to make up for the /5 that shields normally take mob[i].damage(dmg); @@ -2884,14 +2884,14 @@ const b = { } } }, - randomBot(where = player.position, isKeep = true, isAll = true) { - if (Math.random() < 0.167 && isAll) { - b.dynamoBot(where) - if (isKeep) tech.dynamoBotCount++; - } else if (Math.random() < 0.25 && isAll) { + randomBot(where = player.position, isKeep = true, isLaser = true) { + if (Math.random() < 0.166 && isLaser) { b.laserBot(where) if (isKeep) tech.laserBotCount++; - } else if (Math.random() < 0.25 && isAll) { + } else if (Math.random() < 0.2) { + b.dynamoBot(where) + if (isKeep) tech.dynamoBotCount++; + } else if (Math.random() < 0.25) { b.orbitBot(where); if (isKeep) tech.orbitBotCount++; } else if (Math.random() < 0.33) { @@ -2961,7 +2961,7 @@ const b = { if (Vector.magnitude(Vector.sub(this.position, player.position)) < 250 && m.immuneCycle < m.cycle) { //give energy Matter.Body.setAngularVelocity(this, this.spin) if (this.isUpgraded) { - m.energy += 0.1 + m.energy += 0.08 simulation.drawList.push({ //add dmg to draw queue x: this.position.x, y: this.position.y, diff --git a/js/engine.js b/js/engine.js index 152663e..fffc6a1 100644 --- a/js/engine.js +++ b/js/engine.js @@ -192,7 +192,7 @@ function collisionChecks(event) { if (obj.classType === "body" && obj.speed > 6) { const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)); if (v > 9) { - let dmg = 0.075 * b.dmgScale * v * obj.mass * (tech.throwChargeRate) * (tech.isBlockHarm ? 2 : 1) * (tech.isMobBlockFling ? 2 : 1); + let dmg = 0.075 * b.dmgScale * v * obj.mass * (tech.throwChargeRate) * (tech.isBlockHarm ? 2.5 : 1) * (tech.isMobBlockFling ? 2.5 : 1) * (tech.isBlockRestitution ? 2.5 : 1); if (mob[k].isShielded) dmg *= 0.7 mob[k].damage(dmg, true); if (tech.isBlockPowerUps && !mob[k].alive && mob[k].isDropPowerUp && m.throwCycle > m.cycle) { diff --git a/js/level.js b/js/level.js index 00616f2..a1fbcc6 100644 --- a/js/level.js +++ b/js/level.js @@ -2332,8 +2332,6 @@ const level = { ctx.fillRect(5400, -550, 300, 350) }; - spawn.powerUpBoss(0, 0) - spawn.powerUpBoss(0, 0) level.setPosToSpawn(0, -250); //normal spawn spawn.mapRect(5500, -330 + 20, 100, 20); //spawn this because the real exit is in the wrong spot spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20); diff --git a/js/player.js b/js/player.js index 7f02a13..d196c49 100644 --- a/js/player.js +++ b/js/player.js @@ -627,7 +627,7 @@ const m = { return } m.lastHarmCycle = m.cycle - if (tech.isDroneOnDamage) { //chance to build a drone on damage from tech + if (tech.isDroneOnDamage && bullet.length < 150) { //chance to build a drone on damage from tech const len = Math.min((dmg - 0.06 * Math.random()) * 40, 40) / tech.droneEnergyReduction for (let i = 0; i < len; i++) { if (Math.random() < 0.5) b.drone({ x: m.pos.x + 30 * Math.cos(m.angle) + 100 * (Math.random() - 0.5), y: m.pos.y + 30 * Math.sin(m.angle) + 100 * (Math.random() - 0.5) }) //spawn drone @@ -1138,6 +1138,7 @@ const m = { //bullet-like collisions m.holdingTarget.collisionFilter.category = cat.bullet m.holdingTarget.collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield; + if (tech.isBlockRestitution) m.holdingTarget.restitution = 0.999 //extra bouncy //check every second to see if player is away from thrown body, and make solid const solid = function(that) { const dx = that.position.x - player.position.x; @@ -1588,8 +1589,9 @@ const m = { }, { name: "perfect diamagnetism", - // description: "gain energy when blocking
no recoil when blocking", description: "attract power ups from far away
deflecting does not drain energy
deflecting has 90% less recoil", + // description: "attract power ups from far away
deflecting doesn't drain energy
thrown blocks have", + // description: "gain energy when blocking
no recoil when blocking", effect: () => { m.fieldShieldingScale = 0; m.fieldBlockCD = 4; @@ -1659,7 +1661,7 @@ const m = { }, { name: "negative mass field", - description: "use energy to nullify  gravity
reduce harm by 55%
blocks held by the field have a lower mass", + description: "use energy to nullify  gravity
reduce harm by 55%
hold blocks as if they have a lower mass", fieldDrawRadius: 0, effect: () => { m.fieldFire = true; @@ -1847,7 +1849,7 @@ const m = { m.energy -= 0.04; b.iceIX(1) } else if (tech.isDroneRadioactive) { - m.energy -= 0.9; + m.energy -= 0.85; b.droneRadioactive({ x: m.pos.x + 30 * Math.cos(m.angle) + 10 * (Math.random() - 0.5), y: m.pos.y + 30 * Math.sin(m.angle) + 10 * (Math.random() - 0.5) }, 25) } else { m.energy -= 0.45 * tech.droneEnergyReduction; diff --git a/js/tech.js b/js/tech.js index b337e3e..500d2dc 100644 --- a/js/tech.js +++ b/js/tech.js @@ -204,6 +204,37 @@ spawn.randomLevelBoss(m.pos.x - range, m.pos.y - range, spawn.nonCollideBossList); } }, + setTechFrequency(name, frequency) { + for (let i = 0, len = tech.tech.length; i < len; i++) { + if (tech.tech[i].name === name) tech.tech[i].frequency = frequency + } + }, + setBotTechFrequency(f = 0) { + for (let i = 0, len = tech.tech.length; i < len; i++) { + if (tech.tech[i].isBotTech) { + switch (tech.tech[i].name) { + case "dynamo-bot": + tech.tech[i].frequency = f + break; + case "orbital-bot": + tech.tech[i].frequency = f + break; + case "laser-bot": + tech.tech[i].frequency = f + break; + case "boom-bot": + tech.tech[i].frequency = f + break; + case "foam-bot": + tech.tech[i].frequency = f + break; + case "nail-bot": + tech.tech[i].frequency = f + break; + } + } + } + }, tech: [{ name: "integrated armament", description: `increase damage by 30%
your inventory can only hold 1 gun`, @@ -1093,12 +1124,17 @@ for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'nail') bullet[i].isUpgraded = true } + tech.setBotTechFrequency() + tech.setTechFrequency("nail-bot", 5) }, remove() { - tech.isNailBotUpgrade = false - for (let i = 0; i < bullet.length; i++) { - if (bullet[i].botType === 'nail') bullet[i].isUpgraded = false + if (this.count) { + for (let i = 0; i < bullet.length; i++) { + if (bullet[i].botType === 'nail') bullet[i].isUpgraded = false + } + tech.setBotTechFrequency(1) } + tech.isNailBotUpgrade = false } }, { @@ -1144,12 +1180,17 @@ for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'foam') bullet[i].isUpgraded = true } + tech.setBotTechFrequency() + tech.setTechFrequency("foam-bot", 5) }, remove() { - tech.isFoamBotUpgrade = false - for (let i = 0; i < bullet.length; i++) { - if (bullet[i].botType === 'foam') bullet[i].isUpgraded = false + if (this.count) { + for (let i = 0; i < bullet.length; i++) { + if (bullet[i].botType === 'foam') bullet[i].isUpgraded = false + } + tech.setBotTechFrequency(1) } + tech.isFoamBotUpgrade = false } }, { @@ -1195,12 +1236,17 @@ for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'boom') bullet[i].isUpgraded = true } + tech.setBotTechFrequency() + tech.setTechFrequency("boom-bot", 5) }, remove() { - tech.isBoomBotUpgrade = false - for (let i = 0; i < bullet.length; i++) { - if (bullet[i].botType === 'boom') bullet[i].isUpgraded = false + if (this.count) { + for (let i = 0; i < bullet.length; i++) { + if (bullet[i].botType === 'boom') bullet[i].isUpgraded = false + } + tech.setBotTechFrequency(1) } + tech.isBoomBotUpgrade = false } }, { @@ -1246,12 +1292,17 @@ for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'laser') bullet[i].isUpgraded = true } + tech.setBotTechFrequency() + tech.setTechFrequency("laser-bot", 5) }, remove() { - tech.isLaserBotUpgrade = false - for (let i = 0; i < bullet.length; i++) { - if (bullet[i].botType === 'laser') bullet[i].isUpgraded = false + if (this.count) { + for (let i = 0; i < bullet.length; i++) { + if (bullet[i].botType === 'laser') bullet[i].isUpgraded = false + } + tech.setBotTechFrequency(1) } + tech.isLaserBotUpgrade = false } }, { @@ -1302,17 +1353,21 @@ bullet[i].orbitalSpeed = Math.sqrt(0.25 / range) } } - + tech.setBotTechFrequency() + tech.setTechFrequency("orbital-bot", 5) }, remove() { - tech.isOrbitBotUpgrade = false - const range = 190 + 100 * tech.isOrbitBotUpgrade - for (let i = 0; i < bullet.length; i++) { - if (bullet[i].botType === 'orbit') { - bullet[i].range = range - bullet[i].orbitalSpeed = Math.sqrt(0.25 / range) + if (this.count) { + const range = 190 + 100 * tech.isOrbitBotUpgrade + for (let i = 0; i < bullet.length; i++) { + if (bullet[i].botType === 'orbit') { + bullet[i].range = range + bullet[i].orbitalSpeed = Math.sqrt(0.25 / range) + } } + tech.setBotTechFrequency(1) } + tech.isOrbitBotUpgrade = false } }, { @@ -1342,7 +1397,7 @@ }, { name: "dynamo-bot upgrade", - description: "convert your bots to dynamo-bots
increase regen to 20 energy per second", + description: "convert your bots to dynamo-bots
increase regen to 16 energy per second", maxCount: 1, count: 0, frequency: 2, @@ -1358,12 +1413,17 @@ for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'dynamo') bullet[i].isUpgraded = true } + tech.setBotTechFrequency() + tech.setTechFrequency("dynamo-bot", 5) }, remove() { - tech.isDynamoBotUpgrade = false - for (let i = 0; i < bullet.length; i++) { - if (bullet[i].botType === 'dynamo') bullet[i].isUpgraded = false + if (this.count) { + for (let i = 0; i < bullet.length; i++) { + if (bullet[i].botType === 'dynamo') bullet[i].isUpgraded = false + } + tech.setBotTechFrequency(1) } + tech.isDynamoBotUpgrade = false } }, { @@ -1456,7 +1516,7 @@ }, { name: "ersatz bots", - description: "double your permanent bots
remove all of your guns", + description: "double your current permanent bots
remove all of your current guns", maxCount: 1, count: 0, frequency: 2, @@ -1531,7 +1591,7 @@ }, { name: "flywheel", - description: "after a mob dies its block is flung at mobs
increase block collision damage by 100%", + description: "after a mob dies its block is flung at mobs
increase block collision damage by 150%", maxCount: 1, count: 0, frequency: 3, @@ -1547,6 +1607,24 @@ tech.isMobBlockFling = false } }, + { + name: "restitution", + description: "throwing a block makes it very bouncy
increase block collision damage by 150%", + maxCount: 1, + count: 0, + frequency: 3, + frequencyDefault: 3, + allowed() { + return (tech.throwChargeRate > 1 || m.fieldUpgrades[m.fieldMode].name === "pilot wave") && !tech.isBlockExplosion + }, + requires: "mass driver, not pilot wave not tokamak", + effect() { + tech.isBlockRestitution = true + }, + remove() { + tech.isBlockRestitution = false + } + }, // { // name: "fermions", // description: "blocks thrown by you or pilot wave will
collide with intangible mobs, but not you", @@ -1565,6 +1643,24 @@ // tech.isBlockBullets = false // } // }, + { + name: "inelastic collision", + description: "holding a block reduces harm by 85%
increase block collision damage by 150%", + maxCount: 1, + count: 0, + frequency: 3, + frequencyDefault: 3, + allowed() { + return tech.throwChargeRate > 1 && m.fieldUpgrades[m.fieldMode].name !== "pilot wave" && m.fieldUpgrades[m.fieldMode].name !== "wormhole" && !tech.isEnergyHealth + }, + requires: "mass driver, a field that can hold things, not mass-energy", + effect() { + tech.isBlockHarm = true + }, + remove() { + tech.isBlockHarm = false + } + }, { name: "inflation", description: "throwing a block expands it by 300%
increase throw charge rate by 200%", @@ -1573,9 +1669,9 @@ frequency: 3, frequencyDefault: 3, allowed() { - return tech.throwChargeRate > 1 && m.fieldUpgrades[m.fieldMode].name !== "pilot wave" + return (tech.throwChargeRate > 1 || m.fieldUpgrades[m.fieldMode].name === "pilot wave") && !tech.isBlockExplosion }, - requires: "mass driver, not pilot wave", + requires: "mass driver, not pilot wave not tokamak", effect() { tech.isAddBlockMass = true }, @@ -1584,7 +1680,7 @@ } }, { - name: "restitution", + name: "buckling", description: "if a block you threw kills a mob
spawn 1 heal, ammo, or research", maxCount: 1, count: 0, @@ -1601,24 +1697,6 @@ tech.isBlockPowerUps = false } }, - { - name: "inelastic collision", - description: "holding a block reduces harm by 85%
increase block collision damage by 100%", - maxCount: 1, - count: 0, - frequency: 3, - frequencyDefault: 3, - allowed() { - return tech.throwChargeRate > 1 && m.fieldUpgrades[m.fieldMode].name !== "pilot wave" && m.fieldUpgrades[m.fieldMode].name !== "wormhole" && !tech.isEnergyHealth - }, - requires: "mass driver, a field that can hold things, not mass-energy", - effect() { - tech.isBlockHarm = true - }, - remove() { - tech.isBlockHarm = false - } - }, { name: "Pauli exclusion", description: `after receiving harm from a collision become
immune to harm for 1 extra second`, @@ -2629,9 +2707,9 @@ frequency: 3, frequencyDefault: 3, allowed() { - return tech.isDeathAvoid + return tech.isDeathAvoid && tech.duplicationChance() < 0.66 }, - requires: "anthropic principle", + requires: "anthropic principle, below 66% duplication chance", effect() { tech.isAnthropicTech = true powerUps.setDo(); //needed after adjusting duplication chance @@ -3825,7 +3903,7 @@ }, { name: "worm-shot", - description: "shotgun hatches 3-4 mob seeking worms", //
worms seek out nearby mobs + description: "shotgun hatches 3-4 mob seeking worms
worms benefit from spore technology", //
worms seek out nearby mobs isGunTech: true, maxCount: 1, count: 0, @@ -7653,5 +7731,6 @@ isWormShot: null, isFoamShot: null, isIceShot: null, - isNeedleShot: null + isNeedleShot: null, + isBlockRestitution: null } \ No newline at end of file diff --git a/todo.txt b/todo.txt index 0aef0a1..ae25b36 100644 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,24 @@ ******************************************************** NEXT PATCH ******************************************************** +tech: restitution: thrown blocks are bouncy and blocks do 150% more damage + the tech previously named restitution is now named buckling + +after getting a bot upgrade, future bot tech will be for the upgraded bot type + (doesn't effect tech that gives random bots) + +bug fixes ******************************************************** TODO ******************************************************** +using worming makes you immune to harm and drains energy until you run out + disable incoming energy, by saving current energy and just setting energy in the next cycle to be lower then the saved value + +pink seeker boss is cool as heck, make an alt version of it + +perfect diamagnetism field stays when you aren't holding field + good for perfect because it doesn't use energy + holding field moves it the player + block shattering get code from planetesimals https://codepen.io/lilgreenland/pen/jrMvaB?editors=0010 @@ -12,17 +28,11 @@ mob that grows or gets a shield when player is near charge triggers an escape mode mob wonders and drops eggs that hatch into seekers if no player around -pink seeker boss is cool as heck, make an alt version of it - -perfect diamagnetism field stays when you aren't holding field - good for perfect because it doesn't use energy - holding field moves it the player - scrolling console history in pause menu? - also make tech, guns scrolling? -in testing mode console log the body you click on pause should at least show the last in game console message +in testing mode console log the body you click on + make the player get a buff after using wormhole while energy lasts: drain energy and give damage buff