{#if $gameState} (sub = { kind: 'removed' })} onOpenPerks={() => (sub = { kind: 'perks' })} onOpenFaction={(faction) => (sub = { kind: 'faction', faction })} />
(dragIndex = null)} ondrop={onDrop}> {#each drawTopFirst as card, i} {@const pileIndex = deck.drawPile.length - 1 - i}
onDragStart(i)} ondragover={(e) => onDragOver(e, i)} onclick={() => (sub = { kind: 'sendToBottom', displayIndex: i })} role="button" tabindex="0" onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') sub = { kind: 'sendToBottom', displayIndex: i }; }} >
{/each}
{#each discardDisplay as card, i} {@const pileIndex = deck.discardPile.length - 1 - i}
(sub = { kind: 'removeAmd', pileIndex })} role="button" tabindex="0" onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') sub = { kind: 'removeAmd', pileIndex }; }} >
{/each}
{/if} {#if sub?.kind === 'sendToBottom'} {@const pileIndex = deck.drawPile.length - 1 - sub.displayIndex} {@const card = deck.drawPile[pileIndex]} {/if} {#if sub && sub.kind === 'removeAmd'} {@const s = sub} {@const card = deck.discardPile[s.pileIndex]} {/if} {#if sub?.kind === 'removed'}
Removed cards
{#each removedDisplay as card, i} {@const pileIndex = deck.removedPile.length - 1 - i}
(sub = { kind: 'returnAmd', pileIndex })} role="button" tabindex="0" onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') sub = { kind: 'returnAmd', pileIndex }; }} >
{/each}
{/if} {#if sub && sub.kind === 'returnAmd'} {@const s = sub} {@const card = deck.removedPile[s.pileIndex]} {/if} {#if sub?.kind === 'faction'}
{#each factionGfxs as gfx} {/each}
{#if factionAdded == null} {t('tapCardToAddToDeck')} {:else} {/if}
{/if} {#if sub?.kind === 'perks' && character && characterClassData}
{t('addPerks')}
{#if characterClassData.perkDetailsFH.length > 0} {/if} {#each perks as perk, i} {@const added = character.characterState.perkList[i] ?? false} {@const enabled = added ? canRemovePerk( character.characterState.modifierDeck, perks, i ) : canAddPerk( character.characterState.modifierDeck, perks, character.characterState.perkList, i )}
{/each}
{/if}