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

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.
@@ -18,7 +18,7 @@ export interface BgsPlayerEntity {
18
18
  rapidReanimationIndexFromRight?: number;
19
19
  }
20
20
  export interface BgsPlayerGlobalInfo {
21
- EternalKnightsDeadThisGame: number;
22
- UndeadAttackBonus: number;
23
- FrostlingBonus: number;
21
+ EternalKnightsDeadThisGame?: number;
22
+ UndeadAttackBonus?: number;
23
+ FrostlingBonus?: number;
24
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\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"]}
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"]}
@@ -255,7 +255,7 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
255
255
  case "BGS_021":
256
256
  case "TB_BaconUps_090":
257
257
  if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, allCards)) {
258
- const statsBonus = entity.cardId === "TB_BaconUps_090" ? 10 : 5;
258
+ const statsBonus = entity.cardId === "TB_BaconUps_090" ? 8 : 4;
259
259
  (0, utils_1.modifyAttack)(spawned, statsBonus, board, allCards);
260
260
  (0, utils_1.modifyHealth)(spawned, statsBonus, board, allCards);
261
261
  (0, utils_1.afterStatsUpdate)(entity, board, allCards);
@@ -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,IA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O,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"]}
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,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;KAC3G;IACD,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC,C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AAC,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 ? 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(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"]}
@@ -79,7 +79,17 @@ const handleDeathrattleEffects = (boardWithDeadEntity, boardWithDeadEntityHero,
79
79
  case "BGS_040":
80
80
  case "TB_BaconUps_154":
81
81
  for (let i = 0; i < multiplier; i++) {
82
- (0, utils_2.grantAllDivineShield)(boardWithDeadEntity, 'DRAGON', allCards);
82
+ const nadinaMultiplier = deadEntityCardId === "TB_BaconUps_154" ? 6 : 3;
83
+ for (let j = 0; j < nadinaMultiplier; j++) {
84
+ const validTargets = boardWithDeadEntity
85
+ .filter((e) => (0, utils_2.hasCorrectTribe)(e, reference_data_1.Race.DRAGON, allCards))
86
+ .filter((entity) => !entity.divineShield);
87
+ const target = (0, utils_1.pickRandom)(validTargets);
88
+ if (target) {
89
+ (0, utils_2.updateDivineShield)(target, boardWithDeadEntity, true, allCards);
90
+ spectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);
91
+ }
92
+ }
83
93
  }
84
94
  break;
85
95
  case "BG_OG_256":
@@ -1 +1 @@
1
- {"version":3,"file":"deathrattle-effects.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-effects.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,6CAA6F;AAC7F,oCAiBkB;AAClB,qCAA0F;AAC1F,6DAAqD;AAI9C,MAAM,4BAA4B,GAAG,CAAC,KAAoB,EAAE,UAAuB,EAAU,EAAE;;IACrG,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC;IAC9F,M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,CAC1C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,cAA6B,IAAI,MAAM,CAAC,MAAM,kBAA8B,CACrG,CAAC;IACF,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,sBAAoC,CAAC,CAAC;IACjH,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC3B,IAAA,oBAAY,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACxD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACjC,IAAA,oBAAY,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACxD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { 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 { groupByFunction, pickMultipleRandomDifferent, pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgrantAllDivineShield,\r\n\tgrantRandomAttack,\r\n\tgrantRandomDivineShield,\r\n\tgrantRandomHealth,\r\n\tgrantRandomStats,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tisFish,\r\n\tisGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { dealDamageToEnemy, dealDamageToRandomEnemy, findNearestEnemies } 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 computeDeathrattleMultiplier = (board: BoardEntity[], deadEntity: BoardEntity): number => {\r\n\tconst rivendare = board.find((entity) => entity.cardId === CardIds.BaronRivendare_BG_FP1_031);\r\n\tconst goldenRivendare = board.find((entity) => entity.cardId === CardIds.BaronRivendareBattlegrounds);\r\n\tconst titus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare).length;\r\n\tconst goldenTitus = board.filter((entity) => entity.cardId === CardIds.TitusRivendareBattlegrounds).length;\r\n\t// The multiplication / addition order here is irrelelvant, since Baron has been removed once Titus was introduced\r\n\tconst scourgeMultiplier = deadEntity.additionalCards?.includes(CardIds.ScourgeTroll) ? 2 : 1;\r\n\tconst multiplier = scourgeMultiplier * ((goldenRivendare ? 3 : rivendare ? 2 : 1) + titus + 2 * goldenTitus);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const handleDeathrattleEffects = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\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 multiplier = computeDeathrattleMultiplier(boardWithDeadEntity, deadEntity);\r\n\t// We do it on a case by case basis so that we deal all the damage in one go for instance\r\n\t// and avoid proccing deathrattle spawns between the times the damage triggers\r\n\r\n\tconst cardIds = [deadEntity.cardId, ...(deadEntity.additionalCards ?? [])];\r\n\tfor (const deadEntityCardId of cardIds) {\r\n\t\tswitch (deadEntityCardId) {\r\n\t\t\tcase CardIds.SelflessHero_BG_OG_221:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SelflessHeroBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OperaticBelcher:\r\n\t\t\tcase CardIds.OperaticBelcherBattlegrounds:\r\n\t\t\t\tconst belcherMultiplier = deadEntityCardId === CardIds.OperaticBelcherBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < belcherMultiplier; j++) {\r\n\t\t\t\t\t\tconst possibleBelcherTargets = boardWithDeadEntity\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.venomous)\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.poisonous)\r\n\t\t\t\t\t\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead)\r\n\t\t\t\t\t\t\t.filter((entity) => hasCorrectTribe(entity, Race.MURLOC, allCards));\r\n\t\t\t\t\t\tif (possibleBelcherTargets.length > 0) {\r\n\t\t\t\t\t\t\tconst chosen = pickRandom(possibleBelcherTargets);\r\n\t\t\t\t\t\t\tchosen.venomous = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, chosen, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpiritOfAirBattlegrounds_TB_BaconShop_HERO_76_Buddy:\r\n\t\t\tcase CardIds.SpiritOfAirBattlegrounds_TB_BaconShop_HERO_76_Buddy_G:\r\n\t\t\t\tconst iterations =\r\n\t\t\t\t\tdeadEntityCardId === CardIds.SpiritOfAirBattlegrounds_TB_BaconShop_HERO_76_Buddy_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < iterations; j++) {\r\n\t\t\t\t\t\tlet validTargets = boardWithDeadEntity.filter((entity) => !entity.divineShield);\r\n\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.taunt);\r\n\t\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.windfury);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconst target = pickRandom(validTargets);\r\n\t\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\t\tif (!target.divineShield) {\r\n\t\t\t\t\t\t\t\tupdateDivineShield(target, boardWithDeadEntity, true, allCards);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttarget.taunt = true;\r\n\t\t\t\t\t\t\ttarget.windfury = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NadinaTheRed:\r\n\t\t\tcase CardIds.NadinaTheRedBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantAllDivineShield(boardWithDeadEntity, 'DRAGON', allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzoth_BG_OG_256:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 1, multiplier * 1, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzothBattlegrounds:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 2, multiplier * 2, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolf:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 5,\r\n\t\t\t\t\tmultiplier * 5,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolfBattlegrounds:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 10,\r\n\t\t\t\t\tmultiplier * 10,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 2,\r\n\t\t\t\t\tmultiplier * 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgleBattlegrounds:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 4,\r\n\t\t\t\t\tmultiplier * 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServant:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServantBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTrickster:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTricksterBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Leapfrogger:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, false, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LeapfroggerBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, true, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ScarletSkull:\r\n\t\t\tcase CardIds.ScarletSkullBattlegrounds:\r\n\t\t\t\tconst scarletMultiplier = deadEntityCardId === CardIds.ScarletSkullBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tscarletMultiplier * 1,\r\n\t\t\t\t\t\tscarletMultiplier * 2,\r\n\t\t\t\t\t\tRace.UNDEAD,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnubarakNerubianKing:\r\n\t\t\tcase CardIds.AnubarakNerubianKingBattlegrounds:\r\n\t\t\t\tconst anubarakMultiplier = deadEntityCardId === CardIds.AnubarakNerubianKingBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst attackBonus = anubarakMultiplier * 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tattackBonus,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\tRace[Race.UNDEAD],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tboardWithDeadEntityHero.globalInfo.UndeadAttackBonus += attackBonus;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\t// \t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t// \t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t// \tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t// \t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t// \t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t// \t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t// \t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t// \t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t// \t\t\tdealDamageToRandomEnemy(\r\n\t\t\t// \t\t\t\totherBoard,\r\n\t\t\t// \t\t\t\totherBoardHero,\r\n\t\t\t// \t\t\t\tdeadEntity,\r\n\t\t\t// \t\t\t\t3,\r\n\t\t\t// \t\t\t\tboardWithDeadEntity,\r\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t// \t\t\t\tallCards,\r\n\t\t\t// \t\t\t\tcardsData,\r\n\t\t\t// \t\t\t\tsharedState,\r\n\t\t\t// \t\t\t\tspectator,\r\n\t\t\t// \t\t\t);\r\n\t\t\t// \t\t}\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\tcase CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy_G:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst squirrelDamage =\r\n\t\t\t\t\tdeadEntity.cardId === CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy_G\r\n\t\t\t\t\t\t? 4\r\n\t\t\t\t\t\t: 2;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t\t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t\t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t\t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tsquirrelDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// for (let i = 0; i < multiplier; i++) {\r\n\t\t\t// \tdealDamageToRandomEnemy(\r\n\t\t\t// \t\totherBoard,\r\n\t\t\t// \t\totherBoardHero,\r\n\t\t\t// \t\tdeadEntity,\r\n\t\t\t// \t\t4,\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\t// break;\r\n\t\t\tcase CardIds.KaboomBot_BG_BOT_606:\r\n\t\t\tcase CardIds.KaboomBotBattlegrounds:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst kaboomLoops = deadEntity.cardId === CardIds.KaboomBotBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < kaboomLoops; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t4,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DrBoombox:\r\n\t\t\tcase CardIds.DrBoomboxBattlegrounds:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst boomboxDamage = deadEntity.cardId === CardIds.DrBoomboxBattlegrounds ? 14 : 7;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\t// The nearest enemies use the full board info\r\n\t\t\t\t\t// const boardIncludingDeadEntityAtCorrectIndex = boardWithDeadEntity.splice(\r\n\t\t\t\t\t// \tdeadEntityIndexFromRight,\r\n\t\t\t\t\t// \t0,\r\n\t\t\t\t\t// \tdeadEntity,\r\n\t\t\t\t\t// );\r\n\t\t\t\t\tconst targets = findNearestEnemies(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\tdeadEntityIndexFromRight,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t2,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t);\r\n\t\t\t\t\ttargets.forEach((target) => {\r\n\t\t\t\t\t\t// console.debug('dealing damage to', stringifySimpleCard(target));\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboomboxDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UnstableGhoul_BG_FP1_024:\r\n\t\t\tcase CardIds.UnstableGhoulBattlegrounds:\r\n\t\t\t\tconst damage = deadEntityCardId === CardIds.UnstableGhoulBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdamage,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TunnelBlaster_BG_DAL_775:\r\n\t\t\tcase CardIds.TunnelBlasterBattlegrounds:\r\n\t\t\t\tconst loops = deadEntityCardId === CardIds.TunnelBlasterBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < loops; j++) {\r\n\t\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t3,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LeeroyTheReckless:\r\n\t\t\tcase CardIds.LeeroyTheRecklessBattlegrounds:\r\n\t\t\t\tif (deadEntity.lastAffectedByEntity) {\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity.definitelyDead = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RadioStar:\r\n\t\t\tcase CardIds.RadioStarBattlegrounds:\r\n\t\t\t\tconst radioQuantity = deadEntityCardId === CardIds.RadioStarBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst radioEntities = Array(radioQuantity).fill(deadEntity.lastAffectedByEntity);\r\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, radioEntities);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiverBattlegrounds_TB_BaconShop_HERO_41_Buddy:\r\n\t\t\t\tfor (let i = 0; i < Math.min(1, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(rightMostMinion, deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiverBattlegrounds_TB_BaconShop_HERO_41_Buddy_G:\r\n\t\t\t\tfor (let i = 0; i < Math.min(2, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(rightMostMinion, deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Scourfin:\r\n\t\t\tcase CardIds.ScourfinBattlegrounds:\r\n\t\t\t\tconst statsScourfin = deadEntityCardId === CardIds.ScourfinBattlegrounds ? 10 : 5;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero.hand,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\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.Banshee_BG_RLK_957:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 2, 1, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LostSpirit_BG26_GIL_513:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 1, 0, allCards, spectator, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TickingAbomination_BG_ICC_099:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (const entity of boardWithDeadEntity) {\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t5,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t// It's important to first copy the enchantments, otherwise you could end up\r\n\t// in an infinite loop - since new enchants are added after each step\r\n\r\n\tlet enchantments: { cardId: string; originEntityId?: number; repeats?: number }[] = [\r\n\t\t...(deadEntity.enchantments ?? []),\r\n\t\t...(deadEntity.rememberedDeathrattles ?? []),\r\n\t].sort((a, b) => a.timing - b.timing);\r\n\t// In some cases it's possible that there are way too many enchantments because of the frog\r\n\t// In that case, we make a trade-off and don't trigger the \"on stats change\" trigger as\r\n\t// often as we should, so that we can have the stats themselves correct\r\n\t// We don't want to lump everything together, as it skews the stats when there are a lot of buffs\r\n\t// Instead, we build groups\r\n\tconst maxNumberOfGroups = 12;\r\n\tconst enchantmentGroups = groupByFunction((enchantment: any) => enchantment.cardId)(enchantments);\r\n\tenchantments = Object.keys(enchantmentGroups).flatMap((cardId) => {\r\n\t\tlet repeatsToApply = enchantmentGroups[cardId].map((e) => e.repeats || 1).reduce((a, b) => a + b, 0);\r\n\r\n\t\t// Frogs include the multiplers here directly\r\n\t\tif (\r\n\t\t\t[\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t].includes(cardId as CardIds)\r\n\t\t) {\r\n\t\t\trepeatsToApply = repeatsToApply * multiplier;\r\n\t\t}\r\n\r\n\t\tconst results = [];\r\n\t\tconst repeatsPerBuff = Math.max(1, Math.floor(repeatsToApply / maxNumberOfGroups));\r\n\t\tlet repeatsDone = 0;\r\n\t\twhile (repeatsDone < repeatsToApply) {\r\n\t\t\tconst repeats = Math.min(repeatsPerBuff, repeatsToApply - repeatsDone);\r\n\t\t\tresults.push({\r\n\t\t\t\tcardId: cardId,\r\n\t\t\t\trepeats: repeats,\r\n\t\t\t\ttiming: Math.min(...enchantmentGroups[cardId].map((e) => e.timing)),\r\n\t\t\t});\r\n\t\t\trepeatsDone += repeatsPerBuff;\r\n\t\t}\r\n\t\treturn results;\r\n\t});\r\n\tfor (const enchantment of enchantments) {\r\n\t\tswitch (enchantment.cardId) {\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e:\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge:\r\n\t\t\t\tapplyLeapFroggerEffect(\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tenchantment.cardId === CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tenchantment.repeats || 1,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EarthRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyEarthInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FireRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyFireInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.WaterRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyWaterInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LightningRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLightningInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t// const playerCopy = boardWithDeadEntity.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// const oppCopy = otherBoard.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// console.log('player board', boardWithDeadEntity.length, playerCopy.length, playerCopy.map((e) => JSON.stringify(e)).join('\\n'));\r\n\t// console.log('opp board', JSON.stringify(oppCopy));\r\n};\r\n\r\nexport const applyLightningInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\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\t// Because the golden version doubles all the remembered effects\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst targets = pickMultipleRandomDifferent(otherBoard, 5);\r\n\t\tfor (const target of targets) {\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\tdeadEntity,\r\n\t\t\t\t1,\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}\r\n\t}\r\n};\r\n\r\nexport const applyWaterInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[boardWithDeadEntity.length - 1];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyHealth(target, 3, boardWithDeadEntity, allCards);\r\n\t\t\ttarget.taunt = true;\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyFireInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[0];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyAttack(target, target.attack, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyEarthInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst minionsGrantedDeathrattle: BoardEntity[] = pickMultipleRandomDifferent(boardWithDeadEntity, 4);\r\n\t\tminionsGrantedDeathrattle.forEach((minion) => {\r\n\t\t\tminion.enchantments.push({\r\n\t\t\t\tcardId: CardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\toriginEntityId: deadEntity?.entityId,\r\n\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, minion, boardWithDeadEntity);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nconst applyLeapFroggerEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst buffed = grantRandomStats(\r\n\t\tdeadEntity,\r\n\t\tboardWithDeadEntity,\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tRace.BEAST,\r\n\t\tfalse,\r\n\t\tallCards,\r\n\t\tspectator,\r\n\t);\r\n\tif (buffed) {\r\n\t\tbuffed.enchantments = buffed.enchantments ?? [];\r\n\t\tbuffed.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge\r\n\t\t\t\t: CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t});\r\n\t\t// Don't register power effect here, since it's already done in the random stats\r\n\t\t// spectator.registerPowerTarget(deadEntity, buffed, boardWithDeadEntity);\r\n\t\t// console.log('applyLeapFroggerEffect', stringifySimpleCard(deadEntity), stringifySimpleCard(buffed));\r\n\t}\r\n};\r\n\r\nexport const applyMinionDeathEffect = (\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\t// console.log('applying minion death effect', stringifySimpleCard(deadEntity, allCards));\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.BEAST)) {\r\n\t\tapplyScavengingHyenaEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.DEMON)) {\r\n\t\tapplySoulJugglerEffect(\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.MECH)) {\r\n\t\tapplyJunkbotEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, Race.MURLOC, allCards)) {\r\n\t\tremoveOldMurkEyeAttack(boardWithDeadEntity, allCards);\r\n\t\tremoveOldMurkEyeAttack(otherBoard, allCards);\r\n\t}\r\n\tif (deadEntity.taunt) {\r\n\t\tapplyBristlemaneScrapsmithEffect(boardWithDeadEntity, boardWithDeadEntityHero, allCards, spectator);\r\n\t}\r\n\tif (deadEntity.cardId === CardIds.EternalKnight || deadEntity.cardId === CardIds.EternalKnightBattlegrounds) {\r\n\t\tapplyEternalKnightEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\r\n\t// Putricide-only\r\n\tboardWithDeadEntity\r\n\t\t.filter((e) => e.additionalCards?.includes(CardIds.FlesheatingGhoulLegacy_BG26_tt_004))\r\n\t\t.forEach((e) => {\r\n\t\t\tmodifyAttack(e, 1, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(e, boardWithDeadEntity, allCards);\r\n\t\t});\r\n\r\n\tapplyRotHideGnollEffect(boardWithDeadEntity, allCards, spectator);\r\n\r\n\t// Overkill\r\n\tif (deadEntity.health < 0 && deadEntity.lastAffectedByEntity?.attacking) {\r\n\t\tif (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_BGS_032) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t3,\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);\r\n\t\t\t}\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlameBattlegrounds) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t6,\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);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental && deadEntity.lastAffectedByEntity.attacking) {\r\n\t\t// \t// } else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental) {\r\n\t\t// \t// console.log('applying WildfireElemental effect', stringifySimple(boardWithDeadEntity, allCards));\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \t// Prevent propagation of the effect\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\t// \tif (neighbours.length > 0) {\r\n\t\t// \t\tconst randomTarget = neighbours[Math.floor(Math.random() * neighbours.length)];\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\trandomTarget,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\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);\r\n\t\t// \t}\r\n\t\t// } else if (\r\n\t\t// \tdeadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElementalBattlegrounds &&\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking\r\n\t\t// ) {\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \tneighbours.forEach((neighbour) =>\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\tneighbour,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\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),\r\n\t\t// \t);\r\n\t\t// }\r\n\t\telse if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\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\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehornBattlegrounds) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntTokenBattlegrounds,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\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\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_BGS_080) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliathBattlegrounds) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const dealDamageToAllMinions = (\r\n\tboard1: BoardEntity[],\r\n\tboard1Hero: BgsPlayerEntity,\r\n\tboard2: BoardEntity[],\r\n\tboard2Hero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity,\r\n\tdamageDealt: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (board1.length === 0 && board2.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\tfor (let i = 0; i < board1.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard1[i],\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tfor (let i = 0; i < board2.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard2[i],\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst applySoulJugglerEffect = (\r\n\tboardWithJugglers: BoardEntity[],\r\n\tboardWithJugglersHero: BgsPlayerEntity,\r\n\tboardToAttack: BoardEntity[],\r\n\tboardToAttackHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (boardWithJugglers.length === 0 && boardToAttack.length === 0) {\r\n\t\treturn;\r\n\t\t// return [boardWithJugglers, boardToAttack];\r\n\t}\r\n\tconst jugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler);\r\n\tfor (const juggler of jugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tconst goldenJugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJugglerBattlegrounds);\r\n\tfor (const juggler of goldenJugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\t// processMinionDeath(\r\n\t// \tboardWithJugglers,\r\n\t// \tboardWithJugglersHero,\r\n\t// \tboardToAttack,\r\n\t// \tboardToAttackHero,\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 applyScavengingHyenaEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\t// const copy = [...board];\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.ScavengingHyenaLegacy_BG_EX1_531) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.ScavengingHyenaLegacyBattlegrounds) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyEternalKnightEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.EternalKnight || board[i].cardId === CardIds.EternalKnightBattlegrounds) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.EternalKnightBattlegrounds ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tmodifyHealth(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyRotHideGnollEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.RotHideGnoll || board[i].cardId === CardIds.RotHideGnollBattlegrounds) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.RotHideGnollBattlegrounds ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyBristlemaneScrapsmithEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardPlayerEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith ||\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmithBattlegrounds\r\n\t\t) {\r\n\t\t\tconst cardsToAdd = Array(CardIds.BristlemaneScrapsmithBattlegrounds ? 2 : 1).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardPlayerEntity, board, allCards, spectator, cardsToAdd);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyJunkbotEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.Junkbot) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.JunkbotBattlegrounds) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 4, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\n// const applyQirajiHarbringerEffect = (board: BoardEntity[], deadEntityIndex: number, allCards: AllCardsService): void => {\r\n// \tconst qiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger);\r\n// \tconst goldenQiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbingerBattlegrounds);\r\n// \tconst neighbours = getNeighbours(board, null, deadEntityIndex);\r\n\r\n// \t// TODO: if reactivated, properly apply buffs one by one, instead of all together\r\n\r\n// \tneighbours.forEach((entity) => {\r\n// \t\tmodifyAttack(entity, 2 * qiraji.length + 4 * goldenQiraji.length, board, allCards);\r\n// \t\tmodifyHealth(entity, 2 * qiraji.length + 4 * goldenQiraji.length);\r\n// \t\tafterStatsUpdate(entity, board, allCards);\r\n// \t});\r\n// };\r\n\r\nexport const applyMonstrosity = (\r\n\tmonstrosity: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tboardWithDeadEntities: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tfor (const deadEntity of deadEntities) {\r\n\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\tif (monstrosity.cardId === CardIds.MonstrosityBattlegrounds) {\r\n\t\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const rememberDeathrattles = (\r\n\tfish: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tconst validDeathrattles = deadEntities\r\n\t\t.filter((entity) => cardsData.validDeathrattles.includes(entity.cardId) || isFish(entity))\r\n\t\t.map((entity) => ({ cardId: entity.cardId, repeats: 1, timing: sharedState.currentEntityId++ }));\r\n\tconst validEnchantments = deadEntities\r\n\t\t.filter((entity) => entity.enchantments?.length)\r\n\t\t.map((entity) => entity.enchantments)\r\n\t\t.reduce((a, b) => a.concat(b), [])\r\n\t\t.flatMap((enchantment) => ({\r\n\t\t\tcardId: enchantment.cardId,\r\n\t\t\trepeats: enchantment.repeats ?? 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t}))\r\n\t\t.filter((enchantment) =>\r\n\t\t\t[\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantmentBattlegrounds,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\t\t\t\tCardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\tCardIds.FireInvocation_ElementFireEnchantment,\r\n\t\t\t\tCardIds.WaterInvocation_ElementWaterEnchantment,\r\n\t\t\t\tCardIds.LightningInvocation,\r\n\t\t\t].includes(enchantment.cardId as CardIds),\r\n\t\t);\r\n\t// Multiple fish\r\n\tconst deadEntityRememberedDeathrattles =\r\n\t\tdeadEntities.filter((e) => !!e.rememberedDeathrattles?.length).flatMap((e) => e.rememberedDeathrattles) ?? [];\r\n\tconst newDeathrattles = [...validDeathrattles, ...validEnchantments, ...deadEntityRememberedDeathrattles];\r\n\t// Order is important - the DR are triggered in the ordered the minions have died\r\n\t// console.log(\r\n\t// \t'remembering deathrattle',\r\n\t// \t'\\n',\r\n\t// \tstringifySimpleCard(fish, allCards),\r\n\t// \t'\\n',\r\n\t// \tstringifySimple(deadEntities, allCards),\r\n\t// \t'\\n',\r\n\t// \tfish.rememberedDeathrattles,\r\n\t// );\r\n\tif (isGolden(fish.cardId, allCards)) {\r\n\t\t// https://stackoverflow.com/questions/33305152/how-to-duplicate-elements-in-a-js-array\r\n\t\tconst doubleDr = newDeathrattles.reduce((res, current) => res.concat([current, current]), []);\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...doubleDr];\r\n\t} else {\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...newDeathrattles];\r\n\t}\r\n\t// console.log('remembering deathrattle after', '\\n', fish.rememberedDeathrattles);\r\n};\r\n\r\nconst removeOldMurkEyeAttack = (boardWithDeadEntity: BoardEntity[], allCards: AllCardsService) => {\r\n\tconst murkeyes = boardWithDeadEntity.filter(\r\n\t\t(entity) => entity.cardId === CardIds.OldMurkEyeLegacy || entity.cardId === CardIds.OldMurkEyeVanilla,\r\n\t);\r\n\tconst goldenMurkeyes = boardWithDeadEntity.filter((entity) => entity.cardId === CardIds.OldMurkEyeBattlegrounds);\r\n\tmurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -1, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n\tgoldenMurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -2, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n};\r\n"]}
1
+ {"version":3,"file":"deathrattle-effects.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-effects.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,6CAA6F;AAC7F,oCAgBkB;AAClB,qCAA0F;AAC1F,6DAAqD;AAI9C,MAAM,4BAA4B,GAAG,CAAC,KAAoB,EAAE,UAAuB,EAAU,EAAE;;IACrG,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC;IAC9F,MAAM,eAAe,GAAG,KAAK,CAAC,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EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { 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 { groupByFunction, pickMultipleRandomDifferent, pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgrantRandomAttack,\r\n\tgrantRandomDivineShield,\r\n\tgrantRandomHealth,\r\n\tgrantRandomStats,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tisFish,\r\n\tisGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { dealDamageToEnemy, dealDamageToRandomEnemy, findNearestEnemies } 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 computeDeathrattleMultiplier = (board: BoardEntity[], deadEntity: BoardEntity): number => {\r\n\tconst rivendare = board.find((entity) => entity.cardId === CardIds.BaronRivendare_BG_FP1_031);\r\n\tconst goldenRivendare = board.find((entity) => entity.cardId === CardIds.BaronRivendareBattlegrounds);\r\n\tconst titus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare).length;\r\n\tconst goldenTitus = board.filter((entity) => entity.cardId === CardIds.TitusRivendareBattlegrounds).length;\r\n\t// The multiplication / addition order here is irrelelvant, since Baron has been removed once Titus was introduced\r\n\tconst scourgeMultiplier = deadEntity.additionalCards?.includes(CardIds.ScourgeTroll) ? 2 : 1;\r\n\tconst multiplier = scourgeMultiplier * ((goldenRivendare ? 3 : rivendare ? 2 : 1) + titus + 2 * goldenTitus);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const handleDeathrattleEffects = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\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 multiplier = computeDeathrattleMultiplier(boardWithDeadEntity, deadEntity);\r\n\t// We do it on a case by case basis so that we deal all the damage in one go for instance\r\n\t// and avoid proccing deathrattle spawns between the times the damage triggers\r\n\r\n\tconst cardIds = [deadEntity.cardId, ...(deadEntity.additionalCards ?? [])];\r\n\tfor (const deadEntityCardId of cardIds) {\r\n\t\tswitch (deadEntityCardId) {\r\n\t\t\tcase CardIds.SelflessHero_BG_OG_221:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SelflessHeroBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OperaticBelcher:\r\n\t\t\tcase CardIds.OperaticBelcherBattlegrounds:\r\n\t\t\t\tconst belcherMultiplier = deadEntityCardId === CardIds.OperaticBelcherBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < belcherMultiplier; j++) {\r\n\t\t\t\t\t\tconst possibleBelcherTargets = boardWithDeadEntity\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.venomous)\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.poisonous)\r\n\t\t\t\t\t\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead)\r\n\t\t\t\t\t\t\t.filter((entity) => hasCorrectTribe(entity, Race.MURLOC, allCards));\r\n\t\t\t\t\t\tif (possibleBelcherTargets.length > 0) {\r\n\t\t\t\t\t\t\tconst chosen = pickRandom(possibleBelcherTargets);\r\n\t\t\t\t\t\t\tchosen.venomous = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, chosen, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpiritOfAirBattlegrounds_TB_BaconShop_HERO_76_Buddy:\r\n\t\t\tcase CardIds.SpiritOfAirBattlegrounds_TB_BaconShop_HERO_76_Buddy_G:\r\n\t\t\t\tconst iterations =\r\n\t\t\t\t\tdeadEntityCardId === CardIds.SpiritOfAirBattlegrounds_TB_BaconShop_HERO_76_Buddy_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < iterations; j++) {\r\n\t\t\t\t\t\tlet validTargets = boardWithDeadEntity.filter((entity) => !entity.divineShield);\r\n\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.taunt);\r\n\t\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.windfury);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconst target = pickRandom(validTargets);\r\n\t\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\t\tif (!target.divineShield) {\r\n\t\t\t\t\t\t\t\tupdateDivineShield(target, boardWithDeadEntity, true, allCards);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttarget.taunt = true;\r\n\t\t\t\t\t\t\ttarget.windfury = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NadinaTheRed:\r\n\t\t\tcase CardIds.NadinaTheRedBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst nadinaMultiplier = deadEntityCardId === CardIds.NadinaTheRedBattlegrounds ? 6 : 3;\r\n\t\t\t\t\tfor (let j = 0; j < nadinaMultiplier; j++) {\r\n\t\t\t\t\t\tconst validTargets = boardWithDeadEntity\r\n\t\t\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.divineShield);\r\n\t\t\t\t\t\tconst target = pickRandom(validTargets);\r\n\t\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\t\tupdateDivineShield(target, boardWithDeadEntity, true, allCards);\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzoth_BG_OG_256:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 1, multiplier * 1, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzothBattlegrounds:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 2, multiplier * 2, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolf:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 5,\r\n\t\t\t\t\tmultiplier * 5,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolfBattlegrounds:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 10,\r\n\t\t\t\t\tmultiplier * 10,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 2,\r\n\t\t\t\t\tmultiplier * 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgleBattlegrounds:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 4,\r\n\t\t\t\t\tmultiplier * 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServant:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServantBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTrickster:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTricksterBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Leapfrogger:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, false, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LeapfroggerBattlegrounds:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, true, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ScarletSkull:\r\n\t\t\tcase CardIds.ScarletSkullBattlegrounds:\r\n\t\t\t\tconst scarletMultiplier = deadEntityCardId === CardIds.ScarletSkullBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tscarletMultiplier * 1,\r\n\t\t\t\t\t\tscarletMultiplier * 2,\r\n\t\t\t\t\t\tRace.UNDEAD,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnubarakNerubianKing:\r\n\t\t\tcase CardIds.AnubarakNerubianKingBattlegrounds:\r\n\t\t\t\tconst anubarakMultiplier = deadEntityCardId === CardIds.AnubarakNerubianKingBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst attackBonus = anubarakMultiplier * 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tattackBonus,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\tRace[Race.UNDEAD],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tboardWithDeadEntityHero.globalInfo.UndeadAttackBonus += attackBonus;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\t// \t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t// \t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t// \tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t// \t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t// \t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t// \t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t// \t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t// \t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t// \t\t\tdealDamageToRandomEnemy(\r\n\t\t\t// \t\t\t\totherBoard,\r\n\t\t\t// \t\t\t\totherBoardHero,\r\n\t\t\t// \t\t\t\tdeadEntity,\r\n\t\t\t// \t\t\t\t3,\r\n\t\t\t// \t\t\t\tboardWithDeadEntity,\r\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t// \t\t\t\tallCards,\r\n\t\t\t// \t\t\t\tcardsData,\r\n\t\t\t// \t\t\t\tsharedState,\r\n\t\t\t// \t\t\t\tspectator,\r\n\t\t\t// \t\t\t);\r\n\t\t\t// \t\t}\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\tcase CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy_G:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst squirrelDamage =\r\n\t\t\t\t\tdeadEntity.cardId === CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy_G\r\n\t\t\t\t\t\t? 4\r\n\t\t\t\t\t\t: 2;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t\t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t\t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t\t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tsquirrelDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// for (let i = 0; i < multiplier; i++) {\r\n\t\t\t// \tdealDamageToRandomEnemy(\r\n\t\t\t// \t\totherBoard,\r\n\t\t\t// \t\totherBoardHero,\r\n\t\t\t// \t\tdeadEntity,\r\n\t\t\t// \t\t4,\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\t// break;\r\n\t\t\tcase CardIds.KaboomBot_BG_BOT_606:\r\n\t\t\tcase CardIds.KaboomBotBattlegrounds:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst kaboomLoops = deadEntity.cardId === CardIds.KaboomBotBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < kaboomLoops; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t4,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DrBoombox:\r\n\t\t\tcase CardIds.DrBoomboxBattlegrounds:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst boomboxDamage = deadEntity.cardId === CardIds.DrBoomboxBattlegrounds ? 14 : 7;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\t// The nearest enemies use the full board info\r\n\t\t\t\t\t// const boardIncludingDeadEntityAtCorrectIndex = boardWithDeadEntity.splice(\r\n\t\t\t\t\t// \tdeadEntityIndexFromRight,\r\n\t\t\t\t\t// \t0,\r\n\t\t\t\t\t// \tdeadEntity,\r\n\t\t\t\t\t// );\r\n\t\t\t\t\tconst targets = findNearestEnemies(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\tdeadEntityIndexFromRight,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t2,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t);\r\n\t\t\t\t\ttargets.forEach((target) => {\r\n\t\t\t\t\t\t// console.debug('dealing damage to', stringifySimpleCard(target));\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboomboxDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UnstableGhoul_BG_FP1_024:\r\n\t\t\tcase CardIds.UnstableGhoulBattlegrounds:\r\n\t\t\t\tconst damage = deadEntityCardId === CardIds.UnstableGhoulBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdamage,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TunnelBlaster_BG_DAL_775:\r\n\t\t\tcase CardIds.TunnelBlasterBattlegrounds:\r\n\t\t\t\tconst loops = deadEntityCardId === CardIds.TunnelBlasterBattlegrounds ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < loops; j++) {\r\n\t\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t3,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LeeroyTheReckless:\r\n\t\t\tcase CardIds.LeeroyTheRecklessBattlegrounds:\r\n\t\t\t\tif (deadEntity.lastAffectedByEntity) {\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity.definitelyDead = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RadioStar:\r\n\t\t\tcase CardIds.RadioStarBattlegrounds:\r\n\t\t\t\tconst radioQuantity = deadEntityCardId === CardIds.RadioStarBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst radioEntities = Array(radioQuantity).fill(deadEntity.lastAffectedByEntity);\r\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, radioEntities);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiverBattlegrounds_TB_BaconShop_HERO_41_Buddy:\r\n\t\t\t\tfor (let i = 0; i < Math.min(1, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(rightMostMinion, deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiverBattlegrounds_TB_BaconShop_HERO_41_Buddy_G:\r\n\t\t\t\tfor (let i = 0; i < Math.min(2, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(rightMostMinion, deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Scourfin:\r\n\t\t\tcase CardIds.ScourfinBattlegrounds:\r\n\t\t\t\tconst statsScourfin = deadEntityCardId === CardIds.ScourfinBattlegrounds ? 10 : 5;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero.hand,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\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.Banshee_BG_RLK_957:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 2, 1, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LostSpirit_BG26_GIL_513:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 1, 0, allCards, spectator, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TickingAbomination_BG_ICC_099:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (const entity of boardWithDeadEntity) {\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t5,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t// It's important to first copy the enchantments, otherwise you could end up\r\n\t// in an infinite loop - since new enchants are added after each step\r\n\r\n\tlet enchantments: { cardId: string; originEntityId?: number; repeats?: number }[] = [\r\n\t\t...(deadEntity.enchantments ?? []),\r\n\t\t...(deadEntity.rememberedDeathrattles ?? []),\r\n\t].sort((a, b) => a.timing - b.timing);\r\n\t// In some cases it's possible that there are way too many enchantments because of the frog\r\n\t// In that case, we make a trade-off and don't trigger the \"on stats change\" trigger as\r\n\t// often as we should, so that we can have the stats themselves correct\r\n\t// We don't want to lump everything together, as it skews the stats when there are a lot of buffs\r\n\t// Instead, we build groups\r\n\tconst maxNumberOfGroups = 12;\r\n\tconst enchantmentGroups = groupByFunction((enchantment: any) => enchantment.cardId)(enchantments);\r\n\tenchantments = Object.keys(enchantmentGroups).flatMap((cardId) => {\r\n\t\tlet repeatsToApply = enchantmentGroups[cardId].map((e) => e.repeats || 1).reduce((a, b) => a + b, 0);\r\n\r\n\t\t// Frogs include the multiplers here directly\r\n\t\tif (\r\n\t\t\t[\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t].includes(cardId as CardIds)\r\n\t\t) {\r\n\t\t\trepeatsToApply = repeatsToApply * multiplier;\r\n\t\t}\r\n\r\n\t\tconst results = [];\r\n\t\tconst repeatsPerBuff = Math.max(1, Math.floor(repeatsToApply / maxNumberOfGroups));\r\n\t\tlet repeatsDone = 0;\r\n\t\twhile (repeatsDone < repeatsToApply) {\r\n\t\t\tconst repeats = Math.min(repeatsPerBuff, repeatsToApply - repeatsDone);\r\n\t\t\tresults.push({\r\n\t\t\t\tcardId: cardId,\r\n\t\t\t\trepeats: repeats,\r\n\t\t\t\ttiming: Math.min(...enchantmentGroups[cardId].map((e) => e.timing)),\r\n\t\t\t});\r\n\t\t\trepeatsDone += repeatsPerBuff;\r\n\t\t}\r\n\t\treturn results;\r\n\t});\r\n\tfor (const enchantment of enchantments) {\r\n\t\tswitch (enchantment.cardId) {\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e:\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge:\r\n\t\t\t\tapplyLeapFroggerEffect(\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tenchantment.cardId === CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tenchantment.repeats || 1,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EarthRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyEarthInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FireRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyFireInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.WaterRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyWaterInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LightningRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLightningInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t// const playerCopy = boardWithDeadEntity.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// const oppCopy = otherBoard.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// console.log('player board', boardWithDeadEntity.length, playerCopy.length, playerCopy.map((e) => JSON.stringify(e)).join('\\n'));\r\n\t// console.log('opp board', JSON.stringify(oppCopy));\r\n};\r\n\r\nexport const applyLightningInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\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\t// Because the golden version doubles all the remembered effects\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst targets = pickMultipleRandomDifferent(otherBoard, 5);\r\n\t\tfor (const target of targets) {\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\tdeadEntity,\r\n\t\t\t\t1,\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}\r\n\t}\r\n};\r\n\r\nexport const applyWaterInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[boardWithDeadEntity.length - 1];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyHealth(target, 3, boardWithDeadEntity, allCards);\r\n\t\t\ttarget.taunt = true;\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyFireInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[0];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyAttack(target, target.attack, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyEarthInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptorBattlegrounds ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst minionsGrantedDeathrattle: BoardEntity[] = pickMultipleRandomDifferent(boardWithDeadEntity, 4);\r\n\t\tminionsGrantedDeathrattle.forEach((minion) => {\r\n\t\t\tminion.enchantments.push({\r\n\t\t\t\tcardId: CardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\toriginEntityId: deadEntity?.entityId,\r\n\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, minion, boardWithDeadEntity);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nconst applyLeapFroggerEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst buffed = grantRandomStats(\r\n\t\tdeadEntity,\r\n\t\tboardWithDeadEntity,\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tRace.BEAST,\r\n\t\tfalse,\r\n\t\tallCards,\r\n\t\tspectator,\r\n\t);\r\n\tif (buffed) {\r\n\t\tbuffed.enchantments = buffed.enchantments ?? [];\r\n\t\tbuffed.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge\r\n\t\t\t\t: CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t});\r\n\t\t// Don't register power effect here, since it's already done in the random stats\r\n\t\t// spectator.registerPowerTarget(deadEntity, buffed, boardWithDeadEntity);\r\n\t\t// console.log('applyLeapFroggerEffect', stringifySimpleCard(deadEntity), stringifySimpleCard(buffed));\r\n\t}\r\n};\r\n\r\nexport const applyMinionDeathEffect = (\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\t// console.log('applying minion death effect', stringifySimpleCard(deadEntity, allCards));\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.BEAST)) {\r\n\t\tapplyScavengingHyenaEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.DEMON)) {\r\n\t\tapplySoulJugglerEffect(\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.MECH)) {\r\n\t\tapplyJunkbotEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, Race.MURLOC, allCards)) {\r\n\t\tremoveOldMurkEyeAttack(boardWithDeadEntity, allCards);\r\n\t\tremoveOldMurkEyeAttack(otherBoard, allCards);\r\n\t}\r\n\tif (deadEntity.taunt) {\r\n\t\tapplyBristlemaneScrapsmithEffect(boardWithDeadEntity, boardWithDeadEntityHero, allCards, spectator);\r\n\t}\r\n\tif (deadEntity.cardId === CardIds.EternalKnight || deadEntity.cardId === CardIds.EternalKnightBattlegrounds) {\r\n\t\tapplyEternalKnightEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\r\n\t// Putricide-only\r\n\tboardWithDeadEntity\r\n\t\t.filter((e) => e.additionalCards?.includes(CardIds.FlesheatingGhoulLegacy_BG26_tt_004))\r\n\t\t.forEach((e) => {\r\n\t\t\tmodifyAttack(e, 1, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(e, boardWithDeadEntity, allCards);\r\n\t\t});\r\n\r\n\tapplyRotHideGnollEffect(boardWithDeadEntity, allCards, spectator);\r\n\r\n\t// Overkill\r\n\tif (deadEntity.health < 0 && deadEntity.lastAffectedByEntity?.attacking) {\r\n\t\tif (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_BGS_032) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t3,\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);\r\n\t\t\t}\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlameBattlegrounds) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t6,\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);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental && deadEntity.lastAffectedByEntity.attacking) {\r\n\t\t// \t// } else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental) {\r\n\t\t// \t// console.log('applying WildfireElemental effect', stringifySimple(boardWithDeadEntity, allCards));\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \t// Prevent propagation of the effect\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\t// \tif (neighbours.length > 0) {\r\n\t\t// \t\tconst randomTarget = neighbours[Math.floor(Math.random() * neighbours.length)];\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\trandomTarget,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\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);\r\n\t\t// \t}\r\n\t\t// } else if (\r\n\t\t// \tdeadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElementalBattlegrounds &&\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking\r\n\t\t// ) {\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \tneighbours.forEach((neighbour) =>\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\tneighbour,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\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),\r\n\t\t// \t);\r\n\t\t// }\r\n\t\telse if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\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\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehornBattlegrounds) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntTokenBattlegrounds,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\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\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_BGS_080) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliathBattlegrounds) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const dealDamageToAllMinions = (\r\n\tboard1: BoardEntity[],\r\n\tboard1Hero: BgsPlayerEntity,\r\n\tboard2: BoardEntity[],\r\n\tboard2Hero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity,\r\n\tdamageDealt: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (board1.length === 0 && board2.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\tfor (let i = 0; i < board1.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard1[i],\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tfor (let i = 0; i < board2.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard2[i],\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst applySoulJugglerEffect = (\r\n\tboardWithJugglers: BoardEntity[],\r\n\tboardWithJugglersHero: BgsPlayerEntity,\r\n\tboardToAttack: BoardEntity[],\r\n\tboardToAttackHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (boardWithJugglers.length === 0 && boardToAttack.length === 0) {\r\n\t\treturn;\r\n\t\t// return [boardWithJugglers, boardToAttack];\r\n\t}\r\n\tconst jugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler);\r\n\tfor (const juggler of jugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tconst goldenJugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJugglerBattlegrounds);\r\n\tfor (const juggler of goldenJugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\t// processMinionDeath(\r\n\t// \tboardWithJugglers,\r\n\t// \tboardWithJugglersHero,\r\n\t// \tboardToAttack,\r\n\t// \tboardToAttackHero,\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 applyScavengingHyenaEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\t// const copy = [...board];\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.ScavengingHyenaLegacy_BG_EX1_531) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.ScavengingHyenaLegacyBattlegrounds) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyEternalKnightEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.EternalKnight || board[i].cardId === CardIds.EternalKnightBattlegrounds) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.EternalKnightBattlegrounds ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tmodifyHealth(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyRotHideGnollEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.RotHideGnoll || board[i].cardId === CardIds.RotHideGnollBattlegrounds) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.RotHideGnollBattlegrounds ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyBristlemaneScrapsmithEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardPlayerEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith ||\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmithBattlegrounds\r\n\t\t) {\r\n\t\t\tconst cardsToAdd = Array(CardIds.BristlemaneScrapsmithBattlegrounds ? 2 : 1).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardPlayerEntity, board, allCards, spectator, cardsToAdd);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyJunkbotEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.Junkbot) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.JunkbotBattlegrounds) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 4, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\n// const applyQirajiHarbringerEffect = (board: BoardEntity[], deadEntityIndex: number, allCards: AllCardsService): void => {\r\n// \tconst qiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger);\r\n// \tconst goldenQiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbingerBattlegrounds);\r\n// \tconst neighbours = getNeighbours(board, null, deadEntityIndex);\r\n\r\n// \t// TODO: if reactivated, properly apply buffs one by one, instead of all together\r\n\r\n// \tneighbours.forEach((entity) => {\r\n// \t\tmodifyAttack(entity, 2 * qiraji.length + 4 * goldenQiraji.length, board, allCards);\r\n// \t\tmodifyHealth(entity, 2 * qiraji.length + 4 * goldenQiraji.length);\r\n// \t\tafterStatsUpdate(entity, board, allCards);\r\n// \t});\r\n// };\r\n\r\nexport const applyMonstrosity = (\r\n\tmonstrosity: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tboardWithDeadEntities: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tfor (const deadEntity of deadEntities) {\r\n\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\tif (monstrosity.cardId === CardIds.MonstrosityBattlegrounds) {\r\n\t\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const rememberDeathrattles = (\r\n\tfish: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tconst validDeathrattles = deadEntities\r\n\t\t.filter((entity) => cardsData.validDeathrattles.includes(entity.cardId) || isFish(entity))\r\n\t\t.map((entity) => ({ cardId: entity.cardId, repeats: 1, timing: sharedState.currentEntityId++ }));\r\n\tconst validEnchantments = deadEntities\r\n\t\t.filter((entity) => entity.enchantments?.length)\r\n\t\t.map((entity) => entity.enchantments)\r\n\t\t.reduce((a, b) => a.concat(b), [])\r\n\t\t.flatMap((enchantment) => ({\r\n\t\t\tcardId: enchantment.cardId,\r\n\t\t\trepeats: enchantment.repeats ?? 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t}))\r\n\t\t.filter((enchantment) =>\r\n\t\t\t[\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantmentBattlegrounds,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\t\t\t\tCardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\tCardIds.FireInvocation_ElementFireEnchantment,\r\n\t\t\t\tCardIds.WaterInvocation_ElementWaterEnchantment,\r\n\t\t\t\tCardIds.LightningInvocation,\r\n\t\t\t].includes(enchantment.cardId as CardIds),\r\n\t\t);\r\n\t// Multiple fish\r\n\tconst deadEntityRememberedDeathrattles =\r\n\t\tdeadEntities.filter((e) => !!e.rememberedDeathrattles?.length).flatMap((e) => e.rememberedDeathrattles) ?? [];\r\n\tconst newDeathrattles = [...validDeathrattles, ...validEnchantments, ...deadEntityRememberedDeathrattles];\r\n\t// Order is important - the DR are triggered in the ordered the minions have died\r\n\t// console.log(\r\n\t// \t'remembering deathrattle',\r\n\t// \t'\\n',\r\n\t// \tstringifySimpleCard(fish, allCards),\r\n\t// \t'\\n',\r\n\t// \tstringifySimple(deadEntities, allCards),\r\n\t// \t'\\n',\r\n\t// \tfish.rememberedDeathrattles,\r\n\t// );\r\n\tif (isGolden(fish.cardId, allCards)) {\r\n\t\t// https://stackoverflow.com/questions/33305152/how-to-duplicate-elements-in-a-js-array\r\n\t\tconst doubleDr = newDeathrattles.reduce((res, current) => res.concat([current, current]), []);\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...doubleDr];\r\n\t} else {\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...newDeathrattles];\r\n\t}\r\n\t// console.log('remembering deathrattle after', '\\n', fish.rememberedDeathrattles);\r\n};\r\n\r\nconst removeOldMurkEyeAttack = (boardWithDeadEntity: BoardEntity[], allCards: AllCardsService) => {\r\n\tconst murkeyes = boardWithDeadEntity.filter(\r\n\t\t(entity) => entity.cardId === CardIds.OldMurkEyeLegacy || entity.cardId === CardIds.OldMurkEyeVanilla,\r\n\t);\r\n\tconst goldenMurkeyes = boardWithDeadEntity.filter((entity) => entity.cardId === CardIds.OldMurkEyeBattlegrounds);\r\n\tmurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -1, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n\tgoldenMurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -2, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n};\r\n"]}