@gamepark/rules-api 6.0.1-alpha.0 → 6.0.3-alpha.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 (89) hide show
  1. package/dist/material/HiddenMaterialRules.d.ts +13 -11
  2. package/dist/material/HiddenMaterialRules.js +28 -23
  3. package/dist/material/HiddenMaterialRules.js.map +1 -1
  4. package/dist/material/MaterialRules.d.ts +13 -12
  5. package/dist/material/MaterialRules.js +22 -27
  6. package/dist/material/MaterialRules.js.map +1 -1
  7. package/dist/material/SecretMaterialRules.d.ts +3 -3
  8. package/dist/material/index.d.ts +0 -1
  9. package/dist/material/index.js +0 -1
  10. package/dist/material/index.js.map +1 -1
  11. package/dist/material/items/Material.d.ts +12 -7
  12. package/dist/material/items/Material.js +72 -50
  13. package/dist/material/items/Material.js.map +1 -1
  14. package/dist/material/items/MaterialItem.d.ts +5 -3
  15. package/dist/material/items/MaterialMutator.d.ts +20 -0
  16. package/dist/material/items/MaterialMutator.js +151 -0
  17. package/dist/material/items/MaterialMutator.js.map +1 -0
  18. package/dist/material/items/MaterialOperation.d.ts +1 -4
  19. package/dist/material/items/MaterialOperation.js +16 -30
  20. package/dist/material/items/MaterialOperation.js.map +1 -1
  21. package/dist/material/items/index.d.ts +1 -1
  22. package/dist/material/items/index.js +1 -1
  23. package/dist/material/items/index.js.map +1 -1
  24. package/dist/material/location/Location.d.ts +0 -1
  25. package/dist/material/location/Location.js +0 -9
  26. package/dist/material/location/Location.js.map +1 -1
  27. package/dist/material/location/strategy/FillGapStrategy.d.ts +10 -0
  28. package/dist/material/location/strategy/FillGapStrategy.js +25 -0
  29. package/dist/material/location/strategy/FillGapStrategy.js.map +1 -0
  30. package/dist/material/location/strategy/index.d.ts +1 -0
  31. package/dist/material/location/strategy/index.js +1 -0
  32. package/dist/material/location/strategy/index.js.map +1 -1
  33. package/dist/material/moves/CustomMove.d.ts +2 -0
  34. package/dist/material/moves/CustomMove.js +6 -0
  35. package/dist/material/moves/CustomMove.js.map +1 -1
  36. package/dist/material/moves/MaterialMove.d.ts +6 -11
  37. package/dist/material/moves/MoveItem.d.ts +11 -9
  38. package/dist/material/moves/MoveItem.js +9 -45
  39. package/dist/material/moves/MoveItem.js.map +1 -1
  40. package/dist/material/moves/MoveKind.d.ts +1 -1
  41. package/dist/material/moves/MoveKind.js +1 -1
  42. package/dist/material/moves/MoveKind.js.map +1 -1
  43. package/dist/material/moves/index.d.ts +1 -6
  44. package/dist/material/moves/index.js +1 -6
  45. package/dist/material/moves/index.js.map +1 -1
  46. package/dist/material/moves/items/CreateItem.d.ts +9 -0
  47. package/dist/material/moves/items/CreateItem.js +10 -0
  48. package/dist/material/moves/items/CreateItem.js.map +1 -0
  49. package/dist/material/moves/items/DeleteItem.d.ts +9 -0
  50. package/dist/material/moves/items/DeleteItem.js +10 -0
  51. package/dist/material/moves/items/DeleteItem.js.map +1 -0
  52. package/dist/material/moves/items/ItemMove.d.ts +11 -0
  53. package/dist/material/moves/{MaterialRulesMove.js → items/ItemMove.js} +1 -1
  54. package/dist/material/moves/items/ItemMove.js.map +1 -0
  55. package/dist/material/moves/items/ItemMoveType.d.ts +6 -0
  56. package/dist/material/moves/items/ItemMoveType.js +11 -0
  57. package/dist/material/moves/items/ItemMoveType.js.map +1 -0
  58. package/dist/material/moves/items/ItemMovesBuilder.d.ts +8 -0
  59. package/dist/material/moves/items/ItemMovesBuilder.js +34 -0
  60. package/dist/material/moves/items/ItemMovesBuilder.js.map +1 -0
  61. package/dist/material/moves/items/MoveItem.d.ts +16 -0
  62. package/dist/material/moves/items/MoveItem.js +14 -0
  63. package/dist/material/moves/items/MoveItem.js.map +1 -0
  64. package/dist/material/moves/items/Shuffle.d.ts +11 -0
  65. package/dist/material/moves/items/Shuffle.js +10 -0
  66. package/dist/material/moves/items/Shuffle.js.map +1 -0
  67. package/dist/material/moves/items/index.d.ts +7 -0
  68. package/dist/material/moves/items/index.js +24 -0
  69. package/dist/material/moves/items/index.js.map +1 -0
  70. package/dist/material/moves/local/RulesDisplay.d.ts +1 -1
  71. package/dist/material/moves/rules/EndGame.d.ts +2 -0
  72. package/dist/material/moves/rules/EndGame.js +7 -0
  73. package/dist/material/moves/rules/EndGame.js.map +1 -1
  74. package/dist/material/moves/rules/MaterialMutator.d.ts +17 -0
  75. package/dist/material/moves/rules/MaterialMutator.js +133 -0
  76. package/dist/material/moves/rules/MaterialMutator.js.map +1 -0
  77. package/dist/material/moves/rules/StartPlayerTurn.d.ts +2 -0
  78. package/dist/material/moves/rules/StartPlayerTurn.js +7 -0
  79. package/dist/material/moves/rules/StartPlayerTurn.js.map +1 -1
  80. package/dist/material/moves/rules/StartRule.d.ts +2 -0
  81. package/dist/material/moves/rules/StartRule.js +7 -0
  82. package/dist/material/moves/rules/StartRule.js.map +1 -1
  83. package/dist/material/rules/MaterialStepRules.d.ts +7 -7
  84. package/dist/material/rules/MaterialStepRules.js +2 -2
  85. package/dist/material/rules/MaterialStepRules.js.map +1 -1
  86. package/dist/material/rules/PlayerTurnRule.d.ts +4 -4
  87. package/package.json +2 -2
  88. package/dist/material/moves/MaterialRulesMove.d.ts +0 -6
  89. package/dist/material/moves/MaterialRulesMove.js.map +0 -1
@@ -1,18 +1,20 @@
1
1
  import { IncompleteInformation } from '../IncompleteInformation';
2
2
  import { MaterialRules } from './MaterialRules';
3
3
  import { MaterialGame } from './MaterialGame';
4
- import { CreateItem, MaterialRulesMove, MaterialRulesMoveRandomized, MoveItem } from './moves';
4
+ import { CreateItem, MaterialMove, MaterialRulesMoveRandomized, MoveItem } from './moves';
5
5
  import { MaterialItem } from './items';
6
- export declare abstract class HiddenMaterialRules<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends MaterialRules<Player, MaterialType, LocationType> implements IncompleteInformation<MaterialGame<Player, MaterialType, LocationType>, MaterialRulesMove<Player, MaterialType, LocationType>, MaterialRulesMove<Player, MaterialType, LocationType>> {
7
- abstract hidingStrategies: Partial<Record<MaterialType, Partial<Record<LocationType, HidingStrategy<Player, LocationType>>>>>;
8
- getItemTypeHidingStrategies(type: MaterialType): Partial<Record<LocationType, HidingStrategy<Player, LocationType>>> | undefined;
9
- isUnpredictableMove(move: MaterialRulesMove<Player, MaterialType, LocationType>): boolean;
10
- randomize(move: MaterialRulesMove<Player, MaterialType, LocationType>): MaterialRulesMove<Player, MaterialType, LocationType> & MaterialRulesMoveRandomized<Player, MaterialType, LocationType>;
11
- getView(player?: Player): any;
12
- hideItem(type: MaterialType, item: MaterialItem<Player, LocationType>, player?: Player): MaterialItem<Player, LocationType>;
13
- getMoveView(move: MaterialRulesMoveRandomized<Player, MaterialType, LocationType>, player?: Player): MaterialRulesMove<Player, MaterialType, LocationType>;
14
- getMoveItemView(move: MoveItem<Player, MaterialType, LocationType>, player?: Player): MoveItem<Player, MaterialType, LocationType>;
15
- getCreateItemsView(move: CreateItem<Player, MaterialType, LocationType>, player?: Player): CreateItem<Player, MaterialType, LocationType>;
6
+ export declare abstract class HiddenMaterialRules<P extends number = number, M extends number = number, L extends number = number> extends MaterialRules<P, M, L> implements IncompleteInformation<MaterialGame<P, M, L>, MaterialMove<P, M, L>, MaterialMove<P, M, L>> {
7
+ abstract hidingStrategies: Partial<Record<M, Partial<Record<L, HidingStrategy<P, L>>>>>;
8
+ getItemTypeHidingStrategies(type: M): Partial<Record<L, HidingStrategy<P, L>>> | undefined;
9
+ isUnpredictableMove(move: MaterialMove<P, M, L>): boolean;
10
+ randomize(move: MaterialMove<P, M, L>): MaterialMove<P, M, L> & MaterialRulesMoveRandomized<P, M, L>;
11
+ getView(player?: P): any;
12
+ hideItem(type: M, item: MaterialItem<P, L>, player?: P): MaterialItem<P, L>;
13
+ getMoveView(move: MaterialRulesMoveRandomized<P, M, L>, player?: P): MaterialMove<P, M, L>;
14
+ getMoveItemView(move: MoveItem<P, M, L>, player?: P): MoveItem<P, M, L>;
15
+ moveItemRevealsInformation(dataBefore: Omit<MaterialItem, 'quantity' | 'location' | 'rotation'>, dataAfter: Omit<MaterialItem, 'quantity' | 'location' | 'rotation'>): boolean;
16
+ private getHideItemData;
17
+ getCreateItemsView(move: CreateItem<P, M, L>, player?: P): CreateItem<P, M, L>;
16
18
  private getShuffleItemsView;
17
19
  }
18
20
  export declare type HidingStrategy<P extends number = number, L extends number = number> = (item: MaterialItem<P, L>) => MaterialItem<P, L>;
@@ -45,7 +45,6 @@ var lodash_mapvalues_1 = __importDefault(require("lodash.mapvalues"));
45
45
  var MaterialRules_1 = require("./MaterialRules");
46
46
  var moves_1 = require("./moves");
47
47
  var items_1 = require("./items");
48
- var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
49
48
  var HiddenMaterialRules = /** @class */ (function (_super) {
50
49
  __extends(HiddenMaterialRules, _super);
51
50
  function HiddenMaterialRules() {
@@ -57,21 +56,23 @@ var HiddenMaterialRules = /** @class */ (function (_super) {
57
56
  HiddenMaterialRules.prototype.isUnpredictableMove = function (move) {
58
57
  if (_super.prototype.isUnpredictableMove.call(this, move))
59
58
  return true;
60
- if (move.kind !== moves_1.MoveKind.MaterialMove)
59
+ if (move.kind !== moves_1.MoveKind.ItemMove)
61
60
  return false;
62
- if (move.type === moves_1.MaterialMoveType.Move) {
63
- return move.reveal === true;
61
+ if (move.type === moves_1.ItemMoveType.Move) {
62
+ return move.reveal !== undefined;
64
63
  }
65
64
  return false;
66
65
  };
67
66
  HiddenMaterialRules.prototype.randomize = function (move) {
68
- if (move.kind === moves_1.MoveKind.MaterialMove && move.type === moves_1.MaterialMoveType.Move) {
69
- // Hack the randomize function to flag any item movement that reveals something, thus making the action undoable
70
- for (var _i = 0, _a = this.game.players; _i < _a.length; _i++) {
71
- var player = _a[_i];
72
- var moveView = this.getMoveItemView(move, player);
73
- if (!(0, fast_deep_equal_1.default)(move, moveView)) {
74
- return _super.prototype.randomize.call(this, __assign(__assign({}, move), { reveal: true }));
67
+ if (move.kind === moves_1.MoveKind.ItemMove && move.type === moves_1.ItemMoveType.Move) {
68
+ if (this.hidingStrategies /* TODO: can be undefined during setup because setup is called by constructor */) {
69
+ for (var _i = 0, _a = this.game.players; _i < _a.length; _i++) {
70
+ var player = _a[_i];
71
+ var moveView = this.getMoveItemView(move, player);
72
+ if (moveView.reveal) {
73
+ // We flag the move in order to know that it revealed something to someone, which means it cannot be undone
74
+ return _super.prototype.randomize.call(this, __assign(__assign({}, move), { reveal: true }));
75
+ }
75
76
  }
76
77
  }
77
78
  }
@@ -97,27 +98,31 @@ var HiddenMaterialRules = /** @class */ (function (_super) {
97
98
  return strategy(item, player);
98
99
  };
99
100
  HiddenMaterialRules.prototype.getMoveView = function (move, player) {
100
- if (move.kind === moves_1.MoveKind.MaterialMove && move.itemType in this.hidingStrategies) {
101
+ if (move.kind === moves_1.MoveKind.ItemMove && move.itemType in this.hidingStrategies) {
101
102
  switch (move.type) {
102
- case moves_1.MaterialMoveType.Move:
103
+ case moves_1.ItemMoveType.Move:
103
104
  return this.getMoveItemView(move, player);
104
- case moves_1.MaterialMoveType.Create:
105
+ case moves_1.ItemMoveType.Create:
105
106
  return this.getCreateItemsView(move, player);
106
- case moves_1.MaterialMoveType.Shuffle:
107
+ case moves_1.ItemMoveType.Shuffle:
107
108
  return this.getShuffleItemsView(move, player);
108
109
  }
109
110
  }
110
111
  return move;
111
112
  };
112
113
  HiddenMaterialRules.prototype.getMoveItemView = function (move, player) {
113
- if (!(0, items_1.isItemWithLocation)(move.item))
114
- return move;
115
- var movedItem = this.material(move.itemType).getItem(move.itemIndex);
116
- var movedItemView = this.hideItem(move.itemType, movedItem, player);
117
- if ((0, fast_deep_equal_1.default)(movedItem, movedItemView))
118
- return move;
119
- var item = __assign(__assign({}, move.item), { id: movedItem.id });
120
- return __assign(__assign({}, move), { item: this.hideItem(move.itemType, item, player) });
114
+ var mutator = new items_1.MaterialMutator(move.itemType, this.game.items[move.itemType]);
115
+ var movedItemData = this.getHideItemData(move.itemType, this.material(move.itemType).getItem(move.itemIndex), player);
116
+ var newItemData = this.getHideItemData(move.itemType, mutator.getItemAfterMove(move), player);
117
+ return this.moveItemRevealsInformation(movedItemData, newItemData) ? __assign(__assign({}, move), { reveal: newItemData }) : move;
118
+ };
119
+ // Overload if needed
120
+ HiddenMaterialRules.prototype.moveItemRevealsInformation = function (dataBefore, dataAfter) {
121
+ return dataAfter.id !== undefined && dataBefore.id === undefined;
122
+ };
123
+ HiddenMaterialRules.prototype.getHideItemData = function (type, item, player) {
124
+ var _a = this.hideItem(type, item, player), quantity = _a.quantity, rotation = _a.rotation, location = _a.location, hideItemData = __rest(_a, ["quantity", "rotation", "location"]);
125
+ return hideItemData;
121
126
  };
122
127
  HiddenMaterialRules.prototype.getCreateItemsView = function (move, player) {
123
128
  return __assign(__assign({}, move), { item: this.hideItem(move.itemType, move.item, player) });
@@ -1 +1 @@
1
- {"version":3,"file":"HiddenMaterialRules.js","sourceRoot":"","sources":["../../src/material/HiddenMaterialRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sEAAwC;AACxC,iDAA+C;AAE/C,iCASgB;AAChB,iCAA0D;AAE1D,oEAAmC;AAEnC;IACU,uCAAiD;IAD3D;;IAoFA,CAAC;IA9EC,yDAA2B,GAA3B,UAA4B,IAAkB;QAC5C,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED,iDAAmB,GAAnB,UAAoB,IAA2D;QAC7E,IAAI,iBAAM,mBAAmB,YAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QAChD,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAQ,CAAC,YAAY;YAAE,OAAO,KAAK,CAAA;QACrD,IAAI,IAAI,CAAC,IAAI,KAAK,wBAAgB,CAAC,IAAI,EAAE;YACvC,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,CAAA;SAC5B;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,uCAAS,GAAT,UAAU,IAA2D;QACnE,IAAI,IAAI,CAAC,IAAI,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IAC3E,CAAC;IAEO,iDAAmB,GAA3B,UAA4B,IAA0B,EAAE,OAAW;QACjE,+FAA+F;QACvF,IAAA,UAAU,GAAkB,IAAI,WAAtB,EAAK,QAAQ,UAAK,IAAI,EAAlC,cAA2B,CAAF,CAAS;QACxC,OAAO,QAAQ,CAAA;IACjB,CAAC;IACH,0BAAC;AAAD,CAAC,AAhGD,CACU,6BAAa,GA+FtB;AAhGqB,kDAAmB;AAoGlC,IAAM,UAAU,GAAG,UAAuD,IAAwB;IAC/F,IAAA,EAAE,GAAoB,IAAI,GAAxB,EAAK,UAAU,UAAK,IAAI,EAA5B,MAAqB,CAAF,CAAS;IAClC,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAHY,QAAA,UAAU,cAGtB"}
@@ -1,18 +1,18 @@
1
1
  import { MaterialGame } from './MaterialGame';
2
2
  import { Rules } from '../Rules';
3
- import { MaterialRulesMove, MaterialRulesMoveRandomized } from './moves';
4
- import { Material, MaterialItem, MaterialOperation } from './items';
3
+ import { MaterialMove, MaterialRulesMoveRandomized } from './moves';
4
+ import { Material, MaterialItem } from './items';
5
5
  import { RandomMove } from '../RandomMove';
6
6
  import { MaterialRulesStepCreator, MaterialStepRules } from './rules';
7
7
  import { LocationStrategy } from './location';
8
8
  import { Undo } from '../Undo';
9
9
  import { Action } from '../Action';
10
- export declare abstract class MaterialRules<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends Rules<MaterialGame<Player, MaterialType, LocationType>, MaterialRulesMove<Player, MaterialType, LocationType>, Player> implements RandomMove<MaterialRulesMove<Player, MaterialType, LocationType>, MaterialRulesMoveRandomized<Player, MaterialType, LocationType>>, Undo<MaterialGame<Player, MaterialType, LocationType>, MaterialRulesMove<Player, MaterialType, LocationType>, Player> {
10
+ export declare abstract class MaterialRules<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends Rules<MaterialGame<Player, MaterialType, LocationType>, MaterialMove<Player, MaterialType, LocationType>, Player> implements RandomMove<MaterialMove<Player, MaterialType, LocationType>, MaterialRulesMoveRandomized<Player, MaterialType, LocationType>>, Undo<MaterialGame<Player, MaterialType, LocationType>, MaterialMove<Player, MaterialType, LocationType>, Player> {
11
11
  constructor(state: MaterialGame<Player, MaterialType, LocationType>);
12
12
  constructor(options: any);
13
13
  items(type: MaterialType): MaterialItem<Player, LocationType>[];
14
+ setupMaterial(type: MaterialType): Material<Player, MaterialType, LocationType>;
14
15
  material(type: MaterialType): Material<Player, MaterialType, LocationType>;
15
- materialOperations(type: MaterialType): MaterialOperation<Player, MaterialType, LocationType>;
16
16
  abstract setup(options: any): void;
17
17
  abstract get rulesSteps(): Record<number, MaterialRulesStepCreator<Player, MaterialType, LocationType>>;
18
18
  getLocationsStrategies(): Partial<Record<MaterialType, Partial<Record<LocationType, LocationStrategy<Player, MaterialType, LocationType>>>>>;
@@ -20,13 +20,14 @@ export declare abstract class MaterialRules<Player extends number = number, Mate
20
20
  getMemory<T>(player?: Player): T;
21
21
  delegate(): MaterialStepRules<Player, MaterialType, LocationType> | undefined;
22
22
  start<RuleId extends number = number>(id: RuleId, player?: Player, memory?: Record<string, any>): void;
23
- randomize(move: MaterialRulesMove<Player, MaterialType, LocationType>): MaterialRulesMove<Player, MaterialType, LocationType> & MaterialRulesMoveRandomized<Player, MaterialType, LocationType>;
24
- play(move: MaterialRulesMove<Player, MaterialType, LocationType> & MaterialRulesMoveRandomized<Player, MaterialType, LocationType>): MaterialRulesMove<Player, MaterialType, LocationType>[];
25
- canUndo(action: Action<MaterialRulesMove<Player, MaterialType, LocationType>, Player>, consecutiveActions: Action<MaterialRulesMove<Player, MaterialType, LocationType>, Player>[]): boolean;
26
- actionBlocksUndo(action: Action<MaterialRulesMove<Player, MaterialType, LocationType>, Player>): boolean;
27
- actionActivatesPlayer(action: Action<MaterialRulesMove<Player, MaterialType, LocationType>, Player>): boolean;
28
- moveBlocksUndo(move: MaterialRulesMove<Player, MaterialType, LocationType>): boolean;
29
- moveActivatesPlayer(move: MaterialRulesMove<Player, MaterialType, LocationType>): boolean;
30
- isUnpredictableMove(move: MaterialRulesMove<Player, MaterialType, LocationType>): boolean;
23
+ randomize(move: MaterialMove<Player, MaterialType, LocationType>): MaterialMove<Player, MaterialType, LocationType> & MaterialRulesMoveRandomized<Player, MaterialType, LocationType>;
24
+ play(move: MaterialMove<Player, MaterialType, LocationType> & MaterialRulesMoveRandomized<Player, MaterialType, LocationType>): MaterialMove<Player, MaterialType, LocationType>[];
25
+ isMoveTrigger(move: MaterialMove<Player, MaterialType, LocationType>, predicate: (move: MaterialMove<Player, MaterialType, LocationType>) => boolean): boolean;
26
+ canUndo(action: Action<MaterialMove<Player, MaterialType, LocationType>, Player>, consecutiveActions: Action<MaterialMove<Player, MaterialType, LocationType>, Player>[]): boolean;
27
+ actionBlocksUndo(action: Action<MaterialMove<Player, MaterialType, LocationType>, Player>): boolean;
28
+ actionActivatesPlayer(action: Action<MaterialMove<Player, MaterialType, LocationType>, Player>): boolean;
29
+ moveBlocksUndo(move: MaterialMove<Player, MaterialType, LocationType>): boolean;
30
+ moveActivatesPlayer(move: MaterialMove<Player, MaterialType, LocationType>): boolean;
31
+ isUnpredictableMove(move: MaterialMove<Player, MaterialType, LocationType>): boolean;
31
32
  restoreLocalMoves(game: MaterialGame<Player, MaterialType, LocationType>): void;
32
33
  }
@@ -49,15 +49,17 @@ var MaterialRules = /** @class */ (function (_super) {
49
49
  var _a;
50
50
  return (_a = this.game.items[type]) !== null && _a !== void 0 ? _a : [];
51
51
  };
52
+ MaterialRules.prototype.setupMaterial = function (type) {
53
+ var _this = this;
54
+ var _a;
55
+ 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; }), function (move) {
56
+ _this.play(_this.randomize(JSON.parse(JSON.stringify(move))));
57
+ });
58
+ };
52
59
  MaterialRules.prototype.material = function (type) {
53
60
  var _a;
54
61
  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; }));
55
62
  };
56
- MaterialRules.prototype.materialOperations = function (type) {
57
- if (!this.game.items[type])
58
- this.game.items[type] = [];
59
- return new items_1.MaterialOperation(type, this.game.items[type], this.getLocationsStrategies()[type]);
60
- };
61
63
  MaterialRules.prototype.getLocationsStrategies = function () {
62
64
  return {};
63
65
  };
@@ -83,9 +85,9 @@ var MaterialRules = /** @class */ (function (_super) {
83
85
  this.game.rule = { id: id, player: player, memory: memory };
84
86
  };
85
87
  MaterialRules.prototype.randomize = function (move) {
86
- if (move.kind === moves_1.MoveKind.MaterialMove) {
88
+ if (move.kind === moves_1.MoveKind.ItemMove) {
87
89
  switch (move.type) {
88
- case moves_1.MaterialMoveType.Shuffle:
90
+ case moves_1.ItemMoveType.Shuffle:
89
91
  return __assign(__assign({}, move), { newIndexes: (0, lodash_shuffle_1.default)(move.indexes) });
90
92
  }
91
93
  }
@@ -96,27 +98,16 @@ var MaterialRules = /** @class */ (function (_super) {
96
98
  var consequences = [];
97
99
  var delegate = this.delegate();
98
100
  switch (move.kind) {
99
- case moves_1.MoveKind.MaterialMove:
101
+ case moves_1.MoveKind.ItemMove:
100
102
  if (delegate) {
101
- consequences.push.apply(consequences, delegate.beforeMaterialMove(move));
102
- }
103
- var material = this.materialOperations(move.itemType);
104
- switch (move.type) {
105
- case moves_1.MaterialMoveType.Create:
106
- material.create(move.item);
107
- break;
108
- case moves_1.MaterialMoveType.Delete:
109
- material.delete(move.itemIndex, move.quantity);
110
- break;
111
- case moves_1.MaterialMoveType.Shuffle:
112
- material.shuffle(move.indexes, move.newIndexes);
113
- break;
114
- case moves_1.MaterialMoveType.Move:
115
- material.move(move.itemIndex, move.item);
116
- break;
103
+ consequences.push.apply(consequences, delegate.beforeItemMove(move));
117
104
  }
105
+ if (!this.game.items[move.itemType])
106
+ this.game.items[move.itemType] = [];
107
+ var mutator = new items_1.MaterialMutator(move.itemType, this.game.items[move.itemType], this.getLocationsStrategies()[move.itemType]);
108
+ mutator.applyMove(move);
118
109
  if (delegate) {
119
- consequences.push.apply(consequences, delegate.afterMaterialMove(move));
110
+ consequences.push.apply(consequences, delegate.afterItemMove(move));
120
111
  }
121
112
  break;
122
113
  case moves_1.MoveKind.RulesMove:
@@ -155,6 +146,10 @@ var MaterialRules = /** @class */ (function (_super) {
155
146
  }
156
147
  return consequences;
157
148
  };
149
+ MaterialRules.prototype.isMoveTrigger = function (move, predicate) {
150
+ var _this = this;
151
+ return predicate(move) || (move.kind === moves_1.MoveKind.CustomMove && this.play(move).some(function (consequence) { return _this.isMoveTrigger(consequence, predicate); }));
152
+ };
158
153
  MaterialRules.prototype.canUndo = function (action, consecutiveActions) {
159
154
  for (var i = consecutiveActions.length - 1; i >= 0; i--) {
160
155
  var consecutiveAction = consecutiveActions[i];
@@ -187,10 +182,10 @@ var MaterialRules = /** @class */ (function (_super) {
187
182
  return move.kind === moves_1.MoveKind.RulesMove && (move.type === moves_1.RuleMoveType.StartPlayerTurn); // TODO: add StartSimultaneousTurns when implemented
188
183
  };
189
184
  MaterialRules.prototype.isUnpredictableMove = function (move) {
190
- if (move.kind !== moves_1.MoveKind.MaterialMove)
185
+ if (move.kind !== moves_1.MoveKind.ItemMove)
191
186
  return false;
192
187
  switch (move.type) {
193
- case moves_1.MaterialMoveType.Shuffle:
188
+ case moves_1.ItemMoveType.Shuffle:
194
189
  // case MaterialMoveType.ThrowDice:
195
190
  return true;
196
191
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialRules.js","sourceRoot":"","sources":["../../src/material/MaterialRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kCAAgC;AAChC,iCAAiI;AACjI,kEAAoC;AACpC,iCAAmE;AAOnE;IACU,iCAAsH;IAM9H,uBAAY,GAAQ;QAApB,iBAMC;QALC,IAAM,SAAS,GAAG,CAAE,GAAoB,CAAC,KAAK,CAAA;gBAC9C,kBAAM,SAAS,CAAC,CAA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,CAAC,CAAA;KACvD;SAAM;QACL,IAAM,eAAe,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,CAAC,CAAA;QAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAClD,UAAC,EAAE,IAAK,OAAA,CAAC,EAAE,GAAG,CAAC,CAAW,EAAlB,CAAkB,CAC3B,CAAA;KACF;AACH,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { SecretInformation } from '../IncompleteInformation';
2
2
  import { HiddenMaterialRules } from './HiddenMaterialRules';
3
3
  import { MaterialGame } from './MaterialGame';
4
- import { MaterialRulesMove, MaterialRulesMoveRandomized } from './moves';
4
+ import { MaterialMove, MaterialRulesMoveRandomized } from './moves';
5
5
  import { MaterialItem } from './items';
6
- export declare abstract class SecretMaterialRules<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends HiddenMaterialRules<Player, MaterialType, LocationType> implements SecretInformation<MaterialGame, MaterialRulesMove<Player, MaterialType, LocationType>, MaterialRulesMove<Player, MaterialType, LocationType>, Player> {
6
+ export declare abstract class SecretMaterialRules<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends HiddenMaterialRules<Player, MaterialType, LocationType> implements SecretInformation<MaterialGame, MaterialMove<Player, MaterialType, LocationType>, MaterialMove<Player, MaterialType, LocationType>, Player> {
7
7
  abstract hidingStrategies: Partial<Record<MaterialType, Partial<Record<LocationType, HidingSecretsStrategy<Player, LocationType>>>>>;
8
8
  getPlayerView(player: Player): MaterialGame<Player, MaterialType, LocationType>;
9
- getPlayerMoveView(move: MaterialRulesMoveRandomized<Player, MaterialType, LocationType>, player: Player): MaterialRulesMove<Player, MaterialType, LocationType>;
9
+ getPlayerMoveView(move: MaterialRulesMoveRandomized<Player, MaterialType, LocationType>, player: Player): MaterialMove<Player, MaterialType, LocationType>;
10
10
  }
11
11
  export declare type HidingSecretsStrategy<P extends number = number, L extends number = number> = (item: MaterialItem<P, L>, player?: P) => MaterialItem<P, L>;
12
12
  export declare const hideItemIdToOthers: <P extends number = number, L extends number = number>(item: MaterialItem<P, L, any>, player?: P) => MaterialItem<P, L, any>;
@@ -1,4 +1,3 @@
1
- export * from './helper';
2
1
  export * from './items';
3
2
  export * from './location';
4
3
  export * from './moves';
@@ -14,7 +14,6 @@ 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("./helper"), exports);
18
17
  __exportStar(require("./items"), exports);
19
18
  __exportStar(require("./location"), exports);
20
19
  __exportStar(require("./moves"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/material/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,0CAAuB;AACvB,6CAA0B;AAC1B,0CAAuB;AACvB,0CAAuB;AACvB,wDAAqC;AACrC,iDAA8B;AAC9B,kDAA+B;AAC/B,wDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/material/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,6CAA0B;AAC1B,0CAAuB;AACvB,0CAAuB;AACvB,wDAAqC;AACrC,iDAA8B;AAC9B,kDAA+B;AAC/B,wDAAqC"}
@@ -1,12 +1,13 @@
1
- import { MaterialItem } from './MaterialItem';
2
- import { Coordinates, Location } from '../location';
3
- import { CreateItem, MoveItem } from '../moves';
4
- import { DeleteItem } from '../moves/DeleteItem';
1
+ import { ItemPosition, MaterialItem } from './MaterialItem';
2
+ import { Location } from '../location';
3
+ import { CreateItem, DeleteItem, MaterialMove, MoveItem, Shuffle } from '../moves';
5
4
  declare type ItemEntry<P extends number = number, L extends number = number> = [number, MaterialItem<P, L>];
6
5
  export declare class Material<P extends number = number, M extends number = number, L extends number = number> {
7
6
  private readonly type;
8
7
  private readonly entries;
9
- constructor(type: M, items: ItemEntry<P, L>[]);
8
+ private readonly play?;
9
+ constructor(type: M, items: ItemEntry<P, L>[], play?: (move: MaterialMove<P, M, L>) => void);
10
+ private new;
10
11
  getItems(): MaterialItem<P, L>[];
11
12
  getItems<T>(mapFn: (item: MaterialItem<P, L>) => T): T[];
12
13
  getItem(index: number): MaterialItem<P, L> | undefined;
@@ -22,9 +23,13 @@ export declare class Material<P extends number = number, M extends number = numb
22
23
  sort(selector: (item: MaterialItem<P, L>) => number): Material<P, M, L>;
23
24
  limit(count: number): Material<P, M, L>;
24
25
  maxBy(selector: (item: MaterialItem<P, L>) => number): Material<P, M, L>;
26
+ private process;
25
27
  createItem(item: MaterialItem<P, L>): CreateItem<P, M, L>;
28
+ createItems(items: MaterialItem<P, L>[]): CreateItem<P, M, L>[];
26
29
  deleteItem(quantity?: number): DeleteItem<M>;
27
- moveItem(locationType: L, location?: Partial<Location<P, L>>, rotation?: Partial<Coordinates> | false): MoveItem<P, M, L>;
28
- moveItems(locationType: L, location?: Partial<Location<P, L>>, rotation?: Partial<Coordinates> | false): MoveItem<P, M, L>[];
30
+ deleteItems(quantity?: number): DeleteItem<M>[];
31
+ moveItem(position: Partial<ItemPosition<P, L>>, quantity?: number): MoveItem<P, M, L>;
32
+ moveItems(position: Partial<ItemPosition<P, L>>, quantity?: number): MoveItem<P, M, L>[];
33
+ shuffle(): Shuffle<M>;
29
34
  }
30
35
  export {};
@@ -1,15 +1,4 @@
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
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
@@ -21,10 +10,14 @@ var minBy_1 = __importDefault(require("lodash/minBy"));
21
10
  var maxBy_1 = __importDefault(require("lodash/maxBy"));
22
11
  var orderBy_1 = __importDefault(require("lodash/orderBy"));
23
12
  var Material = /** @class */ (function () {
24
- function Material(type, items) {
13
+ function Material(type, items, play) {
25
14
  this.type = type;
26
15
  this.entries = items;
16
+ this.play = play;
27
17
  }
18
+ Material.prototype.new = function (entries) {
19
+ return new Material(this.type, entries, this.play);
20
+ };
28
21
  Material.prototype.getItems = function (mapFn) {
29
22
  return this.entries.map(function (entry) { return mapFn ? mapFn(entry[1]) : entry[1]; });
30
23
  };
@@ -52,7 +45,7 @@ var Material = /** @class */ (function () {
52
45
  configurable: true
53
46
  });
54
47
  Material.prototype.filter = function (predicate) {
55
- return new Material(this.type, this.entries.filter(function (_a) {
48
+ return this.new(this.entries.filter(function (_a) {
56
49
  var item = _a[1];
57
50
  return predicate(item);
58
51
  }));
@@ -89,59 +82,88 @@ var Material = /** @class */ (function () {
89
82
  };
90
83
  Material.prototype.minBy = function (selector) {
91
84
  var min = (0, minBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
92
- return new Material(this.type, min ? [min] : []);
85
+ return this.new(min ? [min] : []);
93
86
  };
94
87
  Material.prototype.sort = function (selector) {
95
88
  var orderedItems = (0, orderBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
96
- return new Material(this.type, orderedItems);
89
+ return this.new(orderedItems);
97
90
  };
98
91
  Material.prototype.limit = function (count) {
99
- return new Material(this.type, this.entries.slice(count));
92
+ return this.new(this.entries.slice(0, count));
100
93
  };
101
94
  Material.prototype.maxBy = function (selector) {
102
95
  var max = (0, maxBy_1.default)(this.entries, function (entry) { return selector(entry[1]); });
103
- return new Material(this.type, max ? [max] : []);
96
+ return this.new(max ? [max] : []);
97
+ };
98
+ Material.prototype.process = function (moves) {
99
+ if (this.play) {
100
+ for (var _i = 0, moves_2 = moves; _i < moves_2.length; _i++) {
101
+ var move = moves_2[_i];
102
+ this.play(move);
103
+ }
104
+ }
105
+ return moves;
104
106
  };
105
107
  Material.prototype.createItem = function (item) {
106
- return { kind: moves_1.MoveKind.MaterialMove, type: moves_1.MaterialMoveType.Create, itemType: this.type, item: item };
108
+ return this.createItems([item])[0];
109
+ };
110
+ Material.prototype.createItems = function (items) {
111
+ var _this = this;
112
+ return this.process(items.map(function (item) { return ({
113
+ kind: moves_1.MoveKind.ItemMove,
114
+ type: moves_1.ItemMoveType.Create,
115
+ itemType: _this.type,
116
+ item: item
117
+ }); }));
107
118
  };
108
119
  Material.prototype.deleteItem = function (quantity) {
109
- if (!this.length || (quantity !== undefined && (this.length - quantity < 0)))
120
+ if (!this.length)
110
121
  throw new Error('You are trying to delete an item that does not exists');
111
- return {
112
- kind: moves_1.MoveKind.MaterialMove,
113
- type: moves_1.MaterialMoveType.Delete,
114
- itemType: this.type,
115
- itemIndex: this.entries[0][0],
116
- quantity: quantity
117
- };
118
- };
119
- Material.prototype.moveItem = function (locationType, location, rotation) {
122
+ return this.limit(1).deleteItems(quantity)[0];
123
+ };
124
+ Material.prototype.deleteItems = function (quantity) {
125
+ var _this = this;
126
+ return this.process(this.entries.map(function (entry) {
127
+ var move = {
128
+ kind: moves_1.MoveKind.ItemMove,
129
+ type: moves_1.ItemMoveType.Delete,
130
+ itemType: _this.type,
131
+ itemIndex: entry[0]
132
+ };
133
+ if (quantity)
134
+ move.quantity = quantity;
135
+ return move;
136
+ }));
137
+ };
138
+ Material.prototype.moveItem = function (position, quantity) {
120
139
  if (!this.length)
121
140
  throw new Error('You are trying to move an item that does not exists');
122
- var destination = { location: __assign({ type: locationType }, location) };
123
- if (rotation)
124
- destination.rotation = rotation;
125
- return {
126
- kind: moves_1.MoveKind.MaterialMove,
127
- type: moves_1.MaterialMoveType.Move,
128
- itemType: this.type,
129
- itemIndex: this.entries[0][0],
130
- item: destination
131
- };
132
- };
133
- Material.prototype.moveItems = function (locationType, location, rotation) {
141
+ return this.limit(1).moveItems(position, quantity)[0];
142
+ };
143
+ Material.prototype.moveItems = function (position, quantity) {
134
144
  var _this = this;
135
- var destination = { location: __assign({ type: locationType }, location) };
136
- if (rotation)
137
- destination.rotation = rotation;
138
- return this.entries.map(function (entry) { return ({
139
- kind: moves_1.MoveKind.MaterialMove,
140
- type: moves_1.MaterialMoveType.Move,
141
- itemType: _this.type,
142
- itemIndex: entry[0],
143
- item: destination
144
- }); });
145
+ if (position.rotation && !position.rotation.x && !position.rotation.y && !position.rotation.z)
146
+ delete position.rotation;
147
+ return this.process(this.entries.map(function (entry) {
148
+ var move = {
149
+ kind: moves_1.MoveKind.ItemMove,
150
+ type: moves_1.ItemMoveType.Move,
151
+ itemType: _this.type,
152
+ itemIndex: entry[0],
153
+ position: position
154
+ };
155
+ if (quantity)
156
+ move.quantity = quantity;
157
+ return move;
158
+ }));
159
+ };
160
+ Material.prototype.shuffle = function () {
161
+ return this.process([{
162
+ kind: moves_1.MoveKind.ItemMove,
163
+ type: moves_1.ItemMoveType.Shuffle,
164
+ itemType: this.type,
165
+ indexes: this.entries.map(function (entry) { return entry[0]; })
166
+ }])[0];
145
167
  };
146
168
  return Material;
147
169
  }());
@@ -1 +1 @@
1
- {"version":3,"file":"Material.js","sourceRoot":"","sources":["../../../src/material/items/Material.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,oEAAmC;AACnC,kCAA2E;AAC3E,uDAAgC;AAChC,uDAAgC;AAChC,2DAAoC;AAKpC;IAKE,kBAAY,IAAO,EAAE,KAAwB;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;IAID,2BAAQ,GAAR,UAAY,KAAuC;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KA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