Fix bugs around AI opponents.

This commit is contained in:
Greyson Parrelli
2026-07-24 12:52:10 -04:00
parent add2218978
commit e25a85e394
4 changed files with 95 additions and 3 deletions
+6 -3
View File
@@ -1290,11 +1290,14 @@ func (g *Game) runBattle() *BattleResult {
}
}
// A single side still holding a pet in play wins; anything else
// (everyone out, or a stalemate with pets on both sides) is a draw.
// A single side that can still field a pet wins; anything else (everyone
// out, or a stalemate with pets on both sides) is a draw. We test canField,
// not unit, because the loop can break the instant one side runs out while
// the other's current pet has just fainted — that side still has pets left
// in its stack (it simply wasn't refilled) and is the rightful winner.
winner := -1
for seat, s := range sides {
if s.unit != nil {
if s.canField() {
if winner >= 0 {
winner = -1 // stalemate / >2-player safety
break