@firestone-hs/simulate-bgs-battle 1.1.488 → 1.1.490
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 +4 -2
- package/dist/cards/card.interface.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-high.d.ts +2 -5
- package/dist/cards/impl/hero-power/aim-high.js +1 -0
- package/dist/cards/impl/hero-power/aim-high.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-left.d.ts +2 -5
- package/dist/cards/impl/hero-power/aim-left.js +1 -0
- package/dist/cards/impl/hero-power/aim-left.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-low.d.ts +2 -5
- package/dist/cards/impl/hero-power/aim-low.js +1 -0
- package/dist/cards/impl/hero-power/aim-low.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-right.d.ts +2 -5
- package/dist/cards/impl/hero-power/aim-right.js +1 -0
- package/dist/cards/impl/hero-power/aim-right.js.map +1 -1
- package/dist/cards/impl/hero-power/all-will-burn.d.ts +2 -5
- package/dist/cards/impl/hero-power/all-will-burn.js +1 -0
- package/dist/cards/impl/hero-power/all-will-burn.js.map +1 -1
- package/dist/cards/impl/hero-power/earth-invocation.d.ts +2 -5
- package/dist/cards/impl/hero-power/earth-invocation.js +1 -0
- package/dist/cards/impl/hero-power/earth-invocation.js.map +1 -1
- package/dist/cards/impl/hero-power/embrace-your-rage.d.ts +2 -8
- package/dist/cards/impl/hero-power/embrace-your-rage.js +1 -0
- package/dist/cards/impl/hero-power/embrace-your-rage.js.map +1 -1
- package/dist/cards/impl/hero-power/fire-invocation.d.ts +2 -5
- package/dist/cards/impl/hero-power/fire-invocation.js +1 -0
- package/dist/cards/impl/hero-power/fire-invocation.js.map +1 -1
- package/dist/cards/impl/hero-power/fragrant-phylactery.d.ts +2 -8
- package/dist/cards/impl/hero-power/fragrant-phylactery.js +1 -0
- package/dist/cards/impl/hero-power/fragrant-phylactery.js.map +1 -1
- package/dist/cards/impl/hero-power/glorious-gloop.d.ts +2 -5
- package/dist/cards/impl/hero-power/glorious-gloop.js +1 -0
- package/dist/cards/impl/hero-power/glorious-gloop.js.map +1 -1
- package/dist/cards/impl/hero-power/lightning-invocation.d.ts +2 -5
- package/dist/cards/impl/hero-power/lightning-invocation.js +1 -0
- package/dist/cards/impl/hero-power/lightning-invocation.js.map +1 -1
- package/dist/cards/impl/hero-power/rapid-reanimation.d.ts +2 -8
- package/dist/cards/impl/hero-power/rapid-reanimation.js +1 -0
- package/dist/cards/impl/hero-power/rapid-reanimation.js.map +1 -1
- package/dist/cards/impl/hero-power/reborn-rites.d.ts +2 -5
- package/dist/cards/impl/hero-power/reborn-rites.js +1 -0
- package/dist/cards/impl/hero-power/reborn-rites.js.map +1 -1
- package/dist/cards/impl/hero-power/swatting-insects.d.ts +2 -5
- package/dist/cards/impl/hero-power/swatting-insects.js +1 -0
- package/dist/cards/impl/hero-power/swatting-insects.js.map +1 -1
- package/dist/cards/impl/hero-power/tentacular.d.ts +2 -8
- package/dist/cards/impl/hero-power/tentacular.js +1 -0
- package/dist/cards/impl/hero-power/tentacular.js.map +1 -1
- package/dist/cards/impl/hero-power/water-invocation.d.ts +2 -5
- package/dist/cards/impl/hero-power/water-invocation.js +1 -0
- package/dist/cards/impl/hero-power/water-invocation.js.map +1 -1
- package/dist/cards/impl/hero-power/wax-warband.d.ts +2 -5
- package/dist/cards/impl/hero-power/wax-warband.js +1 -0
- package/dist/cards/impl/hero-power/wax-warband.js.map +1 -1
- package/dist/cards/impl/trinket/rusty-trident.d.ts +2 -5
- package/dist/cards/impl/trinket/rusty-trident.js +2 -2
- package/dist/cards/impl/trinket/rusty-trident.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-action-processor.d.ts +3 -2
- package/dist/simulation/start-of-combat/soc-action-processor.js +6 -3
- package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-anomalies.js +9 -9
- package/dist/simulation/start-of-combat/soc-anomalies.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-hero-power.js +17 -17
- package/dist/simulation/start-of-combat/soc-hero-power.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-minion.js +12 -12
- package/dist/simulation/start-of-combat/soc-minion.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-pre-combat-hero-power.js +17 -17
- 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 +17 -17
- package/dist/simulation/start-of-combat/soc-quest-reward.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-trinket.js +16 -16
- package/dist/simulation/start-of-combat/soc-trinket.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ const utils_1 = require("../../../services/utils");
|
|
|
6
6
|
const stats_1 = require("../../../simulation/stats");
|
|
7
7
|
const utils_2 = require("../../../utils");
|
|
8
8
|
exports.WaxWarband = {
|
|
9
|
+
startOfCombatTiming: 'pre-combat',
|
|
9
10
|
startOfCombat: (trinket, input) => {
|
|
10
11
|
if (input.playerEntity.heroPowerUsed) {
|
|
11
12
|
if (input.playerBoard.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wax-warband.js","sourceRoot":"","sources":["../../../../src/cards/impl/hero-power/wax-warband.ts"],"names":[],"mappings":";;;AAAA,iEAAmF;AAGnF,mDAAuD;AAEvD,qDAAwD;AACxD,0CAA6D;
|
|
1
|
+
{"version":3,"file":"wax-warband.js","sourceRoot":"","sources":["../../../../src/cards/impl/hero-power/wax-warband.ts"],"names":[],"mappings":";;;AAAA,iEAAmF;AAGnF,mDAAuD;AAEvD,qDAAwD;AACxD,0CAA6D;AAGhD,QAAA,UAAU,GAAsB;IAC5C,mBAAmB,EAAE,YAAY;IACjC,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,IAAI,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE;YACrC,IAAI,KA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,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAC3F,CAAC;YACF,KAAK,MAAM,MAAM,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;gBAC3C,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;oBACtC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC7B,MAAM;iBACN;aACD;SACD;KACD;IAGD,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { ALL_BG_RACES, AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { shuffleArray } from '../../../services/utils';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { getEffectiveTribesForEntity } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const WaxWarband: StartOfCombatCard = {\r\n\tstartOfCombatTiming: 'pre-combat',\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tif (input.playerEntity.heroPowerUsed) {\r\n\t\t\tif (input.playerBoard.length > 0) {\r\n\t\t\t\tconst boardWithTribes = input.playerBoard.filter(\r\n\t\t\t\t\t(e) => !!getEffectiveTribesForEntity(e, input.playerEntity, input.gameState.allCards).length,\r\n\t\t\t\t);\r\n\t\t\t\tconst boardWithoutAll = boardWithTribes.filter(\r\n\t\t\t\t\t(e) => !input.gameState.allCards.getCard(e.cardId).races?.includes(Race[Race.ALL]),\r\n\t\t\t\t);\r\n\t\t\t\tconst selectedMinions = selectMinions(boardWithoutAll, ALL_BG_RACES, input.gameState.allCards);\r\n\t\t\t\tconst allMinions = [\r\n\t\t\t\t\t...selectedMinions,\r\n\t\t\t\t\t...boardWithTribes.filter((e) =>\r\n\t\t\t\t\t\tinput.gameState.allCards.getCard(e.cardId).races?.includes(Race[Race.ALL]),\r\n\t\t\t\t\t),\r\n\t\t\t\t];\r\n\t\t\t\tallMinions.forEach((e) => {\r\n\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\te,\r\n\t\t\t\t\t\tinput.gameState.cardsData.getTavernLevel(e.cardId),\r\n\t\t\t\t\t\tinput.gameState.cardsData.getTavernLevel(e.cardId),\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.gameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\t\te,\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.opponentEntity,\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n\r\n// Not perfect, as I don't think this solves the issue where some cards are mutually exclusive\r\nconst selectMinions = (minions: BoardEntity[], tribes: Race[], allCards: AllCardsService): BoardEntity[] => {\r\n\t// Step 1\r\n\tconst minionsByTribe: { [tribe: string]: BoardEntity[] } = {};\r\n\tfor (const minion of minions) {\r\n\t\tfor (const tribe of allCards.getCard(minion.cardId).races ?? []) {\r\n\t\t\tif (!minionsByTribe[tribe]) {\r\n\t\t\t\tminionsByTribe[tribe] = [];\r\n\t\t\t}\r\n\t\t\tminionsByTribe[tribe].push(minion);\r\n\t\t}\r\n\t}\r\n\tfor (const tribe of ALL_BG_RACES) {\r\n\t\tminionsByTribe[tribe] = shuffleArray(minionsByTribe[Race[tribe]] ?? []);\r\n\t}\r\n\r\n\tconst selectedMinions: BoardEntity[] = [];\r\n\r\n\t// Step 3\r\n\tfor (const tribe of tribes) {\r\n\t\tif (minionsByTribe[tribe]) {\r\n\t\t\tminionsByTribe[tribe].sort(\r\n\t\t\t\t(a, b) => allCards.getCard(a.cardId).races.length - allCards.getCard(b.cardId).races.length,\r\n\t\t\t);\r\n\t\t\tfor (const minion of minionsByTribe[tribe]) {\r\n\t\t\t\tif (!selectedMinions.includes(minion)) {\r\n\t\t\t\t\tselectedMinions.push(minion);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Step 4\r\n\treturn selectedMinions;\r\n};\r\n"]}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const RustyTrident: {
|
|
4
|
-
startOfCombat: (trinket: BoardTrinket, input: SoCInput) => boolean;
|
|
5
|
-
};
|
|
1
|
+
import { StartOfCombatCard } from '../../card.interface';
|
|
2
|
+
export declare const RustyTrident: StartOfCombatCard;
|
|
@@ -8,11 +8,11 @@ exports.RustyTrident = {
|
|
|
8
8
|
input.playerBoard
|
|
9
9
|
.filter((e) => (0, utils_1.hasCorrectTribe)(e, input.playerEntity, reference_data_1.Race.NAGA, input.gameState.allCards))
|
|
10
10
|
.forEach((e) => {
|
|
11
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
12
|
e.enchantments = (_a = e.enchantments) !== null && _a !== void 0 ? _a : [];
|
|
13
13
|
e.enchantments.push({
|
|
14
14
|
cardId: "BG30_MagicItem_917e",
|
|
15
|
-
originEntityId: trinket.entityId,
|
|
15
|
+
originEntityId: (_b = trinket === null || trinket === void 0 ? void 0 : trinket.entityId) !== null && _b !== void 0 ? _b : 0,
|
|
16
16
|
repeats: 1,
|
|
17
17
|
timing: input.gameState.sharedState.currentEntityId++,
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rusty-trident.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/rusty-trident.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,0CAAiD;
|
|
1
|
+
{"version":3,"file":"rusty-trident.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/rusty-trident.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,0CAAiD;AAGpC,QAAA,YAAY,GAAsB;IAC9C,aAAa,EAAE,CAAC,OAAuC,EAAE,KAAe,EAAE,EAAE;QAC3E,KAAK,CAAC,WAAW;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,YAAY,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;aAC1F,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;;YACd,CAAC,CAAC,YAAY,GAAG,MAAA,CAAC,CAAC,YAAY,mCAAI,EAAE,CAAC;YACtC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,MAAM,uBAAsE;gBAC5E,cAAc,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,CAAC;gBACtC,OAAO,EAAE,CAAC;gBACV,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;aACrD,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../../bgs-player-entity';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const RustyTrident: StartOfCombatCard = {\r\n\tstartOfCombat: (trinket: BoardTrinket | BgsPlayerEntity, input: SoCInput) => {\r\n\t\tinput.playerBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, input.playerEntity, Race.NAGA, input.gameState.allCards))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.enchantments = e.enchantments ?? [];\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\t\t\t\t\toriginEntityId: trinket?.entityId ?? 0,\r\n\t\t\t\t\trepeats: 1,\r\n\t\t\t\t\ttiming: input.gameState.sharedState.currentEntityId++,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BoardTrinket } from '../../bgs-player-entity';
|
|
1
|
+
import { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';
|
|
2
2
|
import { BoardEntity } from '../../board-entity';
|
|
3
|
+
import { StartOfCombatTiming } from '../../cards/card.interface';
|
|
3
4
|
import { SoCInput } from './start-of-combat-input';
|
|
4
|
-
export declare const performStartOfCombatAction: (cardId: string, entity: BoardEntity | BoardTrinket, input: SoCInput) => boolean;
|
|
5
|
+
export declare const performStartOfCombatAction: (cardId: string, entity: BoardEntity | BoardTrinket | BgsPlayerEntity, input: SoCInput, timing?: StartOfCombatTiming) => boolean;
|
|
@@ -68,12 +68,15 @@ const summoning_sphere_1 = require("../../cards/impl/trinket/summoning-sphere");
|
|
|
68
68
|
const tinyfin_onesie_1 = require("../../cards/impl/trinket/tinyfin-onesie");
|
|
69
69
|
const training_certificate_1 = require("../../cards/impl/trinket/training-certificate");
|
|
70
70
|
const valorous_medaillion_1 = require("../../cards/impl/trinket/valorous-medaillion");
|
|
71
|
-
const performStartOfCombatAction = (cardId, entity, input) => {
|
|
72
|
-
var _a;
|
|
71
|
+
const performStartOfCombatAction = (cardId, entity, input, timing) => {
|
|
73
72
|
let hasTriggered = false;
|
|
74
73
|
const promoPortraitCount = getPromoPortraitCount(input.playerEntity);
|
|
75
74
|
for (let i = promoPortraitCount; i >= 0; i--) {
|
|
76
|
-
const
|
|
75
|
+
const card = getStartOfCombatAction(cardId);
|
|
76
|
+
if (!!timing && (card === null || card === void 0 ? void 0 : card.startOfCombatTiming) !== timing) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const action = card === null || card === void 0 ? void 0 : card.startOfCombat;
|
|
77
80
|
if (!!action) {
|
|
78
81
|
hasTriggered = action(entity, input);
|
|
79
82
|
if (!!hasTriggered) {
|
|
@@ -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,sFAAiF;AACjF,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;AACpF,uEAAmE;AACnE,6FAAwF;AACxF,2EAAuE;AACvE,0EAAsE;AACtE,oFAAgF;AAChF,gFAA4E;AAC5E,wFAAoF;AACpF,gFAA4E;AAC5E,0EAAsE;AACtE,oEAAgE;AAChE,wEAAoE;AACpE,8EAA0E;AAC1E,gFAA4E;AAC5E,oFAA+E;AAC/E,oFA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C;YACC,OAAO,0BAAW,CAAC;QAEpB;YACC,OAAO,IAAI,CAAC;KACb;AACF,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,SAAiB,EAAE,eAAuB,EAAE,YAA6B,EAAE,EAAE;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 } 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 = (cardId: string, entity: BoardEntity | BoardTrinket, input: SoCInput) => {\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 action = getStartOfCombatAction(cardId)?.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":";;;AAIA,4EAAwE;AACxE,sFAAiF;AACjF,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;AACpF,uEAAmE;AACnE,6FAAwF;AACxF,2EAAuE;AACvE,0EAAsE;AAC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AAC,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"]}
|
|
@@ -5,19 +5,19 @@ const summon_when_space_1 = require("../summon-when-space");
|
|
|
5
5
|
const soc_action_processor_1 = require("./soc-action-processor");
|
|
6
6
|
const handleStartOfCombatAnomalies = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
7
7
|
currentAttacker = handleStartOfCombatAnomaliesForPlayer({
|
|
8
|
-
playerEntity,
|
|
9
|
-
playerBoard,
|
|
10
|
-
opponentEntity,
|
|
11
|
-
opponentBoard,
|
|
8
|
+
playerEntity: playerEntity,
|
|
9
|
+
playerBoard: playerBoard,
|
|
10
|
+
opponentEntity: opponentEntity,
|
|
11
|
+
opponentBoard: opponentBoard,
|
|
12
12
|
currentAttacker,
|
|
13
13
|
gameState,
|
|
14
14
|
playerIsFriendly: true,
|
|
15
15
|
});
|
|
16
16
|
currentAttacker = handleStartOfCombatAnomaliesForPlayer({
|
|
17
|
-
opponentEntity,
|
|
18
|
-
opponentBoard,
|
|
19
|
-
playerEntity,
|
|
20
|
-
playerBoard,
|
|
17
|
+
playerEntity: opponentEntity,
|
|
18
|
+
playerBoard: opponentBoard,
|
|
19
|
+
opponentEntity: playerEntity,
|
|
20
|
+
opponentBoard: playerBoard,
|
|
21
21
|
currentAttacker,
|
|
22
22
|
gameState,
|
|
23
23
|
playerIsFriendly: false,
|
|
@@ -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,
|
|
35
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(anomaly, input.playerEntity, input);
|
|
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;
|
|
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,CAAC,SAAS,CAAC,SAAS,0CAAE,MAAM,CAAA,IAAI,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,CAAC,CAAC;KAC/D;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);\r\n\t}\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
|
@@ -7,19 +7,19 @@ const soc_action_processor_1 = require("./soc-action-processor");
|
|
|
7
7
|
const handleStartOfCombatHeroPowers = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
8
8
|
if (Math.random() < 0.5) {
|
|
9
9
|
currentAttacker = handlePlayerStartOfCombatHeroPowers({
|
|
10
|
-
playerEntity,
|
|
11
|
-
playerBoard,
|
|
12
|
-
opponentEntity,
|
|
13
|
-
opponentBoard,
|
|
10
|
+
playerEntity: playerEntity,
|
|
11
|
+
playerBoard: playerBoard,
|
|
12
|
+
opponentEntity: opponentEntity,
|
|
13
|
+
opponentBoard: opponentBoard,
|
|
14
14
|
currentAttacker,
|
|
15
15
|
playerIsFriendly: true,
|
|
16
16
|
gameState,
|
|
17
17
|
});
|
|
18
18
|
currentAttacker = handlePlayerStartOfCombatHeroPowers({
|
|
19
|
-
opponentEntity,
|
|
20
|
-
opponentBoard,
|
|
21
|
-
playerEntity,
|
|
22
|
-
playerBoard,
|
|
19
|
+
playerEntity: opponentEntity,
|
|
20
|
+
playerBoard: opponentBoard,
|
|
21
|
+
opponentEntity: playerEntity,
|
|
22
|
+
opponentBoard: playerBoard,
|
|
23
23
|
currentAttacker,
|
|
24
24
|
playerIsFriendly: false,
|
|
25
25
|
gameState,
|
|
@@ -27,19 +27,19 @@ const handleStartOfCombatHeroPowers = (playerEntity, playerBoard, opponentEntity
|
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
currentAttacker = handlePlayerStartOfCombatHeroPowers({
|
|
30
|
-
opponentEntity,
|
|
31
|
-
opponentBoard,
|
|
32
|
-
playerEntity,
|
|
33
|
-
playerBoard,
|
|
30
|
+
playerEntity: opponentEntity,
|
|
31
|
+
playerBoard: opponentBoard,
|
|
32
|
+
opponentEntity: playerEntity,
|
|
33
|
+
opponentBoard: playerBoard,
|
|
34
34
|
currentAttacker,
|
|
35
35
|
playerIsFriendly: false,
|
|
36
36
|
gameState,
|
|
37
37
|
});
|
|
38
38
|
currentAttacker = handlePlayerStartOfCombatHeroPowers({
|
|
39
|
-
playerEntity,
|
|
40
|
-
playerBoard,
|
|
41
|
-
opponentEntity,
|
|
42
|
-
opponentBoard,
|
|
39
|
+
playerEntity: playerEntity,
|
|
40
|
+
playerBoard: playerBoard,
|
|
41
|
+
opponentEntity: opponentEntity,
|
|
42
|
+
opponentBoard: opponentBoard,
|
|
43
43
|
currentAttacker,
|
|
44
44
|
playerIsFriendly: true,
|
|
45
45
|
gameState,
|
|
@@ -54,7 +54,7 @@ const handlePlayerStartOfCombatHeroPowers = (input) => {
|
|
|
54
54
|
return input.currentAttacker;
|
|
55
55
|
}
|
|
56
56
|
const playerHeroPowerId = input.playerEntity.heroPowerId || (0, exports.getHeroPowerForHero)(input.playerEntity.cardId);
|
|
57
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId,
|
|
57
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, 'start-of-combat');
|
|
58
58
|
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
59
59
|
return input.currentAttacker;
|
|
60
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-hero-power.ts"],"names":[],"mappings":";;;AAGA,sCAA+C;AAE/C,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,6BAA6B,GAAG,CAC5C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IAGX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,mCAAmC,CAAC;YACrD,YAAY;
|
|
1
|
+
{"version":3,"file":"soc-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-hero-power.ts"],"names":[],"mappings":";;;AAGA,sCAA+C;AAE/C,4DAA8D;AAC9D,iEAAoE;AAG7D,MAAM,6BAA6B,GAAG,CAC5C,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IAG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AAiB,GAAG,KAAK,CAAC,YAAY,CAAC,WAAW,IAAI,IAAA,2BAAmB,EAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3G,IAAA,iDAA0B,EAAC,iBAAiB,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;IAC5F,IAAA,2BAAkB,EACjB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;IACF,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAAC,UAAkB,EAAU,EAAE;IACjE,QAAQ,UAAU,EAAE;QACnB;YACC,6BAAuB;QACxB;YACC,6BAA2B;QAC5B;YACC,6BAA0B;QAC3B;YACC,6BAA2B;QAC5B;YACC,wBAA+C;KAChD;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { processMinionDeath } from '../attack';\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 handleStartOfCombatHeroPowers = (\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\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerStartOfCombatHeroPowers = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone || input.playerEntity.hpLeft <= 0) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tconst playerHeroPowerId = input.playerEntity.heroPowerId || getHeroPowerForHero(input.playerEntity.cardId);\r\n\tperformStartOfCombatAction(playerHeroPowerId, input.playerEntity, input, 'start-of-combat');\r\n\tprocessMinionDeath(\r\n\t\tinput.playerBoard,\r\n\t\tinput.playerEntity,\r\n\t\tinput.opponentBoard,\r\n\t\tinput.opponentEntity,\r\n\t\tinput.gameState,\r\n\t);\r\n\treturn input.currentAttacker;\r\n};\r\n\r\nexport const getHeroPowerForHero = (heroCardId: string): string => {\r\n\tswitch (heroCardId) {\r\n\t\tcase CardIds.IllidanStormrage_TB_BaconShop_HERO_08:\r\n\t\t\treturn CardIds.Wingmen;\r\n\t\tcase CardIds.TheLichKing_TB_BaconShop_HERO_22:\r\n\t\t\treturn CardIds.RebornRites;\r\n\t\tcase CardIds.ProfessorPutricide_BG25_HERO_100:\r\n\t\t\treturn CardIds.RagePotion;\r\n\t\tcase CardIds.Deathwing_TB_BaconShop_HERO_52:\r\n\t\t\treturn CardIds.AllWillBurn;\r\n\t\tcase CardIds.TeronGorefiend_BG25_HERO_103:\r\n\t\t\treturn CardIds.TeronGorefiend_RapidReanimation;\r\n\t}\r\n\treturn null;\r\n};\r\n"]}
|
|
@@ -15,12 +15,12 @@ const handleStartOfCombatMinions = (playerEntity, playerBoard, opponentEntity, o
|
|
|
15
15
|
continue;
|
|
16
16
|
}
|
|
17
17
|
shouldUpdateNextPlayer = (0, exports.performStartOfCombatMinionsForPlayer)(attacker, {
|
|
18
|
-
playerBoard,
|
|
19
|
-
playerEntity,
|
|
20
|
-
opponentBoard,
|
|
21
|
-
opponentEntity,
|
|
22
|
-
playerBoardBefore,
|
|
23
|
-
opponentBoardBefore,
|
|
18
|
+
playerBoard: playerBoard,
|
|
19
|
+
playerEntity: playerEntity,
|
|
20
|
+
opponentBoard: opponentBoard,
|
|
21
|
+
opponentEntity: opponentEntity,
|
|
22
|
+
playerBoardBefore: playerBoardBefore,
|
|
23
|
+
opponentBoardBefore: opponentBoardBefore,
|
|
24
24
|
playerIsFriendly: true,
|
|
25
25
|
currentAttacker: 0,
|
|
26
26
|
gameState,
|
|
@@ -35,12 +35,12 @@ const handleStartOfCombatMinions = (playerEntity, playerBoard, opponentEntity, o
|
|
|
35
35
|
continue;
|
|
36
36
|
}
|
|
37
37
|
shouldUpdateNextPlayer = (0, exports.performStartOfCombatMinionsForPlayer)(attacker, {
|
|
38
|
-
opponentBoard,
|
|
39
|
-
opponentEntity,
|
|
40
|
-
playerBoard,
|
|
41
|
-
playerEntity,
|
|
42
|
-
opponentBoardBefore,
|
|
43
|
-
playerBoardBefore,
|
|
38
|
+
playerBoard: opponentBoard,
|
|
39
|
+
playerEntity: opponentEntity,
|
|
40
|
+
opponentBoard: playerBoard,
|
|
41
|
+
opponentEntity: playerEntity,
|
|
42
|
+
playerBoardBefore: opponentBoardBefore,
|
|
43
|
+
opponentBoardBefore: playerBoardBefore,
|
|
44
44
|
playerIsFriendly: false,
|
|
45
45
|
currentAttacker: 0,
|
|
46
46
|
gameState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-minion.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-minion.ts"],"names":[],"mappings":";;;AAEA,sCAA+C;AAE/C,iEAAoE;AAG7D,MAAM,0BAA0B,GAAG,CACzC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,iBAAgC,EAChC,mBAAkC,EAClC,SAAwB,EACf,EAAE;IACX,IAAI,gBAAgB,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,eAAe,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;IAE7C,OAAO,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QAClE,IAAI,sBAAsB,GAAG,KAAK,CAAC;QACnC,IAAI,gBAAgB,KAAK,CAA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DW,QAAA,0BAA0B,8BA2DrC;AAMK,MAAM,oCAAoC,GAAG,CAAC,MAAmB,EAAE,KAAe,EAAW,EAAE;IACrG,IAAI,KAAK,CAAC,YAAY,CAAC,iBAAiB,EAAE;QACzC,OAAO,KAAK,CAAC;KACb;IAED,MAAM,YAAY,GAAG,IAAA,iDAA0B,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE9E,IAAA,2BAAkB,EACjB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAfW,QAAA,oCAAoC,wCAe/C","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { processMinionDeath } from '../attack';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handleStartOfCombatMinions = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tgameState: FullGameState,\r\n): number => {\r\n\tlet attackerForStart = Math.random() < 0.5 ? 0 : 1;\r\n\tconst playerAttackers = [...playerBoard];\r\n\tconst opponentAttackers = [...opponentBoard];\r\n\r\n\twhile (playerAttackers.length > 0 || opponentAttackers.length > 0) {\r\n\t\tlet shouldUpdateNextPlayer = false;\r\n\t\tif (attackerForStart === 0 && playerAttackers.length > 0) {\r\n\t\t\tconst attacker = playerAttackers.splice(0, 1)[0];\r\n\t\t\tif (attacker.health <= 0 || attacker.definitelyDead) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tshouldUpdateNextPlayer = performStartOfCombatMinionsForPlayer(attacker, {\r\n\t\t\t\tplayerBoard: playerBoard,\r\n\t\t\t\tplayerEntity: playerEntity,\r\n\t\t\t\topponentBoard: opponentBoard,\r\n\t\t\t\topponentEntity: opponentEntity,\r\n\t\t\t\tplayerBoardBefore: playerBoardBefore,\r\n\t\t\t\topponentBoardBefore: opponentBoardBefore,\r\n\t\t\t\tplayerIsFriendly: true,\r\n\t\t\t\tcurrentAttacker: 0,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t} else if (attackerForStart === 0 && playerAttackers.length === 0) {\r\n\t\t\tshouldUpdateNextPlayer = true;\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length > 0) {\r\n\t\t\tconst attacker = opponentAttackers.splice(0, 1)[0];\r\n\t\t\tif (attacker.health <= 0 || attacker.definitelyDead) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tshouldUpdateNextPlayer = performStartOfCombatMinionsForPlayer(attacker, {\r\n\t\t\t\tplayerBoard: opponentBoard,\r\n\t\t\t\tplayerEntity: opponentEntity,\r\n\t\t\t\topponentBoard: playerBoard,\r\n\t\t\t\topponentEntity: playerEntity,\r\n\t\t\t\tplayerBoardBefore: opponentBoardBefore,\r\n\t\t\t\topponentBoardBefore: playerBoardBefore,\r\n\t\t\t\tplayerIsFriendly: false,\r\n\t\t\t\tcurrentAttacker: 0,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length === 0) {\r\n\t\t\tshouldUpdateNextPlayer = true;\r\n\t\t}\r\n\r\n\t\tif (shouldUpdateNextPlayer) {\r\n\t\t\tattackerForStart = (attackerForStart + 1) % 2;\r\n\t\t}\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// Apparently, the board composition used for start of combat minion effects (like Red Whelp, and I assume it works the\r\n// same way for others like Prized Promo Drake or Mantid Queen) is the one that is used before Illidan's effect is handled.\r\n// Since this also runs before HP start of combat, we probably also use the state as it was before HP were triggered, like\r\n// Tamsin's Phylactery.\r\nexport const performStartOfCombatMinionsForPlayer = (minion: BoardEntity, input: SoCInput): boolean => {\r\n\tif (input.playerEntity.startOfCombatDone) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tconst hasProcessed = performStartOfCombatAction(minion.cardId, minion, input);\r\n\r\n\tprocessMinionDeath(\r\n\t\tinput.playerBoard,\r\n\t\tinput.playerEntity,\r\n\t\tinput.opponentBoard,\r\n\t\tinput.opponentEntity,\r\n\t\tinput.gameState,\r\n\t);\r\n\treturn hasProcessed;\r\n};\r\n"]}
|
|
@@ -8,19 +8,19 @@ const soc_hero_power_1 = require("./soc-hero-power");
|
|
|
8
8
|
const handlePreCombatHeroPowers = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
9
9
|
if (Math.random() < 0.5) {
|
|
10
10
|
currentAttacker = handlePreCombatHeroPowersForPlayer({
|
|
11
|
-
playerEntity,
|
|
12
|
-
playerBoard,
|
|
13
|
-
opponentEntity,
|
|
14
|
-
opponentBoard,
|
|
11
|
+
playerEntity: playerEntity,
|
|
12
|
+
playerBoard: playerBoard,
|
|
13
|
+
opponentEntity: opponentEntity,
|
|
14
|
+
opponentBoard: opponentBoard,
|
|
15
15
|
currentAttacker,
|
|
16
16
|
playerIsFriendly: true,
|
|
17
17
|
gameState,
|
|
18
18
|
});
|
|
19
19
|
currentAttacker = handlePreCombatHeroPowersForPlayer({
|
|
20
|
-
opponentEntity,
|
|
21
|
-
opponentBoard,
|
|
22
|
-
playerEntity,
|
|
23
|
-
playerBoard,
|
|
20
|
+
playerEntity: opponentEntity,
|
|
21
|
+
playerBoard: opponentBoard,
|
|
22
|
+
opponentEntity: playerEntity,
|
|
23
|
+
opponentBoard: playerBoard,
|
|
24
24
|
currentAttacker,
|
|
25
25
|
playerIsFriendly: false,
|
|
26
26
|
gameState,
|
|
@@ -28,19 +28,19 @@ const handlePreCombatHeroPowers = (playerEntity, playerBoard, opponentEntity, op
|
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
30
|
currentAttacker = handlePreCombatHeroPowersForPlayer({
|
|
31
|
-
opponentEntity,
|
|
32
|
-
opponentBoard,
|
|
33
|
-
playerEntity,
|
|
34
|
-
playerBoard,
|
|
31
|
+
playerEntity: opponentEntity,
|
|
32
|
+
playerBoard: opponentBoard,
|
|
33
|
+
opponentEntity: playerEntity,
|
|
34
|
+
opponentBoard: playerBoard,
|
|
35
35
|
currentAttacker,
|
|
36
36
|
playerIsFriendly: false,
|
|
37
37
|
gameState,
|
|
38
38
|
});
|
|
39
39
|
currentAttacker = handlePreCombatHeroPowersForPlayer({
|
|
40
|
-
playerEntity,
|
|
41
|
-
playerBoard,
|
|
42
|
-
opponentEntity,
|
|
43
|
-
opponentBoard,
|
|
40
|
+
playerEntity: playerEntity,
|
|
41
|
+
playerBoard: playerBoard,
|
|
42
|
+
opponentEntity: opponentEntity,
|
|
43
|
+
opponentBoard: opponentBoard,
|
|
44
44
|
currentAttacker,
|
|
45
45
|
playerIsFriendly: true,
|
|
46
46
|
gameState,
|
|
@@ -65,7 +65,7 @@ const handlePreCombatHeroPowersForPlayer = (input) => {
|
|
|
65
65
|
return input.currentAttacker;
|
|
66
66
|
}
|
|
67
67
|
const playerHeroPowerId = input.playerEntity.heroPowerId || (0, soc_hero_power_1.getHeroPowerForHero)(input.playerEntity.cardId);
|
|
68
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId,
|
|
68
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(playerHeroPowerId, input.playerEntity, input, 'pre-combat');
|
|
69
69
|
(0, attack_1.processMinionDeath)(input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
70
70
|
return input.currentAttacker;
|
|
71
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soc-pre-combat-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-pre-combat-hero-power.ts"],"names":[],"mappings":";;;AAEA,sCAA+C;AAE/C,4DAA8D;AAC9D,iEAAoE;AACpE,qDAAuD;AAGhD,MAAM,yBAAyB,GAAG,CACxC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,kCAAkC,CAAC;YACpD,YAAY;
|
|
1
|
+
{"version":3,"file":"soc-pre-combat-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/start-of-combat/soc-pre-combat-hero-power.ts"],"names":[],"mappings":";;;AAEA,sCAA+C;AAE/C,4DAA8D;AAC9D,iEAAoE;AACpE,qDAAuD;AAGhD,MAAM,yBAAyB,GAAG,CACxC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,SAAwB,EACf,EAAE;IACX,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE;QACxB,eAAe,GAAG,kCAAkC,CAAC;YACpD,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,WAAW;YACxB,cAAc,EAAE,cAAc;YAC9B,aAAa,EAAE,aAAa;YAC5B,eAAe;YACf,gBAAgB,EAAE,IAAI;YACtB,SAAS;SACT,CAAC,CAAC;QACH,eAAe,GAAG,kCAAkC,CAAC;YACpD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,WAAW;YAC1B,eAAe;YACf,gBAAgB,EAAE,KAAK;YACvB,SAAS;SACT,CAAC,CAAC;KACH;SAAM;QACN,eAAe,GAAG,kCAAkC,CAAC;YACpD,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,YAAY;YAC5B,aAAa,EA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AAC,iBAAiB,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IACvF,IAAA,2BAAkB,EACjB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;IAEF,OAAO,KAAK,CAAC,eAAe,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { processMinionDeath } from '../attack';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleSummonsWhenSpace } from '../summon-when-space';\r\nimport { performStartOfCombatAction } from './soc-action-processor';\r\nimport { getHeroPowerForHero } from './soc-hero-power';\r\nimport { SoCInput } from './start-of-combat-input';\r\n\r\nexport const handlePreCombatHeroPowers = (\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\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t} else {\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: opponentEntity,\r\n\t\t\tplayerBoard: opponentBoard,\r\n\t\t\topponentEntity: playerEntity,\r\n\t\t\topponentBoard: playerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: false,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t\tcurrentAttacker = handlePreCombatHeroPowersForPlayer({\r\n\t\t\tplayerEntity: playerEntity,\r\n\t\t\tplayerBoard: playerBoard,\r\n\t\t\topponentEntity: opponentEntity,\r\n\t\t\topponentBoard: opponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tplayerIsFriendly: true,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\tconst initialPlayerBoardSize = playerBoard.length;\r\n\tconst initialOpponentBoardSize = opponentBoard.length;\r\n\t// Ozumat's Tentaclecan cause the first player to be recomputed\r\n\t// https://replays.firestoneapp.com/?reviewId=f15c90de-8b3c-4017-960d-365fe09eb7ab&turn=5&action=1\r\n\thandleSummonsWhenSpace(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);\r\n\r\n\tif (playerBoard.length !== initialPlayerBoardSize || opponentBoard.length !== initialOpponentBoardSize) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: Math.round(Math.random());\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowersForPlayer = (input: SoCInput): number => {\r\n\tif (input.playerEntity.startOfCombatDone || input.playerEntity.hpLeft <= 0) {\r\n\t\treturn input.currentAttacker;\r\n\t}\r\n\r\n\tconst playerHeroPowerId = input.playerEntity.heroPowerId || getHeroPowerForHero(input.playerEntity.cardId);\r\n\tperformStartOfCombatAction(playerHeroPowerId, input.playerEntity, input, 'pre-combat');\r\n\tprocessMinionDeath(\r\n\t\tinput.playerBoard,\r\n\t\tinput.playerEntity,\r\n\t\tinput.opponentBoard,\r\n\t\tinput.opponentEntity,\r\n\t\tinput.gameState,\r\n\t);\r\n\r\n\treturn input.currentAttacker;\r\n};\r\n"]}
|
|
@@ -6,19 +6,19 @@ const soc_action_processor_1 = require("./soc-action-processor");
|
|
|
6
6
|
const handleStartOfCombatQuestRewards = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
7
7
|
if (Math.random() < 0.5) {
|
|
8
8
|
currentAttacker = handleStartOfCombatQuestRewardsForPlayer({
|
|
9
|
-
playerEntity,
|
|
10
|
-
playerBoard,
|
|
11
|
-
opponentEntity,
|
|
12
|
-
opponentBoard,
|
|
9
|
+
playerEntity: playerEntity,
|
|
10
|
+
playerBoard: playerBoard,
|
|
11
|
+
opponentEntity: opponentEntity,
|
|
12
|
+
opponentBoard: opponentBoard,
|
|
13
13
|
currentAttacker,
|
|
14
14
|
gameState,
|
|
15
15
|
playerIsFriendly: true,
|
|
16
16
|
});
|
|
17
17
|
currentAttacker = handleStartOfCombatQuestRewardsForPlayer({
|
|
18
|
-
opponentEntity,
|
|
19
|
-
opponentBoard,
|
|
20
|
-
playerEntity,
|
|
21
|
-
playerBoard,
|
|
18
|
+
playerEntity: opponentEntity,
|
|
19
|
+
playerBoard: opponentBoard,
|
|
20
|
+
opponentEntity: playerEntity,
|
|
21
|
+
opponentBoard: playerBoard,
|
|
22
22
|
currentAttacker,
|
|
23
23
|
gameState,
|
|
24
24
|
playerIsFriendly: false,
|
|
@@ -26,19 +26,19 @@ const handleStartOfCombatQuestRewards = (playerEntity, playerBoard, opponentEnti
|
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
currentAttacker = handleStartOfCombatQuestRewardsForPlayer({
|
|
29
|
-
opponentEntity,
|
|
30
|
-
opponentBoard,
|
|
31
|
-
playerEntity,
|
|
32
|
-
playerBoard,
|
|
29
|
+
playerEntity: opponentEntity,
|
|
30
|
+
playerBoard: opponentBoard,
|
|
31
|
+
opponentEntity: playerEntity,
|
|
32
|
+
opponentBoard: playerBoard,
|
|
33
33
|
currentAttacker,
|
|
34
34
|
gameState,
|
|
35
35
|
playerIsFriendly: false,
|
|
36
36
|
});
|
|
37
37
|
currentAttacker = handleStartOfCombatQuestRewardsForPlayer({
|
|
38
|
-
playerEntity,
|
|
39
|
-
playerBoard,
|
|
40
|
-
opponentEntity,
|
|
41
|
-
opponentBoard,
|
|
38
|
+
playerEntity: playerEntity,
|
|
39
|
+
playerBoard: playerBoard,
|
|
40
|
+
opponentEntity: opponentEntity,
|
|
41
|
+
opponentBoard: opponentBoard,
|
|
42
42
|
currentAttacker,
|
|
43
43
|
gameState,
|
|
44
44
|
playerIsFriendly: true,
|
|
@@ -53,7 +53,7 @@ const handleStartOfCombatQuestRewardsForPlayer = (input) => {
|
|
|
53
53
|
return input.currentAttacker;
|
|
54
54
|
}
|
|
55
55
|
for (const reward of input.playerEntity.questRewards) {
|
|
56
|
-
(0, soc_action_processor_1.performStartOfCombatAction)(reward,
|
|
56
|
+
(0, soc_action_processor_1.performStartOfCombatAction)(reward, input.playerEntity, input);
|
|
57
57
|
}
|
|
58
58
|
return input.currentAttacker;
|
|
59
59
|
};
|