Skip to content
Divided by Zer0 edited this page Mar 9, 2022 · 100 revisions

Card

Extends: Area2D

Description

A basic card object which includes functionality for handling its own placement and focus.

This class is meant to be used as the basis for your card scripting Simply make your card scripts extend this class and you'll have all the provided scripts available. If your card node type is not Area2D, make sure you change the extends type.

Enumerations

BoardPlacement

const BoardPlacement: Dictionary = {"ANYWHERE":4,"ANY_GRID":3,"GRID_AUTOPLACEMENT":2,"NONE":0,"SPECIFIC_GRID":1}

Specifies where a card is allowed to drop on the board

  • NONE: Cards cannot be manually dropped on the board
  • SPECIFIC_GRID: Cards can only be manually dropped in Grids of a specific name on the board. They will use mandatory_grid_name to specify which grid.
  • ANY_GRID: Cards can only be manually dropped in BoardPlacementGrids
  • ANYWHERE: Cards can only be manually dropped anywhere on the board

AttachmentMode

const AttachmentMode: Dictionary = {"ATTACH_BEHIND":1,"ATTACH_IN_FRONT":2,"DO_NOT_ATTACH":0}

CardState

const CardState: Dictionary = {"DECKBUILDER_GRID":15,"DRAGGED":5,"DROPPING_TO_BOARD":6,"FOCUSED_IN_HAND":1,"FOCUSED_IN_POPUP":12,"FOCUSED_ON_BOARD":8,"IN_HAND":0,"IN_PILE":9,"IN_POPUP":11,"MOVING_TO_CONTAINER":2,"MOVING_TO_SPAWN_DESTINATION":16,"ON_PLAY_BOARD":7,"PREVIEW":14,"PUSHED_ASIDE":4,"REORGANIZING":3,"VIEWED_IN_PILE":10,"VIEWPORT_FOCUS":13}

All the Card's Finite State Machine states

This simply is a way to refer to the values with a human-readable name.

See _process_card_state()

AttachmentOffset

const AttachmentOffset: Dictionary = {"BOTTOM":6,"BOTTOM_LEFT":5,"BOTTOM_RIGHT":7,"LEFT":4,"RIGHT":3,"TOP":1,"TOP_LEFT":0,"TOP_RIGHT":2}

Property Descriptions

properties

export var properties: Dictionary = {}

The properties dictionary will be filled in by the setup() code according to the card definintion.

scripts

export var scripts: Dictionary = {}

The properties dictionary will be filled in by the setup() code according to the card definintion. We export this variable to the editor to allow us to add scripts to each card object directly instead of only via code.

If this variable is set, it takes precedence over scripts found in CardScriptDefinitions.gd

See CardScriptDefinitions.gd for the proper format of a scripts dictionary

attachment_mode

export var attachment_mode = 0

The properties dictionary will be filled in by the setup() code according to the card definintion. We export this variable to the editor to allow us to add scripts to each card object directly instead of only via code.

If this variable is set, it takes precedence over scripts found in CardScriptDefinitions.gd

See CardScriptDefinitions.gd for the proper format of a scripts dictionary If true, the card can be attached to other cards and will follow their host around the table. The card will always return to its host when dragged away

attachment_offset

export var attachment_offset = 1

The properties dictionary will be filled in by the setup() code according to the card definintion. We export this variable to the editor to allow us to add scripts to each card object directly instead of only via code.

If this variable is set, it takes precedence over scripts found in CardScriptDefinitions.gd

See CardScriptDefinitions.gd for the proper format of a scripts dictionary If true, the card can be attached to other cards and will follow their host around the table. The card will always return to its host when dragged away If true, staggers the attachment so the side is also visible

is_viewed

export var is_viewed: bool = false
  • Setter: set_is_viewed
  • Getter: get_is_viewed

The properties dictionary will be filled in by the setup() code according to the card definintion. We export this variable to the editor to allow us to add scripts to each card object directly instead of only via code.

If this variable is set, it takes precedence over scripts found in CardScriptDefinitions.gd

See CardScriptDefinitions.gd for the proper format of a scripts dictionary If true, the card can be attached to other cards and will follow their host around the table. The card will always return to its host when dragged away If true, staggers the attachment so the side is also visible If true, the card front will be displayed when mouse hovers over the card while it's face-down

card_rotation

export var card_rotation: int = 0
  • Setter: set_card_rotation
  • Getter: get_card_rotation

The properties dictionary will be filled in by the setup() code according to the card definintion. We export this variable to the editor to allow us to add scripts to each card object directly instead of only via code.

If this variable is set, it takes precedence over scripts found in CardScriptDefinitions.gd

See CardScriptDefinitions.gd for the proper format of a scripts dictionary If true, the card can be attached to other cards and will follow their host around the table. The card will always return to its host when dragged away If true, staggers the attachment so the side is also visible If true, the card front will be displayed when mouse hovers over the card while it's face-down Specifies the card rotation in increments of 90 degrees

board_placement

export var board_placement: int = 4

Specifies where on the board the card may be placed

mandatory_grid_name

export var mandatory_grid_name: String = ""

card_back_design

export var card_back_design: PackedScene = "[Object:null]"

Contains the scene which has the Card Back design to use for this card type It needs to be scene which uses a CardBack class script.

card_front_design

export var card_front_design: PackedScene = "[Object:null]"

Contains the scene which has the Card Back design to use for this card type It needs to be scene which uses a CardBack class script.

targeting_arrow_scene

export var targeting_arrow_scene = "[PackedScene:5568]"

We use this variable, so that the scene can be overriden with a custom one

disable_dropping_to_cardcontainers

export var disable_dropping_to_cardcontainers: bool = false

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas.

disable_dragging_from_hand

export var disable_dragging_from_hand: bool = false

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually

disable_dragging_from_board

export var disable_dragging_from_board: bool = false

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually

disable_dragging_from_pile

export var disable_dragging_from_pile: bool = false

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window

hand_drag_starts_targeting

export var hand_drag_starts_targeting: bool = false

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand)

in_hand_tween_duration

export var in_hand_tween_duration: float = 0.3

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand

reorganization_tween_duration

export var reorganization_tween_duration: float = 0.4

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand

focus_tween_duration

export var focus_tween_duration: float = 0.3

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand

to_container_tween_duration

export var to_container_tween_duration: float = 0.3

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers

pushed_aside_tween_duration

export var pushed_aside_tween_duration: float = 0.3

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused

to_board_tween_duration

export var to_board_tween_duration: float = 0.25

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board

on_board_tween_duration

export var on_board_tween_duration: float = 0.3

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board The duration of the tweening animation when cards are scaled in play area on the board

dragged_tween_duration

export var dragged_tween_duration: float = 0.2

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board The duration of the tweening animation when cards are scaled in play area on the board The duration of the tweening animation when cards are scaled when being dragged

canonical_size

export var canonical_size: Vector2 = "(150, 240)"

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board The duration of the tweening animation when cards are scaled in play area on the board The duration of the tweening animation when cards are scaled when being dragged Stores the normal size of the card as it should appear on the hand. It should typically should be the same as card_size, but unlike card_size, it should not be adjusted in runtime

play_area_scale

export var play_area_scale: float = 0.8

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board The duration of the tweening animation when cards are scaled in play area on the board The duration of the tweening animation when cards are scaled when being dragged Stores the normal size of the card as it should appear on the hand. It should typically should be the same as card_size, but unlike card_size, it should not be adjusted in runtime the size of the card when seen smaller (usually in a card-grid of selection window)

thumbnail_scale

export var thumbnail_scale: float = 0.85

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board The duration of the tweening animation when cards are scaled in play area on the board The duration of the tweening animation when cards are scaled when being dragged Stores the normal size of the card as it should appear on the hand. It should typically should be the same as card_size, but unlike card_size, it should not be adjusted in runtime the size of the card when seen smaller (usually in a card-grid of selection window) the size of the card when seen smaller (usually in a card-grid of selection window)

preview_scale

export var preview_scale: float = 1.5

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board The duration of the tweening animation when cards are scaled in play area on the board The duration of the tweening animation when cards are scaled when being dragged Stores the normal size of the card as it should appear on the hand. It should typically should be the same as card_size, but unlike card_size, it should not be adjusted in runtime the size of the card when seen smaller (usually in a card-grid of selection window) the size of the card when seen smaller (usually in a card-grid of selection window) The size of the card when seen a thumbnail is moused-over

focused_scale

export var focused_scale: float = 1.5

We use this variable, so that the scene can be overriden with a custom one If true, the player will not be able to drop dragged cards back into CardContainers. The player will only be allowed to drop cards to the board or back into the container they picked them front The game logic will have to provide another way to send cards to the various piles Be careful with this setting, as it will allow the player to drop cards on top of the hand or pile areas. If true, the player will not be able to drag cards out of the hand manually If true, the player will not be able to drag cards around the board manually If true, the player will not be able to drag cards out of piles (Either directly from top, or from popup window If true, and the player attempt to drag the card out of hand then the card will be check on whether it has scripts which are targeting other cards and if so will initiate them.

Be aware that if the targeting task is not is_cost, then other costs and effects of the card will trigger, even if player decided not to, or couldn't, target anything.

If not, it will act according to disable_dragging_from_hand(#disable_dragging_from_hand) The duration of the tweening animation when cards rotate in hand The duration of the tweening animation when reorganizing cards in hand The duration of the tweening animation when focusing a card in hand The duration of the tweening animation when moving a card between containers The duration of the tweening animation when cards are pushed aside due to a neighbor being focused The duration of the tweening animation when cards are dropping to the board The duration of the tweening animation when cards are scaled in play area on the board The duration of the tweening animation when cards are scaled when being dragged Stores the normal size of the card as it should appear on the hand. It should typically should be the same as card_size, but unlike card_size, it should not be adjusted in runtime the size of the card when seen smaller (usually in a card-grid of selection window) the size of the card when seen smaller (usually in a card-grid of selection window) The size of the card when seen a thumbnail is moused-over The size of the card when seen larger in the viewport focus window

canonical_name

var canonical_name: String
  • Setter: set_card_name
  • Getter: get_card_name

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property.

card_size

var card_size: Vector2
  • Setter: set_card_size

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect.

state

var state: int
  • Setter: set_state

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect. Starting state for each card

attachments

var attachments: Array

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect. Starting state for each card If this card is hosting other cards, this list retains links to their objects in order.

current_host_card

var current_host_card: Card

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect. Starting state for each card If this card is hosting other cards, this list retains links to their objects in order. If this card is set as an attachment to another card, this tracks who its host is.

is_faceup

var is_faceup: bool
  • Setter: set_is_faceup
  • Getter: get_is_faceup

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect. Starting state for each card If this card is hosting other cards, this list retains links to their objects in order. If this card is set as an attachment to another card, this tracks who its host is. If true, the card will be displayed faceup. If false, it will be facedown

potential_host

var potential_host: Card

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect. Starting state for each card If this card is hosting other cards, this list retains links to their objects in order. If this card is set as an attachment to another card, this tracks who its host is. If true, the card will be displayed faceup. If false, it will be facedown Used to keep the card and mouse cursor in sync when dragging the card around Represents the cursor's position relative to the card origin when drag was initiated Used for animating the card. Used for animating the card. Used to avoid the focus animation repeating once it's completed. We use this to know at which stage of fancy movement this is. We use this to track multiple cards when our card is about to drop onto or target them

potential_container

var potential_container

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect. Starting state for each card If this card is hosting other cards, this list retains links to their objects in order. If this card is set as an attachment to another card, this tracks who its host is. If true, the card will be displayed faceup. If false, it will be facedown Used to keep the card and mouse cursor in sync when dragging the card around Represents the cursor's position relative to the card origin when drag was initiated Used for animating the card. Used for animating the card. Used to avoid the focus animation repeating once it's completed. We use this to know at which stage of fancy movement this is. We use this to track multiple cards when our card is about to drop onto or target them We use this to track multiple CardContainers when our card is about to drop onto them

temp_properties_modifiers

var temp_properties_modifiers: Dictionary

This is the authorative name for this node

If not set, will be set to the value of the Name label in the front. if that is also not set, will be set. to the human-readable value of the "name" node property. Ensures all nodes fit inside this rect. Starting state for each card If this card is hosting other cards, this list retains links to their objects in order. If this card is set as an attachment to another card, this tracks who its host is. If true, the card will be displayed faceup. If false, it will be facedown Used to keep the card and mouse cursor in sync when dragging the card around Represents the cursor's position relative to the card origin when drag was initiated Used for animating the card. Used for animating the card. Used to avoid the focus animation repeating once it's completed. We use this to know at which stage of fancy movement this is. We use this to track multiple cards when our card is about to drop onto or target them We use this to track multiple CardContainers when our card is about to drop onto them If the card is placed in a placement grid, this will hold a reference to the slot where this card is placed This hold modifiers to card properties that will be active temporarily. This avoids triggering the card_properties_modified signal.

Each key is a ScriptingEngine reference, and each value is a dictionary With the following keys:

  • requesting_object: The object which has requested this temp modifier
  • modifer: A dictionary with all the modifications requested by this card Each key is a (numerical) property name, and value is the temp modifier requested for this property.

This allows multiple modifiers may be active at the same time, even from nested tasks on the same card during an execute_scripts task.

Typically used during an [execute_scripts()](ScriptingEngine#execute_scripts] task.

card_back

var card_back: CardBack

Used for picking a card to start the compiler on Debug for stuck tweens This variable is being used to avoid an infinite loop when alterants are altering get_property based on filtering properties of cards The node which has the design of the card back And the methods which are used for its potential animation. This will be loaded in _init_card_back()

card_front

var card_front: CardFront

The node which has the design of the card front And the methods which are used for modifying the card labels and sizing. This will be loaded in _init_card_layout()

is_executing_scripts

var is_executing_scripts: bool

Holds which controls have already been resized through resize_recursively() to avoid trying to resize them again This is true while the card is in the process of executing its scripts This flag not used in the core CGF, but games build on it can use This flag to prevent the player from "double-dipping" on a script while animations are playing.

spawn_destination

var spawn_destination

Holds which controls have already been resized through resize_recursively() to avoid trying to resize them again This is true while the card is in the process of executing its scripts This flag not used in the core CGF, but games build on it can use This flag to prevent the player from "double-dipping" on a script while animations are playing. If this card is freshly spawned, this variable will hold the CardContainer which is the final constainer to put it in

targeting_arrow

var targeting_arrow

This variable will point to the scene which controls the targeting arrow

buttons

var buttons

The node which hosts all manipulation buttons belonging to this card as well as methods to hide/show them, and connect them to this card.

tokens

var tokens: TokenDrawer

The node which hosts all manipulation buttons belonging to this card as well as methods to hide/show them, and connect them to this card. The node which hosts all tokens belonging to this card as well as the methods retrieve them and to to hide/show their drawer.

highlight

var highlight

The node which hosts all manipulation buttons belonging to this card as well as methods to hide/show them, and connect them to this card. The node which hosts all tokens belonging to this card as well as the methods retrieve them and to to hide/show their drawer. The node which manipulates the highlight borders.

Method Descriptions

setup

func setup() -> void

This function handles filling up the card's labels according to its card definition dictionary entry.

modify_property

func modify_property(property: String, value, check: bool = false, tags: Array = "Manual") -> int

Changes the property stored in the properties dictionary of this card and modified the card front labels so that they display the correct text

If the property is a number, and the value is a string integer with the operator in front (e.g. "+4", "-1" etc), then instead of setting the property it will be instead modified by that amount.

refresh_property_label

func refresh_property_label(property: String) -> void

refresh_card_front

func refresh_card_front() -> void

get_property

func get_property(property: String)

Retrieves the value of a property. This should always be used instead of properties.get() as it takes into account the temp_properties_modifiers var and also checks for alterant scripts

get_property_and_alterants

func get_property_and_alterants(property: String, use_global_temp_mods: bool = false) -> var

Discovers the modified value of the specified property based on temp_properties_modifiers and alterants (if it's a number).

Returns a dictionary with the following keys:

  • value: The final value of this property after all modifications
  • alteration: The full dictionary returned by CFScriptUtils.get_altered_value() but including details about temp_properties_modifiers

resize_recursively

func resize_recursively(control_node: Node, requested_scale: float) -> void

Adjust all control nodes in this card's hierarchy so that they are scaled according to the requested scale, and then adjusted in position likewise This allows the card layout to scale without using the .scale property Which prevents the font from getting blurry

set_card_size

func set_card_size(value: Vector2, ignore_area = false) -> void

Sets the card size and adjusts all nodes depending on it.

set_is_faceup

func set_is_faceup(value: bool, instant: bool = false, check: bool = false, tags: Array = "Manual") -> int

Setter for is_faceup

Flips the card face-up/face-down

  • Returns CFConst.ReturnCode.CHANGED if the card actually changed rotation
  • Returns CFConst.ReturnCode.OK if the card was already in the correct rotation

get_is_faceup

func get_is_faceup() -> bool

Getter for is_faceup

set_is_viewed

func set_is_viewed(value: bool) -> int

Setter for is_faceup

Flips the card face-up/face-down

  • Returns CFConst.ReturnCode.CHANGED if the card actually changed view status
  • Returns CFConst.ReturnCode.OK if the card was already in the correct view status
  • Returns CFConst.ReturnCode.FAILED if changing the status is now allowed

get_is_viewed

func get_is_viewed() -> bool

Getter for is_faceup

set_card_name

func set_card_name(value: String, set_label: bool = true) -> void

Setter for canonical_name Also changes the card label and the node name

get_card_name

func get_card_name() -> String

Getter for canonical_name

set_name

func set_name(value: String) -> void

Overwrites the built-in set name, so that it also sets canonical_name

It's preferrable to set canonical_name instead.

set_state

func set_state(value: int) -> void

Sets the card state and sends a signal.

set_card_rotation

func set_card_rotation(value: int, toggle: bool = false, start_tween: bool = true, check: bool = false, tags: Array = "Manual") -> int

Setter for card_rotation.

Rotates the card the specified number of degrees.

If the caller specifies the degree the card already has, and they have enabled the toggle flag, then we just reset the card to 0 degrees.

  • Returns CFConst.ReturnCode.CHANGED if the card actually changed rotation.
  • Returns CFConst.ReturnCode.OK if the card was already in the correct rotation.
  • Returns CFConst.ReturnCode.FAILED if an invalid rotation was specified.

get_card_rotation

func get_card_rotation() -> int

Getter for card_rotation

get_potential_placement_slot

func get_potential_placement_slot() -> BoardPlacementSlot

Discovers if a grid placement slot is currently highlighted to be used

move_to

func move_to(targetHost: Node, index: int = -1, board_position = null, tags: Array = "Manual") -> var

Arranges so that the card enters the chosen container.

Will take care of interpolation.

If the target container is the board, the card will either be placed at the mouse position, or at the 'boardPosition' variable.

If placed in a pile, the index determines the card's position among other card. If it's -1, card will be placed on the bottom of the pile

execute_scripts

func execute_scripts(trigger_card: Card, trigger: String = "manual", trigger_details: Dictionary, only_cost_check: bool = false)

Executes the tasks defined in the card's scripts in order.

Returns a ScriptingEngine object but that it not statically typed As it causes the parser think there's a cyclic dependency.

retrieve_scripts

func retrieve_scripts(trigger: String) -> Dictionary

Retrieves the card scripts either from those defined on the card itself, or from those defined in the script definition files

Returns a dictionary of card scripts for this specific card based on the current trigger.

get_state_exec

func get_state_exec() -> String

Determines which play position (board, pile or hand) a script should look for to find card scripts based on the card's state.

Returns either "board", "hand", "pile" or "NONE".

attach_to_host

func attach_to_host(host: Card, is_following_previous_host = false, tags: Array = "Manual") -> void

Handles the card becoming an attachment for a specified host Card object

get_class

func get_class()

Overrides the built-in get_class to Returns "Card" instead of "Area2D"

reorganize_self

func reorganize_self() -> void

Ensures the card is placed in the right position in the hand In relation to the other cards in the hand

It will also adjust the separation between cards depending on the amount of cards in-hand

interruptTweening

func interruptTweening() -> void

Stops existing card animations then makes sure they're properly cleaned-up to allow future animations to play.

set_focus

func set_focus(requestedFocus: bool, colour: Color) -> void

Changes card focus (highlighted and put on the focus viewport)

set_to_idle

func set_to_idle() -> void

Ensures the card's state is in idle mode.

This is useful when the game is paused, but we don't want cards to stay focused

get_focus

func get_focus() -> bool

Tells us the focus-state of a card

Returns true if card is currently in focus, else false

get_my_card_index

func get_my_card_index() -> int

Returns the Card's index position among other card objects

set_control_mouse_filters

func set_control_mouse_filters(value = true) -> void

Changes the hosted Control nodes filters

  • When set to false, card cannot receive inputs anymore (this is useful when card is in motion or in a pile)
  • When set to true, card can receive inputs again

recalculate_position

func recalculate_position(index_diff = null) -> Vector2

Get card position in hand by index if use oval shape, the card has a certain offset according to the angle

animate_shuffle

func animate_shuffle(anim_speed: float, style: int) -> var

Animates a card semi-randomly to make it looks like it's being shuffled Then it returns it to its original location

check_play_costs

func check_play_costs() -> Color

This function can be overriden by any class extending Card, in order to provide a way of checking if a card can be played before dragging it out of the hand.

This method will be called while the card is being focused by the player If it returns true, the card will be highlighted as normal and the player will be able to drag it out of the hand

If it returns false, the card will be highlighted with a red tint, and the player will not be able to drag it out of the hand.

common_pre_move_scripts

func common_pre_move_scripts(new_host: Node, old_host: Node, move_tags: Array) -> Node

This function can be overriden by any class extending Card, in order to provide a way of running scripts which might change where a card moves

This method will be called before the card moves anywhere, but before board_placement is evaluted. This allows a card which has been setup to not allow moves to the board, (which would normally send it back to its origin container) to instead be redirected to a pile. warning-ignore:unused_argument warning-ignore:unused_argument

common_post_move_scripts

func common_post_move_scripts(new_host: String, old_host: String, move_tags: Array) -> void

This function can be overriden by any class extending Card, in order to provide a way of running scripts for a whole class of cards, based on where the card moves.

This method will be called after the card moves anywhere, to a different container, or the same. new_host is where it moved to, and old_host is where it moved from. They can be the same, such as when a card changes places on the table. warning-ignore:unused_argument warning-ignore:unused_argument warning-ignore:unused_argument

common_pre_execution_scripts

func common_pre_execution_scripts(_trigger: String, _trigger_details: Dictionary) -> void

This function can be overriden by any class extending Card, in order to provide a way of running scripts for a whole class of cards, based on what the trigger was before all normal scripts have been executed

This is useful for example, for paying the costs of one-use cards before executing them

common_pre_run

func common_pre_run(_sceng) -> void

This function can be overriden by any class extending Card, in order to provide a way of running special functions on an extended scripting engine.

It is called after the scripting engine is initiated, but before it's run the first time

common_post_execution_scripts

func common_post_execution_scripts(_trigger: String) -> void

This function can be overriden by any class extending Card, in order to provide a way of running scripts for a whole class of cards, based on what the trigger was after all normal scripts have been executed

This is useful for example, for discarding one-use cards after playing them

Signals

  • signal card_rotated(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter.
  • signal card_flipped(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down
  • signal card_viewed(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down
  • signal card_moved_to_board(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board
  • signal card_moved_to_pile(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile
  • signal card_moved_to_hand(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand
  • signal card_token_modified(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand Emited whenever the card's tokens are modified warning-ignore:unused_signal
  • signal card_attached(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand Emited whenever the card's tokens are modified warning-ignore:unused_signal Emited whenever the card attaches to another
  • signal card_unattached(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand Emited whenever the card's tokens are modified warning-ignore:unused_signal Emited whenever the card attaches to another Emited whenever the card unattaches from another
  • signal card_properties_modified(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand Emited whenever the card's tokens are modified warning-ignore:unused_signal Emited whenever the card attaches to another Emited whenever the card unattaches from another Emited whenever the card properties are modified
  • signal card_targeted(card, trigger, details): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand Emited whenever the card's tokens are modified warning-ignore:unused_signal Emited whenever the card attaches to another Emited whenever the card unattaches from another Emited whenever the card properties are modified Emited whenever the card is targeted by another card. This signal is not fired by this card directly, but by the card doing the targeting. warning-ignore:unused_signal
  • signal dragging_started(card): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand Emited whenever the card's tokens are modified warning-ignore:unused_signal Emited whenever the card attaches to another Emited whenever the card unattaches from another Emited whenever the card properties are modified Emited whenever the card is targeted by another card. This signal is not fired by this card directly, but by the card doing the targeting. warning-ignore:unused_signal

These signals are not connected to the signal propagator and are expected to be

used internally from this object

Sent when the player start dragging the card

  • signal state_changed(card, old_state, new_state): Emitted whenever the card is rotated The signal must send its name as well (in the trigger var) Because it's sent by the SignalPropagator to all cards and they use it To filter. Emitted whenever the card flips up/down Emitted whenever the card is viewed while face-down Emited whenever the card is moved to the board Emited whenever the card is moved to a pile Emited whenever the card is moved to a hand Emited whenever the card's tokens are modified warning-ignore:unused_signal Emited whenever the card attaches to another Emited whenever the card unattaches from another Emited whenever the card properties are modified Emited whenever the card is targeted by another card. This signal is not fired by this card directly, but by the card doing the targeting. warning-ignore:unused_signal

These signals are not connected to the signal propagator and are expected to be

used internally from this object

Sent when the player start dragging the card Sent when the card's state changes

Clone this wiki locally