 (defn send [msg]
   (.emit socket "netrunner" (clj->js msg)))
 
+(defn not-spectator? [game-state app-state]
+  (#{(get-in @game-state [:corp :user]) (get-in @game-state [:runner :user])} (:user @app-state)))
+
 (defn send-command
   ([command] (send-command command nil))
   ([command args]

     (sab/html
      [:div.card-frame
       [:div.blue-shade.card {:class (when selected "selected")
                              :draggable (when (#{(get-in @game-state [:corp :user]) (get-in @game-state [:runner :user])} (:user @app-state)) true)
                              :on-drag-start #(handle-dragstart % cursor)
                              :on-drag-end #(-> % .-target js/$ (.removeClass "dragged"))
                              :on-mouse-enter #(when (or (not (or flipped facedown))

(defn handle-card-click [{:keys [type zone counter advance-counter advancementcost advanceable
                                 root] :as card} owner]
  (let [side (:side @game-state)]
    (when (not-spectator? game-state app-state)
      (if (= (get-in @game-state [side :prompt 0 :prompt-type]) "select")
        (send-command "select" {:card card})
        (if (and (= (:type card) "Identity") (= side (keyword (.toLowerCase (:side card)))))
