Log inGet started
World

Game Night: Cards, Dice and Board Games Kit

Branchmain
Branchesmain
Commit0cb8462300

README.md

lanternDuel

An original two-player card duel for cardsKit: a painted 25-card deck and the rules that pick a winner. Each player tends a lantern with 20 glow. On your turn you play any cards your energy pays for (creatures and spells dim the other lantern, wards shield yours, charms restore glow, draw cards or brew energy), then press End turn. The first lantern to go dark loses. Every card is original, with storybook gouache art of a night garden and a painted lantern back.

Version 1.0.11 (LD.VERSION). Needs cardsKit 1.0.12 or later (installed with it).

Quick start

  1. Install lanternDuel.package from ZeroMind (search "lantern duel card deck"). cardsKit and gridKit come with it.
  2. A card table scene (see cardsKit's quick start: "player": "none" and a camera), then in build.luau:
local LD = require("lanternDuel.rules")

function content()
    local cam = entity.spawn("TableCamera")
    cam.component.add("Camera", {})
    cam.localPosition = { 0, 3, 6 }
    LD.Table { name = "Duel", style = "fantasy" }
end
  1. In the scene's entrypoint.luau register the rules on every peer:
local LD = require("lanternDuel.rules")
function onLoad() LD.install("Duel") end
  1. Press play with a friend. Each of you is dealt 5 cards nobody else sees; drag a card onto the felt to play it, press End turn, and play until one lantern goes out. CK.table("Duel").restart() deals a rematch.

Change one word for another look: style = "pixel", "cartoon", "scifi", "classic", "minimal" (every cardsKit frame style shows the painted art).

The deck

cardtypecostdoescopies
Moth SwarmCreature1Deal 3.3
Owl DiveCreature2Deal 6.2
Firefly SparkCreature0Deal 2.2
Fox FeintTrick1Deal 2. Draw 1.2
Toad GuardWard1Gain 4 shield.3
Hedgehog CurlWard2Gain 8 shield.2
Moonwell SipCharm1Restore 4 glow.2
Starlit MapCharm1Draw 2.2
Ember TeaCharm0Gain 2 energy.2
Comet FallSpell3Deal 10.1
Lantern FlareSpell2Deal 4. Gain 4 shield.2
Willow HushCharm1Restore 2 glow. Draw 1.2

Glow is cardsKit's hp stat, shield its block stat. Damage hits shield first.

Guides

Rules and defaults

settingdefaultwhat it does
glow (LD.GLOW)20each lantern's starting and maximum glow
energy (LD.ENERGY)3refilled at the start of each of your turns
hand (LD.HAND)5cards dealt when you sit down
hand limit (LD.HAND_MAX)7you draw one card at the start of your turn while under it
plays per turnanyactions = 0: play what your energy pays for, then End turn

LD.Table(opts) takes any cardsKit table setting as an override (style, layout, seed, title, autoSeat, ...). Older played cards move to the discard pile so the felt shows the latest four plays, and an empty draw pile is refilled from the discard pile.

API

calldoes
LD.Table(opts?) -> entityspawns the duel table (build.luau)
LD.settings(opts?) -> tablethe cardsKit settings it uses, for CK.Table yourself
LD.install(name?)registers the rules for a table (every peer, in onLoad)
LD.rules() -> hooksthe cardsKit rule hooks, to wrap with your own
LD.winner(game) -> seat?the winning seat once a lantern is dark
LD.result(name?) -> stringthe result text on any screen, "" while the duel runs
LD.Deckthe deck module: ID, LIST, ART, size()

Tests

zero tests run lanternDuel: the deck and its art, card conservation through a duel, shield and glow under damage and the winner, and the table settings.

Where it is used

The Game Night world puts this duel on a felt table in a cosy room, where two players sit down, play to a winner, see a results screen and take a rematch.

Versions

  • 1.0.11: the duel table clears itself. Once more than four cards lie on the felt, each play sends the oldest one (by play order) to the discard pile, so the felt shows the latest plays and the duel flows on to a winner with no Clear table button. It used to pick the first card in slot order, which after the first clear was the card just played, so the table filled and every play was refused. Checked with two players over 14 turns: never more than four cards on the felt, no refusal.
  • 1.0.10: the winner check installs once however often LD.install runs (a keyed CK.on), built against cardsKit 1.0.11 (a player can no longer restart a duel in progress).
  • 1.0.9: built against cardsKit 1.0.10 (its card sounds carry their descriptions).
  • 1.0.8: built against cardsKit 1.0.8: cards slap onto the felt with a sound, draws swish, the deck riffles when it shuffles, and every card name reads in the fanned hand.
  • 1.0.7: built against cardsKit 1.0.7, whose table fits phones and tablets beside other kits (screen margins, clear of the touch buttons).
  • 1.0.6: two guides: an example, "How to make a two-player card duel, step by step", and a how-to, "How to make a custom card deck with your own art and rules" (they replace the one combined guide). 1.0.5 was published without the how-to's text, so use 1.0.6.
  • 1.0.5 (do not use): two guides: an example, "How to make a two-player card duel, step by step", and a how-to, "How to make a custom card deck with your own art and rules" (they replace the one combined guide).
  • 1.0.4: the winner reaches every screen the moment a lantern goes dark. A win found while a card's damage resolves is now published at once; before, it waited on the dealer until the next action (found in a two-client test in Game Night, where the losing player saw no result).
  • 1.0.3: card art and the card back are passed to cardsKit as texture guids (the form its frame styles draw), so every face shows its painting and the table shows the lantern back (with cardsKit 1.0.6). The deck test checks every card's art is a texture guid.
  • 1.0.2: the card duel guide.
  • 1.0.1: first release: the deck, rules, tests and README.