@firestone-hs/simulate-bgs-battle 1.1.252 → 1.1.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cards/cards-data.d.ts +2 -0
- package/dist/cards/cards-data.js +13 -2
- package/dist/cards/cards-data.js.map +1 -1
- package/dist/simulation/attack.d.ts +2 -1
- package/dist/simulation/attack.js +64 -14
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/avenge.js +13 -2
- package/dist/simulation/avenge.js.map +1 -1
- package/dist/simulation/deathrattle-effects.d.ts +1 -1
- package/dist/simulation/deathrattle-effects.js +13 -15
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.js +26 -0
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/dist/simulation/start-of-combat.js +23 -0
- package/dist/simulation/start-of-combat.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,9 +7,11 @@ export declare class CardsData {
|
|
|
7
7
|
validDeathrattles: readonly string[];
|
|
8
8
|
impMamaSpawns: readonly string[];
|
|
9
9
|
gentleDjinniSpawns: readonly string[];
|
|
10
|
+
festergutSpawns: readonly string[];
|
|
10
11
|
kilrekSpawns: readonly string[];
|
|
11
12
|
brannEpicEggSpawns: readonly string[];
|
|
12
13
|
pirateSpawns: readonly string[];
|
|
14
|
+
beastSpawns: readonly string[];
|
|
13
15
|
private minionsForTier;
|
|
14
16
|
constructor(allCards: AllCardsService, init?: boolean);
|
|
15
17
|
inititialize(validTribes?: readonly Race[]): void;
|
package/dist/cards/cards-data.js
CHANGED
|
@@ -58,6 +58,11 @@ class CardsData {
|
|
|
58
58
|
.filter((card) => utils_2.isCorrectTribe(card.races, reference_data_1.Race.ELEMENTAL))
|
|
59
59
|
.filter((card) => card.id !== "BGS_121")
|
|
60
60
|
.map((card) => card.id);
|
|
61
|
+
this.festergutSpawns = pool
|
|
62
|
+
.filter((card) => !this.isGolden(card))
|
|
63
|
+
.filter((card) => utils_2.isCorrectTribe(card.races, reference_data_1.Race.UNDEAD))
|
|
64
|
+
.filter((card) => card.id !== "BG25_HERO_100_Buddy")
|
|
65
|
+
.map((card) => card.id);
|
|
61
66
|
this.kilrekSpawns = pool
|
|
62
67
|
.filter((card) => !this.isGolden(card))
|
|
63
68
|
.filter((card) => utils_2.isCorrectTribe(card.races, reference_data_1.Race.DEMON))
|
|
@@ -71,6 +76,10 @@ class CardsData {
|
|
|
71
76
|
.filter((card) => !this.isGolden(card))
|
|
72
77
|
.filter((card) => utils_2.isCorrectTribe(card.races, reference_data_1.Race.PIRATE))
|
|
73
78
|
.map((card) => card.id);
|
|
79
|
+
this.beastSpawns = pool
|
|
80
|
+
.filter((card) => !this.isGolden(card))
|
|
81
|
+
.filter((card) => utils_2.isCorrectTribe(card.races, reference_data_1.Race.BEAST))
|
|
82
|
+
.map((card) => card.id);
|
|
74
83
|
}
|
|
75
84
|
avengeValue(cardId) {
|
|
76
85
|
switch (cardId) {
|
|
@@ -78,9 +87,9 @@ class CardsData {
|
|
|
78
87
|
case "BG21_002_G":
|
|
79
88
|
case "BG25_014":
|
|
80
89
|
case "BG25_014_G":
|
|
90
|
+
case "BG25_HERO_103_Buddy":
|
|
91
|
+
case "BG25_HERO_103_Buddy_G":
|
|
81
92
|
return 1;
|
|
82
|
-
case "BG22_HERO_002_Buddy":
|
|
83
|
-
case "BG22_HERO_002_Buddy_G":
|
|
84
93
|
case "BG25_002":
|
|
85
94
|
case "BG25_002_G":
|
|
86
95
|
case "BG21_023":
|
|
@@ -93,6 +102,8 @@ class CardsData {
|
|
|
93
102
|
return 2;
|
|
94
103
|
case "BG21_030":
|
|
95
104
|
case "BG21_030_G":
|
|
105
|
+
case "BG22_HERO_002_Buddy":
|
|
106
|
+
case "BG22_HERO_002_Buddy_G":
|
|
96
107
|
case "BG23_014":
|
|
97
108
|
case "BG23_014_G":
|
|
98
109
|
case "BG21_038":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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AC;IAC7D,CAAC;IAEO,QAAQ,CAAC,IAAmB;QACnC,OAAO,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC;IACxC,CAAC;IAEO,YAAY,CAAC,WAA4B,EAAE,KAAwB;QAC1E,IAAI,EAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAA,EAAE;YACnB,OAAO,KAAK,CAAC;SACb;QACD,OAAO,KAAK;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAW,CAAC,IAAI,CAAC,CAAC;aAChC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,qBAAI,CAAC,GAAG,IAAI,EAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,CAAC;CACD;AAxID,8BAwIC","sourcesContent":["import { AllCardsService, CardIds, GameTag, isBattlegroundsCard, Race, ReferenceCard } 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];\r\nexport const WHELP_CARD_IDS = [CardIds.RedWhelp, CardIds.RedWhelpBattlegrounds, CardIds.Onyxia_OnyxianWhelpToken];\r\n\r\nexport class CardsData {\r\n\t// public shredderSpawns: readonly string[];\r\n\tpublic ghastcoilerSpawns: readonly string[];\r\n\tpublic validDeathrattles: readonly string[];\r\n\tpublic impMamaSpawns: readonly string[];\r\n\tpublic gentleDjinniSpawns: 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\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) => !!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)(pool.filter((card) => !this.isGolden(card)));\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) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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) => !card.id.startsWith('TB_BaconUps')) // Ignore golden\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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.impMamaSpawns = 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.ImpMama)\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.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// .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// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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\treturn 1;\r\n\t\t\tcase CardIds.FrostwolfLieutenant:\r\n\t\t\tcase CardIds.FrostwolfLieutenantBattlegrounds:\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\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\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[], races: readonly string[]): boolean {\r\n\t\tif (!races?.length) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn races\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,iEAA2H;AAC3H,6CAAgE;AAChE,oCAAoE;AAEvD,QAAA,wBAAwB,GAAG;;;;;;;;;;;;;;;;;CAiBvC,CAAC;AACW,QAAA,cAAc,GAAG,gDAAmF,CAAC;AAElH,MAAa,SAAS;IAgBrB,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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U,aAAV,UAAU,cAAV,UAAU,GAAI,CAAC,CAAC,CAAC;QAC5D,IAAI,EAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAA,EAAE;YAC5B,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;SAC7F;QACD,aAAO,kBAAU,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CAAC,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,KAAwB;QAC1E,IAAI,EAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAA,EAAE;YACnB,OAAO,KAAK,CAAC;SACb;QACD,OAAO,KAAK;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAW,CAAC,IAAI,CAAC,CAAC;aAChC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,qBAAI,CAAC,GAAG,IAAI,EAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,CAAC;CACD;AAzJD,8BAyJC","sourcesContent":["import { AllCardsService, CardIds, GameTag, isBattlegroundsCard, Race, ReferenceCard } 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];\r\nexport const WHELP_CARD_IDS = [CardIds.RedWhelp, CardIds.RedWhelpBattlegrounds, CardIds.Onyxia_OnyxianWhelpToken];\r\n\r\nexport class CardsData {\r\n\t// public shredderSpawns: readonly string[];\r\n\tpublic ghastcoilerSpawns: readonly string[];\r\n\tpublic validDeathrattles: readonly string[];\r\n\tpublic impMamaSpawns: readonly string[];\r\n\tpublic gentleDjinniSpawns: readonly string[];\r\n\tpublic 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\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) => !!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)(pool.filter((card) => !this.isGolden(card)));\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) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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) => !card.id.startsWith('TB_BaconUps')) // Ignore golden\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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.impMamaSpawns = 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.ImpMama)\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.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// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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\tthis.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// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\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\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\tcase CardIds.FrostwolfLieutenant:\r\n\t\t\tcase 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\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[], races: readonly string[]): boolean {\r\n\t\tif (!races?.length) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn races\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"]}
|
|
@@ -5,7 +5,8 @@ import { CardsData } from '../cards/cards-data';
|
|
|
5
5
|
import { SharedState } from './shared-state';
|
|
6
6
|
import { Spectator } from './spectator/spectator';
|
|
7
7
|
export declare const simulateAttack: (attackingBoard: BoardEntity[], attackingBoardHero: BgsPlayerEntity, defendingBoard: BoardEntity[], defendingBoardHero: BgsPlayerEntity, lastAttackerEntityId: number, allCards: AllCardsService, spawns: CardsData, sharedState: SharedState, spectator: Spectator, forceAttackingEntityIndex?: number) => number;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const findNearestEnemies: (attackingBoard: BoardEntity[], entity: BoardEntity, entityIndexFromRight: number, defendingBoard: BoardEntity[], numberOfTargets: number) => BoardEntity[];
|
|
9
|
+
export declare const getNeighbours: (board: BoardEntity[], entity: BoardEntity, deadEntityIndexFromRight?: number) => readonly BoardEntity[];
|
|
9
10
|
export declare const dealDamageToRandomEnemy: (boardToBeDamaged: BoardEntity[], boardToBeDamagedHero: BgsPlayerEntity, damageSource: BoardEntity, damage: number, boardWithAttackOrigin: BoardEntity[], boardWithAttackOriginHero: BgsPlayerEntity, allCards: AllCardsService, cardsData: CardsData, sharedState: SharedState, spectator: Spectator) => void;
|
|
10
11
|
export declare const dealDamageToEnemy: (defendingEntity: BoardEntity, defendingBoard: BoardEntity[], defendingBoardHero: BgsPlayerEntity, damageSource: BoardEntity, damage: number, boardWithAttackOrigin: BoardEntity[], boardWithAttackOriginHero: BgsPlayerEntity, allCards: AllCardsService, cardsData: CardsData, sharedState: SharedState, spectator: Spectator) => number;
|
|
11
12
|
export declare const getDefendingEntity: (defendingBoard: BoardEntity[], attackingEntity: BoardEntity, ignoreTaunts?: boolean) => BoardEntity;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.performEntitySpawns = exports.applyOnBeingAttackedBuffs = exports.applyOnAttackBuffs = exports.processMinionDeath = exports.bumpEntities = exports.getDefendingEntity = exports.dealDamageToEnemy = exports.dealDamageToRandomEnemy = exports.getNeighbours = exports.simulateAttack = void 0;
|
|
3
|
+
exports.performEntitySpawns = exports.applyOnBeingAttackedBuffs = exports.applyOnAttackBuffs = exports.processMinionDeath = exports.bumpEntities = exports.getDefendingEntity = exports.dealDamageToEnemy = exports.dealDamageToRandomEnemy = exports.getNeighbours = exports.findNearestEnemies = exports.simulateAttack = void 0;
|
|
4
4
|
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
5
|
const utils_1 = require("../services/utils");
|
|
6
6
|
const simulate_bgs_battle_1 = require("../simulate-bgs-battle");
|
|
@@ -214,14 +214,48 @@ const getAttackingEntity = (attackingBoard, lastAttackerIndex) => {
|
|
|
214
214
|
}
|
|
215
215
|
return attackingEntity;
|
|
216
216
|
};
|
|
217
|
-
const
|
|
217
|
+
const findNearestEnemies = (attackingBoard, entity, entityIndexFromRight, defendingBoard, numberOfTargets) => {
|
|
218
|
+
const result = [];
|
|
219
|
+
if (defendingBoard.length > 0) {
|
|
220
|
+
const alreadyDamaged = [];
|
|
221
|
+
const attackerIndex = attackingBoard.length - entityIndexFromRight - 1;
|
|
222
|
+
const targetIndex = attackerIndex - (attackingBoard.length - defendingBoard.length) / 2;
|
|
223
|
+
const pickRandomNearest = () => {
|
|
224
|
+
const possibleTargets = defendingBoard.filter((e) => !e.definitelyDead).filter((e) => !alreadyDamaged.includes(e.entityId));
|
|
225
|
+
if (!possibleTargets.length) {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
const targetGroups = utils_1.groupByFunction((e) => defendingBoard.indexOf(e) - targetIndex)(defendingBoard);
|
|
229
|
+
const distances = Object.keys(targetGroups)
|
|
230
|
+
.map((k) => +k)
|
|
231
|
+
.sort();
|
|
232
|
+
const nearestDistance = distances[0];
|
|
233
|
+
if (nearestDistance != null) {
|
|
234
|
+
const target = utils_1.pickRandom(targetGroups[nearestDistance]);
|
|
235
|
+
alreadyDamaged.push(target === null || target === void 0 ? void 0 : target.entityId);
|
|
236
|
+
return target;
|
|
237
|
+
}
|
|
238
|
+
return null;
|
|
239
|
+
};
|
|
240
|
+
for (let i = 0; i < numberOfTargets; i++) {
|
|
241
|
+
result.push(pickRandomNearest());
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return result.filter((e) => !!e);
|
|
245
|
+
};
|
|
246
|
+
exports.findNearestEnemies = findNearestEnemies;
|
|
247
|
+
const getNeighbours = (board, entity, deadEntityIndexFromRight) => {
|
|
218
248
|
const neighbours = [];
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
|
|
249
|
+
if (deadEntityIndexFromRight != null) {
|
|
250
|
+
const rightNeighbourIndex = board.length - 1 - (deadEntityIndexFromRight - 1);
|
|
251
|
+
const rightNeighbour = board[rightNeighbourIndex];
|
|
252
|
+
if (rightNeighbour) {
|
|
253
|
+
neighbours.push(rightNeighbour);
|
|
222
254
|
}
|
|
223
|
-
|
|
224
|
-
|
|
255
|
+
const leftNeighbourIndex = board.length - 1 - deadEntityIndexFromRight;
|
|
256
|
+
const leftNeighbour = board[leftNeighbourIndex];
|
|
257
|
+
if (leftNeighbour) {
|
|
258
|
+
neighbours.push(leftNeighbour);
|
|
225
259
|
}
|
|
226
260
|
}
|
|
227
261
|
else {
|
|
@@ -635,7 +669,7 @@ const buildBoardAfterDeathrattleSpawns = (boardWithKilledMinion, boardWithKilled
|
|
|
635
669
|
const entitiesFromEnchantments = deathrattle_spawns_1.spawnEntitiesFromEnchantments(deadEntity, boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
636
670
|
const candidateEntities = [...entitiesFromNativeDeathrattle, ...entitiesFromEnchantments];
|
|
637
671
|
exports.performEntitySpawns(candidateEntities, boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
638
|
-
deathrattle_effects_1.handleDeathrattleEffects(boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
672
|
+
deathrattle_effects_1.handleDeathrattleEffects(boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
639
673
|
if ((_a = deadEntity.rememberedDeathrattles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
640
674
|
for (const deathrattle of deadEntity.rememberedDeathrattles) {
|
|
641
675
|
const entityToProcess = {
|
|
@@ -657,21 +691,37 @@ const buildBoardAfterDeathrattleSpawns = (boardWithKilledMinion, boardWithKilled
|
|
|
657
691
|
avenge_1.applyAvengeEffects(deadEntity, deadMinionIndexFromRight2, boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
658
692
|
};
|
|
659
693
|
const buildBoardAfterRebornSpawns = (boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator) => {
|
|
660
|
-
const
|
|
661
|
-
const numberOfReborns = 1 +
|
|
662
|
-
1 * otherEntityCardIds.filter((cardId) => cardId === "TB_BaconShop_HERO_22_Buddy").length +
|
|
663
|
-
2 * otherEntityCardIds.filter((cardId) => cardId === "TB_BaconShop_HERO_22_Buddy_G").length;
|
|
694
|
+
const numberOfReborns = 1;
|
|
664
695
|
if (!deadEntity.cardId) {
|
|
665
696
|
console.error('missing card id for dead entity', utils_2.stringifySimpleCard(deadEntity, allCards), deadEntity);
|
|
666
697
|
}
|
|
667
698
|
let entityToSpawn = null;
|
|
668
699
|
if (deadEntity.cardId === "BG24_005" || deadEntity.cardId === "BG24_005_G") {
|
|
669
|
-
entityToSpawn = {
|
|
700
|
+
entityToSpawn = {
|
|
701
|
+
...deadEntity,
|
|
702
|
+
health: deadEntity.maxHealth,
|
|
703
|
+
divineShield: deadEntity.hadDivineShield,
|
|
704
|
+
reborn: false,
|
|
705
|
+
};
|
|
670
706
|
}
|
|
671
707
|
const entitiesFromReborn = deadEntity.reborn && deadMinionIndexFromRight >= 0
|
|
672
708
|
? deathrattle_spawns_1.spawnEntities(deadEntity.cardId, numberOfReborns, boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator, deadEntity.friendly, false, true, true, entityToSpawn, deadEntity)
|
|
673
709
|
: [];
|
|
674
|
-
exports.performEntitySpawns(entitiesFromReborn, boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
710
|
+
const entitiesThatWereReborn = exports.performEntitySpawns(entitiesFromReborn, boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
711
|
+
const arfus = boardWithKilledMinion
|
|
712
|
+
.filter((e) => e.cardId === "TB_BaconShop_HERO_22_Buddy")
|
|
713
|
+
.map((e) => e.attack)
|
|
714
|
+
.reduce((a, b) => a + b, 0);
|
|
715
|
+
const goldenArfus = boardWithKilledMinion
|
|
716
|
+
.filter((e) => e.cardId === "TB_BaconShop_HERO_22_Buddy_G")
|
|
717
|
+
.map((e) => 2 * e.attack)
|
|
718
|
+
.reduce((a, b) => a + b, 0);
|
|
719
|
+
if (arfus + goldenArfus > 0) {
|
|
720
|
+
entitiesThatWereReborn.forEach((e) => {
|
|
721
|
+
utils_2.modifyAttack(e, arfus + goldenArfus, boardWithKilledMinion, allCards);
|
|
722
|
+
utils_2.afterStatsUpdate(e, boardWithKilledMinion, allCards);
|
|
723
|
+
});
|
|
724
|
+
}
|
|
675
725
|
const numberOfTriggersForDeathwhisper = Math.min(entitiesFromReborn.length, 1);
|
|
676
726
|
for (let i = 0; i < numberOfTriggersForDeathwhisper; i++) {
|
|
677
727
|
boardWithKilledMinion
|