@firestone-hs/simulate-bgs-battle 1.1.490 → 1.1.492
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/card.interface.d.ts +2 -1
- package/dist/cards/card.interface.js.map +1 -1
- package/dist/cards/impl/bg-spell/boon-of-beetles.d.ts +5 -0
- package/dist/cards/impl/bg-spell/boon-of-beetles.js +10 -0
- package/dist/cards/impl/bg-spell/boon-of-beetles.js.map +1 -0
- package/dist/cards/impl/bg-spell/toxic-tumbleweed.d.ts +5 -0
- package/dist/cards/impl/bg-spell/toxic-tumbleweed.js +16 -0
- package/dist/cards/impl/bg-spell/toxic-tumbleweed.js.map +1 -0
- package/dist/cards/impl/bg-spell/upper-hand.d.ts +5 -0
- package/dist/cards/impl/bg-spell/upper-hand.js +16 -0
- package/dist/cards/impl/bg-spell/upper-hand.js.map +1 -0
- package/dist/cards/impl/hero-power/wax-warband.js +8 -2
- package/dist/cards/impl/hero-power/wax-warband.js.map +1 -1
- package/dist/cards/impl/minion/humming-bird.js +2 -3
- package/dist/cards/impl/minion/humming-bird.js.map +1 -1
- package/dist/cards/impl/spell/fleeting-vigor.d.ts +5 -0
- package/dist/cards/impl/spell/fleeting-vigor.js +11 -0
- package/dist/cards/impl/spell/fleeting-vigor.js.map +1 -0
- package/dist/cards/impl/trinket/karazhan-chess-set.d.ts +2 -5
- package/dist/cards/impl/trinket/karazhan-chess-set.js +1 -11
- package/dist/cards/impl/trinket/karazhan-chess-set.js.map +1 -1
- package/dist/simulation/add-minion-to-board.js +7 -7
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/auras.d.ts +1 -0
- package/dist/simulation/auras.js +26 -1
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/spawn-fail.js +1 -1
- package/dist/simulation/spawn-fail.js.map +1 -1
- package/dist/simulation/spectator/spectator.js +2 -1
- package/dist/simulation/spectator/spectator.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-action-processor.d.ts +2 -1
- package/dist/simulation/start-of-combat/soc-action-processor.js +26 -5
- package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-anomalies.js +1 -1
- package/dist/simulation/start-of-combat/soc-anomalies.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-hero-power.js +1 -3
- package/dist/simulation/start-of-combat/soc-hero-power.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-minion.js +1 -3
- package/dist/simulation/start-of-combat/soc-minion.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-pre-combat-hero-power.js +1 -3
- package/dist/simulation/start-of-combat/soc-pre-combat-hero-power.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-quest-reward.js +1 -1
- package/dist/simulation/start-of-combat/soc-quest-reward.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-secret.js +43 -36
- package/dist/simulation/start-of-combat/soc-secret.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-trinket.js +1 -1
- package/dist/simulation/start-of-combat/soc-trinket.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { BoardEntity } from '../board-entity';
|
|
|
4
4
|
import { CardsData } from '../cards/cards-data';
|
|
5
5
|
import { FullGameState } from './internal-game-state';
|
|
6
6
|
export declare const setMissingAuras: (board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService) => void;
|
|
7
|
+
export declare const setMissingTrinketAura: (board: BoardEntity[], boardHero: BgsPlayerEntity) => void;
|
|
7
8
|
export declare const setMissingHeroPowerAura: (board: BoardEntity[], boardHero: BgsPlayerEntity) => void;
|
|
8
9
|
export declare const setImplicitDataHero: (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean, entityIdContainer: {
|
|
9
10
|
entityId: number;
|
package/dist/simulation/auras.js
CHANGED
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateBoardwideAuras = exports.clearStealthIfNeeded = exports.setImplicitDataHero = exports.setMissingHeroPowerAura = exports.setMissingAuras = void 0;
|
|
3
|
+
exports.updateBoardwideAuras = exports.clearStealthIfNeeded = exports.setImplicitDataHero = exports.setMissingHeroPowerAura = exports.setMissingTrinketAura = exports.setMissingAuras = void 0;
|
|
4
4
|
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const setMissingAuras = (board, boardHero, allCards) => {
|
|
7
7
|
setMissingMinionsAura(board, boardHero, allCards);
|
|
8
8
|
(0, exports.setMissingHeroPowerAura)(board, boardHero);
|
|
9
|
+
(0, exports.setMissingTrinketAura)(board, boardHero);
|
|
9
10
|
};
|
|
10
11
|
exports.setMissingAuras = setMissingAuras;
|
|
12
|
+
const setMissingTrinketAura = (board, boardHero) => {
|
|
13
|
+
var _a;
|
|
14
|
+
for (const trinket of (_a = boardHero.trinkets) !== null && _a !== void 0 ? _a : []) {
|
|
15
|
+
switch (trinket.cardId) {
|
|
16
|
+
case "BG30_MagicItem_997":
|
|
17
|
+
case "BG30_MagicItem_997t":
|
|
18
|
+
const enchantment = trinket.cardId === "BG30_MagicItem_997"
|
|
19
|
+
? "BG30_MagicItem_997e"
|
|
20
|
+
: "BG30_MagicItem_997e2";
|
|
21
|
+
const buff = trinket.cardId === "BG30_MagicItem_997" ? 8 : 20;
|
|
22
|
+
const target = board[0];
|
|
23
|
+
if (!target.enchantments.find((e) => e.cardId === enchantment)) {
|
|
24
|
+
target.attack += buff;
|
|
25
|
+
target.enchantments.push({
|
|
26
|
+
cardId: enchantment,
|
|
27
|
+
originEntityId: trinket.entityId,
|
|
28
|
+
timing: 0,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.setMissingTrinketAura = setMissingTrinketAura;
|
|
11
36
|
const setMissingHeroPowerAura = (board, boardHero) => {
|
|
12
37
|
if (boardHero.heroPowerId === "BG24_Reward_125") {
|
|
13
38
|
board
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAA2C;AAGpC,MAAM,eAAe,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAE,QAAyB,EAAQ,EAAE;IACpH,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B;AAEK,MAAM,uBAAuB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;IACjG,IAAI,SAAS,CAAC,WAAW,sBAA0B,EAAE;QACpD,KAAK;aACH,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CACnB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,uBAA0D,CAC/E,CACF;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;KACJ;IACD,IAAI,SAAS,CAAC,WAAW,sBAA0B,EAAE;QACpD,KAAK;aACH,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,uBAA8C,CAAC,CAAC;aACxG,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;YACd,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;YACd,CAAC,CAAC,YAAY,CAAC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d,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,yBAAkD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QACzC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;YAC1B,MAAM,EACL,CAAC,CAAC,MAAM,yBAAkD;gBACzD,CAAC;gBACD,CAAC,uBAA8E;YACjF,cAAc,EAAE,CAAC,CAAC,QAAQ;YAC1B,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;SAC/C,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AArDW,QAAA,oBAAoB,wBAqD/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService): void => {\r\n\tsetMissingMinionsAura(board, boardHero, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 4;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039_G,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043_G,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t12,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\tconst heroPowerAsReward = hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowerId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? []).map((trinket) => ({\r\n\t\t...trinket,\r\n\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\tscriptDataNum1: cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t}));\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n\r\nexport const updateBoardwideAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (board.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tboard\r\n\t\t.filter((entity) =>\r\n\t\t\tentity.enchantments.some(\r\n\t\t\t\t(ench) =>\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e ||\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t),\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst enchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t).length;\r\n\t\t\tconst greaterEnchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t).length;\r\n\t\t\te.attack = Math.max(0, e.attack - enchantments * 8 - greaterEnchantments * 15);\r\n\t\t\te.enchantments = e.enchantments\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t\t)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t\t);\r\n\t\t});\r\n\tboardHero.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ||\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t,\r\n\t\t)\r\n\t\t.forEach((t) => {\r\n\t\t\tconst buff = t.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 15;\r\n\t\t\tboard[0].attack = board[0].attack + buff;\r\n\t\t\tboard[0].enchantments.push({\r\n\t\t\t\tcardId:\r\n\t\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t\t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t\t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t\toriginEntityId: t.entityId,\r\n\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t});\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAA2C;AAGpC,MAAM,eAAe,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAE,QAAyB,EAAQ,EAAE;IACpH,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;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,YAAY,GAAG,CAAC,GAAG,mBAAmB,GAAG,EAAE,CAAC,CAAC;QAC/E,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY;aAC7B,MAAM,CACN,CAAC,IAAI,EAAE,EAAE,CACR,IAAI,CAAC,MAAM,0BAAiF,CAC7F;aACA,MAAM,CACN,CAAC,IAAI,EAAE,EAAE,CACR,IAAI,CAAC,MAAM,2BAAkF,CAC9F,CAAC;IACJ,CAAC,CAAC,CAAC;IACJ,SAAS,CAAC,QAAQ;SAChB,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,yBAAkD;QAC1D,CAAC,CAAC,MAAM,0BAA2E,CACpF;SACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACd,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,yBAAkD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QACzC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;YAC1B,MAAM,EACL,CAAC,CAAC,MAAM,yBAAkD;gBACzD,CAAC;gBACD,CAAC,uBAA8E;YACjF,cAAc,EAAE,CAAC,CAAC,QAAQ;YAC1B,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;SAC/C,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AArDW,QAAA,oBAAoB,wBAqD/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService): void => {\r\n\tsetMissingMinionsAura(board, boardHero, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\tswitch (trinket.cardId) {\r\n\t\t\tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t\tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t\t\tconst enchantment =\r\n\t\t\t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t\t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t\t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t\t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t\t\tconst target = board[0];\r\n\t\t\t\tif (!target.enchantments.find((e) => e.cardId === enchantment)) {\r\n\t\t\t\t\ttarget.attack += buff;\r\n\t\t\t\t\ttarget.enchantments.push({\r\n\t\t\t\t\t\tcardId: enchantment,\r\n\t\t\t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 4;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039_G,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043_G,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t12,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\tconst heroPowerAsReward = hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowerId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? []).map((trinket) => ({\r\n\t\t...trinket,\r\n\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\tscriptDataNum1: cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t}));\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n\r\nexport const updateBoardwideAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (board.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tboard\r\n\t\t.filter((entity) =>\r\n\t\t\tentity.enchantments.some(\r\n\t\t\t\t(ench) =>\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e ||\r\n\t\t\t\t\tench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t),\r\n\t\t)\r\n\t\t.forEach((e) => {\r\n\t\t\tconst enchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t).length;\r\n\t\t\tconst greaterEnchantments = e.enchantments.filter(\r\n\t\t\t\t(ench) => ench.cardId === CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t).length;\r\n\t\t\te.attack = Math.max(0, e.attack - enchantments * 8 - greaterEnchantments * 15);\r\n\t\t\te.enchantments = e.enchantments\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e,\r\n\t\t\t\t)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(ench) =>\r\n\t\t\t\t\t\tench.cardId !== CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t\t);\r\n\t\t});\r\n\tboardHero.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ||\r\n\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t,\r\n\t\t)\r\n\t\t.forEach((t) => {\r\n\t\t\tconst buff = t.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 15;\r\n\t\t\tboard[0].attack = board[0].attack + buff;\r\n\t\t\tboard[0].enchantments.push({\r\n\t\t\t\tcardId:\r\n\t\t\t\t\tt.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t\t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t\t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2,\r\n\t\t\t\toriginEntityId: t.entityId,\r\n\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t});\r\n};\r\n"]}
|
|
@@ -14,7 +14,7 @@ const onMinionFailedToSpawn = (entity, board, hero, gameState) => {
|
|
|
14
14
|
.filter((e) => e.cardId === "BG30_124" ||
|
|
15
15
|
e.cardId === "BG30_124_G")
|
|
16
16
|
.forEach((abom) => {
|
|
17
|
-
const abomStatsMultiplier =
|
|
17
|
+
const abomStatsMultiplier = abom.cardId === "BG30_124_G" ? 2 : 1;
|
|
18
18
|
(0, stats_1.modifyStats)(abom, abomStatsMultiplier * 3, abomStatsMultiplier * 3, board, hero, gameState);
|
|
19
19
|
});
|
|
20
20
|
board
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn-fail.js","sourceRoot":"","sources":["../../src/simulation/spawn-fail.ts"],"names":[],"mappings":";;;AAGA,oCAA2C;AAE3C,mCAAsC;AAE/B,MAAM,qBAAqB,GAAG,CACpC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAAwB,EACvB,EAAE;IACH,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,EAAE;QAC7B,MAAM,CAAC,gBAAgB,EAAE,CAAC;KAC1B;IAED,IAAI,CAAC,QAAQ;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,0BAAkD,CAAC;SACzE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAEnE,KAAK;SACH,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,eAA2C;QACnD,CAAC,CAAC,MAAM,iBAA6C,CACtD;SACA,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"spawn-fail.js","sourceRoot":"","sources":["../../src/simulation/spawn-fail.ts"],"names":[],"mappings":";;;AAGA,oCAA2C;AAE3C,mCAAsC;AAE/B,MAAM,qBAAqB,GAAG,CACpC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAAwB,EACvB,EAAE;IACH,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,EAAE;Q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} from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const onMinionFailedToSpawn = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (entity?.onCanceledSummon) {\r\n\t\tentity.onCanceledSummon();\r\n\t}\r\n\r\n\thero.trinkets\r\n\t\t.filter((t) => t.cardId === CardIds.MugOfTheSireToken_BG30_MagicItem_438t)\r\n\t\t.forEach((t) => addStatsToBoard(t, board, hero, 5, 0, gameState));\r\n\r\n\tboard\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.ThunderingAbomination_BG30_124 ||\r\n\t\t\t\te.cardId === CardIds.ThunderingAbomination_BG30_124_G,\r\n\t\t)\r\n\t\t.forEach((abom) => {\r\n\t\t\tconst abomStatsMultiplier = abom.cardId === CardIds.ThunderingAbomination_BG30_124_G ? 2 : 1;\r\n\t\t\tmodifyStats(abom, abomStatsMultiplier * 3, abomStatsMultiplier * 3, board, hero, gameState);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.CatacombCrasher_BG30_129 || e.cardId === CardIds.CatacombCrasher_BG30_129_G)\r\n\t\t.forEach((crasher) => {\r\n\t\t\tconst buff = crasher.cardId === CardIds.CatacombCrasher_BG30_129 ? 1 : 2;\r\n\t\t\taddStatsToBoard(crasher, board, hero, buff, buff, gameState);\r\n\t\t});\r\n};\r\n"]}
|
|
@@ -316,12 +316,13 @@ class Spectator {
|
|
|
316
316
|
if (!(trinkets === null || trinkets === void 0 ? void 0 : trinkets.length)) {
|
|
317
317
|
return undefined;
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
const result = trinkets.map((t) => ({
|
|
320
320
|
cardId: t.cardId,
|
|
321
321
|
entityId: t.entityId,
|
|
322
322
|
scriptDataNum1: t.scriptDataNum1,
|
|
323
323
|
scriptDataNum6: t.scriptDataNum6,
|
|
324
324
|
}));
|
|
325
|
+
return result;
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
328
|
exports.Spectator = Spectator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spectator.js","sourceRoot":"","sources":["../../../src/simulation/spectator/spectator.ts"],"names":[],"mappings":";;;AAGA,+CAA4D;AAG5D,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,SAAS;IAMrB;QACC,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;IAEM,mBAAmB;;QAKzB,OAAO;YACN,GAAG,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAClE,IAAI,EAAE,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACpE,IAAI,EAAE,MAAA,IAAI,CAAC,WAAW,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI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zD,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA,EAAE;YACtB,OAAO,SAAS,CAAC;SACjB;QACD,OAAO,QAAQ,CAAC,GAAG,CAClB,CAAC,CAAC,EAAE,EAAE,CACL,CAAC;YACA,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,cAAc,EAAE,CAAC,CAAC,cAAc;SACf,CAAA,CACnB,CAAC;IACH,CAAC;CACD;AAnaD,8BAmaC","sourcesContent":["import { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction, buildGameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tconstructor() {\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst action: GameAction = buildGameAction(playerHero, opponentHero, {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!sourceEntity.entityId && !(sourceEntity as BgsPlayerEntity).heroPowerId) {\r\n\t\t\t// console.error('missing damaging entity id', sourceEntity.cardId);\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity?.entityId) {\r\n\t\t\t// console.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t\tplayerTrinkets: this.sanitizeTrinkets(actions[i].playerTrinkets),\r\n\t\t\t\topponentTrinkets: this.sanitizeTrinkets(actions[i].opponentTrinkets),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction) {\r\n\t\t\t\taction.playerBoard = action.playerBoard ?? lastAction.playerBoard;\r\n\t\t\t\taction.opponentBoard = action.opponentBoard ?? lastAction.opponentBoard;\r\n\t\t\t\taction.playerHand = action.playerHand ?? lastAction.playerHand;\r\n\t\t\t\taction.opponentHand = action.opponentHand ?? lastAction.opponentHand;\r\n\t\t\t\taction.playerSecrets = action.playerSecrets ?? lastAction.playerSecrets;\r\n\t\t\t\taction.opponentSecrets = action.opponentSecrets ?? lastAction.opponentSecrets;\r\n\t\t\t\taction.playerRewardCardId = action.playerRewardCardId ?? lastAction.playerRewardCardId;\r\n\t\t\t\taction.playerRewardEntityId = action.playerRewardEntityId ?? lastAction.playerRewardEntityId;\r\n\t\t\t\taction.playerRewardData = action.playerRewardData ?? lastAction.playerRewardData;\r\n\t\t\t\taction.opponentRewardCardId = action.opponentRewardCardId ?? lastAction.opponentRewardCardId;\r\n\t\t\t\taction.opponentRewardEntityId = action.opponentRewardEntityId ?? lastAction.opponentRewardEntityId;\r\n\t\t\t\taction.opponentRewardData = action.opponentRewardData ?? lastAction.opponentRewardData;\r\n\t\t\t\taction.playerCardId = action.playerCardId ?? lastAction.playerCardId;\r\n\t\t\t\taction.playerEntityId = action.playerEntityId ?? lastAction.playerEntityId;\r\n\t\t\t\taction.playerHeroPowerCardId = action.playerHeroPowerCardId ?? lastAction.playerHeroPowerCardId;\r\n\t\t\t\taction.playerHeroPowerEntityId = action.playerHeroPowerEntityId ?? lastAction.playerHeroPowerEntityId;\r\n\t\t\t\taction.playerHeroPowerUsed = action.playerHeroPowerUsed ?? lastAction.playerHeroPowerUsed;\r\n\t\t\t\taction.opponentCardId = action.opponentCardId ?? lastAction.opponentCardId;\r\n\t\t\t\taction.opponentEntityId = action.opponentEntityId ?? lastAction.opponentEntityId;\r\n\t\t\t\taction.opponentHeroPowerCardId = action.opponentHeroPowerCardId ?? lastAction.opponentHeroPowerCardId;\r\n\t\t\t\taction.opponentHeroPowerEntityId =\r\n\t\t\t\t\taction.opponentHeroPowerEntityId ?? lastAction.opponentHeroPowerEntityId;\r\n\t\t\t\taction.opponentHeroPowerUsed = action.opponentHeroPowerUsed ?? lastAction.opponentHeroPowerUsed;\r\n\t\t\t\taction.playerTrinkets = action.playerTrinkets ?? lastAction.playerTrinkets;\r\n\t\t\t\taction.opponentTrinkets = action.opponentTrinkets ?? lastAction.opponentTrinkets;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n\r\n\tprivate sanitizeTrinkets(trinkets: readonly BoardTrinket[]): readonly BoardTrinket[] {\r\n\t\tif (!trinkets?.length) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn trinkets.map(\r\n\t\t\t(t) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tcardId: t.cardId,\r\n\t\t\t\t\tentityId: t.entityId,\r\n\t\t\t\t\tscriptDataNum1: t.scriptDataNum1,\r\n\t\t\t\t\tscriptDataNum6: t.scriptDataNum6,\r\n\t\t\t\t} as BoardTrinket),\r\n\t\t);\r\n\t}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"spectator.js","sourceRoot":"","sources":["../../../src/simulation/spectator/spectator.ts"],"names":[],"mappings":";;;AAGA,+CAA4D;AAG5D,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,SAAS;IAMrB;QACC,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;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C,MAAM;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;SACP,CAAA,CAClB,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,QAAiC;QACzD,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA,EAAE;YACtB,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,CACL,CAAC;YACA,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,cAAc,EAAE,CAAC,CAAC,cAAc;SACf,CAAA,CACnB,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AApaD,8BAoaC","sourcesContent":["import { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction, buildGameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tconstructor() {\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst action: GameAction = buildGameAction(playerHero, opponentHero, {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!sourceEntity.entityId && !(sourceEntity as BgsPlayerEntity).heroPowerId) {\r\n\t\t\t// console.error('missing damaging entity id', sourceEntity.cardId);\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity?.entityId) {\r\n\t\t\t// console.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t\tplayerTrinkets: this.sanitizeTrinkets(actions[i].playerTrinkets),\r\n\t\t\t\topponentTrinkets: this.sanitizeTrinkets(actions[i].opponentTrinkets),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction) {\r\n\t\t\t\taction.playerBoard = action.playerBoard ?? lastAction.playerBoard;\r\n\t\t\t\taction.opponentBoard = action.opponentBoard ?? lastAction.opponentBoard;\r\n\t\t\t\taction.playerHand = action.playerHand ?? lastAction.playerHand;\r\n\t\t\t\taction.opponentHand = action.opponentHand ?? lastAction.opponentHand;\r\n\t\t\t\taction.playerSecrets = action.playerSecrets ?? lastAction.playerSecrets;\r\n\t\t\t\taction.opponentSecrets = action.opponentSecrets ?? lastAction.opponentSecrets;\r\n\t\t\t\taction.playerRewardCardId = action.playerRewardCardId ?? lastAction.playerRewardCardId;\r\n\t\t\t\taction.playerRewardEntityId = action.playerRewardEntityId ?? lastAction.playerRewardEntityId;\r\n\t\t\t\taction.playerRewardData = action.playerRewardData ?? lastAction.playerRewardData;\r\n\t\t\t\taction.opponentRewardCardId = action.opponentRewardCardId ?? lastAction.opponentRewardCardId;\r\n\t\t\t\taction.opponentRewardEntityId = action.opponentRewardEntityId ?? lastAction.opponentRewardEntityId;\r\n\t\t\t\taction.opponentRewardData = action.opponentRewardData ?? lastAction.opponentRewardData;\r\n\t\t\t\taction.playerCardId = action.playerCardId ?? lastAction.playerCardId;\r\n\t\t\t\taction.playerEntityId = action.playerEntityId ?? lastAction.playerEntityId;\r\n\t\t\t\taction.playerHeroPowerCardId = action.playerHeroPowerCardId ?? lastAction.playerHeroPowerCardId;\r\n\t\t\t\taction.playerHeroPowerEntityId = action.playerHeroPowerEntityId ?? lastAction.playerHeroPowerEntityId;\r\n\t\t\t\taction.playerHeroPowerUsed = action.playerHeroPowerUsed ?? lastAction.playerHeroPowerUsed;\r\n\t\t\t\taction.opponentCardId = action.opponentCardId ?? lastAction.opponentCardId;\r\n\t\t\t\taction.opponentEntityId = action.opponentEntityId ?? lastAction.opponentEntityId;\r\n\t\t\t\taction.opponentHeroPowerCardId = action.opponentHeroPowerCardId ?? lastAction.opponentHeroPowerCardId;\r\n\t\t\t\taction.opponentHeroPowerEntityId =\r\n\t\t\t\t\taction.opponentHeroPowerEntityId ?? lastAction.opponentHeroPowerEntityId;\r\n\t\t\t\taction.opponentHeroPowerUsed = action.opponentHeroPowerUsed ?? lastAction.opponentHeroPowerUsed;\r\n\t\t\t\taction.playerTrinkets = action.playerTrinkets ?? lastAction.playerTrinkets;\r\n\t\t\t\taction.opponentTrinkets = action.opponentTrinkets ?? lastAction.opponentTrinkets;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n\r\n\tprivate sanitizeTrinkets(trinkets: readonly BoardTrinket[]): readonly BoardTrinket[] {\r\n\t\tif (!trinkets?.length) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tconst result = trinkets.map(\r\n\t\t\t(t) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tcardId: t.cardId,\r\n\t\t\t\t\tentityId: t.entityId,\r\n\t\t\t\t\tscriptDataNum1: t.scriptDataNum1,\r\n\t\t\t\t\tscriptDataNum6: t.scriptDataNum6,\r\n\t\t\t\t} as BoardTrinket),\r\n\t\t);\r\n\t\treturn result;\r\n\t}\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';
|
|
2
2
|
import { BoardEntity } from '../../board-entity';
|
|
3
|
+
import { BoardSecret } from '../../board-secret';
|
|
3
4
|
import { StartOfCombatTiming } from '../../cards/card.interface';
|
|
4
5
|
import { SoCInput } from './start-of-combat-input';
|
|
5
|
-
export declare const performStartOfCombatAction: (cardId: string, entity: BoardEntity | BoardTrinket | BgsPlayerEntity, input: SoCInput, timing?: StartOfCombatTiming) => boolean;
|
|
6
|
+
export declare const performStartOfCombatAction: (cardId: string, entity: BoardEntity | BoardTrinket | BgsPlayerEntity | BoardSecret, input: SoCInput, processDeaths: boolean, timing?: StartOfCombatTiming) => boolean;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.performStartOfCombatAction = void 0;
|
|
4
4
|
const anomalous_twin_1 = require("../../cards/impl/anomaly/anomalous-twin");
|
|
5
5
|
const blessed_or_blighted_1 = require("../../cards/impl/anomaly/blessed-or-blighted");
|
|
6
|
+
const boon_of_beetles_1 = require("../../cards/impl/bg-spell/boon-of-beetles");
|
|
7
|
+
const toxic_tumbleweed_1 = require("../../cards/impl/bg-spell/toxic-tumbleweed");
|
|
8
|
+
const upper_hand_1 = require("../../cards/impl/bg-spell/upper-hand");
|
|
6
9
|
const aim_high_1 = require("../../cards/impl/hero-power/aim-high");
|
|
7
10
|
const aim_left_1 = require("../../cards/impl/hero-power/aim-left");
|
|
8
11
|
const aim_low_1 = require("../../cards/impl/hero-power/aim-low");
|
|
@@ -50,6 +53,7 @@ const yulon_fortune_granter_1 = require("../../cards/impl/minion/yulon-fortune-g
|
|
|
50
53
|
const evil_twin_1 = require("../../cards/impl/quest-reward/evil-twin");
|
|
51
54
|
const staff_of_origination_1 = require("../../cards/impl/quest-reward/staff-of-origination");
|
|
52
55
|
const stolen_gold_1 = require("../../cards/impl/quest-reward/stolen-gold");
|
|
56
|
+
const fleeting_vigor_1 = require("../../cards/impl/spell/fleeting-vigor");
|
|
53
57
|
const artisanal_urn_1 = require("../../cards/impl/trinket/artisanal-urn");
|
|
54
58
|
const automaton_portrait_1 = require("../../cards/impl/trinket/automaton-portrait");
|
|
55
59
|
const bronze_timepiece_1 = require("../../cards/impl/trinket/bronze-timepiece");
|
|
@@ -68,7 +72,8 @@ const summoning_sphere_1 = require("../../cards/impl/trinket/summoning-sphere");
|
|
|
68
72
|
const tinyfin_onesie_1 = require("../../cards/impl/trinket/tinyfin-onesie");
|
|
69
73
|
const training_certificate_1 = require("../../cards/impl/trinket/training-certificate");
|
|
70
74
|
const valorous_medaillion_1 = require("../../cards/impl/trinket/valorous-medaillion");
|
|
71
|
-
const
|
|
75
|
+
const attack_1 = require("../attack");
|
|
76
|
+
const performStartOfCombatAction = (cardId, entity, input, processDeaths, timing) => {
|
|
72
77
|
let hasTriggered = false;
|
|
73
78
|
const promoPortraitCount = getPromoPortraitCount(input.playerEntity);
|
|
74
79
|
for (let i = promoPortraitCount; i >= 0; i--) {
|
|
@@ -79,14 +84,21 @@ const performStartOfCombatAction = (cardId, entity, input, timing) => {
|
|
|
79
84
|
const action = card === null || card === void 0 ? void 0 : card.startOfCombat;
|
|
80
85
|
if (!!action) {
|
|
81
86
|
hasTriggered = action(entity, input);
|
|
87
|
+
onStartOfCombatTriggered(i, cardId, input.playerEntity);
|
|
82
88
|
if (!!hasTriggered) {
|
|
83
|
-
|
|
89
|
+
if (processDeaths) {
|
|
90
|
+
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
91
|
+
}
|
|
84
92
|
if (typeof hasTriggered !== 'boolean' && hasTriggered.shouldRecomputeCurrentAttacker) {
|
|
85
93
|
input.currentAttacker =
|
|
86
94
|
input.playerBoard.length > input.opponentBoard.length
|
|
87
|
-
?
|
|
95
|
+
? input.playerIsFriendly
|
|
96
|
+
? 0
|
|
97
|
+
: 1
|
|
88
98
|
: input.opponentBoard.length > input.playerBoard.length
|
|
89
|
-
?
|
|
99
|
+
? input.playerIsFriendly
|
|
100
|
+
? 1
|
|
101
|
+
: 0
|
|
90
102
|
: Math.round(Math.random());
|
|
91
103
|
}
|
|
92
104
|
}
|
|
@@ -180,6 +192,14 @@ const getStartOfCombatAction = (cardId) => {
|
|
|
180
192
|
return blessed_or_blighted_1.BlessedOrBlighted;
|
|
181
193
|
case "BG27_Anomaly_560":
|
|
182
194
|
return anomalous_twin_1.AnomalousTwin;
|
|
195
|
+
case "BG28_603":
|
|
196
|
+
return boon_of_beetles_1.BoonOfBeetles;
|
|
197
|
+
case "BG28_641":
|
|
198
|
+
return toxic_tumbleweed_1.ToxicTumbleweed;
|
|
199
|
+
case "BG28_573":
|
|
200
|
+
return upper_hand_1.UpperHand;
|
|
201
|
+
case "BG28_519":
|
|
202
|
+
return fleeting_vigor_1.FleetingVigor;
|
|
183
203
|
case "BGS_019":
|
|
184
204
|
case "TB_BaconUps_102":
|
|
185
205
|
return red_whelp_1.RedWhelp;
|
|
@@ -267,7 +287,7 @@ const getStartOfCombatAction = (cardId) => {
|
|
|
267
287
|
};
|
|
268
288
|
const onStartOfCombatTriggered = (iteration, triggeredCardId, playerEntity) => {
|
|
269
289
|
const promoPortraits = playerEntity.trinkets.filter((t) => t.cardId === "BG30_MagicItem_918" && t.scriptDataNum1 > 0);
|
|
270
|
-
if (promoPortraits.length === 0 || iteration === 0 || iteration
|
|
290
|
+
if (promoPortraits.length === 0 || iteration === 0 || iteration > promoPortraits.length) {
|
|
271
291
|
return;
|
|
272
292
|
}
|
|
273
293
|
switch (triggeredCardId) {
|
|
@@ -278,6 +298,7 @@ const onStartOfCombatTriggered = (iteration, triggeredCardId, playerEntity) => {
|
|
|
278
298
|
case "BG30_MagicItem_995":
|
|
279
299
|
case "TB_BaconShop_HP_086":
|
|
280
300
|
case "TB_BaconShop_HP_024":
|
|
301
|
+
case "BG28_603":
|
|
281
302
|
return;
|
|
282
303
|
}
|
|
283
304
|
const promoPortrait = promoPortraits[iteration - 1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-action-processor.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-action-processor.ts"],"names":[],"mappings":";;;AAIA,4EAAwE;AACxE,sFAAi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IAE9G,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC,MAAM,CAClD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAA6C,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,CACpF,CAAC;IACF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,IAAI,SAAS,IAAI,cAAc,CAAC,MAAM,EAAE;QACzF,OAAO;KACP;IAED,QAAQ,eAAe,EAAE;QACxB,uBAAwB;QACxB,0BAA2C;QAC3C,0BAAoD;QACpD,0BAAgD;QAChD,0BAAgD;QAChD,2BAA6B;QAC7B;YACC,OAAO;KACR;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACpD,aAAa,CAAC,cAAc,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,YAA6B,EAAE,EAAE;IAC/D,OAAO,YAAY,CAAC,QAAQ,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAA6C,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,CACpF,CAAC,MAAM,CAAC;AACV,CAAC,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { StartOfCombatCard, StartOfCombatTiming } from '../../cards/card.interface';\r\nimport { AnomalousTwin } from '../../cards/impl/anomaly/anomalous-twin';\r\nimport { BlessedOrBlighted } from '../../cards/impl/anomaly/blessed-or-blighted';\r\nimport { AimHigh } from '../../cards/impl/hero-power/aim-high';\r\nimport { AimLeft } from '../../cards/impl/hero-power/aim-left';\r\nimport { AimLow } from '../../cards/impl/hero-power/aim-low';\r\nimport { AimRight } from '../../cards/impl/hero-power/aim-right';\r\nimport { AllWillBurn } from '../../cards/impl/hero-power/all-will-burn';\r\nimport { EarthInvocation } from '../../cards/impl/hero-power/earth-invocation';\r\nimport { EmbraceYourRage } from '../../cards/impl/hero-power/embrace-your-rage';\r\nimport { FireInvocation } from '../../cards/impl/hero-power/fire-invocation';\r\nimport { FragrantPhylactery } from '../../cards/impl/hero-power/fragrant-phylactery';\r\nimport { GloriousGloop } from '../../cards/impl/hero-power/glorious-gloop';\r\nimport { LightningInvocation } from '../../cards/impl/hero-power/lightning-invocation';\r\nimport { RapidReanimation } from '../../cards/impl/hero-power/rapid-reanimation';\r\nimport { RebornRites } from '../../cards/impl/hero-power/reborn-rites';\r\nimport { SwattingInsects } from '../../cards/impl/hero-power/swatting-insects';\r\nimport { Tentacular } from '../../cards/impl/hero-power/tentacular';\r\nimport { WaterInvocation } from '../../cards/impl/hero-power/water-invocation';\r\nimport { WaxWarband } from '../../cards/impl/hero-power/wax-warband';\r\nimport { AmberGuardian } from '../../cards/impl/minion/amber-guardian';\r\nimport { AudaciousAnchor } from '../../cards/impl/minion/audacious-anchor';\r\nimport { CarbonicCopy } from '../../cards/impl/minion/carbonic-copy';\r\nimport { ChoralMrrrglr } from '../../cards/impl/minion/choral-mrrrglr';\r\nimport { CorruptedMyrmidon } from '../../cards/impl/minion/corrupted-myrmidon';\r\nimport { Crabby } from '../../cards/impl/minion/crabby';\r\nimport { DiremuckForager } from '../../cards/impl/minion/diremuck-forager';\r\nimport { ElderTaggawag } from '../../cards/impl/minion/elder-taggawag';\r\nimport { HawkstriderHerald } from '../../cards/impl/minion/hawkstrider-herald';\r\nimport { HoardingHatespawn } from '../../cards/impl/minion/hoarding-hatespawn';\r\nimport { HummingBird } from '../../cards/impl/minion/humming-bird';\r\nimport { InterrogatorWhitemane } from '../../cards/impl/minion/interrogator-whitemane';\r\nimport { IrateRooster } from '../../cards/impl/minion/irate-rooster';\r\nimport { MantidQueen } from '../../cards/impl/minion/mantid-queen';\r\nimport { MisfitDragonling } from '../../cards/impl/minion/misfit-dragonling';\r\nimport { PilotedWhirlOTron } from '../../cards/impl/minion/piloted-whirl-o-tron';\r\nimport { PrizedPromoDrake } from '../../cards/impl/minion/prized-promo-drake';\r\nimport { RedWhelp } from '../../cards/impl/minion/red-whelp';\r\nimport { SanctumRester } from '../../cards/impl/minion/sanctum-rester';\r\nimport { Sandy } from '../../cards/impl/minion/sandy';\r\nimport { SkyPirateFlagbearer } from '../../cards/impl/minion/sky-pirate-flagbearer';\r\nimport { Soulsplitter } from '../../cards/impl/minion/soulsplitter';\r\nimport { SunScreener } from '../../cards/impl/minion/sun-screener';\r\nimport { TheUninvitedGuest } from '../../cards/impl/minion/the-uninvited-guest';\r\nimport { ThousandthPaperDrake } from '../../cards/impl/minion/thousandth-paper-drake';\r\nimport { Vaelastrasz } from '../../cards/impl/minion/vaelastrasz';\r\nimport { YulonFortuneGranter } from '../../cards/impl/minion/yulon-fortune-granter';\r\nimport { EvilTwin } from '../../cards/impl/quest-reward/evil-twin';\r\nimport { StaffOfOrigination } from '../../cards/impl/quest-reward/staff-of-origination';\r\nimport { StolenGold } from '../../cards/impl/quest-reward/stolen-gold';\r\nimport { ArtisanalUrn } from '../../cards/impl/trinket/artisanal-urn';\r\nimport { AutomatonPortrait } from '../../cards/impl/trinket/automaton-portrait';\r\nimport { BronzeTimepiece } from '../../cards/impl/trinket/bronze-timepiece';\r\nimport { EmeraldDreamcatcher } from '../../cards/impl/trinket/emerald-dreamcatcher';\r\nimport { EternalPortrait } from '../../cards/impl/trinket/eternal-portrait';\r\nimport { FishySticker } from '../../cards/impl/trinket/fishy-sticker';\r\nimport { HoggyBank } from '../../cards/impl/trinket/hoggy-bank';\r\nimport { HollyMallet } from '../../cards/impl/trinket/holly-mallet';\r\nimport { IronforgeAnvil } from '../../cards/impl/trinket/ironforge-anvil';\r\nimport { JarredFrostling } from '../../cards/impl/trinket/jarred-frostling';\r\nimport { KarazhanChessSet } from '../../cards/impl/trinket/karazhan-chess-set';\r\nimport { RivendarePortrait } from '../../cards/impl/trinket/rivendare-portrait';\r\nimport { RustyTrident } from '../../cards/impl/trinket/rusty-trident';\r\nimport { ShipInABottle } from '../../cards/impl/trinket/ship-in-a-bottle';\r\nimport { SummoningSphere } from '../../cards/impl/trinket/summoning-sphere';\r\nimport { TinyfinOnesie } from '../../cards/impl/trinket/tinyfin-onesie';\r\nimport { TrainingCertificate } from '../../cards/impl/trinket/training-certificate';\r\nimport { ValorousMedallion } from '../../cards/impl/trinket/valorous-medaillion';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const performStartOfCombatAction = (\r\n\tcardId: string,\r\n\tentity: BoardEntity | BoardTrinket | BgsPlayerEntity,\r\n\tinput: SoCInput,\r\n\ttiming?: StartOfCombatTiming,\r\n) => {\r\n\tlet hasTriggered:\r\n\t\t| boolean\r\n\t\t| {\r\n\t\t\t\thasTriggered: boolean;\r\n\t\t\t\tshouldRecomputeCurrentAttacker: boolean;\r\n\t\t } = false;\r\n\tconst promoPortraitCount = getPromoPortraitCount(input.playerEntity);\r\n\tfor (let i = promoPortraitCount; i >= 0; i--) {\r\n\t\tconst card = getStartOfCombatAction(cardId);\r\n\t\tif (!!timing && card?.startOfCombatTiming !== timing) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst action = card?.startOfCombat;\r\n\t\tif (!!action) {\r\n\t\t\thasTriggered = action(entity, input);\r\n\t\t\tif (!!hasTriggered) {\r\n\t\t\t\tonStartOfCombatTriggered(i, cardId, input.playerEntity);\r\n\t\t\t\tif (typeof hasTriggered !== 'boolean' && hasTriggered.shouldRecomputeCurrentAttacker) {\r\n\t\t\t\t\tinput.currentAttacker =\r\n\t\t\t\t\t\tinput.playerBoard.length > input.opponentBoard.length\r\n\t\t\t\t\t\t\t? 0\r\n\t\t\t\t\t\t\t: input.opponentBoard.length > input.playerBoard.length\r\n\t\t\t\t\t\t\t? 1\r\n\t\t\t\t\t\t\t: Math.round(Math.random());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn !!hasTriggered;\r\n};\r\n\r\n// TODO: load all cards on start, then do some programmatic mapping\r\nconst getStartOfCombatAction = (cardId: string): StartOfCombatCard => {\r\n\tswitch (cardId) {\r\n\t\t// Quest rewards\r\n\t\tcase CardIds.EvilTwin:\r\n\t\t\treturn EvilTwin;\r\n\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\treturn StaffOfOrigination;\r\n\t\tcase CardIds.StolenGold:\r\n\t\t\treturn StolenGold;\r\n\r\n\t\t// Trinkets\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\t\treturn HollyMallet;\r\n\t\tcase CardIds.TrainingCertificate_BG30_MagicItem_962:\r\n\t\t\treturn TrainingCertificate;\r\n\t\tcase CardIds.ValorousMedallion_BG30_MagicItem_970:\r\n\t\tcase CardIds.ValorousMedallion_ValorousMedallionToken_BG30_MagicItem_970t:\r\n\t\t\treturn ValorousMedallion;\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\t\treturn EmeraldDreamcatcher;\r\n\t\tcase CardIds.JarredFrostling_BG30_MagicItem_952:\r\n\t\t\treturn JarredFrostling;\r\n\t\tcase CardIds.RustyTrident_BG30_MagicItem_917:\r\n\t\t\treturn RustyTrident;\r\n\t\tcase CardIds.HoggyBank_BG30_MagicItem_411:\r\n\t\t\treturn HoggyBank;\r\n\t\tcase CardIds.AutomatonPortrait_BG30_MagicItem_303:\r\n\t\t\treturn AutomatonPortrait;\r\n\t\tcase CardIds.ShipInABottle_BG30_MagicItem_407:\r\n\t\t\treturn ShipInABottle;\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\t\treturn EternalPortrait;\r\n\t\tcase CardIds.ArtisanalUrn_BG30_MagicItem_989:\r\n\t\tcase CardIds.ArtisanalUrn_ArtisanalUrnToken_BG30_MagicItem_989t:\r\n\t\t\treturn ArtisanalUrn;\r\n\t\tcase CardIds.RivendarePortrait_BG30_MagicItem_310:\r\n\t\t\treturn RivendarePortrait;\r\n\t\tcase CardIds.TinyfinOnesie_BG30_MagicItem_441:\r\n\t\t\treturn TinyfinOnesie;\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\t\treturn BronzeTimepiece;\r\n\t\tcase CardIds.IronforgeAnvil_BG30_MagicItem_403:\r\n\t\t\treturn IronforgeAnvil;\r\n\t\tcase CardIds.KarazhanChessSet_BG30_MagicItem_972:\r\n\t\t\treturn KarazhanChessSet;\r\n\t\tcase CardIds.FishySticker_BG30_MagicItem_821:\r\n\t\tcase CardIds.FishySticker_FishyStickerToken_BG30_MagicItem_821t2:\r\n\t\t\treturn FishySticker;\r\n\t\tcase CardIds.SummoningSphere_BGDUO_MagicItem_003:\r\n\t\t\treturn SummoningSphere;\r\n\r\n\t\t// Hero powers\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\t\treturn SwattingInsects;\r\n\t\tcase CardIds.EarthInvocationToken:\r\n\t\t\treturn EarthInvocation;\r\n\t\tcase CardIds.WaterInvocationToken:\r\n\t\t\treturn WaterInvocation;\r\n\t\tcase CardIds.FireInvocationToken:\r\n\t\t\treturn FireInvocation;\r\n\t\tcase CardIds.LightningInvocationToken:\r\n\t\t\treturn LightningInvocation;\r\n\t\tcase CardIds.AllWillBurn:\r\n\t\t\treturn AllWillBurn;\r\n\t\tcase CardIds.TamsinRoame_FragrantPhylactery:\r\n\t\t\treturn FragrantPhylactery;\r\n\t\tcase CardIds.EmbraceYourRage:\r\n\t\t\treturn EmbraceYourRage;\r\n\t\tcase CardIds.Ozumat_Tentacular:\r\n\t\t\treturn Tentacular;\r\n\t\tcase CardIds.RebornRites:\r\n\t\t\treturn RebornRites;\r\n\t\tcase CardIds.TeronGorefiend_RapidReanimation:\r\n\t\t\treturn RapidReanimation;\r\n\t\tcase CardIds.WaxWarband:\r\n\t\t\treturn WaxWarband;\r\n\t\tcase CardIds.FlobbidinousFloop_GloriousGloop_BGDUO_HERO_101p:\r\n\t\t\treturn GloriousGloop;\r\n\t\tcase CardIds.AimLeftToken:\r\n\t\t\treturn AimLeft;\r\n\t\tcase CardIds.AimRightToken:\r\n\t\t\treturn AimRight;\r\n\t\tcase CardIds.AimLowToken:\r\n\t\t\treturn AimLow;\r\n\t\tcase CardIds.AimHighToken:\r\n\t\t\treturn AimHigh;\r\n\r\n\t\t// Anomalies\r\n\t\tcase CardIds.BlessedOrBlighted_BG27_Anomaly_726:\r\n\t\t\treturn BlessedOrBlighted;\r\n\t\tcase CardIds.AnomalousTwin_BG27_Anomaly_560:\r\n\t\t\treturn AnomalousTwin;\r\n\r\n\t\t// Minions\r\n\t\tcase CardIds.RedWhelp_BGS_019:\r\n\t\tcase CardIds.RedWhelp_TB_BaconUps_102:\r\n\t\t\treturn RedWhelp;\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014:\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014_G:\r\n\t\t\treturn PrizedPromoDrake;\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354:\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354_G:\r\n\t\t\treturn ChoralMrrrglr;\r\n\t\tcase CardIds.AmberGuardian_BG24_500:\r\n\t\tcase CardIds.AmberGuardian_BG24_500_G:\r\n\t\t\treturn AmberGuardian;\r\n\t\tcase CardIds.SanctumRester_BG26_356:\r\n\t\tcase CardIds.SanctumRester_BG26_356_G:\r\n\t\t\treturn SanctumRester;\r\n\t\tcase CardIds.Soulsplitter_BG25_023:\r\n\t\tcase CardIds.Soulsplitter_BG25_023_G:\r\n\t\t\treturn Soulsplitter;\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy:\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy_G:\r\n\t\t\treturn Crabby;\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012:\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012_G:\r\n\t\t\treturn CorruptedMyrmidon;\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704:\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704_G:\r\n\t\t\treturn InterrogatorWhitemane;\r\n\t\tcase CardIds.MantidQueen_BG22_402:\r\n\t\tcase CardIds.MantidQueen_BG22_402_G:\r\n\t\t\treturn MantidQueen;\r\n\t\tcase CardIds.CarbonicCopy_BG27_503:\r\n\t\tcase CardIds.CarbonicCopy_BG27_503_G:\r\n\t\t\treturn CarbonicCopy;\r\n\t\tcase CardIds.DiremuckForager_BG27_556:\r\n\t\tcase CardIds.DiremuckForager_BG27_556_G:\r\n\t\t\treturn DiremuckForager;\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079:\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079_G:\r\n\t\t\treturn HawkstriderHerald;\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904:\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904_G:\r\n\t\t\treturn AudaciousAnchor;\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy:\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy_G:\r\n\t\t\treturn PilotedWhirlOTron;\r\n\t\tcase CardIds.IrateRooster_BG29_990:\r\n\t\tcase CardIds.IrateRooster_BG29_990_G:\r\n\t\t\treturn IrateRooster;\r\n\t\tcase CardIds.MisfitDragonling_BG29_814:\r\n\t\tcase CardIds.MisfitDragonling_BG29_814_G:\r\n\t\t\treturn MisfitDragonling;\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810:\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810_G:\r\n\t\t\treturn ThousandthPaperDrake;\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811:\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811_G:\r\n\t\t\treturn YulonFortuneGranter;\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872:\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872_G:\r\n\t\t\treturn HoardingHatespawn;\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875:\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875_G:\r\n\t\t\treturn TheUninvitedGuest;\r\n\t\tcase CardIds.Sandy_BGDUO_125:\r\n\t\tcase CardIds.Sandy_BGDUO_125_G:\r\n\t\t\treturn Sandy;\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy:\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_G:\r\n\t\t\treturn Vaelastrasz;\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy:\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy_G:\r\n\t\t\treturn ElderTaggawag;\r\n\t\tcase CardIds.SunScreener_BG30_101:\r\n\t\tcase CardIds.SunScreener_BG30_101_G:\r\n\t\t\treturn SunScreener;\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119:\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119_G:\r\n\t\t\treturn SkyPirateFlagbearer;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\treturn HummingBird;\r\n\r\n\t\tdefault:\r\n\t\t\treturn null;\r\n\t}\r\n};\r\n\r\nconst onStartOfCombatTriggered = (iteration: number, triggeredCardId: string, playerEntity: BgsPlayerEntity) => {\r\n\t// Some procs are iso-functional, and don't update the promo portrait\r\n\tconst promoPortraits = playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t);\r\n\tif (promoPortraits.length === 0 || iteration === 0 || iteration >= promoPortraits.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tswitch (triggeredCardId) {\r\n\t\tcase CardIds.StolenGold:\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\tcase CardIds.RebornRites:\r\n\t\t\treturn;\r\n\t}\r\n\r\n\tconst promoPortrait = promoPortraits[iteration - 1];\r\n\tpromoPortrait.scriptDataNum1--;\r\n};\r\n\r\nconst getPromoPortraitCount = (playerEntity: BgsPlayerEntity) => {\r\n\treturn playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t).length;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"soc-action-processor.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-action-processor.ts"],"names":[],"mappings":";;;AAKA,4EAAwE;AACxE,sFAAiF;AACjF,+EAA0E;AAC1E,iFAA6E;AAC7E,qEAAiE;AACjE,mEAA+D;AAC/D,mEAA+D;AAC/D,iEAA6D;AAC7D,qEAAiE;AACjE,6EAAwE;AACxE,mFAA+E;AAC/E,qFAAgF;AAChF,iFAA6E;AAC7E,yFAAqF;AACrF,+EAA2E;AAC3E,2FAAuF;AACvF,qFAAiF;AACjF,2EAAuE;AACvE,mFAA+E;AAC/E,uEAAoE;AACpE,mFAA+E;AAC/E,yEAAqE;AACrE,2EAAuE;AACvE,+EAA2E;AAC3E,yEAAqE;AACrE,2EAAuE;AACvE,mFAA+E;AAC/E,2DAAwD;AACxD,+EAA2E;AAC3E,2EAAuE;AACvE,mFAA+E;AAC/E,mFAA+E;AAC/E,uEAAmE;AACnE,2FAAuF;AACvF,yEAAqE;AACrE,uEAAmE;AACnE,iFAA6E;AAC7E,uFAAiF;AACjF,mFAA8E;AAC9E,iEAA6D;AAC7D,2EAAuE;AACvE,yDAAsD;AACtD,yFAAoF;AACpF,uEAAoE;AACpE,uEAAmE;AACnE,qFAAgF;AAChF,2FAAsF;AACtF,qEAAkE;AAClE,yFAAoF;A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c,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,IAAI,SAAS,GAAG,cAAc,CAAC,MAAM,EAAE;QACxF,OAAO;KACP;IAED,QAAQ,eAAe,EAAE;QACxB,uBAAwB;QACxB,0BAA2C;QAC3C,0BAAoD;QACpD,0BAAgD;QAChD,0BAAgD;QAChD,2BAA6B;QAC7B,2BAAyB;QACzB;YACC,OAAO;KACR;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACpD,aAAa,CAAC,cAAc,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,YAA6B,EAAE,EAAE;IAC/D,OAAO,YAAY,CAAC,QAAQ,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAA6C,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,CACpF,CAAC,MAAM,CAAC;AACV,CAAC,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { StartOfCombatCard, StartOfCombatTiming } from '../../cards/card.interface';\r\nimport { AnomalousTwin } from '../../cards/impl/anomaly/anomalous-twin';\r\nimport { BlessedOrBlighted } from '../../cards/impl/anomaly/blessed-or-blighted';\r\nimport { BoonOfBeetles } from '../../cards/impl/bg-spell/boon-of-beetles';\r\nimport { ToxicTumbleweed } from '../../cards/impl/bg-spell/toxic-tumbleweed';\r\nimport { UpperHand } from '../../cards/impl/bg-spell/upper-hand';\r\nimport { AimHigh } from '../../cards/impl/hero-power/aim-high';\r\nimport { AimLeft } from '../../cards/impl/hero-power/aim-left';\r\nimport { AimLow } from '../../cards/impl/hero-power/aim-low';\r\nimport { AimRight } from '../../cards/impl/hero-power/aim-right';\r\nimport { AllWillBurn } from '../../cards/impl/hero-power/all-will-burn';\r\nimport { EarthInvocation } from '../../cards/impl/hero-power/earth-invocation';\r\nimport { EmbraceYourRage } from '../../cards/impl/hero-power/embrace-your-rage';\r\nimport { FireInvocation } from '../../cards/impl/hero-power/fire-invocation';\r\nimport { FragrantPhylactery } from '../../cards/impl/hero-power/fragrant-phylactery';\r\nimport { GloriousGloop } from '../../cards/impl/hero-power/glorious-gloop';\r\nimport { LightningInvocation } from '../../cards/impl/hero-power/lightning-invocation';\r\nimport { RapidReanimation } from '../../cards/impl/hero-power/rapid-reanimation';\r\nimport { RebornRites } from '../../cards/impl/hero-power/reborn-rites';\r\nimport { SwattingInsects } from '../../cards/impl/hero-power/swatting-insects';\r\nimport { Tentacular } from '../../cards/impl/hero-power/tentacular';\r\nimport { WaterInvocation } from '../../cards/impl/hero-power/water-invocation';\r\nimport { WaxWarband } from '../../cards/impl/hero-power/wax-warband';\r\nimport { AmberGuardian } from '../../cards/impl/minion/amber-guardian';\r\nimport { AudaciousAnchor } from '../../cards/impl/minion/audacious-anchor';\r\nimport { CarbonicCopy } from '../../cards/impl/minion/carbonic-copy';\r\nimport { ChoralMrrrglr } from '../../cards/impl/minion/choral-mrrrglr';\r\nimport { CorruptedMyrmidon } from '../../cards/impl/minion/corrupted-myrmidon';\r\nimport { Crabby } from '../../cards/impl/minion/crabby';\r\nimport { DiremuckForager } from '../../cards/impl/minion/diremuck-forager';\r\nimport { ElderTaggawag } from '../../cards/impl/minion/elder-taggawag';\r\nimport { HawkstriderHerald } from '../../cards/impl/minion/hawkstrider-herald';\r\nimport { HoardingHatespawn } from '../../cards/impl/minion/hoarding-hatespawn';\r\nimport { HummingBird } from '../../cards/impl/minion/humming-bird';\r\nimport { InterrogatorWhitemane } from '../../cards/impl/minion/interrogator-whitemane';\r\nimport { IrateRooster } from '../../cards/impl/minion/irate-rooster';\r\nimport { MantidQueen } from '../../cards/impl/minion/mantid-queen';\r\nimport { MisfitDragonling } from '../../cards/impl/minion/misfit-dragonling';\r\nimport { PilotedWhirlOTron } from '../../cards/impl/minion/piloted-whirl-o-tron';\r\nimport { PrizedPromoDrake } from '../../cards/impl/minion/prized-promo-drake';\r\nimport { RedWhelp } from '../../cards/impl/minion/red-whelp';\r\nimport { SanctumRester } from '../../cards/impl/minion/sanctum-rester';\r\nimport { Sandy } from '../../cards/impl/minion/sandy';\r\nimport { SkyPirateFlagbearer } from '../../cards/impl/minion/sky-pirate-flagbearer';\r\nimport { Soulsplitter } from '../../cards/impl/minion/soulsplitter';\r\nimport { SunScreener } from '../../cards/impl/minion/sun-screener';\r\nimport { TheUninvitedGuest } from '../../cards/impl/minion/the-uninvited-guest';\r\nimport { ThousandthPaperDrake } from '../../cards/impl/minion/thousandth-paper-drake';\r\nimport { Vaelastrasz } from '../../cards/impl/minion/vaelastrasz';\r\nimport { YulonFortuneGranter } from '../../cards/impl/minion/yulon-fortune-granter';\r\nimport { EvilTwin } from '../../cards/impl/quest-reward/evil-twin';\r\nimport { StaffOfOrigination } from '../../cards/impl/quest-reward/staff-of-origination';\r\nimport { StolenGold } from '../../cards/impl/quest-reward/stolen-gold';\r\nimport { FleetingVigor } from '../../cards/impl/spell/fleeting-vigor';\r\nimport { ArtisanalUrn } from '../../cards/impl/trinket/artisanal-urn';\r\nimport { AutomatonPortrait } from '../../cards/impl/trinket/automaton-portrait';\r\nimport { BronzeTimepiece } from '../../cards/impl/trinket/bronze-timepiece';\r\nimport { EmeraldDreamcatcher } from '../../cards/impl/trinket/emerald-dreamcatcher';\r\nimport { EternalPortrait } from '../../cards/impl/trinket/eternal-portrait';\r\nimport { FishySticker } from '../../cards/impl/trinket/fishy-sticker';\r\nimport { HoggyBank } from '../../cards/impl/trinket/hoggy-bank';\r\nimport { HollyMallet } from '../../cards/impl/trinket/holly-mallet';\r\nimport { IronforgeAnvil } from '../../cards/impl/trinket/ironforge-anvil';\r\nimport { JarredFrostling } from '../../cards/impl/trinket/jarred-frostling';\r\nimport { KarazhanChessSet } from '../../cards/impl/trinket/karazhan-chess-set';\r\nimport { RivendarePortrait } from '../../cards/impl/trinket/rivendare-portrait';\r\nimport { RustyTrident } from '../../cards/impl/trinket/rusty-trident';\r\nimport { ShipInABottle } from '../../cards/impl/trinket/ship-in-a-bottle';\r\nimport { SummoningSphere } from '../../cards/impl/trinket/summoning-sphere';\r\nimport { TinyfinOnesie } from '../../cards/impl/trinket/tinyfin-onesie';\r\nimport { TrainingCertificate } from '../../cards/impl/trinket/training-certificate';\r\nimport { ValorousMedallion } from '../../cards/impl/trinket/valorous-medaillion';\r\nimport { processMinionDeath } from '../attack';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const performStartOfCombatAction = (\r\n\tcardId: string,\r\n\tentity: BoardEntity | BoardTrinket | BgsPlayerEntity | BoardSecret,\r\n\tinput: SoCInput,\r\n\tprocessDeaths: boolean,\r\n\ttiming?: StartOfCombatTiming,\r\n): boolean => {\r\n\tlet hasTriggered:\r\n\t\t| boolean\r\n\t\t| {\r\n\t\t\t\thasTriggered: boolean;\r\n\t\t\t\tshouldRecomputeCurrentAttacker: boolean;\r\n\t\t } = false;\r\n\tconst promoPortraitCount = getPromoPortraitCount(input.playerEntity);\r\n\tfor (let i = promoPortraitCount; i >= 0; i--) {\r\n\t\tconst card = getStartOfCombatAction(cardId);\r\n\t\tif (!!timing && card?.startOfCombatTiming !== timing) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst action = card?.startOfCombat;\r\n\t\tif (!!action) {\r\n\t\t\thasTriggered = action(entity, input);\r\n\t\t\t// Always proc it (for promo portrait), and use the hasTriggered for finer control\r\n\t\t\tonStartOfCombatTriggered(i, cardId, input.playerEntity);\r\n\t\t\tif (!!hasTriggered) {\r\n\t\t\t\tif (processDeaths) {\r\n\t\t\t\t\tprocessMinionDeath(\r\n\t\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tif (typeof hasTriggered !== 'boolean' && hasTriggered.shouldRecomputeCurrentAttacker) {\r\n\t\t\t\t\tinput.currentAttacker =\r\n\t\t\t\t\t\tinput.playerBoard.length > input.opponentBoard.length\r\n\t\t\t\t\t\t\t? input.playerIsFriendly\r\n\t\t\t\t\t\t\t\t? 0\r\n\t\t\t\t\t\t\t\t: 1\r\n\t\t\t\t\t\t\t: input.opponentBoard.length > input.playerBoard.length\r\n\t\t\t\t\t\t\t? input.playerIsFriendly\r\n\t\t\t\t\t\t\t\t? 1\r\n\t\t\t\t\t\t\t\t: 0\r\n\t\t\t\t\t\t\t: Math.round(Math.random());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn !!hasTriggered;\r\n};\r\n\r\n// TODO: load all cards on start, then do some programmatic mapping\r\nconst getStartOfCombatAction = (cardId: string): StartOfCombatCard => {\r\n\tswitch (cardId) {\r\n\t\t// Quest rewards\r\n\t\tcase CardIds.EvilTwin:\r\n\t\t\treturn EvilTwin;\r\n\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\treturn StaffOfOrigination;\r\n\t\tcase CardIds.StolenGold:\r\n\t\t\treturn StolenGold;\r\n\r\n\t\t// Trinkets\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\t\treturn HollyMallet;\r\n\t\tcase CardIds.TrainingCertificate_BG30_MagicItem_962:\r\n\t\t\treturn TrainingCertificate;\r\n\t\tcase CardIds.ValorousMedallion_BG30_MagicItem_970:\r\n\t\tcase CardIds.ValorousMedallion_ValorousMedallionToken_BG30_MagicItem_970t:\r\n\t\t\treturn ValorousMedallion;\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\t\treturn EmeraldDreamcatcher;\r\n\t\tcase CardIds.JarredFrostling_BG30_MagicItem_952:\r\n\t\t\treturn JarredFrostling;\r\n\t\tcase CardIds.RustyTrident_BG30_MagicItem_917:\r\n\t\t\treturn RustyTrident;\r\n\t\tcase CardIds.HoggyBank_BG30_MagicItem_411:\r\n\t\t\treturn HoggyBank;\r\n\t\tcase CardIds.AutomatonPortrait_BG30_MagicItem_303:\r\n\t\t\treturn AutomatonPortrait;\r\n\t\tcase CardIds.ShipInABottle_BG30_MagicItem_407:\r\n\t\t\treturn ShipInABottle;\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\t\treturn EternalPortrait;\r\n\t\tcase CardIds.ArtisanalUrn_BG30_MagicItem_989:\r\n\t\tcase CardIds.ArtisanalUrn_ArtisanalUrnToken_BG30_MagicItem_989t:\r\n\t\t\treturn ArtisanalUrn;\r\n\t\tcase CardIds.RivendarePortrait_BG30_MagicItem_310:\r\n\t\t\treturn RivendarePortrait;\r\n\t\tcase CardIds.TinyfinOnesie_BG30_MagicItem_441:\r\n\t\t\treturn TinyfinOnesie;\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\t\treturn BronzeTimepiece;\r\n\t\tcase CardIds.IronforgeAnvil_BG30_MagicItem_403:\r\n\t\t\treturn IronforgeAnvil;\r\n\t\tcase CardIds.KarazhanChessSet_BG30_MagicItem_972:\r\n\t\t\treturn KarazhanChessSet;\r\n\t\tcase CardIds.FishySticker_BG30_MagicItem_821:\r\n\t\tcase CardIds.FishySticker_FishyStickerToken_BG30_MagicItem_821t2:\r\n\t\t\treturn FishySticker;\r\n\t\tcase CardIds.SummoningSphere_BGDUO_MagicItem_003:\r\n\t\t\treturn SummoningSphere;\r\n\r\n\t\t// Hero powers\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\t\treturn SwattingInsects;\r\n\t\tcase CardIds.EarthInvocationToken:\r\n\t\t\treturn EarthInvocation;\r\n\t\tcase CardIds.WaterInvocationToken:\r\n\t\t\treturn WaterInvocation;\r\n\t\tcase CardIds.FireInvocationToken:\r\n\t\t\treturn FireInvocation;\r\n\t\tcase CardIds.LightningInvocationToken:\r\n\t\t\treturn LightningInvocation;\r\n\t\tcase CardIds.AllWillBurn:\r\n\t\t\treturn AllWillBurn;\r\n\t\tcase CardIds.TamsinRoame_FragrantPhylactery:\r\n\t\t\treturn FragrantPhylactery;\r\n\t\tcase CardIds.EmbraceYourRage:\r\n\t\t\treturn EmbraceYourRage;\r\n\t\tcase CardIds.Ozumat_Tentacular:\r\n\t\t\treturn Tentacular;\r\n\t\tcase CardIds.RebornRites:\r\n\t\t\treturn RebornRites;\r\n\t\tcase CardIds.TeronGorefiend_RapidReanimation:\r\n\t\t\treturn RapidReanimation;\r\n\t\tcase CardIds.WaxWarband:\r\n\t\t\treturn WaxWarband;\r\n\t\tcase CardIds.FlobbidinousFloop_GloriousGloop_BGDUO_HERO_101p:\r\n\t\t\treturn GloriousGloop;\r\n\t\tcase CardIds.AimLeftToken:\r\n\t\t\treturn AimLeft;\r\n\t\tcase CardIds.AimRightToken:\r\n\t\t\treturn AimRight;\r\n\t\tcase CardIds.AimLowToken:\r\n\t\t\treturn AimLow;\r\n\t\tcase CardIds.AimHighToken:\r\n\t\t\treturn AimHigh;\r\n\r\n\t\t// Anomalies\r\n\t\tcase CardIds.BlessedOrBlighted_BG27_Anomaly_726:\r\n\t\t\treturn BlessedOrBlighted;\r\n\t\tcase CardIds.AnomalousTwin_BG27_Anomaly_560:\r\n\t\t\treturn AnomalousTwin;\r\n\t\tcase CardIds.BoonOfBeetles_BG28_603:\r\n\t\t\treturn BoonOfBeetles;\r\n\r\n\t\t// Spells\r\n\t\tcase CardIds.ToxicTumbleweed_BG28_641:\r\n\t\t\treturn ToxicTumbleweed;\r\n\t\tcase CardIds.UpperHand_BG28_573:\r\n\t\t\treturn UpperHand;\r\n\t\tcase CardIds.FleetingVigor_BG28_519:\r\n\t\t\treturn FleetingVigor;\r\n\r\n\t\t// Minions\r\n\t\tcase CardIds.RedWhelp_BGS_019:\r\n\t\tcase CardIds.RedWhelp_TB_BaconUps_102:\r\n\t\t\treturn RedWhelp;\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014:\r\n\t\tcase CardIds.PrizedPromoDrake_BG21_014_G:\r\n\t\t\treturn PrizedPromoDrake;\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354:\r\n\t\tcase CardIds.ChoralMrrrglr_BG26_354_G:\r\n\t\t\treturn ChoralMrrrglr;\r\n\t\tcase CardIds.AmberGuardian_BG24_500:\r\n\t\tcase CardIds.AmberGuardian_BG24_500_G:\r\n\t\t\treturn AmberGuardian;\r\n\t\tcase CardIds.SanctumRester_BG26_356:\r\n\t\tcase CardIds.SanctumRester_BG26_356_G:\r\n\t\t\treturn SanctumRester;\r\n\t\tcase CardIds.Soulsplitter_BG25_023:\r\n\t\tcase CardIds.Soulsplitter_BG25_023_G:\r\n\t\t\treturn Soulsplitter;\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy:\r\n\t\tcase CardIds.Crabby_BG22_HERO_000_Buddy_G:\r\n\t\t\treturn Crabby;\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012:\r\n\t\tcase CardIds.CorruptedMyrmidon_BG23_012_G:\r\n\t\t\treturn CorruptedMyrmidon;\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704:\r\n\t\tcase CardIds.InterrogatorWhitemane_BG24_704_G:\r\n\t\t\treturn InterrogatorWhitemane;\r\n\t\tcase CardIds.MantidQueen_BG22_402:\r\n\t\tcase CardIds.MantidQueen_BG22_402_G:\r\n\t\t\treturn MantidQueen;\r\n\t\tcase CardIds.CarbonicCopy_BG27_503:\r\n\t\tcase CardIds.CarbonicCopy_BG27_503_G:\r\n\t\t\treturn CarbonicCopy;\r\n\t\tcase CardIds.DiremuckForager_BG27_556:\r\n\t\tcase CardIds.DiremuckForager_BG27_556_G:\r\n\t\t\treturn DiremuckForager;\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079:\r\n\t\tcase CardIds.HawkstriderHerald_BG27_079_G:\r\n\t\t\treturn HawkstriderHerald;\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904:\r\n\t\tcase CardIds.AudaciousAnchor_BG28_904_G:\r\n\t\t\treturn AudaciousAnchor;\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy:\r\n\t\tcase CardIds.PilotedWhirlOTron_BG21_HERO_030_Buddy_G:\r\n\t\t\treturn PilotedWhirlOTron;\r\n\t\tcase CardIds.IrateRooster_BG29_990:\r\n\t\tcase CardIds.IrateRooster_BG29_990_G:\r\n\t\t\treturn IrateRooster;\r\n\t\tcase CardIds.MisfitDragonling_BG29_814:\r\n\t\tcase CardIds.MisfitDragonling_BG29_814_G:\r\n\t\t\treturn MisfitDragonling;\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810:\r\n\t\tcase CardIds.ThousandthPaperDrake_BG29_810_G:\r\n\t\t\treturn ThousandthPaperDrake;\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811:\r\n\t\tcase CardIds.YulonFortuneGranter_BG29_811_G:\r\n\t\t\treturn YulonFortuneGranter;\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872:\r\n\t\tcase CardIds.HoardingHatespawn_BG29_872_G:\r\n\t\t\treturn HoardingHatespawn;\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875:\r\n\t\tcase CardIds.TheUninvitedGuest_BG29_875_G:\r\n\t\t\treturn TheUninvitedGuest;\r\n\t\tcase CardIds.Sandy_BGDUO_125:\r\n\t\tcase CardIds.Sandy_BGDUO_125_G:\r\n\t\t\treturn Sandy;\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy:\r\n\t\tcase CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_G:\r\n\t\t\treturn Vaelastrasz;\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy:\r\n\t\tcase CardIds.ElderTaggawag_TB_BaconShop_HERO_14_Buddy_G:\r\n\t\t\treturn ElderTaggawag;\r\n\t\tcase CardIds.SunScreener_BG30_101:\r\n\t\tcase CardIds.SunScreener_BG30_101_G:\r\n\t\t\treturn SunScreener;\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119:\r\n\t\tcase CardIds.SkyPirateFlagbearer_BG30_119_G:\r\n\t\t\treturn SkyPirateFlagbearer;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\treturn HummingBird;\r\n\r\n\t\tdefault:\r\n\t\t\treturn null;\r\n\t}\r\n};\r\n\r\nconst onStartOfCombatTriggered = (iteration: number, triggeredCardId: string, playerEntity: BgsPlayerEntity) => {\r\n\t// Some procs are iso-functional, and don't update the promo portrait\r\n\tconst promoPortraits = playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t);\r\n\tif (promoPortraits.length === 0 || iteration === 0 || iteration > promoPortraits.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tswitch (triggeredCardId) {\r\n\t\tcase CardIds.StolenGold:\r\n\t\tcase CardIds.HolyMallet_BG30_MagicItem_902:\r\n\t\tcase CardIds.EmeraldDreamcatcher_BG30_MagicItem_542:\r\n\t\tcase CardIds.EternalPortrait_BG30_MagicItem_301:\r\n\t\tcase CardIds.BronzeTimepiece_BG30_MagicItem_995:\r\n\t\tcase CardIds.SwattingInsects:\r\n\t\tcase CardIds.RebornRites:\r\n\t\tcase CardIds.BoonOfBeetles_BG28_603:\r\n\t\t\treturn;\r\n\t}\r\n\r\n\tconst promoPortrait = promoPortraits[iteration - 1];\r\n\tpromoPortrait.scriptDataNum1--;\r\n};\r\n\r\nconst getPromoPortraitCount = (playerEntity: BgsPlayerEntity) => {\r\n\treturn playerEntity.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PromoPortrait_BG30_MagicItem_918 && t.scriptDataNum1 > 0,\r\n\t).length;\r\n};\r\n"]}
|
|
@@ -32,7 +32,7 @@ const handleStartOfCombatAnomaliesForPlayer = (input) => {
|
|
|
32
32
|
return input.currentAttacker;
|
|
33
33
|
}
|
|
34
34
|
for (const anomaly of input.gameState.anomalies) {
|
|
35
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(anomaly, input.playerEntity, input);
|
|
35
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(anomaly, input.playerEntity, input, false);
|
|
36
36
|
}
|
|
37
37
|
return input.currentAttacker;
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-anomalies.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-anomalies.ts"],"names":[],"mappings":";;;AAGA,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,4BAA4B,GAAG,CAC3C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,eAAe,GAAG,qCAAqC,CAAC;QACvD,YAAY,EAAE,YAAY;QAC1B,WAAW,EAAE,WAAW;QACxB,cAAc,EAAE,cAAc;QAC9B,aAAa,EAAE,aAAa;QAC5B,eAAe;QACf,SAAS;QACT,gBAAgB,EAAE,IAAI;KACtB,CAAC,CAAC;IACH,eAAe,GAAG,qCAAqC,CAAC;QACvD,YAAY,EAAE,cAAc;QAC5B,WAAW,EAAE,aAAa;QAC1B,cAAc,EAAE,YAAY;QAC5B,aAAa,EAAE,WAAW;QAC1B,eAAe;QACf,SAAS;QACT,gBAAgB,EAAE,KAAK;KACvB,CAAC,CAAC;IACH,IAAA,0CAAsB,EAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAC5F,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC;AA5BW,QAAA,4BAA4B,gCA4BvC;AAEF,MAAM,qCAAqC,GAAG,CAAC,KAAe,EAAU,EAAE;;IACzE,IAAI,CAAC,CAAA,MAAA,KAAK,C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KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE;QAC/E,OAAO,KAAK,CAAC,eAAe,CAAC;KAC7B;IAED,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE;QAChD,IAAA,iDAA0B,EAAC,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KACtE;IAED,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatAnomalies = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tcurrentAttacker = handleStartOfCombatAnomaliesForPlayer({\r\n\t\tplayerEntity: playerEntity,\r\n\t\tplayerBoard: playerBoard,\r\n\t\topponentEntity: opponentEntity,\r\n\t\topponentBoard: opponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tgameState,\r\n\t\tplayerIsFriendly: true,\r\n\t});\r\n\tcurrentAttacker = handleStartOfCombatAnomaliesForPlayer({\r\n\t\tplayerEntity: opponentEntity,\r\n\t\tplayerBoard: opponentBoard,\r\n\t\topponentEntity: playerEntity,\r\n\t\topponentBoard: playerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tgameState,\r\n\t\tplayerIsFriendly: false,\r\n\t});\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatAnomaliesForPlayer = (input: SoCInput): number => {\r\n\tif (!input.gameState.anomalies?.length || input.playerEntity.startOfCombatDone) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tfor (const anomaly of input.gameState.anomalies) {\r\n\t\tperformStartOfCombatAction(anomaly, input.playerEntity, input, false);\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getHeroPowerForHero = exports.handleStartOfCombatHeroPowers = void 0;
|
|
4
|
-
const attack_1 = require("../attack");
|
|
5
4
|
const summon_when_space_1 = require("../summon-when-space");
|
|
6
5
|
const soc_action_processor_1 = require("./soc-action-processor");
|
|
7
6
|
const handleStartOfCombatHeroPowers = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
@@ -54,8 +53,7 @@ const handlePlayerStartOfCombatHeroPowers = (input) => {
|
|
|
54
53
|
return input.currentAttacker;
|
|
55
54
|
}
|
|
56
55
|
const playerHeroPowerId = input.playerEntity.heroPowerId || (0, exports.getHeroPowerForHero)(input.playerEntity.cardId);
|
|
57
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, 'start-of-combat');
|
|
58
|
-
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
56
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, true, 'start-of-combat');
|
|
59
57
|
return input.currentAttacker;
|
|
60
58
|
};
|
|
61
59
|
const getHeroPowerForHero = (heroCardId) => {
|