|
10 | 10 | [game.core.engine :refer [checkpoint end-of-phase-checkpoint register-pending-event pay queue-event resolve-ability trigger-event trigger-event-simult]] |
11 | 11 | [game.core.flags :refer [can-run? cards-can-prevent? clear-run-register! get-prevent-list prevent-jack-out]] |
12 | 12 | [game.core.gaining :refer [gain-credits]] |
13 | | - [game.core.ice :refer [active-ice? get-current-ice get-run-ices update-ice-strength reset-all-ice reset-all-subs! set-current-ice]] |
| 13 | + [game.core.ice :refer [active-ice? break-subs-event-context get-current-ice get-run-ices update-ice-strength reset-all-ice reset-all-subs! set-current-ice]] |
14 | 14 | [game.core.mark :refer [is-mark?]] |
15 | 15 | [game.core.payment :refer [build-cost-string build-spend-msg can-pay? merge-costs ->c]] |
16 | 16 | [game.core.prompts :refer [clear-run-prompts clear-wait-prompt show-run-prompts show-prompt show-wait-prompt]] |
|
334 | 334 | (checkpoint state side eid)))))}) |
335 | 335 |
|
336 | 336 | (defn encounter-ice |
| 337 | + ;; note: as far as I can tell, this deliberately leaves on open eid (the run eid). |
| 338 | + ;; Attempting to change that breaks a very large number of tests, so I'm leaving this |
| 339 | + ;; note here to remind me when I look at this later. -nbk, 2025 |
337 | 340 | [state side eid ice] |
338 | 341 | (swap! state update :encounters conj {:eid eid |
339 | 342 | :ice ice}) |
340 | 343 | (check-auto-no-action state) |
| 344 | + ;; step 6.9.3a: The encounter begins. Conditions relating to the Runner encountering |
| 345 | + ;; this ice are met (this is on-encounter effects, etc) |
341 | 346 | (let [on-encounter (:on-encounter (card-def ice)) |
342 | 347 | applied-encounters (get-effects state nil :gain-encounter-ability ice) |
343 | 348 | all-encounters (map #(preventable-encounter-abi % ice) (remove nil? (conj applied-encounters on-encounter)))] |
|
349 | 354 | (make-eid state) |
350 | 355 | {:cancel-fn (fn [state] |
351 | 356 | (should-end-encounter? state side ice))}) |
352 | | - (when (should-end-encounter? state side ice) |
353 | | - (encounter-ends state side eid))))) |
| 357 | + (if (should-end-encounter? state side ice) |
| 358 | + (encounter-ends state side eid) |
| 359 | + ;; step 6.9.3b: if there are no subroutines on the ice, |
| 360 | + ;; the runner is considered to have broken all the subroutines on this ice. |
| 361 | + ;; This should fire an event, so it can get picked up with cards like hippo |
| 362 | + ;; or knifed. |
| 363 | + (when-let [c-ice (get-current-ice state)] |
| 364 | + (when (and (same-card? c-ice ice) (zero? (count (:subroutines c-ice)))) |
| 365 | + (wait-for (trigger-event-simult state side :subroutines-broken nil (break-subs-event-context state c-ice [] (get-in @state [:runner :basic-action-card])))))))))) |
| 366 | + |
354 | 367 |
|
355 | 368 | (defmethod start-next-phase :encounter-ice |
356 | 369 | [state side _] |
|
0 commit comments