|
|
|
@ -62,11 +62,11 @@ interface PokemonStatusEvent { |
|
|
|
<div class="catch-info"> |
|
|
|
<img |
|
|
|
src="/assets/images/pokeball_color.png" |
|
|
|
[class.grayscale]="pokemon_family.catch_count === 0" |
|
|
|
[class.grayscale]="this.catch_count === 0" |
|
|
|
class="pokeball-icon" |
|
|
|
[matTooltip]="'Need: ' + pokemon_family.catch_count" |
|
|
|
[matTooltip]="'Need: ' + this.catch_count" |
|
|
|
> |
|
|
|
<span class="catch-count">{{ pokemon_family.catch_count }}</span> |
|
|
|
<span class="catch-count">{{ this.catch_count }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -169,6 +169,7 @@ export class PlanPokemonV2Component { |
|
|
|
@Output() familySelected = new EventEmitter<PokemonFamilyEntry>(); |
|
|
|
|
|
|
|
representative_pokemon: Pokemon | null = null; |
|
|
|
catch_count = 0; |
|
|
|
|
|
|
|
constructor( |
|
|
|
public pokemonService: PokemonService, |
|
|
|
@ -178,6 +179,7 @@ export class PlanPokemonV2Component { |
|
|
|
ngOnInit() { |
|
|
|
this.representative_pokemon = null; |
|
|
|
this.handlePokemonFamilyChange(this.pokemon_family); |
|
|
|
this.catch_count = this.pokemon_family.catch_count; |
|
|
|
} |
|
|
|
|
|
|
|
ngOnChanges(changes: SimpleChanges) { |
|
|
|
@ -209,6 +211,9 @@ export class PlanPokemonV2Component { |
|
|
|
this.cdr.markForCheck(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
this.updateCatchCount(); |
|
|
|
this.cdr.markForCheck(); |
|
|
|
} |
|
|
|
|
|
|
|
get hasTargets(): boolean { |
|
|
|
@ -219,26 +224,6 @@ export class PlanPokemonV2Component { |
|
|
|
return this.pokemonService.isTargetCompleted(pfic); |
|
|
|
} |
|
|
|
|
|
|
|
calculateTotalNeeded(): number { |
|
|
|
let total = 1; // Initial catch
|
|
|
|
let breedCount = 0; |
|
|
|
let evolveCount = 0; |
|
|
|
|
|
|
|
// Calculate breeding needs
|
|
|
|
if (this.pokemon_family.breed_for.length > 0) { |
|
|
|
breedCount = 1; // We only need one for breeding, regardless of how many we breed
|
|
|
|
} |
|
|
|
|
|
|
|
// Calculate evolution needs
|
|
|
|
this.pokemon_family.evolve_to.forEach(target => { |
|
|
|
if (!this.isTargetCompleted(target)) { |
|
|
|
evolveCount += 1; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return total + breedCount + evolveCount; |
|
|
|
} |
|
|
|
|
|
|
|
calculateTotalCaught(): number { |
|
|
|
let count = 0; |
|
|
|
|
|
|
|
@ -265,24 +250,8 @@ export class PlanPokemonV2Component { |
|
|
|
|
|
|
|
updateCatchCount() { |
|
|
|
const newCount = this.calculateTotalCaught(); |
|
|
|
if (newCount !== this.pokemon_family.catch_count) { |
|
|
|
this.pokemon_family.catch_count = newCount; |
|
|
|
if (newCount === 0) { |
|
|
|
// Emit event to move to completed section
|
|
|
|
this.statusUpdate.emit({ |
|
|
|
pfic: this.pokemon_family.representative, |
|
|
|
caught: true, |
|
|
|
completed: true |
|
|
|
}); |
|
|
|
} else if (newCount > 0 && this.pokemon_family.catch_count === 0) { |
|
|
|
// Emit event to move back to active section
|
|
|
|
this.statusUpdate.emit({ |
|
|
|
pfic: this.pokemon_family.representative, |
|
|
|
caught: false, |
|
|
|
completed: false |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
this.catch_count = this.pokemon_family.catch_count - newCount; |
|
|
|
console.log(this.catch_count) |
|
|
|
} |
|
|
|
|
|
|
|
getRepresentativePokemon() { |
|
|
|
|