From ef63dc549463e6a8bbd271ae488240775d80a7d4 Mon Sep 17 00:00:00 2001 From: landgreen Date: Sat, 17 Apr 2021 09:55:27 -0700 Subject: [PATCH] crossfire bots are now nonrefundable, so they don't display as a tech when you select them this might introduce some errors, please let me know if you see something bot counts can be seen in pause menu the final boss will spawn progressively more mobs if you don't kill it quickly enough levelBosses are also more likely to spawn on the final boss added community map - crossfire by iNoobBoi --- index.html | 2 +- js/index.js | 11 +++ js/level.js | 175 ++++++++++++++++++++++++++++++++++++++++++++++- js/powerup.js | 46 +++++++------ js/simulation.js | 4 +- js/spawn.js | 33 +++++---- js/tech.js | 32 +++++---- todo.txt | 17 +++-- 8 files changed, 259 insertions(+), 61 deletions(-) diff --git a/index.html b/index.html index 19afb94..9424d56 100644 --- a/index.html +++ b/index.html @@ -119,7 +119,7 @@ - + diff --git a/js/index.js b/js/index.js index 7a1e2eb..d74f71a 100644 --- a/js/index.js +++ b/js/index.js @@ -178,6 +178,16 @@ const build = { } }, pauseGrid() { + let botText = "" + if (tech.nailBotCount) botText += `
nail-bots: ${tech.nailBotCount}` + if (tech.orbitBotCount) botText += `
orbital-bots: ${tech.orbitBotCount}` + if (tech.boomBotCount) botText += `
boom-bots: ${tech.boomBotCount}` + if (tech.laserBotCount) botText += `
laser-bots: ${tech.laserBotCount}` + if (tech.foamBotCount) botText += `
foam-bots: ${tech.foamBotCount}` + if (tech.dynamoBotCount) botText += `
dynamo-bots: ${tech.dynamoBotCount}` + if (tech.plasmaBotCount) botText += `
plasma-bots: ${tech.plasmaBotCount}` + if (tech.missileBotCount) botText += `
missile-bots: ${tech.missileBotCount}` + const harm = (1 - m.harmReduction()) * 100 let text = "" if (!simulation.isChoosing) text += `
@@ -188,6 +198,7 @@ const build = {
harm reduction: ${harm.toFixed(harm > 90 ? 2 : 0)}%
fire delay decrease: ${((1-b.fireCD)*100).toFixed(b.fireCD < 0.1 ? 2 : 0)}%
duplication chance: ${(Math.min(1,tech.duplicationChance())*100).toFixed(0)}% + ${botText}

tech: ${tech.totalCount}   research: ${powerUps.research.count}
health: (${(m.health*100).toFixed(0)} / ${(m.maxHealth*100).toFixed(0)})   energy: (${(m.energy*100).toFixed(0)} / ${(m.maxEnergy*100).toFixed(0)}) diff --git a/js/level.js b/js/level.js index cc04029..6eb843d 100644 --- a/js/level.js +++ b/js/level.js @@ -12,7 +12,7 @@ const level = { start() { if (level.levelsCleared === 0) { //this code only runs on the first level // simulation.enableConstructMode() //used to build maps in testing mode - // level.difficultyIncrease(11) + // level.difficultyIncrease(50) // simulation.zoomScale = 1000; // simulation.setZoom(); // m.setField("nano-scale manufacturing") @@ -57,6 +57,7 @@ const level = { // level.stronghold() //community level // level.perplex() //community level // level.coliseum() //community level + // level.crossfire() //community level // powerUps.directSpawn(simulation.mouseInGame.x, simulation.mouseInGame.y, "tech"); // tech.giveTech("undefined") @@ -1110,7 +1111,7 @@ const level = { // spawn.grower(1900, -500) // spawn.pulsarBoss(1900, -500) // spawn.shooterBoss(1900, -500) - spawn.shooter(2900, -500) + spawn.spawns(2900, -500) // spawn.launcherBoss(1200, -500) // spawn.laserTargetingBoss(1600, -400) // spawn.striker(4600, -500) @@ -4613,4 +4614,174 @@ const level = { if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) spawn.randomLevelBoss(6600, 600, ["historyBoss", "powerUpBoss", "pulsarBoss", "orbitalBoss"]); }, + crossfire() { + //*1.5 + //Level Setup + const slimePitOne = level.hazard(0, 850, 3800, 120, 25); + const slimePitTwo = level.hazard(4600, 430, 2000, 120, 35); + const slimePitThree = level.hazard(6500, 200, 1000, 170, 50); + + level.custom = () => { + slimePitOne.query(); + slimePitTwo.query(); + slimePitThree.query(); + slimePitOne.draw(); + slimePitTwo.draw(); + slimePitThree.draw(); + level.playerExitCheck(); + level.exit.draw(); + level.enter.draw(); + }; + level.customTopLayer = () => {}; + + level.setPosToSpawn(-500, 550); //normal spawn + spawn.mapRect(level.enter.x, level.enter.y + 20, 100, 20); + + level.exit.x = 10300; + level.exit.y = -830; + spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 20); + + level.defaultZoom = 3000 + simulation.zoomTransition(level.defaultZoom) + document.body.style.backgroundColor = "#dcdcde"; + + //Map Elements + spawn.mapRect(-800, -600, 800, 200); + spawn.mapRect(-200, -600, 200, 800); + spawn.mapRect(-800, -600, 200, 800); + spawn.mapRect(-1000, 0, 1000, 200); + spawn.mapRect(-1000, 0, 200, 800); + spawn.mapRect(-1000, 600, 1400, 200); + spawn.mapRect(0, 600, 200, 400); + spawn.mapRect(0, 950, 4000, 100); + spawn.mapRect(800, 800, 600, 200); + spawn.mapRect(1700, 700, 500, 300); + spawn.mapRect(2500, 600, 400, 400); + spawn.mapRect(3200, 600, 1200, 200); + spawn.mapRect(3800, 600, 200, 800); // + spawn.mapRect(3800, 1200, 800, 200); + spawn.mapRect(4400, 400, 300, 1000); + spawn.mapRect(4400, 500, 2000, 100); + spawn.mapRect(6500, 300, 1000, 100); + spawn.mapRect(5000, 200, 700, 400); + spawn.mapRect(6000, 0, 650, 600); + spawn.mapRect(6900, -300, 700, 100); + spawn.mapRect(7400, -600, 200, 1100); + spawn.mapRect(7400, 300, 2600, 200); + spawn.mapRect(9800, -800, 200, 1300); + spawn.mapRect(9800, -800, 1000, 200); + spawn.mapRect(10600, -1400, 200, 800); + spawn.mapRect(9800, -1400, 200, 400); + spawn.mapRect(7400, -1400, 3400, 200); + spawn.mapRect(7400, -1600, 200, 800); + spawn.mapRect(5400, -1600, 2200, 200); + spawn.mapRect(6000, -1600, 200, 800); + spawn.mapRect(5400, -1600, 200, 800); + spawn.mapRect(4800, -1000, 1400, 200); + spawn.mapRect(4800, -1000, 200, 600); + spawn.mapRect(3800, -600, 1200, 200); + spawn.mapRect(3200, -800, 800, 200); + spawn.mapRect(3200, -800, 200, 800); + spawn.mapRect(3800, -800, 200, 800); + spawn.mapRect(-200, -200, 4200, 200); + + //Boss Room Platforms + spawn.mapRect(7700, 100, 300, 40); + spawn.mapRect(8600, 0, 300, 40); + spawn.mapRect(9200, 100, 300, 40); + spawn.mapRect(9400, -200, 300, 40); + spawn.mapRect(8000, -200, 300, 40); + spawn.mapRect(8500, -400, 300, 40); + spawn.mapRect(9000, -600, 300, 40); + spawn.mapRect(9400, -800, 300, 40); + spawn.mapRect(8600, -1000, 300, 40); + spawn.mapRect(7900, -800, 300, 40); + + //Mob Spawning + spawn.randomMob(200, 400, 0.7); + spawn.randomMob(1200, 400, 0.7); + spawn.randomMob(2000, 400, 0.7); + spawn.randomMob(3000, 400, 0.7); + spawn.randomMob(5000, 0, 0.7); + spawn.randomMob(5600, 0, 0.7); + spawn.randomMob(6200, -200, 0.7); + spawn.randomMob(6600, -200, 0.7); + spawn.randomMob(7200, -800, 0.7); + spawn.randomSmallMob(800, 400, 0.9); + spawn.randomSmallMob(1800, 400, 0.9); + spawn.randomSmallMob(2600, 400, 0.9); + spawn.randomSmallMob(5200, 0, 0.9); + spawn.randomSmallMob(5400, 0, 0.9); + spawn.randomSmallMob(6400, -200, 0.9); + spawn.randomGroup(3800, 400, 0.5); + spawn.randomGroup(4200, 400, 0.5); + spawn.randomGroup(4400, 200, 0.5); + spawn.randomGroup(7000, -800, 0.5); + spawn.randomGroup(7700, 300, 0.5); + spawn.randomGroup(9800, 300, 0.5); + spawn.randomGroup(7700, -1100, 0.5); + spawn.randomGroup(9800, -1100, 0.5); + + if (simulation.difficulty > 10) { + spawn.randomLevelBoss(8600, -600, ["powerUpBoss", "bomberBoss", "snakeBoss", "spiderBoss", "historyBoss"]); + } + if (tech.isDuplicateBoss && Math.random() < 2 * tech.duplicationChance()) { + spawn.randomLevelBoss(7900, -400, ["powerUpBoss", "spiderBoss", "historyBoss"]); + } + + //Boss Spawning + spawn.pulsarBoss(-400, -200); + if (simulation.difficulty > 25) { + spawn.pulsarBoss(3600, -400); + if (simulation.difficulty > 40) { + spawn.pulsarBoss(4200, 1000); + if (simulation.difficulty > 65) { + spawn.pulsarBoss(5800, -1200); + spawn.pulsarBoss(-400, -200); + if (simulation.difficulty > 85) { + spawn.pulsarBoss(3600, -400); + spawn.pulsarBoss(4200, 1000); + if (simulation.difficulty > 115) { + spawn.pulsarBoss(5800, -1200); + spawn.pulsarBoss(-400, -200); + spawn.pulsarBoss(3600, -400); + } + } + } + } + } + + //Powerup Spawning + powerUps.spawnStartingPowerUps(4000, 400); + powerUps.spawnStartingPowerUps(4400, 400); + powerUps.chooseRandomPowerUp(4000, 400); + powerUps.chooseRandomPowerUp(4000, 400); + powerUps.chooseRandomPowerUp(4400, 400); + powerUps.chooseRandomPowerUp(4400, 400); + powerUps.addRerollToLevel(); //needs to run after mobs are spawned + + //Block Spawning + // spawn.bodyRect(-100, 200, 100, 400); //spawn door + spawn.bodyRect(7450, -800, 25, 200); //boss room door + spawn.bodyRect(9850, -1000, 25, 200); //end door + spawn.mapRect(-200, 350, 200, 450); + + // spawn.mapRect(3875, -75, 50, 575); + spawn.mapRect(3800, -75, 200, 525); + spawn.mapRect(3875, 590, 50, 150); + spawn.mapRect(3875, 350, 50, 140); + + const debrisCount = 3 + spawn.debris(1050, 700, 400, debrisCount); + spawn.debris(1900, 600, 400, debrisCount); + spawn.debris(2700, 500, 400, debrisCount); + // spawn.debris(3500, 450, 400, debrisCount); + spawn.debris(4150, 500, 400, debrisCount); + spawn.debris(5300, 0, 400, debrisCount); + spawn.debris(6300, -100, 400, debrisCount); + spawn.debris(7200, -500, 400, debrisCount); + spawn.debris(8000, -600, 400, debrisCount); + spawn.debris(8700, -700, 400, debrisCount); + spawn.debris(9300, -900, 400, debrisCount); + }, }; \ No newline at end of file diff --git a/js/powerup.js b/js/powerup.js index d1e20ad..2feccec 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -531,30 +531,32 @@ const powerUps = { }, randomPowerUpCounter: 0, spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades - if (m.fieldMode === 0) { - powerUps.spawn(x, y, "field") - } else { - powerUps.randomPowerUpCounter++; - powerUpChance(Math.max(level.levelsCleared, 10) * 0.1) - } - powerUps.randomPowerUpCounter += 0.6; - powerUpChance(Math.max(level.levelsCleared, 6) * 0.1) - - function powerUpChance(chanceToFail) { - if (Math.random() * chanceToFail < powerUps.randomPowerUpCounter) { - powerUps.randomPowerUpCounter = 0; - if (Math.random() < 0.97) { - powerUps.spawn(x, y, "tech") - } else { - powerUps.spawn(x, y, "gun") - } + if (level.levels[level.onLevel] !== "final") { + if (m.fieldMode === 0) { + powerUps.spawn(x, y, "field") } else { - if (m.health < 0.65 && !tech.isEnergyHealth) { - powerUps.spawn(x, y, "heal"); - powerUps.spawn(x, y, "heal"); + powerUps.randomPowerUpCounter++; + powerUpChance(Math.max(level.levelsCleared, 10) * 0.1) + } + powerUps.randomPowerUpCounter += 0.6; + powerUpChance(Math.max(level.levelsCleared, 6) * 0.1) + + function powerUpChance(chanceToFail) { + if (Math.random() * chanceToFail < powerUps.randomPowerUpCounter) { + powerUps.randomPowerUpCounter = 0; + if (Math.random() < 0.97) { + powerUps.spawn(x, y, "tech") + } else { + powerUps.spawn(x, y, "gun") + } } else { - powerUps.spawn(x, y, "ammo"); - powerUps.spawn(x, y, "ammo"); + if (m.health < 0.65 && !tech.isEnergyHealth) { + powerUps.spawn(x, y, "heal"); + powerUps.spawn(x, y, "heal"); + } else { + powerUps.spawn(x, y, "ammo"); + powerUps.spawn(x, y, "ammo"); + } } } } diff --git a/js/simulation.js b/js/simulation.js index ee6b480..99a7fb6 100644 --- a/js/simulation.js +++ b/js/simulation.js @@ -521,10 +521,12 @@ const simulation = { if (simulation.isCommunityMaps) { level.levels.push("stronghold"); level.levels.push("basement"); - // level.levels.push("detours"); + level.levels.push("crossfire"); level.levels.push("house"); level.levels.push("perplex"); level.levels.push("coliseum"); + + // level.levels.push("vats"); level.levels.splice(0, 5); //remove some random levels to make up for adding the community levels diff --git a/js/spawn.js b/js/spawn.js index 679218a..56e8c6f 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -178,6 +178,7 @@ const spawn = { me.onDamage = function() {}; me.cycle = 420; me.endCycle = 780; + me.totalCycles = 0 me.mode = 0; me.do = function() { Matter.Body.setPosition(this, { //hold position @@ -191,6 +192,7 @@ const spawn = { this.modeDo(); //this does different things based on the mode this.checkStatus(); this.cycle++; //switch modes÷ + this.totalCycles++; // if (!m.isBodiesAsleep) { if (this.health > 0.25) { if (this.cycle > this.endCycle) { @@ -251,23 +253,20 @@ const spawn = { if (!(this.cycle % this.spawnInterval) && !m.isBodiesAsleep && mob.length < 40) { if (this.mode !== 3) Matter.Body.setAngularVelocity(this, 0.1) //fire a bullet from each vertex - let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]; - - const step = (this.health > 0.75) ? 2 : 1 - for (let i = 0, len = this.vertices.length; i < len; i += step) { - spawn[whoSpawn](this.vertices[i].x, this.vertices[i].y); - const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -18) //give the mob a rotational velocity as if they were attached to a vertex + const whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]; + for (let i = 0, len = 2 + this.totalCycles / 1000; i < len; i++) { + const vertex = this.vertices[i % 6] + spawn[whoSpawn](vertex.x + 50 * (Math.random() - 0.5), vertex.y + 50 * (Math.random() - 0.5)); + const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, vertex))), -18) //give the mob a rotational velocity as if they were attached to a vertex Matter.Body.setVelocity(mob[mob.length - 1], { x: this.velocity.x + velocity.x, y: this.velocity.y + velocity.y }); } - - if (simulation.difficulty > 60) { - spawn.randomLevelBoss(3000, -1100) - if (simulation.difficulty > 100) { - spawn.randomLevelBoss(3000, -1300) - } + const len = (this.totalCycles / 400 + simulation.difficulty / 2 - 30) / 15 + // console.log(len) + for (let i = 0; i < len; i++) { + spawn.randomLevelBoss(3000 + 2000 * (Math.random() - 0.5), -1100 + 200 * (Math.random() - 0.5)) } } } @@ -2830,12 +2829,12 @@ const spawn = { this.explode(); }; // me.stroke = "transparent" - me.collisionFilter.mask = cat.player | cat.bullet | cat.body | cat.map + me.collisionFilter.mask = cat.player | cat.bullet | cat.body | cat.map | cat.mob me.showHealthBar = false; - Matter.Body.setDensity(me, 0.0005); //normal is 0.001 - me.g = 0.0001; //required if using 'gravity' - me.accelMag = 0.00008 * simulation.accelScale; - me.memory = 30; + Matter.Body.setDensity(me, 0.0001); //normal is 0.001 + me.g = 0.00002; //required if using 'gravity' + me.accelMag = 0.00012 * simulation.accelScale; + // me.memory = 30; me.leaveBody = false; me.isDropPowerUp = false; me.seePlayerFreq = Math.round((80 + 50 * Math.random()) * simulation.lookFreqScale); diff --git a/js/tech.js b/js/tech.js index a1c15f9..564c214 100644 --- a/js/tech.js +++ b/js/tech.js @@ -272,7 +272,7 @@ }, { name: "gun sciences", - description: "spawn a gun and double the frequency
of finding tech for a specific gun", + description: "spawn a gun and double the frequency
of finding tech for your guns", maxCount: 1, count: 0, frequency: 2, @@ -978,6 +978,7 @@ maxCount: 9, count: 0, frequency: 1, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -989,7 +990,7 @@ b.nailBot(); }, remove() { - tech.nailBotCount -= this.count; + // tech.nailBotCount -= this.count; } }, { @@ -1023,6 +1024,7 @@ maxCount: 9, count: 0, frequency: 1, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1034,7 +1036,7 @@ b.foamBot(); }, remove() { - tech.foamBotCount -= this.count; + // tech.foamBotCount -= this.count; } }, { @@ -1068,6 +1070,7 @@ maxCount: 9, count: 0, frequency: 1, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1079,7 +1082,7 @@ b.boomBot(); }, remove() { - tech.boomBotCount -= this.count; + // tech.boomBotCount -= this.count; } }, { @@ -1113,6 +1116,7 @@ maxCount: 9, count: 0, frequency: 1, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1124,7 +1128,7 @@ b.laserBot(); }, remove() { - tech.laserBotCount -= this.count; + // tech.laserBotCount -= this.count; } }, { @@ -1158,6 +1162,7 @@ maxCount: 9, count: 0, frequency: 1, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1169,7 +1174,7 @@ tech.orbitBotCount++; }, remove() { - tech.orbitBotCount -= this.count; + // tech.orbitBotCount -= this.count; } }, { @@ -1213,6 +1218,7 @@ maxCount: 9, count: 0, frequency: 1, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -1224,7 +1230,7 @@ b.dynamoBot(); }, remove() { - tech.dynamoBotCount -= this.count; + // tech.dynamoBotCount -= this.count; } }, { @@ -2656,11 +2662,11 @@ description: "clicking × to cancel a field, tech, or gun
spawns 8 heals, ammo, and research", maxCount: 1, count: 0, - frequency: 2, + frequency: 1, allowed() { - return tech.isCancelDuplication + return !tech.isDeterminism }, - requires: "futures exchange", + requires: "not determinism", effect() { tech.isCancelRerolls = true }, @@ -3586,6 +3592,7 @@ maxCount: 1, count: 0, frequency: 2, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -3597,7 +3604,7 @@ b.missileBot(); }, remove() { - tech.missileBotCount = 0; + // tech.missileBotCount = 0; } }, { @@ -4712,6 +4719,7 @@ maxCount: 1, count: 0, frequency: 2, + isNonRefundable: true, isBot: true, isBotTech: true, allowed() { @@ -4723,7 +4731,7 @@ b.plasmaBot(); }, remove() { - tech.plasmaBotCount = 0; + // tech.plasmaBotCount = 0; } }, { diff --git a/todo.txt b/todo.txt index 16f157e..c3db8f6 100644 --- a/todo.txt +++ b/todo.txt @@ -1,12 +1,17 @@ ******************************************************** NEXT PATCH ******************************************************** -fixed: sniper/shooter issues with aiming -fixed: Copied build urls +bots are now nonrefundable, so they don't display as a tech when you select them + this might introduce some errors, please let me know if you see something +bot counts can be seen in pause menu + +the final boss will spawn progressively more mobs if you don't kill it quickly enough + levelBosses are also more likely to spawn on the final boss + +added community map - crossfire + by iNoobBoi ******************************************************** BUGS ******************************************************** -spawns are forming node groups, but why?? - you have to press z once to get copy to work for simulation.enableConstructMode() sometimes not sure how to reproduce, but it happens often on the first draw @@ -35,9 +40,9 @@ fix door.isOpen actually meaning isClosed? ******************************************************** TODO ******************************************************** -Tech: "Spacial Continuity": 12% chance for the block resulting from a slain enemy to be thrown at the nearst mob. +import the procedural level generation from one of the older versions of the game as one single level -Mobs that travel through walls but get stuck on blocks are annoying +Tech: "Spacial Continuity": 12% chance for the block resulting from a slain enemy to be thrown at the nearest mob. tech plasma field - plasma field becomes an aoe damage field with the same radius 200% more energy drain, 100% more damage