eddy current brake

mod perfect diamagnetism: eddy current brake - mobs have a speed limit when they are near you
This commit is contained in:
landgreen
2020-10-05 08:55:48 -07:00
parent 7947e69d4d
commit 0d2a570ebd
5 changed files with 46 additions and 26 deletions

View File

@@ -842,6 +842,10 @@ const game = {
}, },
checks() { checks() {
if (!(mech.cycle % 60)) { //once a second if (!(mech.cycle % 60)) { //once a second
//every second energy above max energy loses 25%
if (mech.energy > mech.maxEnergy) mech.energy = 1 + (mech.maxEnergy - mech.energy) * 0.75
if (mech.pos.y > game.fallHeight) { // if 4000px deep if (mech.pos.y > game.fallHeight) { // if 4000px deep
if (game.difficultyMode > 2) { if (game.difficultyMode > 2) {
mech.death(); mech.death();

View File

@@ -10,7 +10,7 @@ const level = {
levels: ["skyscrapers", "rooftops", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"], levels: ["skyscrapers", "rooftops", "warehouse", "highrise", "office", "aerie", "satellite", "sewers", "testChamber"],
start() { start() {
if (level.levelsCleared === 0) { //this code only runs on the first level if (level.levelsCleared === 0) { //this code only runs on the first level
// level.difficultyIncrease(8) level.difficultyIncrease(8)
// game.enableConstructMode() //used to build maps in testing mode // game.enableConstructMode() //used to build maps in testing mode
// game.zoomScale = 1000; // game.zoomScale = 1000;
// game.setZoom(); // game.setZoom();
@@ -20,7 +20,7 @@ const level = {
// for (let i = 0; i < 10; i++) { // for (let i = 0; i < 10; i++) {
// mod.giveMod("laser-bot"); // mod.giveMod("laser-bot");
// } // }
// mod.giveMod("orbit-bot upgrade") // mod.giveMod("eddy current brake")
level.intro(); //starting level level.intro(); //starting level

View File

@@ -1440,9 +1440,9 @@ const mod = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return !mod.isSuperDeterminism && !mod.isRerollHaste return powerUps.reroll.rerolls < 3 && !mod.isSuperDeterminism && !mod.isRerollHaste
}, },
requires: "not superdeterminism or Ψ(t) collapse", requires: "not superdeterminism or Ψ(t) collapse<br>fewer than 3 rerolls",
effect: () => { effect: () => {
mod.manyWorlds = true; mod.manyWorlds = true;
}, },
@@ -1456,9 +1456,9 @@ const mod = {
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return !mod.isSuperDeterminism && !mod.isRerollHaste return (powerUps.reroll.rerolls > 1 || build.isCustomSelection) && !mod.isSuperDeterminism && !mod.isRerollHaste
}, },
requires: "not superdeterminism or Ψ(t) collapse", requires: "not superdeterminism or Ψ(t) collapse<br>at least 2 rerolls",
effect() { effect() {
mod.renormalization = true; mod.renormalization = true;
}, },
@@ -2470,6 +2470,22 @@ const mod = {
mod.isStunField = 0; mod.isStunField = 0;
} }
}, },
{
name: "eddy current brake",
description: "you are <strong>surrounded</strong> by a field that<br>limits the <strong>top speed</strong> of mobs",
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "perfect diamagnetism"
},
requires: "perfect diamagnetism",
effect() {
mod.isPerfectBrake = true;
},
remove() {
mod.isPerfectBrake = false;
}
},
{ {
name: "fracture analysis", name: "fracture analysis",
description: "bullet impacts do <strong>400%</strong> <strong class='color-d'>damage</strong><br>to <strong>stunned</strong> mobs", description: "bullet impacts do <strong>400%</strong> <strong class='color-d'>damage</strong><br>to <strong>stunned</strong> mobs",
@@ -3006,5 +3022,6 @@ const mod = {
isNoFireDamage: null, isNoFireDamage: null,
duplicateChance: null, duplicateChance: null,
beamSplitter: null, beamSplitter: null,
iceEnergy: null iceEnergy: null,
isPerfectBrake: null
} }

View File

@@ -1303,20 +1303,6 @@ const mech = {
// mech.fieldArc = 0.3; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob) // mech.fieldArc = 0.3; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
// mech.calculateFieldThreshold(); // mech.calculateFieldThreshold();
mech.hold = function () { mech.hold = function () {
//cap mob speed based on distance
for (let i = 0; i < mob.length; i++) {
const distance = Vector.magnitude(Vector.sub(mech.pos, mob[i].position))
const range = 1000
if (distance < range) {
const cap = Math.max(0.01 * distance, 4)
if (mob[i].speed > cap) {
Matter.Body.setVelocity(mob[i], Vector.mult(Vector.normalise(mob[i].velocity), cap)); //set velocity to cap, but keep the direction
}
}
}
const wave = Math.sin(mech.cycle * 0.022); const wave = Math.sin(mech.cycle * 0.022);
mech.fieldRange = 170 + 12 * wave mech.fieldRange = 170 + 12 * wave
mech.fieldArc = 0.33 + 0.045 * wave //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob) mech.fieldArc = 0.33 + 0.045 * wave //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
@@ -1361,6 +1347,23 @@ const mech = {
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists) mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
} }
mech.drawFieldMeter() mech.drawFieldMeter()
if (mod.isPerfectBrake) { //cap mob speed around player
const range = 400 + 120 * wave
for (let i = 0; i < mob.length; i++) {
const distance = Vector.magnitude(Vector.sub(mech.pos, mob[i].position))
if (distance < range) {
const cap = mob[i].isShielded ? 7 : 3.5
if (mob[i].speed > cap && Vector.dot(mob[i].velocity, Vector.sub(mech.pos, mob[i].position)) > 0) { // if velocity is directed towards player
Matter.Body.setVelocity(mob[i], Vector.mult(Vector.normalise(mob[i].velocity), cap)); //set velocity to cap, but keep the direction
}
}
}
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, range, 0, 2 * Math.PI);
ctx.fillStyle = "hsla(200,50%,61%,0.08)";
ctx.fill();
}
} }
} }
}, },

View File

@@ -1,11 +1,7 @@
laser bots now use the same laser code as the player mod perfect diamagnetism: eddy current brake - mobs have a speed limit when they are near you
mod: thermoelectric effect - ice IX bullets give you 7% energy after they collides with mobs
************** TODO - n-gon ************** ************** TODO - n-gon **************
a gun that gives back energy
if your energy is below 90% your drones stay near you and give energy regen
buff neutron bomb? buff neutron bomb?
less fire CD? less fire CD?