Skip to content

Commit

Permalink
Merge pull request #7947 from NBKelly/subroutines-have-labels
Browse files Browse the repository at this point in the history
Subroutines have labels
  • Loading branch information
NoahTheDuke authored Feb 5, 2025
2 parents 68d50c4 + c5debc0 commit 1558d1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/clj/game/cards/ice.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,7 @@

(defcard "Datapike"
{:subroutines [{:async true
:label "Runner must pay 2 [Credits]. If they cannot, end the run"
:effect (req (wait-for (pay state :runner (make-eid state eid) card (->c :credit 2))
(if (:cost-paid async-result)
(do (system-msg state :runner (:msg async-result))
Expand Down Expand Up @@ -3056,6 +3057,7 @@
:choices {:card #(and (ice? %)
(in-hand? %))}
:prompt "Choose a piece of ice to install from HQ"
:label "install ice from HQ, ignoring all costs"
:effect (effect (corp-install eid target (zone->name (target-server run)) {:ignore-all-cost true
:msg-keys {:install-source card
:display-origin true}}))}]})
Expand Down
18 changes: 12 additions & 6 deletions test/clj/game/core/abilities_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,22 @@
:when (not-empty (card-def card))]
(is (core/has-trash-ability? card) (str (:title card) " needs either :cost [(->c :trash-can)] or :trash-icon true"))))

(deftest label
(doseq [[title abilities]
(defn- x-has-labels
[x-key x-name]
(doseq [[title cards-with-x]
(->> @all-cards
vals
(sort-by (juxt :type :title))
(map (juxt :title card-def))
(filter (comp :abilities second)))
[idx ability] (map-indexed (fn [idx itm] [idx itm]) (:abilities abilities))]
(is (string? (or (:label ability) (:msg ability)))
(str title ": Ability " (inc idx) " doesn't have an appropriate label"))))
(filter (comp x-key second)))
[idx x] (map-indexed (fn [idx itm] [idx itm]) (x-key cards-with-x))]
(is (string? (or (:label x) (:msg x))) (str title ": " x-name " " (inc idx) " doen't have an appropriate label"))))

(deftest abilities-have-labels
(x-has-labels :abilities "Ability")
(x-has-labels :corp-abilities "Runner Ability")
(x-has-labels :runner-abilities "Corp Ability")
(x-has-labels :subroutines "Subroutine"))

(defn generate-label
[card]
Expand Down

0 comments on commit 1558d1d

Please sign in to comment.