From 3ab42884caeac523fbd833cc7b5f1274cabadcd0 Mon Sep 17 00:00:00 2001 From: landgreen Date: Fri, 26 Mar 2021 05:54:28 -0700 Subject: [PATCH] relay switch bug fix - grower mob becoming immune to damage when shielded and growing bigger than shield relay switch - toggles ON/OFF when you pick up a power up tech: ice IX condenser - if ON make a couple Ice IX crystals every second --- .DS_Store | Bin 6148 -> 6148 bytes js/bullet.js | 18 ++-- js/level.js | 25 +++--- js/mob.js | 7 +- js/player.js | 35 ++++++++ js/powerup.js | 11 +++ js/simulation.js | 7 +- js/tech.js | 213 ++++++++++++++++++++++++++--------------------- todo.txt | 8 +- 9 files changed, 206 insertions(+), 118 deletions(-) diff --git a/.DS_Store b/.DS_Store index 582b8e5369f379c3693e0bde19ec86960b67c08c..bf21f88bd93cc9090d027da08a3e7f87fd026c4f 100644 GIT binary patch delta 15 WcmZoMXffEJ#muzKY_ksY4G{n+hy?Ng delta 15 WcmZoMXffEJ#muyrZL<#Z4G{n*Qv|;N diff --git a/js/bullet.js b/js/bullet.js index dd3c909..8f0352b 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -1958,7 +1958,7 @@ const b = { restitution: 0.3, dmg: 0.29, //damage done in addition to the damage from momentum lookFrequency: 14 + Math.floor(8 * Math.random()), - endCycle: simulation.cycle + 120 * tech.isBulletsLastLonger, //Math.floor((1200 + 420 * Math.random()) * tech.isBulletsLastLonger), + endCycle: simulation.cycle + 140 * tech.isBulletsLastLonger, classType: "bullet", collisionFilter: { category: cat.bullet, @@ -4066,8 +4066,16 @@ const b = { ammoPack: 36, have: false, fire() { - m.fireCDcycle = m.cycle + Math.floor((m.crouch ? 15 : 5) * b.fireCD); // cool down - const radius = (m.crouch ? 10 + 5 * Math.random() : 4 + 6 * Math.random()) + (tech.isAmmoFoamSize && this.ammo < 300) * 12 + let radius, spread + if (m.crouch) { + spread = 0.2 * (Math.random() - 0.5) + radius = 10 + 5 * Math.random() + (tech.isAmmoFoamSize && this.ammo < 300) * 12 + m.fireCDcycle = m.cycle + Math.floor(15 * b.fireCD); // cool down + } else { + spread = 0.5 * (Math.random() - 0.5) + radius = 4 + 6 * Math.random() + (tech.isAmmoFoamSize && this.ammo < 300) * 12 + m.fireCDcycle = m.cycle + Math.floor(5 * b.fireCD); // cool down + } const SPEED = 18 - radius * 0.4; const dir = m.angle + 0.15 * (Math.random() - 0.5) const velocity = { @@ -4088,12 +4096,12 @@ const b = { }); setTimeout(() => { if (!simulation.paused) { - b.foam(position, Vector.rotate(velocity, 0.5 * (Math.random() - 0.5)), radius) + b.foam(position, Vector.rotate(velocity, spread), radius) bullet[bullet.length - 1].damage = (1 + 1.27 * tech.foamFutureFire) * (tech.isFastFoam ? 0.048 : 0.012) //double damage } }, 250 * tech.foamFutureFire); } else { - b.foam(position, Vector.rotate(velocity, 0.5 * (Math.random() - 0.5)), radius) + b.foam(position, Vector.rotate(velocity, spread), radius) } } }, { diff --git a/js/level.js b/js/level.js index dcd6afa..3703457 100644 --- a/js/level.js +++ b/js/level.js @@ -113,6 +113,7 @@ const level = { // } if (tech.isFlipFlopHarm && tech.isFlipFlopLevelReset && !tech.isFlipFlopOn) { tech.isFlipFlopOn = true + m.eyeFillColor = m.fieldMeterColor simulation.makeTextLog(`tech.isFlipFlopOn = true`); } }, @@ -1102,8 +1103,8 @@ const level = { // simulation.difficulty = 30 // spawn.starter(1900, -500, 200) //big boy - spawn.pulsar(1900, -500) - spawn.pulsarBoss(1900, -500) + // spawn.grower(1900, -500) + // spawn.pulsarBoss(1900, -500) // spawn.historyBoss(1900, -500) // spawn.ghoster(2900, -500) // spawn.launcherBoss(1200, -500) @@ -1115,11 +1116,11 @@ const level = { // spawn.streamBoss(1600, -500) // spawn.orbitalBoss(1600, -500) // spawn.cellBossCulture(1600, -500) - // spawn.shieldingBoss(1600, -500) + spawn.shieldingBoss(1600, -500) // spawn.beamer(1200, -500) // spawn.shield(mob[mob.length - 1], 1800, -120, 1); - // spawn.nodeGroup(1200, -500, "launcher") + spawn.nodeGroup(1200, -500, "grower") // spawn.snakeBoss(1200, -500) // spawn.powerUpBoss(2900, -500) // spawn.randomMob(1600, -500) @@ -3101,7 +3102,7 @@ const level = { button = level.button(525, 0) door = level.door(1362, -200, 25, 200, 195) level.setPosToSpawn(1375, -1550); //normal spawn - level.exit.x = 3288; + level.exit.x = 3088; level.exit.y = -630; // spawn.randomSmallMob(3550, -550); level.fillBG.push({ @@ -3114,7 +3115,7 @@ const level = { } else { //reverse direction, start in bottom right button = level.button(3800, 0) door = level.door(3012, -200, 25, 200, 195) - level.setPosToSpawn(3337, -650); //normal spawn + level.setPosToSpawn(3137, -650); //normal spawn level.exit.x = 1375; level.exit.y = -1530; // spawn.bodyRect(3655, -650, 40, 150); //door @@ -3186,10 +3187,10 @@ const level = { color: "rgba(0,0,0,0.1)" }); - spawn.debris(-300, -200, 1000, 4); //ground debris //16 debris per level - spawn.debris(3500, -200, 800, 4); //ground debris //16 debris per level - spawn.debris(-300, -650, 1200, 4); //1st floor debris //16 debris per level - spawn.debris(3500, -650, 800, 5); //1st floor debris //16 debris per level + spawn.debris(-300, -200, 1000, 6); //ground debris //16 debris per level + spawn.debris(3500, -200, 800, 5); //ground debris //16 debris per level + spawn.debris(-300, -650, 1200, 5); //1st floor debris //16 debris per level + // spawn.debris(3500, -650, 800, 5); //1st floor debris //16 debris per lesvel powerUps.spawnStartingPowerUps(-525, -700); spawn.mapRect(-600, 0, 2000, 325); //ground @@ -3243,8 +3244,8 @@ const level = { spawn.bodyRect(3665, -600, 20, 100); //door // spawn.mapRect(3150, -550, 300, 75); // spawn.mapRect(3225, -600, 175, 75); - spawn.mapRect(3150, -550, 375, 75); - spawn.mapRect(3225, -600, 225, 75); + spawn.mapRect(3000, -550, 375, 75); + spawn.mapRect(3000, -600, 225, 75); spawn.mapRect(3000, -2000 * 0.5, 700, 50); //exit roof diff --git a/js/mob.js b/js/mob.js index 666355d..81cdbd6 100644 --- a/js/mob.js +++ b/js/mob.js @@ -767,9 +767,6 @@ const mobs = { this.force.x += this.accelMag * this.mass; } } - // else { - // this.gravity(); - // } }, grow() { if (!m.isBodiesAsleep) { @@ -780,6 +777,10 @@ const mobs = { this.radius *= scale; // this.torque = -0.00002 * this.inertia; this.fill = `hsl(144, ${this.radius}%, 50%)`; + if (this.isShielded) { //remove shield if shielded when growing + this.isShielded = false; + this.removeConsBB(); + } } } else { if (this.radius > 15) { diff --git a/js/player.js b/js/player.js index 3c691ec..197ac3a 100644 --- a/js/player.js +++ b/js/player.js @@ -831,6 +831,41 @@ const m = { ctx.restore(); m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal }, + drawFlipFlop() { + ctx.fillStyle = m.fillColor; + m.walk_cycle += m.flipLegs * m.Vx; + + //draw body + ctx.save(); + ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 + ctx.translate(m.pos.x, m.pos.y); + + m.calcLeg(Math.PI, -3); + m.drawLeg("#4a4a4a"); + m.calcLeg(0, 0); + m.drawLeg("#333"); + + ctx.rotate(m.angle); + ctx.beginPath(); + ctx.arc(0, 0, 30, 0, 2 * Math.PI); + let grd = ctx.createLinearGradient(-30, 0, 30, 0); + grd.addColorStop(0, m.fillColorDark); + grd.addColorStop(1, m.fillColor); + ctx.fillStyle = grd; + ctx.fill(); + ctx.arc(15, 0, 4, 0, 2 * Math.PI); + ctx.strokeStyle = "#333"; + ctx.lineWidth = 2; + ctx.stroke(); + //draw eye + ctx.beginPath(); + ctx.arc(15, 0, 3.5, 0, 2 * Math.PI); + ctx.fillStyle = m.eyeFillColor; + ctx.fill() + ctx.restore(); + + m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal + }, drawDefault() { ctx.fillStyle = m.fillColor; m.walk_cycle += m.flipLegs * m.Vx; diff --git a/js/powerup.js b/js/powerup.js index a2b8575..f31035b 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -482,6 +482,17 @@ const powerUps = { b.mine(who.position, { x: 0, y: 0 }, 0, tech.isMineAmmoBack) } } + if (tech.isRelay) { + if (tech.isFlipFlopOn) { + tech.isFlipFlopOn = false + if (document.getElementById("tech-switch")) document.getElementById("tech-switch").innerHTML = ` = OFF` + m.eyeFillColor = 'transparent' + } else { + tech.isFlipFlopOn = true //immune to damage this hit, lose immunity for next hit + if (document.getElementById("tech-switch")) document.getElementById("tech-switch").innerHTML = ` = ON` + m.eyeFillColor = m.fieldMeterColor //'#0cf' + } + } }, giveRandomAmmo() { const ammoTarget = Math.floor(Math.random() * (b.guns.length)); diff --git a/js/simulation.js b/js/simulation.js index 8d21ab4..b80f36c 100644 --- a/js/simulation.js +++ b/js/simulation.js @@ -792,7 +792,6 @@ const simulation = { // }, checks() { if (!(m.cycle % 60)) { //once a second - //energy overfill if (m.energy > m.maxEnergy) m.energy = m.maxEnergy + (m.energy - m.maxEnergy) * tech.overfillDrain //every second energy above max energy loses 25% if (tech.isFlipFlopEnergy) { @@ -803,6 +802,12 @@ const simulation = { if (m.energy < 0) m.energy = 0 } } + if (tech.relayIce && tech.isFlipFlopOn) { + for (let j = 0; j < tech.relayIce; j++) { + for (let i = 0, len = Math.ceil(3 * Math.random()); i < len; i++) b.iceIX(2) + } + } + if (m.pos.y > simulation.fallHeight) { // if 4000px deep Matter.Body.setVelocity(player, { x: 0, diff --git a/js/tech.js b/js/tech.js index a65b9b0..12fb2d2 100644 --- a/js/tech.js +++ b/js/tech.js @@ -639,9 +639,9 @@ count: 0, frequency: 2, allowed() { - return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" || tech.haveGunCheck("spores") || tech.haveGunCheck("drones") || tech.haveGunCheck("missiles") || tech.haveGunCheck("foam") || tech.haveGunCheck("wave beam") || tech.isNeutronBomb + return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" || tech.haveGunCheck("spores") || tech.haveGunCheck("drones") || tech.haveGunCheck("missiles") || tech.haveGunCheck("foam") || tech.haveGunCheck("wave beam") || tech.isNeutronBomb || tech.isIceField || tech.relayIce }, - requires: "drones, spores, missiles, foam, wave beam, neutron bomb", + requires: "drones, spores, missiles, foam, wave beam, neutron bomb, ice IX", effect() { tech.isBulletsLastLonger += 0.3 }, @@ -1390,77 +1390,8 @@ remove() { tech.cyclicImmunity = 0; } - }, { - name: "flip-flop", - description: `flip-flop toggles ON and OFF after a collision
unlock advanced tech that runs if ON`, - nameInfo: "", - addNameInfo() { - setTimeout(function() { - if (document.getElementById("tech-flip-flop")) { - if (tech.isFlipFlopOn) { - document.getElementById("tech-flip-flop").innerHTML = ` = ON` - m.eyeFillColor = m.fieldMeterColor //'#5af' - } else { - document.getElementById("tech-flip-flop").innerHTML = ` = OFF` - m.eyeFillColor = "transparent" - } - } - }, 100); - }, - maxCount: 1, - count: 0, - frequency: 2, - allowed() { - return true - }, - requires: "", - effect() { - tech.isFlipFlop = true //do you have this tech? - tech.isFlipFlopOn = true //what is the state of flip-Flop? - if (!m.isShipMode) { - m.draw = () => { - ctx.fillStyle = m.fillColor; - m.walk_cycle += m.flipLegs * m.Vx; - - //draw body - ctx.save(); - ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 - ctx.translate(m.pos.x, m.pos.y); - - m.calcLeg(Math.PI, -3); - m.drawLeg("#4a4a4a"); - m.calcLeg(0, 0); - m.drawLeg("#333"); - - ctx.rotate(m.angle); - ctx.beginPath(); - ctx.arc(0, 0, 30, 0, 2 * Math.PI); - let grd = ctx.createLinearGradient(-30, 0, 30, 0); - grd.addColorStop(0, m.fillColorDark); - grd.addColorStop(1, m.fillColor); - ctx.fillStyle = grd; - ctx.fill(); - ctx.arc(15, 0, 4, 0, 2 * Math.PI); - ctx.strokeStyle = "#333"; - ctx.lineWidth = 2; - ctx.stroke(); - //draw eye - ctx.beginPath(); - ctx.arc(15, 0, 3.5, 0, 2 * Math.PI); - ctx.fillStyle = m.eyeFillColor; - ctx.fill() - ctx.restore(); - - m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal - } - } - }, - remove() { - tech.isFlipFlop = false - tech.isFlipFlopOn = false - m.eyeFillColor = 'transparent' - } - }, { + }, + { name: "NOR gate", description: "if flip-flop is in the ON state
take 0 harm from collisions with mobs", maxCount: 1, @@ -1477,18 +1408,110 @@ remove() { tech.isFlipFlopHarm = false } - - }, { + }, + { + name: "flip-flop", + description: `toggle ON and OFF after a collision
unlock advanced tech that runs if ON`, + nameInfo: "", + addNameInfo() { + setTimeout(function() { + if (document.getElementById("tech-flip-flop")) { + if (tech.isFlipFlopOn) { + document.getElementById("tech-flip-flop").innerHTML = ` = ON` + m.eyeFillColor = m.fieldMeterColor //'#5af' + } else { + document.getElementById("tech-flip-flop").innerHTML = ` = OFF` + m.eyeFillColor = "transparent" + } + } + }, 100); + }, + maxCount: 1, + count: 0, + frequency: 1, + allowed() { + return !tech.isRelay + }, + requires: "not relay switch", + effect() { + tech.isFlipFlop = true //do you have this tech? + tech.isFlipFlopOn = true //what is the state of flip-Flop? + if (!m.isShipMode) { + m.draw = m.drawFlipFlop + } + }, + remove() { + tech.isFlipFlop = false + tech.isFlipFlopOn = false + m.eyeFillColor = 'transparent' + } + }, + { + name: "relay switch", + description: `toggle ON and OFF after picking up a power up
unlock advanced tech that runs if ON`, + nameInfo: "", + addNameInfo() { + setTimeout(function() { + if (document.getElementById("tech-switch")) { + if (tech.isFlipFlopOn) { + document.getElementById("tech-switch").innerHTML = ` = ON` + m.eyeFillColor = m.fieldMeterColor //'#5af' + } else { + document.getElementById("tech-switch").innerHTML = ` = OFF` + m.eyeFillColor = "transparent" + } + } + }, 100); + }, + maxCount: 1, + count: 0, + frequency: 1, + allowed() { + return !tech.isFlipFlop + }, + requires: "not flip-flop", + effect() { + tech.isRelay = true //do you have this tech? + tech.isFlipFlopOn = true //what is the state of flip-Flop? + if (!m.isShipMode) { + m.draw = m.drawFlipFlop + } + }, + remove() { + tech.isRelay = false + tech.isFlipFlopOn = false + m.eyeFillColor = 'transparent' + } + }, + { + name: "thermocouple", + description: "if relay switch is in the ON state
condense 1-3 ice IX crystals every second", + maxCount: 9, + count: 0, + frequency: 4, + frequencyDefault: 4, + allowed() { + return tech.isRelay + }, + requires: "relay switch", + effect() { + tech.relayIce++ + }, + remove() { + tech.relayIce = 0 + } + }, + { name: "NAND gate", - description: "if flip-flop is in the ON state
do 55.5% more damage", + description: "if in the ON state
do 55.5% more damage", maxCount: 1, count: 0, frequency: 4, frequencyDefault: 4, allowed() { - return tech.isFlipFlop + return tech.isFlipFlop || tech.isRelay }, - requires: "flip-flop", + requires: "ON/OFF tech", effect() { tech.isFlipFlopDamage = true; }, @@ -1497,15 +1520,15 @@ } }, { name: "transistor", - description: "if flip-flop is ON regen 22 energy per second
if flip-flop is OFF drain 3.1 energy per second", + description: "if ON regen 22 energy per second
if OFF drain 3.1 energy per second", maxCount: 1, count: 0, frequency: 4, frequencyDefault: 4, allowed() { - return tech.isFlipFlop + return tech.isFlipFlop || tech.isRelay }, - requires: "flip-flop", + requires: "ON/OFF tech", effect() { tech.isFlipFlopEnergy = true; }, @@ -1514,7 +1537,7 @@ } }, { name: "shift registers", - description: "set flip-flop to the ON state
at the start of a level", + description: "set to the ON state
at the start of a level", maxCount: 1, count: 0, frequency: 4, @@ -1522,14 +1545,15 @@ allowed() { return tech.isFlipFlopEnergy || tech.isFlipFlopDamage || tech.isFlipFlopHarm }, - requires: "2 flip-flop techs", + requires: "2 ON/OFF techs", effect() { tech.isFlipFlopLevelReset = true; }, remove() { tech.isFlipFlopLevelReset = false; } - }, { + }, + { name: "clock gating", description: `slow time by 50% after receiving harm
reduce harm by 20%`, maxCount: 1, @@ -1569,7 +1593,7 @@ count: 0, frequency: 2, allowed() { - return tech.isStunField || tech.isPulseStun || tech.oneSuperBall || tech.isHarmFreeze || tech.isIceField || tech.isIceCrystals || tech.isSporeFreeze || tech.isAoESlow || tech.isFreezeMobs || tech.isCloakStun || tech.orbitBotCount > 1 || tech.isWormholeDamage + return tech.isStunField || tech.isPulseStun || tech.oneSuperBall || tech.isHarmFreeze || tech.isIceField || tech.relayIce || tech.isIceCrystals || tech.isSporeFreeze || tech.isAoESlow || tech.isFreezeMobs || tech.isCloakStun || tech.orbitBotCount > 1 || tech.isWormholeDamage }, requires: "a freezing or stunning effect", effect() { @@ -1586,7 +1610,7 @@ count: 0, frequency: 2, allowed() { - return tech.isIceCrystals || tech.isSporeFreeze || tech.isIceField + return tech.isIceCrystals || tech.isSporeFreeze || tech.isIceField || tech.relayIce }, requires: "a localized freeze effect", effect() { @@ -2155,7 +2179,7 @@ isNonRefundable: true, isBadRandomOption: true, allowed() { - return ((m.health / m.maxHealth) < 0.7 || build.isExperimentSelection) && !tech.isNoHeals + return (m.health / m.maxHealth) < 0.7 && !tech.isNoHeals }, requires: "health > 70%, not ergodicity", effect() { @@ -2192,7 +2216,7 @@ powerUps.research.changeRerolls(0) }, 1000); }, - description: "use 1 research to avoid dying
and spawn 6 heal power ups once per level", + description: "once per level use 1 research
to prevent dying and spawn 6 heals", maxCount: 1, count: 0, frequency: 2, @@ -2836,7 +2860,8 @@ requires: "between levels 1 and 7", effect() { level.difficultyDecrease(simulation.difficultyMode) - simulation.makeTextLog(`simulation.difficultyMode --`) + // simulation.difficulty-= + simulation.makeTextLog(`level.difficultyDecrease(simulation.difficultyMode)`) tech.addJunkTechToPool(18) // for (let i = 0; i < tech.junk.length; i++) tech.tech.push(tech.junk[i]) }, @@ -2860,7 +2885,7 @@ effect() { tech.isNoHeals = true; level.difficultyDecrease(simulation.difficultyMode * 2) - simulation.makeTextLog(`simulation.difficultyMode -= 2`) + simulation.makeTextLog(`level.difficultyDecrease(simulation.difficultyMode * 2)`) powerUps.heal.color = "#abb" for (let i = 0; i < powerUp.length; i++) { //find active heal power ups and adjust color live if (powerUp[i].name === "heal") powerUp[i].color = powerUps.heal.color @@ -4366,7 +4391,7 @@ } }, { name: "ice IX manufacturing", - description: "nano-scale manufacturing is repurposed
excess energy used to synthesize ice IX", + description: "nano-scale manufacturing is repurposed
excess energy used to condense ice IX", isFieldTech: true, maxCount: 1, count: 0, @@ -4389,7 +4414,7 @@ count: 0, frequency: 2, allowed() { - return tech.isIceField + return tech.isIceField || tech.relayIce }, requires: "ice IX", effect() { @@ -5953,9 +5978,11 @@ isFlipFlopLevelReset: null, isFlipFlopDamage: null, isFlipFlopEnergy: null, + isRelay: null, + relayIce: null, isMetaAnalysis: null, isFoamAttract: null, droneCycleReduction: null, droneEnergyReduction: null, - isNoHeals: null + isNoHeals: null, } \ No newline at end of file diff --git a/todo.txt b/todo.txt index 29fc430..16939bb 100644 --- a/todo.txt +++ b/todo.txt @@ -1,10 +1,9 @@ ******************************************************** NEXT PATCH ******************************************************** -more bug fixes (pulse color, backwards induction giving too many tech) - -mobs can now see through blocks - mobs spawns and level spawns have been adjusted to prevent getting zonked at the start of a level +bug fix - grower mob becoming immune to damage when shielded and growing bigger than shield +relay switch - toggles ON/OFF when you pick up a power up +tech: ice IX condenser - if ON make a couple Ice IX crystals every second ******************************************************** BUGS ******************************************************** @@ -38,6 +37,7 @@ fix door.isOpen actually meaning isClosed? ******************************************************** TODO ******************************************************** have junk tech drop frequency to 0 after showing up once + but add way more junk tech into the pool how to communicate that to player? console message