From 0a15a7748ab96de5cc9e9745d5a1d00241b628e2 Mon Sep 17 00:00:00 2001 From: landgreen Date: Wed, 30 Sep 2020 06:07:17 -0700 Subject: [PATCH] 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 --- js/bullet.js | 33 ++++++++++++++++++++++++--------- js/level.js | 6 +++--- js/mods.js | 42 ++++++++++++++++-------------------------- js/player.js | 13 ++++++------- todo.txt | 9 ++++++--- 5 files changed, 55 insertions(+), 48 deletions(-) diff --git a/js/bullet.js b/js/bullet.js index 83974cf..d800ea7 100644 --- a/js/bullet.js +++ b/js/bullet.js @@ -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 diff --git a/js/level.js b/js/level.js index 4bcea64..2a23551 100644 --- a/js/level.js +++ b/js/level.js @@ -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") diff --git a/js/mods.js b/js/mods.js index 544692c..b717156 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 + 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: "2 bots are locked in orbit around you
damages mobs on contact", + description: "a bot is locked in orbit around you
damages and stuns mobs on contact", 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
applies to all current and future orbit-bots", + name: "orbital-bot upgrade", + description: "125% increased damage and stun duration
applies to all current and future orbit-bots", 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 } }, diff --git a/js/player.js b/js/player.js index 0599761..1cb6116 100644 --- a/js/player.js +++ b/js/player.js @@ -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(` death avoided
${powerUps.reroll.rerolls} rerolls left
`, 420) mech.energy = mech.maxEnergy mech.immuneCycle = mech.cycle + 120 //disable this.immuneCycle bonus seconds - game.makeTextLog(` death avoided
1/${powerUps.reroll.rerolls} rerolls consumed
`, 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(` death avoided
${powerUps.reroll.rerolls} rerolls left
`, 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(` death avoided
1/${powerUps.reroll.rerolls} rerolls consumed
`, 420) // game.makeTextLog(" death avoided
1 reroll consumed
", 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 diff --git a/todo.txt b/todo.txt index f3ba67b..8fab3b6 100644 --- a/todo.txt +++ b/todo.txt @@ -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