 
 (defn korhal-receiveText [this text])
 
-(defn korhal-nukeDetect [this x y]
-  (strategy-inform! :nukes {:x x :y y :frame (frame-count)}))
+(defn korhal-nukeDetect [this x y])
 
 (defn korhal-playerLeft [this player-id])
 
-(defn korhal-unitCreate [this unit-id]
-  (let [unit (get-unit-by-id unit-id)]
-    (when (my-unit? unit)
-      (if (building? unit)
-        (do (builder-to-constructor! unit)
-            (contract-add-new-building unit))
-        (micro-tag-new-unit! unit)))))
+(defn korhal-unitCreate [this unit-id])
 
-(defn korhal-unitDestroy [this unit-id]
-  ;; NOTE: destroyed units are no longer available through the API
-  (cancel-contracts unit-id)
-  (strategy-remove! :enemy-units unit-id))
+(defn korhal-unitDestroy [this unit-id])
 
-(defn korhal-unitDiscover [this unit-id]
-  (let [unit (get-unit-by-id unit-id)]
-    (when (not (my-unit? unit))
-      (strategy-inform! :enemy-units {:id unit-id
-                                      :type (get-unit-type unit)
-                                      :x (pixel-x unit)
-                                      :y (pixel-y unit)
-                                      :frame (frame-count)}))))
+(defn korhal-unitDiscover [this unit-id])
 
 (defn korhal-unitEvade [this unit-id])
 
 (defn korhal-unitHide [this unit-id])
 
-(defn korhal-unitMorph [this unit-id]
-  (let [unit (get-unit-by-id unit-id)]
-    (when ((every-pred my-unit? is-refinery?) unit)
-      (builder-to-constructor! unit)
-      (contract-add-new-building unit))))
+(defn korhal-unitMorph [this unit-id])
 
-(defn korhal-unitShow [this unit-id]
-  (let [unit (get-unit-by-id unit-id)]
-    (when (not (my-unit? unit))
-      (strategy-inform! :enemy-units {:id unit-id
-                                      :type (get-unit-type unit)
-                                      :x (pixel-x unit)
-                                      :y (pixel-y unit)
-                                      :frame (frame-count)}))))
+(defn korhal-unitShow [this unit-id])
 
 (defn korhal-unitRenegade [this unit-id])
 
 (defn korhal-saveGame [this game-name])
 
-(defn korhal-unitComplete
-  "BUG: This does NOT get called when a morphing unit (e.g. refinery)
-  completes!"
-  [this unit-id]
-  (let [unit (get-unit-by-id unit-id)]
-    (when ((every-pred my-unit? building?) unit)
-      (construction-completed! unit))))
+(defn korhal-unitComplete [this unit-id])
 
 (defn korhal-playerDropped [this player-id])

  (println "Game Started")
  (enable-user-input)
  (set-game-speed 10)
  (load-map-data true)
  (draw-targets true)
  (draw-ids true)
  (show-contract-display true)
  (start-repl! 7777))

(defn korhal-gameUpdate [this]
  ;; we have to do this here instead of korhal-gameStarted because frame does not
  ;; get reset to 0 until now when restarting a game
  (when (zero? (frame-count))
    (clear-contract-atoms)
    (contract-add-initial-cc)
    (start-strategy-engine!)
    (start-macro-engine!)
    (start-micro-engine!))
  (strategy-expire! :nukes 250) ;; estimated frames for a nuke to drop
  (clear-contracts)
  (execute-api-queue)
  (execute-repl-queue))

(defn korhal-gameEnded [this]
  (stop-strategy-engine!)
  (stop-macro-engine!)
  (stop-micro-engine!)
  (stop-repl!))

(defn korhal-keyPressed [this keycode])


(ns korhal.core
  (:require [korhal.interop.interop :refer :all]
            [korhal.tools.util :refer [swap-key swap-keys profile]]
            [korhal.tools.repl :refer :all]
            [korhal.tools.queue :refer :all])
  (:import (clojure.lang.IDeref)
           (jnibwapi.JNIBWAPI)
           (jnibwapi.BWAPIEventListener)))
