@firestone-hs/simulate-bgs-battle 1.1.467 → 1.1.468

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 (76) hide show
  1. package/dist/bgs-player-entity.d.ts +12 -1
  2. package/dist/bgs-player-entity.js.map +1 -1
  3. package/dist/cards/cards-data.d.ts +0 -1
  4. package/dist/cards/cards-data.js +18 -50
  5. package/dist/cards/cards-data.js.map +1 -1
  6. package/dist/divine-shield.d.ts +6 -0
  7. package/dist/divine-shield.js +100 -0
  8. package/dist/divine-shield.js.map +1 -0
  9. package/dist/input-sanitation.js +3 -2
  10. package/dist/input-sanitation.js.map +1 -1
  11. package/dist/simulate-bgs-battle.js +3 -0
  12. package/dist/simulate-bgs-battle.js.map +1 -1
  13. package/dist/simulation/add-minion-to-board.d.ts +2 -5
  14. package/dist/simulation/add-minion-to-board.js +172 -45
  15. package/dist/simulation/add-minion-to-board.js.map +1 -1
  16. package/dist/simulation/attack.js +25 -59
  17. package/dist/simulation/attack.js.map +1 -1
  18. package/dist/simulation/auras.d.ts +2 -0
  19. package/dist/simulation/auras.js +60 -23
  20. package/dist/simulation/auras.js.map +1 -1
  21. package/dist/simulation/avenge.js +36 -7
  22. package/dist/simulation/avenge.js.map +1 -1
  23. package/dist/simulation/battlecries.js +53 -12
  24. package/dist/simulation/battlecries.js.map +1 -1
  25. package/dist/simulation/blood-gems.d.ts +2 -2
  26. package/dist/simulation/blood-gems.js +28 -5
  27. package/dist/simulation/blood-gems.js.map +1 -1
  28. package/dist/simulation/cards-in-hand.js +1 -1
  29. package/dist/simulation/cards-in-hand.js.map +1 -1
  30. package/dist/simulation/damage-effects.js +14 -2
  31. package/dist/simulation/damage-effects.js.map +1 -1
  32. package/dist/simulation/damage-to-hero.d.ts +4 -0
  33. package/dist/simulation/damage-to-hero.js +8 -0
  34. package/dist/simulation/damage-to-hero.js.map +1 -0
  35. package/dist/simulation/death-effects.js +15 -0
  36. package/dist/simulation/death-effects.js.map +1 -1
  37. package/dist/simulation/deathrattle-effects.js +58 -27
  38. package/dist/simulation/deathrattle-effects.js.map +1 -1
  39. package/dist/simulation/deathrattle-orchestration.js +3 -3
  40. package/dist/simulation/deathrattle-orchestration.js.map +1 -1
  41. package/dist/simulation/deathrattle-spawns.js +32 -5
  42. package/dist/simulation/deathrattle-spawns.js.map +1 -1
  43. package/dist/simulation/frenzy.js +2 -2
  44. package/dist/simulation/frenzy.js.map +1 -1
  45. package/dist/simulation/minion-death.d.ts +1 -1
  46. package/dist/simulation/minion-death.js +47 -9
  47. package/dist/simulation/minion-death.js.map +1 -1
  48. package/dist/simulation/on-attack.js +11 -4
  49. package/dist/simulation/on-attack.js.map +1 -1
  50. package/dist/simulation/on-being-attacked.js +3 -2
  51. package/dist/simulation/on-being-attacked.js.map +1 -1
  52. package/dist/simulation/reborn.js +9 -0
  53. package/dist/simulation/reborn.js.map +1 -1
  54. package/dist/simulation/remove-minion-from-board.d.ts +2 -1
  55. package/dist/simulation/remove-minion-from-board.js +9 -7
  56. package/dist/simulation/remove-minion-from-board.js.map +1 -1
  57. package/dist/simulation/spawn-fail.d.ts +4 -0
  58. package/dist/simulation/spawn-fail.js +28 -0
  59. package/dist/simulation/spawn-fail.js.map +1 -0
  60. package/dist/simulation/spawns.js +2 -4
  61. package/dist/simulation/spawns.js.map +1 -1
  62. package/dist/simulation/spectator/spectator.d.ts +2 -2
  63. package/dist/simulation/spectator/spectator.js.map +1 -1
  64. package/dist/simulation/start-of-combat.js +248 -39
  65. package/dist/simulation/start-of-combat.js.map +1 -1
  66. package/dist/simulation/stats.js +2 -2
  67. package/dist/simulation/stats.js.map +1 -1
  68. package/dist/simulation/summon-when-space.js +39 -0
  69. package/dist/simulation/summon-when-space.js.map +1 -1
  70. package/dist/simulation/utils/golden.d.ts +1 -1
  71. package/dist/simulation/utils/golden.js +2 -2
  72. package/dist/simulation/utils/golden.js.map +1 -1
  73. package/dist/utils.d.ts +7 -8
  74. package/dist/utils.js +71 -52
  75. package/dist/utils.js.map +1 -1
  76. package/package.json +1 -1
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onMinionSummoned = exports.removeAurasFromSelf = exports.applyAurasToSelf = exports.handleAddedMinionAuraEffect = exports.addMinionToBoard = exports.addMinionsToBoard = void 0;
4
4
  const reference_data_1 = require("@firestone-hs/reference-data");
5
5
  const cards_data_1 = require("../cards/cards-data");
6
- const utils_1 = require("../utils");
6
+ const divine_shield_1 = require("../divine-shield");
7
+ const utils_1 = require("../services/utils");
8
+ const utils_2 = require("../utils");
9
+ const auras_1 = require("./auras");
7
10
  const quest_1 = require("./quest");
8
11
  const stats_1 = require("./stats");
9
12
  const addMinionsToBoard = (board, boardHero, otherHero, index, minionsToAdd, gameState) => {
@@ -15,7 +18,7 @@ const addMinionsToBoard = (board, boardHero, otherHero, index, minionsToAdd, gam
15
18
  exports.addMinionsToBoard = addMinionsToBoard;
16
19
  const addMinionToBoard = (board, boardHero, otherHero, index, minionToAdd, gameState, performAfterSpawnEffects = true) => {
17
20
  board.splice(index, 0, minionToAdd);
18
- (0, exports.handleAddedMinionAuraEffect)(board, boardHero, minionToAdd, gameState);
21
+ (0, exports.handleAddedMinionAuraEffect)(board, boardHero, otherHero, minionToAdd, gameState);
19
22
  (0, exports.onMinionSummoned)(boardHero, board, gameState);
20
23
  handleSpawnEffect(board, boardHero, otherHero, minionToAdd, gameState);
21
24
  if (performAfterSpawnEffects) {
@@ -49,9 +52,9 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
49
52
  }
50
53
  break;
51
54
  case "GVG_062":
52
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MECH, gameState.allCards)) {
55
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MECH, gameState.allCards)) {
53
56
  if (!entity.divineShield) {
54
- (0, utils_1.updateDivineShield)(entity, board, true, gameState.allCards);
57
+ (0, divine_shield_1.updateDivineShield)(entity, board, boardHero, otherHero, true, gameState);
55
58
  }
56
59
  (0, stats_1.modifyStats)(entity, 2, 0, board, boardHero, gameState);
57
60
  gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
@@ -59,10 +62,10 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
59
62
  break;
60
63
  case "BGS_071":
61
64
  case "TB_BaconUps_123":
62
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MECH, gameState.allCards)) {
65
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MECH, gameState.allCards)) {
63
66
  const statsBonus = entity.cardId === "TB_BaconUps_123" ? 4 : 2;
64
67
  if (!entity.divineShield) {
65
- (0, utils_1.updateDivineShield)(entity, board, true, gameState.allCards);
68
+ (0, divine_shield_1.updateDivineShield)(entity, board, boardHero, otherHero, true, gameState);
66
69
  }
67
70
  (0, stats_1.modifyStats)(entity, statsBonus, 0, board, boardHero, gameState);
68
71
  gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
@@ -70,7 +73,7 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
70
73
  break;
71
74
  case "BGS_204":
72
75
  case "TB_BaconUps_304":
73
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.DEMON, gameState.allCards)) {
76
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.DEMON, gameState.allCards)) {
74
77
  const statsBonus = entity.cardId === "TB_BaconUps_304" ? 2 : 1;
75
78
  (0, stats_1.modifyStats)(entity, statsBonus, statsBonus, board, boardHero, gameState);
76
79
  gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
@@ -78,7 +81,7 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
78
81
  break;
79
82
  case "BGS_021":
80
83
  case "TB_BaconUps_090":
81
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, gameState.allCards)) {
84
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.allCards)) {
82
85
  const statsBonus = entity.cardId === "TB_BaconUps_090" ? 8 : 4;
83
86
  (0, stats_1.modifyStats)(spawned, statsBonus, statsBonus, board, boardHero, gameState);
84
87
  gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
@@ -86,16 +89,22 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
86
89
  break;
87
90
  case "BGS_017":
88
91
  case "TB_BaconUps_086":
89
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, gameState.allCards)) {
92
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.allCards)) {
90
93
  const statsBonus = entity.cardId === "TB_BaconUps_086" ? 4 : 2;
91
94
  (0, stats_1.modifyStats)(spawned, statsBonus, 0, board, boardHero, gameState);
92
95
  gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
93
96
  }
94
97
  break;
98
+ case "BG30_124":
99
+ case "BG30_124_G":
100
+ const abomStatsBonus = entity.cardId === "BG30_124_G" ? 4 : 2;
101
+ (0, stats_1.modifyStats)(spawned, abomStatsBonus, abomStatsBonus, board, boardHero, gameState);
102
+ gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
103
+ break;
95
104
  }
96
105
  }
97
106
  };
98
- const handleAddedMinionAuraEffect = (board, boardHero, spawned, gameState) => {
107
+ const handleAddedMinionAuraEffect = (board, boardHero, otherHero, spawned, gameState) => {
99
108
  var _a, _b, _c, _d;
100
109
  switch (boardHero.heroPowerId) {
101
110
  case "TB_BaconShop_HP_107":
@@ -106,7 +115,7 @@ const handleAddedMinionAuraEffect = (board, boardHero, spawned, gameState) => {
106
115
  (0, stats_1.modifyStats)(spawned, 2, 2, board, boardHero, gameState);
107
116
  break;
108
117
  case "TB_BaconShop_HP_015":
109
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MECH, gameState.allCards)) {
118
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MECH, gameState.allCards)) {
110
119
  (0, stats_1.modifyStats)(spawned, 2, 0, board, boardHero, gameState);
111
120
  }
112
121
  break;
@@ -115,15 +124,39 @@ const handleAddedMinionAuraEffect = (board, boardHero, spawned, gameState) => {
115
124
  const tumblingDisasterBonus = ((_c = (_b = boardHero.questRewardEntities) === null || _b === void 0 ? void 0 : _b.find((e) => e.cardId === "BG28_Reward_505")) === null || _c === void 0 ? void 0 : _c.scriptDataNum1) || 1;
116
125
  (0, stats_1.modifyStats)(spawned, tumblingDisasterBonus, tumblingDisasterBonus, board, boardHero, gameState);
117
126
  }
127
+ for (const trinket of boardHero.trinkets) {
128
+ switch (trinket.cardId) {
129
+ case "BG30_MagicItem_978":
130
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MECH, gameState.allCards)) {
131
+ const target = (0, utils_1.pickRandom)(board.filter((e) => !e.divineShield));
132
+ if (!!target) {
133
+ (0, divine_shield_1.updateDivineShield)(target, board, boardHero, otherHero, true, gameState);
134
+ }
135
+ }
136
+ break;
137
+ case "BG30_MagicItem_822":
138
+ case "BG30_MagicItem_822t2":
139
+ if (!trinket.rememberedMinion) {
140
+ trinket.rememberedMinion = (0, utils_2.copyEntity)(spawned);
141
+ }
142
+ break;
143
+ case "BG30_MagicItem_886":
144
+ if (trinket.scriptDataNum1 > 0 && !spawned.divineShield) {
145
+ (0, divine_shield_1.updateDivineShield)(spawned, board, boardHero, otherHero, true, gameState);
146
+ trinket.scriptDataNum1--;
147
+ }
148
+ break;
149
+ }
150
+ }
118
151
  (0, exports.applyAurasToSelf)(spawned, board, boardHero, gameState);
119
152
  const cardIds = [spawned.cardId, ...((_d = spawned.additionalCards) !== null && _d !== void 0 ? _d : [])];
120
153
  for (const spawnedCardId of cardIds) {
121
- handleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, gameState.allCards, gameState.spectator, gameState.sharedState);
154
+ handleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, gameState);
122
155
  }
123
156
  };
124
157
  exports.handleAddedMinionAuraEffect = handleAddedMinionAuraEffect;
125
158
  const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
126
- var _a;
159
+ var _a, _b;
127
160
  if (!!((_a = boardHero.questRewards) === null || _a === void 0 ? void 0 : _a.length)) {
128
161
  for (const quest of boardHero.questRewards) {
129
162
  switch (quest) {
@@ -142,12 +175,37 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
142
175
  }
143
176
  }
144
177
  }
145
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.UNDEAD, gameState.allCards)) {
178
+ if (!!((_b = boardHero.trinkets) === null || _b === void 0 ? void 0 : _b.length)) {
179
+ for (const trinket of boardHero.trinkets) {
180
+ switch (trinket.cardId) {
181
+ case "BG30_MagicItem_880":
182
+ spawned.attack += 2;
183
+ spawned.health += 1;
184
+ break;
185
+ case "BG30_MagicItem_880t":
186
+ spawned.attack += 5;
187
+ spawned.health += 3;
188
+ break;
189
+ case "BG30_MagicItem_843t":
190
+ if (gameState.cardsData.getTavernLevel(spawned.cardId) <= 3) {
191
+ spawned.attack += 6;
192
+ spawned.health += 4;
193
+ }
194
+ break;
195
+ }
196
+ }
197
+ }
198
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.UNDEAD, gameState.allCards)) {
146
199
  if (boardHero.globalInfo.UndeadAttackBonus > 0) {
147
200
  (0, stats_1.modifyStats)(spawned, boardHero.globalInfo.UndeadAttackBonus, 0, board, boardHero, gameState);
148
201
  }
149
202
  }
150
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, gameState.allCards)) {
203
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.PIRATE, gameState.allCards)) {
204
+ if (boardHero.globalInfo.PirateAttackBonus > 0) {
205
+ (0, stats_1.modifyStats)(spawned, boardHero.globalInfo.PirateAttackBonus, 0, board, boardHero, gameState);
206
+ }
207
+ }
208
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.allCards)) {
151
209
  if (boardHero.globalInfo.GoldrinnBuffAtk > 0) {
152
210
  (0, stats_1.modifyStats)(spawned, boardHero.globalInfo.GoldrinnBuffAtk, boardHero.globalInfo.GoldrinnBuffHealth, board, boardHero, gameState);
153
211
  gameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);
@@ -157,26 +215,30 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
157
215
  switch (entity.cardId) {
158
216
  case "BG_EX1_507":
159
217
  case "TB_BaconUps_008":
160
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MURLOC, gameState.allCards) && entity.entityId !== spawned.entityId) {
218
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MURLOC, gameState.allCards) &&
219
+ entity.entityId !== spawned.entityId) {
161
220
  spawned.attack += entity.cardId === "TB_BaconUps_008" ? 4 : 2;
162
221
  }
163
222
  break;
164
223
  case "BG26_805":
165
224
  case "BG26_805_G":
166
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, gameState.allCards) && entity.entityId !== spawned.entityId) {
225
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.allCards) &&
226
+ entity.entityId !== spawned.entityId) {
167
227
  spawned.attack += entity.cardId === "BG26_805_G" ? 4 : 2;
168
228
  }
169
229
  break;
170
230
  case "BG_NEW1_027":
171
231
  case "TB_BaconUps_136":
172
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.PIRATE, gameState.allCards) && entity.entityId !== spawned.entityId) {
232
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.PIRATE, gameState.allCards) &&
233
+ entity.entityId !== spawned.entityId) {
173
234
  spawned.attack += entity.cardId === "TB_BaconUps_136" ? 2 : 1;
174
235
  spawned.health += entity.cardId === "TB_BaconUps_136" ? 2 : 1;
175
236
  }
176
237
  break;
177
238
  case "BG21_039":
178
239
  case "BG21_039_G":
179
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.DEMON, gameState.allCards) && entity.entityId !== spawned.entityId) {
240
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.DEMON, gameState.allCards) &&
241
+ entity.entityId !== spawned.entityId) {
180
242
  spawned.attack += entity.cardId === "BG21_039_G" ? 2 : 1;
181
243
  }
182
244
  break;
@@ -188,7 +250,8 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
188
250
  break;
189
251
  case "BG27_030":
190
252
  case "BG27_030_G":
191
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.UNDEAD, gameState.allCards) && entity.entityId !== spawned.entityId) {
253
+ if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.UNDEAD, gameState.allCards) &&
254
+ entity.entityId !== spawned.entityId) {
192
255
  spawned.attack += (entity.cardId === "BG27_030_G" ? 2 : 1) * boardHero.tavernTier;
193
256
  }
194
257
  break;
@@ -213,6 +276,12 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
213
276
  const statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;
214
277
  (0, stats_1.modifyStats)(spawned, 2 * statsBonusFrostling, statsBonusFrostling, board, boardHero, gameState);
215
278
  break;
279
+ case "BG_TTN_401":
280
+ case "BG_TTN_401_G":
281
+ const multiplierAstral = spawned.cardId === "BG_TTN_401_G" ? 2 : 1;
282
+ const statsBonusAstral = multiplierAstral * boardHero.globalInfo.AstralAutomatonsSummonedThisGame;
283
+ (0, stats_1.modifyStats)(spawned, 3 * statsBonusAstral, 2 * statsBonusAstral, board, boardHero, gameState);
284
+ break;
216
285
  case "BG25_013":
217
286
  case "BG25_013_G":
218
287
  const multiplierGnoll = spawned.cardId === "BG25_013_G" ? 2 : 1;
@@ -222,8 +291,8 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
222
291
  }
223
292
  };
224
293
  exports.applyAurasToSelf = applyAurasToSelf;
225
- const removeAurasFromSelf = (entity, board, boardHero, allCards, sharedState, spectator) => {
226
- var _a, _b;
294
+ const removeAurasFromSelf = (entity, board, boardHero, gameState) => {
295
+ var _a, _b, _c;
227
296
  if (!!((_a = boardHero.questRewards) === null || _a === void 0 ? void 0 : _a.length)) {
228
297
  for (const quest of boardHero.questRewards) {
229
298
  switch (quest) {
@@ -238,12 +307,32 @@ const removeAurasFromSelf = (entity, board, boardHero, allCards, sharedState, sp
238
307
  }
239
308
  }
240
309
  }
241
- if ((0, utils_1.hasCorrectTribe)(entity, reference_data_1.Race.UNDEAD, allCards)) {
310
+ if (!!((_b = boardHero.trinkets) === null || _b === void 0 ? void 0 : _b.length)) {
311
+ for (const trinket of boardHero.trinkets) {
312
+ switch (trinket.cardId) {
313
+ case "BG30_MagicItem_880":
314
+ entity.attack = Math.max(0, entity.attack - 2);
315
+ entity.health = Math.max(1, entity.health - 1);
316
+ break;
317
+ case "BG30_MagicItem_880t":
318
+ entity.attack = Math.max(0, entity.attack - 5);
319
+ entity.health = Math.max(1, entity.health - 3);
320
+ break;
321
+ case "BG30_MagicItem_843t":
322
+ if (gameState.cardsData.getTavernLevel(entity.cardId) <= 3) {
323
+ entity.attack = Math.max(0, entity.attack - 6);
324
+ entity.health = Math.max(1, entity.health - 4);
325
+ }
326
+ break;
327
+ }
328
+ }
329
+ }
330
+ if ((0, utils_2.hasCorrectTribe)(entity, boardHero, reference_data_1.Race.UNDEAD, gameState.allCards)) {
242
331
  if (boardHero.globalInfo.UndeadAttackBonus > 0) {
243
332
  entity.attack = Math.max(0, entity.attack - boardHero.globalInfo.UndeadAttackBonus);
244
333
  }
245
334
  }
246
- if ((0, utils_1.hasCorrectTribe)(entity, reference_data_1.Race.BEAST, allCards)) {
335
+ if ((0, utils_2.hasCorrectTribe)(entity, boardHero, reference_data_1.Race.BEAST, gameState.allCards)) {
247
336
  if (boardHero.globalInfo.GoldrinnBuffAtk > 0) {
248
337
  entity.attack = Math.max(0, entity.attack - boardHero.globalInfo.GoldrinnBuffAtk);
249
338
  entity.health = Math.max(1, entity.health - boardHero.globalInfo.GoldrinnBuffHealth);
@@ -253,26 +342,30 @@ const removeAurasFromSelf = (entity, board, boardHero, allCards, sharedState, sp
253
342
  switch (boardEntity.cardId) {
254
343
  case "BG_EX1_507":
255
344
  case "TB_BaconUps_008":
256
- if ((0, utils_1.hasCorrectTribe)(entity, reference_data_1.Race.MURLOC, allCards) && entity.entityId !== boardEntity.entityId) {
345
+ if ((0, utils_2.hasCorrectTribe)(entity, boardHero, reference_data_1.Race.MURLOC, gameState.allCards) &&
346
+ entity.entityId !== boardEntity.entityId) {
257
347
  entity.attack = Math.max(0, entity.attack - (boardEntity.cardId === "TB_BaconUps_008" ? 4 : 2));
258
348
  }
259
349
  break;
260
350
  case "BG26_805":
261
351
  case "BG26_805_G":
262
- if ((0, utils_1.hasCorrectTribe)(entity, reference_data_1.Race.BEAST, allCards) && entity.entityId !== boardEntity.entityId) {
352
+ if ((0, utils_2.hasCorrectTribe)(entity, boardHero, reference_data_1.Race.BEAST, gameState.allCards) &&
353
+ entity.entityId !== boardEntity.entityId) {
263
354
  entity.attack = Math.max(0, entity.attack - (entity.cardId === "BG26_805_G" ? 4 : 2));
264
355
  }
265
356
  break;
266
357
  case "BG_NEW1_027":
267
358
  case "TB_BaconUps_136":
268
- if ((0, utils_1.hasCorrectTribe)(entity, reference_data_1.Race.PIRATE, allCards) && entity.entityId !== boardEntity.entityId) {
359
+ if ((0, utils_2.hasCorrectTribe)(entity, boardHero, reference_data_1.Race.PIRATE, gameState.allCards) &&
360
+ entity.entityId !== boardEntity.entityId) {
269
361
  entity.attack = Math.max(0, entity.attack - (boardEntity.cardId === "TB_BaconUps_136" ? 2 : 1));
270
362
  entity.health = Math.max(1, entity.health - (boardEntity.cardId === "TB_BaconUps_136" ? 2 : 1));
271
363
  }
272
364
  break;
273
365
  case "BG21_039":
274
366
  case "BG21_039_G":
275
- if ((0, utils_1.hasCorrectTribe)(entity, reference_data_1.Race.DEMON, allCards) && entity.entityId !== boardEntity.entityId) {
367
+ if ((0, utils_2.hasCorrectTribe)(entity, boardHero, reference_data_1.Race.DEMON, gameState.allCards) &&
368
+ entity.entityId !== boardEntity.entityId) {
276
369
  entity.attack = Math.max(0, entity.attack - (boardEntity.cardId === "BG21_039_G" ? 2 : 1));
277
370
  }
278
371
  break;
@@ -284,7 +377,8 @@ const removeAurasFromSelf = (entity, board, boardHero, allCards, sharedState, sp
284
377
  break;
285
378
  case "BG27_030":
286
379
  case "BG27_030_G":
287
- if ((0, utils_1.hasCorrectTribe)(entity, reference_data_1.Race.UNDEAD, allCards) && entity.entityId !== boardEntity.entityId) {
380
+ if ((0, utils_2.hasCorrectTribe)(entity, boardHero, reference_data_1.Race.UNDEAD, gameState.allCards) &&
381
+ entity.entityId !== boardEntity.entityId) {
288
382
  entity.attack = Math.max(0, entity.attack -
289
383
  (boardEntity.cardId === "BG27_030_G" ? 2 : 1) * boardHero.tavernTier);
290
384
  }
@@ -313,14 +407,21 @@ const removeAurasFromSelf = (entity, board, boardHero, allCards, sharedState, sp
313
407
  entity.attack = Math.max(0, entity.attack - statsBonusFrostling);
314
408
  entity.health = Math.max(1, entity.health - statsBonusFrostling);
315
409
  break;
410
+ case "BG_TTN_401":
411
+ case "BG_TTN_401_G":
412
+ const multiplierAstral = entity.cardId === "BG_TTN_401_G" ? 2 : 1;
413
+ const statsBonusAstral = multiplierAstral * boardHero.globalInfo.FrostlingBonus;
414
+ entity.attack = Math.max(0, entity.attack - statsBonusAstral);
415
+ entity.health = Math.max(1, entity.health - statsBonusAstral);
416
+ break;
316
417
  case "BG25_013":
317
418
  case "BG25_013_G":
318
419
  const multiplierGnoll = entity.cardId === "BG25_013_G" ? 2 : 1;
319
- const statsBonusGnoll = multiplierGnoll * sharedState.deaths.filter((e) => e.friendly === entity.friendly).length;
420
+ const statsBonusGnoll = multiplierGnoll * gameState.sharedState.deaths.filter((e) => e.friendly === entity.friendly).length;
320
421
  entity.attack = Math.max(0, entity.attack - statsBonusGnoll);
321
422
  break;
322
423
  }
323
- for (const enchantment of (_b = entity.enchantments) !== null && _b !== void 0 ? _b : []) {
424
+ for (const enchantment of (_c = entity.enchantments) !== null && _c !== void 0 ? _c : []) {
324
425
  switch (enchantment === null || enchantment === void 0 ? void 0 : enchantment.cardId) {
325
426
  case "TB_BaconShop_HP_085e":
326
427
  entity.attack = Math.max(0, entity.attack - enchantment.tagScriptDataNum1);
@@ -329,12 +430,12 @@ const removeAurasFromSelf = (entity, board, boardHero, allCards, sharedState, sp
329
430
  }
330
431
  };
331
432
  exports.removeAurasFromSelf = removeAurasFromSelf;
332
- const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState) => {
433
+ const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, gameState) => {
333
434
  switch (spawnedCardId) {
334
435
  case "BG_NEW1_027":
335
436
  case "TB_BaconUps_136":
336
437
  board
337
- .filter((e) => (0, utils_1.hasCorrectTribe)(e, reference_data_1.Race.PIRATE, allCards))
438
+ .filter((e) => (0, utils_2.hasCorrectTribe)(e, boardHero, reference_data_1.Race.PIRATE, gameState.allCards))
338
439
  .filter((e) => e.entityId !== spawned.entityId)
339
440
  .forEach((e) => {
340
441
  e.attack += spawned.cardId === "TB_BaconUps_136" ? 2 : 1;
@@ -344,7 +445,7 @@ const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, a
344
445
  case "BG_EX1_507":
345
446
  case "TB_BaconUps_008":
346
447
  board
347
- .filter((e) => (0, utils_1.hasCorrectTribe)(e, reference_data_1.Race.MURLOC, allCards))
448
+ .filter((e) => (0, utils_2.hasCorrectTribe)(e, boardHero, reference_data_1.Race.MURLOC, gameState.allCards))
348
449
  .filter((e) => e.entityId !== spawned.entityId)
349
450
  .forEach((e) => {
350
451
  e.attack += spawned.cardId === "TB_BaconUps_008" ? 4 : 2;
@@ -353,7 +454,7 @@ const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, a
353
454
  case "BG26_805":
354
455
  case "BG26_805_G":
355
456
  board
356
- .filter((e) => (0, utils_1.hasCorrectTribe)(e, reference_data_1.Race.BEAST, allCards))
457
+ .filter((e) => (0, utils_2.hasCorrectTribe)(e, boardHero, reference_data_1.Race.BEAST, gameState.allCards))
357
458
  .filter((e) => e.entityId !== spawned.entityId)
358
459
  .forEach((e) => {
359
460
  e.attack += spawned.cardId === "BG26_805_G" ? 4 : 2;
@@ -362,7 +463,7 @@ const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, a
362
463
  case "BG21_039":
363
464
  case "BG21_039_G":
364
465
  board
365
- .filter((e) => (0, utils_1.hasCorrectTribe)(e, reference_data_1.Race.DEMON, allCards))
466
+ .filter((e) => (0, utils_2.hasCorrectTribe)(e, boardHero, reference_data_1.Race.DEMON, gameState.allCards))
366
467
  .filter((e) => e.entityId !== spawned.entityId)
367
468
  .forEach((e) => {
368
469
  e.attack += spawned.cardId === "BG21_039_G" ? 4 : 2;
@@ -379,18 +480,31 @@ const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, a
379
480
  case "BG27_030":
380
481
  case "BG27_030_G":
381
482
  board
382
- .filter((e) => (0, utils_1.hasCorrectTribe)(e, reference_data_1.Race.UNDEAD, allCards))
483
+ .filter((e) => (0, utils_2.hasCorrectTribe)(e, boardHero, reference_data_1.Race.UNDEAD, gameState.allCards))
383
484
  .filter((e) => e.entityId !== spawned.entityId)
384
485
  .forEach((e) => {
385
486
  e.attack += (spawned.cardId === "BG27_030_G" ? 2 : 1) * boardHero.tavernTier;
386
487
  });
387
488
  break;
489
+ case "BG_TTN_401":
490
+ case "BG_TTN_401_G":
491
+ boardHero.globalInfo.AstralAutomatonsSummonedThisGame++;
492
+ board
493
+ .filter((e) => e.entityId !== spawned.entityId)
494
+ .filter((e) => e.cardId === "BG_TTN_401" ||
495
+ e.cardId === "BG_TTN_401_G")
496
+ .forEach((e) => {
497
+ const multiplierAstral = spawned.cardId === "BG_TTN_401_G" ? 2 : 1;
498
+ (0, stats_1.modifyStats)(spawned, 3 * multiplierAstral, 2 * multiplierAstral, board, boardHero, gameState);
499
+ });
500
+ break;
388
501
  }
389
502
  };
390
503
  const handleAfterSpawnEffects = (board, hero, allSpawned, gameState) => {
391
504
  for (const spawned of allSpawned) {
392
505
  handleAfterSpawnEffect(board, hero, spawned, gameState);
393
506
  }
507
+ (0, auras_1.updateBoardwideAuras)(board, hero, gameState);
394
508
  };
395
509
  const onMinionSummoned = (hero, board, gameState) => {
396
510
  var _a;
@@ -415,8 +529,7 @@ const handleAfterSpawnEffect = (board, hero, spawned, gameState) => {
415
529
  case "BG22_401_G":
416
530
  if (entity.entityId !== spawned.entityId) {
417
531
  const multiplier2 = entity.cardId === "BG22_401_G" ? 2 : 1;
418
- const buffAmount2 = multiplier2 *
419
- ((0, utils_1.isCorrectTribe)(gameState.allCards.getCard(spawned.cardId).races, reference_data_1.Race.MURLOC) ? 1 : 0);
532
+ const buffAmount2 = multiplier2 * ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.MURLOC, gameState.allCards) ? 1 : 0);
420
533
  if (buffAmount2 > 0) {
421
534
  (0, stats_1.modifyStats)(entity, buffAmount2, 0, board, hero, gameState);
422
535
  gameState.spectator.registerPowerTarget(entity, entity, board, null, null);
@@ -441,7 +554,7 @@ const handleAfterSpawnEffect = (board, hero, spawned, gameState) => {
441
554
  case "BG26_172":
442
555
  case "BG26_172_G":
443
556
  if (entity.entityId !== spawned.entityId) {
444
- const xylobonesBuff = entity.cardId === "BG26_172_G" ? 6 : 3;
557
+ const xylobonesBuff = entity.cardId === "BG26_172_G" ? 4 : 2;
445
558
  (0, stats_1.modifyStats)(entity, 0, xylobonesBuff, board, hero, gameState);
446
559
  gameState.spectator.registerPowerTarget(entity, entity, board, null, null);
447
560
  }
@@ -455,7 +568,8 @@ const handleAfterSpawnEffect = (board, hero, spawned, gameState) => {
455
568
  break;
456
569
  case "BG26_802":
457
570
  case "BG26_802_G":
458
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, gameState.allCards) && entity.entityId !== spawned.entityId) {
571
+ if ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.BEAST, gameState.allCards) &&
572
+ entity.entityId !== spawned.entityId) {
459
573
  const bananaStatBuff = entity.cardId === "BG26_802_G" ? 3 : 2;
460
574
  (0, stats_1.setEntityStats)(spawned, spawned.attack * bananaStatBuff, spawned.health * bananaStatBuff, board, hero, gameState);
461
575
  gameState.spectator.registerPowerTarget(entity, spawned, board, null, null);
@@ -463,7 +577,8 @@ const handleAfterSpawnEffect = (board, hero, spawned, gameState) => {
463
577
  break;
464
578
  case "BG26_370":
465
579
  case "BG26_370_G":
466
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, gameState.allCards) && entity.entityId !== spawned.entityId) {
580
+ if ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.BEAST, gameState.allCards) &&
581
+ entity.entityId !== spawned.entityId) {
467
582
  const snapjawBuff = entity.cardId === "BG26_370_G" ? 2 : 1;
468
583
  (0, stats_1.modifyStats)(entity, 0, snapjawBuff, board, hero, gameState);
469
584
  }
@@ -472,24 +587,36 @@ const handleAfterSpawnEffect = (board, hero, spawned, gameState) => {
472
587
  case "BG_TTN_078_G":
473
588
  if (spawned.attack > entity.attack) {
474
589
  const observerBuff = entity.cardId === "BG_TTN_078_G" ? 2 : 1;
475
- (0, utils_1.addStatsToBoard)(entity, board, hero, observerBuff, 0, gameState);
590
+ (0, utils_2.addStatsToBoard)(entity, board, hero, observerBuff, 0, gameState);
476
591
  }
477
592
  break;
478
593
  case "TB_BaconShop_HERO_53_Buddy":
479
594
  case "TB_BaconShop_HERO_53_Buddy_G":
480
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.DRAGON, gameState.allCards) && entity.entityId !== spawned.entityId) {
595
+ if ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.DRAGON, gameState.allCards) &&
596
+ entity.entityId !== spawned.entityId) {
481
597
  const valithriaBuff = entity.cardId === "TB_BaconShop_HERO_53_Buddy_G" ? 3 : 2;
482
598
  (0, stats_1.modifyStats)(entity, valithriaBuff, valithriaBuff, board, hero, gameState);
483
599
  gameState.spectator.registerPowerTarget(entity, spawned, board, null, null);
484
600
  }
485
601
  break;
486
602
  case "BG26_RLK_824":
487
- if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.UNDEAD, gameState.allCards) && entity.entityId !== spawned.entityId) {
603
+ if ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.UNDEAD, gameState.allCards) &&
604
+ entity.entityId !== spawned.entityId) {
488
605
  (0, stats_1.modifyStats)(spawned, 1, 0, board, hero, gameState);
489
606
  gameState.spectator.registerPowerTarget(entity, entity, board, null, null);
490
607
  }
491
608
  break;
492
609
  }
493
610
  }
611
+ for (const trinket of hero.trinkets) {
612
+ switch (trinket.cardId) {
613
+ case "BG30_MagicItem_540":
614
+ if ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.BEAST, gameState.allCards)) {
615
+ (0, stats_1.setEntityStats)(spawned, spawned.attack * 2, spawned.health * 2, board, hero, gameState);
616
+ gameState.spectator.registerPowerTarget(hero, spawned, board, null, null);
617
+ }
618
+ break;
619
+ }
620
+ }
494
621
  };
495
622
  //# sourceMappingURL=add-minion-to-board.js.map