# Module: typedefs

### Type Definitions

#### Ability

Ability of an Hero

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`name` | string | name of the ability
`hook` | AbilityHook | when ability has an effect
`isOptionnal` | boolean | If true, player will have choice wether to activate ability or not
`desc` | string | Description of the ability effect

Source:
  - server/src/client-server-shared/def/typedefs.js, line 52

#### AbilityHook

Ability Hook

##### Type:

- "AfterDeploy" | "AfterDiscard" | "AfterRecruit" | "BeforeControl" | "BeforeMaintenance" | "BeforeMilitary"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 47

#### AdvRule

Possible advanced rules

##### Type:

- "popularity" | "discard"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 32

#### Color

player colors

##### Type:

- "blue" | "red"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 27

#### DeckMode

Values For Deck Mode.

##### Type:

- "faction" | "draft" | "tournament"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 12

#### Faction

Faction of a hero

##### Type:

- "orcs" | "humans" | "elves" | "meca" | "none"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 17

#### GameGlobalState

One game global state

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`gameState` | GameStateEnum | Current status of the game
`allHeroes` | Array.<HeroCard> | Array containing all heroes
`deckMode` | DeckMode | Deck mode of the game
`advRules` | Array.<AdvRule> | Array describing the active advandced rules, if any
`waitingFor/blue` | boolean | If true, we are waiting for blue to play
`waitingFor/red` | boolean | If true, we are waiting for red to play
`currentPlayer` | Color | 'both' | Who is current player, can be 'both'
`battleTiles/left/ofBlue` | Array.<BattleTile> | Battle tiles on left side of blue player
`battleTiles/center/ofBlue` | Array.<BattleTile> | Battle tiles on center of blue player
`battleTiles/right/ofBlue` | Array.<BattleTile> | Battle tiles on right side of blue player
`totalFood` | number | Total food available for players to take
`` | string | All heroes in JSON format (read from a JSON file)

Source:
  - server/src/client-server-shared/def/typedefs.js, line 87

#### GameStateEnum

Values for Game state.

##### Type:

- "0_INIT" | "1_SELECT_DRAFT" | "1_SELECT_FACTION" | "1_SELECT_TOURNAMENT" | "2_CHANGE_UP_TO_3_CARDS"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 7

#### HeroAction

Possible action for a hero

##### Type:

- "recruit" | "deploy" | "move" | "ability" | "dismiss" | "discard" | "replace"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 37

#### HeroCard

Hero card

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`id` | number | unique ID of hero
`name` | string | name of hero
`cost` | number | cost of hero
`power` | number | power of hero
`faction` | Faction | faction of hero
`popularity` | Popularity | popularity attribute of hero
`isDraftable` | boolean | Is hero available in Draft mode
`ability` | Ability | Ability of a hero

Source:
  - server/src/client-server-shared/def/typedefs.js, line 61

#### HeroInGame

Hero in game

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`id` | number | unique ID of hero
`position` | HeroPosition | position of hero in game
`possibleActions` | Array.<HeroAction> | Actions possible on hero

Source:
  - server/src/client-server-shared/def/typedefs.js, line 104

#### HeroPosition

Possible position for a hero

##### Type:

- "pile" | "hand" | "discard" | "camp" | "battle_left" | "battle_center" | "battle_right"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 42

#### PlayerAction

Possible action for a player

##### Type:

- "supply" | "pass"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 113

#### PlayerGameState

Game state for one player

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`name` | string | username of this player
`color` | Color | color of the player
`faction` | Faction | "" | Chosen faction (empty if not playing faction mode)
`draftHeroesIds` | Array.<number> | Will contain the IDs of the heroes selectable for draft mode
`twelveHeroes` | Array.<HeroInGame> | The 12 Heroes used by player
`foodInCamp` | number | Number of food in camp
`foodInBattle/left` | number | Food on left battle field
`foodInBattle/center` | number | Food on center battle field
`foodInBattle/right` | number | Food on right battle field
`actionsPerformed` | Array.<object> | During military phase it will contain actions made by player to be replayed by other
`` | Array.<PlayerAction> | Actions avalaible for the player

Source:
  - server/src/client-server-shared/def/typedefs.js, line 118

#### Popularity

popularity attribute of a hero

##### Type:

- "with" | "without" | "any"

Source:
  - server/src/client-server-shared/def/typedefs.js, line 22

#### StoreData

Store data

##### Type:

- object

##### Properties:

Name | Type | Description
--- | --- | ---
`game` | GameGlobalState | The game global state in store
`bluePlayer` | PlayerGameState | The game state for blue player
`redPlayer` | PlayerGameState | The game state for red player

Source:
  - server/src/client-server-shared/def/typedefs.js, line 135