general balance (also removed some unused files)

This commit is contained in:
landgreen
2019-09-22 18:55:52 -07:00
parent 8aa9189049
commit 47feed19e5
35 changed files with 172 additions and 3865 deletions

View File

@@ -796,6 +796,7 @@ const mech = {
fieldUpgrades: [
() => {
mech.fieldMode = 0;
game.makeTextLog("<strong style='font-size:30px;'>Field Emitter</strong><br> (right click or spacebar)<p>lets you pick up and throw objects<br>shields you from damage</p>", 1200);
mech.setHoldDefaults();
mech.hold = function () {
if (mech.isHolding) {
@@ -817,7 +818,7 @@ const mech = {
},
() => {
mech.fieldMode = 1;
game.makeTextLog("<strong style='font-size:30px;'>Time Dilation Field</strong><br> (right mouse or space bar)<p> field emitter slows objects in range</p>", 1000);
game.makeTextLog("<strong style='font-size:30px;'>Time Dilation Field</strong><br> (right mouse or space bar)<p> field slows objects in range<br> field does <span style='color:#a00;'>not</span> shield player</p>", 1200);
mech.setHoldDefaults();
mech.fieldArc = 1; //field covers full 360 degrees
mech.calculateFieldThreshold();
@@ -859,6 +860,7 @@ const mech = {
slow(mob);
slow(body);
slow(bullet);
slow(powerUp);
} else {
mech.fieldCDcycle = game.cycle + 120;
}
@@ -872,7 +874,7 @@ const mech = {
},
() => {
mech.fieldMode = 2;
game.makeTextLog("<strong style='font-size:30px;'>Kinetic Energy Field</strong><br> (right mouse or space bar)<p> field emitter does damage on contact<br> blocks are thrown at a higher velocity</p>", 1000);
game.makeTextLog("<strong style='font-size:30px;'>Kinetic Energy Field</strong><br> (right mouse or space bar)<p> field does damage on contact<br> blocks are thrown at a higher velocity</p>", 1200);
mech.setHoldDefaults();
//throw quicker and harder
mech.throwChargeRate = 3; //0.5
@@ -922,10 +924,12 @@ const mech = {
},
() => {
mech.fieldMode = 3;
game.makeTextLog("<strong style='font-size:30px;'>Negative Mass Field</strong><br> (right mouse or space bar)<p> field emitter nullifies gravity around player<br> field emitter holds more massive objects</p>", 1000);
game.makeTextLog("<strong style='font-size:30px;'>Negative Mass Field</strong><br> (right mouse or space bar)<p> nullifies gravity around player<br> can hold more massive objects<br> field does <span style='color:#a00;'>not</span> shield player</p>", 1200);
mech.setHoldDefaults();
mech.holdingMassScale = 0.05; //can hold heavier blocks
mech.fieldArc = 1; //field covers full 360 degrees
// mech.fieldArc = 1; //field covers full 360 degrees
mech.grabRange = 150;
mech.fieldArc = 0.1;
mech.calculateFieldThreshold();
mech.hold = function () {
@@ -969,6 +973,9 @@ const mech = {
ctx.fill();
ctx.globalCompositeOperation = "source-over";
mech.drawField();
mech.pushMobs();
} else {
//trigger cool down
mech.fieldCDcycle = game.cycle + 120;
@@ -983,7 +990,7 @@ const mech = {
},
() => {
mech.fieldMode = 4;
game.makeTextLog("<strong style='font-size:30px;'>Zero-Point Energy Field</strong><br> (right mouse or space bar) <p>improved energy regeneration<br> field emitter surrounds player</p>", 1000);
game.makeTextLog("<strong style='font-size:30px;'>Zero-Point Energy Field</strong><br> (right mouse or space bar) <p>improved energy regeneration<br> field emitter shield surrounds player</p>", 1200);
mech.setHoldDefaults();
mech.fieldRegen = 0.01; //0.0015
mech.fieldArc = 1; //field covers full 360 degrees
@@ -1011,14 +1018,14 @@ const mech = {
},
() => {
mech.fieldMode = 5;
game.makeTextLog("<strong style='font-size:30px;'>Nano-Scale Manufacturing</strong><br> (passive effect) <p>when energy is full, build a drone using 20 energy</p>", 1000);
game.makeTextLog("<strong style='font-size:30px;'>Nano-Scale Manufacturing</strong><br> (passive effect) <p>excess field energy builds drones<br> field does <span style='color:#a00;'>not</span> shield player</p>", 1200);
mech.setHoldDefaults();
mech.grabRange = 160;
mech.fieldArc = 0.11;
mech.fieldArc = 0.11; //0.2 is normal
// mech.fieldRegen = 0.0008 //0.0015;
mech.hold = function () {
if (mech.fieldMeter === 1) {
mech.fieldMeter -= 0.2;
mech.fieldMeter -= 0.21;
b.guns[12].fire() //spawn drone
}
@@ -1027,9 +1034,7 @@ const mech = {
mech.holding();
mech.throw();
} else if ((keys[32] || game.mouseDownRight && mech.fieldMeter > 0.1)) { //not hold but field button is pressed
// mech.drawField();
//draw field
const range = this.grabRange - 20;
ctx.beginPath();
ctx.arc(this.pos.x, this.pos.y, range, this.angle - Math.PI * this.fieldArc, this.angle + Math.PI * this.fieldArc, false);
@@ -1055,9 +1060,10 @@ const mech = {
},
() => {
mech.fieldMode = 6;
game.makeTextLog("<strong style='font-size:30px;'>Metamaterial Refractive Optics</strong><br> (right mouse or space bar) <p>localized invisibility field</p>", 1000);
game.makeTextLog("<strong style='font-size:30px;'>Metamaterial Refractive Optics</strong><br> (right mouse or space bar) <p>localized invisibility field</p>", 1200);
mech.setHoldDefaults();
// mech.grabRange = 100;
mech.grabRange = 200;
mech.fieldArc = 0.1; //0.2 is normal
// mech.fieldArc = 1; //field covers full 360 degrees
mech.calculateFieldThreshold();
@@ -1069,21 +1075,23 @@ const mech = {
mech.holding();
mech.throw();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < game.cycle) {
const DRAIN = 0.0015 //mech.fieldRegen = 0.0015
const DRAIN = 0.001 //mech.fieldRegen = 0.0015
if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN;
mech.isStealth = true //isStealth is checked in mob foundPlayer()
//draw stealth field
ctx.fillStyle = "rgba(255,255,255,0.5)";
ctx.fillStyle = "rgba(255,255,255,0.4)";
ctx.fill();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y + 25, mech.grabRange, 0, 2 * Math.PI);
ctx.arc(mech.pos.x, mech.pos.y, mech.grabRange - 20, 0, 2 * Math.PI);
ctx.globalCompositeOperation = "destination-in"; //in or atop
ctx.fill();
ctx.globalCompositeOperation = "source-over";
mech.drawField();
mech.grabPowerUp();
mech.pushMobs();
mech.lookForPickUp();
} else {
mech.fieldCDcycle = game.cycle + 120;
@@ -1095,7 +1103,81 @@ const mech = {
}
mech.drawFieldMeter()
}
}
},
() => {
mech.fieldMode = 7;
game.makeTextLog("<strong style='font-size:30px;'>Thermal Radiation Field</strong><br> (right mouse or space bar) <p>field damages all targets within range, <span style='color:#a00;'>including player</span><br>field does <span style='color:#a00;'>not</span> shield player</p>", 1200);
// game.makeTextLog("<strong style='font-size:30px;'>Thermal Radiation Field</strong><br> (right mouse or space bar) <p>field damages and pushes all targets within range<br> <span style='color:#a00;'>field damages player</span><br>field does <span style='color:#a00;'>not</span> shield player</p>", 1200);
mech.setHoldDefaults();
mech.grabRange = 160;
mech.fieldArc = 0.11; //0.2 is normal
mech.rangeSmoothing = 0
// mech.fieldRegen = 0.0008 //0.0015;
mech.hold = function () {
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
mech.throw();
} else if ((keys[32] || game.mouseDownRight && mech.fieldCDcycle < game.cycle)) { //not hold but field button is pressed
mech.grabPowerUp();
mech.lookForPickUp();
//draw grab field
ctx.beginPath();
ctx.arc(this.pos.x, this.pos.y, this.grabRange - 20, this.angle - Math.PI * this.fieldArc, this.angle + Math.PI * this.fieldArc, false);
let EYE_RADIUS = 13;
ctx.lineTo(mech.pos.x + EYE_RADIUS * Math.cos(this.angle), mech.pos.y + EYE_RADIUS * Math.sin(this.angle));
if (this.holdingTarget) {
ctx.fillStyle = "rgba(150,150,150," + (0.05 + 0.1 * Math.random()) + ")";
} else {
ctx.fillStyle = "rgba(150,150,150," + (0.15 + 0.15 * Math.random()) + ")";
}
ctx.fill();
if (mech.health > 0.1) {
const DRAIN = 0.0011 //mech.fieldRegen = 0.0015
if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN;
mech.damage(0.0001)
//draw damage field
mech.rangeSmoothing = mech.rangeSmoothing * 0.997 + (1350 + 60 * Math.cos(game.cycle / 20)) * 0.003
let gradient = ctx.createRadialGradient(this.pos.x, this.pos.y, 0, this.pos.x, this.pos.y, mech.rangeSmoothing);
gradient.addColorStop(0, 'rgba(255,255,255,0)');
gradient.addColorStop(1, 'rgba(255,0,50,0.5)');
// gradient.addColorStop(1, 'rgba(255,0,0,0.05)');
ctx.beginPath();
ctx.arc(this.pos.x, this.pos.y, mech.rangeSmoothing, 0, 2 * Math.PI);
ctx.fillStyle = gradient //rgba(255,0,0,0.2)
ctx.fill();
//damage and gently push mobs in range of field
for (let i = 0, len = mob.length; i < len; ++i) {
if (mob[i].alive) {
sub = Matter.Vector.sub(this.pos, mob[i].position);
dist = Matter.Vector.magnitude(sub);
if (dist < mech.rangeSmoothing) {
mob[i].damage(0.01);
mob[i].locatePlayer();
// mech.fieldMeter -= DRAIN * 0.1; //extra drain for each additional target
// push
mob[i].force = Matter.Vector.mult(Matter.Vector.normalise(sub), -0.0005 * mob[i].mass) //gently push mobs back
}
}
}
} else {
mech.fieldCDcycle = game.cycle + 120;
}
}
} else if (mech.holdingTarget && mech.fireCDcycle < game.cycle) { //holding, but field button is released
mech.rangeSmoothing = 0
mech.pickUp();
} else {
mech.rangeSmoothing = 0
mech.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
}
mech.drawFieldMeter()
}
},
],
drawLeg(stroke) {
// if (game.mouseInGame.x > this.pos.x) {