         ab (dissoc ability :choices)
         args {:priority priority :cancel-effect cancel-effect}]
    (if (map? choices)
-     ; Two types of choices use maps: select prompts, and :number prompts.
+     ;; Two types of choices use maps: select prompts, and :number prompts.
      (if (:req choices)
-       ; a select prompt
+       ;; a select prompt
        (show-select state s card ability {:priority priority})
-       ; a :number prompt
+       ;; a :number prompt
        (let [n ((:number choices) state side card targets)]
          (prompt! state s card prompt {:number n} ab args)))
-     ; Not a map; either :credit, :counter, or a vector of cards or strings.
+     ;; Not a map; either :credit, :counter, or a vector of cards or strings.
      (let [cs (if-not (fn? choices)
                 choices ; :credit or :counter
                 (let [cards (choices state side card targets)] ; a vector of cards or strings

  :optional -- shows a 'Yes/No' prompt to let the user decide whether to resolve the ability.
  :end-turn -- if the ability is resolved, then this ability map will be resolved at the end of the turn."

  ; perhaps the most important function in the game logic
  [state side ability card targets]
  (when ability
    ; Is this an optional ability?
    (check-optional state side ability card targets)
    ; Is this a psi game?
    (check-psi state side ability card targets)
    ; Is this a trace?
    (check-trace state side ability card targets)
    ; Ensure this ability can be triggered more than once per turn,
    ; or has not been yet been triggered this turn.
    (when (can-trigger? state side ability card targets)
      (if (:choices ability)
        ; It's a prompt!
        (do-choices state side ability card targets)
        ; Not a prompt. Trigger the ability.
        (do-ability state side ability card targets)))))


; Checking functions for resolve-ability
(defn- check-req
  "Check if the requirement is fulfilled, or no requirement present"
  [state side card targets ability]
  (if-let [req (:req ability)]
    (req state side card targets)
    ; return true if no requirement present
    true))

(defn- check-optional

         can-trigger? do-choices do-ability
         psi-game resolve-psi resolve-trace show-select)

;;;; Functions for implementing card abilities and prompts

;;; Abilities
(defn resolve-ability
  "Resolves an ability defined by the given ability map. Checks :req functions; shows prompts, psi games,
  traces, etc. as needed; charges costs; invokes :effect functions. All card effects and most engine effects
