@firestone-hs/simulate-bgs-battle 1.1.740 → 1.1.742
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 +4 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/bg-spell/mighty-dragonbreath.js +1 -1
- package/dist/cards/impl/bg-spell/mighty-dragonbreath.js.map +1 -1
- package/dist/cards/impl/bg-spell/misplaced-tea-set.js +1 -1
- package/dist/cards/impl/bg-spell/misplaced-tea-set.js.map +1 -1
- package/dist/cards/impl/enchantments/admiration.js +1 -1
- package/dist/cards/impl/enchantments/admiration.js.map +1 -1
- package/dist/cards/impl/minion/boom-in-a-box.js.map +1 -1
- package/dist/cards/impl/minion/drustfallen-butcher.js +1 -1
- package/dist/cards/impl/minion/drustfallen-butcher.js.map +1 -1
- package/dist/cards/impl/minion/dustbone-devastator.js +1 -1
- package/dist/cards/impl/minion/dustbone-devastator.js.map +1 -1
- package/dist/cards/impl/minion/eredar-escapist.d.ts +2 -0
- package/dist/cards/impl/minion/eredar-escapist.js +38 -0
- package/dist/cards/impl/minion/eredar-escapist.js.map +1 -0
- package/dist/cards/impl/minion/gentle-djinni.js.map +1 -1
- package/dist/cards/impl/minion/glambot.js +1 -1
- package/dist/cards/impl/minion/glambot.js.map +1 -1
- package/dist/cards/impl/minion/imp-lusionist.js +1 -1
- package/dist/cards/impl/minion/imp-lusionist.js.map +1 -1
- package/dist/cards/impl/minion/mama-mrrglton.js +1 -1
- package/dist/cards/impl/minion/mama-mrrglton.js.map +1 -1
- package/dist/cards/impl/minion/maritime-extortionist.js +7 -4
- package/dist/cards/impl/minion/maritime-extortionist.js.map +1 -1
- package/dist/cards/impl/minion/moat-custodian.js +1 -1
- package/dist/cards/impl/minion/moat-custodian.js.map +1 -1
- package/dist/cards/impl/minion/motley-phalanx.js +1 -1
- package/dist/cards/impl/minion/motley-phalanx.js.map +1 -1
- package/dist/cards/impl/minion/papa-mrrglton.js +1 -1
- package/dist/cards/impl/minion/papa-mrrglton.js.map +1 -1
- package/dist/cards/impl/minion/ravaging-scorpid.js +1 -1
- package/dist/cards/impl/minion/ravaging-scorpid.js.map +1 -1
- package/dist/cards/impl/minion/runic-arcanist.js +1 -1
- package/dist/cards/impl/minion/runic-arcanist.js.map +1 -1
- package/dist/cards/impl/minion/sand-swirler.js +2 -2
- package/dist/cards/impl/minion/sand-swirler.js.map +1 -1
- package/dist/cards/impl/minion/showy-cyclist.js +11 -7
- package/dist/cards/impl/minion/showy-cyclist.js.map +1 -1
- package/dist/cards/impl/minion/tasty-lobster.js +1 -1
- package/dist/cards/impl/minion/tasty-lobster.js.map +1 -1
- package/dist/cards/impl/minion/the-last-one-standing.js +1 -1
- package/dist/cards/impl/minion/the-last-one-standing.js.map +1 -1
- package/dist/cards/impl/minion/tichondrius.js +1 -1
- package/dist/cards/impl/minion/tichondrius.js.map +1 -1
- package/dist/cards/impl/minion/torrential-ruiner.js +3 -2
- package/dist/cards/impl/minion/torrential-ruiner.js.map +1 -1
- package/dist/cards/impl/minion/treasure-parrot.d.ts +2 -0
- package/dist/cards/impl/minion/treasure-parrot.js +24 -0
- package/dist/cards/impl/minion/treasure-parrot.js.map +1 -0
- package/dist/cards/impl/minion/twilight-tidehunter.js +1 -1
- package/dist/cards/impl/minion/twilight-tidehunter.js.map +1 -1
- package/dist/cards/impl/minion/wolf-pup.js +1 -1
- package/dist/cards/impl/minion/wolf-pup.js.map +1 -1
- package/dist/cards/impl/spellcraft/thaumaturgy.js +1 -1
- package/dist/cards/impl/spellcraft/thaumaturgy.js.map +1 -1
- package/dist/cards/impl/trinket/dragon-skull.js +1 -1
- package/dist/cards/impl/trinket/dragon-skull.js.map +1 -1
- package/dist/cards/impl/trinket/mama-bear-sticker.js +1 -1
- package/dist/cards/impl/trinket/mama-bear-sticker.js.map +1 -1
- package/dist/input-sanitation.js +3 -5
- package/dist/input-sanitation.js.map +1 -1
- package/dist/simulation/attack.js +3 -0
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/auras.d.ts +1 -1
- package/dist/simulation/auras.js +66 -53
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/deathrattle-utils.js +6 -3
- package/dist/simulation/deathrattle-utils.js.map +1 -1
- package/dist/simulation/stats.js +3 -2
- package/dist/simulation/stats.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +5 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twilight-tidehunter.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/twilight-tidehunter.ts"],"names":[],"mappings":";;;AAQA,qDAAwD;AAIxD,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEN,QAAA,kBAAkB,GAA0B;IACxD,OAAO,EAAE,0BAA4E;IACrF,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACjE,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE;YAC3D,OAAO;SACP;QAED,MAAM,MAAM,GAAG,CAAC,MAAA,KAAK,CAAC,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,MAAM,EAAE;YACZ,OAAO;SACP;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACzG,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Twilight Tidehunter (Tier 4,
|
|
1
|
+
{"version":3,"file":"twilight-tidehunter.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/twilight-tidehunter.ts"],"names":[],"mappings":";;;AAQA,qDAAwD;AAIxD,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEN,QAAA,kBAAkB,GAA0B;IACxD,OAAO,EAAE,0BAA4E;IACrF,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACjE,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE;YAC3D,OAAO;SACP;QAED,MAAM,MAAM,GAAG,CAAC,MAAA,KAAK,CAAC,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,MAAM,EAAE;YACZ,OAAO;SACP;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACzG,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Twilight Tidehunter (Tier 4, 4/6)\r\n * Whenever you cast a spell on this, give the left-most minion in your hand +8/+8.\r\n *\r\n * Golden Twilight Tidehunter (Tier 4, 8/12)\r\n * Whenever you cast a spell on this, give the left-most minion in your hand +16/+16.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { CastSpellInput, OnTavernSpellCastCard } from '../../card.interface';\r\nimport { CardIds } from '../../../services/card-ids';\r\n\r\nconst handBuff = 8;\r\n\r\nexport const TwilightTidehunter: OnTavernSpellCastCard = {\r\n\tcardIds: [CardIds.TwilightTidehunter_BG36_703, CardIds.TwilightTidehunter_BG36_703_G],\r\n\tonTavernSpellCast: (entity: BoardEntity, input: CastSpellInput) => {\r\n\t\tif (input.source !== input.hero || input.target !== entity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst target = (input.hero.hand ?? []).filter((e) => !!e.maxHealth && !!e.cardId)[0];\r\n\t\tif (!target) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst mult = entity.cardId === CardIds.TwilightTidehunter_BG36_703_G ? 2 : 1;\r\n\t\tmodifyStats(target, entity, handBuff * mult, handBuff * mult, input.board, input.hero, input.gameState);\r\n\t},\r\n};\r\n"]}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WolfPup = void 0;
|
|
4
4
|
const stats_1 = require("../../../simulation/stats");
|
|
5
5
|
const wolfPupAttackBuff = 4;
|
|
6
|
-
const wolfPupHealthBuff =
|
|
6
|
+
const wolfPupHealthBuff = 1;
|
|
7
7
|
exports.WolfPup = {
|
|
8
8
|
cardIds: ["BG36_207", "BG36_207_G"],
|
|
9
9
|
rally: (minion, input) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wolf-pup.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wolf-pup.ts"],"names":[],"mappings":";;;AASA,qDAAwD;AAIxD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEf,QAAA,OAAO,GAAc;IACjC,OAAO,EAAE,0BAAsD;IAC/D,KAA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QAAQ,CAAC,CAAC;QAC3F,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,IAAA,mBAAW,EACV,MAAM,EACN,KAAK,CAAC,QAAQ,EACd,iBAAiB,GAAG,IAAI,EACxB,iBAAiB,GAAG,IAAI,EACxB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;SACF;QACD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Wolf Pup (Tier 3, 3/6)\r\n * Rally: Give your other minions +4/+1.\r\n *\r\n * Golden Wolf Pup (Tier 3, 6/12)\r\n * Rally: Give your other minions +8/+2.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { RallyCard } from '../../card.interface';\r\nimport { CardIds } from '../../../services/card-ids';\r\n\r\nconst wolfPupAttackBuff = 4;\r\nconst wolfPupHealthBuff = 1;\r\n\r\nexport const WolfPup: RallyCard = {\r\n\tcardIds: [CardIds.WolfPup_BG36_207, CardIds.WolfPup_BG36_207_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.WolfPup_BG36_207_G ? 2 : 1;\r\n\t\tconst targets = input.attackingBoard.filter((e) => e.entityId !== input.attacker.entityId);\r\n\t\tfor (const target of targets) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tinput.attacker,\r\n\t\t\t\twolfPupAttackBuff * mult,\r\n\t\t\t\twolfPupHealthBuff * mult,\r\n\t\t\t\tinput.attackingBoard,\r\n\t\t\t\tinput.attackingHero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
|
|
@@ -10,7 +10,7 @@ exports.Thaumaturgy = {
|
|
|
10
10
|
const mult = spellCardId === "BG31_924t" ? 1 : 2;
|
|
11
11
|
const target = (_a = input.target) !== null && _a !== void 0 ? _a : (0, utils_1.pickRandom)(input.board);
|
|
12
12
|
if (!!target) {
|
|
13
|
-
const buff = (1 + Math.floor(input.hero.globalInfo.SpellsCastThisGame /
|
|
13
|
+
const buff = (1 + Math.floor(input.hero.globalInfo.SpellsCastThisGame / 3)) * mult;
|
|
14
14
|
(0, stats_1.modifyStats)(target, input.source, buff, buff, input.board, input.hero, input.gameState);
|
|
15
15
|
input.gameState.spectator.registerPowerTarget(input.source, target, input.board, input.hero, input.otherHero);
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thaumaturgy.js","sourceRoot":"","sources":["../../../../src/cards/impl/spellcraft/thaumaturgy.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AACrD,qDAAwD;AAG3C,QAAA,WAAW,GAAoB;IAC3C,OAAO,EAAE,4BAAsG;IAC/G,eAAe,EAAE,CAAC,WAAmB,EAAE,KAAqB,EAAE,EAAE;;QAC/D,MAAM,IAAI,GAAG,WAAW,gBAAqD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,IAAA,kBAAU,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YACnF,IAAA,mBAAW,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YACxF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,KAAK,CAAC,MAAM,EACZ,MAAM,EACN,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,CACf,CAAC;SACF;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { CastSpellInput, TavernSpellCard } from '../../card.interface';\r\n\r\nexport const Thaumaturgy: TavernSpellCard = {\r\n\tcardIds: [CardIds.Thaumaturgist_ThaumaturgyToken_BG31_924t, CardIds.Thaumaturgist_ThaumaturgyToken_BG31_924_Gt],\r\n\tcastTavernSpell: (spellCardId: string, input: CastSpellInput) => {\r\n\t\tconst mult = spellCardId === CardIds.Thaumaturgist_ThaumaturgyToken_BG31_924t ? 1 : 2;\r\n\t\tconst target = input.target ?? pickRandom(input.board);\r\n\t\tif (!!target) {\r\n\t\t\tconst buff = (1 + Math.floor(input.hero.globalInfo.SpellsCastThisGame /
|
|
1
|
+
{"version":3,"file":"thaumaturgy.js","sourceRoot":"","sources":["../../../../src/cards/impl/spellcraft/thaumaturgy.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AACrD,qDAAwD;AAG3C,QAAA,WAAW,GAAoB;IAC3C,OAAO,EAAE,4BAAsG;IAC/G,eAAe,EAAE,CAAC,WAAmB,EAAE,KAAqB,EAAE,EAAE;;QAC/D,MAAM,IAAI,GAAG,WAAW,gBAAqD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,IAAA,kBAAU,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YACnF,IAAA,mBAAW,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YACxF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,KAAK,CAAC,MAAM,EACZ,MAAM,EACN,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,CACf,CAAC;SACF;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { CastSpellInput, TavernSpellCard } from '../../card.interface';\r\n\r\nexport const Thaumaturgy: TavernSpellCard = {\r\n\tcardIds: [CardIds.Thaumaturgist_ThaumaturgyToken_BG31_924t, CardIds.Thaumaturgist_ThaumaturgyToken_BG31_924_Gt],\r\n\tcastTavernSpell: (spellCardId: string, input: CastSpellInput) => {\r\n\t\tconst mult = spellCardId === CardIds.Thaumaturgist_ThaumaturgyToken_BG31_924t ? 1 : 2;\r\n\t\tconst target = input.target ?? pickRandom(input.board);\r\n\t\tif (!!target) {\r\n\t\t\tconst buff = (1 + Math.floor(input.hero.globalInfo.SpellsCastThisGame / 3)) * mult;\r\n\t\t\tmodifyStats(target, input.source, buff, buff, input.board, input.hero, input.gameState);\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\tinput.source,\r\n\t\t\t\ttarget,\r\n\t\t\t\tinput.board,\r\n\t\t\t\tinput.hero,\r\n\t\t\t\tinput.otherHero,\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DragonSkull = void 0;
|
|
4
4
|
const stats_1 = require("../../../simulation/stats");
|
|
5
|
-
const buff =
|
|
5
|
+
const buff = 5;
|
|
6
6
|
exports.DragonSkull = {
|
|
7
7
|
cardIds: ["BG36_MagicItem_203"],
|
|
8
8
|
onBattlecryTriggered: (trinket, input) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dragon-skull.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/dragon-skull.ts"],"names":[],"mappings":";;;AAMA,qDAAwD;AAIxD,MAAM,IAAI,GAAG,CAAC,CAAC;AAEF,QAAA,WAAW,GAA6B;IACpD,OAAO,EAAE,sBAAwC;IACjD,oBAAoB,EAAE,CAAC,OAAqB,EAAE,KAAgC,EAAE,EAAE;QACjF,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzF,KAAK,MAAM,MAAM,IAAI,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE;YACtC,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SACnF;IACF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Dragon Skull (
|
|
1
|
+
{"version":3,"file":"dragon-skull.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/dragon-skull.ts"],"names":[],"mappings":";;;AAMA,qDAAwD;AAIxD,MAAM,IAAI,GAAG,CAAC,CAAC;AAEF,QAAA,WAAW,GAA6B;IACpD,OAAO,EAAE,sBAAwC;IACjD,oBAAoB,EAAE,CAAC,OAAqB,EAAE,KAAgC,EAAE,EAAE;QACjF,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzF,KAAK,MAAM,MAAM,IAAI,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE;YACtC,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SACnF;IACF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Dragon Skull (3 gold)\r\n * Whenever you trigger a Battlecry, give your left- and right-most minions +5/+5.\r\n */\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { OnBattlecryTriggeredInput } from '../../../simulation/battlecries';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { OnBattlecryTriggeredCard } from '../../card.interface';\r\nimport { CardIds } from '../../../services/card-ids';\r\n\r\nconst buff = 5;\r\n\r\nexport const DragonSkull: OnBattlecryTriggeredCard = {\r\n\tcardIds: [CardIds.DragonSkull_BG36_MagicItem_203],\r\n\tonBattlecryTriggered: (trinket: BoardTrinket, input: OnBattlecryTriggeredInput) => {\r\n\t\tconst targets = [input.board[0], input.board[input.board.length - 1]].filter((e) => !!e);\r\n\t\t// Left- and right-most are the same minion when there is only one on the board\r\n\t\tfor (const target of new Set(targets)) {\r\n\t\t\tmodifyStats(target, trinket, buff, buff, input.board, input.hero, input.gameState);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
|
|
@@ -11,7 +11,7 @@ exports.MamaBearSticker = {
|
|
|
11
11
|
if (!(0, utils_1.hasCorrectTribe)(spawned, hero, reference_data_1.Race.BEAST, gameState.anomalies, gameState.allCards)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
(0, stats_1.modifyStats)(spawned, _trinket,
|
|
14
|
+
(0, stats_1.modifyStats)(spawned, _trinket, 6, 6, board, hero, gameState);
|
|
15
15
|
gameState.spectator.registerPowerTarget(_trinket, spawned, board, null, null);
|
|
16
16
|
},
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mama-bear-sticker.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/mama-bear-sticker.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"mama-bear-sticker.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/mama-bear-sticker.ts"],"names":[],"mappings":";;;AAIA,iEAAoD;AAIpD,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,eAAe,GAAuB;IAClD,OAAO,EAAE,sBAA4C;IACrD,cAAc,EAAE,CAAC,QAAsB,EAAE,KAAwB,EAAE,EAAE;QACpE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QAClD,IAAI,CAAC,IAAA,uBAAe,EAAC,OAAO,EAAE,IAAI,EAAE,qBAAI,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;YACzF,OAAO;SACP;QACD,IAAA,mBAAW,EAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7D,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/E,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Mama Bear Sticker\r\n * Whenever you summon a Beast, give it +6/+6.\r\n */\r\nimport { Race } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-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 { OnOtherSpawnedCard } from '../../card.interface';\r\n\r\nexport const MamaBearSticker: OnOtherSpawnedCard = {\r\n\tcardIds: [CardIds.MamaBearSticker_BG35_MagicItem_871],\r\n\tonOtherSpawned: (_trinket: BoardTrinket, input: OnOtherSpawnInput) => {\r\n\t\tconst { spawned, board, hero, gameState } = input;\r\n\t\tif (!hasCorrectTribe(spawned, hero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tmodifyStats(spawned, _trinket, 6, 6, board, hero, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(_trinket, spawned, board, null, null);\r\n\t},\r\n};\r\n"]}
|
package/dist/input-sanitation.js
CHANGED
|
@@ -56,7 +56,7 @@ const buildFinalInput = (battleInput, cards, cardsData) => {
|
|
|
56
56
|
};
|
|
57
57
|
exports.buildFinalInput = buildFinalInput;
|
|
58
58
|
const buildFinalInputForPlayer = (playerInfo, isPlayer, anomalies, cards, cardsData, entityIdContainer) => {
|
|
59
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
59
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
60
60
|
if (!playerInfo) {
|
|
61
61
|
return { board: [], hand: [], player: null };
|
|
62
62
|
}
|
|
@@ -67,9 +67,7 @@ const buildFinalInputForPlayer = (playerInfo, isPlayer, anomalies, cards, cardsD
|
|
|
67
67
|
playerInfo.player.trinkets = (fixedTrinkets !== null && fixedTrinkets !== void 0 ? fixedTrinkets : []).sort((a, b) => a.entityId - b.entityId);
|
|
68
68
|
playerInfo.player.friendly = isPlayer;
|
|
69
69
|
playerInfo.player.globalInfo = (_f = playerInfo.player.globalInfo) !== null && _f !== void 0 ? _f : {};
|
|
70
|
-
playerInfo.player.
|
|
71
|
-
playerInfo.player.globalInfo.MechAttackBonus = (_h = playerInfo.player.globalInfo.MechAttackBonus) !== null && _h !== void 0 ? _h : 0;
|
|
72
|
-
playerInfo.player.heroPowers = ((_j = playerInfo.player.heroPowers) === null || _j === void 0 ? void 0 : _j.length)
|
|
70
|
+
playerInfo.player.heroPowers = ((_g = playerInfo.player.heroPowers) === null || _g === void 0 ? void 0 : _g.length)
|
|
73
71
|
? playerInfo.player.heroPowers.map((hp, index) => sanitizeHeroPower(hp, index, playerInfo.player, cards))
|
|
74
72
|
: [
|
|
75
73
|
{
|
|
@@ -83,7 +81,7 @@ const buildFinalInputForPlayer = (playerInfo, isPlayer, anomalies, cards, cardsD
|
|
|
83
81
|
playerInfo.player.cardId = isGhost ? "TB_BaconShop_HERO_KelThuzad" : playerInfo.player.cardId;
|
|
84
82
|
playerInfo.player.hpLeft = Math.max(1, playerInfo.player.hpLeft);
|
|
85
83
|
(0, auras_1.setMissingAuras)(board, playerInfo.player, anomalies, cards);
|
|
86
|
-
(0, auras_1.setImplicitDataHero)(playerInfo.player, cardsData, isPlayer, entityIdContainer);
|
|
84
|
+
(0, auras_1.setImplicitDataHero)(playerInfo.player, board, cardsData, isPlayer, entityIdContainer);
|
|
87
85
|
return { board, hand, player: playerInfo.player };
|
|
88
86
|
};
|
|
89
87
|
const sanitizeHeroPower = (hp, index, player, cards) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-sanitation.js","sourceRoot":"","sources":["../src/input-sanitation.ts"],"names":[],"mappings":";;;AAOA,8CAA0E;AAC1E,4DAA4D;AAC5D,mCAA8C;AAEvC,MAAM,eAAe,GAAG,CAC9B,WAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACJ,EAAE;;IAClB,MAAM,iBAAiB,GAAG,EAAE,QAAQ,EAAE,SAAW,EAAE,CAAC;IAEpD,MAAM,EACL,KAAK,EAAE,W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KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,IAAI,sBAAsB,EAAE;QAC3B,KAAK,CAAC,cAAc,GAAG,SAAS,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC;KAC5F;IACD,IAAA,2BAAmB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACtC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE1B,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC;IACnC,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAC5B,UAAwB,EACxB,QAAiB,EACjB,SAAoB,EACpB,KAAsB,EAC0B,EAAE;;IAClD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACzG,MAAM,IAAI,GACT,MAAA,MAAA,UAAU,CAAC,MAAM,CAAC,IAAI,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,mCAAI,EAAE,CAAC;IAC1G,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BgsHeroPower, BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { CardIds } from './services/card-ids';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { fixEnchantments } from './simulation/enchantments';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nexport const buildFinalInput = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): BgsBattleInfo => {\r\n\tconst entityIdContainer = { entityId: 999_999_999 };\r\n\r\n\tconst {\r\n\t\tboard: playerBoard,\r\n\t\thand: playerHand,\r\n\t\tplayer: playerEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: playerTeammateBoard,\r\n\t\thand: playerTeammateHand,\r\n\t\tplayer: playerTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerTeammateBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\tconst {\r\n\t\tboard: opponentBoard,\r\n\t\thand: opponentHand,\r\n\t\tplayer: opponentEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: opponentTeammateBoard,\r\n\t\thand: opponentTeammateHand,\r\n\t\tplayer: opponentTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentTeammateBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerEntity,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tplayerTeammateBoard: !!playerTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: playerTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...playerTeammateEntity,\r\n\t\t\t\t\t\thand: playerTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentEntity,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentTeammateBoard: !!opponentTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: opponentTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...opponentTeammateEntity,\r\n\t\t\t\t\t\thand: opponentTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\tgameState: {\r\n\t\t\t...battleInput.gameState,\r\n\t\t\tanomalies: battleInput.gameState.anomalies?.filter((a) => !!a) ?? ([] as readonly string[]),\r\n\t\t},\r\n\t\t// Combat-affecting options (e.g. applyDamageCap) must survive into runSingleBattle;\r\n\t\t// Monte Carlo knobs are still read from the original battleInput before cloning.\r\n\t\toptions: battleInput.options,\r\n\t\theroHasDied: battleInput.heroHasDied,\r\n\t\tdebugState: battleInput.debugState,\r\n\t} as BgsBattleInfo;\r\n\treturn inputReady;\r\n};\r\n\r\nconst buildFinalInputForPlayer = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tanomalies: readonly string[],\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tentityIdContainer: { entityId: number },\r\n): { board: BoardEntity[]; hand: BoardEntity[]; player: BgsPlayerEntity } => {\r\n\tif (!playerInfo) {\r\n\t\treturn { board: [], hand: [], player: null };\r\n\t}\r\n\r\n\tconst { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);\r\n\tconst isGhost = playerInfo.player?.hpLeft != null && playerInfo.player.hpLeft <= 0;\r\n\tplayerInfo.player.secrets = (playerInfo.player.secrets ?? playerInfo.secrets)?.filter((e) => !!e?.cardId) ?? [];\r\n\t// Add the scriptDataNum1 only on the start of combat phase, so that it doesn't trigger too soon\r\n\t// Don't do this, as secrets like Fleeting Vigor use this info to tell how much buff it will apply\r\n\t// playerInfo.player.secrets.forEach((secret) => (secret.scriptDataNum1 = 0));\r\n\t// Trinkets don't seem to trigger when facing the ghost\r\n\t// http://replays.firestoneapp.com/?reviewId=4ad32e03-2620-4fb1-8b43-cad55afd30fc&turn=27&action=2\r\n\t// One of the trinkets is Blood Golem Sticker, and no Blood Golem is summoned\r\n\t// Looks like that's not always the case:\r\n\t// http://replays.firestoneapp.com/?reviewId=9958e8d3-4388-4e6f-9b36-35f3a08be2f6&turn=25&action=4\r\n\t// playerInfo.player.trinkets = isGhost ? [] : playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? [];\r\n\tconst fixedTrinkets = playerInfo.player.trinkets?.filter((e) => !!e?.cardId);\r\n\tplayerInfo.player.trinkets = (fixedTrinkets ?? []).sort((a, b) => a.entityId - b.entityId);\r\n\tplayerInfo.player.friendly = isPlayer;\r\n\tplayerInfo.player.globalInfo = playerInfo.player.globalInfo ?? {};\r\n\tplayerInfo.player.globalInfo.PirateAttackBonus = playerInfo.player.globalInfo.PirateAttackBonus ?? 0;\r\n\tplayerInfo.player.globalInfo.MechAttackBonus = playerInfo.player.globalInfo.MechAttackBonus ?? 0;\r\n\tplayerInfo.player.heroPowers = playerInfo.player.heroPowers?.length\r\n\t\t? playerInfo.player.heroPowers.map((hp, index) => sanitizeHeroPower(hp, index, playerInfo.player, cards))\r\n\t\t: [\r\n\t\t\t\t{\r\n\t\t\t\t\tcardId: playerInfo.player.heroPowerId,\r\n\t\t\t\t\tentityId: playerInfo.player.heroPowerEntityId,\r\n\t\t\t\t\tused: playerInfo.player.heroPowerUsed,\r\n\t\t\t\t\tinfo: playerInfo.player.heroPowerInfo,\r\n\t\t\t\t\tinfo2: playerInfo.player.heroPowerInfo2,\r\n\t\t\t\t} as BgsHeroPower,\r\n\t\t ];\r\n\t// playerInfo.player.heroPowerId =\r\n\t// \tplayerInfo.player.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(playerInfo.player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? playerInfo.player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \tplayerInfo.player.heroPowerId;\r\n\tplayerInfo.player.cardId = isGhost ? CardIds.Kelthuzad_TB_BaconShop_HERO_KelThuzad : playerInfo.player.cardId;\r\n\tplayerInfo.player.hpLeft = Math.max(1, playerInfo.player.hpLeft);\r\n\t// When using the simulator, the aura is not applied when receiving the board state.\r\n\tsetMissingAuras(board, playerInfo.player, anomalies, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, isPlayer, entityIdContainer);\r\n\treturn { board, hand, player: playerInfo.player };\r\n};\r\n\r\nconst sanitizeHeroPower = (\r\n\thp: BgsHeroPower,\r\n\tindex: number,\r\n\tplayer: BgsPlayerEntity,\r\n\tcards: AllCardsService,\r\n): BgsHeroPower => {\r\n\treturn hp;\r\n\t// FIXME: fix this when the situation presents itself. At the moment, we already have trinkets / hero powers / quest rewards\r\n\t// handled separately, so maybe there is no need to map a quest reward to one of Sire D.'s hero power\r\n\t// if (index !== 0) {\r\n\t// \treturn hp;\r\n\t// }\r\n\r\n\t// hp.cardId =\r\n\t// \tplayer.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \thp.cardId;\r\n\t// return hp;\r\n};\r\n\r\nconst sanitizeEntity = (\r\n\tentity: BoardEntity,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n\tapplyDefaultScriptData: boolean,\r\n): BoardEntity => {\r\n\tconst fixed = fixEnchantments(entity, cards);\r\n\tfixed.inInitialState = true;\r\n\tif (applyDefaultScriptData) {\r\n\t\tfixed.scriptDataNum1 = cardsData.defaultScriptDataNum(fixed.cardId) || fixed.scriptDataNum1;\r\n\t}\r\n\taddImpliedMechanics(fixed, cardsData);\r\n\tfixed.friendly = isPlayer;\r\n\t// Used for Persisting Horror\r\n\tfixed.hadVenomous = fixed.venomous;\r\n\treturn fixed;\r\n};\r\n\r\nconst buildFinalInputBoard = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n): { board: BoardEntity[]; hand: BoardEntity[] } => {\r\n\tconst board = playerInfo.board.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, true));\r\n\tconst hand =\r\n\t\tplayerInfo.player.hand?.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, false)) ?? [];\r\n\treturn { board, hand };\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"input-sanitation.js","sourceRoot":"","sources":["../src/input-sanitation.ts"],"names":[],"mappings":";;;AAOA,8CAA0E;AAC1E,4DAA4D;AAC5D,mCAA8C;AAEvC,MAAM,eAAe,GAAG,CAC9B,WAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACJ,EAAE;;IAClB,MAAM,iBAAiB,GAAG,EAAE,QAAQ,EAAE,SAAW,EAAE,CAAC;IAEpD,MAAM,EACL,KAAK,EAAE,WAAW,EAClB,IAAI,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C,QAAQ,GAAG,QAAQ,CAAC;IAE1B,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC;IACnC,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAC5B,UAAwB,EACxB,QAAiB,EACjB,SAAoB,EACpB,KAAsB,EAC0B,EAAE;;IAClD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACzG,MAAM,IAAI,GACT,MAAA,MAAA,UAAU,CAAC,MAAM,CAAC,IAAI,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,mCAAI,EAAE,CAAC;IAC1G,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BgsHeroPower, BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { CardIds } from './services/card-ids';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { fixEnchantments } from './simulation/enchantments';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nexport const buildFinalInput = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): BgsBattleInfo => {\r\n\tconst entityIdContainer = { entityId: 999_999_999 };\r\n\r\n\tconst {\r\n\t\tboard: playerBoard,\r\n\t\thand: playerHand,\r\n\t\tplayer: playerEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: playerTeammateBoard,\r\n\t\thand: playerTeammateHand,\r\n\t\tplayer: playerTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerTeammateBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\tconst {\r\n\t\tboard: opponentBoard,\r\n\t\thand: opponentHand,\r\n\t\tplayer: opponentEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: opponentTeammateBoard,\r\n\t\thand: opponentTeammateHand,\r\n\t\tplayer: opponentTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentTeammateBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerEntity,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tplayerTeammateBoard: !!playerTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: playerTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...playerTeammateEntity,\r\n\t\t\t\t\t\thand: playerTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentEntity,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentTeammateBoard: !!opponentTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: opponentTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...opponentTeammateEntity,\r\n\t\t\t\t\t\thand: opponentTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\tgameState: {\r\n\t\t\t...battleInput.gameState,\r\n\t\t\tanomalies: battleInput.gameState.anomalies?.filter((a) => !!a) ?? ([] as readonly string[]),\r\n\t\t},\r\n\t\t// Combat-affecting options (e.g. applyDamageCap) must survive into runSingleBattle;\r\n\t\t// Monte Carlo knobs are still read from the original battleInput before cloning.\r\n\t\toptions: battleInput.options,\r\n\t\theroHasDied: battleInput.heroHasDied,\r\n\t\tdebugState: battleInput.debugState,\r\n\t} as BgsBattleInfo;\r\n\treturn inputReady;\r\n};\r\n\r\nconst buildFinalInputForPlayer = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tanomalies: readonly string[],\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tentityIdContainer: { entityId: number },\r\n): { board: BoardEntity[]; hand: BoardEntity[]; player: BgsPlayerEntity } => {\r\n\tif (!playerInfo) {\r\n\t\treturn { board: [], hand: [], player: null };\r\n\t}\r\n\r\n\tconst { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);\r\n\tconst isGhost = playerInfo.player?.hpLeft != null && playerInfo.player.hpLeft <= 0;\r\n\tplayerInfo.player.secrets = (playerInfo.player.secrets ?? playerInfo.secrets)?.filter((e) => !!e?.cardId) ?? [];\r\n\t// Add the scriptDataNum1 only on the start of combat phase, so that it doesn't trigger too soon\r\n\t// Don't do this, as secrets like Fleeting Vigor use this info to tell how much buff it will apply\r\n\t// playerInfo.player.secrets.forEach((secret) => (secret.scriptDataNum1 = 0));\r\n\t// Trinkets don't seem to trigger when facing the ghost\r\n\t// http://replays.firestoneapp.com/?reviewId=4ad32e03-2620-4fb1-8b43-cad55afd30fc&turn=27&action=2\r\n\t// One of the trinkets is Blood Golem Sticker, and no Blood Golem is summoned\r\n\t// Looks like that's not always the case:\r\n\t// http://replays.firestoneapp.com/?reviewId=9958e8d3-4388-4e6f-9b36-35f3a08be2f6&turn=25&action=4\r\n\t// playerInfo.player.trinkets = isGhost ? [] : playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? [];\r\n\tconst fixedTrinkets = playerInfo.player.trinkets?.filter((e) => !!e?.cardId);\r\n\tplayerInfo.player.trinkets = (fixedTrinkets ?? []).sort((a, b) => a.entityId - b.entityId);\r\n\tplayerInfo.player.friendly = isPlayer;\r\n\tplayerInfo.player.globalInfo = playerInfo.player.globalInfo ?? {};\r\n\tplayerInfo.player.heroPowers = playerInfo.player.heroPowers?.length\r\n\t\t? playerInfo.player.heroPowers.map((hp, index) => sanitizeHeroPower(hp, index, playerInfo.player, cards))\r\n\t\t: [\r\n\t\t\t\t{\r\n\t\t\t\t\tcardId: playerInfo.player.heroPowerId,\r\n\t\t\t\t\tentityId: playerInfo.player.heroPowerEntityId,\r\n\t\t\t\t\tused: playerInfo.player.heroPowerUsed,\r\n\t\t\t\t\tinfo: playerInfo.player.heroPowerInfo,\r\n\t\t\t\t\tinfo2: playerInfo.player.heroPowerInfo2,\r\n\t\t\t\t} as BgsHeroPower,\r\n\t\t ];\r\n\t// playerInfo.player.heroPowerId =\r\n\t// \tplayerInfo.player.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(playerInfo.player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? playerInfo.player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \tplayerInfo.player.heroPowerId;\r\n\tplayerInfo.player.cardId = isGhost ? CardIds.Kelthuzad_TB_BaconShop_HERO_KelThuzad : playerInfo.player.cardId;\r\n\tplayerInfo.player.hpLeft = Math.max(1, playerInfo.player.hpLeft);\r\n\t// When using the simulator, the aura is not applied when receiving the board state.\r\n\tsetMissingAuras(board, playerInfo.player, anomalies, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, board, cardsData, isPlayer, entityIdContainer);\r\n\treturn { board, hand, player: playerInfo.player };\r\n};\r\n\r\nconst sanitizeHeroPower = (\r\n\thp: BgsHeroPower,\r\n\tindex: number,\r\n\tplayer: BgsPlayerEntity,\r\n\tcards: AllCardsService,\r\n): BgsHeroPower => {\r\n\treturn hp;\r\n\t// FIXME: fix this when the situation presents itself. At the moment, we already have trinkets / hero powers / quest rewards\r\n\t// handled separately, so maybe there is no need to map a quest reward to one of Sire D.'s hero power\r\n\t// if (index !== 0) {\r\n\t// \treturn hp;\r\n\t// }\r\n\r\n\t// hp.cardId =\r\n\t// \tplayer.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \thp.cardId;\r\n\t// return hp;\r\n};\r\n\r\nconst sanitizeEntity = (\r\n\tentity: BoardEntity,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n\tapplyDefaultScriptData: boolean,\r\n): BoardEntity => {\r\n\tconst fixed = fixEnchantments(entity, cards);\r\n\tfixed.inInitialState = true;\r\n\tif (applyDefaultScriptData) {\r\n\t\tfixed.scriptDataNum1 = cardsData.defaultScriptDataNum(fixed.cardId) || fixed.scriptDataNum1;\r\n\t}\r\n\taddImpliedMechanics(fixed, cardsData);\r\n\tfixed.friendly = isPlayer;\r\n\t// Used for Persisting Horror\r\n\tfixed.hadVenomous = fixed.venomous;\r\n\treturn fixed;\r\n};\r\n\r\nconst buildFinalInputBoard = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n): { board: BoardEntity[]; hand: BoardEntity[] } => {\r\n\tconst board = playerInfo.board.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, true));\r\n\tconst hand =\r\n\t\tplayerInfo.player.hand?.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, false)) ?? [];\r\n\treturn { board, hand };\r\n};\r\n"]}
|
|
@@ -270,6 +270,9 @@ const dealDamageToMinion = (target, board, hero, damageSource, damage, otherBoar
|
|
|
270
270
|
}
|
|
271
271
|
if (actualDamageDone > 0) {
|
|
272
272
|
const newSpawns = (0, damage_effects_1.onEntityDamaged)(target, board, hero, otherBoard, otherHero, damageSource, actualDamageDone, gameState);
|
|
273
|
+
if ((0, utils_2.isBoardEntity)(damageSource)) {
|
|
274
|
+
damageSource.venomous = false;
|
|
275
|
+
}
|
|
273
276
|
}
|
|
274
277
|
if (!isDeadBeforeDamage && actualDamageDone > 0 && 'attack' in damageSource && 'health' in damageSource) {
|
|
275
278
|
target.lastAffectedByEntity = damageSource;
|