-
-
Notifications
You must be signed in to change notification settings - Fork 153
feat(engine,client): show the marker token a face-down permanent was made with (#7532) #7535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
matthewevans
merged 3 commits into
phase-rs:main
from
cuinhellcat:fix/face-down-marker-art
Aug 18, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
client/src/components/card/__tests__/faceDownMarker.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { faceDownMarkerRef } from "../faceDownMarker.ts"; | ||
|
|
||
| describe("faceDownMarkerRef", () => { | ||
| it("maps each rules cause onto the printing paper play uses", () => { | ||
| expect(faceDownMarkerRef(true, "Manifest")?.face_name).toBe("manifest"); | ||
| expect(faceDownMarkerRef(true, "Morph")?.face_name).toBe("morph"); | ||
| // Cloak (CR 701.58a) and disguise (CR 702.168a) are different rules that | ||
| // share one printed token — the mapping is where they converge, not the | ||
| // engine's enum. | ||
| expect(faceDownMarkerRef(true, "Cloak")?.face_name).toBe("a mysterious creature"); | ||
| expect(faceDownMarkerRef(true, "Disguise")?.face_name).toBe("a mysterious creature"); | ||
| expect(faceDownMarkerRef(true, "Cloak")?.scryfall_oracle_id).toBe( | ||
| faceDownMarkerRef(true, "Disguise")?.scryfall_oracle_id, | ||
| ); | ||
| }); | ||
|
|
||
| it("has no marker for a cause with no printed token", () => { | ||
| // Ixidron turns permanents face down with no keyword action, and Wizards | ||
| // prints nothing for it — the generic card back stays. | ||
| expect(faceDownMarkerRef(true, "TurnedFaceDown")).toBeNull(); | ||
| }); | ||
|
|
||
| it("stays null unless the permanent is actually face down", () => { | ||
| // The engine leaves the cause on the object after it turns face up, so | ||
| // every reader must gate on `face_down`. This is that gate. | ||
| expect(faceDownMarkerRef(false, "Manifest")).toBeNull(); | ||
| expect(faceDownMarkerRef(true, null)).toBeNull(); | ||
| expect(faceDownMarkerRef(true, undefined)).toBeNull(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import type { FaceDownCause, TokenImageRef } from "../../adapter/types.ts"; | ||
|
|
||
| /** | ||
| * The marker token Wizards prints for each face-down family. | ||
| * | ||
| * Paper play uses these as the required "what ability caused them to be face | ||
| * down" reminder (Duskmourn rulings, 2024-09-20), and the engine already tells | ||
| * us the cause. Mapping the cause onto a printing is a display decision, which | ||
| * is why the ids live here and not in the engine: four rules-level causes share | ||
| * three printed tokens, and one cause has no token at all. | ||
| * | ||
| * Oracle ids are used rather than a single printing's Scryfall id so the lookup | ||
| * survives a reprint — `fetchTokenImageByRef` falls back to the oracle key that | ||
| * `scryfall-token-images.json` already indexes for all three. | ||
| */ | ||
| const MARKERS: Partial<Record<FaceDownCause, TokenImageRef>> = { | ||
| // https://scryfall.com/card/tfrf/4/manifest — also used for manifest dread, | ||
| // which is the same keyword action with a different card-selection step. | ||
| Manifest: { | ||
| scryfall_id: "", | ||
| scryfall_oracle_id: "f4f184ef-f456-47d8-9012-095629a5ea4d", | ||
| face_name: "manifest", | ||
| preset_id: "face-down-manifest", | ||
| }, | ||
| // https://scryfall.com/card/tdtk/7/morph — megamorph shares it. | ||
| Morph: { | ||
| scryfall_id: "", | ||
| scryfall_oracle_id: "8f92f8d7-ec89-426f-86dc-fbc259eb5559", | ||
| face_name: "morph", | ||
| preset_id: "face-down-morph", | ||
| }, | ||
| // https://scryfall.com/card/tmkm/21/a-mysterious-creature — cloak and | ||
| // disguise are different rules (CR 701.58a vs CR 702.168a) with one printing. | ||
| Cloak: { | ||
| scryfall_id: "", | ||
| scryfall_oracle_id: "6481a124-6859-4f02-9fd3-b1302528dd2e", | ||
| face_name: "a mysterious creature", | ||
| preset_id: "face-down-cloak", | ||
| }, | ||
| Disguise: { | ||
| scryfall_id: "", | ||
| scryfall_oracle_id: "6481a124-6859-4f02-9fd3-b1302528dd2e", | ||
| face_name: "a mysterious creature", | ||
| preset_id: "face-down-cloak", | ||
| }, | ||
| // `TurnedFaceDown` (Ixidron class) is deliberately absent: no marker token is | ||
| // printed for it, so it keeps the generic card back. | ||
| }; | ||
|
|
||
| /** | ||
| * The marker printing for a face-down permanent, or `null` when none applies — | ||
| * the permanent is face up, the engine did not record a cause (older saves), or | ||
| * the cause has no printed token. | ||
| */ | ||
| export function faceDownMarkerRef( | ||
| faceDown: boolean, | ||
| cause: FaceDownCause | null | undefined, | ||
| ): TokenImageRef | null { | ||
| if (!faceDown || !cause) return null; | ||
| return MARKERS[cause] ?? null; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Test the missing marker URL fallback.
fireEvent.errorcovers theimageErrorbranch only. TheTurnedFaceDowncase bypasses marker lookup. Add aManifestcase withsrc: nullandisLoading: false. AssertCARD_BACK_URL. This verifies the completed marker lookup failure path.🤖 Prompt for AI Agents