Chuyển đến nội dung
Skillpedia
Lập trình chung6.6k · #13807

card-game

Skill này làm gì

Skill này hướng dẫn xây dựng game bài trong đó các lá bài di chuyển giữa bộ bài, tay bài, khu vực đánh và chồng bài bỏ. Nó dành cho nhà phát triển làm deckbuilder, game bài sưu tầm hoặc game bài roguelike.

Khi nào nên dùng

  • ✓Khi bạn đang xây dựng một deckbuilder hoặc game bài sưu tầm.
  • ✓Khi bạn cần các luật rút bài, xáo bài và xáo lại hoạt động đúng.
  • ✓Khi bạn muốn hiệu ứng lá bài được xử lý theo thứ tự rõ ràng và dễ đoán.

Liên kết skill

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/genres/card-game/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/genres/card-game/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi đang làm một deckbuilder. Bạn có thể thiết lập bộ bài, tay bài, chồng bài bỏ và làm cho cấu trúc lượt hoạt động không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent mô hình hóa lá bài thành dữ liệu có chi phí và hiệu ứng, thiết lập các vùng cho bộ bài, tay bài, khu vực đánh và bỏ bài, rồi viết thứ tự lượt. Nó xử lý từng hiệu ứng lá bài theo một trình tự cố định để kết quả dễ đoán.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Card Game

A playbook for card games — card data, the deck/hand/discard zones, the turn structure, and how card effects resolve. This is a compositional skill: it models cards as data and wires them to UI. It does not re-teach data assets or UI nodes; it defines the zone model, the draw machinery, and the effect-resolution rules that keep a card game correct and bug-free.

When to use

  • Use when building any game where the core objects are cards moving between zones (deck → hand → play → discard): deckbuilder, TCG/CCG, solitaire, roguelike deckbuilder.
  • Use when designing draw/shuffle/reshuffle, turn structure, card costs, or how effects resolve.

When not to use: board/tile state with matching rules → puzzle. RPG with an incidental card battler → start from rpg. For defining cards as assets, use godot-resources / unity-scriptableobjects; for the hand/drag UI, use godot-ui-control.

Core loop

Draw to your hand → spend resources to play cards → effects resolve and change the board → end the turn (cleanup/discard) → opponent/next phase → repeat until a win condition. Depth comes from the combinations a hand allows; the engine's job is to resolve them unambiguously.

Must-have systems

  1. Card data — id, name, cost, type, text, and an effect spec (data, not code).
  2. Zones — deck (draw pile), hand, play/board, discard, exile/removed; cards live in exactly one.
  3. Draw + shuffle + reshuffle — draw from deck to hand; reshuffle discard into deck when empty.
  4. Turn structure — phases (untap/draw/main/combat/end) as a state machine.
  5. Resource system — mana/energy/actions that gate how much you do per turn.
  6. Effect resolution — apply a card's effects in a defined order; handle targets and triggers.
  7. Win/loss condition — life total, deck-out, objective.
  8. UI — hand layout, drag/drop or tap-to-play, zone counts, targeting affordances.

Design knobs

Knob Effect Notes
Starting hand / draw-per-turn tempo, consistency More draw = less variance.
Hand size limit hoarding vs. use Discard down at end of turn.
Deck size (min) consistency Smaller = more reliable combos.
Resource curve what's playable when "Mana curve" paces power.
Card rarity / power budget balance Stronger cards cost more / are rarer.
Determinism vs. randomness skill vs. swing Shuffle + random effects add variance.
Reshuffle rules deck-out, fatigue Reshuffle discard, or punish empty deck.
Removal / answers counterplay Every threat needs an answer in the pool.

Patterns

1. Zones + draw with automatic reshuffle

# Pseudocode. A card is in exactly one zone at a time; moving = remove here, add there.
def draw(n):
    for _ in range(n):
        if not deck:
            if not discard:          # truly empty: deck-out (lose, or take fatigue)
                on_deck_out(); return
            deck.extend(discard)     # reshuffle discard into deck
            discard.clear()
            shuffle(deck, rng)       # use a seeded RNG (see save-systems for replays)
        hand.append(deck.pop())

2. Card as data + effect resolution

# Pseudocode. Effects are a data list interpreted by the engine — not bespoke code per card.
card = {
    "id": "fireball", "cost": 3, "type": "spell",
    "effects": [ {"op": "damage", "amount": 6, "target": "chosen_enemy"} ],
}
def play(card, caster, chosen_targets):
    # Validate everything first; a failed check must leave zones and resources untouched.
    if resources[caster] < card.cost: return False      # can't afford
    if not targets_legal(card, chosen_targets): return False
    resources[caster] -= card.cost                      # commit: pay, then move, then resolve
    move(card, from_zone=hand, to_zone=play_or_discard(card))
    for fx in card.effects:
        resolve_effect(fx, caster, chosen_targets)      # one interpreter handles every card
    return True

3. Turn structure as a phase machine

# Pseudocode. Fixed phases keep timing windows (triggers, priority) unambiguous.
PHASES = ["untap", "draw", "main", "combat", "end"]
def take_turn(player):
    for phase in PHASES:
        enter_phase(player, phase)        # fire "on_phase" triggers here
        if phase == "draw":   draw(1)
        if phase == "main":   await player_plays_cards()
        if phase == "combat": resolve_combat()
        if pha
Câu hỏi thường gặp

Hiệu ứng lá bài nên là code hay dữ liệu?

Skill nói nên định nghĩa hiệu ứng là dữ liệu, giúp lá bài dễ cân bằng và thay đổi hơn.

Nó có bao quát giao diện kéo thả lá bài không?

Tay bài và giao diện kéo do skill UI của engine bao quát, và skill này dẫn tới đó.

Skill này hợp với những loại game bài nào?

Nó hợp với deckbuilder, game bài kiểu TCG và CCG, solitaire và deckbuilder roguelike.

Chi tiết

Mô tả gốc của tác giả

Build a card game: card data, deck/hand/discard zones, draw/shuffle/reshuffle, a turn structure, costs, and effect resolution. Use for a deckbuilder, TCG/CCG, or roguelike deckbuilder.

repo: gamedev-skills/awesome-gamedev-agent-skills

Độ phổ biến

Sao GitHub
6.6k
Vị trí xếp hạng
#13807
Giấy phép
Apache-2.0
Cập nhật
28/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự