diff --git a/js/bullet.js b/js/bullet.js
index 3be32f1..344f14f 100644
--- a/js/bullet.js
+++ b/js/bullet.js
@@ -1013,6 +1013,7 @@ const b = {
for (let i = 0; i < mod.foamBotCount; i++) b.foamBot()
for (let i = 0; i < mod.boomBotCount; i++) b.boomBot()
for (let i = 0; i < mod.plasmaBotCount; i++) b.plasmaBot()
+ for (let i = 0; i < mod.orbitBotCount; i++) b.orbitBot()
if (mod.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
@@ -1020,7 +1021,11 @@ const b = {
}
},
randomBot(where = mech.pos, isKeep = true) {
- if (Math.random() < 0.25) {
+ if (Math.random() < 0.2) {
+ b.orbitBot(where)
+ b.orbitBot(where)
+ if (isKeep) mod.orbitBotCount += 2
+ } else if (Math.random() < 0.25) {
b.nailBot(where)
if (isKeep) mod.nailBotCount++;
} else if (Math.random() < 0.33) {
@@ -1513,6 +1518,65 @@ const b = {
})
World.add(engine.world, bullet[me]); //add bullet to world
},
+ orbitBot(position = mech.pos) {
+ const me = bullet.length;
+ bullet[me] = Bodies.polygon(position.x, position.y, 9, 7, {
+ isUpgraded: mod.isOrbitBotUpgrade,
+ botType: "orbit",
+ friction: 0,
+ frictionStatic: 0,
+ frictionAir: 0,
+ restitution: 0,
+ dmg: 0, // 0.14 //damage done in addition to the damage from momentum
+ minDmgSpeed: 0,
+ endCycle: Infinity,
+ classType: "bullet",
+ collisionFilter: {
+ category: cat.bullet,
+ mask: 0 //cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
+ },
+ onDmg() {},
+ onEnd() {},
+ range: 100 + (100 + 220 * mod.isOrbitBotUpgrade) * (0.7 + 0.6 * Math.random()),
+ orbitalSpeed: 0,
+ phase: 2 * Math.PI * Math.random(),
+ // smoothPlayerPosition: {
+ // x: player.position.x,
+ // y: player.position.y
+ // },
+ do() {
+ //check for damage
+ if (!mech.isCloak && !mech.isBodiesAsleep) { //if time dilation isn't active
+ q = Matter.Query.point(mob, this.position)
+ for (let i = 0; i < q.length; i++) {
+ let dmg = 2.5 * b.dmgScale
+ q[i].damage(dmg);
+ q[i].foundPlayer();
+ game.drawList.push({ //add dmg to draw queue
+ x: this.position.x,
+ y: this.position.y,
+ radius: Math.log(2 * dmg + 1.1) * 40,
+ color: 'rgba(0,0,0,0.4)',
+ time: game.drawTime
+ });
+ }
+ }
+
+ //orbit player
+ const time = game.cycle * this.orbitalSpeed + this.phase
+ const orbit = {
+ x: Math.cos(time),
+ y: 1.1 * Math.sin(time)
+ }
+ // Matter.Body.setPosition(this, Vector.add(player.position, Vector.mult(orbit, this.range))) //bullets move with player
+ // this.smoothPlayerPosition = Vector.add(Vector.mult(Vector.add(player.position, Vector.mult(player.velocity, 5)), 0.1), Vector.mult(this.smoothPlayerPosition, 0.9))
+ // this.smoothPlayerPosition = Vector.add(Vector.mult(player.position, 0.1), Vector.mult(this.smoothPlayerPosition, 0.9))
+ Matter.Body.setPosition(this, Vector.add(player.position, Vector.mult(orbit, this.range))) //bullets move with player
+ }
+ })
+ bullet[me].orbitalSpeed = Math.sqrt(0.7 / bullet[me].range)
+ World.add(engine.world, bullet[me]); //add bullet to world
+ },
// **************************************************************************************************
// **************************************************************************************************
// ******************************** Guns *********************************************
diff --git a/js/level.js b/js/level.js
index 72feca8..ecde322 100644
--- a/js/level.js
+++ b/js/level.js
@@ -17,7 +17,8 @@ const level = {
// mech.isCloak = true;
// mech.setField("metamaterial cloaking")
// b.giveGuns("laser")
- // mod.giveMod("Bayesian statistics");
+ // mod.giveMod("orbit-bot");
+
level.intro(); //starting level
// level.testing(); //not in rotation
diff --git a/js/mods.js b/js/mods.js
index 6f26819..268162b 100644
--- a/js/mods.js
+++ b/js/mods.js
@@ -98,7 +98,7 @@ const mod = {
return dmg * mod.slowFire * mod.aimDamage
},
totalBots() {
- return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount
+ return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount + mod.orbitBotCount
},
mods: [{
name: "integrated armament",
@@ -640,6 +640,46 @@ const mod = {
}
}
},
+ {
+ name: "orbital-bot",
+ description: "2 bots are locked in orbit around you
damages mobs on contact",
+ maxCount: 9,
+ count: 0,
+ allowed() {
+ return true
+ },
+ requires: "",
+ effect() {
+ mod.orbitBotCount += 2;
+ b.orbitBot();
+ b.orbitBot();
+ },
+ remove() {
+ mod.orbitBotCount = 0;
+ }
+ },
+ {
+ name: "orbit-bot upgrade",
+ description: "125% increased orbital radius
applies to all current and future orbit-bots",
+ maxCount: 1,
+ count: 0,
+ allowed() {
+ return mod.orbitBotCount > 2
+ },
+ requires: "2 or more orbit bots",
+ effect() {
+ mod.isOrbitBotUpgrade = true
+ for (let i = 0; i < bullet.length; i++) {
+ if (bullet[i].botType = 'orbit') bullet[i].isUpgraded = true
+ }
+ },
+ remove() {
+ mod.isOrbitBotUpgrade = false
+ for (let i = 0; i < bullet.length; i++) {
+ if (bullet[i].botType = 'orbit') bullet[i].isUpgraded = false
+ }
+ }
+ },
{
name: "perimeter defense",
description: "reduce harm by 4%
for each of your permanent bots",
@@ -691,6 +731,10 @@ const mod = {
b.plasmaBot();
}
mod.plasmaBotCount *= 2
+ for (let i = 0; i < mod.orbitBotCount; i++) {
+ b.orbitBot();
+ }
+ mod.orbitBotCount *= 2
},
remove() {}
},
@@ -2811,6 +2855,7 @@ const mod = {
foamBotCount: null,
boomBotCount: null,
plasmaBotCount: null,
+ orbitBotCount: null,
collisionImmuneCycles: null,
blockDmg: null,
isPiezo: null,
@@ -2896,6 +2941,7 @@ const mod = {
isFoamBotUpgrade: null,
isLaserBotUpgrade: null,
isBoomBotUpgrade: null,
+ isOrbitBotUpgrade: null,
isDroneGrab: null,
isOneGun: null,
isDamageForGuns: null,
diff --git a/js/player.js b/js/player.js
index 5d9e4f6..b894538 100644
--- a/js/player.js
+++ b/js/player.js
@@ -1368,7 +1368,7 @@ const mech = {
}
} else if (mod.isMissileField) {
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
- mech.energy -= 0.55;
+ mech.energy -= 0.5;
b.missile({
x: mech.pos.x + 40 * Math.cos(mech.angle),
y: mech.pos.y + 40 * Math.sin(mech.angle) - 3
@@ -1382,7 +1382,7 @@ const mech = {
b.iceIX(1)
} else {
// mech.fieldCDcycle = mech.cycle + 10; // set cool down to prevent +energy from making huge numbers of drones
- mech.energy -= 0.3;
+ mech.energy -= 0.33;
b.drone(1)
}
diff --git a/todo.txt b/todo.txt
index d6c71aa..1d154fd 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,8 +1,5 @@
-mod: decorrelation - 2 seconds after you don't use your gun or field get 40% harm reduction
-
-mod: anticorrelation - 2 seconds after you don't use your gun or field get 50% damage
- requires decorrelation
-
+mod: orbital-bot - 2 bots orbit you and damage mobs
+mod: orbital-bot upgrade - orbital bots orbit farther away
************** TODO - n-gon **************
@@ -50,10 +47,7 @@ a bot that eats up health and ammo, but poops a reroll after picking up 2 power
disable crystalized armor?
could convert rerolls, ammo, and health into mods instead
-laser-bot orbits player
-bot that does AOE damage while it rotates around player
- no physics / collisions
- cap 3 ?
+
mod: radiation effects can spread to nearby mobs