netrunner icon indicating copy to clipboard operation
netrunner copied to clipboard

The full target list should be available for inspection during a prompt

Open NBKelly opened this issue 9 months ago • 2 comments

req already picks out target from the targets function, so I should be able to do something like this without any normal req functions being effect

{:choices {:max 3
           :req (req (and (not (event? target) ;;default behaviour is checking the one you just clicked on
                          ;; extended behavior lets you classify the whole selection, like 'no more than 1 program'
                          (> 2 (count (filter program? targets)))))}}

I had a look, but it wasn't immediately obvious how to do this (for now you can fetch the selection like this):

(let [pre-selected (:cards (get-in @state [side :selected 0] []))
        full-selection (if-not (some #(same-card? % target) pre-selected)
                           (vec (conj pre-selected target))
                            pre-selected)]

but it's awkward, I don't actually know how it works, and you need to be careful not to count the same card twice (ie preventing yourself from deselecting a card).

NBKelly avatar May 04 '24 20:05 NBKelly