foam damage mod

This commit is contained in:
landgreen
2020-08-16 06:44:47 -07:00
parent e157ab76db
commit cc8c101776
5 changed files with 86 additions and 67 deletions

View File

@@ -624,7 +624,7 @@ const b = {
onDmg(who) { onDmg(who) {
mobs.statusSlow(who, 60) mobs.statusSlow(who, 60)
this.endCycle = game.cycle this.endCycle = game.cycle
if (mod.isHeavyWater) mobs.statusDoT(who, 0.1, 180) if (mod.isHeavyWater) mobs.statusDoT(who, 0.1, 300)
}, },
onEnd() {}, onEnd() {},
do() { do() {
@@ -681,7 +681,7 @@ const b = {
friction: 0.05, friction: 0.05,
frictionAir: 0, frictionAir: 0,
restitution: 1, restitution: 1,
dmg: 0.28, //damage done in addition to the damage from momentum dmg: 0.24, //damage done in addition to the damage from momentum
lookFrequency: 80 + Math.floor(23 * Math.random()), lookFrequency: 80 + Math.floor(23 * Math.random()),
endCycle: game.cycle + Math.floor((1100 + 420 * Math.random()) * mod.isBulletsLastLonger), endCycle: game.cycle + Math.floor((1100 + 420 * Math.random()) * mod.isBulletsLastLonger),
classType: "bullet", classType: "bullet",
@@ -794,13 +794,14 @@ const b = {
radius *= Math.sqrt(mod.bulletSize) radius *= Math.sqrt(mod.bulletSize)
const me = bullet.length; const me = bullet.length;
bullet[me] = Bodies.polygon(position.x, position.y, 20, radius, { bullet[me] = Bodies.polygon(position.x, position.y, 20, radius, {
angle: 0, // angle: 0,
density: 0.00005, // 0.001 is normal density density: 0.00005, // 0.001 is normal density
inertia: Infinity, inertia: Infinity,
frictionAir: 0.003, frictionAir: 0.003,
friction: 0.2, // friction: 0.2,
restitution: 0.2, // restitution: 0.2,
dmg: 0.1, //damage done in addition to the damage from momentum dmg: mod.isFastFoam ? 0.02 : 0.0055, //damage done in addition to the damage from momentum
scale: 1 - 0.005 / mod.isBulletsLastLonger * (mod.isFastFoam ? 1.7 : 1),
classType: "bullet", classType: "bullet",
collisionFilter: { collisionFilter: {
category: cat.bullet, category: cat.bullet,
@@ -845,31 +846,6 @@ const b = {
onEnd() {}, onEnd() {},
do() { do() {
if (!mech.isBodiesAsleep) { //if time dilation isn't active if (!mech.isBodiesAsleep) { //if time dilation isn't active
//check for touching map
// if (Matter.Query.collides(this, map).length > 0) {
if (Matter.Query.point(map, this.position).length > 0) {
const slow = 0.85
Matter.Body.setVelocity(this, {
x: this.velocity.x * slow,
y: this.velocity.y * slow
});
const SCALE = 0.96
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
// } else if (Matter.Query.collides(this, body).length > 0) {
} else if (Matter.Query.point(body, this.position).length > 0) {
const slow = 0.9
Matter.Body.setVelocity(this, {
x: this.velocity.x * slow,
y: this.velocity.y * slow
});
const SCALE = 0.96
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
} else {
this.force.y += this.mass * 0.00008; //gravity
}
if (this.count < 20) { if (this.count < 20) {
this.count++ this.count++
//grow //grow
@@ -878,9 +854,8 @@ const b = {
this.radius *= SCALE; this.radius *= SCALE;
} else { } else {
//shrink //shrink
const SCALE = 1 - 0.005 / mod.isBulletsLastLonger Matter.Body.scale(this, this.scale, this.scale);
Matter.Body.scale(this, SCALE, SCALE); this.radius *= this.scale;
this.radius *= SCALE;
if (this.radius < 8) this.endCycle = 0; if (this.radius < 8) this.endCycle = 0;
} }
@@ -896,13 +871,13 @@ const b = {
// Matter.Body.setAngularVelocity(this.target, this.target.angularVelocity * 0.9) // Matter.Body.setAngularVelocity(this.target, this.target.angularVelocity * 0.9)
if (this.target.isShielded) { if (this.target.isShielded) {
this.target.damage(b.dmgScale * 0.005, true); //shield damage bypass this.target.damage(b.dmgScale * this.dmg, true); //shield damage bypass
//shrink if mob is shielded //shrink if mob is shielded
const SCALE = 1 - 0.018 / mod.isBulletsLastLonger const SCALE = 1 - 0.018 / mod.isBulletsLastLonger
Matter.Body.scale(this, SCALE, SCALE); Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE; this.radius *= SCALE;
} else { } else {
this.target.damage(b.dmgScale * 0.005); this.target.damage(b.dmgScale * this.dmg);
} }
} else if (this.target !== null) { //look for a new target } else if (this.target !== null) { //look for a new target
this.target = null this.target = null
@@ -931,7 +906,27 @@ const b = {
} }
} }
} }
} else if (Matter.Query.point(map, this.position).length > 0) { //slow when touching map or blocks
const slow = 0.85
Matter.Body.setVelocity(this, {
x: this.velocity.x * slow,
y: this.velocity.y * slow
});
const SCALE = 0.96
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
// } else if (Matter.Query.collides(this, body).length > 0) {
} else if (Matter.Query.point(body, this.position).length > 0) {
const slow = 0.9
Matter.Body.setVelocity(this, {
x: this.velocity.x * slow,
y: this.velocity.y * slow
});
const SCALE = 0.96
Matter.Body.scale(this, SCALE, SCALE);
this.radius *= SCALE;
} else {
this.force.y += this.mass * 0.00008; //gravity
} }
} }
} }
@@ -1843,7 +1838,7 @@ const b = {
// check if inside a mob // check if inside a mob
q = Matter.Query.point(mob, this.position) q = Matter.Query.point(mob, this.position)
for (let i = 0; i < q.length; i++) { for (let i = 0; i < q.length; i++) {
let dmg = b.dmgScale * 0.40 / Math.sqrt(q[i].mass) * (mod.waveHelix === 1 ? 1 : 0.6) //1 - 0.4 = 0.6 for helix mod 40% damage reduction 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].damage(dmg);
q[i].foundPlayer(); q[i].foundPlayer();
game.drawList.push({ //add dmg to draw queue game.drawList.push({ //add dmg to draw queue

View File

@@ -202,9 +202,7 @@ function collisionChecks(event) {
} }
//mob + bullet collisions //mob + bullet collisions
if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) { if (obj.classType === "bullet" && obj.speed > obj.minDmgSpeed) {
// const dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)));
let dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity))) let dmg = b.dmgScale * (obj.dmg + 0.15 * obj.mass * Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)))
// console.log(dmg)
if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5 if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5
mob[k].foundPlayer(); mob[k].foundPlayer();
mob[k].damage(dmg); mob[k].damage(dmg);
@@ -223,7 +221,6 @@ function collisionChecks(event) {
const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity)); const v = Vector.magnitude(Vector.sub(mob[k].velocity, obj.velocity));
if (v > 9) { if (v > 9) {
let dmg = 0.06 * b.dmgScale * v * obj.mass * mod.throwChargeRate; let dmg = 0.06 * b.dmgScale * v * obj.mass * mod.throwChargeRate;
if (mod.isCrit && !mob[k].seePlayer.recall && !mob[k].shield) dmg *= 5
if (mob[k].isShielded) dmg *= 0.35 if (mob[k].isShielded) dmg *= 0.35
mob[k].damage(dmg, true); mob[k].damage(dmg, true);
if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer(); if (mob[k].distanceToPlayer2() < 1000000) mob[k].foundPlayer();

View File

@@ -79,7 +79,7 @@ const mod = {
}, },
damageFromMods() { damageFromMods() {
let dmg = 1 let dmg = 1
if (mod.isDamageForGuns) dmg *= 1 + 0.066 * b.inventory.length if (mod.isDamageForGuns) dmg *= 1 + 0.07 * b.inventory.length
if (mod.isLowHealthDmg) dmg *= 1 + 0.5 * Math.max(0, 1 - mech.health) if (mod.isLowHealthDmg) dmg *= 1 + 0.5 * Math.max(0, 1 - mech.health)
if (mod.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 2; if (mod.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 2;
if (mod.isEnergyLoss) dmg *= 1.33; if (mod.isEnergyLoss) dmg *= 1.33;
@@ -175,22 +175,6 @@ const mod = {
mod.isFarAwayDmg = false; mod.isFarAwayDmg = false;
} }
}, },
{
name: "fracture analysis",
description: "increase <strong class='color-d'>damage</strong> by <strong>400%</strong><br>for mobs that are <strong>unaware</strong> of you",
maxCount: 1,
count: 0,
allowed() {
return true
},
requires: "",
effect() {
mod.isCrit = true;
},
remove() {
mod.isCrit = false;
}
},
{ {
name: "fluoroantimonic acid", name: "fluoroantimonic acid",
description: "increase <strong class='color-d'>damage</strong> by <strong>40%</strong><br>when your base <strong>health</strong> is above <strong>100%</strong>", description: "increase <strong class='color-d'>damage</strong> by <strong>40%</strong><br>when your base <strong>health</strong> is above <strong>100%</strong>",
@@ -1068,7 +1052,7 @@ const mod = {
}, },
{ {
name: "arsenal", name: "arsenal",
description: "increase <strong class='color-d'>damage</strong> by <strong>6.6%</strong><br>for each <strong class='color-g'>gun</strong> in your inventory", description: "increase <strong class='color-d'>damage</strong> by <strong>7%</strong><br>for each <strong class='color-g'>gun</strong> in your inventory",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1610,7 +1594,7 @@ const mod = {
}, },
{ {
name: "wave packet", name: "wave packet",
description: "<strong>wave beam</strong> emits <strong>two</strong> oscillating particles<br>decrease wave <strong class='color-d'>damage</strong> by <strong>40%</strong>", description: "<strong>wave beam</strong> emits <strong>two</strong> oscillating particles<br>decrease wave <strong class='color-d'>damage</strong> by <strong>33%</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1969,7 +1953,7 @@ const mod = {
}, },
{ {
name: "heavy water", name: "heavy water",
description: "<strong>ice IX</strong> is synthesized with an extra neutron<br>does <strong class='color-p'>radioactive</strong> <strong class='color-d'>damage</strong> over <strong>3</strong> seconds", description: "<strong>ice IX</strong> is synthesized with an extra neutron<br>does <strong class='color-p'>radioactive</strong> <strong class='color-d'>damage</strong> over <strong>5</strong> seconds",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -1999,6 +1983,22 @@ const mod = {
mod.isFoamGrowOnDeath = false; mod.isFoamGrowOnDeath = false;
} }
}, },
{
name: "colloidal foam",
description: "increase <strong>foam</strong> <strong class='color-d'>damage</strong> by <strong>200%</strong><br><strong>foam</strong> dissipates <strong>50%</strong> faster",
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("foam") || mod.foamBotCount > 2
},
requires: "foam",
effect() {
mod.isFastFoam = true
},
remove() {
mod.isFastFoam = false;
}
},
{ {
name: "frame-dragging", name: "frame-dragging",
description: "<strong>slow time</strong> while charging the <strong>rail gun</strong><br>charging no longer drains <strong class='color-f'>energy</strong>", description: "<strong>slow time</strong> while charging the <strong>rail gun</strong><br>charging no longer drains <strong class='color-f'>energy</strong>",
@@ -2138,7 +2138,7 @@ const mod = {
}, },
{ {
name: "timelike world line", name: "timelike world line",
description: "<strong>time dilation</strong> doubles your time <strong>rate</strong><br>and makes you <strong>immune</strong> to <strong class='color-harm'>harm</strong>", description: "<strong>time dilation</strong> doubles your relative time <strong>rate</strong><br>and makes you <strong>immune</strong> to <strong class='color-harm'>harm</strong>",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -2156,7 +2156,7 @@ const mod = {
}, },
{ {
name: "Lorentz transformation", name: "Lorentz transformation",
description: "<strong>move</strong>, <strong>jump</strong>, and <strong>shoot</strong> <strong>33%</strong> faster", description: "permanently increase your relative time rate<br><strong>move</strong>, <strong>jump</strong>, and <strong>shoot</strong> <strong>33%</strong> faster",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -2194,7 +2194,7 @@ const mod = {
}, },
{ {
name: "plasma-bot", name: "plasma-bot",
description: "a bot uses <strong class='color-f'>energy</strong> to emit short range <strong>plasma</strong><br>plasma <strong class='color-d'>damages</strong> and <strong>pushes</strong> mobs", description: "a bot uses <strong class='color-f'>energy</strong> to emit short range <strong>plasma</strong><br>that <strong class='color-d'>damages</strong> and <strong>pushes</strong> mobs",
maxCount: 1, maxCount: 1,
count: 0, count: 0,
allowed() { allowed() {
@@ -2389,6 +2389,22 @@ const mod = {
mod.superposition = false; mod.superposition = false;
} }
}, },
{
name: "fracture analysis",
description: "bullet impacts do <strong>500%</strong> <strong class='color-d'>damage</strong><br>to mobs that are <strong>unaware</strong> of you or <strong>stunned</strong>",
maxCount: 1,
count: 0,
allowed() {
return mod.isStunField || mech.fieldUpgrades[mech.fieldMode].name === "phase decoherence field"
},
requires: "phase decoherence field or flux pinning",
effect() {
mod.isCrit = true;
},
remove() {
mod.isCrit = false;
}
},
{ {
name: "Bose Einstein condensate", name: "Bose Einstein condensate",
description: "<strong>mobs</strong> in superposition with the <strong>pilot wave</strong><br>are <strong class='color-s'>frozen</strong> for <strong>2</strong> seconds", description: "<strong>mobs</strong> in superposition with the <strong>pilot wave</strong><br>are <strong class='color-s'>frozen</strong> for <strong>2</strong> seconds",
@@ -2420,6 +2436,7 @@ const mod = {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
} }
this.count--
}, },
remove() {} remove() {}
}, },
@@ -2438,6 +2455,7 @@ const mod = {
powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); powerUps.spawn(mech.pos.x, mech.pos.y, "ammo");
if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo"); if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "ammo");
} }
this.count--
}, },
remove() {} remove() {}
}, },
@@ -2457,6 +2475,7 @@ const mod = {
powerUps.spawn(mech.pos.x, mech.pos.y, "reroll"); powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll"); if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "reroll");
} }
this.count--
}, },
remove() {} remove() {}
}, },
@@ -2473,6 +2492,7 @@ const mod = {
effect() { effect() {
powerUps.spawn(mech.pos.x, mech.pos.y, "gun"); powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "gun"); if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
this.count--
}, },
remove() {} remove() {}
}, },
@@ -2489,6 +2509,7 @@ const mod = {
effect() { effect() {
powerUps.spawn(mech.pos.x, mech.pos.y, "field"); powerUps.spawn(mech.pos.x, mech.pos.y, "field");
if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "field"); if (Math.random() < mod.bayesian) powerUps.spawn(mech.pos.x, mech.pos.y, "field");
this.count--
}, },
remove() {} remove() {}
}, },
@@ -2610,5 +2631,6 @@ const mod = {
isDroneGrab: null, isDroneGrab: null,
isOneGun: null, isOneGun: null,
isDamageForGuns: null, isDamageForGuns: null,
isGunCycle: null isGunCycle: null,
isFastFoam: null
} }

View File

@@ -496,8 +496,6 @@ const powerUps = {
if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "gun") if (Math.random() < mod.bayesian) powerUps.spawn(x, y, "gun")
} }
} }
}, },
chooseRandomPowerUp(x, y) { //100% chance to drop a random power up //used in spawn.debris chooseRandomPowerUp(x, y) { //100% chance to drop a random power up //used in spawn.debris
if (Math.random() < 0.5) { if (Math.random() < 0.5) {
@@ -526,6 +524,8 @@ const powerUps = {
} else { } else {
powerUps.spawn(x, y, "ammo", false); powerUps.spawn(x, y, "ammo", false);
powerUps.spawn(x, y, "ammo", false); powerUps.spawn(x, y, "ammo", false);
powerUps.spawn(x, y, "ammo", false);
powerUps.spawn(x, y, "ammo", false);
} }
} else { } else {
powerUps.spawnRandomPowerUp(x, y); powerUps.spawnRandomPowerUp(x, y);

View File

@@ -1,5 +1,10 @@
mods: foam does 200% more damage, but dissolves 50% faster
************** TODO - n-gon ************** ************** TODO - n-gon **************
Mod: "Instant Acceleration": Minigun instantly starts firing at max fire rate, skipping the accelerated fire rate stage. Mod: "Instant Acceleration": Minigun instantly starts firing at max fire rate, skipping the accelerated fire rate stage.
level Boss: fractal Sierpiński triangle level Boss: fractal Sierpiński triangle