@firestone-hs/simulate-bgs-battle 1.1.322 → 1.1.324
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.
- package/dist/bgs-player-entity.d.ts +1 -0
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/cards/cards-data.js +4 -0
- package/dist/cards/cards-data.js.map +1 -1
- package/dist/simulation/add-minion-to-board.js +7 -0
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/auras.js +1 -0
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +4 -2
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\n\r\nexport interface BgsPlayerEntity {\r\n\treadonly cardId: string;\r\n\treadonly nonGhostCardId?: string;\r\n\treadonly hpLeft: number;\r\n\treadonly tavernTier: number;\r\n\treadonly heroPowerId?: string | undefined | null;\r\n\treadonly heroPowerUsed: boolean;\r\n\treadonly heroPowerInfo?: number;\r\n\treadonly heroPowerInfo2?: number;\r\n\tentityId?: number;\r\n\tquestRewards?: readonly string[];\r\n\tquestRewardEntities?: readonly {\r\n\t\tcardId: string;\r\n\t\tavengeDefault?: number;\r\n\t\tavengeCurrent?: number;\r\n\t}[];\r\n\thand?: BoardEntity[];\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tglobalInfo?: BgsPlayerGlobalInfo;\r\n\r\n\tdeadEyeDamageDone?: number;\r\n\trapidReanimationMinion?: BoardEntity;\r\n\trapidReanimationIndexFromRight?: number;\r\n}\r\n\r\nexport interface BgsPlayerGlobalInfo {\r\n\tEternalKnightsDeadThisGame?: number;\r\n\tUndeadAttackBonus?: number;\r\n\tChoralAttackBuff?: number;\r\n\tChoralHealthBuff?: number;\r\n\tFrostlingBonus?: number;\r\n\tBloodGemAttackBonus?: number;\r\n\tBloodGemHealthBonus?: number;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\n\r\nexport interface BgsPlayerEntity {\r\n\treadonly cardId: string;\r\n\treadonly nonGhostCardId?: string;\r\n\treadonly hpLeft: number;\r\n\treadonly tavernTier: number;\r\n\treadonly heroPowerId?: string | undefined | null;\r\n\treadonly heroPowerUsed: boolean;\r\n\treadonly heroPowerInfo?: number;\r\n\treadonly heroPowerInfo2?: number;\r\n\tentityId?: number;\r\n\tquestRewards?: readonly string[];\r\n\tquestRewardEntities?: readonly {\r\n\t\tcardId: string;\r\n\t\tavengeDefault?: number;\r\n\t\tavengeCurrent?: number;\r\n\t}[];\r\n\thand?: BoardEntity[];\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tglobalInfo?: BgsPlayerGlobalInfo;\r\n\r\n\tdeadEyeDamageDone?: number;\r\n\trapidReanimationMinion?: BoardEntity;\r\n\trapidReanimationIndexFromRight?: number;\r\n}\r\n\r\nexport interface BgsPlayerGlobalInfo {\r\n\tEternalKnightsDeadThisGame?: number;\r\n\tUndeadAttackBonus?: number;\r\n\tChoralAttackBuff?: number;\r\n\tChoralHealthBuff?: number;\r\n\tFrostlingBonus?: number;\r\n\tBloodGemAttackBonus?: number;\r\n\tBloodGemHealthBonus?: number;\r\n\tGoldrinnBuff?: number;\r\n}\r\n"]}
|
package/dist/cards/cards-data.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cards-data.js","sourceRoot":"","sources":["../../src/cards/cards-data.ts"],"names":[],"mappings":";;;AAAA,iEAQsC;AACtC,6CAAgE;AAChE,oCAAoE;AAEvD,QAAA,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBvC,CA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,\r\n\tCardIds,\r\n\tGameTag,\r\n\tisBattlegroundsCard,\r\n\tNON_BUYABLE_MINION_IDS,\r\n\tRace,\r\n\tReferenceCard,\r\n} from '@firestone-hs/reference-data';\r\nimport { groupByFunction, pickRandom } from '../services/utils';\r\nimport { getRaceEnum, hasMechanic, isCorrectTribe } from '../utils';\r\n\r\nexport const START_OF_COMBAT_CARD_IDS = [\r\n\tCardIds.CorruptedMyrmidon_BG23_012,\r\n\tCardIds.CorruptedMyrmidon_BG23_012_G,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy_G,\r\n\tCardIds.MantidQueen_BG22_402,\r\n\tCardIds.MantidQueen_BG22_402_G,\r\n\tCardIds.PrizedPromoDrake_BG21_014,\r\n\tCardIds.PrizedPromoDrake_BG21_014_G,\r\n\tCardIds.RedWhelp_BGS_019,\r\n\tCardIds.RedWhelp_TB_BaconUps_102,\r\n\tCardIds.AmberGuardian_BG24_500,\r\n\tCardIds.AmberGuardian_BG24_500_G,\r\n\tCardIds.InterrogatorWhitemane_BG24_704,\r\n\tCardIds.InterrogatorWhitemane_BG24_704_G,\r\n\tCardIds.Soulsplitter_BG25_023,\r\n\tCardIds.Soulsplitter_BG25_023_G,\r\n\tCardIds.ChoralMrrrglr_BG26_354,\r\n\tCardIds.ChoralMrrrglr_BG26_354_G,\r\n\tCardIds.SanctumRester_BG26_356,\r\n\tCardIds.SanctumRester_BG26_356_G,\r\n\tCardIds.CarbonicCopy_BG27_503,\r\n\tCardIds.CarbonicCopy_BG27_503_G,\r\n];\r\nexport const WHELP_CARD_IDS = [\r\n\tCardIds.RedWhelp_BGS_019,\r\n\tCardIds.RedWhelp_TB_BaconUps_102,\r\n\tCardIds.Onyxia_OnyxianWhelpToken,\r\n];\r\n\r\nexport class CardsData {\r\n\tpublic ghastcoilerSpawns: readonly string[];\r\n\t// public shredderSpawns: readonly string[];\r\n\tpublic validDeathrattles: readonly string[];\r\n\tpublic impMamaSpawns: readonly string[];\r\n\tpublic demonSpawns: readonly string[];\r\n\tpublic gentleDjinniSpawns: readonly string[];\r\n\t// public festergutSpawns: readonly string[];\r\n\tpublic kilrekSpawns: readonly string[];\r\n\tpublic brannEpicEggSpawns: readonly string[];\r\n\t// public sneedsSpawns: readonly string[];\r\n\t// public treasureChestSpawns: readonly string[];\r\n\tpublic pirateSpawns: readonly string[];\r\n\tpublic beastSpawns: readonly string[];\r\n\tpublic scrapScraperSpawns: readonly string[];\r\n\r\n\tpublic putricidePool1: readonly string[];\r\n\tpublic putricidePool2: readonly string[];\r\n\tpublic putridicePool2ForEternalSummoner: readonly string[];\r\n\r\n\tprivate pool: readonly ReferenceCard[];\r\n\tprivate minionsForTier: { [key: string]: readonly ReferenceCard[] };\r\n\r\n\tconstructor(private readonly allCards: AllCardsService, init = true) {\r\n\t\tif (init) {\r\n\t\t\tthis.inititialize();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic inititialize(validTribes?: readonly Race[], anomalies?: readonly string[]): void {\r\n\t\tconst poolWithoutGolden = this.allCards\r\n\t\t\t.getCards()\r\n\t\t\t.filter((card) => isBattlegroundsCard(card))\r\n\t\t\t.filter((card) => !NON_BUYABLE_MINION_IDS.includes(card.id as CardIds))\r\n\t\t\t.filter((card) => !!card.techLevel)\r\n\t\t\t.filter((card) => !hasMechanic(card, GameTag[GameTag.BACON_BUDDY]))\r\n\t\t\t.filter((card) => card.set !== 'Vanilla')\r\n\t\t\t.filter((card) =>\r\n\t\t\t\tanomalies?.includes(CardIds.BigLeague_BG27_Anomaly_100)\r\n\t\t\t\t\t? card.techLevel >= 3\r\n\t\t\t\t\t: anomalies?.includes(CardIds.LittleLeague_BG27_Anomaly_800)\r\n\t\t\t\t\t? card.techLevel <= 4\r\n\t\t\t\t\t: true,\r\n\t\t\t);\r\n\t\tthis.pool = poolWithoutGolden.filter((card) =>\r\n\t\t\tanomalies?.includes(CardIds.TheGoldenArena_BG27_Anomaly_801) ? this.isGolden(card) : !this.isGolden(card),\r\n\t\t);\r\n\t\tthis.minionsForTier = groupByFunction((card: ReferenceCard) => card.techLevel)(this.pool);\r\n\t\tthis.ghastcoilerSpawns = this.pool\r\n\t\t\t.filter((card) => card.id !== 'BGS_008')\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.validDeathrattles = poolWithoutGolden\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.demonSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.DEMON)).map((card) => card.id);\r\n\t\tthis.impMamaSpawns = this.demonSpawns.filter((cardId) => cardId !== CardIds.ImpMama_BGS_044);\r\n\t\tthis.gentleDjinniSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.ELEMENTAL))\r\n\t\t\t.filter((card) => card.id !== CardIds.GentleDjinni_BGS_121)\r\n\t\t\t.map((card) => card.id);\r\n\t\t// FIXME: just spawn a random undead instead of an Undead Creation\r\n\t\t// this.festergutSpawns = pool\r\n\t\t// \t.filter((card) => !this.isGolden(card))\r\n\t\t// \t.filter((card) => isCorrectTribe(card.races, Race.UNDEAD))\r\n\t\t// \t.filter((card) => card.id !== CardIds.Festergut_BG25_HERO_100_Buddy)\r\n\t\t// \t// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\r\n\t\t// \t.map((card) => card.id);\r\n\t\tthis.kilrekSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.filter((card) => card.id !== CardIds.Kilrek_TB_BaconShop_HERO_37_Buddy)\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.brannEpicEggSpawns = this.pool.filter((card) => hasMechanic(card, 'BATTLECRY')).map((card) => card.id);\r\n\t\tthis.pirateSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.PIRATE)).map((card) => card.id);\r\n\t\tthis.beastSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.BEAST)).map((card) => card.id);\r\n\t\tthis.scrapScraperSpawns = this.pool\r\n\t\t\t.filter((card) => hasMechanic(card, GameTag[GameTag.MAGNETIC]))\r\n\t\t\t.map((card) => card.id);\r\n\r\n\t\tthis.putricidePool1 = this.pool.filter((card) => card.battlegroundsPutridicePool1).map((card) => card.id);\r\n\t\tthis.putricidePool2 = this.pool.filter((card) => card.battlegroundsPutridicePool2).map((card) => card.id);\r\n\t\tthis.putridicePool2ForEternalSummoner = this.pool\r\n\t\t\t.filter((card) => card.battlegroundsPutridicePool2)\r\n\t\t\t.filter((card) => !card.battlegroundsPutridiceSummonerExclusion)\r\n\t\t\t.map((card) => card.id);\r\n\t}\r\n\r\n\tpublic avengeValue(cardId: string): number {\r\n\t\tswitch (cardId) {\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002:\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002_G:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014_G:\r\n\t\t\t// Not technically an avenge, but behaves as if\r\n\t\t\tcase CardIds.ShadowyConstruct_BG25_HERO_103_Buddy:\r\n\t\t\tcase CardIds.ShadowyConstruct_BG25_HERO_103_Buddy_G:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157_G:\r\n\t\t\tcase CardIds.IceSickle:\r\n\t\t\t\treturn 1;\r\n\t\t\tcase CardIds.GhoulOfTheFeast_BG25_002:\r\n\t\t\tcase CardIds.GhoulOfTheFeast_BG25_002_G:\r\n\t\t\tcase CardIds.MechanoTank_BG21_023:\r\n\t\t\tcase CardIds.MechanoTank_BG21_023_G:\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy:\r\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy_G:\r\n\t\t\tcase CardIds.VanndarStormpike_LeadTheStormpikes:\r\n\t\t\tcase CardIds.Drekthar_LeadTheFrostwolves:\r\n\t\t\t\treturn 2;\r\n\t\t\tcase CardIds.BuddingGreenthumb_BG21_030:\r\n\t\t\tcase CardIds.BuddingGreenthumb_BG21_030_G:\r\n\t\t\t// case CardIds.FrostwolfLieutenant:\r\n\t\t\t// case CardIds.FrostwolfLieutenantBattlegrounds:\r\n\t\t\tcase CardIds.Onyxia_Broodmother:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014_G:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029_G:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007:\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007_G:\r\n\t\t\tcase CardIds.Sisefin_BG21_009:\r\n\t\t\tcase CardIds.Sisefin_BG21_009_G:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031_G:\r\n\t\t\tcase CardIds.ScrapScraper_BG26_148:\r\n\t\t\tcase CardIds.ScrapScraper_BG26_148_G:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003_G:\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010:\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010_G:\r\n\t\t\t\treturn 4;\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tpublic getTavernLevel(cardId: string): number {\r\n\t\treturn this.allCards.getCard(cardId).techLevel ?? 1;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTavernTier(tavernTier: number): string {\r\n\t\t// Tzvern tier can be undefined for hero-power specific tokens, like the Amalgam, or when\r\n\t\t// for some reason tokens end up in the shop. For now, defaulting to 1 for tavern\r\n\t\t// level seems to work in all cases\r\n\t\tconst minionsForTier = this.minionsForTier[tavernTier ?? 1];\r\n\t\tif (!minionsForTier?.length) {\r\n\t\t\tconsole.error('incorrect minions for tier', tavernTier, this.minionsForTier, minionsForTier);\r\n\t\t}\r\n\t\treturn pickRandom(this.minionsForTier[tavernTier ?? 1])?.id;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTribe(tribe: Race, tavernLimitUpper: number): string {\r\n\t\tconst pool = this.pool\r\n\t\t\t.filter((m) => this.isValidTribe([tribe], m.races))\r\n\t\t\t.filter((m) => m.techLevel <= tavernLimitUpper);\r\n\t\treturn pickRandom(pool)?.id;\r\n\t}\r\n\r\n\tprivate isGolden(card: ReferenceCard): boolean {\r\n\t\treturn !!card.battlegroundsNormalDbfId;\r\n\t}\r\n\r\n\tprivate isValidTribe(validTribes: readonly Race[], cardRaces: readonly string[]): boolean {\r\n\t\t// Blank races are always ok\r\n\t\tif (!cardRaces?.length) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn cardRaces\r\n\t\t\t.map((race) => getRaceEnum(race))\r\n\t\t\t.some((raceEnum) => raceEnum === Race.ALL || !validTribes?.length || validTribes.includes(raceEnum));\r\n\t}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"cards-data.js","sourceRoot":"","sources":["../../src/cards/cards-data.ts"],"names":[],"mappings":";;;AAAA,iEAQsC;AACtC,6CAAgE;AAChE,oCAAoE;AAEvD,QAAA,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;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ent":["import {\r\n\tAllCardsService,\r\n\tCardIds,\r\n\tGameTag,\r\n\tisBattlegroundsCard,\r\n\tNON_BUYABLE_MINION_IDS,\r\n\tRace,\r\n\tReferenceCard,\r\n} from '@firestone-hs/reference-data';\r\nimport { groupByFunction, pickRandom } from '../services/utils';\r\nimport { getRaceEnum, hasMechanic, isCorrectTribe } from '../utils';\r\n\r\nexport const START_OF_COMBAT_CARD_IDS = [\r\n\tCardIds.CorruptedMyrmidon_BG23_012,\r\n\tCardIds.CorruptedMyrmidon_BG23_012_G,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy_G,\r\n\tCardIds.MantidQueen_BG22_402,\r\n\tCardIds.MantidQueen_BG22_402_G,\r\n\tCardIds.PrizedPromoDrake_BG21_014,\r\n\tCardIds.PrizedPromoDrake_BG21_014_G,\r\n\tCardIds.RedWhelp_BGS_019,\r\n\tCardIds.RedWhelp_TB_BaconUps_102,\r\n\tCardIds.AmberGuardian_BG24_500,\r\n\tCardIds.AmberGuardian_BG24_500_G,\r\n\tCardIds.InterrogatorWhitemane_BG24_704,\r\n\tCardIds.InterrogatorWhitemane_BG24_704_G,\r\n\tCardIds.Soulsplitter_BG25_023,\r\n\tCardIds.Soulsplitter_BG25_023_G,\r\n\tCardIds.ChoralMrrrglr_BG26_354,\r\n\tCardIds.ChoralMrrrglr_BG26_354_G,\r\n\tCardIds.SanctumRester_BG26_356,\r\n\tCardIds.SanctumRester_BG26_356_G,\r\n\tCardIds.CarbonicCopy_BG27_503,\r\n\tCardIds.CarbonicCopy_BG27_503_G,\r\n\tCardIds.HawkstriderHerald_BG27_079,\r\n\tCardIds.HawkstriderHerald_BG27_079_G,\r\n\tCardIds.AudaciousAnchor_BG28_904,\r\n\tCardIds.AudaciousAnchor_BG28_904_G,\r\n];\r\nexport const WHELP_CARD_IDS = [\r\n\tCardIds.RedWhelp_BGS_019,\r\n\tCardIds.RedWhelp_TB_BaconUps_102,\r\n\tCardIds.Onyxia_OnyxianWhelpToken,\r\n];\r\n\r\nexport class CardsData {\r\n\tpublic ghastcoilerSpawns: readonly string[];\r\n\t// public shredderSpawns: readonly string[];\r\n\tpublic validDeathrattles: readonly string[];\r\n\tpublic impMamaSpawns: readonly string[];\r\n\tpublic demonSpawns: readonly string[];\r\n\tpublic gentleDjinniSpawns: readonly string[];\r\n\t// public festergutSpawns: readonly string[];\r\n\tpublic kilrekSpawns: readonly string[];\r\n\tpublic brannEpicEggSpawns: readonly string[];\r\n\t// public sneedsSpawns: readonly string[];\r\n\t// public treasureChestSpawns: readonly string[];\r\n\tpublic pirateSpawns: readonly string[];\r\n\tpublic beastSpawns: readonly string[];\r\n\tpublic scrapScraperSpawns: readonly string[];\r\n\r\n\tpublic putricidePool1: readonly string[];\r\n\tpublic putricidePool2: readonly string[];\r\n\tpublic putridicePool2ForEternalSummoner: readonly string[];\r\n\r\n\tprivate pool: readonly ReferenceCard[];\r\n\tprivate minionsForTier: { [key: string]: readonly ReferenceCard[] };\r\n\r\n\tconstructor(private readonly allCards: AllCardsService, init = true) {\r\n\t\tif (init) {\r\n\t\t\tthis.inititialize();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic inititialize(validTribes?: readonly Race[], anomalies?: readonly string[]): void {\r\n\t\tconst poolWithoutGolden = this.allCards\r\n\t\t\t.getCards()\r\n\t\t\t.filter((card) => isBattlegroundsCard(card))\r\n\t\t\t.filter((card) => !NON_BUYABLE_MINION_IDS.includes(card.id as CardIds))\r\n\t\t\t.filter((card) => !!card.techLevel)\r\n\t\t\t.filter((card) => !hasMechanic(card, GameTag[GameTag.BACON_BUDDY]))\r\n\t\t\t.filter((card) => card.set !== 'Vanilla')\r\n\t\t\t.filter((card) =>\r\n\t\t\t\tanomalies?.includes(CardIds.BigLeague_BG27_Anomaly_100)\r\n\t\t\t\t\t? card.techLevel >= 3\r\n\t\t\t\t\t: anomalies?.includes(CardIds.LittleLeague_BG27_Anomaly_800)\r\n\t\t\t\t\t? card.techLevel <= 4\r\n\t\t\t\t\t: true,\r\n\t\t\t);\r\n\t\tthis.pool = poolWithoutGolden.filter((card) =>\r\n\t\t\tanomalies?.includes(CardIds.TheGoldenArena_BG27_Anomaly_801) ? this.isGolden(card) : !this.isGolden(card),\r\n\t\t);\r\n\t\tthis.minionsForTier = groupByFunction((card: ReferenceCard) => card.techLevel)(this.pool);\r\n\t\tthis.ghastcoilerSpawns = this.pool\r\n\t\t\t.filter((card) => card.id !== 'BGS_008')\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.validDeathrattles = poolWithoutGolden\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.demonSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.DEMON)).map((card) => card.id);\r\n\t\tthis.impMamaSpawns = this.demonSpawns.filter((cardId) => cardId !== CardIds.ImpMama_BGS_044);\r\n\t\tthis.gentleDjinniSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.ELEMENTAL))\r\n\t\t\t.filter((card) => card.id !== CardIds.GentleDjinni_BGS_121)\r\n\t\t\t.map((card) => card.id);\r\n\t\t// FIXME: just spawn a random undead instead of an Undead Creation\r\n\t\t// this.festergutSpawns = pool\r\n\t\t// \t.filter((card) => !this.isGolden(card))\r\n\t\t// \t.filter((card) => isCorrectTribe(card.races, Race.UNDEAD))\r\n\t\t// \t.filter((card) => card.id !== CardIds.Festergut_BG25_HERO_100_Buddy)\r\n\t\t// \t// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\r\n\t\t// \t.map((card) => card.id);\r\n\t\tthis.kilrekSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.filter((card) => card.id !== CardIds.Kilrek_TB_BaconShop_HERO_37_Buddy)\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.brannEpicEggSpawns = this.pool.filter((card) => hasMechanic(card, 'BATTLECRY')).map((card) => card.id);\r\n\t\tthis.pirateSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.PIRATE)).map((card) => card.id);\r\n\t\tthis.beastSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.BEAST)).map((card) => card.id);\r\n\t\tthis.scrapScraperSpawns = this.pool\r\n\t\t\t.filter((card) => hasMechanic(card, GameTag[GameTag.MAGNETIC]))\r\n\t\t\t.map((card) => card.id);\r\n\r\n\t\tthis.putricidePool1 = this.pool.filter((card) => card.battlegroundsPutridicePool1).map((card) => card.id);\r\n\t\tthis.putricidePool2 = this.pool.filter((card) => card.battlegroundsPutridicePool2).map((card) => card.id);\r\n\t\tthis.putridicePool2ForEternalSummoner = this.pool\r\n\t\t\t.filter((card) => card.battlegroundsPutridicePool2)\r\n\t\t\t.filter((card) => !card.battlegroundsPutridiceSummonerExclusion)\r\n\t\t\t.map((card) => card.id);\r\n\t}\r\n\r\n\tpublic avengeValue(cardId: string): number {\r\n\t\tswitch (cardId) {\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002:\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002_G:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014_G:\r\n\t\t\t// Not technically an avenge, but behaves as if\r\n\t\t\tcase CardIds.ShadowyConstruct_BG25_HERO_103_Buddy:\r\n\t\t\tcase CardIds.ShadowyConstruct_BG25_HERO_103_Buddy_G:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157_G:\r\n\t\t\tcase CardIds.IceSickle:\r\n\t\t\t\treturn 1;\r\n\t\t\tcase CardIds.GhoulOfTheFeast_BG25_002:\r\n\t\t\tcase CardIds.GhoulOfTheFeast_BG25_002_G:\r\n\t\t\tcase CardIds.MechanoTank_BG21_023:\r\n\t\t\tcase CardIds.MechanoTank_BG21_023_G:\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy:\r\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy_G:\r\n\t\t\tcase CardIds.VanndarStormpike_LeadTheStormpikes:\r\n\t\t\tcase CardIds.Drekthar_LeadTheFrostwolves:\r\n\t\t\t\treturn 2;\r\n\t\t\tcase CardIds.BuddingGreenthumb_BG21_030:\r\n\t\t\tcase CardIds.BuddingGreenthumb_BG21_030_G:\r\n\t\t\t// case CardIds.FrostwolfLieutenant:\r\n\t\t\t// case CardIds.FrostwolfLieutenantBattlegrounds:\r\n\t\t\tcase CardIds.Onyxia_Broodmother:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014_G:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029_G:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007:\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007_G:\r\n\t\t\tcase CardIds.Sisefin_BG21_009:\r\n\t\t\tcase CardIds.Sisefin_BG21_009_G:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031_G:\r\n\t\t\tcase CardIds.ScrapScraper_BG26_148:\r\n\t\t\tcase CardIds.ScrapScraper_BG26_148_G:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003_G:\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010:\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010_G:\r\n\t\t\t\treturn 4;\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tpublic getTavernLevel(cardId: string): number {\r\n\t\treturn this.allCards.getCard(cardId).techLevel ?? 1;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTavernTier(tavernTier: number): string {\r\n\t\t// Tzvern tier can be undefined for hero-power specific tokens, like the Amalgam, or when\r\n\t\t// for some reason tokens end up in the shop. For now, defaulting to 1 for tavern\r\n\t\t// level seems to work in all cases\r\n\t\tconst minionsForTier = this.minionsForTier[tavernTier ?? 1];\r\n\t\tif (!minionsForTier?.length) {\r\n\t\t\tconsole.error('incorrect minions for tier', tavernTier, this.minionsForTier, minionsForTier);\r\n\t\t}\r\n\t\treturn pickRandom(this.minionsForTier[tavernTier ?? 1])?.id;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTribe(tribe: Race, tavernLimitUpper: number): string {\r\n\t\tconst pool = this.pool\r\n\t\t\t.filter((m) => this.isValidTribe([tribe], m.races))\r\n\t\t\t.filter((m) => m.techLevel <= tavernLimitUpper);\r\n\t\treturn pickRandom(pool)?.id;\r\n\t}\r\n\r\n\tprivate isGolden(card: ReferenceCard): boolean {\r\n\t\treturn !!card.battlegroundsNormalDbfId;\r\n\t}\r\n\r\n\tprivate isValidTribe(validTribes: readonly Race[], cardRaces: readonly string[]): boolean {\r\n\t\t// Blank races are always ok\r\n\t\tif (!cardRaces?.length) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn cardRaces\r\n\t\t\t.map((race) => getRaceEnum(race))\r\n\t\t\t.some((raceEnum) => raceEnum === Race.ALL || !validTribes?.length || validTribes.includes(raceEnum));\r\n\t}\r\n}\r\n"]}
|
|
@@ -163,6 +163,13 @@ const handleAddedMinionAuraEffect = (board, boardHero, spawned, allCards, specta
|
|
|
163
163
|
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, allCards)) {
|
|
167
|
+
if (boardHero.globalInfo.GoldrinnBuff > 0) {
|
|
168
|
+
(0, utils_1.modifyAttack)(spawned, boardHero.globalInfo.GoldrinnBuff, board, allCards);
|
|
169
|
+
(0, utils_1.modifyHealth)(spawned, boardHero.globalInfo.GoldrinnBuff, board, allCards);
|
|
170
|
+
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
166
173
|
for (const entity of board) {
|
|
167
174
|
switch (entity.cardId) {
|
|
168
175
|
case "BG_EX1_507":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAQkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACjB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,WAAW,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE;QACtD,IAAA,wBAAgB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;KAC3G;IACD,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC,CAA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ACC,IAAI,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE;oBACnC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,mBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;iBACrE;gBACD,MAAM;YAGP;gBACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,qBAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,EAAE;oBAC5F,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,IAAA,wBAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;iBACrD;gBACD,MAAM;SACP;KACD;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\thandleAddedMinionAuraEffect(board, boardHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.SproutItOut:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy_G);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot_BGS_071:\r\n\t\t\tcase CardIds.DeflectOBot_TB_BaconUps_123:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBot_TB_BaconUps_123 ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal_BGS_204:\r\n\t\t\tcase CardIds.Bigfernal_TB_BaconUps_304:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.Bigfernal_TB_BaconUps_304 ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear_BGS_021:\r\n\t\t\tcase CardIds.MamaBear_TB_BaconUps_090:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBear_TB_BaconUps_090 ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader_BGS_017:\r\n\t\t\tcase CardIds.PackLeader_TB_BaconUps_086:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeader_TB_BaconUps_086 ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\nexport const handleAddedMinionAuraEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Tinker_TB_BaconShop_HP_015:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\thandleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState);\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack += entity.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += (entity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleMinionAddedAuraEffect = (\r\n\tspawnedCardId: string,\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (spawnedCardId) {\r\n\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t// Other\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\tboard.forEach((e) => {\r\n\t\t\t\te.attack += spawned.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.Kathranatir_BG21_039_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tmodifyAttack(spawned, statsBonusFrostling, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += (spawned.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\t// case CardIds.MurlocTidecallerLegacy:\r\n\t\t\t// case CardIds.MurlocTidecallerCore:\r\n\t\t\t// \tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t// \tconst buffAmount =\r\n\t\t\t// \t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t// \tif (buffAmount > 0) {\r\n\t\t\t// \t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t// \t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t// \t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.Swampstriker_BG22_401:\r\n\t\t\tcase CardIds.Swampstriker_BG22_401_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst multiplier2 = entity.cardId === CardIds.Swampstriker_BG22_401_G ? 2 : 1;\r\n\t\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper_BG25_042:\r\n\t\t\tcase CardIds.Felstomper_BG25_042_G:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.Felstomper_BG25_042_G ? 6 : 3;\r\n\t\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones_BG26_172:\r\n\t\t\tcase CardIds.XyloBones_BG26_172_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBones_BG26_172_G ? 6 : 3;\r\n\t\t\t\t\tmodifyHealth(entity, xylobonesBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804:\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804_G:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGod_BG26_804_G ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802:\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlamma_BG26_802_G ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370:\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst snapjawBuff = entity.cardId === CardIds.HungrySnapjaw_BG26_370_G ? 2 : 1;\r\n\t\t\t\t\tmodifyHealth(entity, snapjawBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ObserverOfMyths_BG_TTN_078:\r\n\t\t\tcase CardIds.ObserverOfMyths_BG_TTN_078_G:\r\n\t\t\t\tif (spawned.attack > entity.attack) {\r\n\t\t\t\t\tconst observerBuff = entity.cardId === CardIds.ObserverOfMyths_BG_TTN_078_G ? 2 : 1;\r\n\t\t\t\t\taddStatsToBoard(entity, board, observerBuff, 0, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAQkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACjB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,WAAW,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE;QACtD,IAAA,wBAAgB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;KAC3G;IACD,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC,CAAC;AAfW,QAAA,iBAAiB,qBAe5B;AAEK,MAAM,gBAAgB,GAAG,CAC/B,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,WAAwB,EACxB,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACxB,wBAAwB,GAAG,IAAI,EACxB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;IAEpC,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,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AAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;iBAC1C;gBACD,MAAM;YACP,kBAAwC;YACxC;gBACC,IAAI,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE;oBACnC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,mBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;iBACrE;gBACD,MAAM;YAGP;gBACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,qBAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,EAAE;oBAC5F,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,IAAA,wBAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;iBACrD;gBACD,MAAM;SACP;KACD;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\thandleAddedMinionAuraEffect(board, boardHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.SproutItOut:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy_G);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot_BGS_071:\r\n\t\t\tcase CardIds.DeflectOBot_TB_BaconUps_123:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBot_TB_BaconUps_123 ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal_BGS_204:\r\n\t\t\tcase CardIds.Bigfernal_TB_BaconUps_304:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.Bigfernal_TB_BaconUps_304 ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear_BGS_021:\r\n\t\t\tcase CardIds.MamaBear_TB_BaconUps_090:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBear_TB_BaconUps_090 ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader_BGS_017:\r\n\t\t\tcase CardIds.PackLeader_TB_BaconUps_086:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeader_TB_BaconUps_086 ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\nexport const handleAddedMinionAuraEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Tinker_TB_BaconShop_HP_015:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\thandleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState);\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\tif (boardHero.globalInfo.GoldrinnBuff > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.GoldrinnBuff, board, allCards);\r\n\t\t\tmodifyHealth(spawned, boardHero.globalInfo.GoldrinnBuff, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack += entity.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += (entity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleMinionAddedAuraEffect = (\r\n\tspawnedCardId: string,\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (spawnedCardId) {\r\n\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t// Other\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\tboard.forEach((e) => {\r\n\t\t\t\te.attack += spawned.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.Kathranatir_BG21_039_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tmodifyAttack(spawned, statsBonusFrostling, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += (spawned.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\t// case CardIds.MurlocTidecallerLegacy:\r\n\t\t\t// case CardIds.MurlocTidecallerCore:\r\n\t\t\t// \tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t// \tconst buffAmount =\r\n\t\t\t// \t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t// \tif (buffAmount > 0) {\r\n\t\t\t// \t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t// \t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t// \t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.Swampstriker_BG22_401:\r\n\t\t\tcase CardIds.Swampstriker_BG22_401_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst multiplier2 = entity.cardId === CardIds.Swampstriker_BG22_401_G ? 2 : 1;\r\n\t\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper_BG25_042:\r\n\t\t\tcase CardIds.Felstomper_BG25_042_G:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.Felstomper_BG25_042_G ? 6 : 3;\r\n\t\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones_BG26_172:\r\n\t\t\tcase CardIds.XyloBones_BG26_172_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBones_BG26_172_G ? 6 : 3;\r\n\t\t\t\t\tmodifyHealth(entity, xylobonesBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804:\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804_G:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGod_BG26_804_G ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802:\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlamma_BG26_802_G ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370:\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst snapjawBuff = entity.cardId === CardIds.HungrySnapjaw_BG26_370_G ? 2 : 1;\r\n\t\t\t\t\tmodifyHealth(entity, snapjawBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ObserverOfMyths_BG_TTN_078:\r\n\t\t\tcase CardIds.ObserverOfMyths_BG_TTN_078_G:\r\n\t\t\t\tif (spawned.attack > entity.attack) {\r\n\t\t\t\t\tconst observerBuff = entity.cardId === CardIds.ObserverOfMyths_BG_TTN_078_G ? 2 : 1;\r\n\t\t\t\t\taddStatsToBoard(entity, board, observerBuff, 0, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
|
package/dist/simulation/auras.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAA2C;AAEpC,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEK,MAAM,uBAAuB,GAAG,CACtC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EACnB,EAAE;IAmBT,IAAI,SAAS,CAAC,WAAW,sBAA0B,EAAE;QACpD,KAAK;aACH,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CACnB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MA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,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n): void => {\r\n\t// if (\r\n\t// \tboardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ||\r\n\t// \totherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds\r\n\t// ) {\r\n\t// \tconst bonus =\r\n\t// \t\t(boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0) +\r\n\t// \t\t(otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0);\r\n\t// \tboard\r\n\t// \t\t.filter(\r\n\t// \t\t\t(e) =>\r\n\t// \t\t\t\t!e.enchantments.find(\r\n\t// \t\t\t\t\t(ench) => ench.cardId === CardIds.AllWillBurn_AllWillBurnEnchantmentBattlegrounds,\r\n\t// \t\t\t\t),\r\n\t// \t\t)\r\n\t// \t\t.forEach((e) => {\r\n\t// \t\t\te.attack += bonus;\r\n\t// \t\t});\r\n\t// }\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 4;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird_BG26_805,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird_BG26_805_G,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039_G,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantment_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantment_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043_G,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t12,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewards.map((reward) => ({\r\n\t\tcardId: reward,\r\n\t\tavengeCurrent: 0,\r\n\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t}));\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\thero.hand = hero.hand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {\r\n\t\t\tEternalKnightsDeadThisGame: 0,\r\n\t\t\tUndeadAttackBonus: 0,\r\n\t\t\tFrostlingBonus: 0,\r\n\t\t\tBloodGemAttackBonus: 0,\r\n\t\t\tBloodGemHealthBonus: 0,\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAA2C;AAEpC,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEK,MAAM,uBAAuB,GAAG,CACtC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EACnB,EAAE;IAmBT,IAAI,SAAS,CAAC,WAAW,sBAA0B,EAAE;QACpD,KAAK;aACH,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CACnB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,uBAA0D,CAC/E,CACF;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;KACJ;IACD,IAAI,SAAS,CAAC,WAAW,sBAA0B,EAAE;QACpD,KAAK;aACH,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,uBAA8C,CAAC,CAAC;aACxG,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;YACd,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;YACd,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,M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AAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC1C;IACD,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACnE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;QAC1C,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n): void => {\r\n\t// if (\r\n\t// \tboardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ||\r\n\t// \totherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds\r\n\t// ) {\r\n\t// \tconst bonus =\r\n\t// \t\t(boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0) +\r\n\t// \t\t(otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0);\r\n\t// \tboard\r\n\t// \t\t.filter(\r\n\t// \t\t\t(e) =>\r\n\t// \t\t\t\t!e.enchantments.find(\r\n\t// \t\t\t\t\t(ench) => ench.cardId === CardIds.AllWillBurn_AllWillBurnEnchantmentBattlegrounds,\r\n\t// \t\t\t\t),\r\n\t// \t\t)\r\n\t// \t\t.forEach((e) => {\r\n\t// \t\t\te.attack += bonus;\r\n\t// \t\t});\r\n\t// }\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 4;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird_BG26_805,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird_BG26_805_G,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039_G,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantment_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantment_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043_G,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t12,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewards.map((reward) => ({\r\n\t\tcardId: reward,\r\n\t\tavengeCurrent: 0,\r\n\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t}));\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\thero.hand = hero.hand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {\r\n\t\t\tEternalKnightsDeadThisGame: 0,\r\n\t\t\tUndeadAttackBonus: 0,\r\n\t\t\tFrostlingBonus: 0,\r\n\t\t\tBloodGemAttackBonus: 0,\r\n\t\t\tBloodGemHealthBonus: 0,\r\n\t\t\tGoldrinnBuff: 0,\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n"]}
|
|
@@ -144,10 +144,12 @@ const handleDeathrattleEffects = (boardWithDeadEntity, boardWithDeadEntityHero,
|
|
|
144
144
|
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, multiplier * 2, multiplier * 2, allCards, spectator);
|
|
145
145
|
break;
|
|
146
146
|
case "BGS_018":
|
|
147
|
-
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, multiplier *
|
|
147
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, multiplier * 3, multiplier * 3, allCards, spectator, 'BEAST');
|
|
148
|
+
boardWithDeadEntityHero.globalInfo.GoldrinnBuff += multiplier * 3;
|
|
148
149
|
break;
|
|
149
150
|
case "TB_BaconUps_085":
|
|
150
|
-
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, multiplier *
|
|
151
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, multiplier * 6, multiplier * 6, allCards, spectator, 'BEAST');
|
|
152
|
+
boardWithDeadEntityHero.globalInfo.GoldrinnBuff += multiplier * 3;
|
|
151
153
|
break;
|
|
152
154
|
case "BGS_030":
|
|
153
155
|
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, multiplier * 2, multiplier * 3, allCards, spectator, 'MURLOC');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deathrattle-effects.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-effects.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,6CAA6F;AAC7F,oCAiBkB;AAClB,qCAOkB;AAClB,+CAAiD;AACjD,6DAAkH;AAI3G,MAAM,4BAA4B,GAAG,CAC3C,KAAoB,EACpB,SAA0B,EAC1B,UAAuB,EACvB,WAAwB,EACf,EAAE;;IACX,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAC7B,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,iBAAsC,IAAI,MAAM,CAAC,MAAM,eAAsC,CAC3G,CAAC;IACF,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CACjC,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,sBAA2C;QACxD,MAAM,CAAC,MAAM,iBAAwC,CACtD,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,eAAoC,CAAC,CAAC,MAAM,CAAC;IACjG,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,iBAAsC,CAA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mB,EAAE,QAAQ,CAAC,CAAC;QACxD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACjC,IAAA,oBAAY,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACxD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { groupByFunction, pickMultipleRandomDifferent, pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgrantRandomAttack,\r\n\tgrantRandomDivineShield,\r\n\tgrantRandomHealth,\r\n\tgrantRandomStats,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tisFish,\r\n\tisGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport {\r\n\tbuildBoardAfterDeathrattleSpawns,\r\n\tdealDamageToEnemy,\r\n\tdealDamageToRandomEnemy,\r\n\tfindNearestEnemies,\r\n\tgetNeighbours,\r\n\tperformEntitySpawns,\r\n} from './attack';\r\nimport { triggerBattlecry } from './battlecries';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle, spawnEntitiesFromEnchantments } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const computeDeathrattleMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst rivendare = !!board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BaronRivendare_BG_FP1_031 || entity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst goldenRivendare = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BaronRivendare_TB_BaconUps_055 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst titus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354).length;\r\n\tconst goldenTitus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354_G).length;\r\n\tconst tombs =\r\n\t\tboardHero.questRewardEntities?.filter((entity) => entity.cardId === CardIds.TurbulentTombs)?.length ?? 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\tconst scourgeMultiplier = deadEntity.additionalCards?.includes(CardIds.ScourgeTroll) ? 2 : 1;\r\n\tconst multiplier =\r\n\t\tscourgeMultiplier *\r\n\t\t((goldenRivendare ? 3 : rivendare ? 2 : 1) + titus + 2 * goldenTitus + tombs + echoesOfArgus);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const handleDeathrattles = (\r\n\tboardWithKilledMinion: BoardEntity[],\r\n\tboardWithKilledMinionHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadMinionIndexFromRight2: number,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardHero: BgsPlayerEntity,\r\n\tentitiesDeadThisAttack: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n) => {\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tentitiesDeadThisAttack,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\tconst entitiesFromEnchantments: readonly BoardEntity[] = spawnEntitiesFromEnchantments(\r\n\t\tdeadEntity,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\tconst candidateEntities: readonly BoardEntity[] = [...entitiesFromNativeDeathrattle, ...entitiesFromEnchantments];\r\n\tperformEntitySpawns(\r\n\t\tcandidateEntities,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight2,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\t// In case of leapfrogger, we want to first spawn the minions, then apply the frog effect\r\n\thandleDeathrattleEffects(\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight2,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\t// eslint-disable-next-line prettier/prettier\r\n\tif (deadEntity.rememberedDeathrattles?.length) {\r\n\t\tfor (const deathrattle of deadEntity.rememberedDeathrattles) {\r\n\t\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t\t...deadEntity,\r\n\t\t\t\trememberedDeathrattles: undefined,\r\n\t\t\t\tcardId: deathrattle.cardId,\r\n\t\t\t\tenchantments: [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcardId: deathrattle.cardId,\r\n\t\t\t\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\t\t\t\trepeats: deathrattle.repeats ?? 1,\r\n\t\t\t\t\t\ttiming: deathrattle.timing,\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t};\r\n\t\t\tbuildBoardAfterDeathrattleSpawns(\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\tentityToProcess,\r\n\t\t\t\tdeadMinionIndexFromRight2,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tentitiesDeadThisAttack,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleDeathrattleEffects = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = computeDeathrattleMultiplier(\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tsharedState,\r\n\t);\r\n\t// We do it on a case by case basis so that we deal all the damage in one go for instance\r\n\t// and avoid proccing deathrattle spawns between the times the damage triggers\r\n\r\n\tconst cardIds = [deadEntity.cardId, ...(deadEntity.additionalCards ?? [])];\r\n\tfor (const deadEntityCardId of cardIds) {\r\n\t\tswitch (deadEntityCardId) {\r\n\t\t\tcase CardIds.RylakMetalhead_BG26_801:\r\n\t\t\tcase CardIds.RylakMetalhead_BG26_801_G:\r\n\t\t\t\tconst rylakMutltiplier = deadEntityCardId === CardIds.RylakMetalhead_BG26_801_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst neighbours = getNeighbours(boardWithDeadEntity, null, deadEntityIndexFromRight);\r\n\t\t\t\t\tfor (const neighbour of neighbours) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, neighbour, boardWithDeadEntity);\r\n\t\t\t\t\t\tfor (let j = 0; j < rylakMutltiplier; j++) {\r\n\t\t\t\t\t\t\ttriggerBattlecry(\r\n\t\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\t\tneighbour,\r\n\t\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SelflessHero_BG_OG_221:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SelflessHero_TB_BaconUps_014:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OperaticBelcher_BG26_888:\r\n\t\t\tcase CardIds.OperaticBelcher_BG26_888_G:\r\n\t\t\t\tconst belcherMultiplier = deadEntityCardId === CardIds.OperaticBelcher_BG26_888_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < belcherMultiplier; j++) {\r\n\t\t\t\t\t\tconst possibleBelcherTargets = boardWithDeadEntity\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.venomous)\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.poisonous)\r\n\t\t\t\t\t\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead)\r\n\t\t\t\t\t\t\t.filter((entity) => hasCorrectTribe(entity, Race.MURLOC, allCards));\r\n\t\t\t\t\t\tif (possibleBelcherTargets.length > 0) {\r\n\t\t\t\t\t\t\tconst chosen = pickRandom(possibleBelcherTargets);\r\n\t\t\t\t\t\t\tchosen.venomous = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, chosen, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpiritOfAir_TB_BaconShop_HERO_76_Buddy:\r\n\t\t\tcase CardIds.SpiritOfAir_TB_BaconShop_HERO_76_Buddy_G:\r\n\t\t\t\tconst iterations = deadEntityCardId === CardIds.SpiritOfAir_TB_BaconShop_HERO_76_Buddy_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < iterations; j++) {\r\n\t\t\t\t\t\tlet validTargets = boardWithDeadEntity.filter((entity) => !entity.divineShield);\r\n\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.taunt);\r\n\t\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.windfury);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconst target = pickRandom(validTargets);\r\n\t\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\t\tif (!target.divineShield) {\r\n\t\t\t\t\t\t\t\tupdateDivineShield(target, boardWithDeadEntity, true, allCards);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttarget.taunt = true;\r\n\t\t\t\t\t\t\ttarget.windfury = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NadinaTheRed_BGS_040:\r\n\t\t\tcase CardIds.NadinaTheRed_TB_BaconUps_154:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst nadinaMultiplier = deadEntityCardId === CardIds.NadinaTheRed_TB_BaconUps_154 ? 6 : 3;\r\n\t\t\t\t\tfor (let j = 0; j < nadinaMultiplier; j++) {\r\n\t\t\t\t\t\tconst validTargets = boardWithDeadEntity\r\n\t\t\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.divineShield);\r\n\t\t\t\t\t\tconst target = pickRandom(validTargets);\r\n\t\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\t\tupdateDivineShield(target, boardWithDeadEntity, true, allCards);\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzoth_BG_OG_256:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 1, multiplier * 1, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzoth_TB_BaconUps_025:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 2, multiplier * 2, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolf_BGS_018:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 5,\r\n\t\t\t\t\tmultiplier * 5,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolf_TB_BaconUps_085:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 10,\r\n\t\t\t\t\tmultiplier * 10,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 2,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 4,\r\n\t\t\t\t\tmultiplier * 6,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServant_YOD_026:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServant_TB_BaconUps_112:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTrickster_BG21_006:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTrickster_BG21_006_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Leapfrogger_BG21_000:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, false, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Leapfrogger_BG21_000_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, true, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ScarletSkull_BG25_022:\r\n\t\t\tcase CardIds.ScarletSkull_BG25_022_G:\r\n\t\t\t\tconst scarletMultiplier = deadEntityCardId === CardIds.ScarletSkull_BG25_022_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tscarletMultiplier * 1,\r\n\t\t\t\t\t\tscarletMultiplier * 2,\r\n\t\t\t\t\t\tRace.UNDEAD,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnubarakNerubianKing_BG25_007:\r\n\t\t\tcase CardIds.AnubarakNerubianKing_BG25_007_G:\r\n\t\t\t\tconst anubarakMultiplier = deadEntityCardId === CardIds.AnubarakNerubianKing_BG25_007_G ? 2 : 1;\r\n\t\t\t\tconst attackBonus = anubarakMultiplier * 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tboardWithDeadEntityHero.globalInfo.UndeadAttackBonus += attackBonus;\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tattackBonus,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\tRace[Race.UNDEAD],\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\t// \t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t// \t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t// \tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t// \t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t// \t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t// \t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t// \t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t// \t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t// \t\t\tdealDamageToRandomEnemy(\r\n\t\t\t// \t\t\t\totherBoard,\r\n\t\t\t// \t\t\t\totherBoardHero,\r\n\t\t\t// \t\t\t\tdeadEntity,\r\n\t\t\t// \t\t\t\t3,\r\n\t\t\t// \t\t\t\tboardWithDeadEntity,\r\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t// \t\t\t\tallCards,\r\n\t\t\t// \t\t\t\tcardsData,\r\n\t\t\t// \t\t\t\tsharedState,\r\n\t\t\t// \t\t\t\tspectator,\r\n\t\t\t// \t\t\t);\r\n\t\t\t// \t\t}\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.ElementiumSquirrelBomb_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\tcase CardIds.ElementiumSquirrelBomb_TB_BaconShop_HERO_17_Buddy_G:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst squirrelDamage =\r\n\t\t\t\t\tdeadEntity.cardId === CardIds.ElementiumSquirrelBomb_TB_BaconShop_HERO_17_Buddy_G ? 4 : 2;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t\t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t\t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t\t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tsquirrelDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KaboomBot_BG_BOT_606:\r\n\t\t\tcase CardIds.KaboomBot_TB_BaconUps_028:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst kaboomLoops = deadEntity.cardId === CardIds.KaboomBot_TB_BaconUps_028 ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < kaboomLoops; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t4,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DrBoombox_BG25_165:\r\n\t\t\tcase CardIds.DrBoombox_BG25_165_G:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst boomboxDamage = deadEntity.cardId === CardIds.DrBoombox_BG25_165_G ? 14 : 7;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\t// The nearest enemies use the full board info\r\n\t\t\t\t\t// const boardIncludingDeadEntityAtCorrectIndex = boardWithDeadEntity.splice(\r\n\t\t\t\t\t// \tdeadEntityIndexFromRight,\r\n\t\t\t\t\t// \t0,\r\n\t\t\t\t\t// \tdeadEntity,\r\n\t\t\t\t\t// );\r\n\t\t\t\t\tconst targets = findNearestEnemies(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\tdeadEntityIndexFromRight,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t2,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t);\r\n\t\t\t\t\ttargets.forEach((target) => {\r\n\t\t\t\t\t\t// console.debug('dealing damage to', stringifySimpleCard(target));\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboomboxDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UnstableGhoul_BG_FP1_024:\r\n\t\t\tcase CardIds.UnstableGhoul_TB_BaconUps_118:\r\n\t\t\t\tconst damage = deadEntityCardId === CardIds.UnstableGhoul_TB_BaconUps_118 ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdamage,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TunnelBlaster_BG_DAL_775:\r\n\t\t\tcase CardIds.TunnelBlaster_BG_DAL_775_G:\r\n\t\t\t\tconst loops = deadEntityCardId === CardIds.TunnelBlaster_BG_DAL_775_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < loops; j++) {\r\n\t\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t3,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LeeroyTheReckless_BG23_318:\r\n\t\t\tcase CardIds.LeeroyTheReckless_BG23_318_G:\r\n\t\t\t\tif (deadEntity.lastAffectedByEntity) {\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity.definitelyDead = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RadioStar_BG25_399:\r\n\t\t\tcase CardIds.RadioStar_BG25_399_G:\r\n\t\t\t\tconst radioQuantity = deadEntityCardId === CardIds.RadioStar_BG25_399_G ? 2 : 1;\r\n\t\t\t\tconst radioEntities = Array(radioQuantity).fill(deadEntity.lastAffectedByEntity);\r\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, radioEntities);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiver_TB_BaconShop_HERO_41_Buddy:\r\n\t\t\t\tfor (let i = 0; i < Math.min(1, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\t\trightMostMinion,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiver_TB_BaconShop_HERO_41_Buddy_G:\r\n\t\t\t\tfor (let i = 0; i < Math.min(2, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\t\trightMostMinion,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Scourfin_BG26_360:\r\n\t\t\tcase CardIds.Scourfin_BG26_360_G:\r\n\t\t\t\tconst statsScourfin = deadEntityCardId === CardIds.Scourfin_BG26_360_G ? 10 : 5;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero.hand,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = deadEntityCardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\tboardWithDeadEntityHero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\tboardWithDeadEntityHero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.Banshee_BG_RLK_957:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 2, 1, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LostSpirit_BG26_GIL_513:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 1, 0, allCards, spectator, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TickingAbomination_BG_ICC_099:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (const entity of boardWithDeadEntity) {\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t5,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.WitheredSpearhide_BG27_006:\r\n\t\t\tcase CardIds.WitheredSpearhide_BG27_006_G:\r\n\t\t\t\tconst witheredSpearhideCardsToAdd = Array(CardIds.WitheredSpearhide_BG27_006_G ? 2 : 1).fill(\r\n\t\t\t\t\tCardIds.BloodGem,\r\n\t\t\t\t);\r\n\t\t\t\taddCardsInHand(\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\twitheredSpearhideCardsToAdd,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RecurringNightmare_BG26_055:\r\n\t\t\tcase CardIds.RecurringNightmare_BG26_055_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyRecurringNightmareDeathrattleEffect(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdeadEntityCardId === CardIds.RecurringNightmare_BG26_055_G,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MotleyPhalanx_BG27_080:\r\n\t\t\tcase CardIds.MotleyPhalanx_BG27_080_G:\r\n\t\t\t\tconst motleyBuff = deadEntity.cardId === CardIds.MotleyPhalanx_BG27_080_G ? 14 : 7;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmotleyBuff,\r\n\t\t\t\t\tmotleyBuff,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t// It's important to first copy the enchantments, otherwise you could end up\r\n\t// in an infinite loop - since new enchants are added after each step\r\n\r\n\tlet enchantments: { cardId: string; originEntityId?: number; repeats?: number }[] = [\r\n\t\t...(deadEntity.enchantments ?? []),\r\n\t\t...(deadEntity.rememberedDeathrattles ?? []),\r\n\t].sort((a, b) => a.timing - b.timing);\r\n\t// In some cases it's possible that there are way too many enchantments because of the frog\r\n\t// In that case, we make a trade-off and don't trigger the \"on stats change\" trigger as\r\n\t// often as we should, so that we can have the stats themselves correct\r\n\t// We don't want to lump everything together, as it skews the stats when there are a lot of buffs\r\n\t// Instead, we build groups\r\n\tconst maxNumberOfGroups = 12;\r\n\tconst enchantmentGroups = groupByFunction((enchantment: any) => enchantment.cardId)(enchantments);\r\n\tenchantments = Object.keys(enchantmentGroups).flatMap((cardId) => {\r\n\t\tlet repeatsToApply = enchantmentGroups[cardId].map((e) => e.repeats || 1).reduce((a, b) => a + b, 0);\r\n\r\n\t\t// Frogs include the multiplers here directly\r\n\t\tif (\r\n\t\t\t[\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t].includes(cardId as CardIds)\r\n\t\t) {\r\n\t\t\trepeatsToApply = repeatsToApply * multiplier;\r\n\t\t}\r\n\r\n\t\tconst results = [];\r\n\t\tconst repeatsPerBuff = Math.max(1, Math.floor(repeatsToApply / maxNumberOfGroups));\r\n\t\tlet repeatsDone = 0;\r\n\t\twhile (repeatsDone < repeatsToApply) {\r\n\t\t\tconst repeats = Math.min(repeatsPerBuff, repeatsToApply - repeatsDone);\r\n\t\t\tresults.push({\r\n\t\t\t\tcardId: cardId,\r\n\t\t\t\trepeats: repeats,\r\n\t\t\t\ttiming: Math.min(...enchantmentGroups[cardId].map((e) => e.timing)),\r\n\t\t\t});\r\n\t\t\trepeatsDone += repeatsPerBuff;\r\n\t\t}\r\n\t\treturn results;\r\n\t});\r\n\tfor (const enchantment of enchantments) {\r\n\t\tswitch (enchantment.cardId) {\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e:\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge:\r\n\t\t\t\tapplyLeapFroggerEffect(\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tenchantment.cardId === CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tenchantment.repeats || 1,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EarthRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyEarthInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FireRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyFireInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.WaterRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyWaterInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LightningRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLightningInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t// const playerCopy = boardWithDeadEntity.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// const oppCopy = otherBoard.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// console.log('player board', boardWithDeadEntity.length, playerCopy.length, playerCopy.map((e) => JSON.stringify(e)).join('\\n'));\r\n\t// console.log('opp board', JSON.stringify(oppCopy));\r\n};\r\n\r\nexport const applyLightningInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Because the golden version doubles all the remembered effects\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst targets = pickMultipleRandomDifferent(otherBoard, 5);\r\n\t\tfor (const target of targets) {\r\n\t\t\tdealDamageToEnemy(\r\n\t\t\t\ttarget,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\t1,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyWaterInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[boardWithDeadEntity.length - 1];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyHealth(target, 3, boardWithDeadEntity, allCards);\r\n\t\t\ttarget.taunt = true;\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyFireInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[0];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyAttack(target, target.attack, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyEarthInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst minionsGrantedDeathrattle: BoardEntity[] = pickMultipleRandomDifferent(boardWithDeadEntity, 4);\r\n\t\tminionsGrantedDeathrattle.forEach((minion) => {\r\n\t\t\tminion.enchantments.push({\r\n\t\t\t\tcardId: CardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\toriginEntityId: deadEntity?.entityId,\r\n\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, minion, boardWithDeadEntity);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nconst applyLeapFroggerEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst buffed = grantRandomStats(\r\n\t\tdeadEntity,\r\n\t\tboardWithDeadEntity,\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tRace.BEAST,\r\n\t\tfalse,\r\n\t\tallCards,\r\n\t\tspectator,\r\n\t);\r\n\tif (buffed) {\r\n\t\tbuffed.enchantments = buffed.enchantments ?? [];\r\n\t\tbuffed.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge\r\n\t\t\t\t: CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t});\r\n\t\t// Don't register power effect here, since it's already done in the random stats\r\n\t\t// spectator.registerPowerTarget(deadEntity, buffed, boardWithDeadEntity);\r\n\t\t// console.log('applyLeapFroggerEffect', stringifySimpleCard(deadEntity), stringifySimpleCard(buffed));\r\n\t}\r\n};\r\n\r\nconst applyRecurringNightmareDeathrattleEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst target = pickRandom(\r\n\t\tboardWithDeadEntity\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055 &&\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055_G,\r\n\t\t\t),\r\n\t);\r\n\tif (target) {\r\n\t\ttarget.enchantments = target.enchantments ?? [];\r\n\t\ttarget.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge\r\n\t\t\t\t: CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t});\r\n\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t}\r\n};\r\n\r\nexport const applyMinionDeathEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.log('applying minion death effect', stringifySimpleCard(deadEntity, allCards));\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.BEAST)) {\r\n\t\tapplyScavengingHyenaEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.DEMON)) {\r\n\t\tapplySoulJugglerEffect(\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.MECH)) {\r\n\t\tapplyJunkbotEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, Race.MURLOC, allCards)) {\r\n\t\tremoveOldMurkEyeAttack(boardWithDeadEntity, allCards);\r\n\t\tremoveOldMurkEyeAttack(otherBoard, allCards);\r\n\t}\r\n\tif (deadEntity.taunt) {\r\n\t\tapplyBristlemaneScrapsmithEffect(boardWithDeadEntity, boardWithDeadEntityHero, allCards, spectator);\r\n\t\tapplyQirajiHarbringerEffect(boardWithDeadEntity, deadEntityIndexFromRight, allCards, spectator);\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008_G\r\n\t) {\r\n\t\tapplyEternalKnightEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\r\n\t// Putricide-only\r\n\tboardWithDeadEntity\r\n\t\t.filter((e) => e.additionalCards?.includes(CardIds.FlesheatingGhoulLegacy_BG26_tt_004))\r\n\t\t.forEach((e) => {\r\n\t\t\tmodifyAttack(e, 1, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(e, boardWithDeadEntity, allCards);\r\n\t\t});\r\n\r\n\tapplyRotHideGnollEffect(boardWithDeadEntity, allCards, spectator);\r\n\r\n\t// Overkill\r\n\tif (deadEntity.health < 0 && deadEntity.lastAffectedByEntity?.attacking) {\r\n\t\tif (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_BGS_032) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t3,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_TB_BaconUps_103) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t6,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental && deadEntity.lastAffectedByEntity.attacking) {\r\n\t\t// \t// } else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental) {\r\n\t\t// \t// console.log('applying WildfireElemental effect', stringifySimple(boardWithDeadEntity, allCards));\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \t// Prevent propagation of the effect\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\t// \tif (neighbours.length > 0) {\r\n\t\t// \t\tconst randomTarget = neighbours[Math.floor(Math.random() * neighbours.length)];\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\trandomTarget,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t);\r\n\t\t// \t}\r\n\t\t// } else if (\r\n\t\t// \tdeadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElementalBattlegrounds &&\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking\r\n\t\t// ) {\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \tneighbours.forEach((neighbour) =>\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\tneighbour,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t),\r\n\t\t// \t);\r\n\t\t// }\r\n\t\telse if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TRL_232) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TRL_232t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TB_BaconUps_051) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TB_BaconUps_051t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_BGS_080) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_TB_BaconUps_142) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const dealDamageToAllMinions = (\r\n\tboard1: BoardEntity[],\r\n\tboard1Hero: BgsPlayerEntity,\r\n\tboard2: BoardEntity[],\r\n\tboard2Hero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity,\r\n\tdamageDealt: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (board1.length === 0 && board2.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\tfor (let i = 0; i < board1.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard1[i],\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tfor (let i = 0; i < board2.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard2[i],\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst applySoulJugglerEffect = (\r\n\tboardWithJugglers: BoardEntity[],\r\n\tboardWithJugglersHero: BgsPlayerEntity,\r\n\tboardToAttack: BoardEntity[],\r\n\tboardToAttackHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (boardWithJugglers.length === 0 && boardToAttack.length === 0) {\r\n\t\treturn;\r\n\t\t// return [boardWithJugglers, boardToAttack];\r\n\t}\r\n\tconst jugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_BGS_002);\r\n\tfor (const juggler of jugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tconst goldenJugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_TB_BaconUps_075);\r\n\tfor (const juggler of goldenJugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\t// processMinionDeath(\r\n\t// \tboardWithJugglers,\r\n\t// \tboardWithJugglersHero,\r\n\t// \tboardToAttack,\r\n\t// \tboardToAttackHero,\r\n\t// \tallCards,\r\n\t// \tcardsData,\r\n\t// \tsharedState,\r\n\t// \tspectator,\r\n\t// );\r\n};\r\n\r\nconst applyScavengingHyenaEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\t// const copy = [...board];\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.ScavengingHyenaLegacy_BG_EX1_531) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.ScavengingHyenaLegacy_TB_BaconUps_043) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyEternalKnightEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008_G\r\n\t\t) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tmodifyHealth(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyRotHideGnollEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.RotHideGnoll_BG25_013 || board[i].cardId === CardIds.RotHideGnoll_BG25_013_G) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyBristlemaneScrapsmithEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardPlayerEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707 ||\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707_G\r\n\t\t) {\r\n\t\t\tconst cardsToAdd = Array(CardIds.BristlemaneScrapsmith_BG24_707_G ? 2 : 1).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardPlayerEntity, board, allCards, spectator, cardsToAdd);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyJunkbotEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.Junkbot_GVG_106) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.Junkbot_TB_BaconUps_046) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 4, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyQirajiHarbringerEffect = (\r\n\tboard: BoardEntity[],\r\n\tdeadEntityIndexFromRight: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst qiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_BGS_112);\r\n\tconst goldenQiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_TB_BaconUps_303);\r\n\tconst neighbours = getNeighbours(board, null, deadEntityIndexFromRight);\r\n\r\n\t// TODO: if reactivated, properly apply buffs one by one, instead of all together\r\n\tneighbours.forEach((entity) => {\r\n\t\tmodifyAttack(entity, 2 * qiraji.length + 4 * goldenQiraji.length, board, allCards);\r\n\t\tmodifyHealth(entity, 2 * qiraji.length + 4 * goldenQiraji.length, board, allCards);\r\n\t\tafterStatsUpdate(entity, board, allCards);\r\n\t});\r\n};\r\n\r\nexport const applyMonstrosity = (\r\n\tmonstrosity: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tboardWithDeadEntities: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tfor (const deadEntity of deadEntities) {\r\n\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\tif (monstrosity.cardId === CardIds.Monstrosity_BG20_HERO_282_Buddy_G) {\r\n\t\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const rememberDeathrattles = (\r\n\tfish: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tconst validDeathrattles = deadEntities\r\n\t\t.filter((entity) => cardsData.validDeathrattles.includes(entity.cardId) || isFish(entity))\r\n\t\t.map((entity) => ({ cardId: entity.cardId, repeats: 1, timing: sharedState.currentEntityId++ }));\r\n\tconst validEnchantments = deadEntities\r\n\t\t.filter((entity) => entity.enchantments?.length)\r\n\t\t.map((entity) => entity.enchantments)\r\n\t\t.reduce((a, b) => a.concat(b), [])\r\n\t\t.flatMap((enchantment) => ({\r\n\t\t\tcardId: enchantment.cardId,\r\n\t\t\trepeats: enchantment.repeats ?? 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t}))\r\n\t\t.filter((enchantment) =>\r\n\t\t\t[\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\t\t\t\tCardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\tCardIds.FireInvocation_ElementFireEnchantment,\r\n\t\t\t\tCardIds.WaterInvocation_ElementWaterEnchantment,\r\n\t\t\t\tCardIds.LightningInvocation,\r\n\t\t\t\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\t\t\t\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\t\t\t].includes(enchantment.cardId as CardIds),\r\n\t\t);\r\n\t// Multiple fish\r\n\tconst deadEntityRememberedDeathrattles =\r\n\t\tdeadEntities.filter((e) => !!e.rememberedDeathrattles?.length).flatMap((e) => e.rememberedDeathrattles) ?? [];\r\n\tconst newDeathrattles = [...validDeathrattles, ...validEnchantments, ...deadEntityRememberedDeathrattles];\r\n\t// Order is important - the DR are triggered in the ordered the minions have died\r\n\t// console.log(\r\n\t// \t'remembering deathrattle',\r\n\t// \t'\\n',\r\n\t// \tstringifySimpleCard(fish, allCards),\r\n\t// \t'\\n',\r\n\t// \tstringifySimple(deadEntities, allCards),\r\n\t// \t'\\n',\r\n\t// \tfish.rememberedDeathrattles,\r\n\t// );\r\n\tif (isGolden(fish.cardId, allCards)) {\r\n\t\t// https://stackoverflow.com/questions/33305152/how-to-duplicate-elements-in-a-js-array\r\n\t\tconst doubleDr = newDeathrattles.reduce((res, current) => res.concat([current, current]), []);\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...doubleDr];\r\n\t} else {\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...newDeathrattles];\r\n\t}\r\n\t// console.log('remembering deathrattle after', '\\n', fish.rememberedDeathrattles);\r\n};\r\n\r\nconst removeOldMurkEyeAttack = (boardWithDeadEntity: BoardEntity[], allCards: AllCardsService) => {\r\n\tconst murkeyes = boardWithDeadEntity.filter(\r\n\t\t(entity) => entity.cardId === CardIds.OldMurkEyeLegacy || entity.cardId === CardIds.OldMurkEyeVanilla,\r\n\t);\r\n\tconst goldenMurkeyes = boardWithDeadEntity.filter((entity) => entity.cardId === CardIds.OldMurkEye);\r\n\tmurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -1, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n\tgoldenMurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -2, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"deathrattle-effects.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-effects.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,6CAA6F;AAC7F,oCAiBkB;AAClB,qCAOkB;AAClB,+CAAiD;AACjD,6DAAkH;AAI3G,MAAM,4BAA4B,GAAG,CAC3C,KAAoB,EACpB,SAA0B,EAC1B,UAAuB,EACvB,WAAwB,EACf,EAAE;;IACX,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAC7B,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,iBAAsC,IAAI,MAAM,CAAC,MAAM,eAAsC,CAC3G,CAAC;IACF,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CACjC,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,sBAA2C;QACxD,MAAM,CAAC,MAAM,iBAAwC,CACtD,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,eAAoC,CAAC,CAAC,MAAM,CAAC;IACjG,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC,MAAM,CAAC;IACzG,MAAM,KAAK,GACV,MAAA,MAAA,MAAA,SAAS,CAAC,mBAAmB,0CAAE,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,sBAA2B,CAAC,0CAAE,MAAM,mCAAI,CAAC,CAAC;IAC1G,MAAM,aAAa,GAAG,WAAW,CAAC,SAAS,CAAC,QAAQ,oBAAwC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,MAAM,iBAA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AAY,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACxD,IAAA,wBAAgB,EAAC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { groupByFunction, pickMultipleRandomDifferent, pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgrantRandomAttack,\r\n\tgrantRandomDivineShield,\r\n\tgrantRandomHealth,\r\n\tgrantRandomStats,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tisFish,\r\n\tisGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport {\r\n\tbuildBoardAfterDeathrattleSpawns,\r\n\tdealDamageToEnemy,\r\n\tdealDamageToRandomEnemy,\r\n\tfindNearestEnemies,\r\n\tgetNeighbours,\r\n\tperformEntitySpawns,\r\n} from './attack';\r\nimport { triggerBattlecry } from './battlecries';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle, spawnEntitiesFromEnchantments } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const computeDeathrattleMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst rivendare = !!board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BaronRivendare_BG_FP1_031 || entity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst goldenRivendare = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BaronRivendare_TB_BaconUps_055 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst titus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354).length;\r\n\tconst goldenTitus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354_G).length;\r\n\tconst tombs =\r\n\t\tboardHero.questRewardEntities?.filter((entity) => entity.cardId === CardIds.TurbulentTombs)?.length ?? 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\tconst scourgeMultiplier = deadEntity.additionalCards?.includes(CardIds.ScourgeTroll) ? 2 : 1;\r\n\tconst multiplier =\r\n\t\tscourgeMultiplier *\r\n\t\t((goldenRivendare ? 3 : rivendare ? 2 : 1) + titus + 2 * goldenTitus + tombs + echoesOfArgus);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const handleDeathrattles = (\r\n\tboardWithKilledMinion: BoardEntity[],\r\n\tboardWithKilledMinionHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadMinionIndexFromRight2: number,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardHero: BgsPlayerEntity,\r\n\tentitiesDeadThisAttack: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n) => {\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tentitiesDeadThisAttack,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\tconst entitiesFromEnchantments: readonly BoardEntity[] = spawnEntitiesFromEnchantments(\r\n\t\tdeadEntity,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\tconst candidateEntities: readonly BoardEntity[] = [...entitiesFromNativeDeathrattle, ...entitiesFromEnchantments];\r\n\tperformEntitySpawns(\r\n\t\tcandidateEntities,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight2,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\t// In case of leapfrogger, we want to first spawn the minions, then apply the frog effect\r\n\thandleDeathrattleEffects(\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight2,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\r\n\t// eslint-disable-next-line prettier/prettier\r\n\tif (deadEntity.rememberedDeathrattles?.length) {\r\n\t\tfor (const deathrattle of deadEntity.rememberedDeathrattles) {\r\n\t\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t\t...deadEntity,\r\n\t\t\t\trememberedDeathrattles: undefined,\r\n\t\t\t\tcardId: deathrattle.cardId,\r\n\t\t\t\tenchantments: [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcardId: deathrattle.cardId,\r\n\t\t\t\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\t\t\t\trepeats: deathrattle.repeats ?? 1,\r\n\t\t\t\t\t\ttiming: deathrattle.timing,\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t};\r\n\t\t\tbuildBoardAfterDeathrattleSpawns(\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\tentityToProcess,\r\n\t\t\t\tdeadMinionIndexFromRight2,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tentitiesDeadThisAttack,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleDeathrattleEffects = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = computeDeathrattleMultiplier(\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tsharedState,\r\n\t);\r\n\t// We do it on a case by case basis so that we deal all the damage in one go for instance\r\n\t// and avoid proccing deathrattle spawns between the times the damage triggers\r\n\r\n\tconst cardIds = [deadEntity.cardId, ...(deadEntity.additionalCards ?? [])];\r\n\tfor (const deadEntityCardId of cardIds) {\r\n\t\tswitch (deadEntityCardId) {\r\n\t\t\tcase CardIds.RylakMetalhead_BG26_801:\r\n\t\t\tcase CardIds.RylakMetalhead_BG26_801_G:\r\n\t\t\t\tconst rylakMutltiplier = deadEntityCardId === CardIds.RylakMetalhead_BG26_801_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst neighbours = getNeighbours(boardWithDeadEntity, null, deadEntityIndexFromRight);\r\n\t\t\t\t\tfor (const neighbour of neighbours) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, neighbour, boardWithDeadEntity);\r\n\t\t\t\t\t\tfor (let j = 0; j < rylakMutltiplier; j++) {\r\n\t\t\t\t\t\t\ttriggerBattlecry(\r\n\t\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\t\tneighbour,\r\n\t\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SelflessHero_BG_OG_221:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SelflessHero_TB_BaconUps_014:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t\tgrantRandomDivineShield(deadEntity, boardWithDeadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OperaticBelcher_BG26_888:\r\n\t\t\tcase CardIds.OperaticBelcher_BG26_888_G:\r\n\t\t\t\tconst belcherMultiplier = deadEntityCardId === CardIds.OperaticBelcher_BG26_888_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < belcherMultiplier; j++) {\r\n\t\t\t\t\t\tconst possibleBelcherTargets = boardWithDeadEntity\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.venomous)\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.poisonous)\r\n\t\t\t\t\t\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead)\r\n\t\t\t\t\t\t\t.filter((entity) => hasCorrectTribe(entity, Race.MURLOC, allCards));\r\n\t\t\t\t\t\tif (possibleBelcherTargets.length > 0) {\r\n\t\t\t\t\t\t\tconst chosen = pickRandom(possibleBelcherTargets);\r\n\t\t\t\t\t\t\tchosen.venomous = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, chosen, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpiritOfAir_TB_BaconShop_HERO_76_Buddy:\r\n\t\t\tcase CardIds.SpiritOfAir_TB_BaconShop_HERO_76_Buddy_G:\r\n\t\t\t\tconst iterations = deadEntityCardId === CardIds.SpiritOfAir_TB_BaconShop_HERO_76_Buddy_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < iterations; j++) {\r\n\t\t\t\t\t\tlet validTargets = boardWithDeadEntity.filter((entity) => !entity.divineShield);\r\n\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.taunt);\r\n\t\t\t\t\t\t\tif (!validTargets?.length) {\r\n\t\t\t\t\t\t\t\tvalidTargets = boardWithDeadEntity.filter((entity) => !entity.windfury);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconst target = pickRandom(validTargets);\r\n\t\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\t\tif (!target.divineShield) {\r\n\t\t\t\t\t\t\t\tupdateDivineShield(target, boardWithDeadEntity, true, allCards);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttarget.taunt = true;\r\n\t\t\t\t\t\t\ttarget.windfury = true;\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NadinaTheRed_BGS_040:\r\n\t\t\tcase CardIds.NadinaTheRed_TB_BaconUps_154:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst nadinaMultiplier = deadEntityCardId === CardIds.NadinaTheRed_TB_BaconUps_154 ? 6 : 3;\r\n\t\t\t\t\tfor (let j = 0; j < nadinaMultiplier; j++) {\r\n\t\t\t\t\t\tconst validTargets = boardWithDeadEntity\r\n\t\t\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t\t\t\t\t.filter((entity) => !entity.divineShield);\r\n\t\t\t\t\t\tconst target = pickRandom(validTargets);\r\n\t\t\t\t\t\tif (target) {\r\n\t\t\t\t\t\t\tupdateDivineShield(target, boardWithDeadEntity, true, allCards);\r\n\t\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzoth_BG_OG_256:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 1, multiplier * 1, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SpawnOfNzoth_TB_BaconUps_025:\r\n\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, multiplier * 2, multiplier * 2, allCards, spectator);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolf_BGS_018:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tboardWithDeadEntityHero.globalInfo.GoldrinnBuff += multiplier * 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GoldrinnTheGreatWolf_TB_BaconUps_085:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 6,\r\n\t\t\t\t\tmultiplier * 6,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'BEAST',\r\n\t\t\t\t);\r\n\t\t\t\tboardWithDeadEntityHero.globalInfo.GoldrinnBuff += multiplier * 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 2,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmultiplier * 4,\r\n\t\t\t\t\tmultiplier * 6,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t'MURLOC',\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServant_YOD_026:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FiendishServant_TB_BaconUps_112:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t\tgrantRandomAttack(deadEntity, boardWithDeadEntity, deadEntity.attack, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTrickster_BG21_006:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ImpulsiveTrickster_BG21_006_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t\tgrantRandomHealth(deadEntity, boardWithDeadEntity, deadEntity.maxHealth, allCards, spectator, true);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Leapfrogger_BG21_000:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, false, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Leapfrogger_BG21_000_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLeapFroggerEffect(boardWithDeadEntity, deadEntity, true, allCards, spectator, sharedState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\t6,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\t12,\r\n\t\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ScarletSkull_BG25_022:\r\n\t\t\tcase CardIds.ScarletSkull_BG25_022_G:\r\n\t\t\t\tconst scarletMultiplier = deadEntityCardId === CardIds.ScarletSkull_BG25_022_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst target = grantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tscarletMultiplier * 1,\r\n\t\t\t\t\t\tscarletMultiplier * 2,\r\n\t\t\t\t\t\tRace.UNDEAD,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnubarakNerubianKing_BG25_007:\r\n\t\t\tcase CardIds.AnubarakNerubianKing_BG25_007_G:\r\n\t\t\t\tconst anubarakMultiplier = deadEntityCardId === CardIds.AnubarakNerubianKing_BG25_007_G ? 2 : 1;\r\n\t\t\t\tconst attackBonus = anubarakMultiplier * 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tboardWithDeadEntityHero.globalInfo.UndeadAttackBonus += attackBonus;\r\n\t\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tattackBonus,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\tRace[Race.UNDEAD],\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ElementiumSquirrelBombBattlegrounds_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\t// \t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t// \t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t// \tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t// \t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t// \t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t// \t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t// \t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t// \t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t// \t\t\tdealDamageToRandomEnemy(\r\n\t\t\t// \t\t\t\totherBoard,\r\n\t\t\t// \t\t\t\totherBoardHero,\r\n\t\t\t// \t\t\t\tdeadEntity,\r\n\t\t\t// \t\t\t\t3,\r\n\t\t\t// \t\t\t\tboardWithDeadEntity,\r\n\t\t\t// \t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t// \t\t\t\tallCards,\r\n\t\t\t// \t\t\t\tcardsData,\r\n\t\t\t// \t\t\t\tsharedState,\r\n\t\t\t// \t\t\t\tspectator,\r\n\t\t\t// \t\t\t);\r\n\t\t\t// \t\t}\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.ElementiumSquirrelBomb_TB_BaconShop_HERO_17_Buddy:\r\n\t\t\tcase CardIds.ElementiumSquirrelBomb_TB_BaconShop_HERO_17_Buddy_G:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst squirrelDamage =\r\n\t\t\t\t\tdeadEntity.cardId === CardIds.ElementiumSquirrelBomb_TB_BaconShop_HERO_17_Buddy_G ? 4 : 2;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tconst numberOfDeadMechsThisCombat = sharedState.deaths\r\n\t\t\t\t\t\t.filter((entity) => entity.friendly === deadEntity.friendly)\r\n\t\t\t\t\t\t// eslint-disable-next-line prettier/prettier\r\n\t\t\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId)?.races, Race.MECH)).length;\r\n\t\t\t\t\tfor (let j = 0; j < numberOfDeadMechsThisCombat + 1; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tsquirrelDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KaboomBot_BG_BOT_606:\r\n\t\t\tcase CardIds.KaboomBot_TB_BaconUps_028:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst kaboomLoops = deadEntity.cardId === CardIds.KaboomBot_TB_BaconUps_028 ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < kaboomLoops; j++) {\r\n\t\t\t\t\t\tdealDamageToRandomEnemy(\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t4,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DrBoombox_BG25_165:\r\n\t\t\tcase CardIds.DrBoombox_BG25_165_G:\r\n\t\t\t\t// FIXME: I don't think this way of doing things is really accurate (as some deathrattles\r\n\t\t\t\t// could be spawned between the shots firing), but let's say it's good enough for now\r\n\t\t\t\tconst boomboxDamage = deadEntity.cardId === CardIds.DrBoombox_BG25_165_G ? 14 : 7;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\t// The nearest enemies use the full board info\r\n\t\t\t\t\t// const boardIncludingDeadEntityAtCorrectIndex = boardWithDeadEntity.splice(\r\n\t\t\t\t\t// \tdeadEntityIndexFromRight,\r\n\t\t\t\t\t// \t0,\r\n\t\t\t\t\t// \tdeadEntity,\r\n\t\t\t\t\t// );\r\n\t\t\t\t\tconst targets = findNearestEnemies(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\tdeadEntityIndexFromRight,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t2,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t);\r\n\t\t\t\t\ttargets.forEach((target) => {\r\n\t\t\t\t\t\t// console.debug('dealing damage to', stringifySimpleCard(target));\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboomboxDamage,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UnstableGhoul_BG_FP1_024:\r\n\t\t\tcase CardIds.UnstableGhoul_TB_BaconUps_118:\r\n\t\t\t\tconst damage = deadEntityCardId === CardIds.UnstableGhoul_TB_BaconUps_118 ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdamage,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TunnelBlaster_BG_DAL_775:\r\n\t\t\tcase CardIds.TunnelBlaster_BG_DAL_775_G:\r\n\t\t\t\tconst loops = deadEntityCardId === CardIds.TunnelBlaster_BG_DAL_775_G ? 2 : 1;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (let j = 0; j < loops; j++) {\r\n\t\t\t\t\t\tdealDamageToAllMinions(\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t3,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LeeroyTheReckless_BG23_318:\r\n\t\t\tcase CardIds.LeeroyTheReckless_BG23_318_G:\r\n\t\t\t\tif (deadEntity.lastAffectedByEntity) {\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity.definitelyDead = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RadioStar_BG25_399:\r\n\t\t\tcase CardIds.RadioStar_BG25_399_G:\r\n\t\t\t\tconst radioQuantity = deadEntityCardId === CardIds.RadioStar_BG25_399_G ? 2 : 1;\r\n\t\t\t\tconst radioEntities = Array(radioQuantity).fill(deadEntity.lastAffectedByEntity);\r\n\t\t\t\taddCardsInHand(boardWithDeadEntityHero, boardWithDeadEntity, allCards, spectator, radioEntities);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiver_TB_BaconShop_HERO_41_Buddy:\r\n\t\t\t\tfor (let i = 0; i < Math.min(1, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\t\trightMostMinion,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SrTombDiver_TB_BaconShop_HERO_41_Buddy_G:\r\n\t\t\t\tfor (let i = 0; i < Math.min(2, boardWithDeadEntity.length); i++) {\r\n\t\t\t\t\tconst rightMostMinion = boardWithDeadEntity[boardWithDeadEntity.length - 1 - i];\r\n\t\t\t\t\tif (rightMostMinion) {\r\n\t\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\t\trightMostMinion,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Scourfin_BG26_360:\r\n\t\t\tcase CardIds.Scourfin_BG26_360_G:\r\n\t\t\t\tconst statsScourfin = deadEntityCardId === CardIds.Scourfin_BG26_360_G ? 10 : 5;\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero.hand,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tstatsScourfin,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = deadEntityCardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\tboardWithDeadEntityHero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\tboardWithDeadEntityHero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.Banshee_BG_RLK_957:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 2, 1, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LostSpirit_BG26_GIL_513:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\taddStatsToBoard(deadEntity, boardWithDeadEntity, 1, 0, allCards, spectator, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TickingAbomination_BG_ICC_099:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tfor (const entity of boardWithDeadEntity) {\r\n\t\t\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\t\t5,\r\n\t\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.WitheredSpearhide_BG27_006:\r\n\t\t\tcase CardIds.WitheredSpearhide_BG27_006_G:\r\n\t\t\t\tconst witheredSpearhideCardsToAdd = Array(CardIds.WitheredSpearhide_BG27_006_G ? 2 : 1).fill(\r\n\t\t\t\t\tCardIds.BloodGem,\r\n\t\t\t\t);\r\n\t\t\t\taddCardsInHand(\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\twitheredSpearhideCardsToAdd,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RecurringNightmare_BG26_055:\r\n\t\t\tcase CardIds.RecurringNightmare_BG26_055_G:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyRecurringNightmareDeathrattleEffect(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdeadEntityCardId === CardIds.RecurringNightmare_BG26_055_G,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MotleyPhalanx_BG27_080:\r\n\t\t\tcase CardIds.MotleyPhalanx_BG27_080_G:\r\n\t\t\t\tconst motleyBuff = deadEntity.cardId === CardIds.MotleyPhalanx_BG27_080_G ? 14 : 7;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tmotleyBuff,\r\n\t\t\t\t\tmotleyBuff,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t// It's important to first copy the enchantments, otherwise you could end up\r\n\t// in an infinite loop - since new enchants are added after each step\r\n\r\n\tlet enchantments: { cardId: string; originEntityId?: number; repeats?: number }[] = [\r\n\t\t...(deadEntity.enchantments ?? []),\r\n\t\t...(deadEntity.rememberedDeathrattles ?? []),\r\n\t].sort((a, b) => a.timing - b.timing);\r\n\t// In some cases it's possible that there are way too many enchantments because of the frog\r\n\t// In that case, we make a trade-off and don't trigger the \"on stats change\" trigger as\r\n\t// often as we should, so that we can have the stats themselves correct\r\n\t// We don't want to lump everything together, as it skews the stats when there are a lot of buffs\r\n\t// Instead, we build groups\r\n\tconst maxNumberOfGroups = 12;\r\n\tconst enchantmentGroups = groupByFunction((enchantment: any) => enchantment.cardId)(enchantments);\r\n\tenchantments = Object.keys(enchantmentGroups).flatMap((cardId) => {\r\n\t\tlet repeatsToApply = enchantmentGroups[cardId].map((e) => e.repeats || 1).reduce((a, b) => a + b, 0);\r\n\r\n\t\t// Frogs include the multiplers here directly\r\n\t\tif (\r\n\t\t\t[\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t].includes(cardId as CardIds)\r\n\t\t) {\r\n\t\t\trepeatsToApply = repeatsToApply * multiplier;\r\n\t\t}\r\n\r\n\t\tconst results = [];\r\n\t\tconst repeatsPerBuff = Math.max(1, Math.floor(repeatsToApply / maxNumberOfGroups));\r\n\t\tlet repeatsDone = 0;\r\n\t\twhile (repeatsDone < repeatsToApply) {\r\n\t\t\tconst repeats = Math.min(repeatsPerBuff, repeatsToApply - repeatsDone);\r\n\t\t\tresults.push({\r\n\t\t\t\tcardId: cardId,\r\n\t\t\t\trepeats: repeats,\r\n\t\t\t\ttiming: Math.min(...enchantmentGroups[cardId].map((e) => e.timing)),\r\n\t\t\t});\r\n\t\t\trepeatsDone += repeatsPerBuff;\r\n\t\t}\r\n\t\treturn results;\r\n\t});\r\n\tfor (const enchantment of enchantments) {\r\n\t\tswitch (enchantment.cardId) {\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e:\r\n\t\t\tcase CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge:\r\n\t\t\t\tapplyLeapFroggerEffect(\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tenchantment.cardId === CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tenchantment.repeats || 1,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EarthRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyEarthInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FireRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyFireInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.WaterRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyWaterInvocationEnchantment(boardWithDeadEntity, deadEntity, deadEntity, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LightningRecollectionEnchantment:\r\n\t\t\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\t\t\tapplyLightningInvocationEnchantment(\r\n\t\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tcardsData,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t// const playerCopy = boardWithDeadEntity.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// const oppCopy = otherBoard.map((e) => ({ ...e, lastAffectedByEntity: null }));\r\n\t// console.log('player board', boardWithDeadEntity.length, playerCopy.length, playerCopy.map((e) => JSON.stringify(e)).join('\\n'));\r\n\t// console.log('opp board', JSON.stringify(oppCopy));\r\n};\r\n\r\nexport const applyLightningInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Because the golden version doubles all the remembered effects\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst targets = pickMultipleRandomDifferent(otherBoard, 5);\r\n\t\tfor (const target of targets) {\r\n\t\t\tdealDamageToEnemy(\r\n\t\t\t\ttarget,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\t1,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyWaterInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[boardWithDeadEntity.length - 1];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyHealth(target, 3, boardWithDeadEntity, allCards);\r\n\t\t\ttarget.taunt = true;\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyFireInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity[0];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyAttack(target, target.attack, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(target, boardWithDeadEntity, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, target, boardWithDeadEntity);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyEarthInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst minionsGrantedDeathrattle: BoardEntity[] = pickMultipleRandomDifferent(boardWithDeadEntity, 4);\r\n\t\tminionsGrantedDeathrattle.forEach((minion) => {\r\n\t\t\tminion.enchantments.push({\r\n\t\t\t\tcardId: CardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\toriginEntityId: deadEntity?.entityId,\r\n\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, minion, boardWithDeadEntity);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nconst applyLeapFroggerEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst buffed = grantRandomStats(\r\n\t\tdeadEntity,\r\n\t\tboardWithDeadEntity,\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tRace.BEAST,\r\n\t\tfalse,\r\n\t\tallCards,\r\n\t\tspectator,\r\n\t);\r\n\tif (buffed) {\r\n\t\tbuffed.enchantments = buffed.enchantments ?? [];\r\n\t\tbuffed.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge\r\n\t\t\t\t: CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t});\r\n\t\t// Don't register power effect here, since it's already done in the random stats\r\n\t\t// spectator.registerPowerTarget(deadEntity, buffed, boardWithDeadEntity);\r\n\t\t// console.log('applyLeapFroggerEffect', stringifySimpleCard(deadEntity), stringifySimpleCard(buffed));\r\n\t}\r\n};\r\n\r\nconst applyRecurringNightmareDeathrattleEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst target = pickRandom(\r\n\t\tboardWithDeadEntity\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055 &&\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055_G,\r\n\t\t\t),\r\n\t);\r\n\tif (target) {\r\n\t\ttarget.enchantments = target.enchantments ?? [];\r\n\t\ttarget.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge\r\n\t\t\t\t: CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t});\r\n\t\tspectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity);\r\n\t}\r\n};\r\n\r\nexport const applyMinionDeathEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.log('applying minion death effect', stringifySimpleCard(deadEntity, allCards));\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.BEAST)) {\r\n\t\tapplyScavengingHyenaEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.DEMON)) {\r\n\t\tapplySoulJugglerEffect(\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tif (isCorrectTribe(allCards.getCard(deadEntity.cardId).races, Race.MECH)) {\r\n\t\tapplyJunkbotEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, Race.MURLOC, allCards)) {\r\n\t\tremoveOldMurkEyeAttack(boardWithDeadEntity, allCards);\r\n\t\tremoveOldMurkEyeAttack(otherBoard, allCards);\r\n\t}\r\n\tif (deadEntity.taunt) {\r\n\t\tapplyBristlemaneScrapsmithEffect(boardWithDeadEntity, boardWithDeadEntityHero, allCards, spectator);\r\n\t\tapplyQirajiHarbringerEffect(boardWithDeadEntity, deadEntityIndexFromRight, allCards, spectator);\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008_G\r\n\t) {\r\n\t\tapplyEternalKnightEffect(boardWithDeadEntity, allCards, spectator);\r\n\t}\r\n\r\n\t// Putricide-only\r\n\tboardWithDeadEntity\r\n\t\t.filter((e) => e.additionalCards?.includes(CardIds.FlesheatingGhoulLegacy_BG26_tt_004))\r\n\t\t.forEach((e) => {\r\n\t\t\tmodifyAttack(e, 1, boardWithDeadEntity, allCards);\r\n\t\t\tafterStatsUpdate(e, boardWithDeadEntity, allCards);\r\n\t\t});\r\n\r\n\tapplyRotHideGnollEffect(boardWithDeadEntity, allCards, spectator);\r\n\r\n\t// Overkill\r\n\tif (deadEntity.health < 0 && deadEntity.lastAffectedByEntity?.attacking) {\r\n\t\tif (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_BGS_032) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t3,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_TB_BaconUps_103) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToEnemy(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t6,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental && deadEntity.lastAffectedByEntity.attacking) {\r\n\t\t// \t// } else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental) {\r\n\t\t// \t// console.log('applying WildfireElemental effect', stringifySimple(boardWithDeadEntity, allCards));\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \t// Prevent propagation of the effect\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\t// \tif (neighbours.length > 0) {\r\n\t\t// \t\tconst randomTarget = neighbours[Math.floor(Math.random() * neighbours.length)];\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\trandomTarget,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t);\r\n\t\t// \t}\r\n\t\t// } else if (\r\n\t\t// \tdeadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElementalBattlegrounds &&\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking\r\n\t\t// ) {\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \tneighbours.forEach((neighbour) =>\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\tneighbour,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t),\r\n\t\t// \t);\r\n\t\t// }\r\n\t\telse if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TRL_232) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TRL_232t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TB_BaconUps_051) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TB_BaconUps_051t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tallCards,\r\n\t\t\t\tcardsData,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tspectator,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\ttrue,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_BGS_080) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 2, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_TB_BaconUps_142) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) => isCorrectTribe(allCards.getCard(entity.cardId).races, Race.PIRATE))\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyAttack(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tmodifyHealth(pirate, 4, boardWithDeadEntity, allCards);\r\n\t\t\t\tafterStatsUpdate(pirate, boardWithDeadEntity, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(deadEntity.lastAffectedByEntity, pirate, otherBoard);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const dealDamageToAllMinions = (\r\n\tboard1: BoardEntity[],\r\n\tboard1Hero: BgsPlayerEntity,\r\n\tboard2: BoardEntity[],\r\n\tboard2Hero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity,\r\n\tdamageDealt: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (board1.length === 0 && board2.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\tfor (let i = 0; i < board1.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard1[i],\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tfor (let i = 0; i < board2.length; i++) {\r\n\t\tdealDamageToEnemy(\r\n\t\t\tboard2[i],\r\n\t\t\tboard2,\r\n\t\t\tboard2Hero,\r\n\t\t\tdamageSource,\r\n\t\t\tdamageDealt,\r\n\t\t\tboard1,\r\n\t\t\tboard1Hero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst applySoulJugglerEffect = (\r\n\tboardWithJugglers: BoardEntity[],\r\n\tboardWithJugglersHero: BgsPlayerEntity,\r\n\tboardToAttack: BoardEntity[],\r\n\tboardToAttackHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (boardWithJugglers.length === 0 && boardToAttack.length === 0) {\r\n\t\treturn;\r\n\t\t// return [boardWithJugglers, boardToAttack];\r\n\t}\r\n\tconst jugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_BGS_002);\r\n\tfor (const juggler of jugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tconst goldenJugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_TB_BaconUps_075);\r\n\tfor (const juggler of goldenJugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\t// processMinionDeath(\r\n\t// \tboardWithJugglers,\r\n\t// \tboardWithJugglersHero,\r\n\t// \tboardToAttack,\r\n\t// \tboardToAttackHero,\r\n\t// \tallCards,\r\n\t// \tcardsData,\r\n\t// \tsharedState,\r\n\t// \tspectator,\r\n\t// );\r\n};\r\n\r\nconst applyScavengingHyenaEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\t// const copy = [...board];\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.ScavengingHyenaLegacy_BG_EX1_531) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.ScavengingHyenaLegacy_TB_BaconUps_043) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyEternalKnightEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008_G\r\n\t\t) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tmodifyHealth(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyRotHideGnollEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.RotHideGnoll_BG25_013 || board[i].cardId === CardIds.RotHideGnoll_BG25_013_G) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tmodifyAttack(board[i], multiplier * 1, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyBristlemaneScrapsmithEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardPlayerEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707 ||\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707_G\r\n\t\t) {\r\n\t\t\tconst cardsToAdd = Array(CardIds.BristlemaneScrapsmith_BG24_707_G ? 2 : 1).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardPlayerEntity, board, allCards, spectator, cardsToAdd);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyJunkbotEffect = (board: BoardEntity[], allCards: AllCardsService, spectator: Spectator): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.Junkbot_GVG_106) {\r\n\t\t\tmodifyAttack(board[i], 2, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 2, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t} else if (board[i].cardId === CardIds.Junkbot_TB_BaconUps_046) {\r\n\t\t\tmodifyAttack(board[i], 4, board, allCards);\r\n\t\t\tmodifyHealth(board[i], 4, board, allCards);\r\n\t\t\tafterStatsUpdate(board[i], board, allCards);\r\n\t\t\tspectator.registerPowerTarget(board[i], board[i], board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyQirajiHarbringerEffect = (\r\n\tboard: BoardEntity[],\r\n\tdeadEntityIndexFromRight: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst qiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_BGS_112);\r\n\tconst goldenQiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_TB_BaconUps_303);\r\n\tconst neighbours = getNeighbours(board, null, deadEntityIndexFromRight);\r\n\r\n\t// TODO: if reactivated, properly apply buffs one by one, instead of all together\r\n\tneighbours.forEach((entity) => {\r\n\t\tmodifyAttack(entity, 2 * qiraji.length + 4 * goldenQiraji.length, board, allCards);\r\n\t\tmodifyHealth(entity, 2 * qiraji.length + 4 * goldenQiraji.length, board, allCards);\r\n\t\tafterStatsUpdate(entity, board, allCards);\r\n\t});\r\n};\r\n\r\nexport const applyMonstrosity = (\r\n\tmonstrosity: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tboardWithDeadEntities: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tfor (const deadEntity of deadEntities) {\r\n\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\tif (monstrosity.cardId === CardIds.Monstrosity_BG20_HERO_282_Buddy_G) {\r\n\t\t\tmodifyAttack(monstrosity, deadEntity.attack, boardWithDeadEntities, allCards);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const rememberDeathrattles = (\r\n\tfish: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tconst validDeathrattles = deadEntities\r\n\t\t.filter((entity) => cardsData.validDeathrattles.includes(entity.cardId) || isFish(entity))\r\n\t\t.map((entity) => ({ cardId: entity.cardId, repeats: 1, timing: sharedState.currentEntityId++ }));\r\n\tconst validEnchantments = deadEntities\r\n\t\t.filter((entity) => entity.enchantments?.length)\r\n\t\t.map((entity) => entity.enchantments)\r\n\t\t.reduce((a, b) => a.concat(b), [])\r\n\t\t.flatMap((enchantment) => ({\r\n\t\t\tcardId: enchantment.cardId,\r\n\t\t\trepeats: enchantment.repeats ?? 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t}))\r\n\t\t.filter((enchantment) =>\r\n\t\t\t[\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\t\t\t\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\t\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\t\t\t\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\t\t\t\tCardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\tCardIds.FireInvocation_ElementFireEnchantment,\r\n\t\t\t\tCardIds.WaterInvocation_ElementWaterEnchantment,\r\n\t\t\t\tCardIds.LightningInvocation,\r\n\t\t\t\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\t\t\t\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\t\t\t].includes(enchantment.cardId as CardIds),\r\n\t\t);\r\n\t// Multiple fish\r\n\tconst deadEntityRememberedDeathrattles =\r\n\t\tdeadEntities.filter((e) => !!e.rememberedDeathrattles?.length).flatMap((e) => e.rememberedDeathrattles) ?? [];\r\n\tconst newDeathrattles = [...validDeathrattles, ...validEnchantments, ...deadEntityRememberedDeathrattles];\r\n\t// Order is important - the DR are triggered in the ordered the minions have died\r\n\t// console.log(\r\n\t// \t'remembering deathrattle',\r\n\t// \t'\\n',\r\n\t// \tstringifySimpleCard(fish, allCards),\r\n\t// \t'\\n',\r\n\t// \tstringifySimple(deadEntities, allCards),\r\n\t// \t'\\n',\r\n\t// \tfish.rememberedDeathrattles,\r\n\t// );\r\n\tif (isGolden(fish.cardId, allCards)) {\r\n\t\t// https://stackoverflow.com/questions/33305152/how-to-duplicate-elements-in-a-js-array\r\n\t\tconst doubleDr = newDeathrattles.reduce((res, current) => res.concat([current, current]), []);\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...doubleDr];\r\n\t} else {\r\n\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...newDeathrattles];\r\n\t}\r\n\t// console.log('remembering deathrattle after', '\\n', fish.rememberedDeathrattles);\r\n};\r\n\r\nconst removeOldMurkEyeAttack = (boardWithDeadEntity: BoardEntity[], allCards: AllCardsService) => {\r\n\tconst murkeyes = boardWithDeadEntity.filter(\r\n\t\t(entity) => entity.cardId === CardIds.OldMurkEyeLegacy || entity.cardId === CardIds.OldMurkEyeVanilla,\r\n\t);\r\n\tconst goldenMurkeyes = boardWithDeadEntity.filter((entity) => entity.cardId === CardIds.OldMurkEye);\r\n\tmurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -1, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n\tgoldenMurkeyes.forEach((entity) => {\r\n\t\tmodifyAttack(entity, -2, boardWithDeadEntity, allCards);\r\n\t\tafterStatsUpdate(entity, boardWithDeadEntity, allCards);\r\n\t});\r\n};\r\n"]}
|