added images
added images to tech, field, gun cards (enable this in settings) in progress - not all images are generated yet images are generated by me using midJourney plus significant post processing random research power ups are 20% more common per level global difficulty balance: player takes a bit less damage mutualism: 0.5->1 borrowed health for 250->300% more spore damage harpoon can still fire when out of energy, but slower harpoon fire cooldown no longer triggers when the harpoon returns it's just a flat 2/3 of a second after you Fire improved fire rate now allows you to fire many harpoons at once until you run out of energy default harpoon rope is a bit longer several bug fixes and undocumented changes I forgot to list
This commit is contained in:
524
js/powerup.js
524
js/powerup.js
@@ -325,10 +325,10 @@ const powerUps = {
|
||||
ctx.fillStyle = `rgba(221,221,221,0.6)`;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
});
|
||||
document.getElementById("pause-grid-right").style.opacity = "0.7"
|
||||
document.getElementById("pause-grid-left").style.opacity = "0.7"
|
||||
// document.getElementById("pause-grid-right").style.opacity = "0.7"
|
||||
// document.getElementById("pause-grid-left").style.opacity = "0.7"
|
||||
}
|
||||
build.pauseGrid()
|
||||
// build.pauseGrid()
|
||||
},
|
||||
endDraft(type, isCanceled = false) { //type should be a gun, tech, or field
|
||||
if (isCanceled) {
|
||||
@@ -372,7 +372,7 @@ const powerUps = {
|
||||
// simulation.makeTextLog(`powerUps.tech.length: ${Math.max(0,powerUps.tech.lastTotalChoices - banishLength)}`)
|
||||
// }
|
||||
}
|
||||
if (tech.isAnsatz && powerUps.research.count === 0) {
|
||||
if (tech.isAnsatz && powerUps.research.count < 1) {
|
||||
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"
|
||||
@@ -572,11 +572,11 @@ const powerUps = {
|
||||
const target = b.guns[b.activeGun]
|
||||
if (target.ammo !== Infinity) {
|
||||
if (tech.ammoCap) {
|
||||
const ammoAdded = Math.ceil(target.ammoPack * 0.7 * tech.ammoCap) //0.7 is average
|
||||
const ammoAdded = Math.ceil(target.ammoPack * 0.7 * tech.ammoCap * 0.8) //0.7 is average
|
||||
target.ammo = ammoAdded
|
||||
// simulation.makeTextLog(`${target.name}.<span class='color-g'>ammo</span> <span class='color-symbol'>=</span> ${ammoAdded}`)
|
||||
} else {
|
||||
const ammoAdded = Math.ceil((0.7 * Math.random() + 0.7 * Math.random()) * target.ammoPack)
|
||||
const ammoAdded = Math.ceil((0.7 * Math.random() + 0.7 * Math.random()) * target.ammoPack * 0.8)
|
||||
target.ammo += ammoAdded
|
||||
// simulation.makeTextLog(`${target.name}.<span class='color-g'>ammo</span> <span class='color-symbol'>+=</span> ${ammoAdded}`)
|
||||
}
|
||||
@@ -619,6 +619,125 @@ const powerUps = {
|
||||
}
|
||||
}
|
||||
},
|
||||
cancelText(type) {
|
||||
if (tech.isSuperDeterminism) {
|
||||
return `<div></div>`
|
||||
} else if (tech.isCancelTech) {
|
||||
return `<div class='choose-grid-module' onclick='powerUps.endDraft("${type}",true)' style="width: 115px; text-align: center;font-size: 1.1em;font-weight: 100;justify-self: end;">randomize</div>`
|
||||
} else {
|
||||
return `<div class='choose-grid-module' onclick='powerUps.endDraft("${type}",true)' style="width: 82px; text-align: center;font-size: 1.1em;font-weight: 100;justify-self: end;">cancel</div>`
|
||||
}
|
||||
},
|
||||
researchText(type) {
|
||||
let text = ""
|
||||
if (tech.isJunkResearch && powerUps.research.currentRerollCount < 3) {
|
||||
text += `<div onclick="powerUps.research.use('${type}')" class='choose-grid-module' style="font-size: 1.1em;font-weight: 100;">` // 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;"></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='choose-grid-module' style="font-size: 1.1em;font-weight: 100;">` // 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="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
|
||||
},
|
||||
hideStyle: `style="height:auto; border: none; background-color: transparent;"`,
|
||||
gunText(choose, click) {
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-image: url('img/gun/${b.guns[choose].name}.webp');"`
|
||||
|
||||
return `<div class="choose-grid-module card-background" onclick="${click}" ${style}>
|
||||
<div class="card-text">
|
||||
<div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choose].name}</div>
|
||||
${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');"`
|
||||
|
||||
return `<div class="choose-grid-module card-background" onclick="${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 > 1 ? `(${tech.tech[choose].count}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}" ${style}>
|
||||
<div class="card-text">
|
||||
<div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choose].name} ${techCountText}</div>
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
|
||||
fieldTechText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 1 ? `(${tech.tech[choose].count}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}" ${style}>
|
||||
<div class="card-text">
|
||||
<div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<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>
|
||||
${tech.tech[choose].name} ${techCountText}</div>
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
gunTechText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 1 ? `(${tech.tech[choose].count}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}" ${style}>
|
||||
<div class="card-text">
|
||||
<div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<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>
|
||||
${tech.tech[choose].name} ${techCountText}</div>
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
junkTechText(choose, click) {
|
||||
const techCountText = tech.tech[choose].count > 1 ? `(${tech.tech[choose].count}x)` : "";
|
||||
const style = localSettings.isHideImages ? powerUps.hideStyle : `style="background-size: contain;background-repeat: no-repeat;"`
|
||||
if (!localSettings.isHideImages) {
|
||||
setTimeout(() => { //pull image from web search if no url
|
||||
if (tech.tech[choose].url === undefined) {
|
||||
const url = "https://images.search.yahoo.com/search/images?p=" + tech.tech[choose].name;
|
||||
fetch(url)
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(html, "text/html");
|
||||
const elements = doc.getElementsByClassName("ld");
|
||||
// console.log(JSON.parse(elements[i].getAttribute("data")).iurl)
|
||||
tech.tech[choose].url = JSON.parse(elements[i].getAttribute("data")).iurl
|
||||
document.getElementById(`junk-${choose}`).style.backgroundImage = `url('${tech.tech[choose].url}')`
|
||||
});
|
||||
} else {
|
||||
document.getElementById(`junk-${choose}`).style.backgroundImage = `url('${tech.tech[choose].url}')`
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
return `<div id = "junk-${choose}" class="choose-grid-module card-background" onclick="${click}" ${style}>
|
||||
<div class="card-text">
|
||||
<div class="grid-title"><div class="circle-grid junk"></div> ${tech.tech[choose].name} ${techCountText}</div>
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
},
|
||||
incoherentTechText(choose, click) {
|
||||
// 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>`
|
||||
const techCountText = tech.tech[choose].count > 1 ? `(${tech.tech[choose].count}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" ${style}>
|
||||
<div class="card-text" style = "background-color: #efeff5;">
|
||||
<div class="grid-title" style = "color: #ddd;font-weight: normal;">incoherent</div> <br> <br>
|
||||
</div></div>`
|
||||
},
|
||||
gun: {
|
||||
name: "gun",
|
||||
color: "#26a",
|
||||
@@ -627,14 +746,11 @@ const powerUps = {
|
||||
},
|
||||
effect() {
|
||||
if (m.alive) {
|
||||
let text = ""
|
||||
if (!tech.isSuperDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("gun",true)'>${tech.isCancelTech ? "?":"✕"}</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>gun</h3>`
|
||||
let options = [];
|
||||
for (let i = 0; i < b.guns.length; i++) {
|
||||
if (!b.guns[i].have) options.push(i);
|
||||
}
|
||||
let totalChoices = Math.min(options.length, (tech.isDeterminism ? 1 : 2) + tech.extraChoices + (m.fieldUpgrades[m.fieldMode].name === "pilot wave"))
|
||||
let totalChoices = Math.min(options.length, (tech.isDeterminism ? 1 : 2 + tech.extraChoices + (m.fieldUpgrades[m.fieldMode].name === "pilot wave")))
|
||||
if (tech.isFlipFlopChoices) totalChoices += tech.isRelay ? (tech.isFlipFlopOn ? -1 : 7) : (tech.isFlipFlopOn ? 7 : -1) //flip the order for relay
|
||||
function removeOption(index) {
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
@@ -651,9 +767,26 @@ const powerUps = {
|
||||
}
|
||||
for (let i = 0; i < b.guns.length; i++) b.guns[i].isRecentlyShown = false //reset recently shown back to zero
|
||||
if (options.length > 0) {
|
||||
let text = ""
|
||||
if (totalChoices === 2) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px 384px"
|
||||
text += powerUps.researchText('gun')
|
||||
text += powerUps.cancelText('gun')
|
||||
} else if (totalChoices === 1) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px"
|
||||
text += powerUps.cancelText('gun')
|
||||
text += powerUps.researchText('gun')
|
||||
} else {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px 384px 384px"
|
||||
text += "<div></div>"
|
||||
text += powerUps.researchText('gun')
|
||||
text += powerUps.cancelText('gun')
|
||||
}
|
||||
for (let i = 0; i < totalChoices; i++) {
|
||||
const choose = options[Math.floor(Math.seededRandom(0, options.length))] //pick an element from the array of options
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choose})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choose].name}</div> ${b.guns[choose].description}</div>`
|
||||
const choose = options[Math.floor(Math.seededRandom(0, options.length))] //pick an element from the array of options
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choose})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choose].name}</div> ${b.guns[choose].description}</div>`
|
||||
text += powerUps.gunText(choose, `powerUps.choose('gun',${choose})`)
|
||||
|
||||
b.guns[choose].isRecentlyShown = true
|
||||
removeOption(choose)
|
||||
if (options.length < 1) break
|
||||
@@ -664,96 +797,24 @@ const powerUps = {
|
||||
if (tech.tech[i].isBotTech && tech.tech[i].count < tech.tech[i].maxCount && tech.tech[i].allowed()) botTech.push(i)
|
||||
}
|
||||
if (botTech.length > 0) { //pick random bot tech
|
||||
// const choose = botTech[Math.floor(Math.random() * botTech.length)];
|
||||
// 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 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 techCountText = tech.tech[choose].count > 1 ? `(${tech.tech[choose].count}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">
|
||||
<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} ${techCountText}</div>
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
}
|
||||
}
|
||||
if (tech.isJunkResearch && powerUps.research.currentRerollCount < 3) {
|
||||
tech.junkResearchNumber = Math.ceil(4 * Math.random())
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.research.use('gun')"><div class="grid-title"> <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;"></div>`
|
||||
text += `</span> <span class='research-select'>pseudoscience</span></div></div>`
|
||||
} else if (powerUps.research.count) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.research.use('gun')"><div class="grid-title"> <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="position:absolute; top:0; left:${(18 - len*0.3)*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>`
|
||||
}
|
||||
if (tech.isOneGun && b.inventory.length > 0) text += `<div style = "color: #f24">replaces your current gun</div>`
|
||||
document.getElementById("choose-grid").innerHTML = text
|
||||
powerUps.showDraft();
|
||||
}
|
||||
}
|
||||
},
|
||||
// pick(who, skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
|
||||
// let options = [];
|
||||
// for (let i = 0; i < who.length; i++) {
|
||||
// if (!who[i].have && i !== skip1 && i !== skip2 && i !== skip3 && i !== skip4) {
|
||||
// options.push(i);
|
||||
// }
|
||||
// }
|
||||
// //remove repeats from last selection
|
||||
// const totalChoices = tech.isDeterminism ? 1 : 3 + tech.extraChoices * 2
|
||||
// if (powerUps.gun.choiceLog.length > totalChoices || powerUps.gun.choiceLog.length === totalChoices) { //make sure this isn't the first time getting a power up and there are previous choices to remove
|
||||
// for (let i = 0; i < totalChoices; i++) { //repeat for each choice from the last selection
|
||||
// if (options.length > totalChoices) {
|
||||
// for (let j = 0, len = options.length; j < len; j++) {
|
||||
// if (powerUps.gun.choiceLog[powerUps.gun.choiceLog.length - 1 - i] === options[j]) {
|
||||
// options.splice(j, 1) //remove previous choice from option pool
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (options.length > 0) {
|
||||
// return options[Math.floor(Math.seededRandom(0, options.length))]
|
||||
// }
|
||||
// },
|
||||
// effectOld() {
|
||||
// let choice1 = powerUps.gun.pick(b.guns)
|
||||
// let choice2 = -1
|
||||
// let choice3 = -1
|
||||
// if (choice1 > -1) {
|
||||
// let text = ""
|
||||
// if (!tech.isSuperDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("gun",true)'>${tech.isCancelTech ? "?":"✕"}</div>`
|
||||
// text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>gun</h3>`
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice1})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice1].name}</div> ${b.guns[choice1].description}</div>`
|
||||
// if (!tech.isDeterminism) {
|
||||
// choice2 = powerUps.gun.pick(b.guns, choice1)
|
||||
// if (choice2 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice2})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice2].name}</div> ${b.guns[choice2].description}</div>`
|
||||
// choice3 = powerUps.gun.pick(b.guns, choice1, choice2)
|
||||
// if (choice3 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice3})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice3].name}</div> ${b.guns[choice3].description}</div>`
|
||||
// }
|
||||
// if (tech.extraChoices) {
|
||||
// let choice4 = powerUps.gun.pick(b.guns, choice1, choice2, choice3)
|
||||
// if (choice4 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice4})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice4].name}</div> ${b.guns[choice4].description}</div>`
|
||||
// let choice5 = powerUps.gun.pick(b.guns, choice1, choice2, choice3, choice4)
|
||||
// if (choice5 > -1) text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${choice5})">
|
||||
// <div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[choice5].name}</div> ${b.guns[choice5].description}</div>`
|
||||
// powerUps.gun.choiceLog.push(choice4)
|
||||
// powerUps.gun.choiceLog.push(choice5)
|
||||
// }
|
||||
// powerUps.gun.choiceLog.push(choice1)
|
||||
// powerUps.gun.choiceLog.push(choice2)
|
||||
// powerUps.gun.choiceLog.push(choice3)
|
||||
// // if (powerUps.research.count) text += `<div class="choose-grid-module" onclick="powerUps.research.use('gun')"><div class="grid-title"><div class="circle-grid research"></div> research <span class="research-select">${powerUps.research.count}</span></div></div>`
|
||||
|
||||
// if (tech.isJunkResearch && powerUps.research.currentRerollCount < 3) {
|
||||
// tech.junkResearchNumber = Math.floor(5 * Math.random())
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.research.use('gun')"><div class="grid-title"> <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;"></div>`
|
||||
// text += `</span> <span class='research-select'>pseudoscience</span></div></div>`
|
||||
// } else if (powerUps.research.count) {
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.research.use('gun')"><div class="grid-title"> <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="position:absolute; top:0; left:${(18 - len*0.3)*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>`
|
||||
// }
|
||||
// if (tech.isOneGun && b.inventory.length > 0) text += `<div style = "color: #f24">replaces your current gun</div>`
|
||||
// document.getElementById("choose-grid").innerHTML = text
|
||||
// powerUps.showDraft();
|
||||
// }
|
||||
// }
|
||||
},
|
||||
field: {
|
||||
name: "field",
|
||||
@@ -763,15 +824,11 @@ const powerUps = {
|
||||
},
|
||||
effect() {
|
||||
if (m.alive) {
|
||||
let text = ""
|
||||
if (!tech.isSuperDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("field",true)'>${tech.isCancelTech ? "?":"✕"}</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>field</h3>`
|
||||
|
||||
let options = [];
|
||||
for (let i = 1; i < m.fieldUpgrades.length; i++) { //skip field emitter
|
||||
if (i !== m.fieldMode) options.push(i);
|
||||
}
|
||||
let totalChoices = Math.min(options.length, (tech.isDeterminism ? 1 : 2) + tech.extraChoices + (m.fieldUpgrades[m.fieldMode].name === "pilot wave"))
|
||||
let totalChoices = Math.min(options.length, (tech.isDeterminism ? 1 : 2 + tech.extraChoices + (m.fieldUpgrades[m.fieldMode].name === "pilot wave")))
|
||||
if (tech.isFlipFlopChoices) totalChoices += tech.isRelay ? (tech.isFlipFlopOn ? -1 : 7) : (tech.isFlipFlopOn ? 7 : -1) //flip the order for relay
|
||||
|
||||
function removeOption(index) {
|
||||
@@ -790,9 +847,25 @@ const powerUps = {
|
||||
for (let i = 0; i < m.fieldUpgrades.length; i++) m.fieldUpgrades[i].isRecentlyShown = false //reset recently shown back to zero
|
||||
|
||||
if (options.length > 0 || tech.isExtraBotOption) {
|
||||
let text = ""
|
||||
if (totalChoices === 2) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px 384px"
|
||||
text += powerUps.researchText('field')
|
||||
text += powerUps.cancelText('field')
|
||||
} else if (totalChoices === 1) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px"
|
||||
text += powerUps.cancelText('field')
|
||||
text += powerUps.researchText('field')
|
||||
} else {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px 384px 384px"
|
||||
text += "<div></div>"
|
||||
text += powerUps.researchText('field')
|
||||
text += powerUps.cancelText('field')
|
||||
}
|
||||
for (let i = 0; i < totalChoices; i++) {
|
||||
const choose = options[Math.floor(Math.seededRandom(0, options.length))] //pick an element from the array of options
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choose})"><div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[choose].name}</div> ${m.fieldUpgrades[choose].description}</div>`
|
||||
//text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choose})"><div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[choose].name}</div> ${m.fieldUpgrades[choose].description}</div>` //default
|
||||
text += powerUps.fieldText(choose, `powerUps.choose('field',${choose})`)
|
||||
m.fieldUpgrades[choose].isRecentlyShown = true
|
||||
removeOption(choose)
|
||||
if (options.length < 1) break
|
||||
@@ -803,94 +876,23 @@ const powerUps = {
|
||||
if (tech.tech[i].isBotTech && tech.tech[i].count < tech.tech[i].maxCount && tech.tech[i].allowed()) botTech.push(i)
|
||||
}
|
||||
if (botTech.length > 0) { //pick random bot tech
|
||||
// const choose = botTech[Math.floor(Math.random() * botTech.length)];
|
||||
// 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 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 techCountText = tech.tech[choose].count > 1 ? `(${tech.tech[choose].count}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">
|
||||
<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} ${techCountText}</div>
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
}
|
||||
}
|
||||
if (tech.isJunkResearch && powerUps.research.currentRerollCount < 3) {
|
||||
tech.junkResearchNumber = Math.ceil(4 * Math.random())
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.research.use('field')"><div class="grid-title"> <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;"></div>`
|
||||
text += `</span> <span class='research-select'>pseudoscience</span></div></div>`
|
||||
} else if (powerUps.research.count) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.research.use('field')"><div class="grid-title"> <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="position:absolute; top:0; left:${(18 - len*0.3)*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>`
|
||||
}
|
||||
document.getElementById("choose-grid").innerHTML = text
|
||||
powerUps.showDraft();
|
||||
}
|
||||
}
|
||||
},
|
||||
// pick(who, skip1 = -1, skip2 = -1, skip3 = -1, skip4 = -1) {
|
||||
// let options = [];
|
||||
// for (let i = 1; i < who.length; i++) {
|
||||
// if (i !== m.fieldMode && i !== skip1 && i !== skip2 && i !== skip3 && i !== skip4) options.push(i);
|
||||
// }
|
||||
// //remove repeats from last selection
|
||||
// const totalChoices = tech.isDeterminism ? 1 : 3 + tech.extraChoices * 2
|
||||
// if (powerUps.field.choiceLog.length > totalChoices || powerUps.field.choiceLog.length === totalChoices) { //make sure this isn't the first time getting a power up and there are previous choices to remove
|
||||
// for (let i = 0; i < totalChoices; i++) { //repeat for each choice from the last selection
|
||||
// if (options.length > totalChoices) {
|
||||
// for (let j = 0, len = options.length; j < len; j++) {
|
||||
// if (powerUps.field.choiceLog[powerUps.field.choiceLog.length - 1 - i] === options[j]) {
|
||||
// options.splice(j, 1) //remove previous choice from option pool
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (options.length > 0) {
|
||||
// // return options[Math.floor(Math.random() * options.length)]
|
||||
// return options[Math.floor(Math.seededRandom(0, options.length))]
|
||||
// }
|
||||
// },
|
||||
// effectOld() {
|
||||
// let choice1 = powerUps.field.pick(m.fieldUpgrades)
|
||||
// let choice2 = -1
|
||||
// let choice3 = -1
|
||||
// if (choice1 > -1) {
|
||||
// let text = ""
|
||||
// if (!tech.isSuperDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("field",true)'>${tech.isCancelTech ? "?":"✕"}</div>`
|
||||
// text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>field</h3>`
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${choice1})"><div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[choice1].name}</div> ${m.fieldUpgrades[choice1].description}</div>`
|
||||
// powerUps.field.choiceLog.push(choice1)
|
||||
// if (!tech.isDeterminism) {
|
||||
// choice2 = powerUps.field.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> ${m.fieldUpgrades[choice2].name}</div> ${m.fieldUpgrades[choice2].description}</div>`
|
||||
// choice3 = powerUps.field.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> ${m.fieldUpgrades[choice3].name}</div> ${m.fieldUpgrades[choice3].description}</div>`
|
||||
// powerUps.field.choiceLog.push(choice2)
|
||||
// powerUps.field.choiceLog.push(choice3)
|
||||
// }
|
||||
// if (tech.extraChoices) {
|
||||
// let choice4 = powerUps.field.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> ${m.fieldUpgrades[choice4].name}</div> ${m.fieldUpgrades[choice4].description}</div>`
|
||||
// let choice5 = powerUps.field.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> ${m.fieldUpgrades[choice5].name}</div> ${m.fieldUpgrades[choice5].description}</div>`
|
||||
// powerUps.field.choiceLog.push(choice4)
|
||||
// powerUps.field.choiceLog.push(choice5)
|
||||
// }
|
||||
|
||||
// if (tech.isJunkResearch && powerUps.research.currentRerollCount < 3) {
|
||||
// tech.junkResearchNumber = Math.floor(4 * Math.random())
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.research.use('field')"><div class="grid-title"> <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;"></div>`
|
||||
// text += `</span> <span class='research-select'>pseudoscience</span></div></div>`
|
||||
// } else if (powerUps.research.count) {
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.research.use('field')"><div class="grid-title"> <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="position:absolute; top:0; left:${(18 - len*0.3)*i}px ;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
// // text += `</span> <span class='research-select'>research</span></div></div>`
|
||||
// text += `</span> <span class='research-select'>${tech.isResearchReality?"<span class='alt'>alternate reality</span>": "research"}</span></div></div>`
|
||||
// }
|
||||
// //(${powerUps.research.count})
|
||||
// // text += `<div style = 'color:#fff'>${simulation.SVGrightMouse} activate the shield with the right mouse<br>fields shield you from damage <br>and let you pick up and throw blocks</div>`
|
||||
// document.getElementById("choose-grid").innerHTML = text
|
||||
// powerUps.showDraft();
|
||||
// }
|
||||
// }
|
||||
},
|
||||
tech: {
|
||||
name: "tech",
|
||||
@@ -900,14 +902,8 @@ const powerUps = {
|
||||
},
|
||||
effect() {
|
||||
if (m.alive) {
|
||||
let text = ""
|
||||
if (!tech.isSuperDeterminism) text += `<div class='cancel' onclick='powerUps.endDraft("tech",true)'>${tech.isCancelTech ? "?":"✕"}</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>tech</h3>`
|
||||
|
||||
//used for junk estimation
|
||||
let junkCount = 0
|
||||
let totalCount = 0
|
||||
|
||||
let junkCount = 0 //used for junk estimation
|
||||
let totalCount = 0 //used for junk estimation
|
||||
let options = []; //generate all options
|
||||
optionLengthNoDuplicates = 0
|
||||
for (let i = 0; i < tech.tech.length; i++) {
|
||||
@@ -928,19 +924,14 @@ const powerUps = {
|
||||
if (options.length < 1) return;
|
||||
}
|
||||
}
|
||||
|
||||
//set total choices
|
||||
let totalChoices = (tech.isDeterminism ? 1 : 3) + tech.extraChoices + (m.fieldUpgrades[m.fieldMode].name === "pilot wave")
|
||||
let totalChoices = (tech.isDeterminism ? 1 : 3 + tech.extraChoices + (m.fieldUpgrades[m.fieldMode].name === "pilot wave"))
|
||||
if (tech.isFlipFlopChoices) totalChoices += tech.isRelay ? (tech.isFlipFlopOn ? -1 : 7) : (tech.isFlipFlopOn ? 7 : -1) //flip the order for relay
|
||||
if (optionLengthNoDuplicates < totalChoices + 1) { //if not enough options for all the choices
|
||||
// console.log('if not enough options for all the choices')
|
||||
totalChoices = optionLengthNoDuplicates
|
||||
if (tech.isBanish) { //when you run out of options eject banish
|
||||
for (let i = 0, len = tech.tech.length; i < len; i++) {
|
||||
if (tech.tech[i].name === "decoherence") {
|
||||
// console.log(i)
|
||||
powerUps.ejectTech(i, true)
|
||||
}
|
||||
if (tech.tech[i].name === "decoherence") powerUps.ejectTech(i, true)
|
||||
}
|
||||
simulation.makeTextLog(`decoherence <span class='color-var'>tech</span> ejected`)
|
||||
simulation.makeTextLog(`options reset`)
|
||||
@@ -950,15 +941,10 @@ const powerUps = {
|
||||
tech.tooManyTechChoices = false
|
||||
totalChoices = optionLengthNoDuplicates
|
||||
}
|
||||
//check for tech that were a choice last time and remove them
|
||||
if (optionLengthNoDuplicates > totalChoices) {
|
||||
// console.log('check for tech that were a choice last time and remove them', optionLengthNoDuplicates, options.length)
|
||||
if (optionLengthNoDuplicates > totalChoices) { //check for tech that were a choice last time and remove them
|
||||
for (let i = 0; i < tech.tech.length; i++) {
|
||||
if (optionLengthNoDuplicates > totalChoices) {
|
||||
if (tech.tech[i].isRecentlyShown) {
|
||||
// console.log(i)
|
||||
removeOption(i)
|
||||
}
|
||||
if (tech.tech[i].isRecentlyShown) removeOption(i)
|
||||
} else {
|
||||
break //you have to repeat choices if there are not enough choices left to display
|
||||
}
|
||||
@@ -966,42 +952,42 @@ const powerUps = {
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < tech.tech.length; i++) tech.tech[i].isRecentlyShown = false //reset recently shown back to zero
|
||||
// powerUps.tech.lastTotalChoices = options.length //this is recorded so that banish can know how many tech were available
|
||||
// console.log(optionLengthNoDuplicates, options.length)
|
||||
if (options.length > 0) {
|
||||
let text = ""
|
||||
if (totalChoices === 2) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px 384px"
|
||||
text += powerUps.researchText('tech')
|
||||
text += powerUps.cancelText('tech')
|
||||
} else if (totalChoices === 1) {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px"
|
||||
text += powerUps.cancelText('tech')
|
||||
text += powerUps.researchText('tech')
|
||||
} else {
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px 384px 384px"
|
||||
text += "<div></div>"
|
||||
text += powerUps.researchText('tech')
|
||||
text += powerUps.cancelText('tech')
|
||||
}
|
||||
for (let i = 0; i < totalChoices; i++) {
|
||||
if (options.length < 1) break
|
||||
const choose = options[Math.floor(Math.seededRandom(0, options.length))] //pick an element from the array of options
|
||||
|
||||
if (tech.isBanish) {
|
||||
tech.tech[choose].isBanished = true
|
||||
if (i === 0) simulation.makeTextLog(`options.length = ${optionLengthNoDuplicates}`)
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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)` : "";
|
||||
if (tech.tech[choose].isFieldTech) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<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>
|
||||
${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() :tech.tech[choose].description}</div></div>`
|
||||
text += powerUps.fieldTechText(choose, `powerUps.choose('tech',${choose})`)
|
||||
} else if (tech.tech[choose].isGunTech) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<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>
|
||||
${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() :tech.tech[choose].description}</div></div>`
|
||||
} else if (tech.tech[choose].isLore) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title lore-text"><div class="circle-grid lore"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
text += powerUps.gunTechText(choose, `powerUps.choose('tech',${choose})`)
|
||||
// } else if (tech.tech[choose].isLore) {
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title lore-text"><div class="circle-grid lore"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
} else if (tech.tech[choose].isJunk) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"><div class="circle-grid junk"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
} else {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
text += powerUps.junkTechText(choose, `powerUps.choose('tech',${choose})`)
|
||||
} else { //normal tech
|
||||
text += powerUps.techText(choose, `powerUps.choose('tech',${choose})`)
|
||||
}
|
||||
if (options.length < 1) break
|
||||
}
|
||||
@@ -1011,9 +997,16 @@ const powerUps = {
|
||||
if (tech.tech[i].isBotTech && tech.tech[i].count < tech.tech[i].maxCount && tech.tech[i].allowed() && !tech.tech[i].isRecentlyShown) botTech.push(i)
|
||||
}
|
||||
if (botTech.length > 0) { //pick random bot tech
|
||||
// const choose = botTech[Math.floor(Math.random() * botTech.length)];
|
||||
// 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 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 techCountText = tech.tech[choose].count > 1 ? `(${tech.tech[choose].count}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">
|
||||
<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} ${techCountText}</div>
|
||||
${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div></div>`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1024,14 +1017,16 @@ const powerUps = {
|
||||
if (!b.guns[i].have) gunOptions.push(i);
|
||||
}
|
||||
const pick = gunOptions[Math.floor(Math.seededRandom(0, gunOptions.length))] //pick an element from the array of options
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${pick})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[pick].name}</div> ${b.guns[pick].description}</div>`
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${pick})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[pick].name}</div> ${b.guns[pick].description}</div>`
|
||||
text += powerUps.gunText(pick, `powerUps.choose('gun',${pick})`)
|
||||
} else {
|
||||
let fieldOptions = [];
|
||||
for (let i = 1; i < m.fieldUpgrades.length; i++) { //skip field emitter
|
||||
if (i !== m.fieldMode) fieldOptions.push(i);
|
||||
}
|
||||
const pick = fieldOptions[Math.floor(Math.seededRandom(0, fieldOptions.length))] //pick an element from the array of options
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${pick})"><div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[pick].name}</div> ${m.fieldUpgrades[pick].description}</div>`
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${pick})"><div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[pick].name}</div> ${m.fieldUpgrades[pick].description}</div>`
|
||||
text += powerUps.fieldText(pick, `powerUps.choose('field',${pick})`)
|
||||
}
|
||||
}
|
||||
if (tech.isMicroTransactions && powerUps.research.count > 0) {
|
||||
@@ -1063,18 +1058,6 @@ const powerUps = {
|
||||
}
|
||||
requestAnimationFrame(cycle);
|
||||
}
|
||||
//add in research button or pseudoscience button
|
||||
if (tech.isJunkResearch && powerUps.research.currentRerollCount < 3) {
|
||||
tech.junkResearchNumber = Math.ceil(4 * Math.random())
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.research.use('tech')"><div class="grid-title"> <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;"></div>`
|
||||
text += `</span> <span class='research-select'>pseudoscience</span></div></div>`
|
||||
} else if (powerUps.research.count > 0) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.research.use('tech')"><div class="grid-title"> <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="position:absolute; top:0; left:${(18 - len*0.3)*i}px;opacity:0.8; border: 1px #fff solid;"></div>`
|
||||
// text += `</span> <span class='research-select'>research</span></div></div>`
|
||||
text += `</span> <span class='research-select'>${tech.isResearchReality?"<span class='alt'>alternate reality</span>": "research"}</span></div></div>`
|
||||
}
|
||||
document.getElementById("choose-grid").innerHTML = text
|
||||
powerUps.showDraft();
|
||||
|
||||
@@ -1094,52 +1077,50 @@ const powerUps = {
|
||||
entanglement: {
|
||||
name: "entanglement",
|
||||
color: "#fff", //"hsl(248,100%,65%)",
|
||||
size() { return 40 },
|
||||
size() {
|
||||
return 40
|
||||
},
|
||||
effect() {
|
||||
if (m.alive && localSettings.entanglement) {
|
||||
let text = ""
|
||||
text += `<div class='cancel' onclick='powerUps.endDraft("tech")'>✕</div>`
|
||||
text += `<h3 style = 'color:#fff; text-align:left; margin: 0px;'>entanglement</h3>`
|
||||
document.getElementById("choose-grid").style.gridTemplateColumns = "384px 384px 384px"
|
||||
// text += powerUps.researchText('tech')
|
||||
text += "<div></div>"
|
||||
text += "<div class='choose-grid-module entanglement flipX'>entanglement</div>"
|
||||
text += `<div class='choose-grid-module' onclick='powerUps.endDraft("tech",true)' style="width: 82px; text-align: center;font-size: 1.1em;font-weight: 100;justify-self: end;">cancel</div>` //powerUps.cancelText('tech')
|
||||
if (localSettings.entanglement.fieldIndex) {
|
||||
const field = localSettings.entanglement.fieldIndex //add field
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('field',${field})"><div class="grid-title"><div class="circle-grid field"></div> ${m.fieldUpgrades[field].name}</div> ${m.fieldUpgrades[field].description}</div>`
|
||||
const choose = localSettings.entanglement.fieldIndex //add field
|
||||
text += powerUps.fieldText(choose, `powerUps.choose('field',${choose})`)
|
||||
}
|
||||
for (let i = 0; i < localSettings.entanglement.gunIndexes.length; i++) { //add guns
|
||||
const gun = localSettings.entanglement.gunIndexes[i]
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${gun})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[gun].name}</div> ${b.guns[gun].description}</div>`
|
||||
const choose = localSettings.entanglement.gunIndexes[i]
|
||||
// text += `<div class="choose-grid-module" onclick="powerUps.choose('gun',${gun})"><div class="grid-title"><div class="circle-grid gun"></div> ${b.guns[gun].name}</div> ${b.guns[gun].description}</div>`
|
||||
text += powerUps.gunText(choose, `powerUps.choose('gun',${choose})`)
|
||||
}
|
||||
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)` : "";
|
||||
|
||||
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%;">- incompatible</span></div></div>`
|
||||
// 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>`
|
||||
text += powerUps.incoherentTechText(choose)
|
||||
} else {
|
||||
if (tech.tech[choose].isFieldTech) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<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>
|
||||
${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() :tech.tech[choose].description}</div></div>`
|
||||
text += powerUps.fieldTechText(choose, `powerUps.choose('tech',${choose})`)
|
||||
} else if (tech.tech[choose].isGunTech) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title">
|
||||
<span style="position:relative;">
|
||||
<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>
|
||||
${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() :tech.tech[choose].description}</div></div>`
|
||||
text += powerUps.gunTechText(choose, `powerUps.choose('tech',${choose})`)
|
||||
} else if (tech.tech[choose].isLore) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title lore-text"><div class="circle-grid lore"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
} else if (tech.tech[choose].isJunk) {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"><div class="circle-grid junk"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
} else {
|
||||
text += `<div class="choose-grid-module" onclick="powerUps.choose('tech',${choose})"><div class="grid-title"><div class="circle-grid tech"></div> ${tech.tech[choose].name} ${isCount}</div>${tech.tech[choose].descriptionFunction ? tech.tech[choose].descriptionFunction() : tech.tech[choose].description}</div>`
|
||||
text += powerUps.junkTechText(choose, `powerUps.choose('tech',${choose})`)
|
||||
} else { //normal tech
|
||||
text += powerUps.techText(choose, `powerUps.choose('tech',${choose})`)
|
||||
}
|
||||
}
|
||||
}
|
||||
// document.getElementById("choose-grid").classList.add("flipX");
|
||||
document.getElementById("choose-grid").innerHTML = text
|
||||
powerUps.showDraft();
|
||||
|
||||
localSettings.entanglement = undefined
|
||||
if (localSettings.isAllowed) localStorage.setItem("localSettings", JSON.stringify(localSettings)); //update local storage
|
||||
}
|
||||
@@ -1152,7 +1133,10 @@ const powerUps = {
|
||||
if (m.alive) requestAnimationFrame(cycle);
|
||||
if (!simulation.paused && !simulation.isChoosing) { //&& !(simulation.cycle % 2)
|
||||
count--
|
||||
const where = { x: m.pos.x + 50 * (Math.random() - 0.5), y: m.pos.y + 50 * (Math.random() - 0.5) }
|
||||
const where = {
|
||||
x: m.pos.x + 50 * (Math.random() - 0.5),
|
||||
y: m.pos.y + 50 * (Math.random() - 0.5)
|
||||
}
|
||||
powerUps.spawn(where.x, where.y, type);
|
||||
}
|
||||
}
|
||||
@@ -1167,7 +1151,10 @@ const powerUps = {
|
||||
if (tech.isLaserMine && input.down) {
|
||||
b.laserMine(who.position)
|
||||
} else {
|
||||
b.mine(who.position, { x: 0, y: 0 }, 0)
|
||||
b.mine(who.position, {
|
||||
x: 0,
|
||||
y: 0
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
if (tech.isRelay) {
|
||||
@@ -1276,7 +1263,7 @@ const powerUps = {
|
||||
}
|
||||
},
|
||||
addResearchToLevel() { //add a random power up to a location that has a mob, mostly used to give each level one randomly placed research
|
||||
if (mob.length && Math.random() < 0.5 - 0.3 && simulation.difficultyMode < 5) { //lower chance on why difficulty
|
||||
if (mob.length && Math.random() < 0.45 - 0.3 * (simulation.difficultyMode > 5)) { //lower chance on why difficulty
|
||||
const index = Math.floor(Math.random() * mob.length)
|
||||
powerUps.spawn(mob[index].position.x, mob[index].position.y, "research");
|
||||
}
|
||||
@@ -1415,8 +1402,7 @@ const powerUps = {
|
||||
spawn(x, y, target, moving = true, mode = null, size = powerUps[target].size()) {
|
||||
if (
|
||||
(!tech.isSuperDeterminism || (target !== 'research')) &&
|
||||
!(tech.isEnergyNoAmmo && target === 'ammo') &&
|
||||
(!simulation.isNoPowerUps)
|
||||
!(tech.isEnergyNoAmmo && target === 'ammo')
|
||||
) {
|
||||
if (tech.isBoostReplaceAmmo && target === 'ammo') target = 'boost'
|
||||
powerUps.directSpawn(x, y, target, moving, mode, size)
|
||||
|
||||
Reference in New Issue
Block a user