@firestone-hs/simulate-bgs-battle 1.1.280 → 1.1.281

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.
@@ -112,14 +112,15 @@ class CardsData {
112
112
  case "BG22_HERO_003_Buddy":
113
113
  case "BG22_HERO_003_Buddy_G":
114
114
  case "BG22_HERO_003p":
115
+ case "BG22_HERO_002p":
115
116
  return 2;
116
117
  case "BG21_030":
117
118
  case "BG21_030_G":
119
+ case "BG22_HERO_305p":
118
120
  case "BG23_014":
119
121
  case "BG23_014_G":
120
122
  case "BG21_038":
121
123
  case "BG21_038_G":
122
- case "BG22_HERO_002p":
123
124
  return 3;
124
125
  case "BG21_007":
125
126
  case "BG21_007_G":
@@ -127,7 +128,6 @@ class CardsData {
127
128
  case "BG21_009_G":
128
129
  case "BG21_031":
129
130
  case "BG21_031_G":
130
- case "BG22_HERO_305p":
131
131
  case "BG26_148":
132
132
  case "BG26_148_G":
133
133
  return 4;
@@ -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;;;;;;;;;;;;;;;;;;;;;CAqBvC,CAAC;AACW,QAAA,cAAc,GAAG,gDAAmF,CAAC;AAElH,MAAa,SAAS;IAsBrB,YAA6B,QAAyB,EAAE,IAAI,GAAG,IAAI;QAAtC,aAAQ,GAAR,QAAQ,CAAiB;QACrD,IAAI,IAAI,EAAE;YACT,IAAI,CAAC,YAAY,EAAE,CAAC;SACpB;IACF,CAAC;IAEM,YAAY,CAAC,WAA6B;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ;aACxB,QAAQ,EAAE;aACV,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,oCAAmB,EAAC,IAAI,CAAC,CAAC;aAC3C,MAAM,CAAC,CAAC,IAAI,E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,CAAC;IACxC,CAAC;IAEO,YAAY,CAAC,WAA4B,EAAE,SAA4B;QAE9E,IAAI,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAA,EAAE;YACvB,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,SAAS;aACd,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;aAChC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,qBAAI,CAAC,GAAG,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,CAAC;CACD;AA3KD,8BA2KC","sourcesContent":["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,\r\n\tCardIds.CorruptedMyrmidonBattlegrounds,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy,\r\n\tCardIds.CrabbyBattlegrounds,\r\n\tCardIds.MantidQueen,\r\n\tCardIds.MantidQueenBattlegrounds,\r\n\tCardIds.PrizedPromoDrake,\r\n\tCardIds.PrizedPromoDrakeBattlegrounds,\r\n\tCardIds.RedWhelp,\r\n\tCardIds.RedWhelpBattlegrounds,\r\n\tCardIds.AmberGuardian,\r\n\tCardIds.AmberGuardianBattlegrounds,\r\n\tCardIds.InterrogatorWhitemane_BG24_704,\r\n\tCardIds.InterrogatorWhitemane_BG24_704_G,\r\n\tCardIds.Soulsplitter,\r\n\tCardIds.SoulsplitterBattlegrounds,\r\n\tCardIds.ChoralMrrrglr,\r\n\tCardIds.ChoralMrrrglrBattlegrounds,\r\n\tCardIds.SanctumRester,\r\n\tCardIds.SanctumResterBattlegrounds,\r\n];\r\nexport const WHELP_CARD_IDS = [CardIds.RedWhelp, CardIds.RedWhelpBattlegrounds, CardIds.Onyxia_OnyxianWhelpToken];\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 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[]): void {\r\n\t\tconst pool = 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\tthis.minionsForTier = groupByFunction((card: ReferenceCard) => card.techLevel)(\r\n\t\t\tpool.filter((card) => !this.isGolden(card)),\r\n\t\t);\r\n\t\tthis.ghastcoilerSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\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 = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\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 = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.impMamaSpawns = this.demonSpawns.filter((cardId) => cardId !== CardIds.ImpMama);\r\n\t\tthis.gentleDjinniSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.ELEMENTAL))\r\n\t\t\t.filter((card) => card.id !== CardIds.GentleDjinni)\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 = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.filter((card) => card.id !== CardIds.KilrekBattlegrounds_TB_BaconShop_HERO_37_Buddy)\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.brannEpicEggSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => hasMechanic(card, 'BATTLECRY'))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.pirateSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.PIRATE))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.beastSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.BEAST))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.scrapScraperSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\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 = pool.filter((card) => card.battlegroundsPutridicePool1).map((card) => card.id);\r\n\t\tthis.putricidePool2 = pool.filter((card) => card.battlegroundsPutridicePool2).map((card) => card.id);\r\n\t\tthis.putridicePool2ForEternalSummoner = 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:\r\n\t\t\tcase CardIds.BirdBuddyBattlegrounds:\r\n\t\t\tcase CardIds.HungeringAbomination:\r\n\t\t\tcase CardIds.HungeringAbominationBattlegrounds:\r\n\t\t\t// Not technically an avenge, but behaves as if\r\n\t\t\tcase CardIds.ShadowyConstruct:\r\n\t\t\tcase CardIds.ShadowyConstructBattlegrounds:\r\n\t\t\tcase CardIds.Bristlebach:\r\n\t\t\tcase CardIds.BristlebachBattlegrounds:\r\n\t\t\t\treturn 1;\r\n\t\t\tcase CardIds.GhoulOfTheFeast:\r\n\t\t\tcase CardIds.GhoulOfTheFeastBattlegrounds:\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:\r\n\t\t\tcase CardIds.StormpikeLieutenantBattlegrounds:\r\n\t\t\tcase CardIds.VanndarStormpike_LeadTheStormpikes:\r\n\t\t\t\treturn 2;\r\n\t\t\tcase CardIds.BuddingGreenthumb:\r\n\t\t\tcase CardIds.BuddingGreenthumbBattlegrounds:\r\n\t\t\t// case CardIds.FrostwolfLieutenant:\r\n\t\t\t// case CardIds.FrostwolfLieutenantBattlegrounds:\r\n\t\t\tcase CardIds.PashmarTheVengeful:\r\n\t\t\tcase CardIds.PashmarTheVengefulBattlegrounds:\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.Drekthar_LeadTheFrostwolves:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.ImpatientDoomsayer:\r\n\t\t\tcase CardIds.ImpatientDoomsayerBattlegrounds:\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.Onyxia_Broodmother:\r\n\t\t\tcase CardIds.ScrapScraper:\r\n\t\t\tcase CardIds.ScrapScraperBattlegrounds:\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\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;;;;;;;;;;;;;;;;;;;;;CAqBvC,CAAC;AACW,QAAA,cAAc,GAAG,gDAAmF,CAAC;AAElH,MAAa,SAAS;IAsBrB,YAA6B,QAAyB,EAAE,IAAI,GAAG,IAAI;QAAtC,aAAQ,GAAR,QAAQ,CAAiB;QACrD,IAAI,IAAI,EAAE;YACT,IAAI,CAAC,YAAY,EAAE,CAAC;SACpB;IACF,CAAC;IAEM,YAAY,CAAC,WAA6B;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ;aACxB,QAAQ,EAAE;aAC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CAAC,CAAC,0CAAE,EAAE,CAAC;IAC7D,CAAC;IAEO,QAAQ,CAAC,IAAmB;QACnC,OAAO,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC;IACxC,CAAC;IAEO,YAAY,CAAC,WAA4B,EAAE,SAA4B;QAE9E,IAAI,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAA,EAAE;YACvB,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,SAAS;aACd,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;aAChC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,qBAAI,CAAC,GAAG,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,CAAC;CACD;AA3KD,8BA2KC","sourcesContent":["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,\r\n\tCardIds.CorruptedMyrmidonBattlegrounds,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy,\r\n\tCardIds.CrabbyBattlegrounds,\r\n\tCardIds.MantidQueen,\r\n\tCardIds.MantidQueenBattlegrounds,\r\n\tCardIds.PrizedPromoDrake,\r\n\tCardIds.PrizedPromoDrakeBattlegrounds,\r\n\tCardIds.RedWhelp,\r\n\tCardIds.RedWhelpBattlegrounds,\r\n\tCardIds.AmberGuardian,\r\n\tCardIds.AmberGuardianBattlegrounds,\r\n\tCardIds.InterrogatorWhitemane_BG24_704,\r\n\tCardIds.InterrogatorWhitemane_BG24_704_G,\r\n\tCardIds.Soulsplitter,\r\n\tCardIds.SoulsplitterBattlegrounds,\r\n\tCardIds.ChoralMrrrglr,\r\n\tCardIds.ChoralMrrrglrBattlegrounds,\r\n\tCardIds.SanctumRester,\r\n\tCardIds.SanctumResterBattlegrounds,\r\n];\r\nexport const WHELP_CARD_IDS = [CardIds.RedWhelp, CardIds.RedWhelpBattlegrounds, CardIds.Onyxia_OnyxianWhelpToken];\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 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[]): void {\r\n\t\tconst pool = 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\tthis.minionsForTier = groupByFunction((card: ReferenceCard) => card.techLevel)(\r\n\t\t\tpool.filter((card) => !this.isGolden(card)),\r\n\t\t);\r\n\t\tthis.ghastcoilerSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\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 = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\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 = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.impMamaSpawns = this.demonSpawns.filter((cardId) => cardId !== CardIds.ImpMama);\r\n\t\tthis.gentleDjinniSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.ELEMENTAL))\r\n\t\t\t.filter((card) => card.id !== CardIds.GentleDjinni)\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 = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.filter((card) => card.id !== CardIds.KilrekBattlegrounds_TB_BaconShop_HERO_37_Buddy)\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.brannEpicEggSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => hasMechanic(card, 'BATTLECRY'))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.pirateSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.PIRATE))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.beastSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.BEAST))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.scrapScraperSpawns = pool\r\n\t\t\t.filter((card) => !this.isGolden(card))\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 = pool.filter((card) => card.battlegroundsPutridicePool1).map((card) => card.id);\r\n\t\tthis.putricidePool2 = pool.filter((card) => card.battlegroundsPutridicePool2).map((card) => card.id);\r\n\t\tthis.putridicePool2ForEternalSummoner = 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:\r\n\t\t\tcase CardIds.BirdBuddyBattlegrounds:\r\n\t\t\tcase CardIds.HungeringAbomination:\r\n\t\t\tcase CardIds.HungeringAbominationBattlegrounds:\r\n\t\t\t// Not technically an avenge, but behaves as if\r\n\t\t\tcase CardIds.ShadowyConstruct:\r\n\t\t\tcase CardIds.ShadowyConstructBattlegrounds:\r\n\t\t\tcase CardIds.Bristlebach:\r\n\t\t\tcase CardIds.BristlebachBattlegrounds:\r\n\t\t\t\treturn 1;\r\n\t\t\tcase CardIds.GhoulOfTheFeast:\r\n\t\t\tcase CardIds.GhoulOfTheFeastBattlegrounds:\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:\r\n\t\t\tcase CardIds.StormpikeLieutenantBattlegrounds:\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:\r\n\t\t\tcase CardIds.BuddingGreenthumbBattlegrounds:\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:\r\n\t\t\tcase CardIds.PashmarTheVengefulBattlegrounds:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.ImpatientDoomsayer:\r\n\t\t\tcase CardIds.ImpatientDoomsayerBattlegrounds:\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:\r\n\t\t\tcase CardIds.ScrapScraperBattlegrounds:\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\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"]}
@@ -22,13 +22,7 @@ const addMinionToBoard = (board, boardHero, otherHero, index, minionToAdd, allCa
22
22
  exports.addMinionToBoard = addMinionToBoard;
23
23
  const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spectator, sharedState) => {
24
24
  var _a, _b;
25
- if (otherHero.heroPowerId === "TB_BaconShop_HP_061") {
26
- spawned.attack += 3;
27
- }
28
25
  switch (boardHero.heroPowerId) {
29
- case "TB_BaconShop_HP_061":
30
- spawned.attack += 3;
31
- break;
32
26
  case "TB_BaconShop_HP_107":
33
27
  spawned.taunt = true;
34
28
  (0, utils_1.modifyAttack)(spawned, 1, board, allCards);
@@ -1 +1 @@
1
- {"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAOkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACjB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,WAAW,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,SAAS,EAAE,WAAW,CAAC,CAAC;IAC9F,IAAI,wBAAwB,EAAE;QAC7B,uBAAuB,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;KACnE;AACF,CAAC,CAAC;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CAAC;gBACnC,MAAM;YACP,gBAA0B;YAC1B;gBACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,qBAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;oBACnD,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,iBAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACnF,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC;oBACjD,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC;iBACjD;gBACD,MAAM;YAGP;gBACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,qBAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;oBACpD,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,IAAA,wBAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;iBACrD;gBACD,MAAM;SACP;KACD;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tif (otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t\tspawned.attack += 3;\r\n\t}\r\n\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.AllWillBurnBattlegrounds:\r\n\t\t\tspawned.attack += 3;\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SproutItOutBattlegrounds:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TinkerBattlegrounds:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 5;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\tswitch (spawnedCardId) {\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t\t// Other\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\te.attack +=\r\n\t\t\t\t\t\tspawned.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.KathranatirBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.EternalKnight:\r\n\t\t\tcase CardIds.EternalKnightBattlegrounds:\r\n\t\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnightBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FlourishingFrostling:\r\n\t\t\tcase CardIds.FlourishingFrostlingBattlegrounds:\r\n\t\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostlingBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusFrostling, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RotHideGnoll:\r\n\t\t\tcase CardIds.RotHideGnollBattlegrounds:\r\n\t\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnollBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusGnoll =\r\n\t\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelpsBattlegrounds);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack +=\r\n\t\t\t\t\tentity.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.KathranatirBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot:\r\n\t\t\tcase CardIds.DeflectOBotBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBotBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal:\r\n\t\t\tcase CardIds.BigfernalBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BigfernalBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear:\r\n\t\t\tcase CardIds.MamaBearBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBearBattlegrounds ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader:\r\n\t\t\tcase CardIds.PackLeaderBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeaderBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocTidecallerLegacy:\r\n\t\t\tcase CardIds.MurlocTidecallerBattlegrounds:\r\n\t\t\t\tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount =\r\n\t\t\t\t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Swampstriker:\r\n\t\t\tcase CardIds.SwampstrikerBattlegrounds:\r\n\t\t\t\tconst multiplier2 = entity.cardId === CardIds.SwampstrikerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper:\r\n\t\t\tcase CardIds.FelstomperBattlegrounds:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.FelstomperBattlegrounds ? 6 : 3;\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones:\r\n\t\t\tcase CardIds.XyloBonesBattlegrounds:\r\n\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBonesBattlegrounds ? 6 : 3;\r\n\t\t\t\tmodifyHealth(entity, xylobonesBuff, board, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod:\r\n\t\t\tcase CardIds.OctosariWrapGodBattlegrounds:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGodBattlegrounds ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma:\r\n\t\t\tcase CardIds.BananaSlammaBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlammaBattlegrounds ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
1
+ {"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAOkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACjB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,WAAW,IA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oBAC1C,IAAA,wBAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;iBACrD;gBACD,MAAM;SACP;KACD;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\t// if (otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t// \tspawned.attack += 3;\r\n\t// }\r\n\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\t// case CardIds.AllWillBurnBattlegrounds:\r\n\t\t// \tspawned.attack += 3;\r\n\t\t// \tbreak;\r\n\t\tcase CardIds.SproutItOutBattlegrounds:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TinkerBattlegrounds:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 5;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\tswitch (spawnedCardId) {\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t\t// Other\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\te.attack +=\r\n\t\t\t\t\t\tspawned.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.KathranatirBattlegrounds ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tboard\r\n\t\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.EternalKnight:\r\n\t\t\tcase CardIds.EternalKnightBattlegrounds:\r\n\t\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnightBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FlourishingFrostling:\r\n\t\t\tcase CardIds.FlourishingFrostlingBattlegrounds:\r\n\t\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostlingBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusFrostling, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RotHideGnoll:\r\n\t\t\tcase CardIds.RotHideGnollBattlegrounds:\r\n\t\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnollBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst statsBonusGnoll =\r\n\t\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelpsBattlegrounds);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacyBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird:\r\n\t\t\tcase CardIds.HummingBirdBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBirdBattlegrounds ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacyBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacyBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack +=\r\n\t\t\t\t\tentity.cardId === CardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.KathranatirBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.KathranatirBattlegrounds ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\r\n\t\t\tcase CardIds.CyborgDrakeBattlegrounds:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrakeBattlegrounds ? 16 : 8;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.BabyYshaarjBattlegrounds_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus =\r\n\t\t\t\t\t\tentity.cardId === CardIds.WanderingTreantBattlegrounds_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot:\r\n\t\t\tcase CardIds.DeflectOBotBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBotBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal:\r\n\t\t\tcase CardIds.BigfernalBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BigfernalBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear:\r\n\t\t\tcase CardIds.MamaBearBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBearBattlegrounds ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader:\r\n\t\t\tcase CardIds.PackLeaderBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeaderBattlegrounds ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocTidecallerLegacy:\r\n\t\t\tcase CardIds.MurlocTidecallerBattlegrounds:\r\n\t\t\t\tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount =\r\n\t\t\t\t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Swampstriker:\r\n\t\t\tcase CardIds.SwampstrikerBattlegrounds:\r\n\t\t\t\tconst multiplier2 = entity.cardId === CardIds.SwampstrikerBattlegrounds ? 2 : 1;\r\n\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper:\r\n\t\t\tcase CardIds.FelstomperBattlegrounds:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.FelstomperBattlegrounds ? 6 : 3;\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones:\r\n\t\t\tcase CardIds.XyloBonesBattlegrounds:\r\n\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBonesBattlegrounds ? 6 : 3;\r\n\t\t\t\tmodifyHealth(entity, xylobonesBuff, board, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod:\r\n\t\t\tcase CardIds.OctosariWrapGodBattlegrounds:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGodBattlegrounds ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma:\r\n\t\t\tcase CardIds.BananaSlammaBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlammaBattlegrounds ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
@@ -9,16 +9,6 @@ const setMissingAuras = (board, boardHero, otherHero, allCards) => {
9
9
  };
10
10
  exports.setMissingAuras = setMissingAuras;
11
11
  const setMissingHeroPowerAura = (board, boardHero, otherHero) => {
12
- if (boardHero.heroPowerId === "TB_BaconShop_HP_061" ||
13
- otherHero.heroPowerId === "TB_BaconShop_HP_061") {
14
- const bonus = (boardHero.heroPowerId === "TB_BaconShop_HP_061" ? 3 : 0) +
15
- (otherHero.heroPowerId === "TB_BaconShop_HP_061" ? 3 : 0);
16
- board
17
- .filter((e) => !e.enchantments.find((ench) => ench.cardId === "TB_BaconShop_HP_061e"))
18
- .forEach((e) => {
19
- e.attack += bonus;
20
- });
21
- }
22
12
  if (boardHero.heroPowerId === "BG24_Reward_125") {
23
13
  board
24
14
  .filter((e) => !e.enchantments.find((ench) => ench.cardId === "BG24_Reward_125e"))
@@ -1 +1 @@
1
- {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAAmE;AAE5D,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACvC,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEK,MAAM,uBAAuB,GAAG,CACtC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,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC1C;IACD,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACnE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;QAC1C,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe, normalizeCardIdForSkin } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n): void => {\r\n\tif (\r\n\t\tboardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ||\r\n\t\totherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds\r\n\t) {\r\n\t\tconst bonus =\r\n\t\t\t(boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0) +\r\n\t\t\t(otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0);\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.AllWillBurn_AllWillBurnEnchantmentBattlegrounds,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += bonus;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 5;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacyBattlegrounds,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantmentBattlegrounds,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacyBattlegrounds,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantmentBattlegrounds,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBirdBattlegrounds,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.KathranatirBattlegrounds,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t8,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrakeBattlegrounds,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t16,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitData = (board: BoardEntity[], cardsData: CardsData): void => {\r\n\tfor (const entity of board) {\r\n\t\tentity.cardId = normalizeCardIdForSkin(entity.cardId);\r\n\t\tentity.maxHealth = entity.health;\r\n\t\tconst avengeValue = cardsData.avengeValue(entity.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\tentity.avengeCurrent = avengeValue;\r\n\t\t\tentity.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tentity.immuneWhenAttackCharges = 0;\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\thero.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,oCAAmE;AAE5D,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACvC,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEK,MAAM,uBAAuB,GAAG,CACtC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EACnB,EAAE;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,C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eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe, normalizeCardIdForSkin } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n): void => {\r\n\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 += 5;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacyBattlegrounds,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantmentBattlegrounds,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacyBattlegrounds,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantmentBattlegrounds,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBird,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards)),\r\n\t\tCardIds.HummingBirdBattlegrounds,\r\n\t\tCardIds.HummingBird_EntrancedEnchantment_BG26_805_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.KathranatirBattlegrounds,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t8,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrakeBattlegrounds,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t16,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitData = (board: BoardEntity[], cardsData: CardsData): void => {\r\n\tfor (const entity of board) {\r\n\t\tentity.cardId = normalizeCardIdForSkin(entity.cardId);\r\n\t\tentity.maxHealth = entity.health;\r\n\t\tconst avengeValue = cardsData.avengeValue(entity.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\tentity.avengeCurrent = avengeValue;\r\n\t\t\tentity.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tentity.immuneWhenAttackCharges = 0;\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\thero.hand = hero.hand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {\r\n\t\t\tEternalKnightsDeadThisGame: 0,\r\n\t\t\tUndeadAttackBonus: 0,\r\n\t\t\tFrostlingBonus: 0,\r\n\t\t\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"]}
@@ -38,6 +38,9 @@ const handlePreCombatHeroPowersForPlayer = (playerEntity, playerBoard, opponentE
38
38
  else if (playerEntity.heroPowerUsed && playerHeroPowerId === "BG22_HERO_001p_t2") {
39
39
  (0, deathrattle_effects_1.applyFireInvocationEnchantment)(playerBoard, null, playerEntity, allCards, spectator);
40
40
  }
41
+ else if (playerHeroPowerId === "TB_BaconShop_HP_061") {
42
+ applyAllWillBurn(playerBoard, opponentBoard, playerEntity, allCards, spectator);
43
+ }
41
44
  return currentAttacker;
42
45
  };
43
46
  const handleIllidanHeroPowers = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, cardsData, sharedState, gameState, spectator) => {
@@ -140,6 +143,7 @@ const handleIllidanForPlayer = (playerBoard, playerEntity, opponentBoard, oppone
140
143
  const firstAttacker = playerBoard[0];
141
144
  const secondAttacker = minionsAtStart > 1 ? playerBoard[playerBoard.length - 1] : null;
142
145
  (0, utils_2.modifyAttack)(firstAttacker, 2, playerBoard, allCards);
146
+ (0, utils_2.modifyHealth)(firstAttacker, 1, playerBoard, allCards);
143
147
  (0, utils_2.afterStatsUpdate)(firstAttacker, playerBoard, allCards);
144
148
  spectator.registerPowerTarget(firstAttacker, firstAttacker, playerBoard);
145
149
  if (playerBoard.map((e) => e.cardId).includes("TB_BaconShop_HERO_08_Buddy") ||
@@ -177,9 +181,8 @@ const handleTamsinForPlayer = (playerBoard, playerEntity, opponentBoard, opponen
177
181
  return;
178
182
  }
179
183
  const newBoard = playerBoard.filter((e) => e.entityId !== chosenEntity.entityId);
180
- const buffedEntities = (0, utils_1.pickMultipleRandomDifferent)(newBoard, 5);
181
184
  chosenEntity.definitelyDead = true;
182
- buffedEntities.forEach((e) => {
185
+ newBoard.forEach((e) => {
183
186
  (0, utils_2.modifyAttack)(e, chosenEntity.attack, newBoard, allCards);
184
187
  (0, utils_2.modifyHealth)(e, chosenEntity.health, newBoard, allCards);
185
188
  (0, utils_2.afterStatsUpdate)(e, newBoard, allCards);
@@ -203,10 +206,9 @@ const handleTeronForPlayer = (playerBoard, playerEntity, opponentBoard, opponent
203
206
  };
204
207
  const handleWaxWarbandForPlayer = (playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator) => {
205
208
  if (playerBoard.length > 0) {
206
- let tribesGranted = 0;
207
209
  let boardCopy = [...playerBoard];
208
210
  let racesLeft = [...reference_data_1.ALL_BG_RACES];
209
- while (tribesGranted < 3) {
211
+ while (racesLeft.length > 0) {
210
212
  const tribe = (0, utils_1.pickRandom)(racesLeft);
211
213
  const validMinion = (0, utils_2.getRandomAliveMinion)(boardCopy, tribe, allCards);
212
214
  if (validMinion) {
@@ -215,7 +217,9 @@ const handleWaxWarbandForPlayer = (playerBoard, playerEntity, opponentBoard, opp
215
217
  (0, utils_2.afterStatsUpdate)(validMinion, playerBoard, allCards);
216
218
  spectator.registerPowerTarget(playerEntity, validMinion, playerBoard);
217
219
  boardCopy = boardCopy.filter((e) => e !== validMinion);
218
- tribesGranted++;
220
+ }
221
+ else {
222
+ break;
219
223
  }
220
224
  racesLeft = racesLeft.filter((r) => r !== tribe);
221
225
  }
@@ -451,6 +455,18 @@ const performStartOfCombatMinionsForPlayer = (attacker, attackingBoard, attackin
451
455
  }
452
456
  };
453
457
  exports.performStartOfCombatMinionsForPlayer = performStartOfCombatMinionsForPlayer;
458
+ const applyAllWillBurn = (board1, board2, sourceEntity, allCards, spectator) => {
459
+ for (const entity of board1) {
460
+ (0, utils_2.modifyAttack)(entity, 2, board1, allCards);
461
+ (0, utils_2.afterStatsUpdate)(entity, board1, allCards);
462
+ spectator.registerPowerTarget(sourceEntity, entity, board1);
463
+ }
464
+ for (const entity of board2) {
465
+ (0, utils_2.modifyAttack)(entity, 2, board2, allCards);
466
+ (0, utils_2.afterStatsUpdate)(entity, board2, allCards);
467
+ spectator.registerPowerTarget(sourceEntity, entity, board2);
468
+ }
469
+ };
454
470
  const castImpure = (entity, source, board, spectator) => {
455
471
  var _a;
456
472
  if (!entity) {
@@ -1 +1 @@
1
- {"version":3,"file":"start-of-combat.js","sourceRoot":"","sources":["../../src/simulation/start-of-combat.ts"],"names":[],"mappings":";;;AACA,iEAA4F;AAI5F,oDAA0E;AAC1E,6CAA4E;AAC5E,oCAUkB;AAClB,qCAOkB;AAClB,+DAK+B;AAC/B,6DAAqD;AAI9C,MAAM,mBAAmB,GAAG,CAClC,YAA6B,EAC7B,WAA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CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsGameState } from '../bgs-battle-info';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData, START_OF_COMBAT_CARD_IDS } from '../cards/cards-data';\r\nimport { pickMultipleRandomDifferent, pickRandom } from '../services/utils';\r\nimport {\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tstringifySimple,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport {\r\n\tdealDamageToEnemy,\r\n\tdealDamageToRandomEnemy,\r\n\tgetNeighbours,\r\n\tperformEntitySpawns,\r\n\tprocessMinionDeath,\r\n\tsimulateAttack,\r\n} from './attack';\r\nimport {\r\n\tapplyEarthInvocationEnchantment,\r\n\tapplyFireInvocationEnchantment,\r\n\tapplyLightningInvocationEnchantment,\r\n\tapplyWaterInvocationEnchantment,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const handleStartOfCombat = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// https://twitter.com/DCalkosz/status/1564705111850434561\r\n\tcurrentAttacker = handleStartOfCombatQuestRewards(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// https://twitter.com/DCalkosz/status/1488361384320528388?s=20&t=1ECxRZFdjqwEa2fRsXk32Q\r\n\t// There’s a certain order for Start of Combat hero powers, rather than “coin flips” where\r\n\t// an unlucky trigger order could mess up some positioning you had planned for your own hero\r\n\t// power. “Precombat” (Al’Akir, Y’Shaarj), then Illidan, then others.\r\n\tcurrentAttacker = handlePreCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// Because start of combat powers like Red Whelp's use the board composition before Illidan's strike to know the amount of damage\r\n\tconst playerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\tconst opponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\tcurrentAttacker = handleIllidanHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatMinions(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tplayerBoardBefore,\r\n\t\topponentBoardBefore,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowersForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Some are part of the incoming board: Y'Shaarj, Lich King, Ozumat\r\n\t// Since the order is not important here, we just always do the player first\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.SwattingInsectsBattlegrounds && playerBoard.length > 0) {\r\n\t\t// Should be sent by the app, but it is an idempotent operation, so we can just reapply it here\r\n\t\thandleAlakirForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.EarthInvocationToken) {\r\n\t\tapplyEarthInvocationEnchantment(playerBoard, null, playerEntity, allCards, sharedState, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaterInvocationToken) {\r\n\t\tapplyWaterInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.FireInvocationToken) {\r\n\t\tapplyFireInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// console.log('current attacker before', currentAttacker);\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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} else {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\t// console.log('current attacker after', currentAttacker);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatMinions = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet attackerForStart = currentAttacker;\r\n\tconst playerAttackers = playerBoard.filter((entity) => START_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds));\r\n\tconst opponentAttackers = opponentBoard.filter((entity) =>\r\n\t\tSTART_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds),\r\n\t);\r\n\twhile (playerAttackers.length > 0 || opponentAttackers.length > 0) {\r\n\t\tif (attackerForStart === 0 && playerAttackers.length > 0) {\r\n\t\t\tconst attacker = playerAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length > 0) {\r\n\t\t\tconst attacker = opponentAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t\tattackerForStart = (attackerForStart + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewards = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewardsForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tif (!playerEntity.questRewards?.length) {\r\n\t\treturn currentAttacker;\r\n\t}\r\n\tfor (const reward of playerEntity.questRewards) {\r\n\t\tswitch (reward) {\r\n\t\t\tcase CardIds.EvilTwin:\r\n\t\t\t\tif (!!playerBoard.length && playerBoard.length < 7) {\r\n\t\t\t\t\tconst highestHealthMinion = [...playerBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\t\t\t\tconst copy: BoardEntity = {\r\n\t\t\t\t\t\t...highestHealthMinion,\r\n\t\t\t\t\t\tlastAffectedByEntity: null,\r\n\t\t\t\t\t};\r\n\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\thighestHealthMinion.friendly,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tcopy,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(highestHealthMinion) + 1);\r\n\t\t\t\t\tperformEntitySpawns(\r\n\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\thighestHealthMinion,\r\n\t\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\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\tspectator.registerPowerTarget(playerEntity, copy, playerBoard);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\t\tplayerBoard.forEach((entity) => {\r\n\t\t\t\t\tmodifyAttack(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, playerBoard, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(playerEntity, entity, playerBoard);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StolenGold:\r\n\t\t\t\tif (playerBoard.length > 0) {\r\n\t\t\t\t\tmakeMinionGolden(playerBoard[0], playerEntity, playerBoard, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tif (playerBoard.length > 1) {\r\n\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\tplayerBoard[playerBoard.length - 1],\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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} else {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.WingmenBattlegrounds && playerBoard.length > 0) {\r\n\t\thandleIllidanForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = (currentAttacker + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// TODO: not exactly correct, because of \"attack immediately\", but it's close enough\r\nconst handleIllidanForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Otherwise, if the first minion dies on the attack, and the board has only 2 minions, we\r\n\t// miss the second one\r\n\tconst minionsAtStart = playerBoard.length;\r\n\tconst firstAttacker = playerBoard[0];\r\n\tconst secondAttacker = minionsAtStart > 1 ? playerBoard[playerBoard.length - 1] : null;\r\n\r\n\tmodifyAttack(firstAttacker, 2, playerBoard, allCards);\r\n\tafterStatsUpdate(firstAttacker, playerBoard, allCards);\r\n\tspectator.registerPowerTarget(firstAttacker, firstAttacker, playerBoard);\r\n\tif (\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidariBattlegrounds_TB_BaconShop_HERO_08_Buddy) ||\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidariBattlegrounds_TB_BaconShop_HERO_08_Buddy_G)\r\n\t) {\r\n\t\tfirstAttacker.immuneWhenAttackCharges = 1;\r\n\t}\r\n\tsimulateAttack(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tundefined,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t\t0,\r\n\t);\r\n\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tmodifyAttack(secondAttacker, 2, playerBoard, allCards);\r\n\t\tafterStatsUpdate(secondAttacker, playerBoard, allCards);\r\n\t\tspectator.registerPowerTarget(secondAttacker, secondAttacker, playerBoard);\r\n\t\tif (\r\n\t\t\tplayerBoard\r\n\t\t\t\t.map((e) => e.cardId)\r\n\t\t\t\t.includes(CardIds.EclipsionIllidariBattlegrounds_TB_BaconShop_HERO_08_Buddy_G)\r\n\t\t) {\r\n\t\t\tsecondAttacker.immuneWhenAttackCharges = 1;\r\n\t\t}\r\n\t\tsimulateAttack(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tundefined,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tplayerBoard.length - 1,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst handleAlakirForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst firstEntity = playerBoard[0];\r\n\tfirstEntity.windfury = true;\r\n\tif (!firstEntity.divineShield) {\r\n\t\tupdateDivineShield(firstEntity, playerBoard, true, allCards);\r\n\t}\r\n\tfirstEntity.taunt = true;\r\n\tspectator.registerPowerTarget(firstEntity, firstEntity, playerBoard);\r\n};\r\n\r\nconst handleTamsinForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst lowestHealth = Math.min(...playerBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = playerBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\tif (!chosenEntity) {\r\n\t\tconsole.warn('could not pick any entity for tamsin', stringifySimple(entitiesWithLowestHealth, allCards));\r\n\t\treturn;\r\n\t}\r\n\tconst newBoard = playerBoard.filter((e) => e.entityId !== chosenEntity.entityId);\r\n\tconst buffedEntities = pickMultipleRandomDifferent(newBoard, 5);\r\n\t// How to mark the minion as dead\r\n\tchosenEntity.definitelyDead = true;\r\n\tbuffedEntities.forEach((e) => {\r\n\t\tmodifyAttack(e, chosenEntity.attack, newBoard, allCards);\r\n\t\tmodifyHealth(e, chosenEntity.health, newBoard, allCards);\r\n\t\tafterStatsUpdate(e, newBoard, allCards);\r\n\t\tspectator.registerPowerTarget(chosenEntity, e, newBoard);\r\n\t});\r\n};\r\n\r\nconst handleTeronForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// The board state is snapshot after the minion dies\r\n\tconst deadMinionEntityId = playerEntity.heroPowerInfo;\r\n\tconst minionThatWillDie = playerBoard.find((e) => e.entityId === deadMinionEntityId);\r\n\tif (minionThatWillDie) {\r\n\t\tconst minionIndexFromRight = playerBoard.length - 1 - playerBoard.indexOf(minionThatWillDie);\r\n\t\tplayerEntity.rapidReanimationIndexFromRight = minionIndexFromRight;\r\n\t\tplayerEntity.rapidReanimationMinion = {\r\n\t\t\t...minionThatWillDie,\r\n\t\t\tenchantments: minionThatWillDie.enchantments.map((e) => ({ ...e })) ?? [],\r\n\t\t} as BoardEntity;\r\n\t\tminionThatWillDie.definitelyDead = true;\r\n\t\tspectator.registerPowerTarget(playerEntity, minionThatWillDie, playerBoard);\r\n\t}\r\n};\r\n\r\nconst handleWaxWarbandForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (playerBoard.length > 0) {\r\n\t\tlet tribesGranted = 0;\r\n\t\tlet boardCopy = [...playerBoard];\r\n\t\tlet racesLeft = [...ALL_BG_RACES];\r\n\t\twhile (tribesGranted < 3) {\r\n\t\t\tconst tribe = pickRandom(racesLeft);\r\n\t\t\tconst validMinion: BoardEntity = getRandomAliveMinion(boardCopy, tribe, allCards);\r\n\t\t\tif (validMinion) {\r\n\t\t\t\tmodifyAttack(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tmodifyHealth(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(validMinion, playerBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(playerEntity, validMinion, playerBoard);\r\n\t\t\t\tboardCopy = boardCopy.filter((e) => e !== validMinion);\r\n\t\t\t\ttribesGranted++;\r\n\t\t\t}\r\n\t\t\tracesLeft = racesLeft.filter((r) => r !== tribe);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleOzumatForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Because of some interactions between start of combat hero powers, it can happen that Ozumat is already present\r\n\t// on the board when we receive the board state\r\n\tif (\r\n\t\tplayerBoard.length < 7 &&\r\n\t\t!playerBoard.some((e) => e.cardId === CardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt)\r\n\t) {\r\n\t\tconst tentacularSize = playerEntity.heroPowerInfo;\r\n\t\tconst tentacular = spawnEntities(\r\n\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tfriendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\ttentacular[0].attack = tentacularSize;\r\n\t\ttentacular[0].health = tentacularSize;\r\n\t\tconst indexFromRight = 0;\r\n\t\tperformEntitySpawns(\r\n\t\t\ttentacular,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\tspectator.registerPowerTarget(playerEntity, tentacular[0], playerBoard);\r\n\t}\r\n};\r\n\r\nconst handlePlayerStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TamsinRoame_FragrantPhylactery) {\r\n\t\thandleTamsinForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\t// Tamsin's hero power somehow happens before the current attacker is chosen.\r\n\t\t// See http://replays.firestoneapp.com/?reviewId=bce94e6b-c807-48e4-9c72-2c5c04421213&turn=6&action=9\r\n\t\tshouldRecomputeCurrentAttacker = true;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TeronGorefiend_RapidReanimation) {\r\n\t\thandleTeronForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaxWarbandBattlegrounds) {\r\n\t\thandleWaxWarbandForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerHeroPowerId === CardIds.Ozumat_Tentacular) {\r\n\t\thandleOzumatForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tfriendly,\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\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLeftToken) {\r\n\t\tconst target = opponentBoard[0];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimRightToken) {\r\n\t\tconst target = opponentBoard[opponentBoard.length - 1];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLowToken) {\r\n\t\tconst smallestHealthMinion = [...opponentBoard].sort((a, b) => a.health - b.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === smallestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimHighToken) {\r\n\t\tconst highestHealthMinion = [...opponentBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === highestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.LightningInvocationToken) {\r\n\t\tapplyLightningInvocationEnchantment(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tnull,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: currentAttacker;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const getHeroPowerForHero = (heroCardId: string): string => {\r\n\tswitch (heroCardId) {\r\n\t\tcase CardIds.IllidanStormrageBattlegrounds:\r\n\t\t\treturn CardIds.WingmenBattlegrounds;\r\n\t\tcase CardIds.TheLichKingBattlegrounds:\r\n\t\t\treturn CardIds.RebornRitesBattlegrounds;\r\n\t\tcase CardIds.ProfessorPutricideBattlegrounds:\r\n\t\t\treturn CardIds.RagePotionBattlegrounds;\r\n\t\tcase CardIds.DeathwingBattlegrounds:\r\n\t\t\treturn CardIds.AllWillBurnBattlegrounds;\r\n\t\tcase CardIds.TeronGorefiend_BG25_HERO_103:\r\n\t\t\treturn CardIds.TeronGorefiend_RapidReanimation;\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nexport const performStartOfCombatMinionsForPlayer = (\r\n\tattacker: BoardEntity,\r\n\tattackingBoard: BoardEntity[],\r\n\tattackingBoardHero: BgsPlayerEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingBoardHero: BgsPlayerEntity,\r\n\t// Apparently, the board composition used for start of combat minion effects (like Red Whelp, and I assume it works the\r\n\t// same way for others like Prized Promo Drake or Mantid Queen) is the one that is used before Illidan's effect is handled.\r\n\t// Since this also runs before HP start of combat, we probably also use the state as it was before HP were triggered, like\r\n\t// Tamsin's Phylactery.\r\n\tattackingBoardBefore: BoardEntity[],\r\n\tdefendingBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Don't forget to update START_OF_COMBAT_CARD_IDS\r\n\tif (attacker.cardId === CardIds.RedWhelp) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\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\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\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} else if (attacker.cardId === CardIds.RedWhelpBattlegrounds) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\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\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\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\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\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} else if (\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrake ||\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrakeBattlegrounds\r\n\t) {\r\n\t\tconst numberOfDragons = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.PrizedPromoDrakeBattlegrounds ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (attacker.cardId === CardIds.ChoralMrrrglr || attacker.cardId === CardIds.ChoralMrrrglrBattlegrounds) {\r\n\t\t// const statsOfMinionsInHand = attackingBoardHero.hand\r\n\t\t// \t.map((c) => (c.attack ?? 0) + (c.health ?? 0))\r\n\t\t// \t.reduce((a, b) => a + b, 0);\r\n\t\tconst multiplier = attacker.cardId === CardIds.ChoralMrrrglrBattlegrounds ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralAttackBuff, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralHealthBuff, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (attacker.cardId === CardIds.AmberGuardian || attacker.cardId === CardIds.AmberGuardianBattlegrounds) {\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\tconst loops = attacker.cardId === CardIds.AmberGuardianBattlegrounds ? 2 : 1;\r\n\t\tconst dragonsToConsider = otherDragons;\r\n\t\tfor (let i = 0; i < loops; i++) {\r\n\t\t\tconst otherDragon =\r\n\t\t\t\tpickRandom(dragonsToConsider.filter((e) => !e.divineShield)) ?? pickRandom(dragonsToConsider);\r\n\t\t\tif (otherDragon) {\r\n\t\t\t\tif (!otherDragon.divineShield) {\r\n\t\t\t\t\tupdateDivineShield(otherDragon, attackingBoard, true, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tmodifyAttack(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tmodifyHealth(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t\t\tdragonsToConsider.splice(dragonsToConsider.indexOf(otherDragon), 1);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (attacker.cardId === CardIds.SanctumRester || attacker.cardId === CardIds.SanctumResterBattlegrounds) {\r\n\t\tconst buff = attacker.cardId === CardIds.SanctumResterBattlegrounds ? 16 : 8;\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\totherDragons.forEach((otherDragon) => {\r\n\t\t\tmodifyHealth(otherDragon, buff, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t});\r\n\t} else if (attacker.cardId === CardIds.Soulsplitter || attacker.cardId === CardIds.SoulsplitterBattlegrounds) {\r\n\t\tconst numberOfTargets = attacker.cardId === CardIds.SoulsplitterBattlegrounds ? 2 : 1;\r\n\t\tfor (let i = 0; i < numberOfTargets; i++) {\r\n\t\t\tconst undeadsWithoutReborn = attackingBoard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => !e.reborn);\r\n\t\t\tconst chosenUndead = pickRandom(undeadsWithoutReborn);\r\n\t\t\tif (chosenUndead) {\r\n\t\t\t\tchosenUndead.reborn = true;\r\n\t\t\t\tspectator.registerPowerTarget(attacker, chosenUndead, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy ||\r\n\t\tattacker.cardId === CardIds.CrabbyBattlegrounds\r\n\t) {\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.CrabbyBattlegrounds ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidon ||\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidonBattlegrounds\r\n\t) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.CorruptedMyrmidonBattlegrounds ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attacker.attack, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attacker.health, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704 ||\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704_G\r\n\t) {\r\n\t\tif (defendingBoard.length > 0) {\r\n\t\t\tconst attackerIndex = attackingBoard.indexOf(attacker);\r\n\t\t\tconst defenderPosition = attackerIndex - (attackingBoard.length - defendingBoard.length) / 2;\r\n\t\t\tif (Math.round(defenderPosition) === defenderPosition) {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition], attacker, attackingBoard, spectator);\r\n\t\t\t} else {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition - 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition + 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (attacker.cardId === CardIds.MantidQueen || attacker.cardId === CardIds.MantidQueenBattlegrounds) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.MantidQueenBattlegrounds ? 2 : 1;\r\n\t\tconst allRaces = attackingBoardBefore\r\n\t\t\t.map((entity) => entity.cardId)\r\n\t\t\t.flatMap((cardId) => allCards.getCard(cardId).races)\r\n\t\t\t.filter((race) => !!race && race !== Race[Race.BLANK]);\r\n\t\tconst totalRaces =\r\n\t\t\t[...new Set(allRaces.filter((race) => race !== Race[Race.ALL]))].length +\r\n\t\t\tallRaces.filter((race) => race === Race[Race.ALL]).length;\r\n\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\tfor (let j = 0; j < totalRaces; j++) {\r\n\t\t\t\tconst buffType = getRandomMantidQueenBuffType(attacker);\r\n\t\t\t\tswitch (buffType) {\r\n\t\t\t\t\tcase 'stats':\r\n\t\t\t\t\t\tmodifyAttack(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tmodifyHealth(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'reborn':\r\n\t\t\t\t\t\tattacker.reborn = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'taunt':\r\n\t\t\t\t\t\tattacker.taunt = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'windfury':\r\n\t\t\t\t\t\tattacker.windfury = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst castImpure = (entity: BoardEntity, source: BoardEntity, board: BoardEntity[], spectator: Spectator) => {\r\n\tif (!entity) {\r\n\t\treturn;\r\n\t}\r\n\tconst multiplier = source.cardId === CardIds.InterrogatorWhitemane_BG24_704_G ? 3 : 2;\r\n\tentity.taunt = true;\r\n\tentity.damageMultiplier = entity.damageMultiplier ?? 1;\r\n\tentity.damageMultiplier *= multiplier;\r\n\tspectator.registerPowerTarget(source, entity, board);\r\n};\r\n\r\nconst getRandomMantidQueenBuffType = (entity: BoardEntity): 'stats' | 'reborn' | 'windfury' | 'taunt' => {\r\n\tconst possibilities: ('stats' | 'reborn' | 'windfury' | 'taunt')[] = ['stats'];\r\n\tif (!entity.reborn) {\r\n\t\tpossibilities.push('reborn');\r\n\t}\r\n\tif (!entity.windfury) {\r\n\t\tpossibilities.push('windfury');\r\n\t}\r\n\tif (!entity.taunt) {\r\n\t\tpossibilities.push('taunt');\r\n\t}\r\n\treturn pickRandom(possibilities);\r\n};\r\n"]}
1
+ {"version":3,"file":"start-of-combat.js","sourceRoot":"","sources":["../../src/simulation/start-of-combat.ts"],"names":[],"mappings":";;;AACA,iEAA4F;AAI5F,oDAA0E;AAC1E,6CAA+C;AAC/C,oCAUkB;AAClB,qCAOkB;AAClB,+DAK+B;AAC/B,6DAAqD;AAI9C,MAAM,mBAAmB,GAAG,CAClC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,QAAyB,EACzB,MAAiB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AAA,MAAM,CAAC,gBAAgB,mCAAI,CAAC,CAAC;IACvD,MAAM,CAAC,gBAAgB,IAAI,UAAU,CAAC;IACtC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,MAAmB,EAA6C,EAAE;IACvG,MAAM,aAAa,GAAkD,CAAC,OAAO,CAAC,CAAC;IAC/E,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;QACnB,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAC7B;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACrB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAC/B;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;QAClB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC5B;IACD,OAAO,IAAA,kBAAU,EAAC,aAAa,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { ALL_BG_RACES, AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsGameState } from '../bgs-battle-info';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData, START_OF_COMBAT_CARD_IDS } from '../cards/cards-data';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tstringifySimple,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport {\r\n\tdealDamageToEnemy,\r\n\tdealDamageToRandomEnemy,\r\n\tgetNeighbours,\r\n\tperformEntitySpawns,\r\n\tprocessMinionDeath,\r\n\tsimulateAttack,\r\n} from './attack';\r\nimport {\r\n\tapplyEarthInvocationEnchantment,\r\n\tapplyFireInvocationEnchantment,\r\n\tapplyLightningInvocationEnchantment,\r\n\tapplyWaterInvocationEnchantment,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const handleStartOfCombat = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// https://twitter.com/DCalkosz/status/1564705111850434561\r\n\tcurrentAttacker = handleStartOfCombatQuestRewards(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// https://twitter.com/DCalkosz/status/1488361384320528388?s=20&t=1ECxRZFdjqwEa2fRsXk32Q\r\n\t// There’s a certain order for Start of Combat hero powers, rather than “coin flips” where\r\n\t// an unlucky trigger order could mess up some positioning you had planned for your own hero\r\n\t// power. “Precombat” (Al’Akir, Y’Shaarj), then Illidan, then others.\r\n\tcurrentAttacker = handlePreCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// Because start of combat powers like Red Whelp's use the board composition before Illidan's strike to know the amount of damage\r\n\tconst playerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\tconst opponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\tcurrentAttacker = handleIllidanHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatMinions(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tplayerBoardBefore,\r\n\t\topponentBoardBefore,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowersForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Some are part of the incoming board: Y'Shaarj, Lich King, Ozumat\r\n\t// Since the order is not important here, we just always do the player first\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.SwattingInsectsBattlegrounds && playerBoard.length > 0) {\r\n\t\t// Should be sent by the app, but it is an idempotent operation, so we can just reapply it here\r\n\t\thandleAlakirForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.EarthInvocationToken) {\r\n\t\tapplyEarthInvocationEnchantment(playerBoard, null, playerEntity, allCards, sharedState, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaterInvocationToken) {\r\n\t\tapplyWaterInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.FireInvocationToken) {\r\n\t\tapplyFireInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t} else if (playerHeroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t\tapplyAllWillBurn(playerBoard, opponentBoard, playerEntity, allCards, spectator);\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// console.log('current attacker before', currentAttacker);\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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} else {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\t// console.log('current attacker after', currentAttacker);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatMinions = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet attackerForStart = currentAttacker;\r\n\tconst playerAttackers = playerBoard.filter((entity) => START_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds));\r\n\tconst opponentAttackers = opponentBoard.filter((entity) =>\r\n\t\tSTART_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds),\r\n\t);\r\n\twhile (playerAttackers.length > 0 || opponentAttackers.length > 0) {\r\n\t\tif (attackerForStart === 0 && playerAttackers.length > 0) {\r\n\t\t\tconst attacker = playerAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length > 0) {\r\n\t\t\tconst attacker = opponentAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t\tattackerForStart = (attackerForStart + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewards = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewardsForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tif (!playerEntity.questRewards?.length) {\r\n\t\treturn currentAttacker;\r\n\t}\r\n\tfor (const reward of playerEntity.questRewards) {\r\n\t\tswitch (reward) {\r\n\t\t\tcase CardIds.EvilTwin:\r\n\t\t\t\tif (!!playerBoard.length && playerBoard.length < 7) {\r\n\t\t\t\t\tconst highestHealthMinion = [...playerBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\t\t\t\tconst copy: BoardEntity = {\r\n\t\t\t\t\t\t...highestHealthMinion,\r\n\t\t\t\t\t\tlastAffectedByEntity: null,\r\n\t\t\t\t\t};\r\n\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\thighestHealthMinion.friendly,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tcopy,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(highestHealthMinion) + 1);\r\n\t\t\t\t\tperformEntitySpawns(\r\n\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\thighestHealthMinion,\r\n\t\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\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\tspectator.registerPowerTarget(playerEntity, copy, playerBoard);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\t\tplayerBoard.forEach((entity) => {\r\n\t\t\t\t\tmodifyAttack(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, playerBoard, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(playerEntity, entity, playerBoard);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StolenGold:\r\n\t\t\t\tif (playerBoard.length > 0) {\r\n\t\t\t\t\tmakeMinionGolden(playerBoard[0], playerEntity, playerBoard, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tif (playerBoard.length > 1) {\r\n\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\tplayerBoard[playerBoard.length - 1],\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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} else {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\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\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\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\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.WingmenBattlegrounds && playerBoard.length > 0) {\r\n\t\thandleIllidanForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = (currentAttacker + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// TODO: not exactly correct, because of \"attack immediately\", but it's close enough\r\nconst handleIllidanForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Otherwise, if the first minion dies on the attack, and the board has only 2 minions, we\r\n\t// miss the second one\r\n\tconst minionsAtStart = playerBoard.length;\r\n\tconst firstAttacker = playerBoard[0];\r\n\tconst secondAttacker = minionsAtStart > 1 ? playerBoard[playerBoard.length - 1] : null;\r\n\r\n\tmodifyAttack(firstAttacker, 2, playerBoard, allCards);\r\n\tmodifyHealth(firstAttacker, 1, playerBoard, allCards);\r\n\tafterStatsUpdate(firstAttacker, playerBoard, allCards);\r\n\tspectator.registerPowerTarget(firstAttacker, firstAttacker, playerBoard);\r\n\tif (\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidariBattlegrounds_TB_BaconShop_HERO_08_Buddy) ||\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidariBattlegrounds_TB_BaconShop_HERO_08_Buddy_G)\r\n\t) {\r\n\t\tfirstAttacker.immuneWhenAttackCharges = 1;\r\n\t}\r\n\tsimulateAttack(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tundefined,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t\t0,\r\n\t);\r\n\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tmodifyAttack(secondAttacker, 2, playerBoard, allCards);\r\n\t\tafterStatsUpdate(secondAttacker, playerBoard, allCards);\r\n\t\tspectator.registerPowerTarget(secondAttacker, secondAttacker, playerBoard);\r\n\t\tif (\r\n\t\t\tplayerBoard\r\n\t\t\t\t.map((e) => e.cardId)\r\n\t\t\t\t.includes(CardIds.EclipsionIllidariBattlegrounds_TB_BaconShop_HERO_08_Buddy_G)\r\n\t\t) {\r\n\t\t\tsecondAttacker.immuneWhenAttackCharges = 1;\r\n\t\t}\r\n\t\tsimulateAttack(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tundefined,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tplayerBoard.length - 1,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst handleAlakirForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst firstEntity = playerBoard[0];\r\n\tfirstEntity.windfury = true;\r\n\tif (!firstEntity.divineShield) {\r\n\t\tupdateDivineShield(firstEntity, playerBoard, true, allCards);\r\n\t}\r\n\tfirstEntity.taunt = true;\r\n\tspectator.registerPowerTarget(firstEntity, firstEntity, playerBoard);\r\n};\r\n\r\nconst handleTamsinForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst lowestHealth = Math.min(...playerBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = playerBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\tif (!chosenEntity) {\r\n\t\tconsole.warn('could not pick any entity for tamsin', stringifySimple(entitiesWithLowestHealth, allCards));\r\n\t\treturn;\r\n\t}\r\n\tconst newBoard = playerBoard.filter((e) => e.entityId !== chosenEntity.entityId);\r\n\t// How to mark the minion as dead\r\n\tchosenEntity.definitelyDead = true;\r\n\tnewBoard.forEach((e) => {\r\n\t\tmodifyAttack(e, chosenEntity.attack, newBoard, allCards);\r\n\t\tmodifyHealth(e, chosenEntity.health, newBoard, allCards);\r\n\t\tafterStatsUpdate(e, newBoard, allCards);\r\n\t\tspectator.registerPowerTarget(chosenEntity, e, newBoard);\r\n\t});\r\n};\r\n\r\nconst handleTeronForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// The board state is snapshot after the minion dies\r\n\tconst deadMinionEntityId = playerEntity.heroPowerInfo;\r\n\tconst minionThatWillDie = playerBoard.find((e) => e.entityId === deadMinionEntityId);\r\n\tif (minionThatWillDie) {\r\n\t\tconst minionIndexFromRight = playerBoard.length - 1 - playerBoard.indexOf(minionThatWillDie);\r\n\t\tplayerEntity.rapidReanimationIndexFromRight = minionIndexFromRight;\r\n\t\tplayerEntity.rapidReanimationMinion = {\r\n\t\t\t...minionThatWillDie,\r\n\t\t\tenchantments: minionThatWillDie.enchantments.map((e) => ({ ...e })) ?? [],\r\n\t\t} as BoardEntity;\r\n\t\tminionThatWillDie.definitelyDead = true;\r\n\t\tspectator.registerPowerTarget(playerEntity, minionThatWillDie, playerBoard);\r\n\t}\r\n};\r\n\r\nconst handleWaxWarbandForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (playerBoard.length > 0) {\r\n\t\t// let tribesGranted = 0;\r\n\t\tlet boardCopy = [...playerBoard];\r\n\t\tlet racesLeft = [...ALL_BG_RACES];\r\n\t\twhile (racesLeft.length > 0) {\r\n\t\t\tconst tribe = pickRandom(racesLeft);\r\n\t\t\tconst validMinion: BoardEntity = getRandomAliveMinion(boardCopy, tribe, allCards);\r\n\t\t\tif (validMinion) {\r\n\t\t\t\tmodifyAttack(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tmodifyHealth(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(validMinion, playerBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(playerEntity, validMinion, playerBoard);\r\n\t\t\t\tboardCopy = boardCopy.filter((e) => e !== validMinion);\r\n\t\t\t\t// tribesGranted++;\r\n\t\t\t} else {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tracesLeft = racesLeft.filter((r) => r !== tribe);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleOzumatForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Because of some interactions between start of combat hero powers, it can happen that Ozumat is already present\r\n\t// on the board when we receive the board state\r\n\tif (\r\n\t\tplayerBoard.length < 7 &&\r\n\t\t!playerBoard.some((e) => e.cardId === CardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt)\r\n\t) {\r\n\t\tconst tentacularSize = playerEntity.heroPowerInfo;\r\n\t\tconst tentacular = spawnEntities(\r\n\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tfriendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\ttentacular[0].attack = tentacularSize;\r\n\t\ttentacular[0].health = tentacularSize;\r\n\t\tconst indexFromRight = 0;\r\n\t\tperformEntitySpawns(\r\n\t\t\ttentacular,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\tspectator.registerPowerTarget(playerEntity, tentacular[0], playerBoard);\r\n\t}\r\n};\r\n\r\nconst handlePlayerStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TamsinRoame_FragrantPhylactery) {\r\n\t\thandleTamsinForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\t// Tamsin's hero power somehow happens before the current attacker is chosen.\r\n\t\t// See http://replays.firestoneapp.com/?reviewId=bce94e6b-c807-48e4-9c72-2c5c04421213&turn=6&action=9\r\n\t\tshouldRecomputeCurrentAttacker = true;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TeronGorefiend_RapidReanimation) {\r\n\t\thandleTeronForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaxWarbandBattlegrounds) {\r\n\t\thandleWaxWarbandForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerHeroPowerId === CardIds.Ozumat_Tentacular) {\r\n\t\thandleOzumatForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tfriendly,\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\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLeftToken) {\r\n\t\tconst target = opponentBoard[0];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimRightToken) {\r\n\t\tconst target = opponentBoard[opponentBoard.length - 1];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLowToken) {\r\n\t\tconst smallestHealthMinion = [...opponentBoard].sort((a, b) => a.health - b.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === smallestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimHighToken) {\r\n\t\tconst highestHealthMinion = [...opponentBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === highestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\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\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.LightningInvocationToken) {\r\n\t\tapplyLightningInvocationEnchantment(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tnull,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\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\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: currentAttacker;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const getHeroPowerForHero = (heroCardId: string): string => {\r\n\tswitch (heroCardId) {\r\n\t\tcase CardIds.IllidanStormrageBattlegrounds:\r\n\t\t\treturn CardIds.WingmenBattlegrounds;\r\n\t\tcase CardIds.TheLichKingBattlegrounds:\r\n\t\t\treturn CardIds.RebornRitesBattlegrounds;\r\n\t\tcase CardIds.ProfessorPutricideBattlegrounds:\r\n\t\t\treturn CardIds.RagePotionBattlegrounds;\r\n\t\tcase CardIds.DeathwingBattlegrounds:\r\n\t\t\treturn CardIds.AllWillBurnBattlegrounds;\r\n\t\tcase CardIds.TeronGorefiend_BG25_HERO_103:\r\n\t\t\treturn CardIds.TeronGorefiend_RapidReanimation;\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nexport const performStartOfCombatMinionsForPlayer = (\r\n\tattacker: BoardEntity,\r\n\tattackingBoard: BoardEntity[],\r\n\tattackingBoardHero: BgsPlayerEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingBoardHero: BgsPlayerEntity,\r\n\t// Apparently, the board composition used for start of combat minion effects (like Red Whelp, and I assume it works the\r\n\t// same way for others like Prized Promo Drake or Mantid Queen) is the one that is used before Illidan's effect is handled.\r\n\t// Since this also runs before HP start of combat, we probably also use the state as it was before HP were triggered, like\r\n\t// Tamsin's Phylactery.\r\n\tattackingBoardBefore: BoardEntity[],\r\n\tdefendingBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Don't forget to update START_OF_COMBAT_CARD_IDS\r\n\tif (attacker.cardId === CardIds.RedWhelp) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\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\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\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} else if (attacker.cardId === CardIds.RedWhelpBattlegrounds) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\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\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\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\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\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} else if (\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrake ||\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrakeBattlegrounds\r\n\t) {\r\n\t\tconst numberOfDragons = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.PrizedPromoDrakeBattlegrounds ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (attacker.cardId === CardIds.ChoralMrrrglr || attacker.cardId === CardIds.ChoralMrrrglrBattlegrounds) {\r\n\t\t// const statsOfMinionsInHand = attackingBoardHero.hand\r\n\t\t// \t.map((c) => (c.attack ?? 0) + (c.health ?? 0))\r\n\t\t// \t.reduce((a, b) => a + b, 0);\r\n\t\tconst multiplier = attacker.cardId === CardIds.ChoralMrrrglrBattlegrounds ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralAttackBuff, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralHealthBuff, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (attacker.cardId === CardIds.AmberGuardian || attacker.cardId === CardIds.AmberGuardianBattlegrounds) {\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\tconst loops = attacker.cardId === CardIds.AmberGuardianBattlegrounds ? 2 : 1;\r\n\t\tconst dragonsToConsider = otherDragons;\r\n\t\tfor (let i = 0; i < loops; i++) {\r\n\t\t\tconst otherDragon =\r\n\t\t\t\tpickRandom(dragonsToConsider.filter((e) => !e.divineShield)) ?? pickRandom(dragonsToConsider);\r\n\t\t\tif (otherDragon) {\r\n\t\t\t\tif (!otherDragon.divineShield) {\r\n\t\t\t\t\tupdateDivineShield(otherDragon, attackingBoard, true, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tmodifyAttack(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tmodifyHealth(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t\t\tdragonsToConsider.splice(dragonsToConsider.indexOf(otherDragon), 1);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (attacker.cardId === CardIds.SanctumRester || attacker.cardId === CardIds.SanctumResterBattlegrounds) {\r\n\t\tconst buff = attacker.cardId === CardIds.SanctumResterBattlegrounds ? 16 : 8;\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\totherDragons.forEach((otherDragon) => {\r\n\t\t\tmodifyHealth(otherDragon, buff, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t});\r\n\t} else if (attacker.cardId === CardIds.Soulsplitter || attacker.cardId === CardIds.SoulsplitterBattlegrounds) {\r\n\t\tconst numberOfTargets = attacker.cardId === CardIds.SoulsplitterBattlegrounds ? 2 : 1;\r\n\t\tfor (let i = 0; i < numberOfTargets; i++) {\r\n\t\t\tconst undeadsWithoutReborn = attackingBoard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => !e.reborn);\r\n\t\t\tconst chosenUndead = pickRandom(undeadsWithoutReborn);\r\n\t\t\tif (chosenUndead) {\r\n\t\t\t\tchosenUndead.reborn = true;\r\n\t\t\t\tspectator.registerPowerTarget(attacker, chosenUndead, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy ||\r\n\t\tattacker.cardId === CardIds.CrabbyBattlegrounds\r\n\t) {\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.CrabbyBattlegrounds ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidon ||\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidonBattlegrounds\r\n\t) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.CorruptedMyrmidonBattlegrounds ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attacker.attack, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attacker.health, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704 ||\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704_G\r\n\t) {\r\n\t\tif (defendingBoard.length > 0) {\r\n\t\t\tconst attackerIndex = attackingBoard.indexOf(attacker);\r\n\t\t\tconst defenderPosition = attackerIndex - (attackingBoard.length - defendingBoard.length) / 2;\r\n\t\t\tif (Math.round(defenderPosition) === defenderPosition) {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition], attacker, attackingBoard, spectator);\r\n\t\t\t} else {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition - 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition + 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (attacker.cardId === CardIds.MantidQueen || attacker.cardId === CardIds.MantidQueenBattlegrounds) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.MantidQueenBattlegrounds ? 2 : 1;\r\n\t\tconst allRaces = attackingBoardBefore\r\n\t\t\t.map((entity) => entity.cardId)\r\n\t\t\t.flatMap((cardId) => allCards.getCard(cardId).races)\r\n\t\t\t.filter((race) => !!race && race !== Race[Race.BLANK]);\r\n\t\tconst totalRaces =\r\n\t\t\t[...new Set(allRaces.filter((race) => race !== Race[Race.ALL]))].length +\r\n\t\t\tallRaces.filter((race) => race === Race[Race.ALL]).length;\r\n\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\tfor (let j = 0; j < totalRaces; j++) {\r\n\t\t\t\tconst buffType = getRandomMantidQueenBuffType(attacker);\r\n\t\t\t\tswitch (buffType) {\r\n\t\t\t\t\tcase 'stats':\r\n\t\t\t\t\t\tmodifyAttack(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tmodifyHealth(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'reborn':\r\n\t\t\t\t\t\tattacker.reborn = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'taunt':\r\n\t\t\t\t\t\tattacker.taunt = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'windfury':\r\n\t\t\t\t\t\tattacker.windfury = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyAllWillBurn = (\r\n\tboard1: BoardEntity[],\r\n\tboard2: BoardEntity[],\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const entity of board1) {\r\n\t\tmodifyAttack(entity, 2, board1, allCards);\r\n\t\tafterStatsUpdate(entity, board1, allCards);\r\n\t\tspectator.registerPowerTarget(sourceEntity, entity, board1);\r\n\t}\r\n\tfor (const entity of board2) {\r\n\t\tmodifyAttack(entity, 2, board2, allCards);\r\n\t\tafterStatsUpdate(entity, board2, allCards);\r\n\t\tspectator.registerPowerTarget(sourceEntity, entity, board2);\r\n\t}\r\n};\r\n\r\nconst castImpure = (entity: BoardEntity, source: BoardEntity, board: BoardEntity[], spectator: Spectator) => {\r\n\tif (!entity) {\r\n\t\treturn;\r\n\t}\r\n\tconst multiplier = source.cardId === CardIds.InterrogatorWhitemane_BG24_704_G ? 3 : 2;\r\n\tentity.taunt = true;\r\n\tentity.damageMultiplier = entity.damageMultiplier ?? 1;\r\n\tentity.damageMultiplier *= multiplier;\r\n\tspectator.registerPowerTarget(source, entity, board);\r\n};\r\n\r\nconst getRandomMantidQueenBuffType = (entity: BoardEntity): 'stats' | 'reborn' | 'windfury' | 'taunt' => {\r\n\tconst possibilities: ('stats' | 'reborn' | 'windfury' | 'taunt')[] = ['stats'];\r\n\tif (!entity.reborn) {\r\n\t\tpossibilities.push('reborn');\r\n\t}\r\n\tif (!entity.windfury) {\r\n\t\tpossibilities.push('windfury');\r\n\t}\r\n\tif (!entity.taunt) {\r\n\t\tpossibilities.push('taunt');\r\n\t}\r\n\treturn pickRandom(possibilities);\r\n};\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestone-hs/simulate-bgs-battle",
3
- "version": "1.1.280",
3
+ "version": "1.1.281",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "lint": "eslint --color --fix --ext .ts .",