Merge pull request 'feature/fix-bestiary-xp-bonus-bp-tier' (#9) from feature/fix-bestiary-xp-bonus-bp-tier into main

Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
2026-06-13 20:40:42 -04:00
2 changed files with 35 additions and 21 deletions
+26 -4
View File
@@ -27,7 +27,7 @@
8: { hp: 2.00, atp: 1.08, exp: 2.00 }, 8: { hp: 2.00, atp: 1.08, exp: 2.00 },
9: { hp: 2.50, atp: 1.09, exp: 2.50 }, 9: { hp: 2.50, atp: 1.09, exp: 2.50 },
10: { hp: 3.00, atp: 1.10, exp: 3.00 }, 10: { hp: 3.00, atp: 1.10, exp: 3.00 },
11: { hp: 4.00, atp: 1.10, exp: null }, 11: { hp: 4.00, atp: 1.10, exp: 3.00 },
}; };
const COLUMN_GROUPS = { const COLUMN_GROUPS = {
@@ -148,13 +148,25 @@
} }
function bpTier() { function bpTier() {
const tier = Number(qs("#bestiary-bp-tier")?.value || 0); const select = qs("#bestiary-tier");
const raw = String(select?.value || "");
const label = String(select?.selectedOptions?.[0]?.textContent || "");
const match = raw.match(/(\d+)$/) || label.match(/(\d+)/);
const tier = match ? Number(match[1]) : 0;
return BP_TIERS[tier] || BP_TIERS[0]; return BP_TIERS[tier] || BP_TIERS[0];
} }
function xpBonusMultiplier() {
return Number(qs("#bestiary-xp-bonus")?.value || 1);
}
function displayValue(row, key) { function displayValue(row, key) {
const value = row[key]; const value = row[key];
if (key === "exp" && row.difficulty !== "Ultimate") {
return Math.round(Number(value || 0) * xpBonusMultiplier());
}
if (row.difficulty !== "Ultimate") { if (row.difficulty !== "Ultimate") {
return value ?? ""; return value ?? "";
} }
@@ -170,16 +182,22 @@
} }
if (key === "exp" && tier.exp !== null) { if (key === "exp" && tier.exp !== null) {
return Math.round(Number(value || 0) * tier.exp); return Math.round(Number(value || 0) * tier.exp * xpBonusMultiplier());
} }
return value ?? ""; return value ?? "";
} }
function hasAnyBestiaryValue(row) {
const keys = ["hp", "atp", "dfp", "mst", "ata", "evp", "lck", "esp", "exp", "efr", "eic", "eth", "elt", "edk"];
return keys.some((key) => Number(row[key] || 0) !== 0);
}
function visibleRows() { function visibleRows() {
const search = state.filters.search.trim().toLowerCase(); const search = state.filters.search.trim().toLowerCase();
return state.rows.filter((row) => { return state.rows.filter((row) => {
if (!hasAnyBestiaryValue(row)) return false;
if (state.filters.mode && row.mode !== state.filters.mode) return false; if (state.filters.mode && row.mode !== state.filters.mode) return false;
if (state.filters.episode && row.episode !== state.filters.episode) return false; if (state.filters.episode && row.episode !== state.filters.episode) return false;
if (state.filters.difficulty && row.difficulty !== state.filters.difficulty) return false; if (state.filters.difficulty && row.difficulty !== state.filters.difficulty) return false;
@@ -332,11 +350,15 @@
renderTable(); renderTable();
}); });
qs("#bestiary-bp-tier")?.addEventListener("change", () => { qs("#bestiary-tier")?.addEventListener("change", () => {
state.page = 1; state.page = 1;
renderTable(); renderTable();
}); });
qs("#bestiary-xp-bonus")?.addEventListener("change", () => {
renderTable();
});
qs("#bestiary-placeholder")?.addEventListener("click", (event) => { qs("#bestiary-placeholder")?.addEventListener("click", (event) => {
const pageButton = event.target.closest("[data-bestiary-page]"); const pageButton = event.target.closest("[data-bestiary-page]");
if (pageButton) { if (pageButton) {
+9 -17
View File
@@ -51,22 +51,13 @@
<option value="">All difficulties</option> <option value="">All difficulties</option>
</select> </select>
<label for="bestiary-bp-tier">BP Tier</label> <label for="bestiary-xp-bonus">XP Bonus</label>
<select id="bestiary-bp-tier"> <select id="bestiary-xp-bonus">
<option value="0">No modifier</option> <option value="1">No modifier</option>
<option value="1">Brutal Peeps +1</option> <option value="5">5x</option>
<option value="2">Brutal Peeps +2</option> <option value="10">10x</option>
<option value="3">Brutal Peeps +3</option>
<option value="4">Brutal Peeps +4</option>
<option value="5">Brutal Peeps +5</option>
<option value="6">Brutal Peeps +6</option>
<option value="7">Brutal Peeps +7</option>
<option value="8">Brutal Peeps +8</option>
<option value="9">Brutal Peeps +9</option>
<option value="10">Brutal Peeps +10</option>
<option value="11">Brutal Peeps +11</option>
</select> </select>
<p class="drops-field-note">Applies HP, ATP, and EXP modifiers to Ultimate rows only.</p> <p class="drops-field-note">Applies EXP multiplier only.</p>
<label for="bestiary-view">View</label> <label for="bestiary-view">View</label>
<select id="bestiary-view"> <select id="bestiary-view">
@@ -80,7 +71,8 @@
<label for="bestiary-tier" data-bestiary-tier-wrap>BP Tier</label> <label for="bestiary-tier" data-bestiary-tier-wrap>BP Tier</label>
<select id="bestiary-tier" data-bestiary-tier-wrap> <select id="bestiary-tier" data-bestiary-tier-wrap>
<option>BP+1</option><option>BP+2</option><option>BP+3</option>
<option value="0">No modifier</option><option>BP+1</option><option>BP+2</option><option>BP+3</option>
<option>BP+4</option><option>BP+5</option><option>BP+6</option> <option>BP+4</option><option>BP+5</option><option>BP+6</option>
<option>BP+7</option><option>BP+8</option><option>BP+9</option> <option>BP+7</option><option>BP+8</option><option>BP+9</option>
<option>BP+10</option><option>BP+11</option> <option>BP+10</option><option>BP+11</option>
@@ -122,6 +114,6 @@
</div> </div>
</footer> </footer>
</div> </div>
<script src="bestiary-tables.js?v=bestiary-table-viewer-20260613-3" defer></script> <script src="bestiary-tables.js?v=hide-zero-bestiary-rows-1" defer></script>
</body> </body>
</html> </html>