'use strict';
/**
* @namespace typedefs
*/
/**
* @namespace constants
*/
/**
* Values for Game state.
*
* @typedef {"0_INIT" | "1_SELECT_DRAFT" | "1_SELECT_FACTION" | "1_SELECT_TOURNAMENT" | "2_CHANGE_UP_TO_3_CARDS"} GameStateEnum
* @memberof typedefs
*/
/**
* Values For Deck Mode.
*
* @typedef {"faction" | "draft" | "tournament"} DeckMode
* @memberof typedefs
*/
/**
* Faction of a hero
*
* @typedef {"orcs" | "humans" | "elves" | "meca" | "none"} Faction
* @memberof typedefs
*/
/**
* popularity attribute of a hero
*
* @typedef {"with" | "without" | "any"} Popularity
* @memberof typedefs
*/
/**
* player colors
*
* @typedef {"blue" | "red"} Color
* @memberof typedefs
*/
/**
* Possible advanced rules
*
* @typedef {"popularity" | "discard"} AdvRule
* @memberof typedefs
*/
/**
* Possible action for a hero
*
* @typedef {"recruit" | "deploy" | "move" | "ability" | "dismiss" | "discard" | "replace"} HeroAction
* @memberof typedefs
*/
/**
* Possible position for a hero
*
* @typedef {"pile" | "hand" | "discard" | "camp" | "battle_left" | "battle_center" | "battle_right"} HeroPosition
* @memberof typedefs
*/
/**
* Ability Hook
*
* @typedef {"AfterDeploy" | "AfterDiscard" | "AfterRecruit" | "BeforeControl" | "BeforeMaintenance" | "BeforeMilitary"} AbilityHook
* @memberof typedefs
*/
/**
* Ability of an Hero
*
* @typedef {object} Ability
* @property {string} name - name of the ability
* @property {typedefs.AbilityHook} hook - when ability has an effect
* @property {boolean} isOptionnal - If true, player will have choice wether to activate ability or not
* @property {string} desc - Description of the ability effect
* @memberof typedefs
*/
/**
* Hero card
*
* @typedef {object} HeroCard
* @property {number} id - unique ID of hero
* @property {string} name - name of hero
* @property {number} cost - cost of hero
* @property {number} power - power of hero
* @property {typedefs.Faction} faction - faction of hero
* @property {typedefs.Popularity} popularity - popularity attribute of hero
* @property {boolean} isDraftable - Is hero available in Draft mode
* @property {typedefs.Ability} ability - Ability of a hero
* @memberof typedefs
*
*/
/**
* Battle Tile object
*
* @typedef {object} BattleTile
* @property {number} id - unique ID of tile
* @property {string} name - name of tile
* @property {number} victoryPoints - Number of victory points
* @property {number} victories/blue - Number of red player victories
* @property {number} victories/red - Number of blue player victories
* @memberof typedefs
*
*/
/**
* One game global state
*
* @typedef {object} GameGlobalState
* @property {typedefs.GameStateEnum} gameState - Current status of the game
* @property {Array<typedefs.HeroCard>} allHeroes - Array containing all heroes
* @property {typedefs.DeckMode} deckMode - Deck mode of the game
* @property {Array<typedefs.AdvRule>} advRules - Array describing the active advandced rules, if any
* @property {boolean} waitingFor/blue - If true, we are waiting for blue to play
* @property {boolean} waitingFor/red - If true, we are waiting for red to play
* @property {typedefs.Color | 'both'} currentPlayer - Who is current player, can be 'both'
* @property {Array<typedefs.BattleTile>} battleTiles/left/ofBlue - Battle tiles on left side of blue player
* @property {Array<typedefs.BattleTile>} battleTiles/center/ofBlue - Battle tiles on center of blue player
* @property {Array<typedefs.BattleTile>} battleTiles/right/ofBlue - Battle tiles on right side of blue player
* @property {number} totalFood - Total food available for players to take
* @property {string} - All heroes in JSON format (read from a JSON file)
* @memberof typedefs
*/
/**
* Hero in game
*
* @typedef {object} HeroInGame
* @property {number} id - unique ID of hero
* @property {typedefs.HeroPosition} position - position of hero in game
* @property {Array<typedefs.HeroAction>} possibleActions - Actions possible on hero
* @memberof typedefs
*
*/
/**
* Possible action for a player
*
* @typedef {"supply" | "pass"} PlayerAction
* @memberof typedefs
*/
/**
* Game state for one player
*
* @typedef {object} PlayerGameState
* @property {string} name - username of this player
* @property {typedefs.Color} color - color of the player
* @property {typedefs.Faction|""} faction - Chosen faction (empty if not playing faction mode)
* @property {Array<number>} draftHeroesIds - Will contain the IDs of the heroes selectable for draft mode
* @property {Array<typedefs.HeroInGame>} twelveHeroes - The 12 Heroes used by player
* @property {number} foodInCamp - Number of food in camp
* @property {number} foodInBattle/left - Food on left battle field
* @property {number} foodInBattle/center - Food on center battle field
* @property {number} foodInBattle/right - Food on right battle field
* @property {Array<object>} actionsPerformed - During military phase it will contain actions made by player to be replayed by other
* @property {Array<typedefs.PlayerAction>} - Actions avalaible for the player
* @memberof typedefs
*
*/
/**
* Store data
*
* @typedef {object} StoreData
* @property {typedefs.GameGlobalState} game - The game global state in store
* @property {typedefs.PlayerGameState} bluePlayer - The game state for blue player
* @property {typedefs.PlayerGameState} redPlayer - The game state for red player
* @memberof typedefs
*/
exports.unused = {};
export const Constants = {
// Server requests status
REQ_IDLE: 'idle',
REQ_REQUESTED: 'requested',
REQ_SUCCESS: 'success',
REQ_ERROR: 'error',
// Positions of heroes in game
/**
* @constant
* @type {typedefs.HeroPosition}
* @default
* @memberof constants
*/
POS_PILE: 'pile',
POS_HAND: 'hand',
POS_DISCARD: 'discard',
POS_CAMP: 'camp',
POS_BATTLE_LEFT: 'battle_left',
POS_BATTLE_CENTER: 'battle_center',
POS_BATTLE_RIGHT: 'battle_right',
// Possible hero actions in game
HERO_RECRUIT: 'recruit',
HERO_DEPLOY: 'deploy',
HERO_MOVE: 'move',
HERO_ABILITY: 'ability',
HERO_DISMISS: 'dismiss',
HERO_DISCARD: 'discard',
HERO_REPLACE: 'replace',
// Possible actions for player in game
PLAYER_SUPPLY: 'supply',
PLAYER_PASS: 'pass'
};
Constants.install = function(Vue) {
Vue.prototype.$types = key => {
return Constants[key];
};
};