@lands.io/mod-sdk / AttackActionHooks
Interface: AttackActionHooks¶
Hooks for customizing AttackAction behavior. Each hook receives the context and the base result, returning a modified result.
Table of contents¶
Properties¶
Properties¶
canActivate¶
• Optional canActivate: (ctx: ActionContext, allowed: boolean) => boolean
Hook for canActivate - receives context and base allowed result
Type declaration¶
▸ (ctx, allowed): boolean
Parameters¶
| Name | Type |
|---|---|
ctx |
ActionContext |
allowed |
boolean |
Returns¶
boolean
createExecution¶
• Optional createExecution: (ctx: ActionContext, target: AttackTarget, execution: Execution) => Execution
Hook for createExecution - receives context, target, and base execution
Type declaration¶
▸ (ctx, target, execution): Execution
Parameters¶
| Name | Type |
|---|---|
ctx |
ActionContext |
target |
AttackTarget |
execution |
Execution |
Returns¶
getBorderEnemies¶
• Optional getBorderEnemies: (ctx: ActionContext, enemies: Player[]) => Player[]
Hook for getBorderEnemies - receives context and base enemies list
Type declaration¶
▸ (ctx, enemies): Player[]
Parameters¶
| Name | Type |
|---|---|
ctx |
ActionContext |
enemies |
Player[] |
Returns¶
Player[]
getTroops¶
• Optional getTroops: (ctx: ActionContext, troops: number) => number
Hook for getTroops - receives context and base troop count
Type declaration¶
▸ (ctx, troops): number
Parameters¶
| Name | Type |
|---|---|
ctx |
ActionContext |
troops |
number |
Returns¶
number
isValidTarget¶
• Optional isValidTarget: (ctx: ActionContext, target: Player, valid: boolean) => boolean
Hook for isValidTarget - receives context, target player, and base validity
Type declaration¶
▸ (ctx, target, valid): boolean
Parameters¶
| Name | Type |
|---|---|
ctx |
ActionContext |
target |
Player |
valid |
boolean |
Returns¶
boolean
Source Code¶
View full implementation
/**
* Hooks for customizing AttackAction behavior.
* Each hook receives the context and the base result, returning a modified result.
*/
export interface AttackActionHooks {
/** Hook for canActivate - receives context and base allowed result */
canActivate?: (ctx: ActionContext, allowed: boolean) => boolean;
/** Hook for createExecution - receives context, target, and base execution */
createExecution?: (
ctx: ActionContext,
target: AttackTarget,
execution: Execution
) => Execution;
/** Hook for isValidTarget - receives context, target player, and base validity */
isValidTarget?: (
ctx: ActionContext,
target: Player,
valid: boolean
) => boolean;
/** Hook for getBorderEnemies - receives context and base enemies list */
getBorderEnemies?: (ctx: ActionContext, enemies: Player[]) => Player[];
/** Hook for getTroops - receives context and base troop count */
getTroops?: (ctx: ActionContext, troops: number) => number;
}