       (and capturing (= capture-round (:game/round game)))
       (into (end-turn-capture-tx db game unit)))))
 
-(defn end-turn-tx [db game]
+(defn end-turn-tx
+  "Return a transaction that completes captures, clears per round unit flags,
+  updates the current faction, adds faction credits, and updates the round."
+  [db game]
   (let [starting-faction (qe '[:find ?f
                                :in $ ?g
                                :where

      ;; TODO: include info about occupying unit
      (throw (ex-info "Base is occupied" {:q q :r r})))))

;; Build
;; x check base ownership
;; x check credits
;; x check space unoccupied
;; x create new unit
;; x update credits

(defn build-tx
  ([db game q r unit-type-id]
   (let [base (checked-base-at db game q r)]
     (build-tx db game base unit-type-id)))

    (catch :default ex
      false)))


(defn capture-tx
  "Returns a transaction that sets the unit capturing flag and capture round."
  ([db game unit]
   (let [base (base-at db game (:unit/q unit) (:unit/r unit))
         round (:game/round game)]
