CardEffect
namespace Griff.Modules.Cards;
public sealed class CardEffect : Component, ICardPartWhat a card does, with no code: as it’s played (or drawn, discarded, or each turn while it’s on the table) it deals Damage, gives back Heal, has you Draw cards, has its target’s side Discard, gives you GainMana, raises a number (Buff) or does any action (Do), like a Trigger, so a card can drive another part of the game. It does it to its Target: the opponent, yourself, a card or unit the player chooses, or all of them. Give a card one for each thing it does; with no Text of its own, a card writes what its effects do on its face.
Its numbers can come from a table: a deck made from a table sets a column called Damage, Heal, Draw, Discard, Target or Cost on each card (dice in a column roll for each play), so cards from a table carry their effects and costs. A target’s life is its Health: a side’s hero (see Hero), any character with a Health, or a card on the table with one (a creature, which goes to the discard pile when it dies). The computer weighs effects to choose its plays (see Hand). Effects happen where the game is run, with the game’s random numbers, so a seeded game plays the same, and what they change is saved with the scene.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”public float Buff { get; set; }How much it adds to a number of its target’s (BuffStat), for good: +2 to a creature’s Value. Less than 0 weakens.
BuffStat
Section titled “BuffStat”public string? BuffStat { get; set; }The number Buff raises: a property of its target’s components, e.g. “Value” (a card’s), “Armor” or “Health.Max” (one component’s).
ChooseFrom
Section titled “ChooseFrom”public string? ChooseFrom { get; set; }The entities a chosen target may be, by name, separated by commas, or a place they’re inside, e.g. “Enemy Row”: only the cards on it can be chosen. Empty: any card on the table or character with a Health.
Chooses
Section titled “Chooses”public bool Chooses { get; }True if it takes a target the player chooses as the card is played.
Damage
Section titled “Damage”public float Damage { get; set; }Hit points it takes from its target (its Health), each target once.
DamageRoll
Section titled “DamageRoll”public string? DamageRoll { get; set; }Dice rolled each time in place of Damage, e.g. “1d6+1”; empty deals Damage every time.
Discard
Section titled “Discard”public int Discard { get; set; }Cards its target’s side discards from their hand, picked at random (the game’s random numbers).
public string? Do { get; set; }An action it does too, as a Trigger does, e.g. “Open”, “Spawn” or “Damage”: on DoOn, or on its target without any. A card can drive anything in the scene this way: a door in the level, a spawner, a script’s action.
public string? DoOn { get; set; }The entities to do it on, by name, separated by commas. Empty does it on its target.
public int Draw { get; set; }Cards the player who played it draws, one after another.
Effect
Section titled “Effect”public string? Effect { get; set; }A prefab spawned on each target as it happens, e.g. “Sparkle”.
GainMana
Section titled “GainMana”public int GainMana { get; set; }Mana the player who played it gains: a hand’s Mana, for more plays this turn.
public float Heal { get; set; }Hit points it gives back to its target, never past its Max.
HealRoll
Section titled “HealRoll”public string? HealRoll { get; set; }Dice rolled each time in place of Heal, e.g. “2d4”.
public string? Sound { get; set; }A sound played as it happens, e.g. “Sounds/zap.wav”.
Target
Section titled “Target”public CardTarget Target { get; set; }Whom it’s done to: the Opponent’s hero, your own (Self), a card or unit the player picks as they play it (Chosen), or every foe, friend or both.
public CardWhen When { get; set; }When it happens: as the card is played (the usual), drawn or discarded, or as each of its team’s turns starts while it’s on the table.
public string? With { get; set; }What to do it with, for an action that takes a value: how much, a name, or true or false. Empty uses the action’s own default.
Methods
Section titled “Methods”Describe
Section titled “Describe”public string Describe()What it does, in words, e.g. “Deal 3 damage.” or “Each turn: heal 1.”; a card with no Text shows it.