--------------------------------------------------------------------------------
-- Targeting Information                                                      --
--------------------------------------------------------------------------------

hasValidTarget :: CardID -> TargetInfo -> StateT GameState IO Bool
hasValidTarget cID (TargetInfo minTargets maxTargets pred) = do
  s <- get
  let
    keys :: [CardID]
    keys = Map.Lazy.keys (s^.cards)
    targets :: [Targetable]
    targets = map CardTarget keys ++ [PlayerTarget 0, PlayerTarget 1]
  bools <- mapM (liftState . pred cID) targets
  return $ or bools
hasValidTarget :: CardID -> TargetInfo -> StateT GameState IO Bool
hasValidTarget cID (TargetInfo minTargets maxTargets pred) = do
  s <- get
  let
    keys :: [CardID]
    keys = Map.Lazy.keys (s^.cards)
    targets :: [Targetable]
    targets = map CardTarget keys ++ [PlayerTarget 0, PlayerTarget 1]
  bools <- mapM (liftState . pred cID) targets
  return $ or bools
hasValidTarget cID (TargetInfo minTargets maxTargets pred) = do
  s <- get
  let
    keys :: [CardID]
    keys = Map.Lazy.keys (s^.cards)
    targets :: [Targetable]
    targets = map CardTarget keys ++ [PlayerTarget 0, PlayerTarget 1]
  bools <- mapM (liftState . pred cID) targets
  return $ or bools