missile rework

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
This commit is contained in:
landgreen
2020-12-29 18:56:16 -08:00
parent 0d70e3918d
commit 9f019b9988
10 changed files with 334 additions and 217 deletions

View File

@@ -29,7 +29,7 @@ const b = {
}
}
} else {
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>=</span> 0`);
simulation.makeTextLog(`${b.guns[b.activeGun].name}.<span class='color-gun'>ammo</span><span class='color-symbol'>:</span> 0`);
}
mech.fireCDcycle = mech.cycle + 30; //fire cooldown
}
@@ -796,7 +796,7 @@ const b = {
b.grenade = grenadeDefault
}
},
missile(where, angle, speed, size = 1, spawn = 0) {
missile(where, angle, speed, size = 1) {
const me = bullet.length;
bullet[me] = Bodies.rectangle(where.x, where.y, 30 * size, 4 * size, {
angle: angle,
@@ -821,14 +821,6 @@ const b = {
onEnd() {
b.explosion(this.position, this.explodeRad * size); //makes bullet do explosive damage at end
if (tech.fragments) b.targetedNail(this.position, tech.fragments * 5)
if (spawn) {
for (let i = 0; i < tech.recursiveMissiles; i++) {
if (0.2 - 0.02 * i > Math.random()) {
b.missile(this.position, this.angle + Math.PI + 0.5 * (Math.random() - 0.5), 0, 0.33 + size, tech.recursiveMissiles)
break;
}
}
}
},
lockedOn: null,
tryToLockOn() {
@@ -901,7 +893,7 @@ const b = {
}
},
});
const thrust = 0.0065 * bullet[me].mass;
const thrust = 0.0066 * bullet[me].mass * (tech.missileSize ? 0.6 : 1);
Matter.Body.setVelocity(bullet[me], {
x: mech.Vx / 2 + speed * Math.cos(angle),
y: mech.Vy / 2 + speed * Math.sin(angle)
@@ -1594,7 +1586,7 @@ const b = {
if (tech.iceEnergy && !who.shield && !who.isShielded && who.dropPowerUp && who.alive) {
setTimeout(function() {
if (!who.alive) {
mech.energy += tech.iceEnergy
mech.energy += tech.iceEnergy * 0.8
mech.addHealth(tech.iceEnergy * 0.04)
}
}, 10);
@@ -1971,8 +1963,9 @@ const b = {
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.plasmaBotCount; i++) b.plasmaBot()
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()
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
@@ -2022,32 +2015,82 @@ const b = {
category: cat.bullet,
mask: cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
},
lockedOn: null,
beforeDmg() {
this.lockedOn = null
},
beforeDmg() {},
onEnd() {},
do() {
if (this.lastLookCycle < simulation.cycle && !mech.isCloak) {
this.lastLookCycle = simulation.cycle + (this.isUpgraded ? 15 : 80)
let target
for (let i = 0, len = mob.length; i < len; i++) {
const dist = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position));
if (dist < 3000000 && //1400*1400
Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
Matter.Query.ray(body, this.position, mob[i].position).length === 0) {
target = Vector.add(mob[i].position, Vector.mult(mob[i].velocity, Math.sqrt(dist) / 60))
const SPEED = 50
b.nail(this.position, Vector.mult(Vector.normalise(Vector.sub(target, this.position)), SPEED), 0.4)
break;
}
}
}
const distanceToPlayer = Vector.magnitude(Vector.sub(this.position, mech.pos))
if (distanceToPlayer > this.range) { //if far away move towards player
this.force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, this.position)), this.mass * this.acceleration)
} else { //close to player
Matter.Body.setVelocity(this, Vector.add(Vector.mult(this.velocity, 0.90), Vector.mult(player.velocity, 0.17))); //add player's velocity
if (this.lastLookCycle < simulation.cycle && !mech.isCloak) {
this.lastLookCycle = simulation.cycle + (this.isUpgraded ? 15 : 80)
let target
for (let i = 0, len = mob.length; i < len; i++) {
const dist = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position));
if (dist < 3000000 && //1400*1400
Matter.Query.ray(map, this.position, mob[i].position).length === 0 &&
Matter.Query.ray(body, this.position, mob[i].position).length === 0) {
target = Vector.add(mob[i].position, Vector.mult(mob[i].velocity, Math.sqrt(dist) / 60))
const SPEED = 50
const unit = Vector.normalise(Vector.sub(target, this.position))
b.nail(this.position, Vector.mult(unit, SPEED), 0.4)
this.force = Vector.mult(unit, -0.01 * this.mass)
break;
}
}
}
}
}
})
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(`<span class='color-var'>b</span>.missileBot()`);
const me = bullet.length;
bullet[me] = Bodies.rectangle(position.x, position.y, 28, 11, {
botType: "foam",
angle: mech.angle,
friction: 0,
frictionStatic: 0,
frictionAir: 0.055,
restitution: 0.7,
dmg: 0, // 0.14 //damage done in addition to the damage from momentum
minDmgSpeed: 2,
lookFrequency: 70,
cd: 0,
delay: 90,
range: 80,
endCycle: Infinity,
classType: "bullet",
collisionFilter: {
category: cat.bullet,
mask: cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
},
beforeDmg() {},
onEnd() {},
do() {
const distanceToPlayer = Vector.magnitude(Vector.sub(this.position, mech.pos))
if (distanceToPlayer > this.range) { //if far away move towards player
this.force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, this.position)), this.mass * 0.006)
} else { //close to player
Matter.Body.setVelocity(this, Vector.add(Vector.mult(this.velocity, 0.90), Vector.mult(player.velocity, 0.17))); //add player's velocity
if (this.cd < simulation.cycle && !(simulation.cycle % this.lookFrequency) && !mech.isCloak) {
for (let i = 0, len = mob.length; i < len; i++) {
const dist2 = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position));
if (Matter.Query.ray(map, this.position, mob[i].position).length === 0 && dist2 > 250000) {
this.cd = simulation.cycle + this.delay;
const angle = Vector.angle(this.position, mob[i].position)
Matter.Body.setAngle(this, angle)
// Matter.Body.setAngularVelocity(this, 0.025)
this.force = Vector.mult(Vector.normalise(Vector.sub(this.position, mob[i].position)), this.mass * 0.02)
b.missile(this.position, angle, -8, 0.7 * (tech.missileSize ? 1.5 : 1))
break;
}
}
}
}
}
})
@@ -2068,7 +2111,7 @@ const b = {
restitution: 0.6 * (1 + 0.5 * Math.random()),
dmg: 0, // 0.14 //damage done in addition to the damage from momentum
minDmgSpeed: 2,
lookFrequency: 60 + Math.floor(17 * Math.random()) - 20 * tech.isFoamBotUpgrade,
lookFrequency: 60 + Math.floor(17 * Math.random()) - 30 * tech.isFoamBotUpgrade,
cd: 0,
delay: 100,
acceleration: 0.005 * (1 + 0.5 * Math.random()),
@@ -2079,32 +2122,30 @@ const b = {
category: cat.bullet,
mask: cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
},
lockedOn: null,
beforeDmg() {
this.lockedOn = null
},
beforeDmg() {},
onEnd() {},
do() {
if (this.cd < simulation.cycle && !(simulation.cycle % this.lookFrequency) && !mech.isCloak) {
let target
for (let i = 0, len = mob.length; i < len; i++) {
const dist = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position));
if (dist < 1000000 && Matter.Query.ray(map, this.position, mob[i].position).length === 0) {
this.cd = simulation.cycle + this.delay;
target = Vector.add(mob[i].position, Vector.mult(mob[i].velocity, Math.sqrt(dist) / 60))
const radius = 6 + 7 * Math.random()
const SPEED = 29 - radius * 0.5; //(mech.crouch ? 32 : 20) - radius * 0.7;
const velocity = Vector.mult(Vector.normalise(Vector.sub(target, this.position)), SPEED)
b.foam(this.position, velocity, radius + 9 * this.isUpgraded)
break;
}
}
}
const distanceToPlayer = Vector.magnitude(Vector.sub(this.position, mech.pos))
if (distanceToPlayer > this.range) { //if far away move towards player
this.force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, this.position)), this.mass * this.acceleration)
} else { //close to player
Matter.Body.setVelocity(this, Vector.add(Vector.mult(this.velocity, 0.90), Vector.mult(player.velocity, 0.17))); //add player's velocity
if (this.cd < simulation.cycle && !(simulation.cycle % this.lookFrequency) && !mech.isCloak) {
let target
for (let i = 0, len = mob.length; i < len; i++) {
const dist2 = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position));
if (dist2 < 1000000 && Matter.Query.ray(map, this.position, mob[i].position).length === 0) {
this.cd = simulation.cycle + this.delay;
target = Vector.add(mob[i].position, Vector.mult(mob[i].velocity, Math.sqrt(dist2) / 60))
const radius = 6 + 7 * Math.random()
const SPEED = 29 - radius * 0.5; //(mech.crouch ? 32 : 20) - radius * 0.7;
const velocity = Vector.mult(Vector.normalise(Vector.sub(target, this.position)), SPEED)
b.foam(this.position, velocity, radius + 7 * this.isUpgraded)
break;
}
}
}
}
}
})
@@ -2804,18 +2845,34 @@ const b = {
World.add(engine.world, bullet[me]); //add bullet to world
}
} else if (tech.isNailShot) {
for (let i = 0; i < 14; i++) {
const dir = mech.angle + (Math.random() - 0.5) * spread * 0.2
const pos = {
x: mech.pos.x + 35 * Math.cos(mech.angle) + 15 * (Math.random() - 0.5),
y: mech.pos.y + 35 * Math.sin(mech.angle) + 15 * (Math.random() - 0.5)
if (mech.crouch) {
for (let i = 0; i < 11; i++) {
const dir = mech.angle + (Math.random() - 0.5) * 0.015
const pos = {
x: mech.pos.x + 35 * Math.cos(mech.angle) + 15 * (Math.random() - 0.5),
y: mech.pos.y + 35 * Math.sin(mech.angle) + 15 * (Math.random() - 0.5)
}
speed = 39 + 7 * Math.random()
const velocity = {
x: speed * Math.cos(dir),
y: speed * Math.sin(dir)
}
b.nail(pos, velocity, 1.2)
}
speed = 35 + 15 * Math.random()
const velocity = {
x: speed * Math.cos(dir),
y: speed * Math.sin(dir)
} else {
for (let i = 0; i < 15; i++) {
const dir = mech.angle + (Math.random() - 0.5) * 0.42
const pos = {
x: mech.pos.x + 35 * Math.cos(mech.angle) + 15 * (Math.random() - 0.5),
y: mech.pos.y + 35 * Math.sin(mech.angle) + 15 * (Math.random() - 0.5)
}
speed = 34 + 6 * Math.random()
const velocity = {
x: speed * Math.cos(dir),
y: speed * Math.sin(dir)
}
b.nail(pos, velocity, 1.2)
}
b.nail(pos, velocity, 1.2)
}
} else {
const side = 22
@@ -2912,15 +2969,15 @@ const b = {
name: "flechettes",
description: "fire a volley of <strong class='color-p'>uranium-235</strong> <strong>needles</strong><br>does <strong class='color-p'>radioactive</strong> <strong class='color-d'>damage</strong> over <strong>3</strong> seconds",
ammo: 0,
ammoPack: 65,
defaultAmmoPack: 65,
ammoPack: 75,
defaultAmmoPack: 75,
have: false,
count: 0, //used to track how many shots are in a volley before a big CD
lastFireCycle: 0, //use to remember how longs its been since last fire, used to reset count
fire() {
function makeFlechette(angle = mech.angle + 0.02 * (Math.random() - 0.5)) {
const me = bullet.length;
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle), 45, 1.4, b.fireAttributes(angle));
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle), 45, 1, b.fireAttributes(angle));
bullet[me].collisionFilter.mask = tech.pierce ? 0 : cat.body; //cat.mobShield | //cat.map | cat.body |
Matter.Body.setDensity(bullet[me], 0.00001); //0.001 is normal
bullet[me].endCycle = simulation.cycle + 180;
@@ -2954,16 +3011,15 @@ const b = {
}
} else {
this.endCycle = 0;
if (tech.isFlechetteExplode && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.975) {
// mobs.statusStun(who, 120)
if (tech.isFlechetteExplode && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.97) {
this.explodeRad = 300 + 60 * Math.random();
b.explosion(this.position, this.explodeRad); //makes bullet do explosive damage at end
}
who.foundPlayer();
if (tech.isFastDot) {
mobs.statusDoT(who, 3.78, 30)
mobs.statusDoT(who, 4, 30)
} else {
mobs.statusDoT(who, 0.63, tech.isSlowDot ? 360 : 180)
mobs.statusDoT(who, 0.7, tech.isSlowDot ? 360 : 180)
}
simulation.drawList.push({ //add dmg to draw queue
x: this.position.x,
@@ -2991,6 +3047,7 @@ const b = {
x: mech.Vx / 2 + SPEED * Math.cos(angle),
y: mech.Vy / 2 + SPEED * Math.sin(angle)
});
Matter.Body.setDensity(bullet[me], 0.00001);
World.add(engine.world, bullet[me]); //add bullet to world
}
makeFlechette()
@@ -2999,14 +3056,12 @@ const b = {
makeFlechette(mech.angle - 0.02 - 0.005 * Math.random())
}
const CD = (mech.crouch) ? 50 : 20
const CD = (mech.crouch) ? 40 : 15
if (this.lastFireCycle + CD < mech.cycle) this.count = 0 //reset count if it cycles past the CD
this.lastFireCycle = mech.cycle
if (this.count > ((mech.crouch) ? 8 : 1)) {
this.count = 0
mech.fireCDcycle = mech.cycle + Math.floor(CD * b.fireCD); // cool down
const who = bullet[bullet.length - 1]
Matter.Body.setDensity(who, 0.00001);
} else {
this.count++
mech.fireCDcycle = mech.cycle + Math.floor(2 * b.fireCD); // cool down
@@ -3126,62 +3181,88 @@ const b = {
},
{
name: "missiles",
description: "launch missiles that <strong>accelerate</strong> towards <strong>mobs</strong><br><strong class='color-e'>explodes</strong> when near target",
description: "launch <strong>homing</strong> missiles that <strong class='color-e'>explode</strong><br>crouch to <strong>rapidly</strong> launch smaller missiles",
ammo: 0,
ammoPack: 3.3,
ammoPack: 3.5,
have: false,
fireCycle: 0,
ammoLoaded: 0,
fire() {
//missile(where, dir, speed, size = 1, spawn = 0) {
if (tech.is3Missiles) {
if (mech.crouch) {
mech.fireCDcycle = mech.cycle + 17 * b.fireCD; // cool down
for (let i = 0; i < 3; i++) {
b.missile({
x: mech.pos.x,
y: mech.pos.y - 40
}, -Math.PI / 2 + 0.08 * (1 - i) + 0.3 * (Math.random() - 0.5), 0, 0.7, tech.recursiveMissiles)
bullet[bullet.length - 1].force.x -= 0.015 * (i - 1);
}
} else {
mech.fireCDcycle = mech.cycle + 55 * b.fireCD; // cool down
const direction = {
x: Math.cos(mech.angle),
y: Math.sin(mech.angle)
}
const push = Vector.mult(Vector.perp(direction), 0.02)
for (let i = 0; i < 3; i++) {
b.missile({
x: mech.pos.x + 40 * direction.x,
y: mech.pos.y + 40 * direction.y
}, mech.angle + 0.06 * (Math.random() - 0.5), 5, 0.7, tech.recursiveMissiles)
bullet[bullet.length - 1].force.x += push.x * (i - 1);
bullet[bullet.length - 1].force.y += push.y * (i - 1);
}
const countReduction = Math.pow(0.9, tech.missileCount)
if (mech.crouch) {
mech.fireCDcycle = mech.cycle + 10 * b.fireCD / countReduction; // cool down
const size = countReduction * (tech.missileSize ? 1.32 : 0.88)
const where = {
x: mech.pos.x,
y: mech.pos.y - 40
}
for (let i = 0; i < tech.missileCount; i++) {
b.missile(where, -Math.PI / 2 + 0.2 * (Math.random() - 0.5) * Math.sqrt(tech.missileCount), -2, size)
bullet[bullet.length - 1].force.x += 0.004 * size * (i - (tech.missileCount - 1) / 2);
}
} else {
if (mech.crouch) {
mech.fireCDcycle = mech.cycle + 17 * b.fireCD; // cool down
const off = Math.random() - 0.5
b.missile({
x: mech.pos.x,
y: mech.pos.y - 40
},
-Math.PI / 2 + 0.15 * off, 0, 1, tech.recursiveMissiles)
bullet[bullet.length - 1].force.x += off * 0.03;
// bullet[bullet.length - 1].force.y += push.y * (i - 1);
} else {
mech.fireCDcycle = mech.cycle + 55 * b.fireCD; // cool down
b.missile({
x: mech.pos.x + 40 * Math.cos(mech.angle),
y: mech.pos.y + 40 * Math.sin(mech.angle) - 3
},
mech.angle + (0.5 - Math.random()) * (mech.crouch ? 0 : 0.2), 20, 1, tech.recursiveMissiles)
// bullet[bullet.length - 1].force.y += 0.01; //a small push down at first to make it seem like the missile is briefly falling
}
mech.fireCDcycle = mech.cycle + 50 * b.fireCD / countReduction; // cool down
const size = countReduction * (tech.missileSize ? 1.5 : 1)
const direction = {
x: Math.cos(mech.angle),
y: Math.sin(mech.angle)
}
const push = Vector.mult(Vector.perp(direction), 0.02 * size / Math.sqrt(tech.missileCount))
const where = {
x: mech.pos.x + 40 * direction.x,
y: mech.pos.y + 40 * direction.y
}
for (let i = 0; i < tech.missileCount; i++) {
b.missile(where, mech.angle, 0, size)
bullet[bullet.length - 1].force.x += push.x * (i - (tech.missileCount - 1) / 2);
bullet[bullet.length - 1].force.y += push.y * (i - (tech.missileCount - 1) / 2);
}
}
// if (tech.missileCount) {
// if (mech.crouch) {
// for (let i = 0; i < 3; i++) {
// b.missile({
// x: mech.pos.x,
// y: mech.pos.y - 40
// }, -Math.PI / 2 + 0.08 * (1 - i) + 0.3 * (Math.random() - 0.5), 0, 0.6 * (tech.missileSize ? 1.5 : 1))
// bullet[bullet.length - 1].force.x -= 0.015 * (i - 1);
// }
// } else {
// mech.fireCDcycle = mech.cycle + 80 * b.fireCD; // cool down
// const direction = {
// x: Math.cos(mech.angle),
// y: Math.sin(mech.angle)
// }
// const push = Vector.mult(Vector.perp(direction), 0.02)
// for (let i = 0; i < 3; i++) {
// b.missile({
// x: mech.pos.x + 40 * direction.x,
// y: mech.pos.y + 40 * direction.y
// }, mech.angle + 0.06 * (Math.random() - 0.5), 5, 0.7 * (tech.missileSize ? 1.5 : 1))
// bullet[bullet.length - 1].force.x += push.x * (i - 1);
// bullet[bullet.length - 1].force.y += push.y * (i - 1);
// }
// }
// } else {
// if (mech.crouch) {
// mech.fireCDcycle = mech.cycle + 10 * b.fireCD; // cool down
// const off = Math.random() - 0.5
// b.missile({
// x: mech.pos.x,
// y: mech.pos.y - 40
// },
// -Math.PI / 2 + 0.15 * off, 0, 0.83 * (tech.missileSize ? 1.5 : 1))
// bullet[bullet.length - 1].force.x += off * 0.03;
// // bullet[bullet.length - 1].force.y += push.y * (i - 1);
// } else {
// mech.fireCDcycle = mech.cycle + 55 * b.fireCD; // cool down
// // bullet[bullet.length - 1].force.y += 0.01; //a small push down at first to make it seem like the missile is briefly falling
// }
// }
}
},
{
@@ -3773,7 +3854,7 @@ const b = {
mech.fireCDcycle = mech.cycle
mech.energy -= mech.fieldRegen + tech.laserFieldDrain * tech.isLaserDiode
const divergence = mech.crouch ? 0.15 : 0.2
let dmg = 0.1 + tech.laserDamage * Math.pow(0.9, tech.laserDamage)
let dmg = tech.laserDamage * Math.pow(0.9, tech.beamSplitter) //Math.pow(0.9, tech.laserDamage)
const where = {
x: mech.pos.x + 20 * Math.cos(mech.angle),
y: mech.pos.y + 20 * Math.sin(mech.angle)
@@ -3844,7 +3925,7 @@ const b = {
} else {
mech.fireCDcycle = mech.cycle
mech.energy -= mech.fieldRegen + tech.laserFieldDrain * tech.isLaserDiode
const dmg = 0.5 * tech.laserDamage // 3.5 * 0.55 = 200% more damage
const dmg = 0.4 * tech.laserDamage // 3.5 * 0.55 = 200% more damage
ctx.strokeStyle = "#f00";
let spacing, len
if (tech.wideLaser === 3) {
@@ -3886,10 +3967,9 @@ const b = {
let energy = 0.27 * Math.min(mech.energy, 1.5)
mech.energy -= energy * tech.isLaserDiode
if (tech.beamSplitter) {
energy *= 0.66
energy *= Math.pow(0.9, tech.beamSplitter)
b.pulse(energy, mech.angle)
for (let i = 1; i < 1 + tech.beamSplitter; i++) {
energy *= 0.9
b.pulse(energy, mech.angle - i * 0.27)
b.pulse(energy, mech.angle + i * 0.27)
}

View File

@@ -123,7 +123,7 @@ function collisionChecks(event) {
y: mob[k].velocity.y - 8 * Math.sin(angle)
});
if (tech.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mech.energy > 0.34 * mech.maxEnergy) {
if (tech.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mob[k].dropPowerUp && mech.energy > 0.34 * mech.maxEnergy) {
mech.energy -= 0.33 * mech.maxEnergy
mech.immuneCycle = 0; //player doesn't go immune to collision damage
mob[k].death();

View File

@@ -13,13 +13,14 @@ const level = {
start() {
if (level.levelsCleared === 0) { //this code only runs on the first level
// simulation.enableConstructMode() //used to build maps in testing mode
// level.difficultyIncrease(1)
// level.difficultyIncrease(20)
// simulation.zoomScale = 1000;
// simulation.setZoom();
// mech.setField("plasma torch")
// b.giveGuns("wave beam")
// b.giveGuns("missiles")
// tech.giveTech("CPT reversal")
// tech.giveTech("CPT gun")
// tech.giveTech("missile-bot")
// tech.giveTech("nail-bot")
// for (let i = 0; i < 15; i++) tech.giveTech("plasma jet")
level.intro(); //starting level
@@ -62,8 +63,7 @@ const level = {
tech.armorFromPowerUps += gain
mech.setMaxHealth();
// if (powerUps.totalPowerUps) simulation.makeTextLog("<span style='font-size:115%;'> max health increased by " + (gain * 100).toFixed(0) + "%</span>", 300)
simulation.makeTextLog(`<span class='color-var'>mech</span>.<span class='color-h'>maxHealth</span> <span class='color-symbol'>+=</span> ${(gain).toFixed(3)}
<br>${mech.maxHealth.toFixed(3)}`)
simulation.makeTextLog(`<span class='color-var'>mech</span>.<span class='color-h'>maxHealth</span> <span class='color-symbol'>+=</span> ${(gain).toFixed(2)}`)
}
if (tech.isHealLowHealth) {
const len = Math.floor((mech.maxHealth - mech.health) / 0.5)
@@ -146,7 +146,7 @@ const level = {
spawn.bodyRect(x + 5, y - 260 + i * blockSize, 30, blockSize);
}
}
blockDoor(710, -710);
// blockDoor(710, -710);
spawn.mapRect(2500, -1200, 200, 750); //right wall
blockDoor(2585, -210)
spawn.mapRect(2500, -200, 200, 300); //right wall
@@ -159,7 +159,7 @@ const level = {
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump
// spawn.boost(1500, 0, 900);
// spawn.starter(1900, -500, 200) //big boy
spawn.starter(1900, -500, 200) //big boy
// spawn.exploder(2900, -500)
// spawn.launcherBoss(1200, -500)
// spawn.laserTargetingBoss(1600, -400)

View File

@@ -1507,7 +1507,7 @@ const mech = {
}
} else if (tech.isMissileField) {
mech.energy -= 0.55;
b.missile({ x: mech.pos.x, y: mech.pos.y - 40 }, -Math.PI / 2, 0, 1, tech.recursiveMissiles)
b.missile({ x: mech.pos.x, y: mech.pos.y - 40 }, -Math.PI / 2, 0, 1)
} else if (tech.isIceField) {
mech.energy -= 0.057;
b.iceIX(1)
@@ -1540,13 +1540,13 @@ const mech = {
},
{
name: "negative mass field",
description: "use <strong class='color-f'>energy</strong> to nullify &nbsp;<strong style='letter-spacing: 7px;'>gravity</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>40%</strong><br><strong>blocks</strong> held by the field have a lower <strong>mass</strong>",
description: "use <strong class='color-f'>energy</strong> to nullify &nbsp;<strong style='letter-spacing: 7px;'>gravity</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>45%</strong><br><strong>blocks</strong> held by the field have a lower <strong>mass</strong>",
fieldDrawRadius: 0,
effect: () => {
mech.fieldFire = true;
mech.holdingMassScale = 0.03; //can hold heavier blocks with lower cost to jumping
mech.fieldMeterColor = "#000"
mech.fieldHarmReduction = 0.6;
mech.fieldHarmReduction = 0.55;
mech.fieldDrawRadius = 0;
mech.hold = function() {

View File

@@ -53,7 +53,7 @@ const powerUps = {
powerUps.tech.banishLog.push(powerUps.tech.choiceLog[powerUps.tech.choiceLog.length - 1 - i])
}
}
simulation.makeTextLog(`${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)} estimated <strong class='color-m'>tech</strong> choices remaining`)
simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)}`)
}
}
if (tech.manyWorlds && powerUps.reroll.rerolls === 0) {
@@ -127,7 +127,8 @@ const powerUps = {
powerUps.tech.banishLog.push(powerUps.tech.choiceLog[powerUps.tech.choiceLog.length - 1 - i])
}
}
simulation.makeTextLog(`${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)} estimated <strong class='color-m'>tech</strong> choices remaining`)
// simulation.makeTextLog(`${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)} estimated <strong class='color-m'>tech</strong> choices remaining`)
simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)}`)
}
powerUps[type].effect();
},
@@ -168,26 +169,23 @@ const powerUps = {
return 17;
},
effect() {
//give ammo to all guns in inventory
if (tech.isAmmoForGun && b.inventory.length > 0) {
if (tech.isAmmoForGun && b.inventory.length > 0 && b.activeGun) {
const target = b.guns[b.activeGun]
const ammoAdded = Math.ceil(Math.random() * target.ammoPack) + Math.ceil(Math.random() * target.ammoPack)
target.ammo += ammoAdded
// simulation.makeTextLog(`<div class='circle gun'></div> &nbsp; ${ammoAdded} ammo added`, 300)
simulation.makeTextLog(`${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}
<br>${target.ammo}`)
} else {
let text = '';
if (target.ammo !== Infinity) {
const ammoAdded = Math.ceil(Math.random() * target.ammoPack) + Math.ceil(Math.random() * target.ammoPack)
target.ammo += ammoAdded
simulation.makeTextLog(`${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}`)
}
} else { //give ammo to all guns in inventory
for (let i = 0, len = b.inventory.length; i < len; i++) {
const target = b.guns[b.inventory[i]]
if (target.ammo !== Infinity) {
const ammoAdded = Math.ceil(Math.random() * target.ammoPack)
target.ammo += ammoAdded
if (i !== 0) text += "<br>"
text += `${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}`
simulation.makeTextLog(`${target.name}.<span class='color-gun'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}`)
}
}
simulation.makeTextLog(text)
}
simulation.updateGunHUD();
}
@@ -375,7 +373,8 @@ const powerUps = {
for (let i = 0, len = tech.tech.length; i < len; i++) {
if (tech.tech[i].name === "erase") powerUps.ejectTech(i)
}
simulation.makeTextLog(`No <strong class='color-m'>tech</strong> left<br>erased <strong class='color-m'>tech</strong> have been recovered`)
// simulation.makeTextLog(`No <strong class='color-m'>tech</strong> left<br>erased <strong class='color-m'>tech</strong> have been recovered`)
simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)}`)
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
powerUps.endDraft("tech");
} else {

View File

@@ -522,6 +522,7 @@ const simulation = {
tech.foamBotCount = 0;
tech.boomBotCount = 0;
tech.plasmaBotCount = 0;
tech.missileBotCount = 0;
b.setFireCD();
simulation.updateTechHUD();

View File

@@ -83,7 +83,7 @@ const tech = {
if (tech.isEnergyNoAmmo) dmg *= 1.5
if (tech.isDamageForGuns) dmg *= 1 + 0.07 * 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 *= 2;
if (tech.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 3;
if (tech.isEnergyLoss) dmg *= 1.5;
if (tech.isAcidDmg && mech.health > 1) dmg *= 1.4;
if (tech.restDamage > 1 && player.speed < 1) dmg *= tech.restDamage
@@ -100,7 +100,7 @@ const tech = {
return (tech.isBayesian ? 0.2 : 0) + tech.cancelCount * 0.04 + tech.duplicateChance + mech.duplicateChance
},
totalBots() {
return tech.foamBotCount + tech.nailBotCount + tech.laserBotCount + tech.boomBotCount + tech.plasmaBotCount + tech.orbitBotCount
return tech.foamBotCount + tech.nailBotCount + tech.laserBotCount + tech.boomBotCount + tech.orbitBotCount + tech.plasmaBotCount + tech.missileBotCount
},
tech: [{
name: "electrolytes",
@@ -136,7 +136,7 @@ const tech = {
},
{
name: "exothermic process",
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br>if a mob <strong>dies</strong> drain stored <strong class='color-f'>energy</strong> by <strong>25%</strong>",
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br>if a mob <strong>dies</strong> drain <strong class='color-f'>energy</strong> by <strong>25%</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -250,7 +250,7 @@ const tech = {
},
{
name: "negative feedback",
description: "increase <strong class='color-d'>damage</strong> by <strong>6%</strong><br>for every <strong>10</strong> missing base <strong>health</strong>",
description: "increase <strong class='color-d'>damage</strong> by <strong>6%</strong><br>for every <strong>10</strong> <strong>health</strong> below <strong>100</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -266,7 +266,7 @@ const tech = {
},
{
name: "radiative equilibrium",
description: "for <strong>10 seconds</strong> after receiving <strong class='color-harm'>harm</strong><br>increase <strong class='color-d'>damage</strong> by <strong>100%</strong>",
description: "for <strong>10 seconds</strong> after receiving <strong class='color-harm'>harm</strong><br>increase <strong class='color-d'>damage</strong> by <strong>200%</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -561,7 +561,7 @@ const tech = {
},
{
name: "foam-bot",
description: "a bot fires <strong>foam</strong> at targets in line of sight",
description: "a bot fires <strong>foam</strong> at nearby targets",
maxCount: 9,
count: 0,
allowed() {
@@ -805,14 +805,18 @@ const tech = {
b.boomBot();
}
tech.boomBotCount *= 2
for (let i = 0; i < tech.plasmaBotCount; i++) {
b.plasmaBot();
}
tech.plasmaBotCount *= 2
for (let i = 0; i < tech.orbitBotCount; i++) {
b.orbitBot();
}
tech.orbitBotCount *= 2
for (let i = 0; i < tech.plasmaBotCount; i++) {
b.plasmaBot();
}
tech.plasmaBotCount *= 2
for (let i = 0; i < tech.missileBotCount; i++) {
b.missileBot();
}
tech.missileBotCount *= 2
},
remove() {}
},
@@ -906,7 +910,7 @@ const tech = {
},
{
name: "Pauli exclusion",
description: `<strong>immune</strong> to <strong class='color-harm'>harm</strong> for <strong>0.5</strong> seconds longer<br>after receiving <strong class='color-harm'>harm</strong> from a collision`,
description: `<strong>immune</strong> to <strong class='color-harm'>harm</strong> for an extra <strong>0.75</strong> seconds<br>after receiving <strong class='color-harm'>harm</strong> from a <strong>collision</strong>`,
maxCount: 9,
count: 0,
allowed() {
@@ -914,7 +918,7 @@ const tech = {
},
requires: "",
effect() {
tech.collisionImmuneCycles += 30;
tech.collisionImmuneCycles += 45;
mech.immuneCycle = mech.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
},
remove() {
@@ -1384,7 +1388,7 @@ const tech = {
},
{
name: "Bayesian statistics",
description: "<strong>20%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, <strong>eject</strong> 1 <strong class='color-m'>tech</strong>",
description: "<strong>20%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong><br>after a <strong>collision</strong>, eject <strong>1</strong> <strong class='color-m'>tech</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1773,9 +1777,9 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return (powerUps.reroll.rerolls > 5 || build.isCustomSelection) && !tech.isDeterminism
return (powerUps.reroll.rerolls > 2 || build.isCustomSelection) && !tech.isDeterminism
},
requires: "not determinism, at least 4 rerolls",
requires: "not determinism, at least 3 rerolls",
effect() {
tech.isBanish = true
for (let i = 0; i < 4; i++) {
@@ -2052,7 +2056,7 @@ const tech = {
},
{
name: "critical bifurcation",
description: "<strong>nails</strong> do <strong>400%</strong> more <strong class='color-d'>damage</strong><br>when they strike near the <strong>center</strong> of a mob",
description: "nail gun <strong>nails</strong> do <strong>400%</strong> more <strong class='color-d'>damage</strong><br>when they strike near the <strong>center</strong> of a mob",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -2428,25 +2432,42 @@ const tech = {
}
},
{
name: "recursion",
description: "after <strong>missiles</strong> <strong class='color-e'>explode</strong> they have a<br><strong>20%</strong> chance to launch a larger <strong>missile</strong>",
name: "cruise missile",
description: "<strong>missiles</strong> travel <strong>50%</strong> slower,<br>but have a <strong>50%</strong> larger <strong class='color-e'>explosive</strong> payload",
isGunTech: true,
maxCount: 6,
maxCount: 1,
count: 0,
allowed() {
return tech.haveGunCheck("missiles") || tech.isMissileField
},
requires: "missiles",
effect() {
tech.recursiveMissiles++
tech.missileSize = true
},
remove() {
tech.recursiveMissiles = 0;
tech.missileSize = false
}
},
{
name: "MIRV",
description: "launch <strong>3</strong> small <strong>missiles</strong> instead of <strong>1</strong> <br><strong>1.5x</strong> increase in <strong><em>delay</em></strong> after firing",
description: "launch <strong>+1</strong> <strong>missile</strong> at a time<br>decrease <strong>size</strong> and <strong>fire rate</strong> by <strong>10%</strong>",
isGunTech: true,
maxCount: 9,
count: 0,
allowed() {
return tech.haveGunCheck("missiles")
},
requires: "missiles",
effect() {
tech.missileCount++;
},
remove() {
tech.missileCount = 1;
}
},
{
name: "missile-bot",
description: "a bot fires <strong>missiles</strong> at far away targets",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -2455,10 +2476,11 @@ const tech = {
},
requires: "missiles",
effect() {
tech.is3Missiles = true;
tech.missileBotCount++;
b.missileBot();
},
remove() {
tech.is3Missiles = false;
tech.missileBotCount = 0;
}
},
{
@@ -2776,7 +2798,7 @@ const tech = {
},
{
name: "thermoelectric effect",
description: "<strong>killing</strong> mobs with <strong>ice IX</strong> gives <strong>4</strong> <strong class='color-h'>health</strong><br>and <strong>100</strong> <strong class='color-f'>energy</strong>",
description: "<strong>killing</strong> mobs with <strong>ice IX</strong> gives <strong>4</strong> <strong class='color-h'>health</strong><br>and <strong>80</strong> <strong class='color-f'>energy</strong>",
isGunTech: true,
maxCount: 9,
count: 0,
@@ -3034,14 +3056,14 @@ const tech = {
},
requires: "laser, not specular reflection<br>not diffraction grating",
effect() {
this.description = `add 10 more <strong>laser</strong> beams into into your past`
this.description = `add 5 more <strong>laser</strong> beams into into your past`
tech.historyLaser++
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "laser") b.guns[i].chooseFireMethod()
}
},
remove() {
this.description = "<strong>laser</strong> beam is <strong>spread</strong> into your recent <strong>past</strong><br>increase total laser <strong class='color-d'>damage</strong> by <strong>200%</strong>"
this.description = "<strong>laser</strong> beam is <strong>spread</strong> into your recent <strong>past</strong><br>increase total beam <strong class='color-d'>damage</strong> by <strong>300%</strong>"
tech.historyLaser = 0
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
if (b.guns[i].name === "laser") b.guns[i].chooseFireMethod()
@@ -3050,7 +3072,7 @@ const tech = {
},
{
name: "pulse",
description: "convert <strong>25%</strong> of your <strong class='color-f'>energy</strong> into a pulsed laser<br>instantly initiates a fusion <strong class='color-e'>explosion</strong>",
description: "convert <strong>25%</strong> of your <strong class='color-f'>energy</strong> into a pulsed laser<br>that instantly initiates a fusion <strong class='color-e'>explosion</strong>",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -3769,6 +3791,7 @@ const tech = {
foamBotCount: null,
boomBotCount: null,
plasmaBotCount: null,
missileBotCount: null,
orbitBotCount: null,
collisionImmuneCycles: null,
blockDmg: null,
@@ -3796,7 +3819,6 @@ const tech = {
isMineAmmoBack: null,
isPlasmaRange: null,
isFreezeMobs: null,
recursiveMissiles: null,
isIceCrystals: null,
throwChargeRate: null,
isBlockStun: null,
@@ -3816,7 +3838,7 @@ const tech = {
isPulseStun: null,
restDamage: null,
isRPG: null,
is3Missiles: null,
missileCount: null,
isDeterminism: null,
isSuperDeterminism: null,
isHarmReduce: null,
@@ -3919,6 +3941,7 @@ const tech = {
isRewindGrenade: null,
isExtruder: null,
isEndLevelPowerUp: null,
isRewindGun: null
isRewindGun: null,
missileSize: null
}