@firestone-hs/simulate-bgs-battle 1.1.643 → 1.1.644

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.
Files changed (57) hide show
  1. package/dist/bgs-player-entity.d.ts +2 -1
  2. package/dist/bgs-player-entity.js.map +1 -1
  3. package/dist/cards/card.interface.d.ts +2 -2
  4. package/dist/cards/card.interface.js.map +1 -1
  5. package/dist/cards/impl/hero-power/fragrant-phylactery-enchantment.js +2 -2
  6. package/dist/cards/impl/hero-power/fragrant-phylactery-enchantment.js.map +1 -1
  7. package/dist/cards/impl/minion/admiral-eliza-goreblade.js +1 -1
  8. package/dist/cards/impl/minion/admiral-eliza-goreblade.js.map +1 -1
  9. package/dist/cards/impl/minion/arcane-cannoneer.js +1 -1
  10. package/dist/cards/impl/minion/arcane-cannoneer.js.map +1 -1
  11. package/dist/cards/impl/minion/auto-assembler-enchantment.js +2 -2
  12. package/dist/cards/impl/minion/auto-assembler-enchantment.js.map +1 -1
  13. package/dist/cards/impl/minion/bonker.js +1 -1
  14. package/dist/cards/impl/minion/bonker.js.map +1 -1
  15. package/dist/cards/impl/minion/charmwing.js +1 -1
  16. package/dist/cards/impl/minion/charmwing.js.map +1 -1
  17. package/dist/cards/impl/minion/colossus.js +1 -1
  18. package/dist/cards/impl/minion/colossus.js.map +1 -1
  19. package/dist/cards/impl/minion/exceptionnal-caretaker.js +2 -2
  20. package/dist/cards/impl/minion/exceptionnal-caretaker.js.map +1 -1
  21. package/dist/cards/impl/minion/friendly-bouncer.js +2 -2
  22. package/dist/cards/impl/minion/friendly-bouncer.js.map +1 -1
  23. package/dist/cards/impl/minion/greenskeeper.js +1 -1
  24. package/dist/cards/impl/minion/greenskeeper.js.map +1 -1
  25. package/dist/cards/impl/minion/hydralisk.js +1 -1
  26. package/dist/cards/impl/minion/hydralisk.js.map +1 -1
  27. package/dist/cards/impl/minion/monstrous-macaw.js +3 -3
  28. package/dist/cards/impl/minion/monstrous-macaw.js.map +1 -1
  29. package/dist/cards/impl/minion/niuzao.js +2 -2
  30. package/dist/cards/impl/minion/niuzao.js.map +1 -1
  31. package/dist/cards/impl/minion/razorfen-vineweaver.js +1 -1
  32. package/dist/cards/impl/minion/razorfen-vineweaver.js.map +1 -1
  33. package/dist/cards/impl/minion/ripsnarl-captain.js +1 -1
  34. package/dist/cards/impl/minion/ripsnarl-captain.js.map +1 -1
  35. package/dist/cards/impl/minion/sky-pirate-flagbearer-enchantment.js +1 -1
  36. package/dist/cards/impl/minion/sky-pirate-flagbearer-enchantment.js.map +1 -1
  37. package/dist/cards/impl/minion/sleepy-supporter.js +2 -2
  38. package/dist/cards/impl/minion/sleepy-supporter.js.map +1 -1
  39. package/dist/cards/impl/minion/stomping-stegodon.js +2 -3
  40. package/dist/cards/impl/minion/stomping-stegodon.js.map +1 -1
  41. package/dist/cards/impl/minion/tusked-camper.js +1 -1
  42. package/dist/cards/impl/minion/tusked-camper.js.map +1 -1
  43. package/dist/cards/impl/minion/twilight-watcher.js +1 -1
  44. package/dist/cards/impl/minion/twilight-watcher.js.map +1 -1
  45. package/dist/cards/impl/minion/vengeful-protector.js +2 -2
  46. package/dist/cards/impl/minion/vengeful-protector.js.map +1 -1
  47. package/dist/cards/impl/minion/void-ray.js +2 -2
  48. package/dist/cards/impl/minion/void-ray.js.map +1 -1
  49. package/dist/cards/impl/minion/whirring-protector.js +2 -2
  50. package/dist/cards/impl/minion/whirring-protector.js.map +1 -1
  51. package/dist/simulate-bgs-battle.js +1 -0
  52. package/dist/simulate-bgs-battle.js.map +1 -1
  53. package/dist/simulation/auras.js +32 -35
  54. package/dist/simulation/auras.js.map +1 -1
  55. package/dist/simulation/deathrattle-spawns.js +1 -1
  56. package/dist/simulation/deathrattle-spawns.js.map +1 -1
  57. package/package.json +1 -1
@@ -7,7 +7,7 @@ exports.SkyPirateFlagbearerEnchantment = {
7
7
  "BG30_119e",
8
8
  "BG30_119_Ge",
9
9
  ],
10
- deathrattleSpawnEnchantmentEffect: (enchantment, input) => {
10
+ deathrattleSpawnEnchantmentEffect: (enchantment, minion, input) => {
11
11
  return (0, deathrattle_spawns_1.simplifiedSpawnEntities)(enchantment.cardId === "BG30_119e"
12
12
  ? "BGS_061"
13
13
  : "TB_BaconUps_141", 1, input);
@@ -1 +1 @@
1
- {"version":3,"file":"sky-pirate-flagbearer-enchantment.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/sky-pirate-flagbearer-enchantment.ts"],"names":[],"mappings":";;;AAEA,+EAAiF;AAGpE,QAAA,8BAA8B,GAAoC;IAC9E,OAAO,EAAE;;;KAGR;IACD,iCAAiC,EAAE,CAAC,WAA+B,EAAE,KAAgC,EAAE,EAAE;QACxG,OAAO,IAAA,4CAAuB,EAC7B,WAAW,CAAC,MAAM,gBAAiE;YAClF,CAAC;YACD,CAAC,kBAAkC,EACpC,CAAC,EACD,KAAK,CACL,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { DeathrattleSpawnEnchantmentCard } from '../../card.interface';\r\n\r\nexport const SkyPirateFlagbearerEnchantment: DeathrattleSpawnEnchantmentCard = {\r\n\tcardIds: [\r\n\t\tCardIds.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119e,\r\n\t\tCardIds.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119_Ge,\r\n\t],\r\n\tdeathrattleSpawnEnchantmentEffect: (enchantment: { cardId: string }, input: DeathrattleTriggeredInput) => {\r\n\t\treturn simplifiedSpawnEntities(\r\n\t\t\tenchantment.cardId === CardIds.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119e\r\n\t\t\t\t? CardIds.Scallywag_BGS_061\r\n\t\t\t\t: CardIds.Scallywag_TB_BaconUps_141,\r\n\t\t\t1,\r\n\t\t\tinput,\r\n\t\t);\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"sky-pirate-flagbearer-enchantment.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/sky-pirate-flagbearer-enchantment.ts"],"names":[],"mappings":";;;AAGA,+EAAiF;AAGpE,QAAA,8BAA8B,GAAoC;IAC9E,OAAO,EAAE;;;KAGR;IACD,iCAAiC,EAAE,CAClC,WAA+B,EAC/B,MAAsC,EACtC,KAAgC,EAC/B,EAAE;QACH,OAAO,IAAA,4CAAuB,EAC7B,WAAW,CAAC,MAAM,gBAAiE;YAClF,CAAC;YACD,CAAC,kBAAkC,EACpC,CAAC,EACD,KAAK,CACL,CAAC;IACH,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 { DeathrattleSpawnEnchantmentCard } from '../../card.interface';\r\n\r\nexport const SkyPirateFlagbearerEnchantment: DeathrattleSpawnEnchantmentCard = {\r\n\tcardIds: [\r\n\t\tCardIds.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119e,\r\n\t\tCardIds.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119_Ge,\r\n\t],\r\n\tdeathrattleSpawnEnchantmentEffect: (\r\n\t\tenchantment: { cardId: string },\r\n\t\tminion: BoardEntity | null | undefined,\r\n\t\tinput: DeathrattleTriggeredInput,\r\n\t) => {\r\n\t\treturn simplifiedSpawnEntities(\r\n\t\t\tenchantment.cardId === CardIds.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119e\r\n\t\t\t\t? CardIds.Scallywag_BGS_061\r\n\t\t\t\t: CardIds.Scallywag_TB_BaconUps_141,\r\n\t\t\t1,\r\n\t\t\tinput,\r\n\t\t);\r\n\t},\r\n};\r\n"]}
@@ -9,11 +9,11 @@ exports.SleepySupporter = {
9
9
  cardIds: ["BG33_241", "BG33_241_G"],
10
10
  rally: (minion, input) => {
11
11
  const mult = minion.cardId === "BG33_241_G" ? 2 : 1;
12
- const candidates = input.attackingBoard.filter((e) => e !== minion &&
12
+ const candidates = input.attackingBoard.filter((e) => e !== input.attacker &&
13
13
  (0, utils_2.hasCorrectTribe)(e, input.attackingHero, reference_data_1.Race.DRAGON, input.gameState.anomalies, input.gameState.allCards));
14
14
  const target = (0, utils_1.pickRandom)(candidates);
15
15
  if (!!target) {
16
- (0, stats_1.modifyStats)(target, minion, 2 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);
16
+ (0, stats_1.modifyStats)(target, input.attacker, 2 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);
17
17
  }
18
18
  return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
19
19
  },
@@ -1 +1 @@
1
- {"version":3,"file":"sleepy-supporter.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/sleepy-supporter.ts"],"names":[],"mappings":";;;AACA,iEAAoD;AAEpD,mDAAqD;AAErD,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,eAAe,GAAc;IACzC,OAAO,EAAE,0BAAsE;IAC/E,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAC7C,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,KAAK,MAAM;YACZ,IAAA,uBAAe,EACd,CAAC,EACD,KAAK,CAAC,aAAa,EACnB,qBAAI,CAAC,MAAM,EACX,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,CACF,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SAC5G;QACD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { Race } from '@firestone-hs/reference-data';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const SleepySupporter: RallyCard = {\r\n\tcardIds: [CardIds.SleepySupporter_BG33_241, CardIds.SleepySupporter_BG33_241_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.SleepySupporter_BG33_241_G ? 2 : 1;\r\n\t\tconst candidates = input.attackingBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te !== minion &&\r\n\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\tRace.DRAGON,\r\n\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t),\r\n\t\t);\r\n\t\tconst target = pickRandom(candidates);\r\n\t\tif (!!target) {\r\n\t\t\tmodifyStats(target, minion, 2 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"sleepy-supporter.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/sleepy-supporter.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,mDAAqD;AAErD,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,eAAe,GAAc;IACzC,OAAO,EAAE,0BAAsE;IAC/E,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAC7C,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,KAAK,KAAK,CAAC,QAAQ;YACpB,IAAA,uBAAe,EACd,CAAC,EACD,KAAK,CAAC,aAAa,EACnB,qBAAI,CAAC,MAAM,EACX,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,CACF,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,IAAA,mBAAW,EACV,MAAM,EACN,KAAK,CAAC,QAAQ,EACd,CAAC,GAAG,IAAI,EACR,CAAC,GAAG,IAAI,EACR,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":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const SleepySupporter: RallyCard = {\r\n\tcardIds: [CardIds.SleepySupporter_BG33_241, CardIds.SleepySupporter_BG33_241_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.SleepySupporter_BG33_241_G ? 2 : 1;\r\n\t\tconst candidates = input.attackingBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te !== input.attacker &&\r\n\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\tRace.DRAGON,\r\n\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t),\r\n\t\t);\r\n\t\tconst target = pickRandom(candidates);\r\n\t\tif (!!target) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tinput.attacker,\r\n\t\t\t\t2 * mult,\r\n\t\t\t\t3 * 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"]}
@@ -9,15 +9,14 @@ exports.stompingStegodonHealth = 0;
9
9
  exports.StompingStegodon = {
10
10
  cardIds: ["BG33_840", "BG33_840_G"],
11
11
  rally: (minion, input) => {
12
- const debug = minion.entityId === 10597;
13
12
  const mult = minion.cardId === "BG33_840_G" ? 2 : 1;
14
- const candidates = input.attackingBoard.filter((e) => e !== minion &&
13
+ const candidates = input.attackingBoard.filter((e) => e !== input.attacker &&
15
14
  (0, utils_1.hasCorrectTribe)(e, input.attackingHero, reference_data_1.Race.BEAST, input.gameState.anomalies, input.gameState.allCards));
16
15
  const enchantmentCardIdToAdd = minion.cardId === "BG33_840_G"
17
16
  ? "BG33_840_Ge2"
18
17
  : "BG33_840e2";
19
18
  for (const candidate of candidates) {
20
- (0, stats_1.modifyStats)(candidate, minion, exports.stompingStegodonAttack * mult, exports.stompingStegodonHealth * mult, input.attackingBoard, input.attackingHero, input.gameState);
19
+ (0, stats_1.modifyStats)(candidate, input.attacker, exports.stompingStegodonAttack * mult, exports.stompingStegodonHealth * mult, input.attackingBoard, input.attackingHero, input.gameState);
21
20
  let existingEnchantment = candidate.enchantments.find((e) => e.cardId === enchantmentCardIdToAdd);
22
21
  if (!existingEnchantment) {
23
22
  existingEnchantment = {
@@ -1 +1 @@
1
- {"version":3,"file":"stomping-stegodon.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/stomping-stegodon.ts"],"names":[],"mappings":";;;AACA,iEAAoD;AAGpD,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,sBAAsB,GAAG,CAAC,CAAC;AAC3B,QAAA,sBAAsB,GAAG,CAAC,CAAC;AAE3B,QAAA,gBAAgB,GAAc;IAC1C,OAAO,EAAE,0BAAwE;IACjF,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC;QACxC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAwC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAC7C,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,KAAK,MAAM;YACZ,IAAA,uBAAe,EACd,CAAC,EACD,KAAK,CAAC,aAAa,EACnB,qBAAI,CAAC,KAAK,EACV,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,CACF,CAAC;QACF,MAAM,sBAAsB,GAC3B,MAAM,CAAC,MAAM,iBAAwC;YACpD,CAAC;YACD,CAAC,aAAwD,CAAC;QAC5D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YACnC,IAAA,mBAAW,EACV,SAAS,EACT,MAAM,EACN,8BAAsB,GAAG,IAAI,EAC7B,8BAAsB,GAAG,IAAI,EAC7B,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;YAEF,IAAI,mBAAmB,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,sBAAsB,CAAC,CAAC;YAClG,IAAI,CAAC,mBAAmB,EAAE;gBACzB,mBAAmB,GAAG;oBACrB,MAAM,EAAE,sBAAsB;oBAC9B,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ;oBACvC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;oBACrD,OAAO,EAAE,CAAC;iBACV,CAAC;gBACF,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;aACjD;YACD,mBAAmB,CAAC,OAAO,IAAI,CAAC,CAAC;SACjC;QAED,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { Race } from '@firestone-hs/reference-data';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const stompingStegodonAttack = 3;\r\nexport const stompingStegodonHealth = 0;\r\n\r\nexport const StompingStegodon: RallyCard = {\r\n\tcardIds: [CardIds.StompingStegodon_BG33_840, CardIds.StompingStegodon_BG33_840_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst debug = minion.entityId === 10597;\r\n\t\tconst mult = minion.cardId === CardIds.StompingStegodon_BG33_840_G ? 2 : 1;\r\n\t\tconst candidates = input.attackingBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te !== minion &&\r\n\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t),\r\n\t\t);\r\n\t\tconst enchantmentCardIdToAdd =\r\n\t\t\tminion.cardId === CardIds.StompingStegodon_BG33_840_G\r\n\t\t\t\t? CardIds.StompingStegodon_StompingEnchantment_BG33_840_Ge2\r\n\t\t\t\t: CardIds.StompingStegodon_StompingEnchantment_BG33_840e2;\r\n\t\tfor (const candidate of candidates) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tcandidate,\r\n\t\t\t\tminion,\r\n\t\t\t\tstompingStegodonAttack * mult,\r\n\t\t\t\tstompingStegodonHealth * 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\r\n\t\t\tlet existingEnchantment = candidate.enchantments.find((e) => e.cardId === enchantmentCardIdToAdd);\r\n\t\t\tif (!existingEnchantment) {\r\n\t\t\t\texistingEnchantment = {\r\n\t\t\t\t\tcardId: enchantmentCardIdToAdd,\r\n\t\t\t\t\toriginEntityId: input.attacker.entityId,\r\n\t\t\t\t\ttiming: input.gameState.sharedState.currentEntityId++,\r\n\t\t\t\t\trepeats: 0,\r\n\t\t\t\t};\r\n\t\t\t\tcandidate.enchantments.push(existingEnchantment);\r\n\t\t\t}\r\n\t\t\texistingEnchantment.repeats += 1;\r\n\t\t}\r\n\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"stomping-stegodon.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/stomping-stegodon.ts"],"names":[],"mappings":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ACvC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;oBACrD,OAAO,EAAE,CAAC;iBACV,CAAC;gBACF,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;aACjD;YACD,mBAAmB,CAAC,OAAO,IAAI,CAAC,CAAC;SACjC;QAED,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,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 { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const stompingStegodonAttack = 3;\r\nexport const stompingStegodonHealth = 0;\r\n\r\nexport const StompingStegodon: RallyCard = {\r\n\tcardIds: [CardIds.StompingStegodon_BG33_840, CardIds.StompingStegodon_BG33_840_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.StompingStegodon_BG33_840_G ? 2 : 1;\r\n\t\tconst candidates = input.attackingBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te !== input.attacker &&\r\n\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t),\r\n\t\t);\r\n\t\tconst enchantmentCardIdToAdd =\r\n\t\t\tminion.cardId === CardIds.StompingStegodon_BG33_840_G\r\n\t\t\t\t? CardIds.StompingStegodon_StompingEnchantment_BG33_840_Ge2\r\n\t\t\t\t: CardIds.StompingStegodon_StompingEnchantment_BG33_840e2;\r\n\t\tfor (const candidate of candidates) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tcandidate,\r\n\t\t\t\tinput.attacker,\r\n\t\t\t\tstompingStegodonAttack * mult,\r\n\t\t\t\tstompingStegodonHealth * 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\r\n\t\t\tlet existingEnchantment = candidate.enchantments.find((e) => e.cardId === enchantmentCardIdToAdd);\r\n\t\t\tif (!existingEnchantment) {\r\n\t\t\t\texistingEnchantment = {\r\n\t\t\t\t\tcardId: enchantmentCardIdToAdd,\r\n\t\t\t\t\toriginEntityId: input.attacker.entityId,\r\n\t\t\t\t\ttiming: input.gameState.sharedState.currentEntityId++,\r\n\t\t\t\t\trepeats: 0,\r\n\t\t\t\t};\r\n\t\t\t\tcandidate.enchantments.push(existingEnchantment);\r\n\t\t\t}\r\n\t\t\texistingEnchantment.repeats += 1;\r\n\t\t}\r\n\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
@@ -6,7 +6,7 @@ exports.TuskedCamper = {
6
6
  cardIds: ["BG33_886", "BG33_886_G"],
7
7
  rally: (minion, input) => {
8
8
  const mult = minion.cardId === "BG33_886_G" ? 2 : 1;
9
- (0, blood_gems_1.playBloodGemsOn)(minion, minion, 1 * mult, input.attackingBoard, input.attackingHero, input.gameState);
9
+ (0, blood_gems_1.playBloodGemsOn)(input.attacker, input.attacker, 1 * mult, input.attackingBoard, input.attackingHero, input.gameState);
10
10
  return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
11
11
  },
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tusked-camper.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tusked-camper.ts"],"names":[],"mappings":";;;AAEA,+DAAiE;AAIpD,QAAA,YAAY,GAAc;IACtC,OAAO,EAAE,0BAAgE;IACzE,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAoC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,IAAA,4BAAe,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACtG,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { playBloodGemsOn } from '../../../simulation/blood-gems';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const TuskedCamper: RallyCard = {\r\n\tcardIds: [CardIds.TuskedCamper_BG33_886, CardIds.TuskedCamper_BG33_886_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TuskedCamper_BG33_886_G ? 2 : 1;\r\n\t\tplayBloodGemsOn(minion, minion, 1 * mult, input.attackingBoard, input.attackingHero, input.gameState);\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"tusked-camper.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tusked-camper.ts"],"names":[],"mappings":";;;AAEA,+DAAiE;AAIpD,QAAA,YAAY,GAAc;IACtC,OAAO,EAAE,0BAAgE;IACzE,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAoC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,IAAA,4BAAe,EACd,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,QAAQ,EACd,CAAC,GAAG,IAAI,EACR,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;QACF,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { playBloodGemsOn } from '../../../simulation/blood-gems';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const TuskedCamper: RallyCard = {\r\n\tcardIds: [CardIds.TuskedCamper_BG33_886, CardIds.TuskedCamper_BG33_886_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TuskedCamper_BG33_886_G ? 2 : 1;\r\n\t\tplayBloodGemsOn(\r\n\t\t\tinput.attacker,\r\n\t\t\tinput.attacker,\r\n\t\t\t1 * mult,\r\n\t\t\tinput.attackingBoard,\r\n\t\t\tinput.attackingHero,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
@@ -20,7 +20,7 @@ const process = (minion, input) => {
20
20
  const mult = minion.cardId === "BG33_245_G" ? 2 : 1;
21
21
  const candidates = input.attackingBoard.filter((e) => (0, utils_1.hasCorrectTribe)(e, input.attackingHero, reference_data_1.Race.DRAGON, input.gameState.anomalies, input.gameState.allCards));
22
22
  for (const target of candidates) {
23
- (0, stats_1.modifyStats)(target, minion, 1 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);
23
+ (0, stats_1.modifyStats)(target, input.attacker, 1 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);
24
24
  }
25
25
  return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
26
26
  };
@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E,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;KAC5G;IACD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { Race } from '@firestone-hs/reference-data';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { OnWheneverAnotherMinionAttacksCard, RallyCard } from '../../card.interface';\r\n\r\nexport const TwilightWatcher: OnWheneverAnotherMinionAttacksCard & RallyCard = {\r\n\tcardIds: [CardIds.TwilightWatcher_BG33_245, CardIds.TwilightWatcher_BG33_245_G],\r\n\tonWheneverAnotherMinionAttacks: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n};\r\n\r\nconst process = (minion: BoardEntity, input: OnAttackInput) => {\r\n\tif (\r\n\t\t!hasCorrectTribe(\r\n\t\t\tinput.attacker,\r\n\t\t\tinput.attackingHero,\r\n\t\t\tRace.DRAGON,\r\n\t\t\tinput.gameState.anomalies,\r\n\t\t\tinput.gameState.allCards,\r\n\t\t)\r\n\t) {\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t}\r\n\r\n\tconst mult = minion.cardId === CardIds.TwilightWatcher_BG33_245_G ? 2 : 1;\r\n\tconst candidates = input.attackingBoard.filter((e) =>\r\n\t\thasCorrectTribe(e, input.attackingHero, Race.DRAGON, input.gameState.anomalies, input.gameState.allCards),\r\n\t);\r\n\tfor (const target of candidates) {\r\n\t\tmodifyStats(target, minion, 1 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);\r\n\t}\r\n\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n};\r\n"]}
1
+ {"version":3,"file":"twilight-watcher.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/twilight-watcher.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,eAAe,GAAmD;IAC9E,OAAO,EAAE,0BAAsE;IAC/E,8BAA8B,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QAC7E,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACD,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;IAC7D,IACC,CAAC,IAAA,uBAAe,EACf,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,aAAa,EACnB,qBAAI,CAAC,MAAM,EACX,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,EACA;QACD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;KACtD;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACpD,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,qBAAI,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CACzG,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;QAChC,IAAA,mBAAW,EACV,MAAM,EACN,KAAK,CAAC,QAAQ,EACd,CAAC,GAAG,IAAI,EACR,CAAC,GAAG,IAAI,EACR,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;KACF;IACD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { OnWheneverAnotherMinionAttacksCard, RallyCard } from '../../card.interface';\r\n\r\nexport const TwilightWatcher: OnWheneverAnotherMinionAttacksCard & RallyCard = {\r\n\tcardIds: [CardIds.TwilightWatcher_BG33_245, CardIds.TwilightWatcher_BG33_245_G],\r\n\tonWheneverAnotherMinionAttacks: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n};\r\n\r\nconst process = (minion: BoardEntity, input: OnAttackInput) => {\r\n\tif (\r\n\t\t!hasCorrectTribe(\r\n\t\t\tinput.attacker,\r\n\t\t\tinput.attackingHero,\r\n\t\t\tRace.DRAGON,\r\n\t\t\tinput.gameState.anomalies,\r\n\t\t\tinput.gameState.allCards,\r\n\t\t)\r\n\t) {\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t}\r\n\r\n\tconst mult = minion.cardId === CardIds.TwilightWatcher_BG33_245_G ? 2 : 1;\r\n\tconst candidates = input.attackingBoard.filter((e) =>\r\n\t\thasCorrectTribe(e, input.attackingHero, Race.DRAGON, input.gameState.anomalies, input.gameState.allCards),\r\n\t);\r\n\tfor (const target of candidates) {\r\n\t\tmodifyStats(\r\n\t\t\ttarget,\r\n\t\t\tinput.attacker,\r\n\t\t\t1 * mult,\r\n\t\t\t3 * mult,\r\n\t\t\tinput.attackingBoard,\r\n\t\t\tinput.attackingHero,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t}\r\n\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n};\r\n"]}
@@ -6,9 +6,9 @@ exports.VengefulProtector = {
6
6
  cardIds: ["BG33_247", "BG33_247_G"],
7
7
  rally: (minion, input) => {
8
8
  const mult = minion.cardId === "BG33_247_G" ? 2 : 1;
9
- const candidates = input.attackingBoard.filter((e) => e !== minion);
9
+ const candidates = input.attackingBoard.filter((e) => e !== input.attacker);
10
10
  for (const target of candidates) {
11
- (0, stats_1.modifyStats)(target, minion, 3 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);
11
+ (0, stats_1.modifyStats)(target, input.attacker, 3 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);
12
12
  }
13
13
  return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
14
14
  },
@@ -1 +1 @@
1
- {"version":3,"file":"vengeful-protector.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/vengeful-protector.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,iBAAiB,GAAc;IAC3C,OAAO,EAAE,0BAA0E;IACnF,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;QACpE,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;YAChC,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SAC5G;QACD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\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\n\r\nexport const VengefulProtector: RallyCard = {\r\n\tcardIds: [CardIds.VengefulProtector_BG33_247, CardIds.VengefulProtector_BG33_247_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.VengefulProtector_BG33_247_G ? 2 : 1;\r\n\t\tconst candidates = input.attackingBoard.filter((e) => e !== minion);\r\n\t\tfor (const target of candidates) {\r\n\t\t\tmodifyStats(target, minion, 3 * mult, 3 * mult, input.attackingBoard, input.attackingHero, input.gameState);\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"vengeful-protector.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/vengeful-protector.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,iBAAiB,GAAc;IAC3C,OAAO,EAAE,0BAA0E;IACnF,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC5E,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;YAChC,IAAA,mBAAW,EACV,MAAM,EACN,KAAK,CAAC,QAAQ,EACd,CAAC,GAAG,IAAI,EACR,CAAC,GAAG,IAAI,EACR,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":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const VengefulProtector: RallyCard = {\r\n\tcardIds: [CardIds.VengefulProtector_BG33_247, CardIds.VengefulProtector_BG33_247_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.VengefulProtector_BG33_247_G ? 2 : 1;\r\n\t\tconst candidates = input.attackingBoard.filter((e) => e !== input.attacker);\r\n\t\tfor (const target of candidates) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tinput.attacker,\r\n\t\t\t\t3 * mult,\r\n\t\t\t\t3 * 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"]}
@@ -13,8 +13,8 @@ exports.VoidRay = {
13
13
  };
14
14
  const process = (minion, input) => {
15
15
  const mult = minion.cardId === "BG31_HERO_802pt5_G" ? 2 : 1;
16
- (0, stats_1.modifyStats)(input.attacker, minion, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);
17
- (0, stats_1.modifyStats)(minion, minion, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);
16
+ (0, stats_1.modifyStats)(input.attacker, input.attacker, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);
17
+ (0, stats_1.modifyStats)(input.attacker, input.attacker, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);
18
18
  return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
19
19
  };
20
20
  //# sourceMappingURL=void-ray.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"void-ray.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/void-ray.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,OAAO,GAAmD;IACtE,OAAO,EAAE,0CAAoF;IAC7F,8BAA8B,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QAC7E,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACD,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,yBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,IAAA,mBAAW,EAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7G,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACrG,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { OnWheneverAnotherMinionAttacksCard, RallyCard } from '../../card.interface';\r\n\r\nexport const VoidRay: OnWheneverAnotherMinionAttacksCard & RallyCard = {\r\n\tcardIds: [CardIds.WarpGate_VoidRayToken_BG31_HERO_802pt5, CardIds.VoidRay_BG31_HERO_802pt5_G],\r\n\tonWheneverAnotherMinionAttacks: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n};\r\n\r\nconst process = (minion: BoardEntity, input: OnAttackInput) => {\r\n\tconst mult = minion.cardId === CardIds.VoidRay_BG31_HERO_802pt5_G ? 2 : 1;\r\n\tmodifyStats(input.attacker, minion, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);\r\n\tmodifyStats(minion, minion, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);\r\n\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n};\r\n"]}
1
+ {"version":3,"file":"void-ray.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/void-ray.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,OAAO,GAAmD;IACtE,OAAO,EAAE,0CAAoF;IAC7F,8BAA8B,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QAC7E,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACD,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,yBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,IAAA,mBAAW,EACV,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,QAAQ,EACd,CAAC,GAAG,IAAI,EACR,CAAC,EACD,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;IACF,IAAA,mBAAW,EACV,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,QAAQ,EACd,CAAC,GAAG,IAAI,EACR,CAAC,EACD,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;IACF,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { OnWheneverAnotherMinionAttacksCard, RallyCard } from '../../card.interface';\r\n\r\nexport const VoidRay: OnWheneverAnotherMinionAttacksCard & RallyCard = {\r\n\tcardIds: [CardIds.WarpGate_VoidRayToken_BG31_HERO_802pt5, CardIds.VoidRay_BG31_HERO_802pt5_G],\r\n\tonWheneverAnotherMinionAttacks: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\treturn process(minion, input);\r\n\t},\r\n};\r\n\r\nconst process = (minion: BoardEntity, input: OnAttackInput) => {\r\n\tconst mult = minion.cardId === CardIds.VoidRay_BG31_HERO_802pt5_G ? 2 : 1;\r\n\tmodifyStats(\r\n\t\tinput.attacker,\r\n\t\tinput.attacker,\r\n\t\t5 * mult,\r\n\t\t0,\r\n\t\tinput.attackingBoard,\r\n\t\tinput.attackingHero,\r\n\t\tinput.gameState,\r\n\t);\r\n\tmodifyStats(\r\n\t\tinput.attacker,\r\n\t\tinput.attacker,\r\n\t\t5 * mult,\r\n\t\t0,\r\n\t\tinput.attackingBoard,\r\n\t\tinput.attackingHero,\r\n\t\tinput.gameState,\r\n\t);\r\n\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n};\r\n"]}
@@ -6,9 +6,9 @@ exports.WhirringProtector = {
6
6
  cardIds: ["BG33_807", "BG33_807_G"],
7
7
  rally: (minion, input) => {
8
8
  const mult = minion.cardId === "BG33_807_G" ? 2 : 1;
9
- const targets = input.attackingBoard.filter((e) => e !== minion);
9
+ const targets = input.attackingBoard.filter((e) => e !== input.attacker);
10
10
  for (const target of targets) {
11
- (0, stats_1.modifyStats)(target, minion, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);
11
+ (0, stats_1.modifyStats)(target, input.attacker, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);
12
12
  }
13
13
  return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
14
14
  },
@@ -1 +1 @@
1
- {"version":3,"file":"whirring-protector.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/whirring-protector.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,iBAAiB,GAAc;IAC3C,OAAO,EAAE,0BAA0E;IACnF,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;QACjE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SACrG;QACD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\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\n\r\nexport const WhirringProtector: RallyCard = {\r\n\tcardIds: [CardIds.WhirringProtector_BG33_807, CardIds.WhirringProtector_BG33_807_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.WhirringProtector_BG33_807_G ? 2 : 1;\r\n\t\tconst targets = input.attackingBoard.filter((e) => e !== minion);\r\n\t\tfor (const target of targets) {\r\n\t\t\tmodifyStats(target, minion, 5 * mult, 0, input.attackingBoard, input.attackingHero, input.gameState);\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"whirring-protector.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/whirring-protector.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,iBAAiB,GAAc;IAC3C,OAAO,EAAE,0BAA0E;IACnF,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,IAAA,mBAAW,EACV,MAAM,EACN,KAAK,CAAC,QAAQ,EACd,CAAC,GAAG,IAAI,EACR,CAAC,EACD,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":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const WhirringProtector: RallyCard = {\r\n\tcardIds: [CardIds.WhirringProtector_BG33_807, CardIds.WhirringProtector_BG33_807_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.WhirringProtector_BG33_807_G ? 2 : 1;\r\n\t\tconst targets = input.attackingBoard.filter((e) => e !== input.attacker);\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\t5 * mult,\r\n\t\t\t\t0,\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"]}
@@ -221,6 +221,7 @@ const VALID_DEATHRATTLE_ENCHANTMENTS = [
221
221
  "BG31_HERO_801ptee",
222
222
  "BG32_172e",
223
223
  "BG32_172_Ge",
224
+ "BG20_HERO_282e2",
224
225
  ];
225
226
  const validDeathrattleEnchantmentsFromMapping = [];
226
227
  const isValidDeathrattleEnchantment = (cardId) => {
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AAEA,iEAA+D;AAE/D,2DAAwE;AACxE,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA4C;AAC5C,yDAAqD;AAGrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;KACP;IAED,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,CACrB,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,WAAW,mCAAI,MAAA,WAAW,CAAC,OAAO,0CAAE,WAAW,EACtE,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,SAAS,mC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AC,GAAG,gBAAgB,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAE7D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAE,YAAoB,EAAE,UAAkB,EAAU,EAAE;IAChG,IAAI,YAAY,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,YAAY,KAAK,GAAG,IAAI,YAAY,KAAK,UAAU,EAAE;QACxD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAGF,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;CAyBtC,CAAC;AACF,MAAM,uCAAuC,GAAG,EAAE,CAAC;AAC5C,MAAM,6BAA6B,GAAG,CAAC,MAAc,EAAW,EAAE;IACxE,IAAI,8BAA8B,CAAC,QAAQ,CAAC,MAAiB,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,uCAAuC,CAAC,MAAM,KAAK,CAAC,EAAE;QACzD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE;YAEnD,IAAI,IAAA,+CAA8B,EAAC,QAAQ,CAAC,EAAE;gBAC7C,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAbW,QAAA,6BAA6B,iCAaxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { CardIds } from './services/card-ids';\nimport { AllCardsService } from '@firestone-hs/reference-data';\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleSpawnEnchantment } from './cards/card.interface';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cardMappings } from './cards/impl/_card-mappings';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWons: [],\r\n\t\tdamageWon: 0,\r\n\t\tdamageWonRange: null,\r\n\t\tdamageLosts: [],\r\n\t\tdamageLost: 0,\r\n\t\tdamageLostRange: null,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t// Avoid sending this verbose data\r\n\r\n\tsimulationResult.damageWons = [];\r\n\tsimulationResult.damageLosts = [];\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\r\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\r\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\r\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\r\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\r\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\r\n\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\r\n\tif (damageArray.length === 0) {\r\n\t\treturn { min: 0, max: 0 };\r\n\t}\r\n\r\n\t// Sort the array\r\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\r\n\r\n\t// Calculate the 10th and 90th percentiles\r\n\tconst percentile = (arr: number[], p: number) => {\r\n\t\tconst index = Math.floor(p * arr.length);\r\n\t\treturn arr[index];\r\n\t};\r\n\r\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\r\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\r\n\r\n\treturn { min: minDamage, max: maxDamage };\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\r\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172e,\r\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172_Ge,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\t// Also includes non-enchantments, but since we only match this against the enchants list, it's fine\r\n\t\t\tif (hasDeathrattleSpawnEnchantment(cardImpl)) {\r\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
1
+ {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAE/D,2DAAwE;AACxE,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA4C;AAC5C,yDAAqD;AAIrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;KACP;IAED,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,CACrB,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,WAAW,mCAAI,MAAA,WAAW,CAAC,OAAO,0CAAE,WAAW,EACtE,MAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,SAAS,mCAAI,EAAE,CAC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AgB,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAE7D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAE,YAAoB,EAAE,UAAkB,EAAU,EAAE;IAChG,IAAI,YAAY,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,YAAY,KAAK,GAAG,IAAI,YAAY,KAAK,UAAU,EAAE;QACxD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAGF,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;CA0BtC,CAAC;AACF,MAAM,uCAAuC,GAAG,EAAE,CAAC;AAC5C,MAAM,6BAA6B,GAAG,CAAC,MAAc,EAAW,EAAE;IACxE,IAAI,8BAA8B,CAAC,QAAQ,CAAC,MAAiB,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,uCAAuC,CAAC,MAAM,KAAK,CAAC,EAAE;QACzD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE;YAEnD,IAAI,IAAA,+CAA8B,EAAC,QAAQ,CAAC,EAAE;gBAC7C,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAbW,QAAA,6BAA6B,iCAaxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleSpawnEnchantment } from './cards/card.interface';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cardMappings } from './cards/impl/_card-mappings';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { CardIds } from './services/card-ids';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWons: [],\r\n\t\tdamageWon: 0,\r\n\t\tdamageWonRange: null,\r\n\t\tdamageLosts: [],\r\n\t\tdamageLost: 0,\r\n\t\tdamageLostRange: null,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t// Avoid sending this verbose data\r\n\r\n\tsimulationResult.damageWons = [];\r\n\tsimulationResult.damageLosts = [];\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\r\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\r\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\r\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\r\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\r\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\r\n\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\r\n\tif (damageArray.length === 0) {\r\n\t\treturn { min: 0, max: 0 };\r\n\t}\r\n\r\n\t// Sort the array\r\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\r\n\r\n\t// Calculate the 10th and 90th percentiles\r\n\tconst percentile = (arr: number[], p: number) => {\r\n\t\tconst index = Math.floor(p * arr.length);\r\n\t\treturn arr[index];\r\n\t};\r\n\r\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\r\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\r\n\r\n\treturn { min: minDamage, max: maxDamage };\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\r\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172e,\r\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172_Ge,\r\n\tCardIds.TamsinRoame_ImpendingSacrificeEnchantment_BG20_HERO_282e2,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\t// Also includes non-enchantments, but since we only match this against the enchants list, it's fine\r\n\t\t\tif (hasDeathrattleSpawnEnchantment(cardImpl)) {\r\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
@@ -62,7 +62,7 @@ const setMissingAura = (board, minionCardId, enchantmentCardId, attack, health,
62
62
  }
63
63
  };
64
64
  const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
65
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
65
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
66
66
  for (const heroPower of hero.heroPowers) {
67
67
  const avengeValue = cardsData.avengeValue(heroPower.cardId);
68
68
  if (avengeValue > 0) {
@@ -70,11 +70,7 @@ const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
70
70
  heroPower.avengeDefault = avengeValue;
71
71
  }
72
72
  if ((_b = heroPower.info) === null || _b === void 0 ? void 0 : _b.health) {
73
- const infoAvengeValue = cardsData.avengeValue(heroPower.info.cardId);
74
- if (infoAvengeValue > 0) {
75
- heroPower.info.avengeCurrent = infoAvengeValue;
76
- heroPower.info.avengeDefault = infoAvengeValue;
77
- }
73
+ (0, utils_1.addImpliedMechanics)(heroPower.info, cardsData);
78
74
  }
79
75
  }
80
76
  if (!!((_c = hero.questRewards) === null || _c === void 0 ? void 0 : _c.length) && !Array.isArray(hero.questRewards)) {
@@ -108,40 +104,41 @@ const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
108
104
  }));
109
105
  hero.entityId = hero.entityId || entityIdContainer.entityId--;
110
106
  hero.hand = (_f = hero.hand) !== null && _f !== void 0 ? _f : [];
107
+ hero.enchantments = (_g = hero.enchantments) !== null && _g !== void 0 ? _g : [];
111
108
  if (!hero.globalInfo) {
112
109
  hero.globalInfo = {};
113
110
  }
114
- hero.globalInfo.EternalKnightsDeadThisGame = (_g = hero.globalInfo.EternalKnightsDeadThisGame) !== null && _g !== void 0 ? _g : 0;
115
- hero.globalInfo.SanlaynScribesDeadThisGame = (_h = hero.globalInfo.SanlaynScribesDeadThisGame) !== null && _h !== void 0 ? _h : 0;
116
- hero.globalInfo.BeastsSummonedThisGame = (_j = hero.globalInfo.BeastsSummonedThisGame) !== null && _j !== void 0 ? _j : 0;
117
- hero.globalInfo.BeastsSummonedThisCombat = (_k = hero.globalInfo.BeastsSummonedThisCombat) !== null && _k !== void 0 ? _k : 0;
118
- hero.globalInfo.MagnetizedThisGame = (_l = hero.globalInfo.MagnetizedThisGame) !== null && _l !== void 0 ? _l : 0;
119
- hero.globalInfo.PiratesSummonedThisGame = (_m = hero.globalInfo.PiratesSummonedThisGame) !== null && _m !== void 0 ? _m : 0;
120
- hero.globalInfo.BattlecriesTriggeredThisGame = (_o = hero.globalInfo.BattlecriesTriggeredThisGame) !== null && _o !== void 0 ? _o : 0;
121
- hero.globalInfo.BeetleAttackBuff = (_p = hero.globalInfo.BeetleAttackBuff) !== null && _p !== void 0 ? _p : 0;
122
- hero.globalInfo.BeetleHealthBuff = (_q = hero.globalInfo.BeetleHealthBuff) !== null && _q !== void 0 ? _q : 0;
123
- hero.globalInfo.ElementalAttackBuff = (_r = hero.globalInfo.ElementalAttackBuff) !== null && _r !== void 0 ? _r : 0;
124
- hero.globalInfo.ElementalHealthBuff = (_s = hero.globalInfo.ElementalHealthBuff) !== null && _s !== void 0 ? _s : 0;
125
- hero.globalInfo.TavernSpellAttackBuff = (_t = hero.globalInfo.TavernSpellAttackBuff) !== null && _t !== void 0 ? _t : 0;
126
- hero.globalInfo.TavernSpellHealthBuff = (_u = hero.globalInfo.TavernSpellHealthBuff) !== null && _u !== void 0 ? _u : 0;
127
- hero.globalInfo.MutatedLasherAttackBuff = (_v = hero.globalInfo.MutatedLasherAttackBuff) !== null && _v !== void 0 ? _v : 0;
128
- hero.globalInfo.MutatedLasherHealthBuff = (_w = hero.globalInfo.MutatedLasherHealthBuff) !== null && _w !== void 0 ? _w : 0;
129
- hero.globalInfo.TavernSpellsCastThisGame = (_x = hero.globalInfo.TavernSpellsCastThisGame) !== null && _x !== void 0 ? _x : 0;
130
- hero.globalInfo.AdditionalAttack = (_y = hero.globalInfo.AdditionalAttack) !== null && _y !== void 0 ? _y : 0;
131
- hero.globalInfo.SpellsCastThisGame = (_z = hero.globalInfo.SpellsCastThisGame) !== null && _z !== void 0 ? _z : 0;
132
- hero.globalInfo.UndeadAttackBonus = (_0 = hero.globalInfo.UndeadAttackBonus) !== null && _0 !== void 0 ? _0 : 0;
133
- hero.globalInfo.HauntedCarapaceAttackBonus = (_1 = hero.globalInfo.HauntedCarapaceAttackBonus) !== null && _1 !== void 0 ? _1 : 0;
134
- hero.globalInfo.HauntedCarapaceHealthBonus = (_2 = hero.globalInfo.HauntedCarapaceHealthBonus) !== null && _2 !== void 0 ? _2 : 0;
135
- hero.globalInfo.FrostlingBonus = (_3 = hero.globalInfo.FrostlingBonus) !== null && _3 !== void 0 ? _3 : 0;
111
+ hero.globalInfo.EternalKnightsDeadThisGame = (_h = hero.globalInfo.EternalKnightsDeadThisGame) !== null && _h !== void 0 ? _h : 0;
112
+ hero.globalInfo.SanlaynScribesDeadThisGame = (_j = hero.globalInfo.SanlaynScribesDeadThisGame) !== null && _j !== void 0 ? _j : 0;
113
+ hero.globalInfo.BeastsSummonedThisGame = (_k = hero.globalInfo.BeastsSummonedThisGame) !== null && _k !== void 0 ? _k : 0;
114
+ hero.globalInfo.BeastsSummonedThisCombat = (_l = hero.globalInfo.BeastsSummonedThisCombat) !== null && _l !== void 0 ? _l : 0;
115
+ hero.globalInfo.MagnetizedThisGame = (_m = hero.globalInfo.MagnetizedThisGame) !== null && _m !== void 0 ? _m : 0;
116
+ hero.globalInfo.PiratesSummonedThisGame = (_o = hero.globalInfo.PiratesSummonedThisGame) !== null && _o !== void 0 ? _o : 0;
117
+ hero.globalInfo.BattlecriesTriggeredThisGame = (_p = hero.globalInfo.BattlecriesTriggeredThisGame) !== null && _p !== void 0 ? _p : 0;
118
+ hero.globalInfo.BeetleAttackBuff = (_q = hero.globalInfo.BeetleAttackBuff) !== null && _q !== void 0 ? _q : 0;
119
+ hero.globalInfo.BeetleHealthBuff = (_r = hero.globalInfo.BeetleHealthBuff) !== null && _r !== void 0 ? _r : 0;
120
+ hero.globalInfo.ElementalAttackBuff = (_s = hero.globalInfo.ElementalAttackBuff) !== null && _s !== void 0 ? _s : 0;
121
+ hero.globalInfo.ElementalHealthBuff = (_t = hero.globalInfo.ElementalHealthBuff) !== null && _t !== void 0 ? _t : 0;
122
+ hero.globalInfo.TavernSpellAttackBuff = (_u = hero.globalInfo.TavernSpellAttackBuff) !== null && _u !== void 0 ? _u : 0;
123
+ hero.globalInfo.TavernSpellHealthBuff = (_v = hero.globalInfo.TavernSpellHealthBuff) !== null && _v !== void 0 ? _v : 0;
124
+ hero.globalInfo.MutatedLasherAttackBuff = (_w = hero.globalInfo.MutatedLasherAttackBuff) !== null && _w !== void 0 ? _w : 0;
125
+ hero.globalInfo.MutatedLasherHealthBuff = (_x = hero.globalInfo.MutatedLasherHealthBuff) !== null && _x !== void 0 ? _x : 0;
126
+ hero.globalInfo.TavernSpellsCastThisGame = (_y = hero.globalInfo.TavernSpellsCastThisGame) !== null && _y !== void 0 ? _y : 0;
127
+ hero.globalInfo.AdditionalAttack = (_z = hero.globalInfo.AdditionalAttack) !== null && _z !== void 0 ? _z : 0;
128
+ hero.globalInfo.SpellsCastThisGame = (_0 = hero.globalInfo.SpellsCastThisGame) !== null && _0 !== void 0 ? _0 : 0;
129
+ hero.globalInfo.UndeadAttackBonus = (_1 = hero.globalInfo.UndeadAttackBonus) !== null && _1 !== void 0 ? _1 : 0;
130
+ hero.globalInfo.HauntedCarapaceAttackBonus = (_2 = hero.globalInfo.HauntedCarapaceAttackBonus) !== null && _2 !== void 0 ? _2 : 0;
131
+ hero.globalInfo.HauntedCarapaceHealthBonus = (_3 = hero.globalInfo.HauntedCarapaceHealthBonus) !== null && _3 !== void 0 ? _3 : 0;
132
+ hero.globalInfo.FrostlingBonus = (_4 = hero.globalInfo.FrostlingBonus) !== null && _4 !== void 0 ? _4 : 0;
136
133
  hero.globalInfo.BloodGemAttackBonus =
137
- ((_4 = hero.globalInfo.BloodGemAttackBonus) !== null && _4 !== void 0 ? _4 : 0) +
138
- ((_6 = (_5 = hero.questRewardEntities) === null || _5 === void 0 ? void 0 : _5.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _6 !== void 0 ? _6 : 0);
134
+ ((_5 = hero.globalInfo.BloodGemAttackBonus) !== null && _5 !== void 0 ? _5 : 0) +
135
+ ((_7 = (_6 = hero.questRewardEntities) === null || _6 === void 0 ? void 0 : _6.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _7 !== void 0 ? _7 : 0);
139
136
  hero.globalInfo.BloodGemHealthBonus =
140
- ((_7 = hero.globalInfo.BloodGemHealthBonus) !== null && _7 !== void 0 ? _7 : 0) +
141
- ((_9 = (_8 = hero.questRewardEntities) === null || _8 === void 0 ? void 0 : _8.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _9 !== void 0 ? _9 : 0);
142
- hero.globalInfo.GoldrinnBuffAtk = (_10 = hero.globalInfo.GoldrinnBuffAtk) !== null && _10 !== void 0 ? _10 : 0;
143
- hero.globalInfo.GoldrinnBuffHealth = (_11 = hero.globalInfo.GoldrinnBuffHealth) !== null && _11 !== void 0 ? _11 : 0;
144
- hero.globalInfo.GoldSpentThisGame = (_12 = hero.globalInfo.GoldSpentThisGame) !== null && _12 !== void 0 ? _12 : 0;
137
+ ((_8 = hero.globalInfo.BloodGemHealthBonus) !== null && _8 !== void 0 ? _8 : 0) +
138
+ ((_10 = (_9 = hero.questRewardEntities) === null || _9 === void 0 ? void 0 : _9.filter((e) => e.cardId === "BG27_Reward_815").length) !== null && _10 !== void 0 ? _10 : 0);
139
+ hero.globalInfo.GoldrinnBuffAtk = (_11 = hero.globalInfo.GoldrinnBuffAtk) !== null && _11 !== void 0 ? _11 : 0;
140
+ hero.globalInfo.GoldrinnBuffHealth = (_12 = hero.globalInfo.GoldrinnBuffHealth) !== null && _12 !== void 0 ? _12 : 0;
141
+ hero.globalInfo.GoldSpentThisGame = (_13 = hero.globalInfo.GoldSpentThisGame) !== null && _13 !== void 0 ? _13 : 0;
145
142
  };
146
143
  exports.setImplicitDataHero = setImplicitDataHero;
147
144
  const clearStealthIfNeeded = (board, hero, otherBoard, otherHero, gameState) => {
@@ -1 +1 @@
1
- {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAAqE;AAIrE,iDAAoD;AAEpD,oCAA2C;AAGpC,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA4B,EAC5B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,6BAAqB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;;IAC/F,KAAK,MAAM,OAAO,IAAI,MAAA,SAAS,CAAC,QAAQ,mCAAI,EAAE,EAAE;KAoB/C;AACF,CAAC,CAAC;AAtBW,QAAA,qBAAqB,yBAsBhC;AAEK,MAAM,u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,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t// \tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t// \tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t// \t2,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039_G,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => e.divineShield),\r\n\t// \tCardIds.CyborgDrake_BG25_043_G,\r\n\t// \tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t// \t12,\r\n\t// \t0,\r\n\t// \tfalse,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\tconst infoAvengeValue = cardsData.avengeValue((heroPower.info as BoardEntity).cardId);\r\n\t\t\tif (infoAvengeValue > 0) {\r\n\t\t\t\t(heroPower.info as BoardEntity).avengeCurrent = infoAvengeValue;\r\n\t\t\t\t(heroPower.info as BoardEntity).avengeDefault = infoAvengeValue;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? []).map((trinket) => ({\r\n\t\t...trinket,\r\n\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\tscriptDataNum1: trinket.scriptDataNum1 || cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t}));\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
1
+ {"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAAqE;AAIrE,iDAAoD;AAEpD,oCAAgE;AAGzD,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA4B,EAC5B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,6B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AAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t// \tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t// \tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t// \t2,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039_G,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => e.divineShield),\r\n\t// \tCardIds.CyborgDrake_BG25_043_G,\r\n\t// \tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t// \t12,\r\n\t// \t0,\r\n\t// \tfalse,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? []).map((trinket) => ({\r\n\t\t...trinket,\r\n\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\tscriptDataNum1: trinket.scriptDataNum1 || cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t}));\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
@@ -640,7 +640,7 @@ const spawnEntitiesFromEnchantments = (deadEntity, boardWithDeadEntity, boardWit
640
640
  const deathrattleImpl = _card_mappings_1.cardMappings[enchantment.cardId];
641
641
  if ((0, card_interface_1.hasDeathrattleSpawnEnchantment)(deathrattleImpl)) {
642
642
  for (let i = 0; i < multiplier; i++) {
643
- const spawns = deathrattleImpl.deathrattleSpawnEnchantmentEffect(enchantment, deathrattleTriggeredInput);
643
+ const spawns = deathrattleImpl.deathrattleSpawnEnchantmentEffect(enchantment, deadEntity, deathrattleTriggeredInput);
644
644
  if (!!(spawns === null || spawns === void 0 ? void 0 : spawns.length)) {
645
645
  spawnedEntities.push(...spawns);
646
646
  }