possible bug fixes for the crouch lock bug

tech: NAND gate -  at the start of a level set flip-flop to "on"
tech: NOR gate - do 50% more damage when the flip-flop is in the "off" state
This commit is contained in:
landgreen
2021-02-27 12:47:16 -08:00
parent 5c466b4e09
commit 542815478e
9 changed files with 154 additions and 67 deletions

View File

@@ -450,7 +450,7 @@ const b = {
},
pulse(energy, angle = m.angle) {
let best;
let explosionRange = 1560 * energy
let explosionRadius = 1400 * energy
let range = 3000
const path = [{
x: m.pos.x + 20 * Math.cos(angle),
@@ -514,7 +514,7 @@ const b = {
let dist = 2200
for (let i = 0, len = mob.length; i < len; i++) {
const newDist = Vector.magnitude(Vector.sub(path[0], mob[i].position))
if (explosionRange < newDist &&
if (explosionRadius < newDist &&
newDist < dist &&
Matter.Query.ray(map, path[0], mob[i].position).length === 0 &&
Matter.Query.ray(body, path[0], mob[i].position).length === 0) {
@@ -535,7 +535,7 @@ const b = {
};
}
}
if (best.who) b.explosion(path[1], explosionRange, true)
if (best.who) b.explosion(path[1], explosionRadius, true)
if (tech.isPulseStun) {
const range = 100 + 2000 * energy
@@ -2277,6 +2277,7 @@ const b = {
tech.foamBotCount = 0
tech.boomBotCount = 0
tech.orbitBotCount = 0
tech.missileBotCount = 0
},
respawnBots() {
for (let i = 0; i < tech.dynamoBotCount; i++) b.dynamoBot({ x: player.position.x + 50 * (Math.random() - 0.5), y: player.position.y + 50 * (Math.random() - 0.5) }, false)
@@ -2612,7 +2613,7 @@ const b = {
range: (700 + 400 * tech.isLaserBotUpgrade) * (1 + 0.1 * Math.random()),
drainThreshold: tech.isEnergyHealth ? 0.6 : 0.4,
drain: 0.56 - 0.42 * tech.isLaserBotUpgrade,
laserDamage: 0.5 + 0.35 * tech.isLaserBotUpgrade,
laserDamage: 0.55 + 0.39 * tech.isLaserBotUpgrade,
endCycle: Infinity,
classType: "bullet",
collisionFilter: {
@@ -4398,7 +4399,7 @@ const b = {
x: 7.5 * Math.cos(m.angle - Math.PI / 2),
y: 7.5 * Math.sin(m.angle - Math.PI / 2)
}
const dmg = 0.55 * tech.laserDamage // 3.5 * 0.55 = 200% more damage
const dmg = 0.6 * tech.laserDamage // 3.5 * 0.55 = 200% more damage
const where = { x: m.pos.x + 30 * Math.cos(m.angle), y: m.pos.y + 30 * Math.sin(m.angle) }
const eye = {
x: m.pos.x + 15 * Math.cos(m.angle),

View File

@@ -109,14 +109,14 @@ function collisionChecks(event) {
return
}
if (tech.isAnthropicHarm) {
if (!tech.isAnthropicHarmImmune) {
tech.isAnthropicHarmImmune = true
if (document.getElementById("tech-flip-flop")) document.getElementById("tech-flip-flop").innerHTML = ` = on`
if (tech.isFlipFlopHarm) {
if (!tech.isFlipFlopHarmImmune) {
tech.isFlipFlopHarmImmune = true
if (document.getElementById("tech-flip-flop")) document.getElementById("tech-flip-flop").innerHTML = ` = <strong>on</strong>`
m.damage(dmg * 1.25); //damage triggers immune to next hit with extra 10% damage
} else {
tech.isAnthropicHarmImmune = false //immune to damage this hit, lose immunity for next hit
if (document.getElementById("tech-flip-flop")) document.getElementById("tech-flip-flop").innerHTML = ` = off`
tech.isFlipFlopHarmImmune = false //immune to damage this hit, lose immunity for next hit
if (document.getElementById("tech-flip-flop")) document.getElementById("tech-flip-flop").innerHTML = ` = <strong>off</strong>`
}
} else {
m.damage(dmg); //normal damage

View File

@@ -86,6 +86,17 @@ const level = {
tech.armorFromPowerUps += Math.min(0.03 * powerUps.totalPowerUps, 0.51)
m.setMaxHealth();
}
if (tech.isGunCycle) {
b.inventoryGun++;
if (b.inventoryGun > b.inventory.length - 1) b.inventoryGun = 0;
simulation.switchGun();
}
if (tech.isSwitchReality) {
simulation.makeTextLog(`simulation.amplitude <span class='color-symbol'>=</span> ${Math.random()}`);
m.switchWorlds()
simulation.trails()
for (let i = 0; i < 2; i++) powerUps.spawn(m.pos.x + Math.random() * 10, m.pos.y + Math.random() * 10, "tech", false);
}
if (tech.isHealLowHealth) {
const len = Math.floor((m.maxHealth - m.health) / 0.5)
for (let i = 0; i < len; i++) {
@@ -105,16 +116,10 @@ const level = {
if (tech.isPerpetualStun) {
for (let i = 0; i < mob.length; i++) mobs.statusStun(mob[i], 780)
}
if (tech.isGunCycle) {
b.inventoryGun++;
if (b.inventoryGun > b.inventory.length - 1) b.inventoryGun = 0;
simulation.switchGun();
}
if (tech.isSwitchReality) {
simulation.makeTextLog(`simulation.amplitude <span class='color-symbol'>=</span> ${Math.random()}`);
m.switchWorlds()
simulation.trails()
for (let i = 0; i < 2; i++) powerUps.spawn(m.pos.x + Math.random() * 10, m.pos.y + Math.random() * 10, "tech", false);
if (tech.isFlipFlopHarm && tech.isFlipFlopLevelReset && !tech.isFlipFlopHarmImmune) {
tech.isFlipFlopHarmImmune = true
// if (document.getElementById("tech-flip-flop")) document.getElementById("tech-flip-flop").innerHTML = ` = <strong>on</strong>`
simulation.makeTextLog(`tech.isFlipFlopHarmImmune <span class='color-symbol'>=</span> true`);
}
},
custom() {},
@@ -1090,7 +1095,7 @@ const level = {
// spawn.boost(1500, 0, 900);
// spawn.starter(1900, -500, 200) //big boy
spawn.starter(1900, -500)
// spawn.starter(1900, -500)
// spawn.historyBoss(1900, -500)
// spawn.ghoster(2900, -500)
// spawn.launcherBoss(1200, -500)
@@ -1100,15 +1105,15 @@ const level = {
// spawn.bomberBoss(1400, -500)
// spawn.sniper(1800, -120)
// spawn.streamBoss(1600, -500)
simulation.difficulty = 30
spawn.orbitalBoss(1600, -500)
// spawn.cellBossCulture(1600, -500)
// spawn.cellBossCulture(1600, -500)
// simulation.difficulty = 30
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.snakeBoss(1200, -500)
// spawn.snakeBoss(1200, -500)
// spawn.powerUpBoss(2900, -500)
// spawn.randomMob(1600, -500)
},

View File

@@ -389,6 +389,7 @@ const m = {
simulation.makeGunHUD(); //update gun HUD
simulation.updateTechHUD();
simulation.isTextLogOpen = true;
if (m.holdingTarget) m.drop();
},
death() {
if (tech.isImmortal) { //if player has the immortality buff, spawn on the same level with randomized damage
@@ -2249,10 +2250,10 @@ const m = {
},
{
name: "wormhole",
description: "use <strong class='color-f'>energy</strong> to <strong>tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br><strong class='color-worm'>wormholes</strong> attract blocks and power ups<br><strong>10%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong>", //<br>bullets may also traverse <strong class='color-worm'>wormholes</strong>
description: "use <strong class='color-f'>energy</strong> to <strong>tunnel</strong> through a <strong class='color-worm'>wormhole</strong><br><strong class='color-worm'>wormholes</strong> attract blocks and power ups<br><strong>7%</strong> chance to <strong class='color-dup'>duplicate</strong> spawned <strong>power ups</strong>", //<br>bullets may also traverse <strong class='color-worm'>wormholes</strong>
effect: function() {
m.drop();
m.duplicateChance = 0.1
m.duplicateChance = 0.07
simulation.draw.powerUp = simulation.draw.powerUpBonus //change power up draw
// if (tech.isRewindGun) {

View File

@@ -73,6 +73,7 @@ const powerUps = {
if (m.immuneCycle < m.cycle + tech.collisionImmuneCycles) m.immuneCycle = m.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
build.unPauseGrid()
requestAnimationFrame(cycle);
if (m.holdingTarget) m.drop();
},
research: {
count: 0,

View File

@@ -105,7 +105,7 @@ const spawn = {
level.levels.push("null")
level.exit.x = 5500;
level.exit.y = -330;
simulation.makeTextLog(`<span class="lore-text">undecided</span> <span class='color-symbol'>=</span> ${lore.techCount}/10<br>level.levels.push("null")`);
simulation.makeTextLog(`<span class="lore-text">undefined</span> <span class='color-symbol'>=</span> ${lore.techCount}/10<br>level.levels.push("null")`);
//remove block map element so exit is clear
Matter.World.remove(engine.world, map[map.length - 1]);
map.splice(map.length - 1, 1);
@@ -124,7 +124,7 @@ const spawn = {
setTimeout(function() {
simulation.makeTextLog(`simulation.analysis <span class='color-symbol'>=</span> 1`);
setTimeout(() => {
simulation.makeTextLog(`<span class="lore-text">undecided</span> <span class='color-symbol'>=</span> ${lore.techCount}/10`);
simulation.makeTextLog(`<span class="lore-text">undefined</span> <span class='color-symbol'>=</span> ${lore.techCount}/10`);
setTimeout(() => {
if (!simulation.paused && !simulation.testing) {
simulation.makeTextLog(`World.clear(engine.world)`);
@@ -835,7 +835,7 @@ const spawn = {
me.stroke = "transparent"; //used for drawSneaker
me.eventHorizon = radius * 23; //required for blackhole
me.seeAtDistance2 = (me.eventHorizon + 400) * (me.eventHorizon + 400); //vision limit is event horizon
me.accelMag = 0.00009 * simulation.accelScale;
me.accelMag = 0.0001 * simulation.accelScale;
me.frictionAir = 0.025;
me.collisionFilter.mask = cat.player | cat.bullet
me.memory = Infinity;
@@ -2587,7 +2587,7 @@ const spawn = {
World.add(engine.world, consBB[consBB.length - 1]);
spawn.shield(me, x, y, 1);
},
snakeBody(x, y, radius = 14) {
snakeBody(x, y, radius = 10) {
mobs.spawn(x, y, 8, radius, "rgba(0,180,180,0.4)");
let me = mob[mob.length - 1];
// me.onHit = function() {

View File

@@ -108,6 +108,7 @@
},
damageFromTech() {
let dmg = m.fieldDamage
if (tech.isFlipFlopDamage && !tech.isFlipFlopHarmImmune) dmg *= 1.5
if (tech.isAnthropicDamage && tech.isDeathAvoidedThisLevel) dmg *= 2.37
if (tech.isDamageAfterKill) dmg *= (m.lastKillCycle + 300 > m.cycle) ? 1.5 : 0.5
if (tech.isTechDamage) dmg *= 2
@@ -1187,15 +1188,15 @@
},
{
name: "flip-flop",
description: "after a <strong>collision</strong> take <strong>25%</strong> more <strong class='color-harm'>harm</strong><br>but, on your next <strong>collision</strong> take <strong>0</strong> <strong class='color-harm'>harm</strong>",
description: "take <strong>25%</strong> more <strong class='color-harm'>harm</strong> from a <strong>collision</strong><br>but, on your next <strong>collision</strong> take <strong>0</strong> <strong class='color-harm'>harm</strong>",
nameInfo: "<span id = 'tech-flip-flop'></span>",
addNameInfo() {
setTimeout(function() {
if (document.getElementById("tech-flip-flop")) {
if (tech.isAnthropicHarmImmune) {
document.getElementById("tech-flip-flop").innerHTML = ` = on`
if (tech.isFlipFlopHarmImmune) {
document.getElementById("tech-flip-flop").innerHTML = ` = <strong>on</strong>`
} else {
document.getElementById("tech-flip-flop").innerHTML = ` = off`
document.getElementById("tech-flip-flop").innerHTML = ` = <strong>off</strong>`
}
}
}, 100);
@@ -1207,12 +1208,44 @@
},
requires: "",
effect() {
tech.isAnthropicHarm = true //do you have this tech
tech.isAnthropicHarmImmune = false //are you immune to next collision
tech.isFlipFlopHarm = true //do you have this tech
tech.isFlipFlopHarmImmune = false //are you immune to next collision?
},
remove() {
tech.isAnthropicHarm = false
tech.isAnthropicHarmImmune = false
tech.isFlipFlopHarm = false
tech.isFlipFlopHarmImmune = false
}
},
{
name: "NAND gate",
description: "set <strong>flip-flip</strong> to the <strong>on</strong> state at start of a <strong>level</strong><br><em>take 0 harm on your next collision</em>",
maxCount: 1,
count: 0,
allowed() {
return tech.isFlipFlopHarm
},
requires: "flip-flop",
effect() {
tech.isFlipFlopLevelReset = true;
},
remove() {
tech.isFlipFlopLevelReset = true;
}
},
{
name: "NOR gate",
description: "do <strong>50%</strong> more <strong class='color-d'>damage</strong><br>while <strong>flip-flip</strong> is in the <strong>off</strong> state",
maxCount: 1,
count: 0,
allowed() {
return tech.isFlipFlopHarm
},
requires: "flip-flop",
effect() {
tech.isFlipFlopDamage = true;
},
remove() {
tech.isFlipFlopDamage = true;
}
},
{
@@ -1368,7 +1401,7 @@
maxCount: 1,
count: 0,
allowed() {
return !tech.isEnergyHealth && (m.harmReduction() < 1 || tech.isAnthropicHarm)
return !tech.isEnergyHealth && (m.harmReduction() < 1 || tech.isFlipFlopHarm)
},
requires: "not mass-energy equivalence, some harm reduction",
effect() {
@@ -1736,9 +1769,9 @@
maxCount: 1,
count: 0,
allowed() {
return !tech.isEnergyHealth
return !tech.isEnergyHealth && !tech.isDroneGrab
},
requires: "not mass-energy equivalence",
requires: "not mass-energy equivalence, not drone harvester",
effect() {
tech.isArmorFromPowerUps = true; //tracked by tech.armorFromPowerUps
},
@@ -3270,7 +3303,7 @@
allowed() {
return !tech.isArmorFromPowerUps && (tech.haveGunCheck("drones") || (m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField)))
},
requires: "drones",
requires: "drones, not inductive coupling",
effect() {
tech.isDroneGrab = true
},
@@ -3434,7 +3467,7 @@
},
{
name: "laser diodes",
description: "all <strong class='color-laser'>lasers</strong> drain <strong>37%</strong> less <strong class='color-f'>energy</strong><br><em>effects laser-gun, laser-bot, and laser-mines</em>",
description: "all <strong class='color-laser'>lasers</strong> drain <strong>30%</strong> less <strong class='color-f'>energy</strong><br><em>effects laser-gun, laser-bot, and laser-mines</em>",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -3443,7 +3476,7 @@
},
requires: "laser",
effect() {
tech.isLaserDiode = 0.63; //100%-37%
tech.isLaserDiode = 0.70; //100%-37%
},
remove() {
tech.isLaserDiode = 1;
@@ -4336,7 +4369,7 @@
},
{
name: "ship",
description: "<strong>experiment:</strong> fly around with no legs<br>aim by rotating with keyboard",
description: "<strong>experiment:</strong> fly around with no legs<br>aim with the keyboard",
maxCount: 1,
count: 0,
isNonRefundable: true,
@@ -4371,6 +4404,27 @@
},
remove() {}
},
{
name: "shields",
description: "<strong>experiment:</strong> every 5 seconds<br>all mobs gain a shield",
maxCount: 1,
count: 0,
isNonRefundable: true,
isBadRandomOption: true,
isExperimentalMode: true,
allowed() {
return build.isExperimentSelection
},
requires: "",
effect() {
setInterval(() => {
for (let i = 0; i < mob.length; i++) {
if (!mob[i].isShielded && !mob[i].shield && mob[i].dropPowerUp) spawn.shield(mob[i], mob[i].position.x, mob[i].position.y, 1, true);
}
}, 5000); //every 5 sections
},
remove() {}
},
],
addLoreTechToPool() { //adds lore tech to tech pool
if (!simulation.isCheating) {
@@ -4458,7 +4512,7 @@
requires: "",
effect() {
setInterval(() => {
alert(`The best combo is <strong>${tech.tech[Math.floor(Math.random() * tech.tech.length)].name}</strong> with <strong>${tech.tech[Math.floor(Math.random() * tech.tech.length)].name}</strong>!`);
alert(`The best combo is ${tech.tech[Math.floor(Math.random() * tech.tech.length)].name} with ${tech.tech[Math.floor(Math.random() * tech.tech.length)].name}!`);
}, 30000); //every 30 sections
},
remove() {}
@@ -5403,6 +5457,8 @@
isSwitchReality: null,
isResearchReality: null,
isAnthropicDamage: null,
isAnthropicHarm: null,
isAnthropicHarmImmune: null
isFlipFlopHarm: null,
isFlipFlopHarmImmune: null,
isFlipFlopLevelReset: null,
isFlipFlopDamage: null
}