Skip to content

CFConst

Divided by Zer0 edited this page Mar 15, 2021 · 96 revisions

CFConst

Extends: Reference

Description

Card Gaming Framework global Behaviour Constants

This class contains constants which handle how all the framework behaves.

Tweak the values to match your game requirements.

Enumerations

ReturnCode

const ReturnCode: Dictionary = {"CHANGED":1,"FAILED":2,"OK":0}

The possible return codes a function can return

  • OK is returned when the function did not end up doing any changes
  • CHANGE is returned when the function modified the card properties in some way
  • FAILED is returned when the function failed to modify the card for some reason

ShuffleStyle

const ShuffleStyle: Dictionary = {"AUTO":0,"CORGI":3,"NONE":1,"OVERHAND":6,"RANDOM":2,"SNAP":5,"SPLASH":4}

Options for pile shuffle styles.

  • auto: Will choose a shuffle animation depending on the amount of cards in the pile.
  • none: No shuffle animation for this pile.
  • random: Will choose a random shuffle style each time a shuffle is requested.
  • corgi: Looks better on a small amount of cards (0 to 30)
  • splash: Looks better on a moderate amount of cards (30+)
  • snap: For serious people with no time to waste.
  • overhand: Shuffles deck in 3 vertical raises. Best fit for massive amounts (60+)

Constants Descriptions

ARRAY_PROPERTY_JOIN

const ARRAY_PROPERTY_JOIN: String = " - "

This is used when filling in card property labels in Card.setup() when the property is an array, the label will still display it as a string but will have to join its elements somehow.

ATTACHMENT_OFFSET

const ATTACHMENT_OFFSET: Array = ["(-0.2, -0.2)","(0, -0.2)","(0.2, -0.2)","(0.2, 0)","(-0.2, 0)","(-0.2, 0.2)","(0, 0.2)","(0.2, 0.2)"]

Here you can adjust the amount of offset towards a side of their host card that attachments are placed.

This is a multiplier based on the card size.

You define which placement offset an attachment uses by setting the "attachment_offset" exported variable on the card scene

BOTTOM_MARGIN_MULTIPLIER

const BOTTOM_MARGIN_MULTIPLIER: float = 0.5

The margin towards the bottom of the viewport on which to draw the cards.

More than 0 and the card will appear hidden under the display area.

Less than 0 and it will float higher than the bottom of the viewport

CARD_SCALE_WHILE_DRAGGING

const CARD_SCALE_WHILE_DRAGGING: Vector2 = "(0.4, 0.4)"

The below scales down cards down while being dragged.

if you don't want this behaviour, change it to Vector2(1,1)

CARD_SET_NAME_PREPEND

const CARD_SET_NAME_PREPEND: String = "SetDefinition_"

The text which is prepended to files to signify the contain Card definitions for a specific set

CARD_SIZE

const CARD_SIZE: Vector2 = "(150, 240)"

The card size you want your cards to have. This will also adjust all CardContainers to match If you modify this property, you must adjust the min_rect of the various control nodes inside the card front and back scenes.

CostsState

const CostsState: Dictionary = {"DECREASED":"0.65,1.3,0,1.3","IMPOSSIBLE":"1.3,0,0,1.3","INCREASED":"1.3,0.65,0,1.3","OK":"1,1,1,1"}

The below const defines what string to put between these elements. Returns a color code to be used to mark the state of cost to pay for a card

  • IMPOSSIBLE: The cost of the card cannot be paid.
  • INCREASED: The cost of the card can be paid but is increased for some reason.
  • DECREASED: The cost of the card can be paid and is decreased for some reason.
  • OK: The cost of the card can be paid exactly.

DECKS_PATH

const DECKS_PATH: String = "user://Decks/"

The location where this game will store deck files

FANCY_MOVEMENT

const FANCY_MOVEMENT: bool = true

Switch this off to disable fancy movement of cards during draw/discard

FOCUS_HOVER_COLOUR

const FOCUS_HOVER_COLOUR: Color = "1,1,1,1"

The colour to use when hovering over a card.

Reduce the multiplier to reduce glow effect or stop it altogether

FOCUS_STYLE

const FOCUS_STYLE: int = 2

The focus style selected for this game. See enum FocusStyle

HAND_USE_OVAL_SHAPE

const HAND_USE_OVAL_SHAPE: bool = true

If set to true, the hand will be presented in the form of an oval shape If set to false, the hand will be presented with all cards horizontally aligned

If you allow the player to modify this with cfc.set_settings() Then that will always take priority

HOST_HOVER_COLOUR

const HOST_HOVER_COLOUR: Color = "1,0.8,0,1"

The colour to use when hovering over a card with an attachment to signify a valid host.

We multiply it a bit to make it as bright as FOCUS_HOVER_COLOUR for the glow effect.

Reduce the multiplier to reduce glow effect or stop it altogether

NEIGHBOUR_PUSH

const NEIGHBOUR_PUSH: float = 0.75

The amount of distance neighboring cards are pushed during card focus

It's based on the card width. Bigger percentage means larger push.

PATH_ALTERANT_ENGINE

const PATH_ALTERANT_ENGINE: String = "res://src/core/AlterantEngine.gd"

This specifies the path to the Alterant Engine. If you wish to extend The alterant engine functionality with your own tasks, Point this to your own script file.

PATH_ASSETS

const PATH_ASSETS: String = "res://assets/"

The path where assets needed by this game are placed such as token images

PATH_CARDS

const PATH_CARDS: String = "res://src/custom/cards/"

The path where card template scenes exist. These is usually one scene per type of card in the game

PATH_CORE

const PATH_CORE: String = "res://src/core/"

The path where the Card Game Framework core files exist. (i.e. mandatory scenes and scripts)

PATH_CUSTOM

const PATH_CUSTOM: String = "res://src/custom/"

The path where scenes and scripts customized for this specific game exist (e.g. board, card back etc)

PATH_MOUSE_POINTER

const PATH_MOUSE_POINTER: String = "res://src/core/MousePointer.tscn"

This specifies the path to the MousePointer. If you wish to extend The mouse pointer functionality with your own code, Point this to your own scene file with a scrip extending Mouse Pointer.

PATH_OVERRIDABLE_UTILS

const PATH_OVERRIDABLE_UTILS: String = "res://src/core/OverridableUtils.gd"

If you wish to extend the OVUtils, extend the class with your own script, then point to it with this const.

PATH_SCRIPTING_ENGINE

const PATH_SCRIPTING_ENGINE: String = "res://src/core/ScriptingEngine.gd"

This specifies the path to the Scripting Engine. If you wish to extend The scripting engine functionality with your own tasks, Point this to your own script file.

PATH_SCRIPT_PER

const PATH_SCRIPT_PER: String = "res://src/core/ScriptPer.gd"

This specifies the path to the ScriptPer class file. We don't reference is by class name to avoid cyclic dependencies And this also allows other developers to extend its functionality

PATH_SETS

const PATH_SETS: String = "res://src/custom/cards/sets/"

The path where the set definitions exist. This includes Card definition and card script definitions.

PATH_TOKENS

const PATH_TOKENS: String = "res://assets/tokens/"

This specifies the location of your token images. Tokens are always going to be seeked at this location

PLAY_AREA_SCALE

const PLAY_AREA_SCALE: Vector2 = "(0.8, 0.8)"

The scale of a card while on the play area

SCRIPT_SET_NAME_PREPEND

const SCRIPT_SET_NAME_PREPEND: String = "SetScripts_"

The text which is prepended to files to signify the contain script definitions for a specific set

SETTINGS_FILENAME

const SETTINGS_FILENAME: String = "user://CGFSettings.json"

The location and name of the file into which to store game settings

SHOW_TOKEN_BUTTONS

const SHOW_TOKEN_BUTTONS: bool = false

If true, each token will have a convenient +/- button when expanded to allow the player to add a remove more of the same

STATS_PORT

const STATS_PORT: int = 8000

STATS_URI

const STATS_URI: String = "http://127.0.0.1"

TARGETTING_ARROW_COLOUR

const TARGETTING_ARROW_COLOUR: Color = "0,0.52,1.3,1.3"

The colour to use when hovering over a card with an targetting arrow to signify a valid target

We are using the same colour as the TARGET_HOVER_COLOUR since they they match purpose

You can change the colour to something else if you want however

TARGET_HOVER_COLOUR

const TARGETTING_ARROW_COLOUR: Color = "0,0.52,1.3,1.3"

The colour to use when hovering over a card with an targetting arrow to signify a valid target

We are using the same colour as the TARGET_HOVER_COLOUR since they they match purpose

You can change the colour to something else if you want however

TOKENS_MAP

const TOKENS_MAP: Dictionary = {"bio":"green.svg","blood":"red.svg","gold coin":"yellow.svg","industry":"grey.svg","magic":"purple.svg","plasma":"blue.svg","tech":"blue.svg","void":"black.svg"}

This dictionary contains your defined tokens for cards

The key is the name of the token as it will appear in your scene and labels Please use lowercase only for the key

The value is the filename which contains your token image. The full path will be constructed using the PATH_TOKENS variable

This allows us to reuse a token image for more than 1 token type

TOKENS_ONLY_ON_BOARD

const TOKENS_ONLY_ON_BOARD: bool = true

If this is set to false, tokens on cards will not be removed when they exit the board

VIEWPORT_FOCUS_ZOOM_TYPE

const VIEWPORT_FOCUS_ZOOM_TYPE: String = "resize"

Controls how the card will be magnified in the focus viewport. Set to either "resize" or "scale"

If set to scale, will magnify the card during viewport focus using godot scaling. It doesn't require any extra configuration when your Card font layout is changed, but it doesn't look quite as nice.

If set to resize, will resize the card's viewport dupe's dimentions. This prevent blurry text, but needs more setup in the card's front and card back scripts.

Clone this wiki locally