mini black hole mobs travel through walls

mod: radioactive contamination - after a mob or shield dies, leftover radiation spreads to a nearby mob

mod: half-wave rectifier - railgun overfills with energy when you charge instead of draining
   removed rail gun mod - frame dragging
bug fixed - rail gun bugs out when your charge speed gets very low

mod: sentry - mines are modified to automatically fire nails at nearby targets for 12 seconds
This commit is contained in:
landgreen
2020-11-08 05:55:45 -08:00
parent a57ff0c4c1
commit e86ec0c37d
8 changed files with 260 additions and 163 deletions

View File

@@ -594,7 +594,11 @@ const b = {
});
Matter.Body.setAngularVelocity(this, 0)
}
this.arm();
if (mod.isMineSentry) {
this.sentry();
} else {
this.arm();
}
//sometimes the mine can't attach to map and it just needs to be reset
const that = this
@@ -619,18 +623,47 @@ const b = {
this.stillCount++
}
}
if (this.stillCount > 25) this.arm();
if (this.stillCount > 25) {
if (mod.isMineSentry) {
this.sentry();
} else {
this.arm();
}
}
},
sentry() {
this.lookFrequency = game.cycle + 60
this.endCycle = game.cycle + 720
this.do = function() { //overwrite the do method for this bullet
this.force.y += this.mass * 0.002; //extra gravity
if (game.cycle > this.lookFrequency) {
this.lookFrequency = 14 + Math.floor(5 * Math.random())
this.do = function() { //overwrite the do method for this bullet
this.force.y += this.mass * 0.002; //extra gravity
if (!(game.cycle % this.lookFrequency) && !mech.isBodiesAsleep) { //find mob targets
b.targetedNail(this.position, 1, 45 + 5 * Math.random(), 1100, false)
if (!(game.cycle % (this.lookFrequency * 6))) {
game.drawList.push({
x: this.position.x,
y: this.position.y,
radius: 8,
color: "#fe0",
time: 4
});
}
}
}
}
}
},
arm() {
this.lookFrequency = game.cycle + 60
this.do = function() { //overwrite the do method for this bullet
this.force.y += this.mass * 0.002; //extra gravity
if (game.cycle > this.lookFrequency) {
this.isArmed = true
this.lookFrequency = 50 + Math.floor(27 * Math.random())
game.drawList.push({
//add dmg to draw queue
x: this.position.x,
y: this.position.y,
radius: 10,
@@ -1138,7 +1171,7 @@ const b = {
World.add(engine.world, bullet[me]); //add bullet to world
Matter.Body.setVelocity(bullet[me], velocity);
},
targetedNail(position, num = 1, speed = 50 + 10 * Math.random(), range = 1200) {
targetedNail(position, num = 1, speed = 50 + 10 * Math.random(), range = 1200, isRandomAim = true) {
const targets = [] //target nearby mobs
for (let i = 0, len = mob.length; i < len; i++) {
if (mob[i].dropPowerUp) {
@@ -1159,7 +1192,7 @@ const b = {
y: targets[index].y + SPREAD * (Math.random() - 0.5)
}
b.nail(position, Vector.mult(Vector.normalise(Vector.sub(WHERE, position)), speed), 1.1)
} else { // aim in random direction
} else if (isRandomAim) { // aim in random direction
const ANGLE = 2 * Math.PI * Math.random()
b.nail(position, {
x: speed * Math.cos(ANGLE),
@@ -2830,8 +2863,8 @@ const b = {
have: false,
fire() {
if (mod.isCapacitor) {
if (mech.energy > 0.15) {
mech.energy -= 0.15
if (mech.energy > 0.16) {
mech.energy -= 0.16
mech.fireCDcycle = mech.cycle + Math.floor(30 * b.fireCD);
const me = bullet.length;
bullet[me] = Bodies.rectangle(mech.pos.x + 50 * Math.cos(mech.angle), mech.pos.y + 50 * Math.sin(mech.angle), 60, 14, {
@@ -2982,7 +3015,7 @@ const b = {
bullet[me].endCycle = Infinity
bullet[me].charge = 0;
bullet[me].do = function() {
if (mech.energy < 0.005 && !mod.isRailTimeSlow) {
if (mech.energy < 0.005 && !mod.isRailEnergyGain) {
mech.energy += 0.05 + this.charge * 0.3
mech.fireCDcycle = mech.cycle + 120; // cool down if out of energy
this.endCycle = 0;
@@ -2995,10 +3028,6 @@ const b = {
this.do = function() {
this.force.y += this.mass * 0.0003 / this.charge; // low gravity that scales with charge
}
if (mod.isRailTimeSlow) {
game.fpsCap = game.fpsCapDefault
game.fpsInterval = 1000 / game.fpsCap;
}
Matter.Body.scale(this, 8000, 8000) // show the bullet by scaling it up (don't judge me... I know this is a bad way to do it)
this.endCycle = game.cycle + 140
@@ -3045,17 +3074,20 @@ const b = {
}
} else { // charging on mouse down
mech.fireCDcycle = Infinity //can't fire until mouse is released
const lastCharge = this.charge
let chargeRate = (mech.crouch) ? 0.98 : 0.984
chargeRate *= Math.pow(b.fireCD, 0.03)
this.charge = this.charge * chargeRate + (1 - chargeRate) // this.charge converges to 1
if (mod.isRailTimeSlow) {
game.fpsCap = 30 //new fps
game.fpsInterval = 1000 / game.fpsCap;
const previousCharge = this.charge
let smoothRate = 0.98 * (mech.crouch ? 0.99 : 1) * (0.98 + 0.02 * b.fireCD) //small b.fireCD = faster shots, b.fireCD=1 = normal shot, big b.fireCD = slower chot
this.charge = this.charge * smoothRate + 1 * (1 - smoothRate)
// let chargeRate = (mech.crouch) ? 0.98 : 0.984
// chargeRate *= Math.pow(b.fireCD, 0.03)
// this.charge = this.charge * chargeRate + (1 - chargeRate) // this.charge converges to 1
if (mod.isRailEnergyGain) {
mech.energy += (this.charge - previousCharge) * 1.66 //energy drain is proportional to charge gained, but doesn't stop normal mech.fieldRegen
} else {
mech.energy -= (this.charge - lastCharge) * 0.28 //energy drain is proportional to charge gained, but doesn't stop normal mech.fieldRegen
mech.energy -= (this.charge - previousCharge) * 0.33 //energy drain is proportional to charge gained, but doesn't stop normal mech.fieldRegen
}
//draw targeting
let best;
let range = 3000

View File

@@ -724,7 +724,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.05
if (mod.isHealthRecovery) mech.addHealth(0.01)
if (mod.isHealthRecovery) mech.addHealth(0.01 * mech.maxHealth)
}
if (!(game.cycle % 420)) { //once every 7 seconds

View File

@@ -16,13 +16,9 @@ const level = {
// game.enableConstructMode() //used to build maps in testing mode
// game.zoomScale = 1000;
// game.setZoom();
// mech.isCloak = true;
// mech.setField("wormhole")
// b.giveGuns("laser")
// for (let i = 0; i < 10; i++) {
// mod.giveMod("laser-bot");
// }
// mod.giveMod("cardinality")
b.giveGuns("mine")
mod.giveMod("sentry")
level.intro(); //starting level
@@ -152,11 +148,11 @@ const level = {
// spawn.spawner(1600, -500)
// spawn.sniper(1700, -120, 50)
// spawn.bomberBoss(1400, -500)
spawn.launcher(1800, -120)
spawn.sucker(1800, -120)
// spawn.cellBossCulture(1600, -500)
// spawn.powerUpBoss(1600, -500)
// spawn.sniper(1200, -500)
// spawn.shield(mob[mob.length - 1], 1200, -500, 1);
// spawn.shield(mob[mob.length - 1], 1800, -120, 1);
// spawn.nodeBoss(1200, -500, "launcher")
// spawn.snakeBoss(1200, -500)
@@ -220,16 +216,16 @@ const level = {
document.body.style.backgroundColor = "#ccc";
level.fill.push({
x: 6400,
x: 5400,
y: -550,
width: 300,
height: 350,
color: "rgba(0,255,255,0.1)"
});
spawn.mapRect(-950, 0, 7200, 800); //ground
spawn.mapRect(-950, -1500, 800, 1900); //left wall
spawn.mapRect(-950, -2300, 7200, 800); //roof
spawn.mapRect(-1950, 0, 8200, 1800); //ground
spawn.mapRect(-1950, -1500, 1800, 1900); //left wall
spawn.mapRect(-1950, -3300, 8200, 1800); //roof
spawn.mapRect(-250, -200, 1000, 300); // shelf
spawn.mapRect(-250, -1700, 1000, 1250); // shelf roof
spawn.blockDoor(710, -210);
@@ -238,7 +234,7 @@ const level = {
spawn.mapRect(5400, -1700, 400, 1150); //right wall
spawn.mapRect(5400, -300, 400, 400); //right wall
spawn.mapRect(5700, -2300, 800, 3100); //right wall
spawn.mapRect(5700, -3300, 1800, 5100); //right wall
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump
},

View File

@@ -156,7 +156,7 @@ const mobs = {
who.status.push({
effect() {
if ((game.cycle - this.startCycle) % 30 === 0) {
let dmg = b.dmgScale * tickDamage
let dmg = b.dmgScale * this.dmg
who.damage(dmg);
game.drawList.push({ //add dmg to draw queue
x: who.position.x + (Math.random() - 0.5) * who.radius * 0.5,
@@ -172,7 +172,8 @@ const mobs = {
}
},
endEffect() {},
// type: "DoT",
dmg: tickDamage,
type: "dot",
endCycle: game.cycle + cycles,
startCycle: game.cycle
})
@@ -1060,6 +1061,33 @@ const mobs = {
powerUps.spawn(this.position.x, this.position.y, type);
}
}
if (true) {
//look for dots and spread them
let dmgTotal = 0
for (let i = 0, len = this.status.length; i < len; i++) {
if (this.status[i].type === "dot") dmgTotal += this.status[i].dmg * (this.status[i].endCycle - game.cycle)
}
if (dmgTotal > 0) { //look for closest mob
let closestRadius = 500;
let closestIndex = null;
for (let i = 0, len = mob.length; i < len; ++i) {
const radius = Vector.magnitude(Vector.sub(this.position, mob[i].position))
if (mob[i].alive && !mob[i].isShielded && radius < closestRadius) {
closestRadius = radius
closestIndex = i
}
}
if (closestIndex) mobs.statusDoT(mob[closestIndex], dmgTotal / 180, 180)
//draw AOE
// game.drawList.push({ //add dmg to draw queue
// x: this.position.x,
// y: this.position.y,
// radius: radius,
// color: "rgba(0,80,80,0.03)",
// time: 15
// });
}
}
},
removeConsBB() {
for (let i = 0, len = consBB.length; i < len; ++i) {

View File

@@ -92,7 +92,7 @@ const mod = {
if (mod.restDamage > 1 && player.speed < 1) dmg *= mod.restDamage
if (mod.isEnergyDamage) dmg *= 1 + mech.energy / 5.5;
if (mod.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038
if (mod.isRerollDamage) dmg *= 1 + 0.05 * powerUps.reroll.rerolls
if (mod.isRerollDamage) dmg *= 1 + 0.04 * powerUps.reroll.rerolls
if (mod.isOneGun && b.inventory.length < 2) dmg *= 1.25
if (mod.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.5
return dmg * mod.slowFire * mod.aimDamage
@@ -245,7 +245,7 @@ const mod = {
},
{
name: "perturbation theory",
description: "increase <strong class='color-d'>damage</strong> by <strong>5%</strong><br>for each of your <strong class='color-r'>rerolls</strong>",
description: "increase <strong class='color-d'>damage</strong> by <strong>4%</strong><br>for each of your <strong class='color-r'>rerolls</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -1885,6 +1885,22 @@ const mod = {
mod.isFlechetteExplode = false
}
},
{
name: "radioactive contamination",
description: "after a mob or shield <strong>dies</strong>,<br> leftover <strong class='color-p'>radiation</strong> <strong>spreads</strong> to a nearby mob",
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("flechettes") || mod.isNailPoison || mod.isHeavyWater || mod.isWormholeDamage
},
requires: "radiation damage source",
effect() {
mod.isRadioactive = true
},
remove() {
mod.isRadioactive = false
}
},
{
name: "piercing needles",
description: "<strong>needles</strong> penetrate <strong>mobs</strong> and <strong>blocks</strong><br>potentially hitting <strong>multiple</strong> targets",
@@ -2095,9 +2111,9 @@ const mod = {
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("mine")
return mod.haveGunCheck("mine") && !mod.isMineSentry
},
requires: "mine",
requires: "mine, not sentry",
effect() {
mod.isMineAmmoBack = true;
},
@@ -2105,6 +2121,22 @@ const mod = {
mod.isMineAmmoBack = false;
}
},
{
name: "sentry",
description: "<strong>mines</strong> are modified to <strong>target</strong> mobs with nails<br>mines last about <strong>12</strong> seconds",
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("mine") && !mod.isMineAmmoBack
},
requires: "mine, not mine reclamation",
effect() {
mod.isMineSentry = true;
},
remove() {
mod.isMineSentry = false;
}
},
{
name: "irradiated nails",
description: "<strong>nails</strong> are made with a <strong class='color-p'>cobalt-60</strong> alloy<br><strong>85%</strong> <strong class='color-p'>radioactive</strong> <strong class='color-d'>damage</strong> over <strong>2</strong> seconds",
@@ -2123,7 +2155,7 @@ const mod = {
},
{
name: "railroad ties",
description: "<strong>nails</strong> are <strong>70%</strong> <strong>larger</strong><br>increases physical <strong class='color-d'>damage</strong> by about <strong>25%</strong>",
description: "<strong>nails</strong> are <strong>50%</strong> <strong>larger</strong><br>increases physical <strong class='color-d'>damage</strong> by about <strong>25%</strong>",
maxCount: 1,
count: 0,
allowed() {
@@ -2131,7 +2163,7 @@ const mod = {
},
requires: "nails",
effect() {
mod.biggerNails += 0.7
mod.biggerNails += 0.5
},
remove() {
mod.biggerNails = 1
@@ -2346,22 +2378,38 @@ const mod = {
// mod.isLargeFoam = false;
// }
// },
// {
// 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>",
// maxCount: 1,
// count: 0,
// allowed() {
// return game.fpsCapDefault > 45 && mod.haveGunCheck("rail gun") && !mod.isSlowFPS && !mod.isCapacitor
// },
// requires: "rail gun and FPS above 45",
// effect() {
// mod.isRailTimeSlow = true;
// },
// remove() {
// mod.isRailTimeSlow = false;
// game.fpsCap = game.fpsCapDefault
// game.fpsInterval = 1000 / game.fpsCap;
// }
// },
{
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>",
name: "half-wave rectifier",
description: "charging the <strong>rail gun</strong> overfills your <strong class='color-f'>energy</strong><br><em>instead of draining it</em>",
maxCount: 1,
count: 0,
allowed() {
return game.fpsCapDefault > 45 && mod.haveGunCheck("rail gun") && !mod.isSlowFPS && !mod.isCapacitor
return mod.haveGunCheck("rail gun") && !mod.isCapacitor
},
requires: "rail gun and FPS above 45",
requires: "rail gun, not capacitor bank",
effect() {
mod.isRailTimeSlow = true;
mod.isRailEnergyGain = true;
},
remove() {
mod.isRailTimeSlow = false;
game.fpsCap = game.fpsCapDefault
game.fpsInterval = 1000 / game.fpsCap;
mod.isRailEnergyGain = false;
}
},
{
@@ -2370,9 +2418,9 @@ const mod = {
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("rail gun") && !mod.isRailTimeSlow
return mod.haveGunCheck("rail gun") && !mod.isRailEnergyGain
},
requires: "rail gun",
requires: "rail gun, not half-wave rectifier",
effect() {
mod.isCapacitor = true;
},
@@ -2456,7 +2504,7 @@ const mod = {
allowed() {
return mod.haveGunCheck("laser") && mod.laserReflections < 3 && !mod.beamSplitter && !mod.isPulseLaser
},
requires: "laser, not specular reflection<br>not beam splitter",
requires: "laser, not specular reflection<br>not diffraction grating",
effect() {
if (mod.wideLaser === 0) mod.wideLaser = 3
mod.isWideLaser = true;
@@ -2474,7 +2522,7 @@ const mod = {
allowed() {
return mod.haveGunCheck("laser") && mod.isWideLaser
},
requires: "laser, not specular reflection<br>not beam splitter",
requires: "laser, not specular reflection<br>not diffraction grating",
effect() {
mod.wideLaser = 4
},
@@ -2494,7 +2542,7 @@ const mod = {
allowed() {
return mod.haveGunCheck("laser") && mod.laserReflections < 3 && !mod.isWideLaser
},
requires: "laser, not specular reflection<br>not beam splitter, not diffuse",
requires: "laser, not specular reflection, not diffuse",
effect() {
mod.isPulseLaser = true;
for (i = 0, len = b.guns.length; i < len; i++) { //find which gun
@@ -3208,5 +3256,8 @@ const mod = {
isWideLaser: null,
wideLaser: null,
isPulseLaser: null,
timeEnergyRegen: null
timeEnergyRegen: null,
isRadioactive: null,
isRailEnergyGain: null,
isMineSentry: null
}

View File

@@ -94,7 +94,7 @@ const spawn = {
me.frictionAir = 0.01;
me.memory = Infinity;
me.locatePlayer();
const density = 1
const density = 1.1
Matter.Body.setDensity(me, density); //extra dense //normal is 0.001 //makes effective life much larger
// spawn.shield(me, x, y, 1);
me.onDeath = function() {
@@ -160,8 +160,9 @@ const spawn = {
}
this.mode = 3
this.fill = "#000";
this.eventHorizon = 1200
this.rotateVelocity = Math.abs(this.rotateVelocity) * (player.position.x > this.position.x ? 1 : -1) //rotate so that the player can get away
this.eventHorizon = 700
this.spawnInterval = 600
this.rotateVelocity = 0.001 * (player.position.x > this.position.x ? 1 : -1) //rotate so that the player can get away
if (!this.isShielded) spawn.shield(this, x, y, 1); //regen shield here ?
this.modeDo = this.modeAll
}
@@ -173,12 +174,13 @@ const spawn = {
this.modeSuck()
this.modeLasers()
}
me.spawnInterval = 302
me.modeSpawns = function() {
if ((this.cycle === 2 || this.cycle === 300) && !mech.isBodiesAsleep && mob.length < 40) {
if (!(this.cycle % this.spawnInterval) && !mech.isBodiesAsleep && mob.length < 40) {
Matter.Body.setAngularVelocity(this, 0.1)
//fire a bullet from each vertex
let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
for (let i = 0, len = this.vertices.length; i < len; i++) {
let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
spawn[whoSpawn](this.vertices[i].x, this.vertices[i].y);
//give the bullet a rotational velocity as if they were attached to a vertex
const velocity = Vector.mult(Vector.perp(Vector.normalise(Vector.sub(this.position, this.vertices[i]))), -18)
@@ -737,16 +739,17 @@ const spawn = {
}
}
},
sucker(x, y, radius = 30 + Math.ceil(Math.random() * 70)) {
sucker(x, y, radius = 40 + Math.ceil(Math.random() * 50)) {
radius = 9 + radius / 8; //extra small
mobs.spawn(x, y, 6, radius, "#000");
let me = mob[mob.length - 1];
me.stroke = "transparent"; //used for drawSneaker
me.eventHorizon = radius * 23; //required for blackhole
me.seeAtDistance2 = (me.eventHorizon + 500) * (me.eventHorizon + 500); //vision limit is event horizon
me.accelMag = 0.00009 * game.accelScale;
// me.frictionAir = 0.005;
me.memory = 600;
me.seeAtDistance2 = (me.eventHorizon + 200) * (me.eventHorizon + 200); //vision limit is event horizon
me.accelMag = 0.0001 * game.accelScale;
me.frictionAir = 0.025;
me.collisionFilter.mask = cat.player | cat.bullet
me.memory = Infinity;
Matter.Body.setDensity(me, 0.004); //extra dense //normal is 0.001 //makes effective life much larger
me.do = function() {
//keep it slow, to stop issues from explosion knock backs
@@ -756,7 +759,8 @@ const spawn = {
y: this.velocity.y * 0.99
});
}
this.seePlayerByDistOrLOS();
// this.seePlayerByDistOrLOS();
this.seePlayerCheckByDistance()
this.checkStatus();
if (this.seePlayer.recall) {
//eventHorizon waves in and out