I think this is such a cool idea. It's always good to get organized and I see your point entirely jacque. As for my input, I think if such a task is undertaken it should also, if possible, be characterized and categorized by sets, blocks, and expansions. For example, all the complete Return to Ravnica cards could be listed under Block: Return to Ravnica with sub entries for the core and expansions listed as RTR, GTC, and DGM with complete, pending, or impossible next to the cards so we can know if it's currently available or not. Of course credit will be given to the creator of the card as well. Again, I like the idea and challenge of forming this database. I think it would be very coherent and I also think the same would be good for specific known abilities and card effects. The latter will certainly help myself, NeoAnderson, Tejahn, and others that are developing custom sets greatly with our custom mods. For example the full abilities of the Return to Ravnica card
Mizzium Mortars (coded by ???), the GTC card
Mental Vapors (coded by ???),
Melek, Izzet Paragon (coded by ???), and the Theros card
Master of Waves (coded by Rari) could be listed numeric-alphabetic in their proper categories. Perhaps a link can be provided to download individual card XMLs or entire sets, blocks, or expansions currently available. Indeed, the TDX files should be available for download as well but for me just having the codes alone are sufficient.
The card code breakdowns could be as follow per effect:
Return to Ravnica BlockMizzium Mortars

(RTR) - Complete
Sorcery
Mizzium Mortars deals 4 damage to target creature you don't control.
- Code: Select all
<FILTER filter_id="0">
local filter = ClearFilter()
filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
filter:Add(FE_CONTROLLER, OP_NOT, EffectController())
filter:SetZone(ZONE_BATTLEFIELD)
</FILTER>
<RESOLUTION_TIME_ACTION filter_id="0">
local DC = RSN_ObjectDC()
if DC:Count() ~= 0 then
local overload = DC:Int_Get(0)
if overload == 1 then
if FilteredCard() ~= nil then
EffectSourceLKI():DealDamageTo(4, FilteredCard())
end
else
DC:Int_Set(0, 0)
local filter = ClearFilter()
filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
filter:Add(FE_CONTROLLER, OP_NOT, EffectController())
filter:Add(FE_CHARACTERISTIC, OP_NOT, CHARACTERISTIC_HEXPROOF)
filter:Add(FE_CHARACTERISTIC, OP_NOT, CHARACTERISTIC_SHROUD)
EffectController():ChooseItem("CARD_QUERY_CHOOSE_CREATURE_DEAL_4_DAMAGE", EffectDC():Make_Targets(1))
end
else
DC:Int_Set(0, 0)
local filter = ClearFilter()
filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
filter:Add(FE_CONTROLLER, OP_NOT, EffectController())
filter:Add(FE_CHARACTERISTIC, OP_NOT, CHARACTERISTIC_HEXPROOF)
filter:Add(FE_CHARACTERISTIC, OP_NOT, CHARACTERISTIC_SHROUD)
EffectController():ChooseItem("CARD_QUERY_CHOOSE_CREATURE_DEAL_4_DAMAGE", EffectDC():Make_Targets(1))
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local DC = RSN_ObjectDC()
local overload = DC:Int_Get(0)
if overload ~= 1 then
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if target ~= nil then
EffectSourceLKI():DealDamageTo(4, target)
end
end
</RESOLUTION_TIME_ACTION>
Overload

(You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") -
Impossible[I thought this was impossible to code but someone has coded it. I'm not sure if it works in game though.]
- Code: Select all
<COST mana_cost="{3}{R}{R}{R}" type="Mana" />
<COST type="Generic">
<PREREQUISITE>
return true
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
local DC = RSN_ObjectDC()
DC:Int_Set(0, 1)
</RESOLUTION_TIME_ACTION>
</COST>
<ABILITY_TEXT tag="ALTERNATE_COST_OVERLOAD" />
Mental Vapors

(GTC) - Complete
Sorcery
Target player discards a card.
- Code: Select all
<TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD_1" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local filter = ClearFilter()
filter:SetFilterType( FILTER_TYPE_PLAYERS )
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
local filter = ClearFilter()
filter:SetZone( ZONE_HAND, player )
player:SetItemCount( 1 )
for i = 0,(1-1) do
player:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
end
player:ChooseItems( EffectDC():Make_Targets(1) )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
if player ~= nil then
for i = 0,(1-1) do
local target_card = EffectDC():Get_Targets(1):Get_CardPtr(i)
if target_card ~= nil then
target_card:Discard()
end
end
end
</RESOLUTION_TIME_ACTION>
<AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
Cipher
- Code: Select all
<RESOLUTION_TIME_ACTION>
local filter = ClearFilter()
filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
filter:Add(FE_CONTROLLER, OP_IS, EffectController() )
if EffectSource():IsToken() == false then
EffectController():ChooseItem( "CARD_QUERY_CHOOSE_A_CARD_TO_ENCODE_ONTO", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local cipherDC = EffectDC():Get_Targets(1)
if cipherDC ~= nil then
local chosenCard = cipherDC:Get_CardPtr(0)
if chosenCard ~= nil then
local effectSource = EffectSource()
if (effectSource ~= nil) then
effectSource:Exile()
effectSource:NailOnto(chosenCard)
LinkedDC():Set_CardPtr(0, effectSource)
end
end
end
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="6">
local chosenCardDC = EffectDC():Get_Targets(1)
if chosenCardDC ~= nil then
local chosencard = chosenCardDC:Get_CardPtr(0)
if chosencard ~= nil then
local characteristics = chosencard:GetCurrentCharacteristics()
characteristics:GrantAbility(1)
chosencard:AddScore(150)
end
end
</CONTINUOUS_ACTION>
<DURATION>
if LinkedDC():Get_CardPtr(0) ~= nil then
local chosenCardDC = EffectDC():Get_Targets(1)
if chosenCardDC ~= nil and chosenCardDC:Get_CardPtr(0) ~= nil then
return false
end
end
return true
</DURATION>
Whenever this creature deals combat damage to a player, you may copy
Mental Vapors and cast the copy without paying its mana cost.
- Code: Select all
<TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" simple_qualifier="self" damage_type="combat" />
<RESOLUTION_TIME_ACTION>
local encodedSpell = LinkedDC():Get_CardPtr(0)
local effectController = EffectController()
if encodedSpell ~= nil then
local copy = effectController:CopySpell( encodedSpell )
if EffectController():CanCastSpellForFree(copy) then
EffectController():CastSpellForFree(copy)
end
end
</RESOLUTION_TIME_ACTION>
<MAY tag="CARD_QUERY_WOULD_YOU_LIKE_TO_CAST_MENTAL_VAPORS" always_prompt="1" />
Melek, Izzet Paragon

(DGM) - Complete
Creature
Play with the top card of your library revealed.
- Code: Select all
<CONTINUOUS_ACTION layer="8">
local player = EffectController()
if player ~= nil then
local top = player:Library_GetTop()
if top ~= nil then
player:GetCurrentCharacteristics():Bool_Set(PLAYER_CHARACTERISTIC_PLAY_WITH_TOP_CARD_OF_LIBRARY_REVEALED, 1)
end
end
</CONTINUOUS_ACTION>
You may cast the top card of your library if it's an instant or sorcery card.
- Code: Select all
<CONTINUOUS_ACTION layer="8">
local player = EffectController()
if player ~= nil then
local top = player:Library_GetTop()
if top ~= nil then
if top:GetCardType():Test(CARD_TYPE_INSTANT) or top:GetCardType():Test(CARD_TYPE_SORCERY) then
player:GetCurrentCharacteristics():Bool_Set(PLAYER_CHARACTERISTIC_CAN_PLAY_TOP_CARD_OF_LIBRARY, 1)
end
end
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
Whenever you cast an instant or sorcery spell from your library, copy it. You may choose new targets for the copy.
- Code: Select all
<TRIGGER value="SPELL_PLAYED" simple_qualifier="controller">
local tobj = TriggerObject()
return tobj ~= nil and tobj:GetErstwhileZone() == ZONE_LIBRARY and
( tobj:GetCardType():Test(CARD_TYPE_INSTANT) or tobj:GetCardType():Test(CARD_TYPE_SORCERY) )
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local tobj = TriggerObjectLKI()
if tobj ~= nil then
local copy = EffectController():CopySpell(tobj)
EffectController():ChooseNewTargets(copy)
end
</RESOLUTION_TIME_ACTION>
Theros BlockMaster of Waves

(THS) - Complete
Creature
Protection from red.
- Code: Select all
<CONTINUOUS_ACTION layer="0">
if EffectSource() ~= nil then
local filter = ClearFilter()
filter:Add( FE_COLOUR, OP_IS, COLOUR_RED )
EffectSource():Protection()
end
</CONTINUOUS_ACTION>
Elemental creatures you control get +1/+1.
- Code: Select all
<FILTER>
local filter = ClearFilter()
filter:Add( FE_CARD_INSTANCE, OP_NOT, EffectSource() )
filter:Add( FE_SUBTYPE, OP_IS, CREATURE_TYPE_ELEMENTAL)
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, EffectController())
</FILTER>
<CONTINUOUS_ACTION layer="7C" filter_id="0">
if FilteredCard() ~= nil then
local characteristics = FilteredCard():GetCurrentCharacteristics()
characteristics:Power_Add( 1 )
characteristics:Toughness_Add( 1 )
end
</CONTINUOUS_ACTION>
When
Master of Waves enters the battlefield, put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue.
- Code: Select all
[spoiler=] <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
<RESOLUTION_TIME_ACTION>
local filter = ClearFilter()
filter:Add( FE_IS_PERMANENT, true )
filter:Add( FE_CONTROLLER, OP_IS, EffectController())
local total = filter:ChromaCount(COLOUR_BLUE)
MTG():PutTokensOntoBattlefield( "TOKEN_ELEMENTAL_1_0_U_247058", total, EffectController() )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>[/spoiler]
Token Registration
- Code: Select all
<TOKEN_REGISTRATION reservation="1" type="TOKEN_ELEMENTAL_1_0_U_247058" />
And that would be their entries from my limited perspective. But everything can be altered according to what's concise and prudent. I'm sure there are better ways to implement the structure of these examples but this is my initial rough draft. Of course I believe the full card text should be displayed as well but I wanted to focus mainly on codes for now. Also, the first two abilities on
Master of Waves (and a lot of other cards) are interchangeable as far as switching out colors and / or types so this wouldn't necessarily be required for every single card with a similar ability but it would keep everything 'whole' if said abilities are listed with their respective cards also.
All examples given are from Magic 2014 XMLs. This approach is similar to the opening post of codes Master Necro started listing in the Formal Request Thread but greatly expanded to include the card fully dissected. Such an idea had been floating around in my mind since Magic 2013 but was never implemented publicly yet I did start the project offline but abandoned it because it became too tedious to create alone. I'll edit and update my thoughts on this again tomorrow but this is the core of what I've imagined. Collectively, I think this wiki-like database may be feasible. I know it will be challenging and yet if someone is brave enough and willing to raise the banner I'm willing to follow.