Let the AI use Goblin Welder - #11499
Open
liamiak wants to merge 2 commits into
Open
Conversation
The ability targets the artifact that gets sacrificed and the graveyard card that replaces it, so the two have to be read as one trade. PumpAi read neither: with no AILogic it fell through to the generic pump targeting, which takes the most expensive artifact on the battlefield regardless of who owns it. Measured on a board of Goblin Welder, Chromatic Star and Sol Ring, with a Wurmcoil Engine in our own graveyard, it sacrificed the Sol Ring. Given only a worse card in the yard it still welded, trading a Sol Ring for an Ornithopter. And with the opponent holding the biggest artifact it targeted theirs, sacrificing their Wurmcoil Engine to hand them the Blightsteel Colossus out of their own graveyard. AILogic$ Weld picks the pair together. Ours: something already marked expendable through the existing SacCost preference, otherwise the cheapest artifact we control, swapped for the best card in our graveyard. An opponent's: their best board artifact for the worst card in their graveyard, which turns the gift above into removal. Either way the card coming back has to cost more than the one going away - the test ZoneExchangeAi already uses for a swap across zones, and half of what ChangeZoneAi.doSacAndReturnFromGraveLogic uses for sacrifice-and-reanimate. Timing goes through the shared AtOppEOT rule rather than the mid-combat window the generic pump phase check happened to allow. Both branches sit behind the new AILogic, which only this card carries, so nothing else that goes through PumpAi changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Plays until the AI welds of its own accord at the opponent's end step, and checks what it chose: our own worst artifact swapped up into the best one in our graveyard, an opponent's artifact traded down for the junk in theirs, and nothing at all when the swap gains nothing or the graveyard is worse. Drop this commit if you would rather not carry the test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goblin Welder was
AI:RemoveDeck:All. Its ability targets both the artifact that gets sacrificed andthe graveyard card that replaces it, so the two have to be read as one trade.
PumpAiread neither —with no
AILogicit fell through to the generic pump targeting, which takes the most expensiveartifact on the battlefield regardless of who owns it.
Three misplays, measured by probing the decision directly (
canPlaySaplus the resulting targets):AILogic$ Weldpicks the pair together, delegating each actual choice to something that alreadyexists:
SacCostpreference (ComputerUtil.getCardPreference),otherwise the cheapest artifact we control. That is what keeps Sol Ring over Chromatic Star, which
mana value alone cannot separate.
getBestRemovalTargetAI, since welding against an opponent is removal.pumpMandatoryTarget, already in this class: best from our own graveyard,cheapest from theirs.
ZoneExchangeAialready uses for a swap across zones.AtOppEOTrule, rather than the mid-combat window the generic pump phasecheck happened to allow.
Both branches sit behind the new
AILogic, which only this card carries, so nothing else that goesthrough
PumpAichanges.Reasoned rather than measured: that welding at the opponent's end step beats acting earlier. The
ability is free and repeatable so holding it costs nothing, but I have not measured a win-rate
difference.
Known limit: it weighs one candidate pair per player rather than every combination, so a swap that a
different artifact of theirs would have justified can be missed.
Full desktop suite: 356 tests, 0 failures. The regression test is the second commit and can be
dropped on its own — two of its cases fail without the fix.
Written with Claude Opus 5 (also recorded in the commit co-authors).