|
|
|
@ -44,12 +44,12 @@ export interface AIWeights { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface PlayerStartingState extends Pick<PlayerState, 'damageMax' | 'stopCount' | 'failCount'> { |
|
|
|
|
// Percentage of damage that this player starts off dealing
|
|
|
|
|
readonly damageBonusBase: number |
|
|
|
|
// Percentage of damage this player's damage increases by with each damage bonus earned
|
|
|
|
|
readonly damageBonusIncrement: number |
|
|
|
|
// Percentage of damage that this player starts off dealing, default 100
|
|
|
|
|
readonly damageBonusBase?: number |
|
|
|
|
// Percentage of damage this player's damage increases by with each damage bonus earned, default 10
|
|
|
|
|
readonly damageBonusIncrement?: number |
|
|
|
|
// 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
|
|
|
|
|
readonly minStopCount: number |
|
|
|
@ -61,20 +61,29 @@ export interface PlayerStartingState extends Pick<PlayerState, 'damageMax' | 'st |
|
|
|
|
// Maximum number of dice required to fail
|
|
|
|
|
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
|
|
|
|
|
readonly recoverBase?: number |
|
|
|
|
// Amount by which the amount needed to recover increases each time recovery is earned
|
|
|
|
|
// Defaults to 1000
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
readonly aiData?: AIWeights |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export enum RoundStarter { |
|
|
|
|
LAST_ROUND_LOSER = 'last-round-loser', |
|
|
|
|
LAST_ROUND_WINNER = 'last-round-winner', |
|
|
|
|
ALTERNATE = 'alternate', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface Difficulty { |
|
|
|
|
// Name of the difficulty in the select menu
|
|
|
|
|
readonly name: string |
|
|
|
@ -84,6 +93,8 @@ export interface Difficulty { |
|
|
|
|
readonly description?: string |
|
|
|
|
// The player who should start in this difficulty; defaults to random
|
|
|
|
|
readonly startingPlayer?: PlayerSide | null |
|
|
|
|
// The player who should start a round; defaults to alternate
|
|
|
|
|
readonly roundStarter?: PlayerSide | RoundStarter |
|
|
|
|
|
|
|
|
|
// Starting values for each character
|
|
|
|
|
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 { |
|
|
|
|
// 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[] |
|
|
|
|
|
|
|
|
|
// Text given at the start of the game from this side
|
|
|
|
|
readonly startText?: TriggeredText |
|
|
|
|
// Text given at the end of the game from this side
|
|
|
|
|
readonly endText?: TriggeredText |
|
|
|
|
readonly events?: { |
|
|
|
|
readonly [key in ActionTextSide]?: { |
|
|
|
|
readonly [key in PlayerTextEvent]?: RenderableText |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// The name of the damage value for this player
|
|
|
|
|
readonly damage: string |
|
|
|
@ -123,7 +142,7 @@ export interface GameTheme { |
|
|
|
|
|
|
|
|
|
readonly difficulties: readonly Difficulty[] |
|
|
|
|
|
|
|
|
|
readonly commonText?: { readonly [key: string]: RenderableText | undefined } |
|
|
|
|
readonly commonText?: { readonly [key: string]: RenderableText } |
|
|
|
|
|
|
|
|
|
readonly narratorName: string |
|
|
|
|
|
|
|
|
@ -132,13 +151,22 @@ export interface GameTheme { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface TriggeredText { |
|
|
|
|
// The dialogues that can be triggered for this action.
|
|
|
|
|
// Dialogue can be disabled for characters run by human players.
|
|
|
|
|
readonly dialogue?: RenderableText |
|
|
|
|
// The descriptions that can be triggered for this action.
|
|
|
|
|
// Descriptions are always displayed, regardless of player.
|
|
|
|
|
readonly description?: RenderableText |
|
|
|
|
export enum ActionTextEvent { |
|
|
|
|
SELECTED = 'select', |
|
|
|
|
PASSED = 'pass', |
|
|
|
|
REROLLED = 'reroll', |
|
|
|
|
ROLLED_FAIL = 'rollFail', |
|
|
|
|
NEAR_FAILED = 'nearFail', |
|
|
|
|
ROLLED_LAST_FAIL = 'lastFail', |
|
|
|
|
FAILED = 'fail', |
|
|
|
|
ABANDONED = 'abandon', |
|
|
|
|
LOST_ROUND = 'loseRound', |
|
|
|
|
DEFEATED = 'defeated', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export enum ActionTextSide { |
|
|
|
|
SELF = 'self', |
|
|
|
|
OPPONENT = 'opponent', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface ActionText { |
|
|
|
@ -149,34 +177,11 @@ export interface ActionText { |
|
|
|
|
// Description of the action when selected for this side
|
|
|
|
|
readonly description: string |
|
|
|
|
|
|
|
|
|
// Text given when this side selects this action.
|
|
|
|
|
readonly selectAction?: TriggeredText |
|
|
|
|
// Text given when the other side selects this action.
|
|
|
|
|
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 |
|
|
|
|
readonly text: { |
|
|
|
|
[side in ActionTextSide]?: { |
|
|
|
|
[event in ActionTextEvent]?: RenderableText |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export interface GameAction { |
|
|
|
@ -188,15 +193,13 @@ export interface GameAction { |
|
|
|
|
// The dice that are rolled for this action
|
|
|
|
|
readonly dice: readonly DieType[] |
|
|
|
|
// 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
|
|
|
|
|
readonly givesStopCount: boolean |
|
|
|
|
readonly givesStopCount?: boolean |
|
|
|
|
// True if the loser of this action has one fewer buffer for fail dice
|
|
|
|
|
readonly givesFailCount: boolean |
|
|
|
|
// Whether this action can end the game in a loss for the top
|
|
|
|
|
readonly canFinishTop: boolean |
|
|
|
|
// Whether this action can end the game in a loss for the bottom
|
|
|
|
|
readonly canFinishBottom: boolean |
|
|
|
|
readonly givesFailCount?: boolean |
|
|
|
|
// Whether this action can end the game in a loss for the loser of this action
|
|
|
|
|
readonly canFinish?: boolean |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export enum PlayerSide { |
|
|
|
@ -204,6 +207,15 @@ export enum PlayerSide { |
|
|
|
|
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 { |
|
|
|
|
// This player's name
|
|
|
|
|
readonly name: string |
|
|
|
@ -246,8 +258,10 @@ export interface GameState { |
|
|
|
|
|
|
|
|
|
// The current phase of the game.
|
|
|
|
|
readonly gamePhase: GamePhase |
|
|
|
|
// The owner of the current phase, or null if the phase is Aborted
|
|
|
|
|
readonly phaseOwner: PlayerSide | null |
|
|
|
|
// The owner of the current phase
|
|
|
|
|
readonly phaseOwner: PlayerSide |
|
|
|
|
// The initiator of the current round
|
|
|
|
|
readonly roundOwner: PlayerSide |
|
|
|
|
|
|
|
|
|
// The state of each player in the game.
|
|
|
|
|
readonly players: { |
|
|
|
@ -265,8 +279,8 @@ export interface GameState { |
|
|
|
|
readonly lastRoll: readonly DieResult[] |
|
|
|
|
// The total value of the selected dice, or 0 if the selected dice cannot be scored.
|
|
|
|
|
readonly selectedDiceValue: number |
|
|
|
|
// Whether the selected dice are sufficient to end the turn.
|
|
|
|
|
readonly selectedDiceEndTurn: boolean |
|
|
|
|
// Whether the current dice are sufficient to end the turn.
|
|
|
|
|
readonly currentDiceEndTurn: boolean |
|
|
|
|
// The number of dice that have come up failures so far in the current turn, including the lastRoll.
|
|
|
|
|
readonly countedFails: number |
|
|
|
|
// The total of the dice that have been scored so far this turn
|
|
|
|
|