netrunner icon indicating copy to clipboard operation
netrunner copied to clipboard

Maw + Legwork crashes when Agenda is trashed

Open JarekWarsaw opened this issue 9 years ago • 5 comments

Steps to reproduce: HQ with two cards: Agenda and something else (say, ABT and Hedge Fund). Runner has Maw installed and plays Legwork (technically this works with any HQ multiaccess) Runner accesses Hedge Fund. No trash. Maw fires (manually) - this trash is mandatory. Maw trashes ABT. Runner accesses ABT and tries to steal it, but server sends error.

So far my workaround was to never trigger Maw before multiaccess on HQ finishes, but it gives Runner slight advantage. In case presented Runner should've accessed only Hedge Fund and miss the ABT.

Log looks like this (order doesn't indicate when Maw fired): Runner spends click and 2 creds to play Legwork. Runner accesses Hedge Fund from HQ. Runner accesses Accelerated Beta Test from HQ. Runner uses Maw to force the Corp to trash a random card from HQ. //error

Error do choice nil #error { :cause nil :via [{:type java.lang.NullPointerException :message nil :at [clojure.lang.Numbers ops Numbers.java 1013]}] :trace [[clojure.lang.Numbers ops Numbers.java 1013] [clojure.lang.Numbers gt Numbers.java 229] [clojure.lang.Numbers gt Numbers.java 3864] [game.core$steal$fn__6573 invoke runs.clj 46] [game.core$do_effect invokeStatic abilities.clj 260] [game.core$do_effect invoke abilities.clj 256] [game.core$do_ability invokeStatic abilities.clj 241] [game.core$do_ability invoke abilities.clj 214] [game.core$resolve_ability_eid invokeStatic abilities.clj 136] [game.core$resolve_ability_eid invoke abilities.clj 113] [game.core$resolve_ability invokeStatic abilities.clj 111] [game.core$resolve_ability invoke abilities.clj 38] [game.core$trigger_event_simult invokeStatic events.clj 177] [game.core$trigger_event_simult doInvoke events.clj 139] [clojure.lang.RestFn invoke RestFn.java 533] [game.core$steal invokeStatic runs.clj 42] [game.core$steal invoke runs.clj 36] [game.core$resolve_steal$fn__6587 invoke runs.clj 72] [game.core$effect_completed invokeStatic events.clj 244] [game.core$effect_completed invoke events.clj 240] [game.core$resolve_steal_events invokeStatic runs.clj 63] [game.core$resolve_steal_events invoke runs.clj 58] [game.core$resolve_steal invokeStatic runs.clj 70] [game.core$resolve_steal invoke runs.clj 65] [game.core$access_agenda$fn__6650 invoke runs.clj 207] [game.core$do_effect invokeStatic abilities.clj 260] [game.core$do_effect invoke abilities.clj 256] [game.core$do_ability invokeStatic abilities.clj 241] [game.core$do_ability invoke abilities.clj 214] [game.core$resolve_ability_eid invokeStatic abilities.clj 136] [game.core$resolve_ability_eid invoke abilities.clj 113] [game.core$resolve_ability invokeStatic abilities.clj 111] [game.core$resolve_ability invoke abilities.clj 38] [game.core$resolve_ability invokeStatic abilities.clj 109] [game.core$resolve_ability invoke abilities.clj 38] [game.core$prompt_BANG_$fn__6084 invoke abilities.clj 309] [game.core$resolve_prompt invokeStatic actions.clj 147] [game.core$resolve_prompt invoke actions.clj 117] [game.main$handle_do invokeStatic main.clj 77] [game.main$handle_do invoke main.clj 74] [game.main$handle_command invokeStatic main.clj 145] [game.main$handle_command invoke main.clj 134] [game.main$run$fn__30052 invoke main.clj 180] [game.main$run invokeStatic main.clj 170] [game.main$run invoke main.clj 164] [game.main$_main$fn__30087 invoke main.clj 234] [clojure.lang.AFn run AFn.java 22] [java.lang.Thread run nil -1]]}

JarekWarsaw avatar May 16 '17 00:05 JarekWarsaw

My guess is that Maw causes a shuffle once a card is trashed and the on-access code does not like it. Any idea on the timing here and how it should interact with multi-access? ie. Do you access one card, then discard a random card , then access the next?

danhut avatar May 16 '17 03:05 danhut

I could not reproduce this even with the exact same order of access. Do you fire Maw when you see the "OK" button for accessing hedge fund?

danhut avatar May 16 '17 05:05 danhut

This bug has only 25% chance of triggering - that's why it might be hard to reproduce. First you have to access non-agenda (50%) then Maw has to trash yet-to-be-accessed Agenda (50%).

For this example let's say HQ contains Adonis and ABT.

  1. Click prompt "Card from hand". Runner accesses Adonis. Prompt asking "trash Adonis?". Runner clicks No. //Or in case of Hedge Fund clicks OK.
  2. Prompt "Card from hand". Runner clicks Maw, but nothing happens.
  3. Click "Card from hand'. Prompt for Maw appears. Runner clicks Yes. ABT is trashed.
  4. Prompt "Steal ABT" is clicked - error.

Apparently one is supposed to use it as Dan described - trigger Maw on access with a card, not after it. I tested it and it works fine in that case. In above scenario, if Runner sees prompt asking "trash Adonis?", then clicks Maw and then clicks No (for trashing), Maw prompt shows up as expected. In my opinion that's counter-intuitive. Maybe instead of fix we should add note to Maw "Trigger Maw on access with a card, not after it".

JarekWarsaw avatar May 16 '17 06:05 JarekWarsaw

Thanks. I will have a think if it could be improved. I originally tried to automate it but there were a bunch of caveats with it, for example if the first access with a decline to trash happened before Maw was installed.

danhut avatar May 16 '17 09:05 danhut

I tweaked the implementation note. I don't think anything else is viable since once you have hit "No" for trash or "Ok" then you are not accessing the card any more.

danhut avatar May 16 '17 23:05 danhut