relay switch

bug fix - grower mob becoming immune to damage when shielded and growing bigger than shield

relay switch - toggles ON/OFF when you pick up a power up
tech: ice IX condenser - if ON make a couple Ice IX crystals every second
This commit is contained in:
landgreen
2021-03-26 05:54:28 -07:00
parent 84e4079181
commit 3ab42884ca
9 changed files with 206 additions and 118 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -1958,7 +1958,7 @@ const b = {
restitution: 0.3,
dmg: 0.29, //damage done in addition to the damage from momentum
lookFrequency: 14 + Math.floor(8 * Math.random()),
endCycle: simulation.cycle + 120 * tech.isBulletsLastLonger, //Math.floor((1200 + 420 * Math.random()) * tech.isBulletsLastLonger),
endCycle: simulation.cycle + 140 * tech.isBulletsLastLonger,
classType: "bullet",
collisionFilter: {
category: cat.bullet,
@@ -4066,8 +4066,16 @@ const b = {
ammoPack: 36,
have: false,
fire() {
m.fireCDcycle = m.cycle + Math.floor((m.crouch ? 15 : 5) * b.fireCD); // cool down
const radius = (m.crouch ? 10 + 5 * Math.random() : 4 + 6 * Math.random()) + (tech.isAmmoFoamSize && this.ammo < 300) * 12
let radius, spread
if (m.crouch) {
spread = 0.2 * (Math.random() - 0.5)
radius = 10 + 5 * Math.random() + (tech.isAmmoFoamSize && this.ammo < 300) * 12
m.fireCDcycle = m.cycle + Math.floor(15 * b.fireCD); // cool down
} else {
spread = 0.5 * (Math.random() - 0.5)
radius = 4 + 6 * Math.random() + (tech.isAmmoFoamSize && this.ammo < 300) * 12
m.fireCDcycle = m.cycle + Math.floor(5 * b.fireCD); // cool down
}
const SPEED = 18 - radius * 0.4;
const dir = m.angle + 0.15 * (Math.random() - 0.5)
const velocity = {
@@ -4088,12 +4096,12 @@ const b = {
});
setTimeout(() => {
if (!simulation.paused) {
b.foam(position, Vector.rotate(velocity, 0.5 * (Math.random() - 0.5)), radius)
b.foam(position, Vector.rotate(velocity, spread), radius)
bullet[bullet.length - 1].damage = (1 + 1.27 * tech.foamFutureFire) * (tech.isFastFoam ? 0.048 : 0.012) //double damage
}
}, 250 * tech.foamFutureFire);
} else {
b.foam(position, Vector.rotate(velocity, 0.5 * (Math.random() - 0.5)), radius)
b.foam(position, Vector.rotate(velocity, spread), radius)
}
}
}, {

View File

@@ -113,6 +113,7 @@ const level = {
// }
if (tech.isFlipFlopHarm && tech.isFlipFlopLevelReset && !tech.isFlipFlopOn) {
tech.isFlipFlopOn = true
m.eyeFillColor = m.fieldMeterColor
simulation.makeTextLog(`tech.isFlipFlopOn <span class='color-symbol'>=</span> true`);
}
},
@@ -1102,8 +1103,8 @@ const level = {
// simulation.difficulty = 30
// spawn.starter(1900, -500, 200) //big boy
spawn.pulsar(1900, -500)
spawn.pulsarBoss(1900, -500)
// spawn.grower(1900, -500)
// spawn.pulsarBoss(1900, -500)
// spawn.historyBoss(1900, -500)
// spawn.ghoster(2900, -500)
// spawn.launcherBoss(1200, -500)
@@ -1115,11 +1116,11 @@ const level = {
// spawn.streamBoss(1600, -500)
// spawn.orbitalBoss(1600, -500)
// spawn.cellBossCulture(1600, -500)
// spawn.shieldingBoss(1600, -500)
spawn.shieldingBoss(1600, -500)
// spawn.beamer(1200, -500)
// spawn.shield(mob[mob.length - 1], 1800, -120, 1);
// spawn.nodeGroup(1200, -500, "launcher")
spawn.nodeGroup(1200, -500, "grower")
// spawn.snakeBoss(1200, -500)
// spawn.powerUpBoss(2900, -500)
// spawn.randomMob(1600, -500)
@@ -3101,7 +3102,7 @@ const level = {
button = level.button(525, 0)
door = level.door(1362, -200, 25, 200, 195)
level.setPosToSpawn(1375, -1550); //normal spawn
level.exit.x = 3288;
level.exit.x = 3088;
level.exit.y = -630;
// spawn.randomSmallMob(3550, -550);
level.fillBG.push({
@@ -3114,7 +3115,7 @@ const level = {
} else { //reverse direction, start in bottom right
button = level.button(3800, 0)
door = level.door(3012, -200, 25, 200, 195)
level.setPosToSpawn(3337, -650); //normal spawn
level.setPosToSpawn(3137, -650); //normal spawn
level.exit.x = 1375;
level.exit.y = -1530;
// spawn.bodyRect(3655, -650, 40, 150); //door
@@ -3186,10 +3187,10 @@ const level = {
color: "rgba(0,0,0,0.1)"
});
spawn.debris(-300, -200, 1000, 4); //ground debris //16 debris per level
spawn.debris(3500, -200, 800, 4); //ground debris //16 debris per level
spawn.debris(-300, -650, 1200, 4); //1st floor debris //16 debris per level
spawn.debris(3500, -650, 800, 5); //1st floor debris //16 debris per level
spawn.debris(-300, -200, 1000, 6); //ground debris //16 debris per level
spawn.debris(3500, -200, 800, 5); //ground debris //16 debris per level
spawn.debris(-300, -650, 1200, 5); //1st floor debris //16 debris per level
// spawn.debris(3500, -650, 800, 5); //1st floor debris //16 debris per lesvel
powerUps.spawnStartingPowerUps(-525, -700);
spawn.mapRect(-600, 0, 2000, 325); //ground
@@ -3243,8 +3244,8 @@ const level = {
spawn.bodyRect(3665, -600, 20, 100); //door
// spawn.mapRect(3150, -550, 300, 75);
// spawn.mapRect(3225, -600, 175, 75);
spawn.mapRect(3150, -550, 375, 75);
spawn.mapRect(3225, -600, 225, 75);
spawn.mapRect(3000, -550, 375, 75);
spawn.mapRect(3000, -600, 225, 75);
spawn.mapRect(3000, -2000 * 0.5, 700, 50); //exit roof

View File

@@ -767,9 +767,6 @@ const mobs = {
this.force.x += this.accelMag * this.mass;
}
}
// else {
// this.gravity();
// }
},
grow() {
if (!m.isBodiesAsleep) {
@@ -780,6 +777,10 @@ const mobs = {
this.radius *= scale;
// this.torque = -0.00002 * this.inertia;
this.fill = `hsl(144, ${this.radius}%, 50%)`;
if (this.isShielded) { //remove shield if shielded when growing
this.isShielded = false;
this.removeConsBB();
}
}
} else {
if (this.radius > 15) {

View File

@@ -831,6 +831,41 @@ const m = {
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
},
drawFlipFlop() {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
//draw body
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
let grd = ctx.createLinearGradient(-30, 0, 30, 0);
grd.addColorStop(0, m.fillColorDark);
grd.addColorStop(1, m.fillColor);
ctx.fillStyle = grd;
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
//draw eye
ctx.beginPath();
ctx.arc(15, 0, 3.5, 0, 2 * Math.PI);
ctx.fillStyle = m.eyeFillColor;
ctx.fill()
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
},
drawDefault() {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;

View File

@@ -482,6 +482,17 @@ const powerUps = {
b.mine(who.position, { x: 0, y: 0 }, 0, tech.isMineAmmoBack)
}
}
if (tech.isRelay) {
if (tech.isFlipFlopOn) {
tech.isFlipFlopOn = false
if (document.getElementById("tech-switch")) document.getElementById("tech-switch").innerHTML = ` = <strong>OFF</strong>`
m.eyeFillColor = 'transparent'
} else {
tech.isFlipFlopOn = true //immune to damage this hit, lose immunity for next hit
if (document.getElementById("tech-switch")) document.getElementById("tech-switch").innerHTML = ` = <strong>ON</strong>`
m.eyeFillColor = m.fieldMeterColor //'#0cf'
}
}
},
giveRandomAmmo() {
const ammoTarget = Math.floor(Math.random() * (b.guns.length));

View File

@@ -792,7 +792,6 @@ const simulation = {
// },
checks() {
if (!(m.cycle % 60)) { //once a second
//energy overfill
if (m.energy > m.maxEnergy) m.energy = m.maxEnergy + (m.energy - m.maxEnergy) * tech.overfillDrain //every second energy above max energy loses 25%
if (tech.isFlipFlopEnergy) {
@@ -803,6 +802,12 @@ const simulation = {
if (m.energy < 0) m.energy = 0
}
}
if (tech.relayIce && tech.isFlipFlopOn) {
for (let j = 0; j < tech.relayIce; j++) {
for (let i = 0, len = Math.ceil(3 * Math.random()); i < len; i++) b.iceIX(2)
}
}
if (m.pos.y > simulation.fallHeight) { // if 4000px deep
Matter.Body.setVelocity(player, {
x: 0,

View File

@@ -639,9 +639,9 @@
count: 0,
frequency: 2,
allowed() {
return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" || tech.haveGunCheck("spores") || tech.haveGunCheck("drones") || tech.haveGunCheck("missiles") || tech.haveGunCheck("foam") || tech.haveGunCheck("wave beam") || tech.isNeutronBomb
return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" || tech.haveGunCheck("spores") || tech.haveGunCheck("drones") || tech.haveGunCheck("missiles") || tech.haveGunCheck("foam") || tech.haveGunCheck("wave beam") || tech.isNeutronBomb || tech.isIceField || tech.relayIce
},
requires: "drones, spores, missiles, foam, wave beam, neutron bomb",
requires: "drones, spores, missiles, foam, wave beam, neutron bomb, ice IX",
effect() {
tech.isBulletsLastLonger += 0.3
},
@@ -1390,77 +1390,8 @@
remove() {
tech.cyclicImmunity = 0;
}
}, {
name: "flip-flop",
description: `<strong>flip-flop</strong> toggles <strong class="color-flop">ON</strong> and <strong class="color-flop">OFF</strong> after a <strong>collision</strong><br>unlock advanced <strong class='color-m'>tech</strong> that runs if <strong class="color-flop">ON</strong>`,
nameInfo: "<span id = 'tech-flip-flop'></span>",
addNameInfo() {
setTimeout(function() {
if (document.getElementById("tech-flip-flop")) {
if (tech.isFlipFlopOn) {
document.getElementById("tech-flip-flop").innerHTML = ` = <strong>ON</strong>`
m.eyeFillColor = m.fieldMeterColor //'#5af'
} else {
document.getElementById("tech-flip-flop").innerHTML = ` = <strong>OFF</strong>`
m.eyeFillColor = "transparent"
}
}
}, 100);
},
maxCount: 1,
count: 0,
frequency: 2,
allowed() {
return true
},
requires: "",
effect() {
tech.isFlipFlop = true //do you have this tech?
tech.isFlipFlopOn = true //what is the state of flip-Flop?
if (!m.isShipMode) {
m.draw = () => {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
//draw body
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#4a4a4a");
m.calcLeg(0, 0);
m.drawLeg("#333");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
let grd = ctx.createLinearGradient(-30, 0, 30, 0);
grd.addColorStop(0, m.fillColorDark);
grd.addColorStop(1, m.fillColor);
ctx.fillStyle = grd;
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
//draw eye
ctx.beginPath();
ctx.arc(15, 0, 3.5, 0, 2 * Math.PI);
ctx.fillStyle = m.eyeFillColor;
ctx.fill()
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
}
}
},
remove() {
tech.isFlipFlop = false
tech.isFlipFlopOn = false
m.eyeFillColor = 'transparent'
}
}, {
},
{
name: "NOR gate",
description: "if <strong>flip-flop</strong> is in the <strong class='color-flop'>ON</strong> state<br>take <strong>0</strong> <strong class='color-harm'>harm</strong> from collisions with mobs",
maxCount: 1,
@@ -1477,18 +1408,110 @@
remove() {
tech.isFlipFlopHarm = false
}
}, {
},
{
name: "flip-flop",
description: `toggle <strong class="color-flop">ON</strong> and <strong class="color-flop">OFF</strong> after a <strong>collision</strong><br>unlock advanced <strong class='color-m'>tech</strong> that runs if <strong class="color-flop">ON</strong>`,
nameInfo: "<span id = 'tech-flip-flop'></span>",
addNameInfo() {
setTimeout(function() {
if (document.getElementById("tech-flip-flop")) {
if (tech.isFlipFlopOn) {
document.getElementById("tech-flip-flop").innerHTML = ` = <strong>ON</strong>`
m.eyeFillColor = m.fieldMeterColor //'#5af'
} else {
document.getElementById("tech-flip-flop").innerHTML = ` = <strong>OFF</strong>`
m.eyeFillColor = "transparent"
}
}
}, 100);
},
maxCount: 1,
count: 0,
frequency: 1,
allowed() {
return !tech.isRelay
},
requires: "not relay switch",
effect() {
tech.isFlipFlop = true //do you have this tech?
tech.isFlipFlopOn = true //what is the state of flip-Flop?
if (!m.isShipMode) {
m.draw = m.drawFlipFlop
}
},
remove() {
tech.isFlipFlop = false
tech.isFlipFlopOn = false
m.eyeFillColor = 'transparent'
}
},
{
name: "relay switch",
description: `toggle <strong class="color-flop">ON</strong> and <strong class="color-flop">OFF</strong> after picking up a <strong>power up</strong><br>unlock advanced <strong class='color-m'>tech</strong> that runs if <strong class="color-flop">ON</strong>`,
nameInfo: "<span id = 'tech-switch'></span>",
addNameInfo() {
setTimeout(function() {
if (document.getElementById("tech-switch")) {
if (tech.isFlipFlopOn) {
document.getElementById("tech-switch").innerHTML = ` = <strong>ON</strong>`
m.eyeFillColor = m.fieldMeterColor //'#5af'
} else {
document.getElementById("tech-switch").innerHTML = ` = <strong>OFF</strong>`
m.eyeFillColor = "transparent"
}
}
}, 100);
},
maxCount: 1,
count: 0,
frequency: 1,
allowed() {
return !tech.isFlipFlop
},
requires: "not flip-flop",
effect() {
tech.isRelay = true //do you have this tech?
tech.isFlipFlopOn = true //what is the state of flip-Flop?
if (!m.isShipMode) {
m.draw = m.drawFlipFlop
}
},
remove() {
tech.isRelay = false
tech.isFlipFlopOn = false
m.eyeFillColor = 'transparent'
}
},
{
name: "thermocouple",
description: "if <strong>relay switch</strong> is in the <strong class='color-flop'>ON</strong> state<br>condense <strong>1-3</strong> <strong class='color-s'>ice IX</strong> crystals every second",
maxCount: 9,
count: 0,
frequency: 4,
frequencyDefault: 4,
allowed() {
return tech.isRelay
},
requires: "relay switch",
effect() {
tech.relayIce++
},
remove() {
tech.relayIce = 0
}
},
{
name: "NAND gate",
description: "if <strong>flip-flop</strong> is in the <strong class='color-flop'>ON</strong> state<br>do <strong>55.5%</strong> more <strong class='color-d'>damage</strong>",
description: "if in the <strong class='color-flop'>ON</strong> state<br>do <strong>55.5%</strong> more <strong class='color-d'>damage</strong>",
maxCount: 1,
count: 0,
frequency: 4,
frequencyDefault: 4,
allowed() {
return tech.isFlipFlop
return tech.isFlipFlop || tech.isRelay
},
requires: "flip-flop",
requires: "ON/OFF tech",
effect() {
tech.isFlipFlopDamage = true;
},
@@ -1497,15 +1520,15 @@
}
}, {
name: "transistor",
description: "if <strong>flip-flop</strong> is <strong class='color-flop'>ON</strong> regen <strong>22</strong> <strong class='color-f'>energy</strong> per second<br>if <strong>flip-flop</strong> is <strong class='color-flop'>OFF</strong> drain <strong>3.1</strong> <strong class='color-f'>energy</strong> per second",
description: "if <strong class='color-flop'>ON</strong> regen <strong>22</strong> <strong class='color-f'>energy</strong> per second<br>if <strong class='color-flop'>OFF</strong> drain <strong>3.1</strong> <strong class='color-f'>energy</strong> per second",
maxCount: 1,
count: 0,
frequency: 4,
frequencyDefault: 4,
allowed() {
return tech.isFlipFlop
return tech.isFlipFlop || tech.isRelay
},
requires: "flip-flop",
requires: "ON/OFF tech",
effect() {
tech.isFlipFlopEnergy = true;
},
@@ -1514,7 +1537,7 @@
}
}, {
name: "shift registers",
description: "set <strong>flip-flop</strong> to the <strong class='color-flop'>ON</strong> state<br>at the start of a <strong>level</strong>",
description: "set to the <strong class='color-flop'>ON</strong> state<br>at the start of a <strong>level</strong>",
maxCount: 1,
count: 0,
frequency: 4,
@@ -1522,14 +1545,15 @@
allowed() {
return tech.isFlipFlopEnergy || tech.isFlipFlopDamage || tech.isFlipFlopHarm
},
requires: "2 flip-flop techs",
requires: "2 ON/OFF techs",
effect() {
tech.isFlipFlopLevelReset = true;
},
remove() {
tech.isFlipFlopLevelReset = false;
}
}, {
},
{
name: "clock gating",
description: `<strong>slow</strong> <strong>time</strong> by <strong>50%</strong> after receiving <strong class='color-harm'>harm</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>20%</strong>`,
maxCount: 1,
@@ -1569,7 +1593,7 @@
count: 0,
frequency: 2,
allowed() {
return tech.isStunField || tech.isPulseStun || tech.oneSuperBall || tech.isHarmFreeze || tech.isIceField || tech.isIceCrystals || tech.isSporeFreeze || tech.isAoESlow || tech.isFreezeMobs || tech.isCloakStun || tech.orbitBotCount > 1 || tech.isWormholeDamage
return tech.isStunField || tech.isPulseStun || tech.oneSuperBall || tech.isHarmFreeze || tech.isIceField || tech.relayIce || tech.isIceCrystals || tech.isSporeFreeze || tech.isAoESlow || tech.isFreezeMobs || tech.isCloakStun || tech.orbitBotCount > 1 || tech.isWormholeDamage
},
requires: "a freezing or stunning effect",
effect() {
@@ -1586,7 +1610,7 @@
count: 0,
frequency: 2,
allowed() {
return tech.isIceCrystals || tech.isSporeFreeze || tech.isIceField
return tech.isIceCrystals || tech.isSporeFreeze || tech.isIceField || tech.relayIce
},
requires: "a localized freeze effect",
effect() {
@@ -2155,7 +2179,7 @@
isNonRefundable: true,
isBadRandomOption: true,
allowed() {
return ((m.health / m.maxHealth) < 0.7 || build.isExperimentSelection) && !tech.isNoHeals
return (m.health / m.maxHealth) < 0.7 && !tech.isNoHeals
},
requires: "health > 70%, not ergodicity",
effect() {
@@ -2192,7 +2216,7 @@
powerUps.research.changeRerolls(0)
}, 1000);
},
description: "use <strong>1</strong> <strong class='color-r'>research</strong> to avoid <strong>dying</strong><br>and spawn <strong>6</strong> <strong class='color-h'>heal</strong> power ups once per level",
description: "once per level use <strong>1</strong> <strong class='color-r'>research</strong><br>to prevent <strong>dying</strong> and spawn <strong>6</strong> <strong class='color-h'>heals</strong>",
maxCount: 1,
count: 0,
frequency: 2,
@@ -2836,7 +2860,8 @@
requires: "between levels 1 and 7",
effect() {
level.difficultyDecrease(simulation.difficultyMode)
simulation.makeTextLog(`simulation.difficultyMode <span class='color-symbol'>--</span>`)
// simulation.difficulty<span class='color-symbol'>-=</span>
simulation.makeTextLog(`level.difficultyDecrease(simulation.difficultyMode)`)
tech.addJunkTechToPool(18)
// for (let i = 0; i < tech.junk.length; i++) tech.tech.push(tech.junk[i])
},
@@ -2860,7 +2885,7 @@
effect() {
tech.isNoHeals = true;
level.difficultyDecrease(simulation.difficultyMode * 2)
simulation.makeTextLog(`simulation.difficultyMode <span class='color-symbol'>-=</span> 2`)
simulation.makeTextLog(`level.difficultyDecrease(simulation.difficultyMode <span class='color-symbol'>*</span> 2)`)
powerUps.heal.color = "#abb"
for (let i = 0; i < powerUp.length; i++) { //find active heal power ups and adjust color live
if (powerUp[i].name === "heal") powerUp[i].color = powerUps.heal.color
@@ -4366,7 +4391,7 @@
}
}, {
name: "ice IX manufacturing",
description: "<strong>nano-scale manufacturing</strong> is repurposed<br>excess <strong class='color-f'>energy</strong> used to synthesize <strong class='color-s'>ice IX</strong>",
description: "<strong>nano-scale manufacturing</strong> is repurposed<br>excess <strong class='color-f'>energy</strong> used to condense <strong class='color-s'>ice IX</strong>",
isFieldTech: true,
maxCount: 1,
count: 0,
@@ -4389,7 +4414,7 @@
count: 0,
frequency: 2,
allowed() {
return tech.isIceField
return tech.isIceField || tech.relayIce
},
requires: "ice IX",
effect() {
@@ -5953,9 +5978,11 @@
isFlipFlopLevelReset: null,
isFlipFlopDamage: null,
isFlipFlopEnergy: null,
isRelay: null,
relayIce: null,
isMetaAnalysis: null,
isFoamAttract: null,
droneCycleReduction: null,
droneEnergyReduction: null,
isNoHeals: null
isNoHeals: null,
}

View File

@@ -1,10 +1,9 @@
******************************************************** NEXT PATCH ********************************************************
more bug fixes (pulse color, backwards induction giving too many tech)
mobs can now see through blocks
mobs spawns and level spawns have been adjusted to prevent getting zonked at the start of a level
bug fix - grower mob becoming immune to damage when shielded and growing bigger than shield
relay switch - toggles ON/OFF when you pick up a power up
tech: ice IX condenser - if ON make a couple Ice IX crystals every second
******************************************************** BUGS ********************************************************
@@ -38,6 +37,7 @@ fix door.isOpen actually meaning isClosed?
******************************************************** TODO ********************************************************
have junk tech drop frequency to 0 after showing up once
but add way more junk tech into the pool
how to communicate that to player?
console message