 
 (defn valid? [{:keys [identity cards] :as deck}]
   (and (>= (card-count cards) (:minimumdecksize identity))
-       (<= (influence deck) (influencelimit identity))
+       (<= (influence-count deck) (influencelimit identity))
        (every? #(and (allowed? (:card %) identity)
                      (<= (:qty %) (or (get-in % [:card :limited]) 3))) cards)
        (or (= (:side identity) "Runner")

                       (:qty line) " "
                       (if-let [name (get-in line [:card :title])]
                         (let [card (:card line)
                               infaction (or (= (:faction card) (:faction identity))
                                            (zero? (:factioncost card)) (= INFINITY (influencelimit identity)))
                               wanted (mostwanted? card)]
                           [:span
                            [:span {:class (if (allowed? card identity) "fake-link" "invalid")

(defn found? [query cards]
  (some #(if (= (.toLowerCase (:title %)) query) %) cards))

(defn influencelimit [identity]
  "Returns influence limit of an identity or INFINITY in case of draft IDs."
  (if (= (:setname identity) "Draft") INFINITY (:influencelimit identity)))

(defn mostwanted? [card]
  "Returns true if card is on Most Wanted NAPD list."
  (let [napdmwl '("Cerberus \"Lady\" H1" "Clone Chip" "Desperado" "Parasite" "Prepaid VoicePAD"
                   "Architect" "AstroScript Pilot Program" "Eli 1.0" "NAPD Contract" "SanSan City Grid")]
    (some #(= (:title card) %) napdmwl)))

(defn noinfcost? [identity card]
  (or (= (:faction card) (:faction identity))
      (zero? (:factioncost card)) (= INFINITY (influencelimit identity))))

(defn search [query cards]
  (filter #(if (= (.indexOf (.toLowerCase (:title %)) query) -1) false true) cards))
