{:req(req(pos?(count(:scoredcorp)))):delayed-completiontrue:additional-cost[:forfeit]:effect(req(continue-abilitystateside{:prompt"Choose an agenda in your score area to trigger its \"when scored\" ability":choices{:req#(and(is-type?%"Agenda")(is-scored?state:corp%))}:msg(msg"trigger the \"when scored\" ability of "(:titletarget)):delayed-completiontrue;dissoc :end-turn for Breaking News
:effect(effect(continue-ability(dissoc(card-deftarget):end-turn)targetnil))}cardnil))}
(letfn[(ad[inadcard]{:prompt"Select an operation to play":choices{:req#(and(=(:side%)"Corp")(is-type?%"Operation")(=(:zone%)[:play-area]))}:msg(msg"play "(:titletarget)):delayed-completiontrue:effect(req(when-completed(play-instantstatesidetarget{:no-additional-costtrue})(if(and(not(get-in@state[:corp:register:terminal]))(<in))(continue-abilitystateside(ad(inci)nadcard)adcardnil)(effect-completedstatesideeid))))})]{:delayed-completiontrue:effect(req(let[n(count(filter#(is-type?%"Operation")(take3(:deckcorp))))](continue-abilitystateside{:msg"look at the top 3 cards of R&D":delayed-completiontrue:effect(req(doseq[c(take3(:deckcorp))](movestatesidec:play-area))(continue-abilitystateside(ad1ncard)cardnil))}cardnil)))})
(let[abhelp(fnab[ntotal]{:prompt"Select an advertisement to install and rez":show-discardtrue:delayed-completiontrue:choices{:req#(and(=(:side%)"Corp")(has-subtype?%"Advertisement")(or(in-hand?%)(=(:zone%)[:discard])))}:effect(req(when-completed(corp-installstatesidetargetnil{:install-state:rezzed})(if(<ntotal)(continue-abilitystateside(ab(incn)total)cardnil)(effect-completedstatesideeid))))})]{:prompt"How many advertisements?":delayed-completiontrue:choices:credit:msg(msg"install and rez "target" advertisements"):effect(effect(continue-ability(abhelp1target)cardnil))})
{:req(req(:scored-agendacorp-reg)):prompt"Choose a card":choices(req(cancellable(:deckcorp):sorted)):effect(final-effect(movetarget:hand)(shuffle!:deck)):msg"search R&D for a card and add it to HQ"}
{:delayed-completionfalse:prompt"Choose a server":choices["Archives""R&D""HQ"]:effect(req(let[servtarget](show-wait-promptstate:corp(str"Runner to decide on running "target))(continue-abilitystateside{:optional{:prompt(msg"Make a run on "serv"?"):player:runner:yes-ability{:msg(msg"let the Runner make a run on "serv):effect(effect(clear-wait-prompt:corp)(game.core/runeidservnilcard))}:no-ability{:effect(effect(clear-wait-prompt:corp)(as-agenda:corp(some#(when(=(:cidcard)(:cid%))%)(:discardcorp))1)):msg"add it to their score area as an agenda worth 1 agenda point"}}}cardnil)))}
{:effect(req(let[cid(:cidcard)](resolve-abilitystateside{:prompt"Choose a card from Archives to add to HQ":show-discardtrue:choices{:req#(and(not=(:cid%)cid)(=(:side%)"Corp")(=(:zone%)[:discard]))}:effect(final-effect(movetarget:hand)(system-msg(str"adds "(if(:seentarget)(:titletarget)"an unseen card")" to HQ")))}cardnil)))}
{:delayed-completiontrue:req(req(not-empty(:discardrunner))):prompt"Name a card to remove all copies in the Heap from the game":choices(req(cancellable(:discardrunner):sorted)):msg(msg"remove all copies of "(:titletarget)" in the Heap from the game"):effect(req(doseq[c(filter#(=(:titletarget)(:title%))(:discardrunner))](movestate:runnerc:rfg))(effect-completedstatesideeidcard))}
{:prompt"Choose an installed card in a server to trash":choices{:req#(and(=(last(:zone%)):content)(is-remote?(second(:zone%))))}:effect(final-effect(gain:credit(*3(gettarget:advance-counter0)))(trashtarget)):msg(msg"trash "(card-strstatetarget)" and gain "(*3(gettarget:advance-counter0))" [Credits]")}
{:implementation"Any required program trashing is manual":req(reqtagged):msg"force the Runner to lose 2[mu] until the end of the turn":effect(req(losestate:runner:memory2)(when(<(:memoryrunner)0)(system-msgstate:runner"must trash programs to free up [mu]"))):end-turn{:effect(req(gainstate:runner:memory2)(system-msgstate:runner"regains 2[mu]"))}}
{:delayed-completiontrue:req(req(not-empty(all-installedstate:runner))):effect(req(let[t(:tagrunner)](continue-abilitystateside{:prompt(msg"Choose a Runner card with an install cost of "t" or less to trash"):choices{:req#(and(installed?%)(<=(:cost%)t))}:msg(msg"trash "(:titletarget)):effect(effect(trashtarget))}cardnil)))}
{:implementation"Derez is manual":choices{:req#(and(ice?%)(has-subtype?%"Bioroid")(not(rezzed?%)))}:msg(msg"rez "(card-strstatetarget{:visibletrue})" at no cost"):effect(final-effect(reztarget{:ignore-cost:all-costs})(host(get-cardstatetarget)(assoccard:zone[:discard]:seentrue)))}
{:choices{:req#(and(is-type?%"Agenda")(in-hand?%))}:delayed-completiontrue:effect(req(let[agendatarget](continue-abilitystateside{:prompt(str"Choose a server to install "(:titleagenda)):choices(server-liststateagenda):effect(req(corp-installstatesideagendatarget{:install-state:face-up}); find where the agenda ended up and host on it
(let[agenda(some#(when(=(:cid%)(:cidagenda))%)(all-installedstate:corp))]; the operation ends up in :discard when it is played; to host it,
; we need (host) to look for it in discard.
(hoststatesideagenda(assoccard:zone[:discard]:seentrue:installedtrue))(system-msgstateside(str"hosts Casting Call on "(:titleagenda)))))}cardnil))):events{:access{:req(req(=(:cidtarget)(:cid(:hostcard)))):delayed-completiontrue:effect(effect(tag-runner:runnereid2)):msg"give the Runner 2 tags"}}}
{:choices{:max5:req#(and(=(:side%)"Corp")(in-hand?%))}:msg(msg"reveal "(join", "(map:titletargets))" and gain "(*2(counttargets))" [Credits]"):effect(final-effect(gain:credit(*2(counttargets))))}
{:req(req(:successful-runrunner-reg)):psi{:not-equal{:player:runner:prompt"Take 1 tag or 1 brain damage?":choices["1 tag""1 brain damage"]:msg(msg"give the Runner "target):delayed-completiontrue:effect(req(if(=target"1 tag")(tag-runnerstatesideeid1)(damagestatesideeid:brain1{:cardcard})))}}}
{:prompt"Choose an Operation from R&D to play":choices(req(cancellable(filter#(and(is-type?%"Operation")(<=(:cost%)(:creditcorp)))(:deckcorp)):sorted)):effect(effect(shuffle!:deck)(system-msg"shuffles their deck")(play-instanttarget)):msg(msg"search R&D for "(:titletarget)" and play it")}
{:prompt"Choose a faceup card":choices{:reqrezzed?}:msg(msg"place 3 advancement tokens on "(card-strstatetarget)):effect(req(add-propstate:corptarget:advance-counter3{:placedtrue})(effect-completedstatesideeidcard)(let[tgtcid(:cidtarget)](register-turn-flag!statesidetarget:can-score(fn[statesidecard](if(and(=(:cidcard)tgtcid)(>=(:advance-countercard)(or(:current-costcard)(:advancementcostcard))))((constantlyfalse)(toaststate:corp"Cannot score due to Dedication Ceremony.""warning"))true)))))}
{:events{:runner-turn-begins{:trace{:base1:msg(msg(iftagged"do 1 meat damage""give the Runner 1 tag")):label"Do 1 meat damage if Runner is tagged, or give the Runner 1 tag":delayed-completiontrue:effect(req(iftagged(damagestatesideeid:meat1{:cardcard})(tag-runnerstate:runnereid1)))}}}}
{:req(req(->>(get-in@state[:corp:hand])(filter#(not(=(:cid%)(:cidcard))))(count)(pos?))):msg(msg"trash all cards in HQ and draw 5 cards"):effect(effect(trash-cards(get-in@state[:corp:hand]))(draw5))}
{:msg"reduce the Runner's maximum hand size by 1":effect(effect(lose:runner:hand-size-modification1)):leave-play(effect(gain:runner:hand-size-modification1))}
{:trace{:base3:label"Trash a card not matching the faction of the Runner's identity":delayed-completiontrue:effect(req(let[f(:faction(:identityrunner))](continue-abilitystateside{:prompt"Choose an installed card not matching the faction of the Runner's identity":choices{:req#(and(installed?%)(not=f(:faction%))(card-is?%:side:runner))}:msg(msg"trash "(:titletarget)):effect(effect(trashtarget))}cardnil)))}}
(letfn[(add-effect[statesidecard](update!stateside(assoccard:elp-activatedtrue))(click-run-cost-bonusstateside[:click1]))(remove-effect[statesidecard](click-run-cost-bonusstateside[:click-1])(update!stateside(dissoccard:elp-activated)))]{:effect(req(when(and(=:runner(:active-player@state))(not(:made-click-runrunner-reg)))(add-effectstatesidecard)(system-msgstateside(str"uses Enhanced Login Protocol to add an additional cost of [Click]"" to make the first run not through a card ability this turn")))):events{:runner-turn-begins{:msg"add an additional cost of [Click] to make the first run not through a card ability this turn":effect(effect(add-effectcard))}:runner-turn-ends{:req(req(:elp-activatedcard)):effect(effect(remove-effectcard))}:run-ends{:req(req(and(:elp-activatedcard)(:made-click-runrunner-reg))):effect(effect(remove-effectcard))}}:leave-play(req(when(:elp-activatedcard)(remove-effectstatesidecard)))})
{:req(req(andtagged(seq(:scoredrunner))(seq(:scoredcorp)))):delayed-completiontrue:effect(req(continue-abilitystateside{:prompt"Choose a stolen agenda in the Runner's score area to swap":choices{:req#(in-runner-scored?stateside%)}:delayed-completiontrue:effect(req(let[stolentarget](continue-abilitystateside{:prompt(msg"Choose a scored agenda to swap for "(:titlestolen)):choices{:req#(in-corp-scored?stateside%)}:effect(req(let[scoredtarget](swap-agendasstatesidescoredstolen)(system-msgstateside(str"uses Exchange of Information to swap "(:titlescored)" for "(:titlestolen)))(effect-completedstatesideeidcard)))}cardnil)))}cardnil))}
{:prompt"Choose an Agenda":choices(req(cancellable(filter#(is-type?%"Agenda")(:deckcorp)):sorted)):effect(effect(system-msg(str"adds "(:titletarget)" to HQ and shuffle R&D"))(shuffle!:deck)(movetarget:hand))}
{:delayed-completiontrue:req(req(>=(:creditrunner)6)):effect(req(let[rcount(count(filter#(is-type?%"Resource")(all-installedstate:runner)))](if(pos?rcount)(do(show-wait-promptstate:corp"Runner to trash a resource to prevent Financial Collapse")(continue-abilitystateside{:prompt(msg"Trash a resource to prevent Financial Collapse?"):choices["Yes""No"]:player:runner:delayed-completiontrue:effect(final-effect(continue-ability(if(=target"Yes"){:prompt"Choose a resource to trash":player:runner:choices{:req#(and(is-type?%"Resource")(installed?%))}:effect(req(trashstatesidetarget{:unpreventabletrue})(system-msgstate:runner(str"trashes "(:titletarget)" to prevent Financial Collapse"))(clear-wait-promptstate:corp))}{:effect(effect(lose:runner:credit(*rcount2))(clear-wait-prompt:corp)):msg(msg"make the Runner lose "(*rcount2)" [Credits]")})cardnil))}cardnil))(continue-abilitystateside{:effect(effect(lose:runner:credit(*rcount2))):msg(msg"make the Runner lose "(*rcount2)" [Credits]")}cardnil))))}
(let[fhelper(fnfhp[n]{:prompt"Select a card in Archives to install with Friends in High Places":priority-1:delayed-completiontrue:show-discardtrue:choices{:req#(and(=(:side%)"Corp")(not(is-type?%"Operation"))(in-discard?%))}:effect(req(when-completed(corp-installstatesidetargetnilnil)(do(system-msgstateside(str"uses Friends in High Places to "(corp-install-msgtarget)))(if(<n2)(continue-abilitystateside(fhp(incn))cardnil)(effect-completedstatesideeidcard)))))})]{:delayed-completiontrue:effect(effect(continue-ability(fhelper1)cardnil))})
{:req(req(:made-runrunner-reg)):trace{:base4:delayed-completiontrue:msg"give the Runner 4 tags":label"Give the Runner 4 tags":effect(effect(tag-runner:runnereid4))}}
(letfn[(hr-final[chosenoriginal]{:prompt(str"The top cards of R&D will be "(clojure.string/join", "(map:titlechosen))"."):choices["Done""Start over"]:delayed-completiontrue:effect(req(if(=target"Done")(do(doseq[c(reversechosen)](movestate:corpc:deck{:fronttrue}))(clear-wait-promptstate:runner)(effect-completedstatesideeidcard))(continue-abilitystateside(hr-choiceoriginal'()3original)cardnil)))})(hr-choice[remainingchosennoriginal]{:prompt"Choose a card to move next onto R&D":choicesremaining:delayed-completiontrue:effect(req(let[chosen(constargetchosen)](if(<(countchosen)n)(continue-abilitystateside(hr-choice(remove-once#(not=target%)remaining)chosennoriginal)cardnil)(continue-abilitystateside(hr-finalchosenoriginal)cardnil))))})]{:delayed-completiontrue:msg"trash the top card of R&D, draw 3 cards, and add 3 cards in HQ to the top of R&D":effect(req(millstate:corp)(drawstateside3)(show-wait-promptstate:runner"Corp to add 3 cards in HQ to the top of R&D")(let[from(get-in@state[:corp:hand])](continue-abilitystate:corp(hr-choicefrom'()3from)cardnil)))})
{:trace{:base5:choices{:req#(and(installed?%)(card-is?%:side:runner)(not(has-subtype?%"Virtual")))}:msg"add an installed non-virtual card to the Runner's grip":effect(effect(move:runnertarget:handtrue))}}
{:req(req(:installed-resourcerunner-reg)):trace{:base2:choices{:req#(and(installed?%)(is-type?%"Resource"))}:msg"add a Resource to the top of the Stack":effect(effect(move:runnertarget:deck{:fronttrue})(system-msg(str"adds "(:titletarget)" to the top of the Stack"))):unsuccessful{:msg"take 1 bad publicity":effect(effect(gain:corp:bad-publicity1))}}}
{:delayed-completiontrue:effect(effect(draw3)(continue-ability{:prompt"Choose a card in HQ to put on top of R&D":choices{:req#(and(in-hand?%)(=(:side%)"Corp"))}:msg"draw 3 cards and add 1 card from HQ to the top of R&D":effect(effect(movetarget:deck{:fronttrue}))}cardnil))}
{:events{:runner-install{:player:runner:choices{:req#(and(in-hand?%)(=(:side%)"Runner"))}:prompt"Choose a card from your Grip to trash for Housekeeping":once:per-turn:msg(msg"force the Runner to trash "(:titletarget)" from their Grip"):effect(effect(trashtarget{:unpreventabletrue}))}}}
{:prompt"Choose a card to install from Archives or HQ":show-discardtrue:not-distincttrue:choices{:req#(and(not(is-type?%"Operation"))(=(:side%)"Corp")(#{[:hand][:discard]}(:zone%)))}:effect(final-effect(corp-installtargetnil{:no-install-costtrue})):msg(msg(corp-install-msgtarget))}
(letfn[(iop[x]{:delayed-completiontrue:req(req(pos?(count(filter#(or(is-type?%"Resource")(is-type?%"Event"))(:handrunner))))):prompt"Choose a resource or event to trash":msg(msg"trash "(:titletarget)):choices(req(cancellable(filter#(or(is-type?%"Resource")(is-type?%"Event"))(:handrunner)):sorted)):effect(req(trashstatesidetarget)(if(pos?x)(continue-abilitystateside(iop(decx))cardnil)(effect-completedstatesideeidcard)))})]{:trace{:base2:msg"reveal the Runner's Grip and trash up to X resources or events":effect(req(let[x(-target(secondtargets))](system-msgstate:corp(str"reveals the Runner's Grip ( "(join", "(map:title(:handrunner)))" ) and can trash up to "x" resources or events"))(continue-abilitystateside(iop(decx))cardnil))):unsuccessful{:msg"take 1 bad publicity":effect(effect(gain:corp:bad-publicity1))}}})
{:delayed-completiontrue:msg"gain 4 [Credits]":effect(effect(gain:credit4)(continue-ability{:player:corp:prompt"Choose a card to install":delayed-completiontrue:choices{:req#(and(=(:side%)"Corp")(not(is-type?%"Operation"))(in-hand?%))}:effect(effect(corp-installeidtargetnilnil)):msg(msg(corp-install-msgtarget))}cardnil))}
{:delayed-completiontrue:effect(req(let[n(count(filter#(and(rezzed?%)(not(is-type?%"Agenda")))(all-installedstate:corp)))](continue-abilitystateside{:prompt"Choose any number of rezzed cards to trash":choices{:maxn:req#(and(rezzed?%)(not(is-type?%"Agenda")))}:msg(msg"trash "(join", "(map:titletargets))" and gain "(*(counttargets)3)" [Credits]"):effect(req(doseq[ctargets](trashstatesidec))(gainstateside:credit(*(counttargets)3)))}cardnil)))}
{:prompt"Choose a card":choices(req(cancellable(:deckcorp):sorted)):delayed-completiontrue:effect(req(let[c(:titletarget)cs(filter#(=(:title%)c)(:deckcorp))](continue-abilitystateside{:prompt"How many copies?":choices{:number(req(countcs))}:msg(msg"add "target" cop"(if(=target1)"y""ies")" of "c" to HQ"):effect(req(shuffle!state:corp:deck)(doseq[c(taketargetcs)](movestatesidec:hand)))}cardnil)))}
{:events{:successful-run{:interactive(reqtrue):req(req(first-event?stateside:successful-run)):trace{:base2:msg"give the Runner 1 tag":delayed-completiontrue:effect(effect(tag-runner:runnereid1))}}}}
{:req(req(:stole-agendarunner-reg)):trace{:base6:msg"give the Runner X tags":label"Give the Runner X tags":delayed-completiontrue:effect(effect(system-msg(str"gives the Runner "(-target(secondtargets))" tags"))(tag-runner:runnereid(-target(secondtargets))))}}
{:prompt"Choose a card to install from HQ":choices{:req#(and(#{"Asset""Agenda""Upgrade"}(:type%))(=(:side%)"Corp")(in-hand?%))}:effect(req(corp-installstateside(assoctarget:advance-counter3)"New remote")(effect-completedstatesideeidcard)(let[tgtcid(:cidtarget)](register-turn-flag!statesidecard:can-rez(fn[statesidecard](if(=(:cidcard)tgtcid)((constantlyfalse)(toaststate:corp"Cannot rez due to Mushin No Shin.""warning"))true)))(register-turn-flag!statesidecard:can-score(fn[statesidecard](if(and(=(:cidcard)tgtcid)(>=(:advance-countercard)(or(:current-costcard)(:advancementcostcard))))((constantlyfalse)(toaststate:corp"Cannot score due to Mushin No Shin.""warning"))true)))))}
{:req(req(seq(filter(every-predrezzed?ice?)(all-installedstate:corp)))):prompt"Choose a rezzed piece of ICE to trash":choices{:req(every-predrezzed?ice?)}:msg(msg"to trash "(:titletarget)):effect(req(let[i(ice-indexstatetarget)[revealr](split-with(complementice?)(get-in@state[:corp:deck]))titles(->>(conj(vecreveal)(firstr))(filteridentity)(map:title))](trashstatesidetarget{:cause:ability-cost:keep-server-alivetrue})(when(seqtitles)(system-msgstateside(str"reveals "(clojure.string/join", "titles)" from R&D")))(if-let[ice(firstr)](let[newice(associce:zone(:zonetarget):rezzedtrue)ices(get-in@state(cons:corp(:zonetarget)))newices(applyconj(subvecices0i)newice(subvecicesi))](swap!stateassoc-in(cons:corp(:zonetarget))newices)(swap!stateupdate-in[:corp:deck](fn[coll](remove-once#(not=(:cid%)(:cidnewice))coll)))(trigger-eventstateside:corp-installnewice)(card-initstatesidenewicefalse)(system-msgstateside(str"uses Mutate to install and rez "(:titlenewice)" from R&D at no cost"))(trigger-eventstateside:reznewice))(system-msgstateside(str"does not find any ICE to install from R&D")))(shuffle!state:corp:deck)(effect-completedstatesideeidcard)))}
{:req(req(and(pos?(:tagrunner))(<(:creditrunner)6))):delayed-completiontrue:effect(effect(continue-ability{:prompt"Choose an installed card to trash":choices{:reqinstalled?}:msg(msg"remove 1 Runner tag and trash "(:titletarget)):effect(effect(lose:runner:tag1)(trashtarget))}cardnil))}
{:implementation"Trashing ICE is manual":choices{:req#(and(ice?%)(not(rezzed?%))(=(last(:zone%)):ices))}:msg(msg"rez "(:titletarget)" at no cost"):effect(final-effect(reztarget{:ignore-cost:all-costs})(host(get-cardstatetarget)(assoccard:zone[:discard]:seentrue)))}
{:choices{:req#(and(ice?%)(rezzed?%))}:msg(msg"give +2 strength to "(card-strstatetarget)):effect(final-effect(hosttarget(assoccard:zone[:discard]:seentrue))(update-ice-strength(get-cardstatetarget))):events{:pre-ice-strength{:req(req(=(:cidtarget)(:cid(:hostcard)))):effect(effect(ice-strength-bonus2target))}}}
{:trace{:base2:msg"trash 1 piece of hardware":delayed-completiontrue:effect(req(let[max-cost(-target(secondtargets))](continue-abilitystateside{:choices{:req#(and(is-type?%"Hardware")(<=(:cost%)max-cost))}:msg(msg"trash "(:titletarget)):effect(effect(trashtarget))}cardnil))(system-msgstate:corp(str"trashes 1 piece of hardware with install cost less than or equal to "(-target(secondtargets)))))}}
{:req(req(:made-runrunner-reg)):prompt"Trash how many cards from the top R&D?":choices{:number(req(count(:deckcorp)))}:msg(msg"trash "target" cards from the top of R&D"):delayed-completiontrue:effect(req(millstate:corptarget)(let[ntarget](continue-abilitystate:runner{:prompt"Choose a Program or piece of Hardware to trash":choices{:req#(and(#{"Hardware""Program"}(:type%))(<=(:cost%)n))}:msg(msg"trash "(:titletarget)):effect(effect(trashtarget))}cardnil)))}
{:delayed-completiontrue:msg"rearrange the top 5 cards of R&D":effect(req(show-wait-promptstate:runner"Corp to rearrange the top cards of R&D")(let[from(take5(:deckcorp))](if(pos?(countfrom))(continue-abilitystateside(reorder-choice:corp:runnerfrom'()(countfrom)from)cardnil)(do(clear-wait-promptstate:runner)(effect-completedstatesideeidcard)))))}
{:prompt"Choose a rezzed asset or upgrade to trash":choices{:req#(and(rezzed?%)(or(is-type?%"Asset")(is-type?%"Upgrade")))}:effect(req(let[ctarget](trigger-eventstateside:pre-trashc)(let[tcost(trash-coststatesidec)](trashstatesidec)(gainstate:corp:credittcost)(resolve-abilitystateside{:msg(msg"trash "(card-strstatec)" and gain "tcost" [Credits]")}cardnil)(swap!stateupdate-in[:bonus]dissoc:trash)(effect-completedstatesideeidcard))))}
{:req(reqtagged):choices:credit:prompt"How many credits?":delayed-completiontrue:effect(req(let[c(mintarget(:tagrunner))](continue-abilitystateside{:msg(msg"place "c" advancement tokens on "(card-strstatetarget)):choices{:reqcan-be-advanced?}:effect(effect(add-proptarget:advance-counterc{:placedtrue}))}cardnil)))}
{:trace{:base5:msg"do meat damage equal to the number of agenda points stolen last turn":effect(effect(damageeid:meat(or(get-inrunner[:register:stole-agenda])0){:cardcard})(system-msg(str"does "(or(:stole-agendarunner-reg)0)" meat damage")))}}
{:prompt"Choose a card from Archives":show-discardtrue:choices{:req#(and(=(:side%)"Corp")(not=(:title%)"Reclamation Order")(=(:zone%)[:discard]))}:msg(msg"name "(:titletarget)):effect(req(let[title(:titletarget)cards(filter#(=title(:title%))(:discardcorp))n(countcards)](continue-abilitystateside{:prompt(str"Choose how many copies of "title" to reveal"):choices{:number(reqn)}:msg(msg"reveal "target" cop"(if(=1target)"y""ies")" of "title" from Archives"(when(pos?target)(str" and add "(if(=1target)"it""them")" to HQ"))):effect(req(doseq[c(->>cards(sort-by:seen)reverse(taketarget))](movestatesidec:hand)))}cardnil)))}
(let[rthelp(fnrt[totalleftselected](if(pos?left){:prompt(str"Select a sysop ("(inc(-totalleft))"/"total")"):choices(req(cancellable(filter#(and(has-subtype?%"Sysop")(not(some#{(:title%)}selected)))(:deckcorp)):sorted)):msg(msg"put "(:titletarget)" into HQ"):delayed-completiontrue:effect(req(movestatesidetarget:hand)(continue-abilitystateside(rttotal(decleft)(cons(:titletarget)selected))cardnil))}{:effect(effect(shuffle!:corp:deck)):msg(msg"shuffle R&D")}))]{:prompt"How many sysops?":delayed-completiontrue:choices:credit:msg(msg"search for "target" sysops"):effect(effect(continue-ability(rthelptargettarget[])cardnil))})
{:prompt"Choose a Sysop, Executive or Clone to trash":msg(msg"trash "(card-strstatetarget)" to remove 2 bad publicity"):choices{:req#(and(rezzed?%)(or(has-subtype?%"Clone")(has-subtype?%"Executive")(has-subtype?%"Sysop")))}:effect(final-effect(lose:bad-publicity2)(trashtarget))}
{:delayed-completiontrue:effect(req(let[n(count(:handcorp))](continue-abilitystateside{:prompt(msg"Choose up to "n" cards in HQ to trash with Reuse"):choices{:maxn:req#(and(=(:side%)"Corp")(in-hand?%))}:msg(msg"trash "(counttargets)" card"(if(not=1(counttargets))"s")" and gain "(*2(counttargets))" [Credits]"):effect(effect(trash-cardstargets)(gain:credit(*2(counttargets))))}cardnil)))}
{:prompt"Choose a card from HQ to shuffle into R&D":choices{:req#(and(in-hand?%)(=(:side%)"Corp"))}:msg"shuffle a card from HQ into R&D":effect(final-effect(movetarget:deck)(shuffle!:deck))}
{:prompt"Name a Runner card":choices{:card-title(req(and(card-is?target:side"Runner")(not(card-is?target:type"Identity"))))}:effect(req(system-msgstateside(str"uses Salem's Hospitality to reveal the Runner's Grip ( "(join", "(map:title(:handrunner)))" ) and trash any copies of "target))(doseq[c(filter#(=target(:title%))(:handrunner))](trashstatesidec{:unpreventabletrue})))}
{:msg"increase the install cost of resources by 2":events{:pre-install{:req(req(and(is-type?target"Resource")(not(secondtargets)))); not facedown
:effect(effect(install-cost-bonus[:credit2]))}}}
{:req(req(:successful-runrunner-reg)):trace{:base3:msg"give the Runner 1 tag":label"Give the Runner 1 tag":delayed-completiontrue:effect(effect(tag-runner:runnereid1))}}
(let[add-effect(fn[statesidecard](update!stateside(assoccard:so-activatedtrue))(run-cost-bonusstateside[:credit1]))remove-effect(fn[statesidecard](run-cost-bonusstateside[:credit-1])(update!stateside(dissoccard:so-activated)))remove-ability{:req(req(:so-activatedcard)):effect(effect(remove-effectcard))}]{:msg(msg(when(and(=:runner(:active-player@state))(empty?(:made-runrunner-reg)))"add an additional cost of 1 [Credit] to make the first run this turn")):effect(req(when(and(=:runner(:active-player@state))(empty?(:made-runrunner-reg)))(add-effectstatesidecard))):events{:runner-turn-begins{:msg"add an additional cost of 1 [Credit] to make the first run this turn":effect(effect(add-effectcard))}:runner-turn-endsremove-ability:run-endsremove-ability}:leave-play(req(when(:so-activatedcard)(remove-effectstatesidecard)))})
(let[shelper(fnsh[n]{:prompt"Select a card to install with Shipment from MirrorMorph":priority-1:delayed-completiontrue:choices{:req#(and(=(:side%)"Corp")(not(is-type?%"Operation"))(in-hand?%))}:effect(req(when-completed(corp-installstatesidetargetnilnil)(if(<n3)(continue-abilitystateside(sh(incn))cardnil)(effect-completedstatesideeidcard))))})]{:delayed-completiontrue:effect(effect(continue-ability(shelper1)cardnil))})
{:choices["0","1","2"]:prompt"How many advancement tokens?":delayed-completiontrue:effect(req(let[c(Integer/parseInttarget)](continue-abilitystateside{:choices{:reqcan-be-advanced?}:msg(msg"place "c" advancement tokens on "(card-strstatetarget)):effect(effect(add-prop:corptarget:advance-counterc{:placedtrue}))}cardnil)))}
{:trace{:msg"trash a connection":base3:choices{:req#(has-subtype?%"Connection")}:delayed-completiontrue:effect(req(let[ctarget](continue-abilitystateside{:prompt(msg"Take 1 tag to prevent "(:titlec)" from being trashed?"):choices["Yes""No"]:player:runner:delayed-completiontrue:effect(effect(continue-ability(if(=target"Yes"){:msg(msg"take 1 tag to prevent "(:titlec)" from being trashed"):delayed-completiontrue:effect(effect(tag-runnereid1{:unpreventabletrue}))}{:delayed-completiontrue:effect(effect(trasheidcnil)):msg(msg"trash "(:titlec))})cardnil))}cardnil)))}}
{:prompt"Choose any number of cards in HQ to shuffle into R&D":choices{:max(req(count(:handcorp))):req#(and(=(:side%)"Corp")(in-hand?%))}:msg(msg"shuffle "(counttargets)" cards in HQ into R&D and draw "(counttargets)" cards"):effect(req(doseq[ctargets](movestatesidec:deck))(shuffle!stateside:deck)(drawstateside(counttargets))(effect-completedstatesideeidcard))}
{:choices{:req#(and(ice?%)(rezzed?%))}:msg(msg"make "(card-strstatetarget)" gain Barrier and \"[Subroutine] End the run\""):effect(effect(update!(assoctarget:subtype(combine-subtypestrue(:subtypetarget)"Barrier")))(update-ice-strengthtarget)(host(get-cardstatetarget)(assoccard:zone[:discard]:seentrue)))}
(letfn[(sc[isccard]{:prompt"Select an operation in HQ to play":choices{:req#(and(=(:side%)"Corp")(is-type?%"Operation")(in-hand?%))}:delayed-completiontrue:msg(msg"play "(:titletarget)):effect(req(when-completed(play-instantstatesidetarget)(if(and(not(get-in@state[:corp:register:terminal]))(<i2))(continue-abilitystateside(sc(inci)sccard)sccardnil)(effect-completedstatesideeid))))})]{:req(reqtagged):delayed-completiontrue:effect(effect(continue-ability(sc1card)cardnil))})
(letfn[(sun[serv]{:prompt"Select two pieces of ICE to swap positions":choices{:req#(and(=serv(rest(butlast(:zone%))))(ice?%)):max2}:delayed-completiontrue:effect(req(if(=(counttargets)2)(do(swap-icestateside(firsttargets)(secondtargets))(continue-abilitystateside(sunserv)cardnil))(do(system-msgstateside"has finished rearranging ICE")(effect-completedstatesideeidcard))))})]{:prompt"Choose a server":choices(reqservers):delayed-completiontrue:msg(msg"rearrange ICE protecting "target):effect(req(let[serv(next(server->zonestatetarget))](continue-abilitystateside(sunserv)cardnil)))})
(let[gaincr{:req(req(=(:titletarget)(:marketing-targetcard))):effect(effect(gain:corp:credit10)):msg(msg"gain 10 [Credits] from "(:marketing-targetcard))}]{:prompt"Name a Runner card":choices{:card-title(req(and(card-is?target:side"Runner")(not(card-is?target:type"Identity"))))}:effect(effect(update!(assoccard:marketing-targettarget))(system-msg(str"uses Targeted Marketing to name "target))):events{:runner-installgaincr:play-eventgaincr}})
(let[trash-all-resources{:player:runner:effect(req(doseq[resource(get-inrunner[:rig:resource])](trashstatesideresource))):msg(msg"trash all resources")}]{:req(reqtagged):delayed-completiontrue:effect(effect(continue-ability(if-not(zero?(:bad-publicitycorp));; If corp's bad-pub is 0
{:optional{:player:runner:prompt"Remove 1 bad publicity from the corp to prevent all resources from being trashed?":yes-ability{:effect(effect(lose:corp:bad-publicity1)):player:corp:msg(msg"lose 1 bad publicity, preventing all resources from being trashed")}:no-abilitytrash-all-resources}}trash-all-resources)cardtargets))})
{:choices{:req#(and(contains?%:advance-counter)(>(:advance-counter%)0))}:delayed-completiontrue:effect(req(let[frtargettolcard](continue-abilitystateside{:prompt"Move how many advancement tokens?":choices(take(inc(:advance-counterfr))["0""1""2"]):delayed-completiontrue:effect(req(let[c(Integer/parseInttarget)](continue-abilitystateside{:prompt"Move to where?":choices{:req#(and(not=(:cidfr)(:cid%))(can-be-advanced?%))}:effect(effect(add-prop:corptarget:advance-counterc{:placedtrue})(add-prop:corpfr:advance-counter(-c){:placedtrue})(system-msg(str"moves "c" advancement tokens from "(card-strstatefr)" to "(card-strstatetarget))))}tolnil)))}cardnil)))}
{:choices{:req#(and(ice?%)(has-subtype?%"Bioroid")(rezzed?%))}:msg(msg"give "(card-strstatetarget)"\"[Subroutine] Do 1 brain damage\" before all its other subroutines"):effect(effect(update!(assoctarget:subroutines(cons(do-brain-damage1)(:subroutinestarget))))(host(get-cardstatetarget)(assoccard:zone[:discard]:seentrue))):leave-play(effect(update!(assoc(:hostcard):subroutines(rest(:subroutines(:hostcard))))))}
{:req(req(seq(:scoredrunner))):psi{:not-equal{:player:corp:prompt"Choose a resource to trash":choices{:req#(and(installed?%)(is-type?%"Resource"))}:msg(msg"trash "(:titletarget)):effect(effect(trashtarget))}}}