Actions
An action is something that cards, players, or the game can do. Actions make up most non-static effects.
Syntax
All actions look like a function call, with parameters inside parentheses.
Functions
| Function | Description |
|---|---|
| AddCounters(Target, type, amount) | eg AddCounters(SOURCE,+1/+1,1) or AddCounters(SOURCE,time,3) |
| AddMana(ManaCost, player) | Adds mana to player's mana pool. See ManaCost. |
| AllowManaPayment(player) | Allows 'player' to activate mana abilities.Always use Wait() directly after. |
| ApplyContinuous(Target, ContinuousEffect, TriggerCondition) | Apply effect to target. The effect will end when the game sends the trigger condition matching the expiration condition. |
| CombinedPlayerVariable(Condition, varname) | Returns the sum of all "varnames" on each player matching the condition. |
| ContrivoreUnique() | Returns the number of permanents and exiled cards that have counters on them. |
| CopySpell(card, player, [vars…] ) | Copies "card" for "player" |
| CountDevotion(player, types…) | Counts player's devotion to types (each type is a lettered symbol, ex W, U, B, R, or G) |
| CountCardsInZone(zone, Condition) | Counts the number of cards in "zone" matching "condition". |
| CounterSpell(Target target, String zone) | Counters a card. If it's countered, it sends it to the given zone (default Graveyard) |
| CountPermanentsWithSubtype(type, subtype, [player] ) | Counts the number of "type" permanents containing "subtype". If player is included, only counts permanents under that player's control. |
| CreateActionList(player, Condition, prompt, script, defaultprompt, defaultscript) | Searches the game for cards matching condition, then creates a list asking the player to choose one. The script is what gets executed when the player clicks on an item. |
| CreateReplacementEffect(eventMatcher, newEvent, source, charges, endCondition) | Creates a global replacement effect that lasts until the specified trigger event happens or until it is used 'charges' times. |
| CreateVisualActionList(player, Condition, script, defaultscript) | Same as above, but creates a visual list of cards the player can click on. Note that prompt and defaultprompt aren't included here |
| CreateNewCard(card, initialZone, owner, [vars…] ) | Creates a new card that's a copy of "card" in "initialZone" owned by "owner". "vars" are given to the new card as it's created. |
| CreateTokens(player, amount, power, toughness, filename, name, StringList_colors, StringList_types) | Creates tokens for a player. Filename is the name of the token card file (contains the token's art and abilities) StringList_colors is a StringList containing a list of color words, for example StringList(#white#,#green#) StringList_types is a StringList containing pairs of types and subtypes, for example StringList(Creature,#Elf#,Creature,#Warrior#) |
| CreateTokensFromCard(player, amount, Target) | Creates tokens that are copies of Target |
| Damage(Source, Target, amount) | Makes 'Source' deal 'amount' damage to 'Target'. |
| Destroy(Target, canRegen?) | Destroys the permanent. If canRegen is false, that permanent can't be regenerated (defaults to true if omitted). |
| DXM(player) | Returns the amount of mana in player's mana pool, plus the number of untapped mana producers they control.Very useful for spells and abilities with X in them. |
| Draw(player, amount) | Draws amount cards for player |
| Fight(Target, Target) | Makes two creatures fight (as per the keyword) |
| ForceDiscard(player, amount) | Forces the given player to discard an amount of cards. If player has exactly or less cards than amount, the discard happens automatically. Always follow with Wait() |
| ForceSacrifice(player, condition, amount, prompt) | Force player to sacrifice some permanents with the specified conditions. If player controls exactly or fewer sacrifice candidates than amount, the sacrifice is done automatically. Always follow with Wait() |
| ForEachCardInPlayerZone(Zone, min, max, Action, Condition) | Same as ForEachCardInZone, but only works on cards between min and max that meet the condition (useful for "milling" effects, etc.) |
| ForEachCardInZone(Zone, Condition, …, Action) | Loops through each card in the specified zone. Runs each condition on that card. If all conditions are true, runs the specified action on that card. |
| ForEachPlayer(Condition…, Action) | Loops for each player, runs the conditions, then runs the action. |
| FungalBehemothUnique() | Returns the number of +1/+1 counters on creatures controlled by the calling object's controller. |
| GetActivePlayer() | Returns the active player |
| GetCardInZone(zoneName, player, index, [condition] ) | Gets card at index for player in the given zone (0 is top of library). Ignores cards that don't match condition if it's included. |
| GetCMC(card) | Returns the converted mana cost of "card". |
| GetCostPaidCMC(card) | Gets the total amount of mana spent to cast card. |
| GetCounters(card, type) | Returns the number of "type" counters on "card" |
| GetEnchantedObject(card, [ignoreLKI] ) | Returns the object that "card" is attached to. Works on auras and equipment. If a second parameter is present, this will ignore last-known-information. |
| GetManaCost(card) | Returns the mana cost of "card" (not CMC) |
| GetSoulbondPartner(card) | Returns the object this card is soulbonded to. "false" if there's no bond. |
| GetTurnStep() | Returns the name of the current turn step. |
| GetVar(Target, varname) | Returns the value of the given target's variable named varname. |
| IfThenElse(Condition, action_if_true, action_if_false) | Checks a condition and runs the corresponding script. |
| LifeChange(player, amount) | Adds amount to player's life. This counts as life gain and life loss, not damage. |
| ManaPayment(player, manacost) | If 'player' has enough mana in their pool to pay for 'manacost', spend that mana and return true. Otherwise, just return false. |
| Math(String) | Evaluates the math expression. Experimental. |
| MathAdd(int… ) | Adds every value and returns the sum. eg MathAdd(1, 2, 3) returns 1 + 2 + 3 = 6 |
| MathDiv(a, b, [roundMode] ) | Returns a divided by b. roundmode can be "up" or "down" (down by default). |
| MathSub(int…) | Subtracts every value from the first number. eg MathSub(9,3,2) returns 9 - 3 - 2 = 4 |
| RemoveCounters(card, type, amount) | Removes "amount" "type" counters from "card" |
| Random(min, max) | Returns a random integer in the range [min, max] |
| RandomTarget(Condition) | Returns the object id of a random object matching 'Condition' |
| SetVar(Target, varname, value) | Sets the target's varname variable to value. |
| Shuffle(zone, player) | Shuffles the specified zone for the given player. |
| Soulbond(a, b) | Soulbonds cards 'a' and 'b'. All error checking is done internally. This will allow you to bond noncreatures. The SoulbondAvailable condition lets you discriminate against noncreatures being bonded. |
| Tap(Target) | Taps the target. |
| TarmogoyfUnique() | Returns the number of card types in all graveyards. |
| Untap(Target) | Untaps the target |
| Wait() | Pauses execution of this ability until all players pass again. Always use this directly after any function call that forces the player to make a choice. (list at bottom) |
| ZoneChange(Target, zone_from, zone_to, variables…) | Moves the given target from one zone to another. See ZoneChange for complete list of variables. |
Notes
- Wait() should be called after the following functions, ForceDiscard(), ForceSacrifice(), CreateActionList(), CreateVisualActionList(), PlayerRequest(), ChooseCreatureType(). AllowManaPayment()
Function name dump
This is a list of ALL functions that have been implemented. Some of them may not be documented on this page.
AddCardToPile()
AddCounters()
AddMana()
AllowManaPayment()
And()
ApplyContinuous()
AttachTo()
Batch()
CanMiracle()
CanProduceMana()
ChangeTarget()
ChooseCardName()
ChooseCreatureType()
ChooseNumber()
ChooseSource()
ColorToMana()
ColorToSymbol()
CombinedPlayerVariable()
CompareAnOpponent()
CompareCMC()
CompareEachOpponent()
ContrivoreUnique()
ControlsTheMost()
CopySpell()
CountAttachments()
CountCardsInZone()
CountDevotion()
CountPermanentsWithSubtype()
CounterSpell()
CreateActionList()
CreateDelayedTrigger()
CreateExtraCombatPhase()
CreateExtraStep()
CreateExtraTurn()
CreateNewCard()
CreatePiles()
CreateReplacementEffect()
CreateReplacementFromAbility()
CreateTokens()
CreateTokensFromCard()
CreateVisualActionList()
DXM()
Damage()
Destroy()
DivideDamage()
DoublingCubeUnique()
Draw()
EmptyManaPool()
EndTurn()
Equal()
ExchangeControl()
Fight()
ForEachCardInPlayerZone()
ForEachCardInZone()
ForEachPlayer()
ForceBounce()
ForceDiscard()
ForceSacrifice()
FreeCast()
FungalBehemothUnique()
GEqual()
GThan()
GetActivePlayer()
GetCMC()
GetCardInZone()
GetCardInfo()
GetCostPaidCMC()
GetCounters()
GetEnchantedObject()
GetManaCost()
GetSoulbondPartner()
GetTurnStep()
GetUniqueString()
GetVar()
GetVar") || function.endsWith("Than") || function.endsWith("Equal()
GetZoneCastFrom()
GetZoneName()
HandlePiles()
HasAbilityWithName()
HasKeyword()
HighSentinelUnique()
HighestValueAmongPlayers()
HighestValueAmongZone()
IfThenElse()
InkTreaderUnique()
IsActivePlayer()
IsArtifact()
IsAttacking()
IsBasic()
IsBlocking()
IsBonded()
IsColor()
IsColorless()
IsCommander()
IsCreature()
IsEnchanted()
IsEnchantedBy()
IsEnchantment()
IsEquipped()
IsEquipped()
IsFaceDown()
IsInSubzone()
IsInZone()
IsInstant()
IsKingOfTheHill()
IsLand()
IsLinkedFrom()
IsMainPhase()
IsOnlyTargetOf()
IsOpponent()
IsPermanent()
IsPlayer()
IsSorcery()
IsSpell()
IsSpellOrAbility()
IsSubtype()
IsTapped()
IsTargetedBy()
IsToken()
IsType()
IsUnblocked()
IsUntapped()
LEqual()
LThan()
LifeChange()
Loop()
LowestValueAmongPlayers()
LowestValueAmongZone()
ManaContains()
ManaPayment()
ManaWasSpentOn()
Manifest()
Math()
MathAdd()
MathDiv()
MathSub()
Mill()
MoveCounters()
Not()
NotFalse()
NotPreviouslyTargeted()
NullDamage()
Or()
PayLife()
PlaySoundForPlayers()
PlayerChoice()
PlayerCompare()
PlayerControlsPermanent()
PlayerControlsPermanentMatchingCondition()
PlayerRequest()
PowerConduitUnique()
PreClone()
PreventDamage()
Random()
RandomList()
RandomTarget()
RandomTarget()
Regenerate()
RemoveAllDamage()
RemoveCounters()
Reveal()
RevealFromLibraryUntil()
RevealHand()
RevealPiles()
Sacrifice()
SameController()
SaveCardInfo()
SetVar()
SharesSubtype()
Shuffle()
SkipNextTurn()
SorceryTiming()
Soulbond()
SoulbondAvailable()
SpellskiteTargetSelector()
Splice()
Stop()
String()
StringList()
SwitchPile()
Tap()
TarmogoyfUnique()
ToManaCost()
TokenJustCreated()
Transform()
TurnFaceDown()
TurnFaceUp()
TypeList()
Unattach()
Untap()
ZoneChange()
ZoneSize()
ZoneThreshold()





