Skip to contents

Parses the given mana cost argument and returns Scryfall's interpretation.

Usage

parse_cost(cost)

Arguments

cost

The mana string to parse. For more information, see details.

Value

A data frame with 1 row and the following columns:

  • cost [chr]: The normalized cost, with correctly-ordered and wrapped mana symbols.

  • colors [list]: The colors of the given cost.

  • cmc [dbl]: The converted mana cost. If you submit Un-set mana symbols, this decimal could include fractional parts.

  • colorless [lgl]: Whether the cost is colorless.

  • monocolored [lgl]: Whether if the cost is monocolored.

  • multicolored [lgl]: Whether if the cost is multicolored.

Details

The server understands most community shorthand for mana costs (such as 2WW for {2}{W}{W}). Symbols can also be out of order, lowercase, or have multiple colorless costs (such as 2{g}2 for {4}{G}).

If part of the string could not be understood, the server will return an error describing the problem.

Examples

# \donttest{
# Parse mana costs
parse_cost("2g2")
#> # A tibble: 1 × 6
#>   cost   colors      cmc colorless monocolored multicolored
#>   <chr>  <list>    <dbl> <lgl>     <lgl>       <lgl>       
#> 1 {4}{G} <chr [1]>     5 FALSE     TRUE        FALSE       
# }