bug fixes, orbital 1 not 2

mod: orbital-bot - back to just 1 bot, but the bot can stun and hit mobs from a larger range
This commit is contained in:
landgreen
2020-09-30 06:07:17 -07:00
parent 75d2f56390
commit 0a15a7748a
5 changed files with 55 additions and 48 deletions

View File

@@ -1021,11 +1021,9 @@ const b = {
} }
}, },
randomBot(where = mech.pos, isKeep = true) { randomBot(where = mech.pos, isKeep = true) {
if (isKeep && Math.random() < 0.2) { if (Math.random() < 0.2) {
for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) { b.orbitBot();
b.orbitBot(); if (isKeep) mod.orbitBotCount++;
mod.orbitBotCount++;
}
} else if (Math.random() < 0.25) { } else if (Math.random() < 0.25) {
b.nailBot(where) b.nailBot(where)
if (isKeep) mod.nailBotCount++; if (isKeep) mod.nailBotCount++;
@@ -1521,12 +1519,14 @@ const b = {
}, },
orbitBot(position = mech.pos) { orbitBot(position = mech.pos) {
const me = bullet.length; const me = bullet.length;
bullet[me] = Bodies.polygon(position.x, position.y, 9, 7, { bullet[me] = Bodies.polygon(position.x, position.y, 9, 12, {
isUpgraded: mod.isOrbitBotUpgrade, isUpgraded: mod.isOrbitBotUpgrade,
botType: "orbit", botType: "orbit",
friction: 0, friction: 0,
frictionStatic: 0, frictionStatic: 0,
frictionAir: 0, frictionAir: 1,
isStatic: true,
isSensor: true,
restitution: 0, restitution: 0,
dmg: 0, // 0.14 //damage done in addition to the damage from momentum dmg: 0, // 0.14 //damage done in addition to the damage from momentum
minDmgSpeed: 0, minDmgSpeed: 0,
@@ -1544,9 +1544,24 @@ const b = {
do() { do() {
//check for damage //check for damage
if (!mech.isCloak && !mech.isBodiesAsleep) { //if time dilation isn't active if (!mech.isCloak && !mech.isBodiesAsleep) { //if time dilation isn't active
q = Matter.Query.point(mob, this.position)
// q = Matter.Query.point(mob, this.position)
// q = Matter.Query.collides(this, mob)
const size = 30
q = Matter.Query.region(mob, {
min: {
x: this.position.x - size,
y: this.position.y - size
},
max: {
x: this.position.x + size,
y: this.position.y + size
}
})
for (let i = 0; i < q.length; i++) { for (let i = 0; i < q.length; i++) {
let dmg = 2.5 * b.dmgScale mobs.statusStun(q[i], this.isUpgraded ? 240 : 120)
const dmg = 1 * b.dmgScale * (this.isUpgraded ? 2.25 : 1)
q[i].damage(dmg); q[i].damage(dmg);
q[i].foundPlayer(); q[i].foundPlayer();
game.drawList.push({ //add dmg to draw queue game.drawList.push({ //add dmg to draw queue

View File

@@ -17,9 +17,9 @@ const level = {
// mech.isCloak = true; // mech.isCloak = true;
// mech.setField("metamaterial cloaking") // mech.setField("metamaterial cloaking")
// b.giveGuns("laser") // b.giveGuns("laser")
// for (let i = 0; i < 10; i++) { for (let i = 0; i < 1; i++) {
// mod.giveMod("orbital-bot"); mod.giveMod("orbital-bot");
// } }
// mod.giveMod("orbit-bot upgrade") // mod.giveMod("orbit-bot upgrade")

View File

@@ -98,7 +98,7 @@ const mod = {
return dmg * mod.slowFire * mod.aimDamage return dmg * mod.slowFire * mod.aimDamage
}, },
totalBots() { totalBots() {
return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount + Math.floor(mod.orbitBotCount / (2 + mod.isOrbitBotUpgrade)) return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount + mod.orbitBotCount
}, },
mods: [{ mods: [{
name: "integrated armament", name: "integrated armament",
@@ -513,13 +513,13 @@ const mod = {
effect() { effect() {
mod.isNailBotUpgrade = true mod.isNailBotUpgrade = true
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'nail') bullet[i].isUpgraded = true if (bullet[i].botType === 'nail') bullet[i].isUpgraded = true
} }
}, },
remove() { remove() {
mod.isNailBotUpgrade = false mod.isNailBotUpgrade = false
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'nail') bullet[i].isUpgraded = false if (bullet[i].botType === 'nail') bullet[i].isUpgraded = false
} }
} }
}, },
@@ -552,13 +552,13 @@ const mod = {
effect() { effect() {
mod.isFoamBotUpgrade = true mod.isFoamBotUpgrade = true
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'foam') bullet[i].isUpgraded = true if (bullet[i].botType === 'foam') bullet[i].isUpgraded = true
} }
}, },
remove() { remove() {
mod.isFoamBotUpgrade = false mod.isFoamBotUpgrade = false
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'foam') bullet[i].isUpgraded = false if (bullet[i].botType === 'foam') bullet[i].isUpgraded = false
} }
} }
}, },
@@ -591,13 +591,13 @@ const mod = {
effect() { effect() {
mod.isBoomBotUpgrade = true mod.isBoomBotUpgrade = true
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'boom') bullet[i].isUpgraded = true if (bullet[i].botType === 'boom') bullet[i].isUpgraded = true
} }
}, },
remove() { remove() {
mod.isBoomBotUpgrade = false mod.isBoomBotUpgrade = false
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'boom') bullet[i].isUpgraded = false if (bullet[i].botType === 'boom') bullet[i].isUpgraded = false
} }
} }
}, },
@@ -630,19 +630,19 @@ const mod = {
effect() { effect() {
mod.isLaserBotUpgrade = true mod.isLaserBotUpgrade = true
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'laser') bullet[i].isUpgraded = true if (bullet[i].botType === 'laser') bullet[i].isUpgraded = true
} }
}, },
remove() { remove() {
mod.isLaserBotUpgrade = false mod.isLaserBotUpgrade = false
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType = 'laser') bullet[i].isUpgraded = false if (bullet[i].botType === 'laser') bullet[i].isUpgraded = false
} }
} }
}, },
{ {
name: "orbital-bot", name: "orbital-bot",
description: "<strong>2</strong> bots are locked in <strong>orbit</strong> around you<br><strong class='color-d'>damages</strong> mobs on <strong>contact</strong>", description: "a bot is locked in <strong>orbit</strong> around you<br><strong class='color-d'>damages</strong> and <strong>stuns</strong> mobs on <strong>contact</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -650,36 +650,26 @@ const mod = {
}, },
requires: "", requires: "",
effect() { effect() {
for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) { b.orbitBot();
b.orbitBot(); mod.orbitBotCount++;
mod.orbitBotCount++;
}
}, },
remove() { remove() {
mod.orbitBotCount = 0; mod.orbitBotCount = 0;
} }
}, },
{ {
name: "orbit-bot upgrade", name: "orbital-bot upgrade",
description: "get 3 orbital-bots instead of 2<br><em>applies to all current and future orbit-bots</em>", description: "<strong>125%</strong> increased <strong class='color-d'>damage</strong> and <strong>stun</strong> duration<br><em>applies to all current and future orbit-bots</em>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return mod.orbitBotCount > 2 return mod.orbitBotCount > 1
}, },
requires: "2 or more orbital bots", requires: "2 or more orbital bots",
effect() { effect() {
mod.isOrbitBotUpgrade = true mod.isOrbitBotUpgrade = true
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'orbit') { if (bullet[i].botType === 'orbit') bullet[i].isUpgraded = true
bullet[i].isUpgraded = mod.isOrbitBotUpgrade
bullet[i].range = 190 + 50 * mod.isOrbitBotUpgrade
bullet[i].orbitalSpeed = Math.sqrt(0.25 / bullet[i].range)
}
}
for (let i = 0, len = Math.floor(mod.orbitBotCount / 2); i < len; i++) {
b.orbitBot();
} }
}, },

View File

@@ -509,9 +509,9 @@ const mech = {
if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage
if (mod.isDeathAvoid && powerUps.reroll.rerolls) { if (mod.isDeathAvoid && powerUps.reroll.rerolls) {
powerUps.reroll.changeRerolls(-1) powerUps.reroll.changeRerolls(-1)
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
mech.energy = mech.maxEnergy mech.energy = mech.maxEnergy
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1/${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> consumed</span>`, 420)
game.wipe = function () { //set wipe to have trails game.wipe = function () { //set wipe to have trails
ctx.fillStyle = "rgba(255,255,255,0.03)"; ctx.fillStyle = "rgba(255,255,255,0.03)";
ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -537,12 +537,11 @@ const mech = {
if (mod.isDeathAvoid && powerUps.reroll.rerolls > 0) { //&& Math.random() < 0.5 if (mod.isDeathAvoid && powerUps.reroll.rerolls > 0) { //&& Math.random() < 0.5
mech.health = 0.05 mech.health = 0.05
powerUps.reroll.changeRerolls(-1) powerUps.reroll.changeRerolls(-1)
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> left</span>`, 420)
for (let i = 0; i < 4; i++) { for (let i = 0; i < 4; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false); powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false);
} }
mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds
game.makeTextLog(`<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1/${powerUps.reroll.rerolls}</strong> <strong class='color-r'>rerolls</strong> consumed</span>`, 420)
// game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420) // game.makeTextLog("<span style='font-size:115%;'> <strong>death</strong> avoided<br><strong>1</strong> <strong class='color-r'>reroll</strong> consumed</span>", 420)
game.wipe = function () { //set wipe to have trails game.wipe = function () { //set wipe to have trails
@@ -845,7 +844,7 @@ const mech = {
} }
}, },
holding() { holding() {
if (mech.fireCDcycle < mech.cycle) mech.fireCDcycle = mech.cycle if (mech.fireCDcycle < mech.cycle) mech.fireCDcycle = mech.cycle - 1
if (mech.holdingTarget) { if (mech.holdingTarget) {
mech.energy -= mech.fieldRegen; mech.energy -= mech.fieldRegen;
if (mech.energy < 0) mech.energy = 0; if (mech.energy < 0) mech.energy = 0;
@@ -976,7 +975,7 @@ const mech = {
ctx.stroke(); ctx.stroke();
}, },
grabPowerUp() { //look for power ups to grab with field grabPowerUp() { //look for power ups to grab with field
if (mech.fireCDcycle < mech.cycle) mech.fireCDcycle = mech.cycle if (mech.fireCDcycle < mech.cycle) mech.fireCDcycle = mech.cycle - 1
for (let i = 0, len = powerUp.length; i < len; ++i) { for (let i = 0, len = powerUp.length; i < len; ++i) {
const dxP = mech.pos.x - powerUp[i].position.x; const dxP = mech.pos.x - powerUp[i].position.x;
const dyP = mech.pos.y - powerUp[i].position.y; const dyP = mech.pos.y - powerUp[i].position.y;
@@ -1807,7 +1806,7 @@ const mech = {
mech.isCloak = true //enter cloak mech.isCloak = true //enter cloak
if (mod.isIntangible) { if (mod.isIntangible) {
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType) bullet[i].collisionFilter.mask = cat.map | cat.bullet | cat.mobBullet | cat.mobShield if (bullet[i].botType && bullet[i].botType !== "orbit") bullet[i].collisionFilter.mask = cat.map | cat.bullet | cat.mobBullet | cat.mobShield
} }
} }
} }
@@ -1815,7 +1814,7 @@ const mech = {
mech.isCloak = false mech.isCloak = false
if (mod.isIntangible) { if (mod.isIntangible) {
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType) bullet[i].collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield if (bullet[i].botType && bullet[i].botType !== "orbit") bullet[i].collisionFilter.mask = cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet | cat.mobShield
} }
} }
if (mod.isCloakStun) { //stun nearby mobs after exiting cloak if (mod.isCloakStun) { //stun nearby mobs after exiting cloak

View File

@@ -1,9 +1,12 @@
mod: orbital-bot - 2 bots orbit you and damage mobs mod: orbital-bot - back to just 1 bot, but the bot can stun and hit mobs from a larger range
mod: orbital-bot upgrade - orbital bots orbit farther away
************** TODO - n-gon ************** ************** TODO - n-gon **************
mob: springer has a constraint issue, not pulling it Ψ(t) collapse doesn't seem to work properly on custom links
mod: take less harm if you are moving fast
require squirrel cage rotor
mod: laser gets increased damage with each reflection mod: laser gets increased damage with each reflection
mod: laser is 3 thick beams that look like one, but can separate into three at corners mod: laser is 3 thick beams that look like one, but can separate into three at corners