import { AfterViewInit , ChangeDetectionStrategy , ChangeDetectorRef , Component , EventEmitter , Input , } from '@angular/core' ; import { DeckList } from '@firestone-hs/cron-build-ranked-archetypes/dist/archetype-stats' ; import { CardsFacadeService } from '@services/cards-facade.service' ; import { GameState } from '../../models/decktracker/game-state' ; import { GameStateEvent } from '../../models/decktracker/game-state-event' ; import { GameEvent } from '../../models/game-event' ; import { SetCard } from '../../models/set' ; import { DeckstringOverrideEvent } from '../../services/decktracker/event/deckstring-override-event' ; import { OverwolfService } from '../../services/overwolf.service' ; @ Component ( { selector : 'in-game-opponent-recap' , styleUrls : [ `../../../css/global/components-global.scss` , `../../../css/component/constructed/in-game-opponent-recap.component.scss` , ] , template : `
		<div class="in-game-opponent-recap">
			<div class="played-cards-container">
				<div class="header">Played Cards</div>
				<deck-list
					class="played-cards"
					*ngIf="playedCards?.length"
					[cards]="playedCards"
					[collection]="cardsInDecklists"
				>
				</deck-list>
				<div class="no-cards-played" *ngIf="!playedCards?.length">Opponent has not played any cards yet</div>
			</div>
			<div class="archetype-guess">
				<div class="header">Archetype Guess</div>
				<div class="container">
					<div class="no-archetype-name" *ngIf="!archetypes?.length">
						Could not find any matching archetype
					</div>
					<div class="archetypes-list" *ngIf="archetypes?.length">
						<div class="archetype" *ngFor="let archetype of archetypes">
							<div class="archetype-name">
								{{ archetype.name }} ({{ archetype.archetypeProbability.toFixed(0) }}%)
							</div>
							<div class="warning" *ngIf="archetype.approximate" [helpTooltip]="archetype.missingCards">
								Some played cards are not in this list. TODO: show which ones
							</div>
							<deck-list
								class="full-list"
								*ngIf="archetype.decklist?.cards?.length"
								[cards]="archetype.decklist.cards"
							>
							</deck-list>
							<div class="decklist-popularity">Popularity: {{ archetype.popularity.toFixed(1) }}%</div>
							<button
								class="use-decklist-button"
								(mousedown)="useDecklist(archetype)"
								helpTooltip="Use this decklist in the opponent's tracker. It might cause a short lag while the app recomputes everything."
							>
								<span>Use decklist</span>
							</button>

							<div class="no-archetype-list" *ngIf="!archetype.decklist?.cards?.length">
								Could not find any proposed list
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	` , changeDetection : ChangeDetectionStrategy . OnPush , } ) export class InGameOpponentRecapComponent implements AfterViewInit { @ Input ( ) set state ( value ) { this . _state = value ; this . updateInfo ( ) ; } _state : GameState ; playedCards : readonly string [ ] ; cardsInDecklists : readonly SetCard [ ] ; playedCardsAsCollection : readonly SetCard [ ] ; archetypes : readonly Archetype [ ] ; private deckUpdater : EventEmitter < GameEvent | GameStateEvent > ; constructor ( private readonly ow , private readonly allCards , private readonly cdr ) { } async ngAfterViewInit ( ) { this . deckUpdater = this . ow . getMainWindow ( ) . deckUpdater ; } useDecklist ( archetype ) { this . deckUpdater . next ( new DeckstringOverrideEvent ( archetype . name , archetype . decklist . deckstring ) ) ; } private updateInfo ( ) { } private buildArchetypes ( state , playedCards ) { return null ; } } interface Archetype { readonly name : string ; readonly archetypeProbability : number ; readonly decklist : DeckList ; readonly popularity : number ; readonly deckstring : string ; readonly cardsPlayedNotInList : readonly string [ ] ; readonly approximate : boolean ; readonly missingCards : readonly string [ ] ; } interface InternalDeckList extends DeckList { readonly approximate ? : boolean ; readonly score ? : number ; readonly missingCards ? : readonly string [ ] ; }