@firestone-hs/simulate-bgs-battle 1.1.741 → 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/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/simulation/stats.js +3 -2
- package/dist/simulation/stats.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAA+B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,CAAC,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/
|
|
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,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAA+B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,CAAC,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/simulation/stats.js
CHANGED
|
@@ -26,7 +26,7 @@ const multiplyStats = (entity, multiplier, board, hero, gameState) => {
|
|
|
26
26
|
};
|
|
27
27
|
exports.multiplyStats = multiplyStats;
|
|
28
28
|
const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard, friendlyBoardHero, gameState, registerSpectator = true, isEnchantment = true, countsAsStatsGain = true) => {
|
|
29
|
-
var _a, _b;
|
|
29
|
+
var _a, _b, _c;
|
|
30
30
|
if (!(entity === null || entity === void 0 ? void 0 : entity.maxHealth)) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -105,7 +105,8 @@ const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard,
|
|
|
105
105
|
}
|
|
106
106
|
poetMultipliers = poetCount * 2 + timewarpedPoetCount * 2 || 1;
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const hasTarecgosasBlessing = (_c = entity.enchantments) === null || _c === void 0 ? void 0 : _c.some((e) => e.cardId === "BG36_MidGameEffect_000t50e");
|
|
109
|
+
const tarecgosaMultiplier = (isEnchantment && entity.cardId === "BG21_015_G") || hasTarecgosasBlessing ? 2 : 1;
|
|
109
110
|
const realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;
|
|
110
111
|
const realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;
|
|
111
112
|
if (!Number.isFinite(realAttackAmount) && !Number.isFinite(realHealthAmount)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/simulation/stats.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,4DAA4D;AAC5D,iEAA4D;AAE5D,oCAAuD;AACvD,+DAA8E;AAE9E,mCAAiD;AAE1C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,MAAqB,EACrB,MAAqB,EACrB,KAAoB,EACpB,SAA0B,EAC1B,SAAwB,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,GAAG,IAAI,EAChB,EAAE;IACT,IAAA,yCAAmB,EAAC,MAAM,EAAE,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,MAAM,eAAuC;gBACnD,KAAK,CAAC,MAAM,iBAAyC,CAAC,EACtD;YACD,MAAM,QAAQ,GAAG,CAAC,CAAC;YACnB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,IAAA,mBAAW,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;SACzG;QACD,IACC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;YAClC,CAAC,KAAK,CAAC,MAAM,iCAAuD;gBACnE,KAAK,CAAC,MAAM,mCAAyD,CAAC,EACtE;YACD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;YACrB,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;SACrB;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEnchantment, BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { getEffectiveTribesForEntity } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tapplyAttackAuras = true,\r\n\tapplyHealthAuras = true,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n};\r\n\r\nexport const multiplyStats = (\r\n\tentity: BoardEntity,\r\n\tmultiplier: number | null,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tmodifyStats(\r\n\t\tentity,\r\n\t\tentity,\r\n\t\t(multiplier - 1) * entity.maxAttack,\r\n\t\t(multiplier - 1) * entity.maxHealth,\r\n\t\tboard,\r\n\t\thero,\r\n\t\tgameState,\r\n\t);\r\n\tapplyAurasToSelf(entity, board, hero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n\t// All stat modifications become enchantments, excepted the ones coming from gilding a minion\r\n\tisEnchantment = true,\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\t// Not a minion - can happen when buffing the whole hand, so we don't have to filter first\r\n\tif (!entity?.maxHealth) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!Number.isFinite(attackAmount)) {\r\n\t\tattackAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(healthAmount)) {\r\n\t\thealthAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.attack)) {\r\n\t\tentity.attack = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.health)) {\r\n\t\tentity.health = 1;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxAttack as number)) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxHealth as number)) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tconst sourceEntity = source as BoardEntity;\r\n\tconst globalInfo = friendlyBoardHero.globalInfo;\r\n\tif (\r\n\t\tentity.entityId !== sourceEntity?.entityId &&\r\n\t\tsourceEntity?.maxHealth &&\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0 &&\r\n\t\t// Resolving the source's tribes is only useful when one of these global buffs is\r\n\t\t// active, and this is one of the hottest paths of the simulation\r\n\t\t(globalInfo.ElementalAttackBuff ||\r\n\t\t\tglobalInfo.ElementalHealthBuff ||\r\n\t\t\tglobalInfo.PirateAttackBuff ||\r\n\t\t\tglobalInfo.PirateHealthBuff)\r\n\t) {\r\n\t\tconst sourceTribes = getEffectiveTribesForEntity(\r\n\t\t\tsourceEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t);\r\n\t\tconst sourceIsAllTribes = sourceTribes.includes(Race.ALL);\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.ELEMENTAL)) {\r\n\t\t\tattackAmount += globalInfo.ElementalAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.ElementalHealthBuff || 0;\r\n\t\t}\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.PIRATE)) {\r\n\t\t\tattackAmount += globalInfo.PirateAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.PirateHealthBuff || 0;\r\n\t\t}\r\n\t}\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst effectiveTribes = getEffectiveTribesForEntity(\r\n\t\tentity,\r\n\t\tfriendlyBoardHero,\r\n\t\tgameState.anomalies,\r\n\t\tgameState.allCards,\r\n\t);\r\n\tconst isAllTribes = effectiveTribes.includes(Race.ALL);\r\n\tconst isDragon = isAllTribes || effectiveTribes.includes(Race.DRAGON);\r\n\tconst isElemental = isAllTribes || effectiveTribes.includes(Race.ELEMENTAL);\r\n\tlet poetMultipliers = 1;\r\n\tif (isEnchantment && isDragon) {\r\n\t\tlet entityIndex = -1;\r\n\t\tlet timewarpedPoetCount = 0;\r\n\t\tfor (let i = 0; i < friendlyBoard.length; i++) {\r\n\t\t\tif (friendlyBoard[i].entityId === entity.entityId) {\r\n\t\t\t\tentityIndex = i;\r\n\t\t\t}\r\n\t\t\tif (friendlyBoard[i].cardId === CardIds.TimewarpedPoet_BG34_Giant_314_G) {\r\n\t\t\t\ttimewarpedPoetCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet poetCount = 0;\r\n\t\tif (friendlyBoard[entityIndex - 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tif (friendlyBoard[entityIndex + 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tpoetMultipliers = poetCount * 2 + timewarpedPoetCount * 2 || 1;\r\n\t}\r\n\tconst tarecgosaMultiplier = isEnchantment && entity.cardId === CardIds.Tarecgosa_BG21_015_G ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tif (!Number.isFinite(realAttackAmount) && !Number.isFinite(realHealthAmount)) {\r\n\t\treturn;\r\n\t}\r\n\tconst safeAtk = Number.isFinite(realAttackAmount) ? realAttackAmount : 0;\r\n\tconst safeHp = Number.isFinite(realHealthAmount) ? realHealthAmount : 0;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + safeAtk);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(safeAtk);\r\n\tentity.health += safeHp;\r\n\r\n\tif (safeAtk > 0) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (safeHp > 0) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\tif (safeAtk > 0 || safeHp > 0) {\r\n\t\t// Single pass over the board for all the \"when a minion gains stats\" watchers\r\n\t\t// (Stormbringer, Titanic Guardian). Their effects are independent of\r\n\t\t// each other, so interleaving them per board position is equivalent to the\r\n\t\t// previous one-loop-per-effect version, and much cheaper on this hot path\r\n\t\tconst checkStormbringer =\r\n\t\t\tsafeAtk > 0 &&\r\n\t\t\tisDragon &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966 &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966_G;\r\n\t\tfor (const other of friendlyBoard) {\r\n\t\t\tconst otherCardId = other.cardId;\r\n\t\t\tif (safeAtk > 0) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tcheckStormbringer &&\r\n\t\t\t\t\t(otherCardId === CardIds.Stormbringer_BG26_966 || otherCardId === CardIds.Stormbringer_BG26_966_G)\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst multiplier = otherCardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tother.attack += multiplier * safeAtk;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (\r\n\t\t\t\tsafeHp > 0 &&\r\n\t\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t\t(otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\totherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G)\r\n\t\t\t) {\r\n\t\t\t\tconst buff = (otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * safeHp;\r\n\t\t\t\tother.health += buff;\r\n\t\t\t\tother.maxHealth += buff;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (countsAsStatsGain) {\r\n\t\tonStatsUpdate(\r\n\t\t\tentity,\r\n\t\t\tsource,\r\n\t\t\tsafeAtk,\r\n\t\t\tsafeHp,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t\tisElemental,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tonStatUpdateMinions(\r\n\t\tentity,\r\n\t\tsource,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\totherHero,\r\n\t\tgameState,\r\n\t\tisElemental,\r\n\t);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tsource: source as BoardEntity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Single pass for Master of Realities and Tentacle of C'Thun (their effects are\r\n\t// independent, so interleaving them is equivalent to separate loops)\r\n\tfor (const other of friendlyBoard) {\r\n\t\tif (\r\n\t\t\tisElemental &&\r\n\t\t\t(other.cardId === CardIds.MasterOfRealities_BG21_036 ||\r\n\t\t\t\tother.cardId === CardIds.MasterOfRealities_BG21_036_G)\r\n\t\t) {\r\n\t\t\tconst baseBuff = 2;\r\n\t\t\tconst mult = other.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1;\r\n\t\t\tmodifyStats(other, other, baseBuff * mult, baseBuff * mult, friendlyBoard, friendlyBoardHero, gameState);\r\n\t\t}\r\n\t\tif (\r\n\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t(other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\tother.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G)\r\n\t\t) {\r\n\t\t\tconst buff = other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\t\tother.attack += buff;\r\n\t\t\tother.health += buff;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/simulation/stats.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,4DAA4D;AAC5D,iEAA4D;AAE5D,oCAAuD;AACvD,+DAA8E;AAE9E,mCAAiD;AAE1C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,MAAqB,EACrB,MAAqB,EACrB,KAAoB,EACpB,SAA0B,EAC1B,SAAwB,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,GAAG,I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oBAC1B,KAAK,EAAE,aAAa;oBACpB,IAAI,EAAE,iBAAiB;oBACvB,SAAS,EAAE,SAAS;oBACpB,SAAS,EAAE,SAAS;iBACpB,CAAC,CAAC;aACH;SACD;KACD;IAID,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE;QAClC,IACC,WAAW;YACX,CAAC,KAAK,CAAC,MAAM,eAAuC;gBACnD,KAAK,CAAC,MAAM,iBAAyC,CAAC,EACtD;YACD,MAAM,QAAQ,GAAG,CAAC,CAAC;YACnB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,IAAA,mBAAW,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;SACzG;QACD,IACC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;YAClC,CAAC,KAAK,CAAC,MAAM,iCAAuD;gBACnE,KAAK,CAAC,MAAM,mCAAyD,CAAC,EACtE;YACD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;YACrB,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;SACrB;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEnchantment, BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { getEffectiveTribesForEntity } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tapplyAttackAuras = true,\r\n\tapplyHealthAuras = true,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n};\r\n\r\nexport const multiplyStats = (\r\n\tentity: BoardEntity,\r\n\tmultiplier: number | null,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tmodifyStats(\r\n\t\tentity,\r\n\t\tentity,\r\n\t\t(multiplier - 1) * entity.maxAttack,\r\n\t\t(multiplier - 1) * entity.maxHealth,\r\n\t\tboard,\r\n\t\thero,\r\n\t\tgameState,\r\n\t);\r\n\tapplyAurasToSelf(entity, board, hero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n\t// All stat modifications become enchantments, excepted the ones coming from gilding a minion\r\n\tisEnchantment = true,\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\t// Not a minion - can happen when buffing the whole hand, so we don't have to filter first\r\n\tif (!entity?.maxHealth) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!Number.isFinite(attackAmount)) {\r\n\t\tattackAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(healthAmount)) {\r\n\t\thealthAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.attack)) {\r\n\t\tentity.attack = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.health)) {\r\n\t\tentity.health = 1;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxAttack as number)) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxHealth as number)) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tconst sourceEntity = source as BoardEntity;\r\n\tconst globalInfo = friendlyBoardHero.globalInfo;\r\n\tif (\r\n\t\tentity.entityId !== sourceEntity?.entityId &&\r\n\t\tsourceEntity?.maxHealth &&\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0 &&\r\n\t\t// Resolving the source's tribes is only useful when one of these global buffs is\r\n\t\t// active, and this is one of the hottest paths of the simulation\r\n\t\t(globalInfo.ElementalAttackBuff ||\r\n\t\t\tglobalInfo.ElementalHealthBuff ||\r\n\t\t\tglobalInfo.PirateAttackBuff ||\r\n\t\t\tglobalInfo.PirateHealthBuff)\r\n\t) {\r\n\t\tconst sourceTribes = getEffectiveTribesForEntity(\r\n\t\t\tsourceEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t);\r\n\t\tconst sourceIsAllTribes = sourceTribes.includes(Race.ALL);\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.ELEMENTAL)) {\r\n\t\t\tattackAmount += globalInfo.ElementalAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.ElementalHealthBuff || 0;\r\n\t\t}\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.PIRATE)) {\r\n\t\t\tattackAmount += globalInfo.PirateAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.PirateHealthBuff || 0;\r\n\t\t}\r\n\t}\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst effectiveTribes = getEffectiveTribesForEntity(\r\n\t\tentity,\r\n\t\tfriendlyBoardHero,\r\n\t\tgameState.anomalies,\r\n\t\tgameState.allCards,\r\n\t);\r\n\tconst isAllTribes = effectiveTribes.includes(Race.ALL);\r\n\tconst isDragon = isAllTribes || effectiveTribes.includes(Race.DRAGON);\r\n\tconst isElemental = isAllTribes || effectiveTribes.includes(Race.ELEMENTAL);\r\n\tlet poetMultipliers = 1;\r\n\tif (isEnchantment && isDragon) {\r\n\t\tlet entityIndex = -1;\r\n\t\tlet timewarpedPoetCount = 0;\r\n\t\tfor (let i = 0; i < friendlyBoard.length; i++) {\r\n\t\t\tif (friendlyBoard[i].entityId === entity.entityId) {\r\n\t\t\t\tentityIndex = i;\r\n\t\t\t}\r\n\t\t\tif (friendlyBoard[i].cardId === CardIds.TimewarpedPoet_BG34_Giant_314_G) {\r\n\t\t\t\ttimewarpedPoetCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet poetCount = 0;\r\n\t\tif (friendlyBoard[entityIndex - 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tif (friendlyBoard[entityIndex + 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tpoetMultipliers = poetCount * 2 + timewarpedPoetCount * 2 || 1;\r\n\t}\r\n\tconst hasTarecgosasBlessing = entity.enchantments?.some(\r\n\t\t(e) => e.cardId === CardIds.TarecgosasBlessing_TarecgosasBlessingEnchantment_BG36_MidGameEffect_000t50e,\r\n\t);\r\n\tconst tarecgosaMultiplier =\r\n\t\t(isEnchantment && entity.cardId === CardIds.Tarecgosa_BG21_015_G) || hasTarecgosasBlessing ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tif (!Number.isFinite(realAttackAmount) && !Number.isFinite(realHealthAmount)) {\r\n\t\treturn;\r\n\t}\r\n\tconst safeAtk = Number.isFinite(realAttackAmount) ? realAttackAmount : 0;\r\n\tconst safeHp = Number.isFinite(realHealthAmount) ? realHealthAmount : 0;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + safeAtk);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(safeAtk);\r\n\tentity.health += safeHp;\r\n\r\n\tif (safeAtk > 0) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (safeHp > 0) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\tif (safeAtk > 0 || safeHp > 0) {\r\n\t\t// Single pass over the board for all the \"when a minion gains stats\" watchers\r\n\t\t// (Stormbringer, Titanic Guardian). Their effects are independent of\r\n\t\t// each other, so interleaving them per board position is equivalent to the\r\n\t\t// previous one-loop-per-effect version, and much cheaper on this hot path\r\n\t\tconst checkStormbringer =\r\n\t\t\tsafeAtk > 0 &&\r\n\t\t\tisDragon &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966 &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966_G;\r\n\t\tfor (const other of friendlyBoard) {\r\n\t\t\tconst otherCardId = other.cardId;\r\n\t\t\tif (safeAtk > 0) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tcheckStormbringer &&\r\n\t\t\t\t\t(otherCardId === CardIds.Stormbringer_BG26_966 || otherCardId === CardIds.Stormbringer_BG26_966_G)\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst multiplier = otherCardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tother.attack += multiplier * safeAtk;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (\r\n\t\t\t\tsafeHp > 0 &&\r\n\t\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t\t(otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\totherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G)\r\n\t\t\t) {\r\n\t\t\t\tconst buff = (otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * safeHp;\r\n\t\t\t\tother.health += buff;\r\n\t\t\t\tother.maxHealth += buff;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (countsAsStatsGain) {\r\n\t\tonStatsUpdate(\r\n\t\t\tentity,\r\n\t\t\tsource,\r\n\t\t\tsafeAtk,\r\n\t\t\tsafeHp,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t\tisElemental,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tonStatUpdateMinions(\r\n\t\tentity,\r\n\t\tsource,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\totherHero,\r\n\t\tgameState,\r\n\t\tisElemental,\r\n\t);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tsource: source as BoardEntity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Single pass for Master of Realities and Tentacle of C'Thun (their effects are\r\n\t// independent, so interleaving them is equivalent to separate loops)\r\n\tfor (const other of friendlyBoard) {\r\n\t\tif (\r\n\t\t\tisElemental &&\r\n\t\t\t(other.cardId === CardIds.MasterOfRealities_BG21_036 ||\r\n\t\t\t\tother.cardId === CardIds.MasterOfRealities_BG21_036_G)\r\n\t\t) {\r\n\t\t\tconst baseBuff = 2;\r\n\t\t\tconst mult = other.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1;\r\n\t\t\tmodifyStats(other, other, baseBuff * mult, baseBuff * mult, friendlyBoard, friendlyBoardHero, gameState);\r\n\t\t}\r\n\t\tif (\r\n\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t(other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\tother.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G)\r\n\t\t) {\r\n\t\t\tconst buff = other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\t\tother.attack += buff;\r\n\t\t\tother.health += buff;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|