plasma bot, boom bot

mod - boomBot: explodes on mobs in close range
mod - plasma-bot:  bot that fires your plasma torch
This commit is contained in:
landgreen
2020-06-29 05:48:46 -07:00
parent 869102aebb
commit c6a397bd3f
8 changed files with 726 additions and 568 deletions

View File

@@ -156,7 +156,7 @@ const b = {
} }
} }
}, },
explosion(where, radius, isBurn = false) { explosion(where, radius) {
radius *= mod.explosionRadius radius *= mod.explosionRadius
// typically explode is used for some bullets with .onEnd // typically explode is used for some bullets with .onEnd
//add dmg to draw queue //add dmg to draw queue
@@ -969,7 +969,7 @@ const b = {
nailBot(position = mech.pos) { nailBot(position = mech.pos) {
const me = bullet.length; const me = bullet.length;
const dir = mech.angle; const dir = mech.angle;
const RADIUS = (10 + 5 * Math.random()) const RADIUS = (12 + 4 * Math.random())
bullet[me] = Bodies.polygon(position.x, position.y, 4, RADIUS, { bullet[me] = Bodies.polygon(position.x, position.y, 4, RADIUS, {
angle: dir, angle: dir,
friction: 0, friction: 0,
@@ -1076,6 +1076,273 @@ const b = {
}) })
World.add(engine.world, bullet[me]); //add bullet to world World.add(engine.world, bullet[me]); //add bullet to world
}, },
plasmaBot(position = mech.pos) {
const me = bullet.length;
const dir = mech.angle;
const RADIUS = 18
bullet[me] = Bodies.polygon(position.x, position.y, 5, RADIUS, {
angle: dir,
friction: 0,
frictionStatic: 0,
frictionAir: 0.05,
restitution: 1,
dmg: 0, // 0.14 //damage done in addition to the damage from momentum
minDmgSpeed: 2,
lookFrequency: 15,
cd: 0,
acceleration: 0.0085,
endCycle: Infinity,
classType: "bullet",
collisionFilter: {
category: cat.bullet,
mask: cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
},
lockedOn: null,
onDmg() {
this.lockedOn = null
},
onEnd() {},
do() {
const distanceToPlayer = Vector.magnitude(Vector.sub(this.position, mech.pos))
if (distanceToPlayer > 100) { //if far away move towards player
this.force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, this.position)), this.mass * this.acceleration)
}
Matter.Body.setVelocity(this, Vector.add(Vector.mult(this.velocity, 0.90), Vector.mult(player.velocity, 0.17))); //add player's velocity
//find closest
if (!(game.cycle % this.lookFrequency)) {
this.lockedOn = null;
let closeDist = mod.isPlasmaRange * 1000;
for (let i = 0, len = mob.length; i < len; ++i) {
const DIST = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius;
if (DIST < closeDist && 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) {
closeDist = DIST;
this.lockedOn = mob[i]
}
}
}
//fire plasma at target
const DRAIN = 0.0014
if (this.lockedOn && this.lockedOn.alive && mech.energy > DRAIN && mech.fieldCDcycle < mech.cycle) {
mech.energy -= DRAIN;
if (mech.energy < 0) {
mech.fieldCDcycle = mech.cycle + 120;
mech.energy = 0;
}
const sub = Vector.sub(this.lockedOn.position, this.position)
const DIST = Vector.magnitude(sub);
const unit = Vector.normalise(sub)
if (DIST < mod.isPlasmaRange * 600) {
//calculate laser collision
let best;
let range = mod.isPlasmaRange * (140 + 300 * Math.sqrt(Math.random()))
const path = [{
x: this.position.x,
y: this.position.y
},
{
x: this.position.x + range * unit.x,
y: this.position.y + range * unit.y
}
];
const vertexCollision = function (v1, v1End, domain) {
for (let i = 0; i < domain.length; ++i) {
let vertices = domain[i].vertices;
const len = vertices.length - 1;
for (let j = 0; j < len; j++) {
results = game.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
if (results.onLine1 && results.onLine2) {
const dx = v1.x - results.x;
const dy = v1.y - results.y;
const dist2 = dx * dx + dy * dy;
if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) {
best = {
x: results.x,
y: results.y,
dist2: dist2,
who: domain[i],
v1: vertices[j],
v2: vertices[j + 1]
};
}
}
}
results = game.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
if (results.onLine1 && results.onLine2) {
const dx = v1.x - results.x;
const dy = v1.y - results.y;
const dist2 = dx * dx + dy * dy;
if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) {
best = {
x: results.x,
y: results.y,
dist2: dist2,
who: domain[i],
v1: vertices[0],
v2: vertices[len]
};
}
}
}
};
//check for collisions
best = {
x: null,
y: null,
dist2: Infinity,
who: null,
v1: null,
v2: null
};
vertexCollision(path[0], path[1], mob);
vertexCollision(path[0], path[1], map);
vertexCollision(path[0], path[1], body);
if (best.dist2 != Infinity) { //if hitting something
path[path.length - 1] = {
x: best.x,
y: best.y
};
if (best.who.alive) {
const dmg = 0.8 * b.dmgScale; //********** SCALE DAMAGE HERE *********************
best.who.damage(dmg);
best.who.locatePlayer();
//push mobs away
const force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, path[1])), -0.01 * Math.min(5, best.who.mass))
Matter.Body.applyForce(best.who, path[1], force)
Matter.Body.setVelocity(best.who, { //friction
x: best.who.velocity.x * 0.7,
y: best.who.velocity.y * 0.7
});
//draw mob damage circle
game.drawList.push({
x: path[1].x,
y: path[1].y,
radius: Math.sqrt(dmg) * 50,
color: "rgba(255,0,255,0.2)",
time: game.drawTime * 4
});
} else if (!best.who.isStatic) {
//push blocks away
const force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, path[1])), -0.007 * Math.sqrt(Math.sqrt(best.who.mass)))
Matter.Body.applyForce(best.who, path[1], force)
}
}
//draw blowtorch laser beam
ctx.strokeStyle = "rgba(255,0,255,0.1)"
ctx.lineWidth = 14
ctx.beginPath();
ctx.moveTo(path[0].x, path[0].y);
ctx.lineTo(path[1].x, path[1].y);
ctx.stroke();
ctx.strokeStyle = "#f0f";
ctx.lineWidth = 2
ctx.stroke();
//draw electricity
const Dx = Math.cos(mech.angle);
const Dy = Math.sin(mech.angle);
let x = this.position.x + 20 * Dx;
let y = this.position.y + 20 * Dy;
ctx.beginPath();
ctx.moveTo(x, y);
const step = Vector.magnitude(Vector.sub(path[0], path[1])) / 5
for (let i = 0; i < 4; i++) {
x += step * (Dx + 1.5 * (Math.random() - 0.5))
y += step * (Dy + 1.5 * (Math.random() - 0.5))
ctx.lineTo(x, y);
}
ctx.lineWidth = 2 * Math.random();
ctx.stroke();
}
}
}
})
World.add(engine.world, bullet[me]); //add bullet to world
},
boomBot(position = mech.pos) {
const me = bullet.length;
const dir = mech.angle;
const RADIUS = (7 + 2 * Math.random())
bullet[me] = Bodies.polygon(position.x, position.y, 4, RADIUS, {
angle: dir,
friction: 0,
frictionStatic: 0,
frictionAir: 0.05,
restitution: 1,
dmg: 0,
minDmgSpeed: 0,
lookFrequency: 35 + Math.floor(7 * Math.random()),
acceleration: 0.005 * (1 + 0.5 * Math.random()),
range: 500 * (1 + 0.1 * Math.random()),
endCycle: Infinity,
classType: "bullet",
collisionFilter: {
category: cat.bullet,
mask: cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
},
lockedOn: null,
explode: 0,
onDmg() {
if (this.lockedOn) {
const explosionRadius = Math.min(170, Vector.magnitude(Vector.sub(this.position, mech.pos)) - 30)
if (explosionRadius > 60) {
this.explode = explosionRadius
//
//push away from player, because normal explosion knock doesn't do much
// const sub = Vector.sub(this.lockedOn.position, mech.pos)
// mag = Math.min(35, 20 / Math.sqrt(this.lockedOn.mass))
// Matter.Body.setVelocity(this.lockedOn, Vector.mult(Vector.normalise(sub), mag))
}
this.lockedOn = null //lose target so bot returns to player
}
},
onEnd() {},
do() {
if (this.explode) {
b.explosion(this.position, this.explode); //makes bullet do explosive damage at end
this.explode = 0;
}
const distanceToPlayer = Vector.magnitude(Vector.sub(this.position, mech.pos))
if (distanceToPlayer > 100) { //if far away move towards player
this.force = Vector.mult(Vector.normalise(Vector.sub(mech.pos, this.position)), this.mass * this.acceleration)
} else if (distanceToPlayer < 250) { //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
//find targets
if (!(game.cycle % this.lookFrequency) && !mech.isStealth) {
this.lockedOn = null;
let closeDist = this.range;
for (let i = 0, len = mob.length; i < len; ++i) {
const DIST = Vector.magnitude(Vector.sub(this.position, mob[i].position)) - mob[i].radius;
if (DIST < closeDist && 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) {
closeDist = DIST;
this.lockedOn = mob[i]
}
}
}
}
//punch target
if (this.lockedOn && this.lockedOn.alive) {
const DIST = Vector.magnitude(Vector.sub(this.vertices[0], this.lockedOn.position));
if (DIST - this.lockedOn.radius < this.range &&
Matter.Query.ray(map, this.position, this.lockedOn.position).length === 0) {
//move towards the target
this.force = Vector.add(this.force, Vector.mult(Vector.normalise(Vector.sub(this.lockedOn.position, this.position)), 0.012 * this.mass))
}
}
}
})
World.add(engine.world, bullet[me]); //add bullet to world
},
laserBot(position = mech.pos) { laserBot(position = mech.pos) {
const me = bullet.length; const me = bullet.length;
const dir = mech.angle; const dir = mech.angle;
@@ -2212,7 +2479,7 @@ const b = {
}, },
{ {
name: "drones", name: "drones",
description: "deploy drones that <strong>crash</strong> into mobs<br>collisions reduce their <strong>lifespan</strong> by 1 second", description: "deploy drones that <strong>crash</strong> into mobs<br>crashes reduce their <strong>lifespan</strong> by 1 second",
ammo: 0, ammo: 0,
ammoPack: 14, ammoPack: 14,
have: false, have: false,
@@ -2660,7 +2927,7 @@ const b = {
isEasyToAim: false, isEasyToAim: false,
fire() { fire() {
//calculate laser collision //calculate laser collision
let best; let best, energy, explosionRange;
let range = 3000 let range = 3000
const path = [{ const path = [{
x: mech.pos.x + 20 * Math.cos(mech.angle), x: mech.pos.x + 20 * Math.cos(mech.angle),
@@ -2722,15 +2989,22 @@ const b = {
v2: null v2: null
}; };
if (mod.isPulseAim) { //find mobs in line of sight if (mod.isPulseAim) { //find mobs in line of sight
let dist = 2200
energy = 0.25 * Math.min(mech.energy, 1.75)
explosionRange = 1000 * energy
for (let i = 0, len = mob.length; i < len; i++) { for (let i = 0, len = mob.length; i < len; i++) {
if (Vector.magnitude(Vector.sub(path[0], mob[i].position)) < 2200 && const newDist = Vector.magnitude(Vector.sub(path[0], mob[i].position))
if (explosionRange < newDist &&
newDist < dist &&
Matter.Query.ray(map, path[0], mob[i].position).length === 0 && Matter.Query.ray(map, path[0], mob[i].position).length === 0 &&
Matter.Query.ray(body, path[0], mob[i].position).length === 0) { Matter.Query.ray(body, path[0], mob[i].position).length === 0) {
dist = newDist
best.who = mob[i] best.who = mob[i]
path[path.length - 1] = mob[i].position path[path.length - 1] = mob[i].position
break
} }
} }
} }
if (!best.who) { if (!best.who) {
vertexCollision(path[0], path[1], mob); vertexCollision(path[0], path[1], mob);
@@ -2743,16 +3017,16 @@ const b = {
}; };
} }
} }
let energy
if (mod.isPulseAim) { if (mod.isPulseAim) {
energy = 0.25 * Math.min(mech.energy, 1.75)
mech.energy -= energy * mod.isLaserDiode mech.energy -= energy * mod.isLaserDiode
if (best.who) b.explosion(path[1], 1000 * energy, true) if (best.who) b.explosion(path[1], explosionRange, true)
mech.fireCDcycle = mech.cycle + Math.floor(25 * b.fireCD); // cool down mech.fireCDcycle = mech.cycle + Math.floor(25 * b.fireCD); // cool down
} else { } else {
energy = 0.3 * Math.min(mech.energy, 1.75) energy = 0.3 * Math.min(mech.energy, 1.75)
mech.energy -= energy * mod.isLaserDiode mech.energy -= energy * mod.isLaserDiode
if (best.who) b.explosion(path[1], 1000 * energy, true) explosionRange = 1000 * energy
if (best.who) b.explosion(path[1], explosionRange, true)
mech.fireCDcycle = mech.cycle + Math.floor(50 * b.fireCD); // cool down mech.fireCDcycle = mech.cycle + Math.floor(50 * b.fireCD); // cool down
} }
if (mod.isPulseStun) { if (mod.isPulseStun) {

View File

@@ -208,7 +208,7 @@ function collisionChecks(event) {
if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5 if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5
mob[k].foundPlayer(); mob[k].foundPlayer();
mob[k].damage(dmg); mob[k].damage(dmg);
obj.onDmg(mob[k]); //some bullets do actions when they hits things, like despawn obj.onDmg(mob[k]); //some bullets do actions when they hits things, like despawn //forces don't seem to work here
game.drawList.push({ //add dmg to draw queue game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x, x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y, y: pairs[i].activeContacts[0].vertex.y,

View File

@@ -2,33 +2,6 @@
//********************************************************************* //*********************************************************************
const game = { const game = {
loop() {}, //main game loop, gets se tto normal or testing loop loop() {}, //main game loop, gets se tto normal or testing loop
testingLoop() {
game.gravity();
Engine.update(engine, game.delta);
game.wipe();
game.textLog();
if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
level.checkZones();
level.checkQuery();
mech.move();
mech.look();
game.checks();
ctx.save();
game.camera();
mech.draw();
game.draw.wireFrame();
game.draw.cons();
game.draw.testing();
game.drawCircle();
game.constructCycle()
ctx.restore();
game.testingOutput();
game.drawCursor();
},
normalLoop() { normalLoop() {
game.gravity(); game.gravity();
Engine.update(engine, game.delta); Engine.update(engine, game.delta);
@@ -39,7 +12,8 @@ const game = {
} else { } else {
mech.airControl() mech.airControl()
} }
level.checkZones(); // level.checkZones();
level.custom();
level.checkQuery(); level.checkQuery();
mech.move(); mech.move();
mech.look(); mech.look();
@@ -65,10 +39,38 @@ const game = {
b.bulletDraw(); b.bulletDraw();
b.bulletDo(); b.bulletDo();
game.drawCircle(); game.drawCircle();
game.clip(); // game.clip();
ctx.restore(); ctx.restore();
game.drawCursor(); game.drawCursor();
}, },
testingLoop() {
game.gravity();
Engine.update(engine, game.delta);
game.wipe();
game.textLog();
if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
// level.checkZones();
level.custom();
level.checkQuery();
mech.move();
mech.look();
game.checks();
ctx.save();
game.camera();
mech.draw();
game.draw.wireFrame();
game.draw.cons();
game.draw.testing();
game.drawCircle();
game.constructCycle()
ctx.restore();
game.testingOutput();
game.drawCursor();
},
isTimeSkipping: false, isTimeSkipping: false,
timeSkip(cycles = 60) { timeSkip(cycles = 60) {
game.isTimeSkipping = true; game.isTimeSkipping = true;
@@ -146,9 +148,9 @@ const game = {
// }; // };
// requestAnimationFrame(normalFPS); // requestAnimationFrame(normalFPS);
// }, // },
clip() { // clip() {
}, // },
drawCursor() { drawCursor() {
const size = 10; const size = 10;
ctx.beginPath(); ctx.beginPath();
@@ -397,7 +399,7 @@ const game = {
}); });
// game.noCameraScroll() // game.noCameraScroll()
} else if (keys[85]) { // next level with U } else if (keys[85]) { // next level with U
level.zoneActions.nextLevel(); level.nextLevel();
} }
} }
}, },
@@ -659,11 +661,9 @@ const game = {
powerUps.totalPowerUps = powerUp.length powerUps.totalPowerUps = powerUp.length
//if player is holding something this remembers it before it gets deleted let holdTarget; //if player is holding something this remembers it before it gets deleted
let holdTarget; if (mech.holdingTarget) holdTarget = mech.holdingTarget;
if (mech.holdingTarget) {
holdTarget = mech.holdingTarget;
}
mech.fireCDcycle = 0 mech.fireCDcycle = 0
mech.drop(); mech.drop();
level.fill = []; level.fill = [];
@@ -697,7 +697,11 @@ const game = {
frictionAir: holdTarget.frictionAir, frictionAir: holdTarget.frictionAir,
frictionStatic: holdTarget.frictionStatic frictionStatic: holdTarget.frictionStatic
}); });
Matter.Body.setPosition(body[len], mech.pos);
mech.isHolding = true
mech.holdingTarget = body[len]; mech.holdingTarget = body[len];
mech.holdingTarget.collisionFilter.category = 0;
mech.holdingTarget.collisionFilter.mask = 0;
} }
}, },
getCoords: { getCoords: {
@@ -811,20 +815,20 @@ const game = {
let line = 500; let line = 500;
const x = canvas.width - 5; const x = canvas.width - 5;
ctx.fillText("T: exit testing mode", x, line); ctx.fillText("T: exit testing mode", x, line);
line += 20; // line += 20;
ctx.fillText("Y: give all mods", x, line); // ctx.fillText("Y: give all mods", x, line);
line += 20; // line += 20;
ctx.fillText("R: teleport to mouse", x, line); // ctx.fillText("R: teleport to mouse", x, line);
line += 20; // line += 20;
ctx.fillText("F: cycle field", x, line); // ctx.fillText("F: cycle field", x, line);
line += 20; // line += 20;
ctx.fillText("G: give all guns", x, line); // ctx.fillText("G: give all guns", x, line);
line += 20; // line += 20;
ctx.fillText("H: heal", x, line); // ctx.fillText("H: heal", x, line);
line += 20; // line += 20;
ctx.fillText("U: next level", x, line); // ctx.fillText("U: next level", x, line);
line += 20; // line += 20;
ctx.fillText("1-7: spawn things", x, line); // ctx.fillText("1-7: spawn things", x, line);
} }
ctx.textAlign = "center"; ctx.textAlign = "center";
ctx.fillText(`(${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)})`, game.mouse.x, game.mouse.y - 20); ctx.fillText(`(${game.mouseInGame.x.toFixed(1)}, ${game.mouseInGame.y.toFixed(1)})`, game.mouse.x, game.mouse.y - 20);
@@ -924,13 +928,6 @@ const game = {
ctx.stroke(); ctx.stroke();
}, },
testing() { testing() {
//zones
ctx.beginPath();
for (let i = 0, len = level.zones.length; i < len; ++i) {
ctx.rect(level.zones[i].x1, level.zones[i].y1 + 70, level.zones[i].x2 - level.zones[i].x1, level.zones[i].y2 - level.zones[i].y1);
}
ctx.fillStyle = "rgba(0, 255, 0, 0.3)";
ctx.fill();
//query zones //query zones
ctx.beginPath(); ctx.beginPath();
for (let i = 0, len = level.queryList.length; i < len; ++i) { for (let i = 0, len = level.queryList.length; i < len; ++i) {

File diff suppressed because it is too large Load Diff

View File

@@ -1000,12 +1000,14 @@ const mobs = {
} }
} }
if (Math.random() < mod.isBotSpawner) { if (Math.random() < mod.isBotSpawner) {
if (Math.random() < 0.33) { if (Math.random() < 0.25) {
b.nailBot(this.position) b.nailBot(this.position)
} else if (Math.random() < 0.5) { } else if (Math.random() < 0.33) {
b.laserBot(this.position) b.laserBot(this.position)
} else { } else if (Math.random() < 0.5) {
b.foamBot(this.position) b.foamBot(this.position)
} else {
b.boomBot(this.position)
} }
// if (mech.energy > 0.33) mech.energy -= 0.33 // if (mech.energy > 0.33) mech.energy -= 0.33
} }

View File

@@ -276,23 +276,6 @@ const mod = {
mod.throwChargeRate = 1 mod.throwChargeRate = 1
} }
}, },
{
name: "laser-bot",
description: "a bot <strong>defends</strong> the space around you<br>uses a <strong>short range</strong> laser that drains <strong class='color-f'>energy</strong>",
maxCount: 9,
count: 0,
allowed() {
return true
},
requires: "",
effect() {
mod.laserBotCount++;
b.laserBot();
},
remove() {
mod.laserBotCount = 0;
}
},
{ {
name: "nail-bot", name: "nail-bot",
description: "a bot fires <strong>nails</strong> at targets in line of sight", description: "a bot fires <strong>nails</strong> at targets in line of sight",
@@ -327,13 +310,64 @@ const mod = {
mod.foamBotCount = 0; mod.foamBotCount = 0;
} }
}, },
{
name: "boom-bot",
description: "a bot <strong>defends</strong> the space around you<br>ignites an <strong class='color-e'>explosion</strong> after hitting a mob",
maxCount: 9,
count: 0,
allowed() {
return true
},
requires: "",
effect() {
mod.boomBotCount++;
b.boomBot();
},
remove() {
mod.boomBotCount = 0;
}
},
{
name: "laser-bot",
description: "a bot <strong>defends</strong> the space around you<br>uses a <strong>short range</strong> laser that drains <strong class='color-f'>energy</strong>",
maxCount: 9,
count: 0,
allowed() {
return true
},
requires: "",
effect() {
mod.laserBotCount++;
b.laserBot();
},
remove() {
mod.laserBotCount = 0;
}
},
{
name: "plasma-bot",
description: "a bot uses <strong class='color-f'>energy</strong> to emit short range <strong>plasma</strong><br>plasma <strong class='color-d'>damages</strong> and <strong>pushes</strong> mobs",
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "plasma torch"
},
requires: "plasma torch",
effect() {
mod.plasmaBotCount++;
b.plasmaBot();
},
remove() {
mod.plasmaBotCount = 0;
}
},
{ {
name: "scrap bots", name: "scrap bots",
description: "<strong>12%</strong> chance to build a <strong>bot</strong> after killing a mob<br>the bot only functions until the end of the level", description: "<strong>12%</strong> chance to build a <strong>bot</strong> after killing a mob<br>the bot only functions until the end of the level",
maxCount: 6, maxCount: 6,
count: 0, count: 0,
allowed() { allowed() {
return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 0 return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount > 0
}, },
requires: "a bot", requires: "a bot",
effect() { effect() {
@@ -345,19 +379,19 @@ const mod = {
}, },
{ {
name: "bot replication", name: "bot replication",
description: "<strong>duplicate</strong> your permanent <strong>bots</strong><br>remove <strong>80%</strong> of your <strong>ammo</strong>", description: "<strong>duplicate</strong> your permanent <strong>bots</strong><br>remove <strong>90%</strong> of your <strong>ammo</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
// isNonRefundable: true, // isNonRefundable: true,
allowed() { allowed() {
return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 2 return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount > 1
}, },
requires: "3 or more bots", requires: "2 or more bots",
effect() { effect() {
//remove ammo //remove ammo
for (let i = 0, len = b.guns.length; i < len; ++i) { for (let i = 0, len = b.guns.length; i < len; ++i) {
if (b.guns[i].ammo != Infinity) { if (b.guns[i].ammo != Infinity) {
b.guns[i].ammo = Math.floor(b.guns[i].ammo * 0.2); b.guns[i].ammo = Math.floor(b.guns[i].ammo * 0.1);
} }
} }
@@ -374,6 +408,14 @@ const mod = {
b.foamBot(); b.foamBot();
} }
mod.foamBotCount *= 2 mod.foamBotCount *= 2
for (let i = 0; i < mod.boomBotCount; i++) {
b.boomBot();
}
mod.boomBotCount *= 2
for (let i = 0; i < mod.plasmaBotCount; i++) {
b.plasmaBot();
}
mod.plasmaBotCount *= 2
}, },
remove() {} remove() {}
}, },
@@ -545,7 +587,7 @@ const mod = {
}, },
{ {
name: "Pauli exclusion", name: "Pauli exclusion",
description: `<strong>immune</strong> to <strong>harm</strong> for <strong>1</strong> seconds<br>activates after being <strong>harmed</strong> from a collision`, description: `<strong>immune</strong> to <strong>harm</strong> for <strong>1</strong> second<br>activates after being <strong>harmed</strong> from a collision`,
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -1400,7 +1442,7 @@ const mod = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.haveGunCheck("pulse") || mod.isMissileField; return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.haveGunCheck("pulse") || mod.isMissileField || mod.isExplodeMob
}, },
requires: "an explosive gun", requires: "an explosive gun",
effect: () => { effect: () => {
@@ -2163,6 +2205,8 @@ const mod = {
laserBotCount: null, laserBotCount: null,
nailBotCount: null, nailBotCount: null,
foamBotCount: null, foamBotCount: null,
boomBotCount: null,
plasmaBotCount: null,
collisionImmuneCycles: null, collisionImmuneCycles: null,
blockDmg: null, blockDmg: null,
isPiezo: null, isPiezo: null,

View File

@@ -94,20 +94,6 @@ const mech = {
x: 0, x: 0,
y: 0 y: 0
}, },
setPosToSpawn(xPos, yPos) {
this.spawnPos.x = this.pos.x = xPos;
this.spawnPos.y = this.pos.y = yPos;
this.transX = this.transSmoothX = canvas.width2 - this.pos.x;
this.transY = this.transSmoothY = canvas.height2 - this.pos.y;
this.Vx = this.spawnVel.x;
this.Vy = this.spawnVel.y;
player.force.x = 0;
player.force.y = 0;
Matter.Body.setPosition(player, this.spawnPos);
Matter.Body.setVelocity(player, this.spawnVel);
// mech.transX = -player.position.x
// mech.transY = player.position.y
},
Sy: 0, //adds a smoothing effect to vertical only Sy: 0, //adds a smoothing effect to vertical only
Vx: 0, Vx: 0,
Vy: 0, Vy: 0,
@@ -1507,7 +1493,7 @@ const mech = {
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(); mech.lookForPickUp();
const DRAIN = 0.0013 const DRAIN = 0.0014
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN; mech.energy -= DRAIN;
if (mech.energy < 0) { if (mech.energy < 0) {

View File

@@ -1,10 +1,21 @@
rerolls drop 60% more often mod - boomBot: explodes on mobs in close range
mines delay a 1/2 second longer before they arm mod - plasma-bot: bot that fires your plasma torch
mod: supply chain - doubles your current ammo, requires mod:logistics (limit 1 bot) (requires plasma torch)
mod: neocognitron - pulse auto aiming (you can get 2 plasma-bots with bot replication)
(you can switch to a new field after getting plasma-bot)
************** TODO - n-gon ************** ************** TODO - n-gon **************
mob that flashes the player (makes the graphics not update for a couple seconds)
held blocks aren't moving to the next level
only issue is setting held block to not collide
mod do 50% more damage in close, but 50% less at a distance
code it like mod.isFarAwayDmg
have these mods disable each other
phase field still isn't fun phase field still isn't fun
rework renormalization mod as well rework renormalization mod as well
does phase field need the stealth flag? does phase field need the stealth flag?
@@ -12,9 +23,6 @@ phase field still isn't fun
mod: use the stealth flag from the phase decoherence field mod: use the stealth flag from the phase decoherence field
maybe trigger it along with the damage immunity CD maybe trigger it along with the damage immunity CD
levels: make a function in the main game loop that runs level specific code
reset the level function as each new level loads
mod: efficient shielding (requires standing wave harmonics field) mod: efficient shielding (requires standing wave harmonics field)
lowers force applied when blocking mobs (instead of flinging them away, you push them like with plasma torch), but uses less energy to block mobs lowers force applied when blocking mobs (instead of flinging them away, you push them like with plasma torch), but uses less energy to block mobs
and making it so liquid nitrogen and uranium reactor core have that effect in a radius around the player instead of on contact and making it so liquid nitrogen and uranium reactor core have that effect in a radius around the player instead of on contact
@@ -23,9 +31,6 @@ mod: efficient shielding (requires standing wave harmonics field)
mod harmonic shield: slow everything in range around shield (temporal shield) mod harmonic shield: slow everything in range around shield (temporal shield)
set max speed? set max speed?
need a mod that effects ice status
mod: ice status effect lasts twice as long
mod: bot very slowly follows you and gives you a bonus when it's in range mod: bot very slowly follows you and gives you a bonus when it's in range
it moves through walls it moves through walls
effect: damage bonus?, damage reduction?, push away mobs, limit top speed of mobs/blocks/player? effect: damage bonus?, damage reduction?, push away mobs, limit top speed of mobs/blocks/player?