custom mode UI improvements

This commit is contained in:
landgreen
2020-01-12 18:19:14 -08:00
parent 2e14106d48
commit a4a2a83412
3 changed files with 35 additions and 22 deletions

View File

@@ -276,7 +276,7 @@ const b = {
maxCount: 4, maxCount: 4,
count: 0, count: 0,
effect() { effect() {
b.modEnergySiphon += 0.18; b.modEnergySiphon += 0.15;
mech.fieldMeter = mech.fieldEnergyMax mech.fieldMeter = mech.fieldEnergyMax
} }
}, },
@@ -328,6 +328,15 @@ const b = {
mech.fieldMeter = mech.fieldEnergyMax mech.fieldMeter = mech.fieldEnergyMax
} }
}, },
{
name: "quantum immortality", //28
description: "after <strong>dying</strong>, continue in an <strong>alternate reality</strong><br><em>guns, ammo, field, and mods are randomized</em>",
maxCount: 1,
count: 0,
effect() {
b.isModImmortal = true;
}
},
{ {
name: "+1 cardinality", //24 name: "+1 cardinality", //24
description: "one extra <strong>choice</strong> when selecting <strong>power ups</strong>", description: "one extra <strong>choice</strong> when selecting <strong>power ups</strong>",
@@ -359,15 +368,6 @@ const b = {
//have state is checked in mech.death() //have state is checked in mech.death()
} }
}, },
{
name: "quantum immortality", //28
description: "after <strong>dying</strong>, continue in an <strong>alternate reality</strong><br><em>guns, ammo, field, and mods are randomized</em>",
maxCount: 1,
count: 0,
effect() {
b.isModImmortal = true;
}
},
], ],
giveMod(index = 'random') { giveMod(index = 'random') {
if (index === 'random') { if (index === 'random') {

View File

@@ -2,12 +2,15 @@
/* TODO: ******************************************* /* TODO: *******************************************
***************************************************** *****************************************************
show difficulty increase text in custom mode
chart showing info about each mob type
can use css-grid chart like custom mod
add setting for random drops instead of choosing add setting for random drops instead of choosing
rework custom mode custom mode
custom mode grey out mods that are bad, like selection based mods custom mode grey out mods that are bad, like selection based mods
enable recursive mods
remove 5 mod cap on custom mode
change nail-bot's movement change nail-bot's movement
maybe have it move in a circle around player? maybe have it move in a circle around player?
@@ -158,12 +161,14 @@ const build = {
list: [], list: [],
choosePowerUp(who, index, type) { choosePowerUp(who, index, type) {
if (type === "field" || type === "gun") { if (type === "field" || type === "gun") {
let isDeselect = false
//if already click, toggle off //if already click, toggle off
for (let i = 0; i < build.list.length; i++) { for (let i = 0; i < build.list.length; i++) {
if (build.list[i].index === index && build.list[i].type === type) { if (build.list[i].index === index && build.list[i].type === type) {
build.list.splice(i, 1); build.list.splice(i, 1);
who.style.backgroundColor = "#fff" who.style.backgroundColor = "#fff"
return isDeselect = true
break
} }
} }
//check if trying to get a second field //check if trying to get a second field
@@ -175,11 +180,13 @@ const build = {
} }
} }
} }
who.style.backgroundColor = "#919ba8" //"#868f9a" if (!isDeselect) {
build.list[build.list.length] = { who.style.backgroundColor = "#919ba8" //"#868f9a"
who: who, build.list[build.list.length] = {
index: index, who: who,
type: type, index: index,
type: type,
}
} }
} else if (type === "mod") { } else if (type === "mod") {
if (who.style.backgroundColor !== "#919ba8") who.style.backgroundColor = "#919ba8" //"#868f9a" if (who.style.backgroundColor !== "#919ba8") who.style.backgroundColor = "#919ba8" //"#868f9a"
@@ -212,6 +219,8 @@ const build = {
who.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${b.mods[index].name}</div> ${b.mods[index].description}` who.innerHTML = `<div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${b.mods[index].name}</div> ${b.mods[index].description}`
} }
} }
document.title = `effective starting level: ${build.list.length * game.difficultyMode}`
// document.getElementById("starting-level").innerHTML = `effective starting level: ${build.list.length * game.difficultyMode}`
}, },
removeMod(index) { removeMod(index) {
for (let i = build.list.length - 1; i > -1; i--) { for (let i = build.list.length - 1; i > -1; i--) {
@@ -256,7 +265,7 @@ document.getElementById("build-button").addEventListener("click", () => {
</g> </g>
</svg> </svg>
</div> </div>
<div class="build-grid-module" style="font-size: 1.00em; line-height: 175%;"> <div id ="starting-level" class="build-grid-module" style="font-size: 1.00em; line-height: 175%;">
each power up you select will increase the starting level by one each power up you select will increase the starting level by one
</div>` </div>`
for (let i = 1, len = mech.fieldUpgrades.length; i < len; i++) { for (let i = 1, len = mech.fieldUpgrades.length; i < len; i++) {
@@ -266,7 +275,11 @@ document.getElementById("build-button").addEventListener("click", () => {
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="grid-title"><div class="circle-grid gun"></div> &nbsp; ${b.guns[i].name}</div> ${b.guns[i].description}</div>` text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'gun')"><div class="grid-title"><div class="circle-grid gun"></div> &nbsp; ${b.guns[i].name}</div> ${b.guns[i].description}</div>`
} }
for (let i = 0, len = b.mods.length; i < len; i++) { for (let i = 0, len = b.mods.length; i < len; i++) {
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${b.mods[i].name}</div> ${b.mods[i].description}</div>` if (b.mods[i].name === "Born rule" || b.mods[i].name === "Bayesian inference" || b.mods[i].name === "+1 cardinality") {
text += `<div class="build-grid-module" style="opacity:0.3;"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
} else {
text += `<div class="build-grid-module" onclick="build.choosePowerUp(this,${i},'mod')"><div class="grid-title"><div class="circle-grid mod"></div> &nbsp; ${b.mods[i].name}</div> ${b.mods[i].description}</div>`
}
} }
el.innerHTML = text el.innerHTML = text
el.style.display = "grid" el.style.display = "grid"

View File

@@ -940,7 +940,7 @@ const spawn = {
me.leaveBody = false; me.leaveBody = false;
// me.dropPowerUp = false; // me.dropPowerUp = false;
me.onDeath = function () { //run this function on death me.onDeath = function () { //run this function on death
for (let i = 0; i < Math.ceil(this.mass * 0.2 + Math.random() * 3); ++i) { for (let i = 0; i < Math.ceil(this.mass * 0.15 + Math.random() * 2.5); ++i) {
spawn.spawns(this.position.x + (Math.random() - 0.5) * radius * 2.5, this.position.y + (Math.random() - 0.5) * radius * 2.5); spawn.spawns(this.position.x + (Math.random() - 0.5) * radius * 2.5, this.position.y + (Math.random() - 0.5) * radius * 2.5);
Matter.Body.setVelocity(mob[mob.length - 1], { Matter.Body.setVelocity(mob[mob.length - 1], {
x: this.velocity.x + (Math.random() - 0.5) * 15, x: this.velocity.x + (Math.random() - 0.5) * 15,