mtgred / netrunner

Home Page:http://www.jinteki.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

NBKelly opened this issue · 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? target)))))}}

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).

oh yeah, I learned that a card needs to actually pass the :req test for you to deselect it 😂

commented

this should definitely be possible. lemme look at the code, i can probably fix this.