diff --git a/js/engine.js b/js/engine.js index b99be55..f6d1e1a 100644 --- a/js/engine.js +++ b/js/engine.js @@ -124,7 +124,7 @@ function collisionChecks(event) { m.eyeFillColor = m.fieldMeterColor //'#0cf' if (!tech.isFlipFlopHarm) m.damage(dmg); } - m.setMaxHealth(); + if (tech.isFlipFlopHealth) m.setMaxHealth(); } else { m.damage(dmg); //normal damage } diff --git a/js/level.js b/js/level.js index 0f7b84f..0c9f24f 100644 --- a/js/level.js +++ b/js/level.js @@ -18,7 +18,7 @@ const level = { // m.setField("metamaterial cloaking") // b.giveGuns("harpoon") // tech.giveTech("grappling hook") - // tech.giveTech("railgun") + tech.giveTech("discount") // tech.giveTech("shape-memory alloy") // for (let i = 0; i < 2; i++) powerUps.directSpawn(0, 0, "tech"); // for (let i = 0; i < 2; i++) tech.giveTech("corona discharge") @@ -48,6 +48,8 @@ const level = { // lore.unlockTesting(); // tech.giveTech("tinker"); //show junk tech in experiment mode + // tech.giveRandomJUNK() + // tech.giveRandomJUNK() } else { spawn.setSpawnList(); //picks a couple mobs types for a themed random mob spawns // spawn.pickList = ["focuser", "focuser"] @@ -108,8 +110,11 @@ const level = { // if (tech.isFlipFlopLevelReset && !tech.isFlipFlopOn) { if ((tech.isRelay || tech.isFlipFlop) && !tech.isFlipFlopOn) { tech.isFlipFlopOn = true - m.setMaxHealth() - m.setMaxEnergy() + if (tech.isFlipFlopHealth) m.setMaxHealth() + if (tech.isRelayEnergy) { + m.setMaxEnergy() + m.energy += 2 + } m.eyeFillColor = m.fieldMeterColor simulation.makeTextLog(`tech.isFlipFlopOn = true`); } diff --git a/js/powerup.js b/js/powerup.js index 8afd41f..bd4e84e 100644 --- a/js/powerup.js +++ b/js/powerup.js @@ -889,8 +889,10 @@ const powerUps = { if (document.getElementById("tech-switch")) document.getElementById("tech-switch").innerHTML = ` = ON` m.eyeFillColor = m.fieldMeterColor //'#0cf' } - m.setMaxEnergy(); - m.setMaxHealth(); + if (tech.isRelayEnergy) { + m.setMaxEnergy(); + m.energy += 2 + } } }, // giveRandomAmmo() { diff --git a/js/tech.js b/js/tech.js index 282da77..24561a9 100644 --- a/js/tech.js +++ b/js/tech.js @@ -122,6 +122,15 @@ const tech = { } } }, + giveRandomJUNK() { + const list = [] + for (let i = 0; i < tech.tech.length; i++) { + if (tech.tech[i].isJunk) list.push(tech.tech[i].name) + } + let name = list[Math.floor(Math.random() * list.length)] + tech.giveTech(name) + simulation.makeTextLog(`tech.giveTech("${name}")`); + }, giveTech(index = 'random') { if (index === 'random') { let options = []; @@ -1659,8 +1668,8 @@ const tech = { description: "if flip-flop is in the OFF state
take 0 harm from collisions with mobs", maxCount: 1, count: 0, - frequency: 3, - frequencyDefault: 3, + frequency: 4, + frequencyDefault: 4, allowed() { return tech.isFlipFlop }, @@ -1677,8 +1686,8 @@ const tech = { description: "if flip-flop is in the ON state
increase your maximum health by 200", maxCount: 1, count: 0, - frequency: 3, - frequencyDefault: 3, + frequency: 4, + frequencyDefault: 4, allowed() { return tech.isFlipFlop && !tech.isEnergyHealth }, @@ -1736,8 +1745,8 @@ const tech = { description: "if in the ON state
do 55.5% more damage", maxCount: 1, count: 0, - frequency: 3, - frequencyDefault: 3, + frequency: 4, + frequencyDefault: 4, allowed() { return tech.isFlipFlop || tech.isRelay }, @@ -1754,8 +1763,8 @@ const tech = { description: "if ON regen 20 energy per second
if OFF drain 1 energy per second", maxCount: 1, count: 0, - frequency: 3, - frequencyDefault: 3, + frequency: 4, + frequencyDefault: 4, allowed() { return tech.isFlipFlop || tech.isRelay }, @@ -1810,8 +1819,8 @@ const tech = { description: "if relay switch is in the ON state
increase your maximum energy by 200", maxCount: 1, count: 0, - frequency: 3, - frequencyDefault: 3, + frequency: 4, + frequencyDefault: 4, allowed() { return tech.isRelay }, @@ -1849,8 +1858,8 @@ const tech = { description: "if relay switch is in the ON state
condense 4-13 ice IX crystals every second", maxCount: 9, count: 0, - frequency: 3, - frequencyDefault: 3, + frequency: 4, + frequencyDefault: 4, allowed() { return tech.isRelay }, @@ -7502,6 +7511,66 @@ const tech = { }, remove() {} }, + { + name: "discount", + description: "get 3 random JUNK tech for the price of 1!", + maxCount: 1, + count: 0, + frequency: 0, + isJunk: true, + isNonRefundable: true, + allowed() { + return true + }, + requires: "", + effect() { + tech.giveRandomJUNK() + tech.giveRandomJUNK() + tech.giveRandomJUNK() + }, + remove() {} + }, + { + name: "meteor shower", + description: "take a shower, but meteors instead of water", + maxCount: 1, + count: 0, + frequency: 0, + isJunk: true, + isNonRefundable: true, + allowed() { + return true + }, + requires: "", + effect() { + setInterval(() => { + + fireBlock = function(xPos, yPos) { + const index = body.length + spawn.bodyRect(xPos, yPos, 20 + 50 * Math.random(), 20 + 50 * Math.random()); + const bodyBullet = body[body.length - 1] + Matter.Body.setVelocity(body[index], { x: 5 * (Math.random() - 0.5), y: 10 * (Math.random() - 0.5) }); + body[index].collisionFilter.category = cat.body; + body[index].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet + body[index].classType = "body"; + Composite.add(engine.world, body[index]); //add to world + setTimeout(() => { //remove block + for (let i = 0; i < body.length; i++) { + if (body[i] === bodyBullet) { + Matter.Composite.remove(engine.world, body[i]); + body.splice(i, 1); + } + } + }, 3000 + Math.floor(6000 * Math.random())); + } + fireBlock(player.position.x + 600 * (Math.random() - 0.5), player.position.y - 500 - 500 * Math.random()); + // for (let i = 0, len = Math.random(); i < len; i++) { + // } + + }, 1000); + }, + remove() {} + }, { name: "Higgs phase transition", description: "instantly spawn 3 tech, but add a chance to
remove everything with a 5 minute half-life", @@ -8041,7 +8110,7 @@ const tech = { }, { name: "hidden variable", - description: `spawn ${powerUps.orb.heal(15)}
but hide your health bar`, + description: `spawn ${powerUps.orb.heal(20)}
but hide your health bar`, maxCount: 1, count: 0, frequency: 0, @@ -8054,7 +8123,7 @@ const tech = { effect() { document.getElementById("health").style.display = "none" document.getElementById("health-bg").style.display = "none" - for (let i = 0; i < 15; i++) powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal"); + for (let i = 0; i < 20; i++) powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal"); }, remove() {} }, @@ -8076,6 +8145,7 @@ const tech = { setTimeout(() => { simulation.drawCircle = savedfunction canvas.width = canvas.width //clears the canvas // works on chrome at least + powerUps.spawn(m.pos.x, m.pos.y, "tech"); }, 10000); // for (;;) {} //freezes the tab diff --git a/todo.txt b/todo.txt index 4350731..632c2a3 100644 --- a/todo.txt +++ b/todo.txt @@ -1,15 +1,20 @@ ******************************************************** NEXT PATCH ************************************************** -tech lithium-ion - give 200 max energy when relay is ON -tech shape-memory alloy - give 200 max health when flip-flop is ON - NOR gate now prevents damage when in the OFF state (previously ON) to work well with shape-memory alloy +JUNK tech: meteor shower - take a shower, but meteors instead of water +JUNK tech: discount - get 3 random JUNK tech for the price of 1! -harpoon crouch mode now retracts at 30% greater distance than normal with no targeting +bug fixes -more bug fixes of course +I'll be off line until Saturday, so please don't submit any bug reports until I return ******************************************************** TODO ******************************************************** + +tech mines: mines fire _____ instead of nails + needles + super balls? + foam? + plasma ball gently scale damage with circleRadius balance corona discharge