diff --git a/js/bullet.js b/js/bullet.js
index 0b9f762..fd41476 100644
--- a/js/bullet.js
+++ b/js/bullet.js
@@ -2222,8 +2222,8 @@ const b = {
}
//hit target with laser
if (this.lockedOn && this.lockedOn.alive && mech.energy > this.drainThreshold) {
- mech.energy -= 0.0012 * tech.isLaserDiode
- b.laser(this.vertices[0], this.lockedOn.position, b.dmgScale * (0.06 + 0.15 * this.isUpgraded))
+ mech.energy -= tech.laserFieldDrain * tech.isLaserDiode
+ b.laser(this.vertices[0], this.lockedOn.position, b.dmgScale * (0.38 * tech.laserDamage + this.isUpgraded * 0.21)) //tech.laserDamage = 0.16
}
}
})
@@ -3283,18 +3283,107 @@ const b = {
ammoPack: 2.7,
have: false,
fire() {
- const pos = {
- x: mech.pos.x + 30 * Math.cos(mech.angle),
- y: mech.pos.y + 30 * Math.sin(mech.angle)
+ if (tech.isLaserMine) { //laser mine
+ const me = bullet.length;
+ const position = mech.pos
+ bullet[me] = Bodies.polygon(position.x, position.y, 3, 25, {
+ bulletType: "mine",
+ angle: mech.angle,
+ friction: 0,
+ frictionAir: 0.05,
+ restitution: 0.5,
+ dmg: 0, // 0.14 //damage done in addition to the damage from momentum
+ minDmgSpeed: 2,
+ lookFrequency: 60 + Math.floor(7 * Math.random()),
+ drain: tech.isLaserDiode * tech.laserFieldDrain,
+ isArmed: false,
+ torqueMagnitude: (Math.random() > 0.5 ? 1 : -1) * 0.000003,
+ range: 1500,
+ endCycle: Infinity,
+ classType: "bullet",
+ collisionFilter: {
+ category: cat.bullet,
+ mask: cat.map | cat.body | cat.mob | cat.mobBullet | cat.mobShield | cat.bullet
+ },
+ beforeDmg() {},
+ onEnd() {
+ if (tech.isMineAmmoBack && (!this.isArmed || Math.random() < 0.2)) { //get ammo back from tech.isMineAmmoBack
+ for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
+ if (b.guns[i].name === "mine") {
+ b.guns[i].ammo++
+ simulation.updateGunHUD();
+ break;
+ }
+ }
+ }
+ },
+ do() {
+ if (!(simulation.cycle % this.lookFrequency) && mech.energy > this.drain) { //find mob targets
+ for (let i = 0, len = mob.length; i < len; ++i) {
+ if (
+ Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position)) < 2000000 &&
+ mob[i].dropPowerUp &&
+ Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
+ Matter.Query.ray(body, this.position, mob[i].position).length === 0
+ ) {
+ this.do = this.laserSpin
+ this.endCycle = simulation.cycle + 300
+ this.torqueMagnitude *= 2
+ this.torque += this.inertia * this.torqueMagnitude * 30 //spin
+ this.isArmed = true
+ }
+ }
+ }
+ },
+ reflections: Math.max(0, tech.laserReflections - 2),
+ laserSpin() {
+ //drain energy
+ if (mech.energy > this.drain) {
+ mech.energy -= this.drain
+ if (this.angularSpeed < 0.02) this.torque += this.inertia * this.torqueMagnitude //spin
+
+ //fire lasers
+ ctx.strokeStyle = "#f00";
+ ctx.lineWidth = 1.5
+ // ctx.globalAlpha = 1;
+ ctx.beginPath();
+ for (let i = 0; i < 3; i++) {
+ const where = this.vertices[i]
+ const endPoint = Vector.add(where, Vector.mult(Vector.normalise(Vector.sub(where, this.position)), 2500))
+ b.laser(where, endPoint, tech.laserDamage * 10, this.reflections, true)
+ }
+ ctx.stroke();
+ // ctx.globalAlpha = 1;
+ }
+ }
+ })
+
+ // if (tech.isMineSentry) {
+ // bullet[me].endCycle = simulation.cycle + 480
+ // bullet[me].do = bullet[me].laserSpin
+ // bullet[me].isArmed = true
+ // // Matter.Body.setAngularVelocity(bullet[me], 3000 * bullet[me].torqueMagnitude);
+ // }
+ let speed = mech.crouch ? 50 : 20
+ Matter.Body.setVelocity(bullet[me], {
+ x: speed * Math.cos(mech.angle),
+ y: speed * Math.sin(mech.angle)
+ });
+ World.add(engine.world, bullet[me]); //add bullet to world
+ } else { //normal mines
+ const pos = {
+ x: mech.pos.x + 30 * Math.cos(mech.angle),
+ y: mech.pos.y + 30 * Math.sin(mech.angle)
+ }
+ let speed = mech.crouch ? 36 : 22
+ if (Matter.Query.point(map, pos).length > 0) { //don't fire if mine will spawn inside map
+ speed = -2
+ }
+ b.mine(pos, {
+ x: speed * Math.cos(mech.angle),
+ y: speed * Math.sin(mech.angle)
+ }, 0, tech.isMineAmmoBack)
}
- let speed = mech.crouch ? 36 : 22
- if (Matter.Query.point(map, pos).length > 0) { //don't fire if mine will spawn inside map
- speed = -2
- }
- b.mine(pos, {
- x: speed * Math.cos(mech.angle),
- y: speed * Math.sin(mech.angle)
- }, 0, tech.isMineAmmoBack)
mech.fireCDcycle = mech.cycle + Math.floor((mech.crouch ? 50 : 25) * b.fireCD); // cool down
}
},
diff --git a/js/level.js b/js/level.js
index 8550ec4..b17ee16 100644
--- a/js/level.js
+++ b/js/level.js
@@ -17,7 +17,8 @@ const level = {
// simulation.zoomScale = 1000;
// simulation.setZoom();
// mech.setField("plasma torch")
- // b.giveGuns("missiles")
+ // b.giveGuns("mine")
+ // tech.isMineSentry = true
// tech.giveTech("CPT reversal")
// tech.giveTech("missile-bot")
// tech.giveTech("nail-bot")
@@ -3824,8 +3825,9 @@ const level = {
// level.difficultyIncrease(simulation.difficultyMode) //increase difficulty based on modes
//difficulty is increased 5 times when finalBoss dies
- const len = level.levelsCleared / level.levels.length //add 1 extra difficulty step for each time you have cleared all the levels
- for (let i = 0; i < len; i++) level.difficultyIncrease(simulation.difficultyMode)
+ // const len = level.levelsCleared / level.levels.length //add 1 extra difficulty step for each time you have cleared all the levels
+ // for (let i = 0; i < len; i++)
+ level.difficultyIncrease(simulation.difficultyMode)
level.onLevel++; //cycles map to next level
if (level.onLevel > level.levels.length - 1) level.onLevel = 0;
diff --git a/js/tech.js b/js/tech.js
index 038dc22..a075594 100644
--- a/js/tech.js
+++ b/js/tech.js
@@ -2574,6 +2574,23 @@ const tech = {
tech.isNeutronSlow = false
}
},
+ {
+ name: "laser-mines",
+ description: "mines hover in place until mobs get in range
mines use energy to emit 3 unaimed lasers",
+ isGunTech: true,
+ maxCount: 1,
+ count: 0,
+ allowed() {
+ return (tech.haveGunCheck("mine") || tech.isMineDrop) && !tech.isMineSentry
+ },
+ requires: "mines, not sentry",
+ effect() {
+ tech.isLaserMine = true;
+ },
+ remove() {
+ tech.isLaserMine = false;
+ }
+ },
{
name: "mine reclamation",
description: "retrieve ammo from all undetonated mines
and 20% of mines after detonation",
@@ -2598,9 +2615,9 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
- return (tech.haveGunCheck("mine") && !tech.isMineAmmoBack) || tech.isMineDrop
+ return (tech.haveGunCheck("mine") && !tech.isMineAmmoBack && !tech.isLaserMine) || tech.isMineDrop
},
- requires: "mine, not mine reclamation",
+ requires: "mine, not mine reclamation, not laser-mines",
effect() {
tech.isMineSentry = true;
},
@@ -2615,7 +2632,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
- return tech.isMineDrop + tech.nailBotCount + tech.fragments + tech.nailsDeathMob / 2 + (tech.haveGunCheck("mine") + tech.isNailShot + (tech.haveGunCheck("nail gun") && !tech.isIncendiary)) * 2 > 1
+ return tech.isMineDrop + tech.nailBotCount + tech.fragments + tech.nailsDeathMob / 2 + ((tech.haveGunCheck("mine") && !tech.isLaserMine) + tech.isNailShot + (tech.haveGunCheck("nail gun") && !tech.isIncendiary)) * 2 > 1
},
requires: "nails",
effect() {
@@ -2632,7 +2649,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
- return tech.isMineDrop + tech.nailBotCount + tech.fragments + tech.nailsDeathMob / 2 + (tech.haveGunCheck("mine") + tech.isNailShot + (tech.haveGunCheck("nail gun") && !tech.isIncendiary)) * 2 > 1
+ return tech.isMineDrop + tech.nailBotCount + tech.fragments + tech.nailsDeathMob / 2 + ((tech.haveGunCheck("mine") && !tech.isLaserMine) + tech.isNailShot + (tech.haveGunCheck("nail gun") && !tech.isIncendiary)) * 2 > 1
},
requires: "nails",
effect() {
@@ -2934,12 +2951,12 @@ const tech = {
},
{
name: "laser diodes",
- description: "lasers drain 37% less energy
effects laser-gun and laser-bot",
+ description: "all lasers drain 37% less energy
effects laser-gun, laser-bot, and laser-mines",
isGunTech: true,
maxCount: 1,
count: 0,
allowed() {
- return tech.haveGunCheck("laser") || tech.laserBotCount > 1
+ return tech.haveGunCheck("laser") || tech.laserBotCount > 1 || tech.isLaserMine
},
requires: "laser",
effect() {
@@ -2951,12 +2968,12 @@ const tech = {
},
{
name: "specular reflection",
- description: "laser beams gain 1 reflection
increase damage and energy drain by 50%",
+ description: "increase damage and energy drain by 50%
and +1 reflection for all lasers (gun, bot, mine)",
isGunTech: true,
maxCount: 9,
count: 0,
allowed() {
- return tech.haveGunCheck("laser") && !tech.isWideLaser && !tech.isPulseLaser && !tech.historyLaser
+ return (tech.haveGunCheck("laser") || tech.isLaserMine || tech.laserBotCount > 1) && !tech.isWideLaser && !tech.isPulseLaser && !tech.historyLaser
},
requires: "laser, not wide beam",
effect() {
@@ -3942,6 +3959,6 @@ const tech = {
isExtruder: null,
isEndLevelPowerUp: null,
isRewindGun: null,
- missileSize: null
-
+ missileSize: null,
+ isLaserMine: null
}
\ No newline at end of file
diff --git a/todo.txt b/todo.txt
index ccb41fd..4cb60b3 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,14 +1,6 @@
******************************************************** NEXT PATCH ********************************************************
-fixed some math on laser tech: diffraction grating and slow light propagation
- they were giving too much damage
-
-flechettes are slightly improved in: ammo, damage, fire rate
-
-tech - MIRV can now stack up to 9 bonus missiles
-removed tech - recursive missiles
-tech: cruise missile - 50% larger size, but travels 50% slower
-tech: missileBot - requires gun: missiles
+tech: laser-mines - a floating triangle spins around with lasers coming from it's points
******************************************************** BUGS ********************************************************
@@ -58,8 +50,7 @@ in game console
death, max health, max energy, rewind
mine tech: laser mines - mines hover in the air
- maybe they can be thrown a short distance, but they have no gravity and high friction, so they hover
- when a mob gets close they spin and fire 3 unaimed lasers from their vertexes
+ unlock specular reflection and laser diodes
with tech:sentry the mines spin immediately, and spin 2x times longer?
mechanic: use gun swap as an active ability