Filters guide (for style.txt, booster packs)

Graphics and Themes you created go here.
Please read the Image Theme Guide, FAQ, & Index before posting in this forum.
Locked
Jeck
Posts: 71
Joined: Mon Aug 17, 2009 11:53 pm
Location: Snow-covered forest

Filters guide (for style.txt, booster packs)

Post by Jeck »

What is a filter?
Filters are special strings that are used to match cards against certain criteria. They look like this: "rarity:land;type:basic;" (which matches only basic lands), or like this: "type:elf;|type:goblin;" (which matches either elves OR goblins).

Where are filters used?
Filters are used to define dynamic styles in a theme's style.txt file. They are also used when creating custom booster packs, using the txt files under your "res/packs" directory.

How are filters structured
So, this is the basic structure of a filter. You have a number of individual criteria, like "rarity:rare;", "type:goblin;", etc. The part before the colon (":") is the kind of condition we're looking for... in this case, a specific rarity and a specific type. The part after the colon is the value we're looking for, "rare" and "goblin".

Criteria can either be strung together, like "rarity:rare;&type:goblin;&color:r;" (which is read as "match cards which are rare AND goblins AND red"), or separated by the OR symbol, "|", like "rarity:rare;|type:goblin;|color:r;" (which is read as "match cards which are rare OR goblins OR red").

If two filters are placed next to each other without an "&" or "|" symbol, we just assume that an "&" symbol exists. This means that you can type "rarity:land;type:basic;" instead of "rarity:land;&type:basic;".

Filter criteria can be grouped together using parenthesis, like so: "(rarity:rare;type:goblin;)|color:r;". This would be read as "Match any card that is either red, or a rare goblin."

Finally, there's one more operator. If you incase a criteria in curly brackets, it means "NOT". For example, "rarity:rare;color:r;{type:goblin;}" means "Match any rare red card except for goblins.".

Filter criteria
Now that you've had an introduction to filters, it's time to list all the possible criteria for use by them.

Color is checked using the "color" condition, which can be abbreviated as "c". By default, this checks for cards which HAVE that color, meaning "color:r" will find cards which are red, but also multicolored cards that contain red. If you're looking for cards which are purely red, check using the "xcolor" or "xc" condition.
The possible color values to check for are:
  • "x" - Colorless
    "r" - Red
    "g" - Green
    "u" - Blue
    "b" - Black
    "w" - White
You can also check to see if a card produces mana of a certain color using the "produces" or "ma" condition.

Rarity is checked using the "rarity" condition, which can be abbreviated as "r".
The possible values to check for are:
  • "t" - Token
    "l" - Land
    "c" - Common
    "u" - Uncommon
    "r" - Rare
    "m" - Mythic rare
    "s" - Special rarity
The first letter of the card is checked using the "alpha" or "a" condition. The possible values are a-z.

Type is checked using the "type" condition, which can be abbreviated as "t". Check the card coding guide for possible values, but keep in mind that this condition checks both for types like "instant", "land", "creature", etc, as well as for subtypes, like "goblin"

Set is checked using the "set" condition, which can be abbreviated as "s". This finds a card in a certain set. Remember to use the set's short directory name, ie "10E", instead of the full name ("10th Edition").

Power and Toughness can be checked using the "power" or "toughness" conditions, which can be abbreviated as "pow" and "tgh" respectively. The value can be any number, though usually power and toughness are somewhere between 1 and 20. Example: "pow:4;" would find a power 4 creature.

Converted Mana Cost can also be checked for, using the "cmc" condition. Again, any number can be used as the value.

Finally, you can search for cards with a specific ability, using the "ability" or "a" condition. The following is a list of abilities you can search for:
  • "trample",
    "forestwalk",
    "islandwalk",
    "mountainwalk",
    "swampwalk",
    "plainswalk",
    "flying",
    "first strike",
    "double strike",
    "fear",
    "flash",
    "haste",
    "lifelink",
    "reach",
    "shroud",
    "vigilance",
    "defender",
    "banding",
    "protection from green",
    "protection from blue",
    "protection from red",
    "protection from black",
    "protection from white",
    "unblockable",
    "wither",
    "persist",
    "retrace",
    "exalted",
    "nofizzle",
    "shadow",
    "reachshadow",
    "foresthome",
    "islandhome",
    "mountainhome",
    "swamphome",
    "plainshome",
    "cloud",
    "cantattack",
    "mustattack",
    "cantblock",
    "doesnotuntap",
    "opponentshroud",
    "indestructible",
    "intimidate",
    "deathtouch",
    "horsemanship",
    "cantregen",
    "oneblocker",
    "infect",
    "poisontoxic",
    "poisontwotoxic",
    "poisonthreetoxic",
    "phantom",//prevents damage and remove 1 +1/+1 counter
    "wilting",//source takes damage in the form of -1/-1 counters.
    "vigor",//instead of taking damage the source gains +1/+1 counters
    "changeling",//this card is every creature type at all times
    "absorb",//timeshifted sliver ability. if damage would be dealt to card, prevent 1 of that damage.
    "treason",
    "unearth",
    "cantlose",
    "cantlifelose",
    "cantmilllose",
    "cantcreaturecast",
    "cantspellcast",
    "onlyonecast",
    "storm",
    "bothcantcast",
    "bothnocreature",
    "oneboth",
    "affinityartifacts",
    "affinityplains",
    "affinityforests",
    "affinityislands",
    "affinitymountains",
    "affinityswamps",
    "affinitygreencreatures",
    "cantwin",
    "nomaxhand",
    "leyline",
    "playershroud",
    "controllershroud",
    "sunburst",
    "flanking",
    "exiledeath",
    "legendarylandwalk",
    "desertlandwalk",
    "snowforestlandwalk",
    "snowplainslandwalk",
    "snowmountainlandwalk",
    "snowislandlandwalk",
    "snowswamplandwalk",
    "snowlandwalk",
    "nonbasiclandwalk",
    "strong", //can't be blocked by creature with less power
    "weak", //can't block creatures with more power
    "phasing"
So that's it. You should now know enough to write filters for your own custom booster packs, or for dynamic themes which react to the content of your deck (check the updated theme guide for details!)
carslove54
Posts: 279
Joined: Thu Mar 18, 2010 8:58 pm

Re: Filters guide (for style.txt, booster packs)

Post by carslove54 »

One question, I can mix style.txt filters for? ie I can put something like this and work? that is, besides the colors out, the other two possibilities with the rarity filter, also work, and there are no conflicts between them?



<case rule="color:g;">Earth</case>
<case rule="color:r;">Fire</case>
<case rule="color:u;">Water</case>
<case rule="color:b;">Dark</case>
<case rule="color:w;">Light</case>
<case rule="color:x;">Stone</case>

<case rule="rarity:r;">Yavimaya</case>
<case rule="rarity:m;">Pirexia</case>
Locked