What happens if my opponent doesn’t have enough cards in their deck to scrap?
In that case, your opponent scraps all the cards in their deck. Then, setting those cards aside, they shuffle all the other cards in their scrap pile into their deck. Then they scrap enough cards from their reformed deck to scrap the total number of cards they were supposed to. In most cases, however many cards they were supposed to scrap will be the number of cards in their scrap pile after Megatron’s ability is finished. Sorry, after Lord Megatron’s ability is finished.
Reshuffling your deck is when you shuffle your scrap pile into your deck because your deck is empty. If you shuffle your deck for another reason, that’s not “reshuffling your deck.” That’s just shuffling your deck.
Although it’s unlikely, let’s say my opponent’s deck runs out of cards, but there are no cards in their scrap pile. What happens?
If there are no cards in their scrap pile, they can’t reshuffle their deck, so Megatron . . . sorry, Lord Megatron’s ability won’t trigger.
is in Bot mode and attacks Lord Megatron in Bot mode. During Cosmos’ attack against Lord Megatron, I have to reshuffle. Does the reshuffle trigger both Cosmos and Lord Megatron's abilities at the same time? Or does Cosmos KO Lord Megatron first?
Cosmos would KO Lord Megatron first. Megatron’s ability will still happen afterwards if the game has not ended.
I attack my opponent's Lord Megatron in bot mode with a character, but I only have one card left in my deck. After reshuffling, I put the damage on the attacking character, KOing it. Do I finish flipping my battle cards for the attack? Does my opponent flip battle cards for their defense?
Yes, you do; and no, they don't. First, while Lord Megatron's bot mode trigger can happen during attack flips, you don't actually resolve it until you have finished flipping for your attack. So you'll flip your last card, reshuffle (triggering Megatron's ability), then complete your attack flips (including any bold or other effects). Assuming you have no triggers yourself dependent on battle flips, Lord Megatron's trigger then resolves, dealing damage equal to his attack to your choice of one of your characters. If this KOs the attacking character, your attack immediately ends. The defending player won't flip cards for defense, and attack damage won't happen