Well, looking at the code, I realized that spells already break battle so instead I coded up the few spells that don’t break battle. The screenshot shows what happens when a player has no more cards in play. Attacking this wins the game. At the moment, it doesn’t do anything.
What’s next: making the final target button work, then test a full game.