--------------------------------------------------------------------------------
-- Actions that can trigger abilities                                         --
--------------------------------------------------------------------------------

killCard :: CardID -> StateT GameState IO ()
killCard cID = do
  state <- get
  unless (Indestructible `elem` state^.card cID.attributes)
    (sendToGraveyard cID)
  forM_ (state^.card cID.attachedCards) $ \attachmentID -> do
    detach attachmentID
    when (Aura `elem` state^.card attachmentID.cardType) (killCard attachmentID)
killCard :: CardID -> StateT GameState IO ()
killCard cID = do
  state <- get
  unless (Indestructible `elem` state^.card cID.attributes)
    (sendToGraveyard cID)
  forM_ (state^.card cID.attachedCards) $ \attachmentID -> do
    detach attachmentID
    when (Aura `elem` state^.card attachmentID.cardType) (killCard attachmentID)
killCard cID = do
  state <- get
  unless (Indestructible `elem` state^.card cID.attributes)
    (sendToGraveyard cID)
  forM_ (state^.card cID.attachedCards) $ \attachmentID -> do
    detach attachmentID
    when (Aura `elem` state^.card attachmentID.cardType) (killCard attachmentID)