MCPcopy
hub / github.com/FreezingMoon/AncientBeast / UnitBotStrategy

Interface UnitBotStrategy

src/bot.ts:36–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 * Return `undefined` from any hook to fall back to the generic logic.
35 */
36export interface UnitBotStrategy {
37 /** Override move-hex scoring for a non-retreating creature. */
38 scoreMoveHex?(hex: Hex, controller: BotController): number | undefined;
39 /**
40 * Override ability-hex scoring for a specific ability slot.
41 * @param abilityIndex The index of the ability currently being queried (0–3).
42 */
43 scoreAbilityHex?(hex: Hex, abilityIndex: number, controller: BotController): number | undefined;
44 /**
45 * Optional minimum score threshold for selecting a queried ability target hex.
46 * If the best reachable target scores below this value, the bot skips that
47 * ability for the current turn and continues planning.
48 */
49 getAbilityMinScore?(
50 creature: Creature,
51 abilityIndex: number,
52 controller: BotController,
53 ): number | undefined;
54 /** Override the retreat health/energy threshold check. */
55 isRetreating?(creature: Creature, controller: BotController): boolean | undefined;
56 /** Override the preferred board-x position for zone scoring. */
57 getPreferredX?(creature: Creature, controller: BotController): number | undefined;
58 /**
59 * Return ability slot indices in the desired try-order for this turn.
60 * Slots not listed are never tried; the generic guards (used, failed,
61 * require) still apply per slot.
62 */
63 getAbilityPriority?(creature: Creature, controller: BotController): number[];
64 /**
65 * Declares how dangerous it is for an attacker to use a given ability
66 * against this unit. Implemented by the TARGET unit's strategy file so
67 * that any attacker can query retaliation/debuff risk without knowing the
68 * specifics of other units.
69 *
70 * Return a negative score modifier (e.g. -300 for lethal retaliation) or
71 * 0 if there is no special danger. The caller adds this to its base score.
72 *
73 * @param attacker The creature about to attack.
74 * @param target This unit (the one being attacked).
75 * @param abilityIndex The attacker's ability slot being used.
76 * @param controller The shared BotController instance.
77 */
78 getTargetingPenalty?(
79 attacker: Creature,
80 target: Creature,
81 abilityIndex: number,
82 controller: BotController,
83 ): number;
84 /**
85 * Optional target-owned score modifier for opponents attacking this unit.
86 * Unlike `getTargetingPenalty`, this may return positive or negative values.
87 */
88 getCounterTargetingModifier?(
89 attacker: Creature,
90 target: Creature,
91 abilityIndex: number,
92 controller: BotController,
93 ): number;

Callers 40

scoreMoveHexMethod · 0.65
bot.tsFile · 0.65
scoreAbilityHexMethod · 0.65
bot.tsFile · 0.65
isRetreatingMethod · 0.65
scoreMoveHexFunction · 0.65
scoreMoveHexFunction · 0.65
scoreMoveHexFunction · 0.65
scoreMoveHexFunction · 0.65
scoreMoveHexFunction · 0.65
scoreMoveHexFunction · 0.65

Calls

no outgoing calls

Tested by

no test coverage detected