Add skill base stat entry
This commit is contained in:
@@ -58,6 +58,7 @@ const slots = [
|
||||
...FIXED_ITEMS.map((item, i) => ({ type: "item", title: `Item ${i + 1}`, fixed: item })),
|
||||
{ type: "mount", title: "Mount" },
|
||||
...Array.from({ length: 3 }, (_, i) => ({ type: "pet", title: `Pet ${i + 1}` })),
|
||||
{ type: "skill", title: "Skill", noEffects: true },
|
||||
];
|
||||
|
||||
const $ = (selector) => document.querySelector(selector);
|
||||
@@ -86,7 +87,8 @@ function createDefaultPiece(slot, index) {
|
||||
baseDamage: slot.fixed?.baseType === "damage" ? slot.fixed.baseValue : 0,
|
||||
baseHealth: slot.fixed?.baseType === "health" ? slot.fixed.baseValue : 0,
|
||||
fixedBase: Boolean(slot.fixed),
|
||||
effects: [{ type: "", value: 1 }, { type: "", value: 1 }],
|
||||
noEffects: Boolean(slot.noEffects),
|
||||
effects: slot.noEffects ? [] : [{ type: "", value: 1 }, { type: "", value: 1 }],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -117,7 +119,8 @@ function normalizeState(candidate) {
|
||||
...(candidate?.pieces?.[index] || {}),
|
||||
baseDamage: Number(candidate?.pieces?.[index]?.baseDamage ?? (candidate?.pieces?.[index]?.baseType === "damage" ? candidate?.pieces?.[index]?.baseValue : piece.baseDamage) ?? 0),
|
||||
baseHealth: Number(candidate?.pieces?.[index]?.baseHealth ?? (candidate?.pieces?.[index]?.baseType === "health" ? candidate?.pieces?.[index]?.baseValue : piece.baseHealth) ?? 0),
|
||||
effects: [0, 1].map((effectIndex) => ({
|
||||
noEffects: piece.noEffects || Boolean(candidate?.pieces?.[index]?.noEffects),
|
||||
effects: piece.noEffects ? [] : [0, 1].map((effectIndex) => ({
|
||||
type: candidate?.pieces?.[index]?.effects?.[effectIndex]?.type || "",
|
||||
value: clampEffectValue(
|
||||
candidate?.pieces?.[index]?.effects?.[effectIndex]?.type || "",
|
||||
@@ -187,25 +190,29 @@ function renderGear() {
|
||||
}
|
||||
|
||||
const effects = node.querySelector(".effects");
|
||||
piece.effects.forEach((effect, effectIndex) => {
|
||||
const row = document.createElement("div");
|
||||
row.className = "effect-row";
|
||||
row.innerHTML = `
|
||||
<label>Effect ${effectIndex + 1}
|
||||
<select data-effect-type="${effectIndex}">
|
||||
<option value="">None</option>
|
||||
${EFFECTS.map((option) => `<option value="${option.id}">${option.label} (max ${option.cap}%)</option>`).join("")}
|
||||
</select>
|
||||
</label>
|
||||
<label>Percent
|
||||
<input data-effect-value="${effectIndex}" type="number" min="1" step="0.1" value="${effect.value}" />
|
||||
<span class="cap-hint"></span>
|
||||
</label>`;
|
||||
row.querySelector("select").value = effect.type;
|
||||
const hint = row.querySelector(".cap-hint");
|
||||
hint.textContent = effect.type ? `Cap: ${effectById(effect.type).cap}%` : "Ignored";
|
||||
effects.appendChild(row);
|
||||
});
|
||||
if (piece.noEffects) {
|
||||
effects.innerHTML = '<p class="no-effects-note">Base stats only. No effects.</p>';
|
||||
} else {
|
||||
piece.effects.forEach((effect, effectIndex) => {
|
||||
const row = document.createElement("div");
|
||||
row.className = "effect-row";
|
||||
row.innerHTML = `
|
||||
<label>Effect ${effectIndex + 1}
|
||||
<select data-effect-type="${effectIndex}">
|
||||
<option value="">None</option>
|
||||
${EFFECTS.map((option) => `<option value="${option.id}">${option.label} (max ${option.cap}%)</option>`).join("")}
|
||||
</select>
|
||||
</label>
|
||||
<label>Percent
|
||||
<input data-effect-value="${effectIndex}" type="number" min="1" step="0.1" value="${effect.value}" />
|
||||
<span class="cap-hint"></span>
|
||||
</label>`;
|
||||
row.querySelector("select").value = effect.type;
|
||||
const hint = row.querySelector(".cap-hint");
|
||||
hint.textContent = effect.type ? `Cap: ${effectById(effect.type).cap}%` : "Ignored";
|
||||
effects.appendChild(row);
|
||||
});
|
||||
}
|
||||
|
||||
grid.appendChild(node);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user