magarena/grammar/mtg.peg

1231 lines
22 KiB
Plaintext
Raw Normal View History

2012-11-03 18:33:50 -07:00
Rule
2012-12-05 04:38:38 -08:00
= (AbilityWord " — ")? Ability EOR
2012-11-03 18:33:50 -07:00
;
Ability
2012-12-05 04:38:38 -08:00
= SpellEffect
/ KeywordAbility
/ ActivatedAbility
/ TriggeredAbility
/ AdditionalCost
;
2012-10-28 00:30:18 -07:00
SpellEffect
2012-11-03 06:31:42 -07:00
= Effect EOS (SPACE Effect EOS)*
;
Effect
= SingleEffect (SEP SingleEffect)*
;
SingleEffect
= (Duration SEP)? (Optional SPACE)? (SelectPlayer SPACE)? (Optional SPACE)? Action (SPACE Duration)? (SPACE IfCondition)?
2012-10-29 00:33:21 -07:00
;
Optional
= "you may have"
/ "you may"
2012-11-02 19:52:44 -07:00
/ "if you don't,"
2012-11-03 19:49:47 -07:00
/ "if you can't,"
2012-11-02 22:35:21 -07:00
/ "if you do,"
/ "may"
;
2012-11-03 18:33:50 -07:00
AbilityWord
= "metalcraft"
2012-12-05 04:34:29 -08:00
/ "landfall"
2012-12-05 04:38:38 -08:00
/ "threshold"
2012-12-06 01:28:54 -08:00
/ "hellbent"
2012-12-06 01:42:48 -08:00
/ "morbid"
2012-11-03 18:33:50 -07:00
;
2012-10-28 22:36:37 -07:00
KeywordAbility
= Keyword
/ Enchant
;
ActivatedAbility
2012-12-05 04:38:38 -08:00
= ActivationCosts EOC SpellEffect (SPACE AbilityRestriction EOS)?
2012-10-28 22:36:37 -07:00
;
2012-11-03 06:11:57 -07:00
ActivationCosts
2012-12-03 22:36:47 -08:00
= Action (SEP Action)*
2012-11-03 06:11:57 -07:00
;
2012-10-28 22:36:37 -07:00
TriggeredAbility
2012-12-06 01:42:48 -08:00
= Trigger (SEP IfCondition)? SEP SpellEffect
2012-10-28 22:36:37 -07:00
;
AdditionalCost
= "as an additional cost to cast @, " Effect EOS
;
2012-10-28 22:36:37 -07:00
Trigger
= EntersBattlefieldTrigger
/ LeavesBattlefieldTrigger
2012-10-29 00:59:19 -07:00
/ EntersGraveyardTrigger
2012-10-28 22:43:35 -07:00
/ BeginningUpkeepTrigger
2012-10-29 01:39:28 -07:00
/ BeginningEndStepTrigger
2012-10-28 22:44:37 -07:00
/ DiesTrigger
2012-10-28 23:10:15 -07:00
/ DealsDamageTrigger
2012-10-29 00:26:09 -07:00
/ CastTrigger
2012-10-29 01:37:29 -07:00
/ BecomesTargetTrigger
2012-11-02 20:16:04 -07:00
/ BlocksTrigger
/ AttacksTrigger
/ BlockedTrigger
2012-10-28 22:36:37 -07:00
;
Action
= DestroyNoRegenAction
/ DestroyAction
/ ExileAction
/ CounterAction
2012-10-28 00:30:18 -07:00
/ DamageAction
/ DrawAction
/ DiscardAction
2012-10-28 00:30:18 -07:00
/ TapAction
2012-10-28 03:49:34 -07:00
/ PreventAction
/ RegenerateAction
/ PumpAction
/ GainAction
/ BounceAction
/ AddManaAction
/ ReturnAction
/ SacrificeAction
/ ChangeLifeAction
/ ChangeCounterAction
/ PutTokenAction
2012-12-05 06:13:11 -08:00
/ PutCardAction
2012-10-28 23:14:07 -07:00
/ ControlAction
2012-10-29 01:03:09 -07:00
/ ShuffleAction
2012-10-29 01:30:12 -07:00
/ DoesntUntapAction
2012-11-02 19:52:44 -07:00
/ EntersTapped
/ EntersWithCounter
/ PayManaAction
2012-11-03 06:14:50 -07:00
/ MillAction
2012-11-03 18:46:59 -07:00
/ PoisonAction
2012-11-03 19:59:41 -07:00
/ SetPTAction
2012-11-03 23:55:16 -07:00
/ ChangeStateAction
/ AnimateAction
2012-11-04 03:52:59 -08:00
/ AnimateActionReminder
2012-11-07 06:48:13 -08:00
/ ChangeLoyaltyAction
2012-12-15 20:20:38 -08:00
/ KickerAction
2014-02-08 04:25:20 -08:00
/ ScryAction
2012-10-28 00:30:18 -07:00
;
Keyword
2012-10-28 22:36:37 -07:00
= "flash"
/ "flying"
/ "haste"
/ "defender"
/ "vigilance"
/ "reach"
2012-10-29 00:55:19 -07:00
/ "battle cry"
2012-10-28 22:36:37 -07:00
/ "trample"
/ "first strike"
/ "double strike"
/ "infect"
/ "wither"
/ "fear"
/ "shadow"
/ "storm"
/ "swampwalk"
2012-10-29 07:29:53 -07:00
/ "plainswalk"
2012-10-28 22:36:37 -07:00
/ "forestwalk"
/ "islandwalk"
/ "mountainwalk"
/ "changeling"
/ "deathtouch"
/ "lifelink"
/ "exalted"
/ "shroud"
/ "persist"
/ "protection from all colors"
2012-11-04 00:25:21 -07:00
/ "protection from " Color
/ "protection from " Tribal
2012-10-28 22:36:37 -07:00
/ "protection from artifacts"
/ "protection from creatures"
/ "protection from everything"
/ "hexproof"
/ "soulbond"
/ "undying"
/ "flanking"
/ "intimidate"
/ "living weapon"
/ "totem armor"
/ "affinity for artifacts"
2012-10-28 22:36:37 -07:00
/ "bushido" SPACE Number
2012-10-29 07:16:52 -07:00
/ "rampage" SPACE Number
2012-10-28 22:36:37 -07:00
/ "soulshift" SPACE Number
/ "fading" SPACE Number
/ "devour" SPACE Number
/ "modular" SPACE Number
/ "vanishing" SPACE Number
/ "bloodthirst" SPACE Number
/ "annihilator" SPACE Number
2012-10-28 22:36:37 -07:00
/ "buyback" SPACE ManaCost
2012-11-03 19:52:50 -07:00
/ "echo" SPACE ManaCost
2012-10-28 22:36:37 -07:00
/ "kicker" SPACE ManaCost
2012-11-03 06:56:30 -07:00
/ "multikicker" SPACE ManaCost
2012-10-28 22:36:37 -07:00
/ "equip" SPACE ManaCost
/ "cumulative upkeep" SPACE ManaCost
2012-11-02 21:10:01 -07:00
/ "replicate" SPACE ManaCost
2012-11-03 07:18:12 -07:00
/ "miracle" SPACE ManaCost
2012-11-02 21:37:01 -07:00
/ "level up" SPACE ManaCost
2012-12-06 01:23:59 -08:00
/ "level" SPACE Number "-" Number
/ "level" SPACE Number "+"
/ "champion" SPACE "a" "n"? SPACE SelectCreature
2013-02-12 20:30:51 -08:00
/ "cycling" SPACE ManaCost
2013-02-14 01:44:20 -08:00
/ "reinforce" SPACE Number "—" ManaCost
2013-05-17 19:25:36 -07:00
/ "extort"
/ "evolve"
/ "unleash"
/ "evoke" SPACE ManaCost
/ "indestructible"
2014-02-08 04:25:20 -08:00
/ "cipher"
/ "cascade"
2012-10-28 00:30:18 -07:00
;
2012-10-28 02:35:18 -07:00
ColorlessCost
= "{" Number "}"
2012-10-28 22:36:37 -07:00
/ "{x}"
2012-10-28 02:35:18 -07:00
;
2012-10-29 07:15:19 -07:00
SingleColor
2012-10-28 22:36:37 -07:00
= "{b}"
/ "{u}"
/ "{g}"
/ "{r}"
/ "{w}"
2012-10-28 02:35:18 -07:00
;
HybridSingleCost
2012-10-28 22:36:37 -07:00
= "{g/u}"
/ "{g/w}"
/ "{r/g}"
/ "{r/w}"
/ "{u/r}"
/ "{u/b}"
/ "{b/g}"
2012-11-03 19:51:16 -07:00
/ "{b/r}"
2012-10-28 22:36:37 -07:00
/ "{w/b}"
;
2012-10-28 02:35:18 -07:00
ManaCost
= ColorlessCost+ HybridSingleCost* SingleColor*
/ HybridSingleCost+ SingleColor*
2012-10-29 07:15:19 -07:00
/ SingleColor+
2012-10-28 00:30:18 -07:00
;
2012-10-29 01:37:29 -07:00
BecomesTargetTrigger
= "when @ becomes the target of a spell or ability"
;
2012-11-02 20:16:04 -07:00
BlocksTrigger
= "whenever @ blocks"
;
BlockedTrigger
= "whenever @ becomes blocked"
;
2012-10-29 00:26:09 -07:00
CastTrigger
2012-12-05 04:45:16 -08:00
= "whenever " SelectPlayer SPACE Cast SPACE SelectSpell
/ "when " SelectPlayer SPACE Cast SPACE SelectSpell
;
Cast
= "cast" "s"?
2012-10-29 00:26:09 -07:00
;
LeavesBattlefieldTrigger
= "when @ leaves the battlefield"
;
2012-10-29 00:59:19 -07:00
EntersGraveyardTrigger
2012-10-29 01:03:09 -07:00
= "when @ is put into a graveyard from the battlefield"
/ "when @ is put into a graveyard from anywhere"
2012-10-29 00:59:19 -07:00
;
2012-10-28 22:36:37 -07:00
EntersBattlefieldTrigger
= EntersVerb SPACE SelectPermanent SPACE "enters the battlefield" (SPACE "under your control")?
;
EntersVerb
= "whenever"
/ "when"
/ "as"
2012-10-28 22:36:37 -07:00
;
2012-10-29 01:39:28 -07:00
BeginningEndStepTrigger
= "at the beginning of the end step"
/ "at the beginning of each end step"
2012-10-29 01:39:28 -07:00
;
2012-10-28 22:43:35 -07:00
BeginningUpkeepTrigger
= "at the beginning of your upkeep"
/ "at the beginning of each player's upkeep"
2012-10-28 22:43:35 -07:00
;
2012-10-28 22:44:37 -07:00
DiesTrigger
2012-12-07 01:03:52 -08:00
= "when" SPACE SelectCreature SPACE "dies"
/ "whenever" SPACE SelectCreature SPACE "dies"
2012-10-28 22:44:37 -07:00
;
2012-10-28 23:10:15 -07:00
DealsDamageTrigger
= "whenever @ deals" " combat"? " damage" (" to a " DamageReceiver)?
;
DamageReceiver
= "itself"
/ SelectPlayer &(SEP SingleEffect)
/ SelectPlayer (SEP SelectCreature)?
/ SelectCreature &(SEP SingleEffect)
/ SelectCreature (SEP SelectPlayer)?
;
AttacksTrigger
= "whenever @ attacks"
;
2012-11-07 07:02:40 -08:00
AbilityRestriction
= "activate this ability only any time you could cast a sorcery"
2012-12-05 04:38:38 -08:00
/ "activate this ability only if seven or more cards are in your graveyard"
2012-12-06 01:28:54 -08:00
/ "activate this ability only if you have no cards in hand"
2012-11-07 07:02:40 -08:00
;
2012-12-06 01:42:48 -08:00
IfCondition
= "if a creature died this turn"
/ "if it was kicked"
2012-12-06 01:42:48 -08:00
;
2012-12-15 20:20:38 -08:00
KickerAction
= "if it was kicked, " Effect (" instead")?
;
2014-02-08 04:25:20 -08:00
ScryAction
= "scry " Number
;
AnimateAction
2012-12-14 19:54:48 -08:00
= SelectPermanent SPACE AnimateVerb SPACE CreatureSpec (SPACE AnimateActionReminder)?
;
AnimateVerb
= "becomes a"
/ "is a"
2012-11-04 03:52:59 -08:00
;
AnimateActionReminder
2012-12-15 04:49:05 -08:00
= "it's still " SelectPermanent
/ "that's still " SelectPermanent
;
2012-11-07 06:48:13 -08:00
ChangeLoyaltyAction
= SignedNumber
2012-12-04 01:43:04 -08:00
/ "0"
2012-11-07 06:48:13 -08:00
;
2012-11-03 23:55:16 -07:00
ChangeStateAction
= (SelectPermanent SPACE)? PermanentState
;
PermanentState
= "can't attack or block"
/ "can't attack"
/ "can't block"
/ "can't be blocked"
/ "attacks each turn if able"
/ "can't be countered"
/ "are " ColorSpec
/ "are " Tribal " in addition to their other creature types"
2012-11-03 23:55:16 -07:00
;
2012-11-03 19:59:41 -07:00
SetPTAction
= "@'s power and toughness are each equal to the number of " SelectObject (" plus the number of " SelectObject)?
2012-11-04 00:29:22 -07:00
/ SelectPermanent " are " Number "/" Number
2012-11-03 19:59:02 -07:00
;
SacrificeAction
= "sacrifice" "s"? SPACE SelectPermanent (SPACE "unless you" SPACE Action)?
;
2012-11-03 18:46:59 -07:00
PoisonAction
2012-12-04 01:19:58 -08:00
= "gets" SPACE Count SPACE "poison counter" "s"?
2012-11-03 18:46:59 -07:00
;
2012-11-03 06:14:50 -07:00
MillAction
2012-12-04 01:21:52 -08:00
= "put" "s"? " the top " (Count SPACE)? Card " of his or her library into his or her graveyard"
2012-11-03 06:14:50 -07:00
;
2012-10-29 01:30:12 -07:00
DoesntUntapAction
= SelectPermanent " doesn't untap during its controller's untap step"
/ SelectPermanent " doesn't untap during its controller's next untap step"
/ SelectPermanent " doesn't untap during your untap step"
2012-10-29 01:30:12 -07:00
;
2012-10-29 01:03:09 -07:00
ShuffleAction
= "shuffle it into its owner's library"
/ "shuffle your library"
;
PutTokenAction
2012-12-04 01:32:05 -08:00
= "put " Count SPACE CreatureTokenSpec " onto the battlefield"
2012-11-03 06:57:42 -07:00
/ "put a token that's a copy of " SelectPermanent " onto the battlefield"
;
2012-11-04 03:47:06 -08:00
CreatureTokenSpec
= PowerToughness SPACE ColorSpec (SPACE CreatureType)* " artifact"? " creature token" "s"? (SPACE WithAbilitySpec)?
;
WithAbilitySpec
= "with " Keyword SEP Keyword
/ "with " Keyword
2012-11-04 03:47:06 -08:00
;
CreatureSpec
= ("legendary" SPACE)? PowerToughness (SPACE ColorSpec)? (SPACE CreatureType)* " artifact"? " creature" (SPACE WithAbilitySpec)?
;
2012-10-28 23:14:07 -07:00
ControlAction
= "control" "s"? SPACE SelectPermanent
2012-11-03 04:40:35 -07:00
/ "gain control of " SelectPermanent
2012-10-28 23:14:07 -07:00
;
ChangeCounterAction
= CounterVerb SPACE Count SPACE CounterType SPACE Counter " from " SelectPermanent
/ CounterVerb SPACE Count SPACE CounterType SPACE Counter " on " SelectPermanent
;
CounterVerb
= "remove"
/ "put"
;
Counter
= "counter" "s"?
;
PayManaAction
= "pay" "s"? SPACE ManaCost
2012-11-03 06:11:57 -07:00
/ ManaCost
;
ChangeLifeAction
= ChangeLifeVerb SPACE Number SPACE "life"
;
ChangeLifeVerb
= "lose" "s"?
/ "gain" "s"?
/ "pay" "s"?
2012-10-28 06:41:17 -07:00
;
SelectPlayer
= Player &(SEP SingleEffect)
/ Player (SEP Player)*
;
Player
2012-10-28 22:36:37 -07:00
= "target player"
/ "target opponent"
2012-10-28 22:51:17 -07:00
/ "that player"
2012-10-29 01:44:02 -07:00
/ "each player"
2012-11-03 03:51:17 -07:00
/ "each opponent"
2012-11-07 06:52:31 -08:00
/ "your opponents"
2012-11-03 06:23:35 -07:00
/ "an opponent"
2012-10-28 22:36:37 -07:00
/ "you"
2012-11-03 06:23:35 -07:00
/ "he or she"
/ "its controller"
/ "that " SelectPermanent "'s controller"
2012-11-03 19:43:48 -07:00
/ "its owner"
2012-11-02 22:23:48 -07:00
/ "player"
2012-12-05 04:45:16 -08:00
/ "a player"
2012-10-28 05:50:47 -07:00
;
2012-12-05 06:13:11 -08:00
PutCardAction
= "put " SelectCard " onto the battlefield under your control"
/ "put " SelectCard " onto the battlefield"
2012-12-05 06:13:11 -08:00
;
ReturnAction
= BounceVerb SPACE SelectCard SPACE BounceLocation
;
2012-10-28 02:27:04 -07:00
BounceAction
= BounceVerb SPACE SelectPermanent SPACE BounceLocation
;
BounceLocation
= "to its owner's hand"
/ "to their owners' hands"
/ "to your hand"
/ "to the battlefield under its owner's control"
/ "to the battlefield"
/ "on top of its owner's library"
/ "on top of your library"
/ "on the bottom of its owner's library"
;
BounceVerb
= "return" "s"?
/ "put" "s"?
2012-10-28 02:27:04 -07:00
;
2012-10-28 03:49:34 -07:00
PreventAction
= "prevent the next " Number SPACE Damage SPACE "that would be dealt" (SPACE DamageRestriction)?
/ "prevent all " Damage SPACE "that would be dealt" (SPACE DamageRestriction)?
2012-11-03 07:37:33 -07:00
/ "if damage would be dealt to " DamageReceiver ", prevent that damage"
2012-11-03 07:24:08 -07:00
;
DamageRestriction
= DamageVerb SPACE DamageReceiver (SPACE "this turn by" SPACE DamageReceiver)?
;
DamageVerb
= "to and dealt by"
/ "to"
/ "by"
;
2012-11-03 07:24:08 -07:00
Damage
= "damage"
/ "combat damage"
2012-10-28 03:49:34 -07:00
;
2012-10-28 00:30:18 -07:00
TapAction
= TapVerb SPACE SelectPermanent
/ "{t}"
2012-11-03 06:11:57 -07:00
/ "{q}"
;
TapVerb
= "tap or untap"
/ "tap"
/ "untap"
2012-10-28 00:30:18 -07:00
;
RegenerateAction
2012-11-02 21:07:22 -07:00
= "regenerate" SPACE SelectPermanent
2012-10-28 00:30:18 -07:00
;
DamageAction
2012-12-06 01:32:40 -08:00
= (SelectPermanent SPACE)? (Deal SPACE)? Number " damage to " DamageReceiver
/ SelectPermanent SPACE Deal " damage equal to its power to " DamageReceiver
/ SelectPermanent SPACE Deal " damage equal to the number of " CounterType " counters on it to " DamageReceiver
/ SelectPermanent SPACE Deal " damage to " DamageReceiver " equal to the number of " SelectPermanent
;
Deal
= "deal" "s"?
2012-10-28 00:30:18 -07:00
;
EntersTapped
2012-11-02 19:52:44 -07:00
= "@ enters the battlefield tapped"
2012-10-28 00:30:18 -07:00
;
EntersWithCounter
2012-12-04 01:31:22 -08:00
= "@ enters the battlefield with" SPACE Count SPACE CounterType SPACE Counter " on it"
2012-10-28 06:02:31 -07:00
;
CounterType
2012-11-04 02:54:39 -08:00
= "-0/-1"
/ "+0/+1"
/ "-0/-2"
/ "+0/+2"
/ "-1/-0"
/ "+1/+0"
2012-11-04 02:54:39 -08:00
/ "-1/-1"
/ "+1/+1"
/ "+1/+2"
/ "-2/-2"
/ "+2/+2"
2012-11-04 02:38:22 -08:00
/ "age"
/ "aim"
/ "arrow"
/ "arrowhead"
/ "awakening"
/ "blaze"
/ "blood"
/ "bounty"
/ "bribery"
/ "carrion"
2012-10-28 06:02:31 -07:00
/ "charge"
2012-11-04 02:38:22 -08:00
/ "corpse"
/ "credit"
/ "cube"
/ "currency"
/ "death"
/ "delay"
2012-10-28 07:00:15 -07:00
/ "depletion"
2012-11-04 02:38:22 -08:00
/ "despair"
/ "devotion"
/ "divinity"
/ "doom"
/ "dream"
/ "echo"
/ "elixir"
/ "energy"
/ "eon"
/ "fade"
/ "fate"
/ "feather"
/ "filibuster"
/ "flame"
/ "flood"
/ "fungus"
/ "fuse"
/ "glyph"
/ "gold"
/ "growth"
/ "hatchling"
/ "healing"
/ "hoofprint"
/ "hourglass"
/ "hunger"
/ "husk"
/ "ice"
/ "infection"
/ "intervention"
/ "javelin"
2012-10-29 00:26:09 -07:00
/ "ki"
2012-11-04 02:38:22 -08:00
/ "level"
/ "lore"
/ "luck"
/ "magnet"
/ "mannequin"
/ "matrix"
/ "mine"
/ "mining"
/ "mire"
/ "music"
/ "net"
/ "omen"
/ "ore"
/ "page"
/ "pain"
/ "paralyzation"
/ "petal"
/ "petrification"
/ "phylactery"
/ "pin"
/ "plague"
/ "poison"
/ "polyp"
/ "pressure"
/ "pupa"
/ "quest"
2012-11-04 02:38:22 -08:00
/ "rust"
/ "scream"
/ "scroll"
/ "shell"
/ "shield"
/ "shred"
/ "sleep"
/ "sleight"
/ "slime"
/ "soot"
/ "spore"
/ "storage"
/ "strife"
/ "study"
2012-11-03 19:47:53 -07:00
/ "tide"
/ "time"
2012-11-04 02:38:22 -08:00
/ "training"
/ "trap"
/ "treasure"
/ "velocity"
/ "verse"
/ "vitality"
/ "wage"
/ "winch"
/ "wind"
/ "wish"
;
Count
= "an"
/ "a"
2012-12-03 21:36:36 -08:00
/ "one"
/ "two"
/ "three"
2012-10-28 06:20:36 -07:00
/ "four"
/ "five"
/ "six"
/ "seven"
/ "eight"
/ "nine"
/ "ten"
2012-10-28 22:36:37 -07:00
/ "x"
;
2012-10-28 00:30:18 -07:00
Enchant
2012-10-28 22:36:37 -07:00
= "enchant" SPACE RestrictedPermanent
/ "enchant player"
2012-10-28 00:30:18 -07:00
;
2012-11-03 03:44:13 -07:00
Duration
= "until end of turn"
2012-11-03 06:23:35 -07:00
/ "for as long as " SelectPlayer " control @"
2012-11-03 18:33:50 -07:00
/ "as long as you control three or more artifacts"
/ "as long as seven or more cards are in your graveyard"
2012-12-06 01:30:01 -08:00
/ "as long as you have no cards in hand"
2012-11-03 07:28:27 -07:00
/ "this turn"
/ "at the beginning of the next turn's upkeep"
/ "at the beginning of the next end step"
2012-12-06 01:56:17 -08:00
/ "at the beginning of your next end step"
2012-11-03 03:44:13 -07:00
;
GainAction
= (SelectPermanent SPACE)? GainVerb SPACE Keyword (SEP Keyword)*
2012-12-03 21:51:12 -08:00
;
GainVerb
2012-12-03 21:51:12 -08:00
= "has"
/ "have"
/ "gain" "s"?
/ "lose" "s"?
2012-10-28 03:34:39 -07:00
;
PumpAction
2013-09-08 20:37:21 -07:00
= SelectCreature SPACE "get" "s"? SPACE PowerToughnessMod
2012-10-28 00:30:18 -07:00
;
AddManaAction
= "add " ManaSource
;
ManaSource
= "{1}"
2012-12-03 22:36:47 -08:00
/ SingleColor (SEP SingleColor)*
/ "one mana of any color"
2012-10-28 00:30:18 -07:00
;
DrawAction
2012-12-03 21:57:25 -08:00
= Draw SPACE Count SPACE Card
;
Draw
= "draw" "s"?
2012-10-28 05:41:27 -07:00
;
DiscardAction
= Discard SPACE SelectCard " at random"?
/ Discard SPACE Count SPACE RestrictedCard " at random"
;
Discard
= "discard" "s"?
;
DestroyNoRegenAction
2012-12-03 22:00:13 -08:00
= "destroy" SPACE SelectPermanent EOS SPACE NoRegen
;
DestroyAction
2012-12-03 22:00:13 -08:00
= "destroy" SPACE SelectPermanent
;
ExileAction
2012-10-28 22:36:37 -07:00
= "exile " SelectPermanent
2012-12-04 01:40:54 -08:00
/ "exile " SelectCard
;
CounterAction
= "counter " SelectSpell (" unless " SingleEffect)?
;
SelectOp
= "target"
2012-12-05 06:28:08 -08:00
/ "another target"
/ "all"
2012-10-28 06:56:23 -07:00
/ "an"
/ "a"
2012-10-29 00:46:13 -07:00
/ "each"
2012-10-28 23:04:28 -07:00
/ "the"
2012-10-29 02:29:40 -07:00
/ "that"
2012-11-07 06:52:31 -08:00
/ "those"
;
SelectObject
= SelectCard
/ SelectPermanent
;
2012-10-28 06:14:02 -07:00
SelectCard
= "@" (SPACE CardRestriction)? (SEP RestrictedCard)*
/ "it"(SEP RestrictedCard)*
2013-05-13 23:13:00 -07:00
/ (SelectOp SPACE)? RestrictedCard (SEP RestrictedCard)*
2012-10-28 06:16:51 -07:00
;
2012-10-28 06:52:29 -07:00
SelectCreature
= "@" (SEP RestrictedCreature)*
/ "it" (SEP RestrictedCreature)*
/ (SelectOp SPACE)? RestrictedCreature (SEP RestrictedCreature)*
2012-10-28 06:52:29 -07:00
;
SelectPermanent
= "@" (SEP RestrictedPermanent)*
/ "it" (SEP RestrictedPermanent)*
/ (SelectOp SPACE)? RestrictedPermanent (SEP RestrictedPermanent)*
2012-10-28 06:16:51 -07:00
;
2012-10-28 06:14:02 -07:00
SelectSpell
= "@" (SEP RestrictedSpell)*
/ "it" (SEP RestrictedSpell)*
2012-12-07 00:21:23 -08:00
/ (SelectOp SPACE)? RestrictedSpell (SEP RestrictedSpell)*
2012-10-28 06:16:51 -07:00
;
2012-10-28 06:14:02 -07:00
RestrictedPermanent
= (PermanentRestriction SPACE)* Permanent (SPACE PermanentRestriction)*
2012-10-28 06:14:02 -07:00
/ RestrictedCreature
2012-10-28 06:44:01 -07:00
/ RestrictedLand
/ RestrictedArtifact
/ RestrictedEnchantment
/ RestrictedTribal
;
RestrictedArtifact
= (PermanentRestriction SPACE)*+ Artifact (SPACE PermanentRestriction)*
;
RestrictedEnchantment
= (PermanentRestriction SPACE)? Enchantment (SPACE PermanentRestriction)?
;
RestrictedLand
2012-10-28 22:53:17 -07:00
= (LandRestriction SPACE)? Land (SPACE LandRestriction)?
;
RestrictedTribal
= (PermanentRestriction SPACE)? Tribal (SPACE PermanentRestriction)?
;
2012-10-28 06:14:02 -07:00
RestrictedSpell
2012-12-15 04:58:43 -08:00
= (SpellRestriction SPACE)* Spell (SPACE SpellRestriction)*
;
ColorSpec
= Color (SEP Color)*
2012-11-04 00:25:21 -07:00
/ "non" Color
2012-11-04 06:26:09 -08:00
/ "colorless"
;
SpellRestriction
= ColorSpec
2012-10-29 00:26:09 -07:00
/ "multicolored"
2012-10-28 05:34:07 -07:00
/ "noncreature"
/ "during an opponent's turn"
2012-11-03 18:50:23 -07:00
/ "with infect"
2012-11-03 18:53:24 -07:00
/ "with converted mana cost " Number " or less"
/ "with converted mana cost " Number " or greater"
/ "with converted mana cost " Number
/ SpellType (SEP SpellType)*
/ RestrictedPermanent (SEP RestrictedPermanent)*
2012-10-28 05:34:07 -07:00
;
2012-10-28 06:14:02 -07:00
RestrictedCard
= (CardRestriction SPACE)* Card (SPACE CardRestriction)*
;
2012-10-28 05:34:07 -07:00
CardRestriction
= "exiled"
2012-12-04 01:40:54 -08:00
/ "from a graveyard"
/ "from your graveyard"
2013-05-13 23:13:00 -07:00
/ "in all graveyards"
2012-12-05 06:13:11 -08:00
/ "from your hand"
2013-05-17 19:25:36 -07:00
/ "in your hand"
2012-12-05 06:13:11 -08:00
/ "basic land"
/ "land"
/ SpellRestriction
/ RestrictedCreature
2012-10-28 05:34:07 -07:00
;
2012-10-28 06:14:02 -07:00
RestrictedCreature
2012-11-04 00:09:29 -07:00
= (CreatureRestriction SPACE)* Creature (SPACE CreatureRestriction)*
/ (CreatureRestriction SPACE)*+ Tribal (SPACE CreatureRestriction)*
2012-10-28 05:34:07 -07:00
;
2012-11-02 22:32:31 -07:00
PermanentRestriction
= ColorSpec
2012-12-06 19:11:01 -08:00
/ SelectPlayer " control" "s"?
/ SelectPlayer " don't control"
2012-11-02 22:32:31 -07:00
/ "tapped"
/ "untapped"
/ "noncreature"
/ "nonartifact, nonblack"
/ "nonartifact"
2012-12-05 04:42:11 -08:00
/ "nonland"
2012-12-05 20:16:20 -08:00
/ "nontoken"
2012-12-06 19:11:01 -08:00
/ "token" "s"?
2012-10-29 00:11:35 -07:00
/ "artifact"
2012-11-03 19:49:47 -07:00
/ "other than @"
/ "another"
/ "other"
2012-11-04 01:20:28 -08:00
/ "legendary"
/ "enchanted"
2013-05-13 23:13:00 -07:00
/ "on the battlefield"
2012-11-02 22:32:31 -07:00
/ "with converted mana cost " Number " or less"
/ "with converted mana cost " Number " or greater"
/ "with converted mana cost " Number
;
CreatureRestriction
= "with power " Number " or less"
/ "with power " Number " or greater"
/ "with " Keyword
/ "without " Keyword
/ "with a " (CounterType SPACE)? "counter on it"
2012-11-02 22:32:31 -07:00
/ "tapped or blocking"
/ "attacking or blocking"
/ "attacking"
2012-12-05 04:27:05 -08:00
/ "blocking"
/ "blocked"
/ "equipped"
2013-05-17 19:25:36 -07:00
/ "dealt damage by " SelectPermanent " this turn"
2012-11-02 21:42:20 -07:00
/ Tribal
2012-11-02 22:32:31 -07:00
/ PermanentRestriction
/ PowerToughness
;
2012-11-03 06:23:35 -07:00
LandRestriction
= "nonbasic"
/ "basic"
/ PermanentRestriction
;
2012-11-04 00:25:21 -07:00
Color
= "black"
/ "blue"
/ "green"
/ "red"
/ "white"
;
Tribal
2012-11-04 01:09:23 -08:00
= CreatureType "s"?
2012-11-04 01:11:37 -08:00
/ "non-" CreatureType
2012-11-04 01:09:23 -08:00
;
SpellType
= "instant"
/ "sorcery"
/ "arcane"
/ "spirit"
/ "trap"
;
2012-11-04 01:09:23 -08:00
CreatureType
= "advisor"
/ "ally"
/ "angel"
/ "anteater"
/ "antelope"
/ "ape"
/ "archer"
/ "archon"
/ "artificer"
/ "assassin"
/ "assembly-worker"
/ "atog"
/ "aurochs"
/ "avatar"
/ "badger"
/ "barbarian"
/ "basilisk"
/ "bat"
/ "bear"
/ "beast"
/ "beeble"
/ "berserker"
2012-11-02 21:42:20 -07:00
/ "bird"
2012-11-04 01:09:23 -08:00
/ "blinkmoth"
/ "boar"
/ "bringer"
/ "brushwagg"
/ "camarid"
/ "camel"
/ "caribou"
/ "carrier"
/ "cat"
/ "centaur"
/ "cephalid"
/ "chimera"
/ "citizen"
/ "cleric"
/ "cockatrice"
/ "construct"
/ "coward"
/ "crab"
/ "crocodile"
/ "cyclops"
/ "dauthi"
/ "demon"
/ "deserter"
/ "devil"
/ "djinn"
/ "dragon"
/ "drake"
/ "dreadnought"
/ "drone"
/ "druid"
/ "dryad"
/ "dwarf"
/ "efreet"
/ "elder"
/ "eldrazi"
/ "elemental"
/ "elephant"
/ "elf"
/ "elk"
/ "eye"
/ "faerie"
/ "ferret"
/ "fish"
/ "flagbearer"
/ "fox"
/ "frog"
/ "fungus"
/ "gargoyle"
/ "germ"
/ "giant"
/ "gnome"
/ "goat"
2012-11-02 21:09:02 -07:00
/ "goblin"
2012-11-04 01:09:23 -08:00
/ "golem"
/ "gorgon"
/ "graveborn"
/ "gremlin"
/ "griffin"
/ "hag"
/ "harpy"
/ "hellion"
/ "hippo"
/ "hippogriff"
/ "homarid"
/ "homunculus"
/ "horror"
/ "horse"
/ "hound"
/ "human"
/ "hydra"
/ "hyena"
/ "illusion"
/ "imp"
/ "incarnation"
/ "insect"
/ "jellyfish"
/ "juggernaut"
/ "kavu"
/ "kirin"
/ "kithkin"
/ "knight"
/ "kobold"
/ "kor"
/ "kraken"
/ "lammasu"
/ "leech"
/ "leviathan"
/ "lhurgoyf"
/ "licid"
/ "lizard"
/ "manticore"
/ "masticore"
/ "mercenary"
/ "merfolk"
/ "metathran"
/ "minion"
/ "minotaur"
/ "monger"
/ "mongoose"
/ "monk"
/ "moonfolk"
/ "mutant"
/ "myr"
/ "mystic"
/ "nautilus"
/ "nephilim"
/ "nightmare"
/ "nightstalker"
/ "ninja"
/ "noggle"
/ "nomad"
/ "octopus"
/ "ogre"
/ "ooze"
/ "orb"
/ "orc"
/ "orgg"
/ "ouphe"
/ "ox"
/ "oyster"
/ "pegasus"
/ "pentavite"
/ "pest"
/ "phelddagrif"
/ "phoenix"
/ "pincher"
/ "pirate"
/ "plant"
/ "praetor"
/ "prism"
/ "rabbit"
/ "rat"
/ "rebel"
/ "reflection"
/ "rhino"
/ "rigger"
/ "rogue"
/ "salamander"
/ "samurai"
/ "sand"
2012-11-02 21:09:02 -07:00
/ "saproling"
2012-11-04 01:09:23 -08:00
/ "satyr"
/ "scarecrow"
2012-11-04 01:09:23 -08:00
/ "scorpion"
/ "scout"
/ "serf"
/ "serpent"
/ "shade"
/ "shaman"
/ "shapeshifter"
/ "sheep"
/ "siren"
/ "skeleton"
/ "slith"
/ "sliver"
/ "slug"
2012-11-04 00:30:26 -07:00
/ "snake"
/ "soldier"
2012-11-04 01:09:23 -08:00
/ "soltari"
/ "spawn"
/ "specter"
/ "spellshaper"
/ "sphinx"
/ "spider"
/ "spike"
/ "spirit"
/ "splinter"
/ "sponge"
/ "squid"
/ "squirrel"
/ "starfish"
/ "surrakar"
/ "survivor"
/ "tetravite"
/ "thalakos"
/ "thopter"
/ "thrull"
/ "treefolk"
/ "triskelavite"
/ "troll"
/ "turtle"
/ "unicorn"
/ "vampire"
/ "vedalken"
/ "viashino"
/ "volver"
/ "wall"
/ "warrior"
/ "weird"
/ "werewolf"
/ "whale"
/ "wizard"
/ "wolf"
/ "wolverine"
/ "wombat"
/ "worm"
/ "wraith"
/ "wurm"
/ "yeti"
/ "zombie"
/ "zubera"
;
Creature
= "creature" "s"?
;
Artifact
= "artifact" "s"?
2012-10-29 00:13:07 -07:00
/ "equipment" "s"?
;
Land
= "land" "s"?
2012-11-03 20:03:12 -07:00
/ "swamp" "s"?
/ "island" "s"?
/ "forest" "s"?
/ "mountain" "s"?
/ "plains"
;
Enchantment
= "enchantment" "s"?
;
Permanent
= "permanent" "s"?
;
Card
= "card" "s"?
;
Spell
= "spell" "s"?
;
NoRegen
2012-10-28 22:36:37 -07:00
= "it can't be regenerated"
/ "they can't be regenerated"
;
2012-11-04 01:15:05 -08:00
PowerToughness
= Number "/" Number
;
2013-09-08 20:37:21 -07:00
PowerToughnessMod
= SignedNumber "/" SignedNumber
;
SignedNumber
= Sign Number
;
2012-10-28 00:30:18 -07:00
Number
= [0-9]+
2012-10-28 23:10:15 -07:00
/ "that much"
2012-10-29 02:20:20 -07:00
/ "x"
2012-10-28 00:30:18 -07:00
;
Sign
= "+"
2012-10-28 03:32:08 -07:00
/ "-"
;
2012-12-03 22:36:47 -08:00
SEP
= ", or "
/ ", and "
/ ", then "
2012-12-03 22:36:47 -08:00
/ ", "
/ " or "
/ " and "
2012-12-03 22:36:47 -08:00
;
EOC
= ": "
;
SPACE
= " "
;
2012-10-28 02:27:04 -07:00
EOS
= "."
;
2012-10-28 02:27:04 -07:00
EOR
= !_
;