@bct-app/game-engine 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,16 @@
1
- import { TPlayer, TOperation, TAbility, TPopulatedCharacter, TTimeline, TEffect, TPlayerReminder, TReminder } from '@bct-app/game-model';
1
+ import { TPlayer, TOperation, TAbility, TPopulatedCharacter, TTimeline, TTriggerEvent, TEffect, TPlayerReminder, TReminder } from '@bct-app/game-model';
2
+
3
+ type TLifetimeStatusResolver = (input: {
4
+ player: TPlayer;
5
+ status: 'POISONED' | 'DRUNK' | 'HEALTHY';
6
+ }) => boolean;
7
+ type TLifetimeCustomResolver = (input: {
8
+ key: string;
9
+ payload?: unknown;
10
+ effector: TPlayer | undefined;
11
+ target?: TPlayer;
12
+ snapshotSeatMap: Map<number, TPlayer>;
13
+ }) => boolean;
2
14
 
3
15
  type TApplyOperationToPlayersArgs = {
4
16
  players: TPlayer[];
@@ -7,15 +19,29 @@ type TApplyOperationToPlayersArgs = {
7
19
  characters: TPopulatedCharacter[];
8
20
  timelines: TTimeline[];
9
21
  timelineIndexAtNow?: number;
22
+ statusResolver?: TLifetimeStatusResolver;
23
+ customResolver?: TLifetimeCustomResolver;
10
24
  };
11
- declare const applyOperationToPlayers: ({ players, operations, allAbilities, characters, timelines, timelineIndexAtNow, }: TApplyOperationToPlayersArgs) => TPlayer[];
25
+ declare const applyOperationToPlayers: ({ players, operations, allAbilities, characters, timelines, timelineIndexAtNow, statusResolver, customResolver, }: TApplyOperationToPlayersArgs) => TPlayer[];
12
26
 
27
+ type TTriggerEventContext = {
28
+ event: TTriggerEvent;
29
+ actorSeat?: number;
30
+ targetSeat?: number;
31
+ payload?: Record<string, unknown>;
32
+ };
13
33
  type TCanInvokeAbilityArgs = {
14
34
  ability: TAbility;
15
35
  effector: TPlayer | undefined;
16
36
  currentTimelineIdx: number;
17
37
  timelines: TTimeline[];
18
38
  priorOperations?: TOperation[];
39
+ players?: TPlayer[];
40
+ event?: TTriggerEventContext;
41
+ customConditionResolver?: (condition: {
42
+ key: string;
43
+ value?: unknown;
44
+ }) => boolean;
19
45
  };
20
46
  type TCanInvokeAbilityResult = {
21
47
  allowed: true;
@@ -23,7 +49,7 @@ type TCanInvokeAbilityResult = {
23
49
  allowed: false;
24
50
  reason: string;
25
51
  };
26
- declare const canInvokeAbility: ({ ability, effector, currentTimelineIdx, timelines, priorOperations, }: TCanInvokeAbilityArgs) => TCanInvokeAbilityResult;
52
+ declare const canInvokeAbility: ({ ability, effector, currentTimelineIdx, timelines, priorOperations, players, event, customConditionResolver, }: TCanInvokeAbilityArgs) => TCanInvokeAbilityResult;
27
53
 
28
54
  declare const transformEmptyArray: <T>(arr: T[]) => T[];
29
55
  declare const copyPlayers: (players: TPlayer[]) => TPlayer[];
package/dist/index.d.ts CHANGED
@@ -1,4 +1,16 @@
1
- import { TPlayer, TOperation, TAbility, TPopulatedCharacter, TTimeline, TEffect, TPlayerReminder, TReminder } from '@bct-app/game-model';
1
+ import { TPlayer, TOperation, TAbility, TPopulatedCharacter, TTimeline, TTriggerEvent, TEffect, TPlayerReminder, TReminder } from '@bct-app/game-model';
2
+
3
+ type TLifetimeStatusResolver = (input: {
4
+ player: TPlayer;
5
+ status: 'POISONED' | 'DRUNK' | 'HEALTHY';
6
+ }) => boolean;
7
+ type TLifetimeCustomResolver = (input: {
8
+ key: string;
9
+ payload?: unknown;
10
+ effector: TPlayer | undefined;
11
+ target?: TPlayer;
12
+ snapshotSeatMap: Map<number, TPlayer>;
13
+ }) => boolean;
2
14
 
3
15
  type TApplyOperationToPlayersArgs = {
4
16
  players: TPlayer[];
@@ -7,15 +19,29 @@ type TApplyOperationToPlayersArgs = {
7
19
  characters: TPopulatedCharacter[];
8
20
  timelines: TTimeline[];
9
21
  timelineIndexAtNow?: number;
22
+ statusResolver?: TLifetimeStatusResolver;
23
+ customResolver?: TLifetimeCustomResolver;
10
24
  };
11
- declare const applyOperationToPlayers: ({ players, operations, allAbilities, characters, timelines, timelineIndexAtNow, }: TApplyOperationToPlayersArgs) => TPlayer[];
25
+ declare const applyOperationToPlayers: ({ players, operations, allAbilities, characters, timelines, timelineIndexAtNow, statusResolver, customResolver, }: TApplyOperationToPlayersArgs) => TPlayer[];
12
26
 
27
+ type TTriggerEventContext = {
28
+ event: TTriggerEvent;
29
+ actorSeat?: number;
30
+ targetSeat?: number;
31
+ payload?: Record<string, unknown>;
32
+ };
13
33
  type TCanInvokeAbilityArgs = {
14
34
  ability: TAbility;
15
35
  effector: TPlayer | undefined;
16
36
  currentTimelineIdx: number;
17
37
  timelines: TTimeline[];
18
38
  priorOperations?: TOperation[];
39
+ players?: TPlayer[];
40
+ event?: TTriggerEventContext;
41
+ customConditionResolver?: (condition: {
42
+ key: string;
43
+ value?: unknown;
44
+ }) => boolean;
19
45
  };
20
46
  type TCanInvokeAbilityResult = {
21
47
  allowed: true;
@@ -23,7 +49,7 @@ type TCanInvokeAbilityResult = {
23
49
  allowed: false;
24
50
  reason: string;
25
51
  };
26
- declare const canInvokeAbility: ({ ability, effector, currentTimelineIdx, timelines, priorOperations, }: TCanInvokeAbilityArgs) => TCanInvokeAbilityResult;
52
+ declare const canInvokeAbility: ({ ability, effector, currentTimelineIdx, timelines, priorOperations, players, event, customConditionResolver, }: TCanInvokeAbilityArgs) => TCanInvokeAbilityResult;
27
53
 
28
54
  declare const transformEmptyArray: <T>(arr: T[]) => T[];
29
55
  declare const copyPlayers: (players: TPlayer[]) => TPlayer[];