orbital bot

mod: orbital-bot - 2 bots orbit you and damage mobs
mod: orbital-bot upgrade - orbital bots orbit farther away
This commit is contained in:
landgreen
2020-09-28 08:04:37 -07:00
parent bc3ddf7447
commit 4e6d4c15db
5 changed files with 119 additions and 14 deletions

View File

@@ -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 *********************************************

View File

@@ -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

View File

@@ -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 <strong>orbit</strong> around you<br><strong class='color-d'>damages</strong> mobs on <strong>contact</strong>",
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: "<strong>125%</strong> increased orbital radius <br><em>applies to all current and future orbit-bots</em>",
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 <strong class='color-harm'>harm</strong> by <strong>4%</strong><br>for each of your permanent <strong>bots</strong>",
@@ -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,

View File

@@ -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)
}