Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

SugarCube: A very simple card duel

Greetings everyone,

I try to create a very simple card duel. Let me sketch the idea: The NPC deals seven cards (Witch, Vampire, Scolar etc.) one after another in a certain order. Each card has a certain strength and can beat at least one other card. The player has the same cards to counter with but can only use every card once. Depending on whether he chose the right one the NPC loses a hitpoint or not. After designing some nice looking cards and developing the basic rules I now fail at scripting it.

What I have so far: Almost perfect would have been using the <<radiobutton>> macro: With every card encounter a variable is created - which I can check for success easily - and the next card is dealt in a new passage. The problem: Already chosen cards are not removed like in the <<action>> or the <<link>> macro. If I try to use those instead I get stuck with the linked passages which should change of course depending on the card the players card is the counterattack for. Was I able to put it across?

Have you got any ideas? As always I would appreciate every kind of help or just a fearless brainstorming.

Comments

  • Please elaborate on the rules, and what it's supposed to look like, do players click the images to play the cards etc etc.?
    I love these kinds of problems, hopefully I can help you :)
  • You could probably use an array to hold the player's hand and simply remove each card as it was played.  When displaying their hand, you'd check the hand array for membership, so only cards still in the array would be displayed.

    Hand setup:

    <<set $playerHand to [
    "Vampire",
    "Witch",
    "Scholar",
    ""
    ]>>
    Hand display and card selection:

    <<if $playerHand.contains("Witch")>>\
    [img[Card-Witch][Resolution][$playerCard to "Witch"]]\
    <</if>> \
    <<if $playerHand.contains("Vampire")>>\
    [img[Card-Vampire][Resolution][$playerCard to "Vampire"]]\
    <</if>> \
    <<if $playerHand.contains("Scholar")>>\
    [img[Card-Scholar][Resolution][$playerCard to "Scholar"]]\
    <</if>> \
    /% %/
    Removing the played card from their hand:

    <<set $playerHand.splice($playerHand.indexOf($playerCard), 1)>>

    I could throw together a simple mockup if you needed.
Sign In or Register to comment.