mod balance and field balance

This commit is contained in:
landgreen
2019-10-25 06:39:13 -07:00
parent f7dcabd50e
commit 9b35730cf7
2 changed files with 30 additions and 23 deletions

View File

@@ -27,15 +27,14 @@ const b = {
game.makeTextLog("<strong style='font-size:30px;'>Auto-Loading Heuristics</strong><br> (left click)<p>your <strong>rate of fire</strong> 15% is faster</p>", 1200); game.makeTextLog("<strong style='font-size:30px;'>Auto-Loading Heuristics</strong><br> (left click)<p>your <strong>rate of fire</strong> 15% is faster</p>", 1200);
b.setModDefaults(); //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls b.setModDefaults(); //good for guns with extra ammo: needles, M80, rapid fire, flak, super balls
b.modFireRate = 0.85 b.modFireRate = 0.85
//ADD: need to add in something that changes game play //ADD: maybe add in something that changes game play
}, },
() => { () => {
b.mod = 1; b.mod = 1;
game.makeTextLog("<strong style='font-size:30px;'>Anti-Matter Cores</strong><br> (left click)<p>your <strong>explosions</strong> are larger and do more damage</p>", 1200); game.makeTextLog("<strong style='font-size:30px;'>Anti-Matter Cores</strong><br> (left click)<p>your <strong>explosions</strong> are larger and do more damage</p>", 1200);
b.setModDefaults(); //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage b.setModDefaults(); //at 1.4 gives a flat 40% increase, and increased range, balanced by limited guns and self damage
//testing at 1.3: grenade(+0.3), missiles, flak, M80 //testing at 1.3: grenade(+0.3), missiles, flak, M80
b.modExplosionRadius = 1.25; //good for guns with explosions: b.modExplosionRadius = 2; //good for guns with explosions:
//ADD: take no damage from explosions, explosive guns use double ammo, 1.5 radius
}, },
() => { () => {
b.mod = 2; b.mod = 2;
@@ -44,7 +43,7 @@ const b = {
//testing done at 1.15: one shot(+0.38), rapid fire(+0.25), spray, wave beam(+0.4 adds range and dmg), needles(+0.1) //testing done at 1.15: one shot(+0.38), rapid fire(+0.25), spray, wave beam(+0.4 adds range and dmg), needles(+0.1)
//testing at 1.08: spray(point blank)(+0.25), one shot(+0.16), wave beam(point blank)(+0.14) //testing at 1.08: spray(point blank)(+0.25), one shot(+0.16), wave beam(point blank)(+0.14)
b.modBulletSize = 1.07; b.modBulletSize = 1.07;
//ADD: need to add in something that changes game play //ADD: maybe add in something that changes game play
}, },
() => { () => {
b.mod = 3; b.mod = 3;
@@ -60,7 +59,7 @@ const b = {
}, },
() => { () => {
b.mod = 5; b.mod = 5;
game.makeTextLog("<strong style='font-size:30px;'>Desublimated Ammunition</strong><br> (left click)<p>1 out of 3 shots will not consume <strong>ammo</strong> when crouching</p>", 1200); game.makeTextLog("<strong style='font-size:30px;'>Desublimated Ammunition</strong><br> (left click)<p>1 out of 2 shots will not consume <strong>ammo</strong> when <strong>crouching</strong></p>", 1200);
b.setModDefaults(); //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray b.setModDefaults(); //good with guns that have less ammo: one shot, grenades, missiles, super balls, spray
b.modNoAmmo = 1 b.modNoAmmo = 1
}, },
@@ -97,17 +96,16 @@ const b = {
}, },
fire() { fire() {
if (game.mouseDown && mech.fireCDcycle < mech.cycle && (!(keys[32] || game.mouseDownRight) || mech.fieldFire) && b.inventory.length) { if (game.mouseDown && mech.fireCDcycle < mech.cycle && (!(keys[32] || game.mouseDownRight) || mech.fieldFire) && b.inventory.length) {
if (b.guns[this.activeGun].ammo > 0) { if (b.guns[b.activeGun].ammo > 0) {
b.guns[this.activeGun].fire(); b.guns[b.activeGun].fire();
if (b.modNoAmmo && mech.crouch) { if (b.modNoAmmo && mech.crouch) {
if (b.modNoAmmo % 3) { if (b.modNoAmmo % 2) {
b.guns[this.activeGun].ammo--; b.guns[b.activeGun].ammo--;
game.updateGunHUD(); game.updateGunHUD();
} }
b.modNoAmmo++ //makes the no ammo toggle off and on b.modNoAmmo++ //makes the no ammo toggle off and on
} else { } else {
b.guns[this.activeGun].ammo--; b.guns[b.activeGun].ammo--;
game.updateGunHUD(); game.updateGunHUD();
} }
} else { } else {
@@ -264,6 +262,7 @@ const b = {
mech.drop(); mech.drop();
} }
//body knock backs //body knock backs
for (let i = 0, len = body.length; i < len; ++i) { for (let i = 0, len = body.length; i < len; ++i) {
sub = Matter.Vector.sub(bullet[me].position, body[i].position); sub = Matter.Vector.sub(bullet[me].position, body[i].position);
@@ -839,6 +838,7 @@ const b = {
const me = bullet.length; const me = bullet.length;
bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle) - 3, 30 * b.modBulletSize, 4 * b.modBulletSize, b.fireAttributes(dir)); bullet[me] = Bodies.rectangle(mech.pos.x + 40 * Math.cos(mech.angle), mech.pos.y + 40 * Math.sin(mech.angle) - 3, 30 * b.modBulletSize, 4 * b.modBulletSize, b.fireAttributes(dir));
b.fireProps(mech.crouch ? 70 : 30, -3 * (0.5 - Math.random()) + (mech.crouch ? 25 : -8), dir, me); //cd , speed b.fireProps(mech.crouch ? 70 : 30, -3 * (0.5 - Math.random()) + (mech.crouch ? 25 : -8), dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices); b.drawOneBullet(bullet[me].vertices);
// Matter.Body.setDensity(bullet[me], 0.01) //doesn't help with reducing explosion knock backs // Matter.Body.setDensity(bullet[me], 0.01) //doesn't help with reducing explosion knock backs
bullet[me].force.y += 0.00045; //a small push down at first to make it seem like the missile is briefly falling bullet[me].force.y += 0.00045; //a small push down at first to make it seem like the missile is briefly falling
@@ -931,7 +931,7 @@ const b = {
}, },
{ {
name: "flak", name: "flak",
description: "fire a cluster of high speed explosive projectiles<br>explode on contact or after half a second", description: "fire a cluster of explosive projectiles<br>explode on contact or after half a second",
ammo: 0, ammo: 0,
ammoPack: 18, ammoPack: 18,
have: false, have: false,
@@ -945,11 +945,13 @@ const b = {
let dir = mech.angle - angleStep * totalBullets / 2; let dir = mech.angle - angleStep * totalBullets / 2;
const side1 = 17 * b.modBulletSize const side1 = 17 * b.modBulletSize
const side2 = 4 * b.modBulletSize const side2 = 4 * b.modBulletSize
for (let i = 0; i < totalBullets; i++) { //5 -> 7 for (let i = 0; i < totalBullets; i++) { //5 -> 7
dir += angleStep dir += angleStep
const me = bullet.length; const me = bullet.length;
bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), side1, side2, b.fireAttributes(dir)); bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), side1, side2, b.fireAttributes(dir));
b.fireProps(CD, SPEED + 25 * Math.random() - i, dir, me); //cd , speed b.fireProps(CD, SPEED + 25 * Math.random() - i, dir, me); //cd , speed
//Matter.Body.setDensity(bullet[me], 0.00001); //Matter.Body.setDensity(bullet[me], 0.00001);
bullet[me].endCycle = i + game.cycle + END bullet[me].endCycle = i + game.cycle + END
bullet[me].restitution = 0; bullet[me].restitution = 0;
@@ -1011,6 +1013,7 @@ const b = {
bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 22 * b.modBulletSize, b.fireAttributes(dir, false)); bullet[me] = Bodies.circle(mech.pos.x + 30 * Math.cos(mech.angle), mech.pos.y + 30 * Math.sin(mech.angle), 22 * b.modBulletSize, b.fireAttributes(dir, false));
bullet[me].radius = 22; //used from drawing timer bullet[me].radius = 22; //used from drawing timer
b.fireProps(mech.crouch ? 60 : 40, mech.crouch ? 38 : 30, dir, me); //cd , speed b.fireProps(mech.crouch ? 60 : 40, mech.crouch ? 38 : 30, dir, me); //cd , speed
b.drawOneBullet(bullet[me].vertices); b.drawOneBullet(bullet[me].vertices);
Matter.Body.setDensity(bullet[me], 0.000001); Matter.Body.setDensity(bullet[me], 0.000001);
bullet[me].endCycle = game.cycle + Math.floor(140 * b.modBulletsLastLonger); bullet[me].endCycle = game.cycle + Math.floor(140 * b.modBulletsLastLonger);

View File

@@ -949,10 +949,12 @@ const mech = {
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); 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(); mech.setHoldDefaults();
//throw quicker and harder //throw quicker and harder
mech.fieldShieldingScale = 3;
mech.fieldRegen *= 3;
mech.throwChargeRate = 3; mech.throwChargeRate = 3;
mech.throwChargeMax = 140; mech.throwChargeMax = 140;
mech.fieldDamage = 2.5; //passive field does extra damage mech.fieldDamage = 3; //passive field does extra damage
mech.fieldArc = 0.09 mech.fieldArc = 0.11
mech.calculateFieldThreshold(); //run after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob) mech.calculateFieldThreshold(); //run after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
mech.hold = function () { mech.hold = function () {
@@ -962,7 +964,7 @@ const mech = {
mech.throw(); mech.throw();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.15) { //not hold but field button is pressed } else if ((keys[32] || game.mouseDownRight) && mech.fieldMeter > 0.15) { //not hold but field button is pressed
//draw field //draw field
const range = mech.grabRange - 20; const range = mech.grabRange - 15;
ctx.beginPath(); ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - Math.PI * mech.fieldArc, mech.angle + Math.PI * mech.fieldArc, false); ctx.arc(mech.pos.x, mech.pos.y, range, mech.angle - Math.PI * mech.fieldArc, mech.angle + Math.PI * mech.fieldArc, false);
let eye = 13; let eye = 13;
@@ -1013,9 +1015,8 @@ const mech = {
mech.holding(); mech.holding();
mech.throw(); mech.throw();
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away } else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
const DRAIN = 0.001 const DRAIN = 0.0007
if (mech.fieldMeter > DRAIN) { if (mech.fieldMeter > DRAIN) {
mech.fieldMeter -= DRAIN;
mech.pushMobs360(170); mech.pushMobs360(170);
mech.grabPowerUp(); mech.grabPowerUp();
mech.lookForPickUp(170); mech.lookForPickUp(170);
@@ -1034,25 +1035,28 @@ const mech = {
// zeroG(bullet); //works fine, but not that noticeable and maybe not worth the possible performance hit // zeroG(bullet); //works fine, but not that noticeable and maybe not worth the possible performance hit
// zeroG(mob); //mobs are too irregular to make this work? // zeroG(mob); //mobs are too irregular to make this work?
player.force.y -= 0.0009 + player.mass * mech.gravity; //constant upward drift
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x, x: player.velocity.x,
y: player.velocity.y * 0.97 y: player.velocity.y * 0.97
}); });
if (keys[83] || keys[40]) { //down if (keys[83] || keys[40]) { //down
player.force.y += 0.003 player.force.y -= 0.8 * player.mass * mech.gravity;
mech.grabRange = mech.grabRange * 0.97 + 350 * 0.03; mech.grabRange = mech.grabRange * 0.97 + 400 * 0.03;
} else if (keys[87] || keys[38]) { //up
mech.fieldMeter -= 3 * DRAIN;
mech.grabRange = mech.grabRange * 0.97 + 750 * 0.03;
player.force.y -= 1.2 * player.mass * mech.gravity;
} else { } else {
mech.fieldMeter -= DRAIN;
mech.grabRange = mech.grabRange * 0.97 + 650 * 0.03; mech.grabRange = mech.grabRange * 0.97 + 650 * 0.03;
player.force.y -= 1.07 * player.mass * mech.gravity; // slow upward drift
} }
//add extra friction for horizontal motion //add extra friction for horizontal motion
if (keys[65] || keys[68] || keys[37] || keys[39]) { if (keys[65] || keys[68] || keys[37] || keys[39]) {
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x * 0.88, x: player.velocity.x * 0.85,
y: player.velocity.y y: player.velocity.y
}); });
} }