@gamepark/rules-api 6.24.2 → 6.25.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.
- package/dist/Action.d.ts +7 -0
- package/dist/Bot.d.ts +21 -0
- package/dist/Bot.js +18 -2
- package/dist/Bot.js.map +1 -1
- package/dist/Competitive.d.ts +45 -0
- package/dist/Competitive.js +15 -0
- package/dist/Competitive.js.map +1 -1
- package/dist/Eliminations.d.ts +17 -0
- package/dist/Eliminations.js +5 -0
- package/dist/Eliminations.js.map +1 -1
- package/dist/GameSetup.d.ts +14 -0
- package/dist/HiddenInformation.d.ts +22 -0
- package/dist/HiddenInformation.js +5 -0
- package/dist/HiddenInformation.js.map +1 -1
- package/dist/LocalMovePreview.d.ts +14 -0
- package/dist/LocalMovePreview.js +5 -0
- package/dist/LocalMovePreview.js.map +1 -1
- package/dist/RandomMove.d.ts +20 -2
- package/dist/Rules.d.ts +119 -0
- package/dist/Rules.js +102 -1
- package/dist/Rules.js.map +1 -1
- package/dist/SecretInformation.d.ts +39 -0
- package/dist/SecretInformation.js +5 -0
- package/dist/SecretInformation.js.map +1 -1
- package/dist/TimeLimit.d.ts +22 -0
- package/dist/TimeLimit.js +5 -0
- package/dist/TimeLimit.js.map +1 -1
- package/dist/Undo.d.ts +18 -0
- package/dist/Undo.js +6 -0
- package/dist/Undo.js.map +1 -1
- package/dist/UnpredictableMove.d.ts +19 -0
- package/dist/UnpredictableMove.js +5 -0
- package/dist/UnpredictableMove.js.map +1 -1
- package/dist/material/HiddenMaterialRules.d.ts +49 -1
- package/dist/material/HiddenMaterialRules.js +56 -13
- package/dist/material/HiddenMaterialRules.js.map +1 -1
- package/dist/material/MaterialGame.d.ts +12 -0
- package/dist/material/MaterialGameSetup.d.ts +74 -0
- package/dist/material/MaterialGameSetup.js +68 -5
- package/dist/material/MaterialGameSetup.js.map +1 -1
- package/dist/material/MaterialRules.d.ts +133 -1
- package/dist/material/MaterialRules.js +131 -5
- package/dist/material/MaterialRules.js.map +1 -1
- package/dist/material/SecretMaterialRules.d.ts +31 -0
- package/dist/material/SecretMaterialRules.js +23 -1
- package/dist/material/SecretMaterialRules.js.map +1 -1
- package/dist/material/items/Material.d.ts +265 -5
- package/dist/material/items/Material.js +266 -7
- package/dist/material/items/Material.js.map +1 -1
- package/dist/material/items/MaterialDeck.d.ts +34 -1
- package/dist/material/items/MaterialDeck.js +36 -3
- package/dist/material/items/MaterialDeck.js.map +1 -1
- package/dist/material/items/MaterialItem.d.ts +12 -0
- package/dist/material/items/MaterialMoney.d.ts +81 -0
- package/dist/material/items/MaterialMoney.js +288 -0
- package/dist/material/items/MaterialMoney.js.map +1 -0
- package/dist/material/items/MaterialMutator.d.ts +39 -0
- package/dist/material/items/MaterialMutator.js +44 -5
- package/dist/material/items/MaterialMutator.js.map +1 -1
- package/dist/material/items/index.d.ts +2 -1
- package/dist/material/items/index.js +3 -1
- package/dist/material/items/index.js.map +1 -1
- package/dist/material/location/Location.d.ts +28 -0
- package/dist/material/location/Location.js +5 -0
- package/dist/material/location/Location.js.map +1 -1
- package/dist/material/location/LocationBuilder.js +1 -1
- package/dist/material/location/strategy/FillGapStrategy.d.ts +4 -0
- package/dist/material/location/strategy/FillGapStrategy.js +5 -1
- package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
- package/dist/material/location/strategy/LocationStrategy.d.ts +20 -0
- package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +4 -0
- package/dist/material/location/strategy/PositiveSequenceStrategy.js +5 -1
- package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
- package/dist/material/memory/GameMemory.d.ts +21 -0
- package/dist/material/memory/GameMemory.js +22 -1
- package/dist/material/memory/GameMemory.js.map +1 -1
- package/dist/material/memory/PlayerMemory.d.ts +22 -0
- package/dist/material/memory/PlayerMemory.js +23 -1
- package/dist/material/memory/PlayerMemory.js.map +1 -1
- package/dist/material/moves/CustomMove.d.ts +18 -0
- package/dist/material/moves/CustomMove.js +13 -0
- package/dist/material/moves/CustomMove.js.map +1 -1
- package/dist/material/moves/MaterialMove.d.ts +9 -0
- package/dist/material/moves/MaterialMoveBuilder.d.ts +36 -0
- package/dist/material/moves/MaterialMoveBuilder.js +36 -0
- package/dist/material/moves/MaterialMoveBuilder.js.map +1 -1
- package/dist/material/moves/MoveKind.d.ts +3 -0
- package/dist/material/moves/MoveKind.js +3 -0
- package/dist/material/moves/MoveKind.js.map +1 -1
- package/dist/material/moves/items/CreateItem.d.ts +13 -0
- package/dist/material/moves/items/CreateItem.js +10 -0
- package/dist/material/moves/items/CreateItem.js.map +1 -1
- package/dist/material/moves/items/CreateItemsAtOnce.d.ts +14 -0
- package/dist/material/moves/items/CreateItemsAtOnce.js +10 -0
- package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/DeleteItem.d.ts +18 -0
- package/dist/material/moves/items/DeleteItem.js +11 -0
- package/dist/material/moves/items/DeleteItem.js.map +1 -1
- package/dist/material/moves/items/DeleteItemsAtOnce.d.ts +17 -0
- package/dist/material/moves/items/DeleteItemsAtOnce.js +10 -0
- package/dist/material/moves/items/DeleteItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/ItemMove.d.ts +12 -0
- package/dist/material/moves/items/ItemMoveType.d.ts +3 -0
- package/dist/material/moves/items/ItemMoveType.js +3 -0
- package/dist/material/moves/items/ItemMoveType.js.map +1 -1
- package/dist/material/moves/items/MoveItem.d.ts +20 -0
- package/dist/material/moves/items/MoveItem.js +11 -0
- package/dist/material/moves/items/MoveItem.js.map +1 -1
- package/dist/material/moves/items/MoveItemsAtOnce.d.ts +20 -0
- package/dist/material/moves/items/MoveItemsAtOnce.js +10 -0
- package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/RollItem.d.ts +19 -0
- package/dist/material/moves/items/RollItem.js +10 -0
- package/dist/material/moves/items/RollItem.js.map +1 -1
- package/dist/material/moves/items/SelectItem.d.ts +20 -0
- package/dist/material/moves/items/SelectItem.js +11 -0
- package/dist/material/moves/items/SelectItem.js.map +1 -1
- package/dist/material/moves/items/Shuffle.d.ts +26 -0
- package/dist/material/moves/items/Shuffle.js +15 -0
- package/dist/material/moves/items/Shuffle.js.map +1 -1
- package/dist/material/moves/local/CloseTutorialPopup.d.ts +8 -0
- package/dist/material/moves/local/CloseTutorialPopup.js +5 -0
- package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -1
- package/dist/material/moves/local/DisplayHelp.d.ts +18 -0
- package/dist/material/moves/local/DisplayHelp.js +3 -0
- package/dist/material/moves/local/DisplayHelp.js.map +1 -1
- package/dist/material/moves/local/DropItem.d.ts +9 -0
- package/dist/material/moves/local/LocalMove.d.ts +6 -0
- package/dist/material/moves/local/LocalMove.js +3 -0
- package/dist/material/moves/local/LocalMove.js.map +1 -1
- package/dist/material/moves/local/SetTutorialStep.d.ts +8 -0
- package/dist/material/moves/local/SetTutorialStep.js +5 -0
- package/dist/material/moves/local/SetTutorialStep.js.map +1 -1
- package/dist/material/rules/MaterialRulesPart.d.ts +76 -0
- package/dist/material/rules/MaterialRulesPart.js +75 -3
- package/dist/material/rules/MaterialRulesPart.js.map +1 -1
- package/dist/material/rules/PlayerTurnRule.d.ts +19 -0
- package/dist/material/rules/PlayerTurnRule.js +20 -1
- package/dist/material/rules/PlayerTurnRule.js.map +1 -1
- package/dist/material/rules/RuleStep.d.ts +3 -0
- package/dist/material/rules/SimultaneousRule.d.ts +25 -0
- package/dist/material/rules/SimultaneousRule.js +21 -1
- package/dist/material/rules/SimultaneousRule.js.map +1 -1
- package/dist/material/tutorial/TutorialState.d.ts +7 -0
- package/dist/options/OptionsValidationError.js +1 -1
- package/dist/options/PlayerEnumOption.js +3 -0
- package/dist/options/PlayerEnumOption.js.map +1 -1
- package/dist/utils/action-view.util.js +3 -1
- package/dist/utils/action-view.util.js.map +1 -1
- package/dist/utils/action.util.js +1 -1
- package/dist/utils/action.util.js.map +1 -1
- package/dist/utils/enum.util.d.ts +27 -0
- package/dist/utils/enum.util.js +24 -0
- package/dist/utils/enum.util.js.map +1 -1
- package/dist/utils/grid.squares.util.d.ts +26 -0
- package/dist/utils/grid.squares.util.js +26 -0
- package/dist/utils/grid.squares.util.js.map +1 -1
- package/dist/utils/grid.util.d.ts +8 -0
- package/dist/utils/grid.util.js +5 -0
- package/dist/utils/grid.util.js.map +1 -1
- package/dist/utils/listing.util.d.ts +12 -0
- package/dist/utils/listing.util.js +12 -0
- package/dist/utils/listing.util.js.map +1 -1
- package/dist/utils/money.util.d.ts +42 -4
- package/dist/utils/money.util.js +39 -1
- package/dist/utils/money.util.js.map +1 -1
- package/dist/utils/random.util.d.ts +6 -2
- package/dist/utils/random.util.js +6 -10
- package/dist/utils/random.util.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shuffle.js","sourceRoot":"","sources":["../../../../src/material/moves/items/Shuffle.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAG7C,wCAAsC;
|
|
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;
|
|
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":";;;
|
|
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":";;;
|
|
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;
|
|
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
|
-
|
|
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,104 @@ 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
|
-
|
|
36
|
-
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; }));
|
|
45
|
+
return new items_1.Material(type, this.game.items[type]);
|
|
37
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* This function is called immediately before an {@link ItemMove} is played.
|
|
49
|
+
* @param _move The move which is going to be played
|
|
50
|
+
* @param _context Context of execution
|
|
51
|
+
* @returns {MaterialMove[]} Any consequences that should automatically be played after the move
|
|
52
|
+
*/
|
|
38
53
|
MaterialRulesPart.prototype.beforeItemMove = function (_move, _context) {
|
|
39
54
|
return [];
|
|
40
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* This function is called immediately after an {@link ItemMove} is played.
|
|
58
|
+
* @param _move The move which has just been played
|
|
59
|
+
* @param _context Context of execution
|
|
60
|
+
* @returns {MaterialMove[]} Any consequences that should automatically be played after the move
|
|
61
|
+
*/
|
|
41
62
|
MaterialRulesPart.prototype.afterItemMove = function (_move, _context) {
|
|
42
63
|
return [];
|
|
43
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* This function is called immediately after the {@link RuleMove} that started this rules step was played
|
|
67
|
+
* @param _move The move which has just been played
|
|
68
|
+
* @param _previousRule The step of the rules immediately before this one started
|
|
69
|
+
* @param _context Context of execution
|
|
70
|
+
* @returns {MaterialMove[]} Any consequences that should automatically be played after the move
|
|
71
|
+
*/
|
|
44
72
|
MaterialRulesPart.prototype.onRuleStart = function (_move, _previousRule, _context) {
|
|
45
73
|
return [];
|
|
46
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* This function is called just before a {@link RuleMove} that leave this rules step is played.
|
|
77
|
+
*
|
|
78
|
+
* BEWARE: any consequences returned here will happen inside the next rule step. Usually we only clean the memory here.
|
|
79
|
+
*
|
|
80
|
+
* @param _move The move which is going to be played
|
|
81
|
+
* @param _context Context of execution
|
|
82
|
+
* @returns {MaterialMove[]} Any consequences that should automatically be played after the move
|
|
83
|
+
*/
|
|
47
84
|
MaterialRulesPart.prototype.onRuleEnd = function (_move, _context) {
|
|
48
85
|
return [];
|
|
49
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* This function is called when a {@link CustomMove} is played.
|
|
89
|
+
* @param _move The move
|
|
90
|
+
* @param _context Context of execution
|
|
91
|
+
* @returns {MaterialMove[]} Any consequences that should automatically be played after the move
|
|
92
|
+
*/
|
|
50
93
|
MaterialRulesPart.prototype.onCustomMove = function (_move, _context) {
|
|
51
94
|
return [];
|
|
52
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated replace this.rules().[the function] with: this.[the function]
|
|
98
|
+
*/
|
|
53
99
|
MaterialRulesPart.prototype.rules = function () {
|
|
54
100
|
return moves_1.MaterialMoveBuilder;
|
|
55
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* Utility function to access the memory tool for the game or on player.
|
|
104
|
+
* this.game.memory can be used to store any data that is not available through the state of the material, or current rule.
|
|
105
|
+
*
|
|
106
|
+
* @param player Optional, identifier of the player if we want to manipulate a specific player's memory
|
|
107
|
+
* @returns {@link GameMemory} or {@link PlayerMemory} utility
|
|
108
|
+
* @protected
|
|
109
|
+
*/
|
|
56
110
|
MaterialRulesPart.prototype.getMemory = function (player) {
|
|
57
111
|
return player === undefined ? new memory_1.GameMemory(this.game) : new memory_1.PlayerMemory(this.game, player);
|
|
58
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Save a new value inside the memory.
|
|
115
|
+
* @param key The key to index the memorized value.
|
|
116
|
+
* @param value Any JSON serializable value to store, or a function that takes previous stored value and returns the new value to store.
|
|
117
|
+
* @param player optional, if we need to memorize a different value for each player.
|
|
118
|
+
*/
|
|
59
119
|
MaterialRulesPart.prototype.memorize = function (key, value, player) {
|
|
60
120
|
this.getMemory(player).memorize(key, value);
|
|
61
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* Retrieve the value memorized under a given key.
|
|
124
|
+
* Shortcut for this.game.memory[key] or this.game.memory[key][player]
|
|
125
|
+
*
|
|
126
|
+
* @param key Key under which the memory is store. Usually a value of a numeric enum named "Memory".
|
|
127
|
+
* @param player optional, if we need to memorize a different value for each player.
|
|
128
|
+
*/
|
|
62
129
|
MaterialRulesPart.prototype.remind = function (key, player) {
|
|
63
130
|
return this.getMemory(player).remind(key);
|
|
64
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* Delete a value from the memory
|
|
134
|
+
* @param key Key of the value to delete
|
|
135
|
+
* @param player optional, if we need to memorize a different value for each player.
|
|
136
|
+
*/
|
|
65
137
|
MaterialRulesPart.prototype.forget = function (key, player) {
|
|
66
138
|
this.getMemory(player).forget(key);
|
|
67
139
|
};
|
|
@@ -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;
|
|
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,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAClD,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
|
-
|
|
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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerTurnRule.js","sourceRoot":"","sources":["../../../src/material/rules/PlayerTurnRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,yDAAuD;
|
|
1
|
+
{"version":3,"file":"PlayerTurnRule.js","sourceRoot":"","sources":["../../../src/material/rules/PlayerTurnRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,yDAAuD;AAEvD;;GAEG;AACH;IACU,kCAAqD;IAD/D;;IAuCA,CAAC;IAjCC,sBAAI,kCAAM;QAHV;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAK,CAAC,MAAO,CAAA;QAChC,CAAC;;;OAAA;IAKD,sBAAI,sCAAU;QAHd;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACnG,CAAC;;;OAAA;IAED;;OAEG;IACH,wCAAe,GAAf;QACE,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED;;OAEG;IACH,sCAAa,GAAb,UAAc,MAAc;QAC1B,IAAI,MAAM,KAAK,IAAI,CAAC,eAAe,EAAE;YAAE,OAAO,EAAE,CAAA;QAChD,OAAO,IAAI,CAAC,cAAc,EAAE,CAAA;IAC9B,CAAC;IAED;;;OAGG;IACH,uCAAc,GAAd;QACE,OAAO,EAAE,CAAA;IACX,CAAC;IACH,qBAAC;AAAD,CAAC,AAvCD,CACU,qCAAiB,GAsC1B;AAvCqB,wCAAc"}
|
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
import { PlayMoveContext } from '../../Rules';
|
|
2
2
|
import { EndPlayerTurn, MaterialMove } from '../moves';
|
|
3
3
|
import { MaterialRulesPart } from './MaterialRulesPart';
|
|
4
|
+
/**
|
|
5
|
+
* Base class for any part of the rules where multiple players have to do something at the same time.
|
|
6
|
+
*/
|
|
4
7
|
export declare abstract class SimultaneousRule<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends MaterialRulesPart<Player, MaterialType, LocationType> {
|
|
5
8
|
endPlayerTurn: <P extends number = number>(player: P) => EndPlayerTurn<P>;
|
|
9
|
+
/**
|
|
10
|
+
* See {@link Rules.isTurnToPlay}
|
|
11
|
+
*/
|
|
6
12
|
isTurnToPlay(player: Player): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* See {@link Rules.getLegalMoves}
|
|
15
|
+
*/
|
|
7
16
|
getLegalMoves(player: Player): MaterialMove<Player, MaterialType, LocationType>[];
|
|
8
17
|
abstract getActivePlayerLegalMoves(playerId: Player): MaterialMove<Player, MaterialType, LocationType>[];
|
|
18
|
+
/**
|
|
19
|
+
* This function is called immediately after a {@link EndPlayerTurn} has been played.
|
|
20
|
+
* @param _move The move which has just been played
|
|
21
|
+
* @param _context Context of execution
|
|
22
|
+
* @returns {MaterialMove[]} Any consequences that should automatically be played after the move
|
|
23
|
+
*/
|
|
9
24
|
onPlayerTurnEnd(_move: EndPlayerTurn<Player>, _context?: PlayMoveContext): MaterialMove<Player, MaterialType, LocationType>[];
|
|
25
|
+
/**
|
|
26
|
+
* Implement this to return the consequences when all the players have completed their task.
|
|
27
|
+
* Usually, a new rule part should start.
|
|
28
|
+
* @returns the consequences when the last awaited player have played
|
|
29
|
+
*/
|
|
10
30
|
abstract getMovesAfterPlayersDone(): MaterialMove<Player, MaterialType, LocationType>[];
|
|
11
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Type guard to know if a {@link MaterialRulesPart} is a {@link SimultaneousRule}
|
|
34
|
+
* @param rule The rule
|
|
35
|
+
* @returns true if the rule if a {@link SimultaneousRule}
|
|
36
|
+
*/
|
|
12
37
|
export declare function isSimultaneousRule<P extends number = number, M extends number = number, L extends number = number>(rule?: MaterialRulesPart<P, M, L>): rule is SimultaneousRule<P, M, L>;
|
|
@@ -18,26 +18,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.isSimultaneousRule = exports.SimultaneousRule = void 0;
|
|
19
19
|
var moves_1 = require("../moves");
|
|
20
20
|
var MaterialRulesPart_1 = require("./MaterialRulesPart");
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Base class for any part of the rules where multiple players have to do something at the same time.
|
|
23
|
+
*/
|
|
24
|
+
var SimultaneousRule = /** @class */ (function (_super) {
|
|
22
25
|
__extends(SimultaneousRule, _super);
|
|
23
26
|
function SimultaneousRule() {
|
|
24
27
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
25
28
|
_this.endPlayerTurn = moves_1.MaterialMoveBuilder.endPlayerTurn;
|
|
26
29
|
return _this;
|
|
27
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* See {@link Rules.isTurnToPlay}
|
|
33
|
+
*/
|
|
28
34
|
SimultaneousRule.prototype.isTurnToPlay = function (player) {
|
|
29
35
|
var _a, _b, _c;
|
|
30
36
|
return (_c = (_b = (_a = this.game.rule) === null || _a === void 0 ? void 0 : _a.players) === null || _b === void 0 ? void 0 : _b.includes(player)) !== null && _c !== void 0 ? _c : false;
|
|
31
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* See {@link Rules.getLegalMoves}
|
|
40
|
+
*/
|
|
32
41
|
SimultaneousRule.prototype.getLegalMoves = function (player) {
|
|
33
42
|
return this.isTurnToPlay(player) ? this.getActivePlayerLegalMoves(player) : [];
|
|
34
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* This function is called immediately after a {@link EndPlayerTurn} has been played.
|
|
46
|
+
* @param _move The move which has just been played
|
|
47
|
+
* @param _context Context of execution
|
|
48
|
+
* @returns {MaterialMove[]} Any consequences that should automatically be played after the move
|
|
49
|
+
*/
|
|
35
50
|
SimultaneousRule.prototype.onPlayerTurnEnd = function (_move, _context) {
|
|
36
51
|
return [];
|
|
37
52
|
};
|
|
38
53
|
return SimultaneousRule;
|
|
39
54
|
}(MaterialRulesPart_1.MaterialRulesPart));
|
|
40
55
|
exports.SimultaneousRule = SimultaneousRule;
|
|
56
|
+
/**
|
|
57
|
+
* Type guard to know if a {@link MaterialRulesPart} is a {@link SimultaneousRule}
|
|
58
|
+
* @param rule The rule
|
|
59
|
+
* @returns true if the rule if a {@link SimultaneousRule}
|
|
60
|
+
*/
|
|
41
61
|
function isSimultaneousRule(rule) {
|
|
42
62
|
return rule !== undefined && typeof rule.getMovesAfterPlayersDone === 'function';
|
|
43
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimultaneousRule.js","sourceRoot":"","sources":["../../../src/material/rules/SimultaneousRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,kCAA2E;AAC3E,yDAAuD;
|
|
1
|
+
{"version":3,"file":"SimultaneousRule.js","sourceRoot":"","sources":["../../../src/material/rules/SimultaneousRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,kCAA2E;AAC3E,yDAAuD;AAEvD;;GAEG;AACH;IACU,oCAAqD;IAD/D;;QAGE,mBAAa,GAAG,2BAAmB,CAAC,aAAa,CAAA;;IAkCnD,CAAC;IAhCC;;OAEG;IACH,uCAAY,GAAZ,UAAa,MAAc;;QACzB,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,QAAQ,CAAC,MAAM,CAAC,mCAAI,KAAK,CAAA;IAC3D,CAAC;IAED;;OAEG;IACH,wCAAa,GAAb,UAAc,MAAc;QAC1B,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAChF,CAAC;IAID;;;;;OAKG;IACH,0CAAe,GAAf,UAAgB,KAA4B,EAAE,QAA0B;QACtE,OAAO,EAAE,CAAA;IACX,CAAC;IAQH,uBAAC;AAAD,CAAC,AArCD,CACU,qCAAiB,GAoC1B;AArCqB,4CAAgB;AAuCtC;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,IAAiC;IAEjC,OAAO,IAAI,KAAK,SAAS,IAAI,OAAQ,IAAkC,CAAC,wBAAwB,KAAK,UAAU,CAAA;AACjH,CAAC;AAJD,gDAIC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { MaterialMove } from '../moves';
|
|
2
|
+
/**
|
|
3
|
+
* Data structure for the state of the tutorial in a tutorial game implement with {@link MaterialRules}.
|
|
4
|
+
* @property step Current step of the tutorial.
|
|
5
|
+
* @property popupClosed true when the popup has been closed by the player.
|
|
6
|
+
* @property stepComplete if true, the tutorial engine will move on to next step automatically.
|
|
7
|
+
* @property interrupt The automatic consequences that have been interrupted to display some information explaining what is happening.
|
|
8
|
+
*/
|
|
2
9
|
export type TutorialState<P extends number = number, M extends number = number, L extends number = number> = {
|
|
3
10
|
step: number;
|
|
4
11
|
popupClosed: boolean;
|
|
@@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.OptionsValidationError = void 0;
|
|
19
|
-
var OptionsValidationError = (function (_super) {
|
|
19
|
+
var OptionsValidationError = /** @class */ (function (_super) {
|
|
20
20
|
__extends(OptionsValidationError, _super);
|
|
21
21
|
function OptionsValidationError(message, fields) {
|
|
22
22
|
if (fields === void 0) { fields = []; }
|