👁️
at dev 45 lines 1.1 kB view raw
1/** 2 * Public card utility functions for use outside deck-validation. 3 * Re-exports semantic predicates from validation rules. 4 */ 5 6import type { Card } from "@/lib/scryfall-types"; 7import { 8 getPartnerInfo, 9 hasCommanderCreatureType, 10 isDoctor, 11 isValidCommanderType, 12 type PartnerInfo, 13} from "./rules/commander"; 14import { canBePauperCommander, isUncommonInPaperOrMtgo } from "./rules/rarity"; 15 16export type { PartnerInfo }; 17export { 18 getPartnerInfo, 19 hasCommanderCreatureType, 20 isDoctor, 21 isValidCommanderType, 22 isUncommonInPaperOrMtgo, 23 canBePauperCommander, 24}; 25 26/** 27 * Alias for isValidCommanderType - checks if a card can be used as a commander. 28 */ 29export const canBeCommander = isValidCommanderType; 30 31/** 32 * Check if a card has any multi-commander mechanic. 33 * This includes Partner, Friends Forever, Background, Doctor's Companion, etc. 34 */ 35export function hasPartnerMechanic(card: Card): boolean { 36 const info = getPartnerInfo(card); 37 return ( 38 info.hasGenericPartner || 39 info.hasFriendsForever || 40 info.partnerWithName !== null || 41 info.choosesBackground || 42 info.isBackground || 43 info.hasDoctorsCompanion 44 ); 45}