Skip to content

Let the AI use Fauna Shaman's tutor#11348

Merged
Agetian merged 1 commit into
Card-Forge:masterfrom
liamiak:fix-fauna-shaman-ai
Jul 24, 2026
Merged

Let the AI use Fauna Shaman's tutor#11348
Agetian merged 1 commit into
Card-Forge:masterfrom
liamiak:fix-fauna-shaman-ai

Conversation

@liamiak

@liamiak liamiak commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fauna Shaman ({G}, {T}, Discard a creature: search your library for a creature and put it into your hand) is unflagged, so the AI runs it — but it never uses the ability, playing as a vanilla 2/2.

Cause

The block is the discard cost, not targeting or timing. SpellAbilityAi.willPayCostsComputerUtilCost.checkDiscardCost calls ComputerUtil.getCardPreference(ai, source, "DiscardCost", …); with no preference declared it returns null, so the decision comes back CostNotAcceptable and the tutor never fires. The cost is judged in isolation, with no credit for the fact that the tutor hands back a stronger creature than the one discarded.

Fix

Survival of the Fittest is the same ability ({G}, discard a creature: tutor a creature to hand) and already handles this with two hints:

AILogic$ SurvivalOfTheFittest
SVar:AIPreference:DiscardCost$Special:SurvivalOfTheFittest

The backing SpecialCardAi.SurvivalOfTheFittest handlers (considerDiscardTarget / considerCardToGet) are generic — they look only at the AI's own creatures in hand and library and its available mana, with no binding to the Survival card. So they apply unchanged to Fauna Shaman. This PR adds the same two hints; no Java change.

Verified

before after
canPlaySa (untapped, fodder in hand) CostNotAcceptable WillPlay at its firing window
full resolution (opponent's end of turn) never activates discards its worst spare creature, fetches the best affordable one

Concretely: with two Grizzly Bears + a Runeclaw Bear in hand and a Colossal Dreadmaw in the library, it discards a Grizzly Bears and fetches the Dreadmaw — same behaviour as Survival of the Fittest, which fires this logic at the opponent's end of turn just before the AI's turn. 286 desktop tests pass.


Written with Claude Code (Opus 4.8), per the AI coding agent guidance in CONTRIBUTING.md; also recorded as a commit co-author.

Fauna Shaman ({G}, {T}, Discard a creature: search your library for a
creature and put it into your hand) is not flagged, so the AI runs it,
but it never activates the ability - it plays as a vanilla 2/2.

The block is the discard cost. SpellAbilityAi.willPayCosts ->
ComputerUtilCost.checkDiscardCost asks ComputerUtil.getCardPreference for
a "DiscardCost" creature to pitch; with no preference declared it returns
null, so the AI decides CostNotAcceptable and never tutors. The cost is
judged in isolation, without crediting that the tutor hands back a
stronger creature.

Survival of the Fittest is the same ability ({G}, discard a creature:
tutor a creature to hand) and already solves this with two hints:

  AILogic$ SurvivalOfTheFittest
  SVar:AIPreference:DiscardCost$Special:SurvivalOfTheFittest

The backing SpecialCardAi.SurvivalOfTheFittest handlers
(considerDiscardTarget / considerCardToGet) are generic - they only look
at the AI's own creatures in hand and library and its mana - so they
apply unchanged to Fauna Shaman. Add the same two hints.

Verified: before, canPlaySa returns CostNotAcceptable. After, at the
window this logic fires (the opponent's end of turn, just before the AI's
turn) the AI activates it, discards its worst spare creature and fetches
the best affordable one - identical to Survival of the Fittest. 286 desktop
tests still pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tool4ever
tool4ever requested a review from Agetian July 23, 2026 22:34
@Agetian
Agetian merged commit 4d0cf81 into Card-Forge:master Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants