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

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -53,16 +53,16 @@
<audio id="launcher" src="sounds\guns\launcher2.ogg" preload="auto"></audio> --> <audio id="launcher" src="sounds\guns\launcher2.ogg" preload="auto"></audio> -->
<!-- player walk --> <!-- player walk -->
<!-- <audio id="walk1" src="sounds\mech\walk1.ogg" preload="auto"></audio> <!-- <audio id="walk1" src="sounds\m\walk1.ogg" preload="auto"></audio>
<audio id="walk2" src="sounds\mech\walk2.ogg" preload="auto"></audio> <audio id="walk2" src="sounds\m\walk2.ogg" preload="auto"></audio>
<audio id="walk3" src="sounds\mech\walk3.ogg" preload="auto"></audio> <audio id="walk3" src="sounds\m\walk3.ogg" preload="auto"></audio>
<audio id="walk4" src="sounds\mech\walk4.ogg" preload="auto"></audio> <audio id="walk4" src="sounds\m\walk4.ogg" preload="auto"></audio>
<audio id="walk5" src="sounds\mech\walk5.ogg" preload="auto"></audio> <audio id="walk5" src="sounds\m\walk5.ogg" preload="auto"></audio>
<audio id="walk6" src="sounds\mech\walk6.ogg" preload="auto"></audio> <audio id="walk6" src="sounds\m\walk6.ogg" preload="auto"></audio>
<audio id="walk7" src="sounds\mech\walk7.ogg" preload="auto"></audio> <audio id="walk7" src="sounds\m\walk7.ogg" preload="auto"></audio>
<audio id="walk8" src="sounds\mech\walk8.ogg" preload="auto"></audio> <audio id="walk8" src="sounds\m\walk8.ogg" preload="auto"></audio>
<audio id="walk9" src="sounds\mech\walk9.ogg" preload="auto"></audio> <audio id="walk9" src="sounds\m\walk9.ogg" preload="auto"></audio>
<audio id="walk10" src="sounds\mech\walk10.ogg" preload="auto"></audio> --> <audio id="walk10" src="sounds\m\walk10.ogg" preload="auto"></audio> -->
<!-- player dmg --> <!-- player dmg -->
<!-- <audio id="dmg0" src="sounds\dmg\dmg0.ogg" preload="auto"></audio> <!-- <audio id="dmg0" src="sounds\dmg\dmg0.ogg" preload="auto"></audio>

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) { function playerOnGroundCheck(event) {
//runs on collisions events //runs on collisions events
function enter() { function enter() {
mech.numTouching++; m.numTouching++;
if (!mech.onGround) { if (!m.onGround) {
mech.onGround = true; m.onGround = true;
if (mech.crouch) { if (m.crouch) {
if (mech.checkHeadClear()) { if (m.checkHeadClear()) {
mech.undoCrouch(); m.undoCrouch();
} else { } else {
mech.yOffGoal = mech.yOffWhen.crouch; m.yOffGoal = m.yOffWhen.crouch;
} }
} else { } else {
//sets a hard land where player stays in a crouch for a bit and can't jump //sets a hard land where player stays in a crouch for a bit and can't jump
//crouch is forced in groundControl below //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 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) { if (momentum > 130) {
mech.doCrouch(); m.doCrouch();
mech.yOff = mech.yOffWhen.jump; m.yOff = m.yOffWhen.jump;
mech.hardLandCD = mech.cycle + Math.min(momentum / 6.5 - 6, 40) m.hardLandCD = m.cycle + Math.min(momentum / 6.5 - 6, 40)
} else { } 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) { for (let i = 0, j = pairs.length; i != j; ++i) {
let pair = pairs[i]; let pair = pairs[i];
if (pair.bodyA === jumpSensor) { if (pair.bodyA === jumpSensor) {
mech.standingOn = pair.bodyB; //keeping track to correctly provide recoil on jump m.standingOn = pair.bodyB; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter(); if (m.standingOn.alive !== true) enter();
} else if (pair.bodyB === jumpSensor) { } else if (pair.bodyB === jumpSensor) {
mech.standingOn = pair.bodyA; //keeping track to correctly provide recoil on jump m.standingOn = pair.bodyA; //keeping track to correctly provide recoil on jump
if (mech.standingOn.alive !== true) enter(); if (m.standingOn.alive !== true) enter();
} }
} }
mech.numTouching = 0; m.numTouching = 0;
} }
function playerOffGroundCheck(event) { function playerOffGroundCheck(event) {
@@ -66,14 +66,14 @@ function playerOffGroundCheck(event) {
const pairs = event.pairs; const pairs = event.pairs;
for (let i = 0, j = pairs.length; i != j; ++i) { for (let i = 0, j = pairs.length; i != j; ++i) {
if (pairs[i].bodyA === jumpSensor || pairs[i].bodyB === jumpSensor) { if (pairs[i].bodyA === jumpSensor || pairs[i].bodyB === jumpSensor) {
if (mech.onGround && mech.numTouching === 0) { if (m.onGround && m.numTouching === 0) {
mech.onGround = false; m.onGround = false;
mech.hardLandCD = 0 // disable hard landing m.hardLandCD = 0 // disable hard landing
if (mech.checkHeadClear()) { if (m.checkHeadClear()) {
if (mech.crouch) { if (m.crouch) {
mech.undoCrouch(); 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++) { for (let i = 0, j = pairs.length; i != j; i++) {
//mob + (player,bullet,body) collisions //mob + (player,bullet,body) collisions
for (let k = 0; k < mob.length; k++) { 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]) { if (pairs[i].bodyA === mob[k]) {
collideMob(pairs[i].bodyB); collideMob(pairs[i].bodyB);
break; break;
@@ -97,21 +97,21 @@ function collisionChecks(event) {
function collideMob(obj) { function collideMob(obj) {
//player + mob collision //player + mob collision
if ( if (
mech.immuneCycle < mech.cycle && m.immuneCycle < m.cycle &&
(obj === playerBody || obj === playerHead) && (obj === playerBody || obj === playerHead) &&
!(tech.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned)) !(tech.isFreezeHarmImmune && (mob[k].isSlowed || mob[k].isStunned))
) { ) {
mob[k].foundPlayer(); 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 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 if (tech.isRewindAvoidDeath && m.energy > 0.66) { //CPT reversal runs in m.damage, but it stops the rest of the collision code here too
mech.damage(dmg); m.damage(dmg);
return return
} }
mech.damage(dmg); m.damage(dmg);
if (tech.isPiezo) mech.energy += 4; if (tech.isPiezo) m.energy += 4;
if (tech.isBayesian) powerUps.ejectTech() if (tech.isBayesian) powerUps.ejectTech()
if (mob[k].onHit) mob[k].onHit(k); 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... //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); let angle = Math.atan2(player.position.y - mob[k].position.y, player.position.x - mob[k].position.x);
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
@@ -123,9 +123,9 @@ function collisionChecks(event) {
y: mob[k].velocity.y - 8 * Math.sin(angle) 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) { if (tech.isAnnihilation && !mob[k].shield && !mob[k].isShielded && mob[k].dropPowerUp && m.energy > 0.34 * m.maxEnergy) {
mech.energy -= 0.33 * mech.maxEnergy m.energy -= 0.33 * m.maxEnergy
mech.immuneCycle = 0; //player doesn't go immune to collision damage m.immuneCycle = 0; //player doesn't go immune to collision damage
mob[k].death(); mob[k].death();
simulation.drawList.push({ //add dmg to draw queue simulation.drawList.push({ //add dmg to draw queue
x: pairs[i].activeContacts[0].vertex.x, x: pairs[i].activeContacts[0].vertex.x,
@@ -171,7 +171,7 @@ function collisionChecks(event) {
mob[k].damage(dmg, true); mob[k].damage(dmg, true);
const stunTime = dmg / Math.sqrt(obj.mass) const stunTime = dmg / Math.sqrt(obj.mass)
if (stunTime > 0.5) mobs.statusStun(mob[k], 30 + 60 * Math.sqrt(stunTime)) 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) { if (tech.fragments && obj.speed > 10 && !obj.hasFragmented) {
obj.hasFragmented = true; obj.hasFragmented = true;
b.targetedNail(obj.position, tech.fragments * 4) b.targetedNail(obj.position, tech.fragments * 4)

View File

@@ -69,8 +69,8 @@ window.addEventListener('load', (event) => {
if (property === "field") { if (property === "field") {
let found = false let found = false
let index let index
for (let i = 0; i < mech.fieldUpgrades.length; i++) { for (let i = 0; i < m.fieldUpgrades.length; i++) {
if (set[property] === mech.fieldUpgrades[i].name) { if (set[property] === m.fieldUpgrades[i].name) {
index = i; index = i;
found = true; found = true;
break; break;
@@ -156,7 +156,7 @@ const build = {
set[property] = set[property].replace(/%20/g, " ") set[property] = set[property].replace(/%20/g, " ")
if (property.substring(0, 3) === "gun") b.giveGuns(set[property]) if (property.substring(0, 3) === "gun") b.giveGuns(set[property])
if (property.substring(0, 3) === "tech") tech.giveTech(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") { if (property === "difficulty") {
simulation.difficultyMode = Number(set[property]) simulation.difficultyMode = Number(set[property])
document.getElementById("difficulty-select").value = Number(set[property]) document.getElementById("difficulty-select").value = Number(set[property])
@@ -177,7 +177,7 @@ const build = {
} }
}, },
pauseGrid() { pauseGrid() {
const harm = (1 - mech.harmReduction()) * 100 const harm = (1 - m.harmReduction()) * 100
let text = "" let text = ""
if (!simulation.isChoosing) text += `<div class="pause-grid-module"> 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>` <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><strong class='color-dup'>duplication</strong> chance: ${(Math.min(1,tech.duplicationChance())*100).toFixed(0)}%
<br> <br>
<br><strong class='color-m'>tech</strong>: ${tech.totalCount} &nbsp; <strong class='color-r'>research</strong>: ${powerUps.research.count} <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>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>mouse: (${simulation.mouseInGame.x.toFixed(1)}, ${simulation.mouseInGame.y.toFixed(1)}) &nbsp; mass: ${player.mass.toFixed(1)}
<br> <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>${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>damage difficulty scale: ${(b.dmgScale*100).toFixed(2) }%
<br>harm difficulty scale: ${(simulation.dmgScale*100).toFixed(0)}% <br>harm difficulty scale: ${(simulation.dmgScale*100).toFixed(0)}%
@@ -212,7 +212,7 @@ const build = {
el.style.display = "grid" el.style.display = "grid"
el.innerHTML = text el.innerHTML = text
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 let countTech = 0
for (let i = 0, len = tech.tech.length; i < len; i++) { for (let i = 0, len = tech.tech.length; i < len; i++) {
if (tech.tech[i].count > 0) { if (tech.tech[i].count > 0) {
@@ -276,9 +276,9 @@ const build = {
b.giveGuns(index) b.giveGuns(index)
} }
} else if (type === "field") { } else if (type === "field") {
if (mech.fieldMode !== index) { if (m.fieldMode !== index) {
document.getElementById("field-" + mech.fieldMode).classList.remove("build-field-selected"); document.getElementById("field-" + m.fieldMode).classList.remove("build-field-selected");
mech.setField(index) m.setField(index)
who.classList.add("build-field-selected"); who.classList.add("build-field-selected");
} }
} else if (type === "tech") { //remove tech if you have too many } 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;"> <input type="checkbox" id="no-power-ups" name="no-power-ups" style="width:17px; height:17px;">
</div> </div>
</div>` </div>`
for (let i = 0, len = mech.fieldUpgrades.length; i < len; i++) { 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; ${mech.fieldUpgrades[i].name}</div> ${mech.fieldUpgrades[i].description}</div>` 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++) { 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>` 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() { reset() {
build.isExperimentSelection = true; build.isExperimentSelection = true;
mech.setField(0) m.setField(0)
b.inventory = []; //removes guns and ammo b.inventory = []; //removes guns and ammo
for (let i = 0, len = b.guns.length; i < len; ++i) { for (let i = 0, len = b.guns.length; i < len; ++i) {
@@ -432,7 +432,7 @@ const build = {
count++ count++
} }
} }
url += `&field=${encodeURIComponent(mech.fieldUpgrades[mech.fieldMode].name.trim())}` url += `&field=${encodeURIComponent(m.fieldUpgrades[m.fieldMode].name.trim())}`
url += `&difficulty=${simulation.difficultyMode}` url += `&difficulty=${simulation.difficultyMode}`
if (isCustom) { if (isCustom) {
url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}` url += `&level=${Math.abs(Number(document.getElementById("starting-level").value))}`
@@ -501,7 +501,7 @@ document.getElementById("experiment-button").addEventListener("click", () => { /
let inventory = []; let inventory = [];
let techList = []; let techList = [];
if (!simulation.firstRun) { if (!simulation.firstRun) {
field = mech.fieldMode field = m.fieldMode
inventory = [...b.inventory] inventory = [...b.inventory]
for (let i = 0; i < tech.tech.length; i++) { for (let i = 0; i < tech.tech.length; i++) {
techList.push(tech.tech[i].count) techList.push(tech.tech[i].count)
@@ -710,7 +710,7 @@ window.addEventListener("keydown", function(event) {
simulation.previousGun(); simulation.previousGun();
break break
case input.key.pause: case input.key.pause:
if (!simulation.isChoosing && input.isPauseKeyReady && mech.alive) { if (!simulation.isChoosing && input.isPauseKeyReady && m.alive) {
input.isPauseKeyReady = false input.isPauseKeyReady = false
setTimeout(function() { setTimeout(function() {
input.isPauseKeyReady = true input.isPauseKeyReady = true
@@ -729,7 +729,7 @@ window.addEventListener("keydown", function(event) {
} }
break break
case input.key.testing: case input.key.testing:
if (mech.alive && localSettings.loreCount > 0) { if (m.alive && localSettings.loreCount > 0) {
if (simulation.testing) { if (simulation.testing) {
simulation.testing = false; simulation.testing = false;
simulation.loop = simulation.normalLoop simulation.loop = simulation.normalLoop
@@ -791,7 +791,7 @@ window.addEventListener("keydown", function(event) {
break break
} }
if (simulation.testing) { if (simulation.testing) {
if (event.key === "X") mech.death(); //only uppercase if (event.key === "X") m.death(); //only uppercase
switch (event.key.toLowerCase()) { switch (event.key.toLowerCase()) {
case "o": case "o":
simulation.isAutoZoom = false; simulation.isAutoZoom = false;
@@ -837,21 +837,21 @@ window.addEventListener("keydown", function(event) {
spawn.randomLevelBoss(simulation.mouseInGame.x, simulation.mouseInGame.y); spawn.randomLevelBoss(simulation.mouseInGame.x, simulation.mouseInGame.y);
break break
case "f": case "f":
const mode = (mech.fieldMode === mech.fieldUpgrades.length - 1) ? 0 : mech.fieldMode + 1 const mode = (m.fieldMode === m.fieldUpgrades.length - 1) ? 0 : m.fieldMode + 1
mech.setField(mode) m.setField(mode)
break break
case "g": case "g":
b.giveGuns("all", 1000) b.giveGuns("all", 1000)
break break
case "h": case "h":
mech.addHealth(Infinity) m.addHealth(Infinity)
mech.energy = mech.maxEnergy; m.energy = m.maxEnergy;
break break
case "y": case "y":
tech.giveTech() tech.giveTech()
break break
case "r": case "r":
mech.resetHistory(); m.resetHistory();
Matter.Body.setPosition(player, simulation.mouseInGame); Matter.Body.setPosition(player, simulation.mouseInGame);
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: 0, 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.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 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) { if (simulation.clearNow) {
simulation.clearNow = false; simulation.clearNow = false;
simulation.clearMap(); simulation.clearMap();
@@ -1076,8 +1076,8 @@ function cycle() {
} }
simulation.loop(); simulation.loop();
// if (isNaN(mech.health) || isNaN(mech.energy)) { // if (isNaN(m.health) || isNaN(m.energy)) {
// console.log(`mech.health = ${mech.health}`) // console.log(`m.health = ${m.health}`)
// simulation.paused = true; // simulation.paused = true;
// build.pauseGrid() // build.pauseGrid()
// document.body.style.cursor = "auto"; // document.body.style.cursor = "auto";

View File

@@ -16,7 +16,7 @@ const level = {
// level.difficultyIncrease(30) // level.difficultyIncrease(30)
// simulation.zoomScale = 1000; // simulation.zoomScale = 1000;
// simulation.setZoom(); // simulation.setZoom();
// mech.setField("plasma torch") // m.setField("plasma torch")
// b.giveGuns("grenades") // b.giveGuns("grenades")
// tech.isExplodeRadio = true // tech.isExplodeRadio = true
// tech.giveTech("needle gun") // tech.giveTech("needle gun")
@@ -74,26 +74,26 @@ const level = {
level.addToWorld(); //add bodies to game engine level.addToWorld(); //add bodies to game engine
simulation.draw.setPaths(); simulation.draw.setPaths();
b.respawnBots(); b.respawnBots();
mech.resetHistory(); m.resetHistory();
if (tech.isArmorFromPowerUps) { if (tech.isArmorFromPowerUps) {
tech.armorFromPowerUps += Math.min(0.03 * powerUps.totalPowerUps, 0.42) tech.armorFromPowerUps += Math.min(0.03 * powerUps.totalPowerUps, 0.42)
mech.setMaxHealth(); m.setMaxHealth();
} }
if (tech.isHealLowHealth) { 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++) { 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.spawn(m.pos.x + 60 * (Math.random() - 0.5), m.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.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) { 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(m.pos.x + 60 * (Math.random() - 0.5), m.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);
} }
if (tech.isPerpetualHeal) { 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(m.pos.x + 60 * (Math.random() - 0.5), m.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);
} }
if (tech.isPerpetualStun) { if (tech.isPerpetualStun) {
for (let i = 0; i < mob.length; i++) mobs.statusStun(mob[i], 600) for (let i = 0; i < mob.length; i++) mobs.statusStun(mob[i], 600)
@@ -162,9 +162,9 @@ const level = {
ctx.beginPath(); ctx.beginPath();
const step = Math.PI / 20 const step = Math.PI / 20
const horizontalStep = 85 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) // 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) sway.y = 2.5 * Math.sin(simulation.cycle * 0.015)
for (let i = -19.5; i < 20; i++) { for (let i = -19.5; i < 20; i++) {
const where = { const where = {
@@ -740,7 +740,7 @@ const level = {
const door = level.door(312, -750, 25, 190, 185) const door = level.door(312, -750, 25, 190, 185)
level.custom = () => { 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) let touching = Matter.Query.collides(map[removeIndex1], body)
if (touching.length) { if (touching.length) {
// console.log(touching[0].bodyB) // console.log(touching[0].bodyB)
@@ -1112,7 +1112,7 @@ const level = {
level.playerExitCheck(); level.playerExitCheck();
}; };
level.customTopLayer = () => { 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 if (elevator.pointA.y > -1275) { //bottom
elevator.plat.speed = -10 elevator.plat.speed = -10
elevator.pauseUntilCycle = simulation.cycle + 90 elevator.pauseUntilCycle = simulation.cycle + 90
@@ -1321,7 +1321,7 @@ const level = {
}; };
level.customTopLayer = () => { 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 if (elevator.pointA.y > -980) { //bottom
elevator.plat.speed = -2 elevator.plat.speed = -2
elevator.pauseUntilCycle = simulation.cycle + 60 elevator.pauseUntilCycle = simulation.cycle + 60
@@ -2796,7 +2796,7 @@ const level = {
portal[3].draw(); portal[3].draw();
hazard.draw(); hazard.draw();
//elevator //elevator
if (elevator.pauseUntilCycle < simulation.cycle && !mech.isBodiesAsleep) { if (elevator.pauseUntilCycle < simulation.cycle && !m.isBodiesAsleep) {
if (elevator.plat.position.y > -200) { //bottom if (elevator.plat.position.y > -200) { //bottom
elevator.plat.speed = -20 elevator.plat.speed = -20
elevator.pauseUntilCycle = simulation.cycle + 90 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 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.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() difficultyDecrease(num = 1) { //used in easy mode for simulation.reset()
for (let i = 0; i < num; i++) { 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.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>input.key.right = ["<span class='color-text'>${input.key.right}</span>", "<span class='color-text'>ArrowRight</span>"]
// <br> // <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>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); // `, 1200);
}, },
nextLevel() { nextLevel() {
@@ -4009,18 +4009,18 @@ const level = {
} }
}, },
setPosToSpawn(xPos, yPos) { setPosToSpawn(xPos, yPos) {
mech.spawnPos.x = mech.pos.x = xPos; m.spawnPos.x = m.pos.x = xPos;
mech.spawnPos.y = mech.pos.y = yPos; m.spawnPos.y = m.pos.y = yPos;
level.enter.x = mech.spawnPos.x - 50; level.enter.x = m.spawnPos.x - 50;
level.enter.y = mech.spawnPos.y + 20; level.enter.y = m.spawnPos.y + 20;
mech.transX = mech.transSmoothX = canvas.width2 - mech.pos.x; m.transX = m.transSmoothX = canvas.width2 - m.pos.x;
mech.transY = mech.transSmoothY = canvas.height2 - mech.pos.y; m.transY = m.transSmoothY = canvas.height2 - m.pos.y;
mech.Vx = mech.spawnVel.x; m.Vx = m.spawnVel.x;
mech.Vy = mech.spawnVel.y; m.Vy = m.spawnVel.y;
player.force.x = 0; player.force.x = 0;
player.force.y = 0; player.force.y = 0;
Matter.Body.setPosition(player, mech.spawnPos); Matter.Body.setPosition(player, m.spawnPos);
Matter.Body.setVelocity(player, mech.spawnVel); Matter.Body.setVelocity(player, m.spawnVel);
}, },
enter: { enter: {
x: 0, x: 0,
@@ -4115,8 +4115,8 @@ const level = {
target.torque = (Math.random() - 0.5) * 2 * target.mass; target.torque = (Math.random() - 0.5) * 2 * target.mass;
}, },
boost(target, yVelocity) { boost(target, yVelocity) {
mech.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts m.buttonCD_jump = 0; // reset short jump counter to prevent short jumps on boosts
mech.hardLandCD = 0 // disable hard landing m.hardLandCD = 0 // disable hard landing
if (target.velocity.y > 30) { if (target.velocity.y > 30) {
Matter.Body.setVelocity(target, { Matter.Body.setVelocity(target, {
x: target.velocity.x + (Math.random() - 0.5) * 2, 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 addToWorld() { //needs to be run to put bodies into the world
for (let i = 0; i < body.length; i++) { for (let i = 0; i < body.length; i++) {
//body[i].collisionFilter.group = 0; //body[i].collisionFilter.group = 0;
if (body[i] !== mech.holdingTarget) { if (body[i] !== m.holdingTarget) {
body[i].collisionFilter.category = cat.body; body[i].collisionFilter.category = cat.body;
body[i].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet body[i].collisionFilter.mask = cat.player | cat.map | cat.body | cat.bullet | cat.mob | cat.mobBullet
} }
@@ -4270,7 +4270,7 @@ const level = {
if (rotate) { if (rotate) {
rotor.rotate = function() { rotor.rotate = function() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
Matter.Body.applyForce(rotor, { Matter.Body.applyForce(rotor, {
x: rotor.position.x + 100, x: rotor.position.x + 100,
y: rotor.position.y + 100 y: rotor.position.y + 100
@@ -4364,7 +4364,7 @@ const level = {
restitution: 0, restitution: 0,
isOpen: false, isOpen: false,
openClose() { openClose() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
if (!this.isOpen) { if (!this.isOpen) {
if (this.position.y > y - distance) { //try to open if (this.position.y > y - distance) { //try to open
const position = { const position = {
@@ -4432,8 +4432,8 @@ const level = {
if (Matter.Query.collides(this, [player]).length === 0) { //not touching player if (Matter.Query.collides(this, [player]).length === 0) { //not touching player
if (player.isInPortal === this) player.isInPortal = null if (player.isInPortal === this) player.isInPortal = null
} else if (player.isInPortal !== this) { //touching player } 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 if (m.buttonCD_jump === m.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 m.buttonCD_jump = 0 //disable short jumps when letting go of jump key
player.isInPortal = this.portalPair player.isInPortal = this.portalPair
//teleport //teleport
if (this.portalPair.angle % (Math.PI / 2)) { //if left, right up or down if (this.portalPair.angle % (Math.PI / 2)) { //if left, right up or down
@@ -4467,7 +4467,7 @@ const level = {
} }
// if (body.length) { // if (body.length) {
for (let i = 0, len = body.length; i < len; i++) { 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 // 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 (Matter.Query.collides(this, [body[i]]).length === 0) {
if (body[i].isInPortal === this) body[i].isInPortal = null if (body[i].isInPortal === this) body[i].isInPortal = null
@@ -4502,7 +4502,7 @@ const level = {
// if (body.length) { // if (body.length) {
// touching = Matter.Query.collides(this, body) // touching = Matter.Query.collides(this, body)
// for (let i = 0; i < touching.length; i++) { // 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++) { // for (let j = 0, len = body.length; j < len; j++) {
// if (body[j] === touching[i].bodyB) { // if (body[j] === touching[i].bodyB) {
// body.splice(j, 1); // 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) { // if (body.length) {
// for (let i = 0; i < body.length; i++) { // for (let i = 0; i < body.length; i++) {
// if (body[i] === touching[0].bodyB) { // if (body[i] === touching[0].bodyB) {
@@ -4591,12 +4591,12 @@ const level = {
maxHeight: height, maxHeight: height,
isOn: true, isOn: true,
query() { 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) { if (damage < 0.02) {
mech.damage(damage) m.damage(damage)
} else if (mech.immuneCycle < mech.cycle) { } else if (m.immuneCycle < m.cycle) {
mech.immuneCycle = mech.cycle + tech.collisionImmuneCycles; m.immuneCycle = m.cycle + tech.collisionImmuneCycles;
mech.damage(damage) m.damage(damage)
simulation.drawList.push({ //add dmg to draw queue simulation.drawList.push({ //add dmg to draw queue
x: player.position.x, x: player.position.x,
y: player.position.y, y: player.position.y,
@@ -4606,7 +4606,7 @@ const level = {
}); });
} }
const drain = 0.005 const drain = 0.005
if (mech.energy > drain) mech.energy -= drain if (m.energy > drain) m.energy -= drain
} }
}, },
draw() { draw() {
@@ -4623,7 +4623,7 @@ const level = {
} }
}, },
level(isFill) { level(isFill) {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
const growSpeed = 1 const growSpeed = 1
if (isFill) { if (isFill) {
if (this.height < this.maxHeight) { if (this.height < this.maxHeight) {

View File

@@ -61,7 +61,7 @@ const mobs = {
} }
function applySlow() { 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) if (who.isBoss) cycles = Math.floor(cycles * 0.25)
let i = who.status.length let i = who.status.length
@@ -99,7 +99,7 @@ const mobs = {
} }
}, },
statusStun(who, cycles = 180) { statusStun(who, cycles = 180) {
if (!who.shield && !who.isShielded && !mech.isBodiesAsleep) { if (!who.shield && !who.isShielded && !m.isBodiesAsleep) {
Matter.Body.setVelocity(who, { Matter.Body.setVelocity(who, {
x: who.velocity.x * 0.8, x: who.velocity.x * 0.8,
y: who.velocity.y * 0.8 y: who.velocity.y * 0.8
@@ -150,7 +150,7 @@ const mobs = {
} }
}, },
statusDoT(who, tickDamage, cycles = 180) { statusDoT(who, tickDamage, cycles = 180) {
if (!who.isShielded && !mech.isBodiesAsleep && who.alive) { if (!who.isShielded && !m.isBodiesAsleep && who.alive) {
who.status.push({ who.status.push({
effect() { effect() {
if ((simulation.cycle - this.startCycle) % 30 === 0) { if ((simulation.cycle - this.startCycle) % 30 === 0) {
@@ -300,7 +300,7 @@ const mobs = {
} }
}, },
alwaysSeePlayer() { alwaysSeePlayer() {
if (!mech.isCloak) { if (!m.isCloak) {
this.seePlayer.recall = true; this.seePlayer.recall = true;
this.seePlayer.position.x = player.position.x; this.seePlayer.position.x = player.position.x;
this.seePlayer.position.y = player.position.y; this.seePlayer.position.y = player.position.y;
@@ -310,9 +310,9 @@ const mobs = {
if (!(simulation.cycle % this.seePlayerFreq)) { if (!(simulation.cycle % this.seePlayerFreq)) {
if ( if (
this.distanceToPlayer2() < this.seeAtDistance2 && this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mPosRange()).length === 0 &&
!mech.isCloak !m.isCloak
) { ) {
this.foundPlayer(); this.foundPlayer();
} else if (this.seePlayer.recall) { } else if (this.seePlayer.recall) {
@@ -322,7 +322,7 @@ const mobs = {
}, },
seePlayerCheckByDistance() { seePlayerCheckByDistance() {
if (!(simulation.cycle % this.seePlayerFreq)) { if (!(simulation.cycle % this.seePlayerFreq)) {
if (this.distanceToPlayer2() < this.seeAtDistance2 && !mech.isCloak) { if (this.distanceToPlayer2() < this.seeAtDistance2 && !m.isCloak) {
this.foundPlayer(); this.foundPlayer();
} else if (this.seePlayer.recall) { } else if (this.seePlayer.recall) {
this.lostPlayer(); this.lostPlayer();
@@ -332,8 +332,8 @@ const mobs = {
seePlayerByDistOrLOS() { seePlayerByDistOrLOS() {
if (!(simulation.cycle % this.seePlayerFreq)) { if (!(simulation.cycle % this.seePlayerFreq)) {
if ( 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)) && (this.distanceToPlayer2() < this.seeAtDistance2 || (Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mPosRange()).length === 0)) &&
!mech.isCloak !m.isCloak
) { ) {
this.foundPlayer(); this.foundPlayer();
} else if (this.seePlayer.recall) { } else if (this.seePlayer.recall) {
@@ -363,9 +363,9 @@ const mobs = {
if (!(simulation.cycle % this.seePlayerFreq) && (this.seePlayer.recall || this.isLookingAtPlayer(this.lookRange))) { if (!(simulation.cycle % this.seePlayerFreq) && (this.seePlayer.recall || this.isLookingAtPlayer(this.lookRange))) {
if ( if (
this.distanceToPlayer2() < this.seeAtDistance2 && this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mPosRange()).length === 0 &&
!mech.isCloak !m.isCloak
) { ) {
this.foundPlayer(); this.foundPlayer();
} else if (this.seePlayer.recall) { } else if (this.seePlayer.recall) {
@@ -384,7 +384,7 @@ const mobs = {
ctx.fill(); ctx.fill();
} }
}, },
mechPosRange() { mPosRange() {
return { return {
x: player.position.x, // + (Math.random() - 0.5) * 50, x: player.position.x, // + (Math.random() - 0.5) * 50,
y: player.position.y + (Math.random() - 0.5) * 110 y: player.position.y + (Math.random() - 0.5) * 110
@@ -414,18 +414,18 @@ const mobs = {
ctx.setLineDash([125 * Math.random(), 125 * Math.random()]); ctx.setLineDash([125 * Math.random(), 125 * Math.random()]);
// ctx.lineDashOffset = 6*(simulation.cycle % 215); // ctx.lineDashOffset = 6*(simulation.cycle % 215);
if (this.distanceToPlayer() < this.laserRange) { if (this.distanceToPlayer() < this.laserRange) {
if (mech.immuneCycle < mech.cycle) mech.damage(0.0003 * simulation.dmgScale); if (m.immuneCycle < m.cycle) m.damage(0.0003 * simulation.dmgScale);
if (mech.energy > 0.1) mech.energy -= 0.003 if (m.energy > 0.1) m.energy -= 0.003
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); 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.lineTo(mech.pos.x + (Math.random() - 0.5) * 3000, mech.pos.y + (Math.random() - 0.5) * 3000); ctx.lineTo(m.pos.x + (Math.random() - 0.5) * 3000, m.pos.y + (Math.random() - 0.5) * 3000);
ctx.lineWidth = 2; ctx.lineWidth = 2;
ctx.strokeStyle = "rgb(255,0,170)"; ctx.strokeStyle = "rgb(255,0,170)";
ctx.stroke(); ctx.stroke();
ctx.beginPath(); 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.fillStyle = "rgba(255,0,170,0.15)";
ctx.fill(); ctx.fill();
@@ -499,12 +499,12 @@ const mobs = {
}; };
vertexCollision(this.position, look, map); vertexCollision(this.position, look, map);
vertexCollision(this.position, look, body); vertexCollision(this.position, look, body);
if (!mech.isCloak) vertexCollision(this.position, look, [player]); if (!m.isCloak) vertexCollision(this.position, look, [player]);
// hitting player // hitting player
if (best.who === player) { if (best.who === player) {
if (mech.immuneCycle < mech.cycle) { if (m.immuneCycle < m.cycle) {
const dmg = 0.0012 * simulation.dmgScale; const dmg = 0.0012 * simulation.dmgScale;
mech.damage(dmg); m.damage(dmg);
//draw damage //draw damage
ctx.fillStyle = "#f00"; ctx.fillStyle = "#f00";
ctx.beginPath(); ctx.beginPath();
@@ -540,7 +540,7 @@ const mobs = {
this.distanceToPlayer2() < this.seeAtDistance2 && this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, player.position).length === 0 && Matter.Query.ray(map, this.position, player.position).length === 0 &&
Matter.Query.ray(body, this.position, player.position).length === 0 && Matter.Query.ray(body, this.position, player.position).length === 0 &&
!mech.isCloak !m.isCloak
) { ) {
this.foundPlayer(); this.foundPlayer();
} else if (this.seePlayer.recall) { } else if (this.seePlayer.recall) {
@@ -687,17 +687,17 @@ const mobs = {
pullPlayer() { pullPlayer() {
if (this.seePlayer.yes && Vector.magnitudeSquared(Vector.sub(this.position, player.position)) < 1000000) { 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); 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); player.force.y -= simulation.accelScale * 0.00084 * player.mass * Math.sin(angle);
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); 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.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)"; ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke(); ctx.stroke();
ctx.beginPath(); 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.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill(); ctx.fill();
} }
@@ -769,7 +769,7 @@ const mobs = {
// } // }
}, },
grow() { grow() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
if (this.seePlayer.recall) { if (this.seePlayer.recall) {
if (this.radius < 80) { if (this.radius < 80) {
const scale = 1.01; const scale = 1.01;
@@ -843,7 +843,7 @@ const mobs = {
drift() { drift() {
//teleport towards player as a way to move //teleport towards player as a way to move
if (this.seePlayer.recall && !(simulation.cycle % this.blinkRate)) { if (this.seePlayer.recall && !(simulation.cycle % this.blinkRate)) {
// && !mech.lookingAtMob(this,0.5)){ // && !m.lookingAtMob(this,0.5)){
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); ctx.moveTo(this.position.x, this.position.y);
const dist = Vector.sub(this.seePlayer.position, this.position); const dist = Vector.sub(this.seePlayer.position, this.position);
@@ -871,8 +871,8 @@ const mobs = {
if ( if (
!(simulation.cycle % this.fireFreq) && !(simulation.cycle % this.fireFreq) &&
Math.abs(this.position.x - this.seePlayer.position.x) < 400 && //above player 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(map, this.position, this.mPosRange()).length === 0 && //see player
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 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); spawn.bomb(this.position.x, this.position.y + this.radius * 0.5, 10 + Math.ceil(this.radius / 15), 5);
//add spin and speed //add spin and speed
@@ -886,7 +886,7 @@ const mobs = {
} }
}, },
fire() { fire() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
const setNoseShape = () => { const setNoseShape = () => {
const mag = this.radius + this.radius * this.noseLength; const mag = this.radius + this.radius * this.noseLength;
this.vertices[1].x = this.position.x + Math.cos(this.angle) * mag; 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); Matter.Body.setAngle(this, angle - Math.PI);
}, },
explode(mass = this.mass) { explode(mass = this.mass) {
if (mech.immuneCycle < mech.cycle) { if (m.immuneCycle < m.cycle) {
mech.damage(Math.min(Math.max(0.02 * Math.sqrt(mass), 0.01), 0.35) * simulation.dmgScale); m.damage(Math.min(Math.max(0.02 * Math.sqrt(mass), 0.01), 0.35) * simulation.dmgScale);
this.dropPowerUp = false; this.dropPowerUp = false;
this.death(); //death with no power up or body this.death(); //death with no power up or body
} }
}, },
timeLimit() { timeLimit() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
this.timeLeft--; this.timeLeft--;
if (this.timeLeft < 0) { if (this.timeLeft < 0) {
this.dropPowerUp = false; this.dropPowerUp = false;
@@ -1005,11 +1005,11 @@ const mobs = {
if (this.shield) dmg *= 0.075 if (this.shield) dmg *= 0.075
//energy and heal drain should be calculated after damage boosts //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) { if (tech.healthDrain && dmg !== Infinity && this.dropPowerUp) {
mech.addHealth(Math.min(this.health, dmg) * tech.healthDrain) m.addHealth(Math.min(this.health, dmg) * tech.healthDrain)
if (mech.health > mech.maxHealth) mech.health = mech.maxHealth if (m.health > m.maxHealth) m.health = m.maxHealth
} }
dmg /= Math.sqrt(this.mass) dmg /= Math.sqrt(this.mass)
this.health -= dmg this.health -= dmg
@@ -1033,9 +1033,9 @@ const mobs = {
this.removeConsBB(); this.removeConsBB();
this.alive = false; //triggers mob removal in mob[i].replace(i) this.alive = false; //triggers mob removal in mob[i].replace(i)
if (this.dropPowerUp) { 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); 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) { if (Math.random() < tech.sporesOnDeath) {
const len = Math.min(25, Math.floor(2 + this.mass * (0.5 + 0.5 * Math.random()))) const len = Math.min(25, Math.floor(2 + this.mass * (0.5 + 0.5 * Math.random())))
for (let i = 0; i < len; i++) { 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>"]` <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); simulation.makeTextLog(text);
} else if (type === "field") { } else if (type === "field") {
mech.setField(index) m.setField(index)
simulation.makeTextLog(`<span class='color-var'>mech</span>.setField("<span class='color-text'>${mech.fieldUpgrades[mech.fieldMode].name}</span>")`); simulation.makeTextLog(`<span class='color-var'>m</span>.setField("<span class='color-text'>${m.fieldUpgrades[m.fieldMode].name}</span>")`);
} else if (type === "tech") { } else if (type === "tech") {
tech.giveTech(index) tech.giveTech(index)
simulation.makeTextLog(`<span class='color-var'>tech</span>.giveTech("<span class='color-text'>${tech.tech[index].name}</span>")`); 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 (isCanceled) {
if (tech.isCancelDuplication) tech.cancelCount++ if (tech.isCancelDuplication) tech.cancelCount++
if (tech.isCancelRerolls) { 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) { if (Math.random() < 0.33) {
spawnType = "heal" spawnType = "heal"
} else if (Math.random() < 0.5 && !tech.isSuperDeterminism) { } else if (Math.random() < 0.5 && !tech.isSuperDeterminism) {
spawnType = "research" 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 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 const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2
@@ -57,7 +57,7 @@ const powerUps = {
} }
} }
if (tech.manyWorlds && powerUps.research.count === 0) { 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-grid").style.display = "none"
document.getElementById("choose-background").style.display = "none" document.getElementById("choose-background").style.display = "none"
@@ -65,7 +65,7 @@ const powerUps = {
document.body.style.overflow = "hidden" document.body.style.overflow = "hidden"
simulation.paused = false; simulation.paused = false;
simulation.isChoosing = false; //stops p from un pausing on key down 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() build.unPauseGrid()
requestAnimationFrame(cycle); requestAnimationFrame(cycle);
}, },
@@ -95,8 +95,8 @@ const powerUps = {
if (tech.renormalization) { if (tech.renormalization) {
for (let i = 0; i < limit; i++) { for (let i = 0; i < limit; i++) {
if (Math.random() < 0.37) { if (Math.random() < 0.37) {
mech.fieldCDcycle = mech.cycle + 30; m.fieldCDcycle = m.cycle + 30;
powerUps.spawn(mech.pos.x, mech.pos.y, "research"); powerUps.spawn(m.pos.x, m.pos.y, "research");
} }
} }
} }
@@ -105,7 +105,7 @@ const powerUps = {
if (tech.isDeathAvoid && document.getElementById("tech-anthropic")) { if (tech.isDeathAvoid && document.getElementById("tech-anthropic")) {
document.getElementById("tech-anthropic").innerHTML = `-${powerUps.research.count}` 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 (tech.isRerollHaste) {
if (powerUps.research.count === 0) { if (powerUps.research.count === 0) {
tech.researchHaste = 0.66; 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 use(type) { //runs when you actually research a list of selections, type can be field, gun, or tech
powerUps.research.changeRerolls(-1) 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}`) // <br>${powerUps.research.count}`)
if (tech.isBanish && type === 'tech') { // banish researched tech if (tech.isBanish && type === 'tech') { // banish researched tech
const banishLength = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2 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 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() { effect() {
if (!tech.isEnergyHealth && mech.alive) { 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 mech.addHealth() 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) { if (heal > 0) {
const healOutput = Math.min(mech.maxHealth - mech.health, heal) * simulation.healScale const healOutput = Math.min(m.maxHealth - m.health, heal) * simulation.healScale
mech.addHealth(heal); m.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(`<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(mech.maxHealth - mech.health, heal) * simulation.healScale * 100).toFixed(0) + "%</span>", 300) // 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) { if (tech.healGiveMaxEnergy) {
tech.healMaxEnergyBonus += 0.04 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 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) { function pick(who, skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
let options = []; let options = [];
for (let i = 1; i < who.length; i++) { 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 //remove repeats from last selection
const totalChoices = tech.isDeterminism ? 1 : 3 + tech.isExtraChoice * 2 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 choice2 = -1
let choice3 = -1 let choice3 = -1
if (choice1 > -1) { if (choice1 > -1) {
let text = "" let text = ""
if (!tech.isDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("field",true)'>✕</div>` 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 += `<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) { if (!tech.isDeterminism) {
choice2 = pick(mech.fieldUpgrades, choice1) 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; ${mech.fieldUpgrades[choice2].name}</div> ${mech.fieldUpgrades[choice2].description}</div>` 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(mech.fieldUpgrades, choice1, choice2) 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; ${mech.fieldUpgrades[choice3].name}</div> ${mech.fieldUpgrades[choice3].description}</div>` 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) { if (tech.isExtraChoice) {
let choice4 = pick(mech.fieldUpgrades, choice1, choice2, choice3) 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; ${mech.fieldUpgrades[choice4].name}</div> ${mech.fieldUpgrades[choice4].description}</div>` 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(mech.fieldUpgrades, choice1, choice2, choice3, choice4) 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; ${mech.fieldUpgrades[choice5].name}</div> ${mech.fieldUpgrades[choice5].description}</div>` 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(choice4)
powerUps.field.choiceLog.push(choice5) 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 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 banishLog: [], //records all tech permanently removed from the selection pool
effect() { effect() {
if (mech.alive) { if (m.alive) {
function pick(skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) { function pick(skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
let options = []; let options = [];
for (let i = 0; i < tech.tech.length; i++) { 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(`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)}`) 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"); powerUps.endDraft("tech");
} else { } else {
powerUps.giveRandomAmmo() powerUps.giveRandomAmmo()
@@ -465,8 +465,8 @@ const powerUps = {
} }
}, },
onPickUp(who) { onPickUp(who) {
if (tech.isTechDamage && who.name === "tech") mech.damage(0.11) if (tech.isTechDamage && who.name === "tech") m.damage(0.11)
if (tech.isMassEnergy) mech.energy += 2.5; if (tech.isMassEnergy) m.energy += 2.5;
if (tech.isMineDrop) { if (tech.isMineDrop) {
if (tech.isLaserMine) { //laser mine if (tech.isLaserMine) { //laser mine
b.laserMine(who.position) 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 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"); powerUps.spawn(x, y, "heal");
return; return;
} }
@@ -512,7 +512,7 @@ const powerUps = {
}, },
randomPowerUpCounter: 0, randomPowerUpCounter: 0,
spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades spawnBossPowerUp(x, y) { //boss spawns field and gun tech upgrades
if (mech.fieldMode === 0) { if (m.fieldMode === 0) {
powerUps.spawn(x, y, "field") powerUps.spawn(x, y, "field")
} else { } else {
powerUps.randomPowerUpCounter++; powerUps.randomPowerUpCounter++;
@@ -530,7 +530,7 @@ const powerUps = {
powerUps.spawn(x, y, "gun") powerUps.spawn(x, y, "gun")
} }
} else { } 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");
powerUps.spawn(x, y, "heal"); powerUps.spawn(x, y, "heal");
} else { } else {
@@ -560,7 +560,7 @@ const powerUps = {
//bonus power ups for clearing runs in the last game //bonus power ups for clearing runs in the last game
if (level.levelsCleared === 0 && !simulation.isCheating) { if (level.levelsCleared === 0 && !simulation.isCheating) {
for (let i = 0; i < localSettings.levelsClearedLastGame / 4 - 1; i++) { 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 localSettings.levelsClearedLastGame = 0 //after getting bonus power ups reset run history
localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage 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>")`) 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++) { 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 powerUp[powerUp.length - 1].isBonus = true
} }
// remove a random tech from the list of tech you have // 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].count = 0;
tech.tech[choose].isLost = true; tech.tech[choose].isLost = true;
simulation.updateTechHUD(); 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 { } 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(`<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>")`) 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++) { 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 powerUp[powerUp.length - 1].isBonus = true
} }
// remove a random tech from the list of tech you have // 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].count = 0;
tech.tech[choose].isLost = true; tech.tech[choose].isLost = true;
simulation.updateTechHUD(); 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()) { 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); Engine.update(engine, simulation.delta);
simulation.wipe(); simulation.wipe();
simulation.textLog(); simulation.textLog();
if (mech.onGround) { if (m.onGround) {
mech.groundControl() m.groundControl()
} else { } else {
mech.airControl() m.airControl()
} }
// level.checkZones(); // level.checkZones();
level.checkQuery(); level.checkQuery();
mech.move(); m.move();
mech.look(); m.look();
simulation.checks(); simulation.checks();
ctx.save(); ctx.save();
simulation.camera(); simulation.camera();
@@ -29,8 +29,8 @@ const simulation = {
simulation.draw.body(); simulation.draw.body();
mobs.loop(); mobs.loop();
mobs.healthBar(); mobs.healthBar();
mech.draw(); m.draw();
mech.hold(); m.hold();
// v.draw(); //working on visibility work in progress // v.draw(); //working on visibility work in progress
level.drawFills(); level.drawFills();
level.customTopLayer(); level.customTopLayer();
@@ -50,20 +50,20 @@ const simulation = {
Engine.update(engine, simulation.delta); Engine.update(engine, simulation.delta);
simulation.wipe(); simulation.wipe();
simulation.textLog(); simulation.textLog();
if (mech.onGround) { if (m.onGround) {
mech.groundControl() m.groundControl()
} else { } else {
mech.airControl() m.airControl()
} }
// level.checkZones(); // level.checkZones();
level.custom(); level.custom();
level.checkQuery(); level.checkQuery();
mech.move(); m.move();
mech.look(); m.look();
simulation.checks(); simulation.checks();
ctx.save(); ctx.save();
simulation.camera(); simulation.camera();
mech.draw(); m.draw();
level.customTopLayer(); level.customTopLayer();
simulation.draw.wireFrame(); simulation.draw.wireFrame();
simulation.draw.cons(); simulation.draw.cons();
@@ -79,24 +79,24 @@ const simulation = {
simulation.isTimeSkipping = true; simulation.isTimeSkipping = true;
for (let i = 0; i < cycles; i++) { for (let i = 0; i < cycles; i++) {
simulation.cycle++; simulation.cycle++;
mech.cycle++; m.cycle++;
simulation.gravity(); simulation.gravity();
Engine.update(engine, simulation.delta); Engine.update(engine, simulation.delta);
if (mech.onGround) { if (m.onGround) {
mech.groundControl() m.groundControl()
} else { } else {
mech.airControl() m.airControl()
} }
level.checkZones(); level.checkZones();
level.checkQuery(); level.checkQuery();
mech.move(); m.move();
simulation.checks(); simulation.checks();
mobs.loop(); mobs.loop();
// mech.draw(); // m.draw();
mech.walk_cycle += mech.flipLegs * mech.Vx; m.walk_cycle += m.flipLegs * m.Vx;
mech.hold(); m.hold();
b.fire(); b.fire();
b.bulletRemove(); b.bulletRemove();
b.bulletDo(); 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>', // 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) { makeTextLog(text, time = 120) {
if (simulation.isTextLogOpen && !build.isExperimentSelection) { 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; document.getElementById("text-log").innerHTML = document.getElementById("text-log").innerHTML + '<br>' + text;
simulation.lastLogTime = mech.cycle + time; simulation.lastLogTime = m.cycle + time;
} else { } else {
document.getElementById("text-log").innerHTML = text; document.getElementById("text-log").innerHTML = text;
document.getElementById("text-log").style.opacity = 1; document.getElementById("text-log").style.opacity = 1;
simulation.lastLogTime = mech.cycle + time; simulation.lastLogTime = m.cycle + time;
} }
} }
}, },
textLog() { textLog() {
if (simulation.lastLogTime && simulation.lastLogTime < mech.cycle) { if (simulation.lastLogTime && simulation.lastLogTime < m.cycle) {
simulation.lastLogTime = 0; simulation.lastLogTime = 0;
// document.getElementById("text-log").innerHTML = " "; // document.getElementById("text-log").innerHTML = " ";
document.getElementById("text-log").style.opacity = 0; document.getElementById("text-log").style.opacity = 0;
@@ -362,19 +362,19 @@ const simulation = {
b.activeGun = b.inventory[b.inventoryGun]; b.activeGun = b.inventory[b.inventoryGun];
simulation.updateGunHUD(); simulation.updateGunHUD();
simulation.boldActiveGunHUD(); simulation.boldActiveGunHUD();
// mech.drop(); // m.drop();
if (true && powerUps.research.count > 0) { if (tech.isGunSwitchField && powerUps.research.count > 0) {
powerUps.research.changeRerolls(-1) powerUps.research.changeRerolls(-1)
const energy = mech.energy const energy = m.energy
mech.setField((mech.fieldMode === mech.fieldUpgrades.length - 1) ? 1 : mech.fieldMode + 1) //cycle to next field m.setField((m.fieldMode === m.fieldUpgrades.length - 1) ? 1 : m.fieldMode + 1) //cycle to next field
mech.energy = energy //field swap sets energy to max, this undoes that m.energy = energy //field swap sets energy to max, this undoes that
//update text to show next field //update text to show next field
for (let i = tech.tech.length - 1; i > 0; i--) { for (let i = tech.tech.length - 1; i > 0; i--) {
if (tech.tech[i].name === "unified field theory") { 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> 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 break
} }
} }
@@ -435,13 +435,13 @@ const simulation = {
}, },
noCameraScroll() { //makes the camera not scroll after changing locations noCameraScroll() { //makes the camera not scroll after changing locations
//only works if velocity is zero //only works if velocity is zero
mech.pos.x = player.position.x; m.pos.x = player.position.x;
mech.pos.y = playerBody.position.y - mech.yOff; m.pos.y = playerBody.position.y - m.yOff;
const scale = 0.8; const scale = 0.8;
mech.transSmoothX = canvas.width2 - mech.pos.x - (simulation.mouse.x - canvas.width2) * scale; m.transSmoothX = canvas.width2 - m.pos.x - (simulation.mouse.x - canvas.width2) * scale;
mech.transSmoothY = canvas.height2 - mech.pos.y - (simulation.mouse.y - canvas.height2) * scale; m.transSmoothY = canvas.height2 - m.pos.y - (simulation.mouse.y - canvas.height2) * scale;
mech.transX += (mech.transSmoothX - mech.transX) * 1; m.transX += (m.transSmoothX - m.transX) * 1;
mech.transY += (mech.transSmoothY - mech.transY) * 1; m.transY += (m.transSmoothY - m.transY) * 1;
}, },
edgeZoomOutSmooth: 1, edgeZoomOutSmooth: 1,
camera() { camera() {
@@ -455,10 +455,10 @@ const simulation = {
ctx.save(); ctx.save();
ctx.translate(canvas.width2, canvas.height2); //center ctx.translate(canvas.width2, canvas.height2); //center
ctx.scale(simulation.zoom / simulation.edgeZoomOutSmooth, simulation.zoom / simulation.edgeZoomOutSmooth); //zoom in once centered 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 //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.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 - mech.transY; simulation.mouseInGame.y = (simulation.mouse.y - canvas.height2) / simulation.zoom * simulation.edgeZoomOutSmooth + canvas.height2 - m.transY;
}, },
restoreCamera() { restoreCamera() {
ctx.restore(); ctx.restore();
@@ -510,7 +510,7 @@ const simulation = {
document.getElementById("splash").style.display = "none"; //hides the element that spawned the function document.getElementById("splash").style.display = "none"; //hides the element that spawned the function
document.getElementById("dmg").style.display = "inline"; document.getElementById("dmg").style.display = "inline";
document.getElementById("health-bg").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 level.levels = level.playableLevels.slice(0) //copy array, not by just by assignment
if (simulation.isCommunityMaps) { if (simulation.isCommunityMaps) {
@@ -546,15 +546,15 @@ const simulation = {
// simulation.updateTechHUD(); // simulation.updateTechHUD();
powerUps.totalPowerUps = 0; powerUps.totalPowerUps = 0;
powerUps.research.count = 0; powerUps.research.count = 0;
mech.setFillColors(); m.setFillColors();
// mech.maxHealth = 1 // m.maxHealth = 1
// mech.maxEnergy = 1 // m.maxEnergy = 1
// mech.energy = 1 // m.energy = 1
input.isPauseKeyReady = true input.isPauseKeyReady = true
simulation.wipe = function() { //set wipe to normal simulation.wipe = function() { //set wipe to normal
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);
} }
mech.hole.isOn = false m.hole.isOn = false
simulation.paused = false; simulation.paused = false;
engine.timing.timeScale = 1; engine.timing.timeScale = 1;
simulation.fpsCap = simulation.fpsCapDefault; simulation.fpsCap = simulation.fpsCapDefault;
@@ -579,25 +579,25 @@ const simulation = {
document.getElementById("fade-out").style.opacity = 0; document.getElementById("fade-out").style.opacity = 0;
document.title = "n-gon"; document.title = "n-gon";
mech.alive = true; m.alive = true;
mech.setMaxHealth() m.setMaxHealth()
mech.health = 0; m.health = 0;
mech.addHealth(0.25) m.addHealth(0.25)
mech.drop(); m.drop();
mech.holdingTarget = null m.holdingTarget = null
//set to default field //set to default field
mech.fieldMode = 0; m.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); // 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(` // simulation.makeTextLog(`
// input.key.up <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.up}</span>", "<span class='color-text'>ArrowUp</span>"] // 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.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.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>input.key.right <span class='color-symbol'>=</span> ["<span class='color-text'>${input.key.right}</span>", "<span class='color-text'>ArrowRight</span>"]
// <br> // <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>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); // `, 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>"]`); 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); }, delay += step);
setTimeout(function() { 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); }, delay += step);
setTimeout(function() { 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>"]`); 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); }, delay += step);
mech.setField(mech.fieldMode) m.setField(m.fieldMode)
// mech.energy = 0; // m.energy = 0;
//exit testing //exit testing
if (simulation.testing) { if (simulation.testing) {
simulation.testing = false; simulation.testing = false;
@@ -664,9 +664,9 @@ const simulation = {
if (tech.isMutualism && !tech.isEnergyHealth) { if (tech.isMutualism && !tech.isEnergyHealth) {
for (let i = 0; i < bullet.length; i++) { for (let i = 0; i < bullet.length; i++) {
if (bullet[i].isMutualismActive) { if (bullet[i].isMutualismActive) {
mech.health += 0.005 m.health += 0.005
if (mech.health > mech.maxHealth) mech.health = mech.maxHealth; if (m.health > m.maxHealth) m.health = m.maxHealth;
mech.displayHealth(); m.displayHealth();
} }
} }
} }
@@ -678,7 +678,7 @@ const simulation = {
} else if (powerUp[i].name === "gun") { } else if (powerUp[i].name === "gun") {
if (!tech.isOneGun) b.giveGuns("random") if (!tech.isOneGun) b.giveGuns("random")
} else if (powerUp[i].name === "field") { } 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 { } else {
powerUp[i].effect(); powerUp[i].effect();
} }
@@ -687,11 +687,11 @@ const simulation = {
powerUps.totalPowerUps = powerUp.length powerUps.totalPowerUps = powerUp.length
let holdTarget; //if player is holding something this remembers it before it gets deleted 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 m.fireCDcycle = 0
mech.drop(); m.drop();
mech.hole.isOn = false; m.hole.isOn = false;
level.fill = []; level.fill = [];
level.fillBG = []; level.fillBG = [];
level.zones = []; level.zones = [];
@@ -725,12 +725,12 @@ const simulation = {
frictionAir: holdTarget.frictionAir, frictionAir: holdTarget.frictionAir,
frictionStatic: holdTarget.frictionStatic frictionStatic: holdTarget.frictionStatic
}); });
Matter.Body.setPosition(body[len], mech.pos); Matter.Body.setPosition(body[len], m.pos);
mech.isHolding = true m.isHolding = true
mech.holdingTarget = body[len]; m.holdingTarget = body[len];
mech.holdingTarget.collisionFilter.category = 0; m.holdingTarget.collisionFilter.category = 0;
mech.holdingTarget.collisionFilter.mask = 0; m.holdingTarget.collisionFilter.mask = 0;
mech.definePlayerMass(mech.defaultMass + mech.holdingTarget.mass * mech.holdingMassScale) m.definePlayerMass(m.defaultMass + m.holdingTarget.mass * m.holdingMassScale)
} }
//set fps back to default //set fps back to default
simulation.fpsCap = simulation.fpsCapDefault simulation.fpsCap = simulation.fpsCapDefault
@@ -766,12 +766,12 @@ const simulation = {
// } // }
// }, // },
checks() { checks() {
if (!(mech.cycle % 60)) { //once a second if (!(m.cycle % 60)) { //once a second
//energy overfill //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, { Matter.Body.setVelocity(player, {
x: 0, x: 0,
y: 0 y: 0
@@ -793,12 +793,12 @@ const simulation = {
}); });
} }
} }
mech.damage(0.1 * simulation.difficultyMode); m.damage(0.1 * simulation.difficultyMode);
mech.energy -= 0.1 * simulation.difficultyMode m.energy -= 0.1 * simulation.difficultyMode
} }
// if (tech.isEnergyDamage) { // 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 (tech.restDamage) {
// if (player.speed < 1) { // 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 (m.lastKillCycle + 300 > m.cycle) { //effects active for 5 seconds after killing a mob
if (tech.isEnergyRecovery) mech.energy += mech.maxEnergy * 0.05 if (tech.isEnergyRecovery) m.energy += m.maxEnergy * 0.05
if (tech.isHealthRecovery) mech.addHealth(0.01 * mech.maxHealth) if (tech.isHealthRecovery) m.addHealth(0.01 * m.maxHealth)
} }
if (!(simulation.cycle % 420)) { //once every 7 seconds 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) { fallCheck = function(who, save = false) {
let i = who.length; let i = who.length;
@@ -845,13 +845,13 @@ const simulation = {
//check for double crouch //check for double crouch
//crouch playerHead.position.y - player.position.y = 9.7 //positive //crouch playerHead.position.y - player.position.y = 9.7 //positive
//standing playerHead.position.y - player.position.y = -30 //negative //standing playerHead.position.y - player.position.y = -30 //negative
// mech.undoCrouch() // m.undoCrouch()
// if (!mech.crouch && ((playerHead.position.y - player.position.y) > 0)) { // if (!m.crouch && ((playerHead.position.y - player.position.y) > 0)) {
// Matter.Body.translate(playerHead, { // Matter.Body.translate(playerHead, {
// x: 0, // x: 0,
// y: 40 // 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, { // Matter.Body.translate(playerHead, {
// x: 0, // x: 0,
// y: 40 // y: 40
@@ -867,7 +867,7 @@ const simulation = {
}, },
draw: { draw: {
powerUp() { //is set by Bayesian tech 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) { // for (let i = 0, len = powerUp.length; i < len; ++i) {
// ctx.beginPath(); // ctx.beginPath();
// ctx.arc(powerUp[i].position.x, powerUp[i].position.y, powerUp[i].size, 0, 2 * Math.PI); // 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; // ctx.globalAlpha = 1;
}, },
powerUpNormal() { //back up in case power up draw gets changed 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) { for (let i = 0, len = powerUp.length; i < len; ++i) {
ctx.beginPath(); ctx.beginPath();
ctx.arc(powerUp[i].position.x, powerUp[i].position.y, powerUp[i].size, 0, 2 * Math.PI); 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; ctx.globalAlpha = 1;
}, },
powerUpBonus() { //draws crackle effect for bonus power ups 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) { for (let i = 0, len = powerUp.length; i < len; ++i) {
ctx.beginPath(); ctx.beginPath();
ctx.arc(powerUp[i].position.x, powerUp[i].position.y, powerUp[i].size, 0, 2 * Math.PI); 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); // spawn.shield(me, x, y, 1);
me.onDeath = function() { me.onDeath = function() {
//add lore level as next level if player took lore tech earlier in the game //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") if (lore.techCount > 9 && !simulation.isCheating) {
level.levels.push("null")
level.exit.x = 5500; level.exit.x = 5500;
level.exit.y = -330; level.exit.y = -330;
simulation.makeTextLog(`level.levels.push("null")`) // <br>${powerUps.research.count}
}
//ramp up damage //ramp up damage
for (let i = 0; i < 3; i++) level.difficultyIncrease(simulation.difficultyMode) 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.modeDo(); //this does different things based on the mode
this.checkStatus(); this.checkStatus();
this.cycle++; //switch modes÷ this.cycle++; //switch modes÷
// if (!mech.isBodiesAsleep) { // if (!m.isBodiesAsleep) {
if (this.health > 0.25) { if (this.health > 0.25) {
if (this.cycle > this.endCycle) { if (this.cycle > this.endCycle) {
this.cycle = 0; this.cycle = 0;
@@ -222,7 +224,7 @@ const spawn = {
} }
me.spawnInterval = 395 me.spawnInterval = 395
me.modeSpawns = function() { 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) if (this.mode !== 3) Matter.Body.setAngularVelocity(this, 0.1)
//fire a bullet from each vertex //fire a bullet from each vertex
let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)]; let whoSpawn = spawn.fullPickList[Math.floor(Math.random() * spawn.fullPickList.length)];
@@ -273,22 +275,22 @@ const spawn = {
ctx.fill(); ctx.fill();
//when player is inside event horizon //when player is inside event horizon
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) { if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
if (mech.energy > 0) mech.energy -= 0.01 if (m.energy > 0) m.energy -= 0.01
if (mech.energy < 0.15) { if (m.energy < 0.15) {
mech.damage(0.0004 * simulation.dmgScale); m.damage(0.0004 * simulation.dmgScale);
} }
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); 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; player.force.y -= 0.0017 * Math.sin(angle) * player.mass;
//draw line to player //draw line to player
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); 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.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)"; ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke(); ctx.stroke();
ctx.beginPath(); 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.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill(); ctx.fill();
} }
@@ -297,7 +299,7 @@ const spawn = {
me.rotateVelocity = 0.0025 me.rotateVelocity = 0.0025
me.rotateCount = 0; me.rotateCount = 0;
me.modeLasers = function() { me.modeLasers = function() {
if (!mech.isBodiesAsleep && !this.isStunned) { if (!m.isBodiesAsleep && !this.isStunned) {
let slowed = false //check if slowed let slowed = false //check if slowed
for (let i = 0; i < this.status.length; i++) { for (let i = 0; i < this.status.length; i++) {
if (this.status[i].type === "slow") { if (this.status[i].type === "slow") {
@@ -401,10 +403,10 @@ const spawn = {
// vertexCollision(where, look, mob); // vertexCollision(where, look, mob);
vertexCollision(where, look, map); vertexCollision(where, look, map);
vertexCollision(where, look, body); vertexCollision(where, look, body);
if (!mech.isCloak) vertexCollision(where, look, [player]); if (!m.isCloak) vertexCollision(where, look, [player]);
if (best.who && best.who === player && mech.immuneCycle < mech.cycle) { if (best.who && best.who === player && m.immuneCycle < m.cycle) {
mech.immuneCycle = mech.cycle + 60 + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles m.immuneCycle = m.cycle + 60 + tech.collisionImmuneCycles; //player is immune to collision damage for 30 cycles
mech.damage(dmg); m.damage(dmg);
simulation.drawList.push({ //add dmg to draw queue simulation.drawList.push({ //add dmg to draw queue
x: best.x, x: best.x,
y: best.y, y: best.y,
@@ -519,7 +521,7 @@ const spawn = {
if (Math.random() < 0.33 * dmg * Math.sqrt(this.mass) && this.health > dmg) this.split(); if (Math.random() < 0.33 * dmg * Math.sqrt(this.mass) && this.health > dmg) this.split();
} }
me.do = function() { me.do = function() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
this.seePlayerByDistOrLOS(); this.seePlayerByDistOrLOS();
this.checkStatus(); this.checkStatus();
this.attraction(); this.attraction();
@@ -578,13 +580,13 @@ const spawn = {
powerUps.spawnBossPowerUp(me.position.x, me.position.y) 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, "heal");
powerUps.spawn(me.position.x, me.position.y, "ammo"); powerUps.spawn(me.position.x, me.position.y, "ammo");
} else if (!mech.isCloak) { } else if (!m.isCloak) {
me.foundPlayer(); me.foundPlayer();
} }
me.onHit = function() { //run this function on hitting player me.onHit = function() { //run this function on hitting player
powerUps.ejectTech() powerUps.ejectTech()
powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); powerUps.spawn(m.pos.x, m.pos.y, "heal");
powerUps.spawn(mech.pos.x, mech.pos.y, "heal"); powerUps.spawn(m.pos.x, m.pos.y, "heal");
}; };
me.onDeath = function() { me.onDeath = function() {
this.leaveBody = false; this.leaveBody = false;
@@ -814,7 +816,7 @@ const spawn = {
} }
// this.seePlayerCheckByDistance() // this.seePlayerCheckByDistance()
if (!(simulation.cycle % this.seePlayerFreq)) { 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(); this.locatePlayer();
if (!this.seePlayer.yes) this.seePlayer.yes = true; if (!this.seePlayer.yes) this.seePlayer.yes = true;
} else if (this.seePlayer.recall) { } else if (this.seePlayer.recall) {
@@ -848,22 +850,22 @@ const spawn = {
//when player is inside event horizon //when player is inside event horizon
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) { if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
if (mech.energy > 0) mech.energy -= 0.004 if (m.energy > 0) m.energy -= 0.004
if (mech.energy < 0.1) { if (m.energy < 0.1) {
mech.damage(0.00015 * simulation.dmgScale); m.damage(0.00015 * simulation.dmgScale);
} }
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); 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); player.force.y -= 0.0001 * player.mass * Math.sin(angle);
//draw line to player //draw line to player
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); 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.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)"; ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke(); ctx.stroke();
ctx.beginPath(); 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.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill(); ctx.fill();
} }
@@ -910,7 +912,7 @@ const spawn = {
}); });
} }
if (!(simulation.cycle % this.seePlayerFreq)) { 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(); this.locatePlayer();
if (!this.seePlayer.yes) this.seePlayer.yes = true; if (!this.seePlayer.yes) this.seePlayer.yes = true;
} else if (this.seePlayer.recall) { } else if (this.seePlayer.recall) {
@@ -954,22 +956,22 @@ const spawn = {
ctx.fill(); ctx.fill();
//when player is inside event horizon //when player is inside event horizon
if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) { if (Vector.magnitude(Vector.sub(this.position, player.position)) < eventHorizon) {
if (mech.energy > 0) mech.energy -= 0.006 if (m.energy > 0) m.energy -= 0.006
if (mech.energy < 0.1) { if (m.energy < 0.1) {
mech.damage(0.0002 * simulation.dmgScale); m.damage(0.0002 * simulation.dmgScale);
} }
const angle = Math.atan2(player.position.y - this.position.y, player.position.x - this.position.x); 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; player.force.y -= 0.0013 * Math.sin(angle) * player.mass;
//draw line to player //draw line to player
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); 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.lineWidth = Math.min(60, this.radius * 2);
ctx.strokeStyle = "rgba(0,0,0,0.5)"; ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.stroke(); ctx.stroke();
ctx.beginPath(); 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.fillStyle = "rgba(0,0,0,0.3)";
ctx.fill(); ctx.fill();
} }
@@ -1179,7 +1181,7 @@ const spawn = {
}; };
spawn.shield(me, x, y); spawn.shield(me, x, y);
me.do = function() { me.do = function() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
this.seePlayerByLookingAt(); this.seePlayerByLookingAt();
this.checkStatus(); this.checkStatus();
this.attraction(); this.attraction();
@@ -1189,7 +1191,7 @@ const spawn = {
const rangeWidth = 2000; //this is sqrt of 4000000 from above if() const rangeWidth = 2000; //this is sqrt of 4000000 from above if()
//targeting laser will slowly move from the mob to the player's position //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)); 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; const r = 12;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y); ctx.moveTo(this.position.x, this.position.y);
@@ -1341,12 +1343,12 @@ const spawn = {
}; };
vertexCollision(this.position, look, map); vertexCollision(this.position, look, map);
vertexCollision(this.position, look, body); vertexCollision(this.position, look, body);
if (!mech.isCloak) vertexCollision(this.position, look, [player]); if (!m.isCloak) vertexCollision(this.position, look, [player]);
// hitting player // hitting player
if (best.who === player) { if (best.who === player) {
if (mech.immuneCycle < mech.cycle) { if (m.immuneCycle < m.cycle) {
const dmg = 0.001 * simulation.dmgScale; const dmg = 0.001 * simulation.dmgScale;
mech.damage(dmg); m.damage(dmg);
//draw damage //draw damage
ctx.fillStyle = color; ctx.fillStyle = color;
ctx.beginPath(); ctx.beginPath();
@@ -1408,7 +1410,7 @@ const spawn = {
this.checkStatus(); this.checkStatus();
if (!this.isStunned) { if (!this.isStunned) {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
//check if slowed //check if slowed
let slowed = false let slowed = false
for (let i = 0; i < this.status.length; i++) { for (let i = 0; i < this.status.length; i++) {
@@ -1499,11 +1501,11 @@ const spawn = {
// vertexCollision(where, look, mob); // vertexCollision(where, look, mob);
vertexCollision(where, look, map); vertexCollision(where, look, map);
vertexCollision(where, look, body); vertexCollision(where, look, body);
if (!mech.isCloak) vertexCollision(where, look, [player]); if (!m.isCloak) vertexCollision(where, look, [player]);
if (best.who && best.who === player && mech.immuneCycle < mech.cycle) { if (best.who && best.who === player && m.immuneCycle < m.cycle) {
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
const dmg = 0.14 * simulation.dmgScale; const dmg = 0.14 * simulation.dmgScale;
mech.damage(dmg); m.damage(dmg);
simulation.drawList.push({ //add dmg to draw queue simulation.drawList.push({ //add dmg to draw queue
x: best.x, x: best.x,
y: best.y, y: best.y,
@@ -1544,7 +1546,7 @@ const spawn = {
} }
}; };
me.do = function() { me.do = function() {
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
// this.gravity(); // this.gravity();
this.seePlayerByLookingAt(); this.seePlayerByLookingAt();
this.checkStatus(); this.checkStatus();
@@ -1616,9 +1618,9 @@ const spawn = {
if (!(simulation.cycle % this.seePlayerFreq)) { // this.seePlayerCheck(); from mobs if (!(simulation.cycle % this.seePlayerFreq)) { // this.seePlayerCheck(); from mobs
if ( if (
this.distanceToPlayer2() < this.seeAtDistance2 && this.distanceToPlayer2() < this.seeAtDistance2 &&
Matter.Query.ray(map, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(map, this.position, this.mPosRange()).length === 0 &&
Matter.Query.ray(body, this.position, this.mechPosRange()).length === 0 && Matter.Query.ray(body, this.position, this.mPosRange()).length === 0 &&
!mech.isCloak !m.isCloak
) { ) {
this.foundPlayer(); this.foundPlayer();
if (this.cd === Infinity) this.cd = simulation.cycle + this.delay * 0.7; if (this.cd === Infinity) this.cd = simulation.cycle + this.delay * 0.7;
@@ -1674,7 +1676,7 @@ const spawn = {
this.checkStatus(); this.checkStatus();
this.attraction(); this.attraction();
//draw //draw
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
if (this.seePlayer.yes) { if (this.seePlayer.yes) {
if (this.alpha < 1) this.alpha += 0.01; if (this.alpha < 1) this.alpha += 0.01;
} else { } else {
@@ -2019,7 +2021,7 @@ const spawn = {
this.seePlayerCheck(); this.seePlayerCheck();
this.checkStatus(); this.checkStatus();
if (!mech.isBodiesAsleep) { if (!m.isBodiesAsleep) {
const setNoseShape = () => { const setNoseShape = () => {
const mag = this.radius + this.radius * this.noseLength; const mag = this.radius + this.radius * this.noseLength;
this.vertices[1].x = this.position.x + Math.cos(this.angle) * mag; this.vertices[1].x = this.position.x + Math.cos(this.angle) * mag;
@@ -2135,7 +2137,7 @@ const spawn = {
this.seePlayerCheck(); this.seePlayerCheck();
this.checkStatus(); this.checkStatus();
this.attraction(); 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) Matter.Body.setAngularVelocity(this, 0.14)
//fire a bullet from each vertex //fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) { for (let i = 0, len = this.vertices.length; i < len; i++) {
@@ -2173,7 +2175,7 @@ const spawn = {
this.checkStatus(); this.checkStatus();
this.attraction(); this.attraction();
this.repulsion(); 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) Matter.Body.setAngularVelocity(this, 0.11)
//fire a bullet from each vertex //fire a bullet from each vertex
for (let i = 0, len = this.vertices.length; i < len; i++) { for (let i = 0, len = this.vertices.length; i < len; i++) {
@@ -2218,7 +2220,7 @@ const spawn = {
this.repulsion(); this.repulsion();
this.cycle++ 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.canFire) {
if (this.cycle > 120) { if (this.cycle > 120) {
this.cycle = 0 this.cycle = 0
@@ -2701,7 +2703,7 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (mech.pos.x > breakingPoint) { if (m.pos.x > breakingPoint) {
this.freeOfWires = true; this.freeOfWires = true;
this.fill = "#000" this.fill = "#000"
this.force.x += -0.003; this.force.x += -0.003;
@@ -2716,9 +2718,9 @@ const spawn = {
}) })
//player friction from the wires //player friction from the wires
if (mech.pos.x > 700 && player.velocity.x > -2) { if (m.pos.x > 700 && player.velocity.x > -2) {
let wireFriction = 0.75 * Math.min(0.6, Math.max(0, 100 / (breakingPoint - mech.pos.x))); let wireFriction = 0.75 * Math.min(0.6, Math.max(0, 100 / (breakingPoint - m.pos.x)));
if (!mech.onGround) wireFriction *= 3 if (!m.onGround) wireFriction *= 3
Matter.Body.setVelocity(player, { Matter.Body.setVelocity(player, {
x: player.velocity.x - wireFriction, x: player.velocity.x - wireFriction,
y: player.velocity.y y: player.velocity.y
@@ -2726,15 +2728,15 @@ const spawn = {
} }
//move to player //move to player
Matter.Body.setPosition(this, { Matter.Body.setPosition(this, {
x: mech.pos.x + (42 * Math.cos(mech.angle + Math.PI)), x: m.pos.x + (42 * Math.cos(m.angle + Math.PI)),
y: mech.pos.y + (42 * Math.sin(mech.angle + Math.PI)) y: m.pos.y + (42 * Math.sin(m.angle + Math.PI))
}) })
} }
//draw wire //draw wire
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(wireX, wireY); ctx.moveTo(wireX, wireY);
ctx.quadraticCurveTo(wireX, 0, this.position.x, this.position.y); 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.lineCap = "butt";
ctx.lineWidth = 15; ctx.lineWidth = 15;
ctx.strokeStyle = "#000"; ctx.strokeStyle = "#000";
@@ -2769,16 +2771,16 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (mech.pos.x > breakingPoint) { if (m.pos.x > breakingPoint) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x -= 0.0004; this.force.x -= 0.0004;
this.fill = "#222"; this.fill = "#222";
} }
//move mob to player //move mob to player
mech.calcLeg(0, 0); m.calcLeg(0, 0);
Matter.Body.setPosition(this, { Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.knee.x - 5, x: m.pos.x + m.flipLegs * m.knee.x - 5,
y: mech.pos.y + mech.knee.y y: m.pos.y + m.knee.y
}) })
} }
//draw wire //draw wire
@@ -2819,16 +2821,16 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (mech.pos.x > breakingPoint) { if (m.pos.x > breakingPoint) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x += -0.0003; this.force.x += -0.0003;
this.fill = "#333"; this.fill = "#333";
} }
//move mob to player //move mob to player
mech.calcLeg(Math.PI, -3); m.calcLeg(Math.PI, -3);
Matter.Body.setPosition(this, { Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.knee.x - 5, x: m.pos.x + m.flipLegs * m.knee.x - 5,
y: mech.pos.y + mech.knee.y y: m.pos.y + m.knee.y
}) })
} }
//draw wire //draw wire
@@ -2868,16 +2870,16 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (mech.pos.x > breakingPoint) { if (m.pos.x > breakingPoint) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x += -0.0006; this.force.x += -0.0006;
this.fill = "#111"; this.fill = "#111";
} }
//move mob to player //move mob to player
mech.calcLeg(0, 0); m.calcLeg(0, 0);
Matter.Body.setPosition(this, { Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.foot.x - 5, x: m.pos.x + m.flipLegs * m.foot.x - 5,
y: mech.pos.y + mech.foot.y - 1 y: m.pos.y + m.foot.y - 1
}) })
} }
//draw wire //draw wire
@@ -2917,16 +2919,16 @@ const spawn = {
if (this.freeOfWires) { if (this.freeOfWires) {
this.gravity(); this.gravity();
} else { } else {
if (mech.pos.x > breakingPoint) { if (m.pos.x > breakingPoint) {
this.freeOfWires = true; this.freeOfWires = true;
this.force.x += -0.0005; this.force.x += -0.0005;
this.fill = "#222"; this.fill = "#222";
} }
//move mob to player //move mob to player
mech.calcLeg(Math.PI, -3); m.calcLeg(Math.PI, -3);
Matter.Body.setPosition(this, { Matter.Body.setPosition(this, {
x: mech.pos.x + mech.flipLegs * mech.foot.x - 5, x: m.pos.x + m.flipLegs * m.foot.x - 5,
y: mech.pos.y + mech.foot.y - 1 y: m.pos.y + m.foot.y - 1
}) })
} }
//draw wire //draw wire

View File

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

View File

@@ -1,14 +1,7 @@
******************************************************** NEXT PATCH ******************************************************** ******************************************************** NEXT PATCH ********************************************************
duplication bug fix to continue playing after the final boss you need to use testing mode: "T" -> "U"
renamed mech -> m
renaming custom mode -> experimental mode
experimental mode is available again even without completing lore
mob: sneaker is a bit faster and stronger
(the invisible one that attacks from stealth)
tech: unified field theory - switching guns uses a reroll to cycle your field
******************************************************** BUGS ******************************************************** ******************************************************** BUGS ********************************************************
@@ -30,6 +23,10 @@ tech: unified field theory - switching guns uses a reroll to cycle your field
******************************************************** TODO ******************************************************** ******************************************************** TODO ********************************************************
rename ?
health -> integrity, unity
heal -> also integrity, unity
mechanic: use gun swap as an active ability mechanic: use gun swap as an active ability
this effect is spammable, so it needs a cost or a cooldown this effect is spammable, so it needs a cost or a cooldown
tech: tech:
@@ -52,7 +49,7 @@ tech: double your rerolls
might want to use a single variable for all duplication might want to use a single variable for all duplication
bot that follows the players history bot that follows the players history
could have the same shape as the mech circle head could have the same shape as the m circle head
1st bot is at 5s, 2nd is at 4.5s, ... 1st bot is at 5s, 2nd is at 4.5s, ...
bots don't get too close to player bots don't get too close to player
run smoothing on position update, don't update if close to player, based on ordering run smoothing on position update, don't update if close to player, based on ordering
@@ -68,13 +65,9 @@ tech: dodge chance for cloaking, harmonic fields, also pilot wave
set to 100% harm reduction randomly set to 100% harm reduction randomly
if (Math.random() < 0.2) damage *= 0; if (Math.random() < 0.2) damage *= 0;
rename ?
health -> integrity, unity
heal -> also integrity, unity
in game console in game console
set highlighting rules set highlighting rules
mech, tech, level are all highlighted m, tech, level are all highlighted
maybe the first term in each variable should get a highlight maybe the first term in each variable should get a highlight
tech: time dilation - when you exit time dilation rewind to the state you entered tech: time dilation - when you exit time dilation rewind to the state you entered
@@ -89,14 +82,14 @@ mechanic: technological dead end - add tech to the tech pool with a dumb effect
don't show up in custom? don't show up in custom?
negative effect (one time effects are better to avoid code clutter) negative effect (one time effects are better to avoid code clutter)
make the player rainbow colors make the player rainbow colors
mech.color = { m.color = {
hue: 0, hue: 0,
sat: 100, sat: 100,
light: 50 light: 50
} }
setInterval(function(){ setInterval(function(){
mech.color.hue++ m.color.hue++
mech.setFillColors() m.setFillColors()
}, 10); }, 10);
remove all your energy remove all your energy
eject all your rerolls (not bad with dup) eject all your rerolls (not bad with dup)
@@ -200,7 +193,7 @@ tech "Solar Power": Energy regeneration is doubled while standing still
mechanic - remove a random tech as a condition for picking up a really good mod mechanic - remove a random tech as a condition for picking up a really good mod
mechanic - do something for 2 seconds after firing mechanic - do something for 2 seconds after firing
if (mech.fireCDcycle + 120) if (m.fireCDcycle + 120)
tech- do 50% more damage in close, but 50% less at a distance tech- do 50% more damage in close, but 50% less at a distance
code it like techisFarAwayDmg code it like techisFarAwayDmg
@@ -243,7 +236,7 @@ mouse event e.which is deprecated
add some more computer / AI stuff to the level lore text add some more computer / AI stuff to the level lore text
mechanic - shrink mech.baseHealth in a tech or field mechanic - shrink m.baseHealth in a tech or field
standing wave harmonics tech- push things away standing wave harmonics tech- push things away
push scales with mass up to about 4 push scales with mass up to about 4
@@ -290,7 +283,7 @@ atmosphere levels
change the pace, give the user a rest between combat change the pace, give the user a rest between combat
low or no combat, but more graphics low or no combat, but more graphics
explore lore explore lore
find power ups in "wrecked" mechs representing previous simulations find power ups in "wrecked" m representing previous simulations
how you could leave something in one simulation that effects a different simulation how you could leave something in one simulation that effects a different simulation
Maybe some strange quantum physics principle. Maybe some strange quantum physics principle.
add text for player thoughts? add text for player thoughts?
@@ -371,7 +364,7 @@ cool names for tech
lore - a robot (the player) gains self awareness lore - a robot (the player) gains self awareness
each tech gun/field is a new tech each tech gun/field is a new tech
all the technology leads to the singularity all the technology leads to the singularity
each game run is actually the mech simulating a possible escape each game run is actually the m simulating a possible escape
this is why the graphics are so bad, its just a simulation this is why the graphics are so bad, its just a simulation
final tech is "this is just a simulation" final tech is "this is just a simulation"
you get immortality and Infinity damage you get immortality and Infinity damage