refractory metal

extruder:
  new tech: refractory metal - increase extruder damage radius
  fixed extruder graphics bug, and collisions bug
  dynamical systems and discrete optimization are allowed with plasma torch
    (although I nerfed them both just a bit)

irradiated nails: 90% damage spread over 2s -> 3s
  same total damage, but it takes 1 second longer
toggling harpoon: 6x -> 8x damage
  also the graphic effect is more obvious
slasher mobs will grow their sword at the farthest vertex from the player
This commit is contained in:
landgreen
2021-10-09 16:46:16 -07:00
parent f135046e0b
commit 90e9e73084
10 changed files with 265 additions and 206 deletions

View File

@@ -1141,6 +1141,7 @@ const b = {
this.frictionAir = 0.01
this.do = () => {
this.force.y += this.mass * 0.003; //gravity
this.draw();
}
}
@@ -1165,7 +1166,7 @@ const b = {
this.caughtPowerUp.effect();
Matter.Composite.remove(engine.world, this.caughtPowerUp);
powerUp.splice(index, 1);
if (tech.isHarpoonPowerUp) tech.harpoonDensity = 0.008 * 6 //0.006 is normal
if (tech.isHarpoonPowerUp) tech.harpoonDensity = 0.008 * 8 //0.006 is normal
} else {
this.dropCaughtPowerUp()
}
@@ -1173,23 +1174,42 @@ const b = {
this.dropCaughtPowerUp()
}
},
drawToggleHarpoon() {
ctx.beginPath();
ctx.moveTo(this.vertices[0].x, this.vertices[0].y);
for (let j = 1, len = this.vertices.length; j < len; j += 1) ctx.lineTo(this.vertices[j].x, this.vertices[j].y);
ctx.lineTo(this.vertices[0].x, this.vertices[0].y);
ctx.lineJoin = "miter"
ctx.miterLimit = 100;
ctx.lineWidth = 60;
ctx.strokeStyle = "rgba(0,255,255,0.25)";
ctx.stroke();
ctx.lineWidth = 20;
ctx.strokeStyle = "rgb(0,255,255)";
ctx.stroke();
ctx.lineJoin = "round"
ctx.miterLimit = 10
ctx.sillStyle = "#000"
ctx.fill();
},
drawString() {
if (isReturn) {
const where = {
x: m.pos.x + 30 * Math.cos(m.angle),
y: m.pos.y + 30 * Math.sin(m.angle)
}
const sub = Vector.sub(where, this.vertices[0])
const perpendicular = Vector.mult(Vector.normalise(Vector.perp(sub)), this.drawStringFlip * Math.min(80, 10 + this.drawStringControlMagnitude / (10 + Vector.magnitude(sub))))
const controlPoint = Vector.add(Vector.add(where, Vector.mult(sub, -0.5)), perpendicular)
ctx.strokeStyle = "#000" // "#0ce"
ctx.lineWidth = 0.5
ctx.beginPath();
ctx.moveTo(where.x, where.y);
ctx.quadraticCurveTo(controlPoint.x, controlPoint.y, this.vertices[0].x, this.vertices[0].y)
// ctx.lineTo(this.vertices[0].x, this.vertices[0].y);
ctx.stroke();
const where = {
x: m.pos.x + 30 * Math.cos(m.angle),
y: m.pos.y + 30 * Math.sin(m.angle)
}
const sub = Vector.sub(where, this.vertices[0])
const perpendicular = Vector.mult(Vector.normalise(Vector.perp(sub)), this.drawStringFlip * Math.min(80, 10 + this.drawStringControlMagnitude / (10 + Vector.magnitude(sub))))
const controlPoint = Vector.add(Vector.add(where, Vector.mult(sub, -0.5)), perpendicular)
ctx.strokeStyle = "#000" // "#0ce"
ctx.lineWidth = 0.5
ctx.beginPath();
ctx.moveTo(where.x, where.y);
ctx.quadraticCurveTo(controlPoint.x, controlPoint.y, this.vertices[0].x, this.vertices[0].y)
// ctx.lineTo(this.vertices[0].x, this.vertices[0].y);
ctx.stroke();
},
draw() {
},
returnToPlayer() {
if (Vector.magnitude(Vector.sub(this.position, m.pos)) < returnRadius) { //near player
@@ -1214,9 +1234,9 @@ const b = {
const returnForce = Vector.mult(Vector.normalise(sub), rangeScale * this.thrustMag * this.mass)
this.force.x -= returnForce.x
this.force.y -= returnForce.y
this.drawString()
this.grabPowerUp()
}
this.draw();
},
grabPowerUp() { //grab power ups near the tip of the harpoon
if (this.caughtPowerUp) {
@@ -1257,7 +1277,6 @@ const b = {
Matter.Body.setDensity(this, 0.0005); //reduce density on return
if (this.angularSpeed < 0.5) this.torque += this.inertia * 0.001 * (Math.random() - 0.5) //(Math.round(Math.random()) ? 1 : -1)
this.collisionFilter.mask = cat.map | cat.mob | cat.mobBullet | cat.mobShield // | cat.body
}
} else {
this.grabPowerUp()
@@ -1316,41 +1335,7 @@ const b = {
// }
// }
}
this.drawString()
if (tech.isHarpoonPowerUp && this.density > 0.01) {
this.drawString = () => {
ctx.beginPath();
ctx.moveTo(this.vertices[0].x, this.vertices[0].y);
for (let j = 1, len = this.vertices.length; j < len; j += 1) {
ctx.lineTo(this.vertices[j].x, this.vertices[j].y);
}
ctx.lineTo(this.vertices[0].x, this.vertices[0].y);
ctx.lineWidth = 4;
ctx.strokeStyle = "#000";
ctx.lineJoin = "miter"
ctx.miterLimit = 100;
ctx.stroke();
ctx.lineJoin = "round"
ctx.miterLimit = 10
if (isReturn) {
const where = {
x: m.pos.x + 30 * Math.cos(m.angle),
y: m.pos.y + 30 * Math.sin(m.angle)
}
const sub = Vector.sub(where, this.vertices[0])
const perpendicular = Vector.mult(Vector.normalise(Vector.perp(sub)), this.drawStringFlip * Math.min(80, 10 + this.drawStringControlMagnitude / (10 + Vector.magnitude(sub))))
const controlPoint = Vector.add(Vector.add(where, Vector.mult(sub, -0.5)), perpendicular)
ctx.strokeStyle = "#000" // "#0ce"
ctx.lineWidth = 0.5
ctx.beginPath();
ctx.moveTo(where.x, where.y);
ctx.quadraticCurveTo(controlPoint.x, controlPoint.y, this.vertices[0].x, this.vertices[0].y)
// ctx.lineTo(this.vertices[0].x, this.vertices[0].y);
ctx.stroke();
}
}
}
this.draw()
},
});
if (!isReturn && !target) {
@@ -1361,8 +1346,26 @@ const b = {
bullet[me].frictionAir = 0.002
bullet[me].do = function() {
this.force.y += this.mass * 0.001; //gravity
this.draw();
}
}
if (tech.isHarpoonPowerUp && bullet[me].density > 0.01) {
if (isReturn) {
bullet[me].draw = function() {
this.drawToggleHarpoon()
this.drawString()
}
} else {
bullet[me].draw = function() {
this.drawToggleHarpoon()
}
}
} else if (isReturn) {
bullet[me].draw = function() {
this.drawString()
}
}
Composite.add(engine.world, bullet[me]); //add bullet to world
/* todo
despawn
@@ -1405,7 +1408,6 @@ const b = {
// this.drawString()
// }
// }
Composite.add(engine.world, bullet[me]); //add bullet to world
},
missile(where, angle, speed, size = 1) {
if (tech.missileSize) size *= 1.5
@@ -1526,13 +1528,13 @@ const b = {
m.energy = 0;
}
b.isExtruderOn = true
const SPEED = 10 + 10 * tech.isPlasmaRange
const SPEED = 8 + 8 * tech.isPlasmaRange
const me = bullet.length;
const where = Vector.add(m.pos, player.velocity)
bullet[me] = Bodies.polygon(where.x + 20 * Math.cos(m.angle), where.y + 20 * Math.sin(m.angle), 4, 0.01, {
cycle: -0.5,
isWave: true,
endCycle: simulation.cycle + 33, // + 30 * tech.isPlasmaRange,
endCycle: simulation.cycle + 40, // + 30 * tech.isPlasmaRange,
inertia: Infinity,
frictionAir: 0,
isInHole: true, //this keeps the bullet from entering wormholes
@@ -1554,39 +1556,25 @@ const b = {
if (this.endCycle < simulation.cycle + 1) this.isWave = false
if (Matter.Query.point(map, this.position).length) { //check if inside map
this.isBranch = true;
this.do = () => { if (this.endCycle < simulation.cycle + 1) this.isWave = false }
} else { //check if inside a body
for (let i = 0, len = mob.length; i < len; i++) {
const dist = Vector.magnitudeSquared(Vector.sub(this.position, mob[i].position))
const radius = mob[i].radius + 20
const radius = mob[i].radius + tech.extruderRange
if (dist < radius * radius) {
Matter.Body.setVelocity(mob[i], {
x: mob[i].velocity.x * 0.15,
y: mob[i].velocity.y * 0.15
});
Matter.Body.setVelocity(mob[i], { x: mob[i].velocity.x * 0.25, y: mob[i].velocity.y * 0.25 });
Matter.Body.setPosition(this, Vector.add(this.position, mob[i].velocity)) //move with the medium
let dmg = this.dmg / Math.min(10, mob[i].mass)
mob[i].damage(dmg);
if (mob[i].alive) mob[i].foundPlayer();
}
}
// const q = Matter.Query.point(mob, this.position)
// for (let i = 0; i < q.length; i++) {
// Matter.Body.setVelocity(q[i], {
// x: q[i].velocity.x * 0.15,
// y: q[i].velocity.y * 0.15
// });
// Matter.Body.setPosition(this, Vector.add(this.position, q[i].velocity)) //move with the medium
// let dmg = this.dmg / Math.min(10, q[i].mass)
// q[i].damage(dmg);
// if (q[i].alive) q[i].foundPlayer();
// }
}
this.cycle++
const wiggleMag = (input.down ? 6 : 12) * Math.cos(simulation.cycle * 0.09)
const wiggle = Vector.mult(transverse, wiggleMag * Math.cos(this.cycle * 0.36)) //+ wiggleMag * Math.cos(simulation.cycle * 0.3))
const velocity = Vector.mult(player.velocity, 0.3) //move with player
const velocity = Vector.mult(player.velocity, 0.4) //move with player
Matter.Body.setPosition(this, Vector.add(velocity, Vector.add(this.position, wiggle)))
// Matter.Body.setPosition(this, Vector.add(this.position, wiggle))
}
}
});
@@ -1596,9 +1584,11 @@ const b = {
y: SPEED * Math.sin(m.angle)
});
const transverse = Vector.normalise(Vector.perp(bullet[me].velocity))
if (180 - Math.abs(Math.abs(b.lastAngle - m.angle) - 180) > 0.13) bullet[me].isBranch = true; //don't draw stroke for this bullet
if (180 - Math.abs(Math.abs(b.lastAngle - m.angle) - 180) > 0.13 || !b.wasExtruderOn) {
bullet[me].isBranch = true; //don't draw stroke for this bullet
bullet[me].do = function() { if (this.endCycle < simulation.cycle + 1) this.isWave = false }
}
b.lastAngle = m.angle //track last angle for the above angle difference calculation
if (!b.wasExtruderOn) bullet[me].isBranch = true;
} else {
b.canExtruderFire = false;
}
@@ -3049,7 +3039,7 @@ const b = {
bullet[me].endCycle = simulation.cycle + 60 + 18 * Math.random();
bullet[me].dmg = tech.isNailRadiation ? 0 : dmg
bullet[me].beforeDmg = function(who) { //beforeDmg is rewritten with ice crystal tech
if (tech.isNailRadiation) mobs.statusDoT(who, dmg * (tech.isFastRadiation ? 2.6 : 0.65), tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles
if (tech.isNailRadiation) mobs.statusDoT(who, dmg * (tech.isFastRadiation ? 1.3 : 0.44), tech.isSlowRadiation ? 360 : (tech.isFastRadiation ? 60 : 180)) // one tick every 30 cycles
if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.94) {
b.explosion(this.position, 150 + 30 * Math.random()); //makes bullet do explosive damage at end
}
@@ -3083,7 +3073,7 @@ const b = {
this.immuneList.push(who.id) //remember that this needle has hit this mob once already
let dmg = b.dmgScale * 6
if (tech.isNailRadiation) {
mobs.statusDoT(who, tech.isFastRadiation ? 12 : 3, tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles
mobs.statusDoT(who, tech.isFastRadiation ? 6 : 2, tech.isSlowRadiation ? 360 : (tech.isFastRadiation ? 60 : 180)) // one tick every 30 cycles
dmg *= 0.25
}
if (tech.isCrit && who.isStunned) dmg *= 4
@@ -4040,7 +4030,7 @@ const b = {
if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.94) {
b.explosion(this.position, 300 + 30 * Math.random()); //makes bullet do explosive damage at end
}
if (tech.isNailRadiation) mobs.statusDoT(who, 7 * (tech.isFastRadiation ? 1.4 : 0.35), tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles
if (tech.isNailRadiation) mobs.statusDoT(who, 7 * (tech.isFastRadiation ? 0.7 : 0.24), tech.isSlowRadiation ? 360 : (tech.isFastRadiation ? 60 : 180)) // one tick every 30 cycles
};
bullet[me].minDmgSpeed = 10
@@ -4088,7 +4078,7 @@ const b = {
if (tech.isIceCrystals) {
bullet[bullet.length - 1].beforeDmg = function(who) {
mobs.statusSlow(who, 60)
if (tech.isNailRadiation) mobs.statusDoT(who, 1 * (tech.isFastRadiation ? 2.6 : 0.65), tech.isSlowRadiation ? 240 : (tech.isFastRadiation ? 30 : 120)) // one tick every 30 cycles
if (tech.isNailRadiation) mobs.statusDoT(who, 1 * (tech.isFastRadiation ? 1.3 : 0.44), tech.isSlowRadiation ? 360 : (tech.isFastRadiation ? 60 : 180)) // one tick every 30 cycles
if (tech.isNailCrit && !who.shield && Vector.dot(Vector.normalise(Vector.sub(who.position, this.position)), Vector.normalise(this.velocity)) > 0.94) {
b.explosion(this.position, 150 + 30 * Math.random()); //makes bullet do explosive damage at end
}

View File

@@ -506,11 +506,12 @@ const build = {
return `<a target="_blank" href='https://en.wikipedia.org/w/index.php?search=${encodeURIComponent(text).replace(/'/g, '%27')}&title=Special:Search' style="color: #000;">${text}</a>`
},
reset() {
build.isExperimentSelection = true;
build.isExperimentRun = true;
simulation.startGame(true); //starts game, but pauses it
build.isExperimentSelection = true;
build.isExperimentRun = true;
simulation.paused = true;
m.setField(0)
b.inventory = []; //removes guns and ammo
for (let i = 0, len = b.guns.length; i < len; ++i) {
b.guns[i].count = 0;

View File

@@ -15,13 +15,13 @@ const level = {
// localSettings.levelsClearedLastGame = 10
// level.difficultyIncrease(30) //30 is near max on hard //60 is near max on why
// simulation.isHorizontalFlipped = true
// m.setField("plasma torch")
// b.giveGuns("harpoon")
// m.setField("plasma torch")
// tech.giveTech("extruder")
// tech.giveTech("filament")
// for (let i = 0; i < 1; i++) tech.giveTech("refractory metal")
// tech.giveTech("mouth")
// tech.giveTech("all-stars")
// for (let i = 0; i < 3; i++) tech.giveTech("super sized")
// for (let i = 0; i < 3; i++) tech.giveTech("overcharge")
// for (let i = 0; i < 9; i++) tech.giveTech("MIRV")
// tech.isCancelDuplication = true
@@ -2265,7 +2265,7 @@ const level = {
spawn.mapRect(-950, -1800, 8200, 800); //roof
spawn.mapRect(-250, -400, 1000, 600); // shelf
spawn.mapRect(-250, -1200, 1000, 550); // shelf roof
powerUps.spawnStartingPowerUps(600, -800);
// powerUps.spawnStartingPowerUps(600, -800);
// for (let i = 0; i < 50; ++i) powerUps.spawn(550, -800, "research", false);
// powerUps.spawn(350, -800, "gun", false);
@@ -2302,7 +2302,7 @@ const level = {
// for (let i = 0; i < 5; i++) spawn.focuser(1900, -500)
// spawn.slashBoss(1900, -500)
spawn.shooter(1900, -500)
spawn.slasher(1900, -500)
// spawn.shield(mob[mob.length - 1], 1900, -500, 1);
// mob[mob.length - 1].isShielded = true
// spawn.growBossCulture(1200, -500)

View File

@@ -393,12 +393,18 @@ const m = {
// for (let i = 0; i < tech.tech.length; i++) {
// if (tech.tech[i].name === "quantum immortality") tech.removeTech(i)
// }
m.setMaxHealth()
m.health = 1;
// m.addHealth(1)
simulation.wipe = function() { //set wipe to have trails
ctx.fillStyle = "rgba(255,255,255,0)";
ctx.fillRect(0, 0, canvas.width, canvas.height);
}
spawn.setSpawnList(); //new mob types
simulation.clearNow = true; //triggers a map reset
m.switchWorlds()
const swapPeriod = 1000
for (let i = 0, len = 5; i < len; i++) {
@@ -1443,6 +1449,7 @@ const m = {
document.getElementById("field").innerHTML = m.fieldUpgrades[index].name
m.setHoldDefaults();
m.fieldUpgrades[index].effect();
simulation.makeTextLog(`<span class='color-var'>m</span>.setField("<span class='color-text'>${m.fieldUpgrades[m.fieldMode].name}</span>")`);
},
fieldUpgrades: [{
name: "field emitter",
@@ -1972,34 +1979,82 @@ const m = {
}
}
},
// {
// name: "plasma torch",
// description: "use <strong class='color-f'>energy</strong> to emit short range <strong class='color-plasma'>plasma</strong><br><strong class='color-d'>damages</strong> and <strong>pushes</strong> mobs away",
// effect() {
// m.fieldMeterColor = "#f0f"
// m.eyeFillColor = m.fieldMeterColor
// m.hold = function() {
// b.isExtruderOn = false
// if (m.isHolding) {
// m.drawHold(m.holdingTarget);
// m.holding();
// m.throwBlock();
// } else if (input.field && m.fieldCDcycle < m.cycle) { //not hold but field button is pressed
// m.grabPowerUp();
// m.lookForPickUp();
// if (tech.isExtruder) {
// b.extruder();
// } else {
// b.plasma();
// }
// } else if (m.holdingTarget && m.fieldCDcycle < m.cycle) { //holding, but field button is released
// m.pickUp();
// } else {
// m.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
// }
// m.drawFieldMeter("rgba(0, 0, 0, 0.2)")
// if (tech.isExtruder) {
// if (input.field) {
// b.wasExtruderOn = true
// } else {
// b.wasExtruderOn = false
// b.canExtruderFire = true
// }
// ctx.beginPath(); //draw all the wave bullets
// for (let i = 0, len = bullet.length; i < len; i++) {
// if (bullet[i].isWave) {
// if (bullet[i].isBranch) {
// ctx.moveTo(bullet[i].position.x, bullet[i].position.y)
// } else {
// ctx.lineTo(bullet[i].position.x, bullet[i].position.y)
// }
// }
// }
// if (b.wasExtruderOn && b.isExtruderOn) ctx.lineTo(m.pos.x + 15 * Math.cos(m.angle), m.pos.y + 15 * Math.sin(m.angle))
// ctx.lineWidth = 4;
// ctx.strokeStyle = "#f07"
// ctx.stroke();
// ctx.lineWidth = tech.extruderRange;
// ctx.strokeStyle = "rgba(255,0,110,0.05)"
// ctx.stroke();
// }
// }
// }
// },
{
name: "plasma torch",
description: "use <strong class='color-f'>energy</strong> to emit short range <strong class='color-plasma'>plasma</strong><br><strong class='color-d'>damages</strong> and <strong>pushes</strong> mobs away",
effect() {
m.fieldMeterColor = "#f0f"
m.eyeFillColor = m.fieldMeterColor
m.hold = function() {
b.isExtruderOn = false
if (m.isHolding) {
m.drawHold(m.holdingTarget);
m.holding();
m.throwBlock();
} else if (input.field && m.fieldCDcycle < m.cycle) { //not hold but field button is pressed
m.grabPowerUp();
m.lookForPickUp();
if (tech.isExtruder) {
set() {
if (tech.isExtruder) {
m.hold = function() {
b.isExtruderOn = false
if (m.isHolding) {
m.drawHold(m.holdingTarget);
m.holding();
m.throwBlock();
} else if (input.field && m.fieldCDcycle < m.cycle) { //not hold but field button is pressed
m.grabPowerUp();
m.lookForPickUp();
b.extruder();
} else if (m.holdingTarget && m.fieldCDcycle < m.cycle) { //holding, but field button is released
m.pickUp();
} else {
b.plasma();
m.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
}
} else if (m.holdingTarget && m.fieldCDcycle < m.cycle) { //holding, but field button is released
m.pickUp();
} else {
m.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
}
m.drawFieldMeter("rgba(0, 0, 0, 0.2)")
if (tech.isExtruder) {
m.drawFieldMeter("rgba(0, 0, 0, 0.2)")
if (input.field) {
b.wasExtruderOn = true
} else {
@@ -2007,32 +2062,47 @@ const m = {
b.canExtruderFire = true
}
ctx.beginPath(); //draw all the wave bullets
for (let i = 0, len = bullet.length; i < len; i++) {
for (let i = 1, len = bullet.length; i < len; i++) { //skip the first bullet (which is is oldest bullet)
if (bullet[i].isWave) {
if (bullet[i].isBranch) {
if (bullet[i].isBranch || bullet[i - 1].isBranch) {
ctx.moveTo(bullet[i].position.x, bullet[i].position.y)
// ctx.lineWidth = 5;
// ctx.strokeStyle = "#f07"
// ctx.stroke();
// ctx.lineWidth = 30;
// ctx.strokeStyle = "rgba(255,0,110,0.05)"
// ctx.stroke();
// ctx.beginPath(); //draw all the wave bullets
} else {
ctx.lineTo(bullet[i].position.x, bullet[i].position.y)
}
}
}
if (b.wasExtruderOn && b.isExtruderOn) ctx.lineTo(m.pos.x + 15 * Math.cos(m.angle), m.pos.y + 15 * Math.sin(m.angle))
ctx.lineWidth = 5;
ctx.lineWidth = 4;
ctx.strokeStyle = "#f07"
ctx.stroke();
ctx.lineWidth = 35;
ctx.strokeStyle = "rgba(255,0,110,0.05)"
ctx.lineWidth = tech.extruderRange;
ctx.strokeStyle = "rgba(255,0,110,0.06)"
ctx.stroke();
}
} else {
m.hold = function() {
b.isExtruderOn = false
if (m.isHolding) {
m.drawHold(m.holdingTarget);
m.holding();
m.throwBlock();
} else if (input.field && m.fieldCDcycle < m.cycle) { //not hold but field button is pressed
m.grabPowerUp();
m.lookForPickUp();
b.plasma();
} else if (m.holdingTarget && m.fieldCDcycle < m.cycle) { //holding, but field button is released
m.pickUp();
} else {
m.holdingTarget = null; //clears holding target (this is so you only pick up right after the field button is released and a hold target exists)
}
m.drawFieldMeter("rgba(0, 0, 0, 0.2)")
}
}
},
effect() {
m.fieldMeterColor = "#f0f"
m.eyeFillColor = m.fieldMeterColor
this.set();
}
},
{

View File

@@ -217,7 +217,6 @@ const powerUps = {
simulation.makeTextLog(text);
} else if (type === "field") {
m.setField(index)
simulation.makeTextLog(`<span class='color-var'>m</span>.setField("<span class='color-text'>${m.fieldUpgrades[m.fieldMode].name}</span>")`);
} else if (type === "tech") {
setTimeout(() => {
powerUps.lastTechIndex = index

View File

@@ -678,8 +678,6 @@ const simulation = {
level.setDifficulty()
simulation.difficultyMode = Number(document.getElementById("difficulty-select").value)
build.isExperimentSelection = false;
build.isExperimentRun = false;
simulation.clearNow = true;
document.getElementById("text-log").style.opacity = 0;
document.getElementById("fade-out").style.opacity = 0;
@@ -690,7 +688,6 @@ const simulation = {
// simulation.makeTextLog(`input.key.right<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.right}</span>", "<span class='color-text'>ArrowRight</span>"]`);
simulation.makeTextLog(`<span class='color-var'>const</span> engine <span class='color-symbol'>=</span> Engine.create(); <em>//simulation begin</em>`);
simulation.makeTextLog(`engine.timing.timeScale <span class='color-symbol'>=</span> 1`);
simulation.makeTextLog(`<span class='color-var'>m</span>.setField("<span class='color-text'>${m.fieldUpgrades[m.fieldMode].name}</span>")`);
// simulation.makeTextLog(`input.key.field<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.field}</span>", "<span class='color-text'>MouseRight</span>"]`);
document.getElementById("health").style.display = "inline"
@@ -706,7 +703,6 @@ const simulation = {
tech.healMaxEnergyBonus = 0
m.setMaxEnergy();
m.energy = 0
m.fieldMode = 0;
// simulation.makeTextLog(`${simulation.SVGrightMouse}<strong style='font-size:30px;'> ${m.fieldUpgrades[m.fieldMode].name}</strong><br><span class='faded'></span><br>${m.fieldUpgrades[m.fieldMode].description}`, 600);
// simulation.makeTextLog(`
// input.key.up <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.up}</span>", "<span class='color-text'>ArrowUp</span>"]
@@ -719,7 +715,7 @@ const simulation = {
// <br><span class='color-var'>m</span>.field.description <span class='color-symbol'>=</span> "<span class='color-text'>${m.fieldUpgrades[m.fieldMode].description}</span>"
// `, 800);
m.setField(m.fieldMode)
m.setField(0)
// m.energy = 0;
//exit testing
if (simulation.testing) {
@@ -729,6 +725,8 @@ const simulation = {
}
simulation.isCheating = false
simulation.firstRun = false;
build.isExperimentSelection = false;
build.isExperimentRun = false;
//setup FPS cap
simulation.fpsInterval = 1000 / simulation.fpsCap;

View File

@@ -3013,11 +3013,12 @@ const spawn = {
me.delay = 120 * simulation.CDScale;
me.cd = 0;
me.swordRadius = 0;
me.swordVertex = 1
me.swordRadiusMax = 350 + 5 * simulation.difficulty;
me.swordRadiusGrowRate = me.swordRadiusMax * (0.018 + 0.0006 * simulation.difficulty)
me.isSlashing = false;
me.swordDamage = 0.05 * simulation.dmgScale
const laserAngle = 3 * Math.PI / 5
me.laserAngle = 3 * Math.PI / 5
const seeDistance2 = 200000
spawn.shield(me, x, y);
me.onDamage = function() {};
@@ -3027,7 +3028,6 @@ const spawn = {
this.attraction();
if (!m.isBodiesAsleep) this.sword() //does various things depending on what stage of the sword swing
};
me.swordWaiting = function() {
if (
this.seePlayer.recall &&
@@ -3036,6 +3036,17 @@ const spawn = {
Matter.Query.ray(map, this.position, this.playerPosRandomY()).length === 0 &&
Matter.Query.ray(body, this.position, this.playerPosRandomY()).length === 0
) {
//find vertex farthest away from player
let dist = 0
for (let i = 0, len = this.vertices.length; i < len; i++) {
const D = Vector.magnitudeSquared(Vector.sub({ x: this.vertices[i].x, y: this.vertices[i].y }, m.pos))
if (D > dist) {
dist = D
this.swordVertex = i
}
}
// this.laserAngle = 7 / 10 * Math.PI + this.swordVertex / 5 * 2 * Math.PI - Math.PI / 2
this.laserAngle = this.swordVertex / 5 * 2 * Math.PI + 0.6283
this.sword = this.swordGrow
// Matter.Body.setVelocity(this, { x: 0, y: 0 });
this.accelMag = 0
@@ -3043,7 +3054,7 @@ const spawn = {
}
me.sword = me.swordWaiting //base function that changes during different aspects of the sword swing
me.swordGrow = function() {
this.laserSword(this.vertices[1], this.angle + laserAngle);
this.laserSword(this.vertices[this.swordVertex], this.angle + this.laserAngle);
this.swordRadius += this.swordRadiusGrowRate
if (this.swordRadius > this.swordRadiusMax) {
this.sword = this.swordSlash
@@ -3051,7 +3062,7 @@ const spawn = {
}
}
me.swordSlash = function() {
this.laserSword(this.vertices[1], this.angle + laserAngle);
this.laserSword(this.vertices[this.swordVertex], this.angle + this.laserAngle);
this.torque += this.torqueMagnitude;
this.spinCount++
if (this.spinCount > 60) {
@@ -3064,23 +3075,23 @@ const spawn = {
me.laserSword = function(where, angle) {
const vertexCollision = function(v1, v1End, domain) {
for (let i = 0; i < domain.length; ++i) {
let vertices = domain[i].vertices;
const len = vertices.length - 1;
let v = domain[i].vertices;
const len = v.length - 1;
for (let j = 0; j < len; j++) {
results = simulation.checkLineIntersection(v1, v1End, vertices[j], vertices[j + 1]);
results = simulation.checkLineIntersection(v1, v1End, v[j], v[j + 1]);
if (results.onLine1 && results.onLine2) {
const dx = v1.x - results.x;
const dy = v1.y - results.y;
const dist2 = dx * dx + dy * dy;
if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) best = { x: results.x, y: results.y, dist2: dist2, who: domain[i], v1: vertices[j], v2: vertices[j + 1] };
if (dist2 < best.dist2 && (!domain[i].mob || domain[i].alive)) best = { x: results.x, y: results.y, dist2: dist2, who: domain[i], v1: v[j], v2: v[j + 1] };
}
}
results = simulation.checkLineIntersection(v1, v1End, vertices[0], vertices[len]);
results = simulation.checkLineIntersection(v1, v1End, v[0], v[len]);
if (results.onLine1 && results.onLine2) {
const dx = v1.x - results.x;
const dy = v1.y - results.y;
const dist2 = dx * dx + dy * dy;
if (dist2 < best.dist2) best = { x: results.x, y: results.y, dist2: dist2, who: domain[i], v1: vertices[0], v2: vertices[len] };
if (dist2 < best.dist2) best = { x: results.x, y: results.y, dist2: dist2, who: domain[i], v1: v[0], v2: v[len] };
}
}
};

View File

@@ -3876,7 +3876,7 @@
{
name: "irradiated nails",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Irradiation' style="color: #000;">irradiated nails</a>`,
description: "<strong>nails</strong>, <strong>needles</strong>, and <strong>rivets</strong> are <strong class='color-p'>radioactive</strong><br>about <strong>90%</strong> more <strong class='color-d'>damage</strong> over <strong>2</strong> seconds",
description: "<strong>nails</strong>, <strong>needles</strong>, and <strong>rivets</strong> are <strong class='color-p'>radioactive</strong><br>about <strong>90%</strong> more <strong class='color-d'>damage</strong> over <strong>3</strong> seconds",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -3894,8 +3894,8 @@
}
},
{
name: "4s half-life",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Half-life' style="color: #000;">4s half-life</a>`,
name: "6s half-life",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Half-life' style="color: #000;">6s half-life</a>`,
description: "<strong>nails</strong> are made of <strong class='color-p'>plutonium-238</strong><br>increase <strong class='color-d'>damage</strong> by <strong>100%</strong> over <strong>6</strong> seconds",
isGunTech: true,
maxCount: 1,
@@ -3905,7 +3905,7 @@
allowed() {
return tech.isNailRadiation && !tech.isFastRadiation
},
requires: "irradiated nails, not 1/2s half-life",
requires: "irradiated nails, not 1s half-life",
effect() {
tech.isSlowRadiation = true;
},
@@ -3914,9 +3914,9 @@
}
},
{
name: "1/2s half-life",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Half-life' style="color: #000;">1/2s half-life</a>`,
description: "<strong>nails</strong> are made of <strong class='color-p'>lithium-8</strong><br><strong class='color-d'>damage</strong> occurs after <strong>1/2</strong> a second",
name: "1s half-life",
link: `<a target="_blank" href='https://en.wikipedia.org/wiki/Half-life' style="color: #000;">1s half-life</a>`,
description: "<strong>nails</strong> are made of <strong class='color-p'>lithium-8</strong><br><strong class='color-d'>damage</strong> occurs after <strong>1</strong> second",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -3925,7 +3925,7 @@
allowed() {
return tech.isNailRadiation && !tech.isSlowRadiation
},
requires: "irradiated nails, not 4s half-life",
requires: "irradiated nails, not 6s half-life",
effect() {
tech.isFastRadiation = true;
},
@@ -4188,7 +4188,7 @@
},
{
name: "super sized",
description: `increase <strong>super ball</strong> radius by <strong>15%</strong><br>increases <strong class='color-d'>damage</strong> by about <strong>30%</strong>`,
description: `increase <strong>super ball</strong> radius by <strong>14%</strong><br>increases <strong class='color-d'>damage</strong> by about <strong>27%</strong>`,
isGunTech: true,
maxCount: 9,
count: 0,
@@ -5084,7 +5084,7 @@
},
{
name: "toggling harpoon",
description: "increase the <strong class='color-d'>damage</strong> of your next <strong>harpoon</strong><br>by <strong>600%</strong> after using it to collect a <strong>power up</strong>",
description: "increase the <strong class='color-d'>damage</strong> of your next <strong>harpoon</strong><br>by <strong>800%</strong> after using it to collect a <strong>power up</strong>",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -5206,7 +5206,7 @@
frequency: 2,
frequencyDefault: 2,
allowed() {
return (tech.haveGunCheck("laser") || tech.laserBotCount > 1 || tech.isLaserMine) && tech.laserDamage === 0.16
return (tech.haveGunCheck("laser") || tech.laserBotCount > 1 || tech.isLaserMine) && tech.laserDamage === 0.17
},
requires: "laser, not free-electron",
effect() {
@@ -5234,13 +5234,13 @@
requires: "laser, not pulse, diodes",
effect() {
tech.laserFieldDrain = 0.007 //base is 0.002
tech.laserDamage = 0.48; //base is 0.16
tech.laserDamage = 0.51; //base is 0.16
tech.laserColor = "#83f"
tech.laserColorAlpha = "rgba(136, 51, 255,0.5)"
},
remove() {
tech.laserFieldDrain = 0.002;
tech.laserDamage = 0.16; //used in check on pulse and diode: tech.laserDamage === 0.16
tech.laserDamage = 0.17; //used in check on pulse and diode: tech.laserDamage === 0.16
tech.laserColor = "#f00"
tech.laserColorAlpha = "rgba(255, 0, 0, 0.5)"
}
@@ -5999,7 +5999,7 @@
description: `use ${powerUps.orb.research(1)} to increase <strong class='color-plasma'>plasma</strong> <strong>torch</strong> range <strong>50%</strong>`,
// description: "use <strong>1</strong> <strong class='color-r'>research</strong> to <br>increase <strong class='color-plasma'>plasma</strong> <strong>torch's</strong> range by <strong>50%</strong>",
isFieldTech: true,
maxCount: 3,
maxCount: 9,
count: 0,
frequency: 2,
frequencyDefault: 2,
@@ -6018,7 +6018,7 @@
},
{
name: "extruder",
description: "<strong class='color-plasma'>plasma</strong> <strong>torch</strong> extrudes a thin <strong class='color-plasma'>hot</strong> wire<br>increases <strong class='color-d'>damage</strong>, <strong class='color-f'>energy</strong> drain, and <strong>lag</strong>",
description: "<strong class='color-plasma'>plasma</strong> <strong>torch</strong> <strong class='color-plasma'>extrudes</strong> a thin hot wire<br>increases <strong class='color-d'>damage</strong> and <strong class='color-f'>energy</strong> drain",
isFieldTech: true,
maxCount: 1,
count: 0,
@@ -6030,9 +6030,30 @@
requires: "plasma torch, not plasma-bot",
effect() {
tech.isExtruder = true;
m.fieldUpgrades[m.fieldMode].set()
},
remove() {
tech.isExtruder = false;
if (this.count) m.fieldUpgrades[m.fieldMode].set()
}
},
{
name: "refractory metal",
description: "<strong class='color-plasma'>extrude</strong> metals at a higher <strong class='color-plasma'>temperature</strong><br>increases effective <strong>radius</strong>",
isFieldTech: true,
maxCount: 9,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return tech.isExtruder
},
requires: "extruder",
effect() {
tech.extruderRange += 50
},
remove() {
tech.extruderRange = 15
}
},
{
@@ -6252,7 +6273,7 @@
},
{
name: "dynamical systems",
description: `use ${powerUps.orb.research(1)}to increase your <strong class='color-d'>damage</strong> by <strong>35%</strong>`,
description: `use ${powerUps.orb.research(2)}to increase your <strong class='color-d'>damage</strong> by <strong>35%</strong>`,
// description: "use <strong>1</strong> <strong class='color-r'>research</strong><br>increase your <strong class='color-d'>damage</strong> by <strong>35%</strong>",
isFieldTech: true,
maxCount: 1,
@@ -6260,34 +6281,34 @@
frequency: 3,
frequencyDefault: 3,
allowed() {
return (m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking" || m.fieldUpgrades[m.fieldMode].name === "pilot wave") && (build.isExperimentSelection || powerUps.research.count > 0)
return (m.fieldUpgrades[m.fieldMode].name === "plasma torch" || m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking" || m.fieldUpgrades[m.fieldMode].name === "pilot wave") && (build.isExperimentSelection || powerUps.research.count > 1)
},
requires: "metamaterial cloaking or pilot wave",
requires: "metamaterial cloaking pilot wave or plasma torch",
effect() {
tech.isCloakingDamage = true
for (let i = 0; i < 1; i++) {
for (let i = 0; i < 2; i++) {
if (powerUps.research.count > 0) powerUps.research.changeRerolls(-1)
}
},
remove() {
tech.isCloakingDamage = false
if (this.count > 0) powerUps.research.changeRerolls(1)
if (this.count > 0) powerUps.research.changeRerolls(2)
}
},
{
name: "discrete optimization",
description: "increase <strong class='color-d'>damage</strong> by <strong>50%</strong><br><strong>50%</strong> increased <strong><em>delay</em></strong> after firing",
description: "increase <strong class='color-d'>damage</strong> by <strong>40%</strong><br><strong>40%</strong> increased <strong><em>delay</em></strong> after firing",
isFieldTech: true,
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
allowed() {
return m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking" || m.fieldUpgrades[m.fieldMode].name === "pilot wave" || m.fieldUpgrades[m.fieldMode].name === "molecular assembler"
return m.fieldUpgrades[m.fieldMode].name === "plasma torch" || m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking" || m.fieldUpgrades[m.fieldMode].name === "pilot wave" || m.fieldUpgrades[m.fieldMode].name === "molecular assembler"
},
requires: "metamaterial cloaking or pilot wave",
requires: "metamaterial cloaking, plasma torch or pilot wave",
effect() {
tech.aimDamage = 1.5
tech.aimDamage = 1.40
b.setFireCD();
},
remove() {
@@ -8459,5 +8480,6 @@
isAddRemoveMaxHealth: null,
removeMaxHealthOnKill: null,
isSpawnExitTech: null,
cloakDuplication: null
cloakDuplication: null,
extruderRange: null
}