From 9c7eed3b296d250096818a98a38bb42908c1a3fe Mon Sep 17 00:00:00 2001 From: landgreen Date: Thu, 12 Mar 2020 06:49:26 -0700 Subject: [PATCH] negative mass field plasma field does 20% more damage, but can no longer block bremsstrahlung radiation only apply to the harmonic field, and does a bit less damage negative mass field moves faster horizontally can't block can hold mroe massive blocks, but can't throw them fast takes 0.5 dmg while active --- js/bullets.js | 32 ++++++++++++++++---------------- js/engine.js | 2 ++ js/mobs.js | 11 +++++------ js/player.js | 43 +++++++++++++++++++++++++++++++------------ js/powerups.js | 8 ++++---- todo.txt | 36 +++++++++++++++++++++--------------- 6 files changed, 79 insertions(+), 53 deletions(-) diff --git a/js/bullets.js b/js/bullets.js index b221dea..2be890f 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -524,22 +524,6 @@ const b = { b.isModPiezo = false; } }, - { - name: "bremsstrahlung radiation", - description: "when your field blocks it also does damage", - maxCount: 9, - count: 0, - allowed() { - return mech.fieldUpgrades[mech.fieldMode].name !== "time dilation field" && mech.fieldUpgrades[mech.fieldMode].name !== "phase decoherence field" && !(b.isModHawking && mech.fieldUpgrades[mech.fieldMode].name === "negative mass field") - }, - requires: "not time dilation field
requires not phase decoherence field", - effect() { - b.modBlockDmg += 0.7 //if you change this value also update the for loop in the electricity graphics in mech.pushMass - }, - remove() { - b.modBlockDmg = 0; - } - }, { name: "energy conservation", description: "gain energy proportional to damage done", @@ -1095,6 +1079,22 @@ const b = { b.isModHawking = 0; } }, + { + name: "bremsstrahlung radiation", + description: "blocking with standing wave harmonics
damages the blocked mob ", + maxCount: 9, + count: 0, + allowed() { + return mech.fieldUpgrades[mech.fieldMode].name === "standing wave harmonics" + }, + requires: "standing wave harmonics", + effect() { + b.modBlockDmg += 0.6 //if you change this value also update the for loop in the electricity graphics in mech.pushMass + }, + remove() { + b.modBlockDmg = 0; + } + }, { name: "frequency resonance", description: "standing wave harmonics shield is retuned
increase size and blocking efficiency by 30%", diff --git a/js/engine.js b/js/engine.js index 37fb3c5..ed7d06c 100644 --- a/js/engine.js +++ b/js/engine.js @@ -205,6 +205,8 @@ function collisionChecks(event) { if (mob[k].isShielded) dmg *= 0.5 mob[k].damage(dmg, true); if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer(); + // mobs.statusStun(mob[k], 120) + game.drawList.push({ //add dmg to draw queue x: pairs[i].activeContacts[0].vertex.x, diff --git a/js/mobs.js b/js/mobs.js index e039bc3..778f838 100644 --- a/js/mobs.js +++ b/js/mobs.js @@ -79,13 +79,13 @@ const mobs = { }) } }, - statusStun(who, cycles = 120) { + statusStun(who, cycles = 180) { if (!who.shield && !who.isShielded) { Matter.Body.setVelocity(who, { - x: who.velocity.x * 0.8, - y: who.velocity.y * 0.8 + x: who.velocity.x * 0.5, + y: who.velocity.y * 0.5 }); - Matter.Body.setAngularVelocity(who, who.angularVelocity * 0.8); + Matter.Body.setAngularVelocity(who, who.angularVelocity * 0.5); //remove other "stun" effects on this mob let i = who.status.length while (i--) { @@ -98,8 +98,7 @@ const mobs = { x: who.position.x + 100 * (Math.random() - 0.5), y: who.position.y + 100 * (Math.random() - 0.5) } - who.force.y += who.mass * 0.001 //extra gravity - + if (who.velocity.y < 2) who.force.y += who.mass * 0.0005 //extra gravity ctx.beginPath(); ctx.moveTo(who.vertices[0].x, who.vertices[0].y); for (let j = 1, len = who.vertices.length; j < len; ++j) { diff --git a/js/player.js b/js/player.js index 3989b27..8fe6786 100644 --- a/js/player.js +++ b/js/player.js @@ -458,6 +458,7 @@ const mech = { defaultFPSCycle: 0, //tracks when to return to normal fps collisionImmuneCycle: 0, //used in engine damage(dmg) { + dmg *= mech.fieldDamageResistance if (b.isModEntanglement && b.inventory[0] === b.activeGun) { for (let i = 0, len = b.inventory.length; i < len; i++) { dmg *= 0.9 @@ -670,6 +671,7 @@ const mech = { fieldRegen: 0, fieldMode: 0, fieldFire: false, + fieldDamageResistance: 1, holdingMassScale: 0, throwChargeRate: 0, throwChargeMax: 0, @@ -682,6 +684,7 @@ const mech = { if (mech.energy < mech.fieldEnergyMax) mech.energy = mech.fieldEnergyMax; mech.fieldRegen = 0.001; mech.fieldShieldingScale = 1; + mech.fieldDamageResistance = 1; mech.fieldFire = false; mech.fieldCDcycle = 0; mech.isStealth = false; @@ -1223,7 +1226,8 @@ const mech = { mech.energy -= DRAIN; mech.grabPowerUp(); mech.lookForPickUp(); - mech.pushMobs360(); + // mech.pushMobs360(); + // mech.pushMobsFacing(); //calculate laser collision let best; @@ -1297,7 +1301,7 @@ const mech = { y: best.y }; if (best.who.alive) { - const dmg = 0.4 * b.dmgScale; //********** SCALE DAMAGE HERE ********************* + const dmg = 0.5 * b.dmgScale; //********** SCALE DAMAGE HERE ********************* best.who.damage(dmg); best.who.locatePlayer(); @@ -1354,10 +1358,10 @@ const mech = { ctx.lineWidth = 2 * Math.random(); ctx.stroke(); //draw shield around player - ctx.beginPath(); - ctx.arc(mech.pos.x, mech.pos.y, mech.fieldRange * 0.75, 0, 2 * Math.PI); - ctx.fillStyle = "rgba(255,0,255,0.05)" - ctx.fill(); + // ctx.beginPath(); + // ctx.arc(mech.pos.x, mech.pos.y, mech.fieldRange * 0.75, 0, 2 * Math.PI); + // ctx.fillStyle = "rgba(255,0,255,0.05)" + // ctx.fill(); // mech.pushBody360(100); //disabled because doesn't work at short range } else { mech.fieldCDcycle = mech.cycle + 120; //if out of energy @@ -1373,16 +1377,17 @@ const mech = { }, { name: "negative mass field", - description: "use energy to nullify   gravity
launch larger blocks at much higher speeds", + description: "use energy to nullify   gravity
and reduce harm by 50%", //
launch larger blocks at much higher speeds fieldDrawRadius: 0, isEasyToAim: true, effect: () => { mech.fieldFire = true; - mech.throwChargeRate = 3; - mech.throwChargeMax = 110; + // mech.throwChargeRate = 3; + // mech.throwChargeMax = 110; mech.holdingMassScale = 0.03; //can hold heavier blocks with lower cost to jumping mech.hold = function () { + mech.fieldDamageResistance = 1; if (mech.isHolding) { mech.drawHold(mech.holdingTarget); mech.holding(); @@ -1390,9 +1395,23 @@ const mech = { } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away const DRAIN = 0.00035 if (mech.energy > DRAIN) { + mech.fieldDamageResistance = 0.5; mech.grabPowerUp(); mech.lookForPickUp(); - mech.pushMobs360(); + // mech.pushMobs360(); + + //repulse mobs + // for (let i = 0, len = mob.length; i < len; ++i) { + // sub = Vector.sub(mob[i].position, mech.pos); + // dist2 = Vector.magnitudeSquared(sub); + // if (dist2 < this.fieldDrawRadius * this.fieldDrawRadius) { + // const force = Vector.mult(Vector.perp(Vector.normalise(sub)), 0.002) + // mob[i].force.x = force.x + // mob[i].force.y = force.y + // } + // } + + //look for nearby objects to make zero-g function zeroG(who, range, mag = 1.06) { for (let i = 0, len = who.length; i < len; ++i) { @@ -1428,7 +1447,7 @@ const mech = { //add extra friction for horizontal motion if (keys[65] || keys[68] || keys[37] || keys[39]) { Matter.Body.setVelocity(player, { - x: player.velocity.x * 0.95, + x: player.velocity.x * 0.99, y: player.velocity.y * 0.97 }); } else { //slow rise and fall @@ -1447,7 +1466,7 @@ const mech = { if (b.isModHawking) { for (let i = 0, len = mob.length; i < len; i++) { if (mob[i].distanceToPlayer2() < this.fieldDrawRadius * this.fieldDrawRadius && Matter.Query.ray(map, mech.pos, mob[i].position).length === 0 && Matter.Query.ray(body, mech.pos, mob[i].position).length === 0) { - mob[i].damage(b.dmgScale * 0.08); + mob[i].damage(b.dmgScale * 0.085); mob[i].locatePlayer(); //draw electricity diff --git a/js/powerups.js b/js/powerups.js index 6f2f6b4..e88ef86 100644 --- a/js/powerups.js +++ b/js/powerups.js @@ -236,12 +236,12 @@ const powerUps = { if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "gun"); return; } - if (Math.random() < 0.0027 * (14 - b.modCount)) { //a new mod has a low chance for each not acquired mod up to 15 + if (Math.random() < 0.0027 * (15 - b.modCount)) { //a new mod has a low chance for each not acquired mod up to 15 powerUps.spawn(x, y, "mod"); if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "mod"); return; } - if (Math.random() < 0.003) { + if (Math.random() < 0.002) { powerUps.spawn(x, y, "field"); if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "field"); return; @@ -251,13 +251,13 @@ const powerUps = { if (mech.fieldMode === 0) { powerUps.spawn(x, y, "field") if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "field") - } else if (Math.random() < 0.80) { + } else if (Math.random() < 0.85) { powerUps.spawn(x, y, "mod") if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "mod") } else if (Math.random() < 0.35) { powerUps.spawn(x, y, "gun") if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "gun") - } else if (Math.random() < 0.65) { + } else if (Math.random() < 0.5) { powerUps.spawn(x, y, "field"); if (Math.random() < b.isModBayesian) powerUps.spawn(x, y, "field"); } else if (mech.health < 0.7) { diff --git a/todo.txt b/todo.txt index d647adb..eec3523 100644 --- a/todo.txt +++ b/todo.txt @@ -1,26 +1,20 @@ ************** TODO - n-gon ************** +bug - mech.fieldShieldingScale doesn't reset when switching fields + +negative mass field needs a buff + no longer blocks, but the player takes 50% less damage from all sources while the field is active + allow player to hold larger block, but give throwing blocks at high speed for no energy to a mob + +mod - blocks stun mobs +mod - throwing blocks at full power converts the block into nails + would this cause problems for block based puzzles? mod or field - turn blocks into spores or drones mod - robot that attack nearby mobs, and delivers a stun status effect use laser bot code for the attack large and 5 sided? -consider using the "e" key for picking up blocks and just q for gun swaps - good for: plasma torch, time dilation, negative mass - bad for: basic, nano-scale, harmonic - -mod - status effects last 1 second longer - wait until you have more status effects written - -mod - time dilation - Quantum Recovery - Expending all your energy while using the field will - cause the player to go back in time to 3 seconds before the field was activated - resets ammo?, health, position, velocity - need to track player info in game.checks() in an array - put the array in the time field object - cause the player to go back in time when the field was first activated (easier then going back to 3 seconds before) - bug - getting stuck in crouch mode press T to see it visually happened twice to me so far @@ -86,6 +80,18 @@ atmosphere levels: change the pace, give the user a rest between combat mob: targeting laser, then a high speed, no gravity bullet +mod - status effects last 1 second longer + wait until you have more status effects written + +mod - time dilation - Quantum Recovery + Expending all your energy while using the field will + cause the player to go back in time to 3 seconds before the field was activated + resets ammo?, health, position, velocity + need to track player info in game.checks() in an array + put the array in the time field object + cause the player to go back in time when the field was first activated (easier then going back to 3 seconds before) + + css transition for pause menu field that pushes everything back, and can destroy smaller blocks