Choosing order of access
I am working on cleaning up the access routines, mostly in preparation for Haarpsichord Studios. Right now our access code works like this:
- On successful run, gather all cards to access. For remote servers, this is all cards in the server's
:content. For HQ, this is:hq-accessrandom cards from hand and all cards in:hq :content. For R&D, this is the top:rd-accesscards from R&D, plus cards in:rd :content. For Archives, this is all cards in:corp :discardand all cards in:archives :content. Note that cards in the server are gathered last for central servers. - Pass the cards to
handle-access. handle-accessiterates through the group of cards and decides what to do with each. For non-trashable cards, a "Done" prompt is displayed with the card name. For assets/upgrades, an "optional" prompt is displayed to trash. For agendas, steal costs are calculated, and the agenda is sent tosteal.
We have two big issues with this approach:
- Runner is supposed to choose order of access, even so far as being able to pick 1 card from R&D, then access an upgrade in root, then another from R&D on a multi-access run. This is especially important for remotes, where you need to be able to trash (for example) Oaktown Grid before trashing the asset whose trash cost the Grid is increasing. Also incredibly important for Archives (again, see Haarpsichord.)
- All the access logic is run immediately without waiting for one card's access to resolve. Going back to Oaktown Grid, even if you get lucky and get to access Oaktown Grid first to trash it, its effect has already been applied to the trash cost of other cards in the server, because all the trash prompts are created at once without waiting for the resolution of accessing Oaktown Grid. Another problem scenario: Runner users Legwork; 3 cards are accessed, the first is NAPD Contract, the next is a 3 point agenda. The second agenda automatically shows up in Scored area while the NAPD prompt is active, but the Runner is supposed to completely resolve NAPD's access before gaining knowledge about the next card. Fearing Punitive, perhaps the Runner denies NAPD with his illegal knowledge.
There are other smaller issues, but let's cut to the chase.
I have a working prototype for choosing access in remote servers. It looks like this:
(defn access-helper-remote [cards]
{:prompt "Select a card to access. You must access all cards in this server."
:choices {:req #(some (fn [c] (= (:cid %) (:cid c))) cards)}
:effect (req (handle-access state side [target])
(when (< 1 (count cards))
(resolve-ability state side (access-helper-remote (filter #(not= (:cid %) (:cid target)) cards))
card nil)))})
(defn choose-access-remote [cards]
{:effect (req (if (>= 1 (count cards))
(handle-access state side cards)
(resolve-ability state side (access-helper-remote cards) card nil)))})
In a successful run on a remote, we kick off access with choose-access-remote, passing a vector of cards from the server's :content. This starts a recursive function chain to prompt the runner to click one of the cards to access it. We handle-access on that selected target, which creates prompts to display/trash the card accordingly. With that prompt opened, we check to see if there are more cards to access, and if so, recursively call the function again with all remaining cards that were not just selected. This continues until the Runner has clicked once on each card in the server and resolved that card's access prompt.
This works great for remote servers, but I am not sure how to apply it to centrals, and that's what I'd like a discussion about:
What is the simplest and most consistent UI we can come up with for allowing choice-of-access-order for the central servers? The logic can be slightly different for each, but ideally similar enough to be intuitive. Casual ideas I've thrown around:
- For HQ: if there are no upgrades, process one access at a time. Otherwise, show a prompt to click a card in root or in hand. Don't actually access the card they clicked in the hand, just trigger access on the first card pre-selected from a random shuffling of the hand. If more accesses are needed, repeat. Finish once all root cards and enough cards from hand are accessed.
- For R&D: similarly, if there are no upgrades, process one access at a time. Otherwise, click R&D to access a card from there, or click an upgrade to access it.
- For Archives: after revealing all cards, either require Runner to physically click each card to be accessed (filtered to only Agendas and cards flagged as being active in Archives), or perhaps give a prompt with card names like SMC or Clone Chip. Repeatedly resolve access until all cards needing interaction are accessed.
Any thoughts?
Sounds very good.
For Archives, I think a prompt with card names is enough. It should be very rare that there are more than a handful cards in Archive that matter (we don't need to show e.g. operations and non-ambush assets in the prompt). I enabled the card preview for such prompts, so that should be convenient.
Great work!
Alright, I think I'm done with this! It turned out better than I expected.
Running a remote: if there is 1 card, auto-access it. Otherwise prompt to CLICK a card to access. Repeat one time for each card in the server. Each click must be on a card that has not been accessed yet.

HQ: auto-access if doing a single access with no upgrades. Otherwise show a prompt with two sets of options: "Card from hand" to access from hand; and then a list of upgrades in HQ, showing "Upgrade in HQ" if unrezzed and the card's name otherwise. If selecting "Upgrade in HQ", user CLICKS on the unrezzed upgrade they are interested in if there is more than one, otherwise auto-access the only unrezzed upgrade. If selecting a rezzed upgrade's name, auto-access that upgrade. If selecting "Card from hand", access the first card in the already-selected list of cards to be accessed from hand (taking multi-access into account). Repeat until all cards have been accessed.

R&D: same as HQ.
Archives: Show a prompt with all cards in Archives that are interactable: all agendas, and all assets/upgrades that have a :access flag that applies in archives (testing the :req of the :access). Also include upgrades using the same pattern as in HQ and R&D. All cards in the prompt must be resolved one at a time.

Looks awesome!