sendToGraveyard :: CardID -> StateT GameState IO ()
sendToGraveyard cID = do
  state <- get
  triggeredAbilities <- allTriggeredAbilities -- get abilities before killing card
  players.traversed.field %= delete cID
  unless (state^.card cID.token) $
    playerWithID (state^.card cID.ownerID).graveyard <>= [cID]

  let withCorrectTrigger =
        filter (\ (_, Triggered t _) -> t == OnDeath) triggeredAbilities
  forM_ withCorrectTrigger $ \(cardWithAbility, Triggered _ f) ->
    f $ OnDeathInfo cID
sendToGraveyard :: CardID -> StateT GameState IO ()
sendToGraveyard cID = do
  state <- get
  triggeredAbilities <- allTriggeredAbilities -- get abilities before killing card
  players.traversed.field %= delete cID
  unless (state^.card cID.token) $
    playerWithID (state^.card cID.ownerID).graveyard <>= [cID]

  let withCorrectTrigger =
        filter (\ (_, Triggered t _) -> t == OnDeath) triggeredAbilities
  forM_ withCorrectTrigger $ \(cardWithAbility, Triggered _ f) ->
    f $ OnDeathInfo cID
sendToGraveyard cID = do
  state <- get
  triggeredAbilities <- allTriggeredAbilities -- get abilities before killing card
  players.traversed.field %= delete cID
  unless (state^.card cID.token) $
    playerWithID (state^.card cID.ownerID).graveyard <>= [cID]

  let withCorrectTrigger =
        filter (\ (_, Triggered t _) -> t == OnDeath) triggeredAbilities
  forM_ withCorrectTrigger $ \(cardWithAbility, Triggered _ f) ->
    f $ OnDeathInfo cID