   "Creates data for grail ICE"
   [ability]
   {:abilities [ability reveal-grail resolve-grail]})
+
+
+;;; For NEXT ICE
+(defn next-ice-count
+  "Counts number of rezzed NEXT ICE - for use with NEXT Bronze and NEXT Gold"
+  [corp]
+  (let [servers (flatten (seq (:servers corp)))
+        rezzed-next? #(and (rezzed? %) (has-subtype? % "NEXT"))]
+    (reduce (fn [c server] (+ c (count (filter rezzed-next? (:ices server))))) 0 servers)))
 
 
 ;;;; Card definitions


   "NEXT Gold"
   {:abilities [{:label "Do 1 net damage for each rezzed NEXT ice"
                 :msg (msg "do "
                           (reduce (fn [c server]
                                     (+ c (count (filter #(and (rezzed? %)
                                                               (has-subtype? % "NEXT"))
                                                         (:ices server)))))
                                   0 (flatten (seq (:servers corp)))) " net damage")
                 :effect (effect (damage :net (reduce (fn [c server]
                                                        (+ c (count (filter #(and (rezzed? %)
                                                                                  (has-subtype? % "NEXT"))
                                                                            (:ices server)))))
                                                      0 (flatten (seq (:servers corp)))) {:card card}))}
                trash-program]}

   "NEXT Silver"


   "NEXT Bronze"
   {:abilities [end-the-run]
    :strength-bonus (req (next-ice-count corp))
    :events (let [nb {:req (req (and (not= (:cid target) (:cid card))
                                     (has-subtype? target "NEXT")))
                      :effect (effect (update-ice-strength card))}]
