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

Teferi's Ageless Insight incorrect interaction with "for each card drawn this way" #12616

Closed
PurpleCrowbar opened this issue Jul 29, 2024 · 2 comments · Fixed by #12700
Closed
Assignees
Labels
bug Bugs and errors

Comments

@PurpleCrowbar
Copy link
Member

PurpleCrowbar commented Jul 29, 2024

Because [[Teferi's Ageless Insight]] replaces the draw event with two card draws, Player::drawCards doesn't return the number of cards drawn. A note on this method explicitly states this:

/**
* Draw cards. If you call it in replace events then use method with event.appliedEffects param instead.
* Returns 0 if replacement effect triggers on card draw.
*
* @param num
* @param source can be null for game default draws (non effects, example: start of the turn)
* @param game
* @return
*/
int drawCards(int num, Ability source, Game game);
/**
* Draw cards with applied effects, for replaceEvent
* Returns 0 if replacement effect triggers on card draw.
*
* @param num
* @param source can be null for game default draws (non effects, example: start of the turn)
* @param game
* @param event original draw event in replacement code
* @return
*/
int drawCards(int num, Ability source, Game game, GameEvent event);

Casting [[Ancient Excavation]] with three other cards in hand and a TAI in play causes the player to draw 6 cards. They should then discard 6 cards, as per Ancient Excavation's wording ("discard a card for each card drawn this way"); I have confirmed this with a judge. Currently in XMage, the player discards 0 cards, as the drawCards call is returning 0 due to TAI replacing each of the three draw events.

All of these cards should be affected by this problem.

Copy link

Teferi's Ageless Insight - (Gatherer) (Scryfall) (EDHREC)

{2}{U}{U}
Legendary Enchantment
If you would draw a card except the first one you draw in each of your draw steps, draw two cards instead.

Ancient Excavation - (Gatherer) (Scryfall) (EDHREC)

{2}{U}{B}
Instant
Draw cards equal to the number of cards in your hand, then discard a card for each card drawn this way.
Basic landcycling {2} ({2}, Discard this card: Search your library for a basic land card, reveal it, put it into your hand, then shuffle.)

@xenohedron xenohedron added the bug Bugs and errors label Jul 30, 2024
@xenohedron xenohedron self-assigned this Aug 22, 2024
@xenohedron
Copy link
Contributor

xenohedron commented Aug 23, 2024

Question - for the "each card drawn this way", what if a replacement effect causes an opponent to draw instead of you? would those count as cards drawn "this way" ?

I'm pondering this and I think I have a way to refactor that passes through the amount on replacement back to the original method call... it'll be kinda convoluted [edit: actually it isn't!], but it needs to be as the simpler solutions I thought of are flawed.

(I thought I could fix this by storing the amount of cards to draw in the event checked by replacement effects, so that the event didn't need to be fully replaced to change the amount. But in order for this to work, the replacement effect has to be checked on the drawing of multiple cards, not the drawing of individual cards. Unfortunately, it can't work for all replacement effects to check that, because if you have multiple replacement effects, you need to be able to order them separately for each card drawn, so they need to check the drawing of individual cards.)

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
2 participants