@firestone-hs/simulate-bgs-battle 1.1.502 → 1.1.504

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 (228) hide show
  1. package/dist/cards/card.interface.d.ts +7 -3
  2. package/dist/cards/card.interface.js +3 -1
  3. package/dist/cards/card.interface.js.map +1 -1
  4. package/dist/cards/cards-data.js +0 -2
  5. package/dist/cards/cards-data.js.map +1 -1
  6. package/dist/cards/impl/_card-mappings.js +101 -1
  7. package/dist/cards/impl/_card-mappings.js.map +1 -1
  8. package/dist/cards/impl/minion/admiral-eliza-goreblade.d.ts +2 -0
  9. package/dist/cards/impl/minion/admiral-eliza-goreblade.js +20 -0
  10. package/dist/cards/impl/minion/admiral-eliza-goreblade.js.map +1 -0
  11. package/dist/cards/impl/minion/anubarak-nerubian-king.d.ts +2 -0
  12. package/dist/cards/impl/minion/anubarak-nerubian-king.js +15 -0
  13. package/dist/cards/impl/minion/anubarak-nerubian-king.js.map +1 -0
  14. package/dist/cards/impl/minion/arcane-cannoneer.js +3 -0
  15. package/dist/cards/impl/minion/arcane-cannoneer.js.map +1 -1
  16. package/dist/cards/impl/minion/arid-atrocity.d.ts +2 -0
  17. package/dist/cards/impl/minion/arid-atrocity.js +22 -0
  18. package/dist/cards/impl/minion/arid-atrocity.js.map +1 -0
  19. package/dist/cards/impl/minion/assistant-guard.d.ts +2 -0
  20. package/dist/cards/impl/minion/assistant-guard.js +20 -0
  21. package/dist/cards/impl/minion/assistant-guard.js.map +1 -0
  22. package/dist/cards/impl/minion/bannerboar.d.ts +1 -1
  23. package/dist/cards/impl/minion/bannerboar.js +4 -4
  24. package/dist/cards/impl/minion/bannerboar.js.map +1 -1
  25. package/dist/cards/impl/minion/beetle.js +3 -3
  26. package/dist/cards/impl/minion/beetle.js.map +1 -1
  27. package/dist/cards/impl/minion/blazing-skyfin.d.ts +2 -0
  28. package/dist/cards/impl/minion/blazing-skyfin.js +12 -0
  29. package/dist/cards/impl/minion/blazing-skyfin.js.map +1 -0
  30. package/dist/cards/impl/minion/bongo-bopper.d.ts +2 -0
  31. package/dist/cards/impl/minion/bongo-bopper.js +15 -0
  32. package/dist/cards/impl/minion/bongo-bopper.js.map +1 -0
  33. package/dist/cards/impl/minion/champion-of-the-primus.d.ts +2 -0
  34. package/dist/cards/impl/minion/champion-of-the-primus.js +15 -0
  35. package/dist/cards/impl/minion/champion-of-the-primus.js.map +1 -0
  36. package/dist/cards/impl/minion/charlga.d.ts +2 -0
  37. package/dist/cards/impl/minion/charlga.js +15 -0
  38. package/dist/cards/impl/minion/charlga.js.map +1 -0
  39. package/dist/cards/impl/minion/clunker-junker.d.ts +2 -0
  40. package/dist/cards/impl/minion/clunker-junker.js +24 -0
  41. package/dist/cards/impl/minion/clunker-junker.js.map +1 -0
  42. package/dist/cards/impl/minion/corrupted-myrmidon.d.ts +2 -5
  43. package/dist/cards/impl/minion/corrupted-myrmidon.js +1 -0
  44. package/dist/cards/impl/minion/corrupted-myrmidon.js.map +1 -1
  45. package/dist/cards/impl/minion/cruise-controller.d.ts +2 -0
  46. package/dist/cards/impl/minion/cruise-controller.js +11 -0
  47. package/dist/cards/impl/minion/cruise-controller.js.map +1 -0
  48. package/dist/cards/impl/minion/defiant-shipwright.d.ts +2 -0
  49. package/dist/cards/impl/minion/defiant-shipwright.js +13 -0
  50. package/dist/cards/impl/minion/defiant-shipwright.js.map +1 -0
  51. package/dist/cards/impl/minion/deflecto-bot.d.ts +2 -0
  52. package/dist/cards/impl/minion/deflecto-bot.js +21 -0
  53. package/dist/cards/impl/minion/deflecto-bot.js.map +1 -0
  54. package/dist/cards/impl/minion/efficient-engineer.js +8 -1
  55. package/dist/cards/impl/minion/efficient-engineer.js.map +1 -1
  56. package/dist/cards/impl/minion/fairy-gillmother.js +2 -2
  57. package/dist/cards/impl/minion/fairy-gillmother.js.map +1 -1
  58. package/dist/cards/impl/minion/gem-smuggler.d.ts +2 -0
  59. package/dist/cards/impl/minion/gem-smuggler.js +14 -0
  60. package/dist/cards/impl/minion/gem-smuggler.js.map +1 -0
  61. package/dist/cards/impl/minion/general-drakkisath.d.ts +2 -0
  62. package/dist/cards/impl/minion/general-drakkisath.js +17 -0
  63. package/dist/cards/impl/minion/general-drakkisath.js.map +1 -0
  64. package/dist/cards/impl/minion/grease-bot.d.ts +2 -0
  65. package/dist/cards/impl/minion/grease-bot.js +13 -0
  66. package/dist/cards/impl/minion/grease-bot.js.map +1 -0
  67. package/dist/cards/impl/minion/holo-rover.js +3 -0
  68. package/dist/cards/impl/minion/holo-rover.js.map +1 -1
  69. package/dist/cards/impl/minion/hungry-snapjaw.js +2 -2
  70. package/dist/cards/impl/minion/hungry-snapjaw.js.map +1 -1
  71. package/dist/cards/impl/minion/hunter-of-gatherers.d.ts +2 -0
  72. package/dist/cards/impl/minion/hunter-of-gatherers.js +13 -0
  73. package/dist/cards/impl/minion/hunter-of-gatherers.js.map +1 -0
  74. package/dist/cards/impl/minion/implant-subject.js +2 -2
  75. package/dist/cards/impl/minion/implant-subject.js.map +1 -1
  76. package/dist/cards/impl/minion/impulsive-trickster.d.ts +2 -0
  77. package/dist/cards/impl/minion/impulsive-trickster.js +14 -0
  78. package/dist/cards/impl/minion/impulsive-trickster.js.map +1 -0
  79. package/dist/cards/impl/minion/inspiring-underdog.d.ts +2 -0
  80. package/dist/cards/impl/minion/inspiring-underdog.js +18 -0
  81. package/dist/cards/impl/minion/inspiring-underdog.js.map +1 -0
  82. package/dist/cards/impl/minion/interrogator-whitemane.d.ts +2 -5
  83. package/dist/cards/impl/minion/interrogator-whitemane.js +1 -0
  84. package/dist/cards/impl/minion/interrogator-whitemane.js.map +1 -1
  85. package/dist/cards/impl/minion/kalecgos-arcane-aspect.d.ts +2 -0
  86. package/dist/cards/impl/minion/kalecgos-arcane-aspect.js +13 -0
  87. package/dist/cards/impl/minion/kalecgos-arcane-aspect.js.map +1 -0
  88. package/dist/cards/impl/minion/kangors-apprentice.d.ts +2 -0
  89. package/dist/cards/impl/minion/kangors-apprentice.js +21 -0
  90. package/dist/cards/impl/minion/kangors-apprentice.js.map +1 -0
  91. package/dist/cards/impl/minion/king-bagurgle.d.ts +2 -0
  92. package/dist/cards/impl/minion/king-bagurgle.js +12 -0
  93. package/dist/cards/impl/minion/king-bagurgle.js.map +1 -0
  94. package/dist/cards/impl/minion/leeroy-the-reckless.d.ts +2 -0
  95. package/dist/cards/impl/minion/leeroy-the-reckless.js +12 -0
  96. package/dist/cards/impl/minion/leeroy-the-reckless.js.map +1 -0
  97. package/dist/cards/impl/minion/lightfang-enforcer.d.ts +2 -0
  98. package/dist/cards/impl/minion/lightfang-enforcer.js +13 -0
  99. package/dist/cards/impl/minion/lightfang-enforcer.js.map +1 -0
  100. package/dist/cards/impl/minion/lovesick-balladist.d.ts +2 -0
  101. package/dist/cards/impl/minion/lovesick-balladist.js +25 -0
  102. package/dist/cards/impl/minion/lovesick-balladist.js.map +1 -0
  103. package/dist/cards/impl/minion/mecha-jaraxxus.d.ts +2 -0
  104. package/dist/cards/impl/minion/mecha-jaraxxus.js +12 -0
  105. package/dist/cards/impl/minion/mecha-jaraxxus.js.map +1 -0
  106. package/dist/cards/impl/minion/misfit-dragonling.d.ts +2 -5
  107. package/dist/cards/impl/minion/misfit-dragonling.js +1 -0
  108. package/dist/cards/impl/minion/misfit-dragonling.js.map +1 -1
  109. package/dist/cards/impl/minion/mummifier.d.ts +2 -0
  110. package/dist/cards/impl/minion/mummifier.js +25 -0
  111. package/dist/cards/impl/minion/mummifier.js.map +1 -0
  112. package/dist/cards/impl/minion/murky.d.ts +2 -0
  113. package/dist/cards/impl/minion/murky.js +20 -0
  114. package/dist/cards/impl/minion/murky.js.map +1 -0
  115. package/dist/cards/impl/minion/mutated-lasher.d.ts +2 -2
  116. package/dist/cards/impl/minion/mutated-lasher.js +3 -3
  117. package/dist/cards/impl/minion/mutated-lasher.js.map +1 -1
  118. package/dist/cards/impl/minion/neon-agent.js +3 -0
  119. package/dist/cards/impl/minion/neon-agent.js.map +1 -1
  120. package/dist/cards/impl/minion/nerubian-deathswarmer.d.ts +2 -0
  121. package/dist/cards/impl/minion/nerubian-deathswarmer.js +16 -0
  122. package/dist/cards/impl/minion/nerubian-deathswarmer.js.map +1 -0
  123. package/dist/cards/impl/minion/niuzao.js +3 -0
  124. package/dist/cards/impl/minion/niuzao.js.map +1 -1
  125. package/dist/cards/impl/minion/oozeling-gladiator.d.ts +2 -0
  126. package/dist/cards/impl/minion/oozeling-gladiator.js +14 -0
  127. package/dist/cards/impl/minion/oozeling-gladiator.js.map +1 -0
  128. package/dist/cards/impl/minion/operatic-belcher.d.ts +2 -0
  129. package/dist/cards/impl/minion/operatic-belcher.js +26 -0
  130. package/dist/cards/impl/minion/operatic-belcher.js.map +1 -0
  131. package/dist/cards/impl/minion/parched-wanderer.d.ts +2 -0
  132. package/dist/cards/impl/minion/parched-wanderer.js +20 -0
  133. package/dist/cards/impl/minion/parched-wanderer.js.map +1 -0
  134. package/dist/cards/impl/minion/peggy-sturdybone.d.ts +2 -0
  135. package/dist/cards/impl/minion/peggy-sturdybone.js +17 -0
  136. package/dist/cards/impl/minion/peggy-sturdybone.js.map +1 -0
  137. package/dist/cards/impl/minion/primalfin-lookout.d.ts +2 -0
  138. package/dist/cards/impl/minion/primalfin-lookout.js +27 -0
  139. package/dist/cards/impl/minion/primalfin-lookout.js.map +1 -0
  140. package/dist/cards/impl/minion/prized-promo-drake.d.ts +2 -5
  141. package/dist/cards/impl/minion/prized-promo-drake.js +1 -0
  142. package/dist/cards/impl/minion/prized-promo-drake.js.map +1 -1
  143. package/dist/cards/impl/minion/rapscallion-recruiter.d.ts +2 -0
  144. package/dist/cards/impl/minion/rapscallion-recruiter.js +13 -0
  145. package/dist/cards/impl/minion/rapscallion-recruiter.js.map +1 -0
  146. package/dist/cards/impl/minion/razorfen-geomancer.d.ts +2 -0
  147. package/dist/cards/impl/minion/razorfen-geomancer.js +14 -0
  148. package/dist/cards/impl/minion/razorfen-geomancer.js.map +1 -0
  149. package/dist/cards/impl/minion/reckless-cliffdiver.js +1 -1
  150. package/dist/cards/impl/minion/reckless-cliffdiver.js.map +1 -1
  151. package/dist/cards/impl/minion/ripsnarl-captain.d.ts +2 -0
  152. package/dist/cards/impl/minion/ripsnarl-captain.js +18 -0
  153. package/dist/cards/impl/minion/ripsnarl-captain.js.map +1 -0
  154. package/dist/cards/impl/minion/rodeo-performer.d.ts +2 -0
  155. package/dist/cards/impl/minion/rodeo-performer.js +12 -0
  156. package/dist/cards/impl/minion/rodeo-performer.js.map +1 -0
  157. package/dist/cards/impl/minion/scallywag.d.ts +2 -0
  158. package/dist/cards/impl/minion/scallywag.js +13 -0
  159. package/dist/cards/impl/minion/scallywag.js.map +1 -0
  160. package/dist/cards/impl/minion/shell-collector.d.ts +2 -0
  161. package/dist/cards/impl/minion/shell-collector.js +14 -0
  162. package/dist/cards/impl/minion/shell-collector.js.map +1 -0
  163. package/dist/cards/impl/minion/sinodorei-straight-shot.d.ts +2 -0
  164. package/dist/cards/impl/minion/sinodorei-straight-shot.js +14 -0
  165. package/dist/cards/impl/minion/sinodorei-straight-shot.js.map +1 -0
  166. package/dist/cards/impl/minion/sky-pirate-flagbearer-enchantment.d.ts +2 -0
  167. package/dist/cards/impl/minion/sky-pirate-flagbearer-enchantment.js +16 -0
  168. package/dist/cards/impl/minion/sky-pirate-flagbearer-enchantment.js.map +1 -0
  169. package/dist/cards/impl/minion/sky-pirate-flagbearer.d.ts +2 -5
  170. package/dist/cards/impl/minion/sky-pirate-flagbearer.js +1 -0
  171. package/dist/cards/impl/minion/sky-pirate-flagbearer.js.map +1 -1
  172. package/dist/cards/impl/minion/smolderwing.d.ts +2 -0
  173. package/dist/cards/impl/minion/smolderwing.js +25 -0
  174. package/dist/cards/impl/minion/smolderwing.js.map +1 -0
  175. package/dist/cards/impl/minion/spacefarer.js +4 -2
  176. package/dist/cards/impl/minion/spacefarer.js.map +1 -1
  177. package/dist/cards/impl/minion/swampstriker.d.ts +2 -0
  178. package/dist/cards/impl/minion/swampstriker.js +21 -0
  179. package/dist/cards/impl/minion/swampstriker.js.map +1 -0
  180. package/dist/cards/impl/minion/three-lil-quilboar.d.ts +2 -0
  181. package/dist/cards/impl/minion/three-lil-quilboar.js +16 -0
  182. package/dist/cards/impl/minion/three-lil-quilboar.js.map +1 -0
  183. package/dist/cards/impl/minion/thundering-abomination.d.ts +2 -0
  184. package/dist/cards/impl/minion/thundering-abomination.js +13 -0
  185. package/dist/cards/impl/minion/thundering-abomination.js.map +1 -0
  186. package/dist/cards/impl/minion/tunnel-blaster.d.ts +2 -0
  187. package/dist/cards/impl/minion/tunnel-blaster.js +20 -0
  188. package/dist/cards/impl/minion/tunnel-blaster.js.map +1 -0
  189. package/dist/cards/impl/minion/wandering-wight.js +1 -1
  190. package/dist/cards/impl/minion/wandering-wight.js.map +1 -1
  191. package/dist/cards/impl/minion/whelp-smuggler.d.ts +2 -0
  192. package/dist/cards/impl/minion/whelp-smuggler.js +18 -0
  193. package/dist/cards/impl/minion/whelp-smuggler.js.map +1 -0
  194. package/dist/cards/impl/trinket/automaton-portrait.js +1 -0
  195. package/dist/cards/impl/trinket/automaton-portrait.js.map +1 -1
  196. package/dist/cards/impl/trinket/karazhan-chess-set.js +2 -1
  197. package/dist/cards/impl/trinket/karazhan-chess-set.js.map +1 -1
  198. package/dist/cards/impl/trinket/rusty-trident.js +1 -0
  199. package/dist/cards/impl/trinket/rusty-trident.js.map +1 -1
  200. package/dist/keywords/divine-shield.d.ts +2 -0
  201. package/dist/keywords/divine-shield.js +3 -11
  202. package/dist/keywords/divine-shield.js.map +1 -1
  203. package/dist/simulate-bgs-battle.js +1 -5
  204. package/dist/simulate-bgs-battle.js.map +1 -1
  205. package/dist/simulation/add-minion-to-board.d.ts +13 -6
  206. package/dist/simulation/add-minion-to-board.js +20 -38
  207. package/dist/simulation/add-minion-to-board.js.map +1 -1
  208. package/dist/simulation/avenge.js +0 -6
  209. package/dist/simulation/avenge.js.map +1 -1
  210. package/dist/simulation/battlecries.js +16 -188
  211. package/dist/simulation/battlecries.js.map +1 -1
  212. package/dist/simulation/cards-in-hand.js +0 -9
  213. package/dist/simulation/cards-in-hand.js.map +1 -1
  214. package/dist/simulation/deathrattle-effects.js +0 -103
  215. package/dist/simulation/deathrattle-effects.js.map +1 -1
  216. package/dist/simulation/deathrattle-spawns.js +0 -48
  217. package/dist/simulation/deathrattle-spawns.js.map +1 -1
  218. package/dist/simulation/on-attack.d.ts +1 -0
  219. package/dist/simulation/on-attack.js +16 -42
  220. package/dist/simulation/on-attack.js.map +1 -1
  221. package/dist/simulation/on-being-attacked.js +0 -7
  222. package/dist/simulation/on-being-attacked.js.map +1 -1
  223. package/dist/simulation/start-of-combat/soc-action-processor.js +0 -16
  224. package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
  225. package/dist/simulation/stats.d.ts +1 -0
  226. package/dist/simulation/stats.js +5 -18
  227. package/dist/simulation/stats.js.map +1 -1
  228. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThunderingAbomination = void 0;
4
+ const stats_1 = require("../../../simulation/stats");
5
+ exports.ThunderingAbomination = {
6
+ cardIds: ["BG30_124", "BG30_124_G"],
7
+ onOtherSpawned: (minion, input) => {
8
+ const abomStatsMultiplier = minion.cardId === "BG30_124_G" ? 2 : 1;
9
+ (0, stats_1.modifyStats)(input.spawned, abomStatsMultiplier * 3, abomStatsMultiplier * 3, input.board, input.hero, input.gameState);
10
+ input.gameState.spectator.registerPowerTarget(minion, input.spawned, input.board, input.hero, input.otherHero);
11
+ },
12
+ };
13
+ //# sourceMappingURL=thundering-abomination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thundering-abomination.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/thundering-abomination.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,qBAAqB,GAAuB;IACxD,OAAO,EAAE,0BAAkF;IAC3F,cAAc,EAAE,CAAC,MAAmB,EAAE,KAAwB,EAAE,EAAE;QACjE,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,iBAA6C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/F,IAAA,mBAAW,EACV,KAAK,CAAC,OAAO,EACb,mBAAmB,GAAG,CAAC,EACvB,mBAAmB,GAAG,CAAC,EACvB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,CACf,CAAC;QACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChH,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { OnOtherSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { OnOtherSpawnedCard } from '../../card.interface';\r\n\r\nexport const ThunderingAbomination: OnOtherSpawnedCard = {\r\n\tcardIds: [CardIds.ThunderingAbomination_BG30_124, CardIds.ThunderingAbomination_BG30_124_G],\r\n\tonOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => {\r\n\t\tconst abomStatsMultiplier = minion.cardId === CardIds.ThunderingAbomination_BG30_124_G ? 2 : 1;\r\n\t\tmodifyStats(\r\n\t\t\tinput.spawned,\r\n\t\t\tabomStatsMultiplier * 3,\r\n\t\t\tabomStatsMultiplier * 3,\r\n\t\t\tinput.board,\r\n\t\t\tinput.hero,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t\tinput.gameState.spectator.registerPowerTarget(minion, input.spawned, input.board, input.hero, input.otherHero);\r\n\t},\r\n};\r\n"]}
@@ -0,0 +1,2 @@
1
+ import { DeathrattleEffectCard } from '../../card.interface';
2
+ export declare const TunnelBlaster: DeathrattleEffectCard;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TunnelBlaster = void 0;
4
+ const attack_1 = require("../../../simulation/attack");
5
+ exports.TunnelBlaster = {
6
+ cardIds: ["BG_DAL_775", "BG_DAL_775_G"],
7
+ deathrattleEffect: (minion, input) => {
8
+ const loops = minion.cardId === "BG_DAL_775_G" ? 2 : 1;
9
+ const minionsToDamage = [...input.boardWithDeadEntity, ...input.otherBoard];
10
+ for (let j = 0; j < loops; j++) {
11
+ for (const target of minionsToDamage) {
12
+ const isSameSide = target.friendly === minion.friendly;
13
+ const board = isSameSide ? input.boardWithDeadEntity : input.otherBoard;
14
+ const hero = isSameSide ? input.boardWithDeadEntityHero : input.otherBoardHero;
15
+ (0, attack_1.dealDamageToMinion)(target, board, hero, minion, 3, isSameSide ? input.otherBoard : input.boardWithDeadEntity, isSameSide ? input.otherBoardHero : input.boardWithDeadEntityHero, input.gameState);
16
+ }
17
+ }
18
+ },
19
+ };
20
+ //# sourceMappingURL=tunnel-blaster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tunnel-blaster.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tunnel-blaster.ts"],"names":[],"mappings":";;;AAEA,uDAAgE;AAInD,QAAA,aAAa,GAA0B;IACnD,OAAO,EAAE,8BAAsE;IAC/E,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,mBAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3E,MAAM,eAAe,GAAG,CAAC,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;QAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC/B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;gBACrC,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;gBACvD,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;gBACxE,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;gBAC/E,IAAA,2BAAkB,EACjB,MAAM,EACN,KAAK,EACL,IAAI,EACJ,MAAM,EACN,CAAC,EACD,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,EACzD,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB,EACjE,KAAK,CAAC,SAAS,CACf,CAAC;aACF;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { dealDamageToMinion } from '../../../simulation/attack';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { DeathrattleEffectCard } from '../../card.interface';\r\n\r\nexport const TunnelBlaster: DeathrattleEffectCard = {\r\n\tcardIds: [CardIds.TunnelBlaster_BG_DAL_775, CardIds.TunnelBlaster_BG_DAL_775_G],\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst loops = minion.cardId === CardIds.TunnelBlaster_BG_DAL_775_G ? 2 : 1;\r\n\t\t// In case there are spawns, don't target them\r\n\t\tconst minionsToDamage = [...input.boardWithDeadEntity, ...input.otherBoard];\r\n\t\tfor (let j = 0; j < loops; j++) {\r\n\t\t\tfor (const target of minionsToDamage) {\r\n\t\t\t\tconst isSameSide = target.friendly === minion.friendly;\r\n\t\t\t\tconst board = isSameSide ? input.boardWithDeadEntity : input.otherBoard;\r\n\t\t\t\tconst hero = isSameSide ? input.boardWithDeadEntityHero : input.otherBoardHero;\r\n\t\t\t\tdealDamageToMinion(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\t3,\r\n\t\t\t\t\tisSameSide ? input.otherBoard : input.boardWithDeadEntity,\r\n\t\t\t\t\tisSameSide ? input.otherBoardHero : input.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -6,7 +6,7 @@ exports.WanderingWight = {
6
6
  cardIds: ["", ""],
7
7
  afterOtherSpawned: (minion, input) => {
8
8
  const mult = minion.cardId === "" ? 1 : 2;
9
- (0, stats_1.modifyStats)(minion, 0, minion.attack * mult, input.playerBoard, input.playerEntity, input.gameState);
9
+ (0, stats_1.modifyStats)(minion, 0, minion.attack * mult, input.board, input.hero, input.gameState);
10
10
  },
11
11
  };
12
12
  //# sourceMappingURL=wandering-wight.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wandering-wight.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wandering-wight.ts"],"names":[],"mappings":";;;AAEA,qDAAwD;AAI3C,QAAA,cAAc,GAA0B;IACpD,OAAO,EAAE,QAA0D;IACnE,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAwB,EAAE,EAAE;QACpE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,OAA+B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,IAAA,mBAAW,EAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACtG,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { OnOtherSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { TempCardIds } from '../../../temp-card-ids';\r\nimport { AfterOtherSpawnedCard } from '../../card.interface';\r\n\r\nexport const WanderingWight: AfterOtherSpawnedCard = {\r\n\tcardIds: [TempCardIds.WanderingWight, TempCardIds.WanderingWight_G],\r\n\tafterOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => {\r\n\t\tconst mult = minion.cardId === TempCardIds.WanderingWight ? 1 : 2;\r\n\t\tmodifyStats(minion, 0, minion.attack * mult, input.playerBoard, input.playerEntity, input.gameState);\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"wandering-wight.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wandering-wight.ts"],"names":[],"mappings":";;;AAEA,qDAAwD;AAI3C,QAAA,cAAc,GAA0B;IACpD,OAAO,EAAE,QAA0D;IACnE,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAA4B,EAAE,EAAE;QACxE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,OAA+B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,IAAA,mBAAW,EAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACxF,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { OnOtherSpawnAuraInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { TempCardIds } from '../../../temp-card-ids';\r\nimport { AfterOtherSpawnedCard } from '../../card.interface';\r\n\r\nexport const WanderingWight: AfterOtherSpawnedCard = {\r\n\tcardIds: [TempCardIds.WanderingWight, TempCardIds.WanderingWight_G],\r\n\tafterOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnAuraInput) => {\r\n\t\tconst mult = minion.cardId === TempCardIds.WanderingWight ? 1 : 2;\r\n\t\tmodifyStats(minion, 0, minion.attack * mult, input.board, input.hero, input.gameState);\r\n\t},\r\n};\r\n"]}
@@ -0,0 +1,2 @@
1
+ import { OnStatsChangedCard } from '../../card.interface';
2
+ export declare const WhelpSmuggler: OnStatsChangedCard;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhelpSmuggler = void 0;
4
+ const reference_data_1 = require("@firestone-hs/reference-data");
5
+ const stats_1 = require("../../../simulation/stats");
6
+ const utils_1 = require("../../../utils");
7
+ exports.WhelpSmuggler = {
8
+ cardIds: ["BG21_013", "BG21_013_G"],
9
+ onStatsChanged: (minion, input) => {
10
+ if ((0, utils_1.hasCorrectTribe)(input.target, input.hero, reference_data_1.Race.DRAGON, input.gameState.allCards) &&
11
+ input.attackAmount > 0) {
12
+ const buff = minion.cardId === "BG21_013_G" ? 2 : 1;
13
+ (0, stats_1.modifyStats)(input.target, 0, buff, input.board, input.hero, input.gameState);
14
+ input.gameState.spectator.registerPowerTarget(minion, input.target, input.board, input.hero, input.otherHero);
15
+ }
16
+ },
17
+ };
18
+ //# sourceMappingURL=whelp-smuggler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whelp-smuggler.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/whelp-smuggler.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAE7D,qDAA6E;AAC7E,0CAAiD;AAGpC,QAAA,aAAa,GAAuB;IAChD,OAAO,EAAE,0BAAkE;IAC3E,cAAc,EAAE,CAAC,MAAmB,EAAE,KAA0B,EAAE,EAAE;QACnE,IACC,IAAA,uBAAe,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,qBAAI,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;YAChF,KAAK,CAAC,YAAY,GAAG,CAAC,EACrB;YACD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAqC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACxE,IAAA,mBAAW,EAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YAC7E,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,MAAM,EACN,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,CACf,CAAC;SACF;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { modifyStats, OnStatsChangedInput } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { OnStatsChangedCard } from '../../card.interface';\r\n\r\nexport const WhelpSmuggler: OnStatsChangedCard = {\r\n\tcardIds: [CardIds.WhelpSmuggler_BG21_013, CardIds.WhelpSmuggler_BG21_013_G],\r\n\tonStatsChanged: (minion: BoardEntity, input: OnStatsChangedInput) => {\r\n\t\tif (\r\n\t\t\thasCorrectTribe(input.target, input.hero, Race.DRAGON, input.gameState.allCards) &&\r\n\t\t\tinput.attackAmount > 0\r\n\t\t) {\r\n\t\t\tconst buff = minion.cardId === CardIds.WhelpSmuggler_BG21_013_G ? 2 : 1;\r\n\t\t\tmodifyStats(input.target, 0, buff, input.board, input.hero, input.gameState);\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\tminion,\r\n\t\t\t\tinput.target,\r\n\t\t\t\tinput.board,\r\n\t\t\t\tinput.hero,\r\n\t\t\t\tinput.otherHero,\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -4,6 +4,7 @@ exports.AutomatonPortrait = void 0;
4
4
  const deathrattle_spawns_1 = require("../../../simulation/deathrattle-spawns");
5
5
  const spawns_1 = require("../../../simulation/spawns");
6
6
  exports.AutomatonPortrait = {
7
+ cardIds: ["BG30_MagicItem_303"],
7
8
  startOfCombat: (trinket, input) => {
8
9
  if (input.playerBoard.length < 7) {
9
10
  const newMinions = (0, deathrattle_spawns_1.spawnEntities)("BG_TTN_401", 1, input.playerBoard, input.playerEntity, input.opponentBoard, input.opponentEntity, input.gameState.allCards, input.gameState.cardsData, input.gameState.sharedState, input.gameState.spectator, input.playerEntity.friendly, false);
@@ -1 +1 @@
1
- {"version":3,"file":"automaton-portrait.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/automaton-portrait.ts"],"names":[],"mappings":";;;AAEA,+EAAuE;AACvE,uDAAiE;AAIpD,QAAA,iBAAiB,GAAsB;IACnD,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,MAAM,UAAU,GAAG,IAAA,kCAAa,gBAE/B,CAAC,EACD,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CAAC,QAAQ,EACxB,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,WAAW,EAC3B,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,YAAY,CAAC,QAAQ,EAC3B,KAAK,CACL,CAAC;YACF,IAAA,4BAAmB,EAClB,UAAU,EACV,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,YAAY,EAClB,CAAC,EACD,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;YACF,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,8BAA8B,EAAE,IAAI,EAAE,CAAC;SACpE;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { performEntitySpawns } from '../../../simulation/spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const AutomatonPortrait: StartOfCombatCard = {\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tif (input.playerBoard.length < 7) {\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tCardIds.AstralAutomaton_BG_TTN_401,\r\n\t\t\t\t1,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\tinput.gameState.cardsData,\r\n\t\t\t\tinput.gameState.sharedState,\r\n\t\t\t\tinput.gameState.spectator,\r\n\t\t\t\tinput.playerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tperformEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\t0,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t\treturn { hasTriggered: true, shouldRecomputeCurrentAttacker: true };\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"automaton-portrait.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/automaton-portrait.ts"],"names":[],"mappings":";;;AAEA,+EAAuE;AACvE,uDAAiE;AAIpD,QAAA,iBAAiB,GAAsB;IACnD,OAAO,EAAE,sBAA8C;IACvD,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,EAAE,EAAE;QACzD,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,MAAM,UAAU,GAAG,IAAA,kCAAa,gBAE/B,CAAC,EACD,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CAAC,QAAQ,EACxB,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,WAAW,EAC3B,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,YAAY,CAAC,QAAQ,EAC3B,KAAK,CACL,CAAC;YACF,IAAA,4BAAmB,EAClB,UAAU,EACV,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,YAAY,EAClB,CAAC,EACD,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;YACF,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,8BAA8B,EAAE,IAAI,EAAE,CAAC;SACpE;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { performEntitySpawns } from '../../../simulation/spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const AutomatonPortrait: StartOfCombatCard = {\r\n\tcardIds: [CardIds.AutomatonPortrait_BG30_MagicItem_303],\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tif (input.playerBoard.length < 7) {\r\n\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\tCardIds.AstralAutomaton_BG_TTN_401,\r\n\t\t\t\t1,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\tinput.gameState.cardsData,\r\n\t\t\t\tinput.gameState.sharedState,\r\n\t\t\t\tinput.gameState.spectator,\r\n\t\t\t\tinput.playerEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tperformEntitySpawns(\r\n\t\t\t\tnewMinions,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\t0,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t\treturn { hasTriggered: true, shouldRecomputeCurrentAttacker: true };\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -6,13 +6,14 @@ const deathrattle_spawns_1 = require("../../../simulation/deathrattle-spawns");
6
6
  const spawns_1 = require("../../../simulation/spawns");
7
7
  const utils_1 = require("../../../utils");
8
8
  exports.KarazhanChessSet = {
9
+ cardIds: ["BG30_MagicItem_972"],
9
10
  startOfCombat: (trinket, input) => {
10
11
  let hasTriggered = false;
11
12
  if (input.playerBoard.length > 0) {
12
13
  let minionsToCopy = 1;
13
14
  for (let i = 0; i < Math.min(input.playerBoard.length, 7); i++) {
14
15
  if (minionsToCopy <= 0) {
15
- break;
16
+ return;
16
17
  }
17
18
  const entityToCoy = input.playerBoard[i];
18
19
  const copy = (0, utils_1.copyEntity)(entityToCoy);
@@ -1 +1 @@
1
- {"version":3,"file":"karazhan-chess-set.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/karazhan-chess-set.ts"],"names":[],"mappings":";;;AA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,YAAY,EAClB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,EAChC,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBAKF,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;gBACnB,aAAa,EAAE,CAAC;gBAChB,YAAY,GAAG,IAAI,CAAC;aACpB;SACD;QACD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,8BAA8B,EAAE,YAAY,EAAE,CAAC;IACrF,CAAC;CACD,CAAC","sourcesContent":["import { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { removeAurasFromSelf } from '../../../simulation/add-minion-to-board';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { performEntitySpawns } from '../../../simulation/spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { copyEntity } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const KarazhanChessSet: StartOfCombatCard = {\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tlet hasTriggered = false;\r\n\t\tif (input.playerBoard.length > 0) {\r\n\t\t\tlet minionsToCopy = 1;\r\n\t\t\tfor (let i = 0; i < Math.min(input.playerBoard.length, 7); i++) {\r\n\t\t\t\tif (minionsToCopy <= 0) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tconst entityToCoy = input.playerBoard[i];\r\n\t\t\t\tconst copy: BoardEntity = copyEntity(entityToCoy);\r\n\t\t\t\tremoveAurasFromSelf(copy, input.playerBoard, input.playerEntity, input.gameState);\r\n\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t\tinput.gameState.cardsData,\r\n\t\t\t\t\tinput.gameState.sharedState,\r\n\t\t\t\t\tinput.gameState.spectator,\r\n\t\t\t\t\tinput.playerEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tcopy,\r\n\t\t\t\t);\r\n\t\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\t\tnewMinions,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.playerBoard.length - i - 1,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\t// TODO: according to http://replays.firestoneapp.com/?reviewId=576aa3bb-caa1-4e46-9d16-08a001fdd941&turn=23&action=3\r\n\t\t\t\t// it looks like the stats are simply copied from the original entity to the copy, instead\r\n\t\t\t\t// of summoning a copy and applying all the auras stuff\r\n\t\t\t\t// I've asked on Discord (2024-08-21) for clarification\r\n\t\t\t\ti += spawns.length;\r\n\t\t\t\tminionsToCopy--;\r\n\t\t\t\thasTriggered = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { hasTriggered: hasTriggered, shouldRecomputeCurrentAttacker: hasTriggered };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"karazhan-chess-set.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/karazhan-chess-set.ts"],"names":[],"mappings":";;;AAGA,iFAA8E;AAC9E,+EAAuE;AACvE,uDAAiE;AAEjE,0CAA4C;AAG/B,QAAA,gBAAgB,GAAsB;IAClD,OAAO,EAAE,sBAA6C;IACtD,aAAa,EAAE,CAAC,OAAqB,EAAE,KAAe,E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C,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;gBAKF,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;gBACnB,aAAa,EAAE,CAAC;gBAChB,YAAY,GAAG,IAAI,CAAC;aACpB;SACD;QACD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,8BAA8B,EAAE,YAAY,EAAE,CAAC;IACrF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { removeAurasFromSelf } from '../../../simulation/add-minion-to-board';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { performEntitySpawns } from '../../../simulation/spawns';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { copyEntity } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const KarazhanChessSet: StartOfCombatCard = {\r\n\tcardIds: [CardIds.KarazhanChessSet_BG30_MagicItem_972],\r\n\tstartOfCombat: (trinket: BoardTrinket, input: SoCInput) => {\r\n\t\tlet hasTriggered = false;\r\n\t\tif (input.playerBoard.length > 0) {\r\n\t\t\tlet minionsToCopy = 1;\r\n\t\t\tfor (let i = 0; i < Math.min(input.playerBoard.length, 7); i++) {\r\n\t\t\t\tif (minionsToCopy <= 0) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tconst entityToCoy = input.playerBoard[i];\r\n\t\t\t\tconst copy: BoardEntity = copyEntity(entityToCoy);\r\n\t\t\t\tremoveAurasFromSelf(copy, input.playerBoard, input.playerEntity, input.gameState);\r\n\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t\tinput.gameState.cardsData,\r\n\t\t\t\t\tinput.gameState.sharedState,\r\n\t\t\t\t\tinput.gameState.spectator,\r\n\t\t\t\t\tinput.playerEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tcopy,\r\n\t\t\t\t);\r\n\t\t\t\tconst spawns = performEntitySpawns(\r\n\t\t\t\t\tnewMinions,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.playerBoard.length - i - 1,\r\n\t\t\t\t\tinput.opponentBoard,\r\n\t\t\t\t\tinput.opponentEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\t// TODO: according to http://replays.firestoneapp.com/?reviewId=576aa3bb-caa1-4e46-9d16-08a001fdd941&turn=23&action=3\r\n\t\t\t\t// it looks like the stats are simply copied from the original entity to the copy, instead\r\n\t\t\t\t// of summoning a copy and applying all the auras stuff\r\n\t\t\t\t// I've asked on Discord (2024-08-21) for clarification\r\n\t\t\t\ti += spawns.length;\r\n\t\t\t\tminionsToCopy--;\r\n\t\t\t\thasTriggered = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { hasTriggered: hasTriggered, shouldRecomputeCurrentAttacker: hasTriggered };\r\n\t},\r\n};\r\n"]}
@@ -4,6 +4,7 @@ exports.RustyTrident = void 0;
4
4
  const reference_data_1 = require("@firestone-hs/reference-data");
5
5
  const utils_1 = require("../../../utils");
6
6
  exports.RustyTrident = {
7
+ cardIds: ["BG30_MagicItem_917"],
7
8
  startOfCombat: (trinket, input) => {
8
9
  input.playerBoard
9
10
  .filter((e) => (0, utils_1.hasCorrectTribe)(e, input.playerEntity, reference_data_1.Race.NAGA, input.gameState.allCards))
@@ -1 +1 @@
1
- {"version":3,"file":"rusty-trident.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/rusty-trident.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,0CAAiD;AAGpC,QAAA,YAAY,GAAsB;IAC9C,aAAa,EAAE,CAAC,OAAuC,EAAE,KAAe,EAAE,EAAE;QAC3E,KAAK,CAAC,WAAW;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,YAAY,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;aAC1F,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;;YACd,CAAC,CAAC,YAAY,GAAG,MAAA,CAAC,CAAC,YAAY,mCAAI,EAAE,CAAC;YACtC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,MAAM,uBAAsE;gBAC5E,cAAc,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,CAAC;gBACtC,OAAO,EAAE,CAAC;gBACV,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;aACrD,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../../bgs-player-entity';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const RustyTrident: StartOfCombatCard = {\r\n\tstartOfCombat: (trinket: BoardTrinket | BgsPlayerEntity, input: SoCInput) => {\r\n\t\tinput.playerBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, input.playerEntity, Race.NAGA, input.gameState.allCards))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.enchantments = e.enchantments ?? [];\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\t\t\t\t\toriginEntityId: trinket?.entityId ?? 0,\r\n\t\t\t\t\trepeats: 1,\r\n\t\t\t\t\ttiming: input.gameState.sharedState.currentEntityId++,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"rusty-trident.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/rusty-trident.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,0CAAiD;AAGpC,QAAA,YAAY,GAAsB;IAC9C,OAAO,EAAE,sBAAyC;IAClD,aAAa,EAAE,CAAC,OAAuC,EAAE,KAAe,EAAE,EAAE;QAC3E,KAAK,CAAC,WAAW;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,YAAY,EAAE,qBAAI,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;aAC1F,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;;YACd,CAAC,CAAC,YAAY,GAAG,MAAA,CAAC,CAAC,YAAY,mCAAI,EAAE,CAAC;YACtC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,MAAM,uBAAsE;gBAC5E,cAAc,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,CAAC;gBACtC,OAAO,EAAE,CAAC;gBACV,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;aACrD,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../../bgs-player-entity';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const RustyTrident: StartOfCombatCard = {\r\n\tcardIds: [CardIds.RustyTrident_BG30_MagicItem_917],\r\n\tstartOfCombat: (trinket: BoardTrinket | BgsPlayerEntity, input: SoCInput) => {\r\n\t\tinput.playerBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, input.playerEntity, Race.NAGA, input.gameState.allCards))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.enchantments = e.enchantments ?? [];\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\t\t\t\t\toriginEntityId: trinket?.entityId ?? 0,\r\n\t\t\t\t\trepeats: 1,\r\n\t\t\t\t\ttiming: input.gameState.sharedState.currentEntityId++,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
@@ -9,4 +9,6 @@ export interface OnDivineShieldUpdatedInput {
9
9
  hero: BgsPlayerEntity;
10
10
  otherHero: BgsPlayerEntity;
11
11
  gameState: FullGameState;
12
+ target: BoardEntity;
13
+ previousValue: boolean;
12
14
  }
@@ -35,11 +35,13 @@ const updateDivineShield = (entity, board, hero, otherHero, newValue, gameState)
35
35
  for (const boardEntity of board) {
36
36
  const onDivineShieldUpdatedImpl = _card_mappings_1.cardMappings[boardEntity.cardId];
37
37
  if ((0, card_interface_1.hasOnDivineShieldUpdated)(onDivineShieldUpdatedImpl)) {
38
- onDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, entity, entity.hadDivineShield, {
38
+ onDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, {
39
39
  board: board,
40
40
  hero: hero,
41
41
  otherHero: otherHero,
42
42
  gameState: gameState,
43
+ target: entity,
44
+ previousValue: entity.hadDivineShield,
43
45
  });
44
46
  }
45
47
  }
@@ -79,16 +81,6 @@ const updateDivineShield = (entity, board, hero, otherHero, newValue, gameState)
79
81
  }
80
82
  }
81
83
  }
82
- const greaseBots = board.filter((entity) => entity.cardId === "BG21_024");
83
- const greaseBotBattlegrounds = board.filter((entity) => entity.cardId === "BG21_024_G");
84
- greaseBots.forEach((bot) => {
85
- (0, stats_1.modifyStats)(entity, 2, 1, board, hero, gameState);
86
- gameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);
87
- });
88
- greaseBotBattlegrounds.forEach((bot) => {
89
- (0, stats_1.modifyStats)(entity, 4, 2, board, hero, gameState);
90
- gameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);
91
- });
92
84
  }
93
85
  };
94
86
  exports.updateDivineShield = updateDivineShield;
@@ -1 +1 @@
1
- {"version":3,"file":"divine-shield.js","sourceRoot":"","sources":["../../src/keywords/divine-shield.ts"],"names":[],"mappings":";;;AAAA,iEAAuE;AAGvE,4DAAmE;AACnE,iEAA4D;AAC5D,6CAA+C;AAC/C,+DAA6D;AAE7D,+CAAkD;AAClD,oCAA6D;AAEtD,MAAM,kBAAkB,GAAG,CACjC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,QAAiB,EACjB,SAAwB,EACjB,EAAE;;IAIT,MAAM,CAAC,eAAe,GAAG,QAAQ,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe,CAAC;IACnF,MAAM,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC/B,IAAI,MAAM,CAAC,YAAY,EAAE;QACxB,MAAM,aAAa,GAAG,KAAK,CAAC;QAC5B,MAAM,UAAU,GACf,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAiC,CAAC,CAAC,MAAM;YACjF,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAA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C,CAAC;QACtE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7E;AACF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import { CardIds, CardType, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnDivineShieldUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { pickRandom } from '../services/utils';\r\nimport { addCardsInHand } from '../simulation/cards-in-hand';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { grantRandomStats, hasCorrectTribe } from '../utils';\r\n\r\nexport const updateDivineShield = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tnewValue: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// if ((entity.divineShield ?? false) === newValue) {\r\n\t// \treturn;\r\n\t// }\r\n\tentity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t8 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t16 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t8 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t16 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n\r\n\t// Lost divine shield\r\n\tif (entity.hadDivineShield && !entity.divineShield) {\r\n\t\tconst adapter = hero.trinkets\r\n\t\t\t.filter((t) => t.cardId === CardIds.MechagonAdapter_BG30_MagicItem_910)\r\n\t\t\t.filter((t) => t.scriptDataNum1 > 0)[0];\r\n\t\tif (!!adapter && hasCorrectTribe(entity, hero, Race.MECH, gameState.allCards)) {\r\n\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\tadapter.scriptDataNum1--;\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, entity, entity.hadDivineShield, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < board.length; i++) {\r\n\t\t\tif (board[i].cardId === CardIds.BolvarFireblood_ICC_858) {\r\n\t\t\t\tmodifyStats(board[i], 2, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.BolvarFireblood_TB_BaconUps_047) {\r\n\t\t\t\tmodifyStats(board[i], 4, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_BGS_067) {\r\n\t\t\t\tmodifyStats(board[i], 2, 2, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_TB_BaconUps_117) {\r\n\t\t\t\tmodifyStats(board[i], 4, 4, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].entityId !== entity.entityId &&\r\n\t\t\t\t(board[i].cardId === CardIds.HolyMecherel_BG20_401 ||\r\n\t\t\t\t\tboard[i].cardId === CardIds.HolyMecherel_BG20_401_G)\r\n\t\t\t) {\r\n\t\t\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem], gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037_G) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem, CardIds.BloodGem], gameState);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008 ||\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008_G\r\n\t\t\t) {\r\n\t\t\t\t// When it's the opponent, the game state already contains all the buffs\r\n\t\t\t\tif (board[i]?.friendly) {\r\n\t\t\t\t\tconst buff = board[i].cardId === CardIds.CogworkCopter_BG24_008_G ? 2 : 1;\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tboard[i],\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tconst greaseBots = board.filter((entity) => entity.cardId === CardIds.GreaseBot_BG21_024);\r\n\t\tconst greaseBotBattlegrounds = board.filter((entity) => entity.cardId === CardIds.GreaseBot_BG21_024_G);\r\n\t\tgreaseBots.forEach((bot) => {\r\n\t\t\tmodifyStats(entity, 2, 1, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);\r\n\t\t});\r\n\t\tgreaseBotBattlegrounds.forEach((bot) => {\r\n\t\t\tmodifyStats(entity, 4, 2, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(bot, entity, board, hero, otherHero);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = pickRandom(elligibleEntities);\r\n\t\tupdateDivineShield(chosen, board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, chosen, board, null, null);\r\n\t}\r\n};\r\n\r\nexport const grantDivineShieldToLeftmostMinions = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tquantity: number,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < Math.min(quantity, board.length); i++) {\r\n\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, board[i], board, null, null);\r\n\t}\r\n};\r\n\r\nexport interface OnDivineShieldUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
1
+ {"version":3,"file":"divine-shield.js","sourceRoot":"","sources":["../../src/keywords/divine-shield.ts"],"names":[],"mappings":";;;AAAA,iEAAuE;AAGvE,4DAAmE;AACnE,iEAA4D;AAC5D,6CAA+C;AAC/C,+DAA6D;AAE7D,+CAAkD;AAClD,oCAA6D;AAEtD,MAAM,kBAAkB,GAAG,CACjC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,QAAiB,EACjB,SAAwB,EACjB,EAAE;;IAIT,MAAM,CAAC,eAAe,GAAG,QAAQ,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe,CAAC;IACnF,MAAM,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC/B,IAAI,MAAM,CAAC,YAAY,EAAE;QACxB,MAAM,aAAa,GAAG,KAAK,CAAC;QAC5B,MAAM,UAAU,GACf,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAiC,CAAC,CAAC,MAAM;YACjF,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,iBAAmC,CAAC,CAAC,MAAM,CAAC;QAEtF,MAAM,CAAC,MAAM,IAAI,UAAU,CAAC;KAC5B;SAAM;QAEN,MAAM,aAAa,GAAG,KAAK,CAAC;QAC5B,MAAM,UAAU,GACf,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAiC,CAAC,CAAC,MAAM;YACjF,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,iBAAmC,CAAC,CAAC,MAAM,CAAC;QACtF,MAA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AAI,EAAE,SAAS,CAAC,CAAC;QACtE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7E;AACF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import { CardIds, CardType, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnDivineShieldUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { pickRandom } from '../services/utils';\r\nimport { addCardsInHand } from '../simulation/cards-in-hand';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { grantRandomStats, hasCorrectTribe } from '../utils';\r\n\r\nexport const updateDivineShield = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tnewValue: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// if ((entity.divineShield ?? false) === newValue) {\r\n\t// \treturn;\r\n\t// }\r\n\tentity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t8 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t16 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t8 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t16 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n\r\n\t// Lost divine shield\r\n\tif (entity.hadDivineShield && !entity.divineShield) {\r\n\t\tconst adapter = hero.trinkets\r\n\t\t\t.filter((t) => t.cardId === CardIds.MechagonAdapter_BG30_MagicItem_910)\r\n\t\t\t.filter((t) => t.scriptDataNum1 > 0)[0];\r\n\t\tif (!!adapter && hasCorrectTribe(entity, hero, Race.MECH, gameState.allCards)) {\r\n\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\tadapter.scriptDataNum1--;\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < board.length; i++) {\r\n\t\t\tif (board[i].cardId === CardIds.BolvarFireblood_ICC_858) {\r\n\t\t\t\tmodifyStats(board[i], 2, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.BolvarFireblood_TB_BaconUps_047) {\r\n\t\t\t\tmodifyStats(board[i], 4, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_BGS_067) {\r\n\t\t\t\tmodifyStats(board[i], 2, 2, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_TB_BaconUps_117) {\r\n\t\t\t\tmodifyStats(board[i], 4, 4, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].entityId !== entity.entityId &&\r\n\t\t\t\t(board[i].cardId === CardIds.HolyMecherel_BG20_401 ||\r\n\t\t\t\t\tboard[i].cardId === CardIds.HolyMecherel_BG20_401_G)\r\n\t\t\t) {\r\n\t\t\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem], gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037_G) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem, CardIds.BloodGem], gameState);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008 ||\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008_G\r\n\t\t\t) {\r\n\t\t\t\t// When it's the opponent, the game state already contains all the buffs\r\n\t\t\t\tif (board[i]?.friendly) {\r\n\t\t\t\t\tconst buff = board[i].cardId === CardIds.CogworkCopter_BG24_008_G ? 2 : 1;\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tboard[i],\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = pickRandom(elligibleEntities);\r\n\t\tupdateDivineShield(chosen, board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, chosen, board, null, null);\r\n\t}\r\n};\r\n\r\nexport const grantDivineShieldToLeftmostMinions = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tquantity: number,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < Math.min(quantity, board.length); i++) {\r\n\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, board[i], board, null, null);\r\n\t}\r\n};\r\n\r\nexport interface OnDivineShieldUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n\ttarget: BoardEntity;\r\n\tpreviousValue: boolean;\r\n}\r\n"]}
@@ -146,9 +146,7 @@ const updateSimulationResult = (simulationResult, input) => {
146
146
  simulationResult.wonLethalPercent = checkRounding(Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10, simulationResult.wonLethal, totalMatches);
147
147
  simulationResult.lostPercent = checkRounding(Math.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10, simulationResult.lost, totalMatches);
148
148
  simulationResult.lostLethalPercent = checkRounding(Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10, simulationResult.lostLethal, totalMatches);
149
- simulationResult.tiedPercent = checkRounding(100 - simulationResult.lostPercent - simulationResult.wonPercent, simulationResult.tied, totalMatches);
150
- simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;
151
- simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;
149
+ simulationResult.tiedPercent = checkRounding(Math.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent), simulationResult.tied, totalMatches);
152
150
  simulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;
153
151
  simulationResult.averageDamageLost = simulationResult.lost
154
152
  ? simulationResult.damageLost / simulationResult.lost
@@ -193,8 +191,6 @@ const VALID_DEATHRATTLE_ENCHANTMENTS = [
193
191
  "BG30_MagicItem_917e",
194
192
  "BG30_MagicItem_411e",
195
193
  "BG30_MagicItem_952e",
196
- "BG30_119e",
197
- "BG30_119_Ge",
198
194
  ];
199
195
  const validDeathrattleEnchantmentsFromMapping = [];
200
196
  const isValidDeathrattleEnchantment = (cardId) => {
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAExE,2DAAyE;AACzE,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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AA2B,CAAC,CAAC;KAC1C;AACF,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;;;;;;;;;;;;;;;;;;;;;;;;CAwBtC,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;YACnD,IAAI,IAAA,gDAA+B,EAAC,QAAQ,CAAC,EAAE;gBAC9C,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;AAZW,QAAA,6BAA6B,iCAYxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleEnchantmentEffect } 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\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 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\tdamageWon: 0,\r\n\t\tdamageLost: 0,\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();\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\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\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);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\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) => {\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\t// simulationResult.tiedPercent = checkRounding(Math.round((10 * (100 * simulationResult.tied)) / totalMatches) / 10, simulationResult.tied, totalMatches);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\t100 - simulationResult.lostPercent - simulationResult.wonPercent,\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\tsimulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\tsimulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\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 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\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.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.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119e,\r\n\tCardIds.SkyPirateFlagbearer_FlagbearingEnchantment_BG30_119_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\tif (hasDeathrattleEnchantmentEffect(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,iEAAwE;AAExE,2DAAyE;AACzE,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,mCAAI,EAAE,CACtC,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,sBAAc,EAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAGrE,IAAI,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,CAA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hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleEnchantmentEffect } 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\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 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\tdamageWon: 0,\r\n\t\tdamageLost: 0,\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();\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\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\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);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\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) => {\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\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\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 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\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.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];\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\tif (hasDeathrattleEnchantmentEffect(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"]}
@@ -8,18 +8,25 @@ export declare const applyAurasToSelf: (spawned: BoardEntity, board: BoardEntity
8
8
  export declare const removeAurasFromSelf: (entity: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
9
9
  export declare const onMinionSummoned: (hero: BgsPlayerEntity, board: BoardEntity[], gameState: FullGameState) => void;
10
10
  export interface OnSpawnInput {
11
- playerEntity: BgsPlayerEntity;
11
+ hero: BgsPlayerEntity;
12
12
  playerBoard: BoardEntity[];
13
- gameState: FullGameState;
13
+ board: FullGameState;
14
14
  }
15
15
  export interface OnOtherSpawnInput {
16
16
  spawned: BoardEntity;
17
- playerEntity: BgsPlayerEntity;
18
- playerBoard: BoardEntity[];
17
+ hero: BgsPlayerEntity;
18
+ board: BoardEntity[];
19
+ otherHero: BgsPlayerEntity;
20
+ gameState: FullGameState;
21
+ }
22
+ export interface OnOtherSpawnAuraInput {
23
+ spawned: BoardEntity;
24
+ hero: BgsPlayerEntity;
25
+ board: BoardEntity[];
19
26
  gameState: FullGameState;
20
27
  }
21
28
  export interface OnDespawnInput {
22
- playerEntity: BgsPlayerEntity;
23
- playerBoard: BoardEntity[];
29
+ hero: BgsPlayerEntity;
30
+ board: BoardEntity[];
24
31
  gameState: FullGameState;
25
32
  }
@@ -46,6 +46,16 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
46
46
  if (entity.entityId === spawned.entityId) {
47
47
  continue;
48
48
  }
49
+ const onOtherSpawnedImpl = _card_mappings_1.cardMappings[entity.cardId];
50
+ if ((0, card_interface_1.hasOnOtherSpawned)(onOtherSpawnedImpl)) {
51
+ onOtherSpawnedImpl.onOtherSpawned(entity, {
52
+ spawned: spawned,
53
+ hero: boardHero,
54
+ board: board,
55
+ otherHero: otherHero,
56
+ gameState,
57
+ });
58
+ }
49
59
  switch (entity.cardId) {
50
60
  case "TB_BaconShop_HERO_92_Buddy":
51
61
  case "TB_BaconShop_HERO_92_Buddy_G":
@@ -63,17 +73,6 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
63
73
  gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
64
74
  }
65
75
  break;
66
- case "BGS_071":
67
- case "TB_BaconUps_123":
68
- if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MECH, gameState.allCards)) {
69
- const statsBonus = entity.cardId === "TB_BaconUps_123" ? 4 : 2;
70
- if (!entity.divineShield) {
71
- (0, divine_shield_1.updateDivineShield)(entity, board, boardHero, otherHero, true, gameState);
72
- }
73
- (0, stats_1.modifyStats)(entity, statsBonus, 0, board, boardHero, gameState);
74
- gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
75
- }
76
- break;
77
76
  case "BGS_204":
78
77
  case "TB_BaconUps_304":
79
78
  if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.DEMON, gameState.allCards)) {
@@ -106,12 +105,6 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
106
105
  gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
107
106
  }
108
107
  break;
109
- case "BG30_124":
110
- case "BG30_124_G":
111
- const abomStatsMultiplier = entity.cardId === "BG30_124_G" ? 2 : 1;
112
- (0, stats_1.modifyStats)(spawned, abomStatsMultiplier * 3, abomStatsMultiplier * 3, board, boardHero, gameState);
113
- gameState.spectator.registerPowerTarget(entity, spawned, board, boardHero, otherHero);
114
- break;
115
108
  }
116
109
  }
117
110
  };
@@ -232,11 +225,11 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
232
225
  }
233
226
  for (const entity of board) {
234
227
  const onOtherSpawnedImpl = _card_mappings_1.cardMappings[entity.cardId];
235
- if ((0, card_interface_1.hasOnOtherSpawned)(onOtherSpawnedImpl)) {
236
- onOtherSpawnedImpl.onOtherSpawned(entity, {
228
+ if ((0, card_interface_1.hasOnOtherAuraSpawned)(onOtherSpawnedImpl)) {
229
+ onOtherSpawnedImpl.onOtherSpawnedAura(entity, {
237
230
  spawned: spawned,
238
- playerEntity: boardHero,
239
- playerBoard: board,
231
+ hero: boardHero,
232
+ board: board,
240
233
  gameState,
241
234
  });
242
235
  }
@@ -281,9 +274,9 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
281
274
  const onSpawnedImpl = _card_mappings_1.cardMappings[spawned.cardId];
282
275
  if ((0, card_interface_1.hasOnSpawned)(onSpawnedImpl)) {
283
276
  onSpawnedImpl.onSpawned(spawned, {
284
- playerEntity: boardHero,
277
+ hero: boardHero,
285
278
  playerBoard: board,
286
- gameState,
279
+ board: gameState,
287
280
  });
288
281
  }
289
282
  switch (spawned.cardId) {
@@ -371,8 +364,8 @@ const removeAurasFromSelf = (entity, board, boardHero, gameState) => {
371
364
  const onDespawnedImpl = _card_mappings_1.cardMappings[entity.cardId];
372
365
  if ((0, card_interface_1.hasOnDespawned)(onDespawnedImpl)) {
373
366
  onDespawnedImpl.onDespawned(entity, {
374
- playerEntity: boardHero,
375
- playerBoard: board,
367
+ hero: boardHero,
368
+ board: board,
376
369
  gameState,
377
370
  });
378
371
  }
@@ -561,23 +554,12 @@ const handleAfterSpawnEffect = (board, hero, spawned, gameState) => {
561
554
  if ((0, card_interface_1.hasAfterOtherSpawned)(onAfterSpawnedImpl)) {
562
555
  onAfterSpawnedImpl.afterOtherSpawned(entity, {
563
556
  spawned: spawned,
564
- playerEntity: hero,
565
- playerBoard: board,
557
+ hero: hero,
558
+ board: board,
566
559
  gameState,
567
560
  });
568
561
  }
569
562
  switch (entity.cardId) {
570
- case "BG22_401":
571
- case "BG22_401_G":
572
- if (entity.entityId !== spawned.entityId) {
573
- const multiplier2 = entity.cardId === "BG22_401_G" ? 2 : 1;
574
- const buffAmount2 = multiplier2 * ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.MURLOC, gameState.allCards) ? 1 : 0);
575
- if (buffAmount2 > 0) {
576
- (0, stats_1.modifyStats)(entity, buffAmount2, 0, board, hero, gameState);
577
- gameState.spectator.registerPowerTarget(entity, entity, board, null, null);
578
- }
579
- }
580
- break;
581
563
  case "BG25_042":
582
564
  case "BG25_042_G":
583
565
  case "BG28_634":