@gamepark/rules-api 6.24.1 → 6.24.3

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 (167) hide show
  1. package/dist/Action.d.ts +7 -0
  2. package/dist/Bot.d.ts +21 -0
  3. package/dist/Bot.js +18 -2
  4. package/dist/Bot.js.map +1 -1
  5. package/dist/Competitive.d.ts +45 -0
  6. package/dist/Competitive.js +15 -0
  7. package/dist/Competitive.js.map +1 -1
  8. package/dist/Eliminations.d.ts +17 -0
  9. package/dist/Eliminations.js +5 -0
  10. package/dist/Eliminations.js.map +1 -1
  11. package/dist/GameSetup.d.ts +14 -0
  12. package/dist/HiddenInformation.d.ts +22 -0
  13. package/dist/HiddenInformation.js +5 -0
  14. package/dist/HiddenInformation.js.map +1 -1
  15. package/dist/LocalMovePreview.d.ts +14 -0
  16. package/dist/LocalMovePreview.js +5 -0
  17. package/dist/LocalMovePreview.js.map +1 -1
  18. package/dist/RandomMove.d.ts +17 -0
  19. package/dist/Rules.d.ts +119 -0
  20. package/dist/Rules.js +102 -1
  21. package/dist/Rules.js.map +1 -1
  22. package/dist/SecretInformation.d.ts +39 -0
  23. package/dist/SecretInformation.js +5 -0
  24. package/dist/SecretInformation.js.map +1 -1
  25. package/dist/TimeLimit.d.ts +22 -0
  26. package/dist/TimeLimit.js +5 -0
  27. package/dist/TimeLimit.js.map +1 -1
  28. package/dist/Undo.d.ts +18 -0
  29. package/dist/Undo.js +6 -0
  30. package/dist/Undo.js.map +1 -1
  31. package/dist/UnpredictableMove.d.ts +19 -0
  32. package/dist/UnpredictableMove.js +5 -0
  33. package/dist/UnpredictableMove.js.map +1 -1
  34. package/dist/material/HiddenMaterialRules.d.ts +49 -1
  35. package/dist/material/HiddenMaterialRules.js +49 -3
  36. package/dist/material/HiddenMaterialRules.js.map +1 -1
  37. package/dist/material/MaterialGame.d.ts +12 -0
  38. package/dist/material/MaterialGameSetup.d.ts +74 -0
  39. package/dist/material/MaterialGameSetup.js +67 -1
  40. package/dist/material/MaterialGameSetup.js.map +1 -1
  41. package/dist/material/MaterialRules.d.ts +125 -0
  42. package/dist/material/MaterialRules.js +122 -3
  43. package/dist/material/MaterialRules.js.map +1 -1
  44. package/dist/material/SecretMaterialRules.d.ts +31 -0
  45. package/dist/material/SecretMaterialRules.js +23 -1
  46. package/dist/material/SecretMaterialRules.js.map +1 -1
  47. package/dist/material/items/Material.d.ts +253 -0
  48. package/dist/material/items/Material.js +248 -1
  49. package/dist/material/items/Material.js.map +1 -1
  50. package/dist/material/items/MaterialDeck.d.ts +33 -0
  51. package/dist/material/items/MaterialDeck.js +34 -1
  52. package/dist/material/items/MaterialDeck.js.map +1 -1
  53. package/dist/material/items/MaterialItem.d.ts +12 -0
  54. package/dist/material/items/MaterialMutator.d.ts +39 -0
  55. package/dist/material/items/MaterialMutator.js +41 -2
  56. package/dist/material/items/MaterialMutator.js.map +1 -1
  57. package/dist/material/items/index.js +1 -1
  58. package/dist/material/items/index.js.map +1 -1
  59. package/dist/material/location/Location.d.ts +28 -0
  60. package/dist/material/location/Location.js +5 -0
  61. package/dist/material/location/Location.js.map +1 -1
  62. package/dist/material/location/LocationBuilder.js +1 -1
  63. package/dist/material/location/strategy/FillGapStrategy.d.ts +4 -0
  64. package/dist/material/location/strategy/FillGapStrategy.js +5 -1
  65. package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
  66. package/dist/material/location/strategy/LocationStrategy.d.ts +20 -0
  67. package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +4 -0
  68. package/dist/material/location/strategy/PositiveSequenceStrategy.js +5 -1
  69. package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
  70. package/dist/material/memory/GameMemory.d.ts +21 -0
  71. package/dist/material/memory/GameMemory.js +22 -1
  72. package/dist/material/memory/GameMemory.js.map +1 -1
  73. package/dist/material/memory/PlayerMemory.d.ts +22 -0
  74. package/dist/material/memory/PlayerMemory.js +23 -1
  75. package/dist/material/memory/PlayerMemory.js.map +1 -1
  76. package/dist/material/moves/CustomMove.d.ts +18 -0
  77. package/dist/material/moves/CustomMove.js +13 -0
  78. package/dist/material/moves/CustomMove.js.map +1 -1
  79. package/dist/material/moves/MaterialMove.d.ts +9 -0
  80. package/dist/material/moves/MaterialMoveBuilder.d.ts +36 -0
  81. package/dist/material/moves/MaterialMoveBuilder.js +36 -0
  82. package/dist/material/moves/MaterialMoveBuilder.js.map +1 -1
  83. package/dist/material/moves/MoveKind.d.ts +3 -0
  84. package/dist/material/moves/MoveKind.js +3 -0
  85. package/dist/material/moves/MoveKind.js.map +1 -1
  86. package/dist/material/moves/items/CreateItem.d.ts +13 -0
  87. package/dist/material/moves/items/CreateItem.js +10 -0
  88. package/dist/material/moves/items/CreateItem.js.map +1 -1
  89. package/dist/material/moves/items/CreateItemsAtOnce.d.ts +14 -0
  90. package/dist/material/moves/items/CreateItemsAtOnce.js +10 -0
  91. package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
  92. package/dist/material/moves/items/DeleteItem.d.ts +18 -0
  93. package/dist/material/moves/items/DeleteItem.js +11 -0
  94. package/dist/material/moves/items/DeleteItem.js.map +1 -1
  95. package/dist/material/moves/items/DeleteItemsAtOnce.d.ts +17 -0
  96. package/dist/material/moves/items/DeleteItemsAtOnce.js +10 -0
  97. package/dist/material/moves/items/DeleteItemsAtOnce.js.map +1 -1
  98. package/dist/material/moves/items/ItemMove.d.ts +12 -0
  99. package/dist/material/moves/items/ItemMoveType.d.ts +3 -0
  100. package/dist/material/moves/items/ItemMoveType.js +3 -0
  101. package/dist/material/moves/items/ItemMoveType.js.map +1 -1
  102. package/dist/material/moves/items/MoveItem.d.ts +20 -0
  103. package/dist/material/moves/items/MoveItem.js +11 -0
  104. package/dist/material/moves/items/MoveItem.js.map +1 -1
  105. package/dist/material/moves/items/MoveItemsAtOnce.d.ts +20 -0
  106. package/dist/material/moves/items/MoveItemsAtOnce.js +10 -0
  107. package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
  108. package/dist/material/moves/items/RollItem.d.ts +19 -0
  109. package/dist/material/moves/items/RollItem.js +10 -0
  110. package/dist/material/moves/items/RollItem.js.map +1 -1
  111. package/dist/material/moves/items/SelectItem.d.ts +20 -0
  112. package/dist/material/moves/items/SelectItem.js +11 -0
  113. package/dist/material/moves/items/SelectItem.js.map +1 -1
  114. package/dist/material/moves/items/Shuffle.d.ts +26 -0
  115. package/dist/material/moves/items/Shuffle.js +15 -0
  116. package/dist/material/moves/items/Shuffle.js.map +1 -1
  117. package/dist/material/moves/local/CloseTutorialPopup.d.ts +8 -0
  118. package/dist/material/moves/local/CloseTutorialPopup.js +5 -0
  119. package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -1
  120. package/dist/material/moves/local/DisplayHelp.d.ts +18 -0
  121. package/dist/material/moves/local/DisplayHelp.js +3 -0
  122. package/dist/material/moves/local/DisplayHelp.js.map +1 -1
  123. package/dist/material/moves/local/DropItem.d.ts +9 -0
  124. package/dist/material/moves/local/LocalMove.d.ts +6 -0
  125. package/dist/material/moves/local/LocalMove.js +3 -0
  126. package/dist/material/moves/local/LocalMove.js.map +1 -1
  127. package/dist/material/moves/local/SetTutorialStep.d.ts +8 -0
  128. package/dist/material/moves/local/SetTutorialStep.js +5 -0
  129. package/dist/material/moves/local/SetTutorialStep.js.map +1 -1
  130. package/dist/material/rules/MaterialRulesPart.d.ts +76 -0
  131. package/dist/material/rules/MaterialRulesPart.js +74 -1
  132. package/dist/material/rules/MaterialRulesPart.js.map +1 -1
  133. package/dist/material/rules/PlayerTurnRule.d.ts +19 -0
  134. package/dist/material/rules/PlayerTurnRule.js +20 -1
  135. package/dist/material/rules/PlayerTurnRule.js.map +1 -1
  136. package/dist/material/rules/RuleStep.d.ts +3 -0
  137. package/dist/material/rules/SimultaneousRule.d.ts +25 -0
  138. package/dist/material/rules/SimultaneousRule.js +21 -1
  139. package/dist/material/rules/SimultaneousRule.js.map +1 -1
  140. package/dist/material/tutorial/TutorialState.d.ts +7 -0
  141. package/dist/options/OptionsValidationError.js +1 -1
  142. package/dist/options/PlayerEnumOption.js +3 -0
  143. package/dist/options/PlayerEnumOption.js.map +1 -1
  144. package/dist/utils/action-view.util.js +2 -0
  145. package/dist/utils/action-view.util.js.map +1 -1
  146. package/dist/utils/enum.util.d.ts +27 -0
  147. package/dist/utils/enum.util.js +24 -0
  148. package/dist/utils/enum.util.js.map +1 -1
  149. package/dist/utils/grid.squares.util.d.ts +26 -0
  150. package/dist/utils/grid.squares.util.js +26 -0
  151. package/dist/utils/grid.squares.util.js.map +1 -1
  152. package/dist/utils/grid.util.d.ts +8 -0
  153. package/dist/utils/grid.util.js +5 -0
  154. package/dist/utils/grid.util.js.map +1 -1
  155. package/dist/utils/index.d.ts +1 -0
  156. package/dist/utils/index.js +1 -0
  157. package/dist/utils/index.js.map +1 -1
  158. package/dist/utils/listing.util.d.ts +12 -0
  159. package/dist/utils/listing.util.js +12 -0
  160. package/dist/utils/listing.util.js.map +1 -1
  161. package/dist/utils/money.util.d.ts +48 -0
  162. package/dist/utils/money.util.js +174 -0
  163. package/dist/utils/money.util.js.map +1 -0
  164. package/dist/utils/random.util.d.ts +11 -0
  165. package/dist/utils/random.util.js +11 -0
  166. package/dist/utils/random.util.js.map +1 -1
  167. package/package.json +1 -1
@@ -1,11 +1,31 @@
1
1
  import { MaterialMove } from '../MaterialMove';
2
2
  import { MaterialMoveCommon } from './ItemMove';
3
3
  import { ItemMoveType } from './ItemMoveType';
4
+ /**
5
+ * Move object that will select one {@link MaterialItem} (or a part of its quantity), when played.
6
+ * Use {@link Material} utility to build the move easily.
7
+ * The same object is used to unselect an item.
8
+ *
9
+ * @property itemIndex index of the item to move
10
+ * @property quantity if provided, move the specified quantity from the item (split in two items). Otherwise, move all the item.
11
+ * @property selected False to unselect
12
+ */
4
13
  export type SelectItem<MaterialType extends number = number> = MaterialMoveCommon<MaterialType> & {
5
14
  type: typeof ItemMoveType.Select;
6
15
  itemIndex: number;
7
16
  quantity?: number;
8
17
  selected?: boolean;
9
18
  };
19
+ /**
20
+ * Type guard to test if a {@link MaterialMove} is a {@link SelectItem} move
21
+ * @param move Move to test
22
+ * @returns true if move is a {@link SelectItem}
23
+ */
10
24
  export declare function isSelectItem<P extends number, M extends number, L extends number>(move: MaterialMove<P, M, L>): move is SelectItem<M>;
25
+ /**
26
+ * Function to get a type guard for a {@link SelectItem} move for specific item types.
27
+ * @param type Item type to test
28
+ * @param index Optional itemIndex to test along the item type
29
+ * @returns a type guard similar as {@link isSelectItem} but that also verify the item type.
30
+ */
11
31
  export declare function isSelectItemType<P extends number, M extends number, L extends number>(type: M, index?: number): (move: MaterialMove<P, M, L>) => move is SelectItem<M>;
@@ -3,10 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isSelectItemType = exports.isSelectItem = void 0;
4
4
  var MoveKind_1 = require("../MoveKind");
5
5
  var ItemMoveType_1 = require("./ItemMoveType");
6
+ /**
7
+ * Type guard to test if a {@link MaterialMove} is a {@link SelectItem} move
8
+ * @param move Move to test
9
+ * @returns true if move is a {@link SelectItem}
10
+ */
6
11
  function isSelectItem(move) {
7
12
  return move.kind === MoveKind_1.MoveKind.ItemMove && move.type === ItemMoveType_1.ItemMoveType.Select;
8
13
  }
9
14
  exports.isSelectItem = isSelectItem;
15
+ /**
16
+ * Function to get a type guard for a {@link SelectItem} move for specific item types.
17
+ * @param type Item type to test
18
+ * @param index Optional itemIndex to test along the item type
19
+ * @returns a type guard similar as {@link isSelectItem} but that also verify the item type.
20
+ */
10
21
  function isSelectItemType(type, index) {
11
22
  return function (move) {
12
23
  return isSelectItem(move) && move.itemType === type && (index === undefined || move.itemIndex === index);
@@ -1 +1 @@
1
- {"version":3,"file":"SelectItem.js","sourceRoot":"","sources":["../../../../src/material/moves/items/SelectItem.ts"],"names":[],"mappings":";;;AACA,wCAAsC;AAEtC,+CAA6C;AAuB7C,SAAgB,YAAY,CAAuD,IAA2B;IAC5G,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,2BAAY,CAAC,MAAM,CAAA;AAC7E,CAAC;AAFD,oCAEC;AAQD,SAAgB,gBAAgB,CAC9B,IAAO,EAAE,KAAc;IAEvB,OAAO,UAAC,IAA2B;QACjC,OAAA,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;IAAjG,CAAiG,CAAA;AACrG,CAAC;AALD,4CAKC"}
1
+ {"version":3,"file":"SelectItem.js","sourceRoot":"","sources":["../../../../src/material/moves/items/SelectItem.ts"],"names":[],"mappings":";;;AACA,wCAAsC;AAEtC,+CAA6C;AAkB7C;;;;GAIG;AACH,SAAgB,YAAY,CAAuD,IAA2B;IAC5G,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,2BAAY,CAAC,MAAM,CAAA;AAC7E,CAAC;AAFD,oCAEC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,IAAO,EAAE,KAAc;IAEvB,OAAO,UAAC,IAA2B;QACjC,OAAA,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;IAAjG,CAAiG,CAAA;AACrG,CAAC;AALD,4CAKC"}
@@ -1,13 +1,39 @@
1
1
  import { ItemMoveType } from './ItemMoveType';
2
2
  import { MaterialMoveCommon } from './ItemMove';
3
3
  import { MaterialMove } from '../MaterialMove';
4
+ /**
5
+ * Move object that will shuffle a list of {@link MaterialItem}, when played.
6
+ * Use {@link Material} utility to build the move easily.
7
+ * When items are shuffled, they swap their indexes randomly so that players can never "track" one item in the list.
8
+ *
9
+ * @property indexes indexes of the items to shuffle
10
+ */
4
11
  export type Shuffle<MaterialType extends number = number> = MaterialMoveCommon<MaterialType> & {
5
12
  type: typeof ItemMoveType.Shuffle;
6
13
  indexes: number[];
7
14
  };
15
+ /**
16
+ * Data structure when a {@link Shuffle} move has been randomized.
17
+ * @property newIndexes The new random indexes
18
+ */
8
19
  export type ShuffleRandomized<MaterialType extends number = number> = Shuffle<MaterialType> & {
9
20
  newIndexes: number[];
10
21
  };
22
+ /**
23
+ * Type guard to test if a {@link MaterialMove} is a {@link Shuffle} move
24
+ * @param move Move to test
25
+ * @returns true if move is a {@link Shuffle}
26
+ */
11
27
  export declare function isShuffle<P extends number, M extends number, L extends number>(move: MaterialMove<P, M, L>): move is Shuffle<M>;
28
+ /**
29
+ * Function to get a type guard for a {@link Shuffle} move for specific item types.
30
+ * @param type Item type to test
31
+ * @returns a type guard similar as {@link isShuffle} but that also verify the item type.
32
+ */
12
33
  export declare function isShuffleItemType<P extends number, M extends number, L extends number>(type: M): (move: MaterialMove<P, M, L>) => move is Shuffle<M>;
34
+ /**
35
+ * Type guard to test if a {@link MaterialMove} is a {@link ShuffleRandomized} move
36
+ * @param move Move to test
37
+ * @returns true if move is a {@link ShuffleRandomized}
38
+ */
13
39
  export declare function isShuffleRandomized<P extends number, M extends number, L extends number>(move: MaterialMove<P, M, L>): move is ShuffleRandomized<M>;
@@ -3,16 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isShuffleRandomized = exports.isShuffleItemType = exports.isShuffle = void 0;
4
4
  var ItemMoveType_1 = require("./ItemMoveType");
5
5
  var MoveKind_1 = require("../MoveKind");
6
+ /**
7
+ * Type guard to test if a {@link MaterialMove} is a {@link Shuffle} move
8
+ * @param move Move to test
9
+ * @returns true if move is a {@link Shuffle}
10
+ */
6
11
  function isShuffle(move) {
7
12
  return move.kind === MoveKind_1.MoveKind.ItemMove && move.type === ItemMoveType_1.ItemMoveType.Shuffle;
8
13
  }
9
14
  exports.isShuffle = isShuffle;
15
+ /**
16
+ * Function to get a type guard for a {@link Shuffle} move for specific item types.
17
+ * @param type Item type to test
18
+ * @returns a type guard similar as {@link isShuffle} but that also verify the item type.
19
+ */
10
20
  function isShuffleItemType(type) {
11
21
  return function (move) {
12
22
  return isShuffle(move) && move.itemType === type;
13
23
  };
14
24
  }
15
25
  exports.isShuffleItemType = isShuffleItemType;
26
+ /**
27
+ * Type guard to test if a {@link MaterialMove} is a {@link ShuffleRandomized} move
28
+ * @param move Move to test
29
+ * @returns true if move is a {@link ShuffleRandomized}
30
+ */
16
31
  function isShuffleRandomized(move) {
17
32
  return isShuffle(move) && Array.isArray(move.newIndexes);
18
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Shuffle.js","sourceRoot":"","sources":["../../../../src/material/moves/items/Shuffle.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAG7C,wCAAsC;AA2BtC,SAAgB,SAAS,CAAuD,IAA2B;IACzG,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,2BAAY,CAAC,OAAO,CAAA;AAC9E,CAAC;AAFD,8BAEC;AAOD,SAAgB,iBAAiB,CAC/B,IAAO;IAEP,OAAO,UAAC,IAA2B;QACjC,OAAA,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;IAAzC,CAAyC,CAAA;AAC7C,CAAC;AALD,8CAKC;AAOD,SAAgB,mBAAmB,CAAuD,IAA2B;IACnH,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAE,IAA6B,CAAC,UAAU,CAAC,CAAA;AACpF,CAAC;AAFD,kDAEC"}
1
+ {"version":3,"file":"Shuffle.js","sourceRoot":"","sources":["../../../../src/material/moves/items/Shuffle.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAG7C,wCAAsC;AAsBtC;;;;GAIG;AACH,SAAgB,SAAS,CAAuD,IAA2B;IACzG,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,2BAAY,CAAC,OAAO,CAAA;AAC9E,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,IAAO;IAEP,OAAO,UAAC,IAA2B;QACjC,OAAA,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;IAAzC,CAAyC,CAAA;AAC7C,CAAC;AALD,8CAKC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAuD,IAA2B;IACnH,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAE,IAA6B,CAAC,UAAU,CAAC,CAAA;AACpF,CAAC;AAFD,kDAEC"}
@@ -1,8 +1,16 @@
1
1
  import { MoveKind } from '../MoveKind';
2
2
  import { LocalMoveType } from './LocalMove';
3
3
  import { MaterialMove } from '../MaterialMove';
4
+ /**
5
+ * Move object to close the popup during a tutorial
6
+ */
4
7
  export type CloseTutorialPopup = {
5
8
  kind: MoveKind.LocalMove;
6
9
  type: LocalMoveType.CloseTutorialPopup;
7
10
  };
11
+ /**
12
+ * Type guard to test if a {@link MaterialMove} is a {@link CloseTutorialPopup} move
13
+ * @param move Move to test
14
+ * @returns true if move is a {@link CloseTutorialPopup}
15
+ */
8
16
  export declare function isCloseTutorialPopup(move: MaterialMove): move is CloseTutorialPopup;
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isCloseTutorialPopup = void 0;
4
4
  var MoveKind_1 = require("../MoveKind");
5
5
  var LocalMove_1 = require("./LocalMove");
6
+ /**
7
+ * Type guard to test if a {@link MaterialMove} is a {@link CloseTutorialPopup} move
8
+ * @param move Move to test
9
+ * @returns true if move is a {@link CloseTutorialPopup}
10
+ */
6
11
  function isCloseTutorialPopup(move) {
7
12
  return move.kind === MoveKind_1.MoveKind.LocalMove && move.type === LocalMove_1.LocalMoveType.CloseTutorialPopup;
8
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CloseTutorialPopup.js","sourceRoot":"","sources":["../../../../src/material/moves/local/CloseTutorialPopup.ts"],"names":[],"mappings":";;;AAAA,wCAAsC;AACtC,yCAA2C;AAgB3C,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"}
1
+ {"version":3,"file":"CloseTutorialPopup.js","sourceRoot":"","sources":["../../../../src/material/moves/local/CloseTutorialPopup.ts"],"names":[],"mappings":";;;AAAA,wCAAsC;AACtC,yCAA2C;AAW3C;;;;GAIG;AACH,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"}
@@ -2,12 +2,21 @@ import { MaterialItem } from '../../items';
2
2
  import { Location } from '../../location';
3
3
  import { MoveKind } from '../MoveKind';
4
4
  import { LocalMoveType } from './LocalMove';
5
+ /**
6
+ * Common type for the moves that display a help dialog
7
+ */
5
8
  export type HelpDisplay<P extends number = number, M extends number = number, L extends number = number, RuleId extends number = number> = MaterialHelpDisplay<P, M, L> | LocationHelpDisplay<P, L> | RulesHelpDisplay<RuleId>;
9
+ /**
10
+ * Type of help dialogs that can be opened
11
+ */
6
12
  export declare enum HelpDisplayType {
7
13
  Material = 1,
8
14
  Location = 2,
9
15
  Rules = 3
10
16
  }
17
+ /**
18
+ * Data structure describing a help dialog about a {@link MaterialItem}
19
+ */
11
20
  export type MaterialHelpDisplay<P extends number = number, M extends number = number, L extends number = number> = {
12
21
  type: typeof HelpDisplayType.Material;
13
22
  itemType: M;
@@ -15,14 +24,23 @@ export type MaterialHelpDisplay<P extends number = number, M extends number = nu
15
24
  displayIndex?: number;
16
25
  item: Partial<MaterialItem<P, L>>;
17
26
  };
27
+ /**
28
+ * Data structure describing a help dialog about a {@link Location}
29
+ */
18
30
  export type LocationHelpDisplay<P extends number = number, L extends number = number> = {
19
31
  type: typeof HelpDisplayType.Location;
20
32
  location: Location<P, L>;
21
33
  };
34
+ /**
35
+ * Data structure describing a help dialog about a point in the rules of a game
36
+ */
22
37
  export type RulesHelpDisplay<RuleId extends number = number> = {
23
38
  type: typeof HelpDisplayType.Rules;
24
39
  ruleId: RuleId;
25
40
  };
41
+ /**
42
+ * Move object to display a help dialog
43
+ */
26
44
  export type DisplayHelp<P extends number = number, M extends number = number, L extends number = number> = {
27
45
  kind: MoveKind.LocalMove;
28
46
  type: typeof LocalMoveType.DisplayHelp;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HelpDisplayType = void 0;
4
+ /**
5
+ * Type of help dialogs that can be opened
6
+ */
4
7
  var HelpDisplayType;
5
8
  (function (HelpDisplayType) {
6
9
  HelpDisplayType[HelpDisplayType["Material"] = 1] = "Material";
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayHelp.js","sourceRoot":"","sources":["../../../../src/material/moves/local/DisplayHelp.ts"],"names":[],"mappings":";;;AAgBA,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,6DAAY,CAAA;IAAE,6DAAQ,CAAA;IAAE,uDAAK,CAAA;AAC/B,CAAC,EAFW,eAAe,+BAAf,eAAe,QAE1B"}
1
+ {"version":3,"file":"DisplayHelp.js","sourceRoot":"","sources":["../../../../src/material/moves/local/DisplayHelp.ts"],"names":[],"mappings":";;;AAaA;;GAEG;AACH,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,6DAAY,CAAA;IAAE,6DAAQ,CAAA;IAAE,uDAAK,CAAA;AAC/B,CAAC,EAFW,eAAe,+BAAf,eAAe,QAE1B"}
@@ -1,10 +1,19 @@
1
1
  import { MoveKind } from '../MoveKind';
2
2
  import { LocalMoveType } from './LocalMove';
3
+ /**
4
+ * Move object to remind when a player has dropped an item
5
+ */
3
6
  export type DropItem<M extends number = number> = {
4
7
  kind: MoveKind.LocalMove;
5
8
  type: typeof LocalMoveType.DropItem;
6
9
  item: DisplayedItem<M>;
7
10
  };
11
+ /**
12
+ * Data structure of an item displayed on screen
13
+ * @property type the type of item
14
+ * @property index index of the item
15
+ * @property displayIndex when the item has a quantity, the index of the specific item inside the quantity (otherwise 0)
16
+ */
8
17
  export type DisplayedItem<M extends number = number> = {
9
18
  type: M;
10
19
  index: number;
@@ -2,7 +2,13 @@ import { CloseTutorialPopup } from './CloseTutorialPopup';
2
2
  import { DisplayHelp } from './DisplayHelp';
3
3
  import { DropItem } from './DropItem';
4
4
  import { SetTutorialStep } from './SetTutorialStep';
5
+ /**
6
+ * Common type for all the moves designed to be local (not sent to the server)
7
+ */
5
8
  export type LocalMove<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> = DisplayHelp<Player, MaterialType, LocationType> | DropItem<MaterialType> | SetTutorialStep | CloseTutorialPopup;
9
+ /**
10
+ * Types of local moves
11
+ */
6
12
  export declare enum LocalMoveType {
7
13
  DisplayHelp = 1,
8
14
  DropItem = 2,
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalMoveType = void 0;
4
+ /**
5
+ * Types of local moves
6
+ */
4
7
  var LocalMoveType;
5
8
  (function (LocalMoveType) {
6
9
  LocalMoveType[LocalMoveType["DisplayHelp"] = 1] = "DisplayHelp";
@@ -1 +1 @@
1
- {"version":3,"file":"LocalMove.js","sourceRoot":"","sources":["../../../../src/material/moves/local/LocalMove.ts"],"names":[],"mappings":";;;AAiBA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,+DAAe,CAAA;IAAE,yDAAQ,CAAA;IAAE,uEAAe,CAAA;IAAE,6EAAkB,CAAA;AAChE,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB"}
1
+ {"version":3,"file":"LocalMove.js","sourceRoot":"","sources":["../../../../src/material/moves/local/LocalMove.ts"],"names":[],"mappings":";;;AAcA;;GAEG;AACH,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,+DAAe,CAAA;IAAE,yDAAQ,CAAA;IAAE,uEAAe,CAAA;IAAE,6EAAkB,CAAA;AAChE,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB"}
@@ -1,9 +1,17 @@
1
1
  import { MoveKind } from '../MoveKind';
2
2
  import { LocalMoveType } from './LocalMove';
3
3
  import { MaterialMove } from '../MaterialMove';
4
+ /**
5
+ * Move object to set a tutorial to a specific step
6
+ */
4
7
  export type SetTutorialStep = {
5
8
  kind: MoveKind.LocalMove;
6
9
  type: LocalMoveType.SetTutorialStep;
7
10
  step: number;
8
11
  };
12
+ /**
13
+ * Type guard to test if a {@link MaterialMove} is a {@link SetTutorialStep} move
14
+ * @param move Move to test
15
+ * @returns true if move is a {@link SetTutorialStep}
16
+ */
9
17
  export declare function isSetTutorialStep(move: MaterialMove): move is SetTutorialStep;
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isSetTutorialStep = void 0;
4
4
  var MoveKind_1 = require("../MoveKind");
5
5
  var LocalMove_1 = require("./LocalMove");
6
+ /**
7
+ * Type guard to test if a {@link MaterialMove} is a {@link SetTutorialStep} move
8
+ * @param move Move to test
9
+ * @returns true if move is a {@link SetTutorialStep}
10
+ */
6
11
  function isSetTutorialStep(move) {
7
12
  return move.kind === MoveKind_1.MoveKind.LocalMove && move.type === LocalMove_1.LocalMoveType.SetTutorialStep;
8
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SetTutorialStep.js","sourceRoot":"","sources":["../../../../src/material/moves/local/SetTutorialStep.ts"],"names":[],"mappings":";;;AAAA,wCAAsC;AACtC,yCAA2C;AAiB3C,SAAgB,iBAAiB,CAAC,IAAkB;IAClD,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,yBAAa,CAAC,eAAe,CAAA;AACxF,CAAC;AAFD,8CAEC"}
1
+ {"version":3,"file":"SetTutorialStep.js","sourceRoot":"","sources":["../../../../src/material/moves/local/SetTutorialStep.ts"],"names":[],"mappings":";;;AAAA,wCAAsC;AACtC,yCAA2C;AAY3C;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAkB;IAClD,OAAO,IAAI,CAAC,IAAI,KAAK,mBAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,yBAAa,CAAC,eAAe,CAAA;AACxF,CAAC;AAFD,8CAEC"}
@@ -4,24 +4,100 @@ import { MaterialGame } from '../MaterialGame';
4
4
  import { GameMemory, PlayerMemory } from '../memory';
5
5
  import { CustomMove, ItemMove, MaterialMove, MaterialMoveBuilder, RuleMove } from '../moves';
6
6
  import { RuleStep } from './RuleStep';
7
+ /**
8
+ * When you implement the rules of a game using {@link MaterialRules}, the rules are split into small parts.
9
+ * This is the base class to implement one part of the rules.
10
+ * The constructor cannot be changed as the class is instantiated by {@link MaterialRules}.
11
+ */
7
12
  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> {
13
+ /**
14
+ * Helper function to get a {@link Material} instance to work on some item type in the game.
15
+ * @param type Type of material
16
+ * @returns {Material} the material instance
17
+ */
8
18
  material(type: MaterialType): Material<Player, MaterialType, LocationType>;
19
+ /**
20
+ * This function is called immediately before an {@link ItemMove} is played.
21
+ * @param _move The move which is going to be played
22
+ * @param _context Context of execution
23
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
24
+ */
9
25
  beforeItemMove(_move: ItemMove<Player, MaterialType, LocationType>, _context?: PlayMoveContext): MaterialMove<Player, MaterialType, LocationType>[];
26
+ /**
27
+ * This function is called immediately after an {@link ItemMove} is played.
28
+ * @param _move The move which has just been played
29
+ * @param _context Context of execution
30
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
31
+ */
10
32
  afterItemMove(_move: ItemMove<Player, MaterialType, LocationType>, _context?: PlayMoveContext): MaterialMove<Player, MaterialType, LocationType>[];
33
+ /**
34
+ * This function is called immediately after the {@link RuleMove} that started this rules step was played
35
+ * @param _move The move which has just been played
36
+ * @param _previousRule The step of the rules immediately before this one started
37
+ * @param _context Context of execution
38
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
39
+ */
11
40
  onRuleStart<RuleId extends number>(_move: RuleMove<Player, RuleId>, _previousRule?: RuleStep, _context?: PlayMoveContext): MaterialMove<Player, MaterialType, LocationType>[];
41
+ /**
42
+ * This function is called just before a {@link RuleMove} that leave this rules step is played.
43
+ *
44
+ * BEWARE: any consequences returned here will happen inside the next rule step. Usually we only clean the memory here.
45
+ *
46
+ * @param _move The move which is going to be played
47
+ * @param _context Context of execution
48
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
49
+ */
12
50
  onRuleEnd<RuleId extends number>(_move: RuleMove<Player, RuleId>, _context?: PlayMoveContext): MaterialMove<Player, MaterialType, LocationType>[];
51
+ /**
52
+ * This function is called when a {@link CustomMove} is played.
53
+ * @param _move The move
54
+ * @param _context Context of execution
55
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
56
+ */
13
57
  onCustomMove(_move: CustomMove, _context?: PlayMoveContext): MaterialMove<Player, MaterialType, LocationType>[];
58
+ /**
59
+ * @deprecated replace this.rules().[the function] with: this.[the function]
60
+ */
14
61
  rules(): typeof MaterialMoveBuilder;
15
62
  startPlayerTurn: <P extends number = number, R extends number = number>(id: R, player: P) => import("../moves").StartPlayerTurn<P, R>;
16
63
  startSimultaneousRule: <P extends number = number, R extends number = number>(id: R, players?: P[] | undefined) => import("../moves").StartSimultaneousRule<P, R>;
17
64
  startRule: <R extends number = number>(id: R) => import("../moves").StartRule<R>;
18
65
  customMove: <Type extends number = number>(type: Type, data?: any) => CustomMove;
19
66
  endGame: () => import("../moves").EndGame;
67
+ /**
68
+ * Utility function to access the memory tool for the game or on player.
69
+ * this.game.memory can be used to store any data that is not available through the state of the material, or current rule.
70
+ *
71
+ * @param player Optional, identifier of the player if we want to manipulate a specific player's memory
72
+ * @returns {@link GameMemory} or {@link PlayerMemory} utility
73
+ * @protected
74
+ */
20
75
  protected getMemory(player?: Player): GameMemory<Player> | PlayerMemory<Player>;
76
+ /**
77
+ * Save a new value inside the memory.
78
+ * @param key The key to index the memorized value.
79
+ * @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store.
80
+ * @param player optional, if we need to memorize a different value for each player.
81
+ */
21
82
  memorize<T = any>(key: keyof any, value: T | ((lastValue: T) => T), player?: Player): void;
83
+ /**
84
+ * Retrieve the value memorized under a given key.
85
+ * Shortcut for this.game.memory[key] or this.game.memory[key][player]
86
+ *
87
+ * @param key Key under which the memory is store. Usually a value of a numeric enum named "Memory".
88
+ * @param player optional, if we need to memorize a different value for each player.
89
+ */
22
90
  remind<T = any>(key: keyof any, player?: Player): T;
91
+ /**
92
+ * Delete a value from the memory
93
+ * @param key Key of the value to delete
94
+ * @param player optional, if we need to memorize a different value for each player.
95
+ */
23
96
  forget(key: keyof any, player?: Player): void;
24
97
  }
98
+ /**
99
+ * Creator interface for a class that extends {@link MaterialRulesPart} with the same constructor.
100
+ */
25
101
  export interface MaterialRulesPartCreator<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> {
26
102
  new (game: MaterialGame<Player, MaterialType, LocationType>): MaterialRulesPart<Player, MaterialType, LocationType>;
27
103
  }
@@ -20,7 +20,12 @@ var Rules_1 = require("../../Rules");
20
20
  var items_1 = require("../items");
21
21
  var memory_1 = require("../memory");
22
22
  var moves_1 = require("../moves");
23
- var MaterialRulesPart = (function (_super) {
23
+ /**
24
+ * When you implement the rules of a game using {@link MaterialRules}, the rules are split into small parts.
25
+ * This is the base class to implement one part of the rules.
26
+ * The constructor cannot be changed as the class is instantiated by {@link MaterialRules}.
27
+ */
28
+ var MaterialRulesPart = /** @class */ (function (_super) {
24
29
  __extends(MaterialRulesPart, _super);
25
30
  function MaterialRulesPart() {
26
31
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -31,37 +36,105 @@ var MaterialRulesPart = (function (_super) {
31
36
  _this.endGame = moves_1.MaterialMoveBuilder.endGame;
32
37
  return _this;
33
38
  }
39
+ /**
40
+ * Helper function to get a {@link Material} instance to work on some item type in the game.
41
+ * @param type Type of material
42
+ * @returns {Material} the material instance
43
+ */
34
44
  MaterialRulesPart.prototype.material = function (type) {
35
45
  var _a;
36
46
  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; }));
37
47
  };
48
+ /**
49
+ * This function is called immediately before an {@link ItemMove} is played.
50
+ * @param _move The move which is going to be played
51
+ * @param _context Context of execution
52
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
53
+ */
38
54
  MaterialRulesPart.prototype.beforeItemMove = function (_move, _context) {
39
55
  return [];
40
56
  };
57
+ /**
58
+ * This function is called immediately after an {@link ItemMove} is played.
59
+ * @param _move The move which has just been played
60
+ * @param _context Context of execution
61
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
62
+ */
41
63
  MaterialRulesPart.prototype.afterItemMove = function (_move, _context) {
42
64
  return [];
43
65
  };
66
+ /**
67
+ * This function is called immediately after the {@link RuleMove} that started this rules step was played
68
+ * @param _move The move which has just been played
69
+ * @param _previousRule The step of the rules immediately before this one started
70
+ * @param _context Context of execution
71
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
72
+ */
44
73
  MaterialRulesPart.prototype.onRuleStart = function (_move, _previousRule, _context) {
45
74
  return [];
46
75
  };
76
+ /**
77
+ * This function is called just before a {@link RuleMove} that leave this rules step is played.
78
+ *
79
+ * BEWARE: any consequences returned here will happen inside the next rule step. Usually we only clean the memory here.
80
+ *
81
+ * @param _move The move which is going to be played
82
+ * @param _context Context of execution
83
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
84
+ */
47
85
  MaterialRulesPart.prototype.onRuleEnd = function (_move, _context) {
48
86
  return [];
49
87
  };
88
+ /**
89
+ * This function is called when a {@link CustomMove} is played.
90
+ * @param _move The move
91
+ * @param _context Context of execution
92
+ * @returns {MaterialMove[]} Any consequences that should automatically be played after the move
93
+ */
50
94
  MaterialRulesPart.prototype.onCustomMove = function (_move, _context) {
51
95
  return [];
52
96
  };
97
+ /**
98
+ * @deprecated replace this.rules().[the function] with: this.[the function]
99
+ */
53
100
  MaterialRulesPart.prototype.rules = function () {
54
101
  return moves_1.MaterialMoveBuilder;
55
102
  };
103
+ /**
104
+ * Utility function to access the memory tool for the game or on player.
105
+ * this.game.memory can be used to store any data that is not available through the state of the material, or current rule.
106
+ *
107
+ * @param player Optional, identifier of the player if we want to manipulate a specific player's memory
108
+ * @returns {@link GameMemory} or {@link PlayerMemory} utility
109
+ * @protected
110
+ */
56
111
  MaterialRulesPart.prototype.getMemory = function (player) {
57
112
  return player === undefined ? new memory_1.GameMemory(this.game) : new memory_1.PlayerMemory(this.game, player);
58
113
  };
114
+ /**
115
+ * Save a new value inside the memory.
116
+ * @param key The key to index the memorized value.
117
+ * @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store.
118
+ * @param player optional, if we need to memorize a different value for each player.
119
+ */
59
120
  MaterialRulesPart.prototype.memorize = function (key, value, player) {
60
121
  this.getMemory(player).memorize(key, value);
61
122
  };
123
+ /**
124
+ * Retrieve the value memorized under a given key.
125
+ * Shortcut for this.game.memory[key] or this.game.memory[key][player]
126
+ *
127
+ * @param key Key under which the memory is store. Usually a value of a numeric enum named "Memory".
128
+ * @param player optional, if we need to memorize a different value for each player.
129
+ */
62
130
  MaterialRulesPart.prototype.remind = function (key, player) {
63
131
  return this.getMemory(player).remind(key);
64
132
  };
133
+ /**
134
+ * Delete a value from the memory
135
+ * @param key Key of the value to delete
136
+ * @param player optional, if we need to memorize a different value for each player.
137
+ */
65
138
  MaterialRulesPart.prototype.forget = function (key, player) {
66
139
  this.getMemory(player).forget(key);
67
140
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialRulesPart.js","sourceRoot":"","sources":["../../../src/material/rules/MaterialRulesPart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,kCAAmC;AAEnC,oCAAoD;AACpD,kCAA4F;AAQ5F;IACU,qCAAiH;IAD3H;;QAyEE,qBAAe,GAAG,2BAAmB,CAAC,eAAe,CAAA;QACrD,2BAAqB,GAAG,2BAAmB,CAAC,qBAAqB,CAAA;QACjE,eAAS,GAAG,2BAAmB,CAAC,SAAS,CAAA;QACzC,gBAAU,GAAG,2BAAmB,CAAC,UAAU,CAAA;QAC3C,aAAO,GAAG,2BAAmB,CAAC,OAAO,CAAA;;IA2CvC,CAAC;IAhHC,oCAAQ,GAAR,UAAS,IAAkB;;QACzB,OAAO,IAAI,gBAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,EAAvB,CAAuB,CAAC,CAAC,CAAA;IACzH,CAAC;IAQD,0CAAc,GAAd,UAAe,KAAmD,EAAE,QAA0B;QAC5F,OAAO,EAAE,CAAA;IACX,CAAC;IAQD,yCAAa,GAAb,UAAc,KAAmD,EAAE,QAA0B;QAC3F,OAAO,EAAE,CAAA;IACX,CAAC;IASD,uCAAW,GAAX,UAAmC,KAA+B,EAAE,aAAwB,EAAE,QAA0B;QACtH,OAAO,EAAE,CAAA;IACX,CAAC;IAWD,qCAAS,GAAT,UAAiC,KAA+B,EAAE,QAA0B;QAC1F,OAAO,EAAE,CAAA;IACX,CAAC;IAQD,wCAAY,GAAZ,UAAa,KAAiB,EAAE,QAA0B;QACxD,OAAO,EAAE,CAAA;IACX,CAAC;IAKD,iCAAK,GAAL;QACE,OAAO,2BAAmB,CAAA;IAC5B,CAAC;IAgBS,qCAAS,GAAnB,UAAoB,MAAe;QACjC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,mBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAY,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC/F,CAAC;IAQD,oCAAQ,GAAR,UAAkB,GAAc,EAAE,KAAgC,EAAE,MAAe;QACjF,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC7C,CAAC;IASD,kCAAM,GAAN,UAAgB,GAAc,EAAE,MAAe;QAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC3C,CAAC;IAOD,kCAAM,GAAN,UAAO,GAAc,EAAE,MAAe;QACpC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACpC,CAAC;IACH,wBAAC;AAAD,CAAC,AAxHD,CACU,aAAK,GAuHd;AAxHqB,8CAAiB"}
1
+ {"version":3,"file":"MaterialRulesPart.js","sourceRoot":"","sources":["../../../src/material/rules/MaterialRulesPart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,kCAAmC;AAEnC,oCAAoD;AACpD,kCAA4F;AAG5F;;;;GAIG;AACH;IACU,qCAAiH;IAD3H;;QAyEE,qBAAe,GAAG,2BAAmB,CAAC,eAAe,CAAA;QACrD,2BAAqB,GAAG,2BAAmB,CAAC,qBAAqB,CAAA;QACjE,eAAS,GAAG,2BAAmB,CAAC,SAAS,CAAA;QACzC,gBAAU,GAAG,2BAAmB,CAAC,UAAU,CAAA;QAC3C,aAAO,GAAG,2BAAmB,CAAC,OAAO,CAAA;;IA2CvC,CAAC;IArHC;;;;OAIG;IACH,oCAAQ,GAAR,UAAS,IAAkB;;QACzB,OAAO,IAAI,gBAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,EAAvB,CAAuB,CAAC,CAAC,CAAA;IACzH,CAAC;IAED;;;;;OAKG;IACH,0CAAc,GAAd,UAAe,KAAmD,EAAE,QAA0B;QAC5F,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;;;;OAKG;IACH,yCAAa,GAAb,UAAc,KAAmD,EAAE,QAA0B;QAC3F,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;;;;;OAMG;IACH,uCAAW,GAAX,UAAmC,KAA+B,EAAE,aAAwB,EAAE,QAA0B;QACtH,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;;;;;;;OAQG;IACH,qCAAS,GAAT,UAAiC,KAA+B,EAAE,QAA0B;QAC1F,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;;;;OAKG;IACH,wCAAY,GAAZ,UAAa,KAAiB,EAAE,QAA0B;QACxD,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;OAEG;IACH,iCAAK,GAAL;QACE,OAAO,2BAAmB,CAAA;IAC5B,CAAC;IAQD;;;;;;;OAOG;IACO,qCAAS,GAAnB,UAAoB,MAAe;QACjC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,mBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAY,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC/F,CAAC;IAED;;;;;OAKG;IACH,oCAAQ,GAAR,UAAkB,GAAc,EAAE,KAAgC,EAAE,MAAe;QACjF,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,kCAAM,GAAN,UAAgB,GAAc,EAAE,MAAe;QAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC3C,CAAC;IAED;;;;OAIG;IACH,kCAAM,GAAN,UAAO,GAAc,EAAE,MAAe;QACpC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACpC,CAAC;IACH,wBAAC;AAAD,CAAC,AAxHD,CACU,aAAK,GAuHd;AAxHqB,8CAAiB"}
@@ -1,9 +1,28 @@
1
1
  import { MaterialMove } from '../moves';
2
2
  import { MaterialRulesPart } from './MaterialRulesPart';
3
+ /**
4
+ * Base class for any part of the rules where only one player has to do something.
5
+ */
3
6
  export declare abstract class PlayerTurnRule<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends MaterialRulesPart<Player, MaterialType, LocationType> {
7
+ /**
8
+ * Shortcut to get the awaited player (this.game.rule.player)
9
+ */
4
10
  get player(): Player;
11
+ /**
12
+ * Utility function to get the id of the next player in the table order
13
+ */
5
14
  get nextPlayer(): Player;
15
+ /**
16
+ * See {@link Rules.getActivePlayer}
17
+ */
6
18
  getActivePlayer(): Player;
19
+ /**
20
+ * See {@link Rules.getLegalMoves}
21
+ */
7
22
  getLegalMoves(player: Player): MaterialMove<Player, MaterialType, LocationType>[];
23
+ /**
24
+ * Implement this to expose all the legal moves of the active player.
25
+ * @returns All the {@link MaterialMove} that current active player can play
26
+ */
8
27
  getPlayerMoves(): MaterialMove<Player, MaterialType, LocationType>[];
9
28
  }
@@ -17,12 +17,18 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.PlayerTurnRule = void 0;
19
19
  var MaterialRulesPart_1 = require("./MaterialRulesPart");
20
- var PlayerTurnRule = (function (_super) {
20
+ /**
21
+ * Base class for any part of the rules where only one player has to do something.
22
+ */
23
+ var PlayerTurnRule = /** @class */ (function (_super) {
21
24
  __extends(PlayerTurnRule, _super);
22
25
  function PlayerTurnRule() {
23
26
  return _super !== null && _super.apply(this, arguments) || this;
24
27
  }
25
28
  Object.defineProperty(PlayerTurnRule.prototype, "player", {
29
+ /**
30
+ * Shortcut to get the awaited player (this.game.rule.player)
31
+ */
26
32
  get: function () {
27
33
  return this.game.rule.player;
28
34
  },
@@ -30,20 +36,33 @@ var PlayerTurnRule = (function (_super) {
30
36
  configurable: true
31
37
  });
32
38
  Object.defineProperty(PlayerTurnRule.prototype, "nextPlayer", {
39
+ /**
40
+ * Utility function to get the id of the next player in the table order
41
+ */
33
42
  get: function () {
34
43
  return this.game.players[(this.game.players.indexOf(this.player) + 1) % this.game.players.length];
35
44
  },
36
45
  enumerable: false,
37
46
  configurable: true
38
47
  });
48
+ /**
49
+ * See {@link Rules.getActivePlayer}
50
+ */
39
51
  PlayerTurnRule.prototype.getActivePlayer = function () {
40
52
  return this.player;
41
53
  };
54
+ /**
55
+ * See {@link Rules.getLegalMoves}
56
+ */
42
57
  PlayerTurnRule.prototype.getLegalMoves = function (player) {
43
58
  if (player !== this.getActivePlayer())
44
59
  return [];
45
60
  return this.getPlayerMoves();
46
61
  };
62
+ /**
63
+ * Implement this to expose all the legal moves of the active player.
64
+ * @returns All the {@link MaterialMove} that current active player can play
65
+ */
47
66
  PlayerTurnRule.prototype.getPlayerMoves = function () {
48
67
  return [];
49
68
  };