supercapacitor - overfill energy decays 66% slower

This commit is contained in:
landgreen
2020-11-16 19:30:01 -08:00
parent 7c52af4b90
commit f32bfba7a1
5 changed files with 57 additions and 26 deletions

View File

@@ -683,7 +683,7 @@ const game = {
if (!(mech.cycle % 60)) { //once a second
//energy overfill
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy + (mech.energy - mech.maxEnergy) * 0.8 //every second energy above max energy loses 25%
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy + (mech.energy - mech.maxEnergy) * mod.overfillDrain //every second energy above max energy loses 25%
if (mech.pos.y > game.fallHeight) { // if 4000px deep
Matter.Body.setVelocity(player, {

View File

@@ -12,8 +12,8 @@ const level = {
levels: [],
start() {
if (level.levelsCleared === 0) { //this code only runs on the first level
// level.difficultyIncrease(8)
// game.enableConstructMode() //used to build maps in testing mode
// level.difficultyIncrease(8)
// game.zoomScale = 1000;
// game.setZoom();
// mech.setField("wormhole")
@@ -142,18 +142,18 @@ const level = {
spawn.mapRect(level.exit.x, level.exit.y + 20, 100, 100); //exit bump
// spawn.boost(1500, 0, 900);
spawn.starter(1900, -500, 20)
// spawn.starter(1900, -500, 20)
// spawn.bomberBoss(2900, -500)
// spawn.launcherBoss(1200, -500)
// spawn.laserTargetingBoss(1600, -400)
// spawn.spawner(1600, -500)
// spawn.sniper(1700, -120, 50)
spawn.shooter(1700, -120)
// spawn.bomberBoss(1400, -500)
// spawn.sucker(1800, -120)
spawn.sniper(1800, -120)
// spawn.cellBossCulture(1600, -500)
// spawn.spiderBoss(1600, -500)
// spawn.sniper(1200, -500)
spawn.shield(mob[mob.length - 1], 1800, -120, 1);
spawn.launcher(1200, -500)
// spawn.shield(mob[mob.length - 1], 1800, -120, 1);
// spawn.nodeBoss(1200, -500, "launcher")
// spawn.snakeBoss(1200, -500)
@@ -2090,10 +2090,10 @@ const level = {
spawn.randomBoss(-1300, -1100, -0.3);
if (game.difficulty > 3) {
if (Math.random() < 0.1) {
if (Math.random() < 0.25) {
spawn.randomLevelBoss(-800, -1300)
} else {
spawn.snakeBoss(-1300 + Math.random() * 2000, -2200); //boss snake with head
spawn.snakeBoss(-1000 + Math.random() * 1500, -2200); //boss snake with head
}
}
powerUps.addRerollToLevel() //needs to run after mobs are spawned

View File

@@ -932,6 +932,22 @@ const mod = {
mod.isFreezeHarmImmune = false;
}
},
{
name: "supercapacitor",
description: "<strong class='color-f'>energy</strong> above your max decays <strong>66%</strong> slower",
maxCount: 1,
count: 0,
allowed() {
return (mod.isEnergyRecovery || mod.isPiezo || mod.energySiphon > 0 || mod.isRailEnergyGain || mod.isWormholeEnergy || mod.iceEnergy > 0) && mech.fieldUpgrades[mech.fieldMode].name !== "nano-scale manufacturing"
},
requires: "a source of overfilled energy",
effect() {
mod.overfillDrain = 0.933
},
remove() {
mod.overfillDrain = 0.8
}
},
{
name: "piezoelectricity",
description: "<strong>colliding</strong> with mobs overfills <strong class='color-f'>energy</strong> by <strong>200%</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>15%</strong>",
@@ -3262,5 +3278,6 @@ const mod = {
isRadioactive: null,
isRailEnergyGain: null,
isMineSentry: null,
isIncendiary: null
isIncendiary: null,
overfillDrain: null
}

View File

@@ -2110,7 +2110,7 @@ const spawn = {
},
seeker(x, y, radius = 5, sides = 0) {
//bullets
mobs.spawn(x, y, sides, radius, "rgb(150,150,255)");
mobs.spawn(x, y, sides, radius, "rgb(255,0,255)");
let me = mob[mob.length - 1];
me.stroke = "transparent";
me.onHit = function() {
@@ -2196,9 +2196,9 @@ const spawn = {
let me = mob[mob.length - 1];
me.isBoss = true;
me.accelMag = 0.0011 * game.accelScale;
me.memory = 200;
me.memory = 250;
me.laserRange = 500;
Matter.Body.setDensity(me, 0.001 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
Matter.Body.setDensity(me, 0.0013 + 0.0005 * Math.sqrt(game.difficulty)); //extra dense //normal is 0.001 //makes effective life much larger
spawn.shield(me, x, y, 1);
me.onDeath = function() {
powerUps.spawnBossPowerUp(this.position.x, this.position.y)
@@ -2211,8 +2211,8 @@ const spawn = {
};
//snake tail
const nodes = Math.min(3 + Math.ceil(Math.random() * game.difficulty + 2), 8)
spawn.lineBoss(x + 105, y, "spawns", nodes);
const nodes = 2 + Math.min(3 + Math.ceil(Math.random() * game.difficulty + 2), 8)
spawn.lineBoss(x + 105, y, "snakeBody", nodes);
//constraint boss with first 3 mobs in lineboss
consBB[consBB.length] = Constraint.create({
bodyA: mob[mob.length - nodes],
@@ -2234,6 +2234,27 @@ const spawn = {
World.add(engine.world, consBB[consBB.length - 1]);
},
snakeBody(x, y, radius = 20) {
mobs.spawn(x, y, 4, radius, "rgb(255,0,0)");
let me = mob[mob.length - 1];
me.onHit = function() {
//run this function on hitting player
this.explode();
};
me.collisionFilter.mask = cat.bullet | cat.player
// me.g = 0.0002; //required if using 'gravity'
// me.accelMag = 0 //0.001 * game.accelScale;
// me.memory = 0;
me.leaveBody = false;
// me.seePlayerFreq = Math.round((80 + 50 * Math.random()) * game.lookFreqScale);
me.frictionAir = 0.02;
me.do = function() {
// this.gravity();
// this.seePlayerCheck();
this.checkStatus();
// this.attraction();
};
},
tetherBoss(x, y, radius = 90) {
// constrained mob boss for the towers level
// often has a ring of mobs around it