@my-swu/simulator-client / isSingleTargetPlan
Function: isSingleTargetPlan()
isSingleTargetPlan(
groups):boolean
Defined in: packages/ts-sdk/src/actionable.ts:72
Whether a plan is exactly one mandatory pick.
That is the shape the engine synthesises for an ability with no structured clauses but with candidate targets, and it is the only plan a client can resolve from a single selection: one group, min and max both 1. An optional pick (min: 0) or a multi-target group still needs an explicit submit step.
Example:
ts
import {
createSimulatorClient,
isSingleTargetPlan,
targetGroupsOf,
} from '@my-swu/simulator-client'
// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const matchSnapshot = await simulatorClient.matches.get('match_123')
// One mandatory pick resolves from a single click; an optional or
// multi-target plan still needs an explicit submit step.
const [pendingAbility] = matchSnapshot.pendingAbilities
console.log(isSingleTargetPlan(targetGroupsOf(pendingAbility)))Parameters
groups
Example:
ts
import {
createSimulatorClient,
isSingleTargetPlan,
targetGroupsOf,
} from '@my-swu/simulator-client'
// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const matchSnapshot = await simulatorClient.matches.get('match_123')
// One mandatory pick resolves from a single click; an optional or
// multi-target plan still needs an explicit submit step.
const [pendingAbility] = matchSnapshot.pendingAbilities
console.log(isSingleTargetPlan(targetGroupsOf(pendingAbility)))readonly TargetSelectionGroup[] | null | undefined
Groups from targetGroupsOf, or a nullish value.
Returns
boolean
