Skip to content

Autotap - Add support for filter abilities#11173

Draft
Eradev wants to merge 33 commits into
Card-Forge:masterfrom
Eradev:autotap
Draft

Autotap - Add support for filter abilities#11173
Eradev wants to merge 33 commits into
Card-Forge:masterfrom
Eradev:autotap

Conversation

@Eradev

@Eradev Eradev commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What's new?

The auto-tapper is now an intelligent planner. This should hopefully avoid obvious mistakes and allow a better use of utility lands.

  • Prioritize permanent sources rather than disposable ones (e.g. Lotus Petal).

  • Prioritize colorless mana for generic mana, unless you have a {C} heavy hand. (e.g. Eldrazi)

  • Added support for filter abilities with generic cost (e.g. {1}: Add {R}.), and filter lands (e.g. Cascade Bluffs). Prevents chaining if not needed, and should avoid obvious pitfalls (e.g. uselessly activate Initiates of the Ebon Hand).

  • Added support for Mana Flare and Utopia Sprawl effects.

  • Added support for SVar:AIManaReserve:True for utility lands. This makes them less likely to be chosen by the auto-tapper. (Need to add it to more card rules)

  • Castability probe: Detection of remaining cards in hand/command zones to select which assets to use first to try and maximize plays. This is toggleable for performance in options (Desktop and mobile). Default is on.

  • Added multiple tests for edge cases.

Debugging

You can add the VM option -Dforge.debugManaPayment=true to help visualize what it attempts to use, or -Dforge.debugManaPayment=true for an easier to read plan (recommended).

Let me know if there are edge cases it misses.

@Eradev Eradev added AI General AI tag GUI labels Jul 7, 2026
@Eradev
Eradev marked this pull request as draft July 7, 2026 06:41
@Eradev
Eradev marked this pull request as ready for review July 7, 2026 07:12

@tool4ever tool4ever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this'll work better than the last AI attempt 🤔

Anyway this is huge and the highlighting part is already a separate feature: #5112

Please extract that into its own PR first, it'll certainly be useful for testing the rest of this 👍

@Eradev Eradev removed the GUI label Jul 7, 2026
@Eradev
Eradev requested a review from tool4ever July 7, 2026 11:35
@Eradev

Eradev commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Hopefully this'll work better than the last AI attempt 🤔

Anyway this is huge and the highlighting part is already a separate feature: #5112

Please extract that into its own PR first, it'll certainly be useful for testing the rest of this 👍

Moved to #11176

@Eradev
Eradev marked this pull request as draft July 9, 2026 04:00

addCard("Mountain", p);
addCard("Plains", p);
addCard("Boros Signet", p);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after we're done with most code concerns need to remove AI:RemoveDeck:All from all applicable cards so I can batch fuzz random generated decks for crashes

Comment thread forge-ai/src/main/java/forge/ai/ComputerUtilMana.java
SVar:ETBTapped:DB$ Tap | Defined$ Self | ETB$ True
A:AB$ Mana | Cost$ T | Produced$ Combo W U | SpellDescription$ Add {W} or {U}.
A:AB$ Animate | Cost$ 3 W U | Defined$ Self | Power$ 4 | Toughness$ 4 | Types$ Creature,Elemental | Colors$ White,Blue | OverwriteColors$ True | Keywords$ Flying & Vigilance | SpellDescription$ Until end of turn, this land becomes a 4/4 white and blue Elemental creature with flying and vigilance. It's still a land.
SVar:AIManaReserve:True

@tool4ever tool4ever Jul 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please try to solve only one problem with this PR
this size is completely unreasonable besides manlands being something that shouldn't need manual tagging

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will separate them more cleanly.

simulator.setInterceptor(choicesIterator);
// I feel like something here is making a wrong assumption about what the target is
lastScore = simulator.simulateSpellAbility(sa);
final int castBonus = ComputerUtilMana.estimateCastBonusForSpell(sa, player);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you having a LLM go wild?

this is completely out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI General AI tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants