Skip to content

@lands.io/mod-sdk / BotAttackActionHooks

Interface: BotAttackActionHooks

Hooks for customizing BotAttackAction behavior.

Table of contents

Properties

Properties

chooseNeutralTarget

Optional chooseNeutralTarget: (ctx: ActionContext, target: null | AttackTarget) => null | AttackTarget

Hook for chooseNeutralTarget - receives context and base target

Type declaration

▸ (ctx, target): null | AttackTarget

Parameters
Name Type
ctx ActionContext
target null | AttackTarget
Returns

null | AttackTarget


chooseTarget

Optional chooseTarget: (ctx: ActionContext, target: null | AttackTarget) => null | AttackTarget

Hook for chooseTarget - receives context and base target

Type declaration

▸ (ctx, target): null | AttackTarget

Parameters
Name Type
ctx ActionContext
target null | AttackTarget
Returns

null | AttackTarget


chooseTargetPlayer

Optional chooseTargetPlayer: (ctx: ActionContext, targetPlayer: Player, target: AttackTarget) => AttackTarget

Hook for chooseTargetPlayer - receives context, target player, and base target

Type declaration

▸ (ctx, targetPlayer, target): AttackTarget

Parameters
Name Type
ctx ActionContext
targetPlayer Player
target AttackTarget
Returns

AttackTarget


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


Source Code

View full implementation
/**
 * Hooks for customizing BotAttackAction behavior.
 */
export interface BotAttackActionHooks {
  /** Hook for chooseTarget - receives context and base target */
  chooseTarget?: (
    ctx: ActionContext,
    target: AttackTarget | null
  ) => AttackTarget | null;

  /** Hook for chooseTargetPlayer - receives context, target player, and base target */
  chooseTargetPlayer?: (
    ctx: ActionContext,
    targetPlayer: Player,
    target: AttackTarget
  ) => AttackTarget;

  /** Hook for chooseNeutralTarget - receives context and base target */
  chooseNeutralTarget?: (
    ctx: ActionContext,
    target: AttackTarget | null
  ) => AttackTarget | null;

  /** Hook for getTroops - receives context and base troop count */
  getTroops?: (ctx: ActionContext, troops: number) => number;
}