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) {
if (isKeep && Math.random() < 0.2) {
for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) {
b.orbitBot();
mod.orbitBotCount++;
}
if (Math.random() < 0.2) {
b.orbitBot();
if (isKeep) mod.orbitBotCount++;
} else if (Math.random() < 0.25) {
b.nailBot(where)
if (isKeep) mod.nailBotCount++;
@@ -1521,12 +1519,14 @@ const b = {
},
orbitBot(position = mech.pos) {
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,
botType: "orbit",
friction: 0,
frictionStatic: 0,
frictionAir: 0,
frictionAir: 1,
isStatic: true,
isSensor: true,
restitution: 0,
dmg: 0, // 0.14 //damage done in addition to the damage from momentum
minDmgSpeed: 0,
@@ -1544,9 +1544,24 @@ const b = {
do() {
//check for damage
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++) {
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].foundPlayer();
game.drawList.push({ //add dmg to draw queue

View File

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

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 + Math.floor(mod.orbitBotCount / (2 + mod.isOrbitBotUpgrade))
return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount + mod.boomBotCount + mod.plasmaBotCount + mod.orbitBotCount
},
mods: [{
name: "integrated armament",
@@ -513,13 +513,13 @@ const mod = {
effect() {
mod.isNailBotUpgrade = true
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() {
mod.isNailBotUpgrade = false
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() {
mod.isFoamBotUpgrade = true
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() {
mod.isFoamBotUpgrade = false
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() {
mod.isBoomBotUpgrade = true
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() {
mod.isBoomBotUpgrade = false
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() {
mod.isLaserBotUpgrade = true
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() {
mod.isLaserBotUpgrade = false
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",
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,
count: 0,
allowed() {
@@ -650,36 +650,26 @@ const mod = {
},
requires: "",
effect() {
for (let i = 0; i < 2 + mod.isOrbitBotUpgrade; i++) {
b.orbitBot();
mod.orbitBotCount++;
}
b.orbitBot();
mod.orbitBotCount++;
},
remove() {
mod.orbitBotCount = 0;
}
},
{
name: "orbit-bot upgrade",
description: "get 3 orbital-bots instead of 2<br><em>applies to all current and future orbit-bots</em>",
name: "orbital-bot upgrade",
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,
count: 0,
allowed() {
return mod.orbitBotCount > 2
return mod.orbitBotCount > 1
},
requires: "2 or more orbital bots",
effect() {
mod.isOrbitBotUpgrade = true
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].botType === 'orbit') {
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();
if (bullet[i].botType === 'orbit') bullet[i].isUpgraded = true
}
},

View File

@@ -509,9 +509,9 @@ const mech = {
if (mech.energy < 0 || isNaN(mech.energy)) { //taking deadly damage
if (mod.isDeathAvoid && powerUps.reroll.rerolls) {
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.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
ctx.fillStyle = "rgba(255,255,255,0.03)";
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
mech.health = 0.05
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++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", false);
}
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.wipe = function () { //set wipe to have trails
@@ -845,7 +844,7 @@ const mech = {
}
},
holding() {
if (mech.fireCDcycle < mech.cycle) mech.fireCDcycle = mech.cycle
if (mech.fireCDcycle < mech.cycle) mech.fireCDcycle = mech.cycle - 1
if (mech.holdingTarget) {
mech.energy -= mech.fieldRegen;
if (mech.energy < 0) mech.energy = 0;
@@ -976,7 +975,7 @@ const mech = {
ctx.stroke();
},
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) {
const dxP = mech.pos.x - powerUp[i].position.x;
const dyP = mech.pos.y - powerUp[i].position.y;
@@ -1807,7 +1806,7 @@ const mech = {
mech.isCloak = true //enter cloak
if (mod.isIntangible) {
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
if (mod.isIntangible) {
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

View File

@@ -1,9 +1,12 @@
mod: orbital-bot - 2 bots orbit you and damage mobs
mod: orbital-bot upgrade - orbital bots orbit farther away
mod: orbital-bot - back to just 1 bot, but the bot can stun and hit mobs from a larger range
************** 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 is 3 thick beams that look like one, but can separate into three at corners