       false)))
 
 (defn can-repair-other? [db game unit]
-  (get-in unit [:unit/type :unit-type/can-repair]))
+  (try
+    (check-can-repair-other db game unit)
+    true
+    (catch :default ex
+      false)))
 
 (defn can-be-repaired? [db game unit]
   (< (:unit/count unit) (:game/max-count-per-unit game)))

  (concat (move-actions db game unit)
          (attack-actions db game unit)
          (repair-actions db game unit)
          (capture-actions db game unit)))

(defn actionable-units [db game]

           closest)))
     (enemies db game unit))))

(defn friends [db game unit]
  (let [u-faction (unit-faction db unit)]
    (qess '[:find ?u
            :in $ ?g ?f-arg
            :where
            [?g :game/factions ?f]
            [?f :faction/units ?u]
            [(= ?f ?f-arg)]]
          db (e game) (e u-faction))))

(defn friends-in-range [db game unit]
  (into []
        (filter #(in-range? db unit %))
        (friends db game unit)))

(defn closest-friend [db game unit]
  (let [unit-q (:unit/q unit)
        unit-r (:unit/r unit)]
    (reduce
     (fn [closest friend]
       (let [friend-q (:unit/q friend)
             friend-r (:unit/r friend)
             closest-q (:unit/q closest)
             closest-r (:unit/r closest)]
         (if (< (hex/distance unit-q unit-r friend-q friend-r)
                (hex/distance unit-q unit-r closest-q closest-r))
           friend
           closest)))
     (friends db game unit))))

(defn unit-can-act? [db game unit]
  (let [terrain (:unit/terrain unit)]
    (or (can-move? db game unit)
