You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.4 KiB

import { Component, Input } from '@angular/core';
import { CardInfo } from '../../models/card.model';
import { SetInfo } from '../../models/setInfo.model';
import {MatBadgeModule} from '@angular/material/badge';
import { FilterService } from '../../services/filter.service';
@Component({
selector: 'app-card-display',
standalone: true,
imports: [MatBadgeModule],
templateUrl: './card-display.component.html',
styleUrl: './card-display.component.scss'
})
export class CardDisplayComponent {
@Input() card!: CardInfo;
@Input() set!: SetInfo;
@Input() displayHyperspace: boolean = false;
@Input() displayShowcase: boolean = false;
constructor(
private filterService: FilterService
)
{}
shouldShowCard()
{
if(this.displayShowcase)
{
if(this.card.setNumber < this.set.showcaseStart)
{
return false;
}
else
{
return this.filterService.cardPassesFilter(this.card, this.displayHyperspace);
}
}
if(this.card.setNumber >= this.set.showcaseStart)
{
return false;
}
if(this.displayHyperspace)
{
2 years ago
if(this.card.hyperspaceSetNumber == undefined)
{
return false;
}
if(this.set.noHypers.includes(this.card.setNumber))
{
return false;
}
}
return this.filterService.cardPassesFilter(this.card, this.displayHyperspace);;
}
isMissing() {
let count = this.card.standardQuantity;
if(this.displayHyperspace)
{
count = this.card.hyperspaceQuantity;
}
if(count <= 0) {
return "missing";
}
return "";
}
getSetNumber() {
let number = this.card.setNumber
if(this.displayHyperspace)
{
number = this.card.hyperspaceSetNumber;
}
return number.toString().padStart(3, '0');
}
displayOrientation()
{
if(this.card.isBase || this.card.isLeader) {
return "-portrait";
}
return "";
}
getImagePath() {
return "assets/"+this.card.setCode+"/"+this.getSetNumber()+"-small"+this.displayOrientation()+".webp"
}
getStandardCount()
{
if(this.displayHyperspace)
{
return this.card.hyperspaceQuantity;
}
return this.card.standardQuantity;
}
getFoilCount()
{
if(this.displayHyperspace)
{
return this.card.hyperspaceFoilQuantity;
}
return this.card.foilQuantity;
}
}