 (defn add-to-turn [event]
   (swap! game update-in [:turns] add-event-to-turn event))
 
-(defn do-mayor []
-  
+(defn do-mayor [cstate]
+  (swap! estream conj 
+         [:rolepick :mayor]
+         [:worker :bank -1]
+         [:worker (nth (:order cstate) (:role-picker cstate)) 1])
   )
+
+(defn action-done []
+  (swap! estream conj [:actiondone])) 
 
 (defn do-settler [field-type i]
   (when true

   [:div.box {:class type}]
   [:div.clearfix]])

(defn player-board [player]
  [:div
   (if (:role player)
     [:div.rolecard (name (:role player))])
   [:div.well
    [:div.pull-left (:name player)]
    [:span.pull-right (gold (:gold player))]
    [:span.pull-right (vp (:vp player))]
    [:div.clearfix]
    [:h5 "Buildings"]
    (for [building (:buildings player)]
      [:div (:name building)])
    [:h5 "Fields"]
    (for [field (:fields player)]
      [:div.field {:class (name field)} (name field)])
    ]])

(defn player-boards []
  [:div.row
   (for [player (:players @game)]
     [:div.col-md-3
      (player-board player)])])



(enable-console-print!)

(def estream (atom []))

(defn create-player [name gold starting-field]
  {:name name
