@gamepark/rules-api 6.0.10-alpha.0 → 6.1.0

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.
Files changed (76) hide show
  1. package/dist/UnpredictableMove.d.ts +0 -8
  2. package/dist/UnpredictableMove.js +1 -39
  3. package/dist/UnpredictableMove.js.map +1 -1
  4. package/dist/material/HiddenMaterialRules.js +1 -1
  5. package/dist/material/HiddenMaterialRules.js.map +1 -1
  6. package/dist/material/MaterialGame.d.ts +2 -0
  7. package/dist/material/MaterialGameSetup.d.ts +1 -0
  8. package/dist/material/MaterialGameSetup.js +22 -0
  9. package/dist/material/MaterialGameSetup.js.map +1 -1
  10. package/dist/material/MaterialRules.d.ts +4 -2
  11. package/dist/material/MaterialRules.js +16 -7
  12. package/dist/material/MaterialRules.js.map +1 -1
  13. package/dist/material/items/Material.d.ts +7 -4
  14. package/dist/material/items/Material.js +28 -14
  15. package/dist/material/items/Material.js.map +1 -1
  16. package/dist/material/moves/CustomMove.d.ts +2 -1
  17. package/dist/material/moves/CustomMove.js +6 -4
  18. package/dist/material/moves/CustomMove.js.map +1 -1
  19. package/dist/material/moves/items/CreateItem.d.ts +2 -1
  20. package/dist/material/moves/items/CreateItem.js +9 -3
  21. package/dist/material/moves/items/CreateItem.js.map +1 -1
  22. package/dist/material/moves/items/DeleteItem.d.ts +2 -1
  23. package/dist/material/moves/items/DeleteItem.js +9 -3
  24. package/dist/material/moves/items/DeleteItem.js.map +1 -1
  25. package/dist/material/moves/items/MoveItem.d.ts +4 -2
  26. package/dist/material/moves/items/MoveItem.js +17 -5
  27. package/dist/material/moves/items/MoveItem.js.map +1 -1
  28. package/dist/material/moves/items/Shuffle.d.ts +2 -1
  29. package/dist/material/moves/items/Shuffle.js +9 -3
  30. package/dist/material/moves/items/Shuffle.js.map +1 -1
  31. package/dist/material/moves/local/CloseTutorialPopup.d.ts +8 -0
  32. package/dist/material/moves/local/CloseTutorialPopup.js +10 -0
  33. package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -0
  34. package/dist/material/moves/local/DisplayRules.d.ts +2 -2
  35. package/dist/material/moves/local/DisplayRules.js +1 -2
  36. package/dist/material/moves/local/DisplayRules.js.map +1 -1
  37. package/dist/material/moves/local/LocalMove.d.ts +4 -2
  38. package/dist/material/moves/local/LocalMove.js +1 -0
  39. package/dist/material/moves/local/LocalMove.js.map +1 -1
  40. package/dist/material/moves/local/index.d.ts +1 -0
  41. package/dist/material/moves/local/index.js +1 -0
  42. package/dist/material/moves/local/index.js.map +1 -1
  43. package/dist/material/moves/rules/EndPlayerTurn.d.ts +7 -0
  44. package/dist/material/moves/rules/EndPlayerTurn.js +10 -0
  45. package/dist/material/moves/rules/EndPlayerTurn.js.map +1 -0
  46. package/dist/material/moves/rules/RuleMove.d.ts +5 -3
  47. package/dist/material/moves/rules/RuleMove.js +2 -2
  48. package/dist/material/moves/rules/RuleMove.js.map +1 -1
  49. package/dist/material/moves/rules/StartRule.d.ts +1 -2
  50. package/dist/material/moves/rules/StartRule.js.map +1 -1
  51. package/dist/material/moves/rules/StartSimultaneousRule.d.ts +10 -0
  52. package/dist/material/moves/rules/StartSimultaneousRule.js +10 -0
  53. package/dist/material/moves/rules/StartSimultaneousRule.js.map +1 -0
  54. package/dist/material/moves/rules/StartSimultanousRule.d.ts +10 -0
  55. package/dist/material/moves/rules/StartSimultanousRule.js +10 -0
  56. package/dist/material/moves/rules/StartSimultanousRule.js.map +1 -0
  57. package/dist/material/moves/rules/index.d.ts +3 -1
  58. package/dist/material/moves/rules/index.js +3 -1
  59. package/dist/material/moves/rules/index.js.map +1 -1
  60. package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +4 -2
  61. package/dist/material/rules/MaterialRulesMovesBuilder.js +18 -3
  62. package/dist/material/rules/MaterialRulesMovesBuilder.js.map +1 -1
  63. package/dist/material/rules/MaterialRulesPart.d.ts +3 -4
  64. package/dist/material/rules/MaterialRulesPart.js +7 -4
  65. package/dist/material/rules/MaterialRulesPart.js.map +1 -1
  66. package/dist/material/rules/PlayerTurnRule.d.ts +1 -2
  67. package/dist/material/rules/PlayerTurnRule.js +2 -5
  68. package/dist/material/rules/PlayerTurnRule.js.map +1 -1
  69. package/dist/material/rules/RuleStep.d.ts +1 -0
  70. package/dist/material/rules/SimultaneousRule.d.ts +7 -0
  71. package/dist/material/rules/SimultaneousRule.js +39 -0
  72. package/dist/material/rules/SimultaneousRule.js.map +1 -0
  73. package/dist/material/rules/index.d.ts +3 -1
  74. package/dist/material/rules/index.js +3 -1
  75. package/dist/material/rules/index.js.map +1 -1
  76. package/package.json +2 -2
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCloseTutorialPopup = void 0;
4
+ var MoveKind_1 = require("../MoveKind");
5
+ var LocalMove_1 = require("./LocalMove");
6
+ function isCloseTutorialPopup(move) {
7
+ return move.kind === MoveKind_1.MoveKind.LocalMove && move.type === LocalMove_1.LocalMoveType.CloseTutorialPopup;
8
+ }
9
+ exports.isCloseTutorialPopup = isCloseTutorialPopup;
10
+ //# sourceMappingURL=CloseTutorialPopup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloseTutorialPopup.js","sourceRoot":"","sources":["../../../../src/material/moves/local/CloseTutorialPopup.ts"],"names":[],"mappings":";;;AAAA,wCAAsC;AACtC,yCAA2C;AAQ3C,SAAgB,oBAAoB,CAAC,IAAkB;IACrD,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,yBAAa,CAAC,kBAAkB,CAAA;AAC3F,CAAC;AAFD,oDAEC"}
@@ -10,7 +10,7 @@ export declare enum RulesDisplayType {
10
10
  export declare type MaterialRulesDisplay<P extends number = number, M extends number = number, L extends number = number> = {
11
11
  type: typeof RulesDisplayType.Material;
12
12
  itemType: M;
13
- itemIndex: number;
13
+ itemIndex?: number;
14
14
  item: Partial<MaterialItem<P, L>>;
15
15
  };
16
16
  export declare type LocationRulesDisplay<P extends number = number, L extends number = number> = {
@@ -23,7 +23,7 @@ export declare type DisplayRules<P extends number = number, M extends number = n
23
23
  rulesDisplay: RulesDisplay<P, M, L>;
24
24
  };
25
25
  export declare const displayRules: <P extends number = number, M extends number = number, L extends number = number>(rulesDisplay: RulesDisplay<P, M, L>) => DisplayRules<P, M, L>;
26
- export declare const displayMaterialRules: <P extends number = number, M extends number = number, L extends number = number>(itemType: M, itemIndex?: number, item?: Partial<MaterialItem<P, L, any>>) => DisplayRules<P, M, L>;
26
+ export declare const displayMaterialRules: <P extends number = number, M extends number = number, L extends number = number>(itemType: M, item?: Partial<MaterialItem<P, L, any>>, itemIndex?: number) => DisplayRules<P, M, L>;
27
27
  export declare const displayLocationRules: <P extends number = number, M extends number = number, L extends number = number>(location: Location<P, L, any>) => DisplayRules<P, M, L>;
28
28
  export declare type CloseRulesDisplay = {
29
29
  kind: MoveKind.LocalMove;
@@ -12,8 +12,7 @@ var displayRules = function (rulesDisplay) {
12
12
  return ({ kind: MoveKind_1.MoveKind.LocalMove, type: LocalMove_1.LocalMoveType.DisplayRules, rulesDisplay: rulesDisplay });
13
13
  };
14
14
  exports.displayRules = displayRules;
15
- var displayMaterialRules = function (itemType, itemIndex, item) {
16
- if (itemIndex === void 0) { itemIndex = 0; }
15
+ var displayMaterialRules = function (itemType, item, itemIndex) {
17
16
  if (item === void 0) { item = {}; }
18
17
  return (0, exports.displayRules)({ type: RulesDisplayType.Material, itemType: itemType, itemIndex: itemIndex, item: item });
19
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayRules.js","sourceRoot":"","sources":["../../../../src/material/moves/local/DisplayRules.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAC3C,wCAAsC;AAQtC,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,+DAAY,CAAA;IAAE,+DAAQ,CAAA;AACxB,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB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AAC,YAAY,EAAE,YAAY,cAAA,EAAE,CAAC;AAA9E,CAA8E,CAAA;AAFnE,QAAA,YAAY,gBAEuD;AAEzE,IAAM,oBAAoB,GAAG,UACnC,QAAW,EAAE,IAAsC,EAAE,SAAkB;IAA1D,qBAAA,EAAA,SAAsC;IAClD,OAAA,IAAA,oBAAY,EAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,UAAA,EAAE,SAAS,WAAA,EAAE,IAAI,MAAA,EAAE,CAAC;AAA5E,CAA4E,CAAA;AAFjE,QAAA,oBAAoB,wBAE6C;AAEvE,IAAM,oBAAoB,GAAG,UACnC,QAAwB;IACvB,OAAA,IAAA,oBAAY,EAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,UAAA,EAAE,CAAC;AAA3D,CAA2D,CAAA;AAFhD,QAAA,oBAAoB,wBAE4B;AAOhD,QAAA,iBAAiB,GAAsB,EAAE,IAAI,EAAE,mBAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,yBAAa,CAAC,iBAAiB,EAAE,CAAA"}
@@ -1,10 +1,12 @@
1
1
  import { CloseRulesDisplay, DisplayRules } from './DisplayRules';
2
2
  import { DropItem } from './DropItem';
3
3
  import { SetTutorialStep } from './SetTutorialStep';
4
- export declare type LocalMove<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> = DisplayRules<Player, MaterialType, LocationType> | CloseRulesDisplay | DropItem<MaterialType> | SetTutorialStep;
4
+ import { CloseTutorialPopup } from './CloseTutorialPopup';
5
+ export declare type LocalMove<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> = DisplayRules<Player, MaterialType, LocationType> | CloseRulesDisplay | DropItem<MaterialType> | SetTutorialStep | CloseTutorialPopup;
5
6
  export declare enum LocalMoveType {
6
7
  DisplayRules = 0,
7
8
  CloseRulesDisplay = 1,
8
9
  DropItem = 2,
9
- SetTutorialStep = 3
10
+ SetTutorialStep = 3,
11
+ CloseTutorialPopup = 4
10
12
  }
@@ -7,5 +7,6 @@ var LocalMoveType;
7
7
  LocalMoveType[LocalMoveType["CloseRulesDisplay"] = 1] = "CloseRulesDisplay";
8
8
  LocalMoveType[LocalMoveType["DropItem"] = 2] = "DropItem";
9
9
  LocalMoveType[LocalMoveType["SetTutorialStep"] = 3] = "SetTutorialStep";
10
+ LocalMoveType[LocalMoveType["CloseTutorialPopup"] = 4] = "CloseTutorialPopup";
10
11
  })(LocalMoveType = exports.LocalMoveType || (exports.LocalMoveType = {}));
11
12
  //# sourceMappingURL=LocalMove.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalMove.js","sourceRoot":"","sources":["../../../../src/material/moves/local/LocalMove.ts"],"names":[],"mappings":";;;AAUA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,iEAAY,CAAA;IAAE,2EAAiB,CAAA;IAAE,yDAAQ,CAAA;IAAE,uEAAe,CAAA;AAC5D,CAAC,EAFW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAExB"}
1
+ {"version":3,"file":"LocalMove.js","sourceRoot":"","sources":["../../../../src/material/moves/local/LocalMove.ts"],"names":[],"mappings":";;;AAYA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,iEAAY,CAAA;IAAE,2EAAiB,CAAA;IAAE,yDAAQ,CAAA;IAAE,uEAAe,CAAA;IAAE,6EAAkB,CAAA;AAChF,CAAC,EAFW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAExB"}
@@ -1,3 +1,4 @@
1
+ export * from './CloseTutorialPopup';
1
2
  export * from './DisplayRules';
2
3
  export * from './DropItem';
3
4
  export * from './LocalMove';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CloseTutorialPopup"), exports);
17
18
  __exportStar(require("./DisplayRules"), exports);
18
19
  __exportStar(require("./DropItem"), exports);
19
20
  __exportStar(require("./LocalMove"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/material/moves/local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,6CAA0B;AAC1B,8CAA2B;AAC3B,oDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/material/moves/local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,iDAA8B;AAC9B,6CAA0B;AAC1B,8CAA2B;AAC3B,oDAAiC"}
@@ -0,0 +1,7 @@
1
+ import { RuleMoveCommon, RuleMoveType } from './RuleMove';
2
+ import { MaterialMove } from '../MaterialMove';
3
+ export declare type EndPlayerTurn<Player extends number = number> = RuleMoveCommon & {
4
+ type: typeof RuleMoveType.EndPlayerTurn;
5
+ player: Player;
6
+ };
7
+ export declare function isEndPlayerTurn<P extends number, M extends number, L extends number>(move: MaterialMove<P, M, L>): move is EndPlayerTurn<P>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEndPlayerTurn = void 0;
4
+ var RuleMove_1 = require("./RuleMove");
5
+ var MoveKind_1 = require("../MoveKind");
6
+ function isEndPlayerTurn(move) {
7
+ return move.kind === MoveKind_1.MoveKind.RulesMove && move.type === RuleMove_1.RuleMoveType.EndPlayerTurn;
8
+ }
9
+ exports.isEndPlayerTurn = isEndPlayerTurn;
10
+ //# sourceMappingURL=EndPlayerTurn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EndPlayerTurn.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/EndPlayerTurn.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AAEzD,wCAAsC;AAOtC,SAAgB,eAAe,CAAuD,IAA2B;IAC/G,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAY,CAAC,aAAa,CAAA;AACrF,CAAC;AAFD,0CAEC"}
@@ -2,11 +2,13 @@ import { MoveKind } from '../MoveKind';
2
2
  import { StartRule } from './StartRule';
3
3
  import { StartPlayerTurn } from './StartPlayerTurn';
4
4
  import { EndGame } from './EndGame';
5
- export declare type RuleMove<Player extends number = number, RuleId extends number = number> = StartPlayerTurn<Player, RuleId> | StartRule<Player, RuleId> | EndGame;
5
+ import { StartSimultaneousRule } from './StartSimultaneousRule';
6
+ import { EndPlayerTurn } from './EndPlayerTurn';
7
+ export declare type RuleMove<Player extends number = number, RuleId extends number = number> = StartPlayerTurn<Player, RuleId> | StartSimultaneousRule<Player, RuleId> | StartRule<RuleId> | EndGame | EndPlayerTurn<Player>;
6
8
  export declare enum RuleMoveType {
7
9
  StartPlayerTurn = 0,
8
- StartSimultaneousTurns = 1,
9
- StartAutomaticRule = 2,
10
+ StartSimultaneousRule = 1,
11
+ EndPlayerTurn = 2,
10
12
  StartRule = 3,
11
13
  EndGame = 4
12
14
  }
@@ -4,8 +4,8 @@ exports.isRuleChange = exports.RuleMoveType = void 0;
4
4
  var RuleMoveType;
5
5
  (function (RuleMoveType) {
6
6
  RuleMoveType[RuleMoveType["StartPlayerTurn"] = 0] = "StartPlayerTurn";
7
- RuleMoveType[RuleMoveType["StartSimultaneousTurns"] = 1] = "StartSimultaneousTurns";
8
- RuleMoveType[RuleMoveType["StartAutomaticRule"] = 2] = "StartAutomaticRule";
7
+ RuleMoveType[RuleMoveType["StartSimultaneousRule"] = 1] = "StartSimultaneousRule";
8
+ RuleMoveType[RuleMoveType["EndPlayerTurn"] = 2] = "EndPlayerTurn";
9
9
  RuleMoveType[RuleMoveType["StartRule"] = 3] = "StartRule";
10
10
  RuleMoveType[RuleMoveType["EndGame"] = 4] = "EndGame";
11
11
  })(RuleMoveType = exports.RuleMoveType || (exports.RuleMoveType = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"RuleMove.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/RuleMove.ts"],"names":[],"mappings":";;;AAUA,IAAY,YAEX;AAFD,WAAY,YAAY;IACtB,qEAAe,CAAA;IAAE,mFAAsB,CAAA;IAAE,2EAAkB,CAAA;IAAE,yDAAS,CAAA;IAAE,qDAAO,CAAA;AACjF,CAAC,EAFW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAEvB;AAMM,IAAM,YAAY,GAAG,UAAuD,IAAoB;IACrG,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB;YACE,OAAO,IAAI,CAAA;KACd;AACH,CAAC,CAAA;AALY,QAAA,YAAY,gBAKxB"}
1
+ {"version":3,"file":"RuleMove.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/RuleMove.ts"],"names":[],"mappings":";;;AAcA,IAAY,YAEX;AAFD,WAAY,YAAY;IACtB,qEAAe,CAAA;IAAE,iFAAqB,CAAA;IAAE,iEAAa,CAAA;IAAE,yDAAS,CAAA;IAAE,qDAAO,CAAA;AAC3E,CAAC,EAFW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAEvB;AAMM,IAAM,YAAY,GAAG,UAAuD,IAAoB;IACrG,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB;YACE,OAAO,IAAI,CAAA;KACd;AACH,CAAC,CAAA;AALY,QAAA,YAAY,gBAKxB"}
@@ -1,9 +1,8 @@
1
1
  import { RuleMoveCommon, RuleMoveType } from './RuleMove';
2
2
  import { MaterialMove } from '../MaterialMove';
3
- export declare type StartRule<Player extends number = number, RuleId extends number = number> = RuleMoveCommon & {
3
+ export declare type StartRule<RuleId extends number = number> = RuleMoveCommon & {
4
4
  type: typeof RuleMoveType.StartRule;
5
5
  id: RuleId;
6
- player?: Player;
7
6
  memory?: Record<string, any>;
8
7
  };
9
8
  export declare function isStartRule<P extends number, M extends number, L extends number>(move: MaterialMove<P, M, L>): move is StartRule<P>;
@@ -1 +1 @@
1
- {"version":3,"file":"StartRule.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/StartRule.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AAEzD,wCAAsC;AAStC,SAAgB,WAAW,CAAuD,IAA2B;IAC3G,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAY,CAAC,SAAS,CAAA;AACjF,CAAC;AAFD,kCAEC"}
1
+ {"version":3,"file":"StartRule.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/StartRule.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AAEzD,wCAAsC;AAQtC,SAAgB,WAAW,CAAuD,IAA2B;IAC3G,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAY,CAAC,SAAS,CAAA;AACjF,CAAC;AAFD,kCAEC"}
@@ -0,0 +1,10 @@
1
+ import { RuleMoveCommon, RuleMoveType } from './RuleMove';
2
+ import { MaterialMove } from '../MaterialMove';
3
+ export declare type StartSimultaneousRule<Player extends number = number, RuleId extends number = number> = RuleMoveCommon & {
4
+ type: typeof RuleMoveType.StartSimultaneousRule;
5
+ id: RuleId;
6
+ players?: Player[];
7
+ memory?: Record<string, any>;
8
+ playersMemory?: Partial<Record<Player, Record<string, any>>>;
9
+ };
10
+ export declare function isStartSimultaneousRule<P extends number, M extends number, L extends number>(move: MaterialMove<P, M, L>): move is StartSimultaneousRule<P>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isStartSimultaneousRule = void 0;
4
+ var RuleMove_1 = require("./RuleMove");
5
+ var MoveKind_1 = require("../MoveKind");
6
+ function isStartSimultaneousRule(move) {
7
+ return move.kind === MoveKind_1.MoveKind.RulesMove && move.type === RuleMove_1.RuleMoveType.StartSimultaneousRule;
8
+ }
9
+ exports.isStartSimultaneousRule = isStartSimultaneousRule;
10
+ //# sourceMappingURL=StartSimultaneousRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StartSimultaneousRule.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/StartSimultaneousRule.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AAEzD,wCAAsC;AAUtC,SAAgB,uBAAuB,CAAuD,IAA2B;IACvH,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAY,CAAC,qBAAqB,CAAA;AAC7F,CAAC;AAFD,0DAEC"}
@@ -0,0 +1,10 @@
1
+ import { RuleMoveCommon, RuleMoveType } from './RuleMove';
2
+ import { MaterialMove } from '../MaterialMove';
3
+ export declare type StartSimultaneousRule<Player extends number = number, RuleId extends number = number> = RuleMoveCommon & {
4
+ type: typeof RuleMoveType.StartSimultaneousRule;
5
+ id: RuleId;
6
+ players?: Player[];
7
+ memory?: Record<string, any>;
8
+ playersMemory?: Partial<Record<Player, Record<string, any>>>;
9
+ };
10
+ export declare function isStartSimultaneousRule<P extends number, M extends number, L extends number>(move: MaterialMove<P, M, L>): move is StartSimultaneousRule<P>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isStartSimultaneousRule = void 0;
4
+ var RuleMove_1 = require("./RuleMove");
5
+ var MoveKind_1 = require("../MoveKind");
6
+ function isStartSimultaneousRule(move) {
7
+ return move.kind === MoveKind_1.MoveKind.RulesMove && move.type === RuleMove_1.RuleMoveType.StartSimultaneousRule;
8
+ }
9
+ exports.isStartSimultaneousRule = isStartSimultaneousRule;
10
+ //# sourceMappingURL=StartSimultanousRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StartSimultanousRule.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/StartSimultanousRule.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AAEzD,wCAAsC;AAUtC,SAAgB,uBAAuB,CAAuD,IAA2B;IACvH,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAY,CAAC,qBAAqB,CAAA;AAC7F,CAAC;AAFD,0DAEC"}
@@ -1,4 +1,6 @@
1
1
  export * from './EndGame';
2
+ export * from './EndPlayerTurn';
2
3
  export * from './RuleMove';
3
- export * from './StartRule';
4
4
  export * from './StartPlayerTurn';
5
+ export * from './StartRule';
6
+ export * from './StartSimultaneousRule';
@@ -15,7 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./EndGame"), exports);
18
+ __exportStar(require("./EndPlayerTurn"), exports);
18
19
  __exportStar(require("./RuleMove"), exports);
19
- __exportStar(require("./StartRule"), exports);
20
20
  __exportStar(require("./StartPlayerTurn"), exports);
21
+ __exportStar(require("./StartRule"), exports);
22
+ __exportStar(require("./StartSimultaneousRule"), exports);
21
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B;AAC1B,8CAA2B;AAC3B,oDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/material/moves/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,kDAA+B;AAC/B,6CAA0B;AAC1B,oDAAiC;AACjC,8CAA2B;AAC3B,0DAAuC"}
@@ -1,10 +1,12 @@
1
1
  import { MaterialGame } from '../MaterialGame';
2
- import { CustomMove, EndGame, StartPlayerTurn, StartRule } from '../moves';
2
+ import { CustomMove, EndGame, EndPlayerTurn, StartPlayerTurn, StartRule, StartSimultaneousRule } from '../moves';
3
3
  export declare class MaterialRulesMovesBuilder<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> {
4
4
  game: MaterialGame<Player, MaterialType, LocationType>;
5
5
  constructor(game: MaterialGame<Player, MaterialType, LocationType>);
6
6
  startPlayerTurn<RuleId extends number = number>(id: RuleId, player: Player, memory?: Record<string, any>): StartPlayerTurn<Player, RuleId>;
7
- startRule<RuleId extends number = number>(id: RuleId, player?: Player, memory?: Record<string, any>): StartRule<Player, RuleId>;
7
+ startSimultaneousRule<RuleId extends number = number>(id: RuleId, options: Omit<StartSimultaneousRule<Player>, 'kind' | 'type' | 'id'>): StartSimultaneousRule<Player, RuleId>;
8
+ endPlayerTurn(player: Player): EndPlayerTurn<Player>;
9
+ startRule<RuleId extends number = number>(id: RuleId, memory?: Record<string, any>): StartRule<RuleId>;
8
10
  customMove<Type extends number = number>(type: Type, data?: any): CustomMove;
9
11
  endGame(): EndGame;
10
12
  }
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.MaterialRulesMovesBuilder = void 0;
4
15
  var moves_1 = require("../moves");
@@ -12,10 +23,14 @@ var MaterialRulesMovesBuilder = /** @class */ (function () {
12
23
  move.memory = memory;
13
24
  return move;
14
25
  };
15
- MaterialRulesMovesBuilder.prototype.startRule = function (id, player, memory) {
26
+ MaterialRulesMovesBuilder.prototype.startSimultaneousRule = function (id, options) {
27
+ return __assign({ kind: moves_1.MoveKind.RulesMove, type: moves_1.RuleMoveType.StartSimultaneousRule, id: id }, options);
28
+ };
29
+ MaterialRulesMovesBuilder.prototype.endPlayerTurn = function (player) {
30
+ return { kind: moves_1.MoveKind.RulesMove, type: moves_1.RuleMoveType.EndPlayerTurn, player: player };
31
+ };
32
+ MaterialRulesMovesBuilder.prototype.startRule = function (id, memory) {
16
33
  var move = { kind: moves_1.MoveKind.RulesMove, type: moves_1.RuleMoveType.StartRule, id: id };
17
- if (player)
18
- move.player = player;
19
34
  if (memory)
20
35
  move.memory = memory;
21
36
  return move;
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialRulesMovesBuilder.js","sourceRoot":"","sources":["../../../src/material/rules/MaterialRulesMovesBuilder.ts"],"names":[],"mappings":";;;AACA,kCAAkG;AAElG;IAKE,mCAAY,IAAsD;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,mDAAe,GAAf,UAAgD,EAAU,EAAE,MAAc,EAAE,MAA4B;QACtG,IAAM,IAAI,GAAoC,EAAE,IAAI,EAAE,gBAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,oBAAY,CAAC,eAAe,EAAE,EAAE,IAAA,EAAE,MAAM,QAAA,EAAE,CAAA;QAC1H,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,6CAAS,GAAT,UAA0C,EAAU,EAAE,MAAe,EAAE,MAA4B;QACjG,IAAM,IAAI,GAA8B,EAAE,IAAI,EAAE,gBAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,oBAAY,CAAC,SAAS,EAAE,EAAE,IAAA,EAAE,CAAA;QACtG,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAChC,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,8CAAU,GAAV,UAAyC,IAAU,EAAE,IAAU;QAC7D,IAAM,IAAI,GAAe,EAAE,IAAI,EAAE,gBAAQ,CAAC,UAAU,EAAE,IAAI,MAAA,EAAE,CAAA;QAC5D,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAC1B,OAAO,IAAI,CA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C9F,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,8CAAU,GAAV,UAAyC,IAAU,EAAE,IAAU;QAC7D,IAAM,IAAI,GAAe,EAAE,IAAI,EAAE,gBAAQ,CAAC,UAAU,EAAE,IAAI,MAAA,EAAE,CAAA;QAC5D,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,2CAAO,GAAP;QACE,OAAO,EAAE,IAAI,EAAE,gBAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,oBAAY,CAAC,OAAO,EAAE,CAAA;IACjE,CAAC;IACH,gCAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,8DAAyB"}
@@ -5,8 +5,7 @@ import { Material } from '../items';
5
5
  import { MaterialRulesMovesBuilder } from './MaterialRulesMovesBuilder';
6
6
  import { RuleStep } from './RuleStep';
7
7
  export declare abstract class MaterialRulesPart<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends Rules<MaterialGame<Player, MaterialType, LocationType>, MaterialMove<Player, MaterialType, LocationType>, Player> {
8
- readonly material: (type: MaterialType) => Material<Player, MaterialType, LocationType>;
9
- constructor(game: MaterialGame<Player, MaterialType, LocationType>, material: (type: MaterialType) => Material<Player, MaterialType, LocationType>);
8
+ material(type: MaterialType): Material<Player, MaterialType, LocationType>;
10
9
  beforeItemMove(_move: ItemMove<Player, MaterialType, LocationType>): MaterialMove<Player, MaterialType, LocationType>[];
11
10
  afterItemMove(_move: ItemMove<Player, MaterialType, LocationType>): MaterialMove<Player, MaterialType, LocationType>[];
12
11
  onRuleStart<RuleId extends number>(_move: RuleMove<Player, RuleId>, _previousRule?: RuleStep): MaterialMove<Player, MaterialType, LocationType>[];
@@ -14,9 +13,9 @@ export declare abstract class MaterialRulesPart<Player extends number = number,
14
13
  onCustomMove(_move: CustomMove): MaterialMove<Player, MaterialType, LocationType>[];
15
14
  rules(): MaterialRulesMovesBuilder<Player, MaterialType, LocationType>;
16
15
  getMemory<T>(player?: Player): T;
17
- memorize<T extends Record<string, any>>(memory?: T, player?: Player): void;
16
+ memorize<T extends Record<string, any>>(memory?: Partial<T>, player?: Player): void;
18
17
  getGameMemory<T>(player?: Player): T;
19
- memorizeOnGame(memory?: Record<string, any>, player?: Player): void;
18
+ memorizeOnGame<T extends Record<string, any>>(memory?: Partial<T>, player?: Player): void;
20
19
  }
21
20
  export interface MaterialRulesPartCreator<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> {
22
21
  new (game: MaterialGame<Player, MaterialType, LocationType>, material: (type: MaterialType) => Material<Player, MaterialType, LocationType>): MaterialRulesPart<Player, MaterialType, LocationType>;
@@ -28,14 +28,17 @@ var __assign = (this && this.__assign) || function () {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.MaterialRulesPart = void 0;
30
30
  var Rules_1 = require("../../Rules");
31
+ var items_1 = require("../items");
31
32
  var MaterialRulesMovesBuilder_1 = require("./MaterialRulesMovesBuilder");
32
33
  var MaterialRulesPart = /** @class */ (function (_super) {
33
34
  __extends(MaterialRulesPart, _super);
34
- function MaterialRulesPart(game, material) {
35
- var _this = _super.call(this, game) || this;
36
- _this.material = material;
37
- return _this;
35
+ function MaterialRulesPart() {
36
+ return _super !== null && _super.apply(this, arguments) || this;
38
37
  }
38
+ MaterialRulesPart.prototype.material = function (type) {
39
+ var _a;
40
+ return new items_1.Material(type, Array.from(((_a = this.game.items[type]) !== null && _a !== void 0 ? _a : []).entries()).filter(function (entry) { return entry[1].quantity !== 0; }));
41
+ };
39
42
  MaterialRulesPart.prototype.beforeItemMove = function (_move) {
40
43
  return [];
41
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialRulesPart.js","sourceRoot":"","sources":["../../../src/material/rules/MaterialRulesPart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAm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,aAAa,CAAC,MAAM,CAAC,yBAAQ,MAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,mCAAI,EAAE,GAAK,MAAM,CAAE,CAAA;SAC1F;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,yBAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,GAAK,MAAM,CAAE,CAAA;SACtD;IACH,CAAC;IAEH,wBAAC;AAAD,CAAC,AAnED,CACU,aAAK,GAkEd;AAnEqB,8CAAiB"}
@@ -6,8 +6,7 @@ export declare abstract class PlayerTurnRule<Player extends number = number, Mat
6
6
  getActivePlayer(): Player;
7
7
  getPlayerMemory<T>(): T;
8
8
  getPlayerGameMemory<T>(): T;
9
- memorizePlayerOnGame<T>(data: T): void;
10
- initializeMoves(): MaterialMove<Player, MaterialType, LocationType>[];
9
+ memorizePlayerOnGame<T extends Record<string, any>>(memory?: Partial<T>): void;
11
10
  getLegalMoves(player: Player): MaterialMove<Player, MaterialType, LocationType>[];
12
11
  abstract getPlayerMoves(): MaterialMove<Player, MaterialType, LocationType>[];
13
12
  }
@@ -45,11 +45,8 @@ var PlayerTurnRule = /** @class */ (function (_super) {
45
45
  PlayerTurnRule.prototype.getPlayerGameMemory = function () {
46
46
  return _super.prototype.getGameMemory.call(this, this.player);
47
47
  };
48
- PlayerTurnRule.prototype.memorizePlayerOnGame = function (data) {
49
- return _super.prototype.memorizeOnGame.call(this, data, this.player);
50
- };
51
- PlayerTurnRule.prototype.initializeMoves = function () {
52
- return [];
48
+ PlayerTurnRule.prototype.memorizePlayerOnGame = function (memory) {
49
+ return _super.prototype.memorizeOnGame.call(this, memory, this.player);
53
50
  };
54
51
  PlayerTurnRule.prototype.getLegalMoves = function (player) {
55
52
  if (player !== this.getActivePlayer())
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerTurnRule.js","sourceRoot":"","sources":["../../../src/material/rules/PlayerTurnRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yD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kCAAM;aAAV;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAK,CAAC,MAAO,CAAA;QAChC,CAAC;;;OAAA;IAED,sBAAI,sCAAU;aAAd;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACnG,CAAC;;;OAAA;IAED,wCAAe,GAAf;QACE,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,wCAAe,GAAf;QACE,OAAO,iBAAM,SAAS,YAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC;IAED,4CAAmB,GAAnB;QACE,OAAO,iBAAM,aAAa,YAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IAED,6CAAoB,GAApB,UAAoD,MAAmB;QACrE,OAAO,iBAAM,cAAc,YAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;IAED,sCAAa,GAAb,UAAc,MAAc;QAC1B,IAAI,MAAM,KAAK,IAAI,CAAC,eAAe,EAAE;YAAE,OAAO,EAAE,CAAA;QAChD,OAAO,IAAI,CAAC,cAAc,EAAE,CAAA;IAC9B,CAAC;IAGH,qBAAC;AAAD,CAAC,AAjCD,CACU,qCAAiB,GAgC1B;AAjCqB,wCAAc"}
@@ -1,6 +1,7 @@
1
1
  export declare type RuleStep<Player extends number = number, RuleId extends number = number> = {
2
2
  id: RuleId;
3
3
  player?: Player;
4
+ players?: Player[];
4
5
  memory?: Record<string, any>;
5
6
  playersMemory?: Partial<Record<Player, Record<string, any>>>;
6
7
  };
@@ -0,0 +1,7 @@
1
+ import { MaterialRulesPart } from './MaterialRulesPart';
2
+ import { MaterialMove } from '../moves';
3
+ export declare abstract class SimultaneousRule<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends MaterialRulesPart<Player, MaterialType, LocationType> {
4
+ isTurnToPlay(player: Player): boolean;
5
+ getAutomaticMoves(): MaterialMove<Player, MaterialType, LocationType>[];
6
+ abstract getMovesAfterPlayersDone(): MaterialMove<Player, MaterialType, LocationType>[];
7
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SimultaneousRule = void 0;
19
+ var MaterialRulesPart_1 = require("./MaterialRulesPart");
20
+ var SimultaneousRule = /** @class */ (function (_super) {
21
+ __extends(SimultaneousRule, _super);
22
+ function SimultaneousRule() {
23
+ return _super !== null && _super.apply(this, arguments) || this;
24
+ }
25
+ SimultaneousRule.prototype.isTurnToPlay = function (player) {
26
+ var _a, _b, _c;
27
+ return (_c = (_b = (_a = this.game.rule) === null || _a === void 0 ? void 0 : _a.players) === null || _b === void 0 ? void 0 : _b.includes(player)) !== null && _c !== void 0 ? _c : false;
28
+ };
29
+ SimultaneousRule.prototype.getAutomaticMoves = function () {
30
+ var _a, _b;
31
+ if (!((_b = (_a = this.game.rule) === null || _a === void 0 ? void 0 : _a.players) === null || _b === void 0 ? void 0 : _b.length)) {
32
+ return this.getMovesAfterPlayersDone();
33
+ }
34
+ return [];
35
+ };
36
+ return SimultaneousRule;
37
+ }(MaterialRulesPart_1.MaterialRulesPart));
38
+ exports.SimultaneousRule = SimultaneousRule;
39
+ //# sourceMappingURL=SimultaneousRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimultaneousRule.js","sourceRoot":"","sources":["../../../src/material/rules/SimultaneousRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAuD;AAGvD;IACU,oCAAqD;IAD/D;;IAeA,CAAC;IAZC,uCAAY,GAAZ,UAAa,MAAc;;QACzB,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,QAAQ,CAAC,MAAM,CAAC,mCAAI,KAAK,CAAA;IAC3D,CAAC;IAED,4CAAiB,GAAjB;;QACE,IAAI,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAA,EAAE;YACpC,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAA;SACvC;QACD,OAAO,EAAE,CAAA;IACX,CAAC;IAGH,uBAAC;AAAD,CAAC,AAfD,CACU,qCAAiB,GAc1B;AAfqB,4CAAgB"}
@@ -1,3 +1,5 @@
1
- export * from './RuleStep';
1
+ export * from './MaterialRulesMovesBuilder';
2
2
  export * from './MaterialRulesPart';
3
3
  export * from './PlayerTurnRule';
4
+ export * from './RuleStep';
5
+ export * from './SimultaneousRule';
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./RuleStep"), exports);
17
+ __exportStar(require("./MaterialRulesMovesBuilder"), exports);
18
18
  __exportStar(require("./MaterialRulesPart"), exports);
19
19
  __exportStar(require("./PlayerTurnRule"), exports);
20
+ __exportStar(require("./RuleStep"), exports);
21
+ __exportStar(require("./SimultaneousRule"), exports);
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,sDAAmC;AACnC,mDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C;AAC3C,sDAAmC;AACnC,mDAAgC;AAChC,6CAA0B;AAC1B,qDAAkC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/rules-api",
3
- "version": "6.0.10-alpha.0",
3
+ "version": "6.1.0",
4
4
  "description": "API to implement the rules of a board game",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,5 +29,5 @@
29
29
  "@types/lodash": "^4.14.195",
30
30
  "i18next": ">=21.3.0"
31
31
  },
32
- "gitHead": "ec9c89201700ea4b2f7f6eee1ff86e36387d37c6"
32
+ "gitHead": "ff2b373e72e0c77625925b3b61281a008cc0656e"
33
33
  }