      :down-right [(+ x steps) (+ y steps)]
      [x y])))
 
-(defn distance [[a-x a-y] [b-x b-y]]
+(defn- distance [[a-x a-y] [b-x b-y]]
   (let [x-dist (Math/pow (- a-x b-x) 2)
         y-dist (Math/pow (- a-y b-y) 2)
         dist (Math/sqrt (+ x-dist y-dist))]

   (assert (contains? weapons type) "Weapon doesn't exist.")
   (assoc (get weapons type) :weapon-type type)))

(defn weapon-is-ready? [{last-attack :last-attack recharge-delay :recharge-delay}]
  (let [available (t/plus last-attack (t/seconds recharge-delay))
        now (t/now)]
    (or (t/after? now available)
        (t/equal? now available))))

(defn weapon-range [{range :range}] range)

(defn in-weapon-range? [terrain attacker-pos target-pos]
  (= (weapon-range (get-in terrain [attacker-pos :weapon]))
     (distance attacker-pos target-pos)))

(defn weapon-attack [{attack :attack}] attack)

(defn attack-target [terrain attacker-pos target-pos target-type]
  (if (weapon-is-ready? (get-in terrain [attacker-pos :weapon]))
    (let [terrain (assoc-in terrain [attacker-pos :weapon :last-attack] (t/now))]
      (if (terrain-has-type? terrain target-pos target-type)

                                                          (assoc :weapon (make-weapon :dagger))
                                                          (set-terrain-direction direction))))))))))

(defn- move-player [{world-size :world-size current-pos :player-pos terrain :terrain :as game} action]
  (let [new-pos (get-position current-pos action)
        new-pos (if (and (in-world? world-size new-pos)
                         (terrain-accessible? terrain new-pos))
