enterBattlefield :: PlayerID -> Zone -> CardID -> StateT GameState IO ()
enterBattlefield pID zone cID = do
  -- Note that the card entering the battlefield can use "On Enters the Battlefield"
  -- triggered abilities.
  playerWithID pID.zoneToLens zone %= delete cID
  playerWithID pID.field <>= [cID]
  s <- get
  triggeredAbilities <- allTriggeredAbilities
  let withCorrectTrigger =
        filter (\ (_, Triggered t _) -> t == OnEnterBattlefield) triggeredAbilities
  forM_ withCorrectTrigger $ \(cardWithAbility, Triggered _ f) -> do
    trace "Running trigger OnEnterBattlefield" (return ())
    f $ OnEnterBattlefieldInfo cID zone cardWithAbility
enterBattlefield :: PlayerID -> Zone -> CardID -> StateT GameState IO ()
enterBattlefield pID zone cID = do
  -- Note that the card entering the battlefield can use "On Enters the Battlefield"
  -- triggered abilities.
  playerWithID pID.zoneToLens zone %= delete cID
  playerWithID pID.field <>= [cID]
  s <- get
  triggeredAbilities <- allTriggeredAbilities
  let withCorrectTrigger =
        filter (\ (_, Triggered t _) -> t == OnEnterBattlefield) triggeredAbilities
  forM_ withCorrectTrigger $ \(cardWithAbility, Triggered _ f) -> do
    trace "Running trigger OnEnterBattlefield" (return ())
    f $ OnEnterBattlefieldInfo cID zone cardWithAbility
enterBattlefield pID zone cID = do
  -- Note that the card entering the battlefield can use "On Enters the Battlefield"
  -- triggered abilities.
  playerWithID pID.zoneToLens zone %= delete cID
  playerWithID pID.field <>= [cID]
  s <- get
  triggeredAbilities <- allTriggeredAbilities
  let withCorrectTrigger =
        filter (\ (_, Triggered t _) -> t == OnEnterBattlefield) triggeredAbilities
  forM_ withCorrectTrigger $ \(cardWithAbility, Triggered _ f) -> do
    trace "Running trigger OnEnterBattlefield" (return ())
    f $ OnEnterBattlefieldInfo cID zone cardWithAbility