You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
3.2 KiB
76 lines
3.2 KiB
3 years ago
|
/** The interface for actions that can be selected during battle. This is also used automatically for the Defend and Flee options. */
|
||
|
export interface ActionData {
|
||
|
/** The name that will be displayed in the action list - a Handlebars template. */
|
||
|
readonly nameTemplate: string
|
||
|
/** The help message that will be displayed when this action is selected - a Handlebars template. */
|
||
|
readonly helpMessageTemplate: string
|
||
|
/** The cost of the action - a script expression. The cost of the action is automatically deducted, and need not be deducted by the effect as well. */
|
||
|
readonly costExpression: string
|
||
|
/** Whether the action can currently be used, and if so, how much of the turn it takes up - a script expression. */
|
||
|
readonly speedExpression: string
|
||
|
/** The effect of the action - a sequence of script statements separated by newlines. */
|
||
|
readonly actionEffect: string
|
||
|
}
|
||
|
|
||
|
/** The state of an action, determining its display in the action menu. */
|
||
|
export enum ActionSpeed {
|
||
|
/**
|
||
|
* Fast actions only cost half the user's turn.
|
||
|
* If a Fast action is used at the start of the user's turn, they can use a single Fast or Normal action afterward.
|
||
|
*/
|
||
|
FAST="Fast",
|
||
|
/**
|
||
|
* Normal actions only cost half (or maybe two thirds) of the user's turn.
|
||
|
* If these actions are used on the user's turn, it ends, but they can be used after a Fast action.
|
||
|
*/
|
||
|
NORMAL="Normal",
|
||
|
/**
|
||
|
* Slow actions cost a user's entire turn.
|
||
|
* They can't be used after Fast actions, and the user's turn ends after using them.
|
||
|
*/
|
||
|
SLOW="Slow",
|
||
|
/**
|
||
|
* Disabled actions are shown in the action list, but cannot be used.
|
||
|
*/
|
||
|
DISABLED="Disabled",
|
||
|
/**
|
||
|
* Hidden actions are not shown in the action list and cannot be used.
|
||
|
*/
|
||
|
HIDDEN="Hidden",
|
||
|
}
|
||
|
|
||
|
/** The counters that actions' costs and damage/healing can deduct from. */
|
||
|
export enum Counter {
|
||
|
CONFIDENCE="Confidence",
|
||
|
HEALTH="Health",
|
||
|
STAMINA="Stamina",
|
||
|
ENERGY="Energy",
|
||
|
}
|
||
|
|
||
|
/** The interface for an action's cost. */
|
||
|
export interface ActionCost {
|
||
|
/** The counter that the cost will be deducted from. */
|
||
|
readonly affects: Counter
|
||
|
/**
|
||
|
* The cost, which the counter must be greater than or equal to for the skill to be used, and
|
||
|
* which will be deducted from the counter when it is used.
|
||
|
*/
|
||
|
readonly cost: number
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* The interface for an evaluated action. This saves time recalculating actions on every repaint and avoids cases
|
||
|
* where the cost a user sees before choosing the action is not the same as the cost a user sees when using it.
|
||
|
*/
|
||
|
export interface Action {
|
||
|
/** The data this action originated from. */
|
||
|
readonly data: ActionData
|
||
|
/** The name, with any template variables substituted in. */
|
||
|
readonly name: string
|
||
|
/** The help message, with any template variables substituted in. */
|
||
|
readonly helpMessage: string
|
||
|
/** The cost, which has been evaluated into an optimized set of ActionCost with at most one ActionCost per Counter. */
|
||
|
readonly cost: readonly ActionCost[]
|
||
|
/** The speed of the action, determining when it can be used and what other actions can be used with it. */
|
||
|
readonly speed: ActionSpeed
|
||
|
}
|