Reference
Dice and card dressing
import { … } from "@johnmorrisdotca/tenka/dressing";
136.1 kB minified and gzipped, with everything it imports (measured with esbuild)
Tenka's table dressed in the family's dice and cards: Korokoro's dice for the dice of every attack, tumbling onto the faces the game threw, and Toranpu's cards for the cards in a hand, with a territory card of Tenka's own and a back of Tenka's own for the deck.
This is its own entry because it is the one place Tenka reaches for another
package. @johnmorrisdotca/korokoro and @johnmorrisdotca/toranpu are
optional peer dependencies of it and of nothing else: the rules, the map, the
computer player and the plain table (/ui, /react, /element) need
neither, and a page that never imports this file never loads them. It only
draws. The dice are thrown by the game's own seeded random, as they always
were, and Korokoro is handed the face that came up; the cards are the game's
hands. A game plays and replays the same whether or not it is dressed.
import { mountTenka } from "@johnmorrisdotca/tenka/ui";
import { tenkaDressing } from "@johnmorrisdotca/tenka/dressing";
mountTenka(document.getElementById("table")!, { dressing: tenkaDressing() });Exports
| Name | Kind | What it is |
|---|---|---|
TENKA_BACK | constant | Tenka's own back, as the deck shows it. |
TenkaBackHow | type | What a dressing is told about the back it is asked to draw. |
tenkaCardDesign | function | Tenka's cards as a Toranpu design: ask Toranpu for tenkaCardId(map, territory) in this design and it draws the territory's shape and name with its army's symbol, on its paper and in its frame. |
TenkaCardHow | type | What a dressing is told about a card it is asked to draw. |
tenkaCardId | function | The id of a card in Toranpu's hands: tenka-world-12 for the world's twelfth territory, tenka-wild for a wild card. |
tenkaCardOfId | function | The map and territory an id of tenkaCardId names, or null for a wild card (wild: true) or anything else. |
TenkaDieHow | type | What a dressing is told about a die it is asked to draw. |
TenkaDrawn | type | Something a dressing drew: the element to put on the table, and what to do when the table takes it away again (stop a timer, say). |
tenkaDressing | function | Tenka's dice and cards, drawn by the packages that draw them best: give the result to mountTenka, to the React TenkaTable, or to a <tenka-table>'s dressing. |
TenkaDressing | type | HOW A TABLE DRAWS ITS DICE AND ITS CARDS, if not the plain way: each is a function that is given what the rules decided and hands back the element to show. |
TenkaDressingOptions | type | What tenkaDressing may be given. |
tenkaThrownDie | function | A random source for Korokoro that comes up with face on a die of six: how a die is made to tumble onto the face the game has already thrown. |