negative mass field flying buff

harmonic field now has no cooldown after blocking
negative mass field accelerates slower, but with a higher top speed
negative mass field harm reduction is now 60% and always on
mod degenerate matter increases the damage reduction from 60% to 80%

falling damage and damage from blocks have been removed
(I'm trying it out, let me know if you want it back)
This commit is contained in:
landgreen
2020-05-28 16:07:09 -07:00
parent ff78c731fc
commit 7a89051384
9 changed files with 208 additions and 237 deletions

View File

@@ -241,8 +241,8 @@ const b = {
knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 50);
mob[i].force.x += knock.x;
mob[i].force.y += knock.y;
radius *= 0.93 //reduced range for each additional explosion target
damageScale *= 0.8 //reduced damage for each additional explosion target
radius *= 0.95 //reduced range for each additional explosion target
damageScale *= 0.85 //reduced damage for each additional explosion target
} else if (!mob[i].seePlayer.recall && dist < alertRange) {
mob[i].locatePlayer();
knock = Vector.mult(Vector.normalise(sub), (-Math.sqrt(dmg * damageScale) * mob[i].mass) / 80);
@@ -618,9 +618,9 @@ const b = {
friction: 0.05,
frictionAir: FRICTION,
restitution: 1,
dmg: 0.23, //damage done in addition to the damage from momentum
dmg: 0.28, //damage done in addition to the damage from momentum
lookFrequency: 100 + Math.floor(23 * Math.random()),
endCycle: game.cycle + Math.floor((1200 + 420 * Math.random()) * mod.isBulletsLastLonger),
endCycle: game.cycle + Math.floor((1100 + 420 * Math.random()) * mod.isBulletsLastLonger),
classType: "bullet",
collisionFilter: {
category: cat.bullet,
@@ -1192,16 +1192,18 @@ const b = {
let knock, spread
if (mech.crouch) {
mech.fireCDcycle = mech.cycle + Math.floor(55 * mod.fireRate); // cool down
if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + Math.floor(55 * mod.fireRate); //player is immune to collision damage for 30 cycles
spread = 0.75
knock = 0.01 * mod.bulletSize * mod.bulletSize
} else {
mech.fireCDcycle = mech.cycle + Math.floor(45 * mod.fireRate); // cool down
if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + Math.floor(45 * mod.fireRate); //player is immune to collision damage for 30 cycles
spread = 1.3
knock = 0.08 * mod.bulletSize * mod.bulletSize
}
player.force.x -= knock * Math.cos(mech.angle)
player.force.y -= knock * Math.sin(mech.angle) * 0.3 //reduce knock back in vertical direction to stop super jumps
if (mod.isShotgunImmune) mech.immuneCycle = mech.cycle + 60; //player is immune to collision damage for 30 cycles
b.muzzleFlash(35);
if (mod.isNailShot) {
for (let i = 0; i < 15; i++) {
@@ -2074,7 +2076,7 @@ const b = {
name: "drones",
description: "deploy drones that <strong>crash</strong> into mobs<br>collisions reduce their <strong>lifespan</strong> by 1 second",
ammo: 0,
ammoPack: 15,
ammoPack: 14,
have: false,
isStarterGun: true,
isEasyToAim: true,

View File

@@ -87,40 +87,40 @@ function collisionChecks(event) {
//body + player collision
if (game.isBodyDamage) {
if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) {
collidePlayer(pairs[i].bodyB)
} else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) {
collidePlayer(pairs[i].bodyA)
}
}
// if (game.isBodyDamage) {
// if (pairs[i].bodyA === playerBody || pairs[i].bodyA === playerHead) {
// collidePlayer(pairs[i].bodyB)
// } else if (pairs[i].bodyB === playerBody || pairs[i].bodyB === playerHead) {
// collidePlayer(pairs[i].bodyA)
// }
// }
function collidePlayer(obj) {
//player dmg from hitting a body
if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) {
const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26)
if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference
const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity))
if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold)
} else { //block is below player only look at horizontal momentum difference
const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x)
if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold)
}
// function collidePlayer(obj) {
// //player dmg from hitting a body
// if (obj.classType === "body" && obj.speed > 10 && mech.immuneCycle < mech.cycle) {
// const velocityThreshold = 30 //keep this lines up with player.enterLand numbers (130/5 = 26)
// if (player.position.y > obj.position.y) { //block is above the player look at total momentum difference
// const velocityDiffMag = Vector.magnitude(Vector.sub(player.velocity, obj.velocity))
// if (velocityDiffMag > velocityThreshold) hit(velocityDiffMag - velocityThreshold)
// } else { //block is below player only look at horizontal momentum difference
// const velocityDiffMagX = Math.abs(obj.velocity.x - player.velocity.x)
// if (velocityDiffMagX > velocityThreshold) hit(velocityDiffMagX - velocityThreshold)
// }
function hit(dmg) {
mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15);
mech.damage(dmg);
game.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y,
radius: dmg * 500,
color: game.mobDmgColor,
time: game.drawTime
});
}
}
}
// function hit(dmg) {
// mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
// dmg = Math.min(Math.max(Math.sqrt(dmg) * obj.mass * 0.01, 0.02), 0.15);
// mech.damage(dmg);
// game.drawList.push({ //add dmg to draw queue
// x: pairs[i].activeContacts[0].vertex.x,
// y: pairs[i].activeContacts[0].vertex.y,
// radius: dmg * 500,
// color: game.mobDmgColor,
// time: game.drawTime
// });
// }
// }
// }
//mob + (player,bullet,body) collisions
for (let k = 0; k < mob.length; k++) {

View File

@@ -7,7 +7,11 @@ const game = {
Engine.update(engine, game.delta);
game.wipe();
game.textLog();
mech.keyMove();
if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
level.checkZones();
level.checkQuery();
mech.move();
@@ -30,7 +34,11 @@ const game = {
Engine.update(engine, game.delta);
game.wipe();
game.textLog();
mech.keyMove();
if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
level.checkZones();
level.checkQuery();
mech.move();
@@ -69,7 +77,11 @@ const game = {
mech.cycle++;
game.gravity();
Engine.update(engine, game.delta);
mech.keyMove();
if (mech.onGround) {
mech.groundControl()
} else {
mech.airControl()
}
level.checkZones();
level.checkQuery();
@@ -741,7 +753,7 @@ const game = {
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
if (mod.isEnergyRecovery) {
mech.energy += mech.maxEnergy * 0.07
mech.energy += mech.maxEnergy * 0.06
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy;
}
if (mod.isHealthRecovery) mech.addHealth(0.01)

View File

@@ -184,9 +184,9 @@ const level = {
// spawn.bomberBoss(2900, -500)
// spawn.launcherBoss(1200, -500)
spawn.laserTargetingBoss(1600, -400)
// spawn.sneaker(1600, -500)
// spawn.sniper(1700, -120)
// spawn.laserTargetingBoss(1600, -400)
// spawn.spawner(1600, -500)
spawn.sniper(1700, -120)
// spawn.cellBossCulture(1600, -500)
// spawn.shooter(1600, -500)
// spawn.striker(1600, -500)

View File

@@ -342,18 +342,20 @@ const mod = {
},
{
name: "self-replication",
description: "<strong>duplicate</strong> your permanent <strong>bots</strong><br>remove all your <strong>ammo</strong>",
description: "<strong>duplicate</strong> your permanent <strong>bots</strong><br>remove <strong>80%</strong> of your <strong>ammo</strong>",
maxCount: 1,
count: 0,
isNonRefundable: true,
allowed() {
return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 1
return mod.foamBotCount + mod.nailBotCount + mod.laserBotCount > 2
},
requires: "2 or more bots",
requires: "3 or more bots",
effect() {
//remove ammo
for (let i = 0, len = b.guns.length; i < len; ++i) {
if (b.guns[i].ammo != Infinity) b.guns[i].ammo = 0;
if (b.guns[i].ammo != Infinity) {
b.guns[i].ammo = Math.floor(b.guns[i].ammo * 0.2);
}
}
//double bots
@@ -499,7 +501,7 @@ const mod = {
},
{
name: "waste energy recovery",
description: "regen <strong>7%</strong> of max <strong class='color-f'>energy</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
description: "regen <strong>6%</strong> of max <strong class='color-f'>energy</strong> every second<br>active for <strong>5 seconds</strong> after a mob <strong>dies</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -648,7 +650,7 @@ const mod = {
},
{
name: "energy conservation",
description: "<strong>+15%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>",
description: "<strong>+13%</strong> of <strong class='color-d'>damage</strong> done recovered as <strong class='color-f'>energy</strong>",
maxCount: 9,
count: 0,
allowed() {
@@ -656,8 +658,7 @@ const mod = {
},
requires: "",
effect() {
mod.energySiphon += 0.15;
mech.energy = mech.maxEnergy
mod.energySiphon += 0.13;
},
remove() {
mod.energySiphon = 0;
@@ -1032,7 +1033,7 @@ const mod = {
},
{
name: "shotgun spin-statistics",
description: "firing the <strong>shotgun</strong> makes you <br><strong>immune</strong> to <strong>harm</strong> for <strong>1 second</strong>",
description: "firing the <strong>shotgun</strong> makes you <br><strong>immune</strong> to <strong>harm</strong> while on cooldown",
maxCount: 1,
count: 0,
allowed() {
@@ -1591,7 +1592,7 @@ const mod = {
},
{
name: "degenerate matter",
description: "<strong>2x</strong> <strong class='color-f'>energy</strong> drain for <strong>negative mass field</strong><br>increase <strong>harm</strong> reduction to <strong>90%</strong>",
description: "<strong>negative mass field</strong><br><strong>harm</strong> reduction is increased to <strong>80%</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1600,9 +1601,11 @@ const mod = {
requires: "negative mass field",
effect() {
mod.isHarmReduce = true
mech.fieldHarmReduction = 0.2;
},
remove() {
mod.isHarmReduce = false;
if (mech.fieldUpgrades[mech.fieldMode].name === "negative mass field") mech.setField("negative mass field") //reset harm reduction
}
},
{
@@ -1655,7 +1658,7 @@ const mod = {
},
{
name: "frequency resonance",
description: "<strong>standing wave harmonics</strong> shield is retuned<br>increase <strong>size</strong> and <strong>blocking</strong> efficiency by <strong>30%</strong>",
description: "<strong>standing wave harmonics</strong> shield is retuned<br>increase <strong>size</strong> and <strong>blocking</strong> efficiency by <strong>40%</strong>",
maxCount: 9,
count: 0,
allowed() {
@@ -1663,8 +1666,8 @@ const mod = {
},
requires: "standing wave harmonics",
effect() {
mech.fieldRange += 175 * 0.2
mech.fieldShieldingScale *= 0.7
mech.fieldRange += 175 * 0.21
mech.fieldShieldingScale *= 0.6
},
remove() {
mech.fieldRange = 175;

View File

@@ -69,7 +69,7 @@ const mech = {
mass: 5,
FxNotHolding: 0.015,
Fx: 0.015, //run Force on ground //
FxAir: 0.016, //run Force in Air
FxAir: 0.016, // 0.4/5/5 run Force in Air
yOff: 70,
yOffGoal: 70,
onGround: false, //checks if on ground or in air
@@ -112,6 +112,7 @@ const mech = {
ground: 0.01,
air: 0.0025
},
airSpeedLimit: 125, // 125/mass/mass = 5
angle: 0,
walk_cycle: 0,
stepSize: 0,
@@ -208,152 +209,101 @@ const mech = {
}
} else {
//sets a hard land where player stays in a crouch for a bit and can't jump
//crouch is forced in keyMove() on ground section below
//crouch is forced in groundControl below
const momentum = player.velocity.y * player.mass //player mass is 5 so this triggers at 26 down velocity, unless the player is holding something
if (momentum > 130) {
mech.doCrouch();
mech.yOff = mech.yOffWhen.jump;
mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40)
if (mod.isStomp) {
const len = Math.min(25, (momentum - 120) * 0.1)
for (let i = 0; i < len; i++) {
b.spore(player) //spawn drone
}
} else if (player.velocity.y > 27 && momentum > 180 * mod.squirrelFx) { //falling damage
let dmg = Math.sqrt(momentum - 180) * 0.01
dmg = Math.min(Math.max(dmg, 0.02), 0.20);
mech.damage(dmg);
}
// if (mod.isStomp) {
// const len = Math.min(25, (momentum - 120) * 0.1)
// for (let i = 0; i < len; i++) {
// b.spore(player) //spawn drone
// }
// } else if (player.velocity.y > 27 && momentum > 180 * mod.squirrelFx) { //falling damage
// let dmg = Math.sqrt(momentum - 180) * 0.01
// dmg = Math.min(Math.max(dmg, 0.02), 0.20);
// mech.damage(dmg);
// }
} else {
mech.yOffGoal = mech.yOffWhen.stand;
}
}
},
buttonCD_jump: 0, //cool down for player buttons
keyMove() {
if (mech.onGround) { //on ground **********************
if (mech.crouch) {
if (!(keys[83] || keys[40]) && mech.checkHeadClear() && mech.hardLandCD < mech.cycle) mech.undoCrouch();
} else if (keys[83] || keys[40] || mech.hardLandCD > mech.cycle) {
mech.doCrouch(); //on ground && not crouched and pressing s or down
} else if ((keys[87] || keys[38]) && mech.buttonCD_jump + 20 < mech.cycle && mech.yOffWhen.stand > 23) {
mech.buttonCD_jump = mech.cycle; //can't jump again until 20 cycles pass
groundControl() {
if (mech.crouch) {
if (!(keys[83] || keys[40]) && mech.checkHeadClear() && mech.hardLandCD < mech.cycle) mech.undoCrouch();
} else if (keys[83] || keys[40] || mech.hardLandCD > mech.cycle) {
mech.doCrouch(); //on ground && not crouched and pressing s or down
} else if ((keys[87] || keys[38]) && mech.buttonCD_jump + 20 < mech.cycle && mech.yOffWhen.stand > 23) {
mech.buttonCD_jump = mech.cycle; //can't jump again until 20 cycles pass
//apply a fraction of the jump force to the body the player is jumping off of
Matter.Body.applyForce(mech.standingOn, mech.pos, {
x: 0,
y: mech.jumpForce * 0.12 * Math.min(mech.standingOn.mass, 5)
});
//apply a fraction of the jump force to the body the player is jumping off of
Matter.Body.applyForce(mech.standingOn, mech.pos, {
x: 0,
y: mech.jumpForce * 0.12 * Math.min(mech.standingOn.mass, 5)
});
player.force.y = -mech.jumpForce; //player jump force
Matter.Body.setVelocity(player, { //zero player y-velocity for consistent jumps
x: player.velocity.x,
y: 0
});
}
//horizontal move on ground
// function blink(dir) {
// dir *= 6
// mech.fieldCDcycle = mech.cycle + 15;
// for (let i = 0; i < 100; i++) {
// Matter.Body.setPosition(player, {
// x: player.position.x + dir,
// y: player.position.y
// });
// const bounds = {
// min: {
// x: player.bounds.min.x,
// y: player.bounds.min.y
// },
// max: {
// x: player.bounds.max.x,
// y: player.bounds.max.y - 30
// }
// }
// if (Matter.Query.region(map, bounds).length !== 0 || Matter.Query.region(body, bounds).length !== 0) {
// Matter.Body.setPosition(player, {
// x: player.position.x - dir,
// y: player.position.y
// });
// break;
// }
// }
// }
//apply a force to move
if (keys[65] || keys[37]) { //left / a
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(-1)
// } else {
if (player.velocity.x > -2) {
player.force.x -= mech.Fx * 1.5
} else {
player.force.x -= mech.Fx
}
// }
} else if (keys[68] || keys[39]) { //right / d
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(1)
// } else {
if (player.velocity.x < 2) {
player.force.x += mech.Fx * 1.5
} else {
player.force.x += mech.Fx
}
// }
} else {
const stoppingFriction = 0.92;
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
//come to a stop if fast or if no move key is pressed
if (player.speed > 4) {
const stoppingFriction = (mech.crouch) ? 0.65 : 0.89; // this controls speed when crouched
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
} else { // in air **********************************
//check for short jumps
if (
mech.buttonCD_jump + 60 > mech.cycle && //just pressed jump
!(keys[87] || keys[38]) && //but not pressing jump key
mech.Vy < 0 //moving up
) {
Matter.Body.setVelocity(player, {
//reduce player y-velocity every cycle
x: player.velocity.x,
y: player.velocity.y * 0.94
});
}
const limit = 125 / player.mass / player.mass
if (keys[65] || keys[37]) {
if (player.velocity.x > -limit) player.force.x -= mech.FxAir; // move player left / a
} else if (keys[68] || keys[39]) {
if (player.velocity.x < limit) player.force.x += mech.FxAir; //move player right / d
}
// if ((keys[83] || keys[40])) { //ground stomp when pressing down
// player.force.y += 0.1;
// if (player.velocity.y > 50) {
// Matter.Body.setVelocity(player, {
// x: 0,
// y: 50
// });
// }
// }
player.force.y = -mech.jumpForce; //player jump force
Matter.Body.setVelocity(player, { //zero player y-velocity for consistent jumps
x: player.velocity.x,
y: 0
});
}
//smoothly move leg height towards height goal
mech.yOff = mech.yOff * 0.85 + mech.yOffGoal * 0.15;
if (keys[65] || keys[37]) { //left / a
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(-1)
// } else {
if (player.velocity.x > -2) {
player.force.x -= mech.Fx * 1.5
} else {
player.force.x -= mech.Fx
}
// }
} else if (keys[68] || keys[39]) { //right / d
// if (game.mouseDownRight && mech.fieldCDcycle < mech.cycle && !mech.crouch) {
// blink(1)
// } else {
if (player.velocity.x < 2) {
player.force.x += mech.Fx * 1.5
} else {
player.force.x += mech.Fx
}
// }
} else {
const stoppingFriction = 0.92;
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
//come to a stop if fast or if no move key is pressed
if (player.speed > 4) {
const stoppingFriction = (mech.crouch) ? 0.65 : 0.89; // this controls speed when crouched
Matter.Body.setVelocity(player, {
x: player.velocity.x * stoppingFriction,
y: player.velocity.y * stoppingFriction
});
}
},
airControl() {
//check for short jumps //moving up //recently pressed jump //but not pressing jump key now
if (mech.buttonCD_jump + 60 > mech.cycle && !(keys[87] || keys[38]) && mech.Vy < 0) {
Matter.Body.setVelocity(player, {
//reduce player y-velocity every cycle
x: player.velocity.x,
y: player.velocity.y * 0.94
});
}
if (keys[65] || keys[37]) {
if (player.velocity.x > -mech.airSpeedLimit / player.mass / player.mass) player.force.x -= mech.FxAir; // move player left / a
} else if (keys[68] || keys[39]) {
if (player.velocity.x < mech.airSpeedLimit / player.mass / player.mass) player.force.x += mech.FxAir; //move player right / d
}
},
alive: false,
death() {
@@ -374,6 +324,7 @@ const mech = {
if (mod.mods[i].count < mod.mods[i].maxCount &&
!mod.mods[i].isNonRefundable &&
mod.mods[i].name !== "quantum immortality" &&
mod.mods[i].name !== "determinism" &&
mod.mods[i].allowed()
) options.push(i);
}
@@ -507,7 +458,7 @@ const mech = {
immuneCycle: 0, //used in engine
harmReduction() {
let dmg = 1
dmg *= mech.fieldDamageResistance
dmg *= mech.fieldHarmReduction
dmg *= mod.isSlowFPS ? 0.85 : 1
if (mod.energyRegen === 0) dmg *= 0.5 //0.22 + 0.78 * mech.energy //77% damage reduction at zero energy
if (mod.isEntanglement && b.inventory[0] === b.activeGun) {
@@ -539,7 +490,7 @@ const mech = {
dmg *= mech.harmReduction()
if (mod.isEnergyHealth) {
mech.energy -= dmg;
mech.energy -= dmg * 1.25; //energy takes an extra 25% damage for balancing purposes
if (mech.energy < 0 || isNaN(mech.energy)) {
if (mod.isDeathAvoid && powerUps.reroll.rerolls) { //&& Math.random() < 0.5
powerUps.reroll.changeRerolls(-1)
@@ -730,6 +681,7 @@ const mech = {
// ctx.fillStyle = '#9cf' //'#0cf';
// ctx.fill()
ctx.restore();
mech.yOff = mech.yOff * 0.85 + mech.yOffGoal * 0.15; //smoothly move leg height towards height goal
},
// *********************************************
// **************** fields *********************
@@ -754,7 +706,7 @@ const mech = {
fieldRegen: 0,
fieldMode: 0,
fieldFire: false,
fieldDamageResistance: 1,
fieldHarmReduction: 1,
holdingMassScale: 0,
fieldArc: 0,
fieldThreshold: 0,
@@ -766,14 +718,18 @@ const mech = {
mech.fieldRegen = mod.energyRegen; //0.001
mech.fieldMeterColor = "#0cf"
mech.fieldShieldingScale = 1;
mech.fieldBlockCD = 10;
game.isBodyDamage = true;
mech.fieldDamageResistance = 1;
mech.fieldHarmReduction = 1;
mech.fieldRange = 155;
mech.fieldFire = false;
mech.fieldCDcycle = 0;
mech.isStealth = false;
player.collisionFilter.mask = cat.body | cat.map | cat.mob | cat.mobBullet | cat.mobShield
mech.airSpeedLimit = 125
mech.drop();
mech.holdingMassScale = 0.5;
mech.fieldArc = 0.2; //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
mech.calculateFieldThreshold(); //run calculateFieldThreshold after setting fieldArc, used for powerUp grab and mobPush with lookingAt(mob)
mech.isBodiesAsleep = true;
@@ -1059,7 +1015,7 @@ const mech = {
x: player.velocity.x - (15 * unit.x) / massRoot,
y: player.velocity.y - (15 * unit.y) / massRoot
});
mech.fieldCDcycle = mech.cycle + 10;
mech.fieldCDcycle = mech.cycle + mech.fieldBlockCD;
if (mech.crouch) {
Matter.Body.setVelocity(player, {
x: player.velocity.x + 0.4 * unit.x * massRoot,
@@ -1267,6 +1223,7 @@ const mech = {
description: "three oscillating <strong>shields</strong> are permanently active<br><strong class='color-f'>energy</strong> regenerates while field is active",
isEasyToAim: true,
effect: () => {
mech.fieldBlockCD = 0;
mech.hold = function () {
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
@@ -1281,9 +1238,9 @@ const mech = {
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)
}
if (mech.energy > 0.1 && mech.fieldCDcycle < mech.cycle) {
const fieldRange1 = (0.6 + 0.35 * Math.sin(mech.cycle / 23)) * mech.fieldRange
const fieldRange2 = (0.55 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange
const fieldRange3 = (0.5 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange
const fieldRange1 = (0.7 + 0.3 * Math.sin(mech.cycle / 23)) * mech.fieldRange
const fieldRange2 = (0.6 + 0.4 * Math.sin(mech.cycle / 37)) * mech.fieldRange
const fieldRange3 = (0.55 + 0.45 * Math.sin(mech.cycle / 47)) * mech.fieldRange
const netfieldRange = Math.max(fieldRange1, fieldRange2, fieldRange3)
ctx.fillStyle = "rgba(110,170,200," + (0.04 + mech.energy * (0.12 + 0.13 * Math.random())) + ")";
ctx.beginPath();
@@ -1419,16 +1376,21 @@ const mech = {
},
{
name: "negative mass field",
description: "use <strong class='color-f'>energy</strong> to nullify &nbsp; <strong style='letter-spacing: 12px;'>gravity</strong><br>reduce <strong>harm</strong> by <strong>80%</strong> while field is active",
description: "use <strong class='color-f'>energy</strong> to nullify &nbsp; <strong style='letter-spacing: 12px;'>gravity</strong><br>reduce <strong>harm</strong> by <strong>60%</strong>",
fieldDrawRadius: 0,
isEasyToAim: true,
effect: () => {
mech.fieldFire = true;
mech.holdingMassScale = 0.03; //can hold heavier blocks with lower cost to jumping
mech.fieldMeterColor = "#000"
if (mod.isHarmReduce) {
mech.fieldHarmReduction = 0.2;
} else {
mech.fieldHarmReduction = 0.4;
}
mech.hold = function () {
mech.fieldDamageResistance = 1;
mech.airSpeedLimit = 125 //5 * player.mass * player.mass
mech.FxAir = 0.016
if (mech.isHolding) {
mech.drawHold(mech.holdingTarget);
mech.holding();
@@ -1436,16 +1398,10 @@ const mech = {
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //push away
mech.grabPowerUp();
mech.lookForPickUp();
let DRAIN = 0.00105;
const DRAIN = 0.00035
if (mech.energy > DRAIN) {
if (mod.isHarmReduce) {
mech.fieldDamageResistance = 0.1; // 1 - 0.9
DRAIN = 0.0007 //2x energy drain
} else {
mech.fieldDamageResistance = 0.2; // 1 - 0.8
DRAIN = 0.00035
}
mech.airSpeedLimit = 400 // 7* player.mass * player.mass
mech.FxAir = 0.005
// mech.pushMobs360();
//repulse mobs
@@ -1499,12 +1455,12 @@ const mech = {
if (keys[65] || keys[68] || keys[37] || keys[39]) {
Matter.Body.setVelocity(player, {
x: player.velocity.x * 0.99,
y: player.velocity.y * 0.97
y: player.velocity.y * 0.98
});
} else { //slow rise and fall
Matter.Body.setVelocity(player, {
x: player.velocity.x,
y: player.velocity.y * 0.97
x: player.velocity.x * 0.99,
y: player.velocity.y * 0.98
});
}
@@ -1554,11 +1510,11 @@ const mech = {
},
{
name: "plasma torch",
description: "use <strong class='color-f'>energy</strong> to emit <strong class='color-d'>damaging</strong> plasma<br>reduce <strong>harm</strong> by <strong>33%</strong>",
description: "use <strong class='color-f'>energy</strong> to emit <strong class='color-d'>damaging</strong> plasma<br>reduce <strong>harm</strong> by <strong>20%</strong>",
isEasyToAim: false,
effect: () => {
mech.fieldMeterColor = "#f0f"
mech.fieldDamageResistance = 0.67; //reduce harm by 33%
mech.fieldHarmReduction = 0.80;
mech.hold = function () {
if (mech.isHolding) {
@@ -1568,7 +1524,7 @@ const mech = {
} else if ((keys[32] || game.mouseDownRight) && mech.fieldCDcycle < mech.cycle) { //not hold but field button is pressed
mech.grabPowerUp();
mech.lookForPickUp();
const DRAIN = 0.001
const DRAIN = 0.0013
if (mech.energy > DRAIN) {
mech.energy -= DRAIN;
if (mech.energy < 0) {
@@ -2065,7 +2021,7 @@ const mech = {
for (let i = 0, len = body.length; i < len; ++i) {
if (Vector.magnitude(Vector.sub(body[i].position, mech.fieldPosition)) < mech.fieldRadius) {
const DRAIN = speed * body[i].mass * 0.000022
const DRAIN = speed * body[i].mass * 0.000018
if (mech.energy > DRAIN) {
mech.energy -= DRAIN;
Matter.Body.setVelocity(body[i], velocity); //give block mouse velocity

View File

@@ -391,7 +391,7 @@ const powerUps = {
spawnBossPowerUp(x, y) { //boss spawns field and gun mod upgrades
if (game.difficultyMode > 1 || Math.random() < 0.66) { //easy and normal have only a 66% chance for a power up
spawnPowerUps()
if (game.difficultyMode > 2 && Math.random() < 0.33) spawnPowerUps() //why? has a 33% chance for an extra power up
if (game.difficultyMode > 2 && level.levelsCleared % 2 == 0) spawnPowerUps() //why? has an extra power up on even numbered levels
} else {
if (mech.health < 0.65 && !mod.isEnergyHealth) {
powerUps.spawn(x, y, "heal");
@@ -416,7 +416,7 @@ const powerUps = {
} else if (Math.random() < 0.5) {
powerUps.spawn(x, y, "gun")
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "gun")
} else if (mech.health < 0.65 && !mod.isEnergyHealth) {
} else if (mech.health < 0.65 && !mod.isEnergyHealth || mod.bayesian) {
powerUps.spawn(x, y, "heal");
powerUps.spawn(x, y, "heal");
powerUps.spawn(x, y, "heal");
@@ -427,7 +427,7 @@ const powerUps = {
powerUps.spawn(x, y, "heal");
powerUps.spawn(x, y, "heal");
}
} else if (!mod.bayesian) {
} else {
powerUps.spawn(x, y, "ammo");
powerUps.spawn(x, y, "ammo");
powerUps.spawn(x, y, "ammo");

View File

@@ -83,7 +83,8 @@ const spawn = {
},
randomLevelBoss(x, y) {
// other bosses: suckerBoss, laserBoss, tetherBoss, snakeBoss //all need a particular level to work so they are not included
const options = ["shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss", "laserTargetingBoss"] // , "timeSkipBoss"
// "shooterBoss", "cellBossCulture", "bomberBoss", "spiderBoss", "launcherBoss",
const options = ["laserTargetingBoss"] // , "timeSkipBoss"
spawn[options[Math.floor(Math.random() * options.length)]](x, y)
},
//mob templates *********************************************************************************************