diff --git a/.DS_Store b/.DS_Store index 293fb18..eeb07b1 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/js/bullet.js b/js/bullet.js index 7ba90f4..85a5812 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -114,6 +114,11 @@ const b = { simulation.updateGunHUD(); } }, + returnGunAmmo(name) { + for (i = 0, len = b.guns.length; i < len; i++) { //find which gun + if (b.guns[i].name === name) return b.guns[i].ammo + } + }, giveGuns(gun = "random", ammoPacks = 10) { if (tech.ammoCap) ammoPacks = 0.45 * tech.ammoCap if (tech.isOneGun) b.removeAllGuns(); @@ -1448,9 +1453,7 @@ const b = { // ctx.lineTo(this.vertices[0].x, this.vertices[0].y); ctx.stroke(); }, - draw() { - - }, + draw() {}, returnToPlayer() { if (Vector.magnitude(Vector.sub(this.position, m.pos)) < returnRadius) { //near player this.endCycle = 0; @@ -5631,6 +5634,7 @@ const b = { } //fire if ((!input.fire && this.charge > 0.6)) { + tech.harpoonDensity = 0.009 //0.001 is normal for blocks, 0.006 is normal for harpoon, 0.006*6 when buffed const where = { x: m.pos.x + 30 * Math.cos(m.angle), y: m.pos.y + 30 * Math.sin(m.angle) @@ -5639,21 +5643,56 @@ const b = { distance: 10000, target: null } - //look for closest mob in player's LoS - const dir = { x: Math.cos(m.angle), y: Math.sin(m.angle) }; //make a vector for the player's direction of length 1; used in dot product const harpoonSize = tech.isLargeHarpoon ? 1 + 0.1 * Math.sqrt(this.ammo) : 1 - for (let i = 0, len = mob.length; i < len; ++i) { - if (mob[i].alive && !mob[i].isBadTarget && Matter.Query.ray(map, m.pos, mob[i].position).length === 0) { - const dot = Vector.dot(dir, Vector.normalise(Vector.sub(mob[i].position, m.pos))) //the dot product of diff and dir will return how much over lap between the vectors - const dist = Vector.magnitude(Vector.sub(where, mob[i].position)) - if (dist < closest.distance && dot > 0.88) { //target closest mob that player is looking at and isn't too close to target - closest.distance = dist - closest.target = mob[i] + + if (tech.extraHarpoons) { + let targetCount = 0 + const SPREAD = 0.06 + 0.05 * (!input.down) + let angle = m.angle - SPREAD * tech.extraHarpoons / 2; + const dir = { x: Math.cos(angle), y: Math.sin(angle) }; //make a vector for the player's direction of length 1; used in dot product + + for (let i = 0, len = mob.length; i < len; ++i) { + if (mob[i].alive && !mob[i].isBadTarget && !mob[i].shield && Matter.Query.ray(map, m.pos, mob[i].position).length === 0) { + const dot = Vector.dot(dir, Vector.normalise(Vector.sub(mob[i].position, m.pos))) //the dot product of diff and dir will return how much over lap between the vectors + if (dot > 0.7) { //lower dot product threshold for targeting then if you only have one harpoon //target closest mob that player is looking at and isn't too close to target + if (this.ammo > 0) { + this.ammo-- + b.harpoon(where, mob[i], angle, harpoonSize, false) //Vector.angle(Vector.sub(where, mob[i].position), { x: 0, y: 0 }) + angle += SPREAD + targetCount++ + if (targetCount > tech.extraHarpoons) break + } + } } } + //if more harpoons and no targets left + if (targetCount < tech.extraHarpoons + 1) { + const num = tech.extraHarpoons + 1 - targetCount + for (let i = 0; i < num; i++) { + if (this.ammo > 0) { + this.ammo-- + b.harpoon(where, null, angle, harpoonSize, false) + angle += SPREAD + } + } + } + this.ammo++ //make up for the ammo used up in fire() + simulation.updateGunHUD(); + } else { + //look for closest mob in player's LoS + const dir = { x: Math.cos(m.angle), y: Math.sin(m.angle) }; //make a vector for the player's direction of length 1; used in dot product + for (let i = 0, len = mob.length; i < len; ++i) { + if (mob[i].alive && !mob[i].isBadTarget && Matter.Query.ray(map, m.pos, mob[i].position).length === 0) { + const dot = Vector.dot(dir, Vector.normalise(Vector.sub(mob[i].position, m.pos))) //the dot product of diff and dir will return how much over lap between the vectors + const dist = Vector.magnitude(Vector.sub(where, mob[i].position)) + if (dist < closest.distance && dot > 0.88) { //target closest mob that player is looking at and isn't too close to target + closest.distance = dist + closest.target = mob[i] + } + } + } + b.harpoon(where, closest.target, m.angle, harpoonSize, false) } - tech.harpoonDensity = 0.01 //0.001 is normal for blocks, 0.006 is normal for harpoon, 0.006*6 when buffed - b.harpoon(where, closest.target, m.angle, harpoonSize, false) //push away blocks and mobs const range = 1200 * this.charge @@ -5710,7 +5749,7 @@ const b = { if (input.down) smoothRate *= 0.995 this.charge = this.charge * smoothRate + 1 - smoothRate - m.energy += (this.charge - previousCharge) * (tech.isRailEnergyGain ? 0.8 : -0.3) //energy drain is proportional to charge gained, but doesn't stop normal m.fieldRegen + m.energy += (this.charge - previousCharge) * ((tech.isRailEnergyGain ? 0.5 : -0.3)) //energy drain is proportional to charge gained, but doesn't stop normal m.fieldRegen //draw magnetic field const X = m.pos.x @@ -5755,9 +5794,11 @@ const b = { target: null } //look for closest mob in player's LoS - const dir = { x: Math.cos(m.angle), y: Math.sin(m.angle) }; //make a vector for the player's direction of length 1; used in dot product const harpoonSize = (tech.isLargeHarpoon ? 1 + 0.1 * Math.sqrt(this.ammo) : 1) //* (input.down ? 0.7 : 1) const totalCycles = 7 * (tech.isFilament ? 1 + 0.01 * Math.min(110, this.ammo) : 1) * Math.sqrt(harpoonSize) + const SPREAD = 0.1 + let angle = m.angle - SPREAD * tech.extraHarpoons / 2; + const dir = { x: Math.cos(angle), y: Math.sin(angle) }; //make a vector for the player's direction of length 1; used in dot product if (tech.extraHarpoons && !input.down) { const range = 450 * (tech.isFilament ? 1 + 0.005 * Math.min(110, this.ammo) : 1) @@ -5769,7 +5810,8 @@ const b = { if (dist < range && dot > 0.7) { //lower dot product threshold for targeting then if you only have one harpoon //target closest mob that player is looking at and isn't too close to target if (this.ammo > 0) { this.ammo-- - b.harpoon(where, mob[i], m.angle, harpoonSize, true, totalCycles) //Vector.angle(Vector.sub(where, mob[i].position), { x: 0, y: 0 }) + b.harpoon(where, mob[i], angle, harpoonSize, true, totalCycles) //Vector.angle(Vector.sub(where, mob[i].position), { x: 0, y: 0 }) + angle += SPREAD targetCount++ if (targetCount > tech.extraHarpoons) break } @@ -5778,14 +5820,12 @@ const b = { } //if more harpoons and no targets left if (targetCount < tech.extraHarpoons + 1) { - const SPREAD = 0.1 const num = tech.extraHarpoons + 1 - targetCount - let dir = m.angle - SPREAD * (num - 1) / 2; for (let i = 0; i < num; i++) { if (this.ammo > 0) { this.ammo-- - b.harpoon(where, null, dir, harpoonSize, true, totalCycles) //Vector.angle(Vector.sub(where, mob[i].position), { x: 0, y: 0 }) - dir += SPREAD + b.harpoon(where, null, angle, harpoonSize, true, totalCycles) //Vector.angle(Vector.sub(where, mob[i].position), { x: 0, y: 0 }) + angle += SPREAD } } } @@ -5804,7 +5844,7 @@ const b = { } } b.harpoon(where, closest.target, m.angle, harpoonSize, !input.down, totalCycles) - m.fireCDcycle = m.cycle + 90 //Infinity; // cool down + m.fireCDcycle = m.cycle + 45 // cool down } const recoil = Vector.mult(Vector.normalise(Vector.sub(where, m.pos)), input.down ? 0.015 : 0.035) player.force.x -= recoil.x diff --git a/js/level.js b/js/level.js index 7d348e2..2fd3608 100644 --- a/js/level.js +++ b/js/level.js @@ -21,7 +21,7 @@ const level = { // tech.giveTech("railgun") // tech.giveTech("capacitor bank") // tech.giveTech("half-wave rectifier") - // for (let i = 0; i < 1; i++) tech.giveTech("reticulum") + // for (let i = 0; i < 3; i++) tech.giveTech("reticulum") // for (let i = 0; i < 2; i++) powerUps.directSpawn(0, 0, "tech"); // for (let i = 0; i < 3; i++) tech.giveTech("undefined") // for (let i = 10; i < tech.tech.length; i++) { tech.tech[i].isBanished = true } @@ -30,7 +30,7 @@ const level = { // tech.tech[297].frequency = 100 // m.immuneCycle = Infinity //you can't take damage - // level.difficultyIncrease(8) //30 is near max on hard //60 is near max on why + // level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why // simulation.enableConstructMode() //used to build maps in testing mode // level.reactor(); // level.testing(); //not in rotation, used for testing diff --git a/js/tech.js b/js/tech.js index f3af3fb..769bc5b 100644 --- a/js/tech.js +++ b/js/tech.js @@ -3276,7 +3276,7 @@ const tech = { }, { name: "metastability", - description: "12% chance to duplicate spawned power ups
duplicates explode with a 3 second half-life ", + description: "12% chance to duplicate spawned power ups
duplicates explode with a 3 second half-life", maxCount: 1, count: 0, frequency: 1, @@ -5479,17 +5479,17 @@ const tech = { }, { name: "railgun", - description: `harpoons are 66% denser, but don't retract
gain 600% more harpoon ammo per ${powerUps.orb.ammo(1)}`, + description: `harpoons are 50% denser, but don't retract
gain 500% more harpoon ammo per ${powerUps.orb.ammo(1)}`, isGunTech: true, maxCount: 1, count: 0, frequency: 2, frequencyDefault: 2, allowed() { - return tech.haveGunCheck("harpoon") && !tech.isFilament && !tech.extraHarpoons && !tech.isHarpoonPowerUp + return tech.haveGunCheck("harpoon") && !tech.isFilament && !tech.isHarpoonPowerUp }, - requires: "harpoon, not filament, reticulum, toggling harpoon", - ammoBonus: 6, + requires: "harpoon, not filament, toggling harpoon", + ammoBonus: 5, effect() { tech.isRailGun = true; for (i = 0, len = b.guns.length; i < len; i++) { //find which gun @@ -5556,8 +5556,8 @@ const tech = { // } // }, { - name: "half-wave rectifier", - description: "harpoons drain no energy as they retract
crouch firing harpoon generates energy", + name: "alternator", + description: "harpoon drains no energy
railgun generates energy", //as they retract
crouch firing harpoon generates energy", isGunTech: true, maxCount: 1, count: 0, @@ -5583,7 +5583,7 @@ const tech = { frequency: 2, frequencyDefault: 2, allowed() { - return tech.haveGunCheck("harpoon") || (tech.isNeedles || tech.isNeedleShot) + return (!tech.isLargeHarpoon && tech.haveGunCheck("harpoon")) || (tech.isNeedles || tech.isNeedleShot) }, requires: "nail gun, needle gun, needle-shot, harpoon", effect() { @@ -5594,8 +5594,7 @@ const tech = { } }, { - name: "unaaq", - link: `unaaq`, //https://en.wikipedia.org/wiki/Weapon + name: "Bessemer process", description: "increase the size of your harpoon
by 10% of the square root of harpoon ammo", isGunTech: true, maxCount: 1, @@ -5603,7 +5602,7 @@ const tech = { frequency: 2, frequencyDefault: 2, allowed() { - return tech.haveGunCheck("harpoon") + return tech.haveGunCheck("harpoon") && !tech.isShieldPierce }, requires: "harpoon", effect() { @@ -5614,7 +5613,45 @@ const tech = { } }, { - name: "filament", + name: "smelting", + // description: `spend ${powerUps.orb.ammo(2)}to upgrade the harpoon
fire +1 harpoon with each shot`, + // description: `forge ${Math.ceil(0.6*(tech.isRailGun? 5: 1))} ammo into a new harpoon
fire +1 harpoon with each shot`, + descriptionFunction() { return `forge ${tech.isRailGun? 10: 2} ammo into a new harpoon
fire +1 harpoon with each shot` }, + isGunTech: true, + maxCount: 9, + count: 0, + frequency: 2, + frequencyDefault: 2, + allowed() { + return tech.haveGunCheck("harpoon") && b.returnGunAmmo('harpoon') > 1 + }, + requires: "harpoon", + effect() { + for (i = 0, len = b.guns.length; i < len; i++) { //find which gun + if (b.guns[i].name === "harpoon") { + b.guns[i].ammo -= tech.isRailGun ? 10 : 2 + if (b.guns[i].ammo < 0) b.guns[i].ammo = 0 + simulation.updateGunHUD(); + tech.extraHarpoons++; + break + } + } + }, + remove() { + if (tech.extraHarpoons) { + for (i = 0, len = b.guns.length; i < len; i++) { //find which gun + if (b.guns[i].name === "harpoon") { + b.guns[i].ammo += Math.ceil(b.guns[i].ammoPack) * 2 * tech.extraHarpoons + simulation.updateGunHUD(); + break + } + } + } + tech.extraHarpoons = 0; + } + }, + { + name: "UHMWPE", description: "increase the length of your harpoon's rope
by 1% per harpoon ammo", isGunTech: true, maxCount: 1, @@ -5633,7 +5670,7 @@ const tech = { } }, { - name: "toggling harpoon", + name: "induction furnace", description: "increase the damage of your next harpoon
by 600% after using it to collect a power up", isGunTech: true, maxCount: 1, @@ -5652,25 +5689,6 @@ const tech = { tech.harpoonDensity = 0.006 } }, - { - name: "reticulum", - description: "fire +1 harpoon, but energy cost
to retract also increases", - isGunTech: true, - maxCount: 9, - count: 0, - frequency: 2, - frequencyDefault: 2, - allowed() { - return tech.haveGunCheck("harpoon") && !tech.isRailGun - }, - requires: "harpoon", - effect() { - tech.extraHarpoons++; - }, - remove() { - tech.extraHarpoons = 0; - } - }, { name: "optical amplifier", description: "gain 3 random laser guntech
laser only turns off if you have no energy", @@ -7396,6 +7414,40 @@ const tech = { }, remove() {} }, + { + name: "Higgs phase transition", + description: "instantly spawn 3 tech, but add a chance to
remove everything with a 5 minute half-life", + maxCount: 1, + count: 0, + frequency: 0, + frequencyDefault: 0, + isJunk: true, + isNonRefundable: true, + allowed() { + return true + }, + requires: "", + effect() { + powerUps.spawn(m.pos.x, m.pos.y, "tech"); + powerUps.spawn(m.pos.x + 20, m.pos.y, "tech"); + powerUps.spawn(m.pos.x + 40, m.pos.y, "tech"); + + function loop() { + // (1-X)^cycles = chance to be removed //Math.random() < 0.000019 10 min + if (!simulation.paused && m.alive) { + if (Math.random() < 0.000038) { + // m.death(); + simulation.clearMap(); + simulation.draw.setPaths(); + return + } + } + requestAnimationFrame(loop); + } + requestAnimationFrame(loop); + }, + remove() {} + }, { name: "brainstorm", description: "the tech choice menu randomizes
every 0.5 seconds for 10 seconds", diff --git a/todo.txt b/todo.txt index bb9cea6..e85327c 100644 --- a/todo.txt +++ b/todo.txt @@ -1,39 +1,34 @@ ******************************************************** NEXT PATCH ************************************************** -tech railgun - harpoon charge fires and no longer retracts, get 8x ammo from power ups - railgun has auto-targeting, like harpoon - the aiming graphic is gone - disables filament, reticulum, toggling - unlocks capacitor bank +filament renamed UHMWPE +unaaq renamed Bessemer process +toggling harpoon renamed induction furnace +half-wave rectifier renamed alternator +reticulum renamed smelting + smelting costs 2 ammo packs per upgrade + railgun works with smelting -mobs do 2% less harm to player -player does 0.5% more damage per level -Zeno's paradox removes 1/10 -> 1/12 -> 1/14 (7%) health every 5 seconds -drone gun gets 10% more ammo - -harpoon damage reduced by 15% -random bots have a 100% -> 66% chance to match your upgraded bot type -phonon has 1/8 -> 1/9 less ammo than matter wave -Penrose process gain 63 -> 53 energy when wormhole eats blocks -transdimensional spores makes 20% fewer spores when wormhole eats blocks - -bugfixes +JUNK tech: Higgs phase transition - spawn 3 tech, there is a chance to remove everything with a 5 minute halflife ******************************************************** TODO ******************************************************** +make a variety of harpoon shapes? + just a different railgun shape? + +tech - Plasma railgun + like foam, or phonon? + +pause time like invariant for other things... + throwing blocks + charging railgun + charging anything? + tech: when this tech is ejected spawn one of every power up type JUNK tech? -railgun feels like a downgrade from harpoon - buff railgun - increase harpoon size - nerf harpoon - shrink crouch mode harpoon size - - try to get grappling hook working again -bug - does any url sharing work? +bug - url sharing still broken sometimes setting to remove UI, except health bar except active gun? to see ammo