Files
Tarokka/tools/getCardInfo.ts
gavin 5444e25249 stack-the-deck (#1)
Allow for redrawing or explicitly selecting a card for replacement.

Co-authored-by: Gavin McDonald <gavinmcdoh@gmail.com>
Reviewed-on: #1
2025-06-13 07:38:51 -04:00

43 lines
1.1 KiB
TypeScript

import { isHighCard, isLowCard } from '@/tools/cardTypes';
import { Layout, Settings, TarokkaGameCard } from '@/types';
export default function getTooltip(
card: TarokkaGameCard,
position: Layout,
dm: boolean,
settings: Settings,
) {
const { card: cardName, description, flipped } = card;
let text: string[] = [];
if (dm || flipped) {
if (dm || settings.positionFront) text.push(position.text);
if (dm) text.push(`${cardName}: ${description}`);
if (isHighCard(card)) {
// High deck ally
if (position.id === 'ally') {
if (dm || settings.prophecy) text.push(card.prophecy.allies[0].playerText);
if (dm) text.push(card.prophecy.allies[0].dmText);
if (dm) text.push(`Ally: ${card.prophecy.allies[0].ally}`);
}
// High deck Strahd
if (position.id === 'strahd') {
if (dm || settings.prophecy) text.push(card.prophecy.strahd.playerText);
if (dm) text.push(card.prophecy.strahd.dmText);
}
}
// Low deck: Tome, Ravenkind, or Sunsword
if (isLowCard(card)) {
if (dm || settings.prophecy) text.push(card.prophecy.playerText);
if (dm) text.push(card.prophecy.dmText);
}
}
return text;
}