From cd0e47df30bf14adeb83807cb58ec376d0cefcb7 Mon Sep 17 00:00:00 2001 From: landgreen Date: Thu, 7 Jan 2021 12:24:40 -0800 Subject: [PATCH] complex spinstatistics tech: active cooling - 15% faster fire rate for each gun in your inventory tech: specialist - spawn a random power up for each gun in your inventory (not available in custom, requires tech: generalist) tech: complex spin-statistics - become immune to harm for 1s every 7s requires Pauli exclusion even less difficulty ramp after killing final boss --- js/bullet.js | 181 ++++++++++++++++++++++++----------------------- js/index.js | 7 +- js/level.js | 2 +- js/player.js | 19 ++--- js/powerup.js | 28 +++----- js/simulation.js | 13 ++-- js/spawn.js | 2 +- js/tech.js | 93 +++++++++++++++++++----- todo.txt | 21 +++--- 9 files changed, 211 insertions(+), 155 deletions(-) diff --git a/js/bullet.js b/js/bullet.js index 24b3b12..89302cb 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -36,6 +36,68 @@ const b = { if (mech.holdingTarget) mech.drop(); } }, + giveGuns(gun = "random", ammoPacks = 10) { + if (tech.isOneGun) b.removeAllGuns(); + if (gun === "random") { + //find what guns player doesn't have + options = [] + for (let i = 0, len = b.guns.length; i < len; i++) { + if (!b.guns[i].have) options.push(i) + } + if (options.length === 0) return + //randomly pick from list of possible guns + gun = options[Math.floor(Math.random() * options.length)] + } + if (gun === "all") { + b.activeGun = 0; + b.inventoryGun = 0; + for (let i = 0; i < b.guns.length; i++) { + b.inventory[i] = i; + b.guns[i].have = true; + b.guns[i].ammo = Math.floor(b.guns[i].ammoPack * ammoPacks); + } + } else { + if (isNaN(gun)) { //find gun by name + let found = false; + for (let i = 0; i < b.guns.length; i++) { + if (gun === b.guns[i].name) { + gun = i + found = true; + break + } + } + if (!found) return //if no gun found don't give a gun + } + if (!b.guns[gun].have) b.inventory.push(gun); + b.guns[gun].have = true; + b.guns[gun].ammo = Math.floor(b.guns[gun].ammoPack * ammoPacks); + if (b.activeGun === null) b.activeGun = gun //if no active gun switch to new gun + } + simulation.makeGunHUD(); + b.setFireCD(); + }, + removeGun(gun, isRemoveSelection = false) { + for (let i = 0; i < b.guns.length; i++) { + if (b.guns[i].name === gun) { + b.guns[i].have = false + for (let j = 0; j < b.inventory.length; j++) { + if (b.inventory[j] === i) { + b.inventory.splice(j, 1) + break + } + } + if (b.inventory.length) { + b.activeGun = b.inventory[0]; + } else { + b.activeGun = null; + } + simulation.makeGunHUD(); + if (isRemoveSelection) b.guns.splice(i, 1) //also remove gun from gun pool array + break + } + } + b.setFireCD(); + }, removeAllGuns() { b.inventory = []; //removes guns and ammo for (let i = 0, len = b.guns.length; i < len; ++i) { @@ -89,6 +151,7 @@ const b = { fireCD: 1, setFireCD() { b.fireCD = tech.fireRate * tech.slowFire * tech.researchHaste * tech.aimDamage / tech.fastTime + if (tech.isFireRateForGuns) b.fireCD *= Math.pow(0.85, b.inventory.length) }, fireAttributes(dir, rotate = true) { if (rotate) { @@ -1213,12 +1276,12 @@ const b = { }); if (tech.isLaserPush) { //push mobs away - console.log(-0.003 * Math.min(4, best.who.mass), dmg) + // console.log(-0.003 * Math.min(4, best.who.mass), dmg) const index = path.length - 1 // const force = Vector.mult(Vector.normalise(Vector.sub(path[Math.max(0, index - 1)], path[index])), -0.003 * Math.min(4, best.who.mass)) // const push = -0.004 / (1 + tech.beamSplitter + tech.wideLaser + tech.historyLaser) // console.log(push) - const force = Vector.mult(Vector.normalise(Vector.sub(path[index], path[Math.max(0, index - 1)])), 0.004 * push * Math.min(4, best.who.mass)) + const force = Vector.mult(Vector.normalise(Vector.sub(path[index], path[Math.max(0, index - 1)])), 0.003 * push * Math.min(6, best.who.mass)) Matter.Body.applyForce(best.who, path[index], force) // Matter.Body.setVelocity(best.who, { //friction // x: best.who.velocity.x * 0.7, @@ -1975,13 +2038,13 @@ const b = { // ************************************************************************************************** // ************************************************************************************************** respawnBots() { - for (let i = 0; i < tech.laserBotCount; i++) b.laserBot() - for (let i = 0; i < tech.nailBotCount; i++) b.nailBot() - for (let i = 0; i < tech.foamBotCount; i++) b.foamBot() - for (let i = 0; i < tech.boomBotCount; i++) b.boomBot() - for (let i = 0; i < tech.orbitBotCount; i++) b.orbitBot() - for (let i = 0; i < tech.plasmaBotCount; i++) b.plasmaBot() - for (let i = 0; i < tech.missileBotCount; i++) b.missileBot() + for (let i = 0; i < tech.laserBotCount; i++) b.laserBot({ x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, false) + for (let i = 0; i < tech.nailBotCount; i++) b.nailBot({ x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, false) + for (let i = 0; i < tech.foamBotCount; i++) b.foamBot({ x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, false) + for (let i = 0; i < tech.boomBotCount; i++) b.boomBot({ x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, false) + for (let i = 0; i < tech.orbitBotCount; i++) b.orbitBot({ x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, false) + for (let i = 0; i < tech.plasmaBotCount; i++) b.plasmaBot({ x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, false) + for (let i = 0; i < tech.missileBotCount; i++) b.missileBot({ x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, false) if (tech.isIntangible && mech.isCloak) { for (let i = 0; i < bullet.length; i++) { if (bullet[i].botType) bullet[i].collisionFilter.mask = cat.map | cat.bullet | cat.mobBullet | cat.mobShield @@ -1993,7 +2056,7 @@ const b = { b.laserBot(where) if (isKeep) tech.laserBotCount++; } else if (Math.random() < 0.25 && isAll) { - b.orbitBot(); + b.orbitBot(where); if (isKeep) tech.orbitBotCount++; } else if (Math.random() < 0.33) { b.nailBot(where) @@ -2006,8 +2069,8 @@ const b = { if (isKeep) tech.boomBotCount++; } }, - nailBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }) { - simulation.makeTextLog(`b.nailBot()`); + nailBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, isConsole = true) { + if (isConsole) simulation.makeTextLog(`b.nailBot()`); const me = bullet.length; const dir = mech.angle; const RADIUS = (12 + 4 * Math.random()) @@ -2062,8 +2125,8 @@ const b = { }) World.add(engine.world, bullet[me]); //add bullet to world }, - missileBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }) { - simulation.makeTextLog(`b.missileBot()`); + missileBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, isConsole = true) { + if (isConsole) simulation.makeTextLog(`b.missileBot()`); const me = bullet.length; bullet[me] = Bodies.rectangle(position.x, position.y, 28, 11, { botType: "foam", @@ -2112,8 +2175,8 @@ const b = { }) World.add(engine.world, bullet[me]); //add bullet to world }, - foamBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }) { - simulation.makeTextLog(`b.foamBot()`); + foamBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, isConsole = true) { + if (isConsole) simulation.makeTextLog(`b.foamBot()`); const me = bullet.length; const dir = mech.angle; const RADIUS = (10 + 5 * Math.random()) @@ -2167,8 +2230,8 @@ const b = { }) World.add(engine.world, bullet[me]); //add bullet to world }, - laserBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }) { - simulation.makeTextLog(`b.laserBot()`); + laserBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, isConsole = true) { + if (isConsole) simulation.makeTextLog(`b.laserBot()`); const me = bullet.length; const dir = mech.angle; const RADIUS = (14 + 6 * Math.random()) @@ -2252,8 +2315,8 @@ const b = { }) World.add(engine.world, bullet[me]); //add bullet to world }, - boomBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }) { - simulation.makeTextLog(`b.boomBot()`); + boomBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, isConsole = true) { + if (isConsole) simulation.makeTextLog(`b.boomBot()`); const me = bullet.length; const dir = mech.angle; const RADIUS = (7 + 2 * Math.random()) @@ -2331,8 +2394,8 @@ const b = { }) World.add(engine.world, bullet[me]); //add bullet to world }, - plasmaBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }) { - simulation.makeTextLog(`b.plasmaBot()`); + plasmaBot(position = { x: mech.pos.x + 50 * (Math.random() - 0.5), y: mech.pos.y + 50 * (Math.random() - 0.5) }, isConsole = true) { + if (isConsole) simulation.makeTextLog(`b.plasmaBot()`); const me = bullet.length; const dir = mech.angle; const RADIUS = 21 @@ -2516,8 +2579,8 @@ const b = { }) World.add(engine.world, bullet[me]); //add bullet to world }, - orbitBot(position = mech.pos) { - simulation.makeTextLog(`b.orbitBot()`); + orbitBot(position = mech.pos, isConsole = true) { + if (isConsole) simulation.makeTextLog(`b.orbitBot()`); const me = bullet.length; bullet[me] = Bodies.polygon(position.x, position.y, 9, 12, { isUpgraded: tech.isOrbitBotUpgrade, @@ -2616,66 +2679,6 @@ const b = { // ******************************** Guns ********************************************* // ************************************************************************************************** // ************************************************************************************************** - giveGuns(gun = "random", ammoPacks = 10) { - if (tech.isOneGun) b.removeAllGuns(); - if (gun === "random") { - //find what guns player doesn't have - options = [] - for (let i = 0, len = b.guns.length; i < len; i++) { - if (!b.guns[i].have) options.push(i) - } - if (options.length === 0) return - //randomly pick from list of possible guns - gun = options[Math.floor(Math.random() * options.length)] - } - if (gun === "all") { - b.activeGun = 0; - b.inventoryGun = 0; - for (let i = 0; i < b.guns.length; i++) { - b.inventory[i] = i; - b.guns[i].have = true; - b.guns[i].ammo = Math.floor(b.guns[i].ammoPack * ammoPacks); - } - } else { - if (isNaN(gun)) { //find gun by name - let found = false; - for (let i = 0; i < b.guns.length; i++) { - if (gun === b.guns[i].name) { - gun = i - found = true; - break - } - } - if (!found) return //if no gun found don't give a gun - } - if (!b.guns[gun].have) b.inventory.push(gun); - b.guns[gun].have = true; - b.guns[gun].ammo = Math.floor(b.guns[gun].ammoPack * ammoPacks); - if (b.activeGun === null) b.activeGun = gun //if no active gun switch to new gun - } - simulation.makeGunHUD(); - }, - removeGun(gun, isRemoveSelection = false) { - for (let i = 0; i < b.guns.length; i++) { - if (b.guns[i].name === gun) { - b.guns[i].have = false - for (let j = 0; j < b.inventory.length; j++) { - if (b.inventory[j] === i) { - b.inventory.splice(j, 1) - break - } - } - if (b.inventory.length) { - b.activeGun = b.inventory[0]; - } else { - b.activeGun = null; - } - simulation.makeGunHUD(); - if (isRemoveSelection) b.guns.splice(i, 1) //also remove gun from gun pool array - break - } - } - }, guns: [{ name: "nail gun", description: "use compressed air to fire a stream of nails
delay after firing decreases as you shoot", @@ -4017,7 +4020,7 @@ const b = { b.laser(where, { x: where.x + 3000 * Math.cos(angle), y: where.y + 3000 * Math.sin(angle) - }, dmg, 0, true, 0.4) + }, dmg, 0, true, 0.3) for (let i = 1; i < tech.wideLaser; i++) { let whereOff = Vector.add(where, { x: i * off * Math.cos(angle + Math.PI / 2), @@ -4026,7 +4029,7 @@ const b = { b.laser(whereOff, { x: whereOff.x + 3000 * Math.cos(angle), y: whereOff.y + 3000 * Math.sin(angle) - }, dmg, 0, true, 0.4) + }, dmg, 0, true, 0.3) whereOff = Vector.add(where, { x: i * off * Math.cos(angle - Math.PI / 2), y: i * off * Math.sin(angle - Math.PI / 2) @@ -4034,7 +4037,7 @@ const b = { b.laser(whereOff, { x: whereOff.x + 3000 * Math.cos(angle), y: whereOff.y + 3000 * Math.sin(angle) - }, dmg, 0, true, 0.4) + }, dmg, 0, true, 0.3) } ctx.stroke(); ctx.globalAlpha = 1; @@ -4071,7 +4074,7 @@ const b = { }, { x: mech.pos.x + 3000 * Math.cos(mech.angle), y: mech.pos.y + 3000 * Math.sin(mech.angle) - }, dmg, 0, true, 0.3); + }, dmg, 0, true, 0.2); for (let i = 1; i < len; i++) { const history = mech.history[(mech.cycle - i * spacing) % 600] b.laser({ @@ -4080,7 +4083,7 @@ const b = { }, { x: history.position.x + 3000 * Math.cos(history.angle), y: history.position.y + 3000 * Math.sin(history.angle) - mech.yPosDifference - }, dmg, 0, true, 0.3); + }, dmg, 0, true, 0.2); } ctx.stroke(); } diff --git a/js/index.js b/js/index.js index 9257fc8..0683237 100644 --- a/js/index.js +++ b/js/index.js @@ -201,8 +201,7 @@ const build = { copy build url - - `; +`; for (let i = 0, len = b.inventory.length; i < len; i++) { text += `
  ${b.guns[b.inventory[i]].name} - ${b.guns[b.inventory[i]].ammo}
${b.guns[b.inventory[i]].description}
` } @@ -744,6 +743,7 @@ window.addEventListener("keydown", function(event) { break } if (simulation.testing) { + if (event.key === "X") mech.death(); //only uppercase switch (event.key.toLowerCase()) { case "o": simulation.isAutoZoom = false; @@ -826,9 +826,6 @@ window.addEventListener("keydown", function(event) { case "u": level.nextLevel(); break - case "X": //capital X to make it hard to die - mech.death(); - break } } }); diff --git a/js/level.js b/js/level.js index 363ef6a..a2566e3 100644 --- a/js/level.js +++ b/js/level.js @@ -61,7 +61,7 @@ const level = { b.respawnBots(); mech.resetHistory(); if (tech.isArmorFromPowerUps) { - const gain = Math.min(0.04 * powerUps.totalPowerUps, 0.40) + const gain = Math.min(0.03 * powerUps.totalPowerUps, 0.42) tech.armorFromPowerUps += gain mech.setMaxHealth(); // if (powerUps.totalPowerUps) simulation.makeTextLog(" max health increased by " + (gain * 100).toFixed(0) + "%", 300) diff --git a/js/player.js b/js/player.js index 2df41ef..f2e6539 100644 --- a/js/player.js +++ b/js/player.js @@ -429,7 +429,6 @@ const mech = { } simulation.isTextLogOpen = true; simulation.makeTextLog("simulation.amplitude = null"); - }, 6 * swapPeriod); } else if (mech.alive) { //normal death code here @@ -482,8 +481,10 @@ const mech = { }, baseHealth: 1, setMaxHealth() { - mech.maxHealth = mech.baseHealth + tech.bonusHealth + tech.armorFromPowerUps - if (mech.health > mech.maxHealth) mech.health = mech.maxHealth; + const set = mech.baseHealth + tech.bonusHealth + tech.armorFromPowerUps + simulation.makeTextLog(`mech.maxHealth = ${set}`) + mech.maxHealth = set + if(mech.health > mech.maxHealth) mech.health = mech.maxHealth; mech.displayHealth(); }, @@ -604,7 +605,9 @@ const mech = { }, damage(dmg) { if (tech.isRewindAvoidDeath && mech.energy > 0.66) { - mech.rewind(Math.floor(Math.min(299, 137 * mech.energy))) + const steps = Math.floor(Math.min(299, 137 * mech.energy)) + simulation.makeTextLog(`mech.rewind(${steps})`) + mech.rewind(steps) return } mech.lastHarmCycle = mech.cycle @@ -621,8 +624,7 @@ const mech = { if (tech.isDeathAvoid && powerUps.research.research && !tech.isDeathAvoidedThisLevel) { tech.isDeathAvoidedThisLevel = true powerUps.research.changeRerolls(-1) - simulation.makeTextLog(`mech.research-- -
${powerUps.research.research}`) + simulation.makeTextLog(`mech.research--
${powerUps.research.research}`) for (let i = 0; i < 6; i++) { powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false); } @@ -655,9 +657,7 @@ const mech = { powerUps.research.changeRerolls(-1) simulation.makeTextLog(`mech.research--
${powerUps.research.research}`) - for (let i = 0; i < 6; i++) { - powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false); - } + for (let i = 0; i < 6; i++) powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "heal", false); mech.immuneCycle = mech.cycle + 360 //disable this.immuneCycle bonus seconds simulation.wipe = function() { //set wipe to have trails ctx.fillStyle = "rgba(255,255,255,0.03)"; @@ -900,6 +900,7 @@ const mech = { }, setMaxEnergy() { mech.maxEnergy = (tech.isMaxEnergyTech ? 0.5 : 1) + tech.bonusEnergy + tech.healMaxEnergyBonus + simulation.makeTextLog(`mech.maxEnergy = ${mech.maxEnergy}`) }, fieldMeterColor: "#0cf", drawFieldMeter(bgColor = "rgba(0, 0, 0, 0.4)", range = 60) { diff --git a/js/powerup.js b/js/powerup.js index e2c415c..4af1827 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -6,10 +6,10 @@ const powerUps = { if (type === "gun") { b.giveGuns(index) let text = `b.giveGuns("${b.guns[index].name}")` - if (b.inventory.length === 1) text += `
input.key.gun = ["MouseLeft"]` + if (b.inventory.length === 1) text += `
input.key.gun: ["MouseLeft"]` if (b.inventory.length === 2) text += ` -
input.key.nextGun = ["${input.key.nextGun}","MouseWheel"] -
input.key.previousGun = ["${input.key.previousGun}","MouseWheel"]` +
input.key.nextGun: ["${input.key.nextGun}","MouseWheel"] +
input.key.previousGun: ["${input.key.previousGun}","MouseWheel"]` simulation.makeTextLog(text); } else if (type === "field") { mech.setField(index) @@ -489,7 +489,7 @@ const powerUps = { powerUps.spawn(x, y, "ammo"); return; } - if (Math.random() < 0.0015 * (3 - b.inventory.length)) { //a new gun has a low chance for each not acquired gun up to 3 + if (Math.random() < 0.001 * (3 - b.inventory.length)) { //a new gun has a low chance for each not acquired gun up to 3 powerUps.spawn(x, y, "gun"); return; } @@ -520,7 +520,7 @@ const powerUps = { function powerUpChance(chanceToFail) { if (Math.random() * chanceToFail < powerUps.randomPowerUpCounter) { powerUps.randomPowerUpCounter = 0; - if (Math.random() < 0.95) { + if (Math.random() < 0.97) { powerUps.spawn(x, y, "tech") } else { powerUps.spawn(x, y, "gun") @@ -565,25 +565,17 @@ const powerUps = { powerUps.spawn(x, y, "gun", false); //first gun } else if (tech.totalCount === 0) { //first tech powerUps.spawn(x, y, "tech", false); - } else if (b.inventory.length < 2) { //second gun or extra ammo - if (Math.random() < 0.5) { + } else if (b.inventory.length === 1) { //second gun or extra ammo + if (Math.random() < 0.4) { powerUps.spawn(x, y, "gun", false); } else { - powerUps.spawn(x, y, "ammo", false); - powerUps.spawn(x, y, "ammo", false); - powerUps.spawn(x, y, "ammo", false); - powerUps.spawn(x, y, "ammo", false); + for (let i = 0; i < 5; i++) powerUps.spawn(x, y, "ammo", false); } } else { - powerUps.spawnRandomPowerUp(x, y); - powerUps.spawnRandomPowerUp(x, y); - powerUps.spawnRandomPowerUp(x, y); - powerUps.spawnRandomPowerUp(x, y); + for (let i = 0; i < 4; i++) powerUps.spawnRandomPowerUp(x, y); } } else { - powerUps.spawnRandomPowerUp(x, y); - powerUps.spawnRandomPowerUp(x, y); - powerUps.spawnRandomPowerUp(x, y); + for (let i = 0; i < 3; i++) powerUps.spawnRandomPowerUp(x, y); } }, ejectTech(choose = 'random') { diff --git a/js/simulation.js b/js/simulation.js index c24cb95..bc0ec47 100644 --- a/js/simulation.js +++ b/js/simulation.js @@ -576,19 +576,19 @@ const simulation = { let delay = 500 const step = 150 setTimeout(function() { - simulation.makeTextLog(`input.key.up = ["${input.key.up}", "ArrowUp"]`); + simulation.makeTextLog(`input.key.up: ["${input.key.up}", "ArrowUp"]`); }, delay); delay += step setTimeout(function() { - simulation.makeTextLog(`input.key.left = ["${input.key.left}", "ArrowLeft"]`); + simulation.makeTextLog(`input.key.left: ["${input.key.left}", "ArrowLeft"]`); }, delay); delay += step setTimeout(function() { - simulation.makeTextLog(`input.key.down = ["${input.key.down}", "ArrowDown"]`); + simulation.makeTextLog(`input.key.down: ["${input.key.down}", "ArrowDown"]`); }, delay); delay += step setTimeout(function() { - simulation.makeTextLog(`input.key.right = ["${input.key.right}", "ArrowRight"]`); + simulation.makeTextLog(`input.key.right: ["${input.key.right}", "ArrowRight"]`); }, delay); delay += 1000 setTimeout(function() { @@ -596,7 +596,7 @@ const simulation = { }, delay); delay += step setTimeout(function() { - simulation.makeTextLog(`input.key.field = ["${input.key.field}", "MouseRight"]`); + simulation.makeTextLog(`input.key.field: ["${input.key.field}", "MouseRight"]`); }, delay); // delay += step // setTimeout(function() { @@ -790,6 +790,9 @@ const simulation = { } if (!(simulation.cycle % 420)) { //once every 7 seconds + + if (tech.cyclicImmunity && mech.immuneCycle < mech.cycle + tech.cyclicImmunity) mech.immuneCycle = mech.cycle + tech.cyclicImmunity; //player is immune to collision damage for 60 cycles + fallCheck = function(who, save = false) { let i = who.length; while (i--) { diff --git a/js/spawn.js b/js/spawn.js index fff0eb5..439b304 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -101,7 +101,7 @@ const spawn = { level.exit.x = 5500; level.exit.y = -330; //ramp up damage - for (let i = 0; i < 2; i++) level.difficultyIncrease(simulation.difficultyMode) + // for (let i = 0; i < 2; i++) level.difficultyIncrease(simulation.difficultyMode) //set game to the next highest difficulty level if not on why if (simulation.difficultyMode < 6) { diff --git a/js/tech.js b/js/tech.js index eb22479..6dfd1e2 100644 --- a/js/tech.js +++ b/js/tech.js @@ -81,7 +81,7 @@ const tech = { if (tech.isLowEnergyDamage) dmg *= 1 + Math.max(0, 1 - mech.energy) * 0.5 if (tech.isMaxEnergyTech) dmg *= 1.4 if (tech.isEnergyNoAmmo) dmg *= 1.5 - if (tech.isDamageForGuns) dmg *= 1 + 0.1 * b.inventory.length + if (tech.isDamageForGuns) dmg *= 1 + 0.13 * b.inventory.length if (tech.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, 1 - mech.health) if (tech.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 3; if (tech.isEnergyLoss) dmg *= 1.5; @@ -146,7 +146,7 @@ const tech = { }, { name: "arsenal", - description: "increase damage by 10%
for each gun in your inventory", + description: "increase damage by 13%
for each gun in your inventory", maxCount: 1, count: 0, allowed() { @@ -160,26 +160,71 @@ const tech = { tech.isDamageForGuns = false; } }, + { + name: "active cooling", + description: "15% decreased delay after firing
for each gun in your inventory", + maxCount: 1, + count: 0, + allowed() { + return b.inventory.length > 1 + }, + requires: "at least 2 guns", + effect() { + tech.isFireRateForGuns = true; + b.setFireCD(); + }, + remove() { + tech.isFireRateForGuns = false; + b.setFireCD(); + } + }, { name: "generalist", - description: "spawn 6 guns, but you can't switch guns
guns cycle automatically with each new level", + description: "spawn 6 guns, but you can't switch guns
guns cycle automatically with each new level", maxCount: 1, count: 0, isNonRefundable: true, allowed() { - return tech.isDamageForGuns + return tech.isDamageForGuns || tech.isFireRateForGuns }, - requires: "arsenal", + requires: "arsenal or cyclic rate boost", effect() { tech.isGunCycle = true; - for (let i = 0; i < 6; i++) { - powerUps.spawn(mech.pos.x, mech.pos.y, "gun"); - } + for (let i = 0; i < 6; i++) powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "gun"); }, remove() { tech.isGunCycle = false; } }, + { + name: "specialist", + description: "for every gun in your inventory spawn a
heal, research, field, ammo, or tech", + maxCount: 1, //random power up + count: 0, + isNonRefundable: true, + isCustomHide: true, + allowed() { + return tech.isGunCycle + }, + requires: "generalist", + effect() { + for (let i = 0; i < b.inventory.length; i++) { + if (Math.random() < 0.2) { + powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "tech"); + } else if (Math.random() < 0.25) { + powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "field"); + } else if (Math.random() < 0.33) { + powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "heal"); + } else if (Math.random() < 0.5) { + powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "ammo"); + } else { + powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "research"); + } + + } + }, + remove() {} + }, { name: "logistics", description: "ammo power ups give 200% ammo
but ammo is only added to your current gun", @@ -617,7 +662,7 @@ const tech = { }, { name: "laser-bot", - description: "a bot uses energy to emit a laser
targeting nearby mobs", + description: "a bot uses energy to emit a laser beam
that targets nearby mobs", maxCount: 9, count: 0, allowed() { @@ -932,7 +977,7 @@ const tech = { }, { name: "Pauli exclusion", - description: `immune to harm for an extra 0.75 seconds
after receiving harm from a collision`, + description: `after receiving harm from a collision become
immune to harm for an extra 0.75 seconds`, maxCount: 9, count: 0, allowed() { @@ -947,6 +992,22 @@ const tech = { tech.collisionImmuneCycles = 25; } }, + { + name: "complex spin-statistics", + description: `become immune to harm for +1 second
once every 7 seconds`, + maxCount: 3, + count: 0, + allowed() { + return true //tech.collisionImmuneCycles > 30 + }, + requires: "", + effect() { + tech.cyclicImmunity += 60 - this.count * 6; + }, + remove() { + tech.cyclicImmunity = 0; + } + }, { name: "ablative drones", description: "rebuild your broken parts as drones
chance to occur after receiving harm", @@ -1102,7 +1163,7 @@ const tech = { maxCount: 1, count: 0, allowed() { - return (tech.iceEnergy || tech.isWormholeEnergy || tech.isPiezo || tech.isRailEnergyGain) && tech.energyRegen !== 0.004 + return (tech.iceEnergy || tech.isWormholeEnergy || tech.isPiezo || tech.isRailEnergyGain) && tech.energyRegen !== 0.004 && !tech.isEnergyHealth }, requires: "piezoelectricity, Penrose, half-wave, or thermoelectric, but not time crystals", effect: () => { @@ -1403,7 +1464,7 @@ const tech = { }, { name: "inductive coupling", - description: "for each unused power up at the end of a level
add 4 max health (up to 40 health per level)", + description: "for each unused power up at the end of a level
add 3 max health (up to 42 health per level)", maxCount: 1, count: 0, allowed() { @@ -1520,9 +1581,7 @@ const tech = { requires: "at least 2 research", effect() { tech.isImmortal = true; - for (let i = 0; i < 4; i++) { - powerUps.spawn(mech.pos.x, mech.pos.y, "research", false); - } + for (let i = 0; i < 4; i++) powerUps.spawn(mech.pos.x + Math.random() * 10, mech.pos.y + Math.random() * 10, "research", false); }, remove() { tech.isImmortal = false; @@ -3996,5 +4055,7 @@ const tech = { isLaserMine: null, isAmmoFoamSize: null, isIceIX: null, - isDupDamage: null + isDupDamage: null, + isFireRateForGuns: null, + cyclicImmunity: null } \ No newline at end of file diff --git a/todo.txt b/todo.txt index 142173f..6fd4a09 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,12 @@ ******************************************************** NEXT PATCH ******************************************************** -tech: relativistic momentum - laser beams push mobs away +tech: active cooling - 15% faster fire rate for each gun in your inventory +tech: specialist - spawn a random power up for each gun in your inventory + (not available in custom, requires tech: generalist) +tech: complex spin-statistics - become immune to harm for 1s every 7s + requires Pauli exclusion + +even less difficulty ramp after killing final boss ******************************************************** BUGS ******************************************************** @@ -21,6 +27,9 @@ CPT check for crouch after rewind ******************************************************** TODO ******************************************************** +tech "Circadian Rhythm": Become immune to harm for 1 second every 10 seconds while playing. + + bot that follows the players history could have the same shape as the mech circle head 1st bot is at 5s, 2nd is at 4.5s, ... @@ -46,11 +55,6 @@ in game console set highlighting rules mech, tech, level are all highlighted maybe the first term in each variable should get a highlight - make all commands actually work - input.key commands don't work - rewrite to not be a console command? - add commands - death, max health, max energy, rewind mechanic: use gun swap as an active ability this effect is spammable, so it needs a cost or a cooldown @@ -63,14 +67,10 @@ tech: time dilation - when you exit time dilation rewind to the state you entere position, velocity, and health no energy cost -CPT gun seems a bit weak right now. How to buff the gun? - mob ability bombs/bullets that suck in player tech where you can't stop firing, how to code? -tech: translational invariance - laser beams push like plasma torch pushes with directional force - mechanic: technological dead end - add tech to the tech pool with a dumb effect don't show up in custom? negative effect (one time effects are better to avoid code clutter) @@ -92,7 +92,6 @@ mechanic: technological dead end - add tech to the tech pool with a dumb effect tech "Expansion Formula": Permanently increase the size of Negative Mass field by 16%(Max 96%) -tech "Circadian Rhythm": Become immune to harm for 1 second every 10 seconds while playing. tech "High Risk": Spawn two bosses per level. maybe limit to just the power up boss and spawn it at the exit every time to keep it simple