Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creatures sacrificed don't trigger their own death triggers #12195

Open
alexander-novo opened this issue Apr 29, 2024 · 25 comments
Open

Creatures sacrificed don't trigger their own death triggers #12195

alexander-novo opened this issue Apr 29, 2024 · 25 comments
Assignees
Labels
bug Bugs and errors

Comments

@alexander-novo
Copy link
Contributor

[[Industrial Advancement]]. I've noticed it several times. Here's an example of a log:

image

I sacrificed my [[Junji, the Midnight Sky]] and its death trigger did not trigger. Here's a pic of the board state:

image

Copy link

Industrial Advancement - (Gatherer) (Scryfall) (EDHREC)

{3}{R}
Enchantment
At the beginning of your end step, you may sacrifice a creature. If you do, look at the top X cards of your library, where X is that creature's mana value. You may put a creature card from among them onto the battlefield. Put the rest on the bottom of your library in a random order.

Junji, the Midnight Sky - (Gatherer) (Scryfall) (EDHREC)

{3}{B}{B}
Legendary Creature — Dragon Spirit
5/5
Flying, menace
When Junji, the Midnight Sky dies, choose one —
• Each opponent discards two cards and loses 2 life.
• Put target non-Dragon creature card from a graveyard onto the battlefield under your control. You lose 2 life.

@alexander-novo
Copy link
Contributor Author

Another example:

image

image

Kogla had undying and no counters, but undying didn't trigger,

@alexander-novo
Copy link
Contributor Author

Actually this might just be a general problem with sacrifice. Here's another log:

image

Here, I sacrifice Atsushi with [[Vivien on the Hunt]]'s +2 ability, and it doesn't activate Atsushi's death trigger.

@alexander-novo alexander-novo changed the title Creatures sacrificed with Industrial Advancement don't trigger death triggers Creatures sacrificed don't trigger death triggers Apr 30, 2024
Copy link

Vivien on the Hunt - (Gatherer) (Scryfall) (EDHREC)

{4}{G}{G}
Legendary Planeswalker — Vivien
4
+2: You may sacrifice a creature. If you do, search your library for a creature card with mana value equal to 1 plus the sacrificed creature's mana value, put it onto the battlefield, then shuffle.
+1: Mill five cards, then put any number of creature cards milled this way into your hand.
−1: Create a 4/4 green Rhino Warrior creature token.

@alexander-novo
Copy link
Contributor Author

Sacrificing with [[Evolutionary Leap]] seems to work fine, though...

Copy link

Evolutionary Leap - (Gatherer) (Scryfall) (EDHREC)

{1}{G}
Enchantment
{G}, Sacrifice a creature: Reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest on the bottom of your library in a random order.

@alexander-novo alexander-novo changed the title Creatures sacrificed don't trigger death triggers Creatures sacrificed don't trigger their own death triggers May 1, 2024
@alexander-novo
Copy link
Contributor Author

image

It seems it's only missing the triggers on the sacrificed permanent - in this example, The Skullspore Nexus triggers from the sacrifice, but not Protean Hulk itself.

@JayDi85
Copy link
Member

JayDi85 commented May 1, 2024

  1. Is it regression from last updates?
  2. Is it affect cards with multiple modes only?

@alexander-novo
Copy link
Contributor Author

alexander-novo commented May 1, 2024

  1. Is it regression from last updates?

  2. Is it affect cards with multiple modes only?

It must be a regression... there's no way this has been broken for very long. Also it's not multiple modes - cards like [[Protean Hulk]] don't work and also cards with undying. I'm planning on writing a unit test for it and doing a git bisect on it.

Copy link

github-actions bot commented May 1, 2024

Protean Hulk - (Gatherer) (Scryfall) (EDHREC)

{5}{G}{G}
Creature — Beast
6/6
When Protean Hulk dies, search your library for any number of creature cards with total mana value 6 or less, put them onto the battlefield, then shuffle.

@alexander-novo
Copy link
Contributor Author

Actually this may not be a regression...

I've tested on 229e8d3 and it also had the bug. Let me go back further

@sebastiandine
Copy link

I am also having this issue when sacrificing [[Su-Chi]] with [[Sage of Lat-Nam]]. I do not get the mana from Su-Chi in the pool.

Copy link

github-actions bot commented May 7, 2024

Su-Chi - (Gatherer) (Scryfall) (EDHREC)

{4}
Artifact Creature — Construct
4/4
When Su-Chi dies, add {C}{C}{C}{C}.

Sage of Lat-Nam - (Gatherer) (Scryfall) (EDHREC)

{1}{U}
Creature — Human Artificer
1/2
{T}, Sacrifice an artifact: Draw a card.

@Susucre
Copy link
Contributor

Susucre commented May 7, 2024

Couldn't reproduce the bug with the test suite (added two tests in 907ac5c, each one not failing on 10k attempts)

It is either:

  • Related to a part of the code (GUI, AI), that the test suite doesn't use.
  • Has some condition to happen. (a card/effect, or maybe enough triggers overall for a weird race condition bug)

@JayDi85
Copy link
Member

JayDi85 commented May 7, 2024

@Susucre can be related to zcc too (same tests, but make blinks first);

@Susucre
Copy link
Contributor

Susucre commented May 7, 2024

@Susucre can be related to zcc too (same tests, but make blinks first);

Was worth a try, but not that either: 02f19d9

@xenohedron
Copy link
Contributor

Can also try in unit test, add to hand and cast, rather than add to battlefield

@Susucre
Copy link
Contributor

Susucre commented May 7, 2024

Can also try in unit test, add to hand and cast, rather than add to battlefield

No replication either (4d07605). I really think there is something outside of the pair DiesTriggeredAbility/SacrificeTargetCost that we are missing there.

@xenohedron
Copy link
Contributor

I speculate it is related to isInUsableZone and short living lki

@JayDi85
Copy link
Member

JayDi85 commented May 7, 2024

I speculate it is related to isInUsableZone and short living lki

Then put on stack some spells like bolt and exec same test commands after it (without full stack resolve).

@Susucre
Copy link
Contributor

Susucre commented May 7, 2024

No luck either. I'm not around to continue investigating until next week at the earliest.
One of you can try to find the cause from there. I don't have any clue, but feel like it is outside the Test Suite capabilities to replicate (unless we are missing a third card messing up the trigger somehow.).

@JayDi85 JayDi85 self-assigned this May 8, 2024
JayDi85 added a commit that referenced this issue May 8, 2024
@JayDi85
Copy link
Member

JayDi85 commented May 8, 2024

Added reproducible test by e3ae00f. Real reason was in short LKI and move to battlefield code:

shot_240508_063013

Nothing to do with it until move or dies logic rework. Maybe I'll look at it again later.

P.S. call processAction in sacrifice code is not a real fix :)

@JayDi85 JayDi85 added the bug Bugs and errors label May 8, 2024
@JayDi85
Copy link
Member

JayDi85 commented May 8, 2024

As idea to try:

1 - It's very hard to move ApplyEffects/ProcessActions code from move to battlefield to effects/cards like other multi steps effect does (move to battlefield is a most used command and require changes in 100500 files);

2 - It's require less effort but still hard to add process action to each sacrifice and other related effects (dies trigger depends on any moves to graveyard, not sacrifice only);

3 - Most perspective: replace short living LKI logic by zone change counter logic (ZCC) -- shortLKI used in dies triggers only, so it's can require much less changes and checks.
shot_240508_064951
Only one global usage can be a problem and need to research:
shot_240508_070429
Well, it's has a more weird usages:
shot_240508_071318

@alexander-novo
Copy link
Contributor Author

Great work finding the root cause

@xenohedron
Copy link
Contributor

I agree that the best solution is to remove the short living LKI logic and replace with standard ZCC logic. "Short Living LKI" has always sounded like a hack/workaround to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants