Browse Source

- Update for the top level pokemon double dipping

master
Dan 1 year ago
parent
commit
c27d48d364
  1. 12
      Site/templates/index.html

12
Site/templates/index.html

@ -802,17 +802,17 @@
// Update for evolution targets // Update for evolution targets
entry.querySelectorAll('.target-card').forEach(card => { entry.querySelectorAll('.target-card').forEach(card => {
if (card.dataset.pfic === pfic) { if (card.dataset.pfic === pfic) {
updateTargetDisplay(card, entry, isCaught); updateTargetDisplay(card, entry, isCaught, pfic);
} }
}); });
// Update for direct matches // Update for direct matches
if (entry.dataset.pfic === pfic) { if (entry.dataset.pfic === pfic) {
updateEntryDisplay(entry, isCaught); updateEntryDisplay(entry, isCaught, pfic);
} }
}); });
} }
function updateEntryDisplay(entry, isCaught) { function updateEntryDisplay(entry, isCaught, pfic) {
const catchCount = entry.querySelector('.catch-count'); const catchCount = entry.querySelector('.catch-count');
const targetCards = entry.querySelectorAll('.target-card'); const targetCards = entry.querySelectorAll('.target-card');
let totalNeeded = 0; let totalNeeded = 0;
@ -836,7 +836,7 @@
} }
}); });
if (isCaught) { if (isCaught && pfic == entry.dataset.pfic) {
initialCount -= 1; initialCount -= 1;
} }
@ -862,10 +862,10 @@
updateGameTotal(entry, isCaught); updateGameTotal(entry, isCaught);
} }
function updateTargetDisplay(card, parentEntry, isCaught) { function updateTargetDisplay(card, parentEntry, isCaught, pfic) {
const targetImage = card.querySelector('.target-image'); const targetImage = card.querySelector('.target-image');
targetImage.classList.toggle('grayscale', isCaught); targetImage.classList.toggle('grayscale', isCaught);
updateEntryDisplay(parentEntry, isCaught); updateEntryDisplay(parentEntry, isCaught, pfic);
} }
function updateGameTotal(entry, isCaught) { function updateGameTotal(entry, isCaught) {

Loading…
Cancel
Save