If you do not have enough cards in your library, the damage is still prevented and all the cards in your library are exiled.

Artwork
Loading artwork…
Bone Mask
Mirage · #295 · EN
Nonfoil—Foil—
Card rules
2,
: The next time a source of your choice would deal damage to you this turn, prevent that damage. Exile cards from the top of your library equal to the damage prevented this way.
"The protection offered comes at a price. How numerous are your kin?" —Purraj of Urborg
Rare · Illustrated by D. Alexander Gregory
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
PreDH Legal
Premodern Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Tlr Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions