shape-memory alloy

tech lithium-ion - give 200 max energy when relay is ON
tech shape-memory alloy - give 200 max health when flip-flop is ON
  NOR gate now prevents damage when in the OFF state (previously ON) to work well with shape-memory alloy

harpoon crouch mode now retracts at 30% greater distance than normal with no targeting

more bug fixes of course
This commit is contained in:
landgreen
2022-03-30 05:59:33 -07:00
parent d0ed1c6d03
commit 62eb66a002
7 changed files with 111 additions and 69 deletions

View File

@@ -6315,11 +6315,11 @@ const b = {
this.charge += 0.00001
},
grappleFire() {
const where = {
x: m.pos.x + 30 * Math.cos(m.angle),
y: m.pos.y + 30 * Math.sin(m.angle)
}
const harpoonSize = (tech.isLargeHarpoon ? 1 + 0.1 * Math.sqrt(this.ammo) : 1) //* (input.down ? 0.7 : 1)
const where = {
x: m.pos.x + harpoonSize * 40 * Math.cos(m.angle),
y: m.pos.y + harpoonSize * 40 * Math.sin(m.angle)
}
if (tech.extraHarpoons && !input.down) { //multiple harpoons
const SPREAD = 0.06
const len = tech.extraHarpoons + 1
@@ -6353,7 +6353,7 @@ const b = {
}
//look for closest mob in player's LoS
const harpoonSize = (tech.isLargeHarpoon ? 1 + 0.1 * Math.sqrt(this.ammo) : 1) //* (input.down ? 0.7 : 1)
const totalCycles = 7 * (tech.isFilament ? 1 + 0.01 * Math.min(110, this.ammo) : 1) * Math.sqrt(harpoonSize)
const totalCycles = 6 * (tech.isFilament ? 1 + 0.01 * Math.min(110, this.ammo) : 1) * Math.sqrt(harpoonSize)
if (tech.extraHarpoons && !input.down) { //multiple harpoons
const SPREAD = 0.1
@@ -6404,7 +6404,7 @@ const b = {
}
}
if (input.down) {
b.harpoon(where, closest.target, m.angle, harpoonSize, false, 70)
b.harpoon(where, null, m.angle, harpoonSize, true, 1.5 * totalCycles)
} else {
b.harpoon(where, closest.target, m.angle, harpoonSize, true, totalCycles)
}

View File

@@ -117,13 +117,14 @@ function collisionChecks(event) {
tech.isFlipFlopOn = false
if (document.getElementById("tech-flip-flop")) document.getElementById("tech-flip-flop").innerHTML = ` = <strong>OFF</strong>`
m.eyeFillColor = 'transparent'
if (!tech.isFlipFlopHarm) m.damage(dmg);
m.damage(dmg);
} else {
tech.isFlipFlopOn = true //immune to damage this hit, lose immunity for next hit
if (document.getElementById("tech-flip-flop")) document.getElementById("tech-flip-flop").innerHTML = ` = <strong>ON</strong>`
m.eyeFillColor = m.fieldMeterColor //'#0cf'
m.damage(dmg);
if (!tech.isFlipFlopHarm) m.damage(dmg);
}
m.setMaxHealth();
} else {
m.damage(dmg); //normal damage
}

View File

@@ -18,7 +18,8 @@ const level = {
// m.setField("metamaterial cloaking")
// b.giveGuns("harpoon")
// tech.giveTech("grappling hook")
// tech.giveTech("capacitor bank")
// tech.giveTech("railgun")
// tech.giveTech("shape-memory alloy")
// for (let i = 0; i < 2; i++) powerUps.directSpawn(0, 0, "tech");
// for (let i = 0; i < 2; i++) tech.giveTech("corona discharge")
// for (let i = 10; i < tech.tech.length; i++) { tech.tech[i].isBanished = true }
@@ -107,6 +108,8 @@ const level = {
// if (tech.isFlipFlopLevelReset && !tech.isFlipFlopOn) {
if ((tech.isRelay || tech.isFlipFlop) && !tech.isFlipFlopOn) {
tech.isFlipFlopOn = true
m.setMaxHealth()
m.setMaxEnergy()
m.eyeFillColor = m.fieldMeterColor
simulation.makeTextLog(`tech.isFlipFlopOn <span class='color-symbol'>=</span> true`);
}

View File

@@ -491,7 +491,7 @@ const m = {
},
baseHealth: 1,
setMaxHealth() {
m.maxHealth = m.baseHealth + tech.extraMaxHealth + tech.isFallingDamage //+ tech.bonusHealth
m.maxHealth = m.baseHealth + tech.extraMaxHealth + tech.isFallingDamage + 2 * tech.isFlipFlop * tech.isFlipFlopOn * tech.isFlipFlopHealth
document.getElementById("health-bg").style.width = `${Math.floor(300 * m.maxHealth)}px`
simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-h'>maxHealth</span> <span class='color-symbol'>=</span> ${m.maxHealth.toFixed(2)}`)
if (m.health > m.maxHealth) m.health = m.maxHealth;
@@ -962,7 +962,7 @@ const m = {
}
},
setMaxEnergy() {
m.maxEnergy = (tech.isMaxEnergyTech ? 0.5 : 1) + tech.bonusEnergy + tech.healMaxEnergyBonus + tech.harmonicEnergy + 2 * tech.isGroundState
m.maxEnergy = (tech.isMaxEnergyTech ? 0.5 : 1) + tech.bonusEnergy + tech.healMaxEnergyBonus + tech.harmonicEnergy + 2 * tech.isGroundState + 2 * tech.isRelay * tech.isFlipFlopOn * tech.isRelayEnergy
simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-f'>maxEnergy</span> <span class='color-symbol'>=</span> ${(m.maxEnergy.toFixed(2))}`)
},
fieldMeterColor: "#0cf",

View File

@@ -889,6 +889,8 @@ const powerUps = {
if (document.getElementById("tech-switch")) document.getElementById("tech-switch").innerHTML = ` = <strong>ON</strong>`
m.eyeFillColor = m.fieldMeterColor //'#0cf'
}
m.setMaxEnergy();
m.setMaxHealth();
}
},
// giveRandomAmmo() {

View File

@@ -1656,11 +1656,11 @@ const tech = {
},
{
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",
description: "if <strong>flip-flop</strong> is in the <strong class='color-flop'>OFF</strong> state<br>take <strong>0</strong> <strong class='color-harm'>harm</strong> from collisions with mobs",
maxCount: 1,
count: 0,
frequency: 4,
frequencyDefault: 4,
frequency: 3,
frequencyDefault: 3,
allowed() {
return tech.isFlipFlop
},
@@ -1672,6 +1672,26 @@ const tech = {
tech.isFlipFlopHarm = false
}
},
{
name: "shape-memory alloy",
description: "if <strong>flip-flop</strong> is in the <strong class='color-flop'>ON</strong> state<br>increase your <strong>maximum</strong> <strong class='color-h'>health</strong> by <strong>200</strong>",
maxCount: 1,
count: 0,
frequency: 3,
frequencyDefault: 3,
allowed() {
return tech.isFlipFlop && !tech.isEnergyHealth
},
requires: "flip-flop, not mass-energy equivalence",
effect() {
tech.isFlipFlopHealth = true;
m.setMaxHealth();
},
remove() {
tech.isFlipFlopHealth = false;
m.setMaxHealth();
}
},
{
name: "flip-flop",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Flip-flop_(electronics)' class="link">flip-flop</a>`,
@@ -1711,6 +1731,42 @@ const tech = {
m.eyeFillColor = 'transparent'
}
},
{
name: "NAND gate",
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: 3,
frequencyDefault: 3,
allowed() {
return tech.isFlipFlop || tech.isRelay
},
requires: "ON/OFF tech",
effect() {
tech.isFlipFlopDamage = true;
},
remove() {
tech.isFlipFlopDamage = false;
}
},
{
name: "transistor",
description: "if <strong class='color-flop'>ON</strong> regen <strong>20</strong> <strong class='color-f'>energy</strong> per second<br>if <strong class='color-flop'>OFF</strong> drain <strong>1</strong> <strong class='color-f'>energy</strong> per second",
maxCount: 1,
count: 0,
frequency: 3,
frequencyDefault: 3,
allowed() {
return tech.isFlipFlop || tech.isRelay
},
requires: "ON/OFF tech",
effect() {
tech.isFlipFlopEnergy = true;
},
remove() {
tech.isFlipFlopEnergy = false;
}
},
{
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>`,
@@ -1750,39 +1806,23 @@ const tech = {
}
},
{
name: "NAND gate",
description: "if in the <strong class='color-flop'>ON</strong> state<br>do <strong>55.5%</strong> more <strong class='color-d'>damage</strong>",
name: "lithium-ion",
description: "if <strong>relay switch</strong> is in the <strong class='color-flop'>ON</strong> state<br>increase your <strong>maximum</strong> <strong class='color-f'>energy</strong> by <strong>200</strong>",
maxCount: 1,
count: 0,
frequency: 4,
frequencyDefault: 4,
frequency: 3,
frequencyDefault: 3,
allowed() {
return tech.isFlipFlop || tech.isRelay
return tech.isRelay
},
requires: "ON/OFF tech",
effect() {
tech.isFlipFlopDamage = true;
requires: "relay switch",
effect: () => {
tech.isRelayEnergy = true
m.setMaxEnergy()
},
remove() {
tech.isFlipFlopDamage = false;
}
},
{
name: "transistor",
description: "if <strong class='color-flop'>ON</strong> regen <strong>20</strong> <strong class='color-f'>energy</strong> per second<br>if <strong class='color-flop'>OFF</strong> drain <strong>1</strong> <strong class='color-f'>energy</strong> per second",
maxCount: 1,
count: 0,
frequency: 4,
frequencyDefault: 4,
allowed() {
return tech.isFlipFlop || tech.isRelay
},
requires: "ON/OFF tech",
effect() {
tech.isFlipFlopEnergy = true;
},
remove() {
tech.isFlipFlopEnergy = false;
tech.isRelayEnergy = false
m.setMaxEnergy()
}
},
// {
@@ -1803,13 +1843,14 @@ const tech = {
// tech.isFlipFlopLevelReset = false;
// }
// },
{
name: "thermocouple",
description: "if <strong>relay switch</strong> is in the <strong class='color-flop'>ON</strong> state<br>condense <strong>4-13</strong> <strong class='color-s'>ice IX</strong> crystals every second",
maxCount: 9,
count: 0,
frequency: 4,
frequencyDefault: 4,
frequency: 3,
frequencyDefault: 3,
allowed() {
return tech.isRelay
},
@@ -6707,9 +6748,9 @@ const tech = {
frequency: 2,
frequencyDefault: 2,
allowed() {
return m.fieldUpgrades[m.fieldMode].name === "plasma torch" && !tech.isExtruder && tech.isPlasmaRange === 1
return m.fieldUpgrades[m.fieldMode].name === "plasma torch" && tech.isPlasmaBall
},
requires: "plasma torch, not extruder, plasma jet",
requires: "plasma ball",
effect() {
tech.plasmaDischarge += 0.03
},
@@ -9556,5 +9597,7 @@ const tech = {
isDronesTravel: null,
isTechDebt: null,
isPlasmaBall: null,
plasmaDischarge: null
plasmaDischarge: null,
isFlipFlopHealth: null,
isRelayEnergy: null,
}