Skip to content

@lands.io/mod-sdk / Action

Interface: Action\<T>

Base interface for game actions. Actions encapsulate validation, target selection, and execution creation.

Type parameters

Name Type
T extends ActionTarget = ActionTarget

Implemented by

Table of contents

Properties

Methods

Properties

id

Readonly id: string


label

Readonly label: string

Methods

canActivate

canActivate(context): boolean

Parameters

Name Type
context ActionContext

Returns

boolean


chooseTarget

chooseTarget(context): null | T

Parameters

Name Type
context ActionContext

Returns

null | T


createExecution

createExecution(context, target): Execution

Parameters

Name Type
context ActionContext
target T

Returns

Execution


getCost

getCost(context): number

Parameters

Name Type
context ActionContext

Returns

number


Source Code

View full implementation
/**
 * Base interface for game actions.
 * Actions encapsulate validation, target selection, and execution creation.
 */
export interface Action<T extends ActionTarget = ActionTarget> {
  readonly id: string;
  readonly label: string;

  canActivate(context: ActionContext): boolean;
  chooseTarget(context: ActionContext): T | null;
  createExecution(context: ActionContext, target: T): Execution;
  getCost?(context: ActionContext): number;
}