From bfa1fe808c81f4e4ae6c0bc4e2c2bcb3445ecf91 Mon Sep 17 00:00:00 2001 From: landgreen Date: Thu, 29 Apr 2021 06:07:29 -0700 Subject: [PATCH] nonRefundable some bot related tech is no longer nonRefundable nonRefundable tech is now hidden in experiment mode --- .DS_Store | Bin 6148 -> 6148 bytes js/bullet.js | 39 +++++------- js/index.js | 4 +- js/level.js | 8 +-- js/player.js | 4 +- js/spawn.js | 10 +-- js/tech.js | 173 +++++++++++++++++++++++++++++++-------------------- todo.txt | 12 ++-- 8 files changed, 144 insertions(+), 106 deletions(-) diff --git a/.DS_Store b/.DS_Store index c99e68dcbf50b67b64b7318cdb4ec31ebe0aa612..2c514fde9e4d61235f1c3c010d9651026069298a 100644 GIT binary patch delta 21 ccmZoMXffEJ#muCuKUs&_kFjBMHFKv307D=K0{{R3 delta 21 ccmZoMXffEJ#muC 0) { b.fireWithAmmo() } else { @@ -2369,8 +2369,7 @@ const b = { return tech.isNailBotUpgrade + tech.isFoamBotUpgrade + tech.isBoomBotUpgrade + tech.isLaserBotUpgrade + tech.isOrbitBotUpgrade + tech.isDynamoBotUpgrade }, convertBotsTo(type) { //type can be a string like "dynamoBotCount" - //count all bots - const totalBots = b.totalBots() + const totalPermanentBots = b.totalBots() //remove all bots techs and convert them to the new type so that tech refunds work correctly let totalTechToConvert = 0 //count how many tech need to be converted for (let i = 0; i < tech.tech.length; i++) { @@ -2379,28 +2378,24 @@ const b = { tech.removeTech(i) } } - - let name = "" - if (type === "nailBotCount") name = "nail-bot" - if (type === "orbitBotCount") name = "orbital-bot" - if (type === "boomBotCount") name = "boom-bot" - if (type === "laserBotCount") name = "laser-bot" - if (type === "foamBotCount") name = "foam-bot" - if (type === "dynamoBotCount") name = "dynamo-bot" - if (type === "plasmaBotCount") name = "plasma-bot" - if (type === "missileBotCount") name = "missile-bot" - //spawn tech for the correct bot type - for (let i = 0; i < totalTechToConvert; i++) tech.giveTech(name) - //remove all bots b.zeroBotCount() - for (let i = 0; i < bullet.length; i++) { - if (bullet[i].botType && bullet[i].endCycle === Infinity) bullet[i].endCycle = 0 //don't remove temp bots + b.clearPermanentBots() + for (let i = 0; i < totalTechToConvert; i++) tech.giveTech(type) //spawn tech for the correct bot type + //find index of new bot type tech effect + let index = null + for (let i = 0; i < tech.tech.length; i++) { + if (tech.tech[i].name === type) { + index = i + break + } + } + for (let i = 0, len = totalPermanentBots - totalTechToConvert; i < len; i++) tech.tech[index].effect(); //also convert any permanent bots that didn't come from a tech + }, + clearPermanentBots() { + for (let i = 0; i < bullet.length; i++) { + if (bullet[i].botType && bullet[i].endCycle === Infinity) bullet[i].endCycle = 0 //remove active bots, but don't remove temp bots } - //set all bots to type - tech[type] = totalBots - //respawn all bots - b.respawnBots(); }, zeroBotCount() { //remove all bots tech.dynamoBotCount = 0 diff --git a/js/index.js b/js/index.js index 71e9018..beaf253 100644 --- a/js/index.js +++ b/js/index.js @@ -317,7 +317,7 @@ const build = { //update tech text //disable not allowed tech for (let i = 0, len = tech.tech.length; i < len; i++) { const techID = document.getElementById("tech-" + i) - if (!tech.tech[i].isExperimentHide) { + if (!tech.tech[i].isExperimentHide && (!tech.tech[i].isNonRefundable || tech.tech[i].isExperimentalMode)) { if (tech.tech[i].allowed() || isAllowed || tech.tech[i].count > 0) { const isCount = tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : ""; @@ -410,7 +410,7 @@ const build = { } for (let i = 0, len = tech.tech.length; i < len; i++) { - if (!tech.tech[i].isExperimentHide) { + if (!tech.tech[i].isExperimentHide && (!tech.tech[i].isNonRefundable || tech.tech[i].isExperimentalMode)) { if (tech.tech[i].allowed()) { // || tech.tech[i].name === "+1 cardinality") { //|| tech.tech[i].name === "leveraged investment" if (tech.tech[i].isExperimentalMode) { text += `
${tech.tech[i].name}
${tech.tech[i].description}
` diff --git a/js/level.js b/js/level.js index 5b9a673..08b6bec 100644 --- a/js/level.js +++ b/js/level.js @@ -16,7 +16,7 @@ const level = { // simulation.zoomScale = 1000; // simulation.setZoom(); // m.setField("nano-scale manufacturing") - // b.giveGuns("foam") + // b.giveGuns("wave beam") // b.giveGuns("laser") // tech.isExplodeRadio = true // for (let i = 0; i < 9; i++) tech.giveTech("auto-loading heuristics") @@ -1110,7 +1110,7 @@ const level = { spawn.mapRect(6700, -1800, 800, 2600); //right wall spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump - spawn.starter(1900, -500, 200) //big boy + // spawn.starter(1900, -500, 200) //big boy // spawn.grower(1900, -500) // spawn.pulsarBoss(1900, -500) // spawn.shooterBoss(1900, -500) @@ -1119,7 +1119,7 @@ const level = { // spawn.striker(1600, -500) // spawn.laserTargetingBoss(1700, -120) // spawn.bomberBoss(1400, -500) - // spawn.sniper(1800, -120) + spawn.ghoster(1800, -120) // spawn.streamBoss(1600, -500) // spawn.orbitalBoss(1600, -500) // spawn.cellBossCulture(1600, -500) @@ -1129,7 +1129,7 @@ const level = { // spawn.nodeGroup(1200, -500, "pulsar") // spawn.snakeBoss(1200, -500) - // spawn.powerUpBoss(2900, -500) + // spawn.suckerBoss(2900, -500) // spawn.randomMob(1600, -500) }, template() { diff --git a/js/player.js b/js/player.js index 28e5ede..747f7db 100644 --- a/js/player.js +++ b/js/player.js @@ -1145,7 +1145,7 @@ const m = { m.fieldCDcycle = m.cycle + 15; m.isHolding = false; //bullet-like collisions - // m.holdingTarget.collisionFilter.category = cat.bullet; //cat.body; + m.holdingTarget.collisionFilter.category = cat.body; m.holdingTarget.collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield; //check every second to see if player is away from thrown body, and make solid const solid = function(that) { @@ -1911,6 +1911,8 @@ const m = { // simulation.timeSkip(1) // m.energy += 1.5 * DRAIN; //x1 to undo the energy drain from time speed up, x1.5 to cut energy drain in half // } + } else { //holding, but field button is released + m.wakeCheck(); } } else if (m.holdingTarget && m.fieldCDcycle < m.cycle) { //holding, but field button is released m.wakeCheck(); diff --git a/js/spawn.js b/js/spawn.js index e78ee52..011a0f2 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -2162,10 +2162,12 @@ const spawn = { this.attraction(); this.search(); //draw - if (this.distanceToPlayer2() - this.seeAtDistance2 < 0) { - if (this.alpha < 1) this.alpha += 0.004; - } else { - if (this.alpha > 0) this.alpha -= 0.03; + if (!m.isBodiesAsleep) { + if (this.distanceToPlayer2() - this.seeAtDistance2 < 0) { + if (this.alpha < 1) this.alpha += 0.002 * simulation.CDScale; + } else { + if (this.alpha > 0) this.alpha -= 0.03; + } } if (this.alpha > 0) { if (this.alpha > 0.9 && this.seePlayer.recall) { diff --git a/js/tech.js b/js/tech.js index 3a182a8..9866c0d 100644 --- a/js/tech.js +++ b/js/tech.js @@ -22,6 +22,17 @@ simulation.updateTechHUD(); }, removeTech(index) { + if (isNaN(index)) { //find index by name + let found = false; + for (let i = 0; i < tech.tech.length; i++) { + if (index === tech.tech[i].name) { + index = i; + found = true; + break; + } + } + if (!found) return //if name not found don't remove any tech + } tech.tech[index].remove(); tech.tech[index].count = 0; simulation.updateTechHUD(); @@ -1011,7 +1022,6 @@ maxCount: 9, count: 0, frequency: 1, - isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1023,7 +1033,11 @@ b.nailBot(); }, remove() { - // tech.nailBotCount -= this.count; + if (this.count) { + tech.nailBotCount -= this.count; + b.clearPermanentBots(); + b.respawnBots(); + } } }, { @@ -1039,7 +1053,7 @@ requires: "2 or more nail bots and only 1 bot upgrade", effect() { tech.isNailBotUpgrade = true - b.convertBotsTo("nailBotCount") + b.convertBotsTo("nail-bot") for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'nail') bullet[i].isUpgraded = true } @@ -1057,7 +1071,6 @@ maxCount: 9, count: 0, frequency: 1, - isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1069,7 +1082,11 @@ b.foamBot(); }, remove() { - // tech.foamBotCount -= this.count; + if (this.count) { + tech.foamBotCount -= this.count; + b.clearPermanentBots(); + b.respawnBots(); + } } }, { @@ -1085,7 +1102,7 @@ requires: "2 or more foam bots and only 1 bot upgrade", effect() { tech.isFoamBotUpgrade = true - b.convertBotsTo("foamBotCount") + b.convertBotsTo("foam-bot") for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'foam') bullet[i].isUpgraded = true } @@ -1103,7 +1120,6 @@ maxCount: 9, count: 0, frequency: 1, - isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1115,7 +1131,11 @@ b.boomBot(); }, remove() { - // tech.boomBotCount -= this.count; + if (this.count) { + tech.boomBotCount -= this.count; + b.clearPermanentBots(); + b.respawnBots(); + } } }, { @@ -1131,7 +1151,7 @@ requires: "2 or more boom bots and only 1 bot upgrade", effect() { tech.isBoomBotUpgrade = true - b.convertBotsTo("boomBotCount") + b.convertBotsTo("boom-bot") for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'boom') bullet[i].isUpgraded = true } @@ -1149,7 +1169,6 @@ maxCount: 9, count: 0, frequency: 1, - isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1161,7 +1180,11 @@ b.laserBot(); }, remove() { - // tech.laserBotCount -= this.count; + if (this.count) { + tech.laserBotCount -= this.count; + b.clearPermanentBots(); + b.respawnBots(); + } } }, { @@ -1177,7 +1200,7 @@ requires: "2 or more laser bots and only 1 bot upgrade", effect() { tech.isLaserBotUpgrade = true - b.convertBotsTo("laserBotCount") + b.convertBotsTo("laser-bot") for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'laser') bullet[i].isUpgraded = true } @@ -1195,7 +1218,7 @@ maxCount: 9, count: 0, frequency: 1, - isNonRefundable: true, + isBot: true, isBotTech: true, allowed() { @@ -1207,7 +1230,11 @@ tech.orbitBotCount++; }, remove() { - // tech.orbitBotCount -= this.count; + if (this.count) { + tech.orbitBotCount -= this.count; + b.clearPermanentBots(); + b.respawnBots(); + } } }, { @@ -1223,7 +1250,7 @@ requires: "2 or more orbital bots and only 1 bot upgrade", effect() { tech.isOrbitBotUpgrade = true - b.convertBotsTo("orbitBotCount") + b.convertBotsTo("orbital-bot") const range = 190 + 60 * tech.isOrbitBotUpgrade for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'orbit') { @@ -1251,7 +1278,6 @@ maxCount: 9, count: 0, frequency: 1, - isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1263,7 +1289,11 @@ b.dynamoBot(); }, remove() { - // tech.dynamoBotCount -= this.count; + if (this.count) { + tech.dynamoBotCount -= this.count; + b.clearPermanentBots(); + b.respawnBots(); + } } }, { @@ -1279,7 +1309,7 @@ requires: "2 or more dynamo bots and only 1 bot upgrade", effect() { tech.isDynamoBotUpgrade = true - b.convertBotsTo("dynamoBotCount") + b.convertBotsTo("dynamo-bot") for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType === 'dynamo') bullet[i].isUpgraded = true } @@ -1382,13 +1412,15 @@ count: 0, frequency: 2, isBotTech: true, - isNonRefundable: true, + // isNonRefundable: true, isBadRandomOption: true, + numberOfGunsLost: 0, allowed() { return b.totalBots() > 3 }, requires: "at least 4 bots", effect() { + this.numberOfGunsLost = b.inventory.length b.removeAllGuns(); simulation.makeGunHUD(); //double bots @@ -1409,7 +1441,25 @@ for (let i = 0; i < tech.missileBotCount; i++) b.missileBot(); tech.missileBotCount *= 2 }, - remove() {} + remove() { + if (this.count) { + //return guns + for (let i = 0; i < this.numberOfGunsLost; i++) powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "gun"); + this.numberOfGunsLost = 0; + + //half all current guns + tech.nailBotCount = Math.round(tech.nailBotCount / 2) + tech.laserBotCount = Math.round(tech.laserBotCount / 2) + tech.foamBotCount = Math.round(tech.foamBotCount / 2) + tech.boomBotCount = Math.round(tech.boomBotCount / 2) + tech.orbitBotCount = Math.round(tech.orbitBotCount / 2) + tech.dynamoBotCount = Math.round(tech.dynamoBotCount / 2) + tech.plasmaBotCount = Math.round(tech.plasmaBotCount / 2) + tech.missileBotCount = Math.round(tech.missileBotCount / 2) + b.clearPermanentBots(); + b.respawnBots(); + } + } }, { name: "mass driver", @@ -2391,7 +2441,7 @@ powerUps.research.changeRerolls(0) }, 1000); }, - description: "once per level use 1 research
to prevent dying and spawn 6 heals", + description: "once per level, instead of dying
consume 1 research and spawn 6 heals", maxCount: 1, count: 0, frequency: 2, @@ -2662,7 +2712,7 @@ }, { name: "replication", - description: "7% chance to duplicate spawned power ups
add 12 JUNK tech to the potential pool", + description: "7.5% chance to duplicate spawned power ups
add 12 JUNK tech to the potential pool", maxCount: 9, count: 0, frequency: 1, @@ -2797,7 +2847,7 @@ }, { name: "exchange symmetry", - description: "convert 1 a random tech into 3 new guns
recursive tech lose all stacks", + description: "convert 1 random tech into 3 new guns
recursive tech lose all stacks", maxCount: 1, count: 0, frequency: 1, @@ -3661,7 +3711,6 @@ maxCount: 1, count: 0, frequency: 2, - isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -3673,7 +3722,9 @@ b.missileBot(); }, remove() { - // tech.missileBotCount = 0; + tech.missileBotCount = 0; + b.clearPermanentBots(); + b.respawnBots(); } }, { @@ -4491,7 +4542,7 @@ }, { name: "bot manufacturing", - description: "use nano-scale manufacturing
to build 3 random bots", + description: "use nano-scale manufacturing
to build 2 random bots", isFieldTech: true, maxCount: 1, count: 0, @@ -4508,13 +4559,13 @@ m.energy = 0.01; b.randomBot() b.randomBot() - b.randomBot() + // b.randomBot() }, remove() {} }, { - name: "bot prototypes", - description: "use nano-scale manufacturing to upgrade
all bots to a random type and build 2 bots", + name: "bot prototype", + description: "use nano-scale manufacturing to build
a random bot and upgrade all bots to that type", isFieldTech: true, maxCount: 1, count: 0, @@ -4531,72 +4582,59 @@ m.energy = 0.01; //fill array of available bots const notUpgradedBots = [] - if (!tech.isNailBotUpgrade) notUpgradedBots.push(() => { + const num = 1 + notUpgradedBots.push(() => { tech.giveTech("nail-bot upgrade") - tech.setTechoNonRefundable("nail-bot upgrade") - for (let i = 0; i < 2; i++) { + for (let i = 0; i < num; i++) { b.nailBot() tech.nailBotCount++; } simulation.makeTextLog(`tech.isNailBotUpgrade = true`) }) - if (!tech.isFoamBotUpgrade) notUpgradedBots.push(() => { + notUpgradedBots.push(() => { tech.giveTech("foam-bot upgrade") - tech.setTechoNonRefundable("foam-bot upgrade") - for (let i = 0; i < 2; i++) { + for (let i = 0; i < num; i++) { b.foamBot() tech.foamBotCount++; } simulation.makeTextLog(`tech.isFoamBotUpgrade = true`) }) - if (!tech.isBoomBotUpgrade) notUpgradedBots.push(() => { + notUpgradedBots.push(() => { tech.giveTech("boom-bot upgrade") - tech.setTechoNonRefundable("boom-bot upgrade") - for (let i = 0; i < 2; i++) { + for (let i = 0; i < num; i++) { b.boomBot() tech.boomBotCount++; } simulation.makeTextLog(`tech.isBoomBotUpgrade = true`) }) - if (!tech.isLaserBotUpgrade) notUpgradedBots.push(() => { + notUpgradedBots.push(() => { tech.giveTech("laser-bot upgrade") - tech.setTechoNonRefundable("laser-bot upgrade") - for (let i = 0; i < 2; i++) { + for (let i = 0; i < num; i++) { b.laserBot() tech.laserBotCount++; } simulation.makeTextLog(`tech.isLaserBotUpgrade = true`) }) - if (!tech.isOrbitBotUpgrade) notUpgradedBots.push(() => { + notUpgradedBots.push(() => { tech.giveTech("orbital-bot upgrade") - tech.setTechoNonRefundable("orbital-bot upgrade") - for (let i = 0; i < 2; i++) { + for (let i = 0; i < num; i++) { b.orbitBot() tech.orbitBotCount++; } simulation.makeTextLog(`tech.isOrbitalBotUpgrade = true`) }) - if (!tech.isDynamoBotUpgrade) notUpgradedBots.push(() => { - tech.giveTech("dynamo-bot upgrade") - tech.setTechoNonRefundable("dynamo-bot upgrade") - for (let i = 0; i < 2; i++) { - b.dynamoBot() - tech.dynamoBotCount++; - } - simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`) - }) - //double chance for dynamo-bot, since it's very good for nano-scale - if (!tech.isDynamoBotUpgrade) notUpgradedBots.push(() => { - tech.giveTech("dynamo-bot upgrade") - tech.setTechoNonRefundable("dynamo-bot upgrade") - for (let i = 0; i < 2; i++) { - b.dynamoBot() - tech.dynamoBotCount++; - } - simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`) - }) - //choose random function from the array and run it - notUpgradedBots[Math.floor(Math.random() * notUpgradedBots.length)]() + for (let i = 0; i < 2; i++) { //double chance for dynamo-bot, since it's very good for nano-scale + notUpgradedBots.push(() => { + tech.giveTech("dynamo-bot upgrade") + for (let i = 0; i < num; i++) { + b.dynamoBot() + tech.dynamoBotCount++; + } + simulation.makeTextLog(`tech.isDynamoBotUpgrade = true`) + }) + } + + notUpgradedBots[Math.floor(Math.random() * notUpgradedBots.length)]() //choose random function from the array and run it }, remove() {} }, @@ -4770,7 +4808,6 @@ maxCount: 1, count: 0, frequency: 2, - isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -4782,7 +4819,9 @@ b.plasmaBot(); }, remove() { - // tech.plasmaBotCount = 0; + tech.plasmaBotCount = 0; + b.clearPermanentBots(); + b.respawnBots(); } }, { diff --git a/todo.txt b/todo.txt index f8499a4..5752c55 100644 --- a/todo.txt +++ b/todo.txt @@ -1,11 +1,7 @@ ******************************************************** NEXT PATCH ******************************************************** -pulse laser now charges up with energy before you fire, but it fires 3 overlapping explosions - please give feedback on balance (too strong, too weak?) - -tech shockwave: now applies to all explosions - -foam gun now gets 20% less ammo +some bot related tech is no longer nonRefundable +nonRefundable tech is now hidden in experiment mode ******************************************************** BUGS ******************************************************** @@ -41,6 +37,7 @@ is there a way to check if the player is stuck inside the map or block avoid taking collision damage by teleporting to a random power up removes the power up + what if you get stuck? make a tech that improves all charge guns for: pulse, foam, rail gun @@ -52,6 +49,9 @@ make a tech that improves all charge guns apply the new gun.do functions to other guns rail gun + crouching missile? + works similar to foam + tech plasma field - plasma field becomes an aoe damage field with the same radius 200% more energy drain, 100% more damage