mass-energy mod rework

This commit is contained in:
landgreen
2020-02-10 04:42:38 -08:00
parent b6604643db
commit c9dba2ac1c
5 changed files with 38 additions and 23 deletions

View File

@@ -77,7 +77,7 @@ const b = {
b.modSuperBallNumber = 4; b.modSuperBallNumber = 4;
b.modLaserReflections = 2; b.modLaserReflections = 2;
b.isModNoAmmo = false; b.isModNoAmmo = false;
b.isModAmmoFromHealth = false; b.isModAmmoFromHealth = 0;
mech.Fx = 0.015; mech.Fx = 0.015;
mech.jumpForce = 0.38; mech.jumpForce = 0.38;
mech.maxHealth = 1; mech.maxHealth = 1;
@@ -352,7 +352,7 @@ const b = {
}, },
{ {
name: "piezoelectricity", name: "piezoelectricity",
description: "<strong>colliding</strong> with enemies fills your <strong class='color-f'>energy</strong>", description: "<strong>colliding</strong> with enemies charges your <strong class='color-f'>energy</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -366,7 +366,7 @@ const b = {
{ {
name: "energy conservation", name: "energy conservation",
description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done", description: "gain <strong class='color-f'>energy</strong> proportional to <strong class='color-d'>damage</strong> done",
maxCount: 3, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
return true return true
@@ -379,7 +379,7 @@ const b = {
{ {
name: "entropy exchange", name: "entropy exchange",
description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done", description: "<strong class='color-h'>heal</strong> proportional to <strong class='color-d'>damage</strong> done",
maxCount: 3, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
return true return true
@@ -390,7 +390,7 @@ const b = {
}, },
{ {
name: "overcharge", name: "overcharge",
description: "charge <strong class='color-f'>energy</strong> <strong>+50%</strong> beyond your <strong>maximum</strong>", description: "increase your <strong>maximum</strong> <strong class='color-f'>energy</strong> by <strong>+50%</strong>",
maxCount: 9, maxCount: 9,
count: 0, count: 0,
allowed() { allowed() {
@@ -428,7 +428,7 @@ const b = {
}, },
{ {
name: "mass-energy equivalence", name: "mass-energy equivalence",
description: "power ups fill your <strong class='color-f'>energy</strong> and <strong class='color-h'>heal</strong> for <strong>+5%</strong><br><em>applies to guns, ammo, fields, mods, and heals</em>", description: "<strong>power ups</strong> overcharge your <strong class='color-f'>energy</strong><br>temporarily gain <strong>150%</strong> of maximum",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -436,7 +436,7 @@ const b = {
}, },
effect: () => { effect: () => {
b.isModMassEnergy = true // used in mech.grabPowerUp b.isModMassEnergy = true // used in mech.grabPowerUp
mech.fieldMeter = mech.fieldEnergyMax mech.fieldMeter = mech.fieldEnergyMax * 2
} }
}, },
{ {
@@ -465,14 +465,14 @@ const b = {
}, },
{ {
name: "catabolism", name: "catabolism",
description: "when you <strong>fire</strong> while <strong>out</strong> of <strong>ammo</strong><br>convert <strong>5%</strong> health into an <strong>ammo</strong> power up", description: "when you <strong>fire</strong> while <strong>out</strong> of <strong>ammo</strong><br>convert <strong>3%</strong> of current health into <strong>ammo</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
return true return true
}, },
effect: () => { effect: () => {
b.isModAmmoFromHealth = true; b.isModAmmoFromHealth = 0.03;
} }
}, },
{ {
@@ -487,9 +487,11 @@ const b = {
b.isModNoAmmo = true; b.isModNoAmmo = true;
for (let i = 0; i < 6; i++) { // spawn new mods for (let i = 0; i < 6; i++) { // spawn new mods
powerUps.spawn(mech.pos.x, mech.pos.y, "mod"); 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 for (let i = 0; i < 3; i++) { // spawn new mods
powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); 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 { } else {
if (b.isModAmmoFromHealth && mech.health > 0.05) { if (b.isModAmmoFromHealth && mech.health > b.isModAmmoFromHealth) {
mech.damage(0.05); mech.damage(b.isModAmmoFromHealth * mech.health);
powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); 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 mech.fireCDcycle = mech.cycle + 30; //fire cooldown
// game.makeTextLog("<div style='font-size:140%;'>NO AMMO</div><strong class = 'box'>E</strong> / <strong class = 'box'>Q</strong>", 200); // game.makeTextLog("<div style='font-size:140%;'>NO AMMO</div><strong class = 'box'>E</strong> / <strong class = 'box'>Q</strong>", 200);

View File

@@ -2,15 +2,26 @@
/* TODO: ******************************************* /* 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 speed up movement
higher gravity, larger jump force higher gravity, larger jump force
faster horizontal acceleration faster horizontal acceleration
only increase top speed a bit 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 mob: targeting laser, then a high speed, no gravity bullet
add difficulty slider to custom? add difficulty slider to custom?

View File

@@ -16,7 +16,7 @@ const level = {
// level.difficultyIncrease(5) // level.difficultyIncrease(5)
// b.giveGuns("laser") // b.giveGuns("laser")
// mech.setField("phase decoherence field") // mech.setField("phase decoherence field")
// b.giveMod("optimized shell packing"); // b.giveMod("mass-energy equivalence");
level.intro(); //starting level level.intro(); //starting level
// level.testingMap(); // level.testingMap();

View File

@@ -684,9 +684,10 @@ const mech = {
ctx.fillRect(xOff, yOff, range * mech.fieldEnergyMax, 10); ctx.fillRect(xOff, yOff, range * mech.fieldEnergyMax, 10);
ctx.fillStyle = "#0cf"; ctx.fillStyle = "#0cf";
ctx.fillRect(xOff, yOff, range * mech.fieldMeter, 10); ctx.fillRect(xOff, yOff, range * mech.fieldMeter, 10);
} else {
mech.fieldMeter = mech.fieldEnergyMax
} }
// else {
// mech.fieldMeter = mech.fieldEnergyMax
// }
}, },
lookingAt(who) { lookingAt(who) {
//calculate a vector from body to player and make it length 1 //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 (dist2 < 5000) { //use power up if it is close enough
if (b.isModMassEnergy) { if (b.isModMassEnergy) {
mech.fieldMeter = mech.fieldEnergyMax; mech.fieldMeter = mech.fieldEnergyMax * 1.5;
mech.addHealth(0.05); // mech.addHealth(0.01);
} }
Matter.Body.setVelocity(player, { //player knock back, after grabbing power up 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, x: player.velocity.x + ((powerUp[i].velocity.x * powerUp[i].mass) / player.mass) * 0.3,
@@ -1523,7 +1524,7 @@ const mech = {
mech.holding(); mech.holding();
mech.throwBlock(); mech.throwBlock();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { } 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) { if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN; mech.fieldMeter -= DRAIN;

View File

@@ -503,7 +503,7 @@ const spawn = {
ctx.fill(); ctx.fill();
//when player is inside event horizon //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) { if (mech.fieldMeter > 0.1) {
mech.fieldMeter -= 0.005 mech.fieldMeter -= 0.005
} else { } else {
@@ -601,7 +601,7 @@ const spawn = {
ctx.fillStyle = "rgba(0,0,0,0.05)"; ctx.fillStyle = "rgba(0,0,0,0.05)";
ctx.fill(); ctx.fill();
//when player is inside event horizon //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) { if (mech.fieldMeter > 0.1) {
mech.fieldMeter -= 0.0075 mech.fieldMeter -= 0.0075
} else { } else {