@firestone-hs/simulate-bgs-battle 1.1.430 → 1.1.432
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.
|
@@ -293,8 +293,8 @@ const triggerBattlecry = (board, hero, entity, otherBoard, otherHero, gameState)
|
|
|
293
293
|
case "BG25_309_Gt":
|
|
294
294
|
const smolderwingTarget = (0, utils_1.pickRandom)(allMinions.filter((e) => (0, utils_2.hasCorrectTribe)(e, reference_data_1.Race.DRAGON, gameState.allCards)));
|
|
295
295
|
if (!!smolderwingTarget) {
|
|
296
|
-
const targetBoard = board.includes(
|
|
297
|
-
const targetHero = board.includes(
|
|
296
|
+
const targetBoard = board.includes(smolderwingTarget) ? board : otherBoard;
|
|
297
|
+
const targetHero = board.includes(smolderwingTarget) ? hero : otherHero;
|
|
298
298
|
const smolderwingMultiplier = entity.cardId === "BG25_309t" ? 1 : 2;
|
|
299
299
|
const smolderwingStats = 5 * smolderwingMultiplier;
|
|
300
300
|
(0, stats_1.modifyAttack)(smolderwingTarget, smolderwingStats, targetBoard, targetHero, gameState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battlecries.js","sourceRoot":"","sources":["../../src/simulation/battlecries.ts"],"names":[],"mappings":";;;AAAA,iEAAiG;AAGjG,6CAA+C;AAC/C,oCASkB;AAClB,qCAAyC;AACzC,6CAA+C;AAC/C,mDAAiD;AAGjD,mCAAoE;AAE7D,MAAM,0BAA0B,GAAG,CACzC,KAAoB,EACpB,SAA0B,EAC1B,WAAwB,EACf,EAAE;;IACX,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CACvB,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,iBAAwC;QACrD,MAAM,CAAC,MAAM,eAAsC,CACpD,CAAC;IACF,MAAM,cAAc,GAAG,MAAA,SAAS,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM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AM,CAAC,IAAI,gBAAgB,EAAE;wBACjC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;qBAEjD;oBACD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;oBACrB,KAAK,GAAG,IAAI,CAAC;oBAEb,CAAC,GAAG,CAAC,CAAC;iBACN;aACD;SAED;KACD;IAED,YAAY,CAAC,IAAI,CAChB,GAAG,uBAAuB;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAI,CAAC,qBAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACvB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,qBAAI,CAAC,CAAC,CAAC,CAAC,CAC7B,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, CardType, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\taddStatsToBoard,\r\n\tbuildSingleBoardEntity,\r\n\tgetPlayerState,\r\n\tgetRandomAliveMinion,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisMinionGolden,\r\n\tmakeMinionGolden,\r\n} from '../utils';\r\nimport { getNeighbours } from './attack';\r\nimport { playBloodGemsOn } from './blood-gems';\r\nimport { addCardsInHand } from './cards-in-hand';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { SharedState } from './shared-state';\r\nimport { modifyAttack, modifyHealth, onStatsUpdate } from './stats';\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst brann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_BG_LOE_077 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst brannBlessings = boardHero.secrets?.some((e) => e.cardId === CardIds.BrannsBlessing_BG28_509);\r\n\tconst brannBonus = !!brann || brannBlessings ? 2 : 0;\r\n\tconst goldenBrann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_TB_BaconUps_045 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst goldenBrannBonus = !!goldenBrann ? 3 : 0;\r\n\tconst gilneanWarHorns =\r\n\t\tboardHero.questRewardEntities?.filter((entity) => entity.cardId === CardIds.GilneanWarHorn)?.length ?? 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\r\n\tconst multiplier = echoesOfArgus + Math.max(goldenBrannBonus, brannBonus, 1) + gilneanWarHorns;\r\n\treturn multiplier;\r\n};\r\n\r\nexport const triggerBattlecry = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tentity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, gameState.sharedState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100:\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100_G:\r\n\t\t\t\tconst razorFenCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RazorfenGeomancer_BG20_100\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(hero, board, razorFenCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, Race.MURLOC, gameState.allCards);\r\n\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(rockPoolTarget, rockpoolStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(rockPoolTarget, rockpoolStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(rockPoolTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, rockPoolTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellCollector_BG23_002:\r\n\t\t\tcase CardIds.ShellCollector_BG23_002_G:\r\n\t\t\t\tconst shellCollectorCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellCollector_BG23_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, shellCollectorCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(entity, board, hero, menagerieMugStats, menagerieMugStats, gameState, 3);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieJug_BGS_083:\r\n\t\t\tcase CardIds.MenagerieJug_TB_BaconUps_145:\r\n\t\t\t\tconst menagerieJugStats = entity.cardId === CardIds.MenagerieJug_BGS_083 ? 2 : 4;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(entity, board, hero, menagerieJugStats, menagerieJugStats, gameState, 3);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011:\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011_G:\r\n\t\t\t\tconst nerubianDeathswarmerStats = entity.cardId === CardIds.NerubianDeathswarmer_BG25_011 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.UndeadAttackBonus =\r\n\t\t\t\t\t(hero.globalInfo?.UndeadAttackBonus ?? 0) + nerubianDeathswarmerStats;\r\n\t\t\t\taddStatsToBoard(entity, board, hero, nerubianDeathswarmerStats, 0, gameState, Race[Race.UNDEAD]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\tsparringPartnersTarget.taunt = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, Race.DRAGON, gameState.allCards);\r\n\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\tmodifyAttack(twilightEmissaryTarget, twilightEmissaryStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(twilightEmissaryTarget, twilightEmissaryStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(twilightEmissaryTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, twilightEmissaryTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FelfinNavigator_BG_BT_010:\r\n\t\t\tcase CardIds.FelfinNavigator_TB_BaconUps_124:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159:\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159_G:\r\n\t\t\t\t// console.debug('triggering moonbaconjazzer');\r\n\t\t\t\tconst moonBaconJazzerStats = entity.cardId === CardIds.MoonBaconJazzer_BG26_159 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t\t\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) + moonBaconJazzerStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, Race.ELEMENTAL, gameState.allCards);\r\n\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\tmodifyAttack(smoggerTarget, smoggerStats, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(smoggerTarget, smoggerStats, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(smoggerTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, smoggerTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\tconst annihilanStats = (entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\tmodifyHealth(entity, annihilanStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963:\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 3 : 6,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 1 : 2,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.DRAGON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Necrolyte_BG20_202:\r\n\t\t\tcase CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\t// console.debug('triggering necrolyte', entity.entityId);\r\n\t\t\t\tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\tplayBloodGemsOn(necrolyteTarget, necrolyteBloodGems, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, necrolyteTarget, board, hero, otherHero);\r\n\r\n\t\t\t\tconst necrolyteTargetNeighbours = getNeighbours(board, necrolyteTarget);\r\n\t\t\t\tfor (const neighbour of necrolyteTargetNeighbours) {\r\n\t\t\t\t\tconst bloodGemStatsEnchantment = neighbour.enchantments?.find(\r\n\t\t\t\t\t\t(e) => e.cardId === CardIds.BloodGem_BloodGemsEnchantment,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (bloodGemStatsEnchantment) {\r\n\t\t\t\t\t\tconst atk = bloodGemStatsEnchantment.tagScriptDataNum1 ?? 0;\r\n\t\t\t\t\t\tconst heath = bloodGemStatsEnchantment.tagScriptDataNum2 ?? 0;\r\n\t\t\t\t\t\tneighbour.attack = Math.max(0, neighbour.attack - atk);\r\n\t\t\t\t\t\tneighbour.health = Math.max(1, neighbour.health - heath);\r\n\t\t\t\t\t\tneighbour.maxHealth = Math.max(1, neighbour.maxHealth - heath);\r\n\t\t\t\t\t\tnecrolyteTarget.attack += atk;\r\n\t\t\t\t\t\tnecrolyteTarget.health += heath;\r\n\t\t\t\t\t\tnecrolyteTarget.maxHealth += heath;\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(necrolyteTarget, neighbour, board, hero, otherHero);\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.PrimalfinLookout_BGS_020:\r\n\t\t\tcase CardIds.PrimalfinLookout_TB_BaconUps_089:\r\n\t\t\t\tconst primalfinLookoutCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.PrimalfinLookout_BGS_020\r\n\t\t\t\t\t\t? [gameState.cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1)]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tgameState.cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t\t\tgameState.cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, primalfinLookoutCardsToAdd, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, hero, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\tmodifyAttack(target, strongshellScavengerStats, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(target, strongshellScavengerStats, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(target, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, target, board, hero, otherHero);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\tvigilantStonebornTarget.taunt = true;\r\n\t\t\t\tmodifyHealth(vigilantStonebornTarget, vigilantStonebornStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(vigilantStonebornTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, vigilantStonebornTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\tbonemareTarget.taunt = true;\r\n\t\t\t\tmodifyAttack(bonemareTarget, bonemareStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(bonemareTarget, bonemareStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(bonemareTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, bonemareTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309:\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309_G:\r\n\t\t\t\tconst generalDrakkisathCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_BG25_309\r\n\t\t\t\t\t\t? [CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, generalDrakkisathCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, murozondCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, tavernTempestCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807:\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807_G:\r\n\t\t\t\tconst mechaJaraxxusCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.MechaJaraxxus_BG25_807\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, mechaJaraxxusCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002:\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002_G:\r\n\t\t\t\tconst oozelingCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.OozelingGladiator_BG27_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore, CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, oozelingCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\tironGroundskeeperTarget.taunt = !ironGroundskeeperTarget.taunt;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\tconst differentTypes = extractUniqueTribes(board, gameState.allCards);\r\n\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\tconst livingConstellationTarget = pickRandom(allMinions);\r\n\t\t\t\tconst boardForTarget = board.includes(livingConstellationTarget) ? board : otherBoard;\r\n\t\t\t\tmodifyAttack(livingConstellationTarget, livingConstellationStats, boardForTarget, hero, gameState);\r\n\t\t\t\tmodifyHealth(livingConstellationTarget, livingConstellationStats, boardForTarget, hero, gameState);\r\n\t\t\t\tonStatsUpdate(livingConstellationTarget, boardForTarget, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tlivingConstellationTarget,\r\n\t\t\t\t\tboardForTarget,\r\n\t\t\t\t\thero,\r\n\t\t\t\t\totherHero,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparkLing_BG27_019:\r\n\t\t\tcase CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\tallMinions.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tif (!!emergentFlameTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(emergentFlameTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(emergentFlameTarget) ? hero : otherHero;\r\n\t\t\t\t\tconst emergentFlameMultiplier = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\t\tconst emergentFlameStats = (entity.scriptDataNum1 ?? 1) * emergentFlameMultiplier;\r\n\t\t\t\t\tmodifyAttack(emergentFlameTarget, emergentFlameStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tmodifyHealth(emergentFlameTarget, emergentFlameStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(emergentFlameTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, emergentFlameTarget, targetBoard, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t:\r\n\t\t\tcase CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309_Gt:\r\n\t\t\t\tconst smolderwingTarget = pickRandom(\r\n\t\t\t\t\tallMinions.filter((e) => hasCorrectTribe(e, Race.DRAGON, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tif (!!smolderwingTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(emergentFlameTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(emergentFlameTarget) ? hero : otherHero;\r\n\t\t\t\t\tconst smolderwingMultiplier =\r\n\t\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t ? 1 : 2;\r\n\t\t\t\t\tconst smolderwingStats = 5 * smolderwingMultiplier;\r\n\t\t\t\t\tmodifyAttack(smolderwingTarget, smolderwingStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(smolderwingTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\tconst captainSandersTarget = pickRandom(board.filter((e) => !isMinionGolden(e, gameState.allCards)));\r\n\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, hero, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = entity.cardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Murky_BG24_012:\r\n\t\t\tcase CardIds.Murky_BG24_012_G:\r\n\t\t\t\tconst murkyScale = entity.cardId === CardIds.Murky_BG24_012 ? 1 : 2;\r\n\t\t\t\tconst murlocsControlled = board.filter((e) =>\r\n\t\t\t\t\thasCorrectTribe(e, Race.MURLOC, gameState.allCards),\r\n\t\t\t\t).length;\r\n\t\t\t\t// const murkyBattlecriesPlayed = entity.scriptDataNum1 > 0 ? entity.scriptDataNum1 / murkyScale - 1 : 0;\r\n\t\t\t\tconst murkyStats = murkyScale * 4 * murlocsControlled;\r\n\t\t\t\tconst murkyTarget = pickRandom(\r\n\t\t\t\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tmodifyAttack(murkyTarget, murkyStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(murkyTarget, murkyStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(murkyTarget, board, hero, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814:\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814_G:\r\n\t\t\t\tconst balladistMultiplier = entity.cardId === CardIds.LovesickBalladist_BG26_814 ? 1 : 2;\r\n\t\t\t\tconst balladistStats = balladistMultiplier * (entity.scriptDataNum1 ?? 0);\r\n\t\t\t\tconst balladistTargets = allMinions.filter((e) => hasCorrectTribe(e, Race.PIRATE, gameState.allCards));\r\n\t\t\t\tconst balladistTarget = pickRandom(balladistTargets);\r\n\t\t\t\tif (balladistTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(balladistTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(balladistTarget) ? hero : otherHero;\r\n\t\t\t\t\tmodifyHealth(balladistTarget, balladistStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(balladistTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tballadistTarget,\r\n\t\t\t\t\t\ttargetBoard,\r\n\t\t\t\t\t\ttargetHero,\r\n\t\t\t\t\t\totherHero,\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.FacelessDisciple_BG24_719:\r\n\t\t\tcase CardIds.FacelessDisciple_BG24_719_G:\r\n\t\t\t\tconst target = pickRandom(allMinions.filter((e) => !e.definitelyDead && e.health > 0));\r\n\t\t\t\tif (target) {\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, target, board, hero, otherHero);\r\n\t\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(target.cardId);\r\n\t\t\t\t\tconst targetTier =\r\n\t\t\t\t\t\tentity.cardId === CardIds.FacelessDisciple_BG24_719 ? minionTier + 1 : minionTier + 2;\r\n\t\t\t\t\tconst maxTier = !!gameState.anomalies?.includes(CardIds.SecretsOfNorgannon_BG27_Anomaly_504)\r\n\t\t\t\t\t\t? 7\r\n\t\t\t\t\t\t: 6;\r\n\t\t\t\t\tconst newMinionId = gameState.cardsData.getRandomMinionForTavernTier(Math.min(maxTier, targetTier));\r\n\t\t\t\t\tconst targetBoard = board.includes(target) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(target) ? hero : otherHero;\r\n\t\t\t\t\tconst newMinion = buildSingleBoardEntity(\r\n\t\t\t\t\t\tnewMinionId,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t\ttargetHero.friendly,\r\n\t\t\t\t\t\tgameState.sharedState.currentEntityId++,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tgameState.cardsData,\r\n\t\t\t\t\t\tgameState.sharedState,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t);\r\n\t\t\t\t\t// Replace the target with the new minion\r\n\t\t\t\t\tconst index = targetBoard.indexOf(target);\r\n\t\t\t\t\t// console.debug('board before disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\ttargetBoard.splice(index, 1, newMinion);\r\n\t\t\t\t\t// console.debug('board after disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, newMinion, targetBoard, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Amalgadon_BGS_069:\r\n\t\t\tcase CardIds.Amalgadon_TB_BaconUps_121:\r\n\t\t\t\tconst numberOfTribes = extractUniqueTribes(board, gameState.allCards).length;\r\n\t\t\t\tconst amalgadonMultiplier = entity.cardId === CardIds.Amalgadon_BGS_069 ? 1 : 2;\r\n\t\t\t\tconst totalAdapts = amalgadonMultiplier * numberOfTribes;\r\n\t\t\t\tfor (let i = 0; i < totalAdapts; i++) {\r\n\t\t\t\t\tconst adapts = [\r\n\t\t\t\t\t\tCardIds.FlamingClawsToken,\r\n\t\t\t\t\t\tCardIds.LivingSporesToken,\r\n\t\t\t\t\t\tCardIds.VolcanicMightToken,\r\n\t\t\t\t\t\tCardIds.RockyCarapaceToken,\r\n\t\t\t\t\t];\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tadapts.push(CardIds.CracklingShieldToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.windfury) {\r\n\t\t\t\t\t\tadapts.push(CardIds.LightningSpeedToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.taunt) {\r\n\t\t\t\t\t\tadapts.push(CardIds.MassiveToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.venomous && !entity.poisonous) {\r\n\t\t\t\t\t\tadapts.push(CardIds.PoisonSpitToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst adapt = pickRandom(adapts);\r\n\t\t\t\t\tswitch (adapt) {\r\n\t\t\t\t\t\tcase CardIds.FlamingClawsToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 3, board, hero, gameState);\r\n\t\t\t\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LivingSporesToken:\r\n\t\t\t\t\t\t\tentity.enchantments = entity.enchantments ?? [];\r\n\t\t\t\t\t\t\tentity.enchantments.push({\r\n\t\t\t\t\t\t\t\tcardId: CardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LightningSpeedToken:\r\n\t\t\t\t\t\t\tentity.windfury = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.MassiveToken:\r\n\t\t\t\t\t\t\tentity.taunt = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.PoisonSpitToken:\r\n\t\t\t\t\t\t\tentity.poisonous = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.RockyCarapaceToken:\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 3, board, hero, gameState);\r\n\t\t\t\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.CracklingShieldToken:\r\n\t\t\t\t\t\t\tentity.divineShield = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.VolcanicMightToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 1, board, hero, gameState);\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 1, board, hero, gameState);\r\n\t\t\t\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550:\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550_G:\r\n\t\t\t\tconst rodeoPerformerCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RodeoPerformer_BG28_550_G ? [null] : [null, null];\r\n\t\t\t\taddCardsInHand(hero, board, rodeoPerformerCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Eagill_BG28_630:\r\n\t\t\tcase CardIds.Eagill_BG28_630_G:\r\n\t\t\t\tconst eagillMultiplier = entity.cardId === CardIds.Eagill_BG28_630 ? 1 : 2;\r\n\t\t\t\tconst eagillBoardTarget = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\tif (eagillBoardTarget) {\r\n\t\t\t\t\tmodifyAttack(eagillBoardTarget, 2 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(eagillBoardTarget, 3 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(eagillBoardTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, eagillBoardTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tconst eagillHandTarget = pickRandom(\r\n\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t(e) => gameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\tif (eagillHandTarget) {\r\n\t\t\t\t\tmodifyAttack(eagillHandTarget, 2 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(eagillHandTarget, 3 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(eagillHandTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, eagillHandTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy:\r\n\t\t\tcase CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy_G:\r\n\t\t\t\tconst weebominationMultiplier =\r\n\t\t\t\t\tentity.cardId === CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy ? 1 : 2;\r\n\t\t\t\tconst weebominationTarget = pickRandom(allMinions);\r\n\t\t\t\tif (weebominationTarget) {\r\n\t\t\t\t\tconst heroMaxHealth = gameState.allCards.getCard(hero.cardId)?.health ?? 40;\r\n\t\t\t\t\tconst heroMissingHealth = heroMaxHealth - hero.hpLeft;\r\n\t\t\t\t\tconst weebominationBuff = weebominationMultiplier * heroMissingHealth;\r\n\t\t\t\t\tmodifyHealth(weebominationTarget, weebominationBuff, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(weebominationTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, weebominationTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AssistantGuard_BG29_845:\r\n\t\t\tcase CardIds.AssistantGuard_BG29_845_G:\r\n\t\t\t\tconst assistantGuardMultiplier = entity.cardId === CardIds.AssistantGuard_BG29_845 ? 1 : 2;\r\n\t\t\t\tconst assistantGuardTarget = pickRandom(allMinions);\r\n\t\t\t\tif (assistantGuardTarget) {\r\n\t\t\t\t\tassistantGuardTarget.taunt = true;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, assistantGuardTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => !!e.taunt),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tassistantGuardMultiplier * 2,\r\n\t\t\t\t\tassistantGuardMultiplier * 3,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldshellWarden_BG29_803:\r\n\t\t\tcase CardIds.GoldshellWarden_BG29_803_G:\r\n\t\t\t\tconst goldshellMultiplier = entity.cardId === CardIds.GoldshellWarden_BG29_803_G ? 2 : 1;\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tgoldshellMultiplier * 2,\r\n\t\t\t\t\tgoldshellMultiplier * 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.BEAST],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellWhistler_BG26_045:\r\n\t\t\tcase CardIds.ShellWhistler_BG26_045_G:\r\n\t\t\t\tconst shellWhistlerCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellWhistler_BG26_045_G ? [null] : [null, null];\r\n\t\t\t\taddCardsInHand(hero, board, shellWhistlerCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ScrapScraper_BG26_148:\r\n\t\t\t// case CardIds.ScrapScraper_BG26_148_G:\r\n\t\t\t// \tconst scraperToAddQuantity = entity.cardId === CardIds.ScrapScraper_BG26_148_G ? 2 : 1;\r\n\t\t\t// \tconst scraperCardsToAdd = [];\r\n\t\t\t// \tfor (let i = 0; i < scraperToAddQuantity; i++) {\r\n\t\t\t// \t\tscraperCardsToAdd.push(pickRandom(gameState.cardsData.scrapScraperSpawns));\r\n\t\t\t// \t}\r\n\t\t\t// \taddCardsInHand(hero, board, scraperCardsToAdd, gameState);\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.GemSmuggler_BG25_155:\r\n\t\t\tcase CardIds.GemSmuggler_BG25_155_G:\r\n\t\t\t\t// console.debug('triggering gem smuggler');\r\n\t\t\t\tconst gemSmugglerBloodGems = entity.cardId === CardIds.GemSmuggler_BG25_155 ? 1 : 2;\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t\t\t.forEach((e) => playBloodGemsOn(e, gemSmugglerBloodGems, board, hero, gameState));\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DisguisedGraverobber_BG28_303:\r\n\t\t\tcase CardIds.DisguisedGraverobber_BG28_303_G:\r\n\t\t\t\tconst disguisedGraverobberTarget = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\tif (disguisedGraverobberTarget) {\r\n\t\t\t\t\tconst disguisedGraverobberNumberOfCopies =\r\n\t\t\t\t\t\tentity.cardId === CardIds.DisguisedGraverobber_BG28_303 ? 1 : 2;\r\n\t\t\t\t\tdisguisedGraverobberTarget.definitelyDead = true;\r\n\t\t\t\t\tconst copies = Array.from({ length: disguisedGraverobberNumberOfCopies }).map(\r\n\t\t\t\t\t\t(_) => disguisedGraverobberTarget.cardId,\r\n\t\t\t\t\t);\r\n\t\t\t\t\taddCardsInHand(hero, board, copies, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104:\r\n\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104_G:\r\n\t\t\t\tconst playerState = getPlayerState(gameState.gameState, hero);\r\n\t\t\t\tif (playerState) {\r\n\t\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.FriendlySaloonkeeper_BGDUO_104\r\n\t\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\t\taddCardsInHand(playerState.player, playerState.board, cardsToAdd, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111:\r\n\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111_G:\r\n\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GenerousGeomancer_BGDUO_111\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(\r\n\t\t\t\t\tgameState.gameState.player.player,\r\n\t\t\t\t\tgameState.gameState.player.board,\r\n\t\t\t\t\tcardsToAdd,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tif (gameState.gameState.player.teammate) {\r\n\t\t\t\t\taddCardsInHand(\r\n\t\t\t\t\t\tgameState.gameState.player.teammate.player,\r\n\t\t\t\t\t\tgameState.gameState.player.teammate.board,\r\n\t\t\t\t\t\tcardsToAdd,\r\n\t\t\t\t\t\tgameState,\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.OrcEstraConductor_BGDUO_119:\r\n\t\t\tcase CardIds.OrcEstraConductor_BGDUO_119_G:\r\n\t\t\t\tconst conductorTarget = pickRandom(\r\n\t\t\t\t\tallMinions.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tif (!!conductorTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(conductorTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(conductorTarget) ? hero : otherHero;\r\n\t\t\t\t\tconst multiplier = entity.cardId === CardIds.OrcEstraConductor_BGDUO_119 ? 1 : 2;\r\n\t\t\t\t\tconst attackStats = 2 * (entity.scriptDataNum1 ?? 1) * multiplier;\r\n\t\t\t\t\tconst healthStats = 2 * (entity.scriptDataNum1 ?? 1) * multiplier;\r\n\t\t\t\t\tmodifyAttack(conductorTarget, attackStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tmodifyHealth(conductorTarget, healthStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(conductorTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, conductorTarget, targetBoard, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\t// All hte Battlecry minions that arent implemented / have no effect on the board state\r\n\t\t\t\tconst hasBattlecry = gameState.allCards\r\n\t\t\t\t\t.getCard(entity.cardId)\r\n\t\t\t\t\t?.mechanics?.includes(GameTag[GameTag.BATTLECRY]);\r\n\t\t\t\thasTriggered = hasBattlecry;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (hasTriggered) {\r\n\t\t\tafterBattlecryTriggered(entity, board, hero, otherBoard, otherHero, gameState);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst afterBattlecryTriggered = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tboard\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.KalecgosArcaneAspect_BGS_041 ||\r\n\t\t\t\te.cardId === CardIds.KalecgosArcaneAspect_TB_BaconUps_109,\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst buff = entity.cardId === CardIds.KalecgosArcaneAspect_BGS_041 ? 1 : 2;\r\n\t\t\taddStatsToBoard(e, board, hero, buff, buff, gameState, Race[Race.DRAGON]);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.BlazingSkyfin_BG25_040 || e.cardId === CardIds.BlazingSkyfin_BG25_040_G)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst buff = entity.cardId === CardIds.BlazingSkyfin_BG25_040 ? 1 : 2;\r\n\t\t\tmodifyAttack(e, buff, board, hero, gameState);\r\n\t\t\tmodifyHealth(e, buff, board, hero, gameState);\r\n\t\t\tonStatsUpdate(e, board, hero, gameState);\r\n\t\t});\r\n};\r\n\r\n// TODO: this is probably too slow\r\nconst extractUniqueTribes = (board: BoardEntity[], allCards: AllCardsService): readonly Race[] => {\r\n\tconst boardReferenceCards = board.map((m) => allCards.getCard(m.cardId));\r\n\tconst minionsPlayedWithTribes = boardReferenceCards.filter((c) => !!c.races?.length);\r\n\tconst minionsToProcess: /*Mutable<ReferenceCard & { picked?: boolean }>*/ any[] = [\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((c) => !c.races.includes(Race[Race.ALL]))\r\n\t\t\t.map((c) => ({ ...c, races: [...c.races] })),\r\n\t];\r\n\r\n\tconst uniqueTribes: Race[] = [];\r\n\tconst maxTribesPerMinion = 2;\r\n\tfor (let i = 1; i <= maxTribesPerMinion; i++) {\r\n\t\tlet dirty = true;\r\n\t\twhile (dirty) {\r\n\t\t\tdirty = false;\r\n\t\t\tfor (let j = 0; j < minionsToProcess.length; j++) {\r\n\t\t\t\tconst minion = minionsToProcess[j];\r\n\t\t\t\t// console.debug('considering minion', minion.name, minion.races);\r\n\t\t\t\tif (!minion.picked && minion.races.length > 0 && minion.races.length <= i) {\r\n\t\t\t\t\tconst raceToAdd: string = minion.races[0];\r\n\t\t\t\t\tuniqueTribes.push(Race[raceToAdd]);\r\n\t\t\t\t\t// console.debug('added', raceToAdd, uniqueTribes);\r\n\t\t\t\t\tfor (const m of minionsToProcess) {\r\n\t\t\t\t\t\tm.races = m.races.filter((r) => r !== raceToAdd);\r\n\t\t\t\t\t\t// console.debug('updates races', m.name, m.races, raceToAdd);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tminion.picked = true;\r\n\t\t\t\t\tdirty = true;\r\n\t\t\t\t\t// Restart the loop, so we're not dependant on the order in which we process things\r\n\t\t\t\t\tj = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// minionsToProcess = minionsToProcess.filter((c) => !c.picked);\r\n\t\t}\r\n\t}\r\n\r\n\tuniqueTribes.push(\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((m) => m.races.includes(Race[Race.ALL]))\r\n\t\t\t.flatMap((m) => m.races)\r\n\t\t\t.map((r: string) => Race[r]),\r\n\t);\r\n\treturn uniqueTribes;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"battlecries.js","sourceRoot":"","sources":["../../src/simulation/battlecries.ts"],"names":[],"mappings":";;;AAAA,iEAAiG;AAGjG,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AAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;gBAEnC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;oBAC1E,MAAM,SAAS,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC1C,YAAY,CAAC,IAAI,CAAC,qBAAI,CAAC,SAAS,CAAC,CAAC,CAAC;oBAEnC,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE;wBACjC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;qBAEjD;oBACD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;oBACrB,KAAK,GAAG,IAAI,CAAC;oBAEb,CAAC,GAAG,CAAC,CAAC;iBACN;aACD;SAED;KACD;IAED,YAAY,CAAC,IAAI,CAChB,GAAG,uBAAuB;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAI,CAAC,qBAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACvB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,qBAAI,CAAC,CAAC,CAAC,CAAC,CAC7B,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, CardType, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\taddStatsToBoard,\r\n\tbuildSingleBoardEntity,\r\n\tgetPlayerState,\r\n\tgetRandomAliveMinion,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisMinionGolden,\r\n\tmakeMinionGolden,\r\n} from '../utils';\r\nimport { getNeighbours } from './attack';\r\nimport { playBloodGemsOn } from './blood-gems';\r\nimport { addCardsInHand } from './cards-in-hand';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { SharedState } from './shared-state';\r\nimport { modifyAttack, modifyHealth, onStatsUpdate } from './stats';\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst brann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_BG_LOE_077 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst brannBlessings = boardHero.secrets?.some((e) => e.cardId === CardIds.BrannsBlessing_BG28_509);\r\n\tconst brannBonus = !!brann || brannBlessings ? 2 : 0;\r\n\tconst goldenBrann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_TB_BaconUps_045 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst goldenBrannBonus = !!goldenBrann ? 3 : 0;\r\n\tconst gilneanWarHorns =\r\n\t\tboardHero.questRewardEntities?.filter((entity) => entity.cardId === CardIds.GilneanWarHorn)?.length ?? 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\r\n\tconst multiplier = echoesOfArgus + Math.max(goldenBrannBonus, brannBonus, 1) + gilneanWarHorns;\r\n\treturn multiplier;\r\n};\r\n\r\nexport const triggerBattlecry = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tentity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, gameState.sharedState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100:\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100_G:\r\n\t\t\t\tconst razorFenCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RazorfenGeomancer_BG20_100\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(hero, board, razorFenCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, Race.MURLOC, gameState.allCards);\r\n\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(rockPoolTarget, rockpoolStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(rockPoolTarget, rockpoolStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(rockPoolTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, rockPoolTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellCollector_BG23_002:\r\n\t\t\tcase CardIds.ShellCollector_BG23_002_G:\r\n\t\t\t\tconst shellCollectorCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellCollector_BG23_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, shellCollectorCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(entity, board, hero, menagerieMugStats, menagerieMugStats, gameState, 3);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieJug_BGS_083:\r\n\t\t\tcase CardIds.MenagerieJug_TB_BaconUps_145:\r\n\t\t\t\tconst menagerieJugStats = entity.cardId === CardIds.MenagerieJug_BGS_083 ? 2 : 4;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(entity, board, hero, menagerieJugStats, menagerieJugStats, gameState, 3);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011:\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011_G:\r\n\t\t\t\tconst nerubianDeathswarmerStats = entity.cardId === CardIds.NerubianDeathswarmer_BG25_011 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.UndeadAttackBonus =\r\n\t\t\t\t\t(hero.globalInfo?.UndeadAttackBonus ?? 0) + nerubianDeathswarmerStats;\r\n\t\t\t\taddStatsToBoard(entity, board, hero, nerubianDeathswarmerStats, 0, gameState, Race[Race.UNDEAD]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\tsparringPartnersTarget.taunt = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, Race.DRAGON, gameState.allCards);\r\n\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\tmodifyAttack(twilightEmissaryTarget, twilightEmissaryStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(twilightEmissaryTarget, twilightEmissaryStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(twilightEmissaryTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, twilightEmissaryTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FelfinNavigator_BG_BT_010:\r\n\t\t\tcase CardIds.FelfinNavigator_TB_BaconUps_124:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159:\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159_G:\r\n\t\t\t\t// console.debug('triggering moonbaconjazzer');\r\n\t\t\t\tconst moonBaconJazzerStats = entity.cardId === CardIds.MoonBaconJazzer_BG26_159 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t\t\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) + moonBaconJazzerStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, Race.ELEMENTAL, gameState.allCards);\r\n\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\tmodifyAttack(smoggerTarget, smoggerStats, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(smoggerTarget, smoggerStats, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(smoggerTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, smoggerTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\tconst annihilanStats = (entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\tmodifyHealth(entity, annihilanStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963:\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 3 : 6,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 1 : 2,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.DRAGON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Necrolyte_BG20_202:\r\n\t\t\tcase CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\t// console.debug('triggering necrolyte', entity.entityId);\r\n\t\t\t\tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\tplayBloodGemsOn(necrolyteTarget, necrolyteBloodGems, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, necrolyteTarget, board, hero, otherHero);\r\n\r\n\t\t\t\tconst necrolyteTargetNeighbours = getNeighbours(board, necrolyteTarget);\r\n\t\t\t\tfor (const neighbour of necrolyteTargetNeighbours) {\r\n\t\t\t\t\tconst bloodGemStatsEnchantment = neighbour.enchantments?.find(\r\n\t\t\t\t\t\t(e) => e.cardId === CardIds.BloodGem_BloodGemsEnchantment,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (bloodGemStatsEnchantment) {\r\n\t\t\t\t\t\tconst atk = bloodGemStatsEnchantment.tagScriptDataNum1 ?? 0;\r\n\t\t\t\t\t\tconst heath = bloodGemStatsEnchantment.tagScriptDataNum2 ?? 0;\r\n\t\t\t\t\t\tneighbour.attack = Math.max(0, neighbour.attack - atk);\r\n\t\t\t\t\t\tneighbour.health = Math.max(1, neighbour.health - heath);\r\n\t\t\t\t\t\tneighbour.maxHealth = Math.max(1, neighbour.maxHealth - heath);\r\n\t\t\t\t\t\tnecrolyteTarget.attack += atk;\r\n\t\t\t\t\t\tnecrolyteTarget.health += heath;\r\n\t\t\t\t\t\tnecrolyteTarget.maxHealth += heath;\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(necrolyteTarget, neighbour, board, hero, otherHero);\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.PrimalfinLookout_BGS_020:\r\n\t\t\tcase CardIds.PrimalfinLookout_TB_BaconUps_089:\r\n\t\t\t\tconst primalfinLookoutCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.PrimalfinLookout_BGS_020\r\n\t\t\t\t\t\t? [gameState.cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1)]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tgameState.cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t\t\tgameState.cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, primalfinLookoutCardsToAdd, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, hero, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\tmodifyAttack(target, strongshellScavengerStats, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(target, strongshellScavengerStats, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(target, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, target, board, hero, otherHero);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\tvigilantStonebornTarget.taunt = true;\r\n\t\t\t\tmodifyHealth(vigilantStonebornTarget, vigilantStonebornStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(vigilantStonebornTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, vigilantStonebornTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\tbonemareTarget.taunt = true;\r\n\t\t\t\tmodifyAttack(bonemareTarget, bonemareStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(bonemareTarget, bonemareStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(bonemareTarget, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(entity, bonemareTarget, board, hero, otherHero);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309:\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309_G:\r\n\t\t\t\tconst generalDrakkisathCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_BG25_309\r\n\t\t\t\t\t\t? [CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, generalDrakkisathCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, murozondCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, tavernTempestCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807:\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807_G:\r\n\t\t\t\tconst mechaJaraxxusCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.MechaJaraxxus_BG25_807\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, mechaJaraxxusCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002:\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002_G:\r\n\t\t\t\tconst oozelingCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.OozelingGladiator_BG27_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore, CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, oozelingCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\tironGroundskeeperTarget.taunt = !ironGroundskeeperTarget.taunt;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\tconst differentTypes = extractUniqueTribes(board, gameState.allCards);\r\n\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\tconst livingConstellationTarget = pickRandom(allMinions);\r\n\t\t\t\tconst boardForTarget = board.includes(livingConstellationTarget) ? board : otherBoard;\r\n\t\t\t\tmodifyAttack(livingConstellationTarget, livingConstellationStats, boardForTarget, hero, gameState);\r\n\t\t\t\tmodifyHealth(livingConstellationTarget, livingConstellationStats, boardForTarget, hero, gameState);\r\n\t\t\t\tonStatsUpdate(livingConstellationTarget, boardForTarget, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tlivingConstellationTarget,\r\n\t\t\t\t\tboardForTarget,\r\n\t\t\t\t\thero,\r\n\t\t\t\t\totherHero,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparkLing_BG27_019:\r\n\t\t\tcase CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\tallMinions.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tif (!!emergentFlameTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(emergentFlameTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(emergentFlameTarget) ? hero : otherHero;\r\n\t\t\t\t\tconst emergentFlameMultiplier = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\t\tconst emergentFlameStats = (entity.scriptDataNum1 ?? 1) * emergentFlameMultiplier;\r\n\t\t\t\t\tmodifyAttack(emergentFlameTarget, emergentFlameStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tmodifyHealth(emergentFlameTarget, emergentFlameStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(emergentFlameTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, emergentFlameTarget, targetBoard, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t:\r\n\t\t\tcase CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309_Gt:\r\n\t\t\t\tconst smolderwingTarget = pickRandom(\r\n\t\t\t\t\tallMinions.filter((e) => hasCorrectTribe(e, Race.DRAGON, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tif (!!smolderwingTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(smolderwingTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(smolderwingTarget) ? hero : otherHero;\r\n\t\t\t\t\tconst smolderwingMultiplier =\r\n\t\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t ? 1 : 2;\r\n\t\t\t\t\tconst smolderwingStats = 5 * smolderwingMultiplier;\r\n\t\t\t\t\tmodifyAttack(smolderwingTarget, smolderwingStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(smolderwingTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\tconst captainSandersTarget = pickRandom(board.filter((e) => !isMinionGolden(e, gameState.allCards)));\r\n\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, hero, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = entity.cardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Murky_BG24_012:\r\n\t\t\tcase CardIds.Murky_BG24_012_G:\r\n\t\t\t\tconst murkyScale = entity.cardId === CardIds.Murky_BG24_012 ? 1 : 2;\r\n\t\t\t\tconst murlocsControlled = board.filter((e) =>\r\n\t\t\t\t\thasCorrectTribe(e, Race.MURLOC, gameState.allCards),\r\n\t\t\t\t).length;\r\n\t\t\t\t// const murkyBattlecriesPlayed = entity.scriptDataNum1 > 0 ? entity.scriptDataNum1 / murkyScale - 1 : 0;\r\n\t\t\t\tconst murkyStats = murkyScale * 4 * murlocsControlled;\r\n\t\t\t\tconst murkyTarget = pickRandom(\r\n\t\t\t\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tmodifyAttack(murkyTarget, murkyStats, board, hero, gameState);\r\n\t\t\t\tmodifyHealth(murkyTarget, murkyStats, board, hero, gameState);\r\n\t\t\t\tonStatsUpdate(murkyTarget, board, hero, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814:\r\n\t\t\tcase CardIds.LovesickBalladist_BG26_814_G:\r\n\t\t\t\tconst balladistMultiplier = entity.cardId === CardIds.LovesickBalladist_BG26_814 ? 1 : 2;\r\n\t\t\t\tconst balladistStats = balladistMultiplier * (entity.scriptDataNum1 ?? 0);\r\n\t\t\t\tconst balladistTargets = allMinions.filter((e) => hasCorrectTribe(e, Race.PIRATE, gameState.allCards));\r\n\t\t\t\tconst balladistTarget = pickRandom(balladistTargets);\r\n\t\t\t\tif (balladistTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(balladistTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(balladistTarget) ? hero : otherHero;\r\n\t\t\t\t\tmodifyHealth(balladistTarget, balladistStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(balladistTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tballadistTarget,\r\n\t\t\t\t\t\ttargetBoard,\r\n\t\t\t\t\t\ttargetHero,\r\n\t\t\t\t\t\totherHero,\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.FacelessDisciple_BG24_719:\r\n\t\t\tcase CardIds.FacelessDisciple_BG24_719_G:\r\n\t\t\t\tconst target = pickRandom(allMinions.filter((e) => !e.definitelyDead && e.health > 0));\r\n\t\t\t\tif (target) {\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, target, board, hero, otherHero);\r\n\t\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(target.cardId);\r\n\t\t\t\t\tconst targetTier =\r\n\t\t\t\t\t\tentity.cardId === CardIds.FacelessDisciple_BG24_719 ? minionTier + 1 : minionTier + 2;\r\n\t\t\t\t\tconst maxTier = !!gameState.anomalies?.includes(CardIds.SecretsOfNorgannon_BG27_Anomaly_504)\r\n\t\t\t\t\t\t? 7\r\n\t\t\t\t\t\t: 6;\r\n\t\t\t\t\tconst newMinionId = gameState.cardsData.getRandomMinionForTavernTier(Math.min(maxTier, targetTier));\r\n\t\t\t\t\tconst targetBoard = board.includes(target) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(target) ? hero : otherHero;\r\n\t\t\t\t\tconst newMinion = buildSingleBoardEntity(\r\n\t\t\t\t\t\tnewMinionId,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t\ttargetHero.friendly,\r\n\t\t\t\t\t\tgameState.sharedState.currentEntityId++,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tgameState.cardsData,\r\n\t\t\t\t\t\tgameState.sharedState,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t);\r\n\t\t\t\t\t// Replace the target with the new minion\r\n\t\t\t\t\tconst index = targetBoard.indexOf(target);\r\n\t\t\t\t\t// console.debug('board before disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\ttargetBoard.splice(index, 1, newMinion);\r\n\t\t\t\t\t// console.debug('board after disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, newMinion, targetBoard, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Amalgadon_BGS_069:\r\n\t\t\tcase CardIds.Amalgadon_TB_BaconUps_121:\r\n\t\t\t\tconst numberOfTribes = extractUniqueTribes(board, gameState.allCards).length;\r\n\t\t\t\tconst amalgadonMultiplier = entity.cardId === CardIds.Amalgadon_BGS_069 ? 1 : 2;\r\n\t\t\t\tconst totalAdapts = amalgadonMultiplier * numberOfTribes;\r\n\t\t\t\tfor (let i = 0; i < totalAdapts; i++) {\r\n\t\t\t\t\tconst adapts = [\r\n\t\t\t\t\t\tCardIds.FlamingClawsToken,\r\n\t\t\t\t\t\tCardIds.LivingSporesToken,\r\n\t\t\t\t\t\tCardIds.VolcanicMightToken,\r\n\t\t\t\t\t\tCardIds.RockyCarapaceToken,\r\n\t\t\t\t\t];\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tadapts.push(CardIds.CracklingShieldToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.windfury) {\r\n\t\t\t\t\t\tadapts.push(CardIds.LightningSpeedToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.taunt) {\r\n\t\t\t\t\t\tadapts.push(CardIds.MassiveToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.venomous && !entity.poisonous) {\r\n\t\t\t\t\t\tadapts.push(CardIds.PoisonSpitToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst adapt = pickRandom(adapts);\r\n\t\t\t\t\tswitch (adapt) {\r\n\t\t\t\t\t\tcase CardIds.FlamingClawsToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 3, board, hero, gameState);\r\n\t\t\t\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LivingSporesToken:\r\n\t\t\t\t\t\t\tentity.enchantments = entity.enchantments ?? [];\r\n\t\t\t\t\t\t\tentity.enchantments.push({\r\n\t\t\t\t\t\t\t\tcardId: CardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LightningSpeedToken:\r\n\t\t\t\t\t\t\tentity.windfury = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.MassiveToken:\r\n\t\t\t\t\t\t\tentity.taunt = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.PoisonSpitToken:\r\n\t\t\t\t\t\t\tentity.poisonous = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.RockyCarapaceToken:\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 3, board, hero, gameState);\r\n\t\t\t\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.CracklingShieldToken:\r\n\t\t\t\t\t\t\tentity.divineShield = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.VolcanicMightToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 1, board, hero, gameState);\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 1, board, hero, gameState);\r\n\t\t\t\t\t\t\tonStatsUpdate(entity, board, hero, gameState);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550:\r\n\t\t\tcase CardIds.RodeoPerformer_BG28_550_G:\r\n\t\t\t\tconst rodeoPerformerCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RodeoPerformer_BG28_550_G ? [null] : [null, null];\r\n\t\t\t\taddCardsInHand(hero, board, rodeoPerformerCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Eagill_BG28_630:\r\n\t\t\tcase CardIds.Eagill_BG28_630_G:\r\n\t\t\t\tconst eagillMultiplier = entity.cardId === CardIds.Eagill_BG28_630 ? 1 : 2;\r\n\t\t\t\tconst eagillBoardTarget = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\tif (eagillBoardTarget) {\r\n\t\t\t\t\tmodifyAttack(eagillBoardTarget, 2 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(eagillBoardTarget, 3 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(eagillBoardTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, eagillBoardTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tconst eagillHandTarget = pickRandom(\r\n\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t(e) => gameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\tif (eagillHandTarget) {\r\n\t\t\t\t\tmodifyAttack(eagillHandTarget, 2 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tmodifyHealth(eagillHandTarget, 3 * eagillMultiplier, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(eagillHandTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, eagillHandTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy:\r\n\t\t\tcase CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy_G:\r\n\t\t\t\tconst weebominationMultiplier =\r\n\t\t\t\t\tentity.cardId === CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy ? 1 : 2;\r\n\t\t\t\tconst weebominationTarget = pickRandom(allMinions);\r\n\t\t\t\tif (weebominationTarget) {\r\n\t\t\t\t\tconst heroMaxHealth = gameState.allCards.getCard(hero.cardId)?.health ?? 40;\r\n\t\t\t\t\tconst heroMissingHealth = heroMaxHealth - hero.hpLeft;\r\n\t\t\t\t\tconst weebominationBuff = weebominationMultiplier * heroMissingHealth;\r\n\t\t\t\t\tmodifyHealth(weebominationTarget, weebominationBuff, board, hero, gameState);\r\n\t\t\t\t\tonStatsUpdate(weebominationTarget, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, weebominationTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AssistantGuard_BG29_845:\r\n\t\t\tcase CardIds.AssistantGuard_BG29_845_G:\r\n\t\t\t\tconst assistantGuardMultiplier = entity.cardId === CardIds.AssistantGuard_BG29_845 ? 1 : 2;\r\n\t\t\t\tconst assistantGuardTarget = pickRandom(allMinions);\r\n\t\t\t\tif (assistantGuardTarget) {\r\n\t\t\t\t\tassistantGuardTarget.taunt = true;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, assistantGuardTarget, board, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => !!e.taunt),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tassistantGuardMultiplier * 2,\r\n\t\t\t\t\tassistantGuardMultiplier * 3,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldshellWarden_BG29_803:\r\n\t\t\tcase CardIds.GoldshellWarden_BG29_803_G:\r\n\t\t\t\tconst goldshellMultiplier = entity.cardId === CardIds.GoldshellWarden_BG29_803_G ? 2 : 1;\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tgoldshellMultiplier * 2,\r\n\t\t\t\t\tgoldshellMultiplier * 4,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tRace[Race.BEAST],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellWhistler_BG26_045:\r\n\t\t\tcase CardIds.ShellWhistler_BG26_045_G:\r\n\t\t\t\tconst shellWhistlerCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellWhistler_BG26_045_G ? [null] : [null, null];\r\n\t\t\t\taddCardsInHand(hero, board, shellWhistlerCardsToAdd, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ScrapScraper_BG26_148:\r\n\t\t\t// case CardIds.ScrapScraper_BG26_148_G:\r\n\t\t\t// \tconst scraperToAddQuantity = entity.cardId === CardIds.ScrapScraper_BG26_148_G ? 2 : 1;\r\n\t\t\t// \tconst scraperCardsToAdd = [];\r\n\t\t\t// \tfor (let i = 0; i < scraperToAddQuantity; i++) {\r\n\t\t\t// \t\tscraperCardsToAdd.push(pickRandom(gameState.cardsData.scrapScraperSpawns));\r\n\t\t\t// \t}\r\n\t\t\t// \taddCardsInHand(hero, board, scraperCardsToAdd, gameState);\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.GemSmuggler_BG25_155:\r\n\t\t\tcase CardIds.GemSmuggler_BG25_155_G:\r\n\t\t\t\t// console.debug('triggering gem smuggler');\r\n\t\t\t\tconst gemSmugglerBloodGems = entity.cardId === CardIds.GemSmuggler_BG25_155 ? 1 : 2;\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t\t\t.forEach((e) => playBloodGemsOn(e, gemSmugglerBloodGems, board, hero, gameState));\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DisguisedGraverobber_BG28_303:\r\n\t\t\tcase CardIds.DisguisedGraverobber_BG28_303_G:\r\n\t\t\t\tconst disguisedGraverobberTarget = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\tif (disguisedGraverobberTarget) {\r\n\t\t\t\t\tconst disguisedGraverobberNumberOfCopies =\r\n\t\t\t\t\t\tentity.cardId === CardIds.DisguisedGraverobber_BG28_303 ? 1 : 2;\r\n\t\t\t\t\tdisguisedGraverobberTarget.definitelyDead = true;\r\n\t\t\t\t\tconst copies = Array.from({ length: disguisedGraverobberNumberOfCopies }).map(\r\n\t\t\t\t\t\t(_) => disguisedGraverobberTarget.cardId,\r\n\t\t\t\t\t);\r\n\t\t\t\t\taddCardsInHand(hero, board, copies, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104:\r\n\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104_G:\r\n\t\t\t\tconst playerState = getPlayerState(gameState.gameState, hero);\r\n\t\t\t\tif (playerState) {\r\n\t\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.FriendlySaloonkeeper_BGDUO_104\r\n\t\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\t\taddCardsInHand(playerState.player, playerState.board, cardsToAdd, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111:\r\n\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111_G:\r\n\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GenerousGeomancer_BGDUO_111\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(\r\n\t\t\t\t\tgameState.gameState.player.player,\r\n\t\t\t\t\tgameState.gameState.player.board,\r\n\t\t\t\t\tcardsToAdd,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tif (gameState.gameState.player.teammate) {\r\n\t\t\t\t\taddCardsInHand(\r\n\t\t\t\t\t\tgameState.gameState.player.teammate.player,\r\n\t\t\t\t\t\tgameState.gameState.player.teammate.board,\r\n\t\t\t\t\t\tcardsToAdd,\r\n\t\t\t\t\t\tgameState,\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.OrcEstraConductor_BGDUO_119:\r\n\t\t\tcase CardIds.OrcEstraConductor_BGDUO_119_G:\r\n\t\t\t\tconst conductorTarget = pickRandom(\r\n\t\t\t\t\tallMinions.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, gameState.allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tif (!!conductorTarget) {\r\n\t\t\t\t\tconst targetBoard = board.includes(conductorTarget) ? board : otherBoard;\r\n\t\t\t\t\tconst targetHero = board.includes(conductorTarget) ? hero : otherHero;\r\n\t\t\t\t\tconst multiplier = entity.cardId === CardIds.OrcEstraConductor_BGDUO_119 ? 1 : 2;\r\n\t\t\t\t\tconst attackStats = 2 * (entity.scriptDataNum1 ?? 1) * multiplier;\r\n\t\t\t\t\tconst healthStats = 2 * (entity.scriptDataNum1 ?? 1) * multiplier;\r\n\t\t\t\t\tmodifyAttack(conductorTarget, attackStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tmodifyHealth(conductorTarget, healthStats, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tonStatsUpdate(conductorTarget, targetBoard, targetHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, conductorTarget, targetBoard, hero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\t// All hte Battlecry minions that arent implemented / have no effect on the board state\r\n\t\t\t\tconst hasBattlecry = gameState.allCards\r\n\t\t\t\t\t.getCard(entity.cardId)\r\n\t\t\t\t\t?.mechanics?.includes(GameTag[GameTag.BATTLECRY]);\r\n\t\t\t\thasTriggered = hasBattlecry;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (hasTriggered) {\r\n\t\t\tafterBattlecryTriggered(entity, board, hero, otherBoard, otherHero, gameState);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst afterBattlecryTriggered = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tboard\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.KalecgosArcaneAspect_BGS_041 ||\r\n\t\t\t\te.cardId === CardIds.KalecgosArcaneAspect_TB_BaconUps_109,\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst buff = entity.cardId === CardIds.KalecgosArcaneAspect_BGS_041 ? 1 : 2;\r\n\t\t\taddStatsToBoard(e, board, hero, buff, buff, gameState, Race[Race.DRAGON]);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.BlazingSkyfin_BG25_040 || e.cardId === CardIds.BlazingSkyfin_BG25_040_G)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst buff = entity.cardId === CardIds.BlazingSkyfin_BG25_040 ? 1 : 2;\r\n\t\t\tmodifyAttack(e, buff, board, hero, gameState);\r\n\t\t\tmodifyHealth(e, buff, board, hero, gameState);\r\n\t\t\tonStatsUpdate(e, board, hero, gameState);\r\n\t\t});\r\n};\r\n\r\n// TODO: this is probably too slow\r\nconst extractUniqueTribes = (board: BoardEntity[], allCards: AllCardsService): readonly Race[] => {\r\n\tconst boardReferenceCards = board.map((m) => allCards.getCard(m.cardId));\r\n\tconst minionsPlayedWithTribes = boardReferenceCards.filter((c) => !!c.races?.length);\r\n\tconst minionsToProcess: /*Mutable<ReferenceCard & { picked?: boolean }>*/ any[] = [\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((c) => !c.races.includes(Race[Race.ALL]))\r\n\t\t\t.map((c) => ({ ...c, races: [...c.races] })),\r\n\t];\r\n\r\n\tconst uniqueTribes: Race[] = [];\r\n\tconst maxTribesPerMinion = 2;\r\n\tfor (let i = 1; i <= maxTribesPerMinion; i++) {\r\n\t\tlet dirty = true;\r\n\t\twhile (dirty) {\r\n\t\t\tdirty = false;\r\n\t\t\tfor (let j = 0; j < minionsToProcess.length; j++) {\r\n\t\t\t\tconst minion = minionsToProcess[j];\r\n\t\t\t\t// console.debug('considering minion', minion.name, minion.races);\r\n\t\t\t\tif (!minion.picked && minion.races.length > 0 && minion.races.length <= i) {\r\n\t\t\t\t\tconst raceToAdd: string = minion.races[0];\r\n\t\t\t\t\tuniqueTribes.push(Race[raceToAdd]);\r\n\t\t\t\t\t// console.debug('added', raceToAdd, uniqueTribes);\r\n\t\t\t\t\tfor (const m of minionsToProcess) {\r\n\t\t\t\t\t\tm.races = m.races.filter((r) => r !== raceToAdd);\r\n\t\t\t\t\t\t// console.debug('updates races', m.name, m.races, raceToAdd);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tminion.picked = true;\r\n\t\t\t\t\tdirty = true;\r\n\t\t\t\t\t// Restart the loop, so we're not dependant on the order in which we process things\r\n\t\t\t\t\tj = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// minionsToProcess = minionsToProcess.filter((c) => !c.picked);\r\n\t\t}\r\n\t}\r\n\r\n\tuniqueTribes.push(\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((m) => m.races.includes(Race[Race.ALL]))\r\n\t\t\t.flatMap((m) => m.races)\r\n\t\t\t.map((r: string) => Race[r]),\r\n\t);\r\n\treturn uniqueTribes;\r\n};\r\n"]}
|
|
@@ -224,8 +224,7 @@ class Spectator {
|
|
|
224
224
|
if (!spawnedEntities || spawnedEntities.length === 0) {
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
|
-
if (!sourceEntity.entityId) {
|
|
228
|
-
console.error('missing spawn source entity id', sourceEntity);
|
|
227
|
+
if (!(sourceEntity === null || sourceEntity === void 0 ? void 0 : sourceEntity.entityId)) {
|
|
229
228
|
}
|
|
230
229
|
const friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;
|
|
231
230
|
const opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spectator.js","sourceRoot":"","sources":["../../../src/simulation/spectator/spectator.ts"],"names":[],"mappings":";;;AAOA,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,SAAS;IAiBrB,YAAY,WAA0B;QACrC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;QAC1D,IAAI,CAAC,qBAAqB,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC;QACxE,IAAI,CAAC,mBAAmB,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC;QACxE,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;QAC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AM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;SACP,CAAA,CAClB,CAAC;IACH,CAAC;CACD;AA1fD,8BA0fC","sourcesContent":["import { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BgsBattleInfo } from '../../bgs-battle-info';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tprivate readonly playerCardId?: string;\r\n\tprivate readonly playerHeroPowerCardId: string;\r\n\tprivate readonly playerHeroPowerUsed: boolean;\r\n\t// private readonly playerRewardCardId: string;\r\n\t// private readonly playerRewardData: number;\r\n\tprivate readonly opponentCardId: string;\r\n\tprivate readonly opponentHeroPowerCardId: string;\r\n\tprivate readonly opponentHeroPowerUsed: boolean;\r\n\t// private readonly opponentRewardCardId: string;\r\n\t// private readonly opponentRewardData: number;\r\n\r\n\tconstructor(battleInput: BgsBattleInfo) {\r\n\t\tthis.playerCardId = battleInput.playerBoard.player.cardId;\r\n\t\tthis.playerHeroPowerCardId = battleInput.playerBoard.player.heroPowerId;\r\n\t\tthis.playerHeroPowerUsed = battleInput.playerBoard.player.heroPowerUsed;\r\n\t\tthis.opponentCardId = battleInput.opponentBoard.player.cardId;\r\n\t\tthis.opponentHeroPowerCardId = battleInput.opponentBoard.player.heroPowerId;\r\n\t\tthis.opponentHeroPowerUsed = battleInput.opponentBoard.player.heroPowerUsed;\r\n\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t\tplayerCardId: this.playerCardId,\r\n\t\t\tplayerHeroPowerCardId: this.playerHeroPowerCardId,\r\n\t\t\tplayerHeroPowerUsed: this.playerHeroPowerUsed,\r\n\t\t\t// playerRewardCardId: this.playerRewardCardId,\r\n\t\t\t// playerRewardData: this.playerRewardData,\r\n\t\t\topponentCardId: this.opponentCardId,\r\n\t\t\topponentHeroPowerCardId: this.opponentHeroPowerCardId,\r\n\t\t\topponentHeroPowerUsed: this.opponentHeroPowerUsed,\r\n\t\t\t// opponentRewardCardId: this.opponentRewardCardId,\r\n\t\t\t// opponentRewardData: this.opponentRewardData,\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst playerSecrets = isAttackerFriendly ? attackingBoardHero.secrets : defendingBoardHero.secrets;\r\n\t\tconst opponentSecrets = isAttackerFriendly ? defendingBoardHero.secrets : attackingBoardHero.secrets;\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t\tplayerSecrets: (playerSecrets ?? []).filter((s) => !s.triggered),\r\n\t\t\topponentSecrets: (opponentSecrets ?? []).filter((s) => !s.triggered),\r\n\r\n\t\t\tplayerRewardCardId: playerHero?.questRewardEntities?.[0]?.cardId ?? playerHero?.questRewards?.[0],\r\n\t\t\tplayerRewardEntityId: playerHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\tplayerRewardData: playerHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t\topponentRewardCardId: opponentHero?.questRewardEntities?.[0]?.cardId ?? opponentHero?.questRewards?.[0],\r\n\t\t\topponentRewardEntityId: opponentHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\topponentRewardData: opponentHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tconst playerSecrets = friendlyHero.secrets;\r\n\t\tconst opponentSecrets = opponentHero.secrets;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t\tplayerSecrets: playerSecrets ?? [],\r\n\t\t\topponentSecrets: opponentSecrets ?? [],\r\n\t\t\tplayerRewardCardId: friendlyHero.questRewardEntities?.[0]?.cardId ?? friendlyHero.questRewards?.[0],\r\n\t\t\tplayerRewardEntityId: friendlyHero.questRewardEntities?.[0]?.entityId,\r\n\t\t\tplayerRewardData: friendlyHero.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t\topponentRewardCardId: opponentHero.questRewardEntities?.[0]?.cardId ?? opponentHero.questRewards?.[0],\r\n\t\t\topponentRewardEntityId: opponentHero.questRewardEntities?.[0]?.entityId,\r\n\t\t\topponentRewardData: opponentHero.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!sourceEntity.entityId && !(sourceEntity as BgsPlayerEntity).heroPowerId) {\r\n\t\t\t// console.error('missing damaging entity id', sourceEntity.cardId);\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t\tplayerSecrets: (friendlyHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\t\topponentSecrets: (opponentHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\t\tplayerRewardCardId: friendlyHero?.questRewardEntities?.[0]?.cardId ?? friendlyHero?.questRewards?.[0],\r\n\t\t\tplayerRewardEntityId: friendlyHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\tplayerRewardData: friendlyHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t\topponentRewardCardId: opponentHero?.questRewardEntities?.[0]?.cardId ?? opponentHero?.questRewards?.[0],\r\n\t\t\topponentRewardEntityId: opponentHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\topponentRewardData: opponentHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity.entityId) {\r\n\t\t\tconsole.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t\tplayerBoard: undefined,\r\n\t\t\topponentBoard: undefined,\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction && !action.playerBoard) {\r\n\t\t\t\taction.playerBoard = lastAction.playerBoard;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentBoard) {\r\n\t\t\t\taction.opponentBoard = lastAction.opponentBoard;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerHand) {\r\n\t\t\t\taction.playerHand = lastAction.playerHand;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentHand) {\r\n\t\t\t\taction.opponentHand = lastAction.opponentHand;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerSecrets) {\r\n\t\t\t\taction.playerSecrets = lastAction.playerSecrets;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentSecrets) {\r\n\t\t\t\taction.opponentSecrets = lastAction.opponentSecrets;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerRewardCardId) {\r\n\t\t\t\taction.playerRewardCardId = lastAction.playerRewardCardId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerRewardEntityId) {\r\n\t\t\t\taction.playerRewardEntityId = lastAction.playerRewardEntityId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerRewardData) {\r\n\t\t\t\taction.playerRewardData = lastAction.playerRewardData;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentRewardCardId) {\r\n\t\t\t\taction.opponentRewardCardId = lastAction.opponentRewardCardId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentRewardEntityId) {\r\n\t\t\t\taction.opponentRewardEntityId = lastAction.opponentRewardEntityId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentRewardData) {\r\n\t\t\t\taction.opponentRewardData = lastAction.opponentRewardData;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"spectator.js","sourceRoot":"","sources":["../../../src/simulation/spectator/spectator.ts"],"names":[],"mappings":";;;AAOA,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,SAAS;IAiBrB,YAAY,WAA0B;QACrC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;QAC1D,IAAI,CAAC,qBAAqB,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC;QACxE,IAAI,CAAC,mBAAmB,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC;QACxE,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9D,IAAI,CAAC,uBAAuB,GAAG,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC5E,IAAI,CAAC,qBAAqB,GAAG,WA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EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;SACP,CAAA,CAClB,CAAC;IACH,CAAC;CACD;AA1fD,8BA0fC","sourcesContent":["import { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BgsBattleInfo } from '../../bgs-battle-info';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tprivate readonly playerCardId?: string;\r\n\tprivate readonly playerHeroPowerCardId: string;\r\n\tprivate readonly playerHeroPowerUsed: boolean;\r\n\t// private readonly playerRewardCardId: string;\r\n\t// private readonly playerRewardData: number;\r\n\tprivate readonly opponentCardId: string;\r\n\tprivate readonly opponentHeroPowerCardId: string;\r\n\tprivate readonly opponentHeroPowerUsed: boolean;\r\n\t// private readonly opponentRewardCardId: string;\r\n\t// private readonly opponentRewardData: number;\r\n\r\n\tconstructor(battleInput: BgsBattleInfo) {\r\n\t\tthis.playerCardId = battleInput.playerBoard.player.cardId;\r\n\t\tthis.playerHeroPowerCardId = battleInput.playerBoard.player.heroPowerId;\r\n\t\tthis.playerHeroPowerUsed = battleInput.playerBoard.player.heroPowerUsed;\r\n\t\tthis.opponentCardId = battleInput.opponentBoard.player.cardId;\r\n\t\tthis.opponentHeroPowerCardId = battleInput.opponentBoard.player.heroPowerId;\r\n\t\tthis.opponentHeroPowerUsed = battleInput.opponentBoard.player.heroPowerUsed;\r\n\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t\tplayerCardId: this.playerCardId,\r\n\t\t\tplayerHeroPowerCardId: this.playerHeroPowerCardId,\r\n\t\t\tplayerHeroPowerUsed: this.playerHeroPowerUsed,\r\n\t\t\t// playerRewardCardId: this.playerRewardCardId,\r\n\t\t\t// playerRewardData: this.playerRewardData,\r\n\t\t\topponentCardId: this.opponentCardId,\r\n\t\t\topponentHeroPowerCardId: this.opponentHeroPowerCardId,\r\n\t\t\topponentHeroPowerUsed: this.opponentHeroPowerUsed,\r\n\t\t\t// opponentRewardCardId: this.opponentRewardCardId,\r\n\t\t\t// opponentRewardData: this.opponentRewardData,\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst playerSecrets = isAttackerFriendly ? attackingBoardHero.secrets : defendingBoardHero.secrets;\r\n\t\tconst opponentSecrets = isAttackerFriendly ? defendingBoardHero.secrets : attackingBoardHero.secrets;\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t\tplayerSecrets: (playerSecrets ?? []).filter((s) => !s.triggered),\r\n\t\t\topponentSecrets: (opponentSecrets ?? []).filter((s) => !s.triggered),\r\n\r\n\t\t\tplayerRewardCardId: playerHero?.questRewardEntities?.[0]?.cardId ?? playerHero?.questRewards?.[0],\r\n\t\t\tplayerRewardEntityId: playerHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\tplayerRewardData: playerHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t\topponentRewardCardId: opponentHero?.questRewardEntities?.[0]?.cardId ?? opponentHero?.questRewards?.[0],\r\n\t\t\topponentRewardEntityId: opponentHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\topponentRewardData: opponentHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tconst playerSecrets = friendlyHero.secrets;\r\n\t\tconst opponentSecrets = opponentHero.secrets;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t\tplayerSecrets: playerSecrets ?? [],\r\n\t\t\topponentSecrets: opponentSecrets ?? [],\r\n\t\t\tplayerRewardCardId: friendlyHero.questRewardEntities?.[0]?.cardId ?? friendlyHero.questRewards?.[0],\r\n\t\t\tplayerRewardEntityId: friendlyHero.questRewardEntities?.[0]?.entityId,\r\n\t\t\tplayerRewardData: friendlyHero.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t\topponentRewardCardId: opponentHero.questRewardEntities?.[0]?.cardId ?? opponentHero.questRewards?.[0],\r\n\t\t\topponentRewardEntityId: opponentHero.questRewardEntities?.[0]?.entityId,\r\n\t\t\topponentRewardData: opponentHero.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!sourceEntity.entityId && !(sourceEntity as BgsPlayerEntity).heroPowerId) {\r\n\t\t\t// console.error('missing damaging entity id', sourceEntity.cardId);\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t\tplayerSecrets: (friendlyHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\t\topponentSecrets: (opponentHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\t\tplayerRewardCardId: friendlyHero?.questRewardEntities?.[0]?.cardId ?? friendlyHero?.questRewards?.[0],\r\n\t\t\tplayerRewardEntityId: friendlyHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\tplayerRewardData: friendlyHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t\topponentRewardCardId: opponentHero?.questRewardEntities?.[0]?.cardId ?? opponentHero?.questRewards?.[0],\r\n\t\t\topponentRewardEntityId: opponentHero?.questRewardEntities?.[0]?.entityId,\r\n\t\t\topponentRewardData: opponentHero?.questRewardEntities?.[0]?.scriptDataNum1,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity?.entityId) {\r\n\t\t\t// console.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t\tplayerBoard: undefined,\r\n\t\t\topponentBoard: undefined,\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tplayerSecrets: null,\r\n\t\t\topponentSecrets: null,\r\n\t\t\tplayerRewardCardId: null,\r\n\t\t\tplayerRewardEntityId: null,\r\n\t\t\tplayerRewardData: null,\r\n\t\t\topponentRewardCardId: null,\r\n\t\t\topponentRewardEntityId: null,\r\n\t\t\topponentRewardData: null,\r\n\t\t};\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction && !action.playerBoard) {\r\n\t\t\t\taction.playerBoard = lastAction.playerBoard;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentBoard) {\r\n\t\t\t\taction.opponentBoard = lastAction.opponentBoard;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerHand) {\r\n\t\t\t\taction.playerHand = lastAction.playerHand;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentHand) {\r\n\t\t\t\taction.opponentHand = lastAction.opponentHand;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerSecrets) {\r\n\t\t\t\taction.playerSecrets = lastAction.playerSecrets;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentSecrets) {\r\n\t\t\t\taction.opponentSecrets = lastAction.opponentSecrets;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerRewardCardId) {\r\n\t\t\t\taction.playerRewardCardId = lastAction.playerRewardCardId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerRewardEntityId) {\r\n\t\t\t\taction.playerRewardEntityId = lastAction.playerRewardEntityId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.playerRewardData) {\r\n\t\t\t\taction.playerRewardData = lastAction.playerRewardData;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentRewardCardId) {\r\n\t\t\t\taction.opponentRewardCardId = lastAction.opponentRewardCardId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentRewardEntityId) {\r\n\t\t\t\taction.opponentRewardEntityId = lastAction.opponentRewardEntityId;\r\n\t\t\t}\r\n\t\t\tif (lastAction && !action.opponentRewardData) {\r\n\t\t\t\taction.opponentRewardData = lastAction.opponentRewardData;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n}\r\n"]}
|