renamed mech to m

to continue playing after the final boss you need to use testing mode:  "T" -> "U"
renamed mech -> m
This commit is contained in:
landgreen
2021-01-24 08:54:26 -08:00
parent c7822cd1da
commit 21affab7b1
13 changed files with 1725 additions and 1730 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -23,25 +23,25 @@ engine.world.gravity.scale = 0; //turn off gravity (it's added back in later)
function playerOnGroundCheck(event) {
//runs on collisions events
function enter() {
mech.numTouching++;
if (!mech.onGround) {
mech.onGround = true;
if (mech.crouch) {
if (mech.checkHeadClear()) {
mech.undoCrouch();
m.numTouching++;
if (!m.onGround) {
m.onGround = true;
if (m.crouch) {
if (m.checkHeadClear()) {
m.undoCrouch();
} else {
mech.yOffGoal = mech.yOffWhen.crouch;
m.yOffGoal = m.yOffWhen.crouch;
}
} else {
//sets a hard land where player stays in a crouch for a bit and can't jump
//crouch is forced in groundControl below
const momentum = player.velocity.y * player.mass //player mass is 5 so this triggers at 26 down velocity, unless the player is holding something
if (momentum > 130) {
mech.doCrouch();
mech.yOff = mech.yOffWhen.jump;
mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40)
m.doCrouch();
m.yOff = m.yOffWhen.jump;
m.hardLandCD = m.cycle + Math.min(momentum / 6.5 - 6, 40)
} else {
mech.yOffGoal = mech.yOffWhen.stand;
m.yOffGoal = m.yOffWhen.stand;
}
}
}
@@ -51,14 +51,14 @@ function playerOnGroundCheck(event) {
for (let i = 0, j = pairs.length; i != j; ++i) {
let pair = pairs[i];
if (pair.bodyA === jumpSensor) {
mech.standingOn = pair.bodyB; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter();
m.standingOn = pair.bodyB; //keeping track to correctly provide recoil on jump
if (m.standingOn.alive !== true) enter();
} else if (pair.bodyB === jumpSensor) {
mech.standingOn = pair.bodyA; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter();
m.standingOn = pair.bodyA; //keeping track to correctly provide recoil on jump
if (m.standingOn.alive !== true) enter();
}
}
mech.numTouching = 0;
m.numTouching = 0;
}
function playerOffGroundCheck(event) {
@@ -66,14 +66,14 @@ function playerOffGroundCheck(event) {
const pairs = event.pairs;
for (let i = 0, j = pairs.length; i != j; ++i) {
if (pairs[i].bodyA === jumpSensor || pairs[i].bodyB === jumpSensor) {
if (mech.onGround && mech.numTouching === 0) {
mech.onGround = false;
mech.hardLandCD = 0 // disable hard landing
if (mech.checkHeadClear()) {
if (mech.crouch) {
mech.undoCrouch();
if (m.onGround && m.numTouching === 0) {
m.onGround = false;
m.hardLandCD = 0 // disable hard landing
if (m.checkHeadClear()) {
if (m.crouch) {
m.undoCrouch();
}
mech.yOffGoal = mech.yOffWhen.jump;
m.yOffGoal = m.yOffWhen.jump;
}
}
}
@@ -85,7 +85,7 @@ function collisionChecks(event) {
for (let i = 0, j = pairs.length; i != j; i++) {
//mob + (player,bullet,body) collisions
for (let k = 0; k < mob.length; k++) {
if (mob[k].alive && mech.alive) {
if (mob[k].alive && m.alive) {
if (pairs[i].bodyA === mob[k]) {
collideMob(pairs[i].bodyB);
break;
@@ -97,21 +97,21 @@ function collisionChecks(event) {
function collideMob(obj) {
//player + mob collision
if (
mech.immuneCycle < mech.cycle &&
m.immuneCycle < m.cycle &&
(obj === playerBody || obj === playerHead) &&
!(tech.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned))
) {
mob[k].foundPlayer();
let dmg = Math.min(Math.max(0.025 * Math.sqrt(mob[k].mass), 0.05), 0.3) * simulation.dmgScale; //player damage is capped at 0.3*dmgScale of 1.0
if (tech.isRewindAvoidDeath && mech.energy > 0.66) { //CPT reversal runs in mech.damage, but it stops the rest of the collision code here too
mech.damage(dmg);
if (tech.isRewindAvoidDeath && m.energy > 0.66) { //CPT reversal runs in m.damage, but it stops the rest of the collision code here too
m.damage(dmg);
return
}
mech.damage(dmg);
if (tech.isPiezo) mech.energy += 4;
m.damage(dmg);
if (tech.isPiezo) m.energy += 4;
if (tech.isBayesian) powerUps.ejectTech()
if (mob[k].onHit) mob[k].onHit(k);
mech.immuneCycle = mech.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
m.immuneCycle = m.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
//extra kick between player and mob //this section would be better with forces but they don't work...
let angle = Math.atan2(player.position.y - mob[k].position.y, player.position.x - mob[k].position.x);
Matter.Body.setVelocity(player, {
@@ -123,9 +123,9 @@ function collisionChecks(event) {
y: mob[k].velocity.y - 8 * Math.sin(angle)
});
if (tech.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mob[k].dropPowerUp && mech.energy > 0.34 * mech.maxEnergy) {
mech.energy -= 0.33 * mech.maxEnergy
mech.immuneCycle = 0; //player doesn't go immune to collision damage
if (tech.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mob[k].dropPowerUp && m.energy > 0.34 * m.maxEnergy) {
m.energy -= 0.33 * m.maxEnergy
m.immuneCycle = 0; //player doesn't go immune to collision damage
mob[k].death();
simulation.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x,
@@ -171,7 +171,7 @@ function collisionChecks(event) {
mob[k].damage(dmg, true);
const stunTime = dmg / Math.sqrt(obj.mass)
if (stunTime > 0.5) mobs.statusStun(mob[k], 30 + 60 * Math.sqrt(stunTime))
if (mob[k].distanceToPlayer2() < 1000000 && !mech.isCloak) mob[k].foundPlayer();
if (mob[k].distanceToPlayer2() < 1000000 && !m.isCloak) mob[k].foundPlayer();
if (tech.fragments && obj.speed > 10 && !obj.hasFragmented) {
obj.hasFragmented = true;
b.targetedNail(obj.position, tech.fragments * 4)

View File

@@ -69,8 +69,8 @@ window.addEventListener('load', (event) => {
if (property === "field") {
let found = false
let index
for (let i = 0; i < mech.fieldUpgrades.length; i++) {
if (set[property] === mech.fieldUpgrades[i].name) {
for (let i = 0; i < m.fieldUpgrades.length; i++) {
if (set[property] === m.fieldUpgrades[i].name) {
index = i;
found = true;
break;
@@ -156,7 +156,7 @@ const build = {
set[property] = set[property].replace(/%20/g, " ")
if (property.substring(0, 3) === "gun") b.giveGuns(set[property])
if (property.substring(0, 3) === "tech") tech.giveTech(set[property])
if (property === "field") mech.setField(set[property])
if (property === "field") m.setField(set[property])
if (property === "difficulty") {
simulation.difficultyMode = Number(set[property])
document.getElementById("difficulty-select").value = Number(set[property])
@@ -177,7 +177,7 @@ const build = {
}
},
pauseGrid() {
const harm = (1 - mech.harmReduction()) * 100
const harm = (1 - m.harmReduction()) * 100
let text = ""
if (!simulation.isChoosing) text += `<div class="pause-grid-module">
<span style="font-size:1.5em;font-weight: 600;">PAUSED</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; press P to resume</div>`
@@ -189,11 +189,11 @@ const build = {
<br><strong class='color-dup'>duplication</strong> chance: ${(Math.min(1,tech.duplicationChance())*100).toFixed(0)}%
<br>
<br><strong class='color-m'>tech</strong>: ${tech.totalCount} &nbsp; <strong class='color-r'>research</strong>: ${powerUps.research.count}
<br><strong class='color-h'>health</strong>: (${(mech.health*100).toFixed(0)} / ${(mech.maxHealth*100).toFixed(0)}) &nbsp; <strong class='color-f'>energy</strong>: (${(mech.energy*100).toFixed(0)} / ${(mech.maxEnergy*100).toFixed(0)})
<br><strong class='color-h'>health</strong>: (${(m.health*100).toFixed(0)} / ${(m.maxHealth*100).toFixed(0)}) &nbsp; <strong class='color-f'>energy</strong>: (${(m.energy*100).toFixed(0)} / ${(m.maxEnergy*100).toFixed(0)})
<br>position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)}) &nbsp; velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
<br>mouse: (${simulation.mouseInGame.x.toFixed(1)}, ${simulation.mouseInGame.y.toFixed(1)}) &nbsp; mass: ${player.mass.toFixed(1)}
<br>
<br>level: ${level.levels[level.onLevel]} (${level.difficultyText()}) &nbsp; ${mech.cycle} cycles
<br>level: ${level.levels[level.onLevel]} (${level.difficultyText()}) &nbsp; ${m.cycle} cycles
<br>${mob.length} mobs, &nbsp; ${body.length} blocks, &nbsp; ${bullet.length} bullets, &nbsp; ${powerUp.length} power ups
<br>damage difficulty scale: ${(b.dmgScale*100).toFixed(2) }%
<br>harm difficulty scale: ${(simulation.dmgScale*100).toFixed(0)}%
@@ -212,7 +212,7 @@ const build = {
el.style.display = "grid"
el.innerHTML = text
text = "";
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[mech.fieldMode].name}</div> ${mech.fieldUpgrades[mech.fieldMode].description}</div>`
text += `<div class="pause-grid-module"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[m.fieldMode].name}</div> ${m.fieldUpgrades[m.fieldMode].description}</div>`
let countTech = 0
for (let i = 0, len = tech.tech.length; i < len; i++) {
if (tech.tech[i].count > 0) {
@@ -276,9 +276,9 @@ const build = {
b.giveGuns(index)
}
} else if (type === "field") {
if (mech.fieldMode !== index) {
document.getElementById("field-" + mech.fieldMode).classList.remove("build-field-selected");
mech.setField(index)
if (m.fieldMode !== index) {
document.getElementById("field-" + m.fieldMode).classList.remove("build-field-selected");
m.setField(index)
who.classList.add("build-field-selected");
}
} else if (type === "tech") { //remove tech if you have too many
@@ -369,8 +369,8 @@ const build = {
<input type="checkbox" id="no-power-ups" name="no-power-ups" style="width:17px; height:17px;">
</div>
</div>`
for (let i = 0, len = mech.fieldUpgrades.length; i < len; i++) {
text += `<div id ="field-${i}" class="experiment-grid-module" onclick="build.choosePowerUp(this,${i},'field')"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[i].name}</div> ${mech.fieldUpgrades[i].description}</div>`
for (let i = 0, len = m.fieldUpgrades.length; i < len; i++) {
text += `<div id ="field-${i}" class="experiment-grid-module" onclick="build.choosePowerUp(this,${i},'field')"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[i].name}</div> ${m.fieldUpgrades[i].description}</div>`
}
for (let i = 0, len = b.guns.length; i < len; i++) {
text += `<div id = "gun-${i}" class="experiment-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="grid-title"><div class="circle-grid gun"></div> &nbsp; ${b.guns[i].name}</div> ${b.guns[i].description}</div>`
@@ -398,7 +398,7 @@ const build = {
},
reset() {
build.isExperimentSelection = true;
mech.setField(0)
m.setField(0)
b.inventory = []; //removes guns and ammo
for (let i = 0, len = b.guns.length; i < len; ++i) {
@@ -432,7 +432,7 @@ const build = {
count++
}
}
url += `&field=${encodeURIComponent(mech.fieldUpgrades[mech.fieldMode].name.trim())}`
url += `&field=${encodeURIComponent(m.fieldUpgrades[m.fieldMode].name.trim())}`
url += `&difficulty=${simulation.difficultyMode}`
if (isCustom) {
url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}`
@@ -501,7 +501,7 @@ document.getElementById("experiment-button").addEventListener("click", () => { /
let inventory = [];
let techList = [];
if (!simulation.firstRun) {
field = mech.fieldMode
field = m.fieldMode
inventory = [...b.inventory]
for (let i = 0; i < tech.tech.length; i++) {
techList.push(tech.tech[i].count)
@@ -710,7 +710,7 @@ window.addEventListener("keydown", function(event) {
simulation.previousGun();
break
case input.key.pause:
if (!simulation.isChoosing && input.isPauseKeyReady && mech.alive) {
if (!simulation.isChoosing && input.isPauseKeyReady && m.alive) {
input.isPauseKeyReady = false
setTimeout(function() {
input.isPauseKeyReady = true
@@ -729,7 +729,7 @@ window.addEventListener("keydown", function(event) {
}
break
case input.key.testing:
if (mech.alive && localSettings.loreCount > 0) {
if (m.alive && localSettings.loreCount > 0) {
if (simulation.testing) {
simulation.testing = false;
simulation.loop = simulation.normalLoop
@@ -791,7 +791,7 @@ window.addEventListener("keydown", function(event) {
break
}
if (simulation.testing) {
if (event.key === "X") mech.death(); //only uppercase
if (event.key === "X") m.death(); //only uppercase
switch (event.key.toLowerCase()) {
case "o":
simulation.isAutoZoom = false;
@@ -837,21 +837,21 @@ window.addEventListener("keydown", function(event) {
spawn.randomLevelBoss(simulation.mouseInGame.x, simulation.mouseInGame.y);
break
case "f":
const mode = (mech.fieldMode === mech.fieldUpgrades.length - 1) ? 0 : mech.fieldMode + 1
mech.setField(mode)
const mode = (m.fieldMode === m.fieldUpgrades.length - 1) ? 0 : m.fieldMode + 1
m.setField(mode)
break
case "g":
b.giveGuns("all", 1000)
break
case "h":
mech.addHealth(Infinity)
mech.energy = mech.maxEnergy;
m.addHealth(Infinity)
m.energy = m.maxEnergy;
break
case "y":
tech.giveTech()
break
case "r":
mech.resetHistory();
m.resetHistory();
Matter.Body.setPosition(player, simulation.mouseInGame);
Matter.Body.setVelocity(player, {
x: 0,
@@ -1068,7 +1068,7 @@ function cycle() {
simulation.then = now - (elapsed % simulation.fpsInterval); // Get ready for next frame by setting then=now. Also, adjust for fpsInterval not being multiple of 16.67
simulation.cycle++; //tracks game cycles
mech.cycle++; //tracks player cycles //used to alow time to stop for everything, but the player
m.cycle++; //tracks player cycles //used to alow time to stop for everything, but the player
if (simulation.clearNow) {
simulation.clearNow = false;
simulation.clearMap();
@@ -1076,8 +1076,8 @@ function cycle() {
}
simulation.loop();
// if (isNaN(mech.health) || isNaN(mech.energy)) {
// console.log(`mech.health = ${mech.health}`)
// if (isNaN(m.health) || isNaN(m.energy)) {
// console.log(`m.health = ${m.health}`)
// simulation.paused = true;
// build.pauseGrid()
// document.body.style.cursor = "auto";

View File

@@ -16,7 +16,7 @@ const level = {
// level.difficultyIncrease(30)
// simulation.zoomScale = 1000;
// simulation.setZoom();
// mech.setField("plasma torch")
// m.setField("plasma torch")
// b.giveGuns("grenades")
// tech.isExplodeRadio = true
// tech.giveTech("needle gun")
@@ -74,26 +74,26 @@ const level = {
level.addToWorld(); //add bodies to game engine
simulation.draw.setPaths();
b.respawnBots();
mech.resetHistory();
m.resetHistory();
if (tech.isArmorFromPowerUps) {
tech.armorFromPowerUps += Math.min(0.03 * powerUps.totalPowerUps, 0.42)
mech.setMaxHealth();
m.setMaxHealth();
}
if (tech.isHealLowHealth) {
const len = Math.floor((mech.maxHealth - mech.health) / 0.5)
const len = Math.floor((m.maxHealth - m.health) / 0.5)
for (let i = 0; i < len; i++) {
powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "heal", false);
// powerUps.heal.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), 50);
powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "heal", false);
// powerUps.heal.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), 50);
}
}
if (tech.isPerpetualReroll) powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "research", false);
if (tech.isPerpetualReroll) powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "research", false);
if (tech.isPerpetualAmmo) {
powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "ammo", false);
powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "ammo", false);
powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "ammo", false);
powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "ammo", false);
}
if (tech.isPerpetualHeal) {
powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "heal", false);
powerUps.spawn(mech.pos.x + 60 * (Math.random() - 0.5), mech.pos.y + 60 * (Math.random() - 0.5), "heal", false);
powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "heal", false);
powerUps.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.pos.y + 60 * (Math.random() - 0.5), "heal", false);
}
if (tech.isPerpetualStun) {
for (let i = 0; i < mob.length; i++) mobs.statusStun(mob[i], 600)
@@ -162,9 +162,9 @@ const level = {
ctx.beginPath();
const step = Math.PI / 20
const horizontalStep = 85
if (simulation.isCheating) phase += 0.003 //(mech.pos.x - circle.x) * 0.0005 //0.05 * Math.sin(simulation.cycle * 0.030)
if (simulation.isCheating) phase += 0.003 //(m.pos.x - circle.x) * 0.0005 //0.05 * Math.sin(simulation.cycle * 0.030)
// const sway = 5 * Math.cos(simulation.cycle * 0.007)
sway.x = sway.x * 0.995 + 0.005 * (mech.pos.x - circle.x) * 0.05 //+ 0.04 * Math.cos(simulation.cycle * 0.01)
sway.x = sway.x * 0.995 + 0.005 * (m.pos.x - circle.x) * 0.05 //+ 0.04 * Math.cos(simulation.cycle * 0.01)
sway.y = 2.5 * Math.sin(simulation.cycle * 0.015)
for (let i = -19.5; i < 20; i++) {
const where = {
@@ -740,7 +740,7 @@ const level = {
const door = level.door(312, -750, 25, 190, 185)
level.custom = () => {
if (!(mech.cycle % 60)) { //so much work to catch blocks caught at the bottom of the vertical portals
if (!(m.cycle % 60)) { //so much work to catch blocks caught at the bottom of the vertical portals
let touching = Matter.Query.collides(map[removeIndex1], body)
if (touching.length) {
// console.log(touching[0].bodyB)
@@ -1112,7 +1112,7 @@ const level = {
level.playerExitCheck();
};
level.customTopLayer = () => {
if (elevator.pauseUntilCycle < simulation.cycle && !mech.isBodiesAsleep) { //elevator move
if (elevator.pauseUntilCycle < simulation.cycle && !m.isBodiesAsleep) { //elevator move
if (elevator.pointA.y > -1275) { //bottom
elevator.plat.speed = -10
elevator.pauseUntilCycle = simulation.cycle + 90
@@ -1321,7 +1321,7 @@ const level = {
};
level.customTopLayer = () => {
if (elevator.pauseUntilCycle < simulation.cycle && !mech.isBodiesAsleep) { //elevator move
if (elevator.pauseUntilCycle < simulation.cycle && !m.isBodiesAsleep) { //elevator move
if (elevator.pointA.y > -980) { //bottom
elevator.plat.speed = -2
elevator.pauseUntilCycle = simulation.cycle + 60
@@ -2796,7 +2796,7 @@ const level = {
portal[3].draw();
hazard.draw();
//elevator
if (elevator.pauseUntilCycle < simulation.cycle && !mech.isBodiesAsleep) {
if (elevator.pauseUntilCycle < simulation.cycle && !m.isBodiesAsleep) {
if (elevator.plat.position.y > -200) { //bottom
elevator.plat.speed = -20
elevator.pauseUntilCycle = simulation.cycle + 90
@@ -3932,7 +3932,7 @@ const level = {
if (simulation.CDScale > 0.2) simulation.CDScale *= 0.97 //mob CD time decreases each level
}
simulation.dmgScale = 0.378 * simulation.difficulty //damage done by mobs increases each level
simulation.healScale = 1 / (1 + simulation.difficulty * 0.06) //a higher denominator makes for lower heals // mech.health += heal * simulation.healScale;
simulation.healScale = 1 / (1 + simulation.difficulty * 0.06) //a higher denominator makes for lower heals // m.health += heal * simulation.healScale;
},
difficultyDecrease(num = 1) { //used in easy mode for simulation.reset()
for (let i = 0; i < num; i++) {
@@ -3973,9 +3973,9 @@ const level = {
// <br>input.key.down = ["<span class='color-text'>${input.key.down}</span>", "<span class='color-text'>ArrowDown</span>"]
// <br>input.key.right = ["<span class='color-text'>${input.key.right}</span>", "<span class='color-text'>ArrowRight</span>"]
// <br>
// <br><span class='color-var'>mech</span>.fieldMode = "<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].name}</span>"
// <br><span class='color-var'>m</span>.fieldMode = "<span class='color-text'>${m.fieldUpgrades[m.fieldMode].name}</span>"
// <br>input.key.field = ["<span class='color-text'>${input.key.field}</span>", "<span class='color-text'>right mouse</span>"]
// <br><span class='color-var'>mech</span>.field.description = "<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].description}</span>"
// <br><span class='color-var'>m</span>.field.description = "<span class='color-text'>${m.fieldUpgrades[m.fieldMode].description}</span>"
// `, 1200);
},
nextLevel() {
@@ -4009,18 +4009,18 @@ const level = {
}
},
setPosToSpawn(xPos, yPos) {
mech.spawnPos.x = mech.pos.x = xPos;
mech.spawnPos.y = mech.pos.y = yPos;
level.enter.x = mech.spawnPos.x - 50;
level.enter.y = mech.spawnPos.y + 20;
mech.transX = mech.transSmoothX = canvas.width2 - mech.pos.x;
mech.transY = mech.transSmoothY = canvas.height2 - mech.pos.y;
mech.Vx = mech.spawnVel.x;
mech.Vy = mech.spawnVel.y;
m.spawnPos.x = m.pos.x = xPos;
m.spawnPos.y = m.pos.y = yPos;
level.enter.x = m.spawnPos.x - 50;
level.enter.y = m.spawnPos.y + 20;
m.transX = m.transSmoothX = canvas.width2 - m.pos.x;
m.transY = m.transSmoothY = canvas.height2 - m.pos.y;
m.Vx = m.spawnVel.x;
m.Vy = m.spawnVel.y;
player.force.x = 0;
player.force.y = 0;
Matter.Body.setPosition(player, mech.spawnPos);
Matter.Body.setVelocity(player, mech.spawnVel);
Matter.Body.setPosition(player, m.spawnPos);
Matter.Body.setVelocity(player, m.spawnVel);
},
enter: {
x: 0,
@@ -4115,8 +4115,8 @@ const level = {
target.torque = (Math.random() - 0.5) * 2 * target.mass;
},
boost(target, yVelocity) {
mech.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts
mech.hardLandCD = 0 // disable hard landing
m.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts
m.hardLandCD = 0 // disable hard landing
if (target.velocity.y > 30) {
Matter.Body.setVelocity(target, {
x: target.velocity.x + (Math.random() - 0.5) * 2,
@@ -4148,7 +4148,7 @@ const level = {
addToWorld() { //needs to be run to put bodies into the world
for (let i = 0; i < body.length; i++) {
//body[i].collisionFilter.group = 0;
if (body[i] !== mech.holdingTarget) {
if (body[i] !== m.holdingTarget) {
body[i].collisionFilter.category = cat.body;
body[i].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
}
@@ -4270,7 +4270,7 @@ const level = {
if (rotate) {
rotor.rotate = function() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
Matter.Body.applyForce(rotor, {
x: rotor.position.x + 100,
y: rotor.position.y + 100
@@ -4364,7 +4364,7 @@ const level = {
restitution: 0,
isOpen: false,
openClose() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
if (!this.isOpen) {
if (this.position.y > y - distance) { //try to open
const position = {
@@ -4432,8 +4432,8 @@ const level = {
if (Matter.Query.collides(this, [player]).length === 0) { //not touching player
if (player.isInPortal === this) player.isInPortal = null
} else if (player.isInPortal !== this) { //touching player
if (mech.buttonCD_jump === mech.cycle) player.force.y = 0 // undo a jump right before entering the portal
mech.buttonCD_jump = 0 //disable short jumps when letting go of jump key
if (m.buttonCD_jump === m.cycle) player.force.y = 0 // undo a jump right before entering the portal
m.buttonCD_jump = 0 //disable short jumps when letting go of jump key
player.isInPortal = this.portalPair
//teleport
if (this.portalPair.angle % (Math.PI / 2)) { //if left, right up or down
@@ -4467,7 +4467,7 @@ const level = {
}
// if (body.length) {
for (let i = 0, len = body.length; i < len; i++) {
if (body[i] !== mech.holdingTarget) {
if (body[i] !== m.holdingTarget) {
// body[i].bounds.max.x - body[i].bounds.min.x < 100 && body[i].bounds.max.y - body[i].bounds.min.y < 100
if (Matter.Query.collides(this, [body[i]]).length === 0) {
if (body[i].isInPortal === this) body[i].isInPortal = null
@@ -4502,7 +4502,7 @@ const level = {
// if (body.length) {
// touching = Matter.Query.collides(this, body)
// for (let i = 0; i < touching.length; i++) {
// if (touching[i].bodyB !== mech.holdingTarget) {
// if (touching[i].bodyB !== m.holdingTarget) {
// for (let j = 0, len = body.length; j < len; j++) {
// if (body[j] === touching[i].bodyB) {
// body.splice(j, 1);
@@ -4515,7 +4515,7 @@ const level = {
// }
// }
// if (touching.length !== 0 && touching[0].bodyB !== mech.holdingTarget) {
// if (touching.length !== 0 && touching[0].bodyB !== m.holdingTarget) {
// if (body.length) {
// for (let i = 0; i < body.length; i++) {
// if (body[i] === touching[0].bodyB) {
@@ -4591,12 +4591,12 @@ const level = {
maxHeight: height,
isOn: true,
query() {
if (this.isOn && this.height > 0 && Matter.Query.region([player], this).length && !(mech.isCloak && isOptical)) {
if (this.isOn && this.height > 0 && Matter.Query.region([player], this).length && !(m.isCloak && isOptical)) {
if (damage < 0.02) {
mech.damage(damage)
} else if (mech.immuneCycle < mech.cycle) {
mech.immuneCycle = mech.cycle + tech.collisionImmuneCycles;
mech.damage(damage)
m.damage(damage)
} else if (m.immuneCycle < m.cycle) {
m.immuneCycle = m.cycle + tech.collisionImmuneCycles;
m.damage(damage)
simulation.drawList.push({ //add dmg to draw queue
x: player.position.x,
y: player.position.y,
@@ -4606,7 +4606,7 @@ const level = {
});
}
const drain = 0.005
if (mech.energy > drain) mech.energy -= drain
if (m.energy > drain) m.energy -= drain
}
},
draw() {
@@ -4623,7 +4623,7 @@ const level = {
}
},
level(isFill) {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
const growSpeed = 1
if (isFill) {
if (this.height < this.maxHeight) {

View File

@@ -61,7 +61,7 @@ const mobs = {
}
function applySlow() {
if (!who.shield && !who.isShielded && !mech.isBodiesAsleep) {
if (!who.shield && !who.isShielded && !m.isBodiesAsleep) {
if (who.isBoss) cycles = Math.floor(cycles * 0.25)
let i = who.status.length
@@ -99,7 +99,7 @@ const mobs = {
}
},
statusStun(who, cycles = 180) {
if (!who.shield && !who.isShielded && !mech.isBodiesAsleep) {
if (!who.shield && !who.isShielded && !m.isBodiesAsleep) {
Matter.Body.setVelocity(who, {
x: who.velocity.x * 0.8,
y: who.velocity.y * 0.8
@@ -150,7 +150,7 @@ const mobs = {
}
},
statusDoT(who, tickDamage, cycles = 180) {
if (!who.isShielded && !mech.isBodiesAsleep && who.alive) {
if (!who.isShielded && !m.isBodiesAsleep && who.alive) {
who.status.push({
effect() {
if ((simulation.cycle - this.startCycle) % 30 === 0) {
@@ -300,7 +300,7 @@ const mobs = {
}
},
alwaysSeePlayer() {
if (!mech.isCloak) {
if (!m.isCloak) {
this.seePlayer.recall = true;
this.seePlayer.position.x = player.position.x;
this.seePlayer.position.y = player.position.y;
@@ -310,9 +310,9 @@ const mobs = {
if (!(simulation.cycle % this.seePlayerFreq)) {
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
!mech.isCloak
Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mPosRange()).length === 0 &&
!m.isCloak
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -322,7 +322,7 @@ const mobs = {
},
seePlayerCheckByDistance() {
if (!(simulation.cycle % this.seePlayerFreq)) {
if (this.distanceToPlayer2() < this.seeAtDistance2 && !mech.isCloak) {
if (this.distanceToPlayer2() < this.seeAtDistance2 && !m.isCloak) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
this.lostPlayer();
@@ -332,8 +332,8 @@ const mobs = {
seePlayerByDistOrLOS() {
if (!(simulation.cycle % this.seePlayerFreq)) {
if (
(this.distanceToPlayer2() < this.seeAtDistance2 || (Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0)) &&
!mech.isCloak
(this.distanceToPlayer2() < this.seeAtDistance2 || (Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mPosRange()).length === 0)) &&
!m.isCloak
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -363,9 +363,9 @@ const mobs = {
if (!(simulation.cycle % this.seePlayerFreq) && (this.seePlayer.recall || this.isLookingAtPlayer(this.lookRange))) {
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
!mech.isCloak
Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mPosRange()).length === 0 &&
!m.isCloak
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -384,7 +384,7 @@ const mobs = {
ctx.fill();
}
},
mechPosRange() {
mPosRange() {
return {
x: player.position.x, // + (Math.random() - 0.5) * 50,
y: player.position.y + (Math.random() - 0.5) * 110
@@ -414,18 +414,18 @@ const mobs = {
ctx.setLineDash([125 * Math.random(), 125 * Math.random()]);
// ctx.lineDashOffset = 6*(simulation.cycle % 215);
if (this.distanceToPlayer() < this.laserRange) {
if (mech.immuneCycle < mech.cycle) mech.damage(0.0003 * simulation.dmgScale);
if (mech.energy > 0.1) mech.energy -= 0.003
if (m.immuneCycle < m.cycle) m.damage(0.0003 * simulation.dmgScale);
if (m.energy > 0.1) m.energy -= 0.003
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
ctx.lineTo(mech.pos.x, mech.pos.y);
ctx.lineTo(mech.pos.x + (Math.random() - 0.5) * 3000, mech.pos.y + (Math.random() - 0.5) * 3000);
ctx.lineTo(m.pos.x, m.pos.y);
ctx.lineTo(m.pos.x + (Math.random() - 0.5) * 3000, m.pos.y + (Math.random() - 0.5) * 3000);
ctx.lineWidth = 2;
ctx.strokeStyle = "rgb(255,0,170)";
ctx.stroke();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, 40, 0, 2 * Math.PI);
ctx.arc(m.pos.x, m.pos.y, 40, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(255,0,170,0.15)";
ctx.fill();
@@ -499,12 +499,12 @@ const mobs = {
};
vertexCollision(this.position, look, map);
vertexCollision(this.position, look, body);
if (!mech.isCloak) vertexCollision(this.position, look, [player]);
if (!m.isCloak) vertexCollision(this.position, look, [player]);
// hitting player
if (best.who === player) {
if (mech.immuneCycle < mech.cycle) {
if (m.immuneCycle < m.cycle) {
const dmg = 0.0012 * simulation.dmgScale;
mech.damage(dmg);
m.damage(dmg);
//draw damage
ctx.fillStyle = "#f00";
ctx.beginPath();
@@ -540,7 +540,7 @@ const mobs = {
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, player.position).length === 0 &&
Matter.Query.ray(body, this.position, player.position).length === 0 &&
!mech.isCloak
!m.isCloak
) {
this.foundPlayer();
} else if (this.seePlayer.recall) {
@@ -687,17 +687,17 @@ const mobs = {
pullPlayer() {
if (this.seePlayer.yes && Vector.magnitudeSquared(Vector.sub(this.position, player.position)) < 1000000) {
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= simulation.accelScale * 0.00113 * player.mass * Math.cos(angle) * (mech.onGround ? 2 : 1);
player.force.x -= simulation.accelScale * 0.00113 * player.mass * Math.cos(angle) * (m.onGround ? 2 : 1);
player.force.y -= simulation.accelScale * 0.00084 * player.mass * Math.sin(angle);
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
ctx.lineTo(mech.pos.x, mech.pos.y);
ctx.lineTo(m.pos.x, m.pos.y);
ctx.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, 40, 0, 2 * Math.PI);
ctx.arc(m.pos.x, m.pos.y, 40, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill();
}
@@ -769,7 +769,7 @@ const mobs = {
// }
},
grow() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
if (this.seePlayer.recall) {
if (this.radius < 80) {
const scale = 1.01;
@@ -843,7 +843,7 @@ const mobs = {
drift() {
//teleport towards player as a way to move
if (this.seePlayer.recall && !(simulation.cycle % this.blinkRate)) {
// && !mech.lookingAtMob(this,0.5)){
// && !m.lookingAtMob(this,0.5)){
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
const dist = Vector.sub(this.seePlayer.position, this.position);
@@ -871,8 +871,8 @@ const mobs = {
if (
!(simulation.cycle % this.fireFreq) &&
Math.abs(this.position.x - this.seePlayer.position.x) < 400 && //above player
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && //see player
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0
Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 && //see player
Matter.Query.ray(body, this.position, this.mPosRange()).length === 0
) {
spawn.bomb(this.position.x, this.position.y + this.radius * 0.5, 10 + Math.ceil(this.radius / 15), 5);
//add spin and speed
@@ -886,7 +886,7 @@ const mobs = {
}
},
fire() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
const setNoseShape = () => {
const mag = this.radius + this.radius * this.noseLength;
this.vertices[1].x = this.position.x + Math.cos(this.angle) * mag;
@@ -970,14 +970,14 @@ const mobs = {
Matter.Body.setAngle(this, angle - Math.PI);
},
explode(mass = this.mass) {
if (mech.immuneCycle < mech.cycle) {
mech.damage(Math.min(Math.max(0.02 * Math.sqrt(mass), 0.01), 0.35) * simulation.dmgScale);
if (m.immuneCycle < m.cycle) {
m.damage(Math.min(Math.max(0.02 * Math.sqrt(mass), 0.01), 0.35) * simulation.dmgScale);
this.dropPowerUp = false;
this.death(); //death with no power up or body
}
},
timeLimit() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
this.timeLeft--;
if (this.timeLeft < 0) {
this.dropPowerUp = false;
@@ -1005,11 +1005,11 @@ const mobs = {
if (this.shield) dmg *= 0.075
//energy and heal drain should be calculated after damage boosts
if (tech.energySiphon && dmg !== Infinity && this.dropPowerUp) mech.energy += Math.min(this.health, dmg) * tech.energySiphon
if (tech.energySiphon && dmg !== Infinity && this.dropPowerUp) m.energy += Math.min(this.health, dmg) * tech.energySiphon
if (tech.healthDrain && dmg !== Infinity && this.dropPowerUp) {
mech.addHealth(Math.min(this.health, dmg) * tech.healthDrain)
if (mech.health > mech.maxHealth) mech.health = mech.maxHealth
m.addHealth(Math.min(this.health, dmg) * tech.healthDrain)
if (m.health > m.maxHealth) m.health = m.maxHealth
}
dmg /= Math.sqrt(this.mass)
this.health -= dmg
@@ -1033,9 +1033,9 @@ const mobs = {
this.removeConsBB();
this.alive = false; //triggers mob removal in mob[i].replace(i)
if (this.dropPowerUp) {
if (tech.isEnergyLoss) mech.energy *= 0.75;
if (tech.isEnergyLoss) m.energy *= 0.75;
powerUps.spawnRandomPowerUp(this.position.x, this.position.y);
mech.lastKillCycle = mech.cycle; //tracks the last time a kill was made, mostly used in simulation.checks()
m.lastKillCycle = m.cycle; //tracks the last time a kill was made, mostly used in simulation.checks()
if (Math.random() < tech.sporesOnDeath) {
const len = Math.min(25, Math.floor(2 + this.mass * (0.5 + 0.5 * Math.random())))
for (let i = 0; i < len; i++) {

File diff suppressed because it is too large Load Diff

View File

@@ -12,8 +12,8 @@ const powerUps = {
<br>input.key.previousGun<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.previousGun}</span>","<span class='color-text'>MouseWheel</span>"]`
simulation.makeTextLog(text);
} else if (type === "field") {
mech.setField(index)
simulation.makeTextLog(`<span class='color-var'>mech</span>.setField("<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].name}</span>")`);
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") {
tech.giveTech(index)
simulation.makeTextLog(`<span class='color-var'>tech</span>.giveTech("<span class='color-text'>${tech.tech[index].name}</span>")`);
@@ -38,13 +38,13 @@ const powerUps = {
if (isCanceled) {
if (tech.isCancelDuplication) tech.cancelCount++
if (tech.isCancelRerolls) {
let spawnType = (mech.health < 0.25 || tech.isEnergyNoAmmo) ? "heal" : "ammo"
let spawnType = (m.health < 0.25 || tech.isEnergyNoAmmo) ? "heal" : "ammo"
if (Math.random() < 0.33) {
spawnType = "heal"
} else if (Math.random() < 0.5 && !tech.isSuperDeterminism) {
spawnType = "research"
}
for (let i = 0; i < 6; i++) powerUps.spawn(mech.pos.x + 40 * (Math.random() - 0.5), mech.pos.y + 40 * (Math.random() - 0.5), spawnType, false);
for (let i = 0; i < 6; i++) powerUps.spawn(m.pos.x + 40 * (Math.random() - 0.5), m.pos.y + 40 * (Math.random() - 0.5), spawnType, false);
}
if (tech.isBanish && type === 'tech') { // banish researched tech by adding them to the list of banished tech
const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
@@ -57,7 +57,7 @@ const powerUps = {
}
}
if (tech.manyWorlds && powerUps.research.count === 0) {
for (let i = 0; i < 2; i++) powerUps.spawn(mech.pos.x + 40 * (Math.random() - 0.5), mech.pos.y + 40 * (Math.random() - 0.5), "research", false);
for (let i = 0; i < 2; i++) powerUps.spawn(m.pos.x + 40 * (Math.random() - 0.5), m.pos.y + 40 * (Math.random() - 0.5), "research", false);
}
document.getElementById("choose-grid").style.display = "none"
document.getElementById("choose-background").style.display = "none"
@@ -65,7 +65,7 @@ const powerUps = {
document.body.style.overflow = "hidden"
simulation.paused = false;
simulation.isChoosing = false; //stops p from un pausing on key down
mech.immuneCycle = mech.cycle + 60; //player is immune to collision damage for 30 cycles
m.immuneCycle = m.cycle + 60; //player is immune to collision damage for 30 cycles
build.unPauseGrid()
requestAnimationFrame(cycle);
},
@@ -95,8 +95,8 @@ const powerUps = {
if (tech.renormalization) {
for (let i = 0; i < limit; i++) {
if (Math.random() < 0.37) {
mech.fieldCDcycle = mech.cycle + 30;
powerUps.spawn(mech.pos.x, mech.pos.y, "research");
m.fieldCDcycle = m.cycle + 30;
powerUps.spawn(m.pos.x, m.pos.y, "research");
}
}
}
@@ -105,7 +105,7 @@ const powerUps = {
if (tech.isDeathAvoid && document.getElementById("tech-anthropic")) {
document.getElementById("tech-anthropic").innerHTML = `-${powerUps.research.count}`
}
if (tech.renormalization && Math.random() < 0.37 && amount < 0) powerUps.spawn(mech.pos.x, mech.pos.y, "research");
if (tech.renormalization && Math.random() < 0.37 && amount < 0) powerUps.spawn(m.pos.x, m.pos.y, "research");
if (tech.isRerollHaste) {
if (powerUps.research.count === 0) {
tech.researchHaste = 0.66;
@@ -118,7 +118,7 @@ const powerUps = {
},
use(type) { //runs when you actually research a list of selections, type can be field, gun, or tech
powerUps.research.changeRerolls(-1)
// simulation.makeTextLog(`<span class='color-var'>mech</span>.<span class='color-r'>research</span><span class='color-symbol'>--</span>
// simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-r'>research</span><span class='color-symbol'>--</span>
// <br>${powerUps.research.count}`)
if (tech.isBanish && type === 'tech') { // banish researched tech
const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
@@ -140,18 +140,18 @@ const powerUps = {
return 40 * (simulation.healScale ** 0.25) * Math.sqrt(tech.largerHeals) * Math.sqrt(0.1 + Math.random() * 0.5); //(simulation.healScale ** 0.25) gives a smaller radius as heal scale goes down
},
effect() {
if (!tech.isEnergyHealth && mech.alive) {
const heal = tech.largerHeals * (this.size / 40 / Math.sqrt(tech.largerHeals) / (simulation.healScale ** 0.25)) ** 2 //heal scale is undone here because heal scale is properly affected on mech.addHealth()
if (!tech.isEnergyHealth && m.alive) {
const heal = tech.largerHeals * (this.size / 40 / Math.sqrt(tech.largerHeals) / (simulation.healScale ** 0.25)) ** 2 //heal scale is undone here because heal scale is properly affected on m.addHealth()
if (heal > 0) {
const healOutput = Math.min(mech.maxHealth - mech.health, heal) * simulation.healScale
mech.addHealth(heal);
simulation.makeTextLog(`<span class='color-var'>mech</span>.health <span class='color-symbol'>+=</span> ${(healOutput).toFixed(3)}`) // <br>${mech.health.toFixed(3)}
// simulation.makeTextLog("<div class='circle heal'></div> &nbsp; <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (Math.min(mech.maxHealth - mech.health, heal) * simulation.healScale * 100).toFixed(0) + "%</span>", 300)
const healOutput = Math.min(m.maxHealth - m.health, heal) * simulation.healScale
m.addHealth(heal);
simulation.makeTextLog(`<span class='color-var'>m</span>.health <span class='color-symbol'>+=</span> ${(healOutput).toFixed(3)}`) // <br>${m.health.toFixed(3)}
// simulation.makeTextLog("<div class='circle heal'></div> &nbsp; <span style='font-size:115%;'> <strong style = 'letter-spacing: 2px;'>heal</strong> " + (Math.min(m.maxHealth - m.health, heal) * simulation.healScale * 100).toFixed(0) + "%</span>", 300)
}
}
if (tech.healGiveMaxEnergy) {
tech.healMaxEnergyBonus += 0.04
mech.setMaxEnergy();
m.setMaxEnergy();
}
},
spawn(x, y, size) { //used to spawn a heal with a specific size / heal amount, not normally used
@@ -201,7 +201,7 @@ const powerUps = {
function pick(who, skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
let options = [];
for (let i = 1; i < who.length; i++) {
if (i !== mech.fieldMode && i !== skip1 && i !== skip2 && i !== skip3 && i !== skip4) options.push(i);
if (i !== m.fieldMode && i !== skip1 && i !== skip2 && i !== skip3 && i !== skip4) options.push(i);
}
//remove repeats from last selection
const totalChoices = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
@@ -222,25 +222,25 @@ const powerUps = {
}
}
let choice1 = pick(mech.fieldUpgrades)
let choice1 = pick(m.fieldUpgrades)
let choice2 = -1
let choice3 = -1
if (choice1 > -1) {
let text = ""
if (!tech.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("field",true)'>✕</div>`
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>field</h3>`
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[choice1].name}</div> ${mech.fieldUpgrades[choice1].description}</div>`
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[choice1].name}</div> ${m.fieldUpgrades[choice1].description}</div>`
if (!tech.isDeterminism) {
choice2 = pick(mech.fieldUpgrades, choice1)
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice2})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[choice2].name}</div> ${mech.fieldUpgrades[choice2].description}</div>`
choice3 = pick(mech.fieldUpgrades, choice1, choice2)
if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice3})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[choice3].name}</div> ${mech.fieldUpgrades[choice3].description}</div>`
choice2 = pick(m.fieldUpgrades, choice1)
if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice2})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[choice2].name}</div> ${m.fieldUpgrades[choice2].description}</div>`
choice3 = pick(m.fieldUpgrades, choice1, choice2)
if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice3})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[choice3].name}</div> ${m.fieldUpgrades[choice3].description}</div>`
}
if (tech.isExtraChoice) {
let choice4 = pick(mech.fieldUpgrades, choice1, choice2, choice3)
if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice4})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[choice4].name}</div> ${mech.fieldUpgrades[choice4].description}</div>`
let choice5 = pick(mech.fieldUpgrades, choice1, choice2, choice3, choice4)
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice5})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${mech.fieldUpgrades[choice5].name}</div> ${mech.fieldUpgrades[choice5].description}</div>`
let choice4 = pick(m.fieldUpgrades, choice1, choice2, choice3)
if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice4})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[choice4].name}</div> ${m.fieldUpgrades[choice4].description}</div>`
let choice5 = pick(m.fieldUpgrades, choice1, choice2, choice3, choice4)
if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice5})"><div class="grid-title"><div class="circle-grid field"></div> &nbsp; ${m.fieldUpgrades[choice5].name}</div> ${m.fieldUpgrades[choice5].description}</div>`
powerUps.field.choiceLog.push(choice4)
powerUps.field.choiceLog.push(choice5)
}
@@ -272,7 +272,7 @@ const powerUps = {
lastTotalChoices: 0, //tracks how many tech were available for random selection last time a tech was picked up
banishLog: [], //records all tech permanently removed from the selection pool
effect() {
if (mech.alive) {
if (m.alive) {
function pick(skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
let options = [];
for (let i = 0; i < tech.tech.length; i++) {
@@ -378,7 +378,7 @@ const powerUps = {
}
// simulation.makeTextLog(`No <strong class='color-m'>tech</strong> left<br>erased <strong class='color-m'>tech</strong> have been recovered`)
simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - powerUps.tech.banishLog.length)}`)
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
powerUps.spawn(m.pos.x, m.pos.y, "tech");
powerUps.endDraft("tech");
} else {
powerUps.giveRandomAmmo()
@@ -465,8 +465,8 @@ const powerUps = {
}
},
onPickUp(who) {
if (tech.isTechDamage && who.name === "tech") mech.damage(0.11)
if (tech.isMassEnergy) mech.energy += 2.5;
if (tech.isTechDamage && who.name === "tech") m.damage(0.11)
if (tech.isMassEnergy) m.energy += 2.5;
if (tech.isMineDrop) {
if (tech.isLaserMine) { //laser mine
b.laserMine(who.position)
@@ -485,7 +485,7 @@ const powerUps = {
}
},
spawnRandomPowerUp(x, y) { //mostly used after mob dies, doesn't always return a power up
if ((Math.random() * Math.random() - 0.3 > Math.sqrt(mech.health) && !tech.isEnergyHealth) || Math.random() < 0.04) { //spawn heal chance is higher at low health
if ((Math.random() * Math.random() - 0.3 > Math.sqrt(m.health) && !tech.isEnergyHealth) || Math.random() < 0.04) { //spawn heal chance is higher at low health
powerUps.spawn(x, y, "heal");
return;
}
@@ -512,7 +512,7 @@ const powerUps = {
},
randomPowerUpCounter: 0,
spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades
if (mech.fieldMode === 0) {
if (m.fieldMode === 0) {
powerUps.spawn(x, y, "field")
} else {
powerUps.randomPowerUpCounter++;
@@ -530,7 +530,7 @@ const powerUps = {
powerUps.spawn(x, y, "gun")
}
} else {
if (mech.health < 0.65 && !tech.isEnergyHealth) {
if (m.health < 0.65 && !tech.isEnergyHealth) {
powerUps.spawn(x, y, "heal");
powerUps.spawn(x, y, "heal");
} else {
@@ -560,7 +560,7 @@ const powerUps = {
//bonus power ups for clearing runs in the last game
if (level.levelsCleared === 0 && !simulation.isCheating) {
for (let i = 0; i < localSettings.levelsClearedLastGame / 4 - 1; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "tech", false); //spawn a tech for levels cleared in last game
powerUps.spawn(m.pos.x, m.pos.y, "tech", false); //spawn a tech for levels cleared in last game
}
localSettings.levelsClearedLastGame = 0 //after getting bonus power ups reset run history
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
@@ -601,7 +601,7 @@ const powerUps = {
simulation.makeTextLog(`<span class='color-var'>tech</span>.remove("<span class='color-text'>${tech.tech[choose].name}</span>")`)
for (let i = 0; i < tech.tech[choose].count; i++) {
powerUps.directSpawn(mech.pos.x, mech.pos.y, "tech");
powerUps.directSpawn(m.pos.x, m.pos.y, "tech");
powerUp[powerUp.length - 1].isBonus = true
}
// remove a random tech from the list of tech you have
@@ -609,14 +609,14 @@ const powerUps = {
tech.tech[choose].count = 0;
tech.tech[choose].isLost = true;
simulation.updateTechHUD();
mech.fieldCDcycle = mech.cycle + 30; //disable field so you can't pick up the ejected tech
m.fieldCDcycle = m.cycle + 30; //disable field so you can't pick up the ejected tech
}
} else {
// simulation.makeTextLog(`<div class='circle tech'></div> &nbsp; <strong>${tech.tech[choose].name}</strong> was ejected`, 600) //message about what tech was lost
simulation.makeTextLog(`<span class='color-var'>tech</span>.remove("<span class='color-text'>${tech.tech[choose].name}</span>")`)
for (let i = 0; i < tech.tech[choose].count; i++) {
powerUps.directSpawn(mech.pos.x, mech.pos.y, "tech");
powerUps.directSpawn(m.pos.x, m.pos.y, "tech");
powerUp[powerUp.length - 1].isBonus = true
}
// remove a random tech from the list of tech you have
@@ -624,7 +624,7 @@ const powerUps = {
tech.tech[choose].count = 0;
tech.tech[choose].isLost = true;
simulation.updateTechHUD();
mech.fieldCDcycle = mech.cycle + 30; //disable field so you can't pick up the ejected tech
m.fieldCDcycle = m.cycle + 30; //disable field so you can't pick up the ejected tech
}
},
directSpawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {

View File

@@ -7,15 +7,15 @@ const simulation = {
Engine.update(engine, simulation.delta);
simulation.wipe();
simulation.textLog();
if (mech.onGround) {
mech.groundControl()
if (m.onGround) {
m.groundControl()
} else {
mech.airControl()
m.airControl()
}
// level.checkZones();
level.checkQuery();
mech.move();
mech.look();
m.move();
m.look();
simulation.checks();
ctx.save();
simulation.camera();
@@ -29,8 +29,8 @@ const simulation = {
simulation.draw.body();
mobs.loop();
mobs.healthBar();
mech.draw();
mech.hold();
m.draw();
m.hold();
// v.draw(); //working on visibility work in progress
level.drawFills();
level.customTopLayer();
@@ -50,20 +50,20 @@ const simulation = {
Engine.update(engine, simulation.delta);
simulation.wipe();
simulation.textLog();
if (mech.onGround) {
mech.groundControl()
if (m.onGround) {
m.groundControl()
} else {
mech.airControl()
m.airControl()
}
// level.checkZones();
level.custom();
level.checkQuery();
mech.move();
mech.look();
m.move();
m.look();
simulation.checks();
ctx.save();
simulation.camera();
mech.draw();
m.draw();
level.customTopLayer();
simulation.draw.wireFrame();
simulation.draw.cons();
@@ -79,24 +79,24 @@ const simulation = {
simulation.isTimeSkipping = true;
for (let i = 0; i < cycles; i++) {
simulation.cycle++;
mech.cycle++;
m.cycle++;
simulation.gravity();
Engine.update(engine, simulation.delta);
if (mech.onGround) {
mech.groundControl()
if (m.onGround) {
m.groundControl()
} else {
mech.airControl()
m.airControl()
}
level.checkZones();
level.checkQuery();
mech.move();
m.move();
simulation.checks();
mobs.loop();
// mech.draw();
mech.walk_cycle += mech.flipLegs * mech.Vx;
// m.draw();
m.walk_cycle += m.flipLegs * m.Vx;
mech.hold();
m.hold();
b.fire();
b.bulletRemove();
b.bulletDo();
@@ -326,18 +326,18 @@ const simulation = {
// SVGrightMouse: '<svg viewBox="750 0 200 765" class="mouse-icon" width="40px" height = "60px" stroke-linecap="round" stroke-linejoin="round" stroke-width="25px" stroke="#000" fill="none"> <path fill="#fff" stroke="none" d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" /> <path d="M827,112 h30 a140,140,0,0,1,140,140 v68 h-167 z" fill="#0cf" stroke="none" /> <path fill="none" d="M827,112 h30 a140,140,0,0,1,140,140 v268 a140,140,0,0,1-140,140 h-60 a140,140,0,0,1-140-140v-268 a140,140,0,0,1,140-140h60" /> <path d="M657 317 h 340 h-170 v-207" /> <ellipse fill="#fff" cx="827.57" cy="218.64" rx="29" ry="68" /> </svg>',
makeTextLog(text, time = 120) {
if (simulation.isTextLogOpen && !build.isExperimentSelection) {
if (simulation.lastLogTime > mech.cycle) { //if there is an older message
if (simulation.lastLogTime > m.cycle) { //if there is an older message
document.getElementById("text-log").innerHTML = document.getElementById("text-log").innerHTML + '<br>' + text;
simulation.lastLogTime = mech.cycle + time;
simulation.lastLogTime = m.cycle + time;
} else {
document.getElementById("text-log").innerHTML = text;
document.getElementById("text-log").style.opacity = 1;
simulation.lastLogTime = mech.cycle + time;
simulation.lastLogTime = m.cycle + time;
}
}
},
textLog() {
if (simulation.lastLogTime && simulation.lastLogTime < mech.cycle) {
if (simulation.lastLogTime && simulation.lastLogTime < m.cycle) {
simulation.lastLogTime = 0;
// document.getElementById("text-log").innerHTML = " ";
document.getElementById("text-log").style.opacity = 0;
@@ -362,19 +362,19 @@ const simulation = {
b.activeGun = b.inventory[b.inventoryGun];
simulation.updateGunHUD();
simulation.boldActiveGunHUD();
// mech.drop();
if (true && powerUps.research.count > 0) {
// m.drop();
if (tech.isGunSwitchField && powerUps.research.count > 0) {
powerUps.research.changeRerolls(-1)
const energy = mech.energy
mech.setField((mech.fieldMode === mech.fieldUpgrades.length - 1) ? 1 : mech.fieldMode + 1) //cycle to next field
mech.energy = energy //field swap sets energy to max, this undoes that
const energy = m.energy
m.setField((m.fieldMode === m.fieldUpgrades.length - 1) ? 1 : m.fieldMode + 1) //cycle to next field
m.energy = energy //field swap sets energy to max, this undoes that
//update text to show next field
for (let i = tech.tech.length - 1; i > 0; i--) {
if (tech.tech[i].name === "unified field theory") {
const index = (mech.fieldMode === mech.fieldUpgrades.length - 1) ? 1 : mech.fieldMode + 1
const index = (m.fieldMode === m.fieldUpgrades.length - 1) ? 1 : m.fieldMode + 1
tech.tech[i].description = `after switching <strong>guns</strong><br>use a <strong class='color-r'>research</strong> to cycle your <strong class='color-f'>field</strong>
<br>(next <strong class='color-f'>field</strong>: ${mech.fieldUpgrades[index].name})`
<br>(next <strong class='color-f'>field</strong>: ${m.fieldUpgrades[index].name})`
break
}
}
@@ -435,13 +435,13 @@ const simulation = {
},
noCameraScroll() { //makes the camera not scroll after changing locations
//only works if velocity is zero
mech.pos.x = player.position.x;
mech.pos.y = playerBody.position.y - mech.yOff;
m.pos.x = player.position.x;
m.pos.y = playerBody.position.y - m.yOff;
const scale = 0.8;
mech.transSmoothX = canvas.width2 - mech.pos.x - (simulation.mouse.x - canvas.width2) * scale;
mech.transSmoothY = canvas.height2 - mech.pos.y - (simulation.mouse.y - canvas.height2) * scale;
mech.transX += (mech.transSmoothX - mech.transX) * 1;
mech.transY += (mech.transSmoothY - mech.transY) * 1;
m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale;
m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale;
m.transX += (m.transSmoothX - m.transX) * 1;
m.transY += (m.transSmoothY - m.transY) * 1;
},
edgeZoomOutSmooth: 1,
camera() {
@@ -455,10 +455,10 @@ const simulation = {
ctx.save();
ctx.translate(canvas.width2, canvas.height2); //center
ctx.scale(simulation.zoom / simulation.edgeZoomOutSmooth, simulation.zoom / simulation.edgeZoomOutSmooth); //zoom in once centered
ctx.translate(-canvas.width2 + mech.transX, -canvas.height2 + mech.transY); //translate
ctx.translate(-canvas.width2 + m.transX, -canvas.height2 + m.transY); //translate
//calculate in game mouse position by undoing the zoom and translations
simulation.mouseInGame.x = (simulation.mouse.x - canvas.width2) / simulation.zoom * simulation.edgeZoomOutSmooth + canvas.width2 - mech.transX;
simulation.mouseInGame.y = (simulation.mouse.y - canvas.height2) / simulation.zoom * simulation.edgeZoomOutSmooth + canvas.height2 - mech.transY;
simulation.mouseInGame.x = (simulation.mouse.x - canvas.width2) / simulation.zoom * simulation.edgeZoomOutSmooth + canvas.width2 - m.transX;
simulation.mouseInGame.y = (simulation.mouse.y - canvas.height2) / simulation.zoom * simulation.edgeZoomOutSmooth + canvas.height2 - m.transY;
},
restoreCamera() {
ctx.restore();
@@ -510,7 +510,7 @@ const simulation = {
document.getElementById("splash").style.display = "none"; //hides the element that spawned the function
document.getElementById("dmg").style.display = "inline";
document.getElementById("health-bg").style.display = "inline";
mech.spawn(); //spawns the player
m.spawn(); //spawns the player
level.levels = level.playableLevels.slice(0) //copy array, not by just by assignment
if (simulation.isCommunityMaps) {
@@ -546,15 +546,15 @@ const simulation = {
// simulation.updateTechHUD();
powerUps.totalPowerUps = 0;
powerUps.research.count = 0;
mech.setFillColors();
// mech.maxHealth = 1
// mech.maxEnergy = 1
// mech.energy = 1
m.setFillColors();
// m.maxHealth = 1
// m.maxEnergy = 1
// m.energy = 1
input.isPauseKeyReady = true
simulation.wipe = function() { //set wipe to normal
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
mech.hole.isOn = false
m.hole.isOn = false
simulation.paused = false;
engine.timing.timeScale = 1;
simulation.fpsCap = simulation.fpsCapDefault;
@@ -579,25 +579,25 @@ const simulation = {
document.getElementById("fade-out").style.opacity = 0;
document.title = "n-gon";
mech.alive = true;
mech.setMaxHealth()
mech.health = 0;
mech.addHealth(0.25)
mech.drop();
mech.holdingTarget = null
m.alive = true;
m.setMaxHealth()
m.health = 0;
m.addHealth(0.25)
m.drop();
m.holdingTarget = null
//set to default field
mech.fieldMode = 0;
// simulation.makeTextLog(`${simulation.SVGrightMouse}<strong style='font-size:30px;'> ${mech.fieldUpgrades[mech.fieldMode].name}</strong><br><span class='faded'></span><br>${mech.fieldUpgrades[mech.fieldMode].description}`, 600);
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>"]
// <br>input.key.left <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.left}</span>", "<span class='color-text'>ArrowLeft</span>"]
// <br>input.key.down <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.down}</span>", "<span class='color-text'>ArrowDown</span>"]
// <br>input.key.right <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.right}</span>", "<span class='color-text'>ArrowRight</span>"]
// <br>
// <br><span class='color-var'>mech</span>.fieldMode <span class='color-symbol'>=</span> "<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].name}</span>"
// <br><span class='color-var'>m</span>.fieldMode <span class='color-symbol'>=</span> "<span class='color-text'>${m.fieldUpgrades[m.fieldMode].name}</span>"
// <br>input.key.field <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.field}</span>", "<span class='color-text'>right mouse</span>"]
// <br><span class='color-var'>mech</span>.field.description <span class='color-symbol'>=</span> "<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].description}</span>"
// <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);
@@ -616,14 +616,14 @@ 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>"]`);
}, delay += step);
setTimeout(function() {
simulation.makeTextLog(`<br><span class='color-var'>mech</span>.fieldMode <span class='color-symbol'>=</span> "<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].name}</span>"`);
simulation.makeTextLog(`<br><span class='color-var'>m</span>.fieldMode <span class='color-symbol'>=</span> "<span class='color-text'>${m.fieldUpgrades[m.fieldMode].name}</span>"`);
}, delay += step);
setTimeout(function() {
simulation.makeTextLog(`input.key.field<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.field}</span>", "<span class='color-text'>MouseRight</span>"]`);
}, delay += step);
mech.setField(mech.fieldMode)
// mech.energy = 0;
m.setField(m.fieldMode)
// m.energy = 0;
//exit testing
if (simulation.testing) {
simulation.testing = false;
@@ -664,9 +664,9 @@ const simulation = {
if (tech.isMutualism && !tech.isEnergyHealth) {
for (let i = 0; i < bullet.length; i++) {
if (bullet[i].isMutualismActive) {
mech.health += 0.005
if (mech.health > mech.maxHealth) mech.health = mech.maxHealth;
mech.displayHealth();
m.health += 0.005
if (m.health > m.maxHealth) m.health = m.maxHealth;
m.displayHealth();
}
}
}
@@ -678,7 +678,7 @@ const simulation = {
} else if (powerUp[i].name === "gun") {
if (!tech.isOneGun) b.giveGuns("random")
} else if (powerUp[i].name === "field") {
if (mech.fieldMode === 0) mech.setField(Math.ceil(Math.random() * (mech.fieldUpgrades.length - 1))) //pick a random field, but not field 0
if (m.fieldMode === 0) m.setField(Math.ceil(Math.random() * (m.fieldUpgrades.length - 1))) //pick a random field, but not field 0
} else {
powerUp[i].effect();
}
@@ -687,11 +687,11 @@ const simulation = {
powerUps.totalPowerUps = powerUp.length
let holdTarget; //if player is holding something this remembers it before it gets deleted
if (mech.holdingTarget) holdTarget = mech.holdingTarget;
if (m.holdingTarget) holdTarget = m.holdingTarget;
mech.fireCDcycle = 0
mech.drop();
mech.hole.isOn = false;
m.fireCDcycle = 0
m.drop();
m.hole.isOn = false;
level.fill = [];
level.fillBG = [];
level.zones = [];
@@ -725,12 +725,12 @@ const simulation = {
frictionAir: holdTarget.frictionAir,
frictionStatic: holdTarget.frictionStatic
});
Matter.Body.setPosition(body[len], mech.pos);
mech.isHolding = true
mech.holdingTarget = body[len];
mech.holdingTarget.collisionFilter.category = 0;
mech.holdingTarget.collisionFilter.mask = 0;
mech.definePlayerMass(mech.defaultMass + mech.holdingTarget.mass * mech.holdingMassScale)
Matter.Body.setPosition(body[len], m.pos);
m.isHolding = true
m.holdingTarget = body[len];
m.holdingTarget.collisionFilter.category = 0;
m.holdingTarget.collisionFilter.mask = 0;
m.definePlayerMass(m.defaultMass + m.holdingTarget.mass * m.holdingMassScale)
}
//set fps back to default
simulation.fpsCap = simulation.fpsCapDefault
@@ -766,12 +766,12 @@ const simulation = {
// }
// },
checks() {
if (!(mech.cycle % 60)) { //once a second
if (!(m.cycle % 60)) { //once a second
//energy overfill
if (mech.energy > mech.maxEnergy) mech.energy = mech.maxEnergy + (mech.energy - mech.maxEnergy) * tech.overfillDrain //every second energy above max energy loses 25%
if (m.energy > m.maxEnergy) m.energy = m.maxEnergy + (m.energy - m.maxEnergy) * tech.overfillDrain //every second energy above max energy loses 25%
if (mech.pos.y > simulation.fallHeight) { // if 4000px deep
if (m.pos.y > simulation.fallHeight) { // if 4000px deep
Matter.Body.setVelocity(player, {
x: 0,
y: 0
@@ -793,12 +793,12 @@ const simulation = {
});
}
}
mech.damage(0.1 * simulation.difficultyMode);
mech.energy -= 0.1 * simulation.difficultyMode
m.damage(0.1 * simulation.difficultyMode);
m.energy -= 0.1 * simulation.difficultyMode
}
// if (tech.isEnergyDamage) {
// document.getElementById("tech-capacitor").innerHTML = `(+${(mech.energy/0.05).toFixed(0)}%)`
// document.getElementById("tech-capacitor").innerHTML = `(+${(m.energy/0.05).toFixed(0)}%)`
// }
// if (tech.restDamage) {
// if (player.speed < 1) {
@@ -808,14 +808,14 @@ const simulation = {
// }
// }
if (mech.lastKillCycle + 300 > mech.cycle) { //effects active for 5 seconds after killing a mob
if (tech.isEnergyRecovery) mech.energy += mech.maxEnergy * 0.05
if (tech.isHealthRecovery) mech.addHealth(0.01 * mech.maxHealth)
if (m.lastKillCycle + 300 > m.cycle) { //effects active for 5 seconds after killing a mob
if (tech.isEnergyRecovery) m.energy += m.maxEnergy * 0.05
if (tech.isHealthRecovery) m.addHealth(0.01 * m.maxHealth)
}
if (!(simulation.cycle % 420)) { //once every 7 seconds
if (tech.cyclicImmunity && mech.immuneCycle < mech.cycle + tech.cyclicImmunity) mech.immuneCycle = mech.cycle + tech.cyclicImmunity; //player is immune to collision damage for 60 cycles
if (tech.cyclicImmunity && m.immuneCycle < m.cycle + tech.cyclicImmunity) m.immuneCycle = m.cycle + tech.cyclicImmunity; //player is immune to collision damage for 60 cycles
fallCheck = function(who, save = false) {
let i = who.length;
@@ -845,13 +845,13 @@ const simulation = {
//check for double crouch
//crouch playerHead.position.y - player.position.y = 9.7 //positive
//standing playerHead.position.y - player.position.y = -30 //negative
// mech.undoCrouch()
// if (!mech.crouch && ((playerHead.position.y - player.position.y) > 0)) {
// m.undoCrouch()
// if (!m.crouch && ((playerHead.position.y - player.position.y) > 0)) {
// Matter.Body.translate(playerHead, {
// x: 0,
// y: 40
// });
// } else if (mech.crouch && ((playerHead.position.y - player.position.y) > 10)) {
// } else if (m.crouch && ((playerHead.position.y - player.position.y) > 10)) {
// Matter.Body.translate(playerHead, {
// x: 0,
// y: 40
@@ -867,7 +867,7 @@ const simulation = {
},
draw: {
powerUp() { //is set by Bayesian tech
// ctx.globalAlpha = 0.4 * Math.sin(mech.cycle * 0.15) + 0.6;
// ctx.globalAlpha = 0.4 * Math.sin(m.cycle * 0.15) + 0.6;
// for (let i = 0, len = powerUp.length; i < len; ++i) {
// ctx.beginPath();
// ctx.arc(powerUp[i].position.x, powerUp[i].position.y, powerUp[i].size, 0, 2 * Math.PI);
@@ -877,7 +877,7 @@ const simulation = {
// ctx.globalAlpha = 1;
},
powerUpNormal() { //back up in case power up draw gets changed
ctx.globalAlpha = 0.4 * Math.sin(mech.cycle * 0.15) + 0.6;
ctx.globalAlpha = 0.4 * Math.sin(m.cycle * 0.15) + 0.6;
for (let i = 0, len = powerUp.length; i < len; ++i) {
ctx.beginPath();
ctx.arc(powerUp[i].position.x, powerUp[i].position.y, powerUp[i].size, 0, 2 * Math.PI);
@@ -887,7 +887,7 @@ const simulation = {
ctx.globalAlpha = 1;
},
powerUpBonus() { //draws crackle effect for bonus power ups
ctx.globalAlpha = 0.4 * Math.sin(mech.cycle * 0.15) + 0.6;
ctx.globalAlpha = 0.4 * Math.sin(m.cycle * 0.15) + 0.6;
for (let i = 0, len = powerUp.length; i < len; ++i) {
ctx.beginPath();
ctx.arc(powerUp[i].position.x, powerUp[i].position.y, powerUp[i].size, 0, 2 * Math.PI);

View File

@@ -99,10 +99,12 @@ const spawn = {
// spawn.shield(me, x, y, 1);
me.onDeath = function() {
//add lore level as next level if player took lore tech earlier in the game
if (lore.techCount > 9 && !simulation.isCheating) level.levels.push("null")
level.exit.x = 5500;
level.exit.y = -330;
if (lore.techCount > 9 && !simulation.isCheating) {
level.levels.push("null")
level.exit.x = 5500;
level.exit.y = -330;
simulation.makeTextLog(`level.levels.push("null")`) // <br>${powerUps.research.count}
}
//ramp up damage
for (let i = 0; i < 3; i++) level.difficultyIncrease(simulation.difficultyMode)
@@ -165,7 +167,7 @@ const spawn = {
this.modeDo(); //this does different things based on the mode
this.checkStatus();
this.cycle++; //switch modes÷
// if (!mech.isBodiesAsleep) {
// if (!m.isBodiesAsleep) {
if (this.health > 0.25) {
if (this.cycle > this.endCycle) {
this.cycle = 0;
@@ -222,7 +224,7 @@ const spawn = {
}
me.spawnInterval = 395
me.modeSpawns = function() {
if (!(this.cycle % this.spawnInterval) && !mech.isBodiesAsleep && mob.length < 40) {
if (!(this.cycle % this.spawnInterval) && !m.isBodiesAsleep && mob.length < 40) {
if (this.mode !== 3) Matter.Body.setAngularVelocity(this, 0.1)
//fire a bullet from each vertex
let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
@@ -273,22 +275,22 @@ const spawn = {
ctx.fill();
//when player is inside event horizon
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
if (mech.energy > 0) mech.energy -= 0.01
if (mech.energy < 0.15) {
mech.damage(0.0004 * simulation.dmgScale);
if (m.energy > 0) m.energy -= 0.01
if (m.energy < 0.15) {
m.damage(0.0004 * simulation.dmgScale);
}
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= 0.0017 * Math.cos(angle) * player.mass * (mech.onGround ? 1.7 : 1);
player.force.x -= 0.0017 * Math.cos(angle) * player.mass * (m.onGround ? 1.7 : 1);
player.force.y -= 0.0017 * Math.sin(angle) * player.mass;
//draw line to player
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
ctx.lineTo(mech.pos.x, mech.pos.y);
ctx.lineTo(m.pos.x, m.pos.y);
ctx.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, 40, 0, 2 * Math.PI);
ctx.arc(m.pos.x, m.pos.y, 40, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill();
}
@@ -297,7 +299,7 @@ const spawn = {
me.rotateVelocity = 0.0025
me.rotateCount = 0;
me.modeLasers = function() {
if (!mech.isBodiesAsleep && !this.isStunned) {
if (!m.isBodiesAsleep && !this.isStunned) {
let slowed = false //check if slowed
for (let i = 0; i < this.status.length; i++) {
if (this.status[i].type === "slow") {
@@ -401,10 +403,10 @@ const spawn = {
// vertexCollision(where, look, mob);
vertexCollision(where, look, map);
vertexCollision(where, look, body);
if (!mech.isCloak) vertexCollision(where, look, [player]);
if (best.who && best.who === player && mech.immuneCycle < mech.cycle) {
mech.immuneCycle = mech.cycle + 60 + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
mech.damage(dmg);
if (!m.isCloak) vertexCollision(where, look, [player]);
if (best.who && best.who === player && m.immuneCycle < m.cycle) {
m.immuneCycle = m.cycle + 60 + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
m.damage(dmg);
simulation.drawList.push({ //add dmg to draw queue
x: best.x,
y: best.y,
@@ -519,7 +521,7 @@ const spawn = {
if (Math.random() < 0.33 * dmg * Math.sqrt(this.mass) && this.health > dmg) this.split();
}
me.do = function() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
this.seePlayerByDistOrLOS();
this.checkStatus();
this.attraction();
@@ -578,13 +580,13 @@ const spawn = {
powerUps.spawnBossPowerUp(me.position.x, me.position.y)
powerUps.spawn(me.position.x, me.position.y, "heal");
powerUps.spawn(me.position.x, me.position.y, "ammo");
} else if (!mech.isCloak) {
} else if (!m.isCloak) {
me.foundPlayer();
}
me.onHit = function() { //run this function on hitting player
powerUps.ejectTech()
powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
powerUps.spawn(m.pos.x, m.pos.y, "heal");
powerUps.spawn(m.pos.x, m.pos.y, "heal");
};
me.onDeath = function() {
this.leaveBody = false;
@@ -814,7 +816,7 @@ const spawn = {
}
// this.seePlayerCheckByDistance()
if (!(simulation.cycle % this.seePlayerFreq)) {
if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !mech.isCloak ignore cloak for black holes
if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !m.isCloak ignore cloak for black holes
this.locatePlayer();
if (!this.seePlayer.yes) this.seePlayer.yes = true;
} else if (this.seePlayer.recall) {
@@ -848,22 +850,22 @@ const spawn = {
//when player is inside event horizon
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
if (mech.energy > 0) mech.energy -= 0.004
if (mech.energy < 0.1) {
mech.damage(0.00015 * simulation.dmgScale);
if (m.energy > 0) m.energy -= 0.004
if (m.energy < 0.1) {
m.damage(0.00015 * simulation.dmgScale);
}
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= 0.00125 * player.mass * Math.cos(angle) * (mech.onGround ? 1.8 : 1);
player.force.x -= 0.00125 * player.mass * Math.cos(angle) * (m.onGround ? 1.8 : 1);
player.force.y -= 0.0001 * player.mass * Math.sin(angle);
//draw line to player
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
ctx.lineTo(mech.pos.x, mech.pos.y);
ctx.lineTo(m.pos.x, m.pos.y);
ctx.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, 40, 0, 2 * Math.PI);
ctx.arc(m.pos.x, m.pos.y, 40, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill();
}
@@ -910,7 +912,7 @@ const spawn = {
});
}
if (!(simulation.cycle % this.seePlayerFreq)) {
if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !mech.isCloak ignore cloak for black holes
if (this.distanceToPlayer2() < this.seeAtDistance2) { //&& !m.isCloak ignore cloak for black holes
this.locatePlayer();
if (!this.seePlayer.yes) this.seePlayer.yes = true;
} else if (this.seePlayer.recall) {
@@ -954,22 +956,22 @@ const spawn = {
ctx.fill();
//when player is inside event horizon
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
if (mech.energy > 0) mech.energy -= 0.006
if (mech.energy < 0.1) {
mech.damage(0.0002 * simulation.dmgScale);
if (m.energy > 0) m.energy -= 0.006
if (m.energy < 0.1) {
m.damage(0.0002 * simulation.dmgScale);
}
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x);
player.force.x -= 0.0013 * Math.cos(angle) * player.mass * (mech.onGround ? 1.7 : 1);
player.force.x -= 0.0013 * Math.cos(angle) * player.mass * (m.onGround ? 1.7 : 1);
player.force.y -= 0.0013 * Math.sin(angle) * player.mass;
//draw line to player
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
ctx.lineTo(mech.pos.x, mech.pos.y);
ctx.lineTo(m.pos.x, m.pos.y);
ctx.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke();
ctx.beginPath();
ctx.arc(mech.pos.x, mech.pos.y, 40, 0, 2 * Math.PI);
ctx.arc(m.pos.x, m.pos.y, 40, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill();
}
@@ -1179,7 +1181,7 @@ const spawn = {
};
spawn.shield(me, x, y);
me.do = function() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
this.seePlayerByLookingAt();
this.checkStatus();
this.attraction();
@@ -1189,7 +1191,7 @@ const spawn = {
const rangeWidth = 2000; //this is sqrt of 4000000 from above if()
//targeting laser will slowly move from the mob to the player's position
this.laserPos = Vector.add(this.laserPos, Vector.mult(Vector.sub(player.position, this.laserPos), 0.1));
let targetDist = Vector.magnitude(Vector.sub(this.laserPos, mech.pos));
let targetDist = Vector.magnitude(Vector.sub(this.laserPos, m.pos));
const r = 12;
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
@@ -1341,12 +1343,12 @@ const spawn = {
};
vertexCollision(this.position, look, map);
vertexCollision(this.position, look, body);
if (!mech.isCloak) vertexCollision(this.position, look, [player]);
if (!m.isCloak) vertexCollision(this.position, look, [player]);
// hitting player
if (best.who === player) {
if (mech.immuneCycle < mech.cycle) {
if (m.immuneCycle < m.cycle) {
const dmg = 0.001 * simulation.dmgScale;
mech.damage(dmg);
m.damage(dmg);
//draw damage
ctx.fillStyle = color;
ctx.beginPath();
@@ -1408,7 +1410,7 @@ const spawn = {
this.checkStatus();
if (!this.isStunned) {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
//check if slowed
let slowed = false
for (let i = 0; i < this.status.length; i++) {
@@ -1499,11 +1501,11 @@ const spawn = {
// vertexCollision(where, look, mob);
vertexCollision(where, look, map);
vertexCollision(where, look, body);
if (!mech.isCloak) vertexCollision(where, look, [player]);
if (best.who && best.who === player && mech.immuneCycle < mech.cycle) {
mech.immuneCycle = mech.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
if (!m.isCloak) vertexCollision(where, look, [player]);
if (best.who && best.who === player && m.immuneCycle < m.cycle) {
m.immuneCycle = m.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
const dmg = 0.14 * simulation.dmgScale;
mech.damage(dmg);
m.damage(dmg);
simulation.drawList.push({ //add dmg to draw queue
x: best.x,
y: best.y,
@@ -1544,7 +1546,7 @@ const spawn = {
}
};
me.do = function() {
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
// this.gravity();
this.seePlayerByLookingAt();
this.checkStatus();
@@ -1616,9 +1618,9 @@ const spawn = {
if (!(simulation.cycle % this.seePlayerFreq)) { // this.seePlayerCheck(); from mobs
if (
this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 &&
!mech.isCloak
Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mPosRange()).length === 0 &&
!m.isCloak
) {
this.foundPlayer();
if (this.cd === Infinity) this.cd = simulation.cycle + this.delay * 0.7;
@@ -1674,7 +1676,7 @@ const spawn = {
this.checkStatus();
this.attraction();
//draw
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
if (this.seePlayer.yes) {
if (this.alpha < 1) this.alpha += 0.01;
} else {
@@ -2019,7 +2021,7 @@ const spawn = {
this.seePlayerCheck();
this.checkStatus();
if (!mech.isBodiesAsleep) {
if (!m.isBodiesAsleep) {
const setNoseShape = () => {
const mag = this.radius + this.radius * this.noseLength;
this.vertices[1].x = this.position.x + Math.cos(this.angle) * mag;
@@ -2135,7 +2137,7 @@ const spawn = {
this.seePlayerCheck();
this.checkStatus();
this.attraction();
if (this.seePlayer.recall && !(simulation.cycle % this.fireFreq) && !mech.isBodiesAsleep) {
if (this.seePlayer.recall && !(simulation.cycle % this.fireFreq) && !m.isBodiesAsleep) {
Matter.Body.setAngularVelocity(this, 0.14)
//fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) {
@@ -2173,7 +2175,7 @@ const spawn = {
this.checkStatus();
this.attraction();
this.repulsion();
if (this.seePlayer.recall && !(simulation.cycle % this.fireFreq) && !mech.isBodiesAsleep) {
if (this.seePlayer.recall && !(simulation.cycle % this.fireFreq) && !m.isBodiesAsleep) {
Matter.Body.setAngularVelocity(this, 0.11)
//fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) {
@@ -2218,7 +2220,7 @@ const spawn = {
this.repulsion();
this.cycle++
if (this.seePlayer.recall && ((this.cycle % 15) === 0) && !mech.isBodiesAsleep) {
if (this.seePlayer.recall && ((this.cycle % 15) === 0) && !m.isBodiesAsleep) {
if (this.canFire) {
if (this.cycle > 120) {
this.cycle = 0
@@ -2701,7 +2703,7 @@ const spawn = {
if (this.freeOfWires) {
this.gravity();
} else {
if (mech.pos.x > breakingPoint) {
if (m.pos.x > breakingPoint) {
this.freeOfWires = true;
this.fill = "#000"
this.force.x += -0.003;
@@ -2716,9 +2718,9 @@ const spawn = {
})
//player friction from the wires
if (mech.pos.x > 700 && player.velocity.x > -2) {
let wireFriction = 0.75 * Math.min(0.6, Math.max(0, 100 / (breakingPoint - mech.pos.x)));
if (!mech.onGround) wireFriction *= 3
if (m.pos.x > 700 && player.velocity.x > -2) {
let wireFriction = 0.75 * Math.min(0.6, Math.max(0, 100 / (breakingPoint - m.pos.x)));
if (!m.onGround) wireFriction *= 3
Matter.Body.setVelocity(player, {
x: player.velocity.x - wireFriction,
y: player.velocity.y
@@ -2726,15 +2728,15 @@ const spawn = {
}
//move to player
Matter.Body.setPosition(this, {
x: mech.pos.x + (42 * Math.cos(mech.angle + Math.PI)),
y: mech.pos.y + (42 * Math.sin(mech.angle + Math.PI))
x: m.pos.x + (42 * Math.cos(m.angle + Math.PI)),
y: m.pos.y + (42 * Math.sin(m.angle + Math.PI))
})
}
//draw wire
ctx.beginPath();
ctx.moveTo(wireX, wireY);
ctx.quadraticCurveTo(wireX, 0, this.position.x, this.position.y);
if (!this.freeOfWires) ctx.lineTo(mech.pos.x + (30 * Math.cos(mech.angle + Math.PI)), mech.pos.y + (30 * Math.sin(mech.angle + Math.PI)));
if (!this.freeOfWires) ctx.lineTo(m.pos.x + (30 * Math.cos(m.angle + Math.PI)), m.pos.y + (30 * Math.sin(m.angle + Math.PI)));
ctx.lineCap = "butt";
ctx.lineWidth = 15;
ctx.strokeStyle = "#000";
@@ -2769,16 +2771,16 @@ const spawn = {
if (this.freeOfWires) {
this.gravity();
} else {
if (mech.pos.x > breakingPoint) {
if (m.pos.x > breakingPoint) {
this.freeOfWires = true;
this.force.x -= 0.0004;
this.fill = "#222";
}
//move mob to player
mech.calcLeg(0, 0);
m.calcLeg(0, 0);
Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.knee.x - 5,
y: mech.pos.y + mech.knee.y
x: m.pos.x + m.flipLegs * m.knee.x - 5,
y: m.pos.y + m.knee.y
})
}
//draw wire
@@ -2819,16 +2821,16 @@ const spawn = {
if (this.freeOfWires) {
this.gravity();
} else {
if (mech.pos.x > breakingPoint) {
if (m.pos.x > breakingPoint) {
this.freeOfWires = true;
this.force.x += -0.0003;
this.fill = "#333";
}
//move mob to player
mech.calcLeg(Math.PI, -3);
m.calcLeg(Math.PI, -3);
Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.knee.x - 5,
y: mech.pos.y + mech.knee.y
x: m.pos.x + m.flipLegs * m.knee.x - 5,
y: m.pos.y + m.knee.y
})
}
//draw wire
@@ -2868,16 +2870,16 @@ const spawn = {
if (this.freeOfWires) {
this.gravity();
} else {
if (mech.pos.x > breakingPoint) {
if (m.pos.x > breakingPoint) {
this.freeOfWires = true;
this.force.x += -0.0006;
this.fill = "#111";
}
//move mob to player
mech.calcLeg(0, 0);
m.calcLeg(0, 0);
Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.foot.x - 5,
y: mech.pos.y + mech.foot.y - 1
x: m.pos.x + m.flipLegs * m.foot.x - 5,
y: m.pos.y + m.foot.y - 1
})
}
//draw wire
@@ -2917,16 +2919,16 @@ const spawn = {
if (this.freeOfWires) {
this.gravity();
} else {
if (mech.pos.x > breakingPoint) {
if (m.pos.x > breakingPoint) {
this.freeOfWires = true;
this.force.x += -0.0005;
this.fill = "#222";
}
//move mob to player
mech.calcLeg(Math.PI, -3);
m.calcLeg(Math.PI, -3);
Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.foot.x - 5,
y: mech.pos.y + mech.foot.y - 1
x: m.pos.x + m.flipLegs * m.foot.x - 5,
y: m.pos.y + m.foot.y - 1
})
}
//draw wire

View File

@@ -91,29 +91,29 @@ const tech = {
return false
},
damageFromTech() {
let dmg = mech.fieldDamage
let dmg = m.fieldDamage
if (tech.isTechDamage) dmg *= 2
if (tech.isDupDamage) dmg *= 1 + Math.min(1, tech.duplicationChance())
if (tech.isLowEnergyDamage) dmg *= 1 + Math.max(0, 1 - mech.energy) * 0.5
if (tech.isLowEnergyDamage) dmg *= 1 + Math.max(0, 1 - m.energy) * 0.5
if (tech.isMaxEnergyTech) dmg *= 1.4
if (tech.isEnergyNoAmmo) dmg *= 1.5
if (tech.isDamageForGuns) dmg *= 1 + 0.13 * b.inventory.length
if (tech.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, 1 - mech.health)
if (tech.isHarmDamage && mech.lastHarmCycle + 600 > mech.cycle) dmg *= 3;
if (tech.isLowHealthDmg) dmg *= 1 + 0.6 * Math.max(0, 1 - m.health)
if (tech.isHarmDamage && m.lastHarmCycle + 600 > m.cycle) dmg *= 3;
if (tech.isEnergyLoss) dmg *= 1.5;
if (tech.isAcidDmg && mech.health > 1) dmg *= 1.4;
if (tech.isAcidDmg && m.health > 1) dmg *= 1.4;
if (tech.restDamage > 1 && player.speed < 1) dmg *= tech.restDamage
if (tech.isEnergyDamage) dmg *= 1 + mech.energy / 9;
if (tech.isEnergyDamage) dmg *= 1 + m.energy / 9;
if (tech.isDamageFromBulletCount) dmg *= 1 + bullet.length * 0.0038
if (tech.isRerollDamage) dmg *= 1 + 0.035 * powerUps.research.count
if (tech.isOneGun && b.inventory.length < 2) dmg *= 1.25
if (tech.isNoFireDamage && mech.cycle > mech.fireCDcycle + 120) dmg *= 1.66
if (tech.isNoFireDamage && m.cycle > m.fireCDcycle + 120) dmg *= 1.66
if (tech.isSpeedDamage) dmg *= 1 + Math.min(0.4, player.speed * 0.013)
if (tech.isBotDamage) dmg *= 1 + 0.02 * tech.totalBots()
return dmg * tech.slowFire * tech.aimDamage
},
duplicationChance() {
return (tech.isBayesian ? 0.2 : 0) + tech.cancelCount * 0.04 + tech.duplicateChance + mech.duplicateChance
return (tech.isBayesian ? 0.2 : 0) + tech.cancelCount * 0.04 + tech.duplicateChance + m.duplicateChance
},
totalBots() {
return tech.foamBotCount + tech.nailBotCount + tech.laserBotCount + tech.boomBotCount + tech.orbitBotCount + tech.plasmaBotCount + tech.missileBotCount
@@ -206,7 +206,7 @@ const tech = {
requires: "arsenal or cyclic rate boost",
effect() {
tech.isGunCycle = true;
for (let i = 0; i < 6; i++) powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "gun");
for (let i = 0; i < 6; i++) powerUps.spawn(m.pos.x + 10 * Math.random(), m.pos.y + 10 * Math.random(), "gun");
},
remove() {
tech.isGunCycle = false;
@@ -226,15 +226,15 @@ const tech = {
effect() {
for (let i = 0; i < b.inventory.length; i++) {
if (Math.random() < 0.2) {
powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "tech");
powerUps.spawn(m.pos.x + 10 * Math.random(), m.pos.y + 10 * Math.random(), "tech");
} else if (Math.random() < 0.25) {
powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "field");
powerUps.spawn(m.pos.x + 10 * Math.random(), m.pos.y + 10 * Math.random(), "field");
} else if (Math.random() < 0.33) {
powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "heal");
powerUps.spawn(m.pos.x + 10 * Math.random(), m.pos.y + 10 * Math.random(), "heal");
} else if (Math.random() < 0.5) {
powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "ammo");
powerUps.spawn(m.pos.x + 10 * Math.random(), m.pos.y + 10 * Math.random(), "ammo");
} else {
powerUps.spawn(mech.pos.x + 10 * Math.random(), mech.pos.y + 10 * Math.random(), "research");
powerUps.spawn(m.pos.x + 10 * Math.random(), m.pos.y + 10 * Math.random(), "research");
}
}
@@ -378,7 +378,7 @@ const tech = {
}
},
{
name: "Higgs mechanism",
name: "Higgs manism",
description: "while <strong>firing</strong> your <strong>position</strong> is locked<br> and <strong class='color-harm'>harm</strong> is reduced by <strong>60%</strong>",
maxCount: 1,
count: 0,
@@ -409,12 +409,12 @@ const tech = {
effect() { // good with melee builds, content skipping builds
tech.squirrelFx += 0.25;
tech.squirrelJump += 0.1;
mech.setMovement()
m.setMovement()
},
remove() {
tech.squirrelFx = 1;
tech.squirrelJump = 1;
mech.setMovement()
m.setMovement()
}
},
{
@@ -423,7 +423,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.Fx > 0.016 && !tech.isEnergyHealth
return m.Fx > 0.016 && !tech.isEnergyHealth
},
requires: "speed increase, not mass-energy equivalence",
effect() {
@@ -439,7 +439,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.Fx > 0.016
return m.Fx > 0.016
},
requires: "speed increase",
effect() {
@@ -457,7 +457,7 @@ const tech = {
// allowed() {
// return tech.isFireNotMove || tech.isFireMoveLock
// },
// requires: "inertial frame or Higgs mechanism",
// requires: "inertial frame or Higgs manism",
// effect() {
// tech.isRestHarm = true
// },
@@ -625,7 +625,7 @@ const tech = {
effect() {
tech.sporesOnDeath += 0.09;
for (let i = 0; i < 8; i++) {
b.spore(mech.pos)
b.spore(m.pos)
}
},
remove() {
@@ -675,7 +675,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return (tech.totalBots() > 1 || tech.haveGunCheck("drones") || tech.haveGunCheck("mine") || tech.haveGunCheck("spores") || mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing") && !tech.isEnergyHealth
return (tech.totalBots() > 1 || tech.haveGunCheck("drones") || tech.haveGunCheck("mine") || tech.haveGunCheck("spores") || m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing") && !tech.isEnergyHealth
},
requires: "drones, spores, mines, or bots",
effect() {
@@ -840,7 +840,7 @@ const tech = {
maxCount: 9,
count: 0,
allowed() {
return mech.maxEnergy > 0.5
return m.maxEnergy > 0.5
},
requires: "maximum energy above 50%",
effect() {
@@ -934,7 +934,7 @@ const tech = {
effect() {
tech.isRerollBots = true;
powerUps.research.changeRerolls(0)
simulation.makeTextLog(`<span class='color-var'>mech</span>.<span class='color-r'>research</span> <span class='color-symbol'>=</span> 0`)
simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-r'>research</span> <span class='color-symbol'>=</span> 0`)
},
remove() {
tech.isRerollBots = false;
@@ -1023,7 +1023,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name !== "wormhole"
return m.fieldUpgrades[m.fieldMode].name !== "wormhole"
},
requires: "not wormhole",
effect() {
@@ -1060,7 +1060,7 @@ const tech = {
requires: "",
effect() {
tech.collisionImmuneCycles += 45;
mech.immuneCycle = mech.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
m.immuneCycle = m.cycle + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
},
remove() {
tech.collisionImmuneCycles = 25;
@@ -1088,7 +1088,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.harmReduction() < 1
return m.harmReduction() < 1
},
requires: "some harm reduction",
effect() {
@@ -1107,7 +1107,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return !tech.isEnergyHealth && mech.harmReduction() < 1
return !tech.isEnergyHealth && m.harmReduction() < 1
},
requires: "some harm reduction",
effect() {
@@ -1123,7 +1123,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.harmReduction() < 1
return m.harmReduction() < 1
},
requires: "some harm reduction",
effect() {
@@ -1186,8 +1186,8 @@ const tech = {
description: "<strong>charge</strong>, <strong>parity</strong>, and <strong>time</strong> invert to undo <strong class='color-harm'>harm</strong><br><strong class='color-rewind'>rewind</strong> <strong>(1.5—5)</strong> seconds for <strong>(66—220)</strong> <strong class='color-f'>energy</strong>",
maxCount: 1,
count: 0,
allowed() { //&& (mech.fieldUpgrades[mech.fieldMode].name !== "nano-scale manufacturing" || mech.maxEnergy > 1)
return mech.maxEnergy > 0.99 && mech.fieldUpgrades[mech.fieldMode].name !== "standing wave harmonics" && !tech.isEnergyHealth && !tech.isRewindGun
allowed() { //&& (m.fieldUpgrades[m.fieldMode].name !== "nano-scale manufacturing" || m.maxEnergy > 1)
return m.maxEnergy > 0.99 && m.fieldUpgrades[m.fieldMode].name !== "standing wave harmonics" && !tech.isEnergyHealth && !tech.isRewindGun
},
requires: "not standing wave, mass-energy, piezo, max energy reduction, CPT gun",
effect() {
@@ -1240,7 +1240,7 @@ const tech = {
requires: "not mass-energy equivalence",
effect() {
tech.isPiezo = true;
mech.energy += 4;
m.energy += 4;
},
remove() {
tech.isPiezo = false;
@@ -1257,11 +1257,11 @@ const tech = {
requires: "piezoelectricity, Penrose, half-wave, or thermoelectric, but not time crystals",
effect: () => {
tech.energyRegen = 0;
mech.fieldRegen = tech.energyRegen;
m.fieldRegen = tech.energyRegen;
},
remove() {
tech.energyRegen = 0.001;
mech.fieldRegen = tech.energyRegen;
m.fieldRegen = tech.energyRegen;
}
},
{
@@ -1270,25 +1270,25 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return !tech.isEnergyLoss && !tech.isPiezo && !tech.isRewindAvoidDeath && !tech.isRewindGun && !tech.isSpeedHarm && mech.fieldUpgrades[mech.fieldMode].name !== "negative mass field" && !tech.isHealLowHealth && !tech.isTechDamage
return !tech.isEnergyLoss && !tech.isPiezo && !tech.isRewindAvoidDeath && !tech.isRewindGun && !tech.isSpeedHarm && m.fieldUpgrades[m.fieldMode].name !== "negative mass field" && !tech.isHealLowHealth && !tech.isTechDamage
},
requires: "not exothermic process, piezoelectricity, CPT, 1st law, negative mass , ...",
effect: () => {
mech.health = 0
// mech.displayHealth();
m.health = 0
// m.displayHealth();
document.getElementById("health").style.display = "none"
document.getElementById("health-bg").style.display = "none"
document.getElementById("dmg").style.backgroundColor = "#0cf";
tech.isEnergyHealth = true;
mech.displayHealth();
m.displayHealth();
},
remove() {
tech.isEnergyHealth = false;
document.getElementById("health").style.display = "inline"
document.getElementById("health-bg").style.display = "inline"
document.getElementById("dmg").style.backgroundColor = "#f67";
mech.health = Math.min(mech.maxHealth, mech.energy);
mech.displayHealth();
m.health = Math.min(m.maxHealth, m.energy);
m.displayHealth();
}
},
@@ -1323,7 +1323,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.maxEnergy > 1 || tech.isEnergyRecovery || tech.isPiezo || tech.energySiphon > 0
return m.maxEnergy > 1 || tech.isEnergyRecovery || tech.isPiezo || tech.energySiphon > 0
},
requires: "increased energy regen or max energy",
effect: () => {
@@ -1339,7 +1339,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return (tech.haveGunCheck("nail gun") && tech.isIceCrystals) || tech.haveGunCheck("laser") || mech.fieldUpgrades[mech.fieldMode].name === "plasma torch" || mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave"
return (tech.haveGunCheck("nail gun") && tech.isIceCrystals) || tech.haveGunCheck("laser") || m.fieldUpgrades[m.fieldMode].name === "plasma torch" || m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" || m.fieldUpgrades[m.fieldMode].name === "pilot wave"
},
requires: "energy based damage",
effect() {
@@ -1371,16 +1371,16 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return tech.isEnergyLoss && mech.maxEnergy < 1.1 && !tech.isSporeField && !tech.isRewindAvoidDeath
return tech.isEnergyLoss && m.maxEnergy < 1.1 && !tech.isSporeField && !tech.isRewindAvoidDeath
},
requires: "exothermic process, not max energy increase, CPT, or spore nano-scale",
effect() {
tech.isMaxEnergyTech = true;
mech.setMaxEnergy()
m.setMaxEnergy()
},
remove() {
tech.isMaxEnergyTech = false;
mech.setMaxEnergy()
m.setMaxEnergy()
}
},
{
@@ -1389,7 +1389,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return tech.isEnergyLoss && mech.maxEnergy < 1.1
return tech.isEnergyLoss && m.maxEnergy < 1.1
},
requires: "exothermic process, not max energy increase",
effect() {
@@ -1405,18 +1405,18 @@ const tech = {
maxCount: 9,
count: 0,
allowed() {
return mech.maxEnergy > 0.99
return m.maxEnergy > 0.99
},
requires: "max energy >= 1",
effect() {
// mech.maxEnergy += 0.5
// mech.energy += 0.5
// m.maxEnergy += 0.5
// m.energy += 0.5
tech.bonusEnergy += 0.5
mech.setMaxEnergy()
m.setMaxEnergy()
},
remove() {
tech.bonusEnergy = 0;
mech.setMaxEnergy()
m.setMaxEnergy()
}
},
{
@@ -1457,7 +1457,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.maxEnergy > 0.99
return m.maxEnergy > 0.99
},
requires: "max energy >= 1",
effect() {
@@ -1489,7 +1489,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.health < 0.5 || build.isExperimentSelection
return m.health < 0.5 || build.isExperimentSelection
},
requires: "health below 60",
effect() {
@@ -1504,7 +1504,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return (mech.harmReduction() < 1 || tech.healthDrain || tech.isLowHealthDmg || tech.isHealthRecovery || tech.isHealLowHealth || tech.largerHeals > 1 || tech.isPerpetualHeal) && !tech.isEnergyHealth
return (m.harmReduction() < 1 || tech.healthDrain || tech.isLowHealthDmg || tech.isHealthRecovery || tech.isHealLowHealth || tech.largerHeals > 1 || tech.isPerpetualHeal) && !tech.isEnergyHealth
},
requires: "negative feedback or extra healing tech or harm reduction, not mass-energy",
effect() {
@@ -1536,7 +1536,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.maxHealth > 1;
return m.maxHealth > 1;
},
requires: "health above 100",
effect() {
@@ -1557,12 +1557,12 @@ const tech = {
requires: "not mass-energy equivalence",
effect() {
tech.bonusHealth += 0.5
mech.addHealth(0.50)
mech.setMaxHealth();
m.addHealth(0.50)
m.setMaxHealth();
},
remove() {
tech.bonusHealth = 0
mech.setMaxHealth();
m.setMaxHealth();
}
},
@@ -1581,7 +1581,7 @@ const tech = {
remove() {
tech.isArmorFromPowerUps = false;
// tech.armorFromPowerUps = 0; //this is now reset in tech.setupAllTech();
mech.setMaxHealth();
m.setMaxHealth();
}
},
{
@@ -1606,7 +1606,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.maxHealth > 1 || tech.isArmorFromPowerUps
return m.maxHealth > 1 || tech.isArmorFromPowerUps
},
requires: "increased max health",
effect() {
@@ -1622,7 +1622,7 @@ const tech = {
maxCount: 3,
count: 0,
allowed() {
return (mech.health < 0.7 || build.isExperimentSelection) && !tech.isEnergyHealth
return (m.health < 0.7 || build.isExperimentSelection) && !tech.isEnergyHealth
},
requires: "not mass-energy equivalence",
effect() {
@@ -1685,7 +1685,7 @@ const tech = {
requires: "at least 2 research",
effect() {
tech.isImmortal = true;
for (let i = 0; i < 4; i++) powerUps.spawn(mech.pos.x + Math.random() * 10, mech.pos.y + Math.random() * 10, "research", false);
for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x + Math.random() * 10, m.pos.y + Math.random() * 10, "research", false);
},
remove() {
tech.isImmortal = false;
@@ -1814,10 +1814,10 @@ const tech = {
const choose = have[Math.floor(Math.random() * have.length)]
simulation.makeTextLog(`<span class='color-var'>tech</span>.remove("<span class='color-text'>${tech.tech[choose].name}</span>")`)
for (let i = 0; i < tech.tech[choose].count; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
powerUps.spawn(m.pos.x, m.pos.y, "gun");
}
powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
powerUps.spawn(m.pos.x, m.pos.y, "gun");
powerUps.spawn(m.pos.x, m.pos.y, "gun");
tech.tech[choose].count = 0;
tech.tech[choose].remove(); // remove a random tech form the list of tech you have
tech.tech[choose].isLost = true
@@ -1844,9 +1844,9 @@ const tech = {
const choose = have[Math.floor(Math.random() * have.length)]
simulation.makeTextLog(`<span class='color-var'>tech</span>.remove("<span class='color-text'>${tech.tech[choose].name}</span>")`)
for (let i = 0; i < tech.tech[choose].count; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
powerUps.spawn(m.pos.x, m.pos.y, "tech");
}
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
powerUps.spawn(m.pos.x, m.pos.y, "tech");
tech.tech[choose].count = 0;
tech.tech[choose].remove(); // remove a random tech form the list of tech you have
tech.tech[choose].isLost = true
@@ -1867,11 +1867,11 @@ const tech = {
requires: "at least 1 tech and 1 research, a chance to duplicate power ups",
effect: () => {
powerUps.research.changeRerolls(-2)
simulation.makeTextLog(`<span class='color-var'>mech</span>.<span class='color-r'>research</span> <span class='color-symbol'>-=</span> 2
simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-r'>research</span> <span class='color-symbol'>-=</span> 2
<br>${powerUps.research.count}`)
const chanceStore = tech.duplicateChance
tech.duplicateChance = (tech.isBayesian ? 0.2 : 0) + tech.cancelCount * 0.04 + mech.duplicateChance + tech.duplicateChance * 2 //increase duplication chance to simulate doubling all 3 sources of duplication chance
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
tech.duplicateChance = (tech.isBayesian ? 0.2 : 0) + tech.cancelCount * 0.04 + m.duplicateChance + tech.duplicateChance * 2 //increase duplication chance to simulate doubling all 3 sources of duplication chance
powerUps.spawn(m.pos.x, m.pos.y, "tech");
tech.duplicateChance = chanceStore
},
remove() {}
@@ -1887,7 +1887,7 @@ const tech = {
requires: "some power up duplication",
effect() {
tech.isMineDrop = true;
if (tech.isMineDrop) b.mine(mech.pos, { x: 0, y: 0 }, 0, tech.isMineAmmoBack)
if (tech.isMineDrop) b.mine(m.pos, { x: 0, y: 0 }, 0, tech.isMineAmmoBack)
},
remove() {
tech.isMineDrop = false;
@@ -1922,7 +1922,7 @@ const tech = {
effect: () => {
tech.isDeterminism = true;
for (let i = 0; i < 5; i++) { //if you change the six also change it in Born rule
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
powerUps.spawn(m.pos.x, m.pos.y, "tech");
}
},
remove() {
@@ -1942,7 +1942,7 @@ const tech = {
effect: () => {
tech.isSuperDeterminism = true;
for (let i = 0; i < 7; i++) { //if you change the six also change it in Born rule
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
powerUps.spawn(m.pos.x, m.pos.y, "tech");
}
},
remove() {
@@ -1998,9 +1998,9 @@ const tech = {
tech.isGunSwitchField = true;
for (let i = tech.tech.length - 1; i > 0; i--) {
if (tech.tech[i].name === "unified field theory") {
const index = (mech.fieldMode === mech.fieldUpgrades.length - 1) ? 1 : mech.fieldMode + 1
const index = (m.fieldMode === m.fieldUpgrades.length - 1) ? 1 : m.fieldMode + 1
tech.tech[i].description = `after switching <strong>guns</strong><br>use a <strong class='color-r'>research</strong> to cycle your <strong class='color-f'>field</strong>
<br>(next <strong class='color-f'>field</strong>: ${mech.fieldUpgrades[index].name})`
<br>(next <strong class='color-f'>field</strong>: ${m.fieldUpgrades[index].name})`
break
}
}
@@ -2043,7 +2043,7 @@ const tech = {
effect() {
tech.isBanish = true
for (let i = 0; i < 4; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "research", false);
powerUps.spawn(m.pos.x, m.pos.y, "research", false);
}
},
remove() {
@@ -2092,9 +2092,9 @@ const tech = {
tech.setupAllTech(); // remove all tech
tech.addLoreTechToPool();
for (let i = 0; i < count; i++) { // spawn new tech power ups
powerUps.spawn(mech.pos.x, mech.pos.y, "tech");
powerUps.spawn(m.pos.x, m.pos.y, "tech");
}
//have state is checked in mech.death()
//have state is checked in m.death()
},
remove() {}
},
@@ -2125,7 +2125,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return (tech.totalBots() > 5 || mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || mech.fieldUpgrades[mech.fieldMode].name === "plasma torch" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave") && !tech.isEnergyHealth && !tech.isRewindAvoidDeath //build.isExperimentSelection ||
return (tech.totalBots() > 5 || m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" || m.fieldUpgrades[m.fieldMode].name === "plasma torch" || m.fieldUpgrades[m.fieldMode].name === "pilot wave") && !tech.isEnergyHealth && !tech.isRewindAvoidDeath //build.isExperimentSelection ||
},
requires: "bots > 5, plasma torch, nano-scale, pilot wave, not mass-energy equivalence, CPT",
effect() {
@@ -2167,7 +2167,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return ((mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField)) || tech.haveGunCheck("drones") || tech.haveGunCheck("super balls") || tech.haveGunCheck("shotgun")) && !tech.isNailShot
return ((m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField)) || tech.haveGunCheck("drones") || tech.haveGunCheck("super balls") || tech.haveGunCheck("shotgun")) && !tech.isNailShot
},
requires: "drones, super balls, shotgun",
effect() {
@@ -2235,7 +2235,7 @@ const tech = {
maxCount: 3,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.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
},
requires: "drones, spores, missiles, foam<br>wave beam, neutron bomb",
effect() {
@@ -2982,7 +2982,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return tech.haveGunCheck("drones") || (mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField))
return tech.haveGunCheck("drones") || (m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField))
},
requires: "drones",
effect() {
@@ -2999,7 +2999,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return !tech.isArmorFromPowerUps && (tech.haveGunCheck("drones") || (mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField)))
return !tech.isArmorFromPowerUps && (tech.haveGunCheck("drones") || (m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isIceField)))
},
requires: "drones",
effect() {
@@ -3377,11 +3377,11 @@ const tech = {
maxCount: 9,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "standing wave harmonics"
return m.fieldUpgrades[m.fieldMode].name === "standing wave harmonics"
},
requires: "standing wave harmonics",
effect() {
tech.blockDmg += 0.75 //if you change this value also update the for loop in the electricity graphics in mech.pushMass
tech.blockDmg += 0.75 //if you change this value also update the for loop in the electricity graphics in m.pushMass
},
remove() {
tech.blockDmg = 0;
@@ -3394,16 +3394,16 @@ const tech = {
maxCount: 9,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "standing wave harmonics"
return m.fieldUpgrades[m.fieldMode].name === "standing wave harmonics"
},
requires: "standing wave harmonics",
effect() {
mech.fieldRange += 175 * 0.2
mech.fieldShieldingScale *= 0.55
m.fieldRange += 175 * 0.2
m.fieldShieldingScale *= 0.55
},
remove() {
mech.fieldRange = 175;
mech.fieldShieldingScale = 1;
m.fieldRange = 175;
m.fieldShieldingScale = 1;
}
},
{
@@ -3413,7 +3413,7 @@ const tech = {
maxCount: 9,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "perfect diamagnetism"
return m.fieldUpgrades[m.fieldMode].name === "perfect diamagnetism"
},
requires: "perfect diamagnetism",
effect() {
@@ -3430,7 +3430,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "perfect diamagnetism"
return m.fieldUpgrades[m.fieldMode].name === "perfect diamagnetism"
},
requires: "perfect diamagnetism",
effect() {
@@ -3464,12 +3464,12 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave"
return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" || m.fieldUpgrades[m.fieldMode].name === "pilot wave"
},
requires: "nano-scale manufacturing",
effect: () => {
tech.isMassEnergy = true // used in mech.grabPowerUp
mech.energy += 3
tech.isMassEnergy = true // used in m.grabPowerUp
m.energy += 3
},
remove() {
tech.isMassEnergy = false;
@@ -3484,11 +3484,11 @@ const tech = {
isNonRefundable: true,
isCustomHide: true,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing"
return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing"
},
requires: "nano-scale manufacturing",
effect: () => {
mech.energy = 0.01;
m.energy = 0.01;
b.randomBot()
b.randomBot()
b.randomBot()
@@ -3504,11 +3504,11 @@ const tech = {
isNonRefundable: true,
isCustomHide: true,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(tech.isNailBotUpgrade && tech.isFoamBotUpgrade && tech.isBoomBotUpgrade && tech.isLaserBotUpgrade && tech.isOrbitBotUpgrade)
return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isNailBotUpgrade && tech.isFoamBotUpgrade && tech.isBoomBotUpgrade && tech.isLaserBotUpgrade && tech.isOrbitBotUpgrade)
},
requires: "nano-scale manufacturing",
effect: () => {
mech.energy = 0.01;
m.energy = 0.01;
//fill array of available bots
const notUpgradedBots = []
if (!tech.isNailBotUpgrade) notUpgradedBots.push(() => {
@@ -3563,7 +3563,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.maxEnergy > 0.99 && mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(tech.isMissileField || tech.isIceField || tech.isFastDrones || tech.isDroneGrab)
return m.maxEnergy > 0.99 && m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isMissileField || tech.isIceField || tech.isFastDrones || tech.isDroneGrab)
},
requires: "nano-scale manufacturing",
effect() {
@@ -3580,7 +3580,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.maxEnergy > 0.5 && mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isIceField || tech.isFastDrones || tech.isDroneGrab)
return m.maxEnergy > 0.5 && m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isIceField || tech.isFastDrones || tech.isDroneGrab)
},
requires: "nano-scale manufacturing",
effect() {
@@ -3597,7 +3597,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isFastDrones || tech.isDroneGrab)
return m.fieldUpgrades[m.fieldMode].name === "nano-scale manufacturing" && !(tech.isSporeField || tech.isMissileField || tech.isFastDrones || tech.isDroneGrab)
},
requires: "nano-scale manufacturing",
effect() {
@@ -3631,7 +3631,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "negative mass field"
return m.fieldUpgrades[m.fieldMode].name === "negative mass field"
},
requires: "negative mass field",
effect() {
@@ -3648,7 +3648,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "negative mass field" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave"
return m.fieldUpgrades[m.fieldMode].name === "negative mass field" || m.fieldUpgrades[m.fieldMode].name === "pilot wave"
},
requires: "negative mass field",
effect() {
@@ -3665,7 +3665,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "pilot wave" || mech.fieldUpgrades[mech.fieldMode].name === "negative mass field" || mech.fieldUpgrades[mech.fieldMode].name === "time dilation field"
return m.fieldUpgrades[m.fieldMode].name === "pilot wave" || m.fieldUpgrades[m.fieldMode].name === "negative mass field" || m.fieldUpgrades[m.fieldMode].name === "time dilation field"
},
requires: "pilot wave, negative mass field, time dilation field",
effect() {
@@ -3682,7 +3682,7 @@ const tech = {
// maxCount: 1,
// count: 0,
// allowed() {
// return mech.fieldUpgrades[mech.fieldMode].name === "plasma torch" && !tech.isEnergyHealth
// return m.fieldUpgrades[m.fieldMode].name === "plasma torch" && !tech.isEnergyHealth
// },
// requires: "plasma torch, not mass-energy equivalence",
// effect() {
@@ -3699,7 +3699,7 @@ const tech = {
maxCount: 9,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "plasma torch"
return m.fieldUpgrades[m.fieldMode].name === "plasma torch"
},
requires: "plasma torch",
effect() {
@@ -3716,7 +3716,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "plasma torch"
return m.fieldUpgrades[m.fieldMode].name === "plasma torch"
},
requires: "plasma torch",
effect() {
@@ -3734,7 +3734,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "plasma torch"
return m.fieldUpgrades[m.fieldMode].name === "plasma torch"
},
requires: "plasma torch",
effect() {
@@ -3751,7 +3751,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "time dilation field"
return m.fieldUpgrades[m.fieldMode].name === "time dilation field"
},
requires: "time dilation field",
effect() {
@@ -3770,19 +3770,19 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "time dilation field" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave"
return m.fieldUpgrades[m.fieldMode].name === "time dilation field" || m.fieldUpgrades[m.fieldMode].name === "pilot wave"
},
requires: "time dilation field",
effect() {
tech.fastTime = 1.40;
tech.fastTimeJump = 1.11;
mech.setMovement();
m.setMovement();
b.setFireCD();
},
remove() {
tech.fastTime = 1;
tech.fastTimeJump = 1;
mech.setMovement();
m.setMovement();
b.setFireCD();
}
},
@@ -3793,16 +3793,16 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return (mech.fieldUpgrades[mech.fieldMode].name === "time dilation field" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave") && tech.energyRegen !== 0;
return (m.fieldUpgrades[m.fieldMode].name === "time dilation field" || m.fieldUpgrades[m.fieldMode].name === "pilot wave") && tech.energyRegen !== 0;
},
requires: "time dilation field",
effect: () => {
tech.energyRegen = 0.004;
mech.fieldRegen = tech.energyRegen;
m.fieldRegen = tech.energyRegen;
},
remove() {
tech.energyRegen = 0.001;
mech.fieldRegen = tech.energyRegen;
m.fieldRegen = tech.energyRegen;
}
},
{
@@ -3812,7 +3812,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "metamaterial cloaking"
return m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking"
},
requires: "metamaterial cloaking",
effect() {
@@ -3829,7 +3829,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "metamaterial cloaking"
return m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking"
},
requires: "metamaterial cloaking",
effect() {
@@ -3846,7 +3846,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "metamaterial cloaking" || mech.fieldUpgrades[mech.fieldMode].name === "pilot wave"
return m.fieldUpgrades[m.fieldMode].name === "metamaterial cloaking" || m.fieldUpgrades[m.fieldMode].name === "pilot wave"
},
requires: "metamaterial cloaking",
effect() {
@@ -3865,7 +3865,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "wormhole"
return m.fieldUpgrades[m.fieldMode].name === "wormhole"
},
requires: "wormhole",
effect() {
@@ -3882,7 +3882,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "wormhole"
return m.fieldUpgrades[m.fieldMode].name === "wormhole"
},
requires: "wormhole",
effect() {
@@ -3899,7 +3899,7 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "wormhole"
return m.fieldUpgrades[m.fieldMode].name === "wormhole"
},
requires: "wormhole",
effect() {
@@ -3916,13 +3916,13 @@ const tech = {
maxCount: 1,
count: 0,
allowed() {
return mech.fieldUpgrades[mech.fieldMode].name === "wormhole"
return m.fieldUpgrades[m.fieldMode].name === "wormhole"
},
requires: "wormhole",
effect() {
tech.isWormBullets = true
powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
powerUps.spawn(mech.pos.x, mech.pos.y, "ammo");
powerUps.spawn(m.pos.x, m.pos.y, "gun");
powerUps.spawn(m.pos.x, m.pos.y, "ammo");
},
remove() {
tech.isWormBullets = false
@@ -3945,7 +3945,7 @@ const tech = {
requires: "",
effect() {
for (let i = 0; i < 6; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "heal");
powerUps.spawn(m.pos.x, m.pos.y, "heal");
}
this.count--
},
@@ -3964,7 +3964,7 @@ const tech = {
requires: "not exciton lattice",
effect() {
for (let i = 0; i < 6; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "ammo");
powerUps.spawn(m.pos.x, m.pos.y, "ammo");
}
this.count--
},
@@ -3983,7 +3983,7 @@ const tech = {
requires: "not superdeterminism",
effect() {
for (let i = 0; i < 4; i++) {
powerUps.spawn(mech.pos.x, mech.pos.y, "research");
powerUps.spawn(m.pos.x, m.pos.y, "research");
}
this.count--
},
@@ -4001,7 +4001,7 @@ const tech = {
},
requires: "not superdeterminism",
effect() {
powerUps.spawn(mech.pos.x, mech.pos.y, "gun");
powerUps.spawn(m.pos.x, m.pos.y, "gun");
this.count--
},
remove() {}
@@ -4018,7 +4018,7 @@ const tech = {
},
requires: "not superdeterminism",
effect() {
powerUps.spawn(mech.pos.x, mech.pos.y, "field");
powerUps.spawn(m.pos.x, m.pos.y, "field");
this.count--
},
remove() {}