dielectric polarization

mod rail gun: dielectric polarization - firing the rail gun damages nearby mobs

block hole mobs are no longer visible before they activate
striker mobs teleport more often
final boss:
  laser does no damage for 2 seconds after it begins
  spawns 2 waves of mobs each spawn cycle  (was 3)
This commit is contained in:
landgreen
2020-11-21 08:13:15 -08:00
parent 4c040b073a
commit 463bacc977
5 changed files with 94 additions and 87 deletions

View File

@@ -2924,9 +2924,46 @@ const b = {
name: "rail gun",
description: "use <strong class='color-f'>energy</strong> to launch a high-speed <strong>dense</strong> rod<br><strong>hold</strong> left mouse to charge, <strong>release</strong> to fire",
ammo: 0,
ammoPack: 3.5,
ammoPack: 3.25,
have: false,
fire() {
function pushAway(range) { //push away blocks when firing
for (let i = 0, len = mob.length; i < len; ++i) {
const SUB = Vector.sub(mob[i].position, mech.pos)
const DISTANCE = Vector.magnitude(SUB)
if (DISTANCE < range) {
const DEPTH = Math.min(range - DISTANCE, 1500)
const FORCE = Vector.mult(Vector.normalise(SUB), 0.001 * Math.sqrt(DEPTH) * mob[i].mass)
mob[i].force.x += FORCE.x;
mob[i].force.y += FORCE.y;
if (mod.isRailAreaDamage) {
mob[i].force.x += 2 * FORCE.x;
mob[i].force.y += 2 * FORCE.y;
const damage = b.dmgScale * 0.1 * Math.sqrt(DEPTH)
mob[i].damage(damage);
mob[i].locatePlayer();
game.drawList.push({ //add dmg to draw queue
x: mob[i].position.x,
y: mob[i].position.y,
radius: Math.log(2 * damage + 1.1) * 40,
color: "rgba(100,0,200,0.25)",
time: game.drawTime
});
}
}
}
for (let i = 0, len = body.length; i < len; ++i) {
const SUB = Vector.sub(body[i].position, mech.pos)
const DISTANCE = Vector.magnitude(SUB)
if (DISTANCE < range) {
const DEPTH = Math.min(range - DISTANCE, 500)
const FORCE = Vector.mult(Vector.normalise(SUB), 0.002 * Math.sqrt(DEPTH) * body[i].mass)
body[i].force.x += FORCE.x;
body[i].force.y += FORCE.y - body[i].mass * game.g * 1.5; //kick up a bit to give them some arc
}
}
}
if (mod.isCapacitor) {
if (mech.energy > 0.16 || mod.isRailEnergyGain) {
mech.energy += 0.16 * (mod.isRailEnergyGain ? 6 : -1)
@@ -3012,29 +3049,7 @@ const b = {
player.force.x -= KNOCK * Math.cos(mech.angle)
player.force.y -= KNOCK * Math.sin(mech.angle) * 0.35 //reduce knock back in vertical direction to stop super jumps
//push away blocks when firing
let range = 450
for (let i = 0, len = body.length; i < len; ++i) {
const SUB = Vector.sub(body[i].position, mech.pos)
const DISTANCE = Vector.magnitude(SUB)
if (DISTANCE < range) {
const DEPTH = Math.min(range - DISTANCE, 300)
const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * body[i].mass)
body[i].force.x += FORCE.x;
body[i].force.y += FORCE.y - body[i].mass * (game.g * 1.5); //kick up a bit to give them some arc
}
}
for (let i = 0, len = mob.length; i < len; ++i) {
const SUB = Vector.sub(mob[i].position, mech.pos)
const DISTANCE = Vector.magnitude(SUB)
if (DISTANCE < range) {
const DEPTH = Math.min(range - DISTANCE, 300)
const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * mob[i].mass)
mob[i].force.x += 1.5 * FORCE.x;
mob[i].force.y += 1.5 * FORCE.y;
}
}
pushAway(800)
} else {
mech.fireCDcycle = mech.cycle + Math.floor(120);
}
@@ -3112,31 +3127,7 @@ const b = {
const KNOCK = ((mech.crouch) ? 0.1 : 0.5) * this.charge * this.charge
player.force.x -= KNOCK * Math.cos(mech.angle)
player.force.y -= KNOCK * Math.sin(mech.angle) * 0.35 //reduce knock back in vertical direction to stop super jumps
//push away blocks when firing
let range = 900 * this.charge
for (let i = 0, len = body.length; i < len; ++i) {
const SUB = Vector.sub(body[i].position, mech.pos)
const DISTANCE = Vector.magnitude(SUB)
if (DISTANCE < range) {
const DEPTH = Math.min(range - DISTANCE, 300)
const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * body[i].mass)
body[i].force.x += FORCE.x;
body[i].force.y += FORCE.y - body[i].mass * (game.g * 1.5); //kick up a bit to give them some arc
}
}
for (let i = 0, len = mob.length; i < len; ++i) {
const SUB = Vector.sub(mob[i].position, mech.pos)
const DISTANCE = Vector.magnitude(SUB)
if (DISTANCE < range) {
const DEPTH = Math.min(range - DISTANCE, 300)
const FORCE = Vector.mult(Vector.normalise(SUB), 0.003 * Math.sqrt(DEPTH) * mob[i].mass)
mob[i].force.x += 1.5 * FORCE.x;
mob[i].force.y += 1.5 * FORCE.y;
}
}
pushAway(1200 * this.charge)
} else { // charging on mouse down
mech.fireCDcycle = Infinity //can't fire until mouse is released
const previousCharge = this.charge

View File

@@ -13,14 +13,14 @@ const level = {
start() {
if (level.levelsCleared === 0) { //this code only runs on the first level
// game.enableConstructMode() //used to build maps in testing mode
// level.difficultyIncrease(26)
// level.difficultyIncrease(8)
// game.zoomScale = 1000;
// game.setZoom();
// mech.setField("wormhole")
// b.giveGuns("missiles")
// b.giveGuns("rail gun")
// mod.is3Missiles = true
// mod.giveMod("neutron bomb")
// mod.giveMod("super ball")
// mod.giveMod("dielectric polarization")
// mod.giveMod("capacitor bank")
level.intro(); //starting level
// level.testing(); //not in rotation
@@ -145,7 +145,7 @@ const level = {
// spawn.bomberBoss(2900, -500)
// spawn.launcherBoss(1200, -500)
// spawn.laserTargetingBoss(1600, -400)
// spawn.spawner(1600, -500)
spawn.striker(1600, -500)
// spawn.shooter(1700, -120)
// spawn.bomberBoss(1400, -500)
// spawn.sniper(1800, -120)
@@ -156,7 +156,7 @@ const level = {
// spawn.nodeBoss(1200, -500, "launcher")
// spawn.snakeBoss(1200, -500)
spawn.powerUpBoss(2900, -500)
// spawn.powerUpBoss(2900, -500)
// spawn.randomMob(1600, -500)
},
template() {

View File

@@ -2448,6 +2448,22 @@ const mod = {
mod.isRailEnergyGain = false;
}
},
{
name: "dielectric polarization",
description: "firing the <strong>rail gun</strong> <strong class='color-d'>damages</strong> nearby <strong>mobs</strong>",
maxCount: 1,
count: 0,
allowed() {
return mod.haveGunCheck("rail gun")
},
requires: "rail gun",
effect() {
mod.isRailAreaDamage = true;
},
remove() {
mod.isRailAreaDamage = false;
}
},
{
name: "capacitor bank",
description: "the <strong>rail gun</strong> no longer takes time to <strong>charge</strong><br><strong>rail gun</strong> rods are <strong>66%</strong> less massive",
@@ -3298,5 +3314,6 @@ const mod = {
isMineSentry: null,
isIncendiary: null,
overfillDrain: null,
isNeutronSlow: null
isNeutronSlow: null,
isRailAreaDamage: null
}

View File

@@ -2,21 +2,21 @@
const spawn = {
pickList: ["starter", "starter"],
fullPickList: [
"hopper", "hopper", "hopper", "hopper",
"shooter", "shooter", "shooter",
"chaser", "chaser",
"hopper", "hopper", "hopper",
"shooter", "shooter",
"striker", "striker",
"laser", "laser",
"exploder", "exploder",
"stabber", "stabber",
"launcher", "launcher",
"springer", "springer",
"sucker", "sucker",
"chaser",
"sniper",
"spinner",
"grower",
"springer",
"beamer",
"focuser",
"sucker",
"spawner",
"ghoster",
"sneaker",
@@ -173,7 +173,7 @@ const spawn = {
this.modeSuck()
this.modeLasers()
}
me.spawnInterval = 302
me.spawnInterval = 362
me.modeSpawns = function() {
if (!(this.cycle % this.spawnInterval) && !mech.isBodiesAsleep && mob.length < 40) {
if (this.mode !== 3) Matter.Body.setAngularVelocity(this, 0.1)
@@ -265,7 +265,7 @@ const spawn = {
}
if (this.cycle < 240) { //damage scales up over 2 seconds to give player time to move
const scale = this.cycle / 240
const dmg = 0.14 * game.dmgScale * scale
const dmg = (this.cycle < 120) ? 0 : 0.14 * game.dmgScale * scale
ctx.beginPath();
this.laser(this.vertices[0], this.angle + Math.PI / 6, dmg);
this.laser(this.vertices[1], this.angle + 3 * Math.PI / 6, dmg);
@@ -354,7 +354,7 @@ const spawn = {
vertexCollision(where, look, body);
if (!mech.isCloak) vertexCollision(where, look, [player]);
if (best.who && best.who === player && mech.immuneCycle < mech.cycle) {
mech.immuneCycle = mech.cycle + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
mech.immuneCycle = mech.cycle + 60 + mod.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
mech.damage(dmg);
game.drawList.push({ //add dmg to draw queue
x: best.x,
@@ -743,18 +743,18 @@ const spawn = {
}
}
},
sucker(x, y, radius = 40 + Math.ceil(Math.random() * 50)) {
sucker(x, y, radius = 30 + Math.ceil(Math.random() * 25)) {
radius = 9 + radius / 8; //extra small
mobs.spawn(x, y, 6, radius, "#000");
mobs.spawn(x, y, 6, radius, "transparent");
let me = mob[mob.length - 1];
me.stroke = "transparent"; //used for drawSneaker
me.eventHorizon = radius * 23; //required for blackhole
me.seeAtDistance2 = (me.eventHorizon + 200) * (me.eventHorizon + 200); //vision limit is event horizon
me.accelMag = 0.0001 * game.accelScale;
me.accelMag = 0.00009 * 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
Matter.Body.setDensity(me, 0.008); //extra dense //normal is 0.001 //makes effective life much larger
me.do = function() {
//keep it slow, to stop issues from explosion knock backs
if (this.speed > 5) {
@@ -1535,8 +1535,8 @@ const spawn = {
striker(x, y, radius = 14 + Math.ceil(Math.random() * 25)) {
mobs.spawn(x, y, 5, radius, "rgb(221,102,119)");
let me = mob[mob.length - 1];
me.accelMag = 0.0003 * game.accelScale;
me.g = 0.0002; //required if using 'gravity'
me.accelMag = 0.00034 * game.accelScale;
me.g = 0.00015; //required if using 'gravity'
me.frictionStatic = 0;
me.friction = 0;
me.delay = 90 * game.CDScale;
@@ -1564,18 +1564,26 @@ const spawn = {
}
this.checkStatus();
this.attraction();
if (this.seePlayer.recall && this.cd < game.cycle) {
if (this.cd < game.cycle) {
if (this.seePlayer.recall) {
const dist = Vector.sub(this.seePlayer.position, this.position);
const distMag = Vector.magnitude(dist);
if (distMag < 400) {
this.cd = game.cycle + this.delay;
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
if (distMag < 400) {
Matter.Body.translate(this, Vector.mult(Vector.normalise(dist), distMag - 20 - radius));
} else {
Matter.Body.translate(this, Vector.mult(Vector.normalise(dist), 300));
}
ctx.lineTo(this.position.x, this.position.y);
ctx.lineWidth = radius * 2;
ctx.lineWidth = radius * 2.1;
ctx.strokeStyle = this.fill; //"rgba(0,0,0,0.5)"; //'#000'
ctx.stroke();
Matter.Body.setVelocity(this, {
x: this.velocity.x * 0.5,
y: this.velocity.y * 0.5
});
}
}
};
@@ -2200,7 +2208,7 @@ const spawn = {
mobs.spawn(x, y, 8, radius, "rgb(55,170,170)");
let me = mob[mob.length - 1];
me.isBoss = true;
me.accelMag = 0.0008 * game.accelScale;
me.accelMag = 0.00075 * game.accelScale;
me.memory = 250;
me.laserRange = 500;
Matter.Body.setDensity(me, 0.0015 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger

View File

@@ -1,11 +1,5 @@
*********** NEXT PATCH ***********
power up boss no longer slows down after each time you kill it
- fear the power up boss
holding down the field button will stop nano-scale field from converting energy into bullets
energy costs have been increased a bit
nano scale can now use mod - supercapacitor
************** BUGS **************
@@ -23,14 +17,11 @@ holding down the field button will stop nano-scale field from converting energy
after sticking to the top right corner of a wall
notes: had only gun mine, mod mine reclamation, field plasma,
(repeatable almost everytime) bug - mines spawn extra mines when fired at thin map wall while jumping
(repeatable almost every time) bug - mines spawn extra mines when fired at thin map wall while jumping
************** TODO **************
mod - railgun's push effect is increased, and it does some damage to nearby mobs
maybe only triggers at max energy
Laser mod: For each reflection of laser, damage increases by 10%
new power up - increase damage and fire speed, for 15 seconds