 (defn korhal-deref [this]
   @(.state this))
 
-(defn korhal-connected [this])
+(defn korhal-connected [this]
+  (.loadTypeData (:api @this)))
 
 (defn korhal-gameStarted [this]
   (println "Here we go!")

  (:import (jnibwapi.JNIBWAPI)
           (jnibwapi.BWAPIEventListener)
           (jnibwapi.model.Unit)
           (jnibwapi.util.BWColor)))

(gen-class
 :name "korhal.core"

    (.enableUserInput)
    (.enablePerfectInformation)
    (.setGameSpeed 0)
    (.loadMapData true))
  (swap-keys (.state this)
    :claimed []
    :morphed-drone false
    :pool-drone -1
    :supply-cap 0))

(defn korhal-gameUpdate [this]

  ;; spawn a drone
  (for [unit (.getMyUnits (:api @this))]
    (when (= (.getTypeID unit) (.. jnibwapi.types.UnitType.UnitTypes Zerg_Larve getID))
      (when (and (< 50 (.. (:api @this) getSelf getMinerals)) (not (:morphed-drone this)))
        (.morph (:api @this) (.getID unit) (.. jnibwapi.types.UnitType.UnitTypes Zerg_Drone getID))
        (swap-keys (.state this) :morphed-drone true)))))


(defn korhal-gameEnded [this])
(defn korhal-keyPressed [this keycode])
(defn korhal-matchEnded [this winner])
