@gamepark/haati 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/HaatiOptions.d.ts +4 -0
  2. package/dist/HaatiOptions.d.ts.map +1 -0
  3. package/dist/HaatiOptions.js +5 -0
  4. package/dist/HaatiOptions.js.map +1 -0
  5. package/dist/HaatiRules.d.ts +60 -0
  6. package/dist/HaatiRules.d.ts.map +1 -0
  7. package/dist/HaatiRules.js +69 -0
  8. package/dist/HaatiRules.js.map +1 -0
  9. package/dist/HaatiSetup.d.ts +11 -0
  10. package/dist/HaatiSetup.d.ts.map +1 -0
  11. package/dist/HaatiSetup.js +27 -0
  12. package/dist/HaatiSetup.js.map +1 -0
  13. package/dist/Memory.d.ts +5 -0
  14. package/dist/Memory.d.ts.map +1 -0
  15. package/dist/Memory.js +6 -0
  16. package/dist/Memory.js.map +1 -0
  17. package/dist/index.d.ts +4 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +4 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/material/Animal.d.ts +13 -0
  22. package/dist/material/Animal.d.ts.map +1 -0
  23. package/dist/material/Animal.js +22 -0
  24. package/dist/material/Animal.js.map +1 -0
  25. package/dist/material/Character.d.ts +25 -0
  26. package/dist/material/Character.d.ts.map +1 -0
  27. package/dist/material/Character.js +28 -0
  28. package/dist/material/Character.js.map +1 -0
  29. package/dist/material/Collection.d.ts +13 -0
  30. package/dist/material/Collection.d.ts.map +1 -0
  31. package/dist/material/Collection.js +22 -0
  32. package/dist/material/Collection.js.map +1 -0
  33. package/dist/material/LocationType.d.ts +18 -0
  34. package/dist/material/LocationType.d.ts.map +1 -0
  35. package/dist/material/LocationType.js +19 -0
  36. package/dist/material/LocationType.js.map +1 -0
  37. package/dist/material/MaterialSource.d.ts +7 -0
  38. package/dist/material/MaterialSource.d.ts.map +1 -0
  39. package/dist/material/MaterialSource.js +2 -0
  40. package/dist/material/MaterialSource.js.map +1 -0
  41. package/dist/material/MaterialType.d.ts +9 -0
  42. package/dist/material/MaterialType.d.ts.map +1 -0
  43. package/dist/material/MaterialType.js +10 -0
  44. package/dist/material/MaterialType.js.map +1 -0
  45. package/dist/material/Prestige.d.ts +23 -0
  46. package/dist/material/Prestige.d.ts.map +1 -0
  47. package/dist/material/Prestige.js +19 -0
  48. package/dist/material/Prestige.js.map +1 -0
  49. package/dist/rules/ChooseCardsRule.d.ts +13 -0
  50. package/dist/rules/ChooseCardsRule.d.ts.map +1 -0
  51. package/dist/rules/ChooseCardsRule.js +44 -0
  52. package/dist/rules/ChooseCardsRule.js.map +1 -0
  53. package/dist/rules/CustomMoveType.d.ts +5 -0
  54. package/dist/rules/CustomMoveType.d.ts.map +1 -0
  55. package/dist/rules/CustomMoveType.js +6 -0
  56. package/dist/rules/CustomMoveType.js.map +1 -0
  57. package/dist/rules/DiscardCharacterRule.d.ts +6 -0
  58. package/dist/rules/DiscardCharacterRule.d.ts.map +1 -0
  59. package/dist/rules/DiscardCharacterRule.js +15 -0
  60. package/dist/rules/DiscardCharacterRule.js.map +1 -0
  61. package/dist/rules/EndOfRoundRule.d.ts +11 -0
  62. package/dist/rules/EndOfRoundRule.d.ts.map +1 -0
  63. package/dist/rules/EndOfRoundRule.js +71 -0
  64. package/dist/rules/EndOfRoundRule.js.map +1 -0
  65. package/dist/rules/HaatiRule.d.ts +9 -0
  66. package/dist/rules/HaatiRule.d.ts.map +1 -0
  67. package/dist/rules/HaatiRule.js +43 -0
  68. package/dist/rules/HaatiRule.js.map +1 -0
  69. package/dist/rules/MoveAnimalRules.d.ts +28 -0
  70. package/dist/rules/MoveAnimalRules.d.ts.map +1 -0
  71. package/dist/rules/MoveAnimalRules.js +56 -0
  72. package/dist/rules/MoveAnimalRules.js.map +1 -0
  73. package/dist/rules/NewRoundRule.d.ts +11 -0
  74. package/dist/rules/NewRoundRule.d.ts.map +1 -0
  75. package/dist/rules/NewRoundRule.js +23 -0
  76. package/dist/rules/NewRoundRule.js.map +1 -0
  77. package/dist/rules/RefillHandRule.d.ts +8 -0
  78. package/dist/rules/RefillHandRule.d.ts.map +1 -0
  79. package/dist/rules/RefillHandRule.js +32 -0
  80. package/dist/rules/RefillHandRule.js.map +1 -0
  81. package/dist/rules/ResolveDuelRule.d.ts +23 -0
  82. package/dist/rules/ResolveDuelRule.d.ts.map +1 -0
  83. package/dist/rules/ResolveDuelRule.js +127 -0
  84. package/dist/rules/ResolveDuelRule.js.map +1 -0
  85. package/dist/rules/RevealDuelRule.d.ts +10 -0
  86. package/dist/rules/RevealDuelRule.d.ts.map +1 -0
  87. package/dist/rules/RevealDuelRule.js +36 -0
  88. package/dist/rules/RevealDuelRule.js.map +1 -0
  89. package/dist/rules/RuleId.d.ts +15 -0
  90. package/dist/rules/RuleId.d.ts.map +1 -0
  91. package/dist/rules/RuleId.js +16 -0
  92. package/dist/rules/RuleId.js.map +1 -0
  93. package/package.json +31 -3
  94. package/README.md +0 -3
@@ -0,0 +1,44 @@
1
+ import { isMoveItem, SimultaneousRule } from '@gamepark/rules-api';
2
+ import { LocationType } from '../material/LocationType';
3
+ import { MaterialType } from '../material/MaterialType';
4
+ import { CustomMoveType } from './CustomMoveType';
5
+ import { RuleId } from './RuleId';
6
+ export class ChooseCardsRule extends SimultaneousRule {
7
+ getActivePlayerLegalMoves(player) {
8
+ const moves = [];
9
+ const duel = { type: LocationType.PlayerDuel, player };
10
+ const animalPlayed = this.duelCards(MaterialType.AnimalCard, player).length > 0;
11
+ if (!animalPlayed) {
12
+ moves.push(...this.handCards(MaterialType.AnimalCard, player).moveItems(duel));
13
+ }
14
+ if (!this.duelCards(MaterialType.CharacterCard, player).length) {
15
+ moves.push(...this.handCards(MaterialType.CharacterCard, player).moveItems(duel));
16
+ if (animalPlayed)
17
+ moves.push(this.customMove(CustomMoveType.Validate, player));
18
+ }
19
+ return moves;
20
+ }
21
+ afterItemMove(move) {
22
+ if (!isMoveItem(move) || move.location.type !== LocationType.PlayerDuel)
23
+ return [];
24
+ const player = move.location.player;
25
+ const animalPlayed = this.duelCards(MaterialType.AnimalCard, player).length > 0;
26
+ const characterDone = this.duelCards(MaterialType.CharacterCard, player).length > 0 || !this.handCards(MaterialType.CharacterCard, player).length;
27
+ return animalPlayed && characterDone ? [this.endPlayerTurn(player)] : [];
28
+ }
29
+ onCustomMove(move) {
30
+ if (move.type === CustomMoveType.Validate)
31
+ return [this.endPlayerTurn(move.data)];
32
+ return [];
33
+ }
34
+ getMovesAfterPlayersDone() {
35
+ return [this.startRule(RuleId.RevealDuel)];
36
+ }
37
+ handCards(type, player) {
38
+ return this.material(type).location(LocationType.PlayerHand).player(player);
39
+ }
40
+ duelCards(type, player) {
41
+ return this.material(type).location(LocationType.PlayerDuel).player(player);
42
+ }
43
+ }
44
+ //# sourceMappingURL=ChooseCardsRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChooseCardsRule.js","sourceRoot":"","sources":["../../src/rules/ChooseCardsRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAY,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAMjC,MAAM,OAAO,eAAgB,SAAQ,gBAAgB;IACnD,yBAAyB,CAAC,MAAc;QACtC,MAAM,KAAK,GAAG,EAAE,CAAA;QAChB,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,CAAA;QACtD,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QAC/E,IAAI,CAAC,YA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C1E,CAAC;IAED,YAAY,CAAC,IAAgB;QAC3B,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,QAAQ;YAAE,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAc,CAAC,CAAC,CAAA;QAC3F,OAAO,EAAE,CAAA;IACX,CAAC;IAED,wBAAwB;QACtB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED,SAAS,CAAC,IAAkB,EAAE,MAAc;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC7E,CAAC;IAED,SAAS,CAAC,IAAkB,EAAE,MAAc;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC7E,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export declare enum CustomMoveType {
2
+ Validate = 1,
3
+ Pass = 2
4
+ }
5
+ //# sourceMappingURL=CustomMoveType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomMoveType.d.ts","sourceRoot":"","sources":["../../src/rules/CustomMoveType.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IAExB,QAAQ,IAAI;IAEZ,IAAI,IAAA;CACL"}
@@ -0,0 +1,6 @@
1
+ export var CustomMoveType;
2
+ (function (CustomMoveType) {
3
+ CustomMoveType[CustomMoveType["Validate"] = 1] = "Validate";
4
+ CustomMoveType[CustomMoveType["Pass"] = 2] = "Pass";
5
+ })(CustomMoveType || (CustomMoveType = {}));
6
+ //# sourceMappingURL=CustomMoveType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomMoveType.js","sourceRoot":"","sources":["../../src/rules/CustomMoveType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IAExB,2DAAY,CAAA;IAEZ,mDAAI,CAAA;AACN,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB"}
@@ -0,0 +1,6 @@
1
+ import { HaatiRule } from './HaatiRule';
2
+ export declare class DiscardCharacterRule extends HaatiRule {
3
+ getPlayerMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
4
+ afterItemMove(): import("@gamepark/rules-api").MaterialMove[];
5
+ }
6
+ //# sourceMappingURL=DiscardCharacterRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscardCharacterRule.d.ts","sourceRoot":"","sources":["../../src/rules/DiscardCharacterRule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,qBAAa,oBAAqB,SAAQ,SAAS;IACjD,cAAc,qEAKb;IAED,aAAa,iDAEZ;CACF"}
@@ -0,0 +1,15 @@
1
+ import { LocationType } from '../material/LocationType';
2
+ import { MaterialType } from '../material/MaterialType';
3
+ import { HaatiRule } from './HaatiRule';
4
+ export class DiscardCharacterRule extends HaatiRule {
5
+ getPlayerMoves() {
6
+ return this.material(MaterialType.CharacterCard)
7
+ .location(LocationType.PlayerHand)
8
+ .player(this.player)
9
+ .moveItems({ type: LocationType.CharacterDiscard });
10
+ }
11
+ afterItemMove() {
12
+ return this.resume();
13
+ }
14
+ }
15
+ //# sourceMappingURL=DiscardCharacterRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscardCharacterRule.js","sourceRoot":"","sources":["../../src/rules/DiscardCharacterRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IACjD,cAAc;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC;aAC7C,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC;aACjC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;aACnB,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAA;IACvD,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,MAAM,EAAE,CAAA;IACtB,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { ItemMove, MaterialMove, MaterialRulesPart } from '@gamepark/rules-api';
2
+ export declare const ROUNDS_TO_WIN = 2;
3
+ export declare class EndOfRoundRule extends MaterialRulesPart {
4
+ onRuleStart(): MaterialMove[];
5
+ get lastCards(): import("@gamepark/rules-api").Material<number, number, number>;
6
+ afterItemMove(move: ItemMove): MaterialMove[];
7
+ endRound(winner: number): MaterialMove[];
8
+ winRoundVictoryToken(winner: number): MaterialMove;
9
+ prepareNextRound(): MaterialMove[];
10
+ }
11
+ //# sourceMappingURL=EndOfRoundRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EndOfRoundRule.d.ts","sourceRoot":"","sources":["../../src/rules/EndOfRoundRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAS3F,eAAO,MAAM,aAAa,IAAI,CAAA;AAU9B,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,WAAW,mBASV;IAED,IAAI,SAAS,mEAEZ;IAGD,aAAa,CAAC,IAAI,EAAE,QAAQ,kBAO3B;IAED,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAiBvC;IAGD,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAKjD;IAMD,gBAAgB,IAAI,YAAY,EAAE,CAUjC;CACF"}
@@ -0,0 +1,71 @@
1
+ import { isMoveItem, MaterialRulesPart } from '@gamepark/rules-api';
2
+ import { beats } from '../material/Animal';
3
+ import { LocationType } from '../material/LocationType';
4
+ import { MaterialType } from '../material/MaterialType';
5
+ import { countPrestige, prestigeLocation, PrestigeSide, prestigeTokens, totalPrestige } from '../material/Prestige';
6
+ import { Memory } from '../Memory';
7
+ import { RuleId } from './RuleId';
8
+ export const ROUNDS_TO_WIN = 2;
9
+ export class EndOfRoundRule extends MaterialRulesPart {
10
+ onRuleStart() {
11
+ const [player1, player2] = this.game.players;
12
+ const prestige1 = totalPrestige(this, player1);
13
+ const prestige2 = totalPrestige(this, player2);
14
+ if (prestige1 !== prestige2)
15
+ return this.endRound(prestige1 > prestige2 ? player1 : player2);
16
+ const honor1 = countPrestige(this, PrestigeSide.Honor, player1);
17
+ const honor2 = countPrestige(this, PrestigeSide.Honor, player2);
18
+ if (honor1 !== honor2)
19
+ return this.endRound(honor1 > honor2 ? player1 : player2);
20
+ return this.lastCards.moveItems((item) => ({ type: LocationType.PlayerDuel, player: item.location.player, rotation: true }));
21
+ }
22
+ get lastCards() {
23
+ return this.material(MaterialType.AnimalCard).location(LocationType.PlayerHand);
24
+ }
25
+ afterItemMove(move) {
26
+ if (!isMoveItem(move) || move.location.type !== LocationType.PlayerDuel || this.lastCards.length)
27
+ return [];
28
+ const [player1, player2] = this.game.players;
29
+ const duel = this.material(MaterialType.AnimalCard).location(LocationType.PlayerDuel);
30
+ const card1 = duel.player(player1).getItem().id;
31
+ const card2 = duel.player(player2).getItem().id;
32
+ return this.endRound(beats(card1, card2) ? player1 : player2);
33
+ }
34
+ endRound(winner) {
35
+ this.memorize(Memory.RoundWinner, winner);
36
+ const moves = [this.winRoundVictoryToken(winner)];
37
+ const victories = this.material(MaterialType.RoundVictoryToken).location(LocationType.PlayerRoundVictory).player(winner).getQuantity() + 1;
38
+ if (victories >= ROUNDS_TO_WIN) {
39
+ moves.push(this.endGame());
40
+ return moves;
41
+ }
42
+ for (const player of this.game.players) {
43
+ const favor = prestigeTokens(this, PrestigeSide.Favor, player);
44
+ const honor = prestigeTokens(this, PrestigeSide.Honor, player);
45
+ if (favor.length)
46
+ moves.push(favor.deleteItemsAtOnce());
47
+ if (honor.length)
48
+ moves.push(honor.moveItemsAtOnce(prestigeLocation(player)));
49
+ }
50
+ moves.push(...this.prepareNextRound(), this.startRule(RuleId.NewRound));
51
+ return moves;
52
+ }
53
+ winRoundVictoryToken(winner) {
54
+ const tokens = this.material(MaterialType.RoundVictoryToken);
55
+ const reserve = tokens.location(LocationType.Reserve);
56
+ const source = reserve.length ? reserve : tokens.location(LocationType.PlayerRoundVictory).player((player) => player !== winner);
57
+ return source.moveItem({ type: LocationType.PlayerRoundVictory, player: winner }, 1);
58
+ }
59
+ prepareNextRound() {
60
+ const characters = this.material(MaterialType.CharacterCard);
61
+ const animals = this.material(MaterialType.AnimalCard);
62
+ return [
63
+ ...characters.location(LocationType.CharacterDiscard).moveItems({ type: LocationType.CharacterDeck }),
64
+ characters.location((location) => location.type === LocationType.CharacterDeck || location.type === LocationType.CharacterDiscard).shuffle(),
65
+ ...this.material(MaterialType.CollectionToken).rollItems((item) => ({ type: LocationType.CollectionSpot, id: item.id })),
66
+ ...animals.location((location) => location.type !== LocationType.AnimalSetAside).moveItems({ type: LocationType.AnimalSetAside }),
67
+ animals.shuffle()
68
+ ];
69
+ }
70
+ }
71
+ //# sourceMappingURL=EndOfRoundRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EndOfRoundRule.js","sourceRoot":"","sources":["../../src/rules/EndOfRoundRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC3F,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,aA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EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;IACtF,CAAC;IAMD,gBAAgB;QACd,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;QAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;QACtD,OAAO;YACL,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,aAAa,EAAE,CAAC;YACrG,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,aAAa,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE;YAC5I,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,cAAc,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YACxH,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,cAAc,EAAE,CAAC;YACjI,OAAO,CAAC,OAAO,EAAE;SAClB,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { MaterialMove, PlayerTurnRule } from '@gamepark/rules-api';
2
+ export declare abstract class HaatiRule extends PlayerTurnRule {
3
+ get duelWinner(): number;
4
+ get isDuelWinner(): boolean;
5
+ get opponent(): number;
6
+ resume(): MaterialMove[];
7
+ drawCharacter(): MaterialMove[];
8
+ }
9
+ //# sourceMappingURL=HaatiRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HaatiRule.d.ts","sourceRoot":"","sources":["../../src/rules/HaatiRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAQlE,8BAAsB,SAAU,SAAQ,cAAc;IACpD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAGD,MAAM,IAAI,YAAY,EAAE,CAEvB;IASD,aAAa,IAAI,YAAY,EAAE,CAkB9B;CACF"}
@@ -0,0 +1,43 @@
1
+ import { PlayerTurnRule } from '@gamepark/rules-api';
2
+ import { CHARACTER_HAND_LIMIT } from '../material/Character';
3
+ import { LocationType } from '../material/LocationType';
4
+ import { MaterialType } from '../material/MaterialType';
5
+ import { Memory } from '../Memory';
6
+ import { RuleId } from './RuleId';
7
+ export class HaatiRule extends PlayerTurnRule {
8
+ get duelWinner() {
9
+ return this.remind(Memory.DuelWinner);
10
+ }
11
+ get isDuelWinner() {
12
+ return this.player === this.duelWinner;
13
+ }
14
+ get opponent() {
15
+ return this.game.players.find((player) => player !== this.player);
16
+ }
17
+ resume() {
18
+ return [this.startPlayerTurn(RuleId.ResolveDuel, this.player)];
19
+ }
20
+ drawCharacter() {
21
+ const hand = { type: LocationType.PlayerHand, player: this.player };
22
+ const deck = this.material(MaterialType.CharacterCard).location(LocationType.CharacterDeck);
23
+ const moves = [];
24
+ if (deck.length) {
25
+ moves.push(deck.deck().dealOne(hand));
26
+ }
27
+ else {
28
+ const discard = this.material(MaterialType.CharacterCard).location(LocationType.CharacterDiscard);
29
+ if (!discard.length)
30
+ return this.resume();
31
+ moves.push(...discard.moveItems({ type: LocationType.CharacterDeck }), discard.shuffle(), discard.limit(1).moveItem(hand));
32
+ }
33
+ const handSize = this.material(MaterialType.CharacterCard).location(LocationType.PlayerHand).player(this.player).length + 1;
34
+ if (handSize > CHARACTER_HAND_LIMIT) {
35
+ moves.push(this.startPlayerTurn(RuleId.DiscardCharacter, this.player));
36
+ }
37
+ else {
38
+ moves.push(...this.resume());
39
+ }
40
+ return moves;
41
+ }
42
+ }
43
+ //# sourceMappingURL=HaatiRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HaatiRule.js","sourceRoot":"","sources":["../../src/rules/HaatiRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,MAAM,OAAgB,SAAU,SAAQ,cAAc;IACpD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAS,MAAM,CAAC,UAAU,CAAC,CAAA;IAC/C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,CAAA;IACxC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAE,CAAA;IACpE,CAAC;IAGD,MAAM;QACJ,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAChE,CAAC;IASD,aAAa;QACX,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,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AA;QAC9B,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ import { CustomMove, ItemMove, MaterialMove } from '@gamepark/rules-api';
2
+ import { LocationType } from '../material/LocationType';
3
+ import { HaatiRule } from './HaatiRule';
4
+ declare abstract class MoveAnimalRule extends HaatiRule {
5
+ abstract getAnimalMoves(): MaterialMove[];
6
+ onRuleStart(): MaterialMove[];
7
+ getPlayerMoves(): MaterialMove[];
8
+ afterItemMove(move: ItemMove): MaterialMove[];
9
+ onCustomMove(move: CustomMove): MaterialMove[];
10
+ animals(place: LocationType, player?: number): import("@gamepark/rules-api").Material<number, number, number>;
11
+ }
12
+ export declare class JungleElephantRule extends MoveAnimalRule {
13
+ getAnimalMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
14
+ }
15
+ export declare class JungleTigerRule extends MoveAnimalRule {
16
+ getAnimalMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
17
+ }
18
+ export declare class MaharajaRule extends MoveAnimalRule {
19
+ getAnimalMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
20
+ }
21
+ export declare class ThiefRule extends MoveAnimalRule {
22
+ getAnimalMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
23
+ }
24
+ export declare class HunterRule extends MoveAnimalRule {
25
+ getAnimalMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
26
+ }
27
+ export {};
28
+ //# sourceMappingURL=MoveAnimalRules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoveAnimalRules.d.ts","sourceRoot":"","sources":["../../src/rules/MoveAnimalRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAgB,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQvC,uBAAe,cAAe,SAAQ,SAAS;IAC7C,QAAQ,CAAC,cAAc,IAAI,YAAY,EAAE,CAAA;IAEzC,WAAW,mBAEV;IAED,cAAc,mBAEb;IAED,aAAa,CAAC,IAAI,EAAE,QAAQ,kBAE3B;IAED,YAAY,CAAC,IAAI,EAAE,UAAU,kBAE5B;IAGD,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,kEAG3C;CACF;AAMD,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,cAAc,qEAEb;CACF;AAGD,qBAAa,eAAgB,SAAQ,cAAc;IACjD,cAAc,qEAEb;CACF;AAGD,qBAAa,YAAa,SAAQ,cAAc;IAC9C,cAAc,qEAKb;CACF;AAMD,qBAAa,SAAU,SAAQ,cAAc;IAC3C,cAAc,qEAGb;CACF;AAGD,qBAAa,UAAW,SAAQ,cAAc;IAC5C,cAAc,qEAKb;CACF"}
@@ -0,0 +1,56 @@
1
+ import { LocationType } from '../material/LocationType';
2
+ import { MaterialType } from '../material/MaterialType';
3
+ import { CustomMoveType } from './CustomMoveType';
4
+ import { HaatiRule } from './HaatiRule';
5
+ class MoveAnimalRule extends HaatiRule {
6
+ onRuleStart() {
7
+ return this.getAnimalMoves().length ? [] : this.resume();
8
+ }
9
+ getPlayerMoves() {
10
+ return [...this.getAnimalMoves(), this.customMove(CustomMoveType.Pass)];
11
+ }
12
+ afterItemMove(move) {
13
+ return move.itemType === MaterialType.AnimalCard ? this.resume() : [];
14
+ }
15
+ onCustomMove(move) {
16
+ return move.type === CustomMoveType.Pass ? this.resume() : [];
17
+ }
18
+ animals(place, player) {
19
+ const animals = this.material(MaterialType.AnimalCard).location(place);
20
+ return player === undefined ? animals : animals.player(player);
21
+ }
22
+ }
23
+ const sameOwner = (type) => (item) => ({ type, player: item.location.player });
24
+ export class JungleElephantRule extends MoveAnimalRule {
25
+ getAnimalMoves() {
26
+ return this.animals(LocationType.Jungle).moveItems(sameOwner(LocationType.Palace));
27
+ }
28
+ }
29
+ export class JungleTigerRule extends MoveAnimalRule {
30
+ getAnimalMoves() {
31
+ return this.animals(LocationType.Palace).moveItems(sameOwner(LocationType.Jungle));
32
+ }
33
+ }
34
+ export class MaharajaRule extends MoveAnimalRule {
35
+ getAnimalMoves() {
36
+ return [
37
+ ...this.animals(LocationType.Palace).moveItems(sameOwner(LocationType.Jungle)),
38
+ ...this.animals(LocationType.Jungle).moveItems(sameOwner(LocationType.Palace))
39
+ ];
40
+ }
41
+ }
42
+ export class ThiefRule extends MoveAnimalRule {
43
+ getAnimalMoves() {
44
+ const place = this.isDuelWinner ? LocationType.Jungle : LocationType.Palace;
45
+ return this.animals(place, this.opponent).moveItems({ type: place, player: this.player });
46
+ }
47
+ }
48
+ export class HunterRule extends MoveAnimalRule {
49
+ getAnimalMoves() {
50
+ return this.material(MaterialType.AnimalCard)
51
+ .location((location) => location.type === LocationType.Palace || location.type === LocationType.Jungle)
52
+ .player(this.opponent)
53
+ .moveItems({ type: LocationType.AnimalDiscard });
54
+ }
55
+ }
56
+ //# sourceMappingURL=MoveAnimalRules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoveAnimalRules.js","sourceRoot":"","sources":["../../src/rules/MoveAnimalRules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQvC,MAAe,cAAe,SAAQ,SAAS;IAG7C,WAAW;QACT,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAA;IAC1D,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,c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AO,YAAa,SAAQ,cAAc;IAC9C,cAAc;QACZ,OAAO;YACL,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAC9E,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;SAC/E,CAAA;IACH,CAAC;CACF;AAMD,MAAM,OAAO,SAAU,SAAQ,cAAc;IAC3C,cAAc;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAA;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3F,CAAC;CACF;AAGD,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5C,cAAc;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC;aAC1C,QAAQ,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;aACtG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;aACrB,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,aAAa,EAAE,CAAC,CAAA;IACpD,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { MaterialRulesPart } from '@gamepark/rules-api';
2
+ import { LocationType } from '../material/LocationType';
3
+ import { MaterialSource } from '../material/MaterialSource';
4
+ import { MaterialType } from '../material/MaterialType';
5
+ import { RuleId } from './RuleId';
6
+ export declare const animalPiles: number[];
7
+ export declare const dealRound: (source: MaterialSource, players: number[]) => import("@gamepark/rules-api").MoveItem<number, MaterialType, LocationType>[];
8
+ export declare class NewRoundRule extends MaterialRulesPart {
9
+ onRuleStart(): (import("@gamepark/rules-api").MoveItem<number, MaterialType, LocationType> | import("@gamepark/rules-api").StartSimultaneousRule<number, RuleId.ChooseCards>)[];
10
+ }
11
+ //# sourceMappingURL=NewRoundRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NewRoundRule.d.ts","sourceRoot":"","sources":["../../src/rules/NewRoundRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,eAAO,MAAM,WAAW,UAAS,CAAA;AAQjC,eAAO,MAAM,SAAS,WAAY,cAAc,WAAW,MAAM,EAAE,iFASlE,CAAA;AAGD,qBAAa,YAAa,SAAQ,iBAAiB;IACjD,WAAW,qKAEV;CACF"}
@@ -0,0 +1,23 @@
1
+ import { MaterialRulesPart } from '@gamepark/rules-api';
2
+ import { LocationType } from '../material/LocationType';
3
+ import { MaterialType } from '../material/MaterialType';
4
+ import { RuleId } from './RuleId';
5
+ export const animalPiles = [1, 2];
6
+ const HAND_SIZE = 2;
7
+ const PILE_SIZE = 8;
8
+ export const dealRound = (source, players) => {
9
+ const deck = source.material(MaterialType.AnimalCard).location(LocationType.AnimalSetAside).deck();
10
+ return [
11
+ ...players.flatMap((player) => deck.deal({ type: LocationType.PlayerHand, player }, HAND_SIZE)),
12
+ ...animalPiles.flatMap((id) => [
13
+ ...deck.deal({ type: LocationType.AnimalDeck, id }, PILE_SIZE - 1),
14
+ deck.dealOne({ type: LocationType.AnimalDeck, id, rotation: true })
15
+ ])
16
+ ];
17
+ };
18
+ export class NewRoundRule extends MaterialRulesPart {
19
+ onRuleStart() {
20
+ return [...dealRound(this, this.game.players), this.startSimultaneousRule(RuleId.ChooseCards)];
21
+ }
22
+ }
23
+ //# sourceMappingURL=NewRoundRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NewRoundRule.js","sourceRoot":"","sources":["../../src/rules/NewRoundRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACjC,MAAM,SAAS,GAAG,CAAC,CAAA;AACnB,MAAM,SAAS,GAAG,CAAC,CAAA;AAMnB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAsB,EAAE,OAAiB,EAAE,EAAE;IACrE,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE,CAAA;IAClG,OAAO;QACL,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC;QAC/F,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC;YAC7B,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,GAAG,CAAC,CAAC;YAClE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SACpE,CAAC;KACH,CAAA;AACH,CAAC,CAAA;AAGD,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IACjD,WAAW;QACT,OAAO,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAA;IAChG,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { ItemMove, MaterialMove } from '@gamepark/rules-api';
2
+ import { HaatiRule } from './HaatiRule';
3
+ export declare class RefillHandRule extends HaatiRule {
4
+ getPlayerMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
5
+ get offers(): import("@gamepark/rules-api").Material<number, number, number>;
6
+ afterItemMove(move: ItemMove): MaterialMove[];
7
+ }
8
+ //# sourceMappingURL=RefillHandRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefillHandRule.d.ts","sourceRoot":"","sources":["../../src/rules/RefillHandRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAG5E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAUvC,qBAAa,cAAe,SAAQ,SAAS;IAC3C,cAAc,qEAEb;IAED,IAAI,MAAM,mEAIT;IAED,aAAa,CAAC,IAAI,EAAE,QAAQ,kBAc3B;CACF"}
@@ -0,0 +1,32 @@
1
+ import { isMoveItemType } from '@gamepark/rules-api';
2
+ import { LocationType } from '../material/LocationType';
3
+ import { MaterialType } from '../material/MaterialType';
4
+ import { HaatiRule } from './HaatiRule';
5
+ import { animalPiles } from './NewRoundRule';
6
+ import { RuleId } from './RuleId';
7
+ export class RefillHandRule extends HaatiRule {
8
+ getPlayerMoves() {
9
+ return this.offers.moveItems({ type: LocationType.PlayerHand, player: this.player });
10
+ }
11
+ get offers() {
12
+ return this.material(MaterialType.AnimalCard)
13
+ .location(LocationType.AnimalDeck)
14
+ .filter((item) => !!item.location.rotation);
15
+ }
16
+ afterItemMove(move) {
17
+ if (!isMoveItemType(MaterialType.AnimalCard)(move) || move.location.type !== LocationType.PlayerHand)
18
+ return [];
19
+ if (move.location.player === this.player) {
20
+ return this.offers.moveItems({ type: LocationType.PlayerHand, player: this.opponent });
21
+ }
22
+ const moves = this.game.players.map((player) => this.material(MaterialType.AnimalCard).location(LocationType.PlayerHand).player(player).shuffle());
23
+ for (const id of animalPiles) {
24
+ const pile = this.material(MaterialType.AnimalCard).location(LocationType.AnimalDeck).locationId(id);
25
+ if (pile.length)
26
+ moves.push(pile.deck().limit(1).rotateItem(true));
27
+ }
28
+ moves.push(this.startSimultaneousRule(RuleId.ChooseCards));
29
+ return moves;
30
+ }
31
+ }
32
+ //# sourceMappingURL=RefillHandRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefillHandRule.js","sourceRoot":"","sources":["../../src/rules/RefillHandRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAQjC,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C,cAAc;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAA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C,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;QACpE,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAA;QAC1D,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ import { ItemMove, MaterialMove } from '@gamepark/rules-api';
2
+ import { Animal } from '../material/Animal';
3
+ import { CharacterCard } from '../material/Character';
4
+ import { LocationType } from '../material/LocationType';
5
+ import { HaatiRule } from './HaatiRule';
6
+ export declare class ResolveDuelRule extends HaatiRule {
7
+ onRuleStart(): MaterialMove[];
8
+ getPlayerMoves(): import("@gamepark/rules-api").MoveItem<number, number, number>[];
9
+ get destination(): {
10
+ type: LocationType;
11
+ player: number;
12
+ };
13
+ get duelAnimal(): import("@gamepark/rules-api").Material<number, number, number>;
14
+ get duelCharacter(): import("@gamepark/rules-api").Material<number, number, number>;
15
+ afterItemMove(move: ItemMove): MaterialMove[];
16
+ count(place: LocationType, animal: Animal): number;
17
+ palaceEffect(animal: Animal): MaterialMove[];
18
+ jungleEffect(animal: Animal): MaterialMove[];
19
+ characterEffect(card: CharacterCard): MaterialMove[];
20
+ endResolution(): MaterialMove[];
21
+ checkCollections(): MaterialMove[];
22
+ }
23
+ //# sourceMappingURL=ResolveDuelRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolveDuelRule.d.ts","sourceRoot":"","sources":["../../src/rules/ResolveDuelRule.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAA4B,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAYvC,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,WAAW,mBAKV;IAED,cAAc,qEAEb;IAED,IAAI,WAAW;;;MAEd;IAED,IAAI,UAAU,mEAEb;IAED,IAAI,aAAa,mEAEhB;IAED,aAAa,CAAC,IAAI,EAAE,QAAQ,kBAS3B;IAED,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAKxC;IAGD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAe3C;IAGD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAS3C;IAED,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,EAAE,CAkBnD;IAGD,aAAa,IAAI,YAAY,EAAE,CAc9B;IAQD,gBAAgB,IAAI,YAAY,EAAE,CAkBjC;CACF"}
@@ -0,0 +1,127 @@
1
+ import { sumBy } from 'es-toolkit';
2
+ import { isMoveItemType } from '@gamepark/rules-api';
3
+ import { Animal, getAnimal, hasCollection } from '../material/Animal';
4
+ import { CharacterCard } from '../material/Character';
5
+ import { collectionPlace, getCollectionReward } from '../material/Collection';
6
+ import { LocationType } from '../material/LocationType';
7
+ import { MaterialType } from '../material/MaterialType';
8
+ import { gainPrestige, PrestigeSide } from '../material/Prestige';
9
+ import { HaatiRule } from './HaatiRule';
10
+ import { animalPiles } from './NewRoundRule';
11
+ import { RuleId } from './RuleId';
12
+ export class ResolveDuelRule extends HaatiRule {
13
+ onRuleStart() {
14
+ if (this.duelCharacter.length)
15
+ return [];
16
+ const animal = this.duelAnimal;
17
+ if (animal.length)
18
+ return [animal.moveItem(this.destination)];
19
+ return this.endResolution();
20
+ }
21
+ getPlayerMoves() {
22
+ return [...this.duelAnimal.moveItems(this.destination), ...this.duelCharacter.moveItems({ type: LocationType.CharacterDiscard })];
23
+ }
24
+ get destination() {
25
+ return { type: this.isDuelWinner ? LocationType.Palace : LocationType.Jungle, player: this.player };
26
+ }
27
+ get duelAnimal() {
28
+ return this.material(MaterialType.AnimalCard).location(LocationType.PlayerDuel).player(this.player);
29
+ }
30
+ get duelCharacter() {
31
+ return this.material(MaterialType.CharacterCard).location(LocationType.PlayerDuel).player(this.player);
32
+ }
33
+ afterItemMove(move) {
34
+ if (isMoveItemType(MaterialType.AnimalCard)(move) && move.location.type === this.destination.type) {
35
+ const animal = getAnimal(this.material(MaterialType.AnimalCard).getItem(move.itemIndex).id);
36
+ return this.isDuelWinner ? this.palaceEffect(animal) : this.jungleEffect(animal);
37
+ }
38
+ if (isMoveItemType(MaterialType.CharacterCard)(move) && move.location.type === LocationType.CharacterDiscard) {
39
+ return this.characterEffect(this.material(MaterialType.CharacterCard).getItem(move.itemIndex).id);
40
+ }
41
+ return [];
42
+ }
43
+ count(place, animal) {
44
+ return this.material(MaterialType.AnimalCard)
45
+ .location(place)
46
+ .player(this.player)
47
+ .id((id) => getAnimal(id) === animal).length;
48
+ }
49
+ palaceEffect(animal) {
50
+ switch (animal) {
51
+ case Animal.Elephant:
52
+ return [...gainPrestige(this, PrestigeSide.Favor, this.player, this.count(LocationType.Palace, Animal.Elephant)), ...this.resume()];
53
+ case Animal.Tiger:
54
+ return [...gainPrestige(this, PrestigeSide.Favor, this.player, this.count(LocationType.Jungle, Animal.Tiger)), ...this.drawCharacter()];
55
+ case Animal.Mouse: {
56
+ const pairs = Math.floor(this.count(LocationType.Palace, Animal.Mouse) / 2);
57
+ return [
58
+ ...gainPrestige(this, PrestigeSide.Favor, this.player, pairs),
59
+ ...gainPrestige(this, PrestigeSide.Honor, this.player, pairs),
60
+ ...this.resume()
61
+ ];
62
+ }
63
+ }
64
+ }
65
+ jungleEffect(animal) {
66
+ switch (animal) {
67
+ case Animal.Elephant:
68
+ return [this.startPlayerTurn(RuleId.JungleElephant, this.player)];
69
+ case Animal.Tiger:
70
+ return [this.startPlayerTurn(RuleId.JungleTiger, this.player)];
71
+ case Animal.Mouse:
72
+ return this.drawCharacter();
73
+ }
74
+ }
75
+ characterEffect(card) {
76
+ switch (card) {
77
+ case CharacterCard.MerchantWin:
78
+ return [...gainPrestige(this, PrestigeSide.Favor, this.player, 2), ...this.resume()];
79
+ case CharacterCard.MerchantLose:
80
+ return [...gainPrestige(this, PrestigeSide.Favor, this.player, 1), ...gainPrestige(this, PrestigeSide.Honor, this.player, 1), ...this.resume()];
81
+ case CharacterCard.MaharajaWin:
82
+ return [this.startPlayerTurn(RuleId.Maharaja, this.player)];
83
+ case CharacterCard.MaharajaLose:
84
+ return [...gainPrestige(this, PrestigeSide.Favor, this.player, 1), this.startPlayerTurn(RuleId.Maharaja, this.player)];
85
+ case CharacterCard.ThiefWin:
86
+ case CharacterCard.ThiefLose:
87
+ return [this.startPlayerTurn(RuleId.Thief, this.player)];
88
+ case CharacterCard.HunterWin:
89
+ return [...gainPrestige(this, PrestigeSide.Favor, this.player, 1), this.startPlayerTurn(RuleId.Hunter, this.player)];
90
+ case CharacterCard.HunterLose:
91
+ return [...gainPrestige(this, PrestigeSide.Honor, this.player, 1), this.startPlayerTurn(RuleId.Hunter, this.player)];
92
+ }
93
+ }
94
+ endResolution() {
95
+ const moves = this.checkCollections();
96
+ if (this.isDuelWinner) {
97
+ moves.push(this.startPlayerTurn(RuleId.ResolveDuel, this.opponent));
98
+ }
99
+ else if (this.material(MaterialType.AnimalCard)
100
+ .location(LocationType.AnimalDeck)
101
+ .filter((item) => !!item.location.rotation).length === animalPiles.length) {
102
+ moves.push(this.startPlayerTurn(RuleId.RefillHand, this.player));
103
+ }
104
+ else {
105
+ moves.push(this.startRule(RuleId.EndOfRound));
106
+ }
107
+ return moves;
108
+ }
109
+ checkCollections() {
110
+ const tokens = this.material(MaterialType.CollectionToken)
111
+ .location(LocationType.CollectionSpot)
112
+ .getItems()
113
+ .filter((token) => {
114
+ const cards = this.material(MaterialType.AnimalCard).location(collectionPlace[token.id]).player(this.player).getItems();
115
+ return hasCollection(cards.map((card) => card.id));
116
+ });
117
+ const rewards = tokens.map((token) => getCollectionReward(token.id, token.location.rotation));
118
+ return [
119
+ ...tokens.map((token) => this.material(MaterialType.CollectionToken)
120
+ .id(token.id)
121
+ .moveItem({ type: LocationType.PlayerCollection, player: this.player, rotation: token.location.rotation })),
122
+ ...gainPrestige(this, PrestigeSide.Favor, this.player, sumBy(rewards, (reward) => reward.favor)),
123
+ ...gainPrestige(this, PrestigeSide.Honor, this.player, sumBy(rewards, (reward) => reward.honor))
124
+ ];
125
+ }
126
+ }
127
+ //# sourceMappingURL=ResolveDuelRule.js.map