Log in

Forge AbilityFactory

NOTE: These factories have recently been refactored, the base information should still be correct but the locations won't be quite right.

AbilityFactory parses differently from the Keyword parser. Your Ability line will look more like this:

A:{AB/SP/DB}$ <AFSubclass> | {Necessary$ Paramaters}| {Separated$ By} | {Pipes$ Here}

In most cases, each AF subclass implements both the Spell and Ability. Much of the code is shared, so creating the data object will look very similar.

  • AB is for Activated Abilities.
  • SP is for Spell.
  • DB is for Drawback and for many abilities that are subsidiary to other things, like replacements. They are only used to chain AFs together, and will never be the root AF.



Contents

Common Parameters

Cost

For AbilityFactory, Cost$<AbilityCost> is the appropriate way to set the Cost of the Ability. Currently for spells, any additional costs including the original Mana cost need to appear in the Cost parameter in the AbilityFactory.

Secondary abilities such as the DB executed by triggers or replacements don't need costs. (This is one reason to use DB over AB in these cases.)

Read more about it's uses in AbilityCost

Target

There are two different ways to Target. One or the other will need to be used for Spells/Abilities that target. The second way is more advanced, and will be necessary for certain cards.

Read about usage in Target

Defined

If your AF does not target a card, but instead defines what will be affected by the Spell/Ability, use the Defined Parameter.

Read more about it in Defined

SpellDescription

SpellDescription is how the text of the ability will display on the card and in the option dialog for cards with multiple abilities.

The SpellDescription for secondary abilities (both AB and DB) is now displayed when (and if) the ability prompts for user input in the prompt pane so it is useful to put some nice text there.

StackDescription

(Optional) StackDescription is the description the ability will have on the stack. This is automatically generated by the effect, but may be overridden using this parameter.

Conditions

Condition is similar to a IsPresent restriction, except it's checked on Resolution of the spell and not on Activation.

UnlessCost

UnlessCost allows the player specified with UnlessPayer (same as Defined, defaults to TargetedController) to pay mana to prevent the resolving of the ability. If the script has the param "UnlessSwithched", then the player pays mana to resolve the ability (usually used to handle "any player may pay ..." ).

Factories

In Alphabetical Order.

AlterLife

AlterLife is for Abilities that Alter a player's life total. Gain Life and Lose Life are pretty straightforward.

Gain Life

Have a player gain the specified amount of life.

A:AB$ GainLife | Cost$ T | LifeAmount$ 1 | SpellDescription$ You gain 1 life.
A:SP$ GainLife | Cost$ 1 W | LifeAmount$ 3 | SpellDescription$ You gain 3 life.

LifeAmount$ is required. This is how much life you will gain.

Defined is optional, if it appears the defined player(s) gain life. Target is optional, if it appears and Defined doesn't. Then targeted player(s) gain life.

LoseLife

Have a player lose the specified amount of life.

A:AB$ LoseLife | Cost$ Sac<1/CARDNAME> | ValidTgts$ Player | TgtPrompt$ Target a player to lose a life | LifeAmount$ 1 | SpellDescription$ Target player loses 1 life.
A:SP$ LoseLife | Cost$ 1 B | ValidTgts$ Player | TgtPrompt$Target a player to lose a life | LifeAmount$ 2 | SpellDescription$ Target player loses 2 life.
A:SP$ LoseLife | Cost$ 2 B | Defined$ Opponent | LifeAmount$ 2 | SpellDescription$ Each opponent loses 2 life.

LifeAmount$ is required. This is how much life will be lost.

Target is optional. If Target doesn't appear then Defined will be used. Remember, if Defined is missing, the default for Players is "You"

Part of resolving sets the SVar AFLifeLost to the amount of life lost by all players.

Poison

Poison gives a player the specified number of poison counters.

A:AB$ Poison | Cost$ B T | ValidTgts$ Player | TgtPrompt$ Select target player | Num$ 2 | SpellDescription$ Target player gets 2 poison counters.

Parameters:

  • Num (required) - the number of poison counters to give

Target is optional and used if available. Defined is option and used if no Target (defaults to "You").

SetLife

SetLife sets one or both player's life total to a specified value (i.e. "your life total becomes 20" or "Target player's life total is equal to the number of cards in your graveyard").

A:SP$ SetLife | Cost$ 7 W W | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ 20 | SpellDescription$ Target player's life total becomes 20.

Parameters:
LifeAmount (required) - the value to set the life total(s) to

Defined is optional. If it exists, it will be used. Target is optional. If it exists and defined doesn't it will be used. Default player is "You".

ExchangeLife

ExchangeLife switches the Life total of two players.

A:AB$ ExchangeLife | Cost$ 6 T | ValidTgts$ Player | TargetMin$ 2 | TargetMax$ 2 | TgtPrompt$ Select target player | SpellDescription$ Two target players exchange life totals.

One of Defined or Target is required, since there needs to be two Players exchanging life If Defined it will be used. If Target exists and defined doesn't it will be used.

If there aren't two determined players by the SA, the activating player is added as the second player.

Animate

AF_Animate handles animation effects like "This card becomes a 5/5 green creature with flying until end of turn." It is designed to handle color changing, type changing, P/T setting, and granting/removing abilities.

A:SP$Animate | Cost$ G | ValidTgts$ Land | TgtPrompt$ Select target land | Power$ 3 | Toughness$ 3 | Types$ Creature | SpellDescription$ Until end of turn, target land becomes a 3/3 creature that's still a land.
A:AB$Animate | Cost$ 1 B | Defined$ Self | Power$ 1 | Toughness$ 1 | Types$ Creature,Skeleton | Colors$ Black | Abilities$ ABRegen | SpellDescription$ CARDNAME becomes a 1/1 black Skeleton creature with "B: Regenerate this creature" until end of turn. It's still a land. (If it regenerates, the next time it would be destroyed this turn, it isn't. Instead tap it, remove all damage from it, and remove it from combat.)
SVar:ABRegen:AB$Regenerate | Cost$ B | SpellDescription$ Regenerate CARDNAME.
A:AB$Animate | Cost$ 2 R G | Defined$ Self | Power$ 3 | Toughness$ 3 | Types$ Creature,Elemental | Colors$ Red,Green | Triggers$ TrigAttack | SpellDescription$ Until end of turn, CARDNAME becomes a 3/3 red and green Elemental creature with "Whenever this creature attacks, put a +1/+1 counter on it." It's still a land.
SVar:TrigAttack:Mode$ Attacks | ValidCard$ Creature.Self | Execute$ TrigPutCounter | TriggerDescription$ Whenever CARDNAME attacks, put a +1/+1 counter on it.
SVar:TrigPutCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1

Parameters:

  • Power (required) - the power to assign to the animated card
  • Toughness (required) - the toughness to assign to the animated card
  • Permanent (optional) - set to True if this effect lasts indefinitely
  • Types (optional) - the additional types to give the animated card; comma delimited
  • OverwriteTypes (optional) - set to True if the animated being should have these types instead as opposed to in addition to
  • RemoveTypes (optional) - a list of types to Remove from the animated card
  • ChosenType (optional) - overrides types before it and just will add the ChosenType
  • Keywords (optional) - a " & " delimited list of keywords to give the animated being (just like AB$Pump)
  • HiddenKeywords (optional) - a " & " delimited list of hidden keywords to give the animated being (just like AB$Pump)
  • RemoveKeywords (optional) - a " & " delimited list of keywords to remove from the animated being (just like AB$Debuff)
  • Colors (optional) - a comma-delimited list of Colors to give to the animated being (capitalized and spelled out) (ChosenColor accepted)
  • Abilities (optional) - a comma-delimited list of SVar names which contain abilities that should be granted to the animated being
  • OverwriteAbilities - Remove Abilities from animated being
  • Triggers (optional) - a comma-delimited list of SVar names which contain triggers that should be granted to the animated being
  • OverwriteTriggers - Remove/suppress triggers from animated being
  • staticAbilities (optional) - a comma-delimited list of SVar names which contain static abilities that should be granted to the animated being
  • OverwriteStatics- Remove static abilities from animated being
  • OverwriteReplacements - Remove replacement effects from animated being
  • RemoveAllAbilities - Remove all Abilities, Triggers, Statics, and Replacement effects
  • sVars(optional) - a comma-delimited list of SVars that should be granted to the animated being

Optional Durations should be pretty self explanatory (Default is end of turn)

  • UntilEndOfCombat (optional) - set to True if the effect should last only until End of Combat instead of End of Turn
  • UntilHostLeavesPlay (optional) - set to True if the effect should last as long as the host is still in play
  • UntilYourNextUpkeep
  • UntilControllerNextUntap
  • UntilYourNextTurn

Target is optional, will be used if possible. Defined is optional, will be used if no Targets (Self by default)

Attach

Attach is an Ability Factory that's currently partially finished. It's currently being used only for Auras, primarily for Aura Spells, but also for Auras entering the battlefield indirectly.

AB$ Attach | Cost$ R R | ValidTgts$ Creature | AILogic$ Pump

Attach is an interesting AF, instead of having one primary block of code for AI decisions, the AI Logic is split up based on the type of Attachment. Once again, since this AF is primarily for Auras it makes sense that the AI will treat Auras differently.

Parameters:

  • Object (optional) - This is the Object that will be Attached (generally the Source Card for Auras)
  • AILogic - AI Logic tells the AI which base AI code it should use for Attaching
    • GainControl - Gains Control of the Attached Permanent (Control Magic)
    • Curse - A Generic Curse the AI has a handful of checks to see what the most appropriate Target is.
    • Pump - A Generic Pump. The AI has a handful of checks to see what the most appropriate Target is.
    • ChangeType - For Attachments that change types. Evil Presence is a good example. This logic should be expanded.
    • KeepTapped - For Attachments that keep a Permanent tapped. The AI will also check for a few things like Vigilance, and another KeepTapped Aura. Paralyzing Grasp is a good example.

Attach separates the actually granting of abilities from the attaching to permanents to streamline how things work.

Bond

A factory for soulbonding two creatures

ChangeState

An AbilityFactory for Changing a cards State. This is mostly for Flip Cards or the Transform mechanic.

ChangeZone

ChangeZone is a united front of any card that changes zone. This does not include: drawing, discarding, destroying, or milling, as these represent specific words on which triggers and replacements can react. There are two primary forms, but the distinction is handled mostly in the codebase. The only thing that is required is to set appropriate parameters.

Origin and Destination are both required.

Origin is where the card is coming from.

Destination is where the card is going to. If Destination is Library, a LibraryPosition is recommended, but not required. Default value of the LibraryPosition is 0. 0 represents the top of the library, -1 represents the bottom.

There are two primary versions of ChangeZone.

Hidden Origin

The first is hidden, generally used for Origin zones that are not known information, like the Library or the Hand. The choice of "What card is changing zones?" happens during resolution.

A:SP$ ChangeZone | Cost$ W | Origin$ Library | Destination$ Library | LibraryPosition$ 0 | ChangeType$ Artifact,Enchantment | ChangeNum$ 1 | SpellDescription$ Search your library for an artifact or enchantment card and reveal that card. Shuffle your library, then put the card on top of it.
A:AB$ ChangeZone | Cost$ T | Origin$ Hand | Destination$ Battlefield | ChangeType$ Land | ChangeNum$ 1 | Optional$ True | SpellDescription$ You may put a land card from your hand onto the battlefield.

For Hidden, things like ChangeType and ChangeNum are used to restrict what can ChangeZone, and how many do. There are two parameters special to Hidden Origin:

"Chooser" defines which player has to decide which card changes zone (example You, Opponent).

"Mandatory" most of these abilities are not mandatory, but some are.

Known Origin

The second is known, generally used for Origin zones that are known information, like the Battlefield or the Graveyard. The choice of "What card is changing zones?" happens on activation, generally by targeting.

A:AB$ ChangeZone | Cost$ 1 U T | TgtPrompt$ Choose target artifact card in your graveyard | ValidTgts$ Artifact.YouCtrl | Origin$ Graveyard | Destination$ Library | SpellDescription$ Put target artifact card from your graveyard on top of your library.
A:SP$ ChangeZone | Cost$ U U | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return target permanent to its owner's hand.

For Known, since it just uses Target, normal target parameters are used in this Scenario.

Charm

The Charm AF is for modal spells only right now. This allows cards that have a mode to be chosen to occur after a trigger, which before was impossible. It is also streamlines a handful of cards which before were hardcoded due to complexity.

Parameters

  • CharmNum - Number of Modes to Choose
  • Choices - A Comma delimited list of SVars containing the Modes

Choose

ChooseType

This can be used when you are asked to choose a card type or creature type. (Future revisions may let you choose other specific types.)

  • Type - Required - Can be Card or Creature
  • InvalidTypes - Optional - Use to specify any type that cannot be chosen (ex: "Choose any creature type except Wall")

The Defined is for target players.

Note: Make sure that when this is used with a SubAbility that the DB$AF_Whatever will support Card.ChosenType. This will need testing on a case by case basis.

Clash

This AF handles clashing, the old overcomplication from the Lorwyn block. ;) It takes two special parameters: WinSubAbility and OtherwiseSubAbility. They are both optional and work the same way, namely that it contains the name of an SVar that in turn contains a drawback to be executed. The example below is for Release the Ants.

A:SP$ DealDamage | Cost$ 1 R | Tgt$ TgtCP | NumDmg$ 1 | SubAbility$ DBClash | SpellDescription$ Release the Ants deals 1 damage to target creature or player. Clash with an opponent. If you win, return CARDNAME to its owner's hand.
SVar:DBClash:DB$ Clash | WinSubAbility$ DBReturn
SVar:DBReturn:DB$ ChangeZone | Defined$ Self | Origin$ Stack | Destination$ Hand

Cleanup

A non-functional, maintenance AF used for Cleaning up certain Variables before a Spell Finishes Resolving.

Parameters

  • ClearRemembered$ (optional) Set to True to clear this card's remembered list. Generally useful for Cards that Remember a card, do something to it, then need to forget it once it's done.
  • ClearImprinted$ (optional) Set to True to clear the list of imprinted cards.
  • ClearChosenX$ (optional) Set to True to clear the chosen X value.
  • ClearTriggered$ (optional) Set to True to clear any delayed triggers produced by this card.
  • ClearCoinFlips$ (optional) Set to True to clear the remembered coin flip result.
  • ClearChosenCard$ (optional) Set to True to clear the chosen cards.
  • ForgetDefined$ (optional) If present, remove the specified cards from this card's remembered list.

Combat

The Combat AF is for things related to combat. For now that's Prevent Combat Damage like Fog, but may also include other Combat related things.

Fog

Fog is an ability based on the original Fog spell. "Prevent all combat damage that would be dealt this turn." While this could be done with an effect, the specialized nature of the AI gives it it's own AF.

A:AB$ Fog | Cost$ G W U T | SpellDescription$ Prevent all combat damage that would be dealt this turn.
A:SP$ Fog | Cost$ G | SpellDescription$ Prevent all combat damage that would be dealt this turn.

Copy

CopyPermanent

Copies a permanent on the battlefield.

Parameters:

  • NumCopies - optional - the number of copies to put onto the battlefield. Supports SVar:X:????.
  • Keywords - optional - a list of keywords to add to the copies
  • AtEOT - optional
    • Sacrifice - set to this is copy should be sacrificed at End of Turn
    • Exile - set to this is copy should be exiled at End of Turn

CopySpell

Copies a spell on the stack (Twincast, etc.)

Parameters

  • <none>

CounterMagic

CounterMagic deals with Countering Spells or Abilities.

A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | UnlessCost$ 3 | SpellDescription$ Counter target spell unless its controller pays 3.
A:SP$ Counter | Cost$ U | TgtPrompt$ Select target Activated or Triggered Ability | ValidTgts$ Card | TargetType$ Activated,Triggered | SpellDescription$ Counter target activated or triggered ability.
A:SP$ Counter | Cost$ G | TargetType$ Spell | ValidTgts$ Instant,Aura | TargetValidTargeting$ Permanent.YouCtrl | SpellDescription$ Counter target instant or Aura spell that targets a permanent you control. 

Parameters

  • TargetType - Can be Spell,Activated,Triggered. If more than one, just put a comma in between.
  • ValidTgts - a "valid" expression for types of source card (if you don't know what it is it's just "Card")
  • TargetValidTargeting- a "valid" expression for targets of this spell's target
  • Destination - send countered spell to: (only applies to Spells; ignored for Abilities)
    • Graveyard (Default)
    • Exile
    • TopDeck
    • Hand
    • BottomDeck
    • Shuffle

Counters

Factories to handle counters on cards.

PutCounter

Put any type of counter on a cards.

A:AB$ PutCounter | Cost$ T | CounterType$ CHARGE | CounterNum$1 | SpellDescription$ Put a charge counter on CARDNAME.
A:SP$ PutCounter | Cost$ G | Tgt$ TgtC | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a charge counter on CARDNAME.

Target is optional. If no Target is provided, the permanent will put counters on itself.

  • CounterType$ (required) specifies the type of counter and should appear in all caps. It should be one of the values in the Counters enum.
  • CounterNum$ (required) specifies how many counters will be put on the chosen card.

PutCounterAll

Put any type of counter on all valid cards.

  • CounterType$ (required) specifies the type of counter and should appear in all caps. It should be one of the values in the Counters enum.
  • CounterNum$ (required) specifies how many counters will be put on the chosen cards.
  • ValidCards$ (required) specifies the cards to add counters to.

RemoveCounter

Remove any type of counter from a card.

Target is optional. If no Target is provided, the permanent will remove counters from itself.

  • CounterType$ (required) specifies the type of counter and should appear in all caps. It should be one of the values in the Counters enum.
  • CounterNum$ (required) specifies how many counters will be removed from the chosen card.
  • UpTo$ is optional. If an effect states you may remove "up to X counters", set this to True.

RemoveCounterAll

Remove any type of counter from all valid cards.

  • CounterType$ (required) specifies the type of counter and should appear in all caps. It should be one of the values in the Counters enum.
  • CounterNum$ (required) specifies how many counters will be removed from the chosen cards.
  • ValidCards$ (required) specifies the card to remove counters from.

Proliferate

The Proliferate keyword from Scars of Mirrodin. On resolution you choose any number of cards and players. Each of them gains a counter of each type already on them.

A:AB$ Proliferate | Cost$ T Sac<1/Artifact> | SpellDescription$ Proliferate

MoveCounters

User for cards that Move Counters on Resolution, requiring the Host card to have Counters for the Move to occur.

Parameters

  • Source - The Source of the Moving Counters
  • Defined - The Destination of the Moving Counters
  • CounterType - The type of counter to move.
  • CounterNum - The number of counters to move.

DealDamage

This factory handles dealing direct damage.

DealDamage

Deal damage to a specified player or permanent.

A:AB$ DealDamage | Cost$ T | Tgt$ TgtCP | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature or player.
A:SP$ DealDamage | Cost$ R | Tgt$ TgtCP | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to target creature or player.

NumDmg$ is required. This is the amount of damage dealt.

DamageAll

This is for damaging all applicable cards/players. Spells like Earthquake fit in this category.

A:SP$ DamageAll | Cost$ 1 B | NumDmg$ 1 | ValidCards$ Creature | ValidPlayers$ Each | ValidDescription$ each creature and each player. | SpellDescription$ CARDNAME deals 1 damage to each creature and each player.

NumDmg$ is required. This is the amount of damage dealt.

ValidCards are for specifying the cards that will take damage. ValidPlayers are for specifying the players.

Debuff

Parameters

  • Keywords
  • Permanent

Debuff

An AbilityFactory for Removing Keywords, either temporarily or for longer durations.

DebuffAll

Same as Debuff, but for all of something

DelayedTrigger

Documentation Coming

Destroy

This factory handles destruction of cards on the battlefield.

See Sacrifice for special case: 'Target opponent chooses [x cards]. Destroy those [cards]'

Destroy

A:SP$Destroy | Cost$ 1 W W | ValidTgts$ Artifact,Enchantment | TgtPrompt$ Select target artifact or enchantment | SpellDescription$ Destroy target artifact or enchantment.

DestroyAll

A:SP$ DestroyAll | Cost$ 3 U | ValidCards$ Forest | SpellDescription$ Destroy all Forests.

Effect

Effect is an oddball of the AF family. Where usually AFs have similarities to each other to help with AI use, Effect doesn't fall under that jurisdiction. In general, an effect is some type of SA that lasts longer than its resolution.

A good example is High Tide. For the rest of the turn, High Tide makes all Islands produce an extra mana. It doesn't matter if the Island was in play, if it turned into an Island after High Tide was cast, any of that.

A:SP$ Effect | Cost$ U | Name$ High Tide Effect | Triggers$ IslandTrigger | SVars$ TrigMana | SpellDescription$ Until end of turn, whenever a player taps an Island for mana, that player adds U to his or her mana pool (in addition to the mana the land produces).
SVar:IslandTrigger:Mode$ TapsForMana | ValidCard$ Island | Execute$ TrigMana | TriggerDescription$ Whenever a player taps an Island for mana, that player adds U to his or her mana pool (in addition to the mana the land produces).
SVar:TrigMana:AB$Mana | Cost$ 0 | Produced$ U | Amount$ 1

Effect is most similar to Token as it creates a pseudo-permanent, except Effect creates in the command zone rather than the battlefield. It stays active there for a set Duration.

Parameters

  • Abilities,Triggers,SVars are comma separated lists which contain SVars that point to the appropriate type that the Effect will gain.
  • Duration is how long the Effect lasts. Right now, most effects will last Until End of Turn. In the future, they may have other conditions.

Duration$ Permanent for effects that have no specific Duration.

  • Stackable$ False - Most Effects are assumed to be Stackable. By setting the Stackable Flag to False, the AI will know having a second one in play is useless, so will save it's Resource for something else.
  • Image - a file_name_without_extension (image needs to reside in the tokens directory)

EndGameCondition

Documentation to come.

GainControl

Example: Act of Aggression

A:SP$ GainControl | Cost$ 3 PR PR | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature an opponent controls. | LoseControl$ EOT | Untap$ True | AddKWs$ Haste | SpellDescription$ Gain control of target creature an opponent controls until end of turn. Untap that creature. It gains haste until end of turn.

Parameters:

  • NewController(Targeted player, if there is no target player, the default is the ActivatingPlayer)
  • AllValid(all valid types, no targets)
  • LoseControl(LeavesPlay, Untap, LoseControl, EOT(end of turn))

Mana

For lands or other permanent to produce mana.

A:AB$ Mana | Cost$ T | Produced$ W | SpellDescription$ Add W to your mana pool.

PeekAndReveal

This AF is very similar to things that Dig can do, but handle a much simpler form, with less complex coding underneath. Similar to how RearrangeTopOfLibrary could be handled with Dig.

Primarily used with cards that allow you to Peek at the top card of your library, and allow you to reveal it if it's of a certain type. The Kinship cards fit this bill perfectly, so they are used to simplify the complex popups that would be required if using multiple Dig SubAbilities.

RevealOptional - Whether or not the Reveal is optional.

RememberRevealed - Whether to remember the revealed cards (after filtering by Valid)

RememberPeeked - Whether to remember the peeked cards (only if they are not revealed!)

RevealValid - defaults to Card, but allows you to set a specific ValidType if you can only have certain things

PeekAmount - defaults to 1, but allows you to peek at multiple cards if possible

PermanentState

AF for things that alter a permanent's state: tap, untap, or phase in/out.

Untap

A:AB$ Untap | Cost$ G | ActivationLimit$ 1| SpellDescription$ Untap CARDNAME. Activate this ability only once each turn.
A:SP$ Untap | Cost$ W | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | SpellDescription$ Untap target permanent.

Target is optional. If not provided, will untap the permanent with this ability.

UntapAll

A:SP$ UntapAll | Cost$ G | ValidCards$ Creature.YouCtrl | SpellDescription$ Untap all creatures you control.

Tap

A:AB$ Tap | Cost$ R | ValidTgts$ Wall | TgtPrompt$ Select target wall | SpellDescription$ Tap target wall.

TapAll

A:AB$ TapAll | Cost$ U U U | ValidCards$ Creature.withoutFlying | SpellDescription$ Tap all creatures without flying.

TapOrUntap

Documentation to come.

Phases

Documentation to come.

Play

Playing a card or cards as part of SA. The player may have to make a choice about which card to play if there are more choices than the number of cards to play.

There are lots of parameters. This is only some of them. Sunbird's Invocation uses many of the parameters.

Amount - How many cards can be played (a non-negative integer or "All").

Valid - Selection criteria for valid cards from the zone to cast.

ValidZone - The zone to look in to determine the valid cards.

ShowCards - Other cards in the zone to show when selecting valid cards.

Optional - Casting the card is optional.

RememberPlayed - Remember the card played.

ForgetRemembered - Remove all remembered cards from the source (but only if a card was successfully played)

ForgetTargetRemembered - Remove the played card from remembered cards (but only if it was successfully played)

WithoutManaCost - The card can be cost without mana payment.

PreventDamage

AF damage prevention effects.

PreventDamage

  • PreventDamage
    • A:SP$ PreventDamage | Cost$ W | ValidTgts$ Creature | Amount$ 3 | TgtPrompt$ Select target creature | SpellDescription$ Prevent the next 3 damage that would be dealt to target creature this turn.

Protection

Protection

Protection grants protection from colors or cards types, or creature types. Anything that has "Protection from ..."

  • Protection

Gains - required - the thing to gain protection from (green, artifacts, Demons, etc.) or "Choice" if you can choose one of... Choices - optional - if Gains$ Choice then this is a comma-delimited list of choices Permanent - optional - use if this effect lasts indefinitely UntilEndOfCombat - optional - true if this only lasts until end of combat (instead of end of turn)

ProtectionAll

Same as Protection, but for all ValidCards

Pump

This factory handles pumping creatures power/toughness or granting abilities to permanents (usually creatures).

  • Pump
    • A:AB$ Pump | Cost$ R | NumAtt$ +1 | SpellDescription$ CARDNAME gets +1/+0 until end of turn.
    • A:SP$ Pump | Cost$ 1 U | ValidTgts$ Creature | KW$ Shroud| SpellDescription$ Target creature gains shroud until end of turn. | TgtPrompt$ Select target creature.

Target is optional. If it's not provided, the activating permanent will be pumped.

NumAtt$ is optional, will pump Power.

NumDef$ is optional, will pump Toughness.

KW$ is optional, will give temporary keywords.

Regenerate

Regenerate

Regenerate is similar to abilities like Pump. But for creating Regeneration shields.

  • Regenerate
    • A:AB$ Regenerate | Cost$ B | SpellDescription$ Regenerate CARDNAME
    • A:SP$ Regenerate | Cost$ W | ValidTgts$ Creature | TgtPrompt$ Select target creature | SpellDescription$ Regenerate target creature.

Target is optional. If not provided, will regenerate the permanent with this ability.

RegenerateAll

Same as regenerate, but for all.

ValidCards - required - a valid expression for cards to regenerate

Repeat

Repeat the specified ability.

Repeat

A:SP$ Repeat | Cost$ 3 B B | RepeatSubAbility$ DBDig | RepeatOptional$ True
  • MaxRepeat - optional - the maxium times to repeat, execute repeat ability at least once
  • RepeatSubAbility - required - setup subability to repeat
  • RepeatOptional - optional - you make the choice whether to repeat the process
  • RepeatPresent, RepeatCompare, RepeatDefined, RepeatCheckSVar, RepeatSVarCompare - optional - condition check

RepeatEach

  • RepeatSubAbility - required - to set up repeat subability
  • RepeatCards - to repeat for each valid card (zone: present zone of the valid repeat cards, default: battlefield)
  • DefinedCards
  • RepeatPlayers - to repeat for each valid player
  • RepeatCounters - to repeat for each valid counters

RestartGame

Used in the script of Karn Liberated

Reveal

Dig

Dig is for an ability that does basically this: "You look at the X cards of your Library, put Y of them somewhere, then put the rest somewhere." Think of Impulse.

  • DigNum - Required - look at the top number of cards of your library.
  • Reveal - Optional - for abilities that say "Reveal the top X cards of your library". Default is false.
  • SourceZone - Optional - the zone to dig in. Default is Library.
  • DestinationZone - Optional - the zone to put the Y cards in. Default is Hand.
  • LibraryPosition - Optional - if DestinationZone is Library, use this to specify position. Default is -1 (bottom of library).
  • ChangeNum - Optional - the number of cards to move to the DestinationZone (or "All" when it's for things like "put all lands revealed this way into your hand"). Default is 1.
  • ChangeValid - Optional - use this to specify if "you may move an artifact to DestinationZone". Default is any Card.
  • AnyNumber - Optional - use if you can move any number of Cards to DestinationZone. Default is false. (think of Lead the Stampede)
  • Optional - Optional - set this if you "may" move a card to DestinationZone. Default is false.
  • DestinationZone2 - Optional - the zone to put the rest of the cards in. If it is library, you are prompted for the order. Default is Library.
  • LibraryPosition2 - Optional - if DestinationZone2 is Library, use this to specify position. Default is -1 (bottom of library).

There is some leeway in the future to allow targeting based on player, but that is not implemented yet. So, Defined is not necessary, and should not be used unless clarifying "You".

DigUntil

Documentation to come.

RevealHand

Look at a player's hand.

Target or Defined is required.

A:AB$ RevealHand | Cost$ T | ValidTgts$ Player | TgtPrompt$ Select target player | SpellDescription$ Look at target player's hand.

Scry

A:AB$ Scry | Cost$ 1 T | ScryNum$ 2 | SpellDescription$ Scry 2. (To scry 2, look at the top two cards of your library, then put any number of them on the bottom of your library and the rest on top in any order.)

RearrangeTopOfLibrary

Documentation to come. (Note is there any reason Rearrange Top of Library is different than Dig?)

Reveal

A:AB$ Reveal | Cost$ 2 U T | Defined$ You | RevealValid$ Card.Blue | AnyNumber$ True | RememberRevealed$ True

Parameters:

  • RevealValid: to limit the valid cards.
  • AnyNumber
  • Random
  • RememberRevealed: to remember the cards revealed

ReverseTurnOrder

Reverses the order in which the turn progresses.

A:SP$ ReverseTurnOrder | Cost$ ?

Sacrifice

Usually you choose a player and that player has to sacrifice something

A:SP$ Sacrifice | Cost$ 1 B | ValidTgts$ Player | SacValid$ Creature | SacMessage$ Creature | Amount$ 2 | SpellDescription$ Target player sacrifices a creature.

Destroy$ True - An optional parameter for destroying permanents target player chooses (eg: Burning of Xinye, or Imperial Edict).

A:SP$ Sacrifice | Cost$ 1 B | ValidTgts$ Opponent | SacValid$ Creature | SacMessage$ Creature | Destroy$ True | SpellDescription$ Target opponent chooses a creature he or she controls. Destroy it.

StoreSVar

Token

Token simply lets you create tokens of any type.

A:SP$ Token | Cost$ 3 W U | TokenImage$ W 1 1 Bird Flying | TokenAmount$ X | TokenName$ Bird | TokenTypes$ Creature,Bird | TokenOwner$ You | TokenColors$ Blue | TokenPower$ 1 | TokenToughness$ 1 | TokenKeywords$ Flying

This ability factory does not take a target. All the parameters are mandatory except for TokenKeywords. If you provide a non-integer for TokenAmount,TokenPower or TokenToughness the AF will attempt to look for an SVar of that name and interpret it's contents as a Count$ line. Worth noting is that TokenTypes and TokenColors are simple commaseparated lists while TokenKeywords is a list where the items are separated by "<>". If TokenImage is not provided, the factory will attempt to construct a filename on it's own. TokenOwner can use Defined-like parameters, such as "You" "Opponent" or the new Triggered-Variables.

You can also use the parameters TokenAbilities$,TokenTriggers$ and TokenSVars$ to give the created tokens any number of either. For example, here's how Growth Spasm creates an Eldrazi Spawn token complete with ability.

SVar:DBToken:DB$Token | TokenAmount$ 1 | TokenName$ Eldrazi Spawn | TokenTypes$ Creature,Eldrazi,Spawn | TokenOwner$ You | TokenColors$ Colorless | TokenPower$ 0 | TokenToughness$ 1 | TokenAbilities$ ABMana SVar:ABMana:AB$Mana | Cost$ Sac<1/CARDNAME> | Produced$ 1 | Amount$ 1 | SpellDescription$ Add 1 to your mana pool. 

As another example, here's Mitotic Slimes' use of TokenTriggers$:

T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigTokenSenior | TriggerDescription$ When CARDNAME is put into a graveyard from the battlefield, put two 2/2 green Ooze creature tokens onto the battlefield. They have "When this creature is put into a graveyard, put two 1/1 green Ooze creature tokens onto the battlefield." 
SVar:TrigTokenSenior:AB$ Token | Cost$ 0 | TokenImage$ g 2 2 ooze | TokenName$ Ooze | TokenTypes$ Creature,Ooze | TokenColors$ Green | TokenOwner$ You | TokenPower$ 2 | TokenToughness$ 2 | TokenAmount$ 2 | TokenTriggers$ TriggerJunior | TokenSVars$ TrigTokenJunior 
SVar:TriggerJunior:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigTokenJunior | TriggerDescription$ When this creature is put into a graveyard, put two 1/1 green Ooze creature tokens onto the battlefield. SVar:TrigTokenJunior:AB$Token | Cost$ 0 | TokenImage$ g 1 1 ooze | TokenName$ Ooze | TokenTypes$ Creature,Ooze | TokenColors$ Green | TokenOwner$ You | TokenPower$ 1 | TokenToughness$ 1 | TokenAmount$ 2 

Turns

A factory for manipulating the turn structure.

AddTurns

A:SP$ AddTurn | Cost$ 1 U | NumTurns$ 1 | SpellDescription$ Take an extra turn after this one.

EndTurn

A:SP$ EndTurn | Cost$ 4 U U | SpellDescription$ End the turn. (Exile all spells and abilities on the stack, including this card. The player whose turn it is discards down to his or her maximum hand size. Damage wears off, and "this turn" and "until end of turn" effects end.)

ZoneAffecting

For specific effects that handle zones in a specific manner

Draw

A:AB$ Draw | Cost$ 1 Sac<1/CARDNAME> | NumCards$ 1 | SpellDescription$ Draw a card.

Discard

A:AB$ Discard | Cost$ T | ValidTgts$ Opponent | NumCards$ 1 | Mode$ TgtChoose | SpellDescription$ Target opponent discards a card. 
  • NumCards - the number of cards to be discarded (may be integer or X)
  • Mode - the mode of discard - should match spDiscard
    • Random
    • TgtChoose
    • RevealYouChoose
    • Hand
  • DiscardValid - a ValidCards syntax for acceptable cards to discard
  • UnlessType - a ValidCards expression for "discard X unless you discard <Type>"

Mill

A:AB$ Mill | Cost$ 2 T | NumCards$ 2 | ValidTgts$ Player | TgtPrompt$ Choose a player to mill | SpellDescription$ Target player puts the top two cards of his or her library into his or her graveyard.

Shuffle

Used for shuffling a player's library

  • Optional - Optional - Set this parameter if the user should be prompted Yes/No to shuffle the given library. Default is false.