So about
Clockwork Avian and
Clockwork Beast.
Some background explanation first. Bear with me, since this takes a while to get back to the subject at hand.
In Shandalar prior to Thieves Hideout (and in all versions of Manalink), when the AI activates an ability of a permanent, it displays the popup "Opponentname activates..." before actually activating the card. This has a tiny benefit, a moderate benefit, and an enormous drawback.
The tiny benefit is that it allows a card to display an arbitrary other card in the lower-right corner of the activation dialog, instead of it being forced to be the actual target of the ability. For instance, if activating an untargeted ability of an Aura, it can show the creature it's attached to rather than just leaving it blank.
The moderate benefit is that the "Opponentname activates" dialog is shown before paying the ability's costs, and before displaying the popups for other choices made (for modal abilities, for selecting which ability to activate when a card has more than one, for resolving triggers caused by paying those costs, etc.) So, before, you'd see e.g. "Paladin activates
Northern Paladin" with a picture of your
Erg Raiders in the lower right, then the AI taps and sacrifices a
Black Lotus to pay for the
activation cost, then it displays the "Processing..." dialog for the AI to handle the trigger from its
Tablet of Epityr.
Starting in Thieves Hideout 1, you don't get the "Paladin activates
Northern Paladin" until the end of that sequence, the same time it's displayed in multiplayer.
The reason why that's acceptable is that there's an
enormous amount of bookkeeping that needs to be done exactly right in order to predict what needs to go onto that initial dialog in the general case. You need to know all the choices the AI will make to activate an ability that end up getting displayed - which ability it's activating, modal choices for that ability, targets it'll pick, amount it'll pick to spend on
X. This is mediated by each card handling an EVENT_GET_SELECTED_CARD message, and each card peeking forward into the AI's chosen branch of its decision tree to see which decisions it'll make when the card actually gets its EVENT_ACTIVATE message and pays mana, picks targets, etc.
This mostly holds together in the original game, but it's complex and error-prone to get right when adding new cards. Manalink barely even tries; only a half dozen cards handle EVENT_GET_SELECTED_CARD individually, and a bunch of its auras force the auxiliary smallcard display to show the object being enchanted whether or not the ability has a target, and that's it. In order to get this fairly minor feature working right, essentially every card with an activated ability needs a handcrafted handler for EVENT_GET_SELECTED_CARD, and the overwhelming majority of cards don't have even a generic one.
For the original Alpha through The Dark + 4th Edition card set, this task was merely difficult, tedious, and error-prone. It turns out to be effectively impossible once you start adding ways to pay activation costs that have their own targeting choices. If, in the original example, the
Northern Paladin's
cost was paid in part by
Springleaf Drum, then the
Northern Paladin's EVENT_GET_SELECTED_CARD handler needs to know to look an extra step forward in the AI decision branch to get its target, since the
first step will instead be the creature it's going to tap for
Springleaf Drum.
To handle stuff like that correctly, each of the roughly 5000 cards with activated abilities would each have to account for each of the roughly 1000 cards with mana abilities. (And then they all have to do the same for any triggered abilities that can happen before the original card can choose its targets, since in the MicroProse MTG engine those will happen first, too.) That's... really, really not feasible.
So we can either accept that the activation popup will be wrong in all but the simplest cases, or display it afterwards and bypass the whole mess entirely. For now, I do the latter. There's some tricks I can potentially do to improve the interface - if an ability's being activated, maybe make the popup function only record what it's going to pop up until it's done activating, then play all those back in sequence, perhaps - but it's acceptable for now.
---
Back on topic, and why this impacts the Clockwork creatures:
Both
Clockwork Avian and
Clockwork Beast share a backend function; their only difference is that one starts with and has a maximum of four +1/+0 counters, while the other has seven. In that backend function, the handler for EVENT_GET_SELECTED_CARD doesn't peek forward into the AI decision tree, like every other card's EVENT_GET_SELECTED_CARD handler does - it decides
then how much mana it's going to pay, stores that value in the global variable that gets read back for the "amount spent on
X" display, and charges the AI that much instead of
X when the card actually activates.
I can understand the thought process behind a decision like that. AI speculation doesn't run during upkeep at all, so there isn't a decision tree to look forward into; and a decision on how much mana to spend needs to be made in time to display that amount on the activation popup, before the mana is actually charged. But when all 107 other EVENT_GET_SELECTED_CARD handlers in the original game are information-only and make no changes to the game state or AI state, I can't help thinking that this must have been a violation of EVENT_GET_SELECTED_CARD's API. Or at least a poor idea.
Or maybe I just think that because, now that the event never gets sent to any card anymore, the AI is still forced to activate these creatures, and it always picks 0 and leaves me with egg on my face.
In any case, the fix is simple; they just need to recompute the amount to spend during EVENT_ACTIVATE too. So now they'll always tap every upkeep to add as many counters back as they can, so long as any are missing; which still isn't optimal behavior, but at least less objectively stupid as paying
each upkeep.
---
I think I've gotten as much done as I'm going to. Once I have the fix for the Clockwork critters in, I want to test for a while more, just for sanity's sake. Barring unexpected problems, expect a release tonight or tomorrow.
- The handful of cards I added in between other stuff | Open
- Armorer Guildmage
Ashen Rider
Cinder Shade
Civic Guildmage
Dimir Guildmage
Ethersworn Adjudicator
Goblin Marshal
Golgari Guildmage
Granger Guildmage
Gruul Guildmage
Hunting Moa
Lich Lord of Unx
Mikaeus, the Lunarch
Mogg War Marshal
Morphling
Nemata, Grove Guardian
Rathi Assassin
Selesnya Guildmage
Shadow Guildmage
Shaper Guildmage
Squirrel Wrangler
Sydri, Galvanic Genius