mod water shielding

This commit is contained in:
landgreen
2020-05-07 06:04:57 -07:00
parent a7ad085deb
commit 982ca94164
3 changed files with 25 additions and 73 deletions

View File

@@ -1229,6 +1229,22 @@ const b = {
b.isModVacuumShield = false; b.isModVacuumShield = false;
} }
}, },
{
name: "water shielding",
description: "increase <strong>neutron bomb's</strong> range by <strong>20%</strong><br>player is <strong>immune</strong> to its harmful effects",
maxCount: 3,
count: 0,
allowed() {
return b.haveGunCheck("neutron bomb")
},
requires: "neutron bomb",
effect() {
b.isModNeutronImmune = true
},
remove() {
b.isModNeutronImmune = false
}
},
{ {
name: "inertial confinement", name: "inertial confinement",
description: "<strong>neutron bomb's</strong> initial detonation <br><strong>stuns</strong> nearby mobs for <strong>+1</strong> seconds", description: "<strong>neutron bomb's</strong> initial detonation <br><strong>stuns</strong> nearby mobs for <strong>+1</strong> seconds",
@@ -3279,7 +3295,7 @@ const b = {
name: "neutron bomb", name: "neutron bomb",
description: "toss a chunk of <strong class='color-p'>Cf-252</strong> that emits <strong class='color-p'>neutrons</strong><br><strong class='color-d'>damages</strong> and drains <strong class='color-f'>energy</strong> in area of effect", description: "toss a chunk of <strong class='color-p'>Cf-252</strong> that emits <strong class='color-p'>neutrons</strong><br><strong class='color-d'>damages</strong> and drains <strong class='color-f'>energy</strong> in area of effect",
ammo: 0, ammo: 0,
ammoPack: 6, ammoPack: 7,
have: false, have: false,
isStarterGun: false, isStarterGun: false,
isEasyToAim: true, isEasyToAim: true,
@@ -3296,7 +3312,7 @@ const b = {
bullet[me].restitution = 0; bullet[me].restitution = 0;
bullet[me].minDmgSpeed = 0; bullet[me].minDmgSpeed = 0;
bullet[me].damageRadius = 100; bullet[me].damageRadius = 100;
bullet[me].maxDamageRadius = 450 + 150 * Math.random() bullet[me].maxDamageRadius = (450 + 150 * Math.random()) * (b.isModNeutronImmune ? 1.2 : 1)
bullet[me].stuckTo = null; bullet[me].stuckTo = null;
bullet[me].stuckToRelativePosition = null; bullet[me].stuckToRelativePosition = null;
bullet[me].onDmg = function () {}; bullet[me].onDmg = function () {};
@@ -3389,63 +3405,9 @@ const b = {
} }
} }
// if (Matter.Query.collides(this, map).length || bodyCollisions.length || mobCollisions.length) {
// if (mobCollisions.length) {
// this.isStuck = true;
// this.stuckTo = mobCollisions[0].bodyA
// this.stuckToRelativePosition = Vector.rotate(Vector.sub(this.position, this.stuckTo.position), this.stuckTo.angle)
// } else if (bodyCollisions.length) {
// this.isStuck = true;
// this.stuckTo = bodyCollisions[0].bodyA
// this.stuckToRelativePosition = Vector.rotate(Vector.sub(this.position, this.stuckTo.position), this.stuckTo.angle)
// }
// if (b.isModNeutronStun) {
// //push blocks
// const dist = this.maxDamageRadius * 0.9
// for (let i = 0, len = body.length; i < len; ++i) {
// const SUB = Vector.sub(body[i].position, this.position)
// const DISTANCE = Vector.magnitude(SUB)
// if (DISTANCE < dist) {
// const FORCE = Vector.mult(Vector.normalise(SUB), 0.04 * body[i].mass)
// body[i].force.x += FORCE.x;
// body[i].force.y += FORCE.y - body[i].mass * game.g * 5; //kick up a bit to give them some arc
// }
// }
// //stun mobs
// for (let i = 0, len = mob.length; i < len; ++i) {
// if (Vector.magnitude(Vector.sub(mob[i].position, this.position)) < dist) {
// mobs.statusStun(mob[i], b.isModNeutronStun)
// }
// }
// }
// this.collisionFilter.mask = cat.map; //non collide with everything
// Matter.Body.setVelocity(this, {
// x: 0,
// y: 0
// });
// // this.frictionAir = 1;
// this.do = this.radiationMode;
// } else {
// this.force.y += this.mass * 0.001;
// }
}; };
bullet[me].radiationMode = function () { bullet[me].radiationMode = function () {
this.stuck(); //runs different code based on what the bullet is stuck to this.stuck(); //runs different code based on what the bullet is stuck to
// if (this.isStuck) {
// if (this.stuckTo.alive || this.stuckTo.classType === "body") {
// const rotate = Vector.rotate(this.stuckToRelativePosition, this.stuckTo.angle)
// Matter.Body.setPosition(this, Vector.add(rotate, this.stuckTo.position))
// // Matter.Body.setPosition(this, Vector.add(this.stuckToRelativePosition, this.stuckTo.position))
// Matter.Body.setVelocity(this, this.stuckTo.velocity); //so that it will move properly if it gets unstuck
// } else {
// this.isStuck = false;
// // this.force.y += this.mass * 0.5;
// }
// }
if (!mech.isBodiesAsleep) { if (!mech.isBodiesAsleep) {
this.damageRadius = this.damageRadius * 0.85 + 0.15 * this.maxDamageRadius //smooth radius towards max this.damageRadius = this.damageRadius * 0.85 + 0.15 * this.maxDamageRadius //smooth radius towards max
@@ -3455,7 +3417,8 @@ const b = {
this.endCycle = 0; this.endCycle = 0;
} else { } else {
//aoe damage to player //aoe damage to player
if (Vector.magnitude(Vector.sub(player.position, this.position)) < this.damageRadius) {
if (!b.isModNeutronImmune && Vector.magnitude(Vector.sub(player.position, this.position)) < this.damageRadius) {
const DRAIN = 0.0015 const DRAIN = 0.0015
if (mech.energy > DRAIN) { if (mech.energy > DRAIN) {
mech.energy -= DRAIN mech.energy -= DRAIN
@@ -3475,15 +3438,10 @@ const b = {
mob[i].locatePlayer(); mob[i].locatePlayer();
} }
} }
//draw it differently for the initial detonation to make the stun seem logical.
//make draw some electricity?
ctx.beginPath(); ctx.beginPath();
ctx.arc(this.position.x, this.position.y, this.damageRadius, 0, 2 * Math.PI); ctx.arc(this.position.x, this.position.y, this.damageRadius, 0, 2 * Math.PI);
ctx.globalCompositeOperation = "lighter" ctx.globalCompositeOperation = "lighter"
// ctx.fillStyle = `hsla(189,60%,50%,${0.35+0.06*Math.random()})`; ctx.fillStyle = `rgba(25,139,170,${0.3+0.06*Math.random()})`;
ctx.fillStyle = `rgba(20,130,160,${0.35+0.06*Math.random()})`;
ctx.fill(); ctx.fill();
ctx.globalCompositeOperation = "source-over" ctx.globalCompositeOperation = "source-over"
} }

View File

@@ -972,7 +972,7 @@ const mobs = {
this.removeConsBB(); this.removeConsBB();
this.alive = false; //triggers mob removal in mob[i].replace(i) this.alive = false; //triggers mob removal in mob[i].replace(i)
if (this.dropPowerUp) { if (this.dropPowerUp) {
if (b.isModEnergyLoss) mech.energy /= 3; if (b.isModEnergyLoss) mech.energy *= 0.66;
powerUps.spawnRandomPowerUp(this.position.x, this.position.y, this.mass, radius); powerUps.spawnRandomPowerUp(this.position.x, this.position.y, this.mass, radius);
mech.lastKillCycle = mech.cycle; //tracks the last time a kill was made, mostly used in game.checks() mech.lastKillCycle = mech.cycle; //tracks the last time a kill was made, mostly used in game.checks()
if (Math.random() < b.modSporesOnDeath) { if (Math.random() < b.modSporesOnDeath) {

View File

@@ -1,14 +1,8 @@
acute stress mod removes 1/3 (was 1/2) of your energy
zoom works with i and o now
cell boss has double the chance to spilt on damage.
After it splits, each daughter cell has the mother's reduced health
new gun neutron bomb, persistent AoE damage
(might still have issues sticking to objects properly)
new mob neutron bomb stuns mobs
************** TODO - n-gon ************** ************** TODO - n-gon **************
mod - neutron bomb, water shielding, player takess no damage or energy drain
also increase range?
extend neutron mob sticking code to foam gun and mines? extend neutron mob sticking code to foam gun and mines?
phase field is kinda annoying phase field is kinda annoying