Hand
namespace Griff.Modules.Cards;
public sealed class Hand : CardZone, IDrawable, IDrawEffect, ITurnReady, IPlaytestReport, IHoldsItemsThe cards a player holds, fanned out along the bottom of the screen, with no code. It draws StartWith from its Deck as the game starts. Drag a card onto a PlayZone that takes it to play it, or click it and then the zone (a tap and a tap on a touch screen); dropped anywhere else it slides back. Hovering a card lifts it out of the fan. With the keys or a gamepad, left and right pick a card, the PickAction (Space, A) takes it up, left and right choose where it goes and the Pick Action again plays it; the CancelAction puts it back.
Give it a TurnTaker naming its team and it’s played only on its team’s turn, each card played using one of the turn taker’s actions (with Actions set), and in a network game only by the players on that team (the Multiplayer’s Teams). With Hidden, only its own team sees its faces. Its mana is an item like any other (see Items): “Mana” a teammate picks up or a trigger gives goes into it, and a card’s Price is paid from its team’s other items. Its Draw and Discard actions are there for a Trigger (draw a card as each turn starts, discard the hand as it ends), a wire or a script, and its Count output for a Counter or a Text. Untick Controllable (or Focus something else) and it ignores the mouse and keys.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”public float Arc { get; set; }How far the cards at the ends sit below the middle one, so the fan curves.
CancelAction
Section titled “CancelAction”public string? CancelAction { get; set; }The input action that puts a card taken up back, as a right click does: “Dash” is Shift or the gamepad’s B.
Controllable
Section titled “Controllable”public bool Controllable { get; set; }Untick it to have it ignore the mouse, keys and gamepad (its actions and scripts still work): another part of the scene has the player’s input. Its Focus action ticks it and unticks it on everything else the player plays.
public bool Dealt { get; set; }Set by the game once it has drawn its Start With, so a rewind doesn’t deal again. Leave it be.
public string? Deck { get; set; }The deck it draws from, by name. Empty draws from the scene’s first face-down deck.
DiscardPile
Section titled “DiscardPile”public string? DiscardPile { get; set; }The deck its Discard action puts its cards on, by name. Empty uses the scene’s first face-up deck.
DrawAction
Section titled “DrawAction”public string? DrawAction { get; set; }The input action that draws a card from its deck (one with Click To Draw): “Interact” is E, Enter or the gamepad’s Y.
DrawMessage
Section titled “DrawMessage”public string? DrawMessage { get; set; }A message sent as a card is drawn into it, with the card’s entity as its data.
public float Fan { get; set; }Degrees each card is turned from the one beside it, fanning them out. 0 lines them up straight.
HealBelow
Section titled “HealBelow”public float HealBelow { get; set; }For the computer: the share of its hero’s health below which it plays its healing, e.g. 0.5 for under half. It keeps healing cards until then.
public string? Hero { get; set; }The entity whose Health is this side’s life, by name, e.g. “Blue Hero”: what its cards’ effects do to “Self”, and the other teams’ to “Opponent”. Empty: the hand itself if it has a Health, else the first entity with a Health and a Turn Taker on its team.
Hidden
Section titled “Hidden”public bool Hidden { get; set; }Shows its cards’ faces only to its own side (its Turn Taker’s): in a network game, players on other teams see their backs, and their machines aren’t even sent which cards they are; at one screen, a team the computer plays keeps its cards face down, and with several people taking turns, each hand is face down while it isn’t its team’s turn.
HighlightColor
Section titled “HighlightColor”public Color HighlightColor { get; set; }The outline round the card picked, and the one the keys are on.
HoverRise
Section titled “HoverRise”public float HoverRise { get; set; }How far a card is lifted out of the fan while it’s under the mouse or picked.
HoverScale
Section titled “HoverScale”public float HoverScale { get; set; }How much bigger a card is drawn while it’s lifted: 1.15 is 15% bigger.
public int Keep { get; set; }For the computer: how many cards it keeps in its hand for later rather than play.
public int Limit { get; set; }The most cards it holds: once it has this many it draws no more. 0 is no limit.
public int Mana { get; set; }Mana it has to pay its cards’ costs with: it fills up to MaxMana as each of its team’s turns starts.
ManaGrowth
Section titled “ManaGrowth”public int ManaGrowth { get; set; }How much MaxMana grows as each of its team’s turns starts, up to ManaLimit: 1 adds a crystal a turn.
ManaLimit
Section titled “ManaLimit”public int ManaLimit { get; set; }The most MaxMana grows to.
MaxMana
Section titled “MaxMana”public int MaxMana { get; set; }The mana it fills up to as each of its team’s turns starts. Changing it while full keeps it full. 0 doesn’t refill.
MaxWidth
Section titled “MaxWidth”public float MaxWidth { get; set; }How wide it fans out at most: more cards than fit squeeze closer together.
PickAction
Section titled “PickAction”public string? PickAction { get; set; }The input action that takes up the card the keys are on, and plays it where they point: “Jump” is Space or the gamepad’s A.
PickSound
Section titled “PickSound”public string? PickSound { get; set; }A sound played as a card is taken up, e.g. “Sounds/pick.wav”.
Picked
Section titled “Picked”public Card? Picked { get; }The card this machine’s player has taken up from it (clicked, or with the keys), or null.
public string? Said { get; set; }What was last played from it, e.g. “Red plays Fireball on Blue Hero: 3 damage.”, or what one of its cards on the table did as its team’s turn began (“Wolf: 2 damage to Blue Hero.”). The game sets it. Read as the “Said” output.
public string Side { get; }What Team was called before every genre’s teams were one idea. Kept for scripts.
SlideTime
Section titled “SlideTime”public float SlideTime { get; set; }Seconds a card takes to slide into the hand.
Spacing
Section titled “Spacing”public float Spacing { get; set; }How far apart its cards are, middle to middle, while there’s room.
StartWith
Section titled “StartWith”public int StartWith { get; set; }How many cards it draws as the game starts, dealt one after another.
public string Team { get; }Its team: its Turn Taker’s (on it or an entity it’s inside) or whatever else puts it on a team (see Teams), or empty with none. Hands on the same team are friends; on different teams, foes.
ThinkTime
Section titled “ThinkTime”public float ThinkTime { get; set; }For the computer (a hand on one of its turn order’s Computer Teams): seconds it thinks before each play, the last part of it showing the card it’s about to play lifted out of its hand, so the player can follow. 0 plays at once.
ToDraw
Section titled “ToDraw”public int ToDraw { get; set; }Cards still to draw, one a tenth of a second (Draw asks for them). Saved with the scene, so a rewind keeps them.
Methods
Section titled “Methods”Discard
Section titled “Discard”public void Discard()Puts every card in it on its discard pile at the start of the next frame.
Discard
Section titled “Discard”public void Discard(Card card)Puts card (one of its cards) on its discard pile at the start of the next frame.
public void Draw(int count = 1)Draws count cards from its deck, starting at the next frame, a tenth of a second apart.
GainMana
Section titled “GainMana”public void GainMana(int amount = 1)Gives it amount more mana to pay its cards’ costs with (less than 0 takes some away).
public void Play(Card card, CardZone zone, Entity? target = null)Plays card (one of its cards) onto zone at the start of the next frame, if the zone takes it, as a player dragging it there does: a play zone, or a deck that takes drops. A card with an effect whose target is chosen goes for target (a card on the table or something with a Health), or without one, for what the computer would pick.
public override bool Uses(string property)Events
Section titled “Events”public event Action<Hand, Card>? DrewRaised as a card is drawn into it.