Skip to content

@lands.io/mod-sdk / FakeHumanAttackActionHooks

Interface: FakeHumanAttackActionHooks

Hooks for customizing FakeHumanAttackAction 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


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


shouldAttackPlayer

Optional shouldAttackPlayer: (ctx: ActionContext, target: Player, should: boolean) => boolean

Hook for shouldAttackPlayer - receives context, target player, and base decision

Type declaration

▸ (ctx, target, should): boolean

Parameters
Name Type
ctx ActionContext
target Player
should boolean
Returns

boolean


shouldDiscourageAttack

Optional shouldDiscourageAttack: (ctx: ActionContext, target: Player, discourage: boolean) => boolean

Hook for shouldDiscourageAttack - receives context, target player, and base decision

Type declaration

▸ (ctx, target, discourage): boolean

Parameters
Name Type
ctx ActionContext
target Player
discourage boolean
Returns

boolean


Source Code

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

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

  /** Hook for shouldAttackPlayer - receives context, target player, and base decision */
  shouldAttackPlayer?: (
    ctx: ActionContext,
    target: Player,
    should: boolean
  ) => boolean;

  /** Hook for shouldDiscourageAttack - receives context, target player, and base decision */
  shouldDiscourageAttack?: (
    ctx: ActionContext,
    target: Player,
    discourage: boolean
  ) => boolean;

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