I was playing a game with my friend and played Psychic Spiral. He would have put his entire library into his graveyard because of Psychic Spiral, but Ulamog, the Infinite Gyre was placed into his graveyard this way. He says he would shuffle his graveyard into his library because of this before Psychic Spiral's ability finished and then he'd finish placing the assigned number of cards into his graveyard after the shuffle. I say my spells ability would have to finish resolving before his would trigger because it goes on the stack and mine was still mid-resolution. Would he still lose from discarding his library or would he shuffle his graveyard back in and be fine?
Merely having an empty library doesn't cause a player to lose the game; a player loses as a state-based action if he or she "attempted to draw a card from a library with no cards in it since the last time state-based actions were checked" (C.R. 704.5b). In any case, when Ulamog is put in the graveyard, its last ability will trigger, but won't do anything right away (C.R. 603.2); rather, it must be put on the stack (C.R. 603.3, 116.3b, 116.5), and the top spell or ability on the stack will resolve after all players pass in a row (C.R. 116.4).
If you would be required to discard more cards than your library contains, it works the same way, doesn't it? Or am I wrong? Because that's what was gonna happen.
Only if a player tried to draw a card from an empty library can a player lose the game on account of an empty library (C.R. 704.5b). Putting cards from a library into the graveyard is not the same as drawing them (C.R. 120.1; see also C.R. 120.5) (and neither is it the same as discarding them [review C.R. 701.8a]).
If you would be required to discard more cards than your library contains, it works the same way, doesn't it? Or am I wrong? Because that's what was gonna happen.
No. If more cards are to be milled than a library has cards, the entire library gets milled and then nothing. You can't mill more cards so you simply mill as many as there are. Only drawing cards counts as drawing cards, so even a similar action like putting a card from the library into the hand (without the use of the word "draw") will not count as a draw. Therefore a player could prevent losing this way by having Tomorrow, Azami's Familiar on the field.
No. If more cards are to be milled than a library has cards, the entire library gets milled and then nothing. You can't mill more cards so you simply mill as many as there are. Only drawing cards counts as drawing cards, so even a similar action like putting a card from the library into the hand (without the use of the word "draw") will not count as a draw. Therefore a player could prevent losing this way by having Tomorrow, Azami's Familiar on the field.
Former Rules Advisor
"Everything's better with pirates." - Lodge
(The Gamers: Dorkness Rising)
"Any sufficiently analyzed magic is indistinguishable from science."
(Girl Genius - Fairy Tale Theater Break - Cinderella, end of volume 8)