@firestone-hs/simulate-bgs-battle 1.1.467 → 1.1.470
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bgs-player-entity.d.ts +12 -1
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/cards/cards-data.d.ts +0 -1
- package/dist/cards/cards-data.js +18 -50
- package/dist/cards/cards-data.js.map +1 -1
- package/dist/divine-shield.d.ts +6 -0
- package/dist/divine-shield.js +100 -0
- package/dist/divine-shield.js.map +1 -0
- package/dist/input-sanitation.js +3 -2
- package/dist/input-sanitation.js.map +1 -1
- package/dist/simulate-bgs-battle.js +3 -0
- package/dist/simulate-bgs-battle.js.map +1 -1
- package/dist/simulation/add-minion-to-board.d.ts +2 -5
- package/dist/simulation/add-minion-to-board.js +172 -45
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/attack.js +25 -59
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/auras.d.ts +2 -0
- package/dist/simulation/auras.js +60 -23
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/avenge.js +36 -7
- package/dist/simulation/avenge.js.map +1 -1
- package/dist/simulation/battlecries.js +53 -12
- package/dist/simulation/battlecries.js.map +1 -1
- package/dist/simulation/blood-gems.d.ts +2 -2
- package/dist/simulation/blood-gems.js +28 -5
- package/dist/simulation/blood-gems.js.map +1 -1
- package/dist/simulation/cards-in-hand.js +1 -1
- package/dist/simulation/cards-in-hand.js.map +1 -1
- package/dist/simulation/damage-effects.js +14 -2
- package/dist/simulation/damage-effects.js.map +1 -1
- package/dist/simulation/damage-to-hero.d.ts +4 -0
- package/dist/simulation/damage-to-hero.js +8 -0
- package/dist/simulation/damage-to-hero.js.map +1 -0
- package/dist/simulation/death-effects.js +15 -0
- package/dist/simulation/death-effects.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +58 -27
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-orchestration.js +3 -3
- package/dist/simulation/deathrattle-orchestration.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.js +32 -5
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/dist/simulation/frenzy.js +2 -2
- package/dist/simulation/frenzy.js.map +1 -1
- package/dist/simulation/minion-death.d.ts +1 -1
- package/dist/simulation/minion-death.js +47 -9
- package/dist/simulation/minion-death.js.map +1 -1
- package/dist/simulation/on-attack.js +11 -4
- package/dist/simulation/on-attack.js.map +1 -1
- package/dist/simulation/on-being-attacked.js +3 -2
- package/dist/simulation/on-being-attacked.js.map +1 -1
- package/dist/simulation/reborn.js +9 -0
- package/dist/simulation/reborn.js.map +1 -1
- package/dist/simulation/remove-minion-from-board.d.ts +2 -1
- package/dist/simulation/remove-minion-from-board.js +9 -7
- package/dist/simulation/remove-minion-from-board.js.map +1 -1
- package/dist/simulation/spawn-fail.d.ts +4 -0
- package/dist/simulation/spawn-fail.js +28 -0
- package/dist/simulation/spawn-fail.js.map +1 -0
- package/dist/simulation/spawns.js +2 -4
- package/dist/simulation/spawns.js.map +1 -1
- package/dist/simulation/spectator/spectator.d.ts +2 -2
- package/dist/simulation/spectator/spectator.js.map +1 -1
- package/dist/simulation/start-of-combat.js +253 -44
- package/dist/simulation/start-of-combat.js.map +1 -1
- package/dist/simulation/stats.js +2 -2
- package/dist/simulation/stats.js.map +1 -1
- package/dist/simulation/summon-when-space.js +39 -0
- package/dist/simulation/summon-when-space.js.map +1 -1
- package/dist/simulation/utils/golden.d.ts +1 -1
- package/dist/simulation/utils/golden.js +2 -2
- package/dist/simulation/utils/golden.js.map +1 -1
- package/dist/utils.d.ts +7 -8
- package/dist/utils.js +71 -52
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import { BoardSecret } from './board-secret';
|
|
|
3
3
|
export interface BgsPlayerEntity {
|
|
4
4
|
readonly cardId: string;
|
|
5
5
|
readonly nonGhostCardId?: string;
|
|
6
|
-
|
|
6
|
+
hpLeft: number;
|
|
7
7
|
readonly tavernTier: number;
|
|
8
8
|
readonly heroPowerId?: string | undefined | null;
|
|
9
9
|
readonly heroPowerEntityId?: number;
|
|
@@ -24,6 +24,7 @@ export interface BgsPlayerEntity {
|
|
|
24
24
|
}[];
|
|
25
25
|
hand?: BoardEntity[];
|
|
26
26
|
secrets?: BoardSecret[];
|
|
27
|
+
trinkets?: BoardTrinket[];
|
|
27
28
|
avengeCurrent?: number;
|
|
28
29
|
avengeDefault?: number;
|
|
29
30
|
globalInfo?: BgsPlayerGlobalInfo;
|
|
@@ -36,6 +37,7 @@ export interface BgsPlayerEntity {
|
|
|
36
37
|
export interface BgsPlayerGlobalInfo {
|
|
37
38
|
EternalKnightsDeadThisGame?: number;
|
|
38
39
|
UndeadAttackBonus?: number;
|
|
40
|
+
PirateAttackBonus?: number;
|
|
39
41
|
ChoralAttackBuff?: number;
|
|
40
42
|
ChoralHealthBuff?: number;
|
|
41
43
|
FrostlingBonus?: number;
|
|
@@ -45,6 +47,7 @@ export interface BgsPlayerGlobalInfo {
|
|
|
45
47
|
GoldrinnBuffHealth?: number;
|
|
46
48
|
TavernSpellsCastThisGame?: number;
|
|
47
49
|
PiratesPlayedThisGame?: number;
|
|
50
|
+
AstralAutomatonsSummonedThisGame?: number;
|
|
48
51
|
}
|
|
49
52
|
export interface BgsQuestEntity {
|
|
50
53
|
CardId: string;
|
|
@@ -52,3 +55,11 @@ export interface BgsQuestEntity {
|
|
|
52
55
|
ProgressCurrent: number;
|
|
53
56
|
ProgressTotal: number;
|
|
54
57
|
}
|
|
58
|
+
export interface BoardTrinket {
|
|
59
|
+
cardId: string;
|
|
60
|
+
entityId: number;
|
|
61
|
+
scriptDataNum1: number;
|
|
62
|
+
rememberedMinion?: BoardEntity;
|
|
63
|
+
avengeDefault?: number;
|
|
64
|
+
avengeCurrent?: number;
|
|
65
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\nimport { BoardSecret } from './board-secret';\r\n\r\nexport interface BgsPlayerEntity {\r\n\treadonly cardId: string;\r\n\treadonly nonGhostCardId?: string;\r\n\
|
|
1
|
+
{"version":3,"file":"bgs-player-entity.js","sourceRoot":"","sources":["../src/bgs-player-entity.ts"],"names":[],"mappings":"","sourcesContent":["import { BoardEntity } from './board-entity';\r\nimport { BoardSecret } from './board-secret';\r\n\r\nexport interface BgsPlayerEntity {\r\n\treadonly cardId: string;\r\n\treadonly nonGhostCardId?: string;\r\n\thpLeft: number;\r\n\treadonly tavernTier: number;\r\n\r\n\treadonly heroPowerId?: string | undefined | null;\r\n\treadonly heroPowerEntityId?: number;\r\n\treadonly heroPowerUsed: boolean;\r\n\treadonly heroPowerInfo?: number | string;\r\n\theroPowerInfo2?: number;\r\n\t// For Ozumat\r\n\theroPowerActivated?: boolean;\r\n\r\n\tfriendly?: boolean;\r\n\tentityId?: number;\r\n\tquestEntities: BgsQuestEntity[];\r\n\tquestRewards?: string[];\r\n\tquestRewardEntities?: {\r\n\t\tcardId: string;\r\n\t\tentityId: number;\r\n\t\tavengeDefault?: number;\r\n\t\tavengeCurrent?: number;\r\n\t\tscriptDataNum1: number;\r\n\t}[];\r\n\thand?: BoardEntity[];\r\n\tsecrets?: BoardSecret[];\r\n\ttrinkets?: BoardTrinket[];\r\n\tavengeCurrent?: number;\r\n\tavengeDefault?: number;\r\n\tglobalInfo?: BgsPlayerGlobalInfo;\r\n\tstartOfCombatDone?: boolean;\r\n\r\n\tdeadEyeDamageDone?: number;\r\n\trapidReanimationMinion?: BoardEntity;\r\n\trapidReanimationIndexFromLeft?: number;\r\n\trapidReanimationIndexFromRight?: number;\r\n}\r\n\r\nexport interface BgsPlayerGlobalInfo {\r\n\tEternalKnightsDeadThisGame?: number;\r\n\tUndeadAttackBonus?: number;\r\n\tPirateAttackBonus?: number;\r\n\tChoralAttackBuff?: number;\r\n\tChoralHealthBuff?: number;\r\n\tFrostlingBonus?: number;\r\n\tBloodGemAttackBonus?: number;\r\n\tBloodGemHealthBonus?: number;\r\n\tGoldrinnBuffAtk?: number;\r\n\tGoldrinnBuffHealth?: number;\r\n\tTavernSpellsCastThisGame?: number;\r\n\tPiratesPlayedThisGame?: number;\r\n\tAstralAutomatonsSummonedThisGame?: number;\r\n}\r\n\r\nexport interface BgsQuestEntity {\r\n\tCardId: string;\r\n\tRewardDbfId: number;\r\n\tProgressCurrent: number;\r\n\tProgressTotal: number;\r\n}\r\n\r\nexport interface BoardTrinket {\r\n\tcardId: string;\r\n\tentityId: number;\r\n\tscriptDataNum1: number;\r\n\trememberedMinion?: BoardEntity;\r\n\tavengeDefault?: number;\r\n\tavengeCurrent?: number;\r\n}\r\n"]}
|
package/dist/cards/cards-data.js
CHANGED
|
@@ -1,58 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CardsData = exports.WHELP_CARD_IDS =
|
|
3
|
+
exports.CardsData = exports.WHELP_CARD_IDS = void 0;
|
|
4
4
|
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
5
|
const utils_1 = require("../services/utils");
|
|
6
6
|
const utils_2 = require("../utils");
|
|
7
|
-
exports.START_OF_COMBAT_CARD_IDS = [
|
|
8
|
-
"BG23_012",
|
|
9
|
-
"BG23_012_G",
|
|
10
|
-
"BG22_HERO_000_Buddy",
|
|
11
|
-
"BG22_HERO_000_Buddy_G",
|
|
12
|
-
"BG22_402",
|
|
13
|
-
"BG22_402_G",
|
|
14
|
-
"BG21_014",
|
|
15
|
-
"BG21_014_G",
|
|
16
|
-
"BGS_019",
|
|
17
|
-
"TB_BaconUps_102",
|
|
18
|
-
"BG24_500",
|
|
19
|
-
"BG24_500_G",
|
|
20
|
-
"BG24_704",
|
|
21
|
-
"BG24_704_G",
|
|
22
|
-
"BG25_023",
|
|
23
|
-
"BG25_023_G",
|
|
24
|
-
"BG26_354",
|
|
25
|
-
"BG26_354_G",
|
|
26
|
-
"BG26_356",
|
|
27
|
-
"BG26_356_G",
|
|
28
|
-
"BG27_503",
|
|
29
|
-
"BG27_503_G",
|
|
30
|
-
"BG27_079",
|
|
31
|
-
"BG27_079_G",
|
|
32
|
-
"BG28_904",
|
|
33
|
-
"BG28_904_G",
|
|
34
|
-
"BG27_556",
|
|
35
|
-
"BG27_556_G",
|
|
36
|
-
"BG28_573",
|
|
37
|
-
"BG21_HERO_030_Buddy",
|
|
38
|
-
"BG21_HERO_030_Buddy_G",
|
|
39
|
-
"BG29_990",
|
|
40
|
-
"BG29_990_G",
|
|
41
|
-
"BG29_814",
|
|
42
|
-
"BG29_814_G",
|
|
43
|
-
"BG29_810",
|
|
44
|
-
"BG29_810_G",
|
|
45
|
-
"BG29_811",
|
|
46
|
-
"BG29_811_G",
|
|
47
|
-
"BG29_872",
|
|
48
|
-
"BG29_872_G",
|
|
49
|
-
"BG29_875",
|
|
50
|
-
"BG29_875_G",
|
|
51
|
-
"BGDUO_125",
|
|
52
|
-
"BGDUO_125_G",
|
|
53
|
-
"TB_BaconShop_HERO_56_Buddy",
|
|
54
|
-
"TB_BaconShop_HERO_56_Buddy_G",
|
|
55
|
-
];
|
|
56
7
|
exports.WHELP_CARD_IDS = [
|
|
57
8
|
"BGS_019",
|
|
58
9
|
"TB_BaconUps_102",
|
|
@@ -152,6 +103,8 @@ class CardsData {
|
|
|
152
103
|
case "BG27_029_G":
|
|
153
104
|
case "BG28_967":
|
|
154
105
|
case "BG28_967_G":
|
|
106
|
+
case "BG30_MagicItem_864":
|
|
107
|
+
case "BG30_MagicItem_545":
|
|
155
108
|
return 3;
|
|
156
109
|
case "BG22_HERO_305p":
|
|
157
110
|
case "BG21_007":
|
|
@@ -170,9 +123,12 @@ class CardsData {
|
|
|
170
123
|
case "BG28_740_G":
|
|
171
124
|
case "BG29_991":
|
|
172
125
|
case "BG29_991_G":
|
|
126
|
+
case "BG30_MagicItem_410":
|
|
127
|
+
case "BG30_MagicItem_410t2":
|
|
173
128
|
return 4;
|
|
174
129
|
case "BG27_010":
|
|
175
130
|
case "BG27_010_G":
|
|
131
|
+
case "BG30_MagicItem_437":
|
|
176
132
|
return 5;
|
|
177
133
|
case "BG28_Reward_518":
|
|
178
134
|
return 7;
|
|
@@ -182,7 +138,19 @@ class CardsData {
|
|
|
182
138
|
defaultScriptDataNum(cardId) {
|
|
183
139
|
switch (cardId) {
|
|
184
140
|
case "BG28_Reward_505":
|
|
141
|
+
case "BG30_MagicItem_822":
|
|
142
|
+
case "BG30_MagicItem_440":
|
|
143
|
+
case "BG30_MagicItem_433":
|
|
144
|
+
case "BG30_MagicItem_433t":
|
|
185
145
|
return 1;
|
|
146
|
+
case "BG30_MagicItem_822t2":
|
|
147
|
+
case "BG30_MagicItem_546":
|
|
148
|
+
return 2;
|
|
149
|
+
case "BG30_MagicItem_910":
|
|
150
|
+
case "BG30_MagicItem_442":
|
|
151
|
+
return 3;
|
|
152
|
+
case "BG30_MagicItem_886":
|
|
153
|
+
return 4;
|
|
186
154
|
default:
|
|
187
155
|
return 0;
|
|
188
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cards-data.js","sourceRoot":"","sources":["../../src/cards/cards-data.ts"],"names":[],"mappings":";;;AAAA,iEASsC;AACtC,6CAAgE;AAChE,oCAAoE;AAEvD,QAAA,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDvC,CAAC;AACW,QAAA,cAAc,GAAG;;;;CAI7B,CAAC;AAEF,MAAa,SAAS;IAwBrB,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,EAAE,SAA6B;QAC/E,MAA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AX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,CAAC;CACD;AAzND,8BAyNC","sourcesContent":["import {\r\n\tAllCardsService,\r\n\tCardIds,\r\n\tCardType,\r\n\tGameTag,\r\n\tisBattlegroundsCard,\r\n\tNON_BUYABLE_MINION_IDS,\r\n\tRace,\r\n\tReferenceCard,\r\n} from '@firestone-hs/reference-data';\r\nimport { groupByFunction, pickRandom } from '../services/utils';\r\nimport { getRaceEnum, hasMechanic, isCorrectTribe } from '../utils';\r\n\r\nexport const START_OF_COMBAT_CARD_IDS = [\r\n\tCardIds.CorruptedMyrmidon_BG23_012,\r\n\tCardIds.CorruptedMyrmidon_BG23_012_G,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy,\r\n\tCardIds.Crabby_BG22_HERO_000_Buddy_G,\r\n\tCardIds.MantidQueen_BG22_402,\r\n\tCardIds.MantidQueen_BG22_402_G,\r\n\tCardIds.PrizedPromoDrake_BG21_014,\r\n\tCardIds.PrizedPromoDrake_BG21_014_G,\r\n\tCardIds.RedWhelp_BGS_019,\r\n\tCardIds.RedWhelp_TB_BaconUps_102,\r\n\tCardIds.AmberGuardian_BG24_500,\r\n\tCardIds.AmberGuardian_BG24_500_G,\r\n\tCardIds.InterrogatorWhitemane_BG24_704,\r\n\tCardIds.InterrogatorWhitemane_BG24_704_G,\r\n\tCardIds.Soulsplitter_BG25_023,\r\n\tCardIds.Soulsplitter_BG25_023_G,\r\n\tCardIds.ChoralMrrrglr_BG26_354,\r\n\tCardIds.ChoralMrrrglr_BG26_354_G,\r\n\tCardIds.SanctumRester_BG26_356,\r\n\tCardIds.SanctumRester_BG26_356_G,\r\n\tCardIds.CarbonicCopy_BG27_503,\r\n\tCardIds.CarbonicCopy_BG27_503_G,\r\n\tCardIds.HawkstriderHerald_BG27_079,\r\n\tCardIds.HawkstriderHerald_BG27_079_G,\r\n\tCardIds.AudaciousAnchor_BG28_904,\r\n\tCardIds.AudaciousAnchor_BG28_904_G,\r\n\tCardIds.DiremuckForager_BG27_556,\r\n\tCardIds.DiremuckForager_BG27_556_G,\r\n\tCardIds.UpperHand_BG28_573,\r\n\tCardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy,\r\n\tCardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy_G,\r\n\tCardIds.IrateRooster_BG29_990,\r\n\tCardIds.IrateRooster_BG29_990_G,\r\n\tCardIds.MisfitDragonling_BG29_814,\r\n\tCardIds.MisfitDragonling_BG29_814_G,\r\n\tCardIds.ThousandthPaperDrake_BG29_810,\r\n\tCardIds.ThousandthPaperDrake_BG29_810_G,\r\n\tCardIds.YulonFortuneGranter_BG29_811,\r\n\tCardIds.YulonFortuneGranter_BG29_811_G,\r\n\tCardIds.HoardingHatespawn_BG29_872,\r\n\tCardIds.HoardingHatespawn_BG29_872_G,\r\n\tCardIds.TheUninvitedGuest_BG29_875,\r\n\tCardIds.TheUninvitedGuest_BG29_875_G,\r\n\tCardIds.Sandy_BGDUO_125,\r\n\tCardIds.Sandy_BGDUO_125_G,\r\n\tCardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy,\r\n\tCardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_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 battlecryMinions: readonly string[];\r\n\tpublic deathrattleMinions: readonly string[];\r\n\t// public sneedsSpawns: readonly string[];\r\n\t// public treasureChestSpawns: readonly string[];\r\n\tpublic pirateSpawns: readonly string[];\r\n\tpublic beastSpawns: readonly string[];\r\n\tpublic scrapScraperSpawns: readonly string[];\r\n\r\n\tpublic putricidePool1: readonly string[];\r\n\tpublic putricidePool2: readonly string[];\r\n\tpublic putridicePool2ForEternalSummoner: readonly string[];\r\n\r\n\tprivate pool: readonly ReferenceCard[];\r\n\tprivate minionsForTier: { [key: string]: readonly ReferenceCard[] };\r\n\r\n\tconstructor(private readonly allCards: AllCardsService, init = true) {\r\n\t\tif (init) {\r\n\t\t\tthis.inititialize();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic inititialize(validTribes?: readonly Race[], anomalies?: readonly string[]): void {\r\n\t\tconst poolWithoutGolden = this.allCards\r\n\t\t\t.getCards()\r\n\t\t\t.filter((card) => isBattlegroundsCard(card))\r\n\t\t\t.filter((card) => !NON_BUYABLE_MINION_IDS.includes(card.id as CardIds))\r\n\t\t\t.filter((card) => !!card.techLevel)\r\n\t\t\t.filter((card) => card.type?.toUpperCase() === CardType[CardType.MINION])\r\n\t\t\t.filter((card) => !hasMechanic(card, GameTag[GameTag.BACON_BUDDY]))\r\n\t\t\t.filter((card) => card.set !== 'Vanilla')\r\n\t\t\t.filter((card) =>\r\n\t\t\t\tanomalies?.includes(CardIds.BigLeague_BG27_Anomaly_100)\r\n\t\t\t\t\t? card.techLevel >= 3\r\n\t\t\t\t\t: anomalies?.includes(CardIds.LittleLeague_BG27_Anomaly_800)\r\n\t\t\t\t\t? card.techLevel <= 4\r\n\t\t\t\t\t: true,\r\n\t\t\t);\r\n\t\tthis.pool = poolWithoutGolden\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.filter((card) =>\r\n\t\t\t\tanomalies?.includes(CardIds.TheGoldenArena_BG27_Anomaly_801)\r\n\t\t\t\t\t? this.isGolden(card)\r\n\t\t\t\t\t: !this.isGolden(card),\r\n\t\t\t);\r\n\t\tthis.minionsForTier = groupByFunction((card: ReferenceCard) => card.techLevel)(this.pool);\r\n\t\tthis.ghastcoilerSpawns = this.pool\r\n\t\t\t.filter((card) => card.id !== 'BGS_008')\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.validDeathrattles = poolWithoutGolden\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.demonSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.DEMON)).map((card) => card.id);\r\n\t\tthis.impMamaSpawns = this.demonSpawns.filter((cardId) => cardId !== CardIds.ImpMama_BGS_044);\r\n\t\tthis.gentleDjinniSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.ELEMENTAL))\r\n\t\t\t.filter((card) => card.id !== CardIds.GentleDjinni_BGS_121)\r\n\t\t\t.map((card) => card.id);\r\n\t\t// FIXME: just spawn a random undead instead of an Undead Creation\r\n\t\t// this.festergutSpawns = pool\r\n\t\t// \t.filter((card) => !this.isGolden(card))\r\n\t\t// \t.filter((card) => isCorrectTribe(card.races, Race.UNDEAD))\r\n\t\t// \t.filter((card) => card.id !== CardIds.Festergut_BG25_HERO_100_Buddy)\r\n\t\t// \t// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\r\n\t\t// \t.map((card) => card.id);\r\n\t\tthis.kilrekSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.filter((card) => card.id !== CardIds.Kilrek_TB_BaconShop_HERO_37_Buddy)\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.battlecryMinions = this.pool.filter((card) => hasMechanic(card, 'BATTLECRY')).map((card) => card.id);\r\n\t\tthis.deathrattleMinions = this.pool\r\n\t\t\t.filter((card) => hasMechanic(card, GameTag[GameTag.DEATHRATTLE]))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.pirateSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.PIRATE)).map((card) => card.id);\r\n\t\tthis.beastSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.BEAST)).map((card) => card.id);\r\n\t\tthis.scrapScraperSpawns = this.pool\r\n\t\t\t.filter((card) => hasMechanic(card, GameTag[GameTag.MAGNETIC]))\r\n\t\t\t.map((card) => card.id);\r\n\r\n\t\tthis.putricidePool1 = this.pool.filter((card) => card.battlegroundsPutridicePool1).map((card) => card.id);\r\n\t\tthis.putricidePool2 = this.pool.filter((card) => card.battlegroundsPutridicePool2).map((card) => card.id);\r\n\t\tthis.putridicePool2ForEternalSummoner = this.pool\r\n\t\t\t.filter((card) => card.battlegroundsPutridicePool2)\r\n\t\t\t.filter((card) => !card.battlegroundsPutridiceSummonerExclusion)\r\n\t\t\t.map((card) => card.id);\r\n\t}\r\n\r\n\tpublic avengeValue(cardId: string): number {\r\n\t\tswitch (cardId) {\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002:\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002_G:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014_G:\r\n\t\t\t// Not technically an avenge, but behaves as if\r\n\t\t\t// case CardIds.ShadowyConstruct_BG25_HERO_103_Buddy:\r\n\t\t\t// case CardIds.ShadowyConstruct_BG25_HERO_103_Buddy_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\tcase CardIds.Bristlebach_BG26_157:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157_G:\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.PashmarTheVengeful_BG23_014:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014_G:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029_G:\r\n\t\t\tcase CardIds.TremblingTrolley_BG28_967:\r\n\t\t\tcase CardIds.TremblingTrolley_BG28_967_G:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.Onyxia_Broodmother:\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\t// case CardIds.ScrapScraper_BG26_148:\r\n\t\t\t// case CardIds.ScrapScraper_BG26_148_G:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003_G:\r\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403:\r\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403_G:\r\n\t\t\tcase CardIds.TumblingDisaster_BG28_Reward_505:\r\n\t\t\tcase CardIds.CycleOfEnergy_BG28_Reward_504:\r\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740:\r\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740_G:\r\n\t\t\tcase CardIds.MurglMkIi_BG29_991:\r\n\t\t\tcase CardIds.MurglMkIi_BG29_991_G:\r\n\t\t\t\treturn 4;\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010:\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010_G:\r\n\t\t\t\treturn 5;\r\n\t\t\tcase CardIds.StableAmalgamation_BG28_Reward_518:\r\n\t\t\t\treturn 7;\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tpublic defaultScriptDataNum(cardId: string): number {\r\n\t\tswitch (cardId) {\r\n\t\t\tcase CardIds.TumblingDisaster_BG28_Reward_505:\r\n\t\t\t\treturn 1;\r\n\t\t\tdefault:\r\n\t\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic getTavernLevel(cardId: string): number {\r\n\t\treturn this.allCards.getCard(cardId).techLevel ?? 1;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTavernTier(tavernTier: number): string {\r\n\t\t// Tzvern tier can be undefined for hero-power specific tokens, like the Amalgam, or when\r\n\t\t// for some reason tokens end up in the shop. For now, defaulting to 1 for tavern\r\n\t\t// level seems to work in all cases\r\n\t\tconst minionsForTier = this.minionsForTier[tavernTier ?? 1];\r\n\t\tif (!minionsForTier?.length) {\r\n\t\t\tconsole.error('incorrect minions for tier', tavernTier, this.minionsForTier, minionsForTier);\r\n\t\t}\r\n\t\treturn pickRandom(this.minionsForTier[tavernTier ?? 1])?.id;\r\n\t}\r\n\r\n\tpublic getRandomMechToMagnetize(tavernLimitUpper: number): string {\r\n\t\tconst magneticMechs = this.pool\r\n\t\t\t.filter((m) => m.type?.toUpperCase() === CardType[CardType.MINION])\r\n\t\t\t.filter((m) => hasMechanic(m, GameTag[GameTag.MODULAR]));\r\n\t\tconst pool = magneticMechs.filter((m) => m.techLevel <= tavernLimitUpper);\r\n\t\treturn pickRandom(pool)?.id;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTribe(tribe: Race, tavernLimitUpper: number): string {\r\n\t\tconst pool = this.pool\r\n\t\t\t.filter((m) => this.isValidTribe([tribe], m.races, false))\r\n\t\t\t.filter((m) => m.type?.toUpperCase() === CardType[CardType.MINION])\r\n\t\t\t.filter((m) => m.techLevel <= tavernLimitUpper);\r\n\t\treturn pickRandom(pool)?.id;\r\n\t}\r\n\r\n\tpublic 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[], allowEmptyRaces = true): boolean {\r\n\t\tif (!cardRaces?.length && allowEmptyRaces) {\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,iEASsC;AACtC,6CAAgE;AAChE,oCAAoE;AAEvD,QAAA,cAAc,GAAG;;;;CAI7B,CAAC;AAEF,MAAa,SAAS;IAwBrB,YAA6B,QAAyB,EAAE,IAAI,GAAG,IAAI;QAAtC,aAAQ,GAAR,QAAQ,CAAiB;QACrD,IAAI,IAAI,EAAE;YACT,IAAI,CAAC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T,SAAS,CAAE,MAAM,CAAA,IAAI,eAAe,EAAE;YAC1C,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;aACtB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;aAChC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,qBAAI,CAAC,GAAG,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,CAAC;CACD;AA1OD,8BA0OC","sourcesContent":["import {\r\n\tAllCardsService,\r\n\tCardIds,\r\n\tCardType,\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 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 battlecryMinions: readonly string[];\r\n\tpublic deathrattleMinions: readonly string[];\r\n\t// public sneedsSpawns: readonly string[];\r\n\t// public treasureChestSpawns: readonly string[];\r\n\tpublic pirateSpawns: readonly string[];\r\n\tpublic beastSpawns: readonly string[];\r\n\tpublic scrapScraperSpawns: readonly string[];\r\n\r\n\tpublic putricidePool1: readonly string[];\r\n\tpublic putricidePool2: readonly string[];\r\n\tpublic putridicePool2ForEternalSummoner: readonly string[];\r\n\r\n\tprivate pool: readonly ReferenceCard[];\r\n\tprivate minionsForTier: { [key: string]: readonly ReferenceCard[] };\r\n\r\n\tconstructor(private readonly allCards: AllCardsService, init = true) {\r\n\t\tif (init) {\r\n\t\t\tthis.inititialize();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic inititialize(validTribes?: readonly Race[], anomalies?: readonly string[]): void {\r\n\t\tconst poolWithoutGolden = this.allCards\r\n\t\t\t.getCards()\r\n\t\t\t.filter((card) => isBattlegroundsCard(card))\r\n\t\t\t.filter((card) => !NON_BUYABLE_MINION_IDS.includes(card.id as CardIds))\r\n\t\t\t.filter((card) => !!card.techLevel)\r\n\t\t\t.filter((card) => card.type?.toUpperCase() === CardType[CardType.MINION])\r\n\t\t\t.filter((card) => !hasMechanic(card, GameTag[GameTag.BACON_BUDDY]))\r\n\t\t\t.filter((card) => card.set !== 'Vanilla')\r\n\t\t\t.filter((card) =>\r\n\t\t\t\tanomalies?.includes(CardIds.BigLeague_BG27_Anomaly_100)\r\n\t\t\t\t\t? card.techLevel >= 3\r\n\t\t\t\t\t: anomalies?.includes(CardIds.LittleLeague_BG27_Anomaly_800)\r\n\t\t\t\t\t? card.techLevel <= 4\r\n\t\t\t\t\t: true,\r\n\t\t\t);\r\n\t\tthis.pool = poolWithoutGolden\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.filter((card) =>\r\n\t\t\t\tanomalies?.includes(CardIds.TheGoldenArena_BG27_Anomaly_801)\r\n\t\t\t\t\t? this.isGolden(card)\r\n\t\t\t\t\t: !this.isGolden(card),\r\n\t\t\t);\r\n\t\tthis.minionsForTier = groupByFunction((card: ReferenceCard) => card.techLevel)(this.pool);\r\n\t\tthis.ghastcoilerSpawns = this.pool\r\n\t\t\t.filter((card) => card.id !== 'BGS_008')\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.validDeathrattles = poolWithoutGolden\r\n\t\t\t.filter((card) => hasMechanic(card, 'DEATHRATTLE'))\r\n\t\t\t.filter((card) => this.isValidTribe(validTribes, card.races))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.demonSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.DEMON)).map((card) => card.id);\r\n\t\tthis.impMamaSpawns = this.demonSpawns.filter((cardId) => cardId !== CardIds.ImpMama_BGS_044);\r\n\t\tthis.gentleDjinniSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.ELEMENTAL))\r\n\t\t\t.filter((card) => card.id !== CardIds.GentleDjinni_BGS_121)\r\n\t\t\t.map((card) => card.id);\r\n\t\t// FIXME: just spawn a random undead instead of an Undead Creation\r\n\t\t// this.festergutSpawns = pool\r\n\t\t// \t.filter((card) => !this.isGolden(card))\r\n\t\t// \t.filter((card) => isCorrectTribe(card.races, Race.UNDEAD))\r\n\t\t// \t.filter((card) => card.id !== CardIds.Festergut_BG25_HERO_100_Buddy)\r\n\t\t// \t// .filter((card) => REMOVED_CARD_IDS.indexOf(card.id) === -1)\r\n\t\t// \t.map((card) => card.id);\r\n\t\tthis.kilrekSpawns = this.pool\r\n\t\t\t.filter((card) => isCorrectTribe(card.races, Race.DEMON))\r\n\t\t\t.filter((card) => card.id !== CardIds.Kilrek_TB_BaconShop_HERO_37_Buddy)\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.battlecryMinions = this.pool.filter((card) => hasMechanic(card, 'BATTLECRY')).map((card) => card.id);\r\n\t\tthis.deathrattleMinions = this.pool\r\n\t\t\t.filter((card) => hasMechanic(card, GameTag[GameTag.DEATHRATTLE]))\r\n\t\t\t.map((card) => card.id);\r\n\t\tthis.pirateSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.PIRATE)).map((card) => card.id);\r\n\t\tthis.beastSpawns = this.pool.filter((card) => isCorrectTribe(card.races, Race.BEAST)).map((card) => card.id);\r\n\t\tthis.scrapScraperSpawns = this.pool\r\n\t\t\t.filter((card) => hasMechanic(card, GameTag[GameTag.MAGNETIC]))\r\n\t\t\t.map((card) => card.id);\r\n\r\n\t\tthis.putricidePool1 = this.pool.filter((card) => card.battlegroundsPutridicePool1).map((card) => card.id);\r\n\t\tthis.putricidePool2 = this.pool.filter((card) => card.battlegroundsPutridicePool2).map((card) => card.id);\r\n\t\tthis.putridicePool2ForEternalSummoner = this.pool\r\n\t\t\t.filter((card) => card.battlegroundsPutridicePool2)\r\n\t\t\t.filter((card) => !card.battlegroundsPutridiceSummonerExclusion)\r\n\t\t\t.map((card) => card.id);\r\n\t}\r\n\r\n\tpublic avengeValue(cardId: string): number {\r\n\t\tswitch (cardId) {\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002:\r\n\t\t\tcase CardIds.BirdBuddy_BG21_002_G:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014:\r\n\t\t\tcase CardIds.HungeringAbomination_BG25_014_G:\r\n\t\t\t// Not technically an avenge, but behaves as if\r\n\t\t\t// case CardIds.ShadowyConstruct_BG25_HERO_103_Buddy:\r\n\t\t\t// case CardIds.ShadowyConstruct_BG25_HERO_103_Buddy_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\tcase CardIds.Bristlebach_BG26_157:\r\n\t\t\tcase CardIds.Bristlebach_BG26_157_G:\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.PashmarTheVengeful_BG23_014:\r\n\t\t\tcase CardIds.PashmarTheVengeful_BG23_014_G:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038:\r\n\t\t\tcase CardIds.WitchwingNestmatron_BG21_038_G:\r\n\t\t\tcase CardIds.BoomSquad_BG27_Reward_502:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029:\r\n\t\t\tcase CardIds.ChampionOfThePrimus_BG27_029_G:\r\n\t\t\tcase CardIds.TremblingTrolley_BG28_967:\r\n\t\t\tcase CardIds.TremblingTrolley_BG28_967_G:\r\n\t\t\tcase CardIds.GilneanThornedRose_BG30_MagicItem_864:\r\n\t\t\tcase CardIds.FridgeMagnet_BG30_MagicItem_545:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.Onyxia_Broodmother:\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\t// case CardIds.ScrapScraper_BG26_148:\r\n\t\t\t// case CardIds.ScrapScraper_BG26_148_G:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003:\r\n\t\t\tcase CardIds.RelentlessSentry_BG25_003_G:\r\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403:\r\n\t\t\tcase CardIds.PhaerixWrathOfTheSun_BG28_403_G:\r\n\t\t\tcase CardIds.TumblingDisaster_BG28_Reward_505:\r\n\t\t\tcase CardIds.CycleOfEnergy_BG28_Reward_504:\r\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740:\r\n\t\t\tcase CardIds.AugmentedLaborer_BG28_740_G:\r\n\t\t\tcase CardIds.MurglMkIi_BG29_991:\r\n\t\t\tcase CardIds.MurglMkIi_BG29_991_G:\r\n\t\t\tcase CardIds.QuilligraphySet_BG30_MagicItem_410:\r\n\t\t\tcase CardIds.QuilligraphySet_QuilligraphySetToken_BG30_MagicItem_410t2:\r\n\t\t\t\treturn 4;\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010:\r\n\t\t\tcase CardIds.RelentlessMurghoul_BG27_010_G:\r\n\t\t\tcase CardIds.StaffOfTheScourge_BG30_MagicItem_437:\r\n\t\t\t\treturn 5;\r\n\t\t\tcase CardIds.StableAmalgamation_BG28_Reward_518:\r\n\t\t\t\treturn 7;\r\n\t\t}\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tpublic defaultScriptDataNum(cardId: string): number {\r\n\t\tswitch (cardId) {\r\n\t\t\tcase CardIds.TumblingDisaster_BG28_Reward_505:\r\n\t\t\tcase CardIds.TwinSkyLanterns_BG30_MagicItem_822:\r\n\t\t\tcase CardIds.BoomController_BG30_MagicItem_440:\r\n\t\t\tcase CardIds.AllianceKeychain_BG30_MagicItem_433:\r\n\t\t\tcase CardIds.AllianceKeychain_AllianceKeychainToken_BG30_MagicItem_433t:\r\n\t\t\t\treturn 1;\r\n\t\t\tcase CardIds.TwinSkyLanterns_TwinSkyLanternsToken_BG30_MagicItem_822t2:\r\n\t\t\tcase CardIds.JarOGems_BG30_MagicItem_546:\r\n\t\t\t\treturn 2;\r\n\t\t\tcase CardIds.MechagonAdapter_BG30_MagicItem_910:\r\n\t\t\tcase CardIds.BloodGolemSticker_BG30_MagicItem_442:\r\n\t\t\t\treturn 3;\r\n\t\t\tcase CardIds.ReinforcedShield_BG30_MagicItem_886:\r\n\t\t\t\treturn 4;\r\n\t\t\tdefault:\r\n\t\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic getTavernLevel(cardId: string): number {\r\n\t\treturn this.allCards.getCard(cardId).techLevel ?? 1;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTavernTier(tavernTier: number): string {\r\n\t\t// Tzvern tier can be undefined for hero-power specific tokens, like the Amalgam, or when\r\n\t\t// for some reason tokens end up in the shop. For now, defaulting to 1 for tavern\r\n\t\t// level seems to work in all cases\r\n\t\tconst minionsForTier = this.minionsForTier[tavernTier ?? 1];\r\n\t\tif (!minionsForTier?.length) {\r\n\t\t\tconsole.error('incorrect minions for tier', tavernTier, this.minionsForTier, minionsForTier);\r\n\t\t}\r\n\t\treturn pickRandom(this.minionsForTier[tavernTier ?? 1])?.id;\r\n\t}\r\n\r\n\tpublic getRandomMechToMagnetize(tavernLimitUpper: number): string {\r\n\t\tconst magneticMechs = this.pool\r\n\t\t\t.filter((m) => m.type?.toUpperCase() === CardType[CardType.MINION])\r\n\t\t\t.filter((m) => hasMechanic(m, GameTag[GameTag.MODULAR]));\r\n\t\tconst pool = magneticMechs.filter((m) => m.techLevel <= tavernLimitUpper);\r\n\t\treturn pickRandom(pool)?.id;\r\n\t}\r\n\r\n\tpublic getRandomMinionForTribe(tribe: Race, tavernLimitUpper: number): string {\r\n\t\tconst pool = this.pool\r\n\t\t\t.filter((m) => this.isValidTribe([tribe], m.races, false))\r\n\t\t\t.filter((m) => m.type?.toUpperCase() === CardType[CardType.MINION])\r\n\t\t\t.filter((m) => m.techLevel <= tavernLimitUpper);\r\n\t\treturn pickRandom(pool)?.id;\r\n\t}\r\n\r\n\tpublic 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[], allowEmptyRaces = true): boolean {\r\n\t\tif (!cardRaces?.length && allowEmptyRaces) {\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"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BgsPlayerEntity } from './bgs-player-entity';
|
|
2
|
+
import { BoardEntity } from './board-entity';
|
|
3
|
+
import { FullGameState } from './simulation/internal-game-state';
|
|
4
|
+
export declare const updateDivineShield: (entity: BoardEntity, board: BoardEntity[], hero: BgsPlayerEntity, otherHero: BgsPlayerEntity, newValue: boolean, gameState: FullGameState) => void;
|
|
5
|
+
export declare const grantRandomDivineShield: (source: BoardEntity, board: BoardEntity[], hero: BgsPlayerEntity, otherHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
6
|
+
export declare const grantDivineShieldToLeftmostMinions: (source: BoardEntity, board: BoardEntity[], hero: BgsPlayerEntity, quantity: number, otherHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grantDivineShieldToLeftmostMinions = exports.grantRandomDivineShield = exports.updateDivineShield = void 0;
|
|
4
|
+
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
|
+
const utils_1 = require("./services/utils");
|
|
6
|
+
const cards_in_hand_1 = require("./simulation/cards-in-hand");
|
|
7
|
+
const stats_1 = require("./simulation/stats");
|
|
8
|
+
const utils_2 = require("./utils");
|
|
9
|
+
const updateDivineShield = (entity, board, hero, otherHero, newValue, gameState) => {
|
|
10
|
+
var _a;
|
|
11
|
+
entity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;
|
|
12
|
+
entity.divineShield = newValue;
|
|
13
|
+
if (entity.divineShield) {
|
|
14
|
+
const boardForDrake = board;
|
|
15
|
+
const statsBonus = 8 * boardForDrake.filter((e) => e.cardId === "BG25_043").length +
|
|
16
|
+
16 * boardForDrake.filter((e) => e.cardId === "BG25_043_G").length;
|
|
17
|
+
entity.attack += statsBonus;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const boardForDrake = board;
|
|
21
|
+
const statsBonus = 8 * boardForDrake.filter((e) => e.cardId === "BG25_043").length +
|
|
22
|
+
16 * boardForDrake.filter((e) => e.cardId === "BG25_043_G").length;
|
|
23
|
+
entity.attack -= statsBonus;
|
|
24
|
+
}
|
|
25
|
+
if (entity.hadDivineShield && !entity.divineShield) {
|
|
26
|
+
const adapter = hero.trinkets
|
|
27
|
+
.filter((t) => t.cardId === "BG30_MagicItem_910")
|
|
28
|
+
.filter((t) => t.scriptDataNum1 > 0)[0];
|
|
29
|
+
if (!!adapter) {
|
|
30
|
+
(0, exports.updateDivineShield)(entity, board, hero, otherHero, true, gameState);
|
|
31
|
+
adapter.scriptDataNum1--;
|
|
32
|
+
}
|
|
33
|
+
for (let i = 0; i < board.length; i++) {
|
|
34
|
+
if (board[i].cardId === "ICC_858") {
|
|
35
|
+
(0, stats_1.modifyStats)(board[i], 2, 0, board, hero, gameState);
|
|
36
|
+
gameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);
|
|
37
|
+
}
|
|
38
|
+
else if (board[i].cardId === "TB_BaconUps_047") {
|
|
39
|
+
(0, stats_1.modifyStats)(board[i], 4, 0, board, hero, gameState);
|
|
40
|
+
gameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);
|
|
41
|
+
}
|
|
42
|
+
else if (board[i].cardId === "BGS_067") {
|
|
43
|
+
(0, stats_1.modifyStats)(board[i], 2, 2, board, hero, gameState);
|
|
44
|
+
gameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);
|
|
45
|
+
}
|
|
46
|
+
else if (board[i].cardId === "TB_BaconUps_117") {
|
|
47
|
+
(0, stats_1.modifyStats)(board[i], 4, 4, board, hero, gameState);
|
|
48
|
+
gameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);
|
|
49
|
+
}
|
|
50
|
+
else if (board[i].entityId !== entity.entityId &&
|
|
51
|
+
(board[i].cardId === "BG20_401" ||
|
|
52
|
+
board[i].cardId === "BG20_401_G")) {
|
|
53
|
+
(0, exports.updateDivineShield)(board[i], board, hero, otherHero, true, gameState);
|
|
54
|
+
}
|
|
55
|
+
else if (board[i].cardId === "BG21_037") {
|
|
56
|
+
(0, cards_in_hand_1.addCardsInHand)(hero, board, ["BG20_GEM"], gameState);
|
|
57
|
+
}
|
|
58
|
+
else if (board[i].cardId === "BG21_037_G") {
|
|
59
|
+
(0, cards_in_hand_1.addCardsInHand)(hero, board, ["BG20_GEM", "BG20_GEM"], gameState);
|
|
60
|
+
}
|
|
61
|
+
else if (board[i].cardId === "BG24_008" ||
|
|
62
|
+
board[i].cardId === "BG24_008_G") {
|
|
63
|
+
if ((_a = board[i]) === null || _a === void 0 ? void 0 : _a.friendly) {
|
|
64
|
+
const buff = board[i].cardId === "BG24_008_G" ? 2 : 1;
|
|
65
|
+
(0, utils_2.grantRandomStats)(board[i], hero.hand.filter((e) => { var _a; return ((_a = gameState.allCards.getCard(e.cardId).type) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === reference_data_1.CardType[reference_data_1.CardType.MINION]; }), hero, buff, buff, null, true, gameState);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const greaseBots = board.filter((entity) => entity.cardId === "BG21_024");
|
|
70
|
+
const greaseBotBattlegrounds = board.filter((entity) => entity.cardId === "BG21_024_G");
|
|
71
|
+
greaseBots.forEach((bot) => {
|
|
72
|
+
(0, stats_1.modifyStats)(entity, 1, 1, board, hero, gameState);
|
|
73
|
+
gameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);
|
|
74
|
+
});
|
|
75
|
+
greaseBotBattlegrounds.forEach((bot) => {
|
|
76
|
+
(0, stats_1.modifyStats)(entity, 2, 2, board, hero, gameState);
|
|
77
|
+
gameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.updateDivineShield = updateDivineShield;
|
|
82
|
+
const grantRandomDivineShield = (source, board, hero, otherHero, gameState) => {
|
|
83
|
+
const elligibleEntities = board
|
|
84
|
+
.filter((entity) => !entity.divineShield)
|
|
85
|
+
.filter((entity) => entity.health > 0 && !entity.definitelyDead);
|
|
86
|
+
if (elligibleEntities.length > 0) {
|
|
87
|
+
const chosen = (0, utils_1.pickRandom)(elligibleEntities);
|
|
88
|
+
(0, exports.updateDivineShield)(chosen, board, hero, otherHero, true, gameState);
|
|
89
|
+
gameState.spectator.registerPowerTarget(source, chosen, board, null, null);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
exports.grantRandomDivineShield = grantRandomDivineShield;
|
|
93
|
+
const grantDivineShieldToLeftmostMinions = (source, board, hero, quantity, otherHero, gameState) => {
|
|
94
|
+
for (let i = 0; i < Math.min(quantity, board.length); i++) {
|
|
95
|
+
(0, exports.updateDivineShield)(board[i], board, hero, otherHero, true, gameState);
|
|
96
|
+
gameState.spectator.registerPowerTarget(source, board[i], board, null, null);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
exports.grantDivineShieldToLeftmostMinions = grantDivineShieldToLeftmostMinions;
|
|
100
|
+
//# sourceMappingURL=divine-shield.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divine-shield.js","sourceRoot":"","sources":["../src/divine-shield.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AAGjE,4CAA8C;AAC9C,8DAA4D;AAE5D,8CAAiD;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C,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACtE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7E;AACF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import { CardIds, CardType } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { pickRandom } from './services/utils';\r\nimport { addCardsInHand } from './simulation/cards-in-hand';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { modifyStats } from './simulation/stats';\r\nimport { grantRandomStats } from './utils';\r\n\r\nexport const updateDivineShield = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tnewValue: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// if ((entity.divineShield ?? false) === newValue) {\r\n\t// \treturn;\r\n\t// }\r\n\tentity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t8 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t16 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t8 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t16 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n\r\n\t// Lost divine shield\r\n\tif (entity.hadDivineShield && !entity.divineShield) {\r\n\t\tconst adapter = hero.trinkets\r\n\t\t\t.filter((t) => t.cardId === CardIds.MechagonAdapter_BG30_MagicItem_910)\r\n\t\t\t.filter((t) => t.scriptDataNum1 > 0)[0];\r\n\t\tif (!!adapter) {\r\n\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\tadapter.scriptDataNum1--;\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < board.length; i++) {\r\n\t\t\tif (board[i].cardId === CardIds.BolvarFireblood_ICC_858) {\r\n\t\t\t\tmodifyStats(board[i], 2, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.BolvarFireblood_TB_BaconUps_047) {\r\n\t\t\t\tmodifyStats(board[i], 4, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_BGS_067) {\r\n\t\t\t\tmodifyStats(board[i], 2, 2, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_TB_BaconUps_117) {\r\n\t\t\t\tmodifyStats(board[i], 4, 4, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].entityId !== entity.entityId &&\r\n\t\t\t\t(board[i].cardId === CardIds.HolyMecherel_BG20_401 ||\r\n\t\t\t\t\tboard[i].cardId === CardIds.HolyMecherel_BG20_401_G)\r\n\t\t\t) {\r\n\t\t\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem], gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037_G) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem, CardIds.BloodGem], gameState);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008 ||\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008_G\r\n\t\t\t) {\r\n\t\t\t\t// When it's the opponent, the game state already contains all the buffs\r\n\t\t\t\tif (board[i]?.friendly) {\r\n\t\t\t\t\tconst buff = board[i].cardId === CardIds.CogworkCopter_BG24_008_G ? 2 : 1;\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tboard[i],\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tconst greaseBots = board.filter((entity) => entity.cardId === CardIds.GreaseBot_BG21_024);\r\n\t\tconst greaseBotBattlegrounds = board.filter((entity) => entity.cardId === CardIds.GreaseBot_BG21_024_G);\r\n\t\tgreaseBots.forEach((bot) => {\r\n\t\t\tmodifyStats(entity, 1, 1, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);\r\n\t\t});\r\n\t\tgreaseBotBattlegrounds.forEach((bot) => {\r\n\t\t\tmodifyStats(entity, 2, 2, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);\r\n\t\t});\r\n\t}\r\n};\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = pickRandom(elligibleEntities);\r\n\t\tupdateDivineShield(chosen, board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, chosen, board, null, null);\r\n\t}\r\n};\r\n\r\nexport const grantDivineShieldToLeftmostMinions = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tquantity: number,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < Math.min(quantity, board.length); i++) {\r\n\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, board[i], board, null, null);\r\n\t}\r\n};\r\n"]}
|
package/dist/input-sanitation.js
CHANGED
|
@@ -49,12 +49,13 @@ const buildFinalInput = (battleInput, cards, cardsData) => {
|
|
|
49
49
|
};
|
|
50
50
|
exports.buildFinalInput = buildFinalInput;
|
|
51
51
|
const buildFinalInputForPlayer = (playerInfo, isPlayer, cards, cardsData, entityIdContainer) => {
|
|
52
|
-
var _a;
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
53
|
if (!playerInfo) {
|
|
54
54
|
return { board: [], hand: [], player: null };
|
|
55
55
|
}
|
|
56
56
|
const { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);
|
|
57
|
-
playerInfo.player.secrets = (_a = playerInfo.secrets) === null || _a === void 0 ? void 0 : _a.filter((e) => !!(e === null || e === void 0 ? void 0 : e.cardId));
|
|
57
|
+
playerInfo.player.secrets = (_b = (_a = playerInfo.secrets) === null || _a === void 0 ? void 0 : _a.filter((e) => !!(e === null || e === void 0 ? void 0 : e.cardId))) !== null && _b !== void 0 ? _b : [];
|
|
58
|
+
playerInfo.player.trinkets = (_d = (_c = playerInfo.player.trinkets) === null || _c === void 0 ? void 0 : _c.filter((e) => !!(e === null || e === void 0 ? void 0 : e.cardId))) !== null && _d !== void 0 ? _d : [];
|
|
58
59
|
playerInfo.player.friendly = isPlayer;
|
|
59
60
|
(0, auras_1.setMissingAuras)(board, playerInfo.player, cards);
|
|
60
61
|
(0, auras_1.setImplicitDataHero)(playerInfo.player, cardsData, isPlayer, entityIdContainer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-sanitation.js","sourceRoot":"","sources":["../src/input-sanitation.ts"],"names":[],"mappings":";;;AAMA,8CAA0E;AAC1E,4DAA4D;AAC5D,mCAA8C;AAEvC,MAAM,eAAe,GAAG,CAC9B,WAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACJ,EAAE;IAClB,MAAM,iBAAiB,GAAG,EAAE,QAAQ,EAAE,SAAW,EAAE,CAAC;IAEpD,MAAM,EACL,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GACpB,GAAG,wBAAwB,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IACjG,MAAM,EACL,KAAK,EAAE,mBAAmB,EAC1B,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,oBAAoB,GAC5B,GAAG,wBAAwB,CAAC,WAAW,CAAC,mBAAmB,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAEzG,MAAM,EACL,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAA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AC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAA,2BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAkB,CAAA,CAAC,CAAC;IACtG,MAAM,IAAI,GACT,MAAA,MAAA,UAAU,CAAC,MAAM,CAAC,IAAI,0CACnB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EACtD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAA,2BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAkB,CAAA,CAAC,mCAAI,EAAE,CAAC;IAE7G,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { fixEnchantments } from './simulation/enchantments';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nexport const buildFinalInput = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): BgsBattleInfo => {\r\n\tconst entityIdContainer = { entityId: 999_999_999 };\r\n\r\n\tconst {\r\n\t\tboard: playerBoard,\r\n\t\thand: playerHand,\r\n\t\tplayer: playerEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.playerBoard, true, cards, cardsData, entityIdContainer);\r\n\tconst {\r\n\t\tboard: playerTeammateBoard,\r\n\t\thand: playerTeammateHand,\r\n\t\tplayer: playerTeammateEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.playerTeammateBoard, true, cards, cardsData, entityIdContainer);\r\n\r\n\tconst {\r\n\t\tboard: opponentBoard,\r\n\t\thand: opponentHand,\r\n\t\tplayer: opponentEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.opponentBoard, false, cards, cardsData, entityIdContainer);\r\n\tconst {\r\n\t\tboard: opponentTeammateBoard,\r\n\t\thand: opponentTeammateHand,\r\n\t\tplayer: opponentTeammateEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.opponentTeammateBoard, false, cards, cardsData, entityIdContainer);\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: {\r\n\t\t\t\t...playerEntity,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tplayerTeammateBoard: !!playerTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: playerTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...playerTeammateEntity,\r\n\t\t\t\t\t\thand: playerTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentEntity,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentTeammateBoard: !!opponentTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: opponentTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...opponentTeammateEntity,\r\n\t\t\t\t\t\thand: opponentTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\tgameState: battleInput.gameState,\r\n\t} as BgsBattleInfo;\r\n\treturn inputReady;\r\n};\r\n\r\nconst buildFinalInputForPlayer = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tentityIdContainer: { entityId: number },\r\n): { board: BoardEntity[]; hand: BoardEntity[]; player: BgsPlayerEntity } => {\r\n\tif (!playerInfo) {\r\n\t\treturn { board: [], hand: [], player: null };\r\n\t}\r\n\r\n\tconst { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);\r\n\tplayerInfo.player.secrets = playerInfo.secrets?.filter((e) => !!e?.cardId) ?? [];\r\n\tplayerInfo.player.trinkets = playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? [];\r\n\tplayerInfo.player.friendly = isPlayer;\r\n\t// When using the simulator, the aura is not applied when receiving the board state.\r\n\tsetMissingAuras(board, playerInfo.player, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, isPlayer, entityIdContainer);\r\n\treturn { board, hand, player: playerInfo.player };\r\n};\r\n\r\nconst buildFinalInputBoard = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n): { board: BoardEntity[]; hand: BoardEntity[] } => {\r\n\tconst board = playerInfo.board\r\n\t\t.map((entity) => fixEnchantments(entity, cards))\r\n\t\t.map((entity) => ({ ...entity, inInitialState: true }))\r\n\t\t.map((entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: isPlayer } as BoardEntity));\r\n\tconst hand =\r\n\t\tplayerInfo.player.hand\r\n\t\t\t?.map((entity) => ({ ...entity, inInitialState: true }))\r\n\t\t\t.map((entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: isPlayer } as BoardEntity)) ?? [];\r\n\r\n\treturn { board, hand };\r\n};\r\n"]}
|
|
@@ -1 +1 @@
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aAAa,GAAG,CAAC,YAAoB,EAAE,YAAoB,EAAE,UAAkB,EAAU,EAAE;IAChG,IAAI,YAAY,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,YAAY,KAAK,GAAG,IAAI,YAAY,KAAK,UAAU,EAAE;QACxD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAGW,QAAA,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;CAmB7C,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 { CardsData } from './cards/cards-data';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\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\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\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\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\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 spectator = new Spectator();\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\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 input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\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\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo) => {\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 (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue', simulationResult);\r\n\t}\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\n// Used when triggering random deathrattles\r\nexport const VALID_DEATHRATTLE_ENCHANTMENTS = [\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\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n];\r\n\r\n// const 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;AAExE,mDAA+C;AAC/C,+CAA4C;AAC5C,yDAAqD;AAGrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C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/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\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\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\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\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\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 spectator = new Spectator();\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\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 input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\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\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo) => {\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 (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue', simulationResult);\r\n\t}\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\n// Used when triggering random deathrattles\r\nexport const VALID_DEATHRATTLE_ENCHANTMENTS = [\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\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n];\r\n\r\n// const 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,12 +1,9 @@
|
|
|
1
|
-
import { AllCardsService } from '@firestone-hs/reference-data';
|
|
2
1
|
import { BgsPlayerEntity } from '../bgs-player-entity';
|
|
3
2
|
import { BoardEntity } from '../board-entity';
|
|
4
3
|
import { FullGameState } from './internal-game-state';
|
|
5
|
-
import { SharedState } from './shared-state';
|
|
6
|
-
import { Spectator } from './spectator/spectator';
|
|
7
4
|
export declare const addMinionsToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, index: number, minionsToAdd: readonly BoardEntity[], gameState: FullGameState) => void;
|
|
8
5
|
export declare const addMinionToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, index: number, minionToAdd: BoardEntity, gameState: FullGameState, performAfterSpawnEffects?: boolean) => void;
|
|
9
|
-
export declare const handleAddedMinionAuraEffect: (board: BoardEntity[], boardHero: BgsPlayerEntity, spawned: BoardEntity, gameState: FullGameState) => void;
|
|
6
|
+
export declare const handleAddedMinionAuraEffect: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, spawned: BoardEntity, gameState: FullGameState) => void;
|
|
10
7
|
export declare const applyAurasToSelf: (spawned: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
11
|
-
export declare const removeAurasFromSelf: (entity: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity,
|
|
8
|
+
export declare const removeAurasFromSelf: (entity: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
12
9
|
export declare const onMinionSummoned: (hero: BgsPlayerEntity, board: BoardEntity[], gameState: FullGameState) => void;
|