waste heat recovery

mod: electric reactive armor - reduce harm from explosions by 6% for every 10 energy
mod: waste heat recovery - laser damage grows to 400%, but you start to eject your health as a heal power up

new community level by Francois:  house
This commit is contained in:
landgreen
2020-09-13 19:14:33 -07:00
parent 5c2319cc75
commit cab6feda13
11 changed files with 750 additions and 556 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -195,14 +195,23 @@ const b = {
dist = Vector.magnitude(sub);
if (dist < radius) {
if (!(mod.isImmuneExplosion && mech.energy > 0.97)) {
if (mod.isExplosionHarm) {
mech.damage(radius * 0.0004); //300% more player damage from explosions
} else {
mech.damage(radius * 0.0001); //normal player damage from explosions
}
mech.drop();
if (mod.isImmuneExplosion) {
const mitigate = Math.min(1, Math.max(1 - mech.energy * 0.6, 0))
mech.damage(mitigate * radius * (mod.isExplosionHarm) ? 0.0004 : 0.0001);
} else {
mech.damage(radius * (mod.isExplosionHarm) ? 0.0004 : 0.0001);
}
// if (!(mod.isImmuneExplosion && mech.energy > 0.97)) {
// if (mod.isExplosionHarm) {
// mech.damage(radius * 0.0004); //300% more player damage from explosions
// } else {
// mech.damage(radius * 0.0001); //normal player damage from explosions
// }
// mech.drop();
// }
knock = Vector.mult(Vector.normalise(sub), -Math.sqrt(dmg) * player.mass * 0.015);
player.force.x += knock.x;
player.force.y += knock.y;
@@ -1779,7 +1788,7 @@ const b = {
}
if (!immune) {
this.immuneList.push(who.id)
who.foundPlayer();
if (!mech.isStealth) who.foundPlayer();
if (mod.isFastDot) {
mobs.statusDoT(who, 3.9, 30)
} else {
@@ -1795,7 +1804,7 @@ const b = {
}
} else {
this.endCycle = 0;
who.foundPlayer();
if (!mech.isStealth) who.foundPlayer();
if (mod.isFastDot) {
mobs.statusDoT(who, 3.78, 30)
} else {
@@ -1894,7 +1903,7 @@ const b = {
for (let i = 0; i < q.length; i++) {
let dmg = b.dmgScale * 0.36 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.66) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
q[i].damage(dmg);
q[i].foundPlayer();
if (!mech.isStealth) q[i].foundPlayer();
game.drawList.push({ //add dmg to draw queue
x: this.position.x,
y: this.position.y,
@@ -1927,7 +1936,7 @@ const b = {
Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium
let dmg = b.dmgScale * 0.36 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.66) //1 - 0.4 = 0.6 for helix mod 40% damage reduction
q[i].damage(dmg);
q[i].foundPlayer();
if (!mech.isStealth) q[i].foundPlayer();
game.drawList.push({ //add dmg to draw queue
x: this.position.x,
y: this.position.y,
@@ -2961,9 +2970,35 @@ const b = {
ammo: 0,
ammoPack: Infinity,
have: false,
nextFireCycle: 0, //use to remember how longs its been since last fire, used to reset count
holdDamage: 1,
holdCount: 0,
fire() {
if (mod.isLaserHealth) {
if (this.nextFireCycle === mech.cycle) { //ramp up damage
this.holdDamage += 0.01
if (this.holdDamage > 4) this.holdDamage = 4
this.holdCount += this.holdDamage
if (this.holdCount > 180) {
this.holdCount = 0;
const size = 15
const dmg = (mod.largerHeals * (size / 40 / Math.sqrt(mod.largerHeals) / (game.healScale ** 0.25)) ** 2) / mech.harmReduction() * game.healScale
if (mech.health < 0.15) {
mech.fireCDcycle = mech.cycle + 120; // fire cool down if about to die
} else {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal", true, false, size);
mech.damage(dmg, false)
}
}
} else {
this.holdDamage = 1
this.holdCount = 0;
}
this.nextFireCycle = mech.cycle + 1
}
const reflectivity = 1 - 1 / (mod.laserReflections * 1.5)
let damage = b.dmgScale * mod.laserDamage
let damage = b.dmgScale * mod.laserDamage * this.holdDamage
if (mech.energy < mod.laserFieldDrain) {
mech.fireCDcycle = mech.cycle + 100; // cool down if out of energy
} else {
@@ -3097,7 +3132,7 @@ const b = {
ctx.fillStyle = color;
ctx.strokeStyle = color;
ctx.lineWidth = 2;
ctx.lineWidth = 2 * this.holdDamage;
ctx.lineDashOffset = 300 * Math.random()
ctx.setLineDash([50 + 120 * Math.random(), 50 * Math.random()]);
for (let i = 1, len = path.length; i < len; ++i) {
@@ -3184,8 +3219,8 @@ const b = {
};
if (mod.isPulseAim) { //find mobs in line of sight
let dist = 2200
energy = 0.23 * Math.min(mech.energy, 1.75)
explosionRange = 1300 * energy
energy = 0.23 * Math.min(mech.energy, 1.5)
explosionRange = 1400 * energy
for (let i = 0, len = mob.length; i < len; i++) {
const newDist = Vector.magnitude(Vector.sub(path[0], mob[i].position))
if (explosionRange < newDist &&
@@ -3215,9 +3250,9 @@ const b = {
if (best.who) b.explosion(path[1], explosionRange, true)
mech.fireCDcycle = mech.cycle + Math.floor(25 * b.fireCD); // cool down
} else {
energy = 0.3 * Math.min(mech.energy, 1.75)
energy = 0.27 * Math.min(mech.energy, 1.5)
mech.energy -= energy * mod.isLaserDiode
explosionRange = 1200 * energy
explosionRange = 1300 * energy
if (best.who) b.explosion(path[1], explosionRange, true)
mech.fireCDcycle = mech.cycle + Math.floor(50 * b.fireCD); // cool down
}

View File

@@ -154,10 +154,11 @@ function collisionChecks(event) {
if (mod.mods[i].count > 0) have.push(i)
}
const choose = have[Math.floor(Math.random() * have.length)]
game.makeTextLog(`<div class='circle mod'></div> &nbsp; <strong>${mod.mods[choose].name}</strong> ejected by Bayesian statistics`, 300) //message about what mod was lost
game.makeTextLog(`<div class='circle mod'></div> &nbsp; <strong>${mod.mods[choose].name}</strong> ejected by Bayesian statistics`, 600) //message about what mod was lost
for (let i = 0; i < mod.mods[choose].count; i++) powerUps.spawn(mech.pos.x, mech.pos.y, "mod");
mod.mods[choose].count = 0;
mod.mods[choose].remove(); // remove a random mod form the list of mods you have
mod.mods[choose].isLost = true;
game.updateModHUD();
mech.fieldCDcycle = mech.cycle + 30; //disable field so you can't pick up the ejected mod
}
@@ -203,7 +204,7 @@ function collisionChecks(event) {
if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) {
let dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5
mob[k].foundPlayer();
if (!mech.isStealth) mob[k].foundPlayer();
mob[k].damage(dmg);
obj.onDmg(mob[k]); //some bullets do actions when they hits things, like despawn //forces don't seem to work here
game.drawList.push({ //add dmg to draw queue
@@ -224,7 +225,7 @@ function collisionChecks(event) {
mob[k].damage(dmg, true);
const stunTime = dmg / Math.sqrt(obj.mass)
if (stunTime > 0.5) mobs.statusStun(mob[k], 30 + 60 * Math.sqrt(stunTime))
if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer();
if (mob[k].distanceToPlayer2() < 1000000 && !mech.isStealth) mob[k].foundPlayer();
game.drawList.push({
x: pairs[i].activeContacts[0].vertex.x,
y: pairs[i].activeContacts[0].vertex.y,

View File

@@ -311,7 +311,10 @@ const game = {
updateModHUD() {
let text = ""
for (let i = 0, len = mod.mods.length; i < len; i++) { //add mods
if (mod.mods[i].count > 0) {
if (mod.mods[i].isLost) {
if (text) text += "<br>" //add a new line, but not on the first line
text += `<span style="text-decoration: line-through;">${mod.mods[i].name}</span>`
} else if (mod.mods[i].count > 0) {
if (text) text += "<br>" //add a new line, but not on the first line
text += mod.mods[i].name
if (mod.mods[i].nameInfo) {
@@ -709,6 +712,7 @@ const game = {
if (game.isCommunityMaps) {
level.levels.push("stronghold");
level.levels.push("basement");
level.levels.push("house");
// level.levels.push("newLevel");
}
level.levels = shuffle(level.levels); //shuffles order of maps

File diff suppressed because it is too large Load Diff

View File

@@ -297,6 +297,13 @@ const mobs = {
// this.locatePlayer();
// }
// },
alwaysSeePlayer() {
if (!mech.isStealth) {
this.seePlayer.recall = true;
this.seePlayer.position.x = player.position.x;
this.seePlayer.position.y = player.position.y;
}
},
seePlayerCheck() {
if (!(game.cycle % this.seePlayerFreq)) {
if (
@@ -1051,7 +1058,7 @@ const mobs = {
} else if (Math.random() < 0.3 && !mod.isSuperDeterminism) {
type = "reroll"
}
for (let i = 0, len = Math.ceil(2.8 * Math.random()); i < len; i++) {
for (let i = 0, len = Math.ceil(2 * Math.random()); i < len; i++) {
powerUps.spawn(this.position.x, this.position.y, type);
}
}

View File

@@ -350,7 +350,7 @@ const mod = {
},
{
name: "zoospore vector",
description: "mobs produce <strong class='color-p' style='letter-spacing: 2px;'>spores</strong> when they <strong>die</strong><br><strong>11%</strong> chance",
description: "mobs produce <strong class='color-p' style='letter-spacing: 2px;'>spores</strong> when they <strong>die</strong><br><strong>9%</strong> chance",
maxCount: 9,
count: 0,
allowed() {
@@ -358,7 +358,7 @@ const mod = {
},
requires: "",
effect() {
mod.sporesOnDeath += 0.11;
mod.sporesOnDeath += 0.09;
for (let i = 0; i < 10; i++) {
b.spore(mech.pos)
}
@@ -433,13 +433,14 @@ const mod = {
},
{
name: "electric reactive armor",
description: "<strong class='color-e'>explosions</strong> do no <strong class='color-harm'>harm</strong><br> while your <strong class='color-f'>energy</strong> is <strong>full</strong>",
// description: "<strong class='color-e'>explosions</strong> do no <strong class='color-harm'>harm</strong><br> while your <strong class='color-f'>energy</strong> is above <strong>98%</strong>",
description: "<strong class='color-harm'>harm</strong> from <strong class='color-e'>explosions</strong> is passively reduced<br>by <strong>6%</strong> for every <strong>10</strong> stored <strong class='color-f'>energy</strong>",
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("missiles") || mod.haveGunCheck("flak") || mod.haveGunCheck("grenades") || mod.haveGunCheck("vacuum bomb") || mod.isMissileField || mod.isExplodeMob
},
requires: "an explosive gun",
requires: "an explosive damage source",
effect: () => {
mod.isImmuneExplosion = true;
},
@@ -447,6 +448,22 @@ const mod = {
mod.isImmuneExplosion = false;
}
},
{
name: "scrap bots",
description: "<strong>11%</strong> chance to build a <strong>bot</strong> after killing a mob<br>the bot only functions until the end of the level",
maxCount: 6,
count: 0,
allowed() {
return mod.totalBots() > 0
},
requires: "a bot",
effect() {
mod.isBotSpawner += 0.11;
},
remove() {
mod.isBotSpawner = 0;
}
},
{
name: "bot fabrication",
description: "anytime you collect <strong>4</strong> <strong class='color-r'>rerolls</strong><br>use them to build a <strong>random bot</strong>",
@@ -620,22 +637,6 @@ const mod = {
}
}
},
{
name: "scrap bots",
description: "<strong>11%</strong> chance to build a <strong>bot</strong> after killing a mob<br>the bot only functions until the end of the level",
maxCount: 6,
count: 0,
allowed() {
return mod.totalBots() > 0
},
requires: "a bot",
effect() {
mod.isBotSpawner += 0.11;
},
remove() {
mod.isBotSpawner = 0;
}
},
{
name: "perimeter defense",
description: "reduce <strong class='color-harm'>harm</strong> by <strong>4%</strong><br>for each of your permanent <strong>bots</strong>",
@@ -796,7 +797,7 @@ const mod = {
},
{
name: "liquid cooling",
description: `<strong class='color-s'>freeze</strong> all mobs for <strong>6</strong> seconds<br>after receiving <strong class='color-harm'>harm</strong>`,
description: `<strong class='color-s'>freeze</strong> all mobs for <strong>5</strong> seconds<br>after receiving <strong class='color-harm'>harm</strong>`,
maxCount: 1,
count: 0,
allowed() {
@@ -878,6 +879,7 @@ const mod = {
document.getElementById("health-bg").style.display = "none"
document.getElementById("dmg").style.backgroundColor = "#0cf";
mod.isEnergyHealth = true;
mech.displayHealth();
},
remove() {
mod.isEnergyHealth = false;
@@ -885,6 +887,8 @@ const mod = {
document.getElementById("health-bg").style.display = "inline"
document.getElementById("dmg").style.backgroundColor = "#f67";
mech.health = Math.min(mech.maxHealth, mech.energy);
mech.displayHealth();
}
},
{
@@ -1061,7 +1065,7 @@ const mod = {
},
{
name: "bubble fusion",
description: "after destroying a mob's <strong>shield</strong><br>spawn <strong>1-3</strong> <strong class='color-h'>heals</strong>, <strong class='color-g'>ammo</strong>, or <strong class='color-r'>rerolls</strong>",
description: "after destroying a mob's <strong>shield</strong><br>spawn <strong>1-2</strong> <strong class='color-h'>heals</strong>, <strong class='color-g'>ammo</strong>, or <strong class='color-r'>rerolls</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1394,8 +1398,9 @@ const mod = {
for (let i = 0; i < 2 * mod.mods[choose].count; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
}
mod.mods[choose].remove(); // remove a random mod form the list of mods you have
mod.mods[choose].count = 0;
mod.mods[choose].remove(); // remove a random mod form the list of mods you have
mod.mods[choose].isLost = true
game.updateModHUD();
},
remove() {}
@@ -2018,7 +2023,7 @@ const mod = {
},
{
name: "harvester",
description: "after a <strong>drone</strong> picks up a <strong>power up</strong>,<br>it's <strong>bigger</strong>, <strong>faster</strong>, and infinitely <strong>durable</strong>",
description: "after a <strong>drone</strong> picks up a <strong>power up</strong>,<br>it's <strong>larger</strong>, <strong>faster</strong>, and infinitely <strong>durable</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -2198,6 +2203,22 @@ const mod = {
mod.laserFieldDrain = 0.0016;
}
},
{
name: "waste heat recovery",
description: "<strong>laser</strong> <strong class='color-d'>damage</strong> grows by <strong>400%</strong> as you fire<br>but you periodically <strong>eject</strong> your <strong class='color-h'>health</strong>",
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("laser")
},
requires: "laser",
effect() {
mod.isLaserHealth = true;
},
remove() {
mod.isLaserHealth = false
}
},
{
name: "shock wave",
description: "mobs caught in <strong>pulse's</strong> explosion are <strong>stunned</strong><br>for up to <strong>2 seconds</strong>",
@@ -2738,5 +2759,6 @@ const mod = {
isEnergyNoAmmo: null,
isFreezeHarmImmune: null,
isSmallExplosion: null,
isExplosionHarm: null
isExplosionHarm: null,
isLaserHealth: null
}

View File

@@ -487,7 +487,7 @@ const mech = {
}
return dmg
},
damage(dmg) {
damage(dmg, isShowRed = true) {
mech.lastHarmCycle = mech.cycle
if (mod.isDroneOnDamage) { //chance to build a drone on damage from mod
const len = Math.min((dmg - 0.06 * Math.random()) * 40, 40)
@@ -552,8 +552,10 @@ const mech = {
}
}
mech.displayHealth();
document.getElementById("dmg").style.transition = "opacity 0s";
document.getElementById("dmg").style.opacity = 0.1 + Math.min(0.6, dmg * 4);
if (isShowRed) {
document.getElementById("dmg").style.transition = "opacity 0s";
document.getElementById("dmg").style.opacity = 0.1 + Math.min(0.6, dmg * 4);
}
}
if (dmg > 0.06 / mech.holdingMassScale) mech.drop(); //drop block if holding
@@ -577,11 +579,11 @@ const mech = {
mech.defaultFPSCycle = mech.cycle + 20 + Math.min(90, Math.floor(200 * dmg))
if (mod.isHarmFreeze) { //freeze all mobs
for (let i = 0, len = mob.length; i < len; i++) {
mobs.statusSlow(mob[i], 360)
mobs.statusSlow(mob[i], 300)
}
}
} else {
if (dmg > 0.05) { // freeze game for high damage hits
if (dmg > 0.05 && isShowRed) { // freeze game for high damage hits
game.fpsCap = 4 //40 - Math.min(25, 100 * dmg)
game.fpsInterval = 1000 / game.fpsCap;
} else {

View File

@@ -132,8 +132,12 @@ const powerUps = {
mech.addHealth(heal);
}
}
},
spawn() { //used to spawn a heal with a specific size / heal amount, not normally used
}
},
ammo: {
name: "ammo",
color: "#467",
@@ -534,10 +538,9 @@ const powerUps = {
powerUps.spawnRandomPowerUp(x, y);
}
},
directSpawn(x, y, target, moving = true, mode = null) {
directSpawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
let index = powerUp.length;
target = powerUps[target];
size = target.size();
powerUp[index] = Matter.Bodies.polygon(x, y, 0, size, {
density: 0.001,
frictionAir: 0.03,
@@ -564,12 +567,12 @@ const powerUps = {
}
World.add(engine.world, powerUp[index]); //add to world
},
spawn(x, y, target, moving = true, mode = null) {
spawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
if (
!(mod.isSuperDeterminism && (target === 'gun' || target === 'field' || target === 'reroll')) &&
!(mod.isEnergyNoAmmo && target === 'ammo')
) {
powerUps.directSpawn(x, y, target, moving, mode)
powerUps.directSpawn(x, y, target, moving, mode, size)
if (mod.isBayesian && Math.random() < 0.17) powerUps.directSpawn(x, y, target, moving, mode)
}
},

View File

@@ -245,7 +245,7 @@ const spawn = {
powerUps.spawnBossPowerUp(me.position.x, me.position.y)
powerUps.spawn(me.position.x, me.position.y, "heal");
powerUps.spawn(me.position.x, me.position.y, "ammo");
} else {
} else if (!mech.isStealth) {
me.foundPlayer();
}
@@ -1916,10 +1916,7 @@ const spawn = {
me.collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet;
me.do = function () {
// this.seePlayer.yes = false;
this.seePlayer.recall = true;
this.seePlayer.position.x = player.position.x;
this.seePlayer.position.y = player.position.y;
this.alwaysSeePlayer()
this.attraction();
this.timeLimit();
};
@@ -2126,6 +2123,32 @@ const spawn = {
this.checkStatus();
};
},
//fan made mobs *****************************************************************************************
//*******************************************************************************************************
mobBloc(x, y, radius, color) {
mobs.spawn(x, y, 4, radius, color);
let me = mob[mob.length - 1];
me.stroke = "transparent";
me.startingPosition = {
x: x,
y: y
}
Matter.Body.setDensity(me, 0.002);
me.leaveBody = false;
me.isStatic = true;
me.showHealthBar = false;
me.collisionFilter.category = cat.map;
me.collisionFilter.mask = cat.powerUp | cat.map | cat.player | cat.bullet | cat.body
me.rotateVelocity = 0
me.do = function () {
Matter.Body.setVelocity(this, {
x: 0,
y: 0
});
Matter.Body.setPosition(this, this.startingPosition);
this.checkStatus();
};
},
//complex constrained mob templates**********************************************************************
//*******************************************************************************************************
allowShields: true,

View File

@@ -1,12 +1,20 @@
mod: recursion - gives missiles a 30% chance to spawn a larger missile when they explode
mod: electric reactive armor - immune to harm from explosions while energy is full (was 80%)
mod: electric reactive armor - reduce harm from explosions by 6% for every 10 energy
mod: waste heat recovery - laser damage grows to 400%, but you start to eject your health as a heal power up
mod: ammonium nitrate - explosions are 60% bigger, but they do 300% more damage to you
mod: trinitrotoluene - explosions are 50% smaller and do 71% more damage
new community level by Francois: house
************** TODO - n-gon **************
a bot that eats up health and ammo, but poops a reroll after picking up 2 power ups
it passes through walls
moves slower then the player so you can get to it before the bot if you hurry
4 rerolls can convert to a bot, also 1 rerolls can convert to 5% damage
the mods that do those effects could be required before you see this bot
disable crystalized armor?
laser-bot orbits player
mod: radiation effects can spread to nearby mobs
mod: foam is attracted to mobs