Skip to content

Conversation

CTimmerman
Copy link
Contributor

@CTimmerman CTimmerman commented Sep 1, 2025

Fixes #8589. My Naya deck win rate improved by at least 50% when AI played it against its unpatched self.

I moved 0-mana, Exalted, and Extort checks before the RaidTest check as i don't think they reduce the number of blockers. The checks after RaidTest probably apply to cards that share that property with e.g. Blitz. I'm too tired to check atm.

@CTimmerman CTimmerman force-pushed the Consider-more-cards-main1-playable branch 2 times, most recently from eeb03f4 to 9fbd606 Compare September 1, 2025 00:51
Comment on lines +1182 to +1177
final String triggerZones = trigger.getParam("TriggerZones");
if (!"Battlefield".equals(triggerZones)) continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

not all Trigger has TriggerZones set (unless you want to exclude ETB and LTB on purpose)

like for ChangedZone Trigger, it is set there, to the getActiveZone set:

Copy link
Contributor Author

@CTimmerman CTimmerman Sep 1, 2025

Choose a reason for hiding this comment

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

Afaik a permanent with TriggerZones "Battlefield" catches any other card entering or leaving the battlefield, and cards with ETBs are handled elsewhere.

// 1312+ cards match `Mode\$ ChangesZone.*?TriggerZones\$ Battlefield`
// enter/leave triggers
// Admonition Angel etc
if (mode == TriggerType.ChangesZone || mode == TriggerType.ChangesZoneAll) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not all ETB trigger would be positive

Like Hunted Bonebrute would create tokens under opponents control, and would be better to be played after Combat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think a human deck creator would have anticipated that, but the AI is probably less discerning. I'll see if there are more negative than positive effects or the negative ones can be filtered out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Check if the AI would play the Triggered Ability if it wasn't mandatory
this should filter out the bad ones

(see getDamageFromETB and checkETBEffects)

Also see AiController.doTrigger

Copy link
Contributor Author

@CTimmerman CTimmerman Sep 1, 2025

Choose a reason for hiding this comment

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

Hunted Bonebrute matches Mode\$ ChangesZone.*?(?!TriggerZones\$ Battlefield) and such ETBs are handled elsewhere according to #8590 (comment)

// 1312+ cards match `Mode\$ ChangesZone.*?TriggerZones\$ Battlefield`
// enter/leave triggers
// Admonition Angel etc
if (mode == TriggerType.ChangesZone || mode == TriggerType.ChangesZoneAll) {
Copy link
Contributor

Choose a reason for hiding this comment

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

too generic, besides PermanentCreatureAi already checks hasETBTrigger()
if you're worried about Landfall try improving the logic around PlayBeforeLandDrop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PlayBeforeLandDrop still makes sure to drop land later in main1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is Ajani's Chosen worth playing in M1? Ajani's Welcome is marked as such, maybe because it's only 1 mana.


// 1009+ cards match `Mode\$ SpellCast.*?ValidActivatingPlayer\$ You`
// Aetherflux Reservoir etc
if (mode == TriggerType.SpellCast && "You".equals(trigger.getParam("ValidActivatingPlayer"))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

sequence wise this function should decide if there is something important enough to cast before combat (vs. leaving mana open for combat tricks)
Aetherflux Reservoir does not qualify, it should just be cast before other spells ideally so that's more of a use case for AIPriorityModifier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Spellslinger decks run such and prowess, right? So why not play Aetherflux Reservoir in main1?


// 9+ cards match `S:Mode\$ IgnoreLegendRule`
// allow cloning your commander with Mirror Gallery; Myriad etc
if (mode.contains(StaticAbilityMode.IgnoreLegendRule)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

too situational as default:
would at least need to check you have no non-legendary

Copy link
Contributor Author

@CTimmerman CTimmerman Sep 2, 2025

Choose a reason for hiding this comment

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

Etherium Sculptor is not legendary. Your suggested addition breaks this combo: https://www.youtube.com/shorts/KlYmlTzA9kw?feature=share

Copy link
Contributor

@tool4ever tool4ever Sep 2, 2025

Choose a reason for hiding this comment

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

that's nice but we're not adding very broad checks in general AI logic in the hopes of maybe playing a deck with some relevant combo...
FWIW allow me to demonstrate how you're managing to break very basic AI behaviour:
grafik
in case it's not clear enough - thanks to your change AI would prefer to lose from attack next turn instead of grabbing the win so Mirror Gallery can look threatening 💩

it's up to you to ensure you're not making too many such assumptions, otherwise your changes aren't mergeable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the example. Can't that be solved by getSpellAbilityPriority?

// 3+ cards match `S:Mode\$ ActivateAbilityAsIfHaste.*ValidCard\$[^|]*You`
// Thousand-Year Elixir etc
if (mode.contains(StaticAbilityMode.ActivateAbilityAsIfHaste)) {
if (validCard.contains("You")) return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

too inaccurate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only 3 cards match. Why put any in the deck if they're not useful? card.isAbilitySick() checks for this very ability.


// 43+ cards match `K:Bestow`
final String bestow = nma.getParam("Bestow");
if (bestow != null && bestow.equals("True")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the point of casting in main1 just because it has Bestow?

Copy link
Contributor Author

@CTimmerman CTimmerman Sep 1, 2025

Choose a reason for hiding this comment

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

Because Bestow is like an aura, and auras are already played in main1 because they boost creatures.

Copy link
Contributor

Choose a reason for hiding this comment

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

then you should test it
your logic does nothing because it's gonna be treated as Attach spell

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Attach spells are also permanents, but I see Bestow is already checked in attachAIPumpPreference.


// 201+ cards match `S:Mode\$ ReduceCost.*?Activator\$ You`
// reduce cost to enable more plays
if (mode.contains(StaticAbilityMode.ReduceCost) && "You".equals(sta.getParam("Activator"))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

again not worth the risk:
ai might just waste mana before combat

maybe they should get a slight boost in getSpellAbilityPriority() though (at least during early game)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mana rocks are typically played first, and cost reduction should be even better.

Copy link
Contributor

Choose a reason for hiding this comment

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

you aren't understanding what I'm saying:
this function is for "main1 before main2"
hijacking it to add your "permanent A before B" logic just isn't supposed to happen here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean? Don't you think Alisaie Leveilleur, and Jet Medallion are worth playing in M1?

Copy link
Contributor

Choose a reason for hiding this comment

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

no, Jet Medallion does not help your combat directly
you'd need to at least be able to afford two additional playMain1 spells just to reach break even on mana spent vs. the risk of tapping out too early
this means on average it's a bad play

Copy link
Contributor Author

@CTimmerman CTimmerman Sep 2, 2025

Choose a reason for hiding this comment

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

Ok, but Auriok Steelshaper would help equip and is a creature, and Ballyrush Banneret is a creature as well.

Is spending 1W in M1 worth a body and a 1 discount on Kithkin and Soldier spells? Deck-dependent.

Blood Funnel can pay for itself in monoblack, but requires creatures, which is probably checked when deciding to play it. (as well as it drawbacks). Fluctuator and Catalyst Stone also pay for themselves in the right decks. But all these have AI:RemoveDeck:Random

I'll leave ReduceCost to the card's SVar:PlayMain1.

@CTimmerman CTimmerman force-pushed the Consider-more-cards-main1-playable branch from 9fbd606 to e055ca7 Compare September 1, 2025 21:54
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.

Consider more cards playable in main1
3 participants