|
|
@ -44,12 +44,12 @@ export interface AIWeights { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface PlayerStartingState extends Pick<PlayerState, 'damageMax' | 'stopCount' | 'failCount'> { |
|
|
|
export interface PlayerStartingState extends Pick<PlayerState, 'damageMax' | 'stopCount' | 'failCount'> { |
|
|
|
// Percentage of damage that this player starts off dealing
|
|
|
|
// Percentage of damage that this player starts off dealing, default 100
|
|
|
|
readonly damageBonusBase: number |
|
|
|
readonly damageBonusBase?: number |
|
|
|
// Percentage of damage this player's damage increases by with each damage bonus earned
|
|
|
|
// Percentage of damage this player's damage increases by with each damage bonus earned, default 10
|
|
|
|
readonly damageBonusIncrement: number |
|
|
|
readonly damageBonusIncrement?: number |
|
|
|
// Maximum number of damage bonuses that this player can have, or 0 if there's no upper limit
|
|
|
|
// Maximum number of damage bonuses that this player can have, or 0 if there's no upper limit
|
|
|
|
readonly maxDamageBonuses: number |
|
|
|
readonly maxDamageBonuses?: number |
|
|
|
|
|
|
|
|
|
|
|
// Minimum number of dice required to stop
|
|
|
|
// Minimum number of dice required to stop
|
|
|
|
readonly minStopCount: number |
|
|
|
readonly minStopCount: number |
|
|
@ -61,20 +61,29 @@ export interface PlayerStartingState extends Pick<PlayerState, 'damageMax' | 'st |
|
|
|
// Maximum number of dice required to fail
|
|
|
|
// Maximum number of dice required to fail
|
|
|
|
readonly maxFailCount: number |
|
|
|
readonly maxFailCount: number |
|
|
|
|
|
|
|
|
|
|
|
// Base amount of damage that must be dealt to recover, or 0 if recovery is forbidden
|
|
|
|
// Base amount of damage that must be dealt on subsequent recoveries to recover, or 0 if recovery is forbidden
|
|
|
|
// Defaults to 1000
|
|
|
|
// Defaults to 1000
|
|
|
|
readonly recoverBase?: number |
|
|
|
readonly recoverBase?: number |
|
|
|
// Amount by which the amount needed to recover increases each time recovery is earned
|
|
|
|
// Amount by which the amount needed to recover increases each time recovery is earned
|
|
|
|
// Defaults to 1000
|
|
|
|
// Defaults to 1000
|
|
|
|
readonly recoverIncrement?: number |
|
|
|
readonly recoverIncrement?: number |
|
|
|
// Percentage of current damage taken that is removed when recovery is earned
|
|
|
|
// Percentage of current damage taken that is removed when recovery is earned the first time
|
|
|
|
// Defaults to 50
|
|
|
|
// Defaults to 50
|
|
|
|
readonly recoverPercent?: number |
|
|
|
readonly recoverPercentBase?: number |
|
|
|
|
|
|
|
// Percentage points to reduce recoverPercent by for each subsequent recovery
|
|
|
|
|
|
|
|
// Defaults to 0
|
|
|
|
|
|
|
|
readonly recoverPercentIncrement?: number |
|
|
|
|
|
|
|
|
|
|
|
// Instructions for if this player is an AI player. If not specified, this player cannot be played by the AI.
|
|
|
|
// Instructions for if this player is an AI player. If not specified, this player cannot be played by the AI.
|
|
|
|
readonly aiData?: AIWeights |
|
|
|
readonly aiData?: AIWeights |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export enum RoundStarter { |
|
|
|
|
|
|
|
LAST_ROUND_LOSER = 'last-round-loser', |
|
|
|
|
|
|
|
LAST_ROUND_WINNER = 'last-round-winner', |
|
|
|
|
|
|
|
ALTERNATE = 'alternate', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface Difficulty { |
|
|
|
export interface Difficulty { |
|
|
|
// Name of the difficulty in the select menu
|
|
|
|
// Name of the difficulty in the select menu
|
|
|
|
readonly name: string |
|
|
|
readonly name: string |
|
|
@ -84,6 +93,8 @@ export interface Difficulty { |
|
|
|
readonly description?: string |
|
|
|
readonly description?: string |
|
|
|
// The player who should start in this difficulty; defaults to random
|
|
|
|
// The player who should start in this difficulty; defaults to random
|
|
|
|
readonly startingPlayer?: PlayerSide | null |
|
|
|
readonly startingPlayer?: PlayerSide | null |
|
|
|
|
|
|
|
// The player who should start a round; defaults to alternate
|
|
|
|
|
|
|
|
readonly roundStarter?: PlayerSide | RoundStarter |
|
|
|
|
|
|
|
|
|
|
|
// Starting values for each character
|
|
|
|
// Starting values for each character
|
|
|
|
readonly stats: { |
|
|
|
readonly stats: { |
|
|
@ -91,14 +102,22 @@ export interface Difficulty { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export enum PlayerTextEvent { |
|
|
|
|
|
|
|
START_GAME = 'start', |
|
|
|
|
|
|
|
START_ROUND = 'round', |
|
|
|
|
|
|
|
ABORT_GAME = 'abort', |
|
|
|
|
|
|
|
WIN_GAME = 'win', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface PlayerText { |
|
|
|
export interface PlayerText { |
|
|
|
// Possible random names for this player
|
|
|
|
// Possible random names for this player; if not given a name will not be suggested
|
|
|
|
readonly names?: readonly string[] |
|
|
|
readonly names?: readonly string[] |
|
|
|
|
|
|
|
|
|
|
|
// Text given at the start of the game from this side
|
|
|
|
readonly events?: { |
|
|
|
readonly startText?: TriggeredText |
|
|
|
readonly [key in ActionTextSide]?: { |
|
|
|
// Text given at the end of the game from this side
|
|
|
|
readonly [key in PlayerTextEvent]?: RenderableText |
|
|
|
readonly endText?: TriggeredText |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// The name of the damage value for this player
|
|
|
|
// The name of the damage value for this player
|
|
|
|
readonly damage: string |
|
|
|
readonly damage: string |
|
|
@ -123,7 +142,7 @@ export interface GameTheme { |
|
|
|
|
|
|
|
|
|
|
|
readonly difficulties: readonly Difficulty[] |
|
|
|
readonly difficulties: readonly Difficulty[] |
|
|
|
|
|
|
|
|
|
|
|
readonly commonText?: { readonly [key: string]: RenderableText | undefined } |
|
|
|
readonly commonText?: { readonly [key: string]: RenderableText } |
|
|
|
|
|
|
|
|
|
|
|
readonly narratorName: string |
|
|
|
readonly narratorName: string |
|
|
|
|
|
|
|
|
|
|
@ -132,13 +151,22 @@ export interface GameTheme { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface TriggeredText { |
|
|
|
export enum ActionTextEvent { |
|
|
|
// The dialogues that can be triggered for this action.
|
|
|
|
SELECTED = 'select', |
|
|
|
// Dialogue can be disabled for characters run by human players.
|
|
|
|
PASSED = 'pass', |
|
|
|
readonly dialogue?: RenderableText |
|
|
|
REROLLED = 'reroll', |
|
|
|
// The descriptions that can be triggered for this action.
|
|
|
|
ROLLED_FAIL = 'rollFail', |
|
|
|
// Descriptions are always displayed, regardless of player.
|
|
|
|
NEAR_FAILED = 'nearFail', |
|
|
|
readonly description?: RenderableText |
|
|
|
ROLLED_LAST_FAIL = 'lastFail', |
|
|
|
|
|
|
|
FAILED = 'fail', |
|
|
|
|
|
|
|
ABANDONED = 'abandon', |
|
|
|
|
|
|
|
LOST_ROUND = 'loseRound', |
|
|
|
|
|
|
|
DEFEATED = 'defeated', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export enum ActionTextSide { |
|
|
|
|
|
|
|
SELF = 'self', |
|
|
|
|
|
|
|
OPPONENT = 'opponent', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface ActionText { |
|
|
|
export interface ActionText { |
|
|
@ -149,34 +177,11 @@ export interface ActionText { |
|
|
|
// Description of the action when selected for this side
|
|
|
|
// Description of the action when selected for this side
|
|
|
|
readonly description: string |
|
|
|
readonly description: string |
|
|
|
|
|
|
|
|
|
|
|
// Text given when this side selects this action.
|
|
|
|
readonly text: { |
|
|
|
readonly selectAction?: TriggeredText |
|
|
|
[side in ActionTextSide]?: { |
|
|
|
// Text given when the other side selects this action.
|
|
|
|
[event in ActionTextEvent]?: RenderableText |
|
|
|
readonly opponentSelectsAction?: TriggeredText |
|
|
|
} |
|
|
|
// Text given when this side finishes a turn in this action without failing.
|
|
|
|
} |
|
|
|
readonly passTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given when this side receives a turn from the opponent in this action.
|
|
|
|
|
|
|
|
readonly opponentPassesTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given when this side rerolls the dice for this action.
|
|
|
|
|
|
|
|
readonly reroll?: TriggeredText |
|
|
|
|
|
|
|
// Text given when the opposing side rerolls the dice for this action.
|
|
|
|
|
|
|
|
readonly opponentRerolls?: TriggeredText |
|
|
|
|
|
|
|
// Text given the first time each turn this side is one fail die away from failing
|
|
|
|
|
|
|
|
readonly aboutToFailTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given the first time each turn the opposing side is one fail die away from failing
|
|
|
|
|
|
|
|
readonly opponentAboutToFailTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given when this side fails the turn by accumulating fail dice
|
|
|
|
|
|
|
|
readonly failTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given when the opposing side fails the turn by accumulating fail dice
|
|
|
|
|
|
|
|
readonly opponentFailsTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given when this side fails the turn by stopping without enough points
|
|
|
|
|
|
|
|
readonly abandonTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given when the opposing side fails the turn by stopping without enough points
|
|
|
|
|
|
|
|
readonly opponentAbandonsTurn?: TriggeredText |
|
|
|
|
|
|
|
// Text given when this side is defeated by being pushed over their max damage with this action
|
|
|
|
|
|
|
|
readonly defeated?: TriggeredText |
|
|
|
|
|
|
|
// Text given when this side defeats the opponent by pushing them over their max damage with this action
|
|
|
|
|
|
|
|
readonly opponentDefeated?: TriggeredText |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface GameAction { |
|
|
|
export interface GameAction { |
|
|
@ -188,15 +193,13 @@ export interface GameAction { |
|
|
|
// The dice that are rolled for this action
|
|
|
|
// The dice that are rolled for this action
|
|
|
|
readonly dice: readonly DieType[] |
|
|
|
readonly dice: readonly DieType[] |
|
|
|
// True if the loser of this action increases the amount of damage they take
|
|
|
|
// True if the loser of this action increases the amount of damage they take
|
|
|
|
readonly givesDamageBonus: boolean |
|
|
|
readonly givesDamageBonus?: boolean |
|
|
|
// True if the loser of this action has to get an additional stop die to end their turn
|
|
|
|
// True if the loser of this action has to get an additional stop die to end their turn
|
|
|
|
readonly givesStopCount: boolean |
|
|
|
readonly givesStopCount?: boolean |
|
|
|
// True if the loser of this action has one fewer buffer for fail dice
|
|
|
|
// True if the loser of this action has one fewer buffer for fail dice
|
|
|
|
readonly givesFailCount: boolean |
|
|
|
readonly givesFailCount?: boolean |
|
|
|
// Whether this action can end the game in a loss for the top
|
|
|
|
// Whether this action can end the game in a loss for the loser of this action
|
|
|
|
readonly canFinishTop: boolean |
|
|
|
readonly canFinish?: boolean |
|
|
|
// Whether this action can end the game in a loss for the bottom
|
|
|
|
|
|
|
|
readonly canFinishBottom: boolean |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export enum PlayerSide { |
|
|
|
export enum PlayerSide { |
|
|
@ -204,6 +207,15 @@ export enum PlayerSide { |
|
|
|
BOTTOM = 'bottom', |
|
|
|
BOTTOM = 'bottom', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function oppositePlayer(side: PlayerSide): PlayerSide { |
|
|
|
|
|
|
|
switch (side) { |
|
|
|
|
|
|
|
case PlayerSide.BOTTOM: |
|
|
|
|
|
|
|
return PlayerSide.TOP |
|
|
|
|
|
|
|
case PlayerSide.TOP: |
|
|
|
|
|
|
|
return PlayerSide.BOTTOM |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface PlayerState { |
|
|
|
export interface PlayerState { |
|
|
|
// This player's name
|
|
|
|
// This player's name
|
|
|
|
readonly name: string |
|
|
|
readonly name: string |
|
|
@ -246,8 +258,10 @@ export interface GameState { |
|
|
|
|
|
|
|
|
|
|
|
// The current phase of the game.
|
|
|
|
// The current phase of the game.
|
|
|
|
readonly gamePhase: GamePhase |
|
|
|
readonly gamePhase: GamePhase |
|
|
|
// The owner of the current phase, or null if the phase is Aborted
|
|
|
|
// The owner of the current phase
|
|
|
|
readonly phaseOwner: PlayerSide | null |
|
|
|
readonly phaseOwner: PlayerSide |
|
|
|
|
|
|
|
// The initiator of the current round
|
|
|
|
|
|
|
|
readonly roundOwner: PlayerSide |
|
|
|
|
|
|
|
|
|
|
|
// The state of each player in the game.
|
|
|
|
// The state of each player in the game.
|
|
|
|
readonly players: { |
|
|
|
readonly players: { |
|
|
@ -265,8 +279,8 @@ export interface GameState { |
|
|
|
readonly lastRoll: readonly DieResult[] |
|
|
|
readonly lastRoll: readonly DieResult[] |
|
|
|
// The total value of the selected dice, or 0 if the selected dice cannot be scored.
|
|
|
|
// The total value of the selected dice, or 0 if the selected dice cannot be scored.
|
|
|
|
readonly selectedDiceValue: number |
|
|
|
readonly selectedDiceValue: number |
|
|
|
// Whether the selected dice are sufficient to end the turn.
|
|
|
|
// Whether the current dice are sufficient to end the turn.
|
|
|
|
readonly selectedDiceEndTurn: boolean |
|
|
|
readonly currentDiceEndTurn: boolean |
|
|
|
// The number of dice that have come up failures so far in the current turn, including the lastRoll.
|
|
|
|
// The number of dice that have come up failures so far in the current turn, including the lastRoll.
|
|
|
|
readonly countedFails: number |
|
|
|
readonly countedFails: number |
|
|
|
// The total of the dice that have been scored so far this turn
|
|
|
|
// The total of the dice that have been scored so far this turn
|
|
|
|