@firestone-hs/simulate-bgs-battle 1.1.753 → 1.1.755

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/cards/card.interface.d.ts +1 -1
  2. package/dist/cards/card.interface.js.map +1 -1
  3. package/dist/cards/impl/_card-mappings.js +5 -0
  4. package/dist/cards/impl/_card-mappings.js.map +1 -1
  5. package/dist/cards/impl/enchantments/deaths-embrace.js +0 -2
  6. package/dist/cards/impl/enchantments/deaths-embrace.js.map +1 -1
  7. package/dist/cards/impl/enchantments/doppelganger.d.ts +2 -0
  8. package/dist/cards/impl/enchantments/doppelganger.js +26 -0
  9. package/dist/cards/impl/enchantments/doppelganger.js.map +1 -0
  10. package/dist/cards/impl/minion/abyssal-bruiser.js +0 -2
  11. package/dist/cards/impl/minion/abyssal-bruiser.js.map +1 -1
  12. package/dist/cards/impl/minion/cthrax-wrecker.js +2 -3
  13. package/dist/cards/impl/minion/cthrax-wrecker.js.map +1 -1
  14. package/dist/cards/impl/minion/cutthroat-kthir.js +2 -3
  15. package/dist/cards/impl/minion/cutthroat-kthir.js.map +1 -1
  16. package/dist/cards/impl/minion/dark-paradox.js +2 -3
  17. package/dist/cards/impl/minion/dark-paradox.js.map +1 -1
  18. package/dist/cards/impl/minion/dark-puppeteer.js +3 -3
  19. package/dist/cards/impl/minion/dark-puppeteer.js.map +1 -1
  20. package/dist/cards/impl/minion/de-volition-ist.js +0 -3
  21. package/dist/cards/impl/minion/de-volition-ist.js.map +1 -1
  22. package/dist/cards/impl/minion/drifting-sacrifice.js +2 -3
  23. package/dist/cards/impl/minion/drifting-sacrifice.js.map +1 -1
  24. package/dist/cards/impl/minion/drustfallen-butcher.js +1 -1
  25. package/dist/cards/impl/minion/drustfallen-butcher.js.map +1 -1
  26. package/dist/cards/impl/minion/echoing-roar.js +1 -2
  27. package/dist/cards/impl/minion/echoing-roar.js.map +1 -1
  28. package/dist/cards/impl/minion/faceless-converter.js +2 -3
  29. package/dist/cards/impl/minion/faceless-converter.js.map +1 -1
  30. package/dist/cards/impl/minion/harbinger-aphlass.js +3 -4
  31. package/dist/cards/impl/minion/harbinger-aphlass.js.map +1 -1
  32. package/dist/cards/impl/minion/hopebringer.js +4 -6
  33. package/dist/cards/impl/minion/hopebringer.js.map +1 -1
  34. package/dist/cards/impl/minion/joyous.js +2 -3
  35. package/dist/cards/impl/minion/joyous.js.map +1 -1
  36. package/dist/cards/impl/minion/lurking-leviathan.js +1 -2
  37. package/dist/cards/impl/minion/lurking-leviathan.js.map +1 -1
  38. package/dist/cards/impl/minion/maritime-extortionist.js +0 -2
  39. package/dist/cards/impl/minion/maritime-extortionist.js.map +1 -1
  40. package/dist/cards/impl/minion/mindbender-ghursha.js +2 -3
  41. package/dist/cards/impl/minion/mindbender-ghursha.js.map +1 -1
  42. package/dist/cards/impl/minion/mysterious-kthir.js +4 -4
  43. package/dist/cards/impl/minion/mysterious-kthir.js.map +1 -1
  44. package/dist/cards/impl/minion/ravaging-scorpid.js +1 -1
  45. package/dist/cards/impl/minion/ravaging-scorpid.js.map +1 -1
  46. package/dist/cards/impl/minion/sha-of-fear.js +2 -3
  47. package/dist/cards/impl/minion/sha-of-fear.js.map +1 -1
  48. package/dist/cards/impl/minion/skeletal-strafer.js +4 -6
  49. package/dist/cards/impl/minion/skeletal-strafer.js.map +1 -1
  50. package/dist/cards/impl/minion/the-shadow-of-doubt.js +2 -3
  51. package/dist/cards/impl/minion/the-shadow-of-doubt.js.map +1 -1
  52. package/dist/cards/impl/minion/twilight-primordium.js +1 -2
  53. package/dist/cards/impl/minion/twilight-primordium.js.map +1 -1
  54. package/dist/cards/impl/minion/vicious-mindslasher.js +4 -4
  55. package/dist/cards/impl/minion/vicious-mindslasher.js.map +1 -1
  56. package/dist/cards/impl/trinket/archaic-scroll.js +3 -3
  57. package/dist/cards/impl/trinket/archaic-scroll.js.map +1 -1
  58. package/dist/cards/impl/trinket/bloodbound-earrings.js +1 -2
  59. package/dist/cards/impl/trinket/bloodbound-earrings.js.map +1 -1
  60. package/dist/cards/impl/trinket/copper-coil.js +5 -5
  61. package/dist/cards/impl/trinket/copper-coil.js.map +1 -1
  62. package/dist/cards/impl/trinket/eclectic-shrine.js +2 -3
  63. package/dist/cards/impl/trinket/eclectic-shrine.js.map +1 -1
  64. package/dist/cards/impl/trinket/hammer-of-twilight.d.ts +3 -0
  65. package/dist/cards/impl/trinket/hammer-of-twilight.js +80 -0
  66. package/dist/cards/impl/trinket/hammer-of-twilight.js.map +1 -0
  67. package/dist/cards/impl/trinket/tide-raiser-portrait.js +1 -2
  68. package/dist/cards/impl/trinket/tide-raiser-portrait.js.map +1 -1
  69. package/dist/simulation/battlecries.js +9 -9
  70. package/dist/simulation/battlecries.js.map +1 -1
  71. package/dist/simulation/death-effects.js +6 -2
  72. package/dist/simulation/death-effects.js.map +1 -1
  73. package/dist/simulation/deity.d.ts +5 -0
  74. package/dist/simulation/deity.js +28 -10
  75. package/dist/simulation/deity.js.map +1 -1
  76. package/dist/simulation/discard.js +7 -1
  77. package/dist/simulation/discard.js.map +1 -1
  78. package/dist/simulation/reborn.js +7 -0
  79. package/dist/simulation/reborn.js.map +1 -1
  80. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"battlecries.js","sourceRoot":"","sources":["../../src/simulation/battlecries.ts"],"names":[],"mappings":";;;AAAA,iEAAwF;AAGxF,4DAAgF;AAChF,iEAA4D;AAC5D,mEAAqF;AACrF,6CAAgD;AAEhD,6CAA+C;AAC/C,oCAOkB;AAClB,qCAAyC;AACzC,8EAA2F;AAC3F,mDAAiD;AACjD,qDAAoD;AACpD,6DAAqD;AAGrD,qCAA+C;AAC/C,mCAAsC;AACtC,2CAAkE;AAElE,MAAM,yBAAyB,GAAG;;;;;CAKjC,CAAC;AACF,MAAM,yBAAyB,GAAG;;;;CAIjC,CAAC;AAEK,MAAM,0BAA0B,GAAG,CACzC,KAAoB,EACpB,SAA0B,EAC1B,WAAw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CAC7B,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,MAAmB,EAAE,SAAwB,EAAW,EAAE;;IAC5F,OAAO,MAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,0CAAE,SAAS,0CAAE,QAAQ,CAAC,wBAAO,CAAC,wBAAO,CAAC,SAAS,CAAC,CAAC,mCAAI,KAAK,CAAC;AAC5G,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B","sourcesContent":["import { AllCardsService, CardType, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasBattlecry, hasOnBattlecryTriggered } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { dragonsEyeExtraBattlecryTriggers } from '../cards/impl/trinket/dragons-eye';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { CardIds } from '../services/card-ids';\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} from '../utils';\r\nimport { getNeighbours } from './attack';\r\nimport { incrementBattlecriesTriggeredThisGame } from '../mechanics/player-global-effects';\r\nimport { addCardsInHand } from './cards-in-hand';\r\nimport { dealDamageToHero } from './damage-to-hero';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { SharedState } from './shared-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\nimport { isMinionGolden, makeMinionGolden } from './utils/golden';\r\n\r\nconst DOUBLE_BATTLECRY_CARD_IDS = [\r\n\tCardIds.BrannBronzebeard_BG_LOE_077,\r\n\tCardIds.MoiraBronzebeard_BG27_518,\r\n\tCardIds.BrannsBlessing_BG28_509,\r\n\tCardIds.TimewarpedDeios_BG34_Giant_376,\r\n];\r\nconst TRIPLE_BATTLECRY_CARD_IDS = [\r\n\tCardIds.BrannBronzebeard_TB_BaconUps_045,\r\n\tCardIds.MoiraBronzebeard_BG27_518_G,\r\n\tCardIds.TimewarpedDeios_BG34_Giant_376_G,\r\n];\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n\tentity?: BoardEntity,\r\n\tgameState?: FullGameState,\r\n): number => {\r\n\tconst cardIds = [...board.map((e) => e.cardId), ...(boardHero.secrets?.map((e) => e.cardId) ?? [])];\r\n\tconst triggerMult = cardIds.some((cardId) => TRIPLE_BATTLECRY_CARD_IDS.includes(cardId as CardIds))\r\n\t\t? 3\r\n\t\t: cardIds.some((cardId) => DOUBLE_BATTLECRY_CARD_IDS.includes(cardId as CardIds))\r\n\t\t? 2\r\n\t\t: 1;\r\n\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\tconst warDrum = boardHero.trinkets?.find(\r\n\t\t(t) => t.cardId === CardIds.WarDrum_BG32_MagicItem_416 && t.scriptDataNum1 > 0,\r\n\t);\r\n\r\n\tconst dragonsEye = gameState ? dragonsEyeExtraBattlecryTriggers(entity, boardHero, gameState) : 0;\r\n\r\n\tlet multiplier = echoesOfArgus + triggerMult + gilneanWarHorns + dragonsEye;\r\n\tif (warDrum) {\r\n\t\tmultiplier = multiplier * 2;\r\n\t\twarDrum.scriptDataNum1--;\r\n\t}\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\thero.globalInfo.CardsPlayedThisTurn = (hero.globalInfo.CardsPlayedThisTurn ?? 0) + 1;\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, gameState.sharedState, entity, gameState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tconst battlecryImpl = cardMappings[entity.cardId];\r\n\r\n\t\tlet hasBattlecryTrigger = false;\r\n\t\tif (hasBattlecry(battlecryImpl)) {\r\n\t\t\thasBattlecryTrigger = battlecryImpl.battlecry(entity, {\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (!hasBattlecryTrigger) {\r\n\t\t\tswitch (entity.cardId) {\r\n\t\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, hero, Race.MURLOC, gameState);\r\n\t\t\t\t\tif (!!rockPoolTarget) {\r\n\t\t\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\t\t\tmodifyStats(rockPoolTarget, entity, rockpoolStats, rockpoolStats, board, hero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t3,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\t\tupdateTaunt(sparringPartnersTarget, true, board, hero, otherHero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, hero, Race.DRAGON, gameState);\r\n\t\t\t\t\tif (!!twilightEmissaryTarget) {\r\n\t\t\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\ttwilightEmissaryTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\ttwilightEmissaryStats,\r\n\t\t\t\t\t\t\ttwilightEmissaryStats,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.CrowsNestSentry_BG29_502:\r\n\t\t\t\tcase CardIds.CrowsNestSentry_BG29_502_G:\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.cardId === CardIds.CrowsNestSentry_BG29_502 ? 4 : 8,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.FelfinNavigator_BG_BT_010:\r\n\t\t\t\t// case CardIds.FelfinNavigator_TB_BaconUps_124:\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t\tRace[Race.MURLOC],\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\t\tconst numberOfTimesToTrigger = entity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 1 : 2;\r\n\t\t\t\t\tfor (let i = 0; i < numberOfTimesToTrigger; i++) {\r\n\t\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\t2,\r\n\t\t\t\t\t\t\t2,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tdealDamageToHero(entity, hero, board, 2, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, hero, Race.ELEMENTAL, gameState);\r\n\t\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\t\tmodifyStats(smoggerTarget, entity, smoggerStats, smoggerStats, board, hero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\t\t\t// case CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\t\tconst annihilanStats =\r\n\t\t\t\t\t\t(entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\t\tmodifyStats(entity, entity, 0, annihilanStats, board, hero, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.Necrolyte_BG20_202:\r\n\t\t\t\t// case CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\t// \t// console.debug('triggering necrolyte', entity.entityId);\r\n\t\t\t\t// \tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\t// \tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\t// \tplayBloodGemsOn(entity, necrolyteTarget, necrolyteBloodGems, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(entity, necrolyteTarget, board, hero, otherHero);\r\n\r\n\t\t\t\t// \tconst necrolyteTargetNeighbours = getNeighbours(board, necrolyteTarget);\r\n\t\t\t\t// \tfor (const neighbour of necrolyteTargetNeighbours) {\r\n\t\t\t\t// \t\tconst bloodGemStatsEnchantment = neighbour.enchantments?.find(\r\n\t\t\t\t// \t\t\t(e) => e.cardId === CardIds.BloodGem_BloodGemsEnchantment,\r\n\t\t\t\t// \t\t);\r\n\t\t\t\t// \t\tif (bloodGemStatsEnchantment) {\r\n\t\t\t\t// \t\t\tconst atk = bloodGemStatsEnchantment.tagScriptDataNum1 ?? 0;\r\n\t\t\t\t// \t\t\tconst heath = bloodGemStatsEnchantment.tagScriptDataNum2 ?? 0;\r\n\t\t\t\t// \t\t\tneighbour.attack = Math.max(0, neighbour.attack - atk);\r\n\t\t\t\t// \t\t\tneighbour.health = Math.max(1, neighbour.health - heath);\r\n\t\t\t\t// \t\t\tneighbour.maxHealth = Math.max(1, neighbour.maxHealth - heath);\r\n\t\t\t\t// \t\t\tnecrolyteTarget.attack += atk;\r\n\t\t\t\t// \t\t\tnecrolyteTarget.health += heath;\r\n\t\t\t\t// \t\t\tnecrolyteTarget.maxHealth += heath;\r\n\t\t\t\t// \t\t\tgameState.spectator.registerPowerTarget(necrolyteTarget, neighbour, board, hero, otherHero);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t}\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tstrongshellScavengerStats,\r\n\t\t\t\t\t\t\tstrongshellScavengerStats,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\t\t// case CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\t// \tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\t// \tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\t// \tupdateTaunt(vigilantStonebornTarget, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \tmodifyStats(vigilantStonebornTarget, entity, 0, vigilantStonebornStats, board, hero, gameState);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\t// case CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\t\t// case CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\t// \tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\t// \tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\t// \tupdateTaunt(bonemareTarget, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \tmodifyStats(bonemareTarget, entity, bonemareStats, bonemareStats, board, hero, gameState);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t\t? [CardIds.TavernCoin_BG28_810]\r\n\t\t\t\t\t\t\t: [CardIds.TavernCoin_BG28_810, CardIds.TavernCoin_BG28_810];\r\n\t\t\t\t\taddCardsInHand(hero, board, murozondCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t\t? [CardIds.TavernCoin_BG28_810]\r\n\t\t\t\t\t\t\t: [CardIds.TavernCoin_BG28_810, CardIds.TavernCoin_BG28_810];\r\n\t\t\t\t\taddCardsInHand(hero, board, tavernTempestCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\t\t// case CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\t// \tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\t// \tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\t// \tupdateTaunt(\r\n\t\t\t\t// \t\tironGroundskeeperTarget,\r\n\t\t\t\t// \t\t!ironGroundskeeperTarget.taunt,\r\n\t\t\t\t// \t\tboard,\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\totherHero,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\t\tconst differentTypes = extractUniqueTribes(board, gameState.allCards);\r\n\t\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\t\tconst livingConstellationTarget = pickRandom(allMinions);\r\n\t\t\t\t\tconst boardForTarget = board.includes(livingConstellationTarget) ? board : otherBoard;\r\n\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\tlivingConstellationTarget,\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tlivingConstellationStats,\r\n\t\t\t\t\t\tlivingConstellationStats,\r\n\t\t\t\t\t\tboardForTarget,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\t\t// case CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\t// case CardIds.SparkLing_BG27_019:\r\n\t\t\t\t// case CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\totherBoard,\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\t\tallMinions.filter((e) =>\r\n\t\t\t\t\t\t\thasCorrectTribe(e, hero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards),\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!emergentFlameTarget) {\r\n\t\t\t\t\t\tconst targetBoard = board.includes(emergentFlameTarget) ? board : otherBoard;\r\n\t\t\t\t\t\tconst targetHero = board.includes(emergentFlameTarget) ? hero : otherHero;\r\n\t\t\t\t\t\tconst emergentFlameMultiplier = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\t\t\tconst emergentFlameStats = (entity.scriptDataNum1 ?? 1) * emergentFlameMultiplier;\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\temergentFlameTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\temergentFlameStats,\r\n\t\t\t\t\t\t\temergentFlameStats,\r\n\t\t\t\t\t\t\ttargetBoard,\r\n\t\t\t\t\t\t\ttargetHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\t\tconst captainSandersTarget = pickRandom(\r\n\t\t\t\t\t\tboard.filter((e) => !isMinionGolden(e, gameState.allCards) && e.tavernTier <= 6),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, hero, otherBoard, otherHero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FacelessDisciple_BG24_719:\r\n\t\t\t\tcase CardIds.FacelessDisciple_BG24_719_G:\r\n\t\t\t\t\tconst target = pickRandom(allMinions.filter((e) => !e.definitelyDead && e.health > 0));\r\n\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, target, board, hero, otherHero);\r\n\t\t\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(target.cardId);\r\n\t\t\t\t\t\tconst targetTier =\r\n\t\t\t\t\t\t\tentity.cardId === CardIds.FacelessDisciple_BG24_719 ? minionTier + 1 : minionTier + 2;\r\n\t\t\t\t\t\tconst maxTier =\r\n\t\t\t\t\t\t\t!!gameState.anomalies?.includes(CardIds.SecretsOfNorgannon_BG27_Anomaly_504) ||\r\n\t\t\t\t\t\t\thero.questRewardEntities?.some((r) => r.cardId === CardIds.NorgannonsReward_BG33_Reward_010)\r\n\t\t\t\t\t\t\t\t? 7\r\n\t\t\t\t\t\t\t\t: 6;\r\n\t\t\t\t\t\tconst newMinionId = gameState.cardsData.getRandomMinionForTavernTier(\r\n\t\t\t\t\t\t\tMath.min(maxTier, targetTier),\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconst targetBoard = board.includes(target) ? board : otherBoard;\r\n\t\t\t\t\t\tconst targetHero = board.includes(target) ? hero : otherHero;\r\n\t\t\t\t\t\tconst newMinion = buildSingleBoardEntity(\r\n\t\t\t\t\t\t\tnewMinionId,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t\t\ttargetHero.friendly,\r\n\t\t\t\t\t\t\tgameState.sharedState.currentEntityId++,\r\n\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t\tgameState.cardsData,\r\n\t\t\t\t\t\t\tgameState.sharedState,\r\n\t\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\t// Replace the target with the new minion\r\n\t\t\t\t\t\tconst index = targetBoard.indexOf(target);\r\n\t\t\t\t\t\t// console.debug('board before disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\t\ttargetBoard.splice(index, 1, newMinion);\r\n\t\t\t\t\t\t// console.debug('board after disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, newMinion, targetBoard, hero, otherHero);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.Amalgadon_BGS_069:\r\n\t\t\t\t// case CardIds.Amalgadon_TB_BaconUps_121:\r\n\t\t\t\t// \tconst numberOfTribes = extractUniqueTribes(board, gameState.allCards).length;\r\n\t\t\t\t// \tconst amalgadonMultiplier = entity.cardId === CardIds.Amalgadon_BGS_069 ? 1 : 2;\r\n\t\t\t\t// \tconst totalAdapts = amalgadonMultiplier * numberOfTribes;\r\n\t\t\t\t// \tfor (let i = 0; i < totalAdapts; i++) {\r\n\t\t\t\t// \t\tconst adapts = [\r\n\t\t\t\t// \t\t\tCardIds.FlamingClawsToken,\r\n\t\t\t\t// \t\t\tCardIds.LivingSporesToken,\r\n\t\t\t\t// \t\t\tCardIds.VolcanicMightToken,\r\n\t\t\t\t// \t\t\tCardIds.RockyCarapaceToken,\r\n\t\t\t\t// \t\t];\r\n\t\t\t\t// \t\tif (!entity.divineShield) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.CracklingShieldToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tif (!entity.windfury) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.LightningSpeedToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tif (!entity.taunt) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.MassiveToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tif (!entity.venomous && !entity.poisonous) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.PoisonSpitToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tconst adapt = pickRandom(adapts);\r\n\t\t\t\t// \t\tswitch (adapt) {\r\n\t\t\t\t// \t\t\tcase CardIds.FlamingClawsToken:\r\n\t\t\t\t// \t\t\t\tmodifyStats(entity, entity, 3, 0, board, hero, gameState, false);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.LivingSporesToken:\r\n\t\t\t\t// \t\t\t\tentity.enchantments = entity.enchantments ?? [];\r\n\t\t\t\t// \t\t\t\tentity.enchantments.push({\r\n\t\t\t\t// \t\t\t\t\tcardId: CardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\t// \t\t\t\t\ttiming: 0,\r\n\t\t\t\t// \t\t\t\t});\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.LightningSpeedToken:\r\n\t\t\t\t// \t\t\t\tupdateWindfury(entity, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.MassiveToken:\r\n\t\t\t\t// \t\t\t\tupdateTaunt(entity, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.PoisonSpitToken:\r\n\t\t\t\t// \t\t\t\tentity.poisonous = true;\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.RockyCarapaceToken:\r\n\t\t\t\t// \t\t\t\tmodifyStats(entity, entity, 0, 3, board, hero, gameState, false);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.CracklingShieldToken:\r\n\t\t\t\t// \t\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.VolcanicMightToken:\r\n\t\t\t\t// \t\t\t\tmodifyStats(entity, entity, 1, 1, board, hero, gameState, false);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t}\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.Eagill_BG28_630:\r\n\t\t\t\tcase CardIds.Eagill_BG28_630_G:\r\n\t\t\t\t\tconst eagillMultiplier = entity.cardId === CardIds.Eagill_BG28_630 ? 1 : 2;\r\n\t\t\t\t\tconst eagillBoardTarget = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\t\tif (eagillBoardTarget) {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\teagillBoardTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\t2 * eagillMultiplier,\r\n\t\t\t\t\t\t\t3 * eagillMultiplier,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst eagillHandTarget = pickRandom(\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (eagillHandTarget) {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\teagillHandTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\t2 * eagillMultiplier,\r\n\t\t\t\t\t\t\t3 * eagillMultiplier,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ShellWhistler_BG26_045:\r\n\t\t\t\tcase CardIds.ShellWhistler_BG26_045_G:\r\n\t\t\t\t\tconst shellWhistlerCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.ShellWhistler_BG26_045_G ? [null] : [null, null];\r\n\t\t\t\t\taddCardsInHand(hero, board, shellWhistlerCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104:\r\n\t\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104_G:\r\n\t\t\t\t\tconst playerState = getPlayerState(gameState.gameState, hero);\r\n\t\t\t\t\tif (playerState) {\r\n\t\t\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\t\t\tentity.cardId === CardIds.FriendlySaloonkeeper_BGDUO_104\r\n\t\t\t\t\t\t\t\t? [CardIds.TavernCoin_BG28_810]\r\n\t\t\t\t\t\t\t\t: [CardIds.TavernCoin_BG28_810, CardIds.TavernCoin_BG28_810];\r\n\t\t\t\t\t\taddCardsInHand(playerState.player, playerState.board, cardsToAdd, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111:\r\n\t\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111_G:\r\n\t\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.GenerousGeomancer_BGDUO_111\r\n\t\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\t\taddCardsInHand(\r\n\t\t\t\t\t\tgameState.gameState.player.player,\r\n\t\t\t\t\t\tgameState.gameState.player.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\tif (gameState.gameState.player.teammate) {\r\n\t\t\t\t\t\taddCardsInHand(\r\n\t\t\t\t\t\t\tgameState.gameState.player.teammate.player,\r\n\t\t\t\t\t\t\tgameState.gameState.player.teammate.board,\r\n\t\t\t\t\t\t\tcardsToAdd,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.OrcEstraConductor_BGDUO_119:\r\n\t\t\t\tcase CardIds.OrcEstraConductor_BGDUO_119_G:\r\n\t\t\t\t\tconst conductorTarget = pickRandom(\r\n\t\t\t\t\t\tallMinions.filter((e) =>\r\n\t\t\t\t\t\t\thasCorrectTribe(e, hero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards),\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!conductorTarget) {\r\n\t\t\t\t\t\tconst targetBoard = board.includes(conductorTarget) ? board : otherBoard;\r\n\t\t\t\t\t\tconst targetHero = board.includes(conductorTarget) ? hero : otherHero;\r\n\t\t\t\t\t\tconst multiplier = entity.cardId === CardIds.OrcEstraConductor_BGDUO_119 ? 1 : 2;\r\n\t\t\t\t\t\tconst attackStats = 2 * (entity.scriptDataNum1 ?? 1) * multiplier;\r\n\t\t\t\t\t\tconst healthStats = 2 * (entity.scriptDataNum1 ?? 1) * multiplier;\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\tconductorTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tattackStats,\r\n\t\t\t\t\t\t\thealthStats,\r\n\t\t\t\t\t\t\ttargetBoard,\r\n\t\t\t\t\t\t\ttargetHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FacelessOne_BGDUO_HERO_100_Buddy:\r\n\t\t\t\tcase CardIds.FacelessOne_BGDUO_HERO_100_Buddy_G:\r\n\t\t\t\t\tconst facelessOneCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.FacelessOne_BGDUO_HERO_100_Buddy ? [null] : [null, null];\r\n\t\t\t\t\taddCardsInHand(hero, board, facelessOneCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.Phyresz_TB_BaconShop_HERO_91_Buddy:\r\n\t\t\t\tcase CardIds.Phyresz_TB_BaconShop_HERO_91_Buddy_G:\r\n\t\t\t\t\tconst phyreszCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.Phyresz_TB_BaconShop_HERO_91_Buddy ? [null] : [null, null];\r\n\t\t\t\t\taddCardsInHand(hero, board, phyreszCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.Muckslinger_TB_BaconShop_HERO_23_Buddy:\r\n\t\t\t\tcase CardIds.Muckslinger_TB_BaconShop_HERO_23_Buddy_G:\r\n\t\t\t\t\tconst muckslingerCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.Muckslinger_TB_BaconShop_HERO_23_Buddy\r\n\t\t\t\t\t\t\t? [pickRandom(gameState.cardsData.battlecryMinions)]\r\n\t\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.battlecryMinions),\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.battlecryMinions),\r\n\t\t\t\t\t\t\t ];\r\n\t\t\t\t\taddCardsInHand(hero, board, muckslingerCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.BarrensBrawler_BG29_861:\r\n\t\t\t\tcase CardIds.BarrensBrawler_BG29_861_G:\r\n\t\t\t\t\tconst barrendsBrawlerCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.BarrensBrawler_BG29_861\r\n\t\t\t\t\t\t\t? [pickRandom(gameState.cardsData.deathrattleMinions)]\r\n\t\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.deathrattleMinions),\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.deathrattleMinions),\r\n\t\t\t\t\t\t\t ];\r\n\t\t\t\t\taddCardsInHand(hero, board, barrendsBrawlerCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.NathanosBlightcaller_BG23_HERO_306_Buddy:\r\n\t\t\t\tcase CardIds.NathanosBlightcaller_BG23_HERO_306_Buddy_G:\r\n\t\t\t\t\tconst nathanosTarget = pickRandom(board);\r\n\t\t\t\t\tif (nathanosTarget) {\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, nathanosTarget, board, null, null);\r\n\t\t\t\t\t\tnathanosTarget.definitelyDead = true;\r\n\t\t\t\t\t\tconst buffMultiplier =\r\n\t\t\t\t\t\t\tentity.cardId === CardIds.NathanosBlightcaller_BG23_HERO_306_Buddy ? 1 : 2;\r\n\t\t\t\t\t\tconst attackBuff = nathanosTarget.attack * buffMultiplier;\r\n\t\t\t\t\t\tconst healthBuff = nathanosTarget.health * buffMultiplier;\r\n\t\t\t\t\t\tconst buffTargets = getNeighbours(board, nathanosTarget);\r\n\t\t\t\t\t\tbuffTargets.forEach((e) => {\r\n\t\t\t\t\t\t\tmodifyStats(e, entity, attackBuff, healthBuff, board, hero, gameState);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.LuckyEgg_BG30_104:\r\n\t\t\t\tcase CardIds.LuckyEgg_BG30_104_G:\r\n\t\t\t\t\tif (board.length > 0) {\r\n\t\t\t\t\t\tconst transformedInto = gameState.cardsData.getRandomMinionForTavernTier(3);\r\n\t\t\t\t\t\tconst premiumDbfId = gameState.allCards.getCard(transformedInto).battlegroundsPremiumDbfId;\r\n\t\t\t\t\t\tconst goldenCardId = gameState.allCards.getCard(premiumDbfId).id;\r\n\t\t\t\t\t\tconst currentIndex = board.findIndex((e) => e.entityId === entity.entityId);\r\n\t\t\t\t\t\tconst currentIndexFromRight = board.length - currentIndex - 1;\r\n\t\t\t\t\t\tboard.splice(currentIndex, 1);\r\n\t\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\t\tgoldenCardId,\r\n\t\t\t\t\t\t\t1,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t\tentity.friendly,\r\n\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tcurrentIndexFromRight,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.MuseumMummy_BG30_850:\r\n\t\t\t\tcase CardIds.MuseumMummy_BG30_850_G:\r\n\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\tentity.cardId === CardIds.MuseumMummy_BG30_850_G\r\n\t\t\t\t\t\t\t? CardIds.Skeleton_BG_ICC_026t_G\r\n\t\t\t\t\t\t\t: CardIds.SkeletonToken,\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tentity.friendly,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst indexFromRight = board.length - board.findIndex((e) => e.entityId === entity.entityId) - 1;\r\n\t\t\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t// All hte Battlecry minions that arent implemented / have no effect on the board state\r\n\t\t\t\t\tconst hasBattlecry = gameState.allCards\r\n\t\t\t\t\t\t.getCard(entity.cardId)\r\n\t\t\t\t\t\t?.mechanics?.includes(GameTag[GameTag.BATTLECRY]);\r\n\t\t\t\t\thasTriggered = hasBattlecry;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\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\tincrementBattlecriesTriggeredThisGame(hero, board, gameState);\r\n\tfor (const boardEntity of board) {\r\n\t\tconst onBattlecryTriggeredImpl = cardMappings[boardEntity.cardId];\r\n\t\tif (hasOnBattlecryTriggered(onBattlecryTriggeredImpl)) {\r\n\t\t\tonBattlecryTriggeredImpl.onBattlecryTriggered(boardEntity, {\r\n\t\t\t\tboard: board,\r\n\t\t\t\thero: hero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\tconst onBattlecryTriggeredImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasOnBattlecryTriggered(onBattlecryTriggeredImpl)) {\r\n\t\t\tonBattlecryTriggeredImpl.onBattlecryTriggered(trinket, {\r\n\t\t\t\tboard: board,\r\n\t\t\t\thero: hero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\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\r\nexport const hasMinionBattlecry = (entity: BoardEntity, gameState: FullGameState): boolean => {\r\n\treturn gameState.allCards.getCard(entity.cardId)?.mechanics?.includes(GameTag[GameTag.BATTLECRY]) ?? false;\r\n};\r\n\r\nexport interface BattlecryInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\nexport type OnBattlecryTriggeredInput = BattlecryInput;\r\n"]}
1
+ {"version":3,"file":"battlecries.js","sourceRoot":"","sources":["../../src/simulation/battlecries.ts"],"names":[],"mappings":";;;AAAA,iEAAwF;AAGxF,4DAAgF;AAChF,iEAA4D;AAC5D,mEAAqF;AACrF,6CAAgD;AAChD,8EAA2F;AAE3F,6CAA+C;A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,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;AAEK,MAAM,kBAAkB,GAAG,CAAC,MAAmB,EAAE,SAAwB,EAAW,EAAE;;IAC5F,OAAO,MAAA,MAAA,MAAA,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,0CAAE,SAAS,0CAAE,QAAQ,CAAC,wBAAO,CAAC,wBAAO,CAAC,SAAS,CAAC,CAAC,mCAAI,KAAK,CAAC;AAC5G,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B","sourcesContent":["import { AllCardsService, CardType, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasBattlecry, hasOnBattlecryTriggered } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { dragonsEyeExtraBattlecryTriggers } from '../cards/impl/trinket/dragons-eye';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { incrementBattlecriesTriggeredThisGame } from '../mechanics/player-global-effects';\r\nimport { CardIds } from '../services/card-ids';\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} from '../utils';\r\nimport { getNeighbours } from './attack';\r\nimport { addCardsInHand } from './cards-in-hand';\r\nimport { dealDamageToHero } from './damage-to-hero';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { SharedState } from './shared-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\nimport { isMinionGolden, makeMinionGolden } from './utils/golden';\r\n\r\nconst DOUBLE_BATTLECRY_CARD_IDS = [\r\n\tCardIds.BrannBronzebeard_BG_LOE_077,\r\n\tCardIds.MoiraBronzebeard_BG27_518,\r\n\tCardIds.BrannsBlessing_BG28_509,\r\n\tCardIds.TimewarpedDeios_BG34_Giant_376,\r\n];\r\nconst TRIPLE_BATTLECRY_CARD_IDS = [\r\n\tCardIds.BrannBronzebeard_TB_BaconUps_045,\r\n\tCardIds.MoiraBronzebeard_BG27_518_G,\r\n\tCardIds.TimewarpedDeios_BG34_Giant_376_G,\r\n];\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n\tentity?: BoardEntity,\r\n\tgameState?: FullGameState,\r\n): number => {\r\n\tconst cardIds = [...board.map((e) => e.cardId), ...(boardHero.secrets?.map((e) => e.cardId) ?? [])];\r\n\tconst triggerMult = cardIds.some((cardId) => TRIPLE_BATTLECRY_CARD_IDS.includes(cardId as CardIds))\r\n\t\t? 3\r\n\t\t: cardIds.some((cardId) => DOUBLE_BATTLECRY_CARD_IDS.includes(cardId as CardIds))\r\n\t\t? 2\r\n\t\t: 1;\r\n\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\tconst warDrum = boardHero.trinkets?.find(\r\n\t\t(t) => t.cardId === CardIds.WarDrum_BG32_MagicItem_416 && t.scriptDataNum1 > 0,\r\n\t);\r\n\r\n\tconst dragonsEye = gameState ? dragonsEyeExtraBattlecryTriggers(entity, boardHero, gameState) : 0;\r\n\r\n\tlet multiplier = echoesOfArgus + triggerMult + gilneanWarHorns + dragonsEye;\r\n\tif (warDrum) {\r\n\t\tmultiplier = multiplier * 2;\r\n\t\twarDrum.scriptDataNum1--;\r\n\t}\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\thero.globalInfo.CardsPlayedThisTurn = (hero.globalInfo.CardsPlayedThisTurn ?? 0) + 1;\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, gameState.sharedState, entity, gameState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tconst battlecryImpl = cardMappings[entity.cardId];\r\n\r\n\t\tlet hasBattlecryTrigger = false;\r\n\t\tif (hasBattlecry(battlecryImpl)) {\r\n\t\t\thasBattlecryTrigger = battlecryImpl.battlecry(entity, {\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (!hasBattlecryTrigger) {\r\n\t\t\tswitch (entity.cardId) {\r\n\t\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, hero, Race.MURLOC, gameState);\r\n\t\t\t\t\tif (!!rockPoolTarget) {\r\n\t\t\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\t\t\tmodifyStats(rockPoolTarget, entity, rockpoolStats, rockpoolStats, board, hero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t3,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\t\tupdateTaunt(sparringPartnersTarget, true, board, hero, otherHero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, hero, Race.DRAGON, gameState);\r\n\t\t\t\t\tif (!!twilightEmissaryTarget) {\r\n\t\t\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\ttwilightEmissaryTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\ttwilightEmissaryStats,\r\n\t\t\t\t\t\t\ttwilightEmissaryStats,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.CrowsNestSentry_BG29_502:\r\n\t\t\t\tcase CardIds.CrowsNestSentry_BG29_502_G:\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.cardId === CardIds.CrowsNestSentry_BG29_502 ? 4 : 8,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.FelfinNavigator_BG_BT_010:\r\n\t\t\t\t// case CardIds.FelfinNavigator_TB_BaconUps_124:\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FelfinNavigator_TB_BaconUps_124 ? 2 : 1,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t\tRace[Race.MURLOC],\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\t\tconst numberOfTimesToTrigger = entity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 1 : 2;\r\n\t\t\t\t\tfor (let i = 0; i < numberOfTimesToTrigger; i++) {\r\n\t\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\t2,\r\n\t\t\t\t\t\t\t2,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tdealDamageToHero(entity, hero, board, 2, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, hero, Race.ELEMENTAL, gameState);\r\n\t\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\t\tmodifyStats(smoggerTarget, entity, smoggerStats, smoggerStats, board, hero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\t\t\t// case CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\t\tconst annihilanStats =\r\n\t\t\t\t\t\t(entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\t\tmodifyStats(entity, entity, 0, annihilanStats, board, hero, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.Necrolyte_BG20_202:\r\n\t\t\t\t// case CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\t// \t// console.debug('triggering necrolyte', entity.entityId);\r\n\t\t\t\t// \tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\t// \tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\t// \tplayBloodGemsOn(entity, necrolyteTarget, necrolyteBloodGems, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(entity, necrolyteTarget, board, hero, otherHero);\r\n\r\n\t\t\t\t// \tconst necrolyteTargetNeighbours = getNeighbours(board, necrolyteTarget);\r\n\t\t\t\t// \tfor (const neighbour of necrolyteTargetNeighbours) {\r\n\t\t\t\t// \t\tconst bloodGemStatsEnchantment = neighbour.enchantments?.find(\r\n\t\t\t\t// \t\t\t(e) => e.cardId === CardIds.BloodGem_BloodGemsEnchantment,\r\n\t\t\t\t// \t\t);\r\n\t\t\t\t// \t\tif (bloodGemStatsEnchantment) {\r\n\t\t\t\t// \t\t\tconst atk = bloodGemStatsEnchantment.tagScriptDataNum1 ?? 0;\r\n\t\t\t\t// \t\t\tconst heath = bloodGemStatsEnchantment.tagScriptDataNum2 ?? 0;\r\n\t\t\t\t// \t\t\tneighbour.attack = Math.max(0, neighbour.attack - atk);\r\n\t\t\t\t// \t\t\tneighbour.health = Math.max(1, neighbour.health - heath);\r\n\t\t\t\t// \t\t\tneighbour.maxHealth = Math.max(1, neighbour.maxHealth - heath);\r\n\t\t\t\t// \t\t\tnecrolyteTarget.attack += atk;\r\n\t\t\t\t// \t\t\tnecrolyteTarget.health += heath;\r\n\t\t\t\t// \t\t\tnecrolyteTarget.maxHealth += heath;\r\n\t\t\t\t// \t\t\tgameState.spectator.registerPowerTarget(necrolyteTarget, neighbour, board, hero, otherHero);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t}\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tstrongshellScavengerStats,\r\n\t\t\t\t\t\t\tstrongshellScavengerStats,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\t\t// case CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\t// \tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\t// \tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\t// \tupdateTaunt(vigilantStonebornTarget, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \tmodifyStats(vigilantStonebornTarget, entity, 0, vigilantStonebornStats, board, hero, gameState);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\t// case CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\t\t// case CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\t// \tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\t// \tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\t// \tupdateTaunt(bonemareTarget, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \tmodifyStats(bonemareTarget, entity, bonemareStats, bonemareStats, board, hero, gameState);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t\t? [CardIds.TavernCoin_BG28_810]\r\n\t\t\t\t\t\t\t: [CardIds.TavernCoin_BG28_810, CardIds.TavernCoin_BG28_810];\r\n\t\t\t\t\taddCardsInHand(hero, board, murozondCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t\t? [CardIds.TavernCoin_BG28_810]\r\n\t\t\t\t\t\t\t: [CardIds.TavernCoin_BG28_810, CardIds.TavernCoin_BG28_810];\r\n\t\t\t\t\taddCardsInHand(hero, board, tavernTempestCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\t\t// case CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\t// \tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\t// \tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\t// \tupdateTaunt(\r\n\t\t\t\t// \t\tironGroundskeeperTarget,\r\n\t\t\t\t// \t\t!ironGroundskeeperTarget.taunt,\r\n\t\t\t\t// \t\tboard,\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\totherHero,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\t\tconst differentTypes = extractUniqueTribes(board, gameState.allCards);\r\n\t\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\t\tconst livingConstellationTarget = pickRandom(allMinions);\r\n\t\t\t\t\tconst boardForTarget = board.includes(livingConstellationTarget) ? board : otherBoard;\r\n\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\tlivingConstellationTarget,\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tlivingConstellationStats,\r\n\t\t\t\t\t\tlivingConstellationStats,\r\n\t\t\t\t\t\tboardForTarget,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\t\t// case CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\t// case CardIds.SparkLing_BG27_019:\r\n\t\t\t\t// case CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \taddStatsToBoard(\r\n\t\t\t\t// \t\tentity,\r\n\t\t\t\t// \t\totherBoard,\r\n\t\t\t\t// \t\thero,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t// \t\tgameState,\r\n\t\t\t\t// \t);\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\t\tallMinions.filter((e) =>\r\n\t\t\t\t\t\t\thasCorrectTribe(e, hero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards),\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!emergentFlameTarget) {\r\n\t\t\t\t\t\tconst targetBoard = board.includes(emergentFlameTarget) ? board : otherBoard;\r\n\t\t\t\t\t\tconst targetHero = board.includes(emergentFlameTarget) ? hero : otherHero;\r\n\t\t\t\t\t\tconst emergentFlameMultiplier = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\t\t\tconst emergentFlameStats = (entity.scriptDataNum1 || 1) * emergentFlameMultiplier;\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\temergentFlameTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\temergentFlameStats,\r\n\t\t\t\t\t\t\temergentFlameStats,\r\n\t\t\t\t\t\t\ttargetBoard,\r\n\t\t\t\t\t\t\ttargetHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\t\tconst captainSandersTarget = pickRandom(\r\n\t\t\t\t\t\tboard.filter((e) => !isMinionGolden(e, gameState.allCards) && e.tavernTier <= 6),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, hero, otherBoard, otherHero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FacelessDisciple_BG24_719:\r\n\t\t\t\tcase CardIds.FacelessDisciple_BG24_719_G:\r\n\t\t\t\t\tconst target = pickRandom(allMinions.filter((e) => !e.definitelyDead && e.health > 0));\r\n\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, target, board, hero, otherHero);\r\n\t\t\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(target.cardId);\r\n\t\t\t\t\t\tconst targetTier =\r\n\t\t\t\t\t\t\tentity.cardId === CardIds.FacelessDisciple_BG24_719 ? minionTier + 1 : minionTier + 2;\r\n\t\t\t\t\t\tconst maxTier =\r\n\t\t\t\t\t\t\t!!gameState.anomalies?.includes(CardIds.SecretsOfNorgannon_BG27_Anomaly_504) ||\r\n\t\t\t\t\t\t\thero.questRewardEntities?.some((r) => r.cardId === CardIds.NorgannonsReward_BG33_Reward_010)\r\n\t\t\t\t\t\t\t\t? 7\r\n\t\t\t\t\t\t\t\t: 6;\r\n\t\t\t\t\t\tconst newMinionId = gameState.cardsData.getRandomMinionForTavernTier(\r\n\t\t\t\t\t\t\tMath.min(maxTier, targetTier),\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconst targetBoard = board.includes(target) ? board : otherBoard;\r\n\t\t\t\t\t\tconst targetHero = board.includes(target) ? hero : otherHero;\r\n\t\t\t\t\t\tconst newMinion = buildSingleBoardEntity(\r\n\t\t\t\t\t\t\tnewMinionId,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t\t\ttargetHero.friendly,\r\n\t\t\t\t\t\t\tgameState.sharedState.currentEntityId++,\r\n\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t\tgameState.cardsData,\r\n\t\t\t\t\t\t\tgameState.sharedState,\r\n\t\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\t// Replace the target with the new minion\r\n\t\t\t\t\t\tconst index = targetBoard.indexOf(target);\r\n\t\t\t\t\t\t// console.debug('board before disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\t\ttargetBoard.splice(index, 1, newMinion);\r\n\t\t\t\t\t\t// console.debug('board after disciple', stringifySimple(targetBoard, gameState.allCards));\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, newMinion, targetBoard, hero, otherHero);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t// case CardIds.Amalgadon_BGS_069:\r\n\t\t\t\t// case CardIds.Amalgadon_TB_BaconUps_121:\r\n\t\t\t\t// \tconst numberOfTribes = extractUniqueTribes(board, gameState.allCards).length;\r\n\t\t\t\t// \tconst amalgadonMultiplier = entity.cardId === CardIds.Amalgadon_BGS_069 ? 1 : 2;\r\n\t\t\t\t// \tconst totalAdapts = amalgadonMultiplier * numberOfTribes;\r\n\t\t\t\t// \tfor (let i = 0; i < totalAdapts; i++) {\r\n\t\t\t\t// \t\tconst adapts = [\r\n\t\t\t\t// \t\t\tCardIds.FlamingClawsToken,\r\n\t\t\t\t// \t\t\tCardIds.LivingSporesToken,\r\n\t\t\t\t// \t\t\tCardIds.VolcanicMightToken,\r\n\t\t\t\t// \t\t\tCardIds.RockyCarapaceToken,\r\n\t\t\t\t// \t\t];\r\n\t\t\t\t// \t\tif (!entity.divineShield) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.CracklingShieldToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tif (!entity.windfury) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.LightningSpeedToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tif (!entity.taunt) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.MassiveToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tif (!entity.venomous && !entity.poisonous) {\r\n\t\t\t\t// \t\t\tadapts.push(CardIds.PoisonSpitToken);\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t\tconst adapt = pickRandom(adapts);\r\n\t\t\t\t// \t\tswitch (adapt) {\r\n\t\t\t\t// \t\t\tcase CardIds.FlamingClawsToken:\r\n\t\t\t\t// \t\t\t\tmodifyStats(entity, entity, 3, 0, board, hero, gameState, false);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.LivingSporesToken:\r\n\t\t\t\t// \t\t\t\tentity.enchantments = entity.enchantments ?? [];\r\n\t\t\t\t// \t\t\t\tentity.enchantments.push({\r\n\t\t\t\t// \t\t\t\t\tcardId: CardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\t// \t\t\t\t\ttiming: 0,\r\n\t\t\t\t// \t\t\t\t});\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.LightningSpeedToken:\r\n\t\t\t\t// \t\t\t\tupdateWindfury(entity, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.MassiveToken:\r\n\t\t\t\t// \t\t\t\tupdateTaunt(entity, true, board, hero, otherHero, gameState);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.PoisonSpitToken:\r\n\t\t\t\t// \t\t\t\tentity.poisonous = true;\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.RockyCarapaceToken:\r\n\t\t\t\t// \t\t\t\tmodifyStats(entity, entity, 0, 3, board, hero, gameState, false);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.CracklingShieldToken:\r\n\t\t\t\t// \t\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t\tcase CardIds.VolcanicMightToken:\r\n\t\t\t\t// \t\t\t\tmodifyStats(entity, entity, 1, 1, board, hero, gameState, false);\r\n\t\t\t\t// \t\t\t\tbreak;\r\n\t\t\t\t// \t\t}\r\n\t\t\t\t// \t}\r\n\t\t\t\t// \tbreak;\r\n\t\t\t\tcase CardIds.Eagill_BG28_630:\r\n\t\t\t\tcase CardIds.Eagill_BG28_630_G:\r\n\t\t\t\t\tconst eagillMultiplier = entity.cardId === CardIds.Eagill_BG28_630 ? 1 : 2;\r\n\t\t\t\t\tconst eagillBoardTarget = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\t\tif (eagillBoardTarget) {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\teagillBoardTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\t2 * eagillMultiplier,\r\n\t\t\t\t\t\t\t3 * eagillMultiplier,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst eagillHandTarget = pickRandom(\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (eagillHandTarget) {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\teagillHandTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\t2 * eagillMultiplier,\r\n\t\t\t\t\t\t\t3 * eagillMultiplier,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ShellWhistler_BG26_045:\r\n\t\t\t\tcase CardIds.ShellWhistler_BG26_045_G:\r\n\t\t\t\t\tconst shellWhistlerCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.ShellWhistler_BG26_045_G ? [null] : [null, null];\r\n\t\t\t\t\taddCardsInHand(hero, board, shellWhistlerCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104:\r\n\t\t\t\tcase CardIds.FriendlySaloonkeeper_BGDUO_104_G:\r\n\t\t\t\t\tconst playerState = getPlayerState(gameState.gameState, hero);\r\n\t\t\t\t\tif (playerState) {\r\n\t\t\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\t\t\tentity.cardId === CardIds.FriendlySaloonkeeper_BGDUO_104\r\n\t\t\t\t\t\t\t\t? [CardIds.TavernCoin_BG28_810]\r\n\t\t\t\t\t\t\t\t: [CardIds.TavernCoin_BG28_810, CardIds.TavernCoin_BG28_810];\r\n\t\t\t\t\t\taddCardsInHand(playerState.player, playerState.board, cardsToAdd, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111:\r\n\t\t\t\tcase CardIds.GenerousGeomancer_BGDUO_111_G:\r\n\t\t\t\t\tconst cardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.GenerousGeomancer_BGDUO_111\r\n\t\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\t\taddCardsInHand(\r\n\t\t\t\t\t\tgameState.gameState.player.player,\r\n\t\t\t\t\t\tgameState.gameState.player.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\tif (gameState.gameState.player.teammate) {\r\n\t\t\t\t\t\taddCardsInHand(\r\n\t\t\t\t\t\t\tgameState.gameState.player.teammate.player,\r\n\t\t\t\t\t\t\tgameState.gameState.player.teammate.board,\r\n\t\t\t\t\t\t\tcardsToAdd,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.OrcEstraConductor_BGDUO_119:\r\n\t\t\t\tcase CardIds.OrcEstraConductor_BGDUO_119_G:\r\n\t\t\t\t\tconst conductorTarget = pickRandom(\r\n\t\t\t\t\t\tallMinions.filter((e) =>\r\n\t\t\t\t\t\t\thasCorrectTribe(e, hero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards),\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!conductorTarget) {\r\n\t\t\t\t\t\tconst targetBoard = board.includes(conductorTarget) ? board : otherBoard;\r\n\t\t\t\t\t\tconst targetHero = board.includes(conductorTarget) ? hero : otherHero;\r\n\t\t\t\t\t\tconst multiplier = entity.cardId === CardIds.OrcEstraConductor_BGDUO_119 ? 1 : 2;\r\n\t\t\t\t\t\tconst attackStats = 2 * (entity.scriptDataNum1 || 1) * multiplier;\r\n\t\t\t\t\t\tconst healthStats = 2 * (entity.scriptDataNum1 || 1) * multiplier;\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\tconductorTarget,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tattackStats,\r\n\t\t\t\t\t\t\thealthStats,\r\n\t\t\t\t\t\t\ttargetBoard,\r\n\t\t\t\t\t\t\ttargetHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FacelessOne_BGDUO_HERO_100_Buddy:\r\n\t\t\t\tcase CardIds.FacelessOne_BGDUO_HERO_100_Buddy_G:\r\n\t\t\t\t\tconst facelessOneCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.FacelessOne_BGDUO_HERO_100_Buddy ? [null] : [null, null];\r\n\t\t\t\t\taddCardsInHand(hero, board, facelessOneCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.Phyresz_TB_BaconShop_HERO_91_Buddy:\r\n\t\t\t\tcase CardIds.Phyresz_TB_BaconShop_HERO_91_Buddy_G:\r\n\t\t\t\t\tconst phyreszCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.Phyresz_TB_BaconShop_HERO_91_Buddy ? [null] : [null, null];\r\n\t\t\t\t\taddCardsInHand(hero, board, phyreszCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.Muckslinger_TB_BaconShop_HERO_23_Buddy:\r\n\t\t\t\tcase CardIds.Muckslinger_TB_BaconShop_HERO_23_Buddy_G:\r\n\t\t\t\t\tconst muckslingerCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.Muckslinger_TB_BaconShop_HERO_23_Buddy\r\n\t\t\t\t\t\t\t? [pickRandom(gameState.cardsData.battlecryMinions)]\r\n\t\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.battlecryMinions),\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.battlecryMinions),\r\n\t\t\t\t\t\t\t ];\r\n\t\t\t\t\taddCardsInHand(hero, board, muckslingerCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.BarrensBrawler_BG29_861:\r\n\t\t\t\tcase CardIds.BarrensBrawler_BG29_861_G:\r\n\t\t\t\t\tconst barrendsBrawlerCardsToAdd =\r\n\t\t\t\t\t\tentity.cardId === CardIds.BarrensBrawler_BG29_861\r\n\t\t\t\t\t\t\t? [pickRandom(gameState.cardsData.deathrattleMinions)]\r\n\t\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.deathrattleMinions),\r\n\t\t\t\t\t\t\t\t\tpickRandom(gameState.cardsData.deathrattleMinions),\r\n\t\t\t\t\t\t\t ];\r\n\t\t\t\t\taddCardsInHand(hero, board, barrendsBrawlerCardsToAdd, gameState);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.NathanosBlightcaller_BG23_HERO_306_Buddy:\r\n\t\t\t\tcase CardIds.NathanosBlightcaller_BG23_HERO_306_Buddy_G:\r\n\t\t\t\t\tconst nathanosTarget = pickRandom(board);\r\n\t\t\t\t\tif (nathanosTarget) {\r\n\t\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, nathanosTarget, board, null, null);\r\n\t\t\t\t\t\tnathanosTarget.definitelyDead = true;\r\n\t\t\t\t\t\tconst buffMultiplier =\r\n\t\t\t\t\t\t\tentity.cardId === CardIds.NathanosBlightcaller_BG23_HERO_306_Buddy ? 1 : 2;\r\n\t\t\t\t\t\tconst attackBuff = nathanosTarget.attack * buffMultiplier;\r\n\t\t\t\t\t\tconst healthBuff = nathanosTarget.health * buffMultiplier;\r\n\t\t\t\t\t\tconst buffTargets = getNeighbours(board, nathanosTarget);\r\n\t\t\t\t\t\tbuffTargets.forEach((e) => {\r\n\t\t\t\t\t\t\tmodifyStats(e, entity, attackBuff, healthBuff, board, hero, gameState);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.LuckyEgg_BG30_104:\r\n\t\t\t\tcase CardIds.LuckyEgg_BG30_104_G:\r\n\t\t\t\t\tif (board.length > 0) {\r\n\t\t\t\t\t\tconst transformedInto = gameState.cardsData.getRandomMinionForTavernTier(3);\r\n\t\t\t\t\t\tconst premiumDbfId = gameState.allCards.getCard(transformedInto).battlegroundsPremiumDbfId;\r\n\t\t\t\t\t\tconst goldenCardId = gameState.allCards.getCard(premiumDbfId).id;\r\n\t\t\t\t\t\tconst currentIndex = board.findIndex((e) => e.entityId === entity.entityId);\r\n\t\t\t\t\t\tconst currentIndexFromRight = board.length - currentIndex - 1;\r\n\t\t\t\t\t\tboard.splice(currentIndex, 1);\r\n\t\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\t\tgoldenCardId,\r\n\t\t\t\t\t\t\t1,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t\tentity.friendly,\r\n\t\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tcurrentIndexFromRight,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.MuseumMummy_BG30_850:\r\n\t\t\t\tcase CardIds.MuseumMummy_BG30_850_G:\r\n\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\tentity.cardId === CardIds.MuseumMummy_BG30_850_G\r\n\t\t\t\t\t\t\t? CardIds.Skeleton_BG_ICC_026t_G\r\n\t\t\t\t\t\t\t: CardIds.SkeletonToken,\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tentity.friendly,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst indexFromRight = board.length - board.findIndex((e) => e.entityId === entity.entityId) - 1;\r\n\t\t\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t// All hte Battlecry minions that arent implemented / have no effect on the board state\r\n\t\t\t\t\tconst hasBattlecry = gameState.allCards\r\n\t\t\t\t\t\t.getCard(entity.cardId)\r\n\t\t\t\t\t\t?.mechanics?.includes(GameTag[GameTag.BATTLECRY]);\r\n\t\t\t\t\thasTriggered = hasBattlecry;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\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\tincrementBattlecriesTriggeredThisGame(hero, board, gameState);\r\n\tfor (const boardEntity of board) {\r\n\t\tconst onBattlecryTriggeredImpl = cardMappings[boardEntity.cardId];\r\n\t\tif (hasOnBattlecryTriggered(onBattlecryTriggeredImpl)) {\r\n\t\t\tonBattlecryTriggeredImpl.onBattlecryTriggered(boardEntity, {\r\n\t\t\t\tboard: board,\r\n\t\t\t\thero: hero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\tconst onBattlecryTriggeredImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasOnBattlecryTriggered(onBattlecryTriggeredImpl)) {\r\n\t\t\tonBattlecryTriggeredImpl.onBattlecryTriggered(trinket, {\r\n\t\t\t\tboard: board,\r\n\t\t\t\thero: hero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\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\r\nexport const hasMinionBattlecry = (entity: BoardEntity, gameState: FullGameState): boolean => {\r\n\treturn gameState.allCards.getCard(entity.cardId)?.mechanics?.includes(GameTag[GameTag.BATTLECRY]) ?? false;\r\n};\r\n\r\nexport interface BattlecryInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\nexport type OnBattlecryTriggeredInput = BattlecryInput;\r\n"]}
@@ -4,8 +4,8 @@ exports.applyOnDeathEffects = exports.applyAfterDeathEffects = void 0;
4
4
  const card_interface_1 = require("../cards/card.interface");
5
5
  const _card_mappings_1 = require("../cards/impl/_card-mappings");
6
6
  const utils_1 = require("../services/utils");
7
- const deity_1 = require("./deity");
8
7
  const deathrattle_spawns_1 = require("./deathrattle-spawns");
8
+ const deity_1 = require("./deity");
9
9
  const spawns_1 = require("./spawns");
10
10
  const stats_1 = require("./stats");
11
11
  const entity_utils_1 = require("./utils/entity-utils");
@@ -14,6 +14,11 @@ const applyAfterDeathEffects = (deadEntity, deadEntityIndexFromRight, boardWithD
14
14
  const spawnsFromSecrets = handleAfterMinionDeathEffects(deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);
15
15
  allSpawns.push(...spawnsFromSecrets);
16
16
  (0, spawns_1.performEntitySpawns)(allSpawns, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, deadEntityIndexFromRight, otherBoard, otherBoardHero, gameState);
17
+ const deitySpawns = (0, deity_1.onFriendlyAberrationDied)(deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);
18
+ if (deitySpawns.length > 0) {
19
+ (0, spawns_1.performEntitySpawns)(deitySpawns, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, 0, otherBoard, otherBoardHero, gameState);
20
+ allSpawns.push(...deitySpawns);
21
+ }
17
22
  return allSpawns;
18
23
  };
19
24
  exports.applyAfterDeathEffects = applyAfterDeathEffects;
@@ -49,7 +54,6 @@ const handleAfterMinionDeathEffects = (deadEntity, deadEntityIndexFromRight, boa
49
54
  });
50
55
  }
51
56
  }
52
- allSpawns.push(...(0, deity_1.onFriendlyAberrationDied)(deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState));
53
57
  for (const secret of ((_b = boardWithDeadEntityHero.secrets) !== null && _b !== void 0 ? _b : []).filter((s) => !s.triggered)) {
54
58
  switch (secret.cardId) {
55
59
  case "TB_Bacon_Secrets_08":
@@ -1 +1 @@
1
- {"version":3,"file":"death-effects.js","sourceRoot":"","sources":["../../src/simulation/death-effects.ts"],"names":[],"mappings":";;;AAEA,4DAAwG;AACxG,iEAA4D;AAE5D,6CAAoD;AACpD,mCAAmD;AACnD,6DAAqD;AAErD,qCAA+C;AAC/C,mCAAsC;AACtC,uDAAqD;AAE9C,MAAM,sBAAsB,GAAG,CACrC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACR,EAAE;IAClB,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,MAAM,iBAAiB,GAAG,6BAA6B,CACtD,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,SAAS,CACT,CAAC;IACF,SAAS,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC;IACrC,IAAA,4BAAmB,EAClB,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,wBAAwB,EACxB,UAAU,EACV,cAAc,EACd,SAAS,CACT,CAAC;IAEF,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAjCW,QAAA,sBAAsB,0BAiCjC;AAEF,MAAM,6BAA6B,GAAG,CACrC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACR,EAAE;;IAClB,MAAM,SAAS,GAAG,EAAE,CAAC;IAGrB,MAAM,gBAAgB,GAAG,CAAC,GAAG,mBAAmB,CAAC,CAAC;IAClD,KAAK,MAAM,MAAM,IAAI,mBAAmB,EAAE;QACzC,MAAM,IAAI,GAAG,6BAAY,CAAC,MAAM,C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J,CAAC;gBACF,SAAS,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;gBAChC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAClG,MAAM;SACP;KACD;IACD,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAClC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACvB,EAAE;IAEH,OAAO,EAAE,CAAC;AACX,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnAfterFriendlyMinionDeath, hasRebornSelfAttributeTransfer } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandomAlive } from '../services/utils';\r\nimport { onFriendlyAberrationDied } from './deity';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\nimport { copyAttribute } from './utils/entity-utils';\r\n\r\nexport const applyAfterDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\tconst spawnsFromSecrets = handleAfterMinionDeathEffects(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tallSpawns.push(...spawnsFromSecrets);\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\r\n\treturn allSpawns;\r\n};\r\n\r\nconst handleAfterMinionDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\t// TODO: move this to an \"after minion dies\" phase, instead of \"whenever minion dies\"\r\n\tconst boardBeforeProcs = [...boardWithDeadEntity];\r\n\tfor (const entity of boardWithDeadEntity) {\r\n\t\tconst impl = cardMappings[entity.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(impl)) {\r\n\t\t\timpl.onAfterFriendlyMinionDeath(entity, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const trinket of boardWithDeadEntityHero.trinkets ?? []) {\r\n\t\tconst trinketImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(trinketImpl)) {\r\n\t\t\ttrinketImpl.onAfterFriendlyMinionDeath(trinket, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tallSpawns.push(\r\n\t\t...onFriendlyAberrationDied(\r\n\t\t\tdeadEntity,\r\n\t\t\tdeadEntityIndexFromRight,\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t),\r\n\t);\r\n\r\n\tfor (const secret of (boardWithDeadEntityHero.secrets ?? []).filter((s) => !s.triggered)) {\r\n\t\tswitch (secret.cardId) {\r\n\t\t\tcase CardIds.Avenge_TB_Bacon_Secrets_08:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst avengeTarget = pickRandomAlive(boardWithDeadEntity);\r\n\t\t\t\tmodifyStats(avengeTarget, secret, 3, 2, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_TB_Bacon_Secrets_10:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst redemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\t// { ...newSpawn } as BoardEntity,\r\n\t\t\t\t);\r\n\t\t\t\tredemptionSpawns[0].health = 1;\r\n\t\t\t\t// I don't like duplicating this logic\r\n\t\t\t\tconst rebornImpl = cardMappings[redemptionSpawns[0].cardId];\r\n\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\tcopyAttribute(redemptionSpawns[0], deadEntity, attribute);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...redemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, redemptionSpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_BetterRedemption_TB_Bacon_Secrets_10b:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst betterRedemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tfor (const spawn of betterRedemptionSpawns) {\r\n\t\t\t\t\tspawn.health = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.maxHealth = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.attack = deadEntity.attack;\r\n\t\t\t\t\tspawn.maxAttack = deadEntity.maxAttack;\r\n\t\t\t\t\tspawn.enchantments = deadEntity.enchantments;\r\n\t\t\t\t\tspawn.divineShield = deadEntity.hadDivineShield;\r\n\t\t\t\t\tconst rebornImpl = cardMappings[spawn.cardId];\r\n\t\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\t\tcopyAttribute(spawn, deadEntity, attribute);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...betterRedemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsecret,\r\n\t\t\t\t\tbetterRedemptionSpawns[0],\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Effigy_TB_Bacon_Secrets_05:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(deadEntity.cardId);\r\n\t\t\t\tconst newMinion = gameState.cardsData.getRandomMinionForTavernTier(minionTier);\r\n\t\t\t\tconst effigySpawns = spawnEntities(\r\n\t\t\t\t\tnewMinion,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tallSpawns.push(...effigySpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, effigySpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn allSpawns;\r\n};\r\n\r\nexport const applyOnDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\t// Nothing yet\r\n\treturn [];\r\n};\r\n"]}
1
+ {"version":3,"file":"death-effects.js","sourceRoot":"","sources":["../../src/simulation/death-effects.ts"],"names":[],"mappings":";;;AAEA,4DAAwG;AACxG,iEAA4D;AAE5D,6CAAoD;AACpD,6DAAqD;AACrD,mCAAmD;AAEnD,qCAA+C;AAC/C,mCAAsC;AACtC,uDAAqD;AAE9C,MAAM,sBAAsB,GAAG,CACrC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACR,EAAE;IAClB,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,MAAM,iBAAiB,GAAG,6BAA6B,CACtD,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,SAAS,CACT,CAAC;IACF,SAAS,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC;IACrC,IAAA,4BAAmB,EAClB,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,wBAAwB,EACxB,UAAU,EACV,cAAc,EACd,SAAS,CACT,CAAC;IAEF,MAAM,WAAW,GAAG,IAAA,gCAAwB,EAC3C,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,SAAS,CACT,CAAC;IACF,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,IAAA,4BAAmB,EAClB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,CAAC,EACD,UAAU,EACV,cAAc,EACd,SAAS,CACT,CAAC;QACF,SAAS,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC;KAC/B;IAED,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAxDW,QAAA,sBAAsB,0BAwDjC;AAEF,MAAM,6BAA6B,GAAG,CACrC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC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EACvB,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,CAAC,QAAQ,EACnB,KAAK,EACL,KAAK,EACL,IAAI,CACJ,CAAC;gBACF,SAAS,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;gBAChC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAClG,MAAM;SACP;KACD;IACD,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAClC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACvB,EAAE;IAEH,OAAO,EAAE,CAAC;AACX,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnAfterFriendlyMinionDeath, hasRebornSelfAttributeTransfer } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandomAlive } from '../services/utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { onFriendlyAberrationDied } from './deity';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\nimport { copyAttribute } from './utils/entity-utils';\r\n\r\nexport const applyAfterDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\tconst spawnsFromSecrets = handleAfterMinionDeathEffects(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tallSpawns.push(...spawnsFromSecrets);\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\r\n\tconst deitySpawns = onFriendlyAberrationDied(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tif (deitySpawns.length > 0) {\r\n\t\tperformEntitySpawns(\r\n\t\t\tdeitySpawns,\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\tdeadEntity,\r\n\t\t\t0,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tallSpawns.push(...deitySpawns);\r\n\t}\r\n\r\n\treturn allSpawns;\r\n};\r\n\r\nconst handleAfterMinionDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\t// TODO: move this to an \"after minion dies\" phase, instead of \"whenever minion dies\"\r\n\tconst boardBeforeProcs = [...boardWithDeadEntity];\r\n\tfor (const entity of boardWithDeadEntity) {\r\n\t\tconst impl = cardMappings[entity.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(impl)) {\r\n\t\t\timpl.onAfterFriendlyMinionDeath(entity, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const trinket of boardWithDeadEntityHero.trinkets ?? []) {\r\n\t\tconst trinketImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(trinketImpl)) {\r\n\t\t\ttrinketImpl.onAfterFriendlyMinionDeath(trinket, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const secret of (boardWithDeadEntityHero.secrets ?? []).filter((s) => !s.triggered)) {\r\n\t\tswitch (secret.cardId) {\r\n\t\t\tcase CardIds.Avenge_TB_Bacon_Secrets_08:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst avengeTarget = pickRandomAlive(boardWithDeadEntity);\r\n\t\t\t\tmodifyStats(avengeTarget, secret, 3, 2, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_TB_Bacon_Secrets_10:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst redemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\t// { ...newSpawn } as BoardEntity,\r\n\t\t\t\t);\r\n\t\t\t\tredemptionSpawns[0].health = 1;\r\n\t\t\t\t// I don't like duplicating this logic\r\n\t\t\t\tconst rebornImpl = cardMappings[redemptionSpawns[0].cardId];\r\n\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\tcopyAttribute(redemptionSpawns[0], deadEntity, attribute);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...redemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, redemptionSpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_BetterRedemption_TB_Bacon_Secrets_10b:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst betterRedemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tfor (const spawn of betterRedemptionSpawns) {\r\n\t\t\t\t\tspawn.health = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.maxHealth = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.attack = deadEntity.attack;\r\n\t\t\t\t\tspawn.maxAttack = deadEntity.maxAttack;\r\n\t\t\t\t\tspawn.enchantments = deadEntity.enchantments;\r\n\t\t\t\t\tspawn.divineShield = deadEntity.hadDivineShield;\r\n\t\t\t\t\tconst rebornImpl = cardMappings[spawn.cardId];\r\n\t\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\t\tcopyAttribute(spawn, deadEntity, attribute);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...betterRedemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsecret,\r\n\t\t\t\t\tbetterRedemptionSpawns[0],\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Effigy_TB_Bacon_Secrets_05:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(deadEntity.cardId);\r\n\t\t\t\tconst newMinion = gameState.cardsData.getRandomMinionForTavernTier(minionTier);\r\n\t\t\t\tconst effigySpawns = spawnEntities(\r\n\t\t\t\t\tnewMinion,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tallSpawns.push(...effigySpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, effigySpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn allSpawns;\r\n};\r\n\r\nexport const applyOnDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\t// Nothing yet\r\n\treturn [];\r\n};\r\n"]}
@@ -7,6 +7,11 @@ export declare const isDeityCard: (cardId: string, allCards: AllCardsService) =>
7
7
  export declare const isAberration: (entity: BoardEntity, hero: BgsPlayerEntity, gameState: FullGameState) => boolean;
8
8
  export declare const getDeitySecret: (hero: BgsPlayerEntity) => BoardSecret | undefined;
9
9
  export declare const getOnBoardDeity: (board: BoardEntity[], allCards: AllCardsService) => BoardEntity | undefined;
10
+ export declare const getDeityBaseStats: (hero: BgsPlayerEntity, entity?: BoardEntity) => {
11
+ attack: number;
12
+ health: number;
13
+ };
14
+ export declare const applyDeityBaseStats: (entity: BoardEntity, hero: BgsPlayerEntity) => void;
10
15
  export declare const buffYourDeity: (hero: BgsPlayerEntity, board: BoardEntity[], source: BoardEntity | BoardSecret | BgsPlayerEntity, attack: number, health: number, gameState: FullGameState) => void;
11
16
  export declare const incrementDeitySecretStats: (hero: BgsPlayerEntity, attack: number, health: number) => void;
12
17
  export declare const buffTeamDeities: (hero: BgsPlayerEntity, board: BoardEntity[], source: BoardEntity, attack: number, health: number, gameState: FullGameState) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onFriendlyAberrationDied = exports.buffTeamDeities = exports.incrementDeitySecretStats = exports.buffYourDeity = exports.getOnBoardDeity = exports.getDeitySecret = exports.isAberration = exports.isDeityCard = void 0;
3
+ exports.onFriendlyAberrationDied = exports.buffTeamDeities = exports.incrementDeitySecretStats = exports.buffYourDeity = exports.applyDeityBaseStats = exports.getDeityBaseStats = exports.getOnBoardDeity = exports.getDeitySecret = exports.isAberration = exports.isDeityCard = void 0;
4
4
  const reference_data_1 = require("@firestone-hs/reference-data");
5
5
  const card_interface_1 = require("../cards/card.interface");
6
6
  const _card_mappings_1 = require("../cards/impl/_card-mappings");
@@ -40,6 +40,26 @@ const writeSecretStats = (secret, attack, health) => {
40
40
  secret.tags[reference_data_1.GameTag.BACON_OLD_GOD_ATTACK] = attack;
41
41
  secret.tags[reference_data_1.GameTag.BACON_OLD_GOD_HEALTH] = health;
42
42
  };
43
+ const getDeityBaseStats = (hero, entity) => {
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45
+ const secret = (0, exports.getDeitySecret)(hero);
46
+ const attack = (_e = (_d = (_b = (_a = secret === null || secret === void 0 ? void 0 : secret.tags) === null || _a === void 0 ? void 0 : _a[reference_data_1.GameTag.BACON_OLD_GOD_ATTACK]) !== null && _b !== void 0 ? _b : (_c = entity === null || entity === void 0 ? void 0 : entity.tags) === null || _c === void 0 ? void 0 : _c[reference_data_1.GameTag.BACON_OLD_GOD_ATTACK]) !== null && _d !== void 0 ? _d : secret === null || secret === void 0 ? void 0 : secret.scriptDataNum2) !== null && _e !== void 0 ? _e : 1;
47
+ const health = Math.max(1, (_k = (_j = (_g = (_f = secret === null || secret === void 0 ? void 0 : secret.tags) === null || _f === void 0 ? void 0 : _f[reference_data_1.GameTag.BACON_OLD_GOD_HEALTH]) !== null && _g !== void 0 ? _g : (_h = entity === null || entity === void 0 ? void 0 : entity.tags) === null || _h === void 0 ? void 0 : _h[reference_data_1.GameTag.BACON_OLD_GOD_HEALTH]) !== null && _j !== void 0 ? _j : secret === null || secret === void 0 ? void 0 : secret.scriptDataNum3) !== null && _k !== void 0 ? _k : 1);
48
+ return { attack, health };
49
+ };
50
+ exports.getDeityBaseStats = getDeityBaseStats;
51
+ const applyDeityBaseStats = (entity, hero) => {
52
+ var _a;
53
+ const { attack, health } = (0, exports.getDeityBaseStats)(hero, entity);
54
+ entity.attack = attack;
55
+ entity.maxAttack = attack;
56
+ entity.health = health;
57
+ entity.maxHealth = health;
58
+ entity.tags = (_a = entity.tags) !== null && _a !== void 0 ? _a : {};
59
+ entity.tags[reference_data_1.GameTag.BACON_OLD_GOD_ATTACK] = attack;
60
+ entity.tags[reference_data_1.GameTag.BACON_OLD_GOD_HEALTH] = health;
61
+ };
62
+ exports.applyDeityBaseStats = applyDeityBaseStats;
43
63
  const buffYourDeity = (hero, board, source, attack, health, gameState) => {
44
64
  const onBoard = (0, exports.getOnBoardDeity)(board, gameState.allCards);
45
65
  if (onBoard) {
@@ -77,30 +97,28 @@ const resolveDeityCardId = (secret, gameState) => {
77
97
  return "BGFYM_000";
78
98
  };
79
99
  const onFriendlyAberrationDied = (deadEntity, _deadEntityIndexFromRight, board, hero, otherBoard, otherHero, gameState) => {
80
- var _a, _b;
100
+ var _a;
81
101
  if (!(0, exports.isAberration)(deadEntity, hero, gameState)) {
82
102
  return [];
83
103
  }
104
+ if (hero.hpLeft <= 0 || hero.cardId === "TB_BaconShop_HERO_KelThuzad") {
105
+ return [];
106
+ }
84
107
  const secret = (0, exports.getDeitySecret)(hero);
85
108
  if (!secret || secret.triggered) {
86
109
  return [];
87
110
  }
88
- const remaining = ((_a = secret.scriptDataNum1) !== null && _a !== void 0 ? _a : 3) - 1;
111
+ const remaining = (secret.scriptDataNum1 || 3) - 1;
89
112
  secret.scriptDataNum1 = remaining;
90
113
  if (remaining > 0) {
91
114
  return [];
92
115
  }
93
116
  secret.triggered = true;
94
117
  const cardId = resolveDeityCardId(secret, gameState);
95
- const attack = readSecretAttack(secret);
96
- const health = Math.max(1, readSecretHealth(secret));
97
118
  const spawns = (0, deathrattle_spawns_1.spawnEntities)(cardId, 1, board, hero, otherBoard, otherHero, gameState, deadEntity.friendly, false, false, true);
98
119
  for (const spawn of spawns) {
99
- spawn.attack = attack;
100
- spawn.maxAttack = attack;
101
- spawn.health = health;
102
- spawn.maxHealth = health;
103
- if ((_b = hero.trinkets) === null || _b === void 0 ? void 0 : _b.some((t) => t.cardId === "BG36_MagicItem_416")) {
120
+ (0, exports.applyDeityBaseStats)(spawn, hero);
121
+ if ((_a = hero.trinkets) === null || _a === void 0 ? void 0 : _a.some((t) => t.cardId === "BG36_MagicItem_416")) {
104
122
  spawn.reborn = true;
105
123
  }
106
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deity.js","sourceRoot":"","sources":["../../src/simulation/deity.ts"],"names":[],"mappings":";;;AAKA,iEAA8E;AAI9E,4DAAsD;AACtD,iEAA4D;AAE5D,oCAA2F;AAC3F,6DAAqD;AAErD,mCAAsC;AAE/B,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,QAAyB,EAAW,EAAE;IACjF,OAAO,IAAA,mBAAW,EAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,wBAAO,CAAC,aAAa,CAAC,CAAC;AACrE,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAEK,MAAM,YAAY,GAAG,CAAC,MAAmB,EAAE,IAAqB,EAAE,SAAwB,EAAW,EAAE;IAC7G,OAAO,IAAA,uBAAe,EAAC,MAAM,EAAE,IAAI,EAAE,qBAAI,CAAC,UAAU,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;AAChG,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,MAAM,cAAc,GAAG,CAAC,IAAqB,EAA2B,EAAE;;IAChF,OAAO,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,gBAAqC,CAAC,CAAC;AACjF,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB;AAEK,MAAM,eAAe,GAAG,CAAC,KAAoB,EAAE,QAAyB,EAA2B,EAAE;IAC3G,OAAO,KAAK,CAAC,IAAI,CAChB,CAAC,CAAC,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awaken C'Thun or Y'Shaarj with stored stats.\r\n * scriptDataNum1 = deaths remaining, tags BACON_OLD_GOD_ATTACK/HEALTH = atk/hp, scriptDataNum6 = deity dbfId.\r\n */\r\nimport { AllCardsService, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnAwaken } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { getPlayerState, hasCorrectTribe, hasEntityMechanic, hasMechanic } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const isDeityCard = (cardId: string, allCards: AllCardsService): boolean => {\r\n\treturn hasMechanic(allCards.getCard(cardId), GameTag.BACON_OLD_GOD);\r\n};\r\n\r\nexport const isAberration = (entity: BoardEntity, hero: BgsPlayerEntity, gameState: FullGameState): boolean => {\r\n\treturn hasCorrectTribe(entity, hero, Race.ABERRATION, gameState.anomalies, gameState.allCards);\r\n};\r\n\r\nexport const getDeitySecret = (hero: BgsPlayerEntity): BoardSecret | undefined => {\r\n\treturn hero.secrets?.find((s) => s.cardId === CardIds.SecretDeityDnt_BG_OldGod);\r\n};\r\n\r\nexport const getOnBoardDeity = (board: BoardEntity[], allCards: AllCardsService): BoardEntity | undefined => {\r\n\treturn board.find(\r\n\t\t(e) => hasEntityMechanic(e, GameTag.BACON_OLD_GOD, allCards) && e.health > 0 && !e.definitelyDead,\r\n\t);\r\n};\r\n\r\nconst readSecretAttack = (secret: BoardSecret): number => {\r\n\treturn secret.tags?.[GameTag.BACON_OLD_GOD_ATTACK] ?? secret.scriptDataNum2 ?? 1;\r\n};\r\n\r\nconst readSecretHealth = (secret: BoardSecret): number => {\r\n\treturn secret.tags?.[GameTag.BACON_OLD_GOD_HEALTH] ?? secret.scriptDataNum3 ?? 1;\r\n};\r\n\r\nconst writeSecretStats = (secret: BoardSecret, attack: number, health: number): void => {\r\n\tsecret.scriptDataNum2 = attack;\r\n\tsecret.scriptDataNum3 = health;\r\n\tsecret.tags = secret.tags ?? {};\r\n\tsecret.tags[GameTag.BACON_OLD_GOD_ATTACK] = attack;\r\n\tsecret.tags[GameTag.BACON_OLD_GOD_HEALTH] = health;\r\n};\r\n\r\nexport const buffYourDeity = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tsource: BoardEntity | BoardSecret | BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst onBoard = getOnBoardDeity(board, gameState.allCards);\r\n\tif (onBoard) {\r\n\t\tmodifyStats(onBoard, source as BoardEntity, attack, health, board, hero, gameState);\r\n\t}\r\n\tincrementDeitySecretStats(hero, attack, health);\r\n};\r\n\r\nexport const incrementDeitySecretStats = (hero: BgsPlayerEntity, attack: number, health: number): void => {\r\n\tconst secret = getDeitySecret(hero);\r\n\tif (secret) {\r\n\t\twriteSecretStats(secret, readSecretAttack(secret) + attack, readSecretHealth(secret) + health);\r\n\t}\r\n};\r\n\r\nexport const buffTeamDeities = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tsource: BoardEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tbuffYourDeity(hero, board, source, attack, health, gameState);\r\n\tconst playerState = getPlayerState(gameState.gameState, hero);\r\n\tconst teammate = playerState?.teammate;\r\n\tif (teammate?.player) {\r\n\t\tbuffYourDeity(teammate.player, teammate.board ?? [], source, attack, health, gameState);\r\n\t}\r\n};\r\n\r\nconst resolveDeityCardId = (secret: BoardSecret, gameState: FullGameState): string => {\r\n\tconst dbfId = secret.scriptDataNum6 ?? secret.tags?.[GameTag.BACON_GLOBAL_OLD_GOD_DBID];\r\n\tif (dbfId) {\r\n\t\tconst fromDbf = gameState.allCards.getCardFromDbfId(dbfId);\r\n\t\tif (fromDbf?.id) {\r\n\t\t\treturn fromDbf.id;\r\n\t\t}\r\n\t}\r\n\treturn CardIds.Cthun_BGFYM_000;\r\n};\r\n\r\nexport const onFriendlyAberrationDied = (\r\n\tdeadEntity: BoardEntity,\r\n\t_deadEntityIndexFromRight: number,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tif (!isAberration(deadEntity, hero, gameState)) {\r\n\t\treturn [];\r\n\t}\r\n\tconst secret = getDeitySecret(hero);\r\n\tif (!secret || secret.triggered) {\r\n\t\treturn [];\r\n\t}\r\n\tconst remaining = (secret.scriptDataNum1 ?? 3) - 1;\r\n\tsecret.scriptDataNum1 = remaining;\r\n\tif (remaining > 0) {\r\n\t\treturn [];\r\n\t}\r\n\tsecret.triggered = true;\r\n\tconst cardId = resolveDeityCardId(secret, gameState);\r\n\tconst attack = readSecretAttack(secret);\r\n\tconst health = Math.max(1, readSecretHealth(secret));\r\n\tconst spawns = spawnEntities(\r\n\t\tcardId,\r\n\t\t1,\r\n\t\tboard,\r\n\t\thero,\r\n\t\totherBoard,\r\n\t\totherHero,\r\n\t\tgameState,\r\n\t\tdeadEntity.friendly,\r\n\t\tfalse,\r\n\t\tfalse,\r\n\t\ttrue,\r\n\t);\r\n\tfor (const spawn of spawns) {\r\n\t\tspawn.attack = attack;\r\n\t\tspawn.maxAttack = attack;\r\n\t\tspawn.health = health;\r\n\t\tspawn.maxHealth = health;\r\n\t\tif (hero.trinkets?.some((t) => t.cardId === CardIds.EvilExperiment_BG36_MagicItem_416)) {\r\n\t\t\tspawn.reborn = true;\r\n\t\t}\r\n\t}\r\n\tif (spawns[0]) {\r\n\t\tgameState.spectator.registerPowerTarget(secret, spawns[0], board, hero, otherHero);\r\n\t}\r\n\tfor (const spawn of spawns) {\r\n\t\tconst impl = cardMappings[spawn.cardId];\r\n\t\tif (hasOnAwaken(impl)) {\r\n\t\t\timpl.onAwaken(spawn, {\r\n\t\t\t\thero,\r\n\t\t\t\tboard,\r\n\t\t\t\totherHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\treturn [...spawns];\r\n};\r\n"]}
1
+ {"version":3,"file":"deity.js","sourceRoot":"","sources":["../../src/simulation/deity.ts"],"names":[],"mappings":";;;AAKA,iEAA8E;AAI9E,4DAAsD;AACtD,iEAA4D;AAE5D,oCAA2F;AAC3F,6DAAqD;AAErD,mCAAsC;AAE/B,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,QAAyB,EAAW,EAAE;IACjF,OAAO,IAAA,mBAAW,EAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,wBAAO,CAAC,aAAa,CAAC,CAAC;AACrE,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAEK,MAAM,YAAY,GAAG,CAAC,MAAmB,EAAE,IAAqB,EAAE,SAAwB,EAAW,EAAE;IAC7G,OAAO,IAAA,uBAAe,EAAC,MAAM,EAAE,IAAI,EAAE,qBAAI,CAAC,UAAU,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;AAChG,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,MAAM,cAAc,GAAG,CAAC,IAAqB,EAA2B,EAAE;;IAChF,OAAO,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,gBAAqC,CAAC,CAAC;AACjF,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB;AAEK,MAAM,eAAe,GAAG,CAAC,KAAoB,EAAE,QAAyB,EAA2B,EAAE;IAC3G,OAAO,KAAK,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,EAAE,CAAC,IAA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secret.\r\n * After 3 friendly Aberrations die each combat, awaken C'Thun or Y'Shaarj with stored stats.\r\n * scriptDataNum1 = deaths remaining, tags BACON_OLD_GOD_ATTACK/HEALTH = atk/hp, scriptDataNum6 = deity dbfId.\r\n */\r\nimport { AllCardsService, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnAwaken } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { getPlayerState, hasCorrectTribe, hasEntityMechanic, hasMechanic } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const isDeityCard = (cardId: string, allCards: AllCardsService): boolean => {\r\n\treturn hasMechanic(allCards.getCard(cardId), GameTag.BACON_OLD_GOD);\r\n};\r\n\r\nexport const isAberration = (entity: BoardEntity, hero: BgsPlayerEntity, gameState: FullGameState): boolean => {\r\n\treturn hasCorrectTribe(entity, hero, Race.ABERRATION, gameState.anomalies, gameState.allCards);\r\n};\r\n\r\nexport const getDeitySecret = (hero: BgsPlayerEntity): BoardSecret | undefined => {\r\n\treturn hero.secrets?.find((s) => s.cardId === CardIds.SecretDeityDnt_BG_OldGod);\r\n};\r\n\r\nexport const getOnBoardDeity = (board: BoardEntity[], allCards: AllCardsService): BoardEntity | undefined => {\r\n\treturn board.find(\r\n\t\t(e) => hasEntityMechanic(e, GameTag.BACON_OLD_GOD, allCards) && e.health > 0 && !e.definitelyDead,\r\n\t);\r\n};\r\n\r\nconst readSecretAttack = (secret: BoardSecret): number => {\r\n\treturn secret.tags?.[GameTag.BACON_OLD_GOD_ATTACK] ?? secret.scriptDataNum2 ?? 1;\r\n};\r\n\r\nconst readSecretHealth = (secret: BoardSecret): number => {\r\n\treturn secret.tags?.[GameTag.BACON_OLD_GOD_HEALTH] ?? secret.scriptDataNum3 ?? 1;\r\n};\r\n\r\nconst writeSecretStats = (secret: BoardSecret, attack: number, health: number): void => {\r\n\tsecret.scriptDataNum2 = attack;\r\n\tsecret.scriptDataNum3 = health;\r\n\tsecret.tags = secret.tags ?? {};\r\n\tsecret.tags[GameTag.BACON_OLD_GOD_ATTACK] = attack;\r\n\tsecret.tags[GameTag.BACON_OLD_GOD_HEALTH] = health;\r\n};\r\n\r\nexport const getDeityBaseStats = (hero: BgsPlayerEntity, entity?: BoardEntity): { attack: number; health: number } => {\r\n\tconst secret = getDeitySecret(hero);\r\n\tconst attack =\r\n\t\tsecret?.tags?.[GameTag.BACON_OLD_GOD_ATTACK] ??\r\n\t\tentity?.tags?.[GameTag.BACON_OLD_GOD_ATTACK] ??\r\n\t\tsecret?.scriptDataNum2 ??\r\n\t\t1;\r\n\tconst health = Math.max(\r\n\t\t1,\r\n\t\tsecret?.tags?.[GameTag.BACON_OLD_GOD_HEALTH] ??\r\n\t\t\tentity?.tags?.[GameTag.BACON_OLD_GOD_HEALTH] ??\r\n\t\t\tsecret?.scriptDataNum3 ??\r\n\t\t\t1,\r\n\t);\r\n\treturn { attack, health };\r\n};\r\n\r\nexport const applyDeityBaseStats = (entity: BoardEntity, hero: BgsPlayerEntity): void => {\r\n\tconst { attack, health } = getDeityBaseStats(hero, entity);\r\n\tentity.attack = attack;\r\n\tentity.maxAttack = attack;\r\n\tentity.health = health;\r\n\tentity.maxHealth = health;\r\n\tentity.tags = entity.tags ?? {};\r\n\tentity.tags[GameTag.BACON_OLD_GOD_ATTACK] = attack;\r\n\tentity.tags[GameTag.BACON_OLD_GOD_HEALTH] = health;\r\n};\r\n\r\nexport const buffYourDeity = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tsource: BoardEntity | BoardSecret | BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst onBoard = getOnBoardDeity(board, gameState.allCards);\r\n\tif (onBoard) {\r\n\t\tmodifyStats(onBoard, source as BoardEntity, attack, health, board, hero, gameState);\r\n\t}\r\n\tincrementDeitySecretStats(hero, attack, health);\r\n};\r\n\r\nexport const incrementDeitySecretStats = (hero: BgsPlayerEntity, attack: number, health: number): void => {\r\n\tconst secret = getDeitySecret(hero);\r\n\tif (secret) {\r\n\t\twriteSecretStats(secret, readSecretAttack(secret) + attack, readSecretHealth(secret) + health);\r\n\t}\r\n};\r\n\r\nexport const buffTeamDeities = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tsource: BoardEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tbuffYourDeity(hero, board, source, attack, health, gameState);\r\n\tconst playerState = getPlayerState(gameState.gameState, hero);\r\n\tconst teammate = playerState?.teammate;\r\n\tif (teammate?.player) {\r\n\t\tbuffYourDeity(teammate.player, teammate.board ?? [], source, attack, health, gameState);\r\n\t}\r\n};\r\n\r\nconst resolveDeityCardId = (secret: BoardSecret, gameState: FullGameState): string => {\r\n\tconst dbfId = secret.scriptDataNum6 ?? secret.tags?.[GameTag.BACON_GLOBAL_OLD_GOD_DBID];\r\n\tif (dbfId) {\r\n\t\tconst fromDbf = gameState.allCards.getCardFromDbfId(dbfId);\r\n\t\tif (fromDbf?.id) {\r\n\t\t\treturn fromDbf.id;\r\n\t\t}\r\n\t}\r\n\treturn CardIds.Cthun_BGFYM_000;\r\n};\r\n\r\nexport const onFriendlyAberrationDied = (\r\n\tdeadEntity: BoardEntity,\r\n\t_deadEntityIndexFromRight: number,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tif (!isAberration(deadEntity, hero, gameState)) {\r\n\t\treturn [];\r\n\t}\r\n\t// 2026-09-22: This seems to be an HS bug, but for now the deity doesn't spawn when facing the ghost\r\n\tif (hero.hpLeft <= 0 || hero.cardId === CardIds.Kelthuzad_TB_BaconShop_HERO_KelThuzad) {\r\n\t\treturn [];\r\n\t}\r\n\tconst secret = getDeitySecret(hero);\r\n\tif (!secret || secret.triggered) {\r\n\t\treturn [];\r\n\t}\r\n\tconst remaining = (secret.scriptDataNum1 || 3) - 1;\r\n\tsecret.scriptDataNum1 = remaining;\r\n\tif (remaining > 0) {\r\n\t\treturn [];\r\n\t}\r\n\tsecret.triggered = true;\r\n\tconst cardId = resolveDeityCardId(secret, gameState);\r\n\tconst spawns = spawnEntities(\r\n\t\tcardId,\r\n\t\t1,\r\n\t\tboard,\r\n\t\thero,\r\n\t\totherBoard,\r\n\t\totherHero,\r\n\t\tgameState,\r\n\t\tdeadEntity.friendly,\r\n\t\tfalse,\r\n\t\tfalse,\r\n\t\ttrue,\r\n\t);\r\n\tfor (const spawn of spawns) {\r\n\t\tapplyDeityBaseStats(spawn, hero);\r\n\t\tif (hero.trinkets?.some((t) => t.cardId === CardIds.EvilExperiment_BG36_MagicItem_416)) {\r\n\t\t\tspawn.reborn = true;\r\n\t\t}\r\n\t}\r\n\tif (spawns[0]) {\r\n\t\tgameState.spectator.registerPowerTarget(secret, spawns[0], board, hero, otherHero);\r\n\t}\r\n\tfor (const spawn of spawns) {\r\n\t\tconst impl = cardMappings[spawn.cardId];\r\n\t\tif (hasOnAwaken(impl)) {\r\n\t\t\timpl.onAwaken(spawn, {\r\n\t\t\t\thero,\r\n\t\t\t\tboard,\r\n\t\t\t\totherHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\treturn [...spawns];\r\n};\r\n"]}
@@ -14,7 +14,7 @@ const discardCards = (cards, hero, board, otherBoard, otherHero, gameState) => {
14
14
  };
15
15
  exports.discardCards = discardCards;
16
16
  const discardCard = (card, hero, board, otherBoard, otherHero, gameState) => {
17
- var _a, _b;
17
+ var _a, _b, _c;
18
18
  const hand = (_a = hero.hand) !== null && _a !== void 0 ? _a : [];
19
19
  const index = hand.indexOf(card);
20
20
  if (index === -1) {
@@ -43,6 +43,12 @@ const discardCard = (card, hero, board, otherBoard, otherHero, gameState) => {
43
43
  impl.onDiscard(entity, input);
44
44
  }
45
45
  }
46
+ for (const trinket of (_c = hero.trinkets) !== null && _c !== void 0 ? _c : []) {
47
+ const impl = _card_mappings_1.cardMappings[trinket.cardId];
48
+ if ((0, card_interface_1.hasOnDiscard)(impl)) {
49
+ impl.onDiscard(trinket, input);
50
+ }
51
+ }
46
52
  return true;
47
53
  };
48
54
  exports.discardCard = discardCard;
@@ -1 +1 @@
1
- {"version":3,"file":"discard.js","sourceRoot":"","sources":["../../src/simulation/discard.ts"],"names":[],"mappings":";;;AAEA,4DAAyF;AACzF,iEAA4D;AAGrD,MAAM,YAAY,GAAG,CAC3B,KAA6B,EAC7B,IAAqB,EACrB,KAAoB,EACpB,UAAyB,EACzB,SAA0B,EAC1B,SAAwB,EACf,EAAE;IACX,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACzB,IAAI,IAAA,mBAAW,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE;YACrE,SAAS,EAAE,CAAC;SACZ;KACD;IACD,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB;AAEK,MAAM,WAAW,GAAG,CAC1B,IAAiB,EACjB,IAAqB,EACrB,KAAoB,EACpB,UAAyB,EACzB,SAA0B,EAC1B,SAAwB,EACd,EAAE;;IACZ,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QACjB,OAAO,KAAK,CAAC;KACb;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,UAAU,CAAC,sBAAsB,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,sBAAsB,mCAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAE3F,MAAM,KAAK,GAAiB;QAC3B,SAAS,EAAE,IAAI;QACf,IAAI;QACJ,KAAK;QACL,SAAS;QACT,UAAU;QACV,SAAS;KACT,CAAC;IAEF,MAAM,aAAa,GAAG,6BAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChD,IAAI,IAAA,mCAAkB,EAAC,aAAa,CAAC,EAAE;QACtC,aAAa,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KAC3C;IAED,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC3B,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,EAAE;YAChD,SAAS;SACT;QACD,MAAM,IAAI,GAAG,6BAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,IAAA,6BAAY,EAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SAC9B;KACD;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAxCW,QAAA,WAAW,eAwCtB","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { DiscardInput, hasOnDiscard, hasOnThisDiscarded } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const discardCards = (\r\n\tcards: readonly BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tlet discarded = 0;\r\n\tfor (const card of cards) {\r\n\t\tif (discardCard(card, hero, board, otherBoard, otherHero, gameState)) {\r\n\t\t\tdiscarded++;\r\n\t\t}\r\n\t}\r\n\treturn discarded;\r\n};\r\n\r\nexport const discardCard = (\r\n\tcard: BoardEntity,\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): boolean => {\r\n\tconst hand = hero.hand ?? [];\r\n\tconst index = hand.indexOf(card);\r\n\tif (index === -1) {\r\n\t\treturn false;\r\n\t}\r\n\thand.splice(index, 1);\r\n\thero.globalInfo.CardsDiscardedThisGame = (hero.globalInfo.CardsDiscardedThisGame ?? 0) + 1;\r\n\r\n\tconst input: DiscardInput = {\r\n\t\tdiscarded: card,\r\n\t\thero,\r\n\t\tboard,\r\n\t\totherHero,\r\n\t\totherBoard,\r\n\t\tgameState,\r\n\t};\r\n\r\n\tconst discardedImpl = cardMappings[card.cardId];\r\n\tif (hasOnThisDiscarded(discardedImpl)) {\r\n\t\tdiscardedImpl.onThisDiscarded(card, input);\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tif (entity.health <= 0 || entity.definitelyDead) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tconst impl = cardMappings[entity.cardId];\r\n\t\tif (hasOnDiscard(impl)) {\r\n\t\t\timpl.onDiscard(entity, input);\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n};\r\n"]}
1
+ {"version":3,"file":"discard.js","sourceRoot":"","sources":["../../src/simulation/discard.ts"],"names":[],"mappings":";;;AAEA,4DAAyF;AACzF,iEAA4D;AAGrD,MAAM,YAAY,GAAG,CAC3B,KAA6B,EAC7B,IAAqB,EACrB,KAAoB,EACpB,UAAyB,EACzB,SAA0B,EAC1B,SAAwB,EACf,EAAE;IACX,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,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CAAC,CAAC;QACzC,IAAI,IAAA,6BAAY,EAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SAC9B;KACD;IACD,KAAK,MAAM,OAAO,IAAI,MAAA,IAAI,CAAC,QAAQ,mCAAI,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,6BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,IAAA,6BAAY,EAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC/B;KACD;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AA9CW,QAAA,WAAW,eA8CtB","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { DiscardInput, hasOnDiscard, hasOnThisDiscarded } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const discardCards = (\r\n\tcards: readonly BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tlet discarded = 0;\r\n\tfor (const card of cards) {\r\n\t\tif (discardCard(card, hero, board, otherBoard, otherHero, gameState)) {\r\n\t\t\tdiscarded++;\r\n\t\t}\r\n\t}\r\n\treturn discarded;\r\n};\r\n\r\nexport const discardCard = (\r\n\tcard: BoardEntity,\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): boolean => {\r\n\tconst hand = hero.hand ?? [];\r\n\tconst index = hand.indexOf(card);\r\n\tif (index === -1) {\r\n\t\treturn false;\r\n\t}\r\n\thand.splice(index, 1);\r\n\thero.globalInfo.CardsDiscardedThisGame = (hero.globalInfo.CardsDiscardedThisGame ?? 0) + 1;\r\n\r\n\tconst input: DiscardInput = {\r\n\t\tdiscarded: card,\r\n\t\thero,\r\n\t\tboard,\r\n\t\totherHero,\r\n\t\totherBoard,\r\n\t\tgameState,\r\n\t};\r\n\r\n\tconst discardedImpl = cardMappings[card.cardId];\r\n\tif (hasOnThisDiscarded(discardedImpl)) {\r\n\t\tdiscardedImpl.onThisDiscarded(card, input);\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tif (entity.health <= 0 || entity.definitelyDead) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tconst impl = cardMappings[entity.cardId];\r\n\t\tif (hasOnDiscard(impl)) {\r\n\t\t\timpl.onDiscard(entity, input);\r\n\t\t}\r\n\t}\r\n\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\tconst impl = cardMappings[trinket.cardId];\r\n\t\tif (hasOnDiscard(impl)) {\r\n\t\t\timpl.onDiscard(trinket, input);\r\n\t\t}\r\n\t}\r\n\treturn true;\r\n};\r\n"]}
@@ -7,6 +7,7 @@ const persisting_horror_1 = require("../cards/impl/enchantments/persisting-horro
7
7
  const sinrunner_blanchy_1 = require("../cards/impl/minion/sinrunner-blanchy");
8
8
  const utils_1 = require("../utils");
9
9
  const deathrattle_spawns_1 = require("./deathrattle-spawns");
10
+ const deity_1 = require("./deity");
10
11
  const spawns_1 = require("./spawns");
11
12
  const entity_utils_1 = require("./utils/entity-utils");
12
13
  const handleRebornForEntity = (boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight, opponentBoard, opponentBoardHero, gameState) => {
@@ -35,6 +36,12 @@ const handleRebornForEntity = (boardWithKilledMinion, boardWithKilledMinionHero,
35
36
  if (!entitiesFromReborn.length) {
36
37
  return;
37
38
  }
39
+ if ((0, deity_1.isDeityCard)(deadEntity.cardId, gameState.allCards)) {
40
+ for (const entity of entitiesFromReborn) {
41
+ (0, deity_1.applyDeityBaseStats)(entity, boardWithKilledMinionHero);
42
+ entity.health = 1;
43
+ }
44
+ }
38
45
  if (deadEntity.cardId === "BG30_109" ||
39
46
  deadEntity.cardId === "BG30_109_G") {
40
47
  entitiesFromReborn.forEach((e) => {