Name:Matzalantli, the Great Door
ManaCost:3
Types:Legendary Artifact
A:AB$ Draw | Cost$ T | SubAbility$ DBDiscard | SpellDescription$ Draw a card, then discard a card.
SVar:DBDiscard:DB$ Discard | Mode$ TgtChoose
A:AB$ SetState | Cost$ 4 T | Defined$ Self | Mode$ Transform | CheckSVar$ X | SVarCompare$ GE4 | SpellDescription$ Transform CARDNAME. Activate only if there are four or more permanent types among cards in your graveyard. (Artifact, battle, creature, enchantment, land, and planeswalker are permanent types.)
SVar:X:Count$ValidGraveyard Card.YouOwn$CardTypesPermanent
DeckHas:Ability$Discard
DeckHints:Ability$Graveyard|Mill|Dredge
AlternateMode:DoubleFaced
Oracle:{T}: Draw a card, then discard a card.\n{4}, {T}: Transform Matzalantli, the Great Door. Activate only if there are four or more permanent types among cards in your graveyard. (Artifact, battle, creature, enchantment, land, and planeswalker are permanent types.)

ALTERNATE

Name:The Core
ManaCost:no cost
Types:Legendary Land
A:AB$ Mana | Cost$ T | Produced$ Any | Amount$ X | SpellDescription$ Add X mana of any one color, where X is the number of permanent cards in your graveyard.
SVar:X:Count$ValidGraveyard Permanent.YouOwn
Oracle:(Transforms from Matzalantli.)\nFathomless descent — {T}: Add X mana of any one color, where X is the number of permanent cards in your graveyard.
