@gamepark/mythologies 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/Memory.d.ts +9 -6
  2. package/dist/Memory.js +9 -6
  3. package/dist/MythologiesRules.d.ts +42 -32
  4. package/dist/MythologiesRules.js +10 -0
  5. package/dist/MythologiesSetup.js +1 -1
  6. package/dist/material/Entity.d.ts +5 -1
  7. package/dist/material/Entity.js +1 -1
  8. package/dist/material/Mythology.d.ts +0 -1
  9. package/dist/material/Mythology.js +1 -3
  10. package/dist/material/Pantheon.d.ts +11 -6
  11. package/dist/material/Pantheon.js +97 -48
  12. package/dist/material/entity/Effect.d.ts +20 -12
  13. package/dist/material/entity/Effect.js +4 -5
  14. package/dist/material/entity/EntityDescription.d.ts +2 -0
  15. package/dist/material/entity/EntityDescription.js +6 -3
  16. package/dist/material/entity/MoveEffectRule.d.ts +4 -1
  17. package/dist/material/entity/MoveEffectRule.js +53 -6
  18. package/dist/material/entity/PlaceCardEffectRule.js +4 -27
  19. package/dist/material/entity/SacrificeEffectRule.d.ts +2 -1
  20. package/dist/material/entity/SacrificeEffectRule.js +15 -37
  21. package/dist/material/entity/SimultaneousMoveEffectRule.d.ts +8 -2
  22. package/dist/material/entity/SimultaneousMoveEffectRule.js +43 -11
  23. package/dist/material/entity/SimultaneousSacrificeEffectRule.d.ts +1 -0
  24. package/dist/material/entity/SimultaneousSacrificeEffectRule.js +12 -35
  25. package/dist/material/entity/celtic/Banshee.js +33 -1
  26. package/dist/material/entity/celtic/Brigid.js +34 -1
  27. package/dist/material/entity/celtic/Cernunnos.js +37 -1
  28. package/dist/material/entity/celtic/Dagda.js +43 -1
  29. package/dist/material/entity/celtic/Dullahan.js +7 -1
  30. package/dist/material/entity/celtic/Fairy.d.ts +2 -0
  31. package/dist/material/entity/celtic/Fairy.js +12 -0
  32. package/dist/material/entity/celtic/Kelpie.js +33 -1
  33. package/dist/material/entity/celtic/Leprechaun.js +7 -1
  34. package/dist/material/entity/celtic/Morrigan.js +6 -1
  35. package/dist/material/entity/celtic/Selkie.js +12 -1
  36. package/dist/material/entity/egyptian/Beetle.js +19 -13
  37. package/dist/material/entity/hindu/Naga.js +36 -30
  38. package/dist/material/entity/norse/Troll.js +4 -1
  39. package/dist/material/entity/zulu/Tokoloshe.js +22 -17
  40. package/dist/rules/PlaceCardsRule.js +3 -2
  41. package/dist/rules/RuleId.d.ts +37 -32
  42. package/dist/rules/RuleId.js +37 -32
  43. package/dist/rules/effects/AthenaEffectRule.js +29 -1
  44. package/dist/rules/effects/CentaurEffectRule.d.ts +5 -3
  45. package/dist/rules/effects/CentaurEffectRule.js +90 -14
  46. package/dist/rules/effects/CondorEffectRule.d.ts +1 -1
  47. package/dist/rules/effects/CondorEffectRule.js +5 -1
  48. package/dist/rules/effects/DullahanEffectRule.d.ts +11 -0
  49. package/dist/rules/effects/DullahanEffectRule.js +73 -0
  50. package/dist/rules/effects/FairyEffectRule.d.ts +10 -0
  51. package/dist/rules/effects/FairyEffectRule.js +55 -0
  52. package/dist/rules/effects/FenrirEffectRule.js +2 -1
  53. package/dist/rules/effects/GarudaEffectRule.d.ts +1 -1
  54. package/dist/rules/effects/GarudaEffectRule.js +3 -2
  55. package/dist/rules/effects/GorgonEffectRule.d.ts +1 -1
  56. package/dist/rules/effects/GorgonEffectRule.js +2 -26
  57. package/dist/rules/effects/HadesEffectRule.d.ts +8 -4
  58. package/dist/rules/effects/HadesEffectRule.js +12 -50
  59. package/dist/rules/effects/IdloziEffectRule.d.ts +2 -2
  60. package/dist/rules/effects/IdloziEffectRule.js +4 -1
  61. package/dist/rules/effects/IllapaEffectRule.d.ts +1 -1
  62. package/dist/rules/effects/IllapaEffectRule.js +1 -1
  63. package/dist/rules/effects/JiangshiEffectRule.d.ts +1 -1
  64. package/dist/rules/effects/JiangshiEffectRule.js +6 -27
  65. package/dist/rules/effects/LeprechaunEffectRule.d.ts +9 -0
  66. package/dist/rules/effects/LeprechaunEffectRule.js +49 -0
  67. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.d.ts +13 -0
  68. package/dist/rules/effects/MultipleSimultaneousMoveEffectRule.js +160 -0
  69. package/dist/rules/effects/PermanentEffectsRule.d.ts +7 -0
  70. package/dist/rules/effects/PermanentEffectsRule.js +54 -0
  71. package/dist/rules/effects/QilinEffectRule.js +6 -5
  72. package/dist/rules/effects/RaEffectRule.d.ts +8 -4
  73. package/dist/rules/effects/RaEffectRule.js +12 -50
  74. package/dist/rules/effects/ResolveEffectsRule.js +1 -1
  75. package/dist/rules/effects/SelkieEffectRule.d.ts +8 -0
  76. package/dist/rules/effects/SelkieEffectRule.js +44 -0
  77. package/dist/rules/effects/ShivaEffectRule.d.ts +2 -2
  78. package/dist/rules/effects/ShivaEffectRule.js +16 -36
  79. package/dist/rules/effects/SphinxEffectRule.d.ts +2 -2
  80. package/dist/rules/effects/SphinxEffectRule.js +4 -1
  81. package/dist/rules/effects/TianlongEffectRule.d.ts +2 -3
  82. package/dist/rules/effects/TianlongEffectRule.js +33 -39
  83. package/dist/rules/effects/TriggerEffectsRule.d.ts +1 -1
  84. package/dist/rules/effects/TriggerEffectsRule.js +36 -18
  85. package/dist/rules/effects/VetalaEffectRule.d.ts +3 -2
  86. package/dist/rules/effects/VetalaEffectRule.js +10 -5
  87. package/dist/rules/effects/ViracochaEffectRule.d.ts +1 -1
  88. package/dist/rules/effects/ViracochaEffectRule.js +2 -26
  89. package/package.json +2 -2
package/dist/Memory.d.ts CHANGED
@@ -5,14 +5,17 @@ export declare enum Memory {
5
5
  OngoingEffect = 4,
6
6
  OncePerTurn = 5,
7
7
  PlayerGrid = 6,
8
+ TargetEntities = 7,
9
+ EffectCount = 8,
10
+ EntityMoved = 9,
8
11
  OdinTargetMythology = 10,
9
12
  FenrirPaid1 = 11,
10
13
  AnubisInvoke1 = 12,
11
14
  GarudaSacrificeCount = 13,
12
- VetalaCount = 14,
13
- IllapaLine = 15,
14
- YanluoWangCount = 16,
15
- NuwaPlayerCreatures = 17,
16
- TianlongVector = 18,
17
- InkosazanaInvoke1 = 19
15
+ IllapaLine = 14,
16
+ YanluoWangCount = 15,
17
+ NuwaPlayerCreatures = 16,
18
+ TianlongVector = 17,
19
+ InkosazanaInvoke1 = 18,
20
+ FairyTargets = 19
18
21
  }
package/dist/Memory.js CHANGED
@@ -9,14 +9,17 @@ var Memory;
9
9
  Memory[Memory["OngoingEffect"] = 4] = "OngoingEffect";
10
10
  Memory[Memory["OncePerTurn"] = 5] = "OncePerTurn";
11
11
  Memory[Memory["PlayerGrid"] = 6] = "PlayerGrid";
12
+ Memory[Memory["TargetEntities"] = 7] = "TargetEntities";
13
+ Memory[Memory["EffectCount"] = 8] = "EffectCount";
14
+ Memory[Memory["EntityMoved"] = 9] = "EntityMoved";
12
15
  Memory[Memory["OdinTargetMythology"] = 10] = "OdinTargetMythology";
13
16
  Memory[Memory["FenrirPaid1"] = 11] = "FenrirPaid1";
14
17
  Memory[Memory["AnubisInvoke1"] = 12] = "AnubisInvoke1";
15
18
  Memory[Memory["GarudaSacrificeCount"] = 13] = "GarudaSacrificeCount";
16
- Memory[Memory["VetalaCount"] = 14] = "VetalaCount";
17
- Memory[Memory["IllapaLine"] = 15] = "IllapaLine";
18
- Memory[Memory["YanluoWangCount"] = 16] = "YanluoWangCount";
19
- Memory[Memory["NuwaPlayerCreatures"] = 17] = "NuwaPlayerCreatures";
20
- Memory[Memory["TianlongVector"] = 18] = "TianlongVector";
21
- Memory[Memory["InkosazanaInvoke1"] = 19] = "InkosazanaInvoke1";
19
+ Memory[Memory["IllapaLine"] = 14] = "IllapaLine";
20
+ Memory[Memory["YanluoWangCount"] = 15] = "YanluoWangCount";
21
+ Memory[Memory["NuwaPlayerCreatures"] = 16] = "NuwaPlayerCreatures";
22
+ Memory[Memory["TianlongVector"] = 17] = "TianlongVector";
23
+ Memory[Memory["InkosazanaInvoke1"] = 18] = "InkosazanaInvoke1";
24
+ Memory[Memory["FairyTargets"] = 19] = "FairyTargets";
22
25
  })(Memory = exports.Memory || (exports.Memory = {}));
@@ -16,6 +16,8 @@ import { CobraEffectRule, CobraInvokeEffect } from './rules/effects/CobraEffectR
16
16
  import { CondorEffectRule } from './rules/effects/CondorEffectRule';
17
17
  import { CyclopsEffectRule } from './rules/effects/CyclopsEffectRule';
18
18
  import { DraugrEffectRule } from './rules/effects/DraugrEffectRule';
19
+ import { DullahanEffectRule } from './rules/effects/DullahanEffectRule';
20
+ import { FairyEffectRule } from './rules/effects/FairyEffectRule';
19
21
  import { FenghuangEffectRule } from './rules/effects/FenghuangEffectRule';
20
22
  import { FenrirChoiceRule, FenrirEffectRule } from './rules/effects/FenrirEffectRule';
21
23
  import { GarudaEffectRule } from './rules/effects/GarudaEffectRule';
@@ -28,12 +30,15 @@ import { ImpunduluEffectRule } from './rules/effects/ImpunduluEffectRule';
28
30
  import { InkosazanaEffectRule } from './rules/effects/InkosazanaEffectRule';
29
31
  import { JiangshiEffectRule } from './rules/effects/JiangshiEffectRule';
30
32
  import { KinnaraEffectRule, KinnaraPlaceEffectRule } from './rules/effects/KinnaraEffectRule';
33
+ import { LeprechaunEffectRule } from './rules/effects/LeprechaunEffectRule';
31
34
  import { MinotaurEffectRule } from './rules/effects/MinotaurEffectRule';
32
35
  import { NuwaEffectRule } from './rules/effects/NuwaEffectRule';
33
36
  import { OdinEffectRule } from './rules/effects/OdinEffectRule';
34
37
  import { QilinEffectRule } from './rules/effects/QilinEffectRule';
38
+ import { RaEffectRule } from './rules/effects/RaEffectRule';
35
39
  import { RakshasaEffectRule } from './rules/effects/RakshasaEffectRule';
36
40
  import { ResolveEffectsRule } from './rules/effects/ResolveEffectsRule';
41
+ import { SelkieEffectRule } from './rules/effects/SelkieEffectRule';
37
42
  import { ShivaEffectRule } from './rules/effects/ShivaEffectRule';
38
43
  import { SphinxEffectRule } from './rules/effects/SphinxEffectRule';
39
44
  import { SupayEffectRule } from './rules/effects/SupayEffectRule';
@@ -72,38 +77,43 @@ export declare class MythologiesRules extends SecretMaterialRules<PlayerColor, M
72
77
  23: typeof FenrirChoiceRule;
73
78
  24: typeof FenrirEffectRule;
74
79
  25: typeof AlfEffectRule;
75
- 26: typeof AnubisEffectRule;
76
- 27: typeof SphinxEffectRule;
77
- 28: typeof CobraEffectRule;
78
- 29: typeof CobraInvokeEffect;
79
- 30: typeof BabaiEffectRule;
80
- 31: typeof BennuEffectRule;
81
- 32: typeof ShivaEffectRule;
82
- 33: typeof RakshasaEffectRule;
83
- 34: typeof GarudaEffectRule;
84
- 35: typeof VetalaEffectRule;
85
- 36: typeof KinnaraEffectRule;
86
- 37: typeof KinnaraPlaceEffectRule;
87
- 38: typeof ViracochaEffectRule;
88
- 39: typeof IllapaEffectRule;
89
- 40: typeof IllapaSacrificeRule;
90
- 41: typeof CaimanEffectRule;
91
- 42: typeof CondorEffectRule;
92
- 43: typeof SupayEffectRule;
93
- 44: typeof UkukuEffectRule;
94
- 45: typeof UkukuPlaceEffectRule;
95
- 46: typeof YanluoWangEffectRule;
96
- 47: typeof NuwaEffectRule;
97
- 48: typeof TianlongEffectRule;
98
- 49: typeof TianlongOpponentsEffectRule;
99
- 50: typeof QilinEffectRule;
100
- 51: typeof FenghuangEffectRule;
101
- 52: typeof JiangshiEffectRule;
102
- 53: typeof InkosazanaEffectRule;
103
- 54: typeof ImpunduluEffectRule;
104
- 55: typeof WerehyenaEffectRule;
105
- 56: typeof WerehyenaCallEffectRule;
106
- 57: typeof IdloziEffectRule;
80
+ 26: typeof RaEffectRule;
81
+ 27: typeof AnubisEffectRule;
82
+ 28: typeof SphinxEffectRule;
83
+ 29: typeof CobraEffectRule;
84
+ 30: typeof CobraInvokeEffect;
85
+ 31: typeof BabaiEffectRule;
86
+ 32: typeof BennuEffectRule;
87
+ 33: typeof ShivaEffectRule;
88
+ 34: typeof RakshasaEffectRule;
89
+ 35: typeof GarudaEffectRule;
90
+ 36: typeof VetalaEffectRule;
91
+ 37: typeof KinnaraEffectRule;
92
+ 38: typeof KinnaraPlaceEffectRule;
93
+ 39: typeof ViracochaEffectRule;
94
+ 40: typeof IllapaEffectRule;
95
+ 41: typeof IllapaSacrificeRule;
96
+ 42: typeof CaimanEffectRule;
97
+ 43: typeof CondorEffectRule;
98
+ 44: typeof SupayEffectRule;
99
+ 45: typeof UkukuEffectRule;
100
+ 46: typeof UkukuPlaceEffectRule;
101
+ 47: typeof YanluoWangEffectRule;
102
+ 48: typeof NuwaEffectRule;
103
+ 49: typeof TianlongEffectRule;
104
+ 50: typeof TianlongOpponentsEffectRule;
105
+ 51: typeof QilinEffectRule;
106
+ 52: typeof FenghuangEffectRule;
107
+ 53: typeof JiangshiEffectRule;
108
+ 54: typeof InkosazanaEffectRule;
109
+ 55: typeof ImpunduluEffectRule;
110
+ 56: typeof WerehyenaEffectRule;
111
+ 57: typeof WerehyenaCallEffectRule;
112
+ 58: typeof IdloziEffectRule;
113
+ 59: typeof FairyEffectRule;
114
+ 60: typeof LeprechaunEffectRule;
115
+ 61: typeof SelkieEffectRule;
116
+ 62: typeof DullahanEffectRule;
107
117
  };
108
118
  locationsStrategies: {
109
119
  2: {
@@ -39,6 +39,8 @@ var CobraEffectRule_1 = require("./rules/effects/CobraEffectRule");
39
39
  var CondorEffectRule_1 = require("./rules/effects/CondorEffectRule");
40
40
  var CyclopsEffectRule_1 = require("./rules/effects/CyclopsEffectRule");
41
41
  var DraugrEffectRule_1 = require("./rules/effects/DraugrEffectRule");
42
+ var DullahanEffectRule_1 = require("./rules/effects/DullahanEffectRule");
43
+ var FairyEffectRule_1 = require("./rules/effects/FairyEffectRule");
42
44
  var FenghuangEffectRule_1 = require("./rules/effects/FenghuangEffectRule");
43
45
  var FenrirEffectRule_1 = require("./rules/effects/FenrirEffectRule");
44
46
  var GarudaEffectRule_1 = require("./rules/effects/GarudaEffectRule");
@@ -51,12 +53,15 @@ var ImpunduluEffectRule_1 = require("./rules/effects/ImpunduluEffectRule");
51
53
  var InkosazanaEffectRule_1 = require("./rules/effects/InkosazanaEffectRule");
52
54
  var JiangshiEffectRule_1 = require("./rules/effects/JiangshiEffectRule");
53
55
  var KinnaraEffectRule_1 = require("./rules/effects/KinnaraEffectRule");
56
+ var LeprechaunEffectRule_1 = require("./rules/effects/LeprechaunEffectRule");
54
57
  var MinotaurEffectRule_1 = require("./rules/effects/MinotaurEffectRule");
55
58
  var NuwaEffectRule_1 = require("./rules/effects/NuwaEffectRule");
56
59
  var OdinEffectRule_1 = require("./rules/effects/OdinEffectRule");
57
60
  var QilinEffectRule_1 = require("./rules/effects/QilinEffectRule");
61
+ var RaEffectRule_1 = require("./rules/effects/RaEffectRule");
58
62
  var RakshasaEffectRule_1 = require("./rules/effects/RakshasaEffectRule");
59
63
  var ResolveEffectsRule_1 = require("./rules/effects/ResolveEffectsRule");
64
+ var SelkieEffectRule_1 = require("./rules/effects/SelkieEffectRule");
60
65
  var ShivaEffectRule_1 = require("./rules/effects/ShivaEffectRule");
61
66
  var SphinxEffectRule_1 = require("./rules/effects/SphinxEffectRule");
62
67
  var SupayEffectRule_1 = require("./rules/effects/SupayEffectRule");
@@ -101,6 +106,7 @@ var MythologiesRules = (function (_super) {
101
106
  _a[RuleId_1.RuleId.FenrirChoice] = FenrirEffectRule_1.FenrirChoiceRule,
102
107
  _a[RuleId_1.RuleId.FenrirEffect] = FenrirEffectRule_1.FenrirEffectRule,
103
108
  _a[RuleId_1.RuleId.AlfEffect] = AlfEffectRule_1.AlfEffectRule,
109
+ _a[RuleId_1.RuleId.RaEffect] = RaEffectRule_1.RaEffectRule,
104
110
  _a[RuleId_1.RuleId.AnubisEffect] = AnubisEffectRule_1.AnubisEffectRule,
105
111
  _a[RuleId_1.RuleId.SphinxEffect] = SphinxEffectRule_1.SphinxEffectRule,
106
112
  _a[RuleId_1.RuleId.CobraEffect] = CobraEffectRule_1.CobraEffectRule,
@@ -133,6 +139,10 @@ var MythologiesRules = (function (_super) {
133
139
  _a[RuleId_1.RuleId.WerehyenaEffect] = WerehyenaEffectRule_1.WerehyenaEffectRule,
134
140
  _a[RuleId_1.RuleId.WerehyenaCallEffect] = WerehyenaEffectRule_1.WerehyenaCallEffectRule,
135
141
  _a[RuleId_1.RuleId.IdloziEffect] = IdloziEffectRule_1.IdloziEffectRule,
142
+ _a[RuleId_1.RuleId.FairyEffect] = FairyEffectRule_1.FairyEffectRule,
143
+ _a[RuleId_1.RuleId.LeprechaunEffect] = LeprechaunEffectRule_1.LeprechaunEffectRule,
144
+ _a[RuleId_1.RuleId.SelkieEffect] = SelkieEffectRule_1.SelkieEffectRule,
145
+ _a[RuleId_1.RuleId.DullahanEffect] = DullahanEffectRule_1.DullahanEffectRule,
136
146
  _a);
137
147
  _this.locationsStrategies = (_b = {},
138
148
  _b[MaterialType_1.MaterialType.EntityCard] = (_c = {},
@@ -58,7 +58,7 @@ var MythologiesSetup = (function (_super) {
58
58
  return mythologies;
59
59
  }
60
60
  else if (mythologies.length < 4) {
61
- return mythologies.concat((0, lodash_1.sampleSize)((0, lodash_1.difference)(Mythology_1.availableMythologies, mythologies), 4 - mythologies.length));
61
+ return mythologies.concat((0, lodash_1.sampleSize)((0, lodash_1.difference)((0, rules_api_1.getEnumValues)(Mythology_1.Mythology), mythologies), 4 - mythologies.length));
62
62
  }
63
63
  else {
64
64
  return (0, lodash_1.sampleSize)(mythologies, 4);
@@ -1,3 +1,6 @@
1
+ import { MaterialItem } from '../../../../rules-api';
2
+ import { PlayerColor } from '../PlayerColor';
3
+ import { LocationType } from './LocationType';
1
4
  import { Mythology } from './Mythology';
2
5
  export declare enum Entity {
3
6
  Zeus = 1,
@@ -76,7 +79,7 @@ export declare enum Entity {
76
79
  Morrigan = 74,
77
80
  Kelpie = 75,
78
81
  Banshee = 76,
79
- Dryad = 77,
82
+ Fairy = 77,
80
83
  Leprechaun = 78,
81
84
  Selkie = 79,
82
85
  Dullahan = 80
@@ -92,6 +95,7 @@ export type EntityId = {
92
95
  entityType: EntityType;
93
96
  };
94
97
  };
98
+ export type EntityItem = MaterialItem<PlayerColor, LocationType, EntityId>;
95
99
  export declare const getEntityType: (entity: Entity) => EntityType;
96
100
  export declare const isGod: (entity?: Entity) => boolean;
97
101
  export declare const isCreature: (entity?: Entity) => boolean;
@@ -79,7 +79,7 @@ var Entity;
79
79
  Entity[Entity["Morrigan"] = 74] = "Morrigan";
80
80
  Entity[Entity["Kelpie"] = 75] = "Kelpie";
81
81
  Entity[Entity["Banshee"] = 76] = "Banshee";
82
- Entity[Entity["Dryad"] = 77] = "Dryad";
82
+ Entity[Entity["Fairy"] = 77] = "Fairy";
83
83
  Entity[Entity["Leprechaun"] = 78] = "Leprechaun";
84
84
  Entity[Entity["Selkie"] = 79] = "Selkie";
85
85
  Entity[Entity["Dullahan"] = 80] = "Dullahan";
@@ -8,7 +8,6 @@ export declare enum Mythology {
8
8
  Zulu = 6,
9
9
  Celtic = 7
10
10
  }
11
- export declare const availableMythologies: Mythology[];
12
11
  export declare enum SanctuarySide {
13
12
  Left = 0,
14
13
  Right = 1
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SanctuarySide = exports.availableMythologies = exports.Mythology = void 0;
4
- var rules_api_1 = require("@gamepark/rules-api");
3
+ exports.SanctuarySide = exports.Mythology = void 0;
5
4
  var Mythology;
6
5
  (function (Mythology) {
7
6
  Mythology[Mythology["Greek"] = 0] = "Greek";
@@ -13,7 +12,6 @@ var Mythology;
13
12
  Mythology[Mythology["Zulu"] = 6] = "Zulu";
14
13
  Mythology[Mythology["Celtic"] = 7] = "Celtic";
15
14
  })(Mythology = exports.Mythology || (exports.Mythology = {}));
16
- exports.availableMythologies = (0, rules_api_1.getEnumValues)(Mythology).filter(function (mythology) { return mythology < 7; });
17
15
  var SanctuarySide;
18
16
  (function (SanctuarySide) {
19
17
  SanctuarySide[SanctuarySide["Left"] = 0] = "Left";
@@ -1,6 +1,7 @@
1
1
  import { Material, MaterialGame, MaterialItem, MaterialMove, MaterialRulesPart, MoveItem, XYCoordinates } from '@gamepark/rules-api';
2
2
  import { PlayerColor } from '../PlayerColor';
3
- import { Entity } from './Entity';
3
+ import { Entity, EntityItem } from './Entity';
4
+ import { TriggerEvent } from './entity/Effect';
4
5
  export declare class Pantheon extends MaterialRulesPart {
5
6
  private player;
6
7
  constructor(game: MaterialGame, player: PlayerColor);
@@ -11,7 +12,7 @@ export declare class Pantheon extends MaterialRulesPart {
11
12
  private get indexGrid();
12
13
  get legalSpacesToInvoke(): XYCoordinates[];
13
14
  isLegalSpaceToInvoke(space: XYCoordinates): boolean;
14
- getOpponentsWithTrollAt({ x, y }: XYCoordinates): PlayerColor[];
15
+ getFavorTax(space: XYCoordinates): number;
15
16
  get legalSpaces(): XYCoordinates[];
16
17
  isLegalSpace({ x, y }: XYCoordinates, grid?: (Entity | undefined)[][]): boolean;
17
18
  isFreeSpace({ x, y }: XYCoordinates): boolean;
@@ -24,9 +25,10 @@ export declare class Pantheon extends MaterialRulesPart {
24
25
  loseFavor(quantity?: number): import("@gamepark/rules-api").DeleteItem<number>;
25
26
  onCardPlaced(move: MoveItem): MaterialMove<number, number, number, number>[];
26
27
  get isInvoke(): boolean;
27
- updateGrid(gridAfter?: (number | null)[][]): MaterialMove<number, number, number, number>[];
28
+ updateGrid(gridAfter?: (number | null)[][]): TriggerEvent[];
28
29
  private getEntitiesMoved;
29
- private gainBonus;
30
+ private getEntitiesCrushed;
31
+ gainBonus(grid?: (number | null)[][]): MaterialMove<number, number, number, number>[];
30
32
  gainLineBonus(y: number): MoveItem<number, number, number>[];
31
33
  gainColumnBonus(x: number): MoveItem<number, number, number>[];
32
34
  getBonusGem(y: number): Material<number, number, number>;
@@ -35,9 +37,12 @@ export declare class Pantheon extends MaterialRulesPart {
35
37
  getInvokeGains(entity: Entity, line: number): MaterialMove<number, number, number, number>[];
36
38
  hasEntity(entity: Entity): boolean;
37
39
  getPiles(predicate?: (space: XYCoordinates) => boolean): Material[];
38
- isAbleToMove(entity: MaterialItem): boolean;
40
+ isAbleToMove(entity: EntityItem): boolean;
39
41
  get mythologies(): import("./Mythology").Mythology[];
40
42
  get missingMythologies(): import("./Mythology").Mythology[];
41
- onEntitySacrificed(card: Material): MaterialMove<number, number, number, number>[];
43
+ onEntitySacrificed(card: Material): void;
42
44
  hasCrushed(card: MaterialItem): boolean;
45
+ isOpponentOngoingEffect(): boolean;
46
+ replaceSacrifice(cards: EntityItem[]): Material<number, number, number>;
47
+ sacrificeToPreventMove(): MoveItem<number, number, number>[];
43
48
  }
@@ -56,6 +56,7 @@ var rules_api_1 = require("@gamepark/rules-api");
56
56
  var lodash_1 = require("lodash");
57
57
  var Memory_1 = require("../Memory");
58
58
  var MythologiesRules_1 = require("../MythologiesRules");
59
+ var PermanentEffectsRule_1 = require("../rules/effects/PermanentEffectsRule");
59
60
  var TriggerEffectsRule_1 = require("../rules/effects/TriggerEffectsRule");
60
61
  var Entity_1 = require("./Entity");
61
62
  var Effect_1 = require("./entity/Effect");
@@ -128,16 +129,14 @@ var Pantheon = (function (_super) {
128
129
  configurable: true
129
130
  });
130
131
  Pantheon.prototype.isLegalSpaceToInvoke = function (space) {
131
- var trollOpponents = this.getOpponentsWithTrollAt(space);
132
- return !trollOpponents.length || this.favor >= trollOpponents.length;
133
- };
134
- Pantheon.prototype.getOpponentsWithTrollAt = function (_a) {
135
132
  var _this = this;
136
- var x = _a.x, y = _a.y;
137
- return this.game.players.filter(function (player) {
138
- if (player === _this.player)
139
- return false;
140
- return new Pantheon(_this.game, player).grid[y][x] === Entity_1.Entity.Troll;
133
+ var opponents = this.game.players.filter(function (player) { return player !== _this.player; });
134
+ var favorTax = (0, lodash_1.sumBy)(opponents, function (opponent) { return new Pantheon(_this.game, opponent).getFavorTax(space); });
135
+ return this.favor >= favorTax;
136
+ };
137
+ Pantheon.prototype.getFavorTax = function (space) {
138
+ return (0, lodash_1.sumBy)(this.visibleEntities.getItems(), function (card) {
139
+ return (0, lodash_1.sumBy)((0, EntityDescription_1.getEffects)(card.id.front), function (effect) { var _a, _b, _c; return (_c = (_b = (_a = effect).favorTax) === null || _b === void 0 ? void 0 : _b.call(_a, space, card)) !== null && _c !== void 0 ? _c : 0; });
141
140
  });
142
141
  };
143
142
  Object.defineProperty(Pantheon.prototype, "legalSpaces", {
@@ -154,7 +153,8 @@ var Pantheon = (function (_super) {
154
153
  Pantheon.prototype.isLegalSpace = function (_a, grid) {
155
154
  var x = _a.x, y = _a.y;
156
155
  if (grid === void 0) { grid = this.grid; }
157
- return !(0, Entity_1.isGod)(grid[y][x]) && grid[y][x] !== Entity_1.Entity.Tokoloshe;
156
+ var card = this.visibleEntities.location(function (l) { return l.x === x && l.y === y; }).getItem();
157
+ return !card || (!(0, Entity_1.isGod)(grid[y][x]) && new PermanentEffectsRule_1.PermanentEffectsRule(this.game).canCrush(card));
158
158
  };
159
159
  Pantheon.prototype.isFreeSpace = function (_a) {
160
160
  var x = _a.x, y = _a.y;
@@ -206,21 +206,14 @@ var Pantheon = (function (_super) {
206
206
  }
207
207
  var grid = this.indexGrid;
208
208
  grid[move.location.y][move.location.x] = move.itemIndex;
209
- moves.push.apply(moves, __spreadArray([], __read(this.updateGrid(grid)), false));
209
+ moves.push.apply(moves, __spreadArray([], __read(this.gainBonus(grid)), false));
210
210
  var triggerEffectsRule = new TriggerEffectsRule_1.TriggerEffectsRule(this.game);
211
- var crushed = this.allCards.location(function (l) { return l.x === move.location.x && l.y === move.location.y; }).maxBy(function (item) { return item.location.z; });
212
211
  triggerEffectsRule.triggerCardEffect(card, { type: Effect_1.TriggerEventType.SelfPlaced, location: location });
213
- var invoke = this.isInvoke;
214
- if (invoke) {
212
+ var triggerEvents = this.updateGrid(grid);
213
+ if (this.isInvoke) {
215
214
  moves.push.apply(moves, __spreadArray([], __read(this.onInvoke(move)), false));
216
- }
217
- var triggerEvents = [];
218
- if (invoke) {
219
215
  triggerEvents.push({ type: Effect_1.TriggerEventType.EntityInvoked, cardIndex: move.itemIndex, entity: entity, cardLocation: location });
220
216
  }
221
- if (crushed.length) {
222
- triggerEvents.push({ type: Effect_1.TriggerEventType.EntityCrushed, card: crushed.getItem(), cardIndex: crushed.getIndex() });
223
- }
224
217
  if (triggerEvents.length) {
225
218
  triggerEffectsRule.triggerEffects.apply(triggerEffectsRule, __spreadArray([], __read(triggerEvents), false));
226
219
  }
@@ -234,29 +227,45 @@ var Pantheon = (function (_super) {
234
227
  configurable: true
235
228
  });
236
229
  Pantheon.prototype.updateGrid = function (gridAfter) {
237
- var _a;
230
+ var e_1, _a;
231
+ var _b;
238
232
  if (gridAfter === void 0) { gridAfter = this.indexGrid; }
239
- var gridBefore = (_a = this.remind(Memory_1.Memory.PlayerGrid, this.player)) !== null && _a !== void 0 ? _a : this.indexGrid;
233
+ var gridBefore = (_b = this.remind(Memory_1.Memory.PlayerGrid, this.player)) !== null && _b !== void 0 ? _b : this.indexGrid;
240
234
  this.memorize(Memory_1.Memory.PlayerGrid, gridAfter, this.player);
241
- var entities = this.getEntitiesMoved(gridBefore, gridAfter);
242
- if (entities.length) {
243
- new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.EntitiesMoved, player: this.player, entities: entities });
235
+ var triggerEvents = [];
236
+ var entitiesMoved = this.getEntitiesMoved(gridBefore, gridAfter);
237
+ if (entitiesMoved.length) {
238
+ triggerEvents.push({ type: Effect_1.TriggerEventType.EntitiesMoved, player: this.player, entities: entitiesMoved });
239
+ }
240
+ var entitiesCrushed = this.getEntitiesCrushed(gridBefore, gridAfter);
241
+ try {
242
+ for (var entitiesCrushed_1 = __values(entitiesCrushed), entitiesCrushed_1_1 = entitiesCrushed_1.next(); !entitiesCrushed_1_1.done; entitiesCrushed_1_1 = entitiesCrushed_1.next()) {
243
+ var cardIndex = entitiesCrushed_1_1.value;
244
+ triggerEvents.push({ type: Effect_1.TriggerEventType.EntityCrushed, card: this.material(MaterialType_1.MaterialType.EntityCard).getItem(cardIndex), cardIndex: cardIndex });
245
+ }
246
+ }
247
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
248
+ finally {
249
+ try {
250
+ if (entitiesCrushed_1_1 && !entitiesCrushed_1_1.done && (_a = entitiesCrushed_1.return)) _a.call(entitiesCrushed_1);
251
+ }
252
+ finally { if (e_1) throw e_1.error; }
244
253
  }
245
254
  for (var y = 0; y < 3; y++) {
246
255
  if (gridBefore[y].some(function (item) { return item === null; }) && gridAfter[y].every(function (item) { return item !== null; })) {
247
- new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.LineEvent, eventType: Effect_1.LineEventType.Completed, player: this.player, y: y });
256
+ triggerEvents.push({ type: Effect_1.TriggerEventType.LineEvent, eventType: Effect_1.LineEventType.Completed, player: this.player, y: y });
248
257
  }
249
258
  }
250
259
  var _loop_1 = function (x) {
251
260
  if (gridBefore.some(function (line) { return line[x] === null; }) && gridAfter.every(function (line) { return line[x] !== null; })) {
252
- new TriggerEffectsRule_1.TriggerEffectsRule(this_1.game).triggerEffects({ type: Effect_1.TriggerEventType.ColumnEvent, eventType: Effect_1.LineEventType.Completed, player: this_1.player, x: x });
261
+ triggerEvents.push({ type: Effect_1.TriggerEventType.ColumnEvent, eventType: Effect_1.LineEventType.Completed, player: this_1.player, x: x });
253
262
  }
254
263
  };
255
264
  var this_1 = this;
256
265
  for (var x = 0; x < 3; x++) {
257
266
  _loop_1(x);
258
267
  }
259
- return this.gainBonus(gridAfter);
268
+ return triggerEvents;
260
269
  };
261
270
  Pantheon.prototype.getEntitiesMoved = function (before, after) {
262
271
  var entities = [];
@@ -273,8 +282,25 @@ var Pantheon = (function (_super) {
273
282
  }
274
283
  return entities;
275
284
  };
285
+ Pantheon.prototype.getEntitiesCrushed = function (before, after) {
286
+ var entities = [];
287
+ var allCardsIndexes = this.allCards.getIndexes();
288
+ for (var y = 0; y < 3; y++) {
289
+ var _loop_3 = function (x) {
290
+ var cardIndex = before[y][x];
291
+ if (cardIndex !== null && !after.some(function (line) { return line.includes(cardIndex); }) && allCardsIndexes.includes(cardIndex)) {
292
+ entities.push(cardIndex);
293
+ }
294
+ };
295
+ for (var x = 0; x < 3; x++) {
296
+ _loop_3(x);
297
+ }
298
+ }
299
+ return entities;
300
+ };
276
301
  Pantheon.prototype.gainBonus = function (grid) {
277
- var e_1, _a, e_2, _b;
302
+ var e_2, _a, e_3, _b;
303
+ if (grid === void 0) { grid = this.indexGrid; }
278
304
  var moves = [];
279
305
  var fullLines = (0, lodash_1.range)(0, 3).filter(function (y) { return !grid[y].includes(null); });
280
306
  try {
@@ -283,12 +309,12 @@ var Pantheon = (function (_super) {
283
309
  moves.push.apply(moves, __spreadArray([], __read(this.gainLineBonus(y)), false));
284
310
  }
285
311
  }
286
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
312
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
287
313
  finally {
288
314
  try {
289
315
  if (fullLines_1_1 && !fullLines_1_1.done && (_a = fullLines_1.return)) _a.call(fullLines_1);
290
316
  }
291
- finally { if (e_1) throw e_1.error; }
317
+ finally { if (e_2) throw e_2.error; }
292
318
  }
293
319
  var fullColumns = (0, lodash_1.range)(0, 3).filter(function (x) { return grid.every(function (line) { return line[x] !== null; }); });
294
320
  try {
@@ -297,12 +323,12 @@ var Pantheon = (function (_super) {
297
323
  moves.push.apply(moves, __spreadArray([], __read(this.gainColumnBonus(x)), false));
298
324
  }
299
325
  }
300
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
326
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
301
327
  finally {
302
328
  try {
303
329
  if (fullColumns_1_1 && !fullColumns_1_1.done && (_b = fullColumns_1.return)) _b.call(fullColumns_1);
304
330
  }
305
- finally { if (e_2) throw e_2.error; }
331
+ finally { if (e_3) throw e_3.error; }
306
332
  }
307
333
  return moves;
308
334
  };
@@ -327,26 +353,30 @@ var Pantheon = (function (_super) {
327
353
  .location(function (l) { return l.x === x; });
328
354
  };
329
355
  Pantheon.prototype.onInvoke = function (move) {
330
- var e_3, _a;
356
+ var e_4, _a;
331
357
  var moves = [];
332
358
  var card = this.material(MaterialType_1.MaterialType.EntityCard).index(move.itemIndex).getItem();
333
359
  var entity = card.id.front;
334
360
  if (!entity)
335
361
  return [];
336
- var trollOpponents = this.getOpponentsWithTrollAt(move.location);
337
362
  var favor = this.material(MaterialType_1.MaterialType.FavorToken).location(LocationType_1.LocationType.PlayerFavor).player(this.player);
338
363
  try {
339
- for (var trollOpponents_1 = __values(trollOpponents), trollOpponents_1_1 = trollOpponents_1.next(); !trollOpponents_1_1.done; trollOpponents_1_1 = trollOpponents_1.next()) {
340
- var trollOpponent = trollOpponents_1_1.value;
341
- moves.push(favor.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: trollOpponent }));
364
+ for (var _b = __values(this.game.players), _c = _b.next(); !_c.done; _c = _b.next()) {
365
+ var player = _c.value;
366
+ if (player !== this.player) {
367
+ var favorTax = new Pantheon(this.game, player).getFavorTax(move.location);
368
+ if (favorTax > 0) {
369
+ moves.push(favor.moveItem({ type: LocationType_1.LocationType.PlayerFavor, player: player }, favorTax));
370
+ }
371
+ }
342
372
  }
343
373
  }
344
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
374
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
345
375
  finally {
346
376
  try {
347
- if (trollOpponents_1_1 && !trollOpponents_1_1.done && (_a = trollOpponents_1.return)) _a.call(trollOpponents_1);
377
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
348
378
  }
349
- finally { if (e_3) throw e_3.error; }
379
+ finally { if (e_4) throw e_4.error; }
350
380
  }
351
381
  moves.push.apply(moves, __spreadArray([], __read(this.getInvokeGains(entity, move.location.y)), false));
352
382
  return moves;
@@ -370,8 +400,8 @@ var Pantheon = (function (_super) {
370
400
  var piles = [];
371
401
  var myEntities = this.material(MaterialType_1.MaterialType.EntityCard).player(this.player);
372
402
  var fullPantheon = myEntities.location(LocationType_1.LocationType.Pantheon);
373
- var _loop_3 = function (x) {
374
- var _loop_4 = function (y) {
403
+ var _loop_4 = function (x) {
404
+ var _loop_5 = function (y) {
375
405
  if (predicate({ x: x, y: y })) {
376
406
  var pile = fullPantheon.location(function (l) { return l.x === x && l.y === y; }).sort(function (item) { return item.location.z; });
377
407
  if (pile.length > 0) {
@@ -380,16 +410,16 @@ var Pantheon = (function (_super) {
380
410
  }
381
411
  };
382
412
  for (var y = 0; y < 3; y++) {
383
- _loop_4(y);
413
+ _loop_5(y);
384
414
  }
385
415
  };
386
416
  for (var x = 0; x < 3; x++) {
387
- _loop_3(x);
417
+ _loop_4(x);
388
418
  }
389
419
  return piles;
390
420
  };
391
421
  Pantheon.prototype.isAbleToMove = function (entity) {
392
- return !this.visibleEntities.getItems().some(function (item) { return item.id.front === Entity_1.Entity.Naga && (0, rules_api_1.areAdjacentSquares)(item.location, entity.location); });
422
+ return new PermanentEffectsRule_1.PermanentEffectsRule(this.game).canMove(entity);
393
423
  };
394
424
  Object.defineProperty(Pantheon.prototype, "mythologies", {
395
425
  get: function () {
@@ -409,12 +439,31 @@ var Pantheon = (function (_super) {
409
439
  configurable: true
410
440
  });
411
441
  Pantheon.prototype.onEntitySacrificed = function (card) {
412
- new TriggerEffectsRule_1.TriggerEffectsRule(this.game).triggerEffects({ type: Effect_1.TriggerEventType.EntitySacrificed, card: card.getItem(), cardIndex: card.getIndex() });
413
- return this.updateGrid();
442
+ var _a;
443
+ var effects = this.updateGrid();
444
+ effects.push({ type: Effect_1.TriggerEventType.EntitySacrificed, card: card.getItem(), cardIndex: card.getIndex() });
445
+ (_a = new TriggerEffectsRule_1.TriggerEffectsRule(this.game)).triggerEffects.apply(_a, __spreadArray([], __read(effects), false));
414
446
  };
415
447
  Pantheon.prototype.hasCrushed = function (card) {
416
448
  return this.allCards.location(function (l) { return l.x === card.location.x && l.y === card.location.y && l.z < card.location.z; }).length > 0;
417
449
  };
450
+ Pantheon.prototype.isOpponentOngoingEffect = function () {
451
+ var ongoingEffect = this.remind(Memory_1.Memory.OngoingEffect);
452
+ if (!ongoingEffect)
453
+ return false;
454
+ var effectOwner = this.material(MaterialType_1.MaterialType.EntityCard).getItem(ongoingEffect.cardIndex).location.player;
455
+ return this.player !== effectOwner;
456
+ };
457
+ Pantheon.prototype.replaceSacrifice = function (cards) {
458
+ return this.visibleEntities.filter(function (item) {
459
+ return (0, EntityDescription_1.getEffects)(item.id.front).some(function (effect) { return !(0, Effect_1.isTriggeredEffect)(effect) && cards.some(function (card) { var _a; return (_a = effect.replaceSacrifice) === null || _a === void 0 ? void 0 : _a.call(effect, card, item); }); });
460
+ });
461
+ };
462
+ Pantheon.prototype.sacrificeToPreventMove = function () {
463
+ return this.visibleEntities
464
+ .filter(function (item) { return (0, EntityDescription_1.getEffects)(item.id.front).some(function (effect) { return !(0, Effect_1.isTriggeredEffect)(effect) && effect.sacrificeInsteadOfMove; }); })
465
+ .moveItems({ type: LocationType_1.LocationType.PlayerDiscard, player: this.player });
466
+ };
418
467
  return Pantheon;
419
468
  }(rules_api_1.MaterialRulesPart));
420
469
  exports.Pantheon = Pantheon;