netrunner icon indicating copy to clipboard operation
netrunner copied to clipboard

:trash event is fired before prevent effects

Open queueseven opened this issue 11 years ago • 7 comments

Say I have Cache, Q-Coherence Chip and Sacrificial Construct in play and I facecheck an ICE that trashed a program, so the corp trashes Cache.

Expected behaviour: I can use Sacrificial Construct to prevent the trashing of Cache; and only Sacrificial Construct will be trashed

Actual behaviour: I'm asked if I want to use Sacrificial Construct to prevent the trashing of Q-Coherence Chip. If I don't do this, I'm asked if I want to prevent the trashing of Cache. I do so, but now Sacrificial Construct and Q-Coherence Chip are trashed.

The problem is that the :trash event is triggered before preventing the trashing is handled.

queueseven avatar Aug 13 '15 11:08 queueseven

Yes, many events fire before their action is fully resolved. I don't know why this is. I guess we can think of :trash as really being "pre-trash".

You could try moving the event trigger to resolve-trash, but you'll need to check to see if anything else breaks. You could also just add a new event like :trashed or :post-trash and then handle that in Q-Coherence.

nealterrell avatar Aug 13 '15 14:08 nealterrell

I think moving the event trigger is the way to go. There are not many :trash event listener, and none of those should fire when the trash effect is prevented.

queueseven avatar Aug 13 '15 15:08 queueseven

I moved the trigger out of trash and into resolve-trash as mentioned above, so the originally described scenario of Cache, Q-Coherence Chip and Sacrificial Construct now works correctly when Cache is targeted for trashing. Are there any other cards to check to see if this will break anything?

JoelCFC25 avatar Nov 24 '15 15:11 JoelCFC25

@JoelCFC25 did you commit/PR your changes you talked about?

queueseven avatar Apr 13 '16 19:04 queueseven

No, never did. Just tested the one limited scenario but didn't get into it exhaustively to see if it broke other stuff.

JoelCFC25 avatar Apr 13 '16 19:04 JoelCFC25

Will this be easy to fix now with when-completed?

Saintis avatar Aug 04 '16 11:08 Saintis

I just checked this and indeed the when-completed framework results in the correct outcome!

JoelCFC25 avatar Aug 24 '16 14:08 JoelCFC25