@firestone-hs/simulate-bgs-battle 1.1.268 → 1.1.271

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.
@@ -9,7 +9,7 @@ export interface BgsPlayerEntity {
9
9
  readonly heroPowerInfo?: number;
10
10
  entityId?: number;
11
11
  questRewards?: readonly string[];
12
- cardsInHand?: BoardEntity[];
12
+ hand?: BoardEntity[];
13
13
  avengeCurrent?: number;
14
14
  avengeDefault?: number;
15
15
  globalInfo?: BgsPlayerGlobalInfo;
@@ -20,4 +20,5 @@ export interface BgsPlayerEntity {
20
20
  export interface BgsPlayerGlobalInfo {
21
21
  EternalKnightsDeadThisGame: number;
22
22
  UndeadAttackBonus: number;
23
+ FrostlingBonus: number;
23
24
  }
@@ -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\tentityId?: number;\r\n\tquestRewards?: readonly string[];\r\n\tcardsInHand?: 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}\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\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\tentityId?: number;\r\n\tquestRewards?: readonly string[];\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\tFrostlingBonus: number;\r\n}\r\n"]}
@@ -89,7 +89,8 @@ const simulateBattle = (battleInput, cards, cardsData) => {
89
89
  simulationResult.lost++;
90
90
  simulationResult.damageLost += battleResult.damageDealt;
91
91
  outcomes[battleResult.damageDealt] = ((_d = outcomes[battleResult.damageDealt]) !== null && _d !== void 0 ? _d : 0) + 1;
92
- if (battleInput.playerBoard.player.hpLeft && battleResult.damageDealt >= battleInput.playerBoard.player.hpLeft) {
92
+ if (battleInput.playerBoard.player.hpLeft &&
93
+ battleResult.damageDealt >= battleInput.playerBoard.player.hpLeft) {
93
94
  simulationResult.lostLethal++;
94
95
  }
95
96
  }
@@ -107,7 +108,9 @@ const simulateBattle = (battleInput, cards, cardsData) => {
107
108
  simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;
108
109
  simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;
109
110
  simulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;
110
- simulationResult.averageDamageLost = simulationResult.lost ? simulationResult.damageLost / simulationResult.lost : 0;
111
+ simulationResult.averageDamageLost = simulationResult.lost
112
+ ? simulationResult.damageLost / simulationResult.lost
113
+ : 0;
111
114
  if (simulationResult.averageDamageWon > 0 && simulationResult.averageDamageWon < playerInfo.player.tavernTier) {
112
115
  console.warn('average damage won issue', simulationResult, playerInfo);
113
116
  }
@@ -152,6 +155,7 @@ exports.validEnchantments = [
152
155
  "BG22_HERO_001p_t4_s",
153
156
  ];
154
157
  const cleanEnchantmentsForEntity = (enchantments, entityIds) => {
155
- return enchantments.filter((enchant) => entityIds.indexOf(enchant.originEntityId) !== -1 || exports.validEnchantments.indexOf(enchant.cardId) !== -1);
158
+ return enchantments.filter((enchant) => entityIds.indexOf(enchant.originEntityId) !== -1 ||
159
+ exports.validEnchantments.indexOf(enchant.cardId) !== -1);
156
160
  };
157
161
  //# sourceMappingURL=simulate-bgs-battle.js.map
@@ -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,8CAA2F;AAC3F,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,CAAC,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,WAAW,mCAAI,MAAA,WAAW,CAAC,OAAO,0CAAE,WAAW,CAAC,CAAC;IAC/F,MAAM,gBAAgB,GAAG,IAAA,sBAAc,EAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAEvE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AClE,OAAO,YAAY,CAAC,MAAM,CACzB,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,IAAI,yBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAiB,CAAC,KAAK,CAAC,CAAC,CAC5H,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 { setImplicitData, 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(battleInput.gameState?.validTribes ?? battleInput.options?.validTribes);\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 = (battleInput: BgsBattleInfo, cards: AllCardsService, cardsData: CardsData): 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((entity) => ({ ...addImpliedMechanics(entity), friendly: true } as BoardEntity));\r\n\tconst opponentBoard = opponentInfo.board.map((entity) => ({ ...addImpliedMechanics(entity), friendly: false } as BoardEntity));\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\tsetImplicitData(playerBoard, cardsData);\r\n\tsetImplicitData(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: playerInfo.player,\r\n\t\t},\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: opponentInfo.player,\r\n\t\t},\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 (battleInput.playerBoard.player.hpLeft && battleResult.damageDealt >= battleInput.playerBoard.player.hpLeft) {\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 ? simulationResult.damageLost / simulationResult.lost : 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_ReplicatingMenaceEnchantmentBattlegrounds,\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];\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) => entityIds.indexOf(enchant.originEntityId) !== -1 || validEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n\t);\r\n};\r\n"]}
1
+ {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAGxE,mDAA+C;AAE/C,8CAA2F;AAC3F,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,CAAC,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,WAAW,mCAAI,MAAA,WAAW,CAAC,OAAO,0CAAE,WAAW,CAAC,CAAC;IAC/F,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,W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C;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 { setImplicitData, 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(battleInput.gameState?.validTribes ?? battleInput.options?.validTribes);\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), friendly: true } as BoardEntity),\r\n\t);\r\n\tconst opponentBoard = opponentInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity), friendly: false } 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\tsetImplicitData(playerBoard, cardsData);\r\n\tsetImplicitData(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: playerInfo.player,\r\n\t\t},\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: opponentInfo.player,\r\n\t\t},\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_ReplicatingMenaceEnchantmentBattlegrounds,\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];\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"]}
@@ -128,6 +128,13 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
128
128
  (0, utils_1.modifyHealth)(spawned, statsBonusKnight, board, allCards);
129
129
  (0, utils_1.afterStatsUpdate)(spawned, board, allCards);
130
130
  break;
131
+ case "BG26_537":
132
+ case "BG26_537_G":
133
+ const multiplierFrostling = spawned.cardId === "BG26_537_G" ? 2 : 1;
134
+ const statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;
135
+ (0, utils_1.modifyAttack)(spawned, statsBonusFrostling, board, allCards);
136
+ (0, utils_1.afterStatsUpdate)(spawned, board, allCards);
137
+ break;
131
138
  case "BG25_013":
132
139
  case "BG25_013_G":
133
140
  const multiplierGnoll = spawned.cardId === "BG25_013_G" ? 2 : 1;
@@ -1 +1 @@
1
- {"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAOkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACjB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,WAAW,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE;QACtD,IAAA,wBAAgB,EAAC,KAAK,EAAE,S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-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tif (otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t\tspawned.attack += 3;\r\n\t}\r\n\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.AllWillBurnBattlegrounds:\r\n\t\t\tspawned.attack += 3;\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SproutItOutBattlegrounds:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TinkerBattlegrounds:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 5;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\tswitch (spawnedCardId) {\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t\t// Other\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\te.attack +=\r\n\t\t\t\t\t\tspawned.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.KathranatirBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.EternalKnight:\r\n\t\t\tcase CardIds.EternalKnightBattlegrounds:\r\n\t\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnightBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RotHideGnoll:\r\n\t\t\tcase CardIds.RotHideGnollBattlegrounds:\r\n\t\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnollBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusGnoll =\r\n\t\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelpsBattlegrounds);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack +=\r\n\t\t\t\t\tentity.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.KathranatirBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot:\r\n\t\t\tcase CardIds.DeflectOBotBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBotBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal:\r\n\t\t\tcase CardIds.BigfernalBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BigfernalBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear:\r\n\t\t\tcase CardIds.MamaBearBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBearBattlegrounds ? 10 : 5;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader:\r\n\t\t\tcase CardIds.PackLeaderBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeaderBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocTidecallerLegacy:\r\n\t\t\tcase CardIds.MurlocTidecallerBattlegrounds:\r\n\t\t\t\tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount =\r\n\t\t\t\t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Swampstriker:\r\n\t\t\tcase CardIds.SwampstrikerBattlegrounds:\r\n\t\t\t\tconst multiplier2 = entity.cardId === CardIds.SwampstrikerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper:\r\n\t\t\tcase CardIds.FelstomperBattlegrounds:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.FelstomperBattlegrounds ? 6 : 3;\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones:\r\n\t\t\tcase CardIds.XyloBonesBattlegrounds:\r\n\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBonesBattlegrounds ? 6 : 3;\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\tmodifyHealth(e, xylobonesBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod:\r\n\t\t\tcase CardIds.OctosariWrapGodBattlegrounds:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGodBattlegrounds ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma:\r\n\t\t\tcase CardIds.BananaSlammaBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlammaBattlegrounds ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
1
+ {"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAOkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAo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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACnF,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC;oBACjD,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC;iBACjD;gBACD,MAAM;YAGP;gBACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,qBAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;oBACpD,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,IAAA,wBAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;iBACrD;gBACD,MAAM;SACP;KACD;AACF,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 { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tif (otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t\tspawned.attack += 3;\r\n\t}\r\n\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.AllWillBurnBattlegrounds:\r\n\t\t\tspawned.attack += 3;\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SproutItOutBattlegrounds:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TinkerBattlegrounds:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 5;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\tswitch (spawnedCardId) {\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t\t// Other\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\te.attack +=\r\n\t\t\t\t\t\tspawned.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.KathranatirBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.EternalKnight:\r\n\t\t\tcase CardIds.EternalKnightBattlegrounds:\r\n\t\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnightBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FlourishingFrostling:\r\n\t\t\tcase CardIds.FlourishingFrostlingBattlegrounds:\r\n\t\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostlingBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusFrostling, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RotHideGnoll:\r\n\t\t\tcase CardIds.RotHideGnollBattlegrounds:\r\n\t\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnollBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusGnoll =\r\n\t\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelpsBattlegrounds);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack +=\r\n\t\t\t\t\tentity.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.KathranatirBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot:\r\n\t\t\tcase CardIds.DeflectOBotBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBotBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal:\r\n\t\t\tcase CardIds.BigfernalBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BigfernalBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear:\r\n\t\t\tcase CardIds.MamaBearBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBearBattlegrounds ? 10 : 5;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader:\r\n\t\t\tcase CardIds.PackLeaderBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeaderBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocTidecallerLegacy:\r\n\t\t\tcase CardIds.MurlocTidecallerBattlegrounds:\r\n\t\t\t\tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount =\r\n\t\t\t\t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Swampstriker:\r\n\t\t\tcase CardIds.SwampstrikerBattlegrounds:\r\n\t\t\t\tconst multiplier2 = entity.cardId === CardIds.SwampstrikerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper:\r\n\t\t\tcase CardIds.FelstomperBattlegrounds:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.FelstomperBattlegrounds ? 6 : 3;\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones:\r\n\t\t\tcase CardIds.XyloBonesBattlegrounds:\r\n\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBonesBattlegrounds ? 6 : 3;\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\tmodifyHealth(e, xylobonesBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod:\r\n\t\t\tcase CardIds.OctosariWrapGodBattlegrounds:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGodBattlegrounds ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma:\r\n\t\t\tcase CardIds.BananaSlammaBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlammaBattlegrounds ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
@@ -92,11 +92,12 @@ const setImplicitDataHero = (hero, cardsData, isPlayer) => {
92
92
  }
93
93
  hero.questRewards = [...((_b = hero.questRewards) !== null && _b !== void 0 ? _b : []), hero.heroPowerId].filter((e) => !!e);
94
94
  hero.entityId = (_c = hero.entityId) !== null && _c !== void 0 ? _c : (isPlayer ? 999999998 : 999999999);
95
- hero.cardsInHand = (_d = hero.cardsInHand) !== null && _d !== void 0 ? _d : [];
95
+ hero.hand = (_d = hero.hand) !== null && _d !== void 0 ? _d : [];
96
96
  if (!hero.globalInfo) {
97
97
  hero.globalInfo = {
98
98
  EternalKnightsDeadThisGame: 0,
99
99
  UndeadAttackBonus: 0,
100
+ FrostlingBonus: 0,
100
101
  };
101
102
  }
102
103
  };
@@ -1 +1 @@
1
- {"version":3,"file":"auras.js","sourceRoot":"","sources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EAAE,CAAC;SACpB,CAAC;KACF;AACF,CAAC,CAAC;AArBW,QAAA,mBAAmB,uBAqB9B;AAEK,MAAM,oBAAoB,GAAG,CAAC,KAAoB,EAAE,UAAyB,EAAQ,EAAE;IAE7F,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC1C;IACD,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACnE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;QAC1C,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe, normalizeCardIdForSkin } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n): void => {\r\n\tif (\r\n\t\tboardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ||\r\n\t\totherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds\r\n\t) {\r\n\t\tconst bonus =\r\n\t\t\t(boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0) +\r\n\t\t\t(otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0);\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.AllWillBurn_AllWillBurnEnchantmentBattlegrounds,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += bonus;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 5;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacyBattlegrounds,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantmentBattlegrounds,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacyBattlegrounds,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantmentBattlegrounds,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBirdBattlegrounds,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.KathranatirBattlegrounds,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t8,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrakeBattlegrounds,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t16,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitData = (board: BoardEntity[], cardsData: CardsData): void => {\r\n\tfor (const entity of board) {\r\n\t\tentity.cardId = normalizeCardIdForSkin(entity.cardId);\r\n\t\tentity.maxHealth = entity.health;\r\n\t\tconst avengeValue = cardsData.avengeValue(entity.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\tentity.avengeCurrent = avengeValue;\r\n\t\t\tentity.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tentity.immuneWhenAttackCharges = 0;\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\thero.cardsInHand = hero.cardsInHand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {\r\n\t\t\tEternalKnightsDeadThisGame: 0,\r\n\t\t\tUndeadAttackBonus: 0,\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n"]}
1
+ {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAAmE;AAE5D,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACvC,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEK,MAAM,uBAAuB,GAAG,CACtC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EACnB,EAAE;IACT,IACC,SAAS,CAAC,WAAW,0BAA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CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACnE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;QAC1C,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe, normalizeCardIdForSkin } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n): void => {\r\n\tif (\r\n\t\tboardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ||\r\n\t\totherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds\r\n\t) {\r\n\t\tconst bonus =\r\n\t\t\t(boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0) +\r\n\t\t\t(otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0);\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.AllWillBurn_AllWillBurnEnchantmentBattlegrounds,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += bonus;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 5;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacyBattlegrounds,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantmentBattlegrounds,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacyBattlegrounds,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantmentBattlegrounds,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBirdBattlegrounds,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.KathranatirBattlegrounds,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t8,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrakeBattlegrounds,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t16,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitData = (board: BoardEntity[], cardsData: CardsData): void => {\r\n\tfor (const entity of board) {\r\n\t\tentity.cardId = normalizeCardIdForSkin(entity.cardId);\r\n\t\tentity.maxHealth = entity.health;\r\n\t\tconst avengeValue = cardsData.avengeValue(entity.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\tentity.avengeCurrent = avengeValue;\r\n\t\t\tentity.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tentity.immuneWhenAttackCharges = 0;\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\thero.hand = hero.hand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {\r\n\t\t\tEternalKnightsDeadThisGame: 0,\r\n\t\t\tUndeadAttackBonus: 0,\r\n\t\t\tFrostlingBonus: 0,\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"avenge.js","sourceRoot":"","sources":["../../src/simulation/avenge.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAI9E,6CAA+C;AAC/C,oCAWkB;AAClB,qCAAiF;AACjF,6DAAqD;AAI9C,MAAM,kBAAkB,GAAG,CACjC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACxB,SAAoB,EACb,EAAE;IACT,MAAM,mCAAmC,GAAkB,EAAE,CAAC;IAC9D,oBAAoB,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,mBAAmB;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,KAAK,CAAC,CAAC;SAGzD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACd,IAAI,CAAC,CAAC,MAAM,eAAiC,IAAI,CAAC,CAAC,MAAM,iBAAmC,EAAE;YAC7F,OAAO,CAAC,CAAC,CAAC;SACV;QACD,IAAI,CAAC,CAAC,MAAM,eAAiC,IAAI,CAAC,CAAC,MAAM,iBAAmC,EAAE;YAC7F,OAAO,CAAC,CAAC;SACT;QACD,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EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;iBAC/D,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACnB,IAAA,oBAAY,EAAC,MAAM,EAAE,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACvD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACxD,SAAS,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;YACJ,MAAM;QACP;YACC,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACtC,IAAA,oBAAY,EAAC,MAAM,EAAE,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACvD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACxD,SAAS,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;YACH,MAAM;KACP;IACD,uBAAuB,CAAC,aAAa,GAAG,uBAAuB,CAAC,aAAa,CAAC;AAC/E,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\tgetRandomMinionWithHighestHealth,\r\n\tgrantRandomStats,\r\n\tgrantStatsToMinionsOfEachType,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n} from '../utils';\r\nimport { dealDamageToEnemy, getNeighbours, performEntitySpawns } from './attack';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const applyAvengeEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst candidatesEntitiesSpawnedFromAvenge: BoardEntity[] = [];\r\n\tupdateAvengeCounters(boardWithDeadEntity, boardWithDeadEntityHero);\r\n\tconst avengers = boardWithDeadEntity\r\n\t\t.filter((e) => !!e.avengeDefault && e.avengeCurrent === 0)\r\n\t\t// Get Tony to be processed first, because of the \"when turned golden, the minion ignores the death for the avenge counter\"\r\n\t\t// behavior\r\n\t\t.sort((a, b) => {\r\n\t\t\tif (a.cardId === CardIds.TonyTwoTusk_BG21_031 || a.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\r\n\t\t\t\treturn -1;\r\n\t\t\t}\r\n\t\t\tif (b.cardId === CardIds.TonyTwoTusk_BG21_031 || b.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t});\r\n\tfor (const avenger of avengers) {\r\n\t\thandleAvenge(\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\tdeadEntity,\r\n\t\t\tdeadEntityIndexFromRight,\r\n\t\t\tavenger,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t}\r\n\t// console.log('updating dead entity avenge counter', boardWithDeadEntityHero.avengeCurrent, stringifySimpleCard(deadEntity, allCards));\r\n\tconst heroAvenger = !!boardWithDeadEntityHero.avengeDefault && boardWithDeadEntityHero.avengeCurrent === 0;\r\n\tif (heroAvenger) {\r\n\t\t// console.log(\r\n\t\t// \t'Hero is an avenger',\r\n\t\t// \tboardWithDeadEntityHero.avengeCurrent,\r\n\t\t// \tboardWithDeadEntityHero.avengeDefault,\r\n\t\t// \tboardWithDeadEntityHero.heroPowerId,\r\n\t\t// );\r\n\t\thandleHeroAvenge(\r\n\t\t\tdeadEntity,\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tcandidatesEntitiesSpawnedFromAvenge,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n};\r\n\r\nconst updateAvengeCounters = (board: readonly BoardEntity[], boardWithDeadEntityHero: BgsPlayerEntity) => {\r\n\tfor (const entity of board) {\r\n\t\tif (!!entity.avengeDefault) {\r\n\t\t\tentity.avengeCurrent -= 1;\r\n\t\t}\r\n\t}\r\n\tif (!!boardWithDeadEntityHero.avengeDefault) {\r\n\t\tboardWithDeadEntityHero.avengeCurrent -= 1;\r\n\t}\r\n};\r\n\r\nconst handleAvenge = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tavenger: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n\tallCards: AllCardsService,\r\n) => {\r\n\t// Don't forget to update the avenge data in cards-data\r\n\tswitch (avenger.cardId) {\r\n\t\tcase CardIds.BirdBuddy:\r\n\t\t\taddStatsToBoard(avenger, boardWithDeadEntity, 1, 1, allCards, spectator, 'BEAST');\r\n\t\t\tbreak;\r\n\t\tcase CardIds.BirdBuddyBattlegrounds:\r\n\t\t\taddStatsToBoard(avenger, boardWithDeadEntity, 2, 2, allCards, spectator, 'BEAST');\r\n\t\t\tbreak;\r\n\t\tcase CardIds.BuddingGreenthumb:\r\n\t\tcase CardIds.BuddingGreenthumbBattlegrounds:\r\n\t\t\tconst neighbours = getNeighbours(boardWithDeadEntity, avenger);\r\n\t\t\tneighbours.forEach((entity) => {\r\n\t\t\t\tmodifyAttack(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tavenger.cardId === CardIds.BuddingGreenthumbBattlegrounds ? 4 : 2,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t);\r\n\t\t\t\tmodifyHealth(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tavenger.cardId === CardIds.BuddingGreenthumbBattlegrounds ? 2 : 1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t);\r\n\t\t\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(avenger, entity, boardWithDeadEntity);\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\t// case CardIds.FrostwolfLieutenant:\r\n\t\t// case CardIds.FrostwolfLieutenantBattlegrounds:\r\n\t\t// \taddStatsToBoard(\r\n\t\t// \t\tavenger,\r\n\t\t// \t\tboardWithDeadEntity,\r\n\t\t// \t\tavenger.cardId === CardIds.FrostwolfLieutenantBattlegrounds ? 2 : 1,\r\n\t\t// \t\t0,\r\n\t\t// \t\tallCards,\r\n\t\t// \t\tspectator,\r\n\t\t// \t);\r\n\t\t// \tbreak;\r\n\t\tcase CardIds.StormpikeLieutenant:\r\n\t\tcase CardIds.StormpikeLieutenantBattlegrounds:\r\n\t\t\taddStatsToBoard(\r\n\t\t\t\tavenger,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t0,\r\n\t\t\t\tavenger.cardId === CardIds.StormpikeLieutenantBattlegrounds ? 2 : 1,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\tconst target1 = grantRandomStats(avenger, boardWithDeadEntity, 6, 6, Race.BEAST, true, allCards, spectator);\r\n\t\t\tif (!!target1) {\r\n\t\t\t\tspectator.registerPowerTarget(avenger, target1, boardWithDeadEntity);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\tconst target2 = grantRandomStats(\r\n\t\t\t\tavenger,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t12,\r\n\t\t\t\t12,\r\n\t\t\t\tRace.BEAST,\r\n\t\t\t\ttrue,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t\tif (!!target2) {\r\n\t\t\t\tspectator.registerPowerTarget(avenger, target2, boardWithDeadEntity);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.ImpatientDoomsayer:\r\n\t\tcase CardIds.ImpatientDoomsayerBattlegrounds:\r\n\t\t\tconst doomsayerCardsToAddQuantity = avenger.cardId === CardIds.ImpatientDoomsayerBattlegrounds ? 2 : 1;\r\n\t\t\tconst doomsayerCardsToAdd = [];\r\n\t\t\tfor (let i = 0; i < doomsayerCardsToAddQuantity; i++) {\r\n\t\t\t\tdoomsayerCardsToAdd.push(pickRandom(cardsData.demonSpawns));\r\n\t\t\t}\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, doomsayerCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.PashmarTheVengeful:\r\n\t\tcase CardIds.PashmarTheVengefulBattlegrounds:\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, [null]);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\tconst nestmatronToAddQuantity = avenger.cardId === CardIds.WitchwingNestmatron_BG21_038_G ? 2 : 1;\r\n\t\t\tconst nestmatronCardsToAdd = [];\r\n\t\t\tfor (let i = 0; i < nestmatronToAddQuantity; i++) {\r\n\t\t\t\tnestmatronCardsToAdd.push(pickRandom(cardsData.brannEpicEggSpawns));\r\n\t\t\t}\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, nestmatronCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Thorncaller:\r\n\t\tcase CardIds.ThorncallerBattlegrounds:\r\n\t\t\tconst thorncallerToAddQuantity = avenger.cardId === CardIds.ThorncallerBattlegrounds ? 2 : 1;\r\n\t\t\tconst thorncallerCardsToAdd = Array(thorncallerToAddQuantity).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, thorncallerCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Sisefin_BG21_009:\r\n\t\tcase CardIds.Sisefin_BG21_009_G:\r\n\t\t\tconst poisonousIterations = avenger.cardId === CardIds.Sisefin_BG21_009_G ? 2 : 1;\r\n\t\t\tfor (let i = 0; i < poisonousIterations; i++) {\r\n\t\t\t\tconst validTargets = boardWithDeadEntity.filter((e) => !e.poisonous && !e.venomous);\r\n\t\t\t\tconst murloc = getRandomAliveMinion(validTargets, Race.MURLOC, allCards);\r\n\t\t\t\tif (murloc) {\r\n\t\t\t\t\tmurloc.venomous = true;\r\n\t\t\t\t\tspectator.registerPowerTarget(avenger, murloc, boardWithDeadEntity);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.ScrapScraper:\r\n\t\tcase CardIds.ScrapScraperBattlegrounds:\r\n\t\t\tconst scraperToAddQuantity = avenger.cardId === CardIds.ScrapScraperBattlegrounds ? 2 : 1;\r\n\t\t\tconst scraperCardsToAdd = [];\r\n\t\t\tfor (let i = 0; i < scraperToAddQuantity; i++) {\r\n\t\t\t\tscraperCardsToAdd.push(pickRandom(cardsData.scrapScraperSpawns));\r\n\t\t\t}\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, scraperCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MechanoTank_BG21_023:\r\n\t\t\t// This can be null if the avenge triggers when the last enemy minion dies as well\r\n\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\r\n\t\t\tspectator.registerPowerTarget(avenger, target, otherBoard);\r\n\t\t\tdealDamageToEnemy(\r\n\t\t\t\ttarget,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tavenger,\r\n\t\t\t\t5,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MechanoTank_BG21_023_G:\r\n\t\t\tfor (let i = 0; i < 2; i++) {\r\n\t\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\r\n\t\t\t\tspectator.registerPowerTarget(avenger, target, otherBoard);\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tavenger,\r\n\t\t\t\t\t5,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TonyTwoTusk_BG21_031:\r\n\t\t\tconst nonGoldenMinions = boardWithDeadEntity\r\n\t\t\t\t.filter((e) => e.entityId !== avenger.entityId)\r\n\t\t\t\t.filter((e) => {\r\n\t\t\t\t\tconst ref = allCards.getCard(e.cardId);\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t!!ref.battlegroundsPremiumDbfId && !!allCards.getCardFromDbfId(ref.battlegroundsPremiumDbfId).id\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\tconst pirate = getRandomAliveMinion(nonGoldenMinions, Race.PIRATE, allCards);\r\n\t\t\tif (pirate) {\r\n\t\t\t\tmakeMinionGolden(pirate, avenger, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TonyTwoTusk_BG21_031_G:\r\n\t\t\tfor (let i = 0; i < 2; i++) {\r\n\t\t\t\tconst nonGoldenMinions = boardWithDeadEntity.filter((e) => {\r\n\t\t\t\t\tconst ref = allCards.getCard(e.cardId);\r\n\t\t\t\t\treturn !!ref.battlegroundsPremiumDbfId;\r\n\t\t\t\t});\r\n\t\t\t\tconst pirate = getRandomAliveMinion(nonGoldenMinions, Race.PIRATE, allCards);\r\n\t\t\t\tif (pirate) {\r\n\t\t\t\t\tmakeMinionGolden(pirate, avenger, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.GhoulOfTheFeast:\r\n\t\tcase CardIds.GhoulOfTheFeastBattlegrounds:\r\n\t\t\tconst ghoulMultiplier = avenger.cardId === CardIds.GhoulOfTheFeastBattlegrounds ? 2 : 1;\r\n\t\t\tgrantStatsToMinionsOfEachType(avenger, boardWithDeadEntity, ghoulMultiplier * 3, 0, allCards, spectator);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Bristlebach:\r\n\t\tcase CardIds.BristlebachBattlegrounds:\r\n\t\t\tconst bristlebachMultiplier = avenger.cardId === CardIds.BristlebachBattlegrounds ? 2 : 1;\r\n\t\t\t// TODO: use current blood gem buff values\r\n\t\t\tfor (let i = 0; i < bristlebachMultiplier * 2; i++) {\r\n\t\t\t\taddStatsToBoard(avenger, boardWithDeadEntity, 1, 1, allCards, spectator, Race[Race.QUILBOAR]);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.HungeringAbomination:\r\n\t\tcase CardIds.HungeringAbominationBattlegrounds:\r\n\t\t\tconst abominationMultiplier = avenger.cardId === CardIds.HungeringAbominationBattlegrounds ? 2 : 1;\r\n\t\t\tmodifyAttack(avenger, abominationMultiplier * 1, boardWithDeadEntity, allCards);\r\n\t\t\tmodifyHealth(avenger, abominationMultiplier * 1, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(avenger, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(avenger, avenger, boardWithDeadEntity);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.ShadowyConstruct:\r\n\t\tcase CardIds.ShadowyConstructBattlegrounds:\r\n\t\t\tconst neighboursShadowy = getNeighbours(boardWithDeadEntity, null, deadEntityIndexFromRight);\r\n\t\t\tconst multiplierShadowy = avenger.cardId === CardIds.ShadowyConstructBattlegrounds ? 2 : 1;\r\n\t\t\tneighboursShadowy.forEach((neighbour) => {\r\n\t\t\t\tmodifyAttack(neighbour, multiplierShadowy * 1, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(neighbour, multiplierShadowy * 1, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(neighbour, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(avenger, neighbour, boardWithDeadEntity);\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n\tavenger.avengeCurrent = avenger.avengeDefault;\r\n};\r\n\r\nconst handleHeroAvenge = (\r\n\tdeadEntity: BoardEntity,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tcandidatesEntitiesSpawnedFromAvenge: BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n\tallCards: AllCardsService,\r\n) => {\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\t// Not affected by Khadgar\r\n\tswitch (boardWithDeadEntityHero?.heroPowerId) {\r\n\t\tcase CardIds.Onyxia_Broodmother:\r\n\t\t\tcandidatesEntitiesSpawnedFromAvenge.push(\r\n\t\t\t\t...spawnEntities(\r\n\t\t\t\t\tCardIds.Onyxia_OnyxianWhelpToken,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t),\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.VanndarStormpike_LeadTheStormpikes:\r\n\t\t\tboardWithDeadEntity\r\n\t\t\t\t.filter((entity) => !entity.definitelyDead && entity.health > 0)\r\n\t\t\t\t.forEach((entity) => {\r\n\t\t\t\t\tmodifyHealth(entity, 1, boardWithDeadEntity, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(boardWithDeadEntityHero, entity, boardWithDeadEntity);\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Drekthar_LeadTheFrostwolves:\r\n\t\t\tboardWithDeadEntity.forEach((entity) => {\r\n\t\t\t\tmodifyAttack(entity, 1, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(boardWithDeadEntityHero, entity, boardWithDeadEntity);\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n\tboardWithDeadEntityHero.avengeCurrent = boardWithDeadEntityHero.avengeDefault;\r\n};\r\n"]}
1
+ {"version":3,"file":"avenge.js","sourceRoot":"","sources":["../../src/simulation/avenge.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAI9E,6CAA+C;AAC/C,oCAWkB;AAClB,qCAAiF;AACjF,6DAAqD;AAI9C,MAAM,kBAAkB,GAAG,CACjC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACxB,SAAoB,EACb,EAAE;IACT,MAAM,mCAAmC,GAAkB,EAAE,CAAC;IAC9D,oBAAoB,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,mBAAmB;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,KAAK,CAAC,CAAC;SAGzD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACd,IAAI,CAAC,CAAC,MAAM,eAAiC,IAAI,C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ACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,CAAC,QAAQ,EACnB,KAAK,EACL,KAAK,EACL,KAAK,CACL,CACD,CAAC;YACF,MAAM;QACP;YACC,mBAAmB;iBACjB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;iBAC/D,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACnB,IAAA,oBAAY,EAAC,MAAM,EAAE,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACvD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACxD,SAAS,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;YACJ,MAAM;QACP;YACC,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACtC,IAAA,oBAAY,EAAC,MAAM,EAAE,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACvD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;gBACxD,SAAS,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;YACrF,CAAC,CAAC,CAAC;YACH,MAAM;KACP;IACD,uBAAuB,CAAC,aAAa,GAAG,uBAAuB,CAAC,aAAa,CAAC;AAC/E,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\tgetRandomMinionWithHighestHealth,\r\n\tgrantRandomStats,\r\n\tgrantStatsToMinionsOfEachType,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n} from '../utils';\r\nimport { dealDamageToEnemy, getNeighbours, performEntitySpawns } from './attack';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const applyAvengeEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst candidatesEntitiesSpawnedFromAvenge: BoardEntity[] = [];\r\n\tupdateAvengeCounters(boardWithDeadEntity, boardWithDeadEntityHero);\r\n\tconst avengers = boardWithDeadEntity\r\n\t\t.filter((e) => !!e.avengeDefault && e.avengeCurrent === 0)\r\n\t\t// Get Tony to be processed first, because of the \"when turned golden, the minion ignores the death for the avenge counter\"\r\n\t\t// behavior\r\n\t\t.sort((a, b) => {\r\n\t\t\tif (a.cardId === CardIds.TonyTwoTusk_BG21_031 || a.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\r\n\t\t\t\treturn -1;\r\n\t\t\t}\r\n\t\t\tif (b.cardId === CardIds.TonyTwoTusk_BG21_031 || b.cardId === CardIds.TonyTwoTusk_BG21_031_G) {\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t});\r\n\tfor (const avenger of avengers) {\r\n\t\thandleAvenge(\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\tdeadEntity,\r\n\t\t\tdeadEntityIndexFromRight,\r\n\t\t\tavenger,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t}\r\n\t// console.log('updating dead entity avenge counter', boardWithDeadEntityHero.avengeCurrent, stringifySimpleCard(deadEntity, allCards));\r\n\tconst heroAvenger = !!boardWithDeadEntityHero.avengeDefault && boardWithDeadEntityHero.avengeCurrent === 0;\r\n\tif (heroAvenger) {\r\n\t\t// console.log(\r\n\t\t// \t'Hero is an avenger',\r\n\t\t// \tboardWithDeadEntityHero.avengeCurrent,\r\n\t\t// \tboardWithDeadEntityHero.avengeDefault,\r\n\t\t// \tboardWithDeadEntityHero.heroPowerId,\r\n\t\t// );\r\n\t\thandleHeroAvenge(\r\n\t\t\tdeadEntity,\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tcandidatesEntitiesSpawnedFromAvenge,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tcandidatesEntitiesSpawnedFromAvenge,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n};\r\n\r\nconst updateAvengeCounters = (board: readonly BoardEntity[], boardWithDeadEntityHero: BgsPlayerEntity) => {\r\n\tfor (const entity of board) {\r\n\t\tif (!!entity.avengeDefault) {\r\n\t\t\tentity.avengeCurrent -= 1;\r\n\t\t}\r\n\t}\r\n\tif (!!boardWithDeadEntityHero.avengeDefault) {\r\n\t\tboardWithDeadEntityHero.avengeCurrent -= 1;\r\n\t}\r\n};\r\n\r\nconst handleAvenge = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tavenger: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n\tallCards: AllCardsService,\r\n) => {\r\n\t// Don't forget to update the avenge data in cards-data\r\n\tswitch (avenger.cardId) {\r\n\t\tcase CardIds.BirdBuddy:\r\n\t\t\taddStatsToBoard(avenger, boardWithDeadEntity, 1, 1, allCards, spectator, 'BEAST');\r\n\t\t\tbreak;\r\n\t\tcase CardIds.BirdBuddyBattlegrounds:\r\n\t\t\taddStatsToBoard(avenger, boardWithDeadEntity, 2, 2, allCards, spectator, 'BEAST');\r\n\t\t\tbreak;\r\n\t\tcase CardIds.BuddingGreenthumb:\r\n\t\tcase CardIds.BuddingGreenthumbBattlegrounds:\r\n\t\t\tconst neighbours = getNeighbours(boardWithDeadEntity, avenger);\r\n\t\t\tneighbours.forEach((entity) => {\r\n\t\t\t\tmodifyAttack(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tavenger.cardId === CardIds.BuddingGreenthumbBattlegrounds ? 4 : 2,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t);\r\n\t\t\t\tmodifyHealth(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tavenger.cardId === CardIds.BuddingGreenthumbBattlegrounds ? 2 : 1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t);\r\n\t\t\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(avenger, entity, boardWithDeadEntity);\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\t// case CardIds.FrostwolfLieutenant:\r\n\t\t// case CardIds.FrostwolfLieutenantBattlegrounds:\r\n\t\t// \taddStatsToBoard(\r\n\t\t// \t\tavenger,\r\n\t\t// \t\tboardWithDeadEntity,\r\n\t\t// \t\tavenger.cardId === CardIds.FrostwolfLieutenantBattlegrounds ? 2 : 1,\r\n\t\t// \t\t0,\r\n\t\t// \t\tallCards,\r\n\t\t// \t\tspectator,\r\n\t\t// \t);\r\n\t\t// \tbreak;\r\n\t\tcase CardIds.StormpikeLieutenant:\r\n\t\tcase CardIds.StormpikeLieutenantBattlegrounds:\r\n\t\t\taddStatsToBoard(\r\n\t\t\t\tavenger,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t0,\r\n\t\t\t\tavenger.cardId === CardIds.StormpikeLieutenantBattlegrounds ? 2 : 1,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\tconst target1 = grantRandomStats(avenger, boardWithDeadEntity, 6, 6, Race.BEAST, true, allCards, spectator);\r\n\t\t\tif (!!target1) {\r\n\t\t\t\tspectator.registerPowerTarget(avenger, target1, boardWithDeadEntity);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\tconst target2 = grantRandomStats(\r\n\t\t\t\tavenger,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t12,\r\n\t\t\t\t12,\r\n\t\t\t\tRace.BEAST,\r\n\t\t\t\ttrue,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t\tif (!!target2) {\r\n\t\t\t\tspectator.registerPowerTarget(avenger, target2, boardWithDeadEntity);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.ImpatientDoomsayer:\r\n\t\tcase CardIds.ImpatientDoomsayerBattlegrounds:\r\n\t\t\tconst doomsayerCardsToAddQuantity = avenger.cardId === CardIds.ImpatientDoomsayerBattlegrounds ? 2 : 1;\r\n\t\t\tconst doomsayerCardsToAdd = [];\r\n\t\t\tfor (let i = 0; i < doomsayerCardsToAddQuantity; i++) {\r\n\t\t\t\tdoomsayerCardsToAdd.push(pickRandom(cardsData.demonSpawns));\r\n\t\t\t}\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, doomsayerCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.PashmarTheVengeful:\r\n\t\tcase CardIds.PashmarTheVengefulBattlegrounds:\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, [null]);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\tconst nestmatronToAddQuantity = avenger.cardId === CardIds.WitchwingNestmatron_BG21_038_G ? 2 : 1;\r\n\t\t\tconst nestmatronCardsToAdd = [];\r\n\t\t\tfor (let i = 0; i < nestmatronToAddQuantity; i++) {\r\n\t\t\t\tnestmatronCardsToAdd.push(pickRandom(cardsData.brannEpicEggSpawns));\r\n\t\t\t}\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, nestmatronCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Thorncaller:\r\n\t\tcase CardIds.ThorncallerBattlegrounds:\r\n\t\t\tconst thorncallerToAddQuantity = avenger.cardId === CardIds.ThorncallerBattlegrounds ? 2 : 1;\r\n\t\t\tconst thorncallerCardsToAdd = Array(thorncallerToAddQuantity).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, thorncallerCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Sisefin_BG21_009:\r\n\t\tcase CardIds.Sisefin_BG21_009_G:\r\n\t\t\tconst poisonousIterations = avenger.cardId === CardIds.Sisefin_BG21_009_G ? 2 : 1;\r\n\t\t\tfor (let i = 0; i < poisonousIterations; i++) {\r\n\t\t\t\tconst validTargets = boardWithDeadEntity.filter((e) => !e.poisonous && !e.venomous);\r\n\t\t\t\tconst murloc = getRandomAliveMinion(validTargets, Race.MURLOC, allCards);\r\n\t\t\t\tif (murloc) {\r\n\t\t\t\t\tmurloc.venomous = true;\r\n\t\t\t\t\tspectator.registerPowerTarget(avenger, murloc, boardWithDeadEntity);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.ScrapScraper:\r\n\t\tcase CardIds.ScrapScraperBattlegrounds:\r\n\t\t\tconst scraperToAddQuantity = avenger.cardId === CardIds.ScrapScraperBattlegrounds ? 2 : 1;\r\n\t\t\tconst scraperCardsToAdd = [];\r\n\t\t\tfor (let i = 0; i < scraperToAddQuantity; i++) {\r\n\t\t\t\tscraperCardsToAdd.push(pickRandom(cardsData.scrapScraperSpawns));\r\n\t\t\t}\r\n\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, scraperCardsToAdd);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MechanoTank_BG21_023:\r\n\t\t\t// This can be null if the avenge triggers when the last enemy minion dies as well\r\n\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\r\n\t\t\tspectator.registerPowerTarget(avenger, target, otherBoard);\r\n\t\t\tdealDamageToEnemy(\r\n\t\t\t\ttarget,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tavenger,\r\n\t\t\t\t5,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MechanoTank_BG21_023_G:\r\n\t\t\tfor (let i = 0; i < 2; i++) {\r\n\t\t\t\tconst target = getRandomMinionWithHighestHealth(otherBoard);\r\n\t\t\t\tspectator.registerPowerTarget(avenger, target, otherBoard);\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tavenger,\r\n\t\t\t\t\t5,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TonyTwoTusk_BG21_031:\r\n\t\t\tconst nonGoldenMinions = boardWithDeadEntity\r\n\t\t\t\t.filter((e) => e.entityId !== avenger.entityId)\r\n\t\t\t\t.filter((e) => {\r\n\t\t\t\t\tconst ref = allCards.getCard(e.cardId);\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t!!ref.battlegroundsPremiumDbfId && !!allCards.getCardFromDbfId(ref.battlegroundsPremiumDbfId).id\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\tconst pirate = getRandomAliveMinion(nonGoldenMinions, Race.PIRATE, allCards);\r\n\t\t\tif (pirate) {\r\n\t\t\t\tmakeMinionGolden(pirate, avenger, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TonyTwoTusk_BG21_031_G:\r\n\t\t\tfor (let i = 0; i < 2; i++) {\r\n\t\t\t\tconst nonGoldenMinions = boardWithDeadEntity.filter((e) => {\r\n\t\t\t\t\tconst ref = allCards.getCard(e.cardId);\r\n\t\t\t\t\treturn !!ref.battlegroundsPremiumDbfId;\r\n\t\t\t\t});\r\n\t\t\t\tconst pirate = getRandomAliveMinion(nonGoldenMinions, Race.PIRATE, allCards);\r\n\t\t\t\tif (pirate) {\r\n\t\t\t\t\tmakeMinionGolden(pirate, avenger, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.GhoulOfTheFeast:\r\n\t\tcase CardIds.GhoulOfTheFeastBattlegrounds:\r\n\t\t\tconst ghoulMultiplier = avenger.cardId === CardIds.GhoulOfTheFeastBattlegrounds ? 2 : 1;\r\n\t\t\tgrantStatsToMinionsOfEachType(avenger, boardWithDeadEntity, ghoulMultiplier * 3, 0, allCards, spectator);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Bristlebach:\r\n\t\tcase CardIds.BristlebachBattlegrounds:\r\n\t\t\tconst bristlebachMultiplier = avenger.cardId === CardIds.BristlebachBattlegrounds ? 2 : 1;\r\n\t\t\t// const currentBloodGemBuff\r\n\t\t\t// TODO: use current blood gem buff values\r\n\t\t\tfor (let i = 0; i < bristlebachMultiplier * 2; i++) {\r\n\t\t\t\taddStatsToBoard(avenger, boardWithDeadEntity, 1, 1, allCards, spectator, Race[Race.QUILBOAR]);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.HungeringAbomination:\r\n\t\tcase CardIds.HungeringAbominationBattlegrounds:\r\n\t\t\tconst abominationMultiplier = avenger.cardId === CardIds.HungeringAbominationBattlegrounds ? 2 : 1;\r\n\t\t\tmodifyAttack(avenger, abominationMultiplier * 1, boardWithDeadEntity, allCards);\r\n\t\t\tmodifyHealth(avenger, abominationMultiplier * 1, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(avenger, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(avenger, avenger, boardWithDeadEntity);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.ShadowyConstruct:\r\n\t\tcase CardIds.ShadowyConstructBattlegrounds:\r\n\t\t\tconst neighboursShadowy = getNeighbours(boardWithDeadEntity, null, deadEntityIndexFromRight);\r\n\t\t\tconst multiplierShadowy = avenger.cardId === CardIds.ShadowyConstructBattlegrounds ? 2 : 1;\r\n\t\t\tneighboursShadowy.forEach((neighbour) => {\r\n\t\t\t\tmodifyAttack(neighbour, multiplierShadowy * 1, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(neighbour, multiplierShadowy * 1, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(neighbour, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(avenger, neighbour, boardWithDeadEntity);\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n\tavenger.avengeCurrent = avenger.avengeDefault;\r\n};\r\n\r\nconst handleHeroAvenge = (\r\n\tdeadEntity: BoardEntity,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tcandidatesEntitiesSpawnedFromAvenge: BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n\tallCards: AllCardsService,\r\n) => {\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\t// Not affected by Khadgar\r\n\tswitch (boardWithDeadEntityHero?.heroPowerId) {\r\n\t\tcase CardIds.Onyxia_Broodmother:\r\n\t\t\tcandidatesEntitiesSpawnedFromAvenge.push(\r\n\t\t\t\t...spawnEntities(\r\n\t\t\t\t\tCardIds.Onyxia_OnyxianWhelpToken,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t),\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.VanndarStormpike_LeadTheStormpikes:\r\n\t\t\tboardWithDeadEntity\r\n\t\t\t\t.filter((entity) => !entity.definitelyDead && entity.health > 0)\r\n\t\t\t\t.forEach((entity) => {\r\n\t\t\t\t\tmodifyHealth(entity, 1, boardWithDeadEntity, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(boardWithDeadEntityHero, entity, boardWithDeadEntity);\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Drekthar_LeadTheFrostwolves:\r\n\t\t\tboardWithDeadEntity.forEach((entity) => {\r\n\t\t\t\tmodifyAttack(entity, 1, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(boardWithDeadEntityHero, entity, boardWithDeadEntity);\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n\tboardWithDeadEntityHero.avengeCurrent = boardWithDeadEntityHero.avengeDefault;\r\n};\r\n"]}
@@ -244,6 +244,13 @@ const handleDeathrattleEffects = (boardWithDeadEntity, boardWithDeadEntityHero,
244
244
  }
245
245
  }
246
246
  break;
247
+ case "BG26_360":
248
+ case "BG26_360_G":
249
+ const statsScourfin = deadEntityCardId === "BG26_360_G" ? 10 : 5;
250
+ for (let i = 0; i < multiplier; i++) {
251
+ (0, utils_2.grantRandomStats)(deadEntity, boardWithDeadEntityHero.hand, statsScourfin, statsScourfin, null, true, allCards, spectator);
252
+ }
253
+ break;
247
254
  case "BG_RLK_957":
248
255
  for (let i = 0; i < multiplier; i++) {
249
256
  (0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, 2, 1, allCards, spectator, reference_data_1.Race[reference_data_1.Race.UNDEAD]);