{:abilities[{:cost[:click1]:msg"make a run on R&D":makes-runtrue:effect(effect(run:rd{:req(req(=target:rd)):replace-access{:prompt"Choose a card to shuffle into R&D":choices{:req#(and(not(ice?%))(not(rezzed?%))(not(:advance-counter%)))}:effect(req(movestate:corptarget:deck)(shuffle!state:corp:deck)(swap!stateupdate-in[:runner:prompt]rest)(handle-end-runstateside)); remove the replace-access prompt
:msg"shuffle a card into R&D"}}card))}]}
{:abilities[{:cost[:click1]:effect(req(let[b(get-cardstatecard)hosted?(ice?(:hostb))remote?(is-remote?(second(:zone(:hostb))))](resolve-abilitystateside{:prompt(msg"Host Bishop on a piece of ICE protecting "(ifhosted?(ifremote?"a central""a remote")"any")" server"):choices{:req#(ifhosted?(and(ifremote?(is-central?(second(:zone%)))(is-remote?(second(:zone%))))(ice?%)(=(last(:zone%)):ices)(not(some(fn[c](has-subtype?c"Caïssa"))(:hosted%))))(and(ice?%)(=(last(:zone%)):ices)(not(some(fn[c](has-subtype?c:subtype"Caïssa"))(:hosted%)))))}:msg(msg"host it on "(card-strstatetarget)):effect(effect(hosttargetcard))}cardnil)))}]:events{:pre-ice-strength{:req(req(and(=(:cidtarget)(:cid(:hostcard)))(:rezzedtarget))):effect(effect(ice-strength-bonus-2target))}}}
{:implementation"Can only pay to see last card drawn after multiple draws":req(req(some#{:hq}(:successful-runrunner-reg))):events{:corp-draw{:optional{:prompt(msg"Pay 2 [Credits] to reveal card just drawn?"):player:runner:yes-ability{:msg(msg"reveal the card just drawn: "(:title(last(:handcorp)))):cost[:credit2]}}}}}
{:abilities[{:req(req(and(:run@state)(:rezzedcurrent-ice))):effect(req(let[icename(:titlecurrent-ice)](resolve-abilitystateside{:prompt(msg"Choose a rezzed copy of "icename):choices{:req#(and(rezzed?%)(ice?%)(=(:title%)icename))}:msg"redirect the run":effect(req(let[dest(second(:zonetarget))tgtndx(ice-indexstatetarget)](swap!stateupdate-in[:run]#(assoc%:positiontgtndx:server[dest]))(trashstatesidecard{:cause:ability-cost})))}cardnil)))}]}
{:implementation"Does not check that all subroutines were broken":abilities[{:req(req(rezzed?current-ice)):msg(msg"derez "(:titlecurrent-ice)):effect(effect(trashcard{:cause:ability-cost})(derezcurrent-ice))}]}
{:implementation"Does not check that ICE strength is 5 or greater":data{:counter{:power3}}:abilities[{:counter-cost[:power1]:msg"break 1 subroutine"}]}
{:events{:successful-run{:silent(reqtrue):effect(effect(add-countercard:power1))}}:abilities[{:effect(req(let[ccard](resolve-abilitystateside{:prompt"Choose a card to install from your Grip":choices{:req#(and(<=(:cost%)(get-inc[:counter:power]0))(#{"Hardware""Program""Resource"}(:type%))(in-hand?%))}:msg(msg"install "(:titletarget)" at no cost"):effect(effect(trashcard{:cause:ability-cost})(runner-installtarget{:no-costtrue}))}cardnil)))}]}
{:events(let[ds{:effect(req(update!stateside(dissoccard:datasucker-count)))}]{:successful-run{:silent(reqtrue):effect(effect(add-countercard:virus1)):req(req(#{:hq:rd:archives}target))}:pre-ice-strength{:req(req(and(=(:cidtarget)(:cidcurrent-ice))(:datasucker-countcard))):effect(req(let[c(:datasucker-count(get-cardstatecard))](ice-strength-bonusstateside(-c)target)))}:pass-iceds:run-endsds}):abilities[{:counter-cost[:virus1]:msg(msg"give -1 strength to "(:titlecurrent-ice)):req(req(andcurrent-ice(:rezzedcurrent-ice))):effect(req(update!stateside(update-incard[:datasucker-count](fnil#(+%1)0)))(update-ice-strengthstatesidecurrent-ice))}]}
{:events{:successful-run{:silent(reqtrue):effect(effect(add-countercard:virus1)):req(req(=target:rd))}:runner-turn-begins{:req(req(>=(get-virus-countersstatesidecard)3)):msg"look at the top card of R&D":effect(effect(prompt!card(str"The top card of R&D is "(:title(first(:deckcorp))))["OK"]{}))}}}
{:prompt"Choose the server that this copy of Diwan is targeting:":choices(reqservers):effect(effect(update!(assoccard:server-targettarget))):events{:purge{:effect(effect(trashcard))}:pre-corp-install{:req(req(let[ctargetserv(:server(secondtargets))](and(=serv(:server-targetcard))(not(and(is-central?serv)(is-type?c"Upgrade")))))):effect(effect(install-cost-bonus[:credit1]))}}}
{:abilities[{:label"Search your Stack for a virus program and add it to your Grip":prompt"Choose a Virus":msg(msg"add "(:titletarget)" to their Grip"):choices(req(cancellable(filter#(and(is-type?%"Program")(has-subtype?%"Virus"))(:deckrunner)):sorted)):cost[:click1:credit1]:effect(effect(trigger-event:searched-stacknil)(shuffle!:deck)(movetarget:hand))}{:label"Install a non-Icebreaker program on Djinn":effect(effect(resolve-ability{:cost[:click1]:prompt"Choose a non-Icebreaker program in your Grip to install on Djinn":choices{:req#(and(is-type?%"Program")(runner-can-install?stateside%false)(not(has-subtype?%"Icebreaker"))(in-hand?%))}:msg(msg"install and host "(:titletarget)):effect(effect(gain:memory(:memoryunitstarget))(runner-installtarget{:host-cardcard})(update!(assoc(get-cardstatecard):hosted-programs(cons(:cidtarget)(:hosted-programscard)))))}cardnil))}{:label"Host an installed non-Icebreaker program on Djinn":prompt"Choose an installed non-Icebreaker program to host on Djinn":choices{:req#(and(is-type?%"Program")(not(has-subtype?%"Icebreaker"))(installed?%))}:msg(msg"host "(:titletarget)):effect(effect(hostcardtarget)(gain:memory(:memoryunitstarget))(update!(assoc(get-cardstatecard):hosted-programs(cons(:cidtarget)(:hosted-programscard)))))}]:events{:card-moved{:req(req(some#{(:cidtarget)}(:hosted-programscard))):effect(effect(update!(assoccard:hosted-programs(remove#(=(:cidtarget)%)(:hosted-programscard))))(lose:memory(:memoryunitstarget)))}}}
(let[force-draw(fn[title]{:optional{:prompt(str"Force the Corp to draw "title"?"):yes-ability{:effect(effect(draw:corp1)(system-msg:corp(str"is forced to draw "title)))}}})reveal{:optional{:prompt"Reveal the top card of R&D?":yes-ability{:delayed-completiontrue:effect(req(let[topcard(->corp:deckfirst:title)](system-msgstate:runner(str"reveals "topcard" from the top of R&D"))(continue-abilitystateside(force-drawtopcard)cardnil)))}}}]{:events{:successful-run{:req(req(=target:rd)):delayed-completiontrue:interactive(reqtrue):effect(effect(continue-abilityrevealcardnil))}}})
{:abilities[{:cost[:click1]:msg"make a run on HQ":makes-runtrue:effect(effect(run:hq{:req(req(=target:hq)):replace-access{:msg(msg"reveal cards in HQ: "(join", "(map:title(:handcorp))))}}card))}]}
{:abilities[{:req(req(andrun(<(:positionrun)(countrun-ices))(not(rezzed?current-ice)))):msg"make the Corp rez the passed ICE or add it to HQ":effect(req(let[s(:serverrun)ice(nth(get-in@state(vec(concat[:corp:servers]s[:ices])))(:positionrun))icename(:titleice)icecost(rez-coststatesideice)](continue-abilitystateside{:prompt(msg"Rez "icename" or add it to HQ?"):player:corp:choices(req(if(<(:creditcorp)icecost)["Add to HQ"]["Rez""Add to HQ"])):effect(req(if(=target"Rez")(rezstatesideice)(do(movestate:corpice:handnil)(system-msgstate:corp(str"chooses to add the passed ICE to HQ"))))(trashstatesidecard))}cardnil)))}]}
{:events(let[e{:req(req(and(installed?target)(=(:sidetarget)"Corp"))):effect(effect(add-counter:runnercard:virus1))}]{:runner-trashe:corp-trashe}):abilities[{:counter-cost[:virus1]:cost[:click1]:msg"force the Corp to trash the top card of R&D":effect(effect(mill:corp))}]}
{:events{:successful-run{:silent(reqtrue):effect(effect(add-countercard:virus1))}}:abilities[{:counter-cost[:virus2]:cost[:click1]:req(req(>(count(:handcorp))0)):msg"force the Corp to trash 1 card from HQ":effect(req(show-wait-promptstate:runner"Corp to trash a card from HQ")(resolve-abilitystate:corp{:prompt"Choose a card to trash":choices(req(filter#(=(:side%)"Corp")(:handcorp))):effect(effect(trashtarget)(clear-wait-prompt:runner))}cardnil))}]}
{:data{:counter{:virus1}}:abilities[{:req(req(>(get-incard[:counter:virus])0)):prioritytrue:prompt"Move a virus counter to which card?":choices{:req#(has-subtype?%"Virus")}:effect(req(let[abilities(:abilities(card-deftarget))virustarget](add-counterstate:runnervirus:virus1)(add-counterstate:runnercard:virus-1)(if(=(countabilities)1)(do(swap!stateupdate-in[side:prompt]rest); remove the Hivemind prompt so Imp works
(resolve-abilitystateside(firstabilities)(get-cardstatevirus)nil))(resolve-abilitystateside{:prompt"Choose an ability to trigger":choices(vec(map:msgabilities)):effect(req(swap!stateupdate-in[side:prompt]rest)(resolve-abilitystateside(first(filter#(=(:msg%)target)abilities))cardnil))}(get-cardstatevirus)nil)))):msg(msg"to trigger an ability on "(:titletarget))}]}
{:flags{:runner-phase-12(reqtrue)}:abilities[{:label"Remove Hyperdriver from the game to gain [Click] [Click] [Click]":req(req(:runner-phase-12@state)):effect(effect(movecard:rfg)(gain:memory3:click3)):msg"gain [Click] [Click] [Click]"}]}
{:flags{:slow-trash(req(pos?(get-incard[:counter:virus]0)))}:data{:counter{:virus2}}:abilities[{:counter-cost[:virus1]:msg"trash at no cost":once:per-turn:effect(effect(trash-no-cost))}]}
{:abilities[{:cost[:click1]:msg"make a run on R&D":makes-runtrue:effect(effect(run:rd{:req(req(=target:rd)):replace-access{:prompt"Choose a card to trash":not-distincttrue:msg(msg"trash "(:titletarget)):choices(req(take3(:deckcorp))):mandatorytrue:effect(effect(trash(assoctarget:seentrue))(shuffle!:corp:deck))}}card))}]}
{:events{:successful-run{:req(req(=target:hq)):msg"force the Corp to lose 1 [Credits]":effect(effect(lose:corp:credit1))}:purge{:effect(effect(trashcard))}}}
{:abilities[{:label"Install a program on Leprechaun":req(req(<(count(:hostedcard))2)):effect(effect(resolve-ability{:cost[:click1]:prompt"Choose a program in your Grip to install on Leprechaun":choices{:req#(and(is-type?%"Program")(runner-can-install?stateside%false)(in-hand?%))}:msg(msg"host "(:titletarget)):effect(effect(gain:memory(:memoryunitstarget))(runner-installtarget{:host-cardcard})(update!(assoc(get-cardstatecard):hosted-programs(cons(:cidtarget)(:hosted-programscard)))))}cardnil))}{:label"Host an installed program on Leprechaun":req(req(<(count(:hostedcard))2)):prompt"Choose an installed program to host on Leprechaun":choices{:req#(and(is-type?%"Program")(installed?%))}:msg(msg"host "(:titletarget)):effect(effect(hostcardtarget)(gain:memory(:memoryunitstarget))(update!(assoc(get-cardstatecard):hosted-programs(cons(:cidtarget)(:hosted-programscard)))))}]:events{:card-moved{:req(req(some#{(:cidtarget)}(:hosted-programscard))):effect(effect(update!(assoccard:hosted-programs(remove#(=(:cidtarget)%)(:hosted-programscard))))(lose:memory(:memoryunitstarget)))}}}
{:prevent{:trash[:hardware]}:abilities[{:cost[:credit3]:msg"prevent a hardware from being trashed":effect(effect(trash-prevent:hardware1))}{:label"[Trash]: Prevent a hardware from being trashed":msg"prevent a hardware from being trashed":effect(effect(trash-prevent:hardware1)(trashcard{:cause:ability-cost}))}]}
{:events{:successful-run{:req(req(=target:rd)):effect(effect(add-countercard:virus1))}:pre-access{:delayed-completiontrue:req(req(=target:rd)):effect(effect(continue-ability{:req(req(<1(get-virus-countersstatesidecard))):prompt"Choose how many additional R&D accesses to make with Medium":choices{:number(req(dec(get-virus-countersstatesidecard))):default(req(dec(get-virus-countersstatesidecard)))}:msg(msg"access "target" additional cards from R&D"):effect(effect(access-bonus(max0target)))}cardnil))}}}
{:abilities[{:cost[:click2]:prompt"How many [Credits] to spend to remove that number of tags?":choices{:number(req(min(:creditrunner)(:tagrunner)))}:msg(msg"spend "target" [Credits] and remove "target" tags"):effect(effect(lose:credittarget)(lose:tagtarget))}]}
{:events{:successful-run{:req(req(=target:hq)):effect(effect(add-countercard:virus1))}:pre-access{:delayed-completiontrue:req(req(=target:hq)):effect(effect(continue-ability{:req(req(<1(get-virus-countersstatesidecard))):prompt"Choose how many additional HQ accesses to make with Nerve Agent":choices{:number(req(dec(get-virus-countersstatesidecard))):default(req(dec(get-virus-countersstatesidecard)))}:msg(msg"access "target" additional cards from HQ"):effect(effect(access-bonus(max0target)))}cardnil))}}}
{:abilities[{:cost[:click1]:choices{:req#(and(installed?%)(ice?%)(rezzed?%))}:effect(req(let[icetargetstypes(:subtypeice)](resolve-abilitystate:runner{:prompt(msg"Choose a subtype"):choices["Sentry""Code Gate""Barrier"]:msg(msg"make "(card-strstateice)" gain "(.toLowerCasetarget)" until the end of the next run this turn"):effect(effect(update!(associce:subtype(combine-subtypestruestypestarget)))(update-ice-strength(get-cardstateice))(register-events{:run-ends{:effect(effect(update!(associce:subtypestypes))(unregister-eventscard)(update-ice-strength(get-cardstateice)))}}card))}cardnil)))}]:events{:run-endsnil}}
{:implementation"All abilities are manual":abilities[{:label"Host Pawn on the outermost ICE of a central server":prompt"Host Pawn on the outermost ICE of a central server":cost[:click1]:choices{:req#(and(ice?%)(=(last(:zone%)):ices)(is-central?(second(:zone%))))}:msg(msg"host it on "(card-strstatetarget)):effect(effect(hosttargetcard))}{:label"Advance to next ICE":prompt"Choose the next innermost ICE to host Pawn on it":choices{:req#(and(ice?%)(=(last(:zone%)):ices)(is-central?(second(:zone%))))}:msg(msg"host it on "(card-strstatetarget)):effect(effect(hosttargetcard))}{:label"Trash Pawn and install a Caïssa from your Grip or Heap, ignoring all costs":effect(req(let[this-pawn(:cidcard)](resolve-abilitystateside{:prompt"Choose a Caïssa program to install from your Grip or Heap":show-discardtrue:choices{:req#(and(has-subtype?%"Caïssa")(not=(:cid%)this-pawn)(#{[:hand][:discard]}(:zone%)))}:msg(msg"install "(:titletarget)):effect(effect(runner-installtarget{:no-costtrue}))}cardnil)(trashstatesidecard)))}]}
{:abilities[{:label"Install a virus program on Progenitor":req(req(empty?(:hostedcard))):effect(effect(resolve-ability{:cost[:click1]:prompt"Choose a Virus program to install on Progenitor":choices{:req#(and(is-type?%"Program")(has-subtype?%"Virus")(in-hand?%))}:msg(msg"host "(:titletarget)):effect(effect(gain:memory(:memoryunitstarget))(runner-installtarget{:host-cardcard})(update!(assoc(get-cardstatecard):hosted-programs(cons(:cidtarget)(:hosted-programscard)))))}cardnil))}{:label"Host an installed virus on Progenitor":req(req(empty?(:hostedcard))):prompt"Choose an installed virus program to host on Progenitor":choices{:req#(and(is-type?%"Program")(has-subtype?%"Virus")(installed?%))}:msg(msg"host "(:titletarget)):effect(effect(hostcardtarget)(gain:memory(:memoryunitstarget))(update!(assoc(get-cardstatecard):hosted-programs(cons(:cidtarget)(:hosted-programscard)))))}]:events{:pre-purge{:effect(req(when-let[c(first(:hostedcard))](update!stateside(assoc-incard[:special:numpurged](get-inc[:counter:virus]0)))))}:purge{:req(req(pos?(or(get-incard[:special:numpurged])0))):effect(req(when-let[c(first(:hostedcard))](add-counterstatesidec:virus1)))}:card-moved{:req(req(some#{(:cidtarget)}(:hosted-programscard))):effect(effect(update!(assoccard:hosted-programs(remove#(=(:cidtarget)%)(:hosted-programscard))))(lose:memory(:memoryunitstarget)))}}}
{:abilities[{:cost[:click1]:effect(req(let[r(get-cardstatecard)hosted?(ice?(:hostr))icepos(ice-indexstate(get-cardstate(:hostr)))](resolve-abilitystateside{:prompt(ifhosted?(msg"Host Rook on a piece of ICE protecting this server or at position "icepos" of a different server")(msg"Host Rook on a piece of ICE protecting any server")):choices{:req#(ifhosted?(and(or(=(:zone%)(:zone(:hostr)))(=(ice-indexstate%)icepos))(=(last(:zone%)):ices)(ice?%)(not(some(fn[c](has?c:subtype"Caïssa"))(:hosted%))))(and(ice?%)(=(last(:zone%)):ices)(not(some(fn[c](has?c:subtype"Caïssa"))(:hosted%)))))}:msg(msg"host it on "(card-strstatetarget)):effect(effect(hosttargetcard))}cardnil)))}]:events{:pre-rez-cost{:req(req(=(:zone(:hostcard))(:zonetarget))):effect(effect(rez-cost-bonus2))}}}
{:abilities[{:cost[:credit2]:once:per-turn:msg(msg"install "(:titletarget)):prompt"Choose a program to install from your grip":choices{:req#(and(is-type?%"Program")(in-hand?%))}:effect(effect(runner-installtarget))}]}
{:abilities[{:label"Install and host a program from Grip":effect(effect(resolve-ability{:cost[:click1]:prompt"Choose a program to install on Scheherazade from your grip":choices{:req#(and(is-type?%"Program")(runner-can-install?stateside%false)(in-hand?%))}:msg(msg"host "(:titletarget)" and gain 1 [Credits]"):effect(effect(runner-installtarget{:host-cardcard})(gain:credit1))}cardnil))}{:label"Host an installed program":prompt"Choose a program to host on Scheherazade":priority2:choices{:req#(and(is-type?%"Program")(installed?%))}:msg(msg"host "(:titletarget)" and gain 1 [Credits]"):effect(req(when(hoststatesidecardtarget)(gainstateside:credit1)))}]}
{:abilities[{:effect(req(when-completed(trashstatesidecard{:cause:ability-cost})(continue-abilitystateside{:prompt"Choose a program to install":msg(req(if(not=target"No install")(str"install "(:titletarget))(str"shuffle their Stack"))):prioritytrue:choices(req(cancellable(conj(vec(sort-by:title(filter#(is-type?%"Program")(:deckrunner))))"No install"))):cost[:credit2]:effect(req(trigger-eventstateside:searched-stacknil)(trashstatesidecard{:cause:ability-cost})(shuffle!stateside:deck)(when(not=target"No install")(runner-installstatesidetarget)))}cardnil)))}]}
{:abilities[{:cost[:click1]:msg"make a run on Archives":makes-runtrue:effect(effect(run:archives{:req(req(=target:archives)):successful-run{:silent(reqtrue):effect(req(swap!stateassoc-in[:run:server][:hq]); remove the :req from the run-effect, so that other cards that replace
; access don't use Sneakdoor's req. (Security Testing, Ash 2X).
(swap!statedissoc-in[:run:run-effect:req])(trigger-eventstate:corp:no-action)(system-msgstateside(str"uses Sneakdoor Beta to make a successful run on HQ")))}}card))}]}
{:abilities[{:once:per-run:req(req(and(ice?current-ice)(not(rezzed?current-ice)))):delayed-completiontrue:effect(req(when-completed(exposestatesidecurrent-ice)(continue-abilitystateside{:optional{:prompt"Jack out?":yes-ability{:msg"jack out":effect(effect(jack-outnil))}:no-ability{:msg"continue the run"}}}cardnil)))}]}
(letfn[(surf[statecice]{:prompt(msg"Choose an ICE before or after "(:titlecice)):choices{:req#(and(ice?%)(=(:zone%)(:zonecice))(=1(abs(-(ice-indexstate%)(ice-indexstatecice)))))}:msg"swap a piece of barrier ICE":effect(req(let[tgtndx(ice-indexstatetarget)cidx(ice-indexstatecice)](swap!stateupdate-in(cons:corp(:zonecice))#(assoc%tgtndxcice))(swap!stateupdate-in(cons:corp(:zonecice))#(assoc%cidxtarget))(swap!stateupdate-in[:run]#(assoc%:position(inctgtndx)))(update-all-icestateside)(trigger-eventstateside:approach-icecurrent-ice)))})]{:abilities[{:cost[:credit2]:req(req(and(:run@state)(rezzed?current-ice)(has-subtype?current-ice"Barrier"))):label"Swap the barrier ICE currently being encountered with a piece of ICE directly before or after it":effect(effect(resolve-ability(surfstatecurrent-ice)cardnil))}]})
(let[ability{:prompt"Choose a server for Tracker":choices(reqservers):msg(msg"target "target):req(req(not(:server-targetcard))):effect(effect(update!(assoccard:server-targettarget)))}]{:abilities[{:label"Make a run on targeted server":cost[:click1:credit2]:req(req(:server-targetcard)):msg(msg"make a run on "(:server-targetcard)". Prevent the first subroutine that would resolve from resolving"):effect(effect(run(:server-targetcard)nilcard))}]:events{:runner-turn-beginsability:runner-turn-ends{:effect(effect(update!(dissoccard:server-target)))}}})
{:events{:runner-turn-begins{:effect(effect(add-countercard:power1))}}:abilities[{:cost[:click1]:label"[Click], remove Trope from the game: Reshuffle cards from Heap back into Stack":effect(effect(movecard:rfg)(gain:memory1)(resolve-ability{:show-discardtrue:choices{:max(get-incard[:counter:power]0):req#(and(=(:side%)"Runner")(=(:zone%)[:discard]))}:msg(msg"shuffle "(join", "(map:titletargets))" into their Stack"):effect(req(doseq[ctargets](movestatesidec:deck))(shuffle!stateside:deck))}cardnil))}]}