From c9dba2ac1c68f14f77a0678025ab2a55889dd4b7 Mon Sep 17 00:00:00 2001 From: landgreen Date: Mon, 10 Feb 2020 04:42:38 -0800 Subject: [PATCH] mass-energy mod rework --- js/bullets.js | 25 ++++++++++++++----------- js/index.js | 19 +++++++++++++++---- js/level.js | 2 +- js/player.js | 11 ++++++----- js/spawn.js | 4 ++-- 5 files changed, 38 insertions(+), 23 deletions(-) diff --git a/js/bullets.js b/js/bullets.js index 1ca0023..9e2c552 100644 --- a/js/bullets.js +++ b/js/bullets.js @@ -77,7 +77,7 @@ const b = { b.modSuperBallNumber = 4; b.modLaserReflections = 2; b.isModNoAmmo = false; - b.isModAmmoFromHealth = false; + b.isModAmmoFromHealth = 0; mech.Fx = 0.015; mech.jumpForce = 0.38; mech.maxHealth = 1; @@ -352,7 +352,7 @@ const b = { }, { name: "piezoelectricity", - description: "colliding with enemies fills your energy", + description: "colliding with enemies charges your energy", maxCount: 1, count: 0, allowed() { @@ -366,7 +366,7 @@ const b = { { name: "energy conservation", description: "gain energy proportional to damage done", - maxCount: 3, + maxCount: 9, count: 0, allowed() { return true @@ -379,7 +379,7 @@ const b = { { name: "entropy exchange", description: "heal proportional to damage done", - maxCount: 3, + maxCount: 9, count: 0, allowed() { return true @@ -390,7 +390,7 @@ const b = { }, { name: "overcharge", - description: "charge energy +50% beyond your maximum", + description: "increase your maximum energy by +50%", maxCount: 9, count: 0, allowed() { @@ -428,7 +428,7 @@ const b = { }, { name: "mass-energy equivalence", - description: "power ups fill your energy and heal for +5%
applies to guns, ammo, fields, mods, and heals", + description: "power ups overcharge your energy
temporarily gain 150% of maximum", maxCount: 1, count: 0, allowed() { @@ -436,7 +436,7 @@ const b = { }, effect: () => { b.isModMassEnergy = true // used in mech.grabPowerUp - mech.fieldMeter = mech.fieldEnergyMax + mech.fieldMeter = mech.fieldEnergyMax * 2 } }, { @@ -465,14 +465,14 @@ const b = { }, { name: "catabolism", - description: "when you fire while out of ammo
convert 5% health into an ammo power up", + description: "when you fire while out of ammo
convert 3% of current health into ammo", maxCount: 1, count: 0, allowed() { return true }, effect: () => { - b.isModAmmoFromHealth = true; + b.isModAmmoFromHealth = 0.03; } }, { @@ -487,9 +487,11 @@ const b = { b.isModNoAmmo = true; for (let i = 0; i < 6; i++) { // spawn new mods powerUps.spawn(mech.pos.x, mech.pos.y, "mod"); + if (Math.random() < b.isModBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "mod"); } for (let i = 0; i < 3; i++) { // spawn new mods powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); + if (Math.random() < b.isModBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); } } }, @@ -635,9 +637,10 @@ const b = { } } else { - if (b.isModAmmoFromHealth && mech.health > 0.05) { - mech.damage(0.05); + if (b.isModAmmoFromHealth && mech.health > b.isModAmmoFromHealth) { + mech.damage(b.isModAmmoFromHealth * mech.health); powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); + if (Math.random() < b.isModBayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); } mech.fireCDcycle = mech.cycle + 30; //fire cooldown // game.makeTextLog("
NO AMMO
E / Q", 200); diff --git a/js/index.js b/js/index.js index a4bb59c..5fbe33e 100644 --- a/js/index.js +++ b/js/index.js @@ -2,15 +2,26 @@ /* TODO: ******************************************* ***************************************************** +mod: flechettes - each burst fires an extra flechette +mod: flechettes - stick into mobs and do poison damage, like foam + +mod: foam - does extra poison dmg (to get past shields) + +mod: vacuum bomb - does a constant suck + +mod: shield harmonics - large field radius + +mod: shotgun - fire extra shot + but also increase spread? + +mod: wave beam - speed up the wave beam and reduce the wave amplitude to improve targeting at range + + speed up movement higher gravity, larger jump force faster horizontal acceleration only increase top speed a bit -mod: if you fire when out of ammo you gain 1 ammo pack at the cost of - 10% max health - 20% of your current health - mob: targeting laser, then a high speed, no gravity bullet add difficulty slider to custom? diff --git a/js/level.js b/js/level.js index ef9684b..e38ddc6 100644 --- a/js/level.js +++ b/js/level.js @@ -16,7 +16,7 @@ const level = { // level.difficultyIncrease(5) // b.giveGuns("laser") // mech.setField("phase decoherence field") - // b.giveMod("optimized shell packing"); + // b.giveMod("mass-energy equivalence"); level.intro(); //starting level // level.testingMap(); diff --git a/js/player.js b/js/player.js index 7e159df..b84b4e8 100644 --- a/js/player.js +++ b/js/player.js @@ -684,9 +684,10 @@ const mech = { ctx.fillRect(xOff, yOff, range * mech.fieldEnergyMax, 10); ctx.fillStyle = "#0cf"; ctx.fillRect(xOff, yOff, range * mech.fieldMeter, 10); - } else { - mech.fieldMeter = mech.fieldEnergyMax } + // else { + // mech.fieldMeter = mech.fieldEnergyMax + // } }, lookingAt(who) { //calculate a vector from body to player and make it length 1 @@ -891,8 +892,8 @@ const mech = { }); if (dist2 < 5000) { //use power up if it is close enough if (b.isModMassEnergy) { - mech.fieldMeter = mech.fieldEnergyMax; - mech.addHealth(0.05); + mech.fieldMeter = mech.fieldEnergyMax * 1.5; + // mech.addHealth(0.01); } Matter.Body.setVelocity(player, { //player knock back, after grabbing power up x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.3, @@ -1523,7 +1524,7 @@ const mech = { mech.holding(); mech.throwBlock(); } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { - const DRAIN = 0.0002 + 0.00027 * player.speed + const DRAIN = 0.00015 + 0.00027 * player.speed if (mech.fieldMeter > DRAIN) { mech.fieldMeter -= DRAIN; diff --git a/js/spawn.js b/js/spawn.js index 321fa7f..4506b8b 100644 --- a/js/spawn.js +++ b/js/spawn.js @@ -503,7 +503,7 @@ const spawn = { ctx.fill(); //when player is inside event horizon - if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon && !mech.isStealth) { + if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) { if (mech.fieldMeter > 0.1) { mech.fieldMeter -= 0.005 } else { @@ -601,7 +601,7 @@ const spawn = { ctx.fillStyle = "rgba(0,0,0,0.05)"; ctx.fill(); //when player is inside event horizon - if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon && !mech.isStealth) { + if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) { if (mech.fieldMeter > 0.1) { mech.fieldMeter -= 0.0075 } else {