borders for no image selection menu
mob damage difficulty setting is lower recycling now flashes green when it heals merged cancel and research bars for single column selection added some dark grey borders for no images selection mode new images with midJourney V5 spores, pilot wave, standing wave bug fixes
This commit is contained in:
4433
js/bullet.js
4433
js/bullet.js
File diff suppressed because it is too large
Load Diff
127
js/index.js
127
js/index.js
@@ -14,7 +14,7 @@ Math.hash = s => {
|
||||
|
||||
document.getElementById("seed").placeholder = Math.initialSeed = String(Math.floor(Date.now() % 100000))
|
||||
Math.seed = Math.abs(Math.hash(Math.initialSeed)) //update randomizer seed in case the player changed it
|
||||
Math.seededRandom = function(min = 0, max = 1) { // in order to work 'Math.seed' must NOT be undefined
|
||||
Math.seededRandom = function (min = 0, max = 1) { // in order to work 'Math.seed' must NOT be undefined
|
||||
Math.seed = (Math.seed * 9301 + 49297) % 233280;
|
||||
return min + Math.seed / 233280 * (max - min);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ let color = { //light
|
||||
//difficulty is 0 easy, 1 normal, 2 hard, 4 why
|
||||
function getUrlVars() {
|
||||
let vars = {};
|
||||
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, k, v) {
|
||||
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, k, v) {
|
||||
vars[k] = v;
|
||||
});
|
||||
return vars;
|
||||
@@ -201,7 +201,7 @@ const ctx = canvas.getContext("2d");
|
||||
document.body.style.backgroundColor = "#fff";
|
||||
|
||||
//disable pop up menu on right click
|
||||
document.oncontextmenu = function() {
|
||||
document.oncontextmenu = function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -287,18 +287,18 @@ const build = {
|
||||
localSettings.isHideImages = !localSettings.isHideImages
|
||||
if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||
if (from === 'experiment') {
|
||||
// build.startExperiment()
|
||||
// openExperimentMenu()
|
||||
build.reset();
|
||||
// build.populateGrid();
|
||||
// build.choosePowerUp(null, 'none')
|
||||
} else if (from === 'pause') {
|
||||
build.unPauseGrid()
|
||||
build.pauseGrid() //redraw pause text with images
|
||||
} else { //settings
|
||||
//nothing needs to be here I think
|
||||
}
|
||||
|
||||
if (localSettings.isHideImages) {
|
||||
document.getElementById("choose-grid").classList.add('choose-grid-no-images');
|
||||
document.getElementById("choose-grid").classList.remove('choose-grid');
|
||||
} else {
|
||||
document.getElementById("choose-grid").classList.add('choose-grid');
|
||||
document.getElementById("choose-grid").classList.remove('choose-grid-no-images');
|
||||
}
|
||||
document.getElementById("hide-images").checked = localSettings.isHideImages
|
||||
// console.log(localSettings.isHideImages, from)
|
||||
},
|
||||
@@ -331,30 +331,30 @@ const build = {
|
||||
</svg><span style="font-size:1.5em;font-weight: 600; float: right;">PAUSED</span>
|
||||
<br>
|
||||
<label for="hide-images-pause" title="hide images for fields, guns, and tech" style="font-size:1.3em;" >hide images:</label>
|
||||
<input onclick="build.showImages('pause')" type="checkbox" id="hide-images-pause" name="hide-images-pause" ${localSettings.isHideImages? "checked": ""}>
|
||||
<input onclick="build.showImages('pause')" type="checkbox" id="hide-images-pause" name="hide-images-pause" ${localSettings.isHideImages ? "checked" : ""}>
|
||||
<span style="float: right;">press ${input.key.pause} to resume</span>
|
||||
<br>
|
||||
<br><strong class='color-d'>damage</strong>: ${((tech.damageFromTech())).toPrecision(4)} difficulty: ${((m.dmgScale)).toPrecision(4)}
|
||||
<br><strong class='color-defense'>defense</strong>: ${tech.isEnergyHealth ? (1-Math.pow(m.defense(), 0.13)).toPrecision(5) : (1-m.defense()).toPrecision(5) } difficulty: ${(1/simulation.dmgScale).toPrecision(4)}
|
||||
<br><strong><em>fire rate</em></strong>: ${((1-b.fireCDscale)*100).toFixed(b.fireCDscale < 0.1 ? 2 : 0)}%
|
||||
${tech.duplicationChance() ? `<br><strong class='color-dup'>duplication</strong>: ${(tech.duplicationChance()*100).toFixed(0)}%`: ""}
|
||||
${m.coupling ? `<br><strong class='color-coupling'>coupling</strong>: ${(m.coupling).toFixed(2)} <span style = 'font-size:90%;'>`+m.couplingDescription()+"</span>": ""}
|
||||
<br><strong class='color-defense'>defense</strong>: ${tech.isEnergyHealth ? (1 - Math.pow(m.defense(), 0.13)).toPrecision(5) : (1 - m.defense()).toPrecision(5)} difficulty: ${(1 / simulation.dmgScale).toPrecision(4)}
|
||||
<br><strong><em>fire rate</em></strong>: ${((1 - b.fireCDscale) * 100).toFixed(b.fireCDscale < 0.1 ? 2 : 0)}%
|
||||
${tech.duplicationChance() ? `<br><strong class='color-dup'>duplication</strong>: ${(tech.duplicationChance() * 100).toFixed(0)}%` : ""}
|
||||
${m.coupling ? `<br><strong class='color-coupling'>coupling</strong>: ${(m.coupling).toFixed(2)} <span style = 'font-size:90%;'>` + m.couplingDescription() + "</span>" : ""}
|
||||
${botText}
|
||||
<br>
|
||||
<br><strong class='color-h'>health</strong>: (${(m.health*100).toFixed(0)} / ${(m.maxHealth*100).toFixed(0)})
|
||||
<br><strong class='color-h'>health</strong>: (${(m.health * 100).toFixed(0)} / ${(m.maxHealth * 100).toFixed(0)})
|
||||
<span style="float: right;">mass: ${player.mass.toFixed(1)}</span>
|
||||
<br><strong class='color-f'>energy</strong>: (${(m.energy*100).toFixed(0)} / ${(m.maxEnergy*100).toFixed(0)}) +(${(m.fieldRegen*6000).toFixed(0)}/s)
|
||||
<br><strong class='color-f'>energy</strong>: (${(m.energy * 100).toFixed(0)} / ${(m.maxEnergy * 100).toFixed(0)}) + (${(m.fieldRegen * 6000).toFixed(0)}/s)
|
||||
<span style="float: right;">position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)})</span>
|
||||
<br><strong class='color-g'>gun</strong>: ${b.activeGun === null || b.activeGun === undefined ? "undefined":b.guns[b.activeGun].name} <strong class='color-g'>ammo</strong>: ${b.activeGun === null || b.activeGun === undefined ? "0":b.guns[b.activeGun].ammo}
|
||||
<br><strong class='color-g'>gun</strong>: ${b.activeGun === null || b.activeGun === undefined ? "undefined" : b.guns[b.activeGun].name} <strong class='color-g'>ammo</strong>: ${b.activeGun === null || b.activeGun === undefined ? "0" : b.guns[b.activeGun].ammo}
|
||||
<span style="float: right;">mouse: (${simulation.mouseInGame.x.toFixed(1)}, ${simulation.mouseInGame.y.toFixed(1)})</span>
|
||||
<br><strong class='color-m'>tech</strong>: ${tech.totalCount} <strong class='color-r'>research</strong>: ${powerUps.research.count}
|
||||
<span style="float: right;">velocity: (${player.velocity.x.toFixed(3)}, ${player.velocity.y.toFixed(3)})</span>
|
||||
${junkCount ? `<br><strong class='color-junk'>JUNK</strong>: ${(junkCount / totalCount * 100).toFixed(1)}% `: ""}
|
||||
${junkCount ? `<br><strong class='color-junk'>JUNK</strong>: ${(junkCount / totalCount * 100).toFixed(1)}% ` : ""}
|
||||
<br>
|
||||
<br>level: ${level.levelsCleared} ${level.levels[level.onLevel]} (${level.difficultyText()})
|
||||
<br>seed: ${Math.initialSeed} ${m.cycle} cycles
|
||||
<br>mobs: ${mob.length} blocks: ${body.length} bullets: ${bullet.length} power ups: ${powerUp.length}
|
||||
${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
${simulation.isCheating ? "<br><br><em>lore disabled</em>" : ""}
|
||||
</span></div>`;
|
||||
// deaths: ${mobs.mobDeaths}
|
||||
if (tech.isPauseSwitchField && !simulation.isChoosing) {
|
||||
@@ -415,7 +415,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
const style = (localSettings.isHideImages || tech.tech[i].isJunk || tech.tech[i].isLore) ? `style="height:auto;"` : `style = "background-image: url('img/${tech.tech[i].name}.webp');"`
|
||||
const techCountText = tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : "";
|
||||
if (tech.tech[i].isNonRefundable) {
|
||||
text += `<div class="pause-grid-module" id ="${i}-pause-tech" style = "border: 0px; opacity:0.5; font-size: 60%; line-height: 130%; margin: 1px; padding: 6px;"><div class="grid-title">${tech.tech[i].link} ${techCountText}</div>${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div></div>`
|
||||
text += `<div class="pause-grid-module" id ="${i}-pause-tech" style = "border: 0px; opacity:0.5; font-size: 60%; line-height: 130%; margin: 1px; padding: 6px;"><div class="grid-title">${tech.tech[i].link} ${techCountText}</div>${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div></div>`
|
||||
// } else if (tech.tech[i].isLore) {
|
||||
// text += `<div class="pause-grid-module"><div class="grid-title lore-text"><div class="circle-grid lore"></div> ${tech.tech[i].name} ${techCountText}</div>${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div></div>`
|
||||
} else if (tech.tech[i].isFieldTech) {
|
||||
@@ -432,7 +432,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
text += build.techText(i) + "</div>"
|
||||
}
|
||||
} else if (tech.tech[i].isLost) {
|
||||
text += `<div class="pause-grid-module" style="text-decoration: line-through;"><div class="grid-title">${tech.tech[i].link}</div>${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div></div>`
|
||||
text += `<div class="pause-grid-module" style="text-decoration: line-through;"><div class="grid-title">${tech.tech[i].link}</div>${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div></div>`
|
||||
}
|
||||
}
|
||||
el = document.getElementById("pause-grid-right")
|
||||
@@ -478,7 +478,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
techText(i) {
|
||||
return `<div class="card-text" >
|
||||
<div class="grid-title" ><div class="circle-grid tech"></div> ${build.nameLink(tech.tech[i].name)} ${tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : ""}</div>
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div>`
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div>`
|
||||
},
|
||||
skinTechText(i) {
|
||||
return `<div class="card-text"> <div class="grid-title">
|
||||
@@ -486,7 +486,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
<div class="circle-grid-skin"></div>
|
||||
<div class="circle-grid-skin-eye"></div>
|
||||
</span> ${build.nameLink(tech.tech[i].name)} ${tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : ""}</div>
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div>`
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div>`
|
||||
},
|
||||
gunTechText(i) {
|
||||
return `<div class="card-text"> <div class="grid-title">
|
||||
@@ -494,7 +494,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
<div class="circle-grid tech" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid gun" style="position:absolute; top:0; left:10px; opacity:0.65;"></div>
|
||||
</span> ${build.nameLink(tech.tech[i].name)} ${tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : ""}</div>
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div>`
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div>`
|
||||
},
|
||||
fieldTechText(i) {
|
||||
return `<div class="card-text"><div class="grid-title">
|
||||
@@ -502,12 +502,12 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
<div class="circle-grid tech" style="position:absolute; top:0; left:0;opacity:0.8;"></div>
|
||||
<div class="circle-grid field" style="position:absolute; top:0; left:10px;opacity:0.65;"></div>
|
||||
</span> ${build.nameLink(tech.tech[i].name)} ${tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : ""}</div>
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div>`
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div>`
|
||||
},
|
||||
junkTechText(i) {
|
||||
return `<div class="card-text">
|
||||
<div class="grid-title"><div class="circle-grid junk"></div> ${build.nameLink(tech.tech[i].name)} ${tech.tech[i].count > 1 ? `(${tech.tech[i].count}x)` : ""}</div>
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div>`
|
||||
${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div>`
|
||||
},
|
||||
choosePowerUp(index, type, isAllowed = false) {
|
||||
if (type === "gun") {
|
||||
@@ -594,7 +594,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
techID.setAttribute("onClick", `javascript: build.choosePowerUp(${i},'tech')`);
|
||||
}
|
||||
} else { //disabled color for disabled tech
|
||||
techID.innerHTML = `<div class="grid-title">${tech.tech[i].name}</div>${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() :tech.tech[i].description}</div>`
|
||||
techID.innerHTML = `<div class="grid-title">${tech.tech[i].name}</div>${tech.tech[i].descriptionFunction ? tech.tech[i].descriptionFunction() : tech.tech[i].description}</div>`
|
||||
if (!techID.classList.contains("experiment-grid-disabled")) {
|
||||
techID.classList.add("experiment-grid-disabled");
|
||||
techID.onclick = null
|
||||
@@ -630,7 +630,7 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
</div>
|
||||
<div>
|
||||
<label for="hide-images-experiment" title="reload experiment with no images for fields, guns, and tech">hide images:</label>
|
||||
<input onclick="build.showImages('experiment')" type="checkbox" id="hide-images-experiment" name="hide-images-experiment" style="width:17px; height:17px; margin-bottom: 15px;" ${localSettings.isHideImages? "checked": ""}>
|
||||
<input onclick="build.showImages('experiment')" type="checkbox" id="hide-images-experiment" name="hide-images-experiment" style="width:17px; height:17px; margin-bottom: 15px;" ${localSettings.isHideImages ? "checked" : ""}>
|
||||
</div>
|
||||
<div>
|
||||
<svg class="SVG-button" onclick="build.reset()" width="50" height="25">
|
||||
@@ -775,17 +775,17 @@ ${simulation.isCheating ? "<br><br><em>lore disabled</em>": ""}
|
||||
}
|
||||
console.log('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||
console.log(url)
|
||||
navigator.clipboard.writeText(url).then(function() {
|
||||
navigator.clipboard.writeText(url).then(function () {
|
||||
/* clipboard successfully set */
|
||||
if (isCustom) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
alert('n-gon build URL copied to clipboard.\nPaste into browser address bar.')
|
||||
}, 300);
|
||||
}
|
||||
}, function() {
|
||||
}, function () {
|
||||
/* clipboard write failed */
|
||||
if (isCustom) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
alert('copy failed')
|
||||
}, 300);
|
||||
}
|
||||
@@ -946,23 +946,23 @@ const input = {
|
||||
setKeys(event) {
|
||||
//check for duplicate keys
|
||||
if (event.code && !(
|
||||
event.code === "ArrowRight" ||
|
||||
event.code === "ArrowLeft" ||
|
||||
event.code === "ArrowUp" ||
|
||||
event.code === "ArrowDown" ||
|
||||
event.code === input.key.fire ||
|
||||
event.code === input.key.field ||
|
||||
event.code === input.key.up ||
|
||||
event.code === input.key.down ||
|
||||
event.code === input.key.left ||
|
||||
event.code === input.key.right ||
|
||||
event.code === input.key.pause ||
|
||||
// event.code === "Escape" ||
|
||||
event.code === input.key.nextGun ||
|
||||
event.code === input.key.previousGun ||
|
||||
event.code === input.key.testing ||
|
||||
event.code === "Digit1" || event.code === "Digit2" || event.code === "Digit3" || event.code === "Digit4" || event.code === "Digit5" || event.code === "Digit6" || event.code === "Digit7" || event.code === "Digit8" || event.code === "Digit9" || event.code === "Digit0" || event.code === "Minus" || event.code === "Equal"
|
||||
)) {
|
||||
event.code === "ArrowRight" ||
|
||||
event.code === "ArrowLeft" ||
|
||||
event.code === "ArrowUp" ||
|
||||
event.code === "ArrowDown" ||
|
||||
event.code === input.key.fire ||
|
||||
event.code === input.key.field ||
|
||||
event.code === input.key.up ||
|
||||
event.code === input.key.down ||
|
||||
event.code === input.key.left ||
|
||||
event.code === input.key.right ||
|
||||
event.code === input.key.pause ||
|
||||
// event.code === "Escape" ||
|
||||
event.code === input.key.nextGun ||
|
||||
event.code === input.key.previousGun ||
|
||||
event.code === input.key.testing ||
|
||||
event.code === "Digit1" || event.code === "Digit2" || event.code === "Digit3" || event.code === "Digit4" || event.code === "Digit5" || event.code === "Digit6" || event.code === "Digit7" || event.code === "Digit8" || event.code === "Digit9" || event.code === "Digit0" || event.code === "Minus" || event.code === "Equal"
|
||||
)) {
|
||||
switch (input.focus.id) {
|
||||
case "key-fire":
|
||||
input.key.fire = event.code
|
||||
@@ -1013,14 +1013,14 @@ document.getElementById("control-table").addEventListener('click', (event) => {
|
||||
window.addEventListener("keydown", input.setKeys);
|
||||
}
|
||||
});
|
||||
document.getElementById("control-details").addEventListener("toggle", function() {
|
||||
document.getElementById("control-details").addEventListener("toggle", function () {
|
||||
input.controlTextUpdate()
|
||||
input.endKeySensing();
|
||||
})
|
||||
|
||||
document.getElementById("control-reset").addEventListener('click', input.setDefault);
|
||||
|
||||
window.addEventListener("keyup", function(event) {
|
||||
window.addEventListener("keyup", function (event) {
|
||||
switch (event.code) {
|
||||
case input.key.right:
|
||||
case "ArrowRight":
|
||||
@@ -1047,7 +1047,7 @@ window.addEventListener("keyup", function(event) {
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("keydown", function(event) {
|
||||
window.addEventListener("keydown", function (event) {
|
||||
// console.log(event.code)
|
||||
switch (event.code) {
|
||||
case input.key.right:
|
||||
@@ -1081,7 +1081,7 @@ window.addEventListener("keydown", function(event) {
|
||||
case input.key.pause:
|
||||
if (!simulation.isChoosing && input.isPauseKeyReady && m.alive) {
|
||||
input.isPauseKeyReady = false
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
input.isPauseKeyReady = true
|
||||
}, 300);
|
||||
if (simulation.paused) {
|
||||
@@ -1110,7 +1110,7 @@ window.addEventListener("keydown", function(event) {
|
||||
}
|
||||
m.energy = energy //return to current energy
|
||||
// document.getElementById("pause-field").innerHTML = `<div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[m.fieldMode].name}</div> ${m.fieldUpgrades[m.fieldMode].description}`
|
||||
document.getElementById("pause-field").style.backgroundImage = `url('img/field/${m.fieldUpgrades[m.fieldMode].name}${m.fieldMode === 0 ? Math.floor(Math.random()*10) : ""}.webp')`
|
||||
document.getElementById("pause-field").style.backgroundImage = `url('img/field/${m.fieldUpgrades[m.fieldMode].name}${m.fieldMode === 0 ? Math.floor(Math.random() * 10) : ""}.webp')`
|
||||
document.getElementById("pause-field").innerHTML = `
|
||||
<div class="card-text" style = "animation: fieldColorCycle 1s linear infinite alternate;">
|
||||
<div class="grid-title"><div class="circle-grid field"></div> ${build.nameLink(m.fieldUpgrades[m.fieldMode].name)}</div>
|
||||
@@ -1310,7 +1310,7 @@ window.addEventListener("keydown", function(event) {
|
||||
break
|
||||
case "b":
|
||||
tech.isRerollDamage = true
|
||||
powerUps.research.changeRerolls(100000)
|
||||
powerUps.research.changeRerolls(1000000)
|
||||
break
|
||||
case "r":
|
||||
m.resetHistory();
|
||||
@@ -1564,10 +1564,10 @@ document.getElementById("difficulty-select").addEventListener("input", () => {
|
||||
});
|
||||
|
||||
|
||||
document.getElementById("updates").addEventListener("toggle", function() {
|
||||
document.getElementById("updates").addEventListener("toggle", function () {
|
||||
function loadJSON(path, success, error) { //generic function to get JSON
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
if (xhr.status === 200) {
|
||||
if (success)
|
||||
@@ -1586,7 +1586,7 @@ document.getElementById("updates").addEventListener("toggle", function() {
|
||||
|
||||
/// https://api.github.com/repos/landgreen/n-gon/stats/commit_activity
|
||||
loadJSON('https://api.github.com/repos/landgreen/n-gon/commits',
|
||||
function(data) {
|
||||
function (data) {
|
||||
// console.log(data)
|
||||
for (let i = 0, len = 20; i < len; i++) {
|
||||
text += "<strong>" + data[i].commit.author.date.substr(0, 10) + "</strong> - "; //+ "<br>"
|
||||
@@ -1595,14 +1595,14 @@ document.getElementById("updates").addEventListener("toggle", function() {
|
||||
}
|
||||
document.getElementById("updates-div").innerHTML = text.replace(/\n/g, "<br />")
|
||||
},
|
||||
function(xhr) {
|
||||
function (xhr) {
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
})
|
||||
const sound = {
|
||||
tone(frequency, end = 1000, gain = 0.05) {
|
||||
const audioCtx = new(window.AudioContext || window.webkitAudioContext)(); //setup audio context
|
||||
const audioCtx = new (window.AudioContext || window.webkitAudioContext)(); //setup audio context
|
||||
const oscillator = audioCtx.createOscillator();
|
||||
const gainNode = audioCtx.createGain();
|
||||
gainNode.gain.value = gain; //controls volume
|
||||
@@ -1618,7 +1618,7 @@ const sound = {
|
||||
// return audioCtx
|
||||
},
|
||||
portamento(frequency, end = 1000, shiftRate = 10, gain = 0.05) {
|
||||
const audioCtx = new(window.AudioContext || window.webkitAudioContext)(); //setup audio context
|
||||
const audioCtx = new (window.AudioContext || window.webkitAudioContext)(); //setup audio context
|
||||
const oscillator = audioCtx.createOscillator();
|
||||
const gainNode = audioCtx.createGain();
|
||||
gainNode.gain.value = gain; //controls volume
|
||||
@@ -1681,6 +1681,9 @@ if (!localSettings.isHideImages) {
|
||||
}
|
||||
// console.log(urls, images)
|
||||
});
|
||||
document.getElementById("choose-grid").classList.add('choose-grid');
|
||||
} else {
|
||||
document.getElementById("choose-grid").classList.add('choose-grid-no-images');
|
||||
}
|
||||
|
||||
|
||||
|
||||
1429
js/level.js
1429
js/level.js
File diff suppressed because it is too large
Load Diff
24
js/lore.js
24
js/lore.js
@@ -2,15 +2,7 @@ const lore = {
|
||||
techCount: 0,
|
||||
techGoal: 7,
|
||||
setTechGoal() {
|
||||
if (simulation.difficultyMode === 1) {
|
||||
this.techGoal = 8
|
||||
} else if (simulation.difficultyMode === 2) {
|
||||
this.techGoal = 5
|
||||
} else if (simulation.difficultyMode === 4) {
|
||||
this.techGoal = 2
|
||||
} else if (simulation.difficultyMode === 6) {
|
||||
this.techGoal = 1
|
||||
}
|
||||
this.techGoal = Math.max(1, Math.floor(8 - 1.5 * simulation.difficultyMode))
|
||||
},
|
||||
talkingColor: "#dff", //set color of graphic on level.null
|
||||
isSpeech: false,
|
||||
@@ -55,8 +47,8 @@ const lore = {
|
||||
trainer: {
|
||||
color: "#f20",
|
||||
voice: undefined,
|
||||
text: function(say) {
|
||||
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
|
||||
text: function (say) {
|
||||
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now() / 1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
|
||||
lore.talkingColor = this.color
|
||||
const utterance = new SpeechSynthesisUtterance(say);
|
||||
utterance.lang = "en-AU" //"en-IN"; //de-DE en-GB fr-FR en-US en-AU
|
||||
@@ -67,9 +59,9 @@ const lore = {
|
||||
anand: {
|
||||
color: "#e0c",
|
||||
voice: undefined,
|
||||
text: function(say) {
|
||||
text: function (say) {
|
||||
if (level.levels[level.onLevel] === undefined) { //only talk if on the lore level (which is undefined because it is popped out of the level.levels array)
|
||||
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
|
||||
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now() / 1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
|
||||
lore.talkingColor = this.color
|
||||
if (lore.isSpeech) {
|
||||
const utterance = new SpeechSynthesisUtterance(say);
|
||||
@@ -101,9 +93,9 @@ const lore = {
|
||||
},
|
||||
miriam: {
|
||||
color: "#f20",
|
||||
text: function(say) {
|
||||
text: function (say) {
|
||||
if (level.levels[level.onLevel] === undefined) { //only talk if on the lore level (which is undefined because it is popped out of the level.levels array)
|
||||
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now()/1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
|
||||
simulation.makeTextLog(`input.audio(<span style="color:#888; font-size: 70%;">${(Date.now() / 1000).toFixed(0)} s</span>)<span class='color-symbol'>:</span> "<span style="color:${this.color};">${say}</span>"`, Infinity);
|
||||
lore.talkingColor = this.color
|
||||
if (lore.isSpeech) {
|
||||
utterance = new SpeechSynthesisUtterance(say);
|
||||
@@ -116,7 +108,7 @@ const lore = {
|
||||
lore.isSpeech = false
|
||||
lore.nextSentence()
|
||||
}
|
||||
speechFrozen = setTimeout(function() { // speech frozen after 10 seconds of no end
|
||||
speechFrozen = setTimeout(function () { // speech frozen after 10 seconds of no end
|
||||
console.log('speech frozen')
|
||||
lore.isSpeech = false
|
||||
lore.nextSentence()
|
||||
|
||||
4530
js/player.js
4530
js/player.js
File diff suppressed because it is too large
Load Diff
@@ -75,7 +75,7 @@ const powerUps = {
|
||||
}
|
||||
let text = '<span style="position:relative;">'
|
||||
for (let i = 0; i < num; i++) {
|
||||
text += `<div class="research-circle" style="position:absolute; top:1.5px; left:${i*8}px;"></div>`
|
||||
text += `<div class="research-circle" style="position:absolute; top:1.5px; left:${i * 8}px;"></div>`
|
||||
}
|
||||
text += '</span> '
|
||||
for (let i = 0; i < num; i++) {
|
||||
@@ -90,7 +90,7 @@ const powerUps = {
|
||||
}
|
||||
let text = '<span style="position:relative;">'
|
||||
for (let i = 0; i < num; i++) {
|
||||
text += `<div class="ammo-circle" style="position:absolute; top:1.5px; left:${i*8}px;"></div>`
|
||||
text += `<div class="ammo-circle" style="position:absolute; top:1.5px; left:${i * 8}px;"></div>`
|
||||
}
|
||||
text += '</span> '
|
||||
for (let i = 0; i < num; i++) {
|
||||
@@ -106,7 +106,7 @@ const powerUps = {
|
||||
}
|
||||
let text = '<span style="position:relative;">'
|
||||
for (let i = 0; i < num; i++) {
|
||||
text += `<div class="heal-circle-energy" style="position:absolute; top:1px; left:${i*10}px;"></div>`
|
||||
text += `<div class="heal-circle-energy" style="position:absolute; top:1px; left:${i * 10}px;"></div>`
|
||||
}
|
||||
text += '</span> '
|
||||
for (let i = 0; i < num; i++) {
|
||||
@@ -120,7 +120,7 @@ const powerUps = {
|
||||
}
|
||||
let text = '<span style="position:relative;">'
|
||||
for (let i = 0; i < num; i++) {
|
||||
text += `<div class="heal-circle" style="position:absolute; top:1px; left:${i*10}px;"></div>`
|
||||
text += `<div class="heal-circle" style="position:absolute; top:1px; left:${i * 10}px;"></div>`
|
||||
}
|
||||
text += '</span> '
|
||||
for (let i = 0; i < num; i++) {
|
||||
@@ -139,7 +139,7 @@ const powerUps = {
|
||||
}
|
||||
let text = '<span style="position:relative;">'
|
||||
for (let i = 0; i < num; i++) {
|
||||
text += `<div class="coupling-circle" style="position:absolute; top:1.5px; left:${i*6}px;"></div>`
|
||||
text += `<div class="coupling-circle" style="position:absolute; top:1.5px; left:${i * 6}px;"></div>`
|
||||
}
|
||||
text += '</span> '
|
||||
for (let i = 0; i < num; i++) {
|
||||
@@ -154,7 +154,7 @@ const powerUps = {
|
||||
}
|
||||
let text = '<span style="position:relative;">'
|
||||
for (let i = 0; i < num; i++) {
|
||||
text += `<div class="boost-circle" style="position:absolute; top:1.5px; left:${i*8}px;"></div>`
|
||||
text += `<div class="boost-circle" style="position:absolute; top:1.5px; left:${i * 8}px;"></div>`
|
||||
}
|
||||
text += '</span> '
|
||||
for (let i = 0; i < num; i++) {
|
||||
@@ -164,7 +164,7 @@ const powerUps = {
|
||||
},
|
||||
},
|
||||
totalPowerUps: 0, //used for tech that count power ups at the end of a level
|
||||
do() {},
|
||||
do() { },
|
||||
setDupChance() {
|
||||
if (tech.duplicationChance() > 0 || tech.isAnthropicTech) {
|
||||
if (tech.isPowerUpsVanish) {
|
||||
@@ -639,6 +639,8 @@ const powerUps = {
|
||||
}
|
||||
},
|
||||
cancelText(type) {
|
||||
// if (localSettings.isHideImages) { }
|
||||
|
||||
if (tech.isSuperDeterminism) {
|
||||
return `<div></div>`
|
||||
} else if (tech.isCancelTech) {
|
||||
@@ -655,18 +657,54 @@ const powerUps = {
|
||||
text += `<div onclick="powerUps.research.use('${type}')" class='research-card'>` // style = "margin-left: 192px; margin-right: -192px;"
|
||||
tech.junkResearchNumber = Math.ceil(4 * Math.random())
|
||||
text += `<div><div> <span style="position:relative;">`
|
||||
for (let i = 0; i < tech.junkResearchNumber; i++) text += `<div class="circle-grid junk" style="position:absolute; top:0; left:${15*i}px ;opacity:0.8; border: 1px #fff solid;width: 1.15em;height: 1.15em;"></div>`
|
||||
for (let i = 0; i < tech.junkResearchNumber; i++) {
|
||||
text += `<div class="circle-grid junk" style="position:absolute; top:0; left:${15 * i}px ;opacity:0.8; border: 1px #fff solid;width: 1.15em;height: 1.15em;"></div>`
|
||||
}
|
||||
text += `</span> <span class='research-select'>pseudoscience</span></div></div></div>`
|
||||
} else if (powerUps.research.count > 0) {
|
||||
text += `<div onclick="powerUps.research.use('${type}')" class='research-card' >` // style = "margin-left: 192px; margin-right: -192px;"
|
||||
text += `<div><div><span style="position:relative;">`
|
||||
for (let i = 0, len = Math.min(powerUps.research.count, 30); i < len; i++) text += `<div class="circle-grid research" style="font-size:0.82em; position:absolute; top:0; left:${(18 - len*0.21)*i}px ;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
text += `</span> <span class='research-select'>${tech.isResearchReality?"<span class='alt'>alternate reality</span>": "research"}</span></div></div></div>`
|
||||
for (let i = 0, len = Math.min(powerUps.research.count, 30); i < len; i++) text += `<div class="circle-grid research" style="font-size:0.82em; position:absolute; top:0; left:${(18 - len * 0.21) * i}px ;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
text += `</span> <span class='research-select'>${tech.isResearchReality ? "<span class='alt'>alternate reality</span>" : "research"}</span></div></div></div>`
|
||||
} else {
|
||||
text += `<div></div>`
|
||||
}
|
||||
return text
|
||||
},
|
||||
researchAndCancelText(type) {
|
||||
let text = `<div class='research-cancel'>`
|
||||
if (type === "entanglement") {
|
||||
text += `<span class='research-card entanglement flipX' style="width: 275px;"><span style="letter-spacing: 6px;">entanglement</span></span>` //‌
|
||||
} else if (tech.isJunkResearch && powerUps.research.currentRerollCount < 3) {
|
||||
text += `<span onclick="powerUps.research.use('${type}')" class='research-card' style="width: 275px;float: left;">` // style = "margin-left: 192px; margin-right: -192px;"
|
||||
tech.junkResearchNumber = Math.ceil(4 * Math.random())
|
||||
text += `<div><div><span style="position:relative;">`
|
||||
for (let i = 0, len = tech.junkResearchNumber; i < len; i++) {
|
||||
text += `<div class="circle-grid junk" style="position:absolute; top:0; left:${15 * i}px ;opacity:0.8; border: 1px #fff solid;width: 1.15em;height: 1.15em;"></div>`
|
||||
}
|
||||
text += `</span> <span class='research-select'>${tech.isResearchReality ? "<span class='alt'>alternate reality</span>" : "research"}</span></div></div></span>`
|
||||
} else if (powerUps.research.count > 0) {
|
||||
text += `<span onclick="powerUps.research.use('${type}')" class='research-card' style="width: 275px;float: left;">` // style = "margin-left: 192px; margin-right: -192px;"
|
||||
text += `<div><div><span style="position:relative;">`
|
||||
let researchCap = 18
|
||||
if (tech.isCancelTech) researchCap -= 2
|
||||
if (canvas.width < 1951) researchCap -= 3
|
||||
if (canvas.width < 1711) researchCap -= 4
|
||||
for (let i = 0, len = Math.min(powerUps.research.count, researchCap); i < len; i++) {
|
||||
text += `<div class="circle-grid research" style="font-size:0.82em; position:absolute; top:0; left:${(18 - len * 0.21) * i}px ;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
}
|
||||
text += `</span> <span class='research-select'>${tech.isResearchReality ? "<span class='alt'>alternate reality</span>" : "research"}</span></div></div></span>`
|
||||
} else {
|
||||
text += `<span class='research-card' style="width: 275px;float: right; background-color: #bbb;">research</span>` //‌
|
||||
}
|
||||
if (tech.isCancelTech) {
|
||||
text += `<span class='cancel-card' onclick='powerUps.endDraft("${type}",true)' style="width: 115px;float: right;font-size:0.9em;padding-top:5px">randomize</span>`
|
||||
} else {
|
||||
text += `<span class='cancel-card' onclick='powerUps.endDraft("${type}",true)' style="width: 95px;float: right;">cancel</span>`
|
||||
}
|
||||
|
||||
return text + "</div>"
|
||||
},
|
||||
buildColumns(totalChoices, type) {
|
||||
let width
|
||||
if (canvas.width < 1710) {
|
||||
@@ -676,18 +714,17 @@ const powerUps = {
|
||||
} else {
|
||||
width = "384px"
|
||||
}
|
||||
// if (canvas.width < 1500) {
|
||||
// width = "340px"
|
||||
// } else if (canvas.width < 1950) {
|
||||
// width = "360px"
|
||||
// } else {
|
||||
// width = "384px"
|
||||
// }
|
||||
|
||||
let text = ""
|
||||
if (totalChoices === 1 || localSettings.isHideImages || canvas.width < 1200) {
|
||||
if (localSettings.isHideImages) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = width
|
||||
text += powerUps.cancelText(type)
|
||||
text += powerUps.researchText(type)
|
||||
text += powerUps.researchAndCancelText(type)
|
||||
} else if (totalChoices === 1 || canvas.width < 1200) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = width
|
||||
text += powerUps.researchAndCancelText(type)
|
||||
// console.log('hi')
|
||||
// text += powerUps.cancelText(type)
|
||||
// text += powerUps.researchText(type)
|
||||
} else if (totalChoices === 2) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = `repeat(2, ${width})`
|
||||
text += powerUps.researchText(type)
|
||||
@@ -727,14 +764,14 @@ const powerUps = {
|
||||
${b.guns[choose].description}</div></div>`
|
||||
},
|
||||
fieldText(choose, click) {
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/field/${m.fieldUpgrades[choose].name}${choose === 0 ? Math.floor(Math.random()*10) : ""}.webp');"`
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/field/${m.fieldUpgrades[choose].name}${choose === 0 ? Math.floor(Math.random() * 10) : ""}.webp');"`
|
||||
return `<div class="choose-grid-module card-background" onclick="${click}" onauxclick="${click}"${style}>
|
||||
<div class="card-text">
|
||||
<div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[choose].name}</div>
|
||||
${m.fieldUpgrades[choose].description}</div></div>`
|
||||
},
|
||||
techText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages || tech.tech[choose].isLore ? powerUps.hideStyle : `style="background-image: url('img/${tech.tech[choose].name}.webp');"`
|
||||
return `<div class="choose-grid-module card-background" onclick="${click}" onauxclick="${click}"${style}>
|
||||
<div class="card-text">
|
||||
@@ -742,7 +779,7 @@ const powerUps = {
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
skinTechText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/${tech.tech[choose].name}.webp');"`
|
||||
return `<div class="choose-grid-module card-background" onclick="${click}" onauxclick="${click}"${style}>
|
||||
<div class="card-text">
|
||||
@@ -755,7 +792,7 @@ const powerUps = {
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
fieldTechText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/${tech.tech[choose].name}.webp');"`
|
||||
return `<div class="choose-grid-module card-background" onclick="${click}" onauxclick="${click}"${style}>
|
||||
<div class="card-text">
|
||||
@@ -768,7 +805,7 @@ const powerUps = {
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
gunTechText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/${tech.tech[choose].name}.webp');"`
|
||||
return `<div class="choose-grid-module card-background" onclick="${click}" onauxclick="${click}"${style}>
|
||||
<div class="card-text">
|
||||
@@ -781,7 +818,7 @@ const powerUps = {
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
junkTechText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-size: contain;background-repeat: no-repeat;background-image: url('img/junk.webp');"`
|
||||
if (!localSettings.isHideImages) {
|
||||
setTimeout(() => { //delay so that the html element exists
|
||||
@@ -873,7 +910,7 @@ const powerUps = {
|
||||
// const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"> <span id = "cellular-rule-id${this.id}" style = "font-size: 150%;font-family: 'Courier New', monospace;">⭓▸●■</span> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
const choose = botTech[Math.floor(Math.random() * botTech.length)];
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/${tech.tech[choose].name}.webp');"`
|
||||
text += `<div class="choose-grid-module card-background" onclick="powerUps.choose('tech',${choose})" ${style}>
|
||||
<div class="card-text">
|
||||
@@ -938,7 +975,7 @@ const powerUps = {
|
||||
// const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"> <span id = "cellular-rule-id${this.id}" style = "font-size: 150%;font-family: 'Courier New', monospace;">⭓▸●■</span> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
const choose = botTech[Math.floor(Math.random() * botTech.length)];
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/${tech.tech[choose].name}.webp');"`
|
||||
text += `<div class="choose-grid-module card-background" onclick="powerUps.choose('tech',${choose})" ${style}>
|
||||
<div class="card-text">
|
||||
@@ -1021,7 +1058,7 @@ const powerUps = {
|
||||
}
|
||||
removeOption(choose) //move from future options pool to avoid repeats on this selection
|
||||
tech.tech[choose].isRecentlyShown = true //this flag prevents this option from being shown the next time you pick up a tech power up
|
||||
const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
if (tech.tech[choose].isFieldTech) {
|
||||
text += powerUps.fieldTechText(choose, `powerUps.choose('tech',${choose})`)
|
||||
} else if (tech.tech[choose].isGunTech) {
|
||||
@@ -1045,7 +1082,7 @@ const powerUps = {
|
||||
// const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"> <span id = "cellular-rule-id${this.id}" style = "font-size: 150%;font-family: 'Courier New', monospace;">⭓▸●■</span> ${tech.tech[choose].name} ${isCount}</div> ${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
const choose = botTech[Math.floor(Math.random() * botTech.length)];
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const techCountText = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/${tech.tech[choose].name}.webp');"`
|
||||
text += `<div class="choose-grid-module card-background" onclick="powerUps.choose('tech',${choose})" ${style}>
|
||||
<div class="card-text">
|
||||
@@ -1162,7 +1199,7 @@ const powerUps = {
|
||||
}
|
||||
for (let i = 0; i < localSettings.entanglement.techIndexes.length; i++) { //add tech
|
||||
let choose = localSettings.entanglement.techIndexes[i]
|
||||
const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
|
||||
const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count + 1}x)` : "";
|
||||
|
||||
if (choose === null || tech.tech[choose].count + 1 > tech.tech[choose].maxCount || !tech.tech[choose].allowed()) {
|
||||
// text += `<div class="choose-grid-module" style = "background-color: #efeff5; border: 0px; opacity:0.5; font-size: 60%; line-height: 130%; margin: 1px; padding-top: 6px; padding-bottom: 6px;"><div class="grid-title">${tech.tech[choose].name} <span style = "color: #aaa;font-weight: normal;font-size:80%;">- incoherent</span></div></div>`
|
||||
|
||||
@@ -1137,31 +1137,16 @@ const simulation = {
|
||||
// },
|
||||
checks() {
|
||||
if (!(m.cycle % 15)) { //4 times a second
|
||||
//update defense bar
|
||||
const defense = m.defense()
|
||||
const defense = m.defense() //update defense bar
|
||||
if (m.lastCalculatedDefense !== defense) {
|
||||
document.getElementById("defense-bar").style.width = Math.floor(300 * m.maxHealth * (1 - defense)) + "px";
|
||||
|
||||
// if (m.lastCalculatedDefense === 1) document.getElementById("defense-bar").style.display = "inline"
|
||||
// if (defense === 1) document.getElementById("defense-bar").style.display = "none"
|
||||
// Math.pow(m.defense(), 0.13)
|
||||
m.lastCalculatedDefense = defense
|
||||
// console.log(defense)
|
||||
}
|
||||
|
||||
//update damage bar
|
||||
const damage = tech.damageFromTech()
|
||||
const damage = tech.damageFromTech() //update damage bar
|
||||
if (m.lastCalculatedDamage !== damage) {
|
||||
canvas.width
|
||||
// document.getElementById("damage-bar").style.width = Math.floor(Math.atan(damage - 1) / 6.28 * canvas.width) + "px";
|
||||
document.getElementById("damage-bar").style.height = Math.floor(Math.atan(damage - 1) / 3.14 * canvas.height) + "px";
|
||||
|
||||
document.getElementById("damage-bar").style.height = Math.floor(Math.atan(0.25 * damage - 0.25) / 1.65 * canvas.height) + "px";
|
||||
m.lastCalculatedDamage = damage
|
||||
console.log(damage)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (!(m.cycle % 60)) { //once a second
|
||||
//energy overfill
|
||||
@@ -1211,7 +1196,17 @@ const simulation = {
|
||||
if (isNaN(player.position.x)) m.death();
|
||||
if (m.lastKillCycle + 300 > m.cycle) { //effects active for 5 seconds after killing a mob
|
||||
if (tech.isEnergyRecovery && m.immuneCycle < m.cycle) m.energy += m.maxEnergy * 0.05
|
||||
if (tech.isHealthRecovery) m.addHealth(0.005 * m.maxHealth)
|
||||
if (tech.isHealthRecovery) {
|
||||
const heal = 0.005 * m.maxHealth
|
||||
m.addHealth(heal)
|
||||
simulation.drawList.push({ //add dmg to draw queue
|
||||
x: m.pos.x,
|
||||
y: m.pos.y,
|
||||
radius: Math.sqrt(heal) * 150,
|
||||
color: "rgba(0,255,200,0.6)",
|
||||
time: 8
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!(m.cycle % 420)) { //once every 7 seconds
|
||||
|
||||
994
js/spawn.js
994
js/spawn.js
File diff suppressed because it is too large
Load Diff
20756
js/tech.js
20756
js/tech.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user