@firestone-hs/simulate-bgs-battle 1.1.285 → 1.1.286

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.
@@ -6,7 +6,7 @@ export interface BoardEntity {
6
6
  maxHealth?: number;
7
7
  avengeCurrent?: number;
8
8
  avengeDefault?: number;
9
- frenzyApplied?: boolean;
9
+ frenzyChargesLeft?: number;
10
10
  definitelyDead?: boolean;
11
11
  taunt?: boolean;
12
12
  divineShield?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"board-entity.js","sourceRoot":"","sources":["../src/board-entity.ts"],"names":[],"mappings":"","sourcesContent":["export interface BoardEntity {\r\n\tentityId: number;\r\n\tcardId: string;\r\n\tattack: number;\r\n\thealth: number;\r\n\r\n\tmaxHealth?: number;\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tfrenzyApplied?: boolean;\r\n\tdefinitelyDead?: boolean;\r\n\ttaunt?: boolean;\r\n\tdivineShield?: boolean;\r\n\tpoisonous?: boolean;\r\n\tvenomous?: boolean;\r\n\treborn?: boolean;\r\n\tcleave?: boolean;\r\n\twindfury?: boolean;\r\n\tstealth?: boolean;\r\n\tenchantments?: { cardId: string; originEntityId?: number; timing: number; repeats?: number; value?: number }[];\r\n\tscriptDataNum1?: number;\r\n\t// For Build-An-Undead\r\n\tadditionalCards?: readonly string[] | null;\r\n\r\n\t// We only store the card id, because we want all the attack and other data to be computed at runtime, based on the\r\n\t// current stats of the Fish\r\n\trememberedDeathrattles?: { cardId: string; timing: number; repeats: number }[];\r\n\tdamageMultiplier?: number;\r\n\tsummonedFromHand?: boolean;\r\n\tfriendly?: boolean;\r\n\tcantAttack?: boolean;\r\n\tattacksPerformed?: number;\r\n\timmuneWhenAttackCharges?: number;\r\n\tattackImmediately?: boolean;\r\n\t// Used only to handle murkeye aura?\r\n\tpreviousAttack?: number;\r\n\tlastAffectedByEntity?: BoardEntity;\r\n\tattacking?: boolean;\r\n\t// Did it have divine shield at least once? (for Sinrunner Blanchy)\r\n\thadDivineShield?: boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"board-entity.js","sourceRoot":"","sources":["../src/board-entity.ts"],"names":[],"mappings":"","sourcesContent":["export interface BoardEntity {\r\n\tentityId: number;\r\n\tcardId: string;\r\n\tattack: number;\r\n\thealth: number;\r\n\r\n\tmaxHealth?: number;\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tfrenzyChargesLeft?: number;\r\n\tdefinitelyDead?: boolean;\r\n\ttaunt?: boolean;\r\n\tdivineShield?: boolean;\r\n\tpoisonous?: boolean;\r\n\tvenomous?: boolean;\r\n\treborn?: boolean;\r\n\tcleave?: boolean;\r\n\twindfury?: boolean;\r\n\tstealth?: boolean;\r\n\tenchantments?: { cardId: string; originEntityId?: number; timing: number; repeats?: number; value?: number }[];\r\n\tscriptDataNum1?: number;\r\n\t// For Build-An-Undead\r\n\tadditionalCards?: readonly string[] | null;\r\n\r\n\t// We only store the card id, because we want all the attack and other data to be computed at runtime, based on the\r\n\t// current stats of the Fish\r\n\trememberedDeathrattles?: { cardId: string; timing: number; repeats: number }[];\r\n\tdamageMultiplier?: number;\r\n\tsummonedFromHand?: boolean;\r\n\tfriendly?: boolean;\r\n\tcantAttack?: boolean;\r\n\tattacksPerformed?: number;\r\n\timmuneWhenAttackCharges?: number;\r\n\tattackImmediately?: boolean;\r\n\t// Used only to handle murkeye aura?\r\n\tpreviousAttack?: number;\r\n\tlastAffectedByEntity?: BoardEntity;\r\n\tattacking?: boolean;\r\n\t// Did it have divine shield at least once? (for Sinrunner Blanchy)\r\n\thadDivineShield?: boolean;\r\n}\r\n"]}
@@ -26,7 +26,11 @@ exports.START_OF_COMBAT_CARD_IDS = [
26
26
  "BG26_356",
27
27
  "BG26_356_G",
28
28
  ];
29
- exports.WHELP_CARD_IDS = ["BGS_019", "TB_BaconUps_102", "BG22_HERO_305t"];
29
+ exports.WHELP_CARD_IDS = [
30
+ "BGS_019",
31
+ "TB_BaconUps_102",
32
+ "BG22_HERO_305t",
33
+ ];
30
34
  class CardsData {
31
35
  constructor(allCards, init = true) {
32
36
  this.allCards = allCards;
@@ -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,EAAE,EAAE,CAAC,CAAC,uCAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAa,CAAC,CAAC;aACtE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;aAClC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAA,mBAAW,EAAC,IAAI,EAAE,wBAAO,CAAC,wBAAO,CAAC,WAAW,CAAC,CAAC,CAAC;aAClE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,cAAc,GAAG,IAAA,uBAAe,EAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAC7E,IAAI,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AC;CACD;AA7KD,8BA6KC","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_BG21_002:\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002_G:\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\tcase CardIds.IceSickle:\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:\r\n\t\t\tcase CardIds.PalescaleCrocoliskBattlegrounds:\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_BG21_030:\r\n\t\t\tcase CardIds.BuddingGreenthumb_BG21_030_G:\r\n\t\t\t// case CardIds.FrostwolfLieutenant:\r\n\t\t\t// case CardIds.FrostwolfLieutenantBattlegrounds:\r\n\t\t\tcase CardIds.Onyxia_Broodmother:\r\n\t\t\tcase CardIds.PashmarTheVengeful:\r\n\t\t\tcase CardIds.PashmarTheVengefulBattlegrounds:\r\n\t\t\tcase CardIds.WitchwingNestmatron:\r\n\t\t\tcase CardIds.WitchwingNestmatronBattlegrounds:\r\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007:\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007_G:\r\n\t\t\tcase CardIds.Sisefin_BG21_009:\r\n\t\t\tcase CardIds.Sisefin_BG21_009_G:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031_G:\r\n\t\t\tcase CardIds.ScrapScraper:\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;;;;CAI7B,CAAC;AAEF,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,EAAE,EAAE,CAAC,CAAC,uCAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAa,CAAC,CAAC;aACtE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;aAClC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAA,mBAAW,EAAC,IAAI,EAAE,wBAAO,CAAC,wBAAO,CAAC,WAAW,CAAC,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AAC;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;AA7KD,8BA6KC","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_BG23_012,\r\n\tCardIds.CorruptedMyrmidon_BG23_012_G,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy_G,\r\n\tCardIds.MantidQueen_BG22_402,\r\n\tCardIds.MantidQueen_BG22_402_G,\r\n\tCardIds.PrizedPromoDrake_BG21_014,\r\n\tCardIds.PrizedPromoDrake_BG21_014_G,\r\n\tCardIds.RedWhelp_BGS_019,\r\n\tCardIds.RedWhelp_TB_BaconUps_102,\r\n\tCardIds.AmberGuardian_BG24_500,\r\n\tCardIds.AmberGuardian_BG24_500_G,\r\n\tCardIds.InterrogatorWhitemane_BG24_704,\r\n\tCardIds.InterrogatorWhitemane_BG24_704_G,\r\n\tCardIds.Soulsplitter_BG25_023,\r\n\tCardIds.Soulsplitter_BG25_023_G,\r\n\tCardIds.ChoralMrrrglr_BG26_354,\r\n\tCardIds.ChoralMrrrglr_BG26_354_G,\r\n\tCardIds.SanctumRester_BG26_356,\r\n\tCardIds.SanctumRester_BG26_356_G,\r\n];\r\nexport const WHELP_CARD_IDS = [\r\n\tCardIds.RedWhelp_BGS_019,\r\n\tCardIds.RedWhelp_TB_BaconUps_102,\r\n\tCardIds.Onyxia_OnyxianWhelpToken,\r\n];\r\n\r\nexport class CardsData {\r\n\tpublic ghastcoilerSpawns: readonly string[];\r\n\t// public shredderSpawns: readonly string[];\r\n\tpublic validDeathrattles: readonly string[];\r\n\tpublic impMamaSpawns: readonly string[];\r\n\tpublic demonSpawns: readonly string[];\r\n\tpublic gentleDjinniSpawns: readonly string[];\r\n\t// public festergutSpawns: readonly string[];\r\n\tpublic kilrekSpawns: readonly string[];\r\n\tpublic brannEpicEggSpawns: readonly string[];\r\n\t// public sneedsSpawns: readonly string[];\r\n\t// public treasureChestSpawns: readonly string[];\r\n\tpublic pirateSpawns: readonly string[];\r\n\tpublic beastSpawns: readonly string[];\r\n\tpublic scrapScraperSpawns: readonly string[];\r\n\r\n\tpublic putricidePool1: readonly string[];\r\n\tpublic putricidePool2: readonly string[];\r\n\tpublic putridicePool2ForEternalSummoner: readonly string[];\r\n\r\n\tprivate 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_BGS_044);\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_BGS_121)\r\n\t\t\t.map((card) => card.id);\r\n\t\t// FIXME: just spawn a random undead instead of an Undead Creation\r\n\t\t// this.festergutSpawns = pool\r\n\t\t// \t.filter((card) => !this.isGolden(card))\r\n\t\t// \t.filter((card) => isCorrectTribe(card.races, Race.UNDEAD))\r\n\t\t// \t.filter((card) => card.id !== CardIds.Festergut_BG25_HERO_100_Buddy)\r\n\t\t// \t// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\r\n\t\t// \t.map((card) => card.id);\r\n\t\tthis.kilrekSpawns = 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.Kilrek_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_BG21_002:\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002_G:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014_G:\r\n\t\t\t// Not technically an avenge, but behaves as if\r\n\t\t\tcase CardIds.ShadowyConstruct_BG25_HERO_103_Buddy:\r\n\t\t\tcase CardIds.ShadowyConstruct_BG25_HERO_103_Buddy_G:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157_G:\r\n\t\t\tcase CardIds.IceSickle:\r\n\t\t\t\treturn 1;\r\n\t\t\tcase CardIds.GhoulOfTheFeast_BG25_002:\r\n\t\t\tcase CardIds.GhoulOfTheFeast_BG25_002_G:\r\n\t\t\tcase CardIds.MechanoTank_BG21_023:\r\n\t\t\tcase CardIds.MechanoTank_BG21_023_G:\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001:\r\n\t\t\tcase CardIds.PalescaleCrocolisk_BG21_001_G:\r\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy:\r\n\t\t\tcase CardIds.StormpikeLieutenant_BG22_HERO_003_Buddy_G:\r\n\t\t\tcase CardIds.VanndarStormpike_LeadTheStormpikes:\r\n\t\t\tcase CardIds.Drekthar_LeadTheFrostwolves:\r\n\t\t\t\treturn 2;\r\n\t\t\tcase CardIds.BuddingGreenthumb_BG21_030:\r\n\t\t\tcase CardIds.BuddingGreenthumb_BG21_030_G:\r\n\t\t\t// case CardIds.FrostwolfLieutenant:\r\n\t\t\t// case CardIds.FrostwolfLieutenantBattlegrounds:\r\n\t\t\tcase CardIds.Onyxia_Broodmother:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014_G:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007:\r\n\t\t\tcase CardIds.ImpatientDoomsayer_BG21_007_G:\r\n\t\t\tcase CardIds.Sisefin_BG21_009:\r\n\t\t\tcase CardIds.Sisefin_BG21_009_G:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031:\r\n\t\t\tcase CardIds.TonyTwoTusk_BG21_031_G:\r\n\t\t\tcase CardIds.ScrapScraper_BG26_148:\r\n\t\t\tcase CardIds.ScrapScraper_BG26_148_G:\r\n\t\t\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 +1 @@
1
- {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAGxE,mDAA+C;AAE/C,8CAA2F;AAC3F,sDAAmD;AACnD,gEAA6D;AAC7D,mCAA8C;AAE9C,MAAM,KAAK,GAAG,IAAI,gCAAe,EAAE,CAAC;AAKpC,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAChC,MAAM,SA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AM,EAAE,EAAE,CAAC,CAAC;QAC7B,GAAG,MAAM;QACT,YAAY,EAAE,0BAA0B,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC;KACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEW,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;CAgBhC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAClC,YAA2E,EAC3E,SAA4B,EACoC,EAAE;IAClE,OAAO,YAAY,CAAC,MAAM,CACzB,CAAC,OAAO,EAAE,EAAE,CACX,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAChD,yBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAiB,CAAC,KAAK,CAAC,CAAC,CAC5D,CAAC;AACH,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { setImplicitData, setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nconst cards = new AllCardsService();\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(battleInput.gameState?.validTribes ?? battleInput.options?.validTribes);\r\n\tconst simulationResult = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): SimulationResult => {\r\n\tconst start = Date.now();\r\n\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 5000;\r\n\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst playerInfo = battleInput.playerBoard;\r\n\tconst opponentInfo = battleInput.opponentBoard;\r\n\r\n\tconst playerBoard = playerInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity), friendly: true } as BoardEntity),\r\n\t);\r\n\tconst opponentBoard = opponentInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity), friendly: false } as BoardEntity),\r\n\t);\r\n\t// When using the simulator, the aura is not applied when receiving the board state. When\r\n\tsetMissingAuras(playerBoard, playerInfo.player, opponentInfo.player, cards);\r\n\tsetMissingAuras(opponentBoard, opponentInfo.player, playerInfo.player, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\tsetImplicitData(playerBoard, cardsData);\r\n\tsetImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, true);\r\n\tsetImplicitDataHero(opponentInfo.player, cardsData, false);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: playerInfo.player,\r\n\t\t},\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: opponentInfo.player,\r\n\t\t},\r\n\t} as BgsBattleInfo;\r\n\tconst inputStr = JSON.stringify(inputReady);\r\n\tconst spectator = new Spectator(\r\n\t\tbattleInput.playerBoard.player.cardId,\r\n\t\tbattleInput.playerBoard.player.heroPowerId,\r\n\t\tbattleInput.opponentBoard.player.cardId,\r\n\t\tbattleInput.opponentBoard.player.heroPowerId,\r\n\t);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst simulator = new Simulator(cards, cardsData);\r\n\t\tconst input: BgsBattleInfo = JSON.parse(inputStr);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(\r\n\t\t\tinput.playerBoard.board,\r\n\t\t\tinput.playerBoard.player,\r\n\t\t\tinput.opponentBoard.board,\r\n\t\t\tinput.opponentBoard.player,\r\n\t\t\tinput.gameState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms', battleResult);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\t}\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\t// simulationResult.tiedPercent = checkRounding(Math.round((10 * (100 * simulationResult.tied)) / totalMatches) / 10, simulationResult.tied, totalMatches);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\t100 - simulationResult.lostPercent - simulationResult.wonPercent,\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\tsimulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\tsimulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (simulationResult.averageDamageWon > 0 && simulationResult.averageDamageWon < playerInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage won issue', simulationResult, playerInfo);\r\n\t}\r\n\tif (simulationResult.averageDamageLost > 0 && simulationResult.averageDamageLost < opponentInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage lost issue', simulationResult, opponentInfo);\r\n\t}\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\treturn simulationResult;\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\nconst cleanEnchantments = (board: readonly BoardEntity[]): readonly BoardEntity[] => {\r\n\tconst entityIds = board.map((entity) => entity.entityId);\r\n\treturn board.map((entity) => ({\r\n\t\t...entity,\r\n\t\tenchantments: cleanEnchantmentsForEntity(entity.enchantments, entityIds),\r\n\t}));\r\n};\r\n\r\nexport const validEnchantments = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantmentBattlegrounds,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\t// CardIds.FireInvocation_ElementFireEnchantment, // Attack is doubled, probably no use to keep it\r\n\t// CardIds.WaterInvocation_ElementWaterEnchantment, // +3 health and taunt, same\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n];\r\n\r\nconst cleanEnchantmentsForEntity = (\r\n\tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n\tentityIds: readonly number[],\r\n): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n\treturn enchantments.filter(\r\n\t\t(enchant) =>\r\n\t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n\t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n\t);\r\n};\r\n"]}
1
+ {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAGxE,mDAA+C;AAE/C,8CAA2F;AAC3F,sDAAmD;AACnD,gEAA6D;AAC7D,mCAA8C;AAE9C,MAAM,KAAK,GAAG,IAAI,gCAAe,EAAE,CAAC;AAKpC,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;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AAE,0BAA0B,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC;KACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEW,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;CAgBhC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAClC,YAA2E,EAC3E,SAA4B,EACoC,EAAE;IAClE,OAAO,YAAY,CAAC,MAAM,CACzB,CAAC,OAAO,EAAE,EAAE,CACX,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAChD,yBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAiB,CAAC,KAAK,CAAC,CAAC,CAC5D,CAAC;AACH,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { setImplicitData, setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nconst cards = new AllCardsService();\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(battleInput.gameState?.validTribes ?? battleInput.options?.validTribes);\r\n\tconst simulationResult = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): SimulationResult => {\r\n\tconst start = Date.now();\r\n\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 5000;\r\n\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst playerInfo = battleInput.playerBoard;\r\n\tconst opponentInfo = battleInput.opponentBoard;\r\n\r\n\tconst playerBoard = playerInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity), friendly: true } as BoardEntity),\r\n\t);\r\n\tconst opponentBoard = opponentInfo.board.map(\r\n\t\t(entity) => ({ ...addImpliedMechanics(entity), friendly: false } as BoardEntity),\r\n\t);\r\n\t// When using the simulator, the aura is not applied when receiving the board state. When\r\n\tsetMissingAuras(playerBoard, playerInfo.player, opponentInfo.player, cards);\r\n\tsetMissingAuras(opponentBoard, opponentInfo.player, playerInfo.player, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\tsetImplicitData(playerBoard, cardsData);\r\n\tsetImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, true);\r\n\tsetImplicitDataHero(opponentInfo.player, cardsData, false);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: playerInfo.player,\r\n\t\t},\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: opponentInfo.player,\r\n\t\t},\r\n\t} as BgsBattleInfo;\r\n\tconst inputStr = JSON.stringify(inputReady);\r\n\tconst spectator = new Spectator(\r\n\t\tbattleInput.playerBoard.player.cardId,\r\n\t\tbattleInput.playerBoard.player.heroPowerId,\r\n\t\tbattleInput.opponentBoard.player.cardId,\r\n\t\tbattleInput.opponentBoard.player.heroPowerId,\r\n\t);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst simulator = new Simulator(cards, cardsData);\r\n\t\tconst input: BgsBattleInfo = JSON.parse(inputStr);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(\r\n\t\t\tinput.playerBoard.board,\r\n\t\t\tinput.playerBoard.player,\r\n\t\t\tinput.opponentBoard.board,\r\n\t\t\tinput.opponentBoard.player,\r\n\t\t\tinput.gameState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms', battleResult);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\t}\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\t// simulationResult.tiedPercent = checkRounding(Math.round((10 * (100 * simulationResult.tied)) / totalMatches) / 10, simulationResult.tied, totalMatches);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\t100 - simulationResult.lostPercent - simulationResult.wonPercent,\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\tsimulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\tsimulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (simulationResult.averageDamageWon > 0 && simulationResult.averageDamageWon < playerInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage won issue', simulationResult, playerInfo);\r\n\t}\r\n\tif (simulationResult.averageDamageLost > 0 && simulationResult.averageDamageLost < opponentInfo.player.tavernTier) {\r\n\t\tconsole.warn('average damage lost issue', simulationResult, opponentInfo);\r\n\t}\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\treturn simulationResult;\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\nconst cleanEnchantments = (board: readonly BoardEntity[]): readonly BoardEntity[] => {\r\n\tconst entityIds = board.map((entity) => entity.entityId);\r\n\treturn board.map((entity) => ({\r\n\t\t...entity,\r\n\t\tenchantments: cleanEnchantmentsForEntity(entity.enchantments, entityIds),\r\n\t}));\r\n};\r\n\r\nexport const validEnchantments = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\t// CardIds.FireInvocation_ElementFireEnchantment, // Attack is doubled, probably no use to keep it\r\n\t// CardIds.WaterInvocation_ElementWaterEnchantment, // +3 health and taunt, same\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n];\r\n\r\nconst cleanEnchantmentsForEntity = (\r\n\tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n\tentityIds: readonly number[],\r\n): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n\treturn enchantments.filter(\r\n\t\t(enchant) =>\r\n\t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n\t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n\t);\r\n};\r\n"]}
@@ -93,8 +93,7 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
93
93
  case "TB_BaconShop_HERO_52_Buddy":
94
94
  case "TB_BaconShop_HERO_52_Buddy_G":
95
95
  board.forEach((e) => {
96
- e.attack +=
97
- spawned.cardId === "TB_BaconShop_HERO_52_Buddy_G" ? 6 : 3;
96
+ e.attack += spawned.cardId === "TB_BaconShop_HERO_52_Buddy_G" ? 6 : 3;
98
97
  });
99
98
  break;
100
99
  case "BG21_039":
@@ -181,8 +180,7 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
181
180
  break;
182
181
  case "TB_BaconShop_HERO_52_Buddy":
183
182
  case "TB_BaconShop_HERO_52_Buddy_G":
184
- spawned.attack +=
185
- entity.cardId === "TB_BaconShop_HERO_52_Buddy_G" ? 6 : 3;
183
+ spawned.attack += entity.cardId === "TB_BaconShop_HERO_52_Buddy_G" ? 6 : 3;
186
184
  break;
187
185
  case "BG21_039":
188
186
  case "BG21_039_G":
@@ -276,16 +274,6 @@ const handleAfterSpawnEffects = (board, allSpawned, allCards, spectator) => {
276
274
  const handleAfterSpawnEffect = (board, spawned, allCards, spectator) => {
277
275
  for (const entity of board) {
278
276
  switch (entity.cardId) {
279
- case "EX1_509":
280
- case "TB_BaconUps_011":
281
- const multiplier = entity.cardId === "TB_BaconUps_011" ? 2 : 1;
282
- const buffAmount = multiplier * ((0, utils_1.isCorrectTribe)(allCards.getCard(spawned.cardId).races, reference_data_1.Race.MURLOC) ? 1 : 0);
283
- if (buffAmount > 0) {
284
- (0, utils_1.modifyAttack)(entity, buffAmount, board, allCards);
285
- (0, utils_1.afterStatsUpdate)(entity, board, allCards);
286
- spectator.registerPowerTarget(entity, entity, board);
287
- }
288
- break;
289
277
  case "BG22_401":
290
278
  case "BG22_401_G":
291
279
  const multiplier2 = entity.cardId === "BG22_401_G" ? 2 : 1;
@@ -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;KAC3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;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\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 += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\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.Kathranatir_BG21_039_G:\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.Kathranatir_BG21_039_G ? 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 ? 12 : 6;\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.Kathranatir_BG21_039_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake:\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 ? 12 : 6;\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\t\t\tcase CardIds.HungrySnapjaw:\r\n\t\t\tcase CardIds.HungrySnapjawBattlegrounds:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst snapjawBuff = entity.cardId === CardIds.HungrySnapjawBattlegrounds ? 2 : 1;\r\n\t\t\t\t\tmodifyHealth(entity, snapjawBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
1
+ {"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAOkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACjB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,WAAW,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EA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-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.SproutItOut:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Tinker_TB_BaconShop_HP_015:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\tswitch (spawnedCardId) {\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\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.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 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.MurlocWarleaderLegacy_TB_BaconUps_008:\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.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\t\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.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.LadySinestra_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.Kathranatir_BG21_039_G:\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.Kathranatir_BG21_039_G ? 4 : 2;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\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.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnight_BG25_008_G ? 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_BG26_537:\r\n\t\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 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_BG25_013:\r\n\t\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnoll_BG25_013_G ? 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_BG22_HERO_305_Buddy);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy_G);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack += entity.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot_BGS_071:\r\n\t\t\tcase CardIds.DeflectOBot_TB_BaconUps_123:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBot_TB_BaconUps_123 ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal_BGS_204:\r\n\t\t\tcase CardIds.Bigfernal_TB_BaconUps_304:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.Bigfernal_TB_BaconUps_304 ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear_BGS_021:\r\n\t\t\tcase CardIds.MamaBear_TB_BaconUps_090:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBear_TB_BaconUps_090 ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader_BGS_017:\r\n\t\t\tcase CardIds.PackLeader_TB_BaconUps_086:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeader_TB_BaconUps_086 ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\t// case CardIds.MurlocTidecallerLegacy:\r\n\t\t\t// case CardIds.MurlocTidecallerCore:\r\n\t\t\t// \tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t// \tconst buffAmount =\r\n\t\t\t// \t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t// \tif (buffAmount > 0) {\r\n\t\t\t// \t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t// \t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t// \t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.Swampstriker_BG22_401:\r\n\t\t\tcase CardIds.Swampstriker_BG22_401_G:\r\n\t\t\t\tconst multiplier2 = entity.cardId === CardIds.Swampstriker_BG22_401_G ? 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_BG25_042:\r\n\t\t\tcase CardIds.Felstomper_BG25_042_G:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.Felstomper_BG25_042_G ? 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_BG26_172:\r\n\t\t\tcase CardIds.XyloBones_BG26_172_G:\r\n\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBones_BG26_172_G ? 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_BG26_804:\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804_G:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGod_BG26_804_G ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802:\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlamma_BG26_802_G ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370:\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst snapjawBuff = entity.cardId === CardIds.HungrySnapjaw_BG26_370_G ? 2 : 1;\r\n\t\t\t\t\tmodifyHealth(entity, snapjawBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\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"]}
@@ -106,7 +106,7 @@ const performAttack = (attackingEntity, defendingEntity, attackingBoard, attacki
106
106
  }
107
107
  if (["BG22_001", "BG22_001_G"].includes(attackingEntity.cardId)) {
108
108
  const spawns = (0, deathrattle_spawns_1.spawnEntities)(attackingEntity.cardId === "BG22_001_G"
109
- ? "BG22_001t2_G"
109
+ ? "BG22_001_G"
110
110
  : "BG22_001t2", 1, attackingBoard, attackingBoardHero, defendingBoard, defendingBoardHero, allCards, cardsData, sharedState, spectator, true, true);
111
111
  if (spawns.length > 0) {
112
112
  const sourceIndex = attackingBoard.indexOf(attackingEntity);
@@ -318,7 +318,8 @@ const dealDamageToEnemy = (defendingEntity, defendingBoard, defendingBoardHero,
318
318
  exports.dealDamageToEnemy = dealDamageToEnemy;
319
319
  const getDefendingEntity = (defendingBoard, attackingEntity, ignoreTaunts = false) => {
320
320
  let possibleDefenders;
321
- if (attackingEntity.cardId === "BGS_022" || attackingEntity.cardId === "TB_BaconUps_091") {
321
+ if (attackingEntity.cardId === "BGS_022" ||
322
+ attackingEntity.cardId === "TB_BaconUps_091") {
322
323
  const minAttack = Math.min(...defendingBoard.map((entity) => entity.attack));
323
324
  possibleDefenders = defendingBoard.filter((entity) => entity.attack === minAttack);
324
325
  }
@@ -416,9 +417,9 @@ const bumpEntities = (entity, bumpInto, entityBoard, entityBoardHero, otherBoard
416
417
  }
417
418
  spectator.registerDamageDealt(bumpInto, entity, (entity.damageMultiplier || 1) * bumpInto.attack, entityBoard);
418
419
  entity.lastAffectedByEntity = bumpInto;
419
- if (!entity.frenzyApplied && entity.health > 0 && !entity.definitelyDead) {
420
+ if (entity.frenzyChargesLeft > 0 && entity.health > 0 && !entity.definitelyDead) {
420
421
  (0, frenzy_1.applyFrenzy)(entity, entityBoard, entityBoardHero, allCards, cardsData, sharedState, spectator);
421
- entity.frenzyApplied = true;
422
+ entity.frenzyChargesLeft--;
422
423
  }
423
424
  const entitySpawns = getWheneverEntitySpawns(entity, entityBoard, entityBoardHero, otherBoard, otherHero, allCards, cardsData, sharedState, spectator);
424
425
  if (!!(entitySpawns === null || entitySpawns === void 0 ? void 0 : entitySpawns.length)) {
@@ -491,10 +492,12 @@ const processMinionDeath = (board1, board1Hero, board2, board2Hero, allCards, ca
491
492
  .filter((entity) => (0, utils_2.isFish)(entity))
492
493
  .forEach((entity) => (0, deathrattle_effects_1.rememberDeathrattles)(entity, deadEntities2, cardsData, allCards, sharedState));
493
494
  board1
494
- .filter((entity) => entity.cardId === "BG20_HERO_282_Buddy" || entity.cardId === "BG20_HERO_282_Buddy_G")
495
+ .filter((entity) => entity.cardId === "BG20_HERO_282_Buddy" ||
496
+ entity.cardId === "BG20_HERO_282_Buddy_G")
495
497
  .forEach((entity) => (0, deathrattle_effects_1.applyMonstrosity)(entity, deadEntities1, board1, allCards));
496
498
  board2
497
- .filter((entity) => entity.cardId === "BG20_HERO_282_Buddy" || entity.cardId === "BG20_HERO_282_Buddy_G")
499
+ .filter((entity) => entity.cardId === "BG20_HERO_282_Buddy" ||
500
+ entity.cardId === "BG20_HERO_282_Buddy_G")
498
501
  .forEach((entity) => (0, deathrattle_effects_1.applyMonstrosity)(entity, deadEntities2, board2, allCards));
499
502
  (0, exports.processMinionDeath)(board1, board1Hero, board2, board2Hero, allCards, cardsData, sharedState, spectator);
500
503
  handleAfterMinionsDeaths(board1, deadEntities1, board1Hero, board2, deadEntities2, board2Hero, allCards, cardsData, sharedState, spectator);
@@ -643,7 +646,8 @@ const applyOnBeingAttackedBuffs = (attackerEntity, attackedEntity, defendingBoar
643
646
  spectator.registerPowerTarget(attackedEntity, entity, defendingBoard);
644
647
  });
645
648
  }
646
- if (attackedEntity.cardId === "BG24_300" || attackedEntity.cardId === "BG24_300_G") {
649
+ if (attackedEntity.cardId === "BG24_300" ||
650
+ attackedEntity.cardId === "BG24_300_G") {
647
651
  (0, utils_2.modifyAttack)(attackedEntity, attackedEntity.cardId === "BG24_300_G" ? 2 : 1, defendingBoard, allCards);
648
652
  spectator.registerPowerTarget(attackedEntity, attackedEntity, defendingBoard);
649
653
  }
@@ -744,7 +748,8 @@ const buildBoardAfterRebornSpawns = (boardWithKilledMinion, boardWithKilledMinio
744
748
  const numberOfTriggersForDeathwhisper = Math.min(entitiesFromReborn.length, 1);
745
749
  for (let i = 0; i < numberOfTriggersForDeathwhisper; i++) {
746
750
  boardWithKilledMinion
747
- .filter((e) => e.cardId === "BG25_020" || e.cardId === "BG25_020_G")
751
+ .filter((e) => e.cardId === "BG25_020" ||
752
+ e.cardId === "BG25_020_G")
748
753
  .forEach((e) => {
749
754
  const multiplier = e.cardId === "BG25_020_G" ? 2 : 1;
750
755
  (0, utils_2.addStatsToBoard)(e, boardWithKilledMinion, multiplier * 1, multiplier * 3, allCards, spectator, reference_data_1.Race[reference_data_1.Race.UNDEAD]);