Browse Source

- Work on the counte tracking in the plan when marking as caught

master
Quildra 1 year ago
parent
commit
7e7476abc8
  1. 38
      Site/templates/index.html

38
Site/templates/index.html

@ -550,7 +550,7 @@
<div class="catch-count-container">
<img src="{{ url_for('static', filename='images/pokeball_color.png') }}"
alt="Catch count"
class="catch-count-pokeball grayscale"
class="catch-count-pokeball"
data-pfic="{{ pokemon.pfic }}">
<span class="catch-count">{{ pokemon.catch_count }}</span>
</div>
@ -565,7 +565,7 @@
<div class="pokemon-targets-grid">
{% if pokemon.evolve_to %}
{% for evolution in pokemon.evolve_to %}
<div class="target-card">
<div class="target-card" data-pfic="{{ evolution.pfic }}">
<div class="target-name">
{{ evolution.name }}
{% if evolution.form_name %}({{ evolution.form_name }}){% endif %}
@ -581,7 +581,7 @@
{% if pokemon.breed_for %}
{% for breeding in pokemon.breed_for %}
<div class="target-card">
<div class="target-card" data-pfic="{{ breeding.pfic }}">
<div class="target-name">
{{ breeding.name }}
{% if breeding.form_name %}({{ breeding.form_name }}){% endif %}
@ -742,9 +742,6 @@
count += isCaught ? -1 : 1;
catchCount.textContent = count;
const pokeball = entry.querySelector('.catch-count-pokeball');
pokeball.classList.toggle('grayscale', count === 0);
updateGameTotal(entry, isCaught);
}
@ -872,15 +869,26 @@
.then(response => response.json())
.then(caught => {
caught.forEach(pfic => {
const pokeball = document.querySelector(`.pokeball-icon[data-pfic="${pfic}"]`);
if (pokeball) {
pokeball.classList.remove('grayscale');
}
const planPokeball = document.querySelector(`.catch-count-pokeball[data-pfic="${pfic}"]`);
if (planPokeball) {
planPokeball.classList.remove('grayscale');
}
// Update efficiency plan counts for caught Pokemon
const planTab = document.getElementById('efficiency-tab');
planTab.querySelectorAll('.pokemon-entry').forEach(entry => {
// Check if this Pokemon is part of any evolution/breeding group
const targetCards = entry.querySelectorAll('.target-card');
targetCards.forEach(card => {
if (card.dataset.pfic === pfic) {
// Found as an evolution/breeding target - update parent's catch count
const catchCount = entry.querySelector('.catch-count');
let count = parseInt(catchCount.textContent);
if (count > 0) {
count -= 1;
catchCount.textContent = count;
}
// Update game total
updateGameTotal(entry, true);
}
});
});
});
});
});

Loading…
Cancel
Save