Card-Forge / Card-Forge/forge

AI never casts an "untap + pump" instant as a combat trick (UntapAi filters to tapped targets)

Open
#11,753 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
1.1k
Avg merge
1d 1h
Merged PRs (30d)
158

Description

`UntapAi` filters candidate targets to permanents that are already tapped
([`UntapAi.java:177`](https://github.com/Card-Forge/forge/blob/master/forge-ai/src/main/java/forge/ai/ability/UntapAi.java#L177)):

```java
CardCollection untapList = targetUntapped ? list : CardLists.filter(list, CardPredicates.TAPPED);
```

For a spell whose untap is incidental and whose payoff is the sub-ability, no target is ever found
and the card is never cast.

`Vow to Erebor` (HOB): instant, untap target creature you control, +2/+2, attach an Equipment free.
Everything but the untap is a combat trick on an untapped creature. **0 casts in 300 AI-vs-AI
games** on a deck running it; a human playing the same deck casts it readily.

The `targetUntapped` escape hatch exists (lines 160-175) but is wired only to `RemoveFromCombat`
with `AILogic$ RemoveBestAttacker`.

**Loosening the filter alone is not the fix.** Letting the pump half pick the target reaches the
candidate list 161 times in 4 games and still casts 0: 100 of those have no combat at all, and the
other 61 are evaluated at beginning of combat, before attackers are declared, so nothing is yet
attacking or blocking. It needs predicted combat (`ComputerUtilCard.doesCreatureAttackAI`) or
timing that waits for `COMBAT_DECLARE_ATTACKERS`. Which one is a design call, hence an issue and
not a PR.

Forge master `e9cc3207f4`, also 2.0.14. Linux, OpenJDK 25.0.4.

Contributor guide

Open the contributing guide

Research direction

Start in forge-ai/src/main/java/forge/ai/ability/UntapAi.java, especially the target filtering around lines 160-177 and the existing targetUntapped handling. Read how ComputerUtilCard.doesCreatureAttackAI and COMBAT_DECLARE_ATTACKERS relate to combat timing, then reproduce the Vow to Erebor behavior described in the issue. Done means the AI can identify and cast this combat trick appropriately without breaking ordinary untap targeting.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ai, game-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.