Name emblems and boons instead of showing "Card #N"

Command-zone objects such as boons have small grpIds that aren't cards.
Name them from the log's name id (e.g. "The Ring") or the card that
created them ("Swiftspear's Teachings (boon)"), and preview the source
card on hover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aeth3randClaude Opus 5.5 committed 2026-10-19 09:54:08 -04:00
1 parent f16a67e042
commit d9ef771db8
4 files changed
+62 -10

No files matched your search

+21 -2
View File
@@ -211,8 +211,8 @@ def test_commanders_are_not_emblems():
g = t.game
assert g.commander_status(ME) == [(8000, "command zone")]
assert g.commander_status(OPP) == [(9000, "command zone")]
assert g.emblems(OPP) == {7777: 1}
assert g.emblems(ME) == {}
assert [o["grpId"] for o in g.emblems(OPP)] == [7777]
assert g.emblems(ME) == []
assert sum(t.my_library_remaining().values()) == 3 # the commander isn't part of the library
# Opponent casts their commander from the command zone: it's on the stack, tax goes up.
@@ -247,3 +247,22 @@ def test_known_cards_never_exceed_zone_size():
t.handle(GreMessages([gsm(2, zones=[zone(OPP_HAND, "Hand", [201], OPP)], objects=[
card(400, 7007, OPP_HAND, otype="RevealedCard"), card(401, 7008, OPP_HAND, otype="RevealedCard")])]))
assert sum(t.game.opp_known_in("ZoneType_Hand").values()) == 1
def test_command_zone_objects_are_named_from_log_or_source_card():
from mtga_assistant.carddb import command_object_info
class Cards:
def get(self, grp):
return CardInfo(grp_id=grp, name={97038: "Swiftspear's Teachings", 87496: "The Ring"}.get(grp, f"Card #{grp}"))
def loc(self, loc_id):
return {732510: "The Ring"}.get(loc_id)
boon = {"grpId": 6, "type": "GameObjectType_Boon", "objectSourceGrpId": 97038}
emblem = {"grpId": 2, "type": "GameObjectType_Emblem", "objectSourceGrpId": 87496, "name": 732510}
bare = {"grpId": 3, "type": "GameObjectType_Emblem"}
b, e, x = (command_object_info(Cards(), o) for o in (boon, emblem, bare))
assert (b.name, b.types, b.grp_id) == ("Swiftspear's Teachings (boon)", ("Boon",), 97038) # hover shows the source card
assert (e.name, e.types, e.grp_id) == ("The Ring", ("Emblem",), 87496)
assert x.name == "Emblem" and x.grp_id == 0 # no source card: nothing to preview