Improve Homarid Spawning Bed AI - #11717
Conversation
| ManaCost:U U | ||
| Types:Enchantment | ||
| A:AB$ Token | Cost$ 1 U U Sac<1/Creature.Blue/blue creature> | TokenAmount$ X | TokenScript$ u_1_1_camarid | TokenOwner$ You | SpellDescription$ Create X 1/1 blue Camarid creature tokens, where X is the sacrificed creature's mana value. | ||
| A:AB$ Token | Cost$ 1 U U Sac<1/Creature.Blue/blue creature> | TokenAmount$ X | TokenScript$ u_1_1_camarid | TokenOwner$ You | AILogic$ SacrificeThreatenedForManaValue | SpellDescription$ Create X 1/1 blue Camarid creature tokens, where X is the sacrificed creature's mana value. |
There was a problem hiding this comment.
we need less AILogic for trivial stuff, not more
What about using AIPreference:SacCost...?
There was a problem hiding this comment.
Good suggestion. I removed the card-specific AILogic entirely and added SVar:AIPreference:SacCost$Creature.cmcGE1. The only Java change is now generic: when a token count depends on an unpaid sacrifice, TokenAi evaluates X on a detached ability copy containing the preferred sacrifice in its normal paid-cost list. This lets AbilityUtils calculate the existing Sacrificed$... expression without special card logic. I also verified that a positive-mana-value creature enables the ability, a zero-value Camarid does not, and the same path works for Tend the Pests.
There was a problem hiding this comment.
This problem trying to be solved here is pretty close to what I've already described in #11486 (comment)
I guess it's up to me to write down how this architecture should be handled, though I can't give this a high priority
There was a problem hiding this comment.
Thanks, the #11486 comparison made me step back from pre-payment projection entirely. I removed the copied-ability/token-value helper and the AIPreference. The revision now reuses the existing ComputerUtil.activateForCost path: TokenAi only bypasses its normal amount and phase heuristics when a legal sacrifice is already predicted to die, and the existing SacCost selection chooses that threatened permanent. There is no new AILogic, SVar prediction, or attempt to solve proactive sacrifice value. The focused test shows that the Bed stays idle without a threat, responds to Doom Blade, and selects the threatened creature over another legal sacrifice.
a4361b5 to
5ec1c25
Compare
|
Post-revision self-review: the Java path is generic and one-pass. It runs only when the token amount currently evaluates to zero and the cost contains a sacrifice, uses the established sacrifice chooser, records the projected payment on a copied |
62a7e6b to
55b2cfc
Compare
55b2cfc to
8e6f3c3
Compare
tool4ever
left a comment
There was a problem hiding this comment.
sacrificing everything threatened is way too generic, feels like we're running in circles
8e6f3c3 to
e87a334
Compare
e87a334 to
8e6f3c3
Compare
|
Would a card-specific |
|
Sorry, I accidentally clicked re-request review. |
|
first it depends a bit on if there are more cards that have this cost->effect pattern, it doesn't look like that research was done so far 🤷♂️ #11712 was a step in the right direction for how heuristics could pass information to different effect parts, however that was on Card level + between subabilities - now we need SpellAbility + between its cost maybe it's possible together with |
SacCostpreference choose the threatened permanent.TokenAibehavior when no legal sacrifice is threatened.AILogicor pre-payment token projection.