@gamepark/rules-api 7.0.0-beta.0 → 7.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Action.js +1 -2
- package/dist/Bot.js +15 -37
- package/dist/Bot.js.map +1 -1
- package/dist/Competitive.js +3 -8
- package/dist/Competitive.js.map +1 -1
- package/dist/Eliminations.js +2 -5
- package/dist/Eliminations.js.map +1 -1
- package/dist/GameSetup.js +1 -2
- package/dist/HiddenInformation.js +2 -5
- package/dist/HiddenInformation.js.map +1 -1
- package/dist/LocalMovePreview.js +1 -4
- package/dist/LocalMovePreview.js.map +1 -1
- package/dist/RandomMove.js +1 -2
- package/dist/Rules.js +49 -56
- package/dist/Rules.js.map +1 -1
- package/dist/SecretInformation.js +2 -5
- package/dist/SecretInformation.js.map +1 -1
- package/dist/TimeLimit.js +1 -4
- package/dist/TimeLimit.js.map +1 -1
- package/dist/Undo.js +2 -5
- package/dist/Undo.js.map +1 -1
- package/dist/UnpredictableMove.js +1 -5
- package/dist/UnpredictableMove.js.map +1 -1
- package/dist/index.js +16 -32
- package/dist/index.js.map +1 -1
- package/dist/material/HiddenMaterialRules.js +125 -180
- package/dist/material/HiddenMaterialRules.js.map +1 -1
- package/dist/material/MaterialGame.js +1 -2
- package/dist/material/MaterialGameSetup.js +52 -70
- package/dist/material/MaterialGameSetup.js.map +1 -1
- package/dist/material/MaterialRules.js +186 -250
- package/dist/material/MaterialRules.js.map +1 -1
- package/dist/material/SecretMaterialRules.js +9 -35
- package/dist/material/SecretMaterialRules.js.map +1 -1
- package/dist/material/index.js +11 -27
- package/dist/material/index.js.map +1 -1
- package/dist/material/items/Material.js +177 -262
- package/dist/material/items/Material.js.map +1 -1
- package/dist/material/items/MaterialDeck.js +10 -36
- package/dist/material/items/MaterialDeck.js.map +1 -1
- package/dist/material/items/MaterialItem.js +1 -2
- package/dist/material/items/MaterialMoney.js +89 -141
- package/dist/material/items/MaterialMoney.js.map +1 -1
- package/dist/material/items/MaterialMutator.js +108 -145
- package/dist/material/items/MaterialMutator.js.map +1 -1
- package/dist/material/items/index.js +5 -21
- package/dist/material/items/index.js.map +1 -1
- package/dist/material/location/Location.js +1 -14
- package/dist/material/location/Location.js.map +1 -1
- package/dist/material/location/LocationBuilder.js +26 -41
- package/dist/material/location/LocationBuilder.js.map +1 -1
- package/dist/material/location/index.js +3 -19
- package/dist/material/location/index.js.map +1 -1
- package/dist/material/location/strategy/FillGapStrategy.js +9 -16
- package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
- package/dist/material/location/strategy/LocationStrategy.js +1 -2
- package/dist/material/location/strategy/PositiveSequenceStrategy.js +26 -35
- package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
- package/dist/material/location/strategy/StackingStrategy.js +15 -22
- package/dist/material/location/strategy/StackingStrategy.js.map +1 -1
- package/dist/material/location/strategy/index.js +5 -23
- package/dist/material/location/strategy/index.js.map +1 -1
- package/dist/material/memory/GameMemory.js +10 -14
- package/dist/material/memory/GameMemory.js.map +1 -1
- package/dist/material/memory/PlayerMemory.js +13 -18
- package/dist/material/memory/PlayerMemory.js.map +1 -1
- package/dist/material/memory/index.js +2 -18
- package/dist/material/memory/index.js.map +1 -1
- package/dist/material/moves/CustomMove.js +4 -9
- package/dist/material/moves/CustomMove.js.map +1 -1
- package/dist/material/moves/MaterialMove.js +1 -2
- package/dist/material/moves/MaterialMoveBuilder.js +16 -32
- package/dist/material/moves/MaterialMoveBuilder.js.map +1 -1
- package/dist/material/moves/MoveKind.js +2 -5
- package/dist/material/moves/MoveKind.js.map +1 -1
- package/dist/material/moves/index.js +7 -23
- package/dist/material/moves/index.js.map +1 -1
- package/dist/material/moves/items/CreateItem.js +6 -12
- package/dist/material/moves/items/CreateItem.js.map +1 -1
- package/dist/material/moves/items/CreateItemsAtOnce.js +6 -12
- package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/DeleteItem.js +6 -12
- package/dist/material/moves/items/DeleteItem.js.map +1 -1
- package/dist/material/moves/items/DeleteItemsAtOnce.js +6 -12
- package/dist/material/moves/items/DeleteItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/ItemMove.js +1 -2
- package/dist/material/moves/items/ItemMoveType.js +2 -5
- package/dist/material/moves/items/ItemMoveType.js.map +1 -1
- package/dist/material/moves/items/MoveItem.js +6 -12
- package/dist/material/moves/items/MoveItem.js.map +1 -1
- package/dist/material/moves/items/MoveItemsAtOnce.js +6 -12
- package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/RollItem.js +6 -12
- package/dist/material/moves/items/RollItem.js.map +1 -1
- package/dist/material/moves/items/SelectItem.js +6 -12
- package/dist/material/moves/items/SelectItem.js.map +1 -1
- package/dist/material/moves/items/Shuffle.js +7 -14
- package/dist/material/moves/items/Shuffle.js.map +1 -1
- package/dist/material/moves/items/index.js +11 -27
- package/dist/material/moves/items/index.js.map +1 -1
- package/dist/material/moves/local/CloseTutorialPopup.js +4 -7
- package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -1
- package/dist/material/moves/local/DisplayHelp.js +2 -5
- package/dist/material/moves/local/DisplayHelp.js.map +1 -1
- package/dist/material/moves/local/DropItem.js +1 -2
- package/dist/material/moves/local/LocalMove.js +2 -5
- package/dist/material/moves/local/LocalMove.js.map +1 -1
- package/dist/material/moves/local/SetTutorialStep.js +4 -7
- package/dist/material/moves/local/SetTutorialStep.js.map +1 -1
- package/dist/material/moves/local/index.js +5 -21
- package/dist/material/moves/local/index.js.map +1 -1
- package/dist/material/moves/rules/EndGame.js +4 -7
- package/dist/material/moves/rules/EndGame.js.map +1 -1
- package/dist/material/moves/rules/EndPlayerTurn.js +4 -7
- package/dist/material/moves/rules/EndPlayerTurn.js.map +1 -1
- package/dist/material/moves/rules/RuleMove.js +3 -7
- package/dist/material/moves/rules/RuleMove.js.map +1 -1
- package/dist/material/moves/rules/StartPlayerTurn.js +4 -7
- package/dist/material/moves/rules/StartPlayerTurn.js.map +1 -1
- package/dist/material/moves/rules/StartRule.js +4 -7
- package/dist/material/moves/rules/StartRule.js.map +1 -1
- package/dist/material/moves/rules/StartSimultaneousRule.js +4 -7
- package/dist/material/moves/rules/StartSimultaneousRule.js.map +1 -1
- package/dist/material/moves/rules/index.js +6 -22
- package/dist/material/moves/rules/index.js.map +1 -1
- package/dist/material/rules/MaterialRulesPart.js +38 -63
- package/dist/material/rules/MaterialRulesPart.js.map +1 -1
- package/dist/material/rules/PlayerTurnRule.js +20 -52
- package/dist/material/rules/PlayerTurnRule.js.map +1 -1
- package/dist/material/rules/RuleStep.js +1 -2
- package/dist/material/rules/SimultaneousRule.js +19 -51
- package/dist/material/rules/SimultaneousRule.js.map +1 -1
- package/dist/material/rules/index.js +4 -20
- package/dist/material/rules/index.js.map +1 -1
- package/dist/material/tutorial/TutorialState.js +1 -2
- package/dist/material/tutorial/index.js +1 -17
- package/dist/material/tutorial/index.js.map +1 -1
- package/dist/options/EnumArrayOption.js +3 -6
- package/dist/options/EnumArrayOption.js.map +1 -1
- package/dist/options/EnumOption.js +1 -4
- package/dist/options/EnumOption.js.map +1 -1
- package/dist/options/Option.js +1 -2
- package/dist/options/OptionSpecOf.js +1 -2
- package/dist/options/OptionsSpec.js +1 -2
- package/dist/options/OptionsValidationError.js +6 -28
- package/dist/options/OptionsValidationError.js.map +1 -1
- package/dist/options/PlayerEnumOption.js +19 -29
- package/dist/options/PlayerEnumOption.js.map +1 -1
- package/dist/options/PlayersOptionsSpec.js +1 -2
- package/dist/options/WithIdOption.js +1 -2
- package/dist/options/WithPlayerOptionsSpec.js +1 -4
- package/dist/options/WithPlayerOptionsSpec.js.map +1 -1
- package/dist/options/WithPlayersOptions.js +1 -2
- package/dist/options/index.js +12 -28
- package/dist/options/index.js.map +1 -1
- package/dist/options/isWithPlayerIdOptions.js +3 -6
- package/dist/options/isWithPlayerIdOptions.js.map +1 -1
- package/dist/utils/action-view.util.js +18 -25
- package/dist/utils/action-view.util.js.map +1 -1
- package/dist/utils/action.util.js +11 -16
- package/dist/utils/action.util.js.map +1 -1
- package/dist/utils/adjacent-groups.util.js +33 -41
- package/dist/utils/adjacent-groups.util.js.map +1 -1
- package/dist/utils/automatic-moves.util.js +10 -15
- package/dist/utils/automatic-moves.util.js.map +1 -1
- package/dist/utils/enum.util.js +7 -13
- package/dist/utils/enum.util.js.map +1 -1
- package/dist/utils/game-view.util.js +5 -8
- package/dist/utils/game-view.util.js.map +1 -1
- package/dist/utils/grid.hex.util.js +36 -88
- package/dist/utils/grid.hex.util.js.map +1 -1
- package/dist/utils/grid.squares.util.js +8 -19
- package/dist/utils/grid.squares.util.js.map +1 -1
- package/dist/utils/grid.util.js +1 -5
- package/dist/utils/grid.util.js.map +1 -1
- package/dist/utils/index.js +16 -32
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/listing.util.js +8 -13
- package/dist/utils/listing.util.js.map +1 -1
- package/dist/utils/loops.util.js +3 -6
- package/dist/utils/loops.util.js.map +1 -1
- package/dist/utils/money.util.js +54 -73
- package/dist/utils/money.util.js.map +1 -1
- package/dist/utils/neighbors.util.js +6 -10
- package/dist/utils/neighbors.util.js.map +1 -1
- package/dist/utils/polyhex.util.js +36 -56
- package/dist/utils/polyhex.util.js.map +1 -1
- package/dist/utils/random.util.js +2 -5
- package/dist/utils/random.util.js.map +1 -1
- package/dist/utils/rank.util.js +9 -13
- package/dist/utils/rank.util.js.map +1 -1
- package/package.json +43 -37
- package/dist/ApplyAutomaticMoves.d.ts +0 -2
- package/dist/ApplyAutomaticMoves.js +0 -25
- package/dist/ApplyAutomaticMoves.js.map +0 -1
- package/dist/DefaultGameSetup.d.ts +0 -7
- package/dist/DefaultGameSetup.js +0 -15
- package/dist/DefaultGameSetup.js.map +0 -1
- package/dist/Dummy.d.ts +0 -7
- package/dist/Dummy.js +0 -27
- package/dist/Dummy.js.map +0 -1
- package/dist/GameSetupCreator.d.ts +0 -4
- package/dist/GameSetupCreator.js +0 -3
- package/dist/GameSetupCreator.js.map +0 -1
- package/dist/IncompleteInformation.d.ts +0 -14
- package/dist/IncompleteInformation.js +0 -38
- package/dist/IncompleteInformation.js.map +0 -1
- package/dist/LoopWithFuse.d.ts +0 -4
- package/dist/LoopWithFuse.js +0 -15
- package/dist/LoopWithFuse.js.map +0 -1
- package/dist/Robot.d.ts +0 -1
- package/dist/Robot.js +0 -3
- package/dist/Robot.js.map +0 -1
- package/dist/RulesCreator.d.ts +0 -7
- package/dist/RulesCreator.js +0 -3
- package/dist/RulesCreator.js.map +0 -1
- package/dist/material/location/strategy/StakingStrategy.d.ts +0 -12
- package/dist/material/location/strategy/StakingStrategy.js +0 -32
- package/dist/material/location/strategy/StakingStrategy.js.map +0 -1
- package/dist/material/moves/items/ItemMovesBuilder.d.ts +0 -8
- package/dist/material/moves/items/ItemMovesBuilder.js +0 -34
- package/dist/material/moves/items/ItemMovesBuilder.js.map +0 -1
- package/dist/material/rules/MaterialMoveBuilder.d.ts +0 -9
- package/dist/material/rules/MaterialMoveBuilder.js +0 -28
- package/dist/material/rules/MaterialMoveBuilder.js.map +0 -1
- package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +0 -12
- package/dist/material/rules/MaterialRulesMovesBuilder.js +0 -36
- package/dist/material/rules/MaterialRulesMovesBuilder.js.map +0 -1
- package/dist/setup/DefaultGameSetup.d.ts +0 -7
- package/dist/setup/DefaultGameSetup.js +0 -15
- package/dist/setup/DefaultGameSetup.js.map +0 -1
- package/dist/setup/GameSetup.d.ts +0 -3
- package/dist/setup/GameSetup.js +0 -3
- package/dist/setup/GameSetup.js.map +0 -1
- package/dist/setup/GameSetupCreator.d.ts +0 -4
- package/dist/setup/GameSetupCreator.js +0 -3
- package/dist/setup/GameSetupCreator.js.map +0 -1
- package/dist/setup/index.d.ts +0 -2
- package/dist/setup/index.js +0 -19
- package/dist/setup/index.js.map +0 -1
- package/dist/utils/EnumUtils.d.ts +0 -1
- package/dist/utils/EnumUtils.js +0 -8
- package/dist/utils/EnumUtils.js.map +0 -1
- package/dist/utils/coordinates.util.d.ts +0 -5
- package/dist/utils/coordinates.util.js +0 -16
- package/dist/utils/coordinates.util.js.map +0 -1
- package/dist/utils/isDeadEndMove.util.d.ts +0 -2
- package/dist/utils/isDeadEndMove.util.js +0 -19
- package/dist/utils/isDeadEndMove.util.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/location/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/location/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA"}
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FillGapStrategy = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* This strategy attributes the first gap in a sequence, and leaves a gap when an item is removed.
|
|
6
3
|
* Use for river-type mechanisms for instance.
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export class FillGapStrategy {
|
|
6
|
+
axis;
|
|
7
|
+
constructor(axis = 'x') {
|
|
11
8
|
this.axis = axis;
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
var _this = this;
|
|
15
|
-
var _a;
|
|
10
|
+
addItem(material, item) {
|
|
16
11
|
if (item.location[this.axis] === undefined) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
while (
|
|
12
|
+
const items = material.sort(item => item.location[this.axis]).getItems();
|
|
13
|
+
let position = 0;
|
|
14
|
+
while (items[position]?.location[this.axis] === position) {
|
|
20
15
|
position++;
|
|
21
16
|
}
|
|
22
17
|
item.location[this.axis] = position;
|
|
23
18
|
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}());
|
|
27
|
-
exports.FillGapStrategy = FillGapStrategy;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
28
21
|
//# sourceMappingURL=FillGapStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FillGapStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/FillGapStrategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FillGapStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/FillGapStrategy.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,eAAe;IAC1B,IAAI,CAAiB;IAErB,YAAY,OAAwB,GAAG;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,OAAO,CAAC,QAA2B,EAAE,IAAwB;QAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;YACzE,IAAI,QAAQ,GAAG,CAAC,CAAA;YAChB,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACzD,QAAQ,EAAE,CAAA;YACZ,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAA;QACrC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,70 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PositiveSequenceStrategy = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* This strategy help to maintain a consecutive sequence of numbers starting with 0 for items at the same location,
|
|
6
3
|
* for example a deck or a hand of cards.
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export class PositiveSequenceStrategy {
|
|
6
|
+
axis;
|
|
7
|
+
constructor(axis = 'x') {
|
|
11
8
|
this.axis = axis;
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
addItem(material, item) {
|
|
11
|
+
const x = item.location[this.axis];
|
|
15
12
|
if (x === undefined) {
|
|
16
13
|
item.location[this.axis] = material.length;
|
|
17
14
|
}
|
|
18
15
|
else {
|
|
19
|
-
for (
|
|
20
|
-
|
|
21
|
-
var itemX = item_1.location[this.axis];
|
|
16
|
+
for (const item of material.getItems()) {
|
|
17
|
+
const itemX = item.location[this.axis];
|
|
22
18
|
if (itemX !== undefined && itemX >= x) {
|
|
23
|
-
|
|
19
|
+
item.location[this.axis]++;
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
|
-
}
|
|
28
|
-
|
|
23
|
+
}
|
|
24
|
+
moveItem(material, item, index) {
|
|
29
25
|
if (item.location[this.axis] === undefined) {
|
|
30
26
|
item.location[this.axis] = material.length - 1;
|
|
31
27
|
}
|
|
32
|
-
|
|
28
|
+
const x = material.getItem(index).location[this.axis];
|
|
33
29
|
if (x === undefined)
|
|
34
30
|
return;
|
|
35
|
-
|
|
31
|
+
const newX = item.location[this.axis];
|
|
36
32
|
if (x < newX) {
|
|
37
|
-
for (
|
|
38
|
-
|
|
39
|
-
var itemX = item_2.location[this.axis];
|
|
33
|
+
for (const item of material.getItems()) {
|
|
34
|
+
const itemX = item.location[this.axis];
|
|
40
35
|
if (itemX !== undefined && itemX > x && itemX <= newX) {
|
|
41
|
-
|
|
36
|
+
item.location[this.axis]--;
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
40
|
else if (newX < x) {
|
|
46
|
-
for (
|
|
47
|
-
|
|
48
|
-
var itemX = item_3.location[this.axis];
|
|
41
|
+
for (const item of material.getItems()) {
|
|
42
|
+
const itemX = item.location[this.axis];
|
|
49
43
|
if (itemX !== undefined && itemX >= newX && itemX < x) {
|
|
50
|
-
|
|
44
|
+
item.location[this.axis]++;
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
}
|
|
49
|
+
removeItem(material, item) {
|
|
50
|
+
const x = item.location[this.axis];
|
|
57
51
|
if (x === undefined)
|
|
58
52
|
return;
|
|
59
|
-
for (
|
|
60
|
-
|
|
61
|
-
var itemX = item_4.location[this.axis];
|
|
53
|
+
for (const item of material.getItems()) {
|
|
54
|
+
const itemX = item.location[this.axis];
|
|
62
55
|
if (itemX !== undefined && itemX > x) {
|
|
63
|
-
|
|
56
|
+
item.location[this.axis]--;
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
}());
|
|
69
|
-
exports.PositiveSequenceStrategy = PositiveSequenceStrategy;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
70
61
|
//# sourceMappingURL=PositiveSequenceStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PositiveSequenceStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/PositiveSequenceStrategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PositiveSequenceStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/PositiveSequenceStrategy.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IACnC,IAAI,CAAiB;IAErB,YAAY,OAAwB,GAAG;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,OAAO,CAAC,QAA2B,EAAE,IAAwB;QAC3D,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ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CAAE,EAAE,CAAA;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACpB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACvC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;oBACtD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAE,EAAE,CAAA;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,UAAU,CAAC,QAA2B,EAAE,IAAwB;QAC9D,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,SAAS;YAAE,OAAM;QAC3B,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAE,EAAE,CAAA;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StackingStrategy = void 0;
|
|
4
|
-
var PositiveSequenceStrategy_1 = require("./PositiveSequenceStrategy");
|
|
1
|
+
import { PositiveSequenceStrategy } from './PositiveSequenceStrategy';
|
|
5
2
|
/**
|
|
6
3
|
* This strategy will only work on items with the same location.x and location.y, to maintain a positive sequence on location.z,
|
|
7
4
|
* for example to easily stack scoring pawns when they are on the same spot.
|
|
8
5
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export class StackingStrategy {
|
|
7
|
+
delegate = new PositiveSequenceStrategy('z');
|
|
8
|
+
addItem(material, item) {
|
|
9
|
+
this.delegate.addItem(material.location(l => l.x === item.location.x && l.y === item.location.y), item);
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
StackingStrategy.prototype.moveItem = function (material, item, index) {
|
|
17
|
-
var itemBefore = material.getItem(index);
|
|
11
|
+
moveItem(material, item, index) {
|
|
12
|
+
const itemBefore = material.getItem(index);
|
|
18
13
|
if (itemBefore.location.x === item.location.x && itemBefore.location.y === item.location.y) {
|
|
19
|
-
this.delegate.moveItem(material.location(
|
|
14
|
+
this.delegate.moveItem(material.location(l => l.x === item.location.x && l.y === item.location.y), item, index);
|
|
20
15
|
}
|
|
21
16
|
else {
|
|
22
|
-
this.delegate.removeItem(material.index(
|
|
23
|
-
this.delegate.addItem(material.location(
|
|
17
|
+
this.delegate.removeItem(material.index(i => i !== index).location(l => l.x === itemBefore.location.x && l.y === itemBefore.location.y), itemBefore);
|
|
18
|
+
this.delegate.addItem(material.location(l => l.x === item.location.x && l.y === item.location.y), item);
|
|
24
19
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.delegate.removeItem(material.location(
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}());
|
|
31
|
-
exports.StackingStrategy = StackingStrategy;
|
|
20
|
+
}
|
|
21
|
+
removeItem(material, item) {
|
|
22
|
+
this.delegate.removeItem(material.location(l => l.x === item.location.x && l.y === item.location.y), item);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
32
25
|
//# sourceMappingURL=StackingStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackingStrategy.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/StackingStrategy.ts"],"names":[],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AAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAA;YACpJ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;QACzG,CAAC;IACH,CAAC;IAED,UAAU,CAAC,QAAkB,EAAE,IAAkB;QAC/C,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;IAC5G,CAAC;CACF"}
|
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.StakingStrategy = void 0;
|
|
18
|
-
__exportStar(require("./FillGapStrategy"), exports);
|
|
19
|
-
__exportStar(require("./LocationStrategy"), exports);
|
|
20
|
-
__exportStar(require("./PositiveSequenceStrategy"), exports);
|
|
21
|
-
__exportStar(require("./StackingStrategy"), exports);
|
|
22
|
-
var StackingStrategy_1 = require("./StackingStrategy"); // TODO: remove once every game using the badly spelled name are fixed
|
|
23
|
-
Object.defineProperty(exports, "StakingStrategy", { enumerable: true, get: function () { return StackingStrategy_1.StackingStrategy; } });
|
|
1
|
+
export * from './FillGapStrategy';
|
|
2
|
+
export * from './LocationStrategy';
|
|
3
|
+
export * from './PositiveSequenceStrategy';
|
|
4
|
+
export * from './StackingStrategy';
|
|
5
|
+
export { StackingStrategy as StakingStrategy } from './StackingStrategy'; // TODO: remove once every game using the badly spelled name are fixed
|
|
24
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/material/location/strategy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,gBAAgB,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAA,CAAC,sEAAsE"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GameMemory = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Utility class to manipulate the memory in a {@link MaterialGame}.
|
|
6
3
|
*/
|
|
7
|
-
|
|
4
|
+
export class GameMemory {
|
|
5
|
+
game;
|
|
8
6
|
/**
|
|
9
7
|
* @constructor
|
|
10
8
|
* @param {MaterialGame} game Current state of the game
|
|
11
9
|
*/
|
|
12
|
-
|
|
10
|
+
constructor(game) {
|
|
13
11
|
this.game = game;
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
@@ -17,7 +15,7 @@ var GameMemory = /** @class */ (function () {
|
|
|
17
15
|
* @param key The key to index the memorized value
|
|
18
16
|
* @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
memorize(key, value) {
|
|
21
19
|
if (typeof value === 'function') {
|
|
22
20
|
this.game.memory[key] = value(this.game.memory[key]);
|
|
23
21
|
}
|
|
@@ -25,23 +23,21 @@ var GameMemory = /** @class */ (function () {
|
|
|
25
23
|
this.game.memory[key] = value;
|
|
26
24
|
}
|
|
27
25
|
return this.game.memory[key];
|
|
28
|
-
}
|
|
26
|
+
}
|
|
29
27
|
/**
|
|
30
28
|
* Get a value stored in the memory
|
|
31
29
|
* @param key The key to index the memorized value
|
|
32
30
|
* @returns the value stored (or undefined is nothing was stored under this key yet)
|
|
33
31
|
*/
|
|
34
|
-
|
|
32
|
+
remind(key) {
|
|
35
33
|
return this.game.memory[key];
|
|
36
|
-
}
|
|
34
|
+
}
|
|
37
35
|
/**
|
|
38
36
|
* Delete a value from the memory
|
|
39
37
|
* @param key Key of the value to delete
|
|
40
38
|
*/
|
|
41
|
-
|
|
39
|
+
forget(key) {
|
|
42
40
|
delete this.game.memory[key];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}());
|
|
46
|
-
exports.GameMemory = GameMemory;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
47
43
|
//# sourceMappingURL=GameMemory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameMemory.js","sourceRoot":"","sources":["../../../src/material/memory/GameMemory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GameMemory.js","sourceRoot":"","sources":["../../../src/material/memory/GameMemory.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,UAAU;IAKD;IAJpB;;;OAGG;IACH,YAAoB,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAC9C,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAU,GAAc,EAAE,KAAgC;QAChE,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAI,KAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;QAC/E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAU,GAAc;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,GAAc;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;CACF"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlayerMemory = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Utility class to manipulate a player's memory in a {@link MaterialGame}.
|
|
6
3
|
*/
|
|
7
|
-
|
|
4
|
+
export class PlayerMemory {
|
|
5
|
+
game;
|
|
6
|
+
player;
|
|
8
7
|
/**
|
|
9
8
|
* @constructor
|
|
10
9
|
* @param {MaterialGame} game Current state of the game
|
|
11
10
|
* @param player The player to work with
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
constructor(game, player) {
|
|
14
13
|
this.game = game;
|
|
15
14
|
this.player = player;
|
|
16
15
|
}
|
|
@@ -19,7 +18,7 @@ var PlayerMemory = /** @class */ (function () {
|
|
|
19
18
|
* @param key The key to index the memorized value
|
|
20
19
|
* @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
memorize(key, value) {
|
|
23
22
|
if (!this.game.memory[key])
|
|
24
23
|
this.game.memory[key] = {};
|
|
25
24
|
if (typeof value === 'function') {
|
|
@@ -29,25 +28,21 @@ var PlayerMemory = /** @class */ (function () {
|
|
|
29
28
|
this.game.memory[key][this.player] = value;
|
|
30
29
|
}
|
|
31
30
|
return this.game.memory[key][this.player];
|
|
32
|
-
}
|
|
31
|
+
}
|
|
33
32
|
/**
|
|
34
33
|
* Get a value stored in the memory
|
|
35
34
|
* @param key The key to index the memorized value
|
|
36
35
|
* @returns the value stored (or undefined is nothing was stored under this key yet)
|
|
37
36
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
37
|
+
remind(key) {
|
|
38
|
+
return this.game.memory[key]?.[this.player];
|
|
39
|
+
}
|
|
42
40
|
/**
|
|
43
41
|
* Delete a value from the memory
|
|
44
42
|
* @param key Key of the value to delete
|
|
45
43
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return PlayerMemory;
|
|
51
|
-
}());
|
|
52
|
-
exports.PlayerMemory = PlayerMemory;
|
|
44
|
+
forget(key) {
|
|
45
|
+
delete this.game.memory[key]?.[this.player];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
53
48
|
//# sourceMappingURL=PlayerMemory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerMemory.js","sourceRoot":"","sources":["../../../src/material/memory/PlayerMemory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlayerMemory.js","sourceRoot":"","sources":["../../../src/material/memory/PlayerMemory.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MA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4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./GameMemory"), exports);
|
|
18
|
-
__exportStar(require("./PlayerMemory"), exports);
|
|
1
|
+
export * from './GameMemory';
|
|
2
|
+
export * from './PlayerMemory';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/memory/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/memory/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCustomMove = void 0;
|
|
4
|
-
exports.isCustomMoveType = isCustomMoveType;
|
|
5
|
-
var MoveKind_1 = require("./MoveKind");
|
|
1
|
+
import { MoveKind } from './MoveKind';
|
|
6
2
|
/**
|
|
7
3
|
* Type guard for {@link CustomMove}
|
|
8
4
|
* @param {MaterialMove} move The move to test
|
|
9
5
|
* @returns true if the move is a {@link CustomMove}
|
|
10
6
|
*/
|
|
11
|
-
|
|
12
|
-
exports.isCustomMove = isCustomMove;
|
|
7
|
+
export const isCustomMove = (move) => move.kind === MoveKind.CustomMove;
|
|
13
8
|
/**
|
|
14
9
|
* Function that returns a type guard for a {@link CustomMove} of a specific type
|
|
15
10
|
* @param type The type of custom move to test
|
|
@@ -18,7 +13,7 @@ exports.isCustomMove = isCustomMove;
|
|
|
18
13
|
* @example
|
|
19
14
|
* `if (isCustomMoveType(CustomMoveType.Pass)(move)) ...`
|
|
20
15
|
*/
|
|
21
|
-
function isCustomMoveType(type) {
|
|
22
|
-
return
|
|
16
|
+
export function isCustomMoveType(type) {
|
|
17
|
+
return (move) => isCustomMove(move) && move.type === type;
|
|
23
18
|
}
|
|
24
19
|
//# sourceMappingURL=CustomMove.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomMove.js","sourceRoot":"","sources":["../../../src/material/moves/CustomMove.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomMove.js","sourceRoot":"","sources":["../../../src/material/moves/CustomMove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAcrC;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAA2B,EACJ,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,UAAU,CAAA;AAE7D;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAO;IAEP,OAAO,CAAC,IAA2B,EAAyB,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAA;AACzG,CAAC"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MaterialMoveBuilder = void 0;
|
|
4
|
-
var index_1 = require("./index");
|
|
1
|
+
import { HelpDisplayType, LocalMoveType, MoveKind, RuleMoveType } from './index';
|
|
5
2
|
/**
|
|
6
3
|
* Common namespaces for all the helper function that creates the different types of {@link MaterialMove} objects.
|
|
7
4
|
*/
|
|
8
|
-
var MaterialMoveBuilder;
|
|
5
|
+
export var MaterialMoveBuilder;
|
|
9
6
|
(function (MaterialMoveBuilder) {
|
|
10
7
|
/**
|
|
11
8
|
* Creates a {@link StartPlayerTurn} object
|
|
12
9
|
*/
|
|
13
|
-
MaterialMoveBuilder.startPlayerTurn =
|
|
14
|
-
return ({ kind: index_1.MoveKind.RulesMove, type: index_1.RuleMoveType.StartPlayerTurn, id: id, player: player });
|
|
15
|
-
};
|
|
10
|
+
MaterialMoveBuilder.startPlayerTurn = (id, player) => ({ kind: MoveKind.RulesMove, type: RuleMoveType.StartPlayerTurn, id, player });
|
|
16
11
|
/**
|
|
17
12
|
* Creates a {@link StartSimultaneousRule} object
|
|
18
13
|
*/
|
|
19
|
-
MaterialMoveBuilder.startSimultaneousRule =
|
|
20
|
-
|
|
14
|
+
MaterialMoveBuilder.startSimultaneousRule = (id, players) => {
|
|
15
|
+
const move = { kind: MoveKind.RulesMove, type: RuleMoveType.StartSimultaneousRule, id };
|
|
21
16
|
if (players)
|
|
22
17
|
move.players = players;
|
|
23
18
|
return move;
|
|
@@ -25,18 +20,16 @@ var MaterialMoveBuilder;
|
|
|
25
20
|
/**
|
|
26
21
|
* Creates a {@link EndPlayerTurn} object
|
|
27
22
|
*/
|
|
28
|
-
MaterialMoveBuilder.endPlayerTurn =
|
|
29
|
-
return ({ kind: index_1.MoveKind.RulesMove, type: index_1.RuleMoveType.EndPlayerTurn, player: player });
|
|
30
|
-
};
|
|
23
|
+
MaterialMoveBuilder.endPlayerTurn = (player) => ({ kind: MoveKind.RulesMove, type: RuleMoveType.EndPlayerTurn, player });
|
|
31
24
|
/**
|
|
32
25
|
* Creates a {@link StartRule} object
|
|
33
26
|
*/
|
|
34
|
-
MaterialMoveBuilder.startRule =
|
|
27
|
+
MaterialMoveBuilder.startRule = (id) => ({ kind: MoveKind.RulesMove, type: RuleMoveType.StartRule, id });
|
|
35
28
|
/**
|
|
36
29
|
* Creates a {@link CustomMove} object
|
|
37
30
|
*/
|
|
38
|
-
MaterialMoveBuilder.customMove =
|
|
39
|
-
|
|
31
|
+
MaterialMoveBuilder.customMove = (type, data) => {
|
|
32
|
+
const move = { kind: MoveKind.CustomMove, type };
|
|
40
33
|
if (data !== undefined)
|
|
41
34
|
move.data = data;
|
|
42
35
|
return move;
|
|
@@ -44,38 +37,29 @@ var MaterialMoveBuilder;
|
|
|
44
37
|
/**
|
|
45
38
|
* Creates a {@link EndGame} object
|
|
46
39
|
*/
|
|
47
|
-
MaterialMoveBuilder.endGame =
|
|
40
|
+
MaterialMoveBuilder.endGame = () => ({ kind: MoveKind.RulesMove, type: RuleMoveType.EndGame });
|
|
48
41
|
/**
|
|
49
42
|
* Creates a {@link DisplayHelp} object
|
|
50
43
|
*/
|
|
51
|
-
MaterialMoveBuilder.displayHelp =
|
|
52
|
-
return ({ kind: index_1.MoveKind.LocalMove, type: index_1.LocalMoveType.DisplayHelp, helpDisplay: helpDisplay });
|
|
53
|
-
};
|
|
44
|
+
MaterialMoveBuilder.displayHelp = (helpDisplay) => ({ kind: MoveKind.LocalMove, type: LocalMoveType.DisplayHelp, helpDisplay });
|
|
54
45
|
/**
|
|
55
46
|
* Creates a {@link DisplayHelp} object holding a {@link MaterialHelpDisplay}
|
|
56
47
|
*/
|
|
57
|
-
MaterialMoveBuilder.displayMaterialHelp =
|
|
58
|
-
if (item === void 0) { item = {}; }
|
|
59
|
-
return MaterialMoveBuilder.displayHelp({ type: index_1.HelpDisplayType.Material, itemType: itemType, itemIndex: itemIndex, displayIndex: displayIndex, item: item });
|
|
60
|
-
};
|
|
48
|
+
MaterialMoveBuilder.displayMaterialHelp = (itemType, item = {}, itemIndex, displayIndex) => MaterialMoveBuilder.displayHelp({ type: HelpDisplayType.Material, itemType, itemIndex, displayIndex, item });
|
|
61
49
|
/**
|
|
62
50
|
* Creates a {@link DisplayHelp} object holding a {@link LocationHelpDisplay}
|
|
63
51
|
*/
|
|
64
|
-
MaterialMoveBuilder.displayLocationHelp =
|
|
65
|
-
return MaterialMoveBuilder.displayHelp({ type: index_1.HelpDisplayType.Location, location: location });
|
|
66
|
-
};
|
|
52
|
+
MaterialMoveBuilder.displayLocationHelp = (location) => MaterialMoveBuilder.displayHelp({ type: HelpDisplayType.Location, location });
|
|
67
53
|
/**
|
|
68
54
|
* Creates a {@link DisplayHelp} object holding a {@link RulesHelpDisplay}
|
|
69
55
|
*/
|
|
70
|
-
MaterialMoveBuilder.displayRulesHelp =
|
|
71
|
-
return MaterialMoveBuilder.displayHelp({ type: index_1.HelpDisplayType.Rules, ruleId: ruleId });
|
|
72
|
-
};
|
|
56
|
+
MaterialMoveBuilder.displayRulesHelp = (ruleId) => MaterialMoveBuilder.displayHelp({ type: HelpDisplayType.Rules, ruleId });
|
|
73
57
|
/**
|
|
74
58
|
* Creates a {@link DropItem} object
|
|
75
59
|
*/
|
|
76
60
|
function dropItemMove(type, index, displayIndex) {
|
|
77
|
-
return { kind:
|
|
61
|
+
return { kind: MoveKind.LocalMove, type: LocalMoveType.DropItem, item: { type, index, displayIndex } };
|
|
78
62
|
}
|
|
79
63
|
MaterialMoveBuilder.dropItemMove = dropItemMove;
|
|
80
|
-
})(MaterialMoveBuilder || (
|
|
64
|
+
})(MaterialMoveBuilder || (MaterialMoveBuilder = {}));
|
|
81
65
|
//# sourceMappingURL=MaterialMoveBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialMoveBuilder.js","sourceRoot":"","sources":["../../../src/material/moves/MaterialMoveBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MaterialMoveBuilder.js","sourceRoot":"","sources":["../../../src/material/moves/MaterialMoveBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAIQ,eAAe,EAC5B,aAAa,EACb,QAAQ,EACR,YAAY,EAIb,MAAM,SAAS,CAAA;AAEhB;;GAEG;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ind = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* The different kind of moves that exists in a game implemented with {@link MaterialRules}.
|
|
6
3
|
*/
|
|
7
|
-
var MoveKind;
|
|
4
|
+
export var MoveKind;
|
|
8
5
|
(function (MoveKind) {
|
|
9
6
|
MoveKind[MoveKind["ItemMove"] = 1] = "ItemMove";
|
|
10
7
|
MoveKind[MoveKind["RulesMove"] = 2] = "RulesMove";
|
|
11
8
|
MoveKind[MoveKind["CustomMove"] = 3] = "CustomMove";
|
|
12
9
|
MoveKind[MoveKind["LocalMove"] = 4] = "LocalMove";
|
|
13
|
-
})(MoveKind || (
|
|
10
|
+
})(MoveKind || (MoveKind = {}));
|
|
14
11
|
//# sourceMappingURL=MoveKind.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoveKind.js","sourceRoot":"","sources":["../../../src/material/moves/MoveKind.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MoveKind.js","sourceRoot":"","sources":["../../../src/material/moves/MoveKind.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,QAEX;AAFD,WAAY,QAAQ;IAClB,+CAAY,CAAA;IAAE,iDAAa,CAAA;IAAE,mDAAc,CAAA;IAAE,iDAAa,CAAA;AAC5D,CAAC,EAFW,QAAQ,KAAR,QAAQ,QAEnB"}
|