@firestone-hs/simulate-bgs-battle 1.1.686 → 1.1.688
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/impl/_card-mappings.js +2 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/minion/blue-volumizer.js +1 -1
- package/dist/cards/impl/minion/blue-volumizer.js.map +1 -1
- package/dist/cards/impl/minion/carrier.js +1 -1
- package/dist/cards/impl/minion/carrier.js.map +1 -1
- package/dist/cards/impl/minion/metal-dispenser.js +3 -2
- package/dist/cards/impl/minion/metal-dispenser.js.map +1 -1
- package/dist/cards/impl/minion/mothership.js +1 -1
- package/dist/cards/impl/minion/mothership.js.map +1 -1
- package/dist/cards/impl/minion/red-volumizer.js +1 -1
- package/dist/cards/impl/minion/red-volumizer.js.map +1 -1
- package/dist/cards/impl/minion/relentless-deflector.js +1 -1
- package/dist/cards/impl/minion/relentless-deflector.js.map +1 -1
- package/dist/cards/impl/minion/silky-shimmermoth.d.ts +2 -2
- package/dist/cards/impl/minion/silky-shimmermoth.js +3 -3
- package/dist/cards/impl/minion/silky-shimmermoth.js.map +1 -1
- package/dist/cards/impl/minion/sundered-matriarch.d.ts +2 -0
- package/dist/cards/impl/minion/sundered-matriarch.js +14 -0
- package/dist/cards/impl/minion/sundered-matriarch.js.map +1 -0
- package/dist/cards/impl/minion/timewarped-chimera.js +1 -1
- package/dist/cards/impl/minion/timewarped-chimera.js.map +1 -1
- package/dist/cards/impl/minion/timewarped-goldrinn.js +1 -1
- package/dist/cards/impl/minion/timewarped-goldrinn.js.map +1 -1
- package/dist/cards/impl/minion/timewarped-jungle-king.js +4 -4
- package/dist/cards/impl/minion/timewarped-jungle-king.js.map +1 -1
- package/dist/cards/impl/minion/timewarped-mothership.js +1 -1
- package/dist/cards/impl/minion/timewarped-mothership.js.map +1 -1
- package/dist/cards/impl/minion/timewarped-mythraw.js +1 -1
- package/dist/cards/impl/minion/timewarped-mythraw.js.map +1 -1
- package/dist/cards/impl/minion/timewarped-traveler.js +1 -1
- package/dist/cards/impl/minion/timewarped-traveler.js.map +1 -1
- package/dist/cards/impl/minion/turquoise-skitterer.js +2 -2
- package/dist/cards/impl/minion/turquoise-skitterer.js.map +1 -1
- package/dist/cards/impl/spellcraft/veterans-tactics.js +2 -2
- package/dist/cards/impl/spellcraft/veterans-tactics.js.map +1 -1
- package/dist/cards/impl/trinket/eternal-portrait.d.ts +1 -1
- package/dist/cards/impl/trinket/eternal-portrait.js +1 -1
- package/dist/cards/impl/trinket/eternal-portrait.js.map +1 -1
- package/dist/simulation/damage-effects.js +1 -1
- package/dist/simulation/damage-effects.js.map +1 -1
- package/dist/simulation/deathrattle-orchestration.js +12 -0
- package/dist/simulation/deathrattle-orchestration.js.map +1 -1
- package/dist/simulation/start-of-combat/start-of-combat.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timewarped-goldrinn.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-goldrinn.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,0CAAiD;AAGpC,QAAA,kBAAkB,GAAyB;IACvD,OAAO,EAAE,sCAAwF;IACjG,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAAgD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnF,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC;QACpC,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC;QACpC,IAAA,uBAAe,EACd,MAAM,EACN,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,CAAC,SAAS,EACf,qBAAI,CAAC,qBAAI,CAAC,KAAK,CAAC,CAChB,CAAC;QACF,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,eAAe,IAAI,kBAAkB,CAAC;QAC/E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,kBAAkB,IAAI,kBAAkB,CAAC;QAClF,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { addStatsToBoard } from '../../../utils';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const TimewarpedGoldrinn: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.TimewarpedGoldrinn_BG34_Giant_362, CardIds.TimewarpedGoldrinn_BG34_Giant_362_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TimewarpedGoldrinn_BG34_Giant_362_G ? 2 : 1;\r\n\t\tconst goldrinnAttackBuff = 3 * mult;\r\n\t\tconst goldrinnHealthBuff =
|
|
1
|
+
{"version":3,"file":"timewarped-goldrinn.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-goldrinn.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,0CAAiD;AAGpC,QAAA,kBAAkB,GAAyB;IACvD,OAAO,EAAE,sCAAwF;IACjG,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAAgD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnF,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC;QACpC,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC;QACpC,IAAA,uBAAe,EACd,MAAM,EACN,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,CAAC,SAAS,EACf,qBAAI,CAAC,qBAAI,CAAC,KAAK,CAAC,CAChB,CAAC;QACF,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,eAAe,IAAI,kBAAkB,CAAC;QAC/E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,kBAAkB,IAAI,kBAAkB,CAAC;QAClF,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { addStatsToBoard } from '../../../utils';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const TimewarpedGoldrinn: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.TimewarpedGoldrinn_BG34_Giant_362, CardIds.TimewarpedGoldrinn_BG34_Giant_362_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TimewarpedGoldrinn_BG34_Giant_362_G ? 2 : 1;\r\n\t\tconst goldrinnAttackBuff = 3 * mult;\r\n\t\tconst goldrinnHealthBuff = 3 * mult;\r\n\t\taddStatsToBoard(\r\n\t\t\tminion,\r\n\t\t\tinput.boardWithDeadEntity,\r\n\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\tgoldrinnAttackBuff,\r\n\t\t\tgoldrinnHealthBuff,\r\n\t\t\tinput.gameState,\r\n\t\t\tRace[Race.BEAST],\r\n\t\t);\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.GoldrinnBuffAtk += goldrinnAttackBuff;\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.GoldrinnBuffHealth += goldrinnHealthBuff;\r\n\t\treturn [];\r\n\t},\r\n};\r\n"]}
|
|
@@ -12,17 +12,17 @@ exports.TimewarpedJungleKing = {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const mult = minion.cardId === "BG34_PreMadeChamp_004_G" ? 2 : 1;
|
|
15
|
-
const atkBuff = (_a = minion.scriptDataNum1) !== null && _a !== void 0 ? _a :
|
|
16
|
-
const healthBuff = (_b = minion.scriptDataNum2) !== null && _b !== void 0 ? _b :
|
|
15
|
+
const atkBuff = (_a = minion.scriptDataNum1) !== null && _a !== void 0 ? _a : 4 * mult;
|
|
16
|
+
const healthBuff = (_b = minion.scriptDataNum2) !== null && _b !== void 0 ? _b : 3 * mult;
|
|
17
17
|
(0, stats_1.modifyStats)(input.spawned, minion, atkBuff, healthBuff, input.board, input.hero, input.gameState);
|
|
18
18
|
},
|
|
19
19
|
afterTavernSpellCast: (entity, input) => {
|
|
20
20
|
var _a, _b;
|
|
21
21
|
const mult = entity.cardId === "BG34_PreMadeChamp_004_G" ? 2 : 1;
|
|
22
22
|
entity.scriptDataNum1 = (_a = entity.scriptDataNum1) !== null && _a !== void 0 ? _a : 0;
|
|
23
|
-
entity.scriptDataNum1 +=
|
|
23
|
+
entity.scriptDataNum1 += 4 * mult;
|
|
24
24
|
entity.scriptDataNum2 = (_b = entity.scriptDataNum2) !== null && _b !== void 0 ? _b : 0;
|
|
25
|
-
entity.scriptDataNum2 +=
|
|
25
|
+
entity.scriptDataNum2 += 3 * mult;
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
//# sourceMappingURL=timewarped-jungle-king.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timewarped-jungle-king.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-jungle-king.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,oBAAoB,GAAqD;IACrF,OAAO,EAAE,oDAA0G;IACnH,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAwB,EAAE,EAAE;;QACpE,IACC,CAAC,IAAA,uBAAe,EAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,EAC3G;YACD,OAAO;SACP;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,8BAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,MAAM,OAAO,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,GAAG,IAAI,CAAC;QAClD,MAAM,UAAU,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,GAAG,IAAI,CAAC;QACrD,IAAA,mBAAW,EAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnG,CAAC;IACD,oBAAoB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACpE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,8BAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,MAAM,CAAC,cAAc,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,IAAI,CAAC,GAAG,IAAI,CAAC;QAClC,MAAM,CAAC,cAAc,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,IAAI,CAAC,GAAG,IAAI,CAAC;IACnC,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnOtherSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { AfterOtherSpawnedCard, AfterTavernSpellCastCard, CastSpellInput } from '../../card.interface';\r\n\r\nexport const TimewarpedJungleKing: AfterOtherSpawnedCard & AfterTavernSpellCastCard = {\r\n\tcardIds: [CardIds.TimewarpedJungleKing_BG34_PreMadeChamp_004, CardIds.TimewarpedJungleKing_BG34_PreMadeChamp_004_G],\r\n\tafterOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => {\r\n\t\tif (\r\n\t\t\t!hasCorrectTribe(input.spawned, input.hero, Race.BEAST, input.gameState.anomalies, input.gameState.allCards)\r\n\t\t) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst mult = minion.cardId === CardIds.TimewarpedJungleKing_BG34_PreMadeChamp_004_G ? 2 : 1;\r\n\t\tconst atkBuff = minion.scriptDataNum1 ??
|
|
1
|
+
{"version":3,"file":"timewarped-jungle-king.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-jungle-king.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,oBAAoB,GAAqD;IACrF,OAAO,EAAE,oDAA0G;IACnH,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAwB,EAAE,EAAE;;QACpE,IACC,CAAC,IAAA,uBAAe,EAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,EAC3G;YACD,OAAO;SACP;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,8BAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,MAAM,OAAO,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,GAAG,IAAI,CAAC;QAClD,MAAM,UAAU,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,GAAG,IAAI,CAAC;QACrD,IAAA,mBAAW,EAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnG,CAAC;IACD,oBAAoB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACpE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,8BAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,MAAM,CAAC,cAAc,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,IAAI,CAAC,GAAG,IAAI,CAAC;QAClC,MAAM,CAAC,cAAc,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,IAAI,CAAC,GAAG,IAAI,CAAC;IACnC,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnOtherSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { AfterOtherSpawnedCard, AfterTavernSpellCastCard, CastSpellInput } from '../../card.interface';\r\n\r\nexport const TimewarpedJungleKing: AfterOtherSpawnedCard & AfterTavernSpellCastCard = {\r\n\tcardIds: [CardIds.TimewarpedJungleKing_BG34_PreMadeChamp_004, CardIds.TimewarpedJungleKing_BG34_PreMadeChamp_004_G],\r\n\tafterOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => {\r\n\t\tif (\r\n\t\t\t!hasCorrectTribe(input.spawned, input.hero, Race.BEAST, input.gameState.anomalies, input.gameState.allCards)\r\n\t\t) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst mult = minion.cardId === CardIds.TimewarpedJungleKing_BG34_PreMadeChamp_004_G ? 2 : 1;\r\n\t\tconst atkBuff = minion.scriptDataNum1 ?? 4 * mult;\r\n\t\tconst healthBuff = minion.scriptDataNum2 ?? 3 * mult;\r\n\t\tmodifyStats(input.spawned, minion, atkBuff, healthBuff, input.board, input.hero, input.gameState);\r\n\t},\r\n\tafterTavernSpellCast: (entity: BoardEntity, input: CastSpellInput) => {\r\n\t\tconst mult = entity.cardId === CardIds.TimewarpedJungleKing_BG34_PreMadeChamp_004_G ? 2 : 1;\r\n\t\tentity.scriptDataNum1 = entity.scriptDataNum1 ?? 0;\r\n\t\tentity.scriptDataNum1 += 4 * mult;\r\n\t\tentity.scriptDataNum2 = entity.scriptDataNum2 ?? 0;\r\n\t\tentity.scriptDataNum2 += 3 * mult;\r\n\t},\r\n};\r\n"]}
|
|
@@ -4,7 +4,7 @@ exports.TimewarpedMothership = void 0;
|
|
|
4
4
|
const cards_in_hand_1 = require("../../../simulation/cards-in-hand");
|
|
5
5
|
exports.TimewarpedMothership = {
|
|
6
6
|
cardIds: ["BG34_Giant_598", "BG34_Giant_598_G"],
|
|
7
|
-
baseAvengeValue: (cardId) =>
|
|
7
|
+
baseAvengeValue: (cardId) => 4,
|
|
8
8
|
avenge: (minion, input) => {
|
|
9
9
|
const cards = minion.cardId === "BG34_Giant_598_G" ? 2 : 1;
|
|
10
10
|
const cardsAdded = Array.from({ length: cards }).map(() => input.gameState.cardsData.getRandomProtossMinion(input.hero.tavernTier));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timewarped-mothership.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-mothership.ts"],"names":[],"mappings":";;;AAGA,qEAAmE;AAGtD,QAAA,oBAAoB,GAAe;IAC/C,OAAO,EAAE,sCAA4F;IACrG,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAmB,EAAE,KAAkB,EAAQ,EAAE;QACzD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,uBAAkD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CACzD,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CACvE,CAAC;QACF,IAAA,8BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACtE,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { AvengeInput } from '../../../simulation/avenge';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { AvengeCard } from '../../card.interface';\r\n\r\nexport const TimewarpedMothership: AvengeCard = {\r\n\tcardIds: [CardIds.TimewarpedMothership_BG34_Giant_598, CardIds.TimewarpedMothership_BG34_Giant_598_G],\r\n\tbaseAvengeValue: (cardId: string) =>
|
|
1
|
+
{"version":3,"file":"timewarped-mothership.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-mothership.ts"],"names":[],"mappings":";;;AAGA,qEAAmE;AAGtD,QAAA,oBAAoB,GAAe;IAC/C,OAAO,EAAE,sCAA4F;IACrG,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAmB,EAAE,KAAkB,EAAQ,EAAE;QACzD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,uBAAkD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CACzD,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CACvE,CAAC;QACF,IAAA,8BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACtE,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { AvengeInput } from '../../../simulation/avenge';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { AvengeCard } from '../../card.interface';\r\n\r\nexport const TimewarpedMothership: AvengeCard = {\r\n\tcardIds: [CardIds.TimewarpedMothership_BG34_Giant_598, CardIds.TimewarpedMothership_BG34_Giant_598_G],\r\n\tbaseAvengeValue: (cardId: string) => 4,\r\n\tavenge: (minion: BoardEntity, input: AvengeInput): void => {\r\n\t\tconst cards = minion.cardId === CardIds.TimewarpedMothership_BG34_Giant_598_G ? 2 : 1;\r\n\t\tconst cardsAdded = Array.from({ length: cards }).map(() =>\r\n\t\t\tinput.gameState.cardsData.getRandomProtossMinion(input.hero.tavernTier),\r\n\t\t);\r\n\t\taddCardsInHand(input.hero, input.board, cardsAdded, input.gameState);\r\n\t},\r\n};\r\n"]}
|
|
@@ -9,7 +9,7 @@ exports.TimewarpedMythrax = {
|
|
|
9
9
|
startOfCombat: (minion, input) => {
|
|
10
10
|
const mult = minion.cardId === "BG34_Giant_684_G" ? 2 : 1;
|
|
11
11
|
for (let i = 0; i < mult; i++) {
|
|
12
|
-
const candidates = (0, utils_2.getMinionsOfDifferentTypes)(input.playerBoard, input.playerEntity, input.gameState);
|
|
12
|
+
const candidates = (0, utils_2.getMinionsOfDifferentTypes)(input.playerBoard.filter((e) => !exports.TimewarpedMythrax.cardIds.includes(e.cardId)), input.playerEntity, input.gameState);
|
|
13
13
|
const targets = (0, utils_1.pickMultipleRandomDifferent)(candidates, 3);
|
|
14
14
|
const totalAttack = targets.reduce((acc, target) => { var _a; return acc + ((_a = target.attack) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
15
15
|
const totalHealth = targets.reduce((acc, target) => { var _a; return acc + ((_a = target.health) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timewarped-mythraw.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-mythraw.ts"],"names":[],"mappings":";;;AAEA,mDAAsE;AAEtE,qDAAwD;AACxD,0CAA4D;AAG/C,QAAA,iBAAiB,GAAsB;IACnD,OAAO,EAAE,sCAAsF;IAC/F,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;QACvD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAA+C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,MAAM,UAAU,GAAG,IAAA,kCAA0B,
|
|
1
|
+
{"version":3,"file":"timewarped-mythraw.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-mythraw.ts"],"names":[],"mappings":";;;AAEA,mDAAsE;AAEtE,qDAAwD;AACxD,0CAA4D;AAG/C,QAAA,iBAAiB,GAAsB;IACnD,OAAO,EAAE,sCAAsF;IAC/F,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;QACvD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAA+C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,MAAM,UAAU,GAAG,IAAA,kCAA0B,EAC5C,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,yBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAC9E,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,SAAS,CACf,CAAC;YACF,MAAM,OAAO,GAAG,IAAA,mCAA2B,EAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,WAAC,OAAA,GAAG,GAAG,CAAC,MAAA,MAAM,CAAC,MAAM,mCAAI,CAAC,CAAC,CAAA,EAAA,EAAE,CAAC,CAAC,CAAC;YACnF,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,WAAC,OAAA,GAAG,GAAG,CAAC,MAAA,MAAM,CAAC,MAAM,mCAAI,CAAC,CAAC,CAAA,EAAA,EAAE,CAAC,CAAC,CAAC;YACnF,IAAA,mBAAW,EACV,MAAM,EACN,MAAM,EACN,WAAW,EACX,WAAW,EACX,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,SAAS,CACf,CAAC;SACF;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickMultipleRandomDifferent } from '../../../services/utils';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { getMinionsOfDifferentTypes } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const TimewarpedMythrax: StartOfCombatCard = {\r\n\tcardIds: [CardIds.TimewarpedMythrax_BG34_Giant_684, CardIds.TimewarpedMythrax_BG34_Giant_684_G],\r\n\tstartOfCombat: (minion: BoardEntity, input: SoCInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TimewarpedMythrax_BG34_Giant_684_G ? 2 : 1;\r\n\t\tfor (let i = 0; i < mult; i++) {\r\n\t\t\tconst candidates = getMinionsOfDifferentTypes(\r\n\t\t\t\tinput.playerBoard.filter((e) => !TimewarpedMythrax.cardIds.includes(e.cardId)),\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t\tconst targets = pickMultipleRandomDifferent(candidates, 3);\r\n\t\t\tconst totalAttack = targets.reduce((acc, target) => acc + (target.attack ?? 0), 0);\r\n\t\t\tconst totalHealth = targets.reduce((acc, target) => acc + (target.health ?? 0), 0);\r\n\t\t\tmodifyStats(\r\n\t\t\t\tminion,\r\n\t\t\t\tminion,\r\n\t\t\t\ttotalAttack,\r\n\t\t\t\ttotalHealth,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
|
|
@@ -4,7 +4,7 @@ exports.TimewarpedTraveler = void 0;
|
|
|
4
4
|
const cards_in_hand_1 = require("../../../simulation/cards-in-hand");
|
|
5
5
|
exports.TimewarpedTraveler = {
|
|
6
6
|
cardIds: ["BG34_Giant_605", "BG34_Giant_605_G"],
|
|
7
|
-
baseAvengeValue: (cardId) =>
|
|
7
|
+
baseAvengeValue: (cardId) => 4,
|
|
8
8
|
avenge: (minion, input) => {
|
|
9
9
|
const mult = minion.cardId === "BG34_Giant_605_G" ? 2 : 1;
|
|
10
10
|
const cardsToAdd = Array(mult).fill(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timewarped-traveler.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-traveler.ts"],"names":[],"mappings":";;;AAGA,qEAAmE;AAGtD,QAAA,kBAAkB,GAAe;IAC7C,OAAO,EAAE,sCAAwF;IACjG,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAmB,EAAE,KAAkB,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAAgD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAA,8BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACtE,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { AvengeInput } from '../../../simulation/avenge';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { AvengeCard } from '../../card.interface';\r\n\r\nexport const TimewarpedTraveler: AvengeCard = {\r\n\tcardIds: [CardIds.TimewarpedTraveler_BG34_Giant_605, CardIds.TimewarpedTraveler_BG34_Giant_605_G],\r\n\tbaseAvengeValue: (cardId: string) =>
|
|
1
|
+
{"version":3,"file":"timewarped-traveler.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/timewarped-traveler.ts"],"names":[],"mappings":";;;AAGA,qEAAmE;AAGtD,QAAA,kBAAkB,GAAe;IAC7C,OAAO,EAAE,sCAAwF;IACjG,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAmB,EAAE,KAAkB,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAAgD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAA,8BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACtE,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { AvengeInput } from '../../../simulation/avenge';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { AvengeCard } from '../../card.interface';\r\n\r\nexport const TimewarpedTraveler: AvengeCard = {\r\n\tcardIds: [CardIds.TimewarpedTraveler_BG34_Giant_605, CardIds.TimewarpedTraveler_BG34_Giant_605_G],\r\n\tbaseAvengeValue: (cardId: string) => 4,\r\n\tavenge: (minion: BoardEntity, input: AvengeInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TimewarpedTraveler_BG34_Giant_605_G ? 2 : 1;\r\n\t\tconst cardsToAdd = Array(mult).fill(null);\r\n\t\taddCardsInHand(input.hero, input.board, cardsToAdd, input.gameState);\r\n\t},\r\n};\r\n"]}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TurquoiseSkitterer = void 0;
|
|
4
4
|
const deathrattle_spawns_1 = require("../../../simulation/deathrattle-spawns");
|
|
5
5
|
const stats_1 = require("../../../simulation/stats");
|
|
6
|
-
const atkBuff =
|
|
7
|
-
const hpBuff =
|
|
6
|
+
const atkBuff = 4;
|
|
7
|
+
const hpBuff = 4;
|
|
8
8
|
exports.TurquoiseSkitterer = {
|
|
9
9
|
cardIds: ["BG31_809", "BG31_809_G"],
|
|
10
10
|
deathrattleSpawn: (minion, input) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turquoise-skitterer.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/turquoise-skitterer.ts"],"names":[],"mappings":";;;AAGA,+EAAiF;AACjF,qDAAwD;AAGxD,MAAM,OAAO,GAAG,CAAC,CAAC;AAClB,MAAM,MAAM,GAAG,CAAC,CAAC;AAEJ,QAAA,kBAAkB,GAAgD;IAC9E,OAAO,EAAE,0BAA4E;IACrF,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB;YACxD,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB,GAAG,OAAO,GAAG,IAAI,CAAC;QAC5E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB;YACxD,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAAC;QAC3E,KAAK,CAAC,mBAAmB;aACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,4BAAyE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAiB,CAAC,CACvG;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,IAAA,mBAAW,EACV,CAAC,EACD,MAAM,EACN,OAAO,GAAG,IAAI,EACd,MAAM,GAAG,IAAI,EACb,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,SAAS,CACf,CAAC;QACH,CAAC,CAAC,CAAC;QACJ,OAAO,IAAA,4CAAuB,eAA8C,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1F,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nconst atkBuff =
|
|
1
|
+
{"version":3,"file":"turquoise-skitterer.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/turquoise-skitterer.ts"],"names":[],"mappings":";;;AAGA,+EAAiF;AACjF,qDAAwD;AAGxD,MAAM,OAAO,GAAG,CAAC,CAAC;AAClB,MAAM,MAAM,GAAG,CAAC,CAAC;AAEJ,QAAA,kBAAkB,GAAgD;IAC9E,OAAO,EAAE,0BAA4E;IACrF,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB;YACxD,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB,GAAG,OAAO,GAAG,IAAI,CAAC;QAC5E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB;YACxD,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAAC;QAC3E,KAAK,CAAC,mBAAmB;aACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,4BAAyE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAiB,CAAC,CACvG;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,IAAA,mBAAW,EACV,CAAC,EACD,MAAM,EACN,OAAO,GAAG,IAAI,EACd,MAAM,GAAG,IAAI,EACb,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,SAAS,CACf,CAAC;QACH,CAAC,CAAC,CAAC;QACJ,OAAO,IAAA,4CAAuB,eAA8C,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1F,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nconst atkBuff = 4;\r\nconst hpBuff = 4;\r\n\r\nexport const TurquoiseSkitterer: DeathrattleSpawnCard & DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.TurquoiseSkitterer_BG31_809, CardIds.TurquoiseSkitterer_BG31_809_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TurquoiseSkitterer_BG31_809_G ? 2 : 1;\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.BeetleAttackBuff =\r\n\t\t\tinput.boardWithDeadEntityHero.globalInfo.BeetleAttackBuff + atkBuff * mult;\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.BeetleHealthBuff =\r\n\t\t\tinput.boardWithDeadEntityHero.globalInfo.BeetleHealthBuff + hpBuff * mult;\r\n\t\tinput.boardWithDeadEntity\r\n\t\t\t.filter((e) =>\r\n\t\t\t\t[CardIds.BoonOfBeetles_BeetleToken_BG28_603t, CardIds.Beetle_BG28_603t_G].includes(e.cardId as CardIds),\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\tatkBuff * mult,\r\n\t\t\t\t\thpBuff * mult,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\treturn simplifiedSpawnEntities(CardIds.BoonOfBeetles_BeetleToken_BG28_603t, mult, input);\r\n\t},\r\n};\r\n"]}
|
|
@@ -9,13 +9,13 @@ exports.VeteransTactics = {
|
|
|
9
9
|
"BG34_407_Gt",
|
|
10
10
|
],
|
|
11
11
|
castTavernSpell: (spellCardId, input) => {
|
|
12
|
-
let totalKeywords =
|
|
12
|
+
let totalKeywords = 0;
|
|
13
13
|
for (const bonusKeyword of cards_data_1.validBonusKeywords) {
|
|
14
14
|
if (input.board.some((e) => (0, cards_data_1.hasKeyword)(e, bonusKeyword))) {
|
|
15
15
|
totalKeywords++;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
const loops =
|
|
18
|
+
const loops = totalKeywords;
|
|
19
19
|
const mult = spellCardId === "BG34_407_Gt" ? 2 : 1;
|
|
20
20
|
for (let i = 0; i < loops; i++) {
|
|
21
21
|
(0, utils_1.addStatsToBoard)(input.source, input.board, input.hero, 2 * mult, 1 * mult, input.gameState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"veterans-tactics.js","sourceRoot":"","sources":["../../../../src/cards/impl/spellcraft/veterans-tactics.ts"],"names":[],"mappings":";;;AACA,0CAAiD;AAEjD,iDAAkE;AAErD,QAAA,eAAe,GAAoB;IAC/C,OAAO,EAAE;;;KAGR;IACD,eAAe,EAAE,CAAC,WAAmB,EAAE,KAAqB,EAAE,EAAE;QAC/D,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,KAAK,MAAM,YAAY,IAAI,+BAAkB,EAAE;YAC9C,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE;gBACzD,aAAa,EAAE,CAAC;aAChB;SACD;QACD,MAAM,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"veterans-tactics.js","sourceRoot":"","sources":["../../../../src/cards/impl/spellcraft/veterans-tactics.ts"],"names":[],"mappings":";;;AACA,0CAAiD;AAEjD,iDAAkE;AAErD,QAAA,eAAe,GAAoB;IAC/C,OAAO,EAAE;;;KAGR;IACD,eAAe,EAAE,CAAC,WAAmB,EAAE,KAAqB,EAAE,EAAE;QAC/D,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,KAAK,MAAM,YAAY,IAAI,+BAAkB,EAAE;YAC9C,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE;gBACzD,aAAa,EAAE,CAAC;aAChB;SACD;QACD,MAAM,KAAK,GAAG,aAAa,CAAC;QAC5B,MAAM,IAAI,GAAG,WAAW,kBAA6D,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC/B,IAAA,uBAAe,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SAC5F;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\r\nimport { addStatsToBoard } from '../../../utils';\r\nimport { CastSpellInput, TavernSpellCard } from '../../card.interface';\r\nimport { hasKeyword, validBonusKeywords } from '../../cards-data';\r\n\r\nexport const VeteransTactics: TavernSpellCard = {\r\n\tcardIds: [\r\n\t\tCardIds.AzsharanVeteran_VeteransTacticsToken_BG34_407t,\r\n\t\tCardIds.AzsharanVeteran_VeteransTacticsToken_BG34_407_Gt,\r\n\t],\r\n\tcastTavernSpell: (spellCardId: string, input: CastSpellInput) => {\r\n\t\tlet totalKeywords = 0;\r\n\t\tfor (const bonusKeyword of validBonusKeywords) {\r\n\t\t\tif (input.board.some((e) => hasKeyword(e, bonusKeyword))) {\r\n\t\t\t\ttotalKeywords++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tconst loops = totalKeywords;\r\n\t\tconst mult = spellCardId === CardIds.AzsharanVeteran_VeteransTacticsToken_BG34_407_Gt ? 2 : 1;\r\n\t\tfor (let i = 0; i < loops; i++) {\r\n\t\t\taddStatsToBoard(input.source, input.board, input.hero, 2 * mult, 1 * mult, input.gameState);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoardTrinket } from '../../../bgs-player-entity';
|
|
2
2
|
import { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';
|
|
3
|
-
export declare const eternalKnightAttack =
|
|
3
|
+
export declare const eternalKnightAttack = 4;
|
|
4
4
|
export declare const eternalKnightHealth = 1;
|
|
5
5
|
export declare const EternalPortrait: {
|
|
6
6
|
startOfCombat: (trinket: BoardTrinket, input: SoCInput) => boolean;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EternalPortrait = exports.eternalKnightHealth = exports.eternalKnightAttack = void 0;
|
|
4
4
|
const reborn_1 = require("../../../keywords/reborn");
|
|
5
5
|
const taunt_1 = require("../../../keywords/taunt");
|
|
6
|
-
exports.eternalKnightAttack =
|
|
6
|
+
exports.eternalKnightAttack = 4;
|
|
7
7
|
exports.eternalKnightHealth = 1;
|
|
8
8
|
exports.EternalPortrait = {
|
|
9
9
|
startOfCombat: (trinket, input) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eternal-portrait.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/eternal-portrait.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"eternal-portrait.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/eternal-portrait.ts"],"names":[],"mappings":";;;AACA,qDAAwD;AACxD,mDAAsD;AAIzC,QAAA,mBAAmB,GAAG,CAAC,CAAC;AACxB,QAAA,mBAAmB,GAAG,CAAC,CAAC;AAExB,QAAA,eAAe,GAAG;IAC9B,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW;aAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAmC,IAAI,CAAC,CAAC,MAAM,iBAAqC,CAAC;aAC3G,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EAAE;YACvB,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC7B,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;gBACxG,IAAA,qBAAY,EACX,MAAM,EACN,IAAI,EACJ,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,KAAK,CAAC,YAAY,EAClB,MAAM,EACN,KAAK,CAAC,WAAW,EACjB,IAAI,EACJ,IAAI,CACJ,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;SACZ;IACF,CAAC;CACD,CAAC","sourcesContent":["import { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { updateReborn } from '../../../keywords/reborn';\r\nimport { updateTaunt } from '../../../keywords/taunt';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\n\r\nexport const eternalKnightAttack = 4;\r\nexport const eternalKnightHealth = 1;\r\n\r\nexport const EternalPortrait = {\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tconst candidates = input.playerBoard\r\n\t\t\t.filter((e) => e.cardId === CardIds.EternalKnight_BG25_008 || e.cardId === CardIds.EternalKnight_BG25_008_G)\r\n\t\t\t.filter((e) => !e.taunt || !e.reborn);\r\n\t\tif (candidates?.length) {\r\n\t\t\tcandidates.forEach((knight) => {\r\n\t\t\t\tupdateTaunt(knight, true, input.playerBoard, input.playerEntity, input.opponentEntity, input.gameState);\r\n\t\t\t\tupdateReborn(\r\n\t\t\t\t\tknight,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tknight,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t\treturn true;\r\n\t\t}\r\n\t},\r\n};\r\n"]}
|
|
@@ -115,7 +115,7 @@ const handleOtherEntityEffects = (entity, board, hero, otherBoard, otherHero, sp
|
|
|
115
115
|
const stats = e.cardId === "BG29_806_G" ? 2 : 1;
|
|
116
116
|
const target = (0, utils_1.pickRandom)(board.filter((e) => e.entityId !== entity.entityId));
|
|
117
117
|
if (!!target) {
|
|
118
|
-
(0, stats_1.modifyStats)(target, e,
|
|
118
|
+
(0, stats_1.modifyStats)(target, e, 3 * stats, 1 * stats, board, hero, gameState);
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
board
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"damage-effects.js","sourceRoot":"","sources":["../../src/simulation/damage-effects.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD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AAG,OAAO,CAAC,MAAM,0BAA+D,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnG,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;SAC9D;IACF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasAfterDealDamage, hasOnDamaged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { updateDivineShield } from '../keywords/divine-shield';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandom, pickRandomAlive } from '../services/utils';\r\nimport { grantStatsToMinionsOfEachType, hasCorrectTribe } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { applyFrenzy } from './frenzy';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const onEntityDamaged = (\r\n\tdamagedEntity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity | BgsPlayerEntity,\r\n\tdamage: number,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst spawnedEntities: BoardEntity[] = [];\r\n\tconst friendlyBoard =\r\n\t\tboard?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? board\r\n\t\t\t: otherBoard?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? otherBoard\r\n\t\t\t: [];\r\n\tconst enemyBoard =\r\n\t\tboard?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? otherBoard\r\n\t\t\t: board?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? board\r\n\t\t\t: [];\r\n\tconst friendlyHero = friendlyBoard === board ? hero : otherHero;\r\n\tconst enemyHero = friendlyBoard === board ? otherHero : hero;\r\n\r\n\tif (damagedEntity.frenzyChargesLeft > 0 && damagedEntity.health > 0 && !damagedEntity.definitelyDead) {\r\n\t\tapplyFrenzy(damagedEntity, friendlyBoard, friendlyHero, gameState);\r\n\t\tdamagedEntity.frenzyChargesLeft--;\r\n\t}\r\n\r\n\tconst wheneverDamagedImpl = cardMappings[damagedEntity.cardId];\r\n\tif (hasOnDamaged(wheneverDamagedImpl)) {\r\n\t\twheneverDamagedImpl.onDamaged(damagedEntity, {\r\n\t\t\tdamagedEntity: damagedEntity,\r\n\t\t\tdamageDealer: damageSource,\r\n\t\t\tdamage: damage,\r\n\t\t\tboard: friendlyBoard,\r\n\t\t\thero: friendlyHero,\r\n\t\t\totherHero: enemyHero,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\r\n\tswitch (damagedEntity.cardId) {\r\n\t\tcase CardIds.WingedChimera_BG29_844:\r\n\t\tcase CardIds.WingedChimera_BG29_844_G:\r\n\t\t\tif (damagedEntity.abiityChargesLeft > 0) {\r\n\t\t\t\tconst wingedChimeraModifier = damagedEntity.cardId === CardIds.WingedChimera_BG29_844_G ? 2 : 1;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tdamagedEntity,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyHero,\r\n\t\t\t\t\twingedChimeraModifier * 1,\r\n\t\t\t\t\twingedChimeraModifier * 1,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tdamagedEntity.abiityChargesLeft--;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Untameabull_BG29_878:\r\n\t\tcase CardIds.Untameabull_BG29_878_G:\r\n\t\t\tupdateDivineShield(damagedEntity, friendlyBoard, friendlyHero, enemyHero, true, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\tdamagedEntity,\r\n\t\t\t\tdamagedEntity,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyHero,\r\n\t\t\t\tenemyHero,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TrustyPup_BG29_800:\r\n\t\tcase CardIds.TrustyPup_BG29_800_G:\r\n\t\t\tconst trustyPupStats = damagedEntity.cardId === CardIds.TrustyPup_BG29_800_G ? 2 : 1;\r\n\t\t\tmodifyStats(damagedEntity, damagedEntity, trustyPupStats, 0, friendlyBoard, friendlyHero, gameState);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SilverGoose_BG29_801:\r\n\t\tcase CardIds.SilverGoose_BG29_801_G:\r\n\t\t\tspawnedEntities.push(\r\n\t\t\t\t...spawnEntities(\r\n\t\t\t\t\tdamagedEntity.cardId === CardIds.SilverGoose_BG29_801_G\r\n\t\t\t\t\t\t? CardIds.SilverGoose_SilverFledglingToken_BG29_801_Gt\r\n\t\t\t\t\t\t: CardIds.SilverGoose_SilverFledglingToken_BG29_801t,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyHero,\r\n\t\t\t\t\tenemyBoard,\r\n\t\t\t\t\tenemyHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdamagedEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t),\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\thandleOtherEntityEffects(\r\n\t\tdamagedEntity,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\tenemyBoard,\r\n\t\tenemyHero,\r\n\t\tspawnedEntities,\r\n\t\tgameState,\r\n\t);\r\n\tconst finalSpawns = performEntitySpawns(\r\n\t\tspawnedEntities,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\tdamagedEntity,\r\n\t\tfriendlyBoard.length - (friendlyBoard.indexOf(damagedEntity) + 1),\r\n\t\tenemyBoard,\r\n\t\tenemyHero,\r\n\t\tgameState,\r\n\t);\r\n\r\n\tconst entityRightToSpawns = friendlyBoard[friendlyBoard.indexOf(damagedEntity) + 1];\r\n\tfinalSpawns.forEach((e) => {\r\n\t\te.hasAttacked = damagedEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tif (damage > 0) {\r\n\t\tfor (const entity of friendlyBoard) {\r\n\t\t\tconst afterDealDamageImpl = cardMappings[entity.cardId];\r\n\t\t\tif (hasAfterDealDamage(afterDealDamageImpl)) {\r\n\t\t\t\tafterDealDamageImpl.afterDealDamage(entity, {\r\n\t\t\t\t\tdamagedEntity: damagedEntity,\r\n\t\t\t\t\tdamageDealer: damageSource,\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (const entity of enemyBoard) {\r\n\t\t\tconst afterDealDamageImpl = cardMappings[entity.cardId];\r\n\t\t\tif (hasAfterDealDamage(afterDealDamageImpl)) {\r\n\t\t\t\tafterDealDamageImpl.afterDealDamage(entity, {\r\n\t\t\t\t\tdamagedEntity: damagedEntity,\r\n\t\t\t\t\tdamageDealer: damageSource,\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t\tboard: enemyBoard,\r\n\t\t\t\t\thero: enemyHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn finalSpawns;\r\n};\r\n\r\nconst handleOtherEntityEffects = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawnedEntities: BoardEntity[],\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (hasCorrectTribe(entity, hero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.IridescentSkyblazer_BG29_806 ||\r\n\t\t\t\t\te.cardId === CardIds.IridescentSkyblazer_BG29_806_G,\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst stats = e.cardId === CardIds.IridescentSkyblazer_BG29_806_G ? 2 : 1;\r\n\t\t\t\tconst target = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\tif (!!target) {\r\n\t\t\t\t\tmodifyStats(target, e, 2 * stats, 1 * stats, board, hero, gameState);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.TrigoreTheLasher_BG29_807 || e.cardId === CardIds.TrigoreTheLasher_BG29_807_G,\r\n\t\t\t)\r\n\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst stats = e.cardId === CardIds.TrigoreTheLasher_BG29_807_G ? 2 : 1;\r\n\t\t\t\tmodifyStats(e, e, 0, 2 * stats, board, hero, gameState);\r\n\t\t\t});\r\n\t}\r\n\r\n\thero.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.TigerCarving_BG30_MagicItem_427 ||\r\n\t\t\t\tt.cardId === CardIds.TigerCarving_TigerCarvingToken_BG30_MagicItem_427t,\r\n\t\t)\r\n\t\t.forEach((carving) => {\r\n\t\t\tconst target = pickRandomAlive(board);\r\n\t\t\tif (!!target) {\r\n\t\t\t\tconst buff = carving.cardId === CardIds.TigerCarving_TigerCarvingToken_BG30_MagicItem_427t ? 4 : 2;\r\n\t\t\t\tmodifyStats(target, carving, buff, 0, board, hero, gameState);\r\n\t\t\t}\r\n\t\t});\r\n};\r\n\r\nexport interface AfterDealDamageInput {\r\n\tdamagedEntity: BoardEntity | BgsPlayerEntity;\r\n\tdamageDealer: BoardEntity | BgsPlayerEntity;\r\n\tdamage: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"damage-effects.js","sourceRoot":"","sources":["../../src/simulation/damage-effects.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,4DAA2E;AAC3E,iEAA4D;AAC5D,6DAA+D;AAE/D,6CAAgE;AAChE,oCAA0E;AAC1E,6DAAqD;AACrD,qCAAuC;AAEvC,qCAA+C;AAC/C,mCAAsC;AAE/B,MAAM,eAAe,GAAG,CAC9B,aAA0B,EAC1B,KAAoB,EACpB,IAAqB,EACrB,UAAyB,EACzB,SAA0B,EAC1B,YAA2C,EAC3C,MAAc,EACd,SAAwB,EACC,EAAE;;IAC3B,MAAM,eAAe,GAAkB,EAAE,CAAC;IAC1C,MAAM,aAAa,GAClB,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,0CAAE,QAAQ,MAAK,aAAa,CAAC,QAAQ;QAC9C,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,CAAC,CAAC,0CAAE,QAAQ,MAAK,aAAa,CAAC,QAAQ;YACtD,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,UAAU,GACf,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,0CAAE,QAAQ,MAAK,aAAa,CAAC,QAAQ;QAC9C,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,0CAAE,QAAQ,MAAK,aAAa,CAAC,QAAQ;YACj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;QACzD,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,CAAC,QAAQ;SACX,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,yBAA4C;QACpD,CAAC,CAAC,MAAM,0BAA+D,CACxE;SACA,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACpB,MAAM,MAAM,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,0BAA+D,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnG,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;SAC9D;IACF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasAfterDealDamage, hasOnDamaged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { updateDivineShield } from '../keywords/divine-shield';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandom, pickRandomAlive } from '../services/utils';\r\nimport { grantStatsToMinionsOfEachType, hasCorrectTribe } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { applyFrenzy } from './frenzy';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const onEntityDamaged = (\r\n\tdamagedEntity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity | BgsPlayerEntity,\r\n\tdamage: number,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst spawnedEntities: BoardEntity[] = [];\r\n\tconst friendlyBoard =\r\n\t\tboard?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? board\r\n\t\t\t: otherBoard?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? otherBoard\r\n\t\t\t: [];\r\n\tconst enemyBoard =\r\n\t\tboard?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? otherBoard\r\n\t\t\t: board?.[0]?.friendly === damagedEntity.friendly\r\n\t\t\t? board\r\n\t\t\t: [];\r\n\tconst friendlyHero = friendlyBoard === board ? hero : otherHero;\r\n\tconst enemyHero = friendlyBoard === board ? otherHero : hero;\r\n\r\n\tif (damagedEntity.frenzyChargesLeft > 0 && damagedEntity.health > 0 && !damagedEntity.definitelyDead) {\r\n\t\tapplyFrenzy(damagedEntity, friendlyBoard, friendlyHero, gameState);\r\n\t\tdamagedEntity.frenzyChargesLeft--;\r\n\t}\r\n\r\n\tconst wheneverDamagedImpl = cardMappings[damagedEntity.cardId];\r\n\tif (hasOnDamaged(wheneverDamagedImpl)) {\r\n\t\twheneverDamagedImpl.onDamaged(damagedEntity, {\r\n\t\t\tdamagedEntity: damagedEntity,\r\n\t\t\tdamageDealer: damageSource,\r\n\t\t\tdamage: damage,\r\n\t\t\tboard: friendlyBoard,\r\n\t\t\thero: friendlyHero,\r\n\t\t\totherHero: enemyHero,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\r\n\tswitch (damagedEntity.cardId) {\r\n\t\tcase CardIds.WingedChimera_BG29_844:\r\n\t\tcase CardIds.WingedChimera_BG29_844_G:\r\n\t\t\tif (damagedEntity.abiityChargesLeft > 0) {\r\n\t\t\t\tconst wingedChimeraModifier = damagedEntity.cardId === CardIds.WingedChimera_BG29_844_G ? 2 : 1;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tdamagedEntity,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyHero,\r\n\t\t\t\t\twingedChimeraModifier * 1,\r\n\t\t\t\t\twingedChimeraModifier * 1,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tdamagedEntity.abiityChargesLeft--;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Untameabull_BG29_878:\r\n\t\tcase CardIds.Untameabull_BG29_878_G:\r\n\t\t\tupdateDivineShield(damagedEntity, friendlyBoard, friendlyHero, enemyHero, true, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\tdamagedEntity,\r\n\t\t\t\tdamagedEntity,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyHero,\r\n\t\t\t\tenemyHero,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.TrustyPup_BG29_800:\r\n\t\tcase CardIds.TrustyPup_BG29_800_G:\r\n\t\t\tconst trustyPupStats = damagedEntity.cardId === CardIds.TrustyPup_BG29_800_G ? 2 : 1;\r\n\t\t\tmodifyStats(damagedEntity, damagedEntity, trustyPupStats, 0, friendlyBoard, friendlyHero, gameState);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SilverGoose_BG29_801:\r\n\t\tcase CardIds.SilverGoose_BG29_801_G:\r\n\t\t\tspawnedEntities.push(\r\n\t\t\t\t...spawnEntities(\r\n\t\t\t\t\tdamagedEntity.cardId === CardIds.SilverGoose_BG29_801_G\r\n\t\t\t\t\t\t? CardIds.SilverGoose_SilverFledglingToken_BG29_801_Gt\r\n\t\t\t\t\t\t: CardIds.SilverGoose_SilverFledglingToken_BG29_801t,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyHero,\r\n\t\t\t\t\tenemyBoard,\r\n\t\t\t\t\tenemyHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdamagedEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t),\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\thandleOtherEntityEffects(\r\n\t\tdamagedEntity,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\tenemyBoard,\r\n\t\tenemyHero,\r\n\t\tspawnedEntities,\r\n\t\tgameState,\r\n\t);\r\n\tconst finalSpawns = performEntitySpawns(\r\n\t\tspawnedEntities,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\tdamagedEntity,\r\n\t\tfriendlyBoard.length - (friendlyBoard.indexOf(damagedEntity) + 1),\r\n\t\tenemyBoard,\r\n\t\tenemyHero,\r\n\t\tgameState,\r\n\t);\r\n\r\n\tconst entityRightToSpawns = friendlyBoard[friendlyBoard.indexOf(damagedEntity) + 1];\r\n\tfinalSpawns.forEach((e) => {\r\n\t\te.hasAttacked = damagedEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tif (damage > 0) {\r\n\t\tfor (const entity of friendlyBoard) {\r\n\t\t\tconst afterDealDamageImpl = cardMappings[entity.cardId];\r\n\t\t\tif (hasAfterDealDamage(afterDealDamageImpl)) {\r\n\t\t\t\tafterDealDamageImpl.afterDealDamage(entity, {\r\n\t\t\t\t\tdamagedEntity: damagedEntity,\r\n\t\t\t\t\tdamageDealer: damageSource,\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (const entity of enemyBoard) {\r\n\t\t\tconst afterDealDamageImpl = cardMappings[entity.cardId];\r\n\t\t\tif (hasAfterDealDamage(afterDealDamageImpl)) {\r\n\t\t\t\tafterDealDamageImpl.afterDealDamage(entity, {\r\n\t\t\t\t\tdamagedEntity: damagedEntity,\r\n\t\t\t\t\tdamageDealer: damageSource,\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t\tboard: enemyBoard,\r\n\t\t\t\t\thero: enemyHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn finalSpawns;\r\n};\r\n\r\nconst handleOtherEntityEffects = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawnedEntities: BoardEntity[],\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (hasCorrectTribe(entity, hero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.IridescentSkyblazer_BG29_806 ||\r\n\t\t\t\t\te.cardId === CardIds.IridescentSkyblazer_BG29_806_G,\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst stats = e.cardId === CardIds.IridescentSkyblazer_BG29_806_G ? 2 : 1;\r\n\t\t\t\tconst target = pickRandom(board.filter((e) => e.entityId !== entity.entityId));\r\n\t\t\t\tif (!!target) {\r\n\t\t\t\t\tmodifyStats(target, e, 3 * stats, 1 * stats, board, hero, gameState);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\tboard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.TrigoreTheLasher_BG29_807 || e.cardId === CardIds.TrigoreTheLasher_BG29_807_G,\r\n\t\t\t)\r\n\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst stats = e.cardId === CardIds.TrigoreTheLasher_BG29_807_G ? 2 : 1;\r\n\t\t\t\tmodifyStats(e, e, 0, 2 * stats, board, hero, gameState);\r\n\t\t\t});\r\n\t}\r\n\r\n\thero.trinkets\r\n\t\t.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.TigerCarving_BG30_MagicItem_427 ||\r\n\t\t\t\tt.cardId === CardIds.TigerCarving_TigerCarvingToken_BG30_MagicItem_427t,\r\n\t\t)\r\n\t\t.forEach((carving) => {\r\n\t\t\tconst target = pickRandomAlive(board);\r\n\t\t\tif (!!target) {\r\n\t\t\t\tconst buff = carving.cardId === CardIds.TigerCarving_TigerCarvingToken_BG30_MagicItem_427t ? 4 : 2;\r\n\t\t\t\tmodifyStats(target, carving, buff, 0, board, hero, gameState);\r\n\t\t\t}\r\n\t\t});\r\n};\r\n\r\nexport interface AfterDealDamageInput {\r\n\tdamagedEntity: BoardEntity | BgsPlayerEntity;\r\n\tdamageDealer: BoardEntity | BgsPlayerEntity;\r\n\tdamage: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
|
@@ -10,7 +10,18 @@ const deathrattle_effects_1 = require("./deathrattle-effects");
|
|
|
10
10
|
const deathrattle_spawns_1 = require("./deathrattle-spawns");
|
|
11
11
|
const reborn_1 = require("./reborn");
|
|
12
12
|
const spawns_1 = require("./spawns");
|
|
13
|
+
let _deathEffectsDepth = 0;
|
|
13
14
|
const orchestrateMinionDeathEffects = (deathrattleInput, processAvenge = true, processReborn = true) => {
|
|
15
|
+
_deathEffectsDepth++;
|
|
16
|
+
if (_deathEffectsDepth > 100) {
|
|
17
|
+
console.error('Infinite recursion detected at depth', _deathEffectsDepth);
|
|
18
|
+
console.error('Player dead entities:', deathrattleInput.playerDeadEntities.map((e) => e.cardId));
|
|
19
|
+
console.error('Opponent dead entities:', deathrattleInput.opponentDeadEntities.map((e) => e.cardId));
|
|
20
|
+
console.error('Player board:', deathrattleInput.gameState.gameState.player.board.map((e) => e.cardId));
|
|
21
|
+
console.error('Opponent board:', deathrattleInput.gameState.gameState.opponent.board.map((e) => e.cardId));
|
|
22
|
+
_deathEffectsDepth--;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
14
25
|
handleAfterMinionsKillEffects(deathrattleInput);
|
|
15
26
|
handleWheneverMinionsDieEffects(deathrattleInput);
|
|
16
27
|
const playerBoardBefore = [...deathrattleInput.gameState.gameState.player.board];
|
|
@@ -46,6 +57,7 @@ const orchestrateMinionDeathEffects = (deathrattleInput, processAvenge = true, p
|
|
|
46
57
|
}
|
|
47
58
|
const entitiesFromFeathermanes = processFeathermaneEffects(deathrattleInput);
|
|
48
59
|
handlePostDeathrattleEffects(deathrattleInput, [...entitiesFromDeathrattles, ...entitiesFromFeathermanes]);
|
|
60
|
+
_deathEffectsDepth--;
|
|
49
61
|
};
|
|
50
62
|
exports.orchestrateMinionDeathEffects = orchestrateMinionDeathEffects;
|
|
51
63
|
const handleAfterMinionsKillEffects = (deathrattleInput) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deathrattle-orchestration.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-orchestration.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAEpD,oDAA8C;AAE9C,oCAA2C;AAC3C,qCAA8C;AAC9C,mDAAyD;AACzD,+DAI+B;AAC/B,6DAAmF;AAEnF,qCAAiD;AACjD,qCAA+C;AAWxC,MAAM,6BAA6B,GAAG,CAC5C,gBAAkC,EAClC,aAAa,GAAG,IAAI,EACpB,aAAa,GAAG,IAAI,EACnB,EAAE;IACH,6BAA6B,CAAC,gBAAgB,CAAC,CAAC;IAGhD,+BAA+B,CAAC,gBAAgB,CAAC,CAAC;IAElD,MAAM,iBAAiB,GAAG,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjF,MAAM,mBAAmB,GAAG,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAErF,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IAItF,4BAA4B,CAAC,gBAAgB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U,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QACnD,IAAI,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,EAAE;YAChE,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAC3B,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAC3E,CAAC;SACF;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAvengeEffects } from './avenge';\r\nimport { applyAfterDeathEffects } from './death-effects';\r\nimport {\r\n\tapplyAfterMinionDiesEffect,\r\n\tapplyWheneverMinionDiesEffect,\r\n\thandleAfterMinionKillsEffect,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle } from './deathrattle-spawns';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { handleRebornForEntity } from './reborn';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\n// FIXME:\r\n// From Mitchell on Discord:\r\n// - Minions die left to right\r\n// - When a minion dies, it procs natural deathrattle, added deathrattles, and then all avenges progress\r\n// by 1 (and trigger as necessary)\r\n// - Then next minion\r\n// - After ALL deathrattles and avenges are done, Reborn triggers\r\n// - (Ideally after all of that I would want Feathermane to trigger, but that is not what it does right now.\r\n// Right now it triggers at deathrattle speed rather than after Reborn speed)\r\nexport const orchestrateMinionDeathEffects = (\r\n\tdeathrattleInput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n\tprocessReborn = true,\r\n) => {\r\n\thandleAfterMinionsKillEffects(deathrattleInput);\r\n\r\n\t// Not sure about this\r\n\thandleWheneverMinionsDieEffects(deathrattleInput);\r\n\r\n\tconst playerBoardBefore = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardBefore = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\r\n\tconst entitiesFromDeathrattles = processDeathrattles(deathrattleInput, processAvenge);\r\n\r\n\t// When a Silent Enforcer dies, it deals damage to other minions, then Soul Juggler damages the minions\r\n\t// **before** they completely die and spawn their own deathrattles\r\n\thandleAfterMinionsDieEffects(deathrattleInput);\r\n\r\n\t// Hack to try and fix how reborn indices are handled when there are spawns during the deathrattle phase\r\n\t// Ideally, this should probably be rewritten completely to keep the dead entities in the board itself\r\n\t// so we can use that as a source for the spawn index. However this is a big rewrite with lots of\r\n\t// potential side-effects\r\n\tconst playerBoardAfter = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardAfter = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\tconst opponentIndexOfSpawnedEntities = opponentBoardAfter\r\n\t\t.filter((entity) => !opponentBoardBefore.includes(entity))\r\n\t\t.map((entity) => opponentBoardAfter.length - opponentBoardAfter.indexOf(entity) - 1);\r\n\tconst playerIndexOfSpawnedEntities = playerBoardAfter\r\n\t\t.filter((entity) => !playerBoardBefore.includes(entity))\r\n\t\t.map((entity) => playerBoardAfter.length - playerBoardAfter.indexOf(entity) - 1);\r\n\tdeathrattleInput.opponentDeadEntityIndexesFromRight = deathrattleInput.opponentDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\topponentIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\tdeathrattleInput.playerDeadEntityIndexesFromRight = deathrattleInput.playerDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\tplayerIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\r\n\tif (processReborn) {\r\n\t\tprocessReborns(deathrattleInput);\r\n\t}\r\n\r\n\tconst entitiesFromFeathermanes = processFeathermaneEffects(deathrattleInput);\r\n\thandlePostDeathrattleEffects(deathrattleInput, [...entitiesFromDeathrattles, ...entitiesFromFeathermanes]);\r\n};\r\n\r\nconst handleAfterMinionsKillEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\thandleAfterMinionKillsEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleWheneverMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\t// Wildfire Element is applied first, before the DR spawns\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyWheneverMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyAfterMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst processDeathrattles = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\t// Deathrattles are handled left to right\r\n\t// Then for each minion, natural deathrattles are processed first, then enchantments\r\n\t// http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=1\r\n\t// http://replays.firestoneapp.com/?reviewId=f32e734a-d5a2-4fa4-ad10-94019969cdd7&turn=6&action=22\r\n\t// http://replays.firestoneapp.com/?reviewId=ea9503c9-2795-49f0-866b-9ea856cec7df&turn=11&action=3\r\n\t// http://replays.firestoneapp.com/?reviewId=1ff37e17-704c-4a73-8c78-377c52b6cb42&turn=13&action=1 is a trap: the enchantment is on the first\r\n\t// minion, but the DR is on the second one.\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\t// Issue: we should process all deathrattles first, then all avenge. If multiple minions die at the same time,\r\n\t\t// the current implementation processes the first minion completely (DR + avenge), then the second one\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tconst spawns = processDeathrattleForMinions(\r\n\t\t\t\tdeadEntities,\r\n\t\t\t\tplayerDeadEntityIndexesFromRight[i],\r\n\t\t\t\tplayerStates[i],\r\n\t\t\t\tplayerStates[1 - i],\r\n\t\t\t\tdeathrattleInput,\r\n\t\t\t\tprocessAvenge,\r\n\t\t\t);\r\n\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// for (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t// \tconst deadEntity = deadEntities[j];\r\n\t\t\t// \tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t// \tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t// \tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t// \tconst spawns = processDeathrattleForMinion(\r\n\t\t\t// \t\tdeadEntity,\r\n\t\t\t// \t\tindexFromRight,\r\n\t\t\t// \t\tdeadEntities,\r\n\t\t\t// \t\tdeadEntityPlayerState,\r\n\t\t\t// \t\totherPlayerState,\r\n\t\t\t// \t\tdeathrattleInput.gameState,\r\n\t\t\t// \t\tprocessAvenge,\r\n\t\t\t// \t);\r\n\t\t\t// \tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// }\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneEffects = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processFeathermaneForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst maxSpawns = 7 - deadEntityPlayerState.board.length;\r\n\tconst allSpawns = [];\r\n\r\n\t// Feathermane\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tconst feathermanes =\r\n\t\t\tdeadEntityPlayerState.player.hand\r\n\t\t\t\t?.filter((e) => !e.locked)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014 ||\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014_G,\r\n\t\t\t\t) ?? [];\r\n\t\tfor (const feathermaneSpawn of feathermanes) {\r\n\t\t\tif (allSpawns.length >= maxSpawns) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfeathermaneSpawn.locked = true;\r\n\t\t\tconst spawns = spawnEntities(\r\n\t\t\t\tfeathermaneSpawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tgameState,\r\n\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{ ...feathermaneSpawn } as BoardEntity,\r\n\t\t\t);\r\n\r\n\t\t\t// So that it can be flagged as \"unspawned\" if it is not spawned in the end\r\n\t\t\tfor (const spawn of spawns) {\r\n\t\t\t\tspawn.onCanceledSummon = () => (feathermaneSpawn.locked = false);\r\n\t\t\t\t// spawn.backRef = feathermaneSpawn;\r\n\t\t\t}\r\n\t\t\tallSpawns.push(...spawns);\r\n\t\t}\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn allSpawns;\r\n};\r\n\r\nconst processDeathrattleForMinions = (\r\n\tdeadEntities: BoardEntity[],\r\n\tplayerDeadEntityIndexesFromRight: number[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tinput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\r\n\t// Natural deathrattles & enchantments\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst drEntities = handleNaturalDeathrattle(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\r\n\t\tentitiesFromDeathrattles.push(...drEntities);\r\n\t}\r\n\r\n\t// Avenge\r\n\tlet avengeEntities = [];\r\n\tif (processAvenge) {\r\n\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\tconst allAfterDeathEntities = [];\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst afterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t\tallAfterDeathEntities.push(...afterDeathEntities);\r\n\t}\r\n\r\n\treturn [...entitiesFromDeathrattles, ...avengeEntities, ...allAfterDeathEntities];\r\n};\r\n\r\nexport const processDeathrattleForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst drEntities = handleNaturalDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\t// Avenge trigger before reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=5bb20eb8-e0ca-47ab-adc7-13134716d568&turn=7&action=6\r\n\tlet avengeEntities = [];\r\n\tlet afterDeathEntities = [];\r\n\tif (processAvenge) {\r\n\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t\t[...drEntities],\r\n\t\t);\r\n\r\n\t\t// TODO: Feathermane should be applied after the Reborn effects have all been processed\r\n\t\t// Secrets should be processed here (\"at Avenge speed\")\r\n\t\tafterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\treturn [...drEntities, ...avengeEntities, ...afterDeathEntities];\r\n};\r\n\r\nconst handleNaturalDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\t// const allSpawns = [];\r\n\t// const spawnsToSpawn = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\toriginalCardId: deadEntity.cardId,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tdeathrattleRepeats: dr.repeats ?? 1,\r\n\t\t\tscriptDataNum1: dr.tagScriptDataNum1,\r\n\t\t\tscriptDataNum2: dr.tagScriptDataNum2,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t\t// For Corrupted Bristler\r\n\t\t\tenchantments: deadEntity.enchantments.filter((e) => e.cardId?.startsWith(CardIds.BloodGem)),\r\n\t\t\tmemory:\r\n\t\t\t\tdr.memory == null\r\n\t\t\t\t\t? null\r\n\t\t\t\t\t: Array.isArray(dr.memory)\r\n\t\t\t\t\t? dr.memory.map((mem) => ({ ...mem }))\r\n\t\t\t\t\t: { ...dr.memory },\r\n\t\t};\r\n\t\tconst spawns = handleNaturalDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\t// The spawns have already been processed in the \"handleNaturalDeathrattle\" method\r\n\t\t// spawnsToSpawn.push(...spawns);\r\n\t\t// allSpawns.push(...spawns);\r\n\t}\r\n\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tdeadEntities,\r\n\t\tgameState,\r\n\t);\r\n\r\n\treturn entitiesFromNativeDeathrattle;\r\n};\r\n\r\nconst processReborns = (deathrattleInput: DeathrattleInput) => {\r\n\t// const entitiesFromReborn: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\thandleRebornForEntity(\r\n\t\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\totherPlayerState.board,\r\n\t\t\t\t\totherPlayerState.player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handlePostDeathrattleEffects = (deathrattleInput: DeathrattleInput, entitiesFromDeathrattles: BoardEntity[]) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Process from right to left, so that we can set the hasAttacked attribute properly\r\n\t\t\t// If two minions die at the same time, both of which having attacked, but the third in line having not,\r\n\t\t\t// processing them from left to right means the first (leftmost) one will check its right neighbor, which\r\n\t\t\t// is the minion that hasn't attacked\r\n\t\t\tfor (let j = deadEntities.length - 1; j >= 0; j--) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\thandlePostDeathrattleEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t\t\tdeadEntityPlayerState.player.friendly,\r\n\t\t\t\t\tdeathrattleInput,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleDeathrattles = (deathrattleInput: DeathrattleInput) => {\r\n\torchestrateMinionDeathEffects(deathrattleInput, false, false);\r\n};\r\n\r\nconst handlePostDeathrattleEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tspawnedEntities: BoardEntity[],\r\n\tisPlayer: boolean,\r\n\tdeathrattleInput: DeathrattleInput,\r\n) => {\r\n\t// This doesn't work if the entity that was to the right died.\r\n\tconst entityRightToSpawns =\r\n\t\tindexFromRight === 0 ? null : deadEntityPlayerState.board[deadEntityPlayerState.board.length - indexFromRight];\r\n\t// To handle minions attack tokens\r\n\t// See http://replays.firestoneapp.com/?reviewId=0583d6a4-6ed0-4b20-894e-4ceb560894fe&turn=6&action=11\r\n\t// When a minion dies, the spawn are either elligible to attack next turn or not\r\n\t// If the minion right to the spawned minion has already attacked, then the spawned\r\n\t// minion cannot attack\r\n\tspawnedEntities.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tif (deadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113)) {\r\n\t\tconst ogDeadEntity = gameState.sharedState.deaths.find((entity) => entity.entityId === deadEntity.entityId);\r\n\t\tif (ogDeadEntity) {\r\n\t\t\togDeadEntity.attack += 4;\r\n\t\t\togDeadEntity.health += 4;\r\n\t\t}\r\n\t}\r\n\r\n\t// ISSUE: when we do this, we change the minion's stats before processing deathrattle effects, which can mess\r\n\t// up the simulation in some cases (like Nightbane, Ignited)\r\n\t// FIX: we do it in postDeathrattleEfects, not when removing minions from the board\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tdeadEntity.attack = Math.max(\r\n\t\t\t0,\r\n\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus,\r\n\t\t);\r\n\t}\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tdeadEntity.health = Math.max(\r\n\t\t\t1,\r\n\t\t\tdeadEntity.health - deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus,\r\n\t\t);\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.UNDEAD, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.UndeadAttackBonus,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (isWhelp(deadEntity.cardId, gameState.allCards)) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.WhelpAttackBuff > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.WhelpAttackBuff,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\ninterface DeathrattleInput {\r\n\tgameState: FullGameState;\r\n\tplayerDeadEntities: BoardEntity[];\r\n\tplayerDeadEntityIndexesFromRight: number[];\r\n\topponentDeadEntities: BoardEntity[];\r\n\topponentDeadEntityIndexesFromRight: number[];\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"deathrattle-orchestration.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-orchestration.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAEpD,oDAA8C;AAE9C,oCAA2C;AAC3C,qCAA8C;AAC9C,mDAAyD;AACzD,+DAI+B;AAC/B,6DAAmF;AAEnF,qCAAiD;AACjD,qCAA+C;AAW/C,IAAI,kBAAkB,GAAG,CAAC,CAAC;AAEpB,MAAM,6BAA6B,GAAG,CAC5C,gBAAkC,EAClC,aAAa,GAAG,IAAI,EACpB,aAAa,GAAG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C3E,CAAC;SACF;KACD;IACD,IAAI,IAAA,oBAAO,EAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QACnD,IAAI,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,EAAE;YAChE,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAC3B,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAC3E,CAAC;SACF;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAvengeEffects } from './avenge';\r\nimport { applyAfterDeathEffects } from './death-effects';\r\nimport {\r\n\tapplyAfterMinionDiesEffect,\r\n\tapplyWheneverMinionDiesEffect,\r\n\thandleAfterMinionKillsEffect,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle } from './deathrattle-spawns';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { handleRebornForEntity } from './reborn';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\n// FIXME:\r\n// From Mitchell on Discord:\r\n// - Minions die left to right\r\n// - When a minion dies, it procs natural deathrattle, added deathrattles, and then all avenges progress\r\n// by 1 (and trigger as necessary)\r\n// - Then next minion\r\n// - After ALL deathrattles and avenges are done, Reborn triggers\r\n// - (Ideally after all of that I would want Feathermane to trigger, but that is not what it does right now.\r\n// Right now it triggers at deathrattle speed rather than after Reborn speed)\r\nlet _deathEffectsDepth = 0;\r\n\r\nexport const orchestrateMinionDeathEffects = (\r\n\tdeathrattleInput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n\tprocessReborn = true,\r\n) => {\r\n\t_deathEffectsDepth++;\r\n\tif (_deathEffectsDepth > 100) {\r\n\t\tconsole.error('Infinite recursion detected at depth', _deathEffectsDepth);\r\n\t\tconsole.error(\r\n\t\t\t'Player dead entities:',\r\n\t\t\tdeathrattleInput.playerDeadEntities.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Opponent dead entities:',\r\n\t\t\tdeathrattleInput.opponentDeadEntities.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Player board:',\r\n\t\t\tdeathrattleInput.gameState.gameState.player.board.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Opponent board:',\r\n\t\t\tdeathrattleInput.gameState.gameState.opponent.board.map((e) => e.cardId),\r\n\t\t);\r\n\t\t_deathEffectsDepth--;\r\n\t\treturn;\r\n\t}\r\n\r\n\thandleAfterMinionsKillEffects(deathrattleInput);\r\n\r\n\t// Not sure about this\r\n\thandleWheneverMinionsDieEffects(deathrattleInput);\r\n\r\n\tconst playerBoardBefore = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardBefore = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\r\n\tconst entitiesFromDeathrattles = processDeathrattles(deathrattleInput, processAvenge);\r\n\r\n\t// When a Silent Enforcer dies, it deals damage to other minions, then Soul Juggler damages the minions\r\n\t// **before** they completely die and spawn their own deathrattles\r\n\thandleAfterMinionsDieEffects(deathrattleInput);\r\n\r\n\t// Hack to try and fix how reborn indices are handled when there are spawns during the deathrattle phase\r\n\t// Ideally, this should probably be rewritten completely to keep the dead entities in the board itself\r\n\t// so we can use that as a source for the spawn index. However this is a big rewrite with lots of\r\n\t// potential side-effects\r\n\tconst playerBoardAfter = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardAfter = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\tconst opponentIndexOfSpawnedEntities = opponentBoardAfter\r\n\t\t.filter((entity) => !opponentBoardBefore.includes(entity))\r\n\t\t.map((entity) => opponentBoardAfter.length - opponentBoardAfter.indexOf(entity) - 1);\r\n\tconst playerIndexOfSpawnedEntities = playerBoardAfter\r\n\t\t.filter((entity) => !playerBoardBefore.includes(entity))\r\n\t\t.map((entity) => playerBoardAfter.length - playerBoardAfter.indexOf(entity) - 1);\r\n\tdeathrattleInput.opponentDeadEntityIndexesFromRight = deathrattleInput.opponentDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\topponentIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\tdeathrattleInput.playerDeadEntityIndexesFromRight = deathrattleInput.playerDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\tplayerIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\r\n\tif (processReborn) {\r\n\t\tprocessReborns(deathrattleInput);\r\n\t}\r\n\r\n\tconst entitiesFromFeathermanes = processFeathermaneEffects(deathrattleInput);\r\n\thandlePostDeathrattleEffects(deathrattleInput, [...entitiesFromDeathrattles, ...entitiesFromFeathermanes]);\r\n\r\n\t_deathEffectsDepth--;\r\n};\r\n\r\nconst handleAfterMinionsKillEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\thandleAfterMinionKillsEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleWheneverMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\t// Wildfire Element is applied first, before the DR spawns\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyWheneverMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyAfterMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst processDeathrattles = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\t// Deathrattles are handled left to right\r\n\t// Then for each minion, natural deathrattles are processed first, then enchantments\r\n\t// http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=1\r\n\t// http://replays.firestoneapp.com/?reviewId=f32e734a-d5a2-4fa4-ad10-94019969cdd7&turn=6&action=22\r\n\t// http://replays.firestoneapp.com/?reviewId=ea9503c9-2795-49f0-866b-9ea856cec7df&turn=11&action=3\r\n\t// http://replays.firestoneapp.com/?reviewId=1ff37e17-704c-4a73-8c78-377c52b6cb42&turn=13&action=1 is a trap: the enchantment is on the first\r\n\t// minion, but the DR is on the second one.\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\t// Issue: we should process all deathrattles first, then all avenge. If multiple minions die at the same time,\r\n\t\t// the current implementation processes the first minion completely (DR + avenge), then the second one\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tconst spawns = processDeathrattleForMinions(\r\n\t\t\t\tdeadEntities,\r\n\t\t\t\tplayerDeadEntityIndexesFromRight[i],\r\n\t\t\t\tplayerStates[i],\r\n\t\t\t\tplayerStates[1 - i],\r\n\t\t\t\tdeathrattleInput,\r\n\t\t\t\tprocessAvenge,\r\n\t\t\t);\r\n\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// for (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t// \tconst deadEntity = deadEntities[j];\r\n\t\t\t// \tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t// \tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t// \tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t// \tconst spawns = processDeathrattleForMinion(\r\n\t\t\t// \t\tdeadEntity,\r\n\t\t\t// \t\tindexFromRight,\r\n\t\t\t// \t\tdeadEntities,\r\n\t\t\t// \t\tdeadEntityPlayerState,\r\n\t\t\t// \t\totherPlayerState,\r\n\t\t\t// \t\tdeathrattleInput.gameState,\r\n\t\t\t// \t\tprocessAvenge,\r\n\t\t\t// \t);\r\n\t\t\t// \tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// }\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneEffects = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processFeathermaneForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst maxSpawns = 7 - deadEntityPlayerState.board.length;\r\n\tconst allSpawns = [];\r\n\r\n\t// Feathermane\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tconst feathermanes =\r\n\t\t\tdeadEntityPlayerState.player.hand\r\n\t\t\t\t?.filter((e) => !e.locked)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014 ||\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014_G,\r\n\t\t\t\t) ?? [];\r\n\t\tfor (const feathermaneSpawn of feathermanes) {\r\n\t\t\tif (allSpawns.length >= maxSpawns) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfeathermaneSpawn.locked = true;\r\n\t\t\tconst spawns = spawnEntities(\r\n\t\t\t\tfeathermaneSpawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tgameState,\r\n\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{ ...feathermaneSpawn } as BoardEntity,\r\n\t\t\t);\r\n\r\n\t\t\t// So that it can be flagged as \"unspawned\" if it is not spawned in the end\r\n\t\t\tfor (const spawn of spawns) {\r\n\t\t\t\tspawn.onCanceledSummon = () => (feathermaneSpawn.locked = false);\r\n\t\t\t\t// spawn.backRef = feathermaneSpawn;\r\n\t\t\t}\r\n\t\t\tallSpawns.push(...spawns);\r\n\t\t}\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn allSpawns;\r\n};\r\n\r\nconst processDeathrattleForMinions = (\r\n\tdeadEntities: BoardEntity[],\r\n\tplayerDeadEntityIndexesFromRight: number[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tinput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\r\n\t// Natural deathrattles & enchantments\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst drEntities = handleNaturalDeathrattle(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\r\n\t\tentitiesFromDeathrattles.push(...drEntities);\r\n\t}\r\n\r\n\t// Avenge\r\n\tlet avengeEntities = [];\r\n\tif (processAvenge) {\r\n\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\tconst allAfterDeathEntities = [];\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst afterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t\tallAfterDeathEntities.push(...afterDeathEntities);\r\n\t}\r\n\r\n\treturn [...entitiesFromDeathrattles, ...avengeEntities, ...allAfterDeathEntities];\r\n};\r\n\r\nexport const processDeathrattleForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst drEntities = handleNaturalDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\t// Avenge trigger before reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=5bb20eb8-e0ca-47ab-adc7-13134716d568&turn=7&action=6\r\n\tlet avengeEntities = [];\r\n\tlet afterDeathEntities = [];\r\n\tif (processAvenge) {\r\n\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t\t[...drEntities],\r\n\t\t);\r\n\r\n\t\t// TODO: Feathermane should be applied after the Reborn effects have all been processed\r\n\t\t// Secrets should be processed here (\"at Avenge speed\")\r\n\t\tafterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\treturn [...drEntities, ...avengeEntities, ...afterDeathEntities];\r\n};\r\n\r\nconst handleNaturalDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\t// const allSpawns = [];\r\n\t// const spawnsToSpawn = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\toriginalCardId: deadEntity.cardId,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tdeathrattleRepeats: dr.repeats ?? 1,\r\n\t\t\tscriptDataNum1: dr.tagScriptDataNum1,\r\n\t\t\tscriptDataNum2: dr.tagScriptDataNum2,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t\t// For Corrupted Bristler\r\n\t\t\tenchantments: deadEntity.enchantments.filter((e) => e.cardId?.startsWith(CardIds.BloodGem)),\r\n\t\t\tmemory:\r\n\t\t\t\tdr.memory == null\r\n\t\t\t\t\t? null\r\n\t\t\t\t\t: Array.isArray(dr.memory)\r\n\t\t\t\t\t? dr.memory.map((mem) => ({ ...mem }))\r\n\t\t\t\t\t: { ...dr.memory },\r\n\t\t};\r\n\t\tconst spawns = handleNaturalDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\t// The spawns have already been processed in the \"handleNaturalDeathrattle\" method\r\n\t\t// spawnsToSpawn.push(...spawns);\r\n\t\t// allSpawns.push(...spawns);\r\n\t}\r\n\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tdeadEntities,\r\n\t\tgameState,\r\n\t);\r\n\r\n\treturn entitiesFromNativeDeathrattle;\r\n};\r\n\r\nconst processReborns = (deathrattleInput: DeathrattleInput) => {\r\n\t// const entitiesFromReborn: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\thandleRebornForEntity(\r\n\t\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\totherPlayerState.board,\r\n\t\t\t\t\totherPlayerState.player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handlePostDeathrattleEffects = (deathrattleInput: DeathrattleInput, entitiesFromDeathrattles: BoardEntity[]) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Process from right to left, so that we can set the hasAttacked attribute properly\r\n\t\t\t// If two minions die at the same time, both of which having attacked, but the third in line having not,\r\n\t\t\t// processing them from left to right means the first (leftmost) one will check its right neighbor, which\r\n\t\t\t// is the minion that hasn't attacked\r\n\t\t\tfor (let j = deadEntities.length - 1; j >= 0; j--) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\thandlePostDeathrattleEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t\t\tdeadEntityPlayerState.player.friendly,\r\n\t\t\t\t\tdeathrattleInput,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleDeathrattles = (deathrattleInput: DeathrattleInput) => {\r\n\torchestrateMinionDeathEffects(deathrattleInput, false, false);\r\n};\r\n\r\nconst handlePostDeathrattleEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tspawnedEntities: BoardEntity[],\r\n\tisPlayer: boolean,\r\n\tdeathrattleInput: DeathrattleInput,\r\n) => {\r\n\t// This doesn't work if the entity that was to the right died.\r\n\tconst entityRightToSpawns =\r\n\t\tindexFromRight === 0 ? null : deadEntityPlayerState.board[deadEntityPlayerState.board.length - indexFromRight];\r\n\t// To handle minions attack tokens\r\n\t// See http://replays.firestoneapp.com/?reviewId=0583d6a4-6ed0-4b20-894e-4ceb560894fe&turn=6&action=11\r\n\t// When a minion dies, the spawn are either elligible to attack next turn or not\r\n\t// If the minion right to the spawned minion has already attacked, then the spawned\r\n\t// minion cannot attack\r\n\tspawnedEntities.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tif (deadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113)) {\r\n\t\tconst ogDeadEntity = gameState.sharedState.deaths.find((entity) => entity.entityId === deadEntity.entityId);\r\n\t\tif (ogDeadEntity) {\r\n\t\t\togDeadEntity.attack += 4;\r\n\t\t\togDeadEntity.health += 4;\r\n\t\t}\r\n\t}\r\n\r\n\t// ISSUE: when we do this, we change the minion's stats before processing deathrattle effects, which can mess\r\n\t// up the simulation in some cases (like Nightbane, Ignited)\r\n\t// FIX: we do it in postDeathrattleEfects, not when removing minions from the board\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tdeadEntity.attack = Math.max(\r\n\t\t\t0,\r\n\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus,\r\n\t\t);\r\n\t}\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tdeadEntity.health = Math.max(\r\n\t\t\t1,\r\n\t\t\tdeadEntity.health - deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus,\r\n\t\t);\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.UNDEAD, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.UndeadAttackBonus,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (isWhelp(deadEntity.cardId, gameState.allCards)) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.WhelpAttackBuff > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.WhelpAttackBuff,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\ninterface DeathrattleInput {\r\n\tgameState: FullGameState;\r\n\tplayerDeadEntities: BoardEntity[];\r\n\tplayerDeadEntityIndexesFromRight: number[];\r\n\topponentDeadEntities: BoardEntity[];\r\n\topponentDeadEntityIndexesFromRight: number[];\r\n}\r\n"]}
|