From 06ce5cc91a2a84d0becd02dbd8745345598373be Mon Sep 17 00:00:00 2001 From: KoalaTrapLord <265133236+KoalaTrapLord@users.noreply.github.com> Date: Fri, 27 Mar 2026 10:22:05 -0400 Subject: [PATCH] fix(rules): add nonbasic land guard before creature fallback (fixes #118) (#122) --- src/commander_ai_lab/sim/rules.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/commander_ai_lab/sim/rules.py b/src/commander_ai_lab/sim/rules.py index bcca82c..d94430c 100644 --- a/src/commander_ai_lab/sim/rules.py +++ b/src/commander_ai_lab/sim/rules.py @@ -223,6 +223,21 @@ def enrich_card(card: Card) -> Card: _apply_oracle_flags(card) return card + + # ── Nonbasic land name guard (Issue #118) ────────────────── + # Catch common nonbasic lands BEFORE the creature fallback + _land_kw = re.compile( + r"\b(grove|garden|glade|falls|summit|crag|chapel|retreat|harbor|cemetery|" + r"pool|fountain|shrine|foundry|vents|grave|crypt|tomb|ground|" + r"command tower|path of ancestry|evolving wilds|terramorphic|expanse|" + r"exotic orchard|mana confluence|city of brass|reflecting pool|" + r"fabled passage|prismatic vista)\b", re.IGNORECASE) + if _land_kw.search(name_lower): + card.type_line = "Land" + card.cmc = 0 + _apply_oracle_flags(card) + return card + # Default: treat as creature with deterministic CMC based on # card name hash (fixes #32 — no more random.randint jitter # between games for the same card).