updated helmets.json

This commit is contained in:
Frederik Palmø 2022-03-20 18:27:20 +01:00
parent 13c45f2b9b
commit ade1c99b70
3 changed files with 1376 additions and 1352 deletions

View File

@ -36,9 +36,14 @@
<hr> <hr>
<li> <li>
<label for="equip-load"><b>Max. Equip Load</b></label> <label for="max-equip-load"><b>Max. Equip Load</b></label>
<input style="max-width: 50px" class="stat" id="equip-load" type="number" onchange="update()" <input style="max-width: 50px" class="stat" id="max-equip-load" type="number"
min=0 step=0.1 value="30"> onchange="update()" min=0 step=0.1 value=30>
</li>
<li>
<label for="current-equip-load"><b>Current Equip Load</b></label>
<input style="max-width: 50px" class="stat" id="current-equip-load" type="number"
onchange="update()" min=0 step=0.1 value=0>
</li> </li>
<hr> <hr>
@ -71,7 +76,14 @@
<hr> <hr>
<li> <li>
<b>Sorting</b> <b>Sort by</b>
</li>
<li>
<div>
<input type="radio" id="greatest-average" name="sorting-order" onclick="update()">
<label for="greatest-average">Greatest Average Defense</label>
</div>
</li> </li>
<li> <li>
@ -95,13 +107,6 @@
</div> </div>
</li> </li>
<li>
<div>
<input type="radio" id="greatest-average" name="sorting-order" onclick="update()">
<label for="greatest-average">Greatest Weighted Average Defense</label>
</div>
</li>
<hr> <hr>
<li> <li>

View File

@ -1,4 +1,5 @@
[ {
"helmets": [
{ {
"id": "alberichs-pointed-hat", "id": "alberichs-pointed-hat",
"name": "Alberich's Pointed Hat", "name": "Alberich's Pointed Hat",
@ -1326,3 +1327,4 @@
"weight": 3.2 "weight": 3.2
} }
] ]
}

View File

@ -15,25 +15,42 @@ const LEGGINGS = fetch("/data/armor.json")
.then(data => data.leggings) .then(data => data.leggings)
.catch(error => console.log(error)); .catch(error => console.log(error));
async function init() { let sortedHelmets;
let sortedChestplates;
let sortedGauntlets;
let sortedLeggings;
const SortingMethod = {
AVERAGE,
PHYSICAL,
ELEMENTAL,
IMMUNITIES,
};
async function init() {
// precompute and sort list of armor pieces
} }
async function update() { async function update() {
let sorted = sortedCandidates(); let sorted = sortedCombinations();
} }
function sortedCandidates() { function updateSortingMethod() {
// determine how to sort update();
// get most likely candidates
let candidates = findCandidates();
// sort candidates
return candidates;
} }
function findCandidates() { function fitness(item, order) {
return []; // return fitness of item based on given order
switch (order) {
case SortingMethod.AVERAGE:
return item.defenses.reduce((total, value) => total + value, 0) / item.defenses.length;
case SortingMethod.PHYSICAL:
break;
case SortingMethod.ELEMENTAL:
break;
case SortingMethod.IMMUNITIES:
break;
default:
console.log("error pls fix");
}
} }