@firestone-hs/simulate-bgs-battle 1.1.339 → 1.1.340

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.
@@ -1,4 +1,5 @@
1
1
  import { BoardEntity } from './board-entity';
2
+ import { BoardSecret } from './board-secret';
2
3
  export interface BgsPlayerEntity {
3
4
  readonly cardId: string;
4
5
  readonly nonGhostCardId?: string;
@@ -10,13 +11,13 @@ export interface BgsPlayerEntity {
10
11
  readonly heroPowerInfo2?: number;
11
12
  entityId?: number;
12
13
  questRewards?: readonly string[];
13
- spells?: readonly string[];
14
14
  questRewardEntities?: readonly {
15
15
  cardId: string;
16
16
  avengeDefault?: number;
17
17
  avengeCurrent?: number;
18
18
  }[];
19
19
  hand?: BoardEntity[];
20
+ secrets?: BoardSecret[];
20
21
  avengeCurrent?: number;
21
22
  avengeDefault?: number;
22
23
  globalInfo?: BgsPlayerGlobalInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\n\r\nexport interface BgsPlayerEntity {\r\n\treadonly cardId: string;\r\n\treadonly nonGhostCardId?: string;\r\n\treadonly hpLeft: number;\r\n\treadonly tavernTier: number;\r\n\treadonly heroPowerId?: string | undefined | null;\r\n\treadonly heroPowerUsed: boolean;\r\n\treadonly heroPowerInfo?: number;\r\n\treadonly heroPowerInfo2?: number;\r\n\tentityId?: number;\r\n\tquestRewards?: readonly string[];\r\n\tspells?: readonly string[];\r\n\tquestRewardEntities?: readonly {\r\n\t\tcardId: string;\r\n\t\tavengeDefault?: number;\r\n\t\tavengeCurrent?: number;\r\n\t}[];\r\n\thand?: BoardEntity[];\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tglobalInfo?: BgsPlayerGlobalInfo;\r\n\r\n\tdeadEyeDamageDone?: number;\r\n\trapidReanimationMinion?: BoardEntity;\r\n\trapidReanimationIndexFromRight?: number;\r\n}\r\n\r\nexport interface BgsPlayerGlobalInfo {\r\n\tEternalKnightsDeadThisGame?: number;\r\n\tUndeadAttackBonus?: number;\r\n\tChoralAttackBuff?: number;\r\n\tChoralHealthBuff?: number;\r\n\tFrostlingBonus?: number;\r\n\tBloodGemAttackBonus?: number;\r\n\tBloodGemHealthBonus?: number;\r\n\tGoldrinnBuffAtk?: number;\r\n\tGoldrinnBuffHealth?: number;\r\n\tTavernSpellsCastThisGame?: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\nimport { BoardSecret } from './board-secret';\r\n\r\nexport interface BgsPlayerEntity {\r\n\treadonly cardId: string;\r\n\treadonly nonGhostCardId?: string;\r\n\treadonly hpLeft: number;\r\n\treadonly tavernTier: number;\r\n\treadonly heroPowerId?: string | undefined | null;\r\n\treadonly heroPowerUsed: boolean;\r\n\treadonly heroPowerInfo?: number;\r\n\treadonly heroPowerInfo2?: number;\r\n\tentityId?: number;\r\n\tquestRewards?: readonly string[];\r\n\tquestRewardEntities?: readonly {\r\n\t\tcardId: string;\r\n\t\tavengeDefault?: number;\r\n\t\tavengeCurrent?: number;\r\n\t}[];\r\n\thand?: BoardEntity[];\r\n\tsecrets?: BoardSecret[];\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tglobalInfo?: BgsPlayerGlobalInfo;\r\n\r\n\tdeadEyeDamageDone?: number;\r\n\trapidReanimationMinion?: BoardEntity;\r\n\trapidReanimationIndexFromRight?: number;\r\n}\r\n\r\nexport interface BgsPlayerGlobalInfo {\r\n\tEternalKnightsDeadThisGame?: number;\r\n\tUndeadAttackBonus?: number;\r\n\tChoralAttackBuff?: number;\r\n\tChoralHealthBuff?: number;\r\n\tFrostlingBonus?: number;\r\n\tBloodGemAttackBonus?: number;\r\n\tBloodGemHealthBonus?: number;\r\n\tGoldrinnBuffAtk?: number;\r\n\tGoldrinnBuffHealth?: number;\r\n\tTavernSpellsCastThisGame?: number;\r\n}\r\n"]}
@@ -23,7 +23,7 @@ exports.default = async (event) => {
23
23
  return response;
24
24
  };
25
25
  const simulateBattle = (battleInput, cards, cardsData) => {
26
- var _a, _b, _c, _d, _e, _f, _g;
26
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
27
27
  const start = Date.now();
28
28
  const maxAcceptableDuration = ((_a = battleInput.options) === null || _a === void 0 ? void 0 : _a.maxAcceptableDuration) || 8000;
29
29
  const numberOfSimulations = ((_b = battleInput.options) === null || _b === void 0 ? void 0 : _b.numberOfSimulations) || 5000;
@@ -47,8 +47,10 @@ const simulateBattle = (battleInput, cards, cardsData) => {
47
47
  const opponentInfo = battleInput.opponentBoard;
48
48
  const playerBoard = playerInfo.board.map((entity) => ({ ...(0, utils_1.addImpliedMechanics)(entity, cardsData), friendly: true }));
49
49
  const playerHand = (_c = playerInfo.player.hand) === null || _c === void 0 ? void 0 : _c.map((entity) => ({ ...(0, utils_1.addImpliedMechanics)(entity, cardsData), friendly: true }));
50
+ playerInfo.player.secrets = (_d = playerInfo.secrets) === null || _d === void 0 ? void 0 : _d.filter((e) => !!(e === null || e === void 0 ? void 0 : e.cardId));
50
51
  const opponentBoard = opponentInfo.board.map((entity) => ({ ...(0, utils_1.addImpliedMechanics)(entity, cardsData), friendly: false }));
51
- const opponentHand = (_d = opponentInfo.player.hand) === null || _d === void 0 ? void 0 : _d.map((entity) => ({ ...(0, utils_1.addImpliedMechanics)(entity, cardsData), friendly: true }));
52
+ const opponentHand = (_e = opponentInfo.player.hand) === null || _e === void 0 ? void 0 : _e.map((entity) => ({ ...(0, utils_1.addImpliedMechanics)(entity, cardsData), friendly: true }));
53
+ opponentInfo.player.secrets = (_f = opponentInfo.secrets) === null || _f === void 0 ? void 0 : _f.filter((e) => !!(e === null || e === void 0 ? void 0 : e.cardId));
52
54
  (0, auras_1.setMissingAuras)(playerBoard, playerInfo.player, opponentInfo.player, cards);
53
55
  (0, auras_1.setMissingAuras)(opponentBoard, opponentInfo.player, playerInfo.player, cards);
54
56
  (0, auras_1.setImplicitDataHero)(playerInfo.player, cardsData, true);
@@ -72,7 +74,7 @@ const simulateBattle = (battleInput, cards, cardsData) => {
72
74
  };
73
75
  const inputStr = JSON.stringify(inputReady);
74
76
  const spectator = new spectator_1.Spectator(battleInput.playerBoard.player.cardId, battleInput.playerBoard.player.heroPowerId, battleInput.opponentBoard.player.cardId, battleInput.opponentBoard.player.heroPowerId);
75
- !((_e = battleInput.options) === null || _e === void 0 ? void 0 : _e.skipInfoLogs) && console.time('simulation');
77
+ !((_g = battleInput.options) === null || _g === void 0 ? void 0 : _g.skipInfoLogs) && console.time('simulation');
76
78
  const outcomes = {};
77
79
  for (let i = 0; i < numberOfSimulations; i++) {
78
80
  const simulator = new simulator_1.Simulator(cards, cardsData);
@@ -95,7 +97,7 @@ const simulateBattle = (battleInput, cards, cardsData) => {
95
97
  else if (battleResult.result === 'lost') {
96
98
  simulationResult.lost++;
97
99
  simulationResult.damageLost += battleResult.damageDealt;
98
- outcomes[battleResult.damageDealt] = ((_f = outcomes[battleResult.damageDealt]) !== null && _f !== void 0 ? _f : 0) + 1;
100
+ outcomes[battleResult.damageDealt] = ((_h = outcomes[battleResult.damageDealt]) !== null && _h !== void 0 ? _h : 0) + 1;
99
101
  if (battleInput.playerBoard.player.hpLeft &&
100
102
  battleResult.damageDealt >= battleInput.playerBoard.player.hpLeft) {
101
103
  simulationResult.lostLethal++;
@@ -124,7 +126,7 @@ const simulateBattle = (battleInput, cards, cardsData) => {
124
126
  if (simulationResult.averageDamageLost > 0 && simulationResult.averageDamageLost < opponentInfo.player.tavernTier) {
125
127
  console.warn('average damage lost issue', simulationResult, opponentInfo);
126
128
  }
127
- !((_g = battleInput.options) === null || _g === void 0 ? void 0 : _g.skipInfoLogs) && console.timeEnd('simulation');
129
+ !((_j = battleInput.options) === null || _j === void 0 ? void 0 : _j.skipInfoLogs) && console.timeEnd('simulation');
128
130
  spectator.prune();
129
131
  simulationResult.outcomeSamples = spectator.buildOutcomeSamples();
130
132
  return simulationResult;
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAGxE,mDAA+C;AAE/C,8CAA0E;AAC1E,sDAAmD;AACnD,gEAA6D;AAC7D,mCAA8C;AAE9C,MAAM,KAAK,GAAG,IAAI,gCAAe,EAAE,CAAC;AAKpC,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,CACrB,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,WAAW,mCAAI,MAAA,WAAW,CAAC,OAAO,0CAAE,WAAW,EACtE,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,SAAS,mCAAI,EAAE,CACtC,CAAC;IACF,MAAM,gBAAgB,GAAG,IAAA,sBAAc,EAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAEvE,MAAM,QAAQ,GAAG;QAChB,UAAU,EAAE,GAAG;QACf,eAAe,EAAE,KAAK;QACtB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;KACtC,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEK,MAAM,cAAc,GAAG,CAC7B,WAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACD,EAAE;;IACrB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,MAAM,qBAAqB,GAAG,CAAA,MAA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EW,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;CAoBhC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAClC,YAA2E,EAC3E,SAA4B,EACoC,EAAE;IAClE,OAAO,YAAY,CAAC,MAAM,CACzB,CAAC,OAAO,EAAE,EAAE,CACX,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAChD,yBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAiB,CAAC,KAAK,CAAC,CAAC,CAC5D,CAAC;AACH,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nconst cards = new AllCardsService();\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst simulationResult = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): SimulationResult => {\r\n\tconst start = Date.now();\r\n\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 5000;\r\n\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst playerInfo = battleInput.playerBoard;\r\n\tconst opponentInfo = battleInput.opponentBoard;\r\n\r\n\tconst playerBoard = playerInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: true } as BoardEntity),\r\n\t);\r\n\tconst playerHand = playerInfo.player.hand?.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: true } as BoardEntity),\r\n\t);\r\n\tconst opponentBoard = opponentInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: false } as BoardEntity),\r\n\t);\r\n\tconst opponentHand = opponentInfo.player.hand?.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: true } as BoardEntity),\r\n\t);\r\n\t// When using the simulator, the aura is not applied when receiving the board state. When\r\n\tsetMissingAuras(playerBoard, playerInfo.player, opponentInfo.player, cards);\r\n\tsetMissingAuras(opponentBoard, opponentInfo.player, playerInfo.player, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, true);\r\n\tsetImplicitDataHero(opponentInfo.player, cardsData, false);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerInfo.player,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentInfo.player,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tgameState: battleInput.gameState,\r\n\t} as BgsBattleInfo;\r\n\tconst inputStr = JSON.stringify(inputReady);\r\n\tconst spectator = new Spectator(\r\n\t\tbattleInput.playerBoard.player.cardId,\r\n\t\tbattleInput.playerBoard.player.heroPowerId,\r\n\t\tbattleInput.opponentBoard.player.cardId,\r\n\t\tbattleInput.opponentBoard.player.heroPowerId,\r\n\t);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst simulator = new Simulator(cards, cardsData);\r\n\t\tconst input: BgsBattleInfo = JSON.parse(inputStr);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(\r\n\t\t\tinput.playerBoard.board,\r\n\t\t\tinput.playerBoard.player,\r\n\t\t\tinput.opponentBoard.board,\r\n\t\t\tinput.opponentBoard.player,\r\n\t\t\tinput.gameState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms', battleResult);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\t}\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\t// simulationResult.tiedPercent = checkRounding(Math.round((10 * (100 * simulationResult.tied)) / totalMatches) / 10, simulationResult.tied, totalMatches);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\t100 - simulationResult.lostPercent - simulationResult.wonPercent,\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\tsimulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\tsimulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (simulationResult.averageDamageWon > 0 && simulationResult.averageDamageWon < playerInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage won issue', simulationResult, playerInfo);\r\n\t}\r\n\tif (simulationResult.averageDamageLost > 0 && simulationResult.averageDamageLost < opponentInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage lost issue', simulationResult, opponentInfo);\r\n\t}\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\treturn simulationResult;\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\nconst cleanEnchantments = (board: readonly BoardEntity[]): readonly BoardEntity[] => {\r\n\tconst entityIds = board.map((entity) => entity.entityId);\r\n\treturn board.map((entity) => ({\r\n\t\t...entity,\r\n\t\tenchantments: cleanEnchantmentsForEntity(entity.enchantments, entityIds),\r\n\t}));\r\n};\r\n\r\nexport const validEnchantments = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\t// CardIds.FireInvocation_ElementFireEnchantment, // Attack is doubled, probably no use to keep it\r\n\t// CardIds.WaterInvocation_ElementWaterEnchantment, // +3 health and taunt, same\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n];\r\n\r\nconst cleanEnchantmentsForEntity = (\r\n\tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n\tentityIds: readonly number[],\r\n): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n\treturn enchantments.filter(\r\n\t\t(enchant) =>\r\n\t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n\t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n\t);\r\n};\r\n"]}
1
+ {"version":3,"file":"simulate-bgs-battle.js","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,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7B,GAAG,MAAM;QACT,YAAY,EAAE,0BAA0B,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC;KACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEW,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;CAoBhC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAClC,YAA2E,EAC3E,SAA4B,EACoC,EAAE;IAClE,OAAO,YAAY,CAAC,MAAM,CACzB,CAAC,OAAO,EAAE,EAAE,CACX,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAChD,yBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAiB,CAAC,KAAK,CAAC,CAAC,CAC5D,CAAC;AACH,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nconst cards = new AllCardsService();\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst simulationResult = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): SimulationResult => {\r\n\tconst start = Date.now();\r\n\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 5000;\r\n\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst playerInfo = battleInput.playerBoard;\r\n\tconst opponentInfo = battleInput.opponentBoard;\r\n\r\n\tconst playerBoard = playerInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: true } as BoardEntity),\r\n\t);\r\n\tconst playerHand = playerInfo.player.hand?.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: true } as BoardEntity),\r\n\t);\r\n\tplayerInfo.player.secrets = playerInfo.secrets?.filter((e) => !!e?.cardId);\r\n\tconst opponentBoard = opponentInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: false } as BoardEntity),\r\n\t);\r\n\tconst opponentHand = opponentInfo.player.hand?.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: true } as BoardEntity),\r\n\t);\r\n\topponentInfo.player.secrets = opponentInfo.secrets?.filter((e) => !!e?.cardId);\r\n\r\n\t// When using the simulator, the aura is not applied when receiving the board state. When\r\n\tsetMissingAuras(playerBoard, playerInfo.player, opponentInfo.player, cards);\r\n\tsetMissingAuras(opponentBoard, opponentInfo.player, playerInfo.player, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, true);\r\n\tsetImplicitDataHero(opponentInfo.player, cardsData, false);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerInfo.player,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentInfo.player,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tgameState: battleInput.gameState,\r\n\t} as BgsBattleInfo;\r\n\tconst inputStr = JSON.stringify(inputReady);\r\n\tconst spectator = new Spectator(\r\n\t\tbattleInput.playerBoard.player.cardId,\r\n\t\tbattleInput.playerBoard.player.heroPowerId,\r\n\t\tbattleInput.opponentBoard.player.cardId,\r\n\t\tbattleInput.opponentBoard.player.heroPowerId,\r\n\t);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst simulator = new Simulator(cards, cardsData);\r\n\t\tconst input: BgsBattleInfo = JSON.parse(inputStr);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(\r\n\t\t\tinput.playerBoard.board,\r\n\t\t\tinput.playerBoard.player,\r\n\t\t\tinput.opponentBoard.board,\r\n\t\t\tinput.opponentBoard.player,\r\n\t\t\tinput.gameState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms', battleResult);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\t}\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\t// simulationResult.tiedPercent = checkRounding(Math.round((10 * (100 * simulationResult.tied)) / totalMatches) / 10, simulationResult.tied, totalMatches);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\t100 - simulationResult.lostPercent - simulationResult.wonPercent,\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\tsimulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\tsimulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (simulationResult.averageDamageWon > 0 && simulationResult.averageDamageWon < playerInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage won issue', simulationResult, playerInfo);\r\n\t}\r\n\tif (simulationResult.averageDamageLost > 0 && simulationResult.averageDamageLost < opponentInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage lost issue', simulationResult, opponentInfo);\r\n\t}\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\treturn simulationResult;\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\nconst cleanEnchantments = (board: readonly BoardEntity[]): readonly BoardEntity[] => {\r\n\tconst entityIds = board.map((entity) => entity.entityId);\r\n\treturn board.map((entity) => ({\r\n\t\t...entity,\r\n\t\tenchantments: cleanEnchantmentsForEntity(entity.enchantments, entityIds),\r\n\t}));\r\n};\r\n\r\nexport const validEnchantments = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\t// CardIds.FireInvocation_ElementFireEnchantment, // Attack is doubled, probably no use to keep it\r\n\t// CardIds.WaterInvocation_ElementWaterEnchantment, // +3 health and taunt, same\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n];\r\n\r\nconst cleanEnchantmentsForEntity = (\r\n\tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n\tentityIds: readonly number[],\r\n): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n\treturn enchantments.filter(\r\n\t\t(enchant) =>\r\n\t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n\t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n\t);\r\n};\r\n"]}
@@ -9,7 +9,7 @@ const computeBattlecryMultiplier = (board, boardHero, sharedState) => {
9
9
  var _a;
10
10
  const brann = board.find((entity) => entity.cardId === "BG_LOE_077" ||
11
11
  entity.cardId === "BG27_518");
12
- const brannBlessings = (_a = boardHero.spells) === null || _a === void 0 ? void 0 : _a.some((cardId) => cardId === "BG28_509");
12
+ const brannBlessings = (_a = boardHero.secrets) === null || _a === void 0 ? void 0 : _a.some((e) => e.cardId === "BG28_509");
13
13
  const brannBonus = !!brann || brannBlessings ? 2 : 0;
14
14
  const goldenBrann = board.find((entity) => entity.cardId === "TB_BaconUps_045" ||
15
15
  entity.cardId === "BG27_518_G");
@@ -1 +1 @@
1
- {"version":3,"file":"battlecries.js","sourceRoot":"","sources":["../../src/simulation/battlecries.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAI9E,6CAA+C;AAC/C,oCAWkB;AAClB,6CAA+C;AAIxC,MAAM,0BAA0B,GAAG,CACzC,KAAoB,EACpB,SAA0B,EAC1B,WAAwB,EACf,EAAE;;IACX,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CACvB,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,iBAAwC;QACrD,MAAM,CAAC,MAAM,eAAsC,CACpD,CAAC;IACF,MAAM,cAAc,GAAG,MAAA,SAAS,CAAC,MAAM,0CAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,eAAoC,CAAC,CAAC;IACtG,MAAM,U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AAC;gBAEnC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;oBAC1E,MAAM,SAAS,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC1C,YAAY,CAAC,IAAI,CAAC,qBAAI,CAAC,SAAS,CAAC,CAAC,CAAC;oBAEnC,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE;wBACjC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;qBAEjD;oBACD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;oBACrB,KAAK,GAAG,IAAI,CAAC;oBAEb,CAAC,GAAG,CAAC,CAAC;iBACN;aACD;SAED;KACD;IAED,YAAY,CAAC,IAAI,CAChB,GAAG,uBAAuB;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAI,CAAC,qBAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACvB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,qBAAI,CAAC,CAAC,CAAC,CAAC,CAC7B,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisMinionGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n} from '../utils';\r\nimport { playBloodGemsOn } from './blood-gems';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst brann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_BG_LOE_077 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst brannBlessings = boardHero.spells?.some((cardId) => cardId === CardIds.BrannsBlessing_BG28_509);\r\n\tconst brannBonus = !!brann || brannBlessings ? 2 : 0;\r\n\tconst goldenBrann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_TB_BaconUps_045 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst goldenBrannBonus = !!goldenBrann ? 3 : 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\r\n\tconst multiplier = echoesOfArgus + Math.max(goldenBrannBonus, brannBonus, 1);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const triggerBattlecry = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tentity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n) => {\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, sharedState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100:\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100_G:\r\n\t\t\t\tconst razorFenCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RazorfenGeomancer_BG20_100\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, razorFenCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, Race.MURLOC, allCards);\r\n\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tmodifyHealth(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(rockPoolTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, rockPoolTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellCollector_BG23_002:\r\n\t\t\tcase CardIds.ShellCollector_BG23_002_G:\r\n\t\t\t\tconst shellCollectorCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellCollector_BG23_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, shellCollectorCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieJug_BGS_083:\r\n\t\t\tcase CardIds.MenagerieJug_TB_BaconUps_145:\r\n\t\t\t\tconst menagerieJugStats = entity.cardId === CardIds.MenagerieJug_BGS_083 ? 2 : 4;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011:\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011_G:\r\n\t\t\t\tconst nerubianDeathswarmerStats = entity.cardId === CardIds.NerubianDeathswarmer_BG25_011 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.UndeadAttackBonus =\r\n\t\t\t\t\t(hero.globalInfo?.UndeadAttackBonus ?? 0) + nerubianDeathswarmerStats;\r\n\t\t\t\taddStatsToBoard(entity, board, nerubianDeathswarmerStats, 0, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\tsparringPartnersTarget.taunt = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, Race.DRAGON, allCards);\r\n\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\tmodifyAttack(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tmodifyHealth(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(twilightEmissaryTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, twilightEmissaryTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159:\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159_G:\r\n\t\t\t\tconst moonBaconJazzerStats = entity.cardId === CardIds.MoonBaconJazzer_BG26_159 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t\t\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) + moonBaconJazzerStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, Race.ELEMENTAL, allCards);\r\n\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\tmodifyAttack(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(smoggerTarget, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, smoggerTarget, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\tconst annihilanStats = (entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\tmodifyHealth(entity, annihilanStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963:\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DRAGON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Necrolyte_BG20_202:\r\n\t\t\tcase CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\tplayBloodGemsOn(necrolyteTarget, necrolyteBloodGems, board, hero, allCards, spectator);\r\n\t\t\t\tspectator.registerPowerTarget(entity, necrolyteTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PrimalfinLookout_BGS_020:\r\n\t\t\tcase CardIds.PrimalfinLookout_TB_BaconUps_089:\r\n\t\t\t\tconst primalfinLookoutCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.PrimalfinLookout_BGS_020\r\n\t\t\t\t\t\t? [cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1)]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, primalfinLookoutCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\tmodifyAttack(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(target, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, target, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\tvigilantStonebornTarget.taunt = true;\r\n\t\t\t\tmodifyHealth(vigilantStonebornTarget, vigilantStonebornStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(vigilantStonebornTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, vigilantStonebornTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\tbonemareTarget.taunt = true;\r\n\t\t\t\tmodifyAttack(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tmodifyHealth(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(bonemareTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, bonemareTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309:\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309_G:\r\n\t\t\t\tconst generalDrakkisathCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_BG25_309\r\n\t\t\t\t\t\t? [CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, generalDrakkisathCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 3 : 6,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, murozondCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, tavernTempestCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807:\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807_G:\r\n\t\t\t\tconst mechaJaraxxusCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.MechaJaraxxus_BG25_807\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, mechaJaraxxusCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002:\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002_G:\r\n\t\t\t\tconst oozelingCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.OozelingGladiator_BG27_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore, CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, oozelingCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\tironGroundskeeperTarget.taunt = !ironGroundskeeperTarget.taunt;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\tconst differentTypes = extractUniqueTribes(board, allCards);\r\n\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\tconst livingConstellationTarget = pickRandom(board);\r\n\t\t\t\tmodifyAttack(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tmodifyHealth(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(livingConstellationTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, livingConstellationTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparkLing_BG27_019:\r\n\t\t\tcase CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\tboard.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tconst emergentFlameStats = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tmodifyHealth(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(emergentFlameTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\tconst captainSandersTarget = pickRandom(board.filter((e) => !isMinionGolden(e, allCards)));\r\n\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, hero, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = entity.cardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Murky_BG24_012:\r\n\t\t\tcase CardIds.Murky_BG24_012_G:\r\n\t\t\t\tconst murkyScale = entity.cardId === CardIds.Murky_BG24_012 ? 1 : 2;\r\n\t\t\t\t// const murkyBattlecriesPlayed = entity.scriptDataNum1 > 0 ? entity.scriptDataNum1 / murkyScale - 1 : 0;\r\n\t\t\t\tconst murkyStats = murkyScale * 10;\r\n\t\t\t\tconst murkyTarget = pickRandom(board.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)));\r\n\t\t\t\tmodifyAttack(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tmodifyHealth(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(murkyTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814:\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814_G:\r\n\t\t\t\tconst balladistMultiplier = entity.cardId === CardIds.LovesickBalladist_BG26_814 ? 1 : 2;\r\n\t\t\t\tconst balladistStats = balladistMultiplier * (entity.scriptDataNum1 ?? 0);\r\n\t\t\t\tconst balladistTarget = pickRandom(board.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)));\r\n\t\t\t\tif (balladistTarget) {\r\n\t\t\t\t\tmodifyHealth(balladistTarget, balladistStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(balladistTarget, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, balladistTarget, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Amalgadon_BGS_069:\r\n\t\t\tcase CardIds.Amalgadon_TB_BaconUps_121:\r\n\t\t\t\tconst numberOfTribes = extractUniqueTribes(board, allCards).length;\r\n\t\t\t\tconst amalgadonMultiplier = entity.cardId === CardIds.Amalgadon_BGS_069 ? 1 : 2;\r\n\t\t\t\tconst totalAdapts = amalgadonMultiplier * numberOfTribes;\r\n\t\t\t\tfor (let i = 0; i < totalAdapts; i++) {\r\n\t\t\t\t\tconst adapts = [\r\n\t\t\t\t\t\tCardIds.FlamingClawsToken,\r\n\t\t\t\t\t\tCardIds.LivingSporesToken,\r\n\t\t\t\t\t\tCardIds.VolcanicMightToken,\r\n\t\t\t\t\t\tCardIds.RockyCarapaceToken,\r\n\t\t\t\t\t];\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tadapts.push(CardIds.CracklingShieldToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.windfury) {\r\n\t\t\t\t\t\tadapts.push(CardIds.LightningSpeedToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.taunt) {\r\n\t\t\t\t\t\tadapts.push(CardIds.MassiveToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.venomous && !entity.poisonous) {\r\n\t\t\t\t\t\tadapts.push(CardIds.PoisonSpitToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst adapt = pickRandom(adapts);\r\n\t\t\t\t\tswitch (adapt) {\r\n\t\t\t\t\t\tcase CardIds.FlamingClawsToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 3, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LivingSporesToken:\r\n\t\t\t\t\t\t\tentity.enchantments = entity.enchantments ?? [];\r\n\t\t\t\t\t\t\tentity.enchantments.push({\r\n\t\t\t\t\t\t\t\tcardId: CardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LightningSpeedToken:\r\n\t\t\t\t\t\t\tentity.windfury = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.MassiveToken:\r\n\t\t\t\t\t\t\tentity.taunt = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.PoisonSpitToken:\r\n\t\t\t\t\t\t\tentity.poisonous = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.RockyCarapaceToken:\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 3, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.CracklingShieldToken:\r\n\t\t\t\t\t\t\tentity.divineShield = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.VolcanicMightToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 1, board, allCards);\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 1, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550:\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550_G:\r\n\t\t\t\tconst rodeoPerformerCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RodeoPerformer_BG28_550_G ? [null] : [null, null];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, rodeoPerformerCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\thasTriggered = false;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (hasTriggered) {\r\n\t\t\tafterBattlecryTriggered(entity, board, hero, otherBoard, otherHero, allCards, cardsData, spectator);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst afterBattlecryTriggered = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tspectator: Spectator,\r\n) => {\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_BGS_041)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 1, 1, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_TB_BaconUps_109)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 2, 2, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n};\r\n\r\n// TODO: this is probably too slow\r\nconst extractUniqueTribes = (board: BoardEntity[], allCards: AllCardsService): readonly Race[] => {\r\n\tconst boardReferenceCards = board.map((m) => allCards.getCard(m.cardId));\r\n\tconst minionsPlayedWithTribes = boardReferenceCards.filter((c) => !!c.races?.length);\r\n\tconst minionsToProcess: /*Mutable<ReferenceCard & { picked?: boolean }>*/ any[] = [\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((c) => !c.races.includes(Race[Race.ALL]))\r\n\t\t\t.map((c) => ({ ...c, races: [...c.races] })),\r\n\t];\r\n\r\n\tconst uniqueTribes: Race[] = [];\r\n\tconst maxTribesPerMinion = 2;\r\n\tfor (let i = 1; i <= maxTribesPerMinion; i++) {\r\n\t\tlet dirty = true;\r\n\t\twhile (dirty) {\r\n\t\t\tdirty = false;\r\n\t\t\tfor (let j = 0; j < minionsToProcess.length; j++) {\r\n\t\t\t\tconst minion = minionsToProcess[j];\r\n\t\t\t\t// console.debug('considering minion', minion.name, minion.races);\r\n\t\t\t\tif (!minion.picked && minion.races.length > 0 && minion.races.length <= i) {\r\n\t\t\t\t\tconst raceToAdd: string = minion.races[0];\r\n\t\t\t\t\tuniqueTribes.push(Race[raceToAdd]);\r\n\t\t\t\t\t// console.debug('added', raceToAdd, uniqueTribes);\r\n\t\t\t\t\tfor (const m of minionsToProcess) {\r\n\t\t\t\t\t\tm.races = m.races.filter((r) => r !== raceToAdd);\r\n\t\t\t\t\t\t// console.debug('updates races', m.name, m.races, raceToAdd);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tminion.picked = true;\r\n\t\t\t\t\tdirty = true;\r\n\t\t\t\t\t// Restart the loop, so we're not dependant on the order in which we process things\r\n\t\t\t\t\tj = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// minionsToProcess = minionsToProcess.filter((c) => !c.picked);\r\n\t\t}\r\n\t}\r\n\r\n\tuniqueTribes.push(\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((m) => m.races.includes(Race[Race.ALL]))\r\n\t\t\t.flatMap((m) => m.races)\r\n\t\t\t.map((r: string) => Race[r]),\r\n\t);\r\n\treturn uniqueTribes;\r\n};\r\n"]}
1
+ {"version":3,"file":"battlecries.js","sourceRoot":"","sources":["../../src/simulation/battlecries.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAI9E,6CAA+C;AAC/C,oCAWkB;AAClB,6CAA+C;AAIxC,MAAM,0BAA0B,GAAG,CACzC,KAAoB,EACpB,SAA0B,EAC1B,WAAwB,EACf,EAAE;;IACX,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CACvB,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,iBAAwC;QACrD,MAAM,CAAC,MAAM,eAAsC,CACpD,CAAC;IACF,MAAM,cAAc,GAAG,MAAA,SAAS,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAoC,CAAC,CAAC;IACpG,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAC7B,CAAC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C1E,MAAM,SAAS,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC1C,YAAY,CAAC,IAAI,CAAC,qBAAI,CAAC,SAAS,CAAC,CAAC,CAAC;oBAEnC,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE;wBACjC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;qBAEjD;oBACD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;oBACrB,KAAK,GAAG,IAAI,CAAC;oBAEb,CAAC,GAAG,CAAC,CAAC;iBACN;aACD;SAED;KACD;IAED,YAAY,CAAC,IAAI,CAChB,GAAG,uBAAuB;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAI,CAAC,qBAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACvB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,qBAAI,CAAC,CAAC,CAAC,CAAC,CAC7B,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisMinionGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n} from '../utils';\r\nimport { playBloodGemsOn } from './blood-gems';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst brann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_BG_LOE_077 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst brannBlessings = boardHero.secrets?.some((e) => e.cardId === CardIds.BrannsBlessing_BG28_509);\r\n\tconst brannBonus = !!brann || brannBlessings ? 2 : 0;\r\n\tconst goldenBrann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_TB_BaconUps_045 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst goldenBrannBonus = !!goldenBrann ? 3 : 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\r\n\tconst multiplier = echoesOfArgus + Math.max(goldenBrannBonus, brannBonus, 1);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const triggerBattlecry = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tentity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n) => {\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, sharedState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100:\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100_G:\r\n\t\t\t\tconst razorFenCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RazorfenGeomancer_BG20_100\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, razorFenCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, Race.MURLOC, allCards);\r\n\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tmodifyHealth(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(rockPoolTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, rockPoolTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellCollector_BG23_002:\r\n\t\t\tcase CardIds.ShellCollector_BG23_002_G:\r\n\t\t\t\tconst shellCollectorCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellCollector_BG23_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, shellCollectorCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieJug_BGS_083:\r\n\t\t\tcase CardIds.MenagerieJug_TB_BaconUps_145:\r\n\t\t\t\tconst menagerieJugStats = entity.cardId === CardIds.MenagerieJug_BGS_083 ? 2 : 4;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011:\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011_G:\r\n\t\t\t\tconst nerubianDeathswarmerStats = entity.cardId === CardIds.NerubianDeathswarmer_BG25_011 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.UndeadAttackBonus =\r\n\t\t\t\t\t(hero.globalInfo?.UndeadAttackBonus ?? 0) + nerubianDeathswarmerStats;\r\n\t\t\t\taddStatsToBoard(entity, board, nerubianDeathswarmerStats, 0, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\tsparringPartnersTarget.taunt = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, Race.DRAGON, allCards);\r\n\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\tmodifyAttack(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tmodifyHealth(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(twilightEmissaryTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, twilightEmissaryTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159:\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159_G:\r\n\t\t\t\tconst moonBaconJazzerStats = entity.cardId === CardIds.MoonBaconJazzer_BG26_159 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t\t\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) + moonBaconJazzerStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, Race.ELEMENTAL, allCards);\r\n\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\tmodifyAttack(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(smoggerTarget, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, smoggerTarget, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\tconst annihilanStats = (entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\tmodifyHealth(entity, annihilanStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963:\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DRAGON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Necrolyte_BG20_202:\r\n\t\t\tcase CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\tplayBloodGemsOn(necrolyteTarget, necrolyteBloodGems, board, hero, allCards, spectator);\r\n\t\t\t\tspectator.registerPowerTarget(entity, necrolyteTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PrimalfinLookout_BGS_020:\r\n\t\t\tcase CardIds.PrimalfinLookout_TB_BaconUps_089:\r\n\t\t\t\tconst primalfinLookoutCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.PrimalfinLookout_BGS_020\r\n\t\t\t\t\t\t? [cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1)]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, primalfinLookoutCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\tmodifyAttack(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(target, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, target, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\tvigilantStonebornTarget.taunt = true;\r\n\t\t\t\tmodifyHealth(vigilantStonebornTarget, vigilantStonebornStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(vigilantStonebornTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, vigilantStonebornTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\tbonemareTarget.taunt = true;\r\n\t\t\t\tmodifyAttack(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tmodifyHealth(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(bonemareTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, bonemareTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309:\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309_G:\r\n\t\t\t\tconst generalDrakkisathCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_BG25_309\r\n\t\t\t\t\t\t? [CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, generalDrakkisathCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 3 : 6,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, murozondCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, tavernTempestCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807:\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807_G:\r\n\t\t\t\tconst mechaJaraxxusCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.MechaJaraxxus_BG25_807\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, mechaJaraxxusCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002:\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002_G:\r\n\t\t\t\tconst oozelingCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.OozelingGladiator_BG27_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore, CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, oozelingCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\tironGroundskeeperTarget.taunt = !ironGroundskeeperTarget.taunt;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\tconst differentTypes = extractUniqueTribes(board, allCards);\r\n\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\tconst livingConstellationTarget = pickRandom(board);\r\n\t\t\t\tmodifyAttack(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tmodifyHealth(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(livingConstellationTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, livingConstellationTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparkLing_BG27_019:\r\n\t\t\tcase CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\tboard.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tconst emergentFlameStats = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tmodifyHealth(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(emergentFlameTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\tconst captainSandersTarget = pickRandom(board.filter((e) => !isMinionGolden(e, allCards)));\r\n\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, hero, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = entity.cardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Murky_BG24_012:\r\n\t\t\tcase CardIds.Murky_BG24_012_G:\r\n\t\t\t\tconst murkyScale = entity.cardId === CardIds.Murky_BG24_012 ? 1 : 2;\r\n\t\t\t\t// const murkyBattlecriesPlayed = entity.scriptDataNum1 > 0 ? entity.scriptDataNum1 / murkyScale - 1 : 0;\r\n\t\t\t\tconst murkyStats = murkyScale * 10;\r\n\t\t\t\tconst murkyTarget = pickRandom(board.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)));\r\n\t\t\t\tmodifyAttack(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tmodifyHealth(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(murkyTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814:\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814_G:\r\n\t\t\t\tconst balladistMultiplier = entity.cardId === CardIds.LovesickBalladist_BG26_814 ? 1 : 2;\r\n\t\t\t\tconst balladistStats = balladistMultiplier * (entity.scriptDataNum1 ?? 0);\r\n\t\t\t\tconst balladistTarget = pickRandom(board.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)));\r\n\t\t\t\tif (balladistTarget) {\r\n\t\t\t\t\tmodifyHealth(balladistTarget, balladistStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(balladistTarget, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, balladistTarget, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Amalgadon_BGS_069:\r\n\t\t\tcase CardIds.Amalgadon_TB_BaconUps_121:\r\n\t\t\t\tconst numberOfTribes = extractUniqueTribes(board, allCards).length;\r\n\t\t\t\tconst amalgadonMultiplier = entity.cardId === CardIds.Amalgadon_BGS_069 ? 1 : 2;\r\n\t\t\t\tconst totalAdapts = amalgadonMultiplier * numberOfTribes;\r\n\t\t\t\tfor (let i = 0; i < totalAdapts; i++) {\r\n\t\t\t\t\tconst adapts = [\r\n\t\t\t\t\t\tCardIds.FlamingClawsToken,\r\n\t\t\t\t\t\tCardIds.LivingSporesToken,\r\n\t\t\t\t\t\tCardIds.VolcanicMightToken,\r\n\t\t\t\t\t\tCardIds.RockyCarapaceToken,\r\n\t\t\t\t\t];\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tadapts.push(CardIds.CracklingShieldToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.windfury) {\r\n\t\t\t\t\t\tadapts.push(CardIds.LightningSpeedToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.taunt) {\r\n\t\t\t\t\t\tadapts.push(CardIds.MassiveToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.venomous && !entity.poisonous) {\r\n\t\t\t\t\t\tadapts.push(CardIds.PoisonSpitToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst adapt = pickRandom(adapts);\r\n\t\t\t\t\tswitch (adapt) {\r\n\t\t\t\t\t\tcase CardIds.FlamingClawsToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 3, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LivingSporesToken:\r\n\t\t\t\t\t\t\tentity.enchantments = entity.enchantments ?? [];\r\n\t\t\t\t\t\t\tentity.enchantments.push({\r\n\t\t\t\t\t\t\t\tcardId: CardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LightningSpeedToken:\r\n\t\t\t\t\t\t\tentity.windfury = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.MassiveToken:\r\n\t\t\t\t\t\t\tentity.taunt = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.PoisonSpitToken:\r\n\t\t\t\t\t\t\tentity.poisonous = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.RockyCarapaceToken:\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 3, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.CracklingShieldToken:\r\n\t\t\t\t\t\t\tentity.divineShield = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.VolcanicMightToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 1, board, allCards);\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 1, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550:\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550_G:\r\n\t\t\t\tconst rodeoPerformerCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RodeoPerformer_BG28_550_G ? [null] : [null, null];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, rodeoPerformerCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\thasTriggered = false;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (hasTriggered) {\r\n\t\t\tafterBattlecryTriggered(entity, board, hero, otherBoard, otherHero, allCards, cardsData, spectator);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst afterBattlecryTriggered = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tspectator: Spectator,\r\n) => {\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_BGS_041)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 1, 1, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_TB_BaconUps_109)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 2, 2, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n};\r\n\r\n// TODO: this is probably too slow\r\nconst extractUniqueTribes = (board: BoardEntity[], allCards: AllCardsService): readonly Race[] => {\r\n\tconst boardReferenceCards = board.map((m) => allCards.getCard(m.cardId));\r\n\tconst minionsPlayedWithTribes = boardReferenceCards.filter((c) => !!c.races?.length);\r\n\tconst minionsToProcess: /*Mutable<ReferenceCard & { picked?: boolean }>*/ any[] = [\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((c) => !c.races.includes(Race[Race.ALL]))\r\n\t\t\t.map((c) => ({ ...c, races: [...c.races] })),\r\n\t];\r\n\r\n\tconst uniqueTribes: Race[] = [];\r\n\tconst maxTribesPerMinion = 2;\r\n\tfor (let i = 1; i <= maxTribesPerMinion; i++) {\r\n\t\tlet dirty = true;\r\n\t\twhile (dirty) {\r\n\t\t\tdirty = false;\r\n\t\t\tfor (let j = 0; j < minionsToProcess.length; j++) {\r\n\t\t\t\tconst minion = minionsToProcess[j];\r\n\t\t\t\t// console.debug('considering minion', minion.name, minion.races);\r\n\t\t\t\tif (!minion.picked && minion.races.length > 0 && minion.races.length <= i) {\r\n\t\t\t\t\tconst raceToAdd: string = minion.races[0];\r\n\t\t\t\t\tuniqueTribes.push(Race[raceToAdd]);\r\n\t\t\t\t\t// console.debug('added', raceToAdd, uniqueTribes);\r\n\t\t\t\t\tfor (const m of minionsToProcess) {\r\n\t\t\t\t\t\tm.races = m.races.filter((r) => r !== raceToAdd);\r\n\t\t\t\t\t\t// console.debug('updates races', m.name, m.races, raceToAdd);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tminion.picked = true;\r\n\t\t\t\t\tdirty = true;\r\n\t\t\t\t\t// Restart the loop, so we're not dependant on the order in which we process things\r\n\t\t\t\t\tj = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// minionsToProcess = minionsToProcess.filter((c) => !c.picked);\r\n\t\t}\r\n\t}\r\n\r\n\tuniqueTribes.push(\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((m) => m.races.includes(Race[Race.ALL]))\r\n\t\t\t.flatMap((m) => m.races)\r\n\t\t\t.map((r: string) => Race[r]),\r\n\t);\r\n\treturn uniqueTribes;\r\n};\r\n"]}
@@ -10,7 +10,7 @@ const deathrattle_spawns_1 = require("./deathrattle-spawns");
10
10
  const computeDeathrattleMultiplier = (board, boardHero, deadEntity, sharedState) => {
11
11
  var _a, _b, _c, _d, _e;
12
12
  const rivendare = !!board.find((entity) => entity.cardId === "BG_FP1_031" ||
13
- entity.cardId === "BG27_518") || ((_a = boardHero.spells) === null || _a === void 0 ? void 0 : _a.includes("BG28_843"));
13
+ entity.cardId === "BG27_518") || ((_a = boardHero.secrets) === null || _a === void 0 ? void 0 : _a.some((e) => e.cardId === "BG28_843"));
14
14
  const goldenRivendare = board.find((entity) => entity.cardId === "TB_BaconUps_055" ||
15
15
  entity.cardId === "BG27_518_G");
16
16
  const titus = board.filter((entity) => entity.cardId === "BG25_354").length;