@firestone-hs/simulate-bgs-battle 1.1.716 → 1.1.718

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 (223) hide show
  1. package/dist/bgs-battle-info.js.map +1 -1
  2. package/dist/cards/card.interface.js.map +1 -1
  3. package/dist/cards/cards-data.js.map +1 -1
  4. package/dist/cards/impl/_card-mappings.js +4 -2
  5. package/dist/cards/impl/_card-mappings.js.map +1 -1
  6. package/dist/cards/impl/bg-spell/sharing-is-caring.js.map +1 -1
  7. package/dist/cards/impl/bg-spell/toxic-tumbleweed.js.map +1 -1
  8. package/dist/cards/impl/hero-power/aim-high.js.map +1 -1
  9. package/dist/cards/impl/hero-power/aim-left.js.map +1 -1
  10. package/dist/cards/impl/hero-power/aim-low.js.map +1 -1
  11. package/dist/cards/impl/hero-power/aim-right.js.map +1 -1
  12. package/dist/cards/impl/hero-power/earth-invocation.js.map +1 -1
  13. package/dist/cards/impl/hero-power/embrace-your-rage.js.map +1 -1
  14. package/dist/cards/impl/hero-power/fire-invocation.js.map +1 -1
  15. package/dist/cards/impl/hero-power/lightning-invocation.js.map +1 -1
  16. package/dist/cards/impl/hero-power/reborn-rites.js.map +1 -1
  17. package/dist/cards/impl/hero-power/water-invocation.js.map +1 -1
  18. package/dist/cards/impl/minion/all-seeing-elder.js.map +1 -1
  19. package/dist/cards/impl/minion/alleycat.js.map +1 -1
  20. package/dist/cards/impl/minion/amber-guardian.js.map +1 -1
  21. package/dist/cards/impl/minion/archimonde.js.map +1 -1
  22. package/dist/cards/impl/minion/arid-atrocity.js.map +1 -1
  23. package/dist/cards/impl/minion/ashen-corruptor.js.map +1 -1
  24. package/dist/cards/impl/minion/assistant-guard.js.map +1 -1
  25. package/dist/cards/impl/minion/audacious-anchor.js.map +1 -1
  26. package/dist/cards/impl/minion/auto-assembler.js.map +1 -1
  27. package/dist/cards/impl/minion/avalanche-caller.js.map +1 -1
  28. package/dist/cards/impl/minion/baby-nzoth.d.ts +2 -0
  29. package/dist/cards/impl/minion/baby-nzoth.js +25 -0
  30. package/dist/cards/impl/minion/baby-nzoth.js.map +1 -0
  31. package/dist/cards/impl/minion/baneling.js.map +1 -1
  32. package/dist/cards/impl/minion/bigwig-bandit.js.map +1 -1
  33. package/dist/cards/impl/minion/bird-buddy.js.map +1 -1
  34. package/dist/cards/impl/minion/blazing-skyfin.js.map +1 -1
  35. package/dist/cards/impl/minion/blue-chromadrake.js +1 -1
  36. package/dist/cards/impl/minion/blue-chromadrake.js.map +1 -1
  37. package/dist/cards/impl/minion/blue-whelp.js.map +1 -1
  38. package/dist/cards/impl/minion/boar-gamer.js.map +1 -1
  39. package/dist/cards/impl/minion/briarback-bookie.js.map +1 -1
  40. package/dist/cards/impl/minion/bronze-steward.js.map +1 -1
  41. package/dist/cards/impl/minion/bubble-gunner.js.map +1 -1
  42. package/dist/cards/impl/minion/buzzing-vermin.js.map +1 -1
  43. package/dist/cards/impl/minion/cadaver-caretaker.js.map +1 -1
  44. package/dist/cards/impl/minion/captain-bonerender.js.map +1 -1
  45. package/dist/cards/impl/minion/carapace-raiser.js.map +1 -1
  46. package/dist/cards/impl/minion/carbonic-copy.js.map +1 -1
  47. package/dist/cards/impl/minion/coilskar-sapper.js.map +1 -1
  48. package/dist/cards/impl/minion/coldlight-diver.js.map +1 -1
  49. package/dist/cards/impl/minion/crystal-infuser-enchantment.js.map +1 -1
  50. package/dist/cards/impl/minion/cupcake-peddler.js.map +1 -1
  51. package/dist/cards/impl/minion/deadstomper.js.map +1 -1
  52. package/dist/cards/impl/minion/deathly-striker.js.map +1 -1
  53. package/dist/cards/impl/minion/deflecto-bot.js.map +1 -1
  54. package/dist/cards/impl/minion/devout-hellcaller.js.map +1 -1
  55. package/dist/cards/impl/minion/drakkari-embalmer.js.map +1 -1
  56. package/dist/cards/impl/minion/elder-taggawag.js.map +1 -1
  57. package/dist/cards/impl/minion/electric-synthesizer.js.map +1 -1
  58. package/dist/cards/impl/minion/elite-navigator.js.map +1 -1
  59. package/dist/cards/impl/minion/fairy-gillmother.js.map +1 -1
  60. package/dist/cards/impl/minion/firescale-hoarder.js.map +1 -1
  61. package/dist/cards/impl/minion/fireworks-fanatic.js.map +1 -1
  62. package/dist/cards/impl/minion/flotsam-flinger.js.map +1 -1
  63. package/dist/cards/impl/minion/fountain-chiller.js.map +1 -1
  64. package/dist/cards/impl/minion/friendly-geist.js.map +1 -1
  65. package/dist/cards/impl/minion/gem-rat.js.map +1 -1
  66. package/dist/cards/impl/minion/general-drakkisath.js.map +1 -1
  67. package/dist/cards/impl/minion/gentle-djinni.js.map +1 -1
  68. package/dist/cards/impl/minion/gentle-stag.js.map +1 -1
  69. package/dist/cards/impl/minion/glowing-cinder.js.map +1 -1
  70. package/dist/cards/impl/minion/gormling-gourmet.js.map +1 -1
  71. package/dist/cards/impl/minion/greedy-snaketongue.js.map +1 -1
  72. package/dist/cards/impl/minion/grimscale-elegist.js.map +1 -1
  73. package/dist/cards/impl/minion/gritty-headhunter.js.map +1 -1
  74. package/dist/cards/impl/minion/hackerfin.js.map +1 -1
  75. package/dist/cards/impl/minion/handless-forsaken.js.map +1 -1
  76. package/dist/cards/impl/minion/harmless-bonehead.js.map +1 -1
  77. package/dist/cards/impl/minion/hawkstrider-herald.js.map +1 -1
  78. package/dist/cards/impl/minion/holo-rover.js.map +1 -1
  79. package/dist/cards/impl/minion/humongozz.js.map +1 -1
  80. package/dist/cards/impl/minion/hungry-snapjaw.js.map +1 -1
  81. package/dist/cards/impl/minion/hunter-of-gatherers.js.map +1 -1
  82. package/dist/cards/impl/minion/ignition-specialist.js.map +1 -1
  83. package/dist/cards/impl/minion/immortal.js.map +1 -1
  84. package/dist/cards/impl/minion/implant-subject.js.map +1 -1
  85. package/dist/cards/impl/minion/imposing-percussionist.js.map +1 -1
  86. package/dist/cards/impl/minion/inspiring-underdog.js.map +1 -1
  87. package/dist/cards/impl/minion/interrogator-whitemane.js.map +1 -1
  88. package/dist/cards/impl/minion/kangors-apprentice.js.map +1 -1
  89. package/dist/cards/impl/minion/leeroy-the-reckless.js.map +1 -1
  90. package/dist/cards/impl/minion/lightfang-enforcer.js.map +1 -1
  91. package/dist/cards/impl/minion/lightfeather-screecher.js.map +1 -1
  92. package/dist/cards/impl/minion/living-azerite.js.map +1 -1
  93. package/dist/cards/impl/minion/lokholar-frostforger.js.map +1 -1
  94. package/dist/cards/impl/minion/lovesick-balladist.js.map +1 -1
  95. package/dist/cards/impl/minion/low-flier.js.map +1 -1
  96. package/dist/cards/impl/minion/lurker.js.map +1 -1
  97. package/dist/cards/impl/minion/manasaber.js.map +1 -1
  98. package/dist/cards/impl/minion/mantid-queen.js.map +1 -1
  99. package/dist/cards/impl/minion/marquee-ticker.js.map +1 -1
  100. package/dist/cards/impl/minion/maw-caster.js.map +1 -1
  101. package/dist/cards/impl/minion/mecha-jaraxxus.js.map +1 -1
  102. package/dist/cards/impl/minion/mechanized-gift-horse.js.map +1 -1
  103. package/dist/cards/impl/minion/mechorse.js.map +1 -1
  104. package/dist/cards/impl/minion/menagerie-jug.js.map +1 -1
  105. package/dist/cards/impl/minion/metallic-hunter.js.map +1 -1
  106. package/dist/cards/impl/minion/misfit-dragonling.js.map +1 -1
  107. package/dist/cards/impl/minion/mummifier.js.map +1 -1
  108. package/dist/cards/impl/minion/murkbrine-expeditioner.js.map +1 -1
  109. package/dist/cards/impl/minion/murky.js.map +1 -1
  110. package/dist/cards/impl/minion/mutated-lasher.js.map +1 -1
  111. package/dist/cards/impl/minion/mythrax.js.map +1 -1
  112. package/dist/cards/impl/minion/neon-agent.js.map +1 -1
  113. package/dist/cards/impl/minion/nest-swarmer.js.map +1 -1
  114. package/dist/cards/impl/minion/nether-drake.js.map +1 -1
  115. package/dist/cards/impl/minion/nightmare-par-tea-guest.js.map +1 -1
  116. package/dist/cards/impl/minion/nimble-hatchling.js.map +1 -1
  117. package/dist/cards/impl/minion/operatic-belcher.js.map +1 -1
  118. package/dist/cards/impl/minion/outback-smolderer.js.map +1 -1
  119. package/dist/cards/impl/minion/parched-wanderer.js.map +1 -1
  120. package/dist/cards/impl/minion/primalfin-lookout.js.map +1 -1
  121. package/dist/cards/impl/minion/rapscallion-recruiter.js.map +1 -1
  122. package/dist/cards/impl/minion/razorgore-the-untamed.js.map +1 -1
  123. package/dist/cards/impl/minion/red-chromadrake.js +1 -1
  124. package/dist/cards/impl/minion/red-chromadrake.js.map +1 -1
  125. package/dist/cards/impl/minion/roach.js.map +1 -1
  126. package/dist/cards/impl/minion/roadboar.js.map +1 -1
  127. package/dist/cards/impl/minion/rodeo-performer.js.map +1 -1
  128. package/dist/cards/impl/minion/ruins-renovator.js.map +1 -1
  129. package/dist/cards/impl/minion/rylak-metalhead.js.map +1 -1
  130. package/dist/cards/impl/minion/salty-hog.js.map +1 -1
  131. package/dist/cards/impl/minion/sand-swirler.js.map +1 -1
  132. package/dist/cards/impl/minion/sandy.js.map +1 -1
  133. package/dist/cards/impl/minion/sanguine-refiner.js.map +1 -1
  134. package/dist/cards/impl/minion/scourge-harvester.js.map +1 -1
  135. package/dist/cards/impl/minion/selfless-hero.js.map +1 -1
  136. package/dist/cards/impl/minion/shadowdancer.js.map +1 -1
  137. package/dist/cards/impl/minion/sharp-eyed-sabretooth.js.map +1 -1
  138. package/dist/cards/impl/minion/sharptooth-snapper.js.map +1 -1
  139. package/dist/cards/impl/minion/ship-master-eudora.js.map +1 -1
  140. package/dist/cards/impl/minion/shipwrecked-rascal.js.map +1 -1
  141. package/dist/cards/impl/minion/silver-handed-recruit.js.map +1 -1
  142. package/dist/cards/impl/minion/slumber-sorcerer.js.map +1 -1
  143. package/dist/cards/impl/minion/smolderwing.js.map +1 -1
  144. package/dist/cards/impl/minion/sneeds-new-shredder.d.ts +2 -0
  145. package/dist/cards/impl/minion/{pilot-the-shredder.js → sneeds-new-shredder.js} +7 -4
  146. package/dist/cards/impl/minion/sneeds-new-shredder.js.map +1 -0
  147. package/dist/cards/impl/minion/soul-rewinder.js.map +1 -1
  148. package/dist/cards/impl/minion/spacefarer.js.map +1 -1
  149. package/dist/cards/impl/minion/spirited-whimsydrake.js.map +1 -1
  150. package/dist/cards/impl/minion/springy-spriggan.js.map +1 -1
  151. package/dist/cards/impl/minion/stitched-salvager.js.map +1 -1
  152. package/dist/cards/impl/minion/stray-satyr.js.map +1 -1
  153. package/dist/cards/impl/minion/sun-screener.js.map +1 -1
  154. package/dist/cards/impl/minion/surfing-slyvar.js.map +1 -1
  155. package/dist/cards/impl/minion/thorncaller.js.map +1 -1
  156. package/dist/cards/impl/minion/thousandth-paper-drake.js.map +1 -1
  157. package/dist/cards/impl/minion/thundering-abomination.js.map +1 -1
  158. package/dist/cards/impl/minion/timewarped-embalmer.js +1 -1
  159. package/dist/cards/impl/minion/timewarped-embalmer.js.map +1 -1
  160. package/dist/cards/impl/minion/timewarped-warghoul.js.map +1 -1
  161. package/dist/cards/impl/minion/tunnel-blaster.js.map +1 -1
  162. package/dist/cards/impl/minion/twilight-primordium.js.map +1 -1
  163. package/dist/cards/impl/minion/ultralisk.js.map +1 -1
  164. package/dist/cards/impl/minion/valiant-tiger.js.map +1 -1
  165. package/dist/cards/impl/minion/void-earl.js.map +1 -1
  166. package/dist/cards/impl/minion/vorkai-guardian.js.map +1 -1
  167. package/dist/cards/impl/minion/wandering-wight.js.map +1 -1
  168. package/dist/cards/impl/minion/whelp-smuggler.js.map +1 -1
  169. package/dist/cards/impl/minion/whirring-protector-enchantment.js.map +1 -1
  170. package/dist/cards/impl/minion/wildfire-elemental.js.map +1 -1
  171. package/dist/cards/impl/minion/wisp-in-the-shell.js.map +1 -1
  172. package/dist/cards/impl/minion/yorik-smite.js.map +1 -1
  173. package/dist/cards/impl/minion/yrel.js.map +1 -1
  174. package/dist/cards/impl/minion/yulon-fortune-granter.js.map +1 -1
  175. package/dist/cards/impl/quest-reward/righteous-charge.js.map +1 -1
  176. package/dist/cards/impl/trinket/all-purpose-kibble.js.map +1 -1
  177. package/dist/cards/impl/trinket/arm-of-the-empire.js.map +1 -1
  178. package/dist/cards/impl/trinket/bassgill-portrait.js.map +1 -1
  179. package/dist/cards/impl/trinket/battle-horn.js.map +1 -1
  180. package/dist/cards/impl/trinket/beetle-band.js.map +1 -1
  181. package/dist/cards/impl/trinket/bird-feeder.js.map +1 -1
  182. package/dist/cards/impl/trinket/crocheted-sungill.js.map +1 -1
  183. package/dist/cards/impl/trinket/deathtouch-apple.js +1 -1
  184. package/dist/cards/impl/trinket/deathtouch-apple.js.map +1 -1
  185. package/dist/cards/impl/trinket/eclectic-shrine.js.map +1 -1
  186. package/dist/cards/impl/trinket/eternal-portrait.d.ts +2 -0
  187. package/dist/cards/impl/trinket/eternal-portrait.js +2 -1
  188. package/dist/cards/impl/trinket/eternal-portrait.js.map +1 -1
  189. package/dist/cards/impl/trinket/faerie-dragon-scale.js.map +1 -1
  190. package/dist/cards/impl/trinket/fishy-sticker.js.map +1 -1
  191. package/dist/cards/impl/trinket/herald-sticker.js.map +1 -1
  192. package/dist/cards/impl/trinket/karazhan-chess-set.js.map +1 -1
  193. package/dist/cards/impl/trinket/rivendare-portrait.js.map +1 -1
  194. package/dist/cards/impl/trinket/sthara-sticker.js.map +1 -1
  195. package/dist/cards/impl/trinket/valorous-medaillion.js.map +1 -1
  196. package/dist/cards/impl/trinket/vashjir-anemone.js.map +1 -1
  197. package/dist/cards/impl/trinket/yulon-sticker.js.map +1 -1
  198. package/dist/debug-state.js.map +1 -1
  199. package/dist/input-sanitation.js +7 -6
  200. package/dist/input-sanitation.js.map +1 -1
  201. package/dist/keywords/venomous.js.map +1 -1
  202. package/dist/simulate-bgs-battle.js.map +1 -1
  203. package/dist/simulation/add-minion-to-board.js +4 -4
  204. package/dist/simulation/add-minion-to-board.js.map +1 -1
  205. package/dist/simulation/avenge.js.map +1 -1
  206. package/dist/simulation/deathrattle-effects.js +10 -2
  207. package/dist/simulation/deathrattle-effects.js.map +1 -1
  208. package/dist/simulation/deathrattle-on-trigger.js.map +1 -1
  209. package/dist/simulation/discover.js.map +1 -1
  210. package/dist/simulation/frenzy.js.map +1 -1
  211. package/dist/simulation/quest.js.map +1 -1
  212. package/dist/simulation/reborn.js +25 -23
  213. package/dist/simulation/reborn.js.map +1 -1
  214. package/dist/simulation/spectator/game-action.js +18 -17
  215. package/dist/simulation/spectator/game-action.js.map +1 -1
  216. package/dist/simulation/spectator/resolve-trinket-hero-power.d.ts +2 -0
  217. package/dist/simulation/spectator/resolve-trinket-hero-power.js +27 -0
  218. package/dist/simulation/spectator/resolve-trinket-hero-power.js.map +1 -0
  219. package/dist/simulation/spectator/spectator.js +1 -0
  220. package/dist/simulation/spectator/spectator.js.map +1 -1
  221. package/package.json +51 -51
  222. package/dist/cards/impl/minion/pilot-the-shredder.d.ts +0 -2
  223. package/dist/cards/impl/minion/pilot-the-shredder.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"reborn.js","sourceRoot":"","sources":["../../src/simulation/reborn.ts"],"names":[],"mappings":";;;AAEA,4DAA+F;AAC/F,iEAA4D;AAC5D,8EAA+G;AAE/G,oCAA2C;AAC3C,6DAAqD;AAErD,qCAA+C;AAC/C,mCAAsC;AAE/B,MAAM,qBAAqB,GAAG,CACpC,qBAAoC,EACpC,yBAA0C,EAC1C,UAAuB,EACvB,wBAAgC,EAChC,aAA4B,EAC5B,iBAAkC,EAClC,SAAwB,EACjB,EAAE;;IACT,MAAM,eAAe,GAAG,CAAC,CAAC;IAC1B,IAAI,aAAa,GAAgB,IAAI,CAAC;IACtC,IACC,IAAA,sCAAkB,EAAC,UAAU,CAAC,MAAM,CAAC;SACrC,MAAA,UAAU,CAAC,YAAY,0CAAE,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,wBAAuE,CACtF,CAAA,EACA;QACD,aAAa,GAAG,IAAA,qDAAiC,EAAC,UAAU,CAAC,CAAC;KAC9D;IACD,MAAM,kBAAkB,GACvB,UAAU,CAAC,MAAM,IAAI,wBAAwB,IAAI,CAAC;QACjD,CAAC,CAAC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CACL,CAAC,CAAC,MAAM,eAAwC;YAChD,CAAC,CAAC,MAAM,iBAA0C,CACnD;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9E,IAAA,uBAAe,EACd,CAAC,EACD,qBAAqB,EACrB,yBAAyB,EACzB,UAAU,GAAG,CAAC,EACd,UAAU,GAAG,CAAC,EACd,SAAS,CACT,CAAC;QACH,CAAC,CAAC,CAAC;KACJ;AACF,CAAC,CAAC;AApKW,QAAA,qBAAqB,yBAoKhC","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasAfterReborn, hasRebornEffect, hasRebornSelfEffect } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { buildSinrunnerBlanchyRebornEntity, isSinrunnerBlanchy } from '../cards/impl/minion/sinrunner-blanchy';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const handleRebornForEntity = (\r\n\tboardWithKilledMinion: BoardEntity[],\r\n\tboardWithKilledMinionHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadMinionIndexFromRight: number,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst numberOfReborns = 1;\r\n\tlet entityToSpawn: BoardEntity = null;\r\n\tif (\r\n\t\tisSinrunnerBlanchy(deadEntity.cardId) ||\r\n\t\tdeadEntity.enchantments?.some(\r\n\t\t\t(e) => e.cardId === CardIds.UltraCapacitor_UltraCapacitorEnchantment_BG31_HERO_801ptje,\r\n\t\t)\r\n\t) {\r\n\t\tentityToSpawn = buildSinrunnerBlanchyRebornEntity(deadEntity);\r\n\t}\r\n\tconst entitiesFromReborn: readonly BoardEntity[] =\r\n\t\tdeadEntity.reborn && deadMinionIndexFromRight >= 0\r\n\t\t\t? spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\tnumberOfReborns,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tentityToSpawn,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t )\r\n\t\t\t: [];\r\n\tif (!entitiesFromReborn.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109 ||\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G\r\n\t) {\r\n\t\tentitiesFromReborn.forEach((e) => {\r\n\t\t\tconst attack = deadEntity.maxAttack;\r\n\t\t\tconst health = deadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G ? deadEntity.maxHealth : 1;\r\n\t\t\te.attack = attack;\r\n\t\t\te.health = health;\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of entitiesFromReborn) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornSelfEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornSelfEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of boardWithKilledMinion) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tconst entitiesThatWereReborn = performEntitySpawns(\r\n\t\tentitiesFromReborn,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tentitiesThatWereReborn.forEach((e) => (e.rebornFromEntityId = deadEntity.entityId));\r\n\tconst entityRightToSpawns =\r\n\t\tdeadMinionIndexFromRight === 0\r\n\t\t\t? null\r\n\t\t\t: boardWithKilledMinion[boardWithKilledMinion.length - deadMinionIndexFromRight];\r\n\tentitiesThatWereReborn.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tfor (const entity of boardWithKilledMinion) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\trebornImpl.afterReborn(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\tfor (const trinket of boardWithKilledMinionHero.trinkets ?? []) {\r\n\t\tconst rebornImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\trebornImpl.afterReborn(trinket, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\t// Arfus\r\n\tboardWithKilledMinion\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G,\r\n\t\t)\r\n\t\t.forEach((arfus) => {\r\n\t\t\tconst multiplier = arfus.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G ? 2 : 1;\r\n\t\t\tconst attackBonus = arfus.attack * multiplier;\r\n\t\t\tentitiesThatWereReborn\r\n\t\t\t\t.filter((e) => e.entityId !== arfus.entityId && e.rebornFromEntityId !== arfus.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\tmodifyStats(e, arfus, attackBonus, 0, boardWithKilledMinion, boardWithKilledMinionHero, gameState);\r\n\t\t\t\t});\r\n\t\t});\r\n\r\n\tconst numberOfTriggersForDeathwhisper = Math.min(entitiesThatWereReborn.length, 1);\r\n\tfor (let i = 0; i < numberOfTriggersForDeathwhisper; i++) {\r\n\t\tboardWithKilledMinion\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020 ||\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020_G,\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst multiplier = e.cardId === CardIds.SisterDeathwhisper_BG25_020_G ? 2 : 1;\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\tmultiplier * 1,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport interface RebornEffectInput {\r\n\treadonly rebornEntity: BoardEntity;\r\n\treadonly boardWithKilledMinion: BoardEntity[];\r\n\treadonly boardWithKilledMinionHero: BgsPlayerEntity;\r\n\treadonly opponentBoard: BoardEntity[];\r\n\treadonly opponentBoardHero: BgsPlayerEntity;\r\n\treadonly gameState: FullGameState;\r\n}\r\n"]}
1
+ {"version":3,"file":"reborn.js","sourceRoot":"","sources":["../../src/simulation/reborn.ts"],"names":[],"mappings":";;;AAEA,4DAA+F;AAC/F,iEAA4D;AAC5D,8EAA+G;AAE/G,oCAA2C;AAC3C,6DAAqD;AAErD,qCAA+C;AAC/C,mCAAsC;AAE/B,MAAM,qBAAqB,GAAG,CACpC,qBAAoC,EACpC,yBAA0C,EAC1C,UAAuB,EACvB,wBAAgC,EAChC,aAA4B,EAC5B,iBAAkC,EAClC,SAAwB,EACjB,EAAE;;IACT,MAAM,eAAe,GAAG,CAAC,CAAC;IAC1B,IAAI,aAAa,GAAgB,IAAI,CAAC;IACtC,IACC,IAAA,sCAAkB,EAAC,UAAU,CAAC,MAAM,CAAC;SACrC,MAAA,UAAU,CAAC,YAAY,0CAAE,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,wBAAuE,CACtF,CAAA,EACA;QACD,aAAa,GAAG,IAAA,qDAAiC,EAAC,UAAU,CAAC,CAAC;KAC9D;IACD,MAAM,kBAAkB,GACvB,UAAU,CAAC,MAAM,IAAI,wBAAwB,IAAI,CAAC;QACjD,CAAC,CAAC,IAAA,kCAAa,EACd,UAAU,CAAC,MAAM,EACjB,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EACzB,a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C;YAChD,CAAC,CAAC,MAAM,iBAA0C,CACnD;aACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9E,IAAA,uBAAe,EACd,CAAC,EACD,qBAAqB,EACrB,yBAAyB,EACzB,UAAU,GAAG,CAAC,EACd,UAAU,GAAG,CAAC,EACd,SAAS,CACT,CAAC;QACH,CAAC,CAAC,CAAC;KACJ;AACF,CAAC,CAAC;AAtKW,QAAA,qBAAqB,yBAsKhC","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasAfterReborn, hasRebornEffect, hasRebornSelfEffect } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { buildSinrunnerBlanchyRebornEntity, isSinrunnerBlanchy } from '../cards/impl/minion/sinrunner-blanchy';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const handleRebornForEntity = (\r\n\tboardWithKilledMinion: BoardEntity[],\r\n\tboardWithKilledMinionHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tdeadMinionIndexFromRight: number,\r\n\topponentBoard: BoardEntity[],\r\n\topponentBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst numberOfReborns = 1;\r\n\tlet entityToSpawn: BoardEntity = null;\r\n\tif (\r\n\t\tisSinrunnerBlanchy(deadEntity.cardId) ||\r\n\t\tdeadEntity.enchantments?.some(\r\n\t\t\t(e) => e.cardId === CardIds.UltraCapacitor_UltraCapacitorEnchantment_BG31_HERO_801ptje,\r\n\t\t)\r\n\t) {\r\n\t\tentityToSpawn = buildSinrunnerBlanchyRebornEntity(deadEntity);\r\n\t}\r\n\tconst entitiesFromReborn: readonly BoardEntity[] =\r\n\t\tdeadEntity.reborn && deadMinionIndexFromRight >= 0\r\n\t\t\t? spawnEntities(\r\n\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\tnumberOfReborns,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\ttrue,\r\n\t\t\t\ttrue,\r\n\t\t\t\tentityToSpawn,\r\n\t\t\t\tdeadEntity,\r\n\t\t\t)\r\n\t\t\t: [];\r\n\tif (!entitiesFromReborn.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109 ||\r\n\t\tdeadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G\r\n\t) {\r\n\t\tentitiesFromReborn.forEach((e) => {\r\n\t\t\tconst attack = deadEntity.maxAttack;\r\n\t\t\tconst health = deadEntity.cardId === CardIds.WannabeGargoyle_BG30_109_G ? deadEntity.maxHealth : 1;\r\n\t\t\te.attack = attack;\r\n\t\t\te.health = health;\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of entitiesFromReborn) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornSelfEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornSelfEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of boardWithKilledMinion) {\r\n\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\tif (hasRebornEffect(rebornImpl)) {\r\n\t\t\trebornImpl.rebornEffect(entity, {\r\n\t\t\t\trebornEntity: deadEntity,\r\n\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tconst entitiesThatWereReborn = performEntitySpawns(\r\n\t\tentitiesFromReborn,\r\n\t\tboardWithKilledMinion,\r\n\t\tboardWithKilledMinionHero,\r\n\t\tdeadEntity,\r\n\t\tdeadMinionIndexFromRight,\r\n\t\topponentBoard,\r\n\t\topponentBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tentitiesThatWereReborn.forEach((e) => (e.rebornFromEntityId = deadEntity.entityId));\r\n\tconst entityRightToSpawns =\r\n\t\tdeadMinionIndexFromRight === 0\r\n\t\t\t? null\r\n\t\t\t: boardWithKilledMinion[boardWithKilledMinion.length - deadMinionIndexFromRight];\r\n\tentitiesThatWereReborn.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tfor (const rebornEntity of entitiesThatWereReborn) {\r\n\t\tfor (const entity of boardWithKilledMinion) {\r\n\t\t\tconst rebornImpl = cardMappings[entity.cardId];\r\n\t\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\t\trebornImpl.afterReborn(entity, {\r\n\t\t\t\t\trebornEntity: rebornEntity,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (const trinket of boardWithKilledMinionHero.trinkets ?? []) {\r\n\t\t\tconst rebornImpl = cardMappings[trinket.cardId];\r\n\t\t\tif (hasAfterReborn(rebornImpl)) {\r\n\t\t\t\trebornImpl.afterReborn(trinket, {\r\n\t\t\t\t\trebornEntity: rebornEntity,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\topponentBoard,\r\n\t\t\t\t\topponentBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Arfus\r\n\tboardWithKilledMinion\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G,\r\n\t\t)\r\n\t\t.forEach((arfus) => {\r\n\t\t\tconst multiplier = arfus.cardId === CardIds.Arfus_TB_BaconShop_HERO_22_Buddy_G ? 2 : 1;\r\n\t\t\tconst attackBonus = arfus.attack * multiplier;\r\n\t\t\tentitiesThatWereReborn\r\n\t\t\t\t.filter((e) => e.entityId !== arfus.entityId && e.rebornFromEntityId !== arfus.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\tmodifyStats(e, arfus, attackBonus, 0, boardWithKilledMinion, boardWithKilledMinionHero, gameState);\r\n\t\t\t\t});\r\n\t\t});\r\n\r\n\tconst numberOfTriggersForDeathwhisper = Math.min(entitiesThatWereReborn.length, 1);\r\n\tfor (let i = 0; i < numberOfTriggersForDeathwhisper; i++) {\r\n\t\tboardWithKilledMinion\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020 ||\r\n\t\t\t\t\te.cardId === CardIds.SisterDeathwhisper_BG25_020_G,\r\n\t\t\t)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tconst multiplier = e.cardId === CardIds.SisterDeathwhisper_BG25_020_G ? 2 : 1;\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tboardWithKilledMinion,\r\n\t\t\t\t\tboardWithKilledMinionHero,\r\n\t\t\t\t\tmultiplier * 1,\r\n\t\t\t\t\tmultiplier * 3,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport interface RebornEffectInput {\r\n\treadonly rebornEntity: BoardEntity;\r\n\treadonly boardWithKilledMinion: BoardEntity[];\r\n\treadonly boardWithKilledMinionHero: BgsPlayerEntity;\r\n\treadonly opponentBoard: BoardEntity[];\r\n\treadonly opponentBoardHero: BgsPlayerEntity;\r\n\treadonly gameState: FullGameState;\r\n}\r\n"]}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildGameAction = void 0;
4
+ const resolve_trinket_hero_power_1 = require("./resolve-trinket-hero-power");
4
5
  const buildGameAction = (playerHero, opponentHero, action) => {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
6
7
  const isPlayerSireD = (_a = playerHero === null || playerHero === void 0 ? void 0 : playerHero.cardId) === null || _a === void 0 ? void 0 : _a.startsWith("BG24_HERO_100");
7
8
  const isOpponentSireD = (_b = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.cardId) === null || _b === void 0 ? void 0 : _b.startsWith("BG24_HERO_100");
8
9
  const result = {
@@ -10,36 +11,36 @@ const buildGameAction = (playerHero, opponentHero, action) => {
10
11
  playerSecrets: ((_c = playerHero === null || playerHero === void 0 ? void 0 : playerHero.secrets) !== null && _c !== void 0 ? _c : []).filter((s) => !s.triggered),
11
12
  playerCardId: playerHero === null || playerHero === void 0 ? void 0 : playerHero.cardId,
12
13
  playerEntityId: playerHero === null || playerHero === void 0 ? void 0 : playerHero.entityId,
13
- playerHeroPowerCardId: (_h = (_e = (_d = playerHero === null || playerHero === void 0 ? void 0 : playerHero.trinkets.find((t) => t.scriptDataNum6 === 3)) === null || _d === void 0 ? void 0 : _d.cardId) !== null && _e !== void 0 ? _e : (isPlayerSireD ? (_g = (_f = playerHero.questRewardEntities) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.cardId : null)) !== null && _h !== void 0 ? _h : (_j = playerHero === null || playerHero === void 0 ? void 0 : playerHero.heroPowers[0]) === null || _j === void 0 ? void 0 : _j.cardId,
14
+ playerHeroPowerCardId: (_g = (_d = (0, resolve_trinket_hero_power_1.resolveTrinketHeroPowerCardId)(playerHero === null || playerHero === void 0 ? void 0 : playerHero.trinkets)) !== null && _d !== void 0 ? _d : (isPlayerSireD ? (_f = (_e = playerHero.questRewardEntities) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.cardId : null)) !== null && _g !== void 0 ? _g : (_h = playerHero === null || playerHero === void 0 ? void 0 : playerHero.heroPowers[0]) === null || _h === void 0 ? void 0 : _h.cardId,
14
15
  playerHeroPowerEntityId: 100000002,
15
- playerHeroPowerUsed: (_k = playerHero === null || playerHero === void 0 ? void 0 : playerHero.heroPowers[0]) === null || _k === void 0 ? void 0 : _k.used,
16
+ playerHeroPowerUsed: (_j = playerHero === null || playerHero === void 0 ? void 0 : playerHero.heroPowers[0]) === null || _j === void 0 ? void 0 : _j.used,
16
17
  playerHeroPowers: playerHero === null || playerHero === void 0 ? void 0 : playerHero.heroPowers,
17
- playerRewardCardId: isPlayerSireD && ((_l = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _l === void 0 ? void 0 : _l.length) < 2
18
+ playerRewardCardId: isPlayerSireD && ((_k = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _k === void 0 ? void 0 : _k.length) < 2
18
19
  ? null
19
- : (_p = (_o = (_m = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _m === void 0 ? void 0 : _m[1]) === null || _o === void 0 ? void 0 : _o.cardId) !== null && _p !== void 0 ? _p : (_q = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewards) === null || _q === void 0 ? void 0 : _q[0],
20
- playerRewardEntityId: isPlayerSireD && ((_r = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _r === void 0 ? void 0 : _r.length) < 2
20
+ : (_o = (_m = (_l = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _l === void 0 ? void 0 : _l[1]) === null || _m === void 0 ? void 0 : _m.cardId) !== null && _o !== void 0 ? _o : (_p = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewards) === null || _p === void 0 ? void 0 : _p[0],
21
+ playerRewardEntityId: isPlayerSireD && ((_q = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _q === void 0 ? void 0 : _q.length) < 2
21
22
  ? null
22
- : (_t = (_s = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _s === void 0 ? void 0 : _s[1]) === null || _t === void 0 ? void 0 : _t.entityId,
23
- playerRewardData: isPlayerSireD && ((_u = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _u === void 0 ? void 0 : _u.length) < 2
23
+ : (_s = (_r = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _r === void 0 ? void 0 : _r[1]) === null || _s === void 0 ? void 0 : _s.entityId,
24
+ playerRewardData: isPlayerSireD && ((_t = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _t === void 0 ? void 0 : _t.length) < 2
24
25
  ? null
25
- : (_x = (_w = (_v = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.scriptDataNum1) !== null && _x !== void 0 ? _x : 0,
26
+ : (_w = (_v = (_u = playerHero === null || playerHero === void 0 ? void 0 : playerHero.questRewardEntities) === null || _u === void 0 ? void 0 : _u[0]) === null || _v === void 0 ? void 0 : _v.scriptDataNum1) !== null && _w !== void 0 ? _w : 0,
26
27
  playerTrinkets: playerHero === null || playerHero === void 0 ? void 0 : playerHero.trinkets,
27
- opponentSecrets: ((_y = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.secrets) !== null && _y !== void 0 ? _y : []).filter((s) => !s.triggered),
28
+ opponentSecrets: ((_x = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.secrets) !== null && _x !== void 0 ? _x : []).filter((s) => !s.triggered),
28
29
  opponentCardId: opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.cardId,
29
30
  opponentEntityId: opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.entityId,
30
- opponentHeroPowerCardId: (_5 = (_3 = (_0 = (_z = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.trinkets.find((t) => t.scriptDataNum6 === 3)) === null || _z === void 0 ? void 0 : _z.cardId) !== null && _0 !== void 0 ? _0 : (isOpponentSireD ? (_2 = (_1 = opponentHero.questRewardEntities) === null || _1 === void 0 ? void 0 : _1[0]) === null || _2 === void 0 ? void 0 : _2.cardId : null)) !== null && _3 !== void 0 ? _3 : (_4 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.heroPowers[0]) === null || _4 === void 0 ? void 0 : _4.cardId) !== null && _5 !== void 0 ? _5 : opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.heroPowerId,
31
+ opponentHeroPowerCardId: (_3 = (_1 = (_y = (0, resolve_trinket_hero_power_1.resolveTrinketHeroPowerCardId)(opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.trinkets)) !== null && _y !== void 0 ? _y : (isOpponentSireD ? (_0 = (_z = opponentHero.questRewardEntities) === null || _z === void 0 ? void 0 : _z[0]) === null || _0 === void 0 ? void 0 : _0.cardId : null)) !== null && _1 !== void 0 ? _1 : (_2 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.heroPowers[0]) === null || _2 === void 0 ? void 0 : _2.cardId) !== null && _3 !== void 0 ? _3 : opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.heroPowerId,
31
32
  opponentHeroPowerEntityId: 200000002,
32
33
  opponentHeroPowerUsed: opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.heroPowerUsed,
33
34
  opponentHeroPowers: opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.heroPowers,
34
- opponentRewardCardId: isOpponentSireD && ((_6 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _6 === void 0 ? void 0 : _6.length) < 2
35
+ opponentRewardCardId: isOpponentSireD && ((_4 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _4 === void 0 ? void 0 : _4.length) < 2
35
36
  ? null
36
- : (_9 = (_8 = (_7 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _7 === void 0 ? void 0 : _7[1]) === null || _8 === void 0 ? void 0 : _8.cardId) !== null && _9 !== void 0 ? _9 : (_10 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewards) === null || _10 === void 0 ? void 0 : _10[0],
37
- opponentRewardEntityId: isOpponentSireD && ((_11 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _11 === void 0 ? void 0 : _11.length) < 2
37
+ : (_7 = (_6 = (_5 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _5 === void 0 ? void 0 : _5[1]) === null || _6 === void 0 ? void 0 : _6.cardId) !== null && _7 !== void 0 ? _7 : (_8 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewards) === null || _8 === void 0 ? void 0 : _8[0],
38
+ opponentRewardEntityId: isOpponentSireD && ((_9 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _9 === void 0 ? void 0 : _9.length) < 2
38
39
  ? null
39
- : (_13 = (_12 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _12 === void 0 ? void 0 : _12[1]) === null || _13 === void 0 ? void 0 : _13.entityId,
40
- opponentRewardData: isOpponentSireD && ((_14 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _14 === void 0 ? void 0 : _14.length) < 2
40
+ : (_11 = (_10 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _10 === void 0 ? void 0 : _10[1]) === null || _11 === void 0 ? void 0 : _11.entityId,
41
+ opponentRewardData: isOpponentSireD && ((_12 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _12 === void 0 ? void 0 : _12.length) < 2
41
42
  ? null
42
- : (_17 = (_16 = (_15 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _15 === void 0 ? void 0 : _15[0]) === null || _16 === void 0 ? void 0 : _16.scriptDataNum1) !== null && _17 !== void 0 ? _17 : 0,
43
+ : (_15 = (_14 = (_13 = opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.questRewardEntities) === null || _13 === void 0 ? void 0 : _13[0]) === null || _14 === void 0 ? void 0 : _14.scriptDataNum1) !== null && _15 !== void 0 ? _15 : 0,
43
44
  opponentTrinkets: opponentHero === null || opponentHero === void 0 ? void 0 : opponentHero.trinkets,
44
45
  };
45
46
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"game-action.js","sourceRoot":"","sources":["../../../src/simulation/spectator/game-action.ts"],"names":[],"mappings":";;;AA0DO,MAAM,eAAe,GAAG,CAC9B,UAA2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BAAmB,4CAAE,MAAM,IAAG,CAAC;YAC/D,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,OAAA,OAAA,OAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,mBAAmB,4CAAG,CAAC,CAAC,4CAAE,cAAc,qCAAI,CAAC;QAC/D,gBAAgB,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ;KAC1B,CAAC;IAChB,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AA9DW,QAAA,eAAe,mBA8D1B","sourcesContent":["import { CardIds } from '../../services/card-ids';\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\n\r\nexport interface GameAction {\r\n\ttype:\r\n\t\t| 'damage'\r\n\t\t| 'attack'\r\n\t\t| 'spawn'\r\n\t\t| 'minion-death'\r\n\t\t| 'power-target'\r\n\t\t| 'start-of-combat'\r\n\t\t| 'player-attack'\r\n\t\t| 'opponent-attack';\r\n\tplayerBoard: readonly BoardEntity[];\r\n\tplayerHand: readonly BoardEntity[];\r\n\tplayerSecrets: readonly BoardSecret[];\r\n\tplayerTrinkets: readonly BoardTrinket[];\r\n\topponentBoard: readonly BoardEntity[];\r\n\topponentHand: readonly BoardEntity[];\r\n\topponentSecrets: readonly BoardSecret[];\r\n\topponentTrinkets: readonly BoardTrinket[];\r\n\tplayerCardId: string;\r\n\tplayerEntityId: number;\r\n\tplayerHeroPowerCardId: string;\r\n\tplayerHeroPowerEntityId: number;\r\n\tplayerHeroPowerUsed: boolean;\r\n\tplayerHeroPowers: readonly BgsHeroPower[];\r\n\topponentCardId: string;\r\n\topponentEntityId: number;\r\n\topponentHeroPowerCardId: string;\r\n\topponentHeroPowerEntityId: number;\r\n\topponentHeroPowerUsed: boolean;\r\n\topponentHeroPowers: readonly BgsHeroPower[];\r\n\tplayerRewardCardId: string;\r\n\tplayerRewardEntityId: number;\r\n\tplayerRewardData: number;\r\n\topponentRewardCardId: string;\r\n\topponentRewardEntityId: number;\r\n\topponentRewardData: number;\r\n\tsourceEntityId?: number;\r\n\t/** @deprecated */\r\n\ttargetEntityId?: number;\r\n\ttargetEntityIds?: number[];\r\n\r\n\tdamages?: Damage[];\r\n\tspawns?: readonly BoardEntity[];\r\n\tdeaths?: readonly BoardEntity[];\r\n\tdeadMinionsPositionsOnBoard?: readonly number[];\r\n}\r\n\r\nexport interface Damage {\r\n\treadonly sourceEntityId?: number;\r\n\treadonly targetEntityId?: number;\r\n\treadonly damage?: number;\r\n}\r\n\r\nexport const buildGameAction = (\r\n\tplayerHero: BgsPlayerEntity,\r\n\topponentHero: BgsPlayerEntity,\r\n\taction: Partial<GameAction>,\r\n): GameAction => {\r\n\tconst isPlayerSireD = playerHero?.cardId?.startsWith(CardIds.SireDenathrius_BG24_HERO_100);\r\n\tconst isOpponentSireD = opponentHero?.cardId?.startsWith(CardIds.SireDenathrius_BG24_HERO_100);\r\n\tconst result: GameAction = {\r\n\t\t...action,\r\n\r\n\t\tplayerSecrets: (playerHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\tplayerCardId: playerHero?.cardId,\r\n\t\tplayerEntityId: playerHero?.entityId,\r\n\r\n\t\tplayerHeroPowerCardId:\r\n\t\t\tplayerHero?.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t\t\t(isPlayerSireD ? playerHero.questRewardEntities?.[0]?.cardId : null) ??\r\n\t\t\tplayerHero?.heroPowers[0]?.cardId,\r\n\t\tplayerHeroPowerEntityId: 100000002,\r\n\t\tplayerHeroPowerUsed: playerHero?.heroPowers[0]?.used,\r\n\t\tplayerHeroPowers: playerHero?.heroPowers,\r\n\r\n\t\tplayerRewardCardId:\r\n\t\t\tisPlayerSireD && playerHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: playerHero?.questRewardEntities?.[1]?.cardId ?? playerHero?.questRewards?.[0],\r\n\t\tplayerRewardEntityId:\r\n\t\t\tisPlayerSireD && playerHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: playerHero?.questRewardEntities?.[1]?.entityId,\r\n\t\tplayerRewardData:\r\n\t\t\tisPlayerSireD && playerHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: playerHero?.questRewardEntities?.[0]?.scriptDataNum1 ?? 0,\r\n\t\tplayerTrinkets: playerHero?.trinkets,\r\n\r\n\t\topponentSecrets: (opponentHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\topponentCardId: opponentHero?.cardId,\r\n\t\topponentEntityId: opponentHero?.entityId,\r\n\t\topponentHeroPowerCardId:\r\n\t\t\topponentHero?.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t\t\t(isOpponentSireD ? opponentHero.questRewardEntities?.[0]?.cardId : null) ??\r\n\t\t\topponentHero?.heroPowers[0]?.cardId ??\r\n\t\t\topponentHero?.heroPowerId,\r\n\t\topponentHeroPowerEntityId: 200000002,\r\n\t\topponentHeroPowerUsed: opponentHero?.heroPowerUsed,\r\n\t\topponentHeroPowers: opponentHero?.heroPowers,\r\n\t\topponentRewardCardId:\r\n\t\t\tisOpponentSireD && opponentHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: opponentHero?.questRewardEntities?.[1]?.cardId ?? opponentHero?.questRewards?.[0],\r\n\t\topponentRewardEntityId:\r\n\t\t\tisOpponentSireD && opponentHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: opponentHero?.questRewardEntities?.[1]?.entityId,\r\n\t\topponentRewardData:\r\n\t\t\tisOpponentSireD && opponentHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: opponentHero?.questRewardEntities?.[0]?.scriptDataNum1 ?? 0,\r\n\t\topponentTrinkets: opponentHero?.trinkets,\r\n\t} as GameAction;\r\n\treturn result;\r\n};\r\n"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AM,IAAG,CAAC;YAC/D,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,OAAA,OAAA,OAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,mBAAmB,4CAAG,CAAC,CAAC,4CAAE,cAAc,qCAAI,CAAC;QAC/D,gBAAgB,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ;KAC1B,CAAC;IAChB,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AA9DW,QAAA,eAAe,mBA8D1B","sourcesContent":["import { CardIds } from '../../services/card-ids';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { resolveTrinketHeroPowerCardId } from './resolve-trinket-hero-power';\r\n\r\nexport interface GameAction {\r\n\ttype:\r\n\t\t| 'damage'\r\n\t\t| 'attack'\r\n\t\t| 'spawn'\r\n\t\t| 'minion-death'\r\n\t\t| 'power-target'\r\n\t\t| 'start-of-combat'\r\n\t\t| 'player-attack'\r\n\t\t| 'opponent-attack';\r\n\tplayerBoard: readonly BoardEntity[];\r\n\tplayerHand: readonly BoardEntity[];\r\n\tplayerSecrets: readonly BoardSecret[];\r\n\tplayerTrinkets: readonly BoardTrinket[];\r\n\topponentBoard: readonly BoardEntity[];\r\n\topponentHand: readonly BoardEntity[];\r\n\topponentSecrets: readonly BoardSecret[];\r\n\topponentTrinkets: readonly BoardTrinket[];\r\n\tplayerCardId: string;\r\n\tplayerEntityId: number;\r\n\tplayerHeroPowerCardId: string;\r\n\tplayerHeroPowerEntityId: number;\r\n\tplayerHeroPowerUsed: boolean;\r\n\tplayerHeroPowers: readonly BgsHeroPower[];\r\n\topponentCardId: string;\r\n\topponentEntityId: number;\r\n\topponentHeroPowerCardId: string;\r\n\topponentHeroPowerEntityId: number;\r\n\topponentHeroPowerUsed: boolean;\r\n\topponentHeroPowers: readonly BgsHeroPower[];\r\n\tplayerRewardCardId: string;\r\n\tplayerRewardEntityId: number;\r\n\tplayerRewardData: number;\r\n\topponentRewardCardId: string;\r\n\topponentRewardEntityId: number;\r\n\topponentRewardData: number;\r\n\tsourceEntityId?: number;\r\n\t/** @deprecated */\r\n\ttargetEntityId?: number;\r\n\ttargetEntityIds?: number[];\r\n\r\n\tdamages?: Damage[];\r\n\tspawns?: readonly BoardEntity[];\r\n\tdeaths?: readonly BoardEntity[];\r\n\tdeadMinionsPositionsOnBoard?: readonly number[];\r\n}\r\n\r\nexport interface Damage {\r\n\treadonly sourceEntityId?: number;\r\n\treadonly targetEntityId?: number;\r\n\treadonly damage?: number;\r\n}\r\n\r\nexport const buildGameAction = (\r\n\tplayerHero: BgsPlayerEntity,\r\n\topponentHero: BgsPlayerEntity,\r\n\taction: Partial<GameAction>,\r\n): GameAction => {\r\n\tconst isPlayerSireD = playerHero?.cardId?.startsWith(CardIds.SireDenathrius_BG24_HERO_100);\r\n\tconst isOpponentSireD = opponentHero?.cardId?.startsWith(CardIds.SireDenathrius_BG24_HERO_100);\r\n\tconst result: GameAction = {\r\n\t\t...action,\r\n\r\n\t\tplayerSecrets: (playerHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\tplayerCardId: playerHero?.cardId,\r\n\t\tplayerEntityId: playerHero?.entityId,\r\n\r\n\t\tplayerHeroPowerCardId:\r\n\t\t\tresolveTrinketHeroPowerCardId(playerHero?.trinkets) ??\r\n\t\t\t(isPlayerSireD ? playerHero.questRewardEntities?.[0]?.cardId : null) ??\r\n\t\t\tplayerHero?.heroPowers[0]?.cardId,\r\n\t\tplayerHeroPowerEntityId: 100000002,\r\n\t\tplayerHeroPowerUsed: playerHero?.heroPowers[0]?.used,\r\n\t\tplayerHeroPowers: playerHero?.heroPowers,\r\n\r\n\t\tplayerRewardCardId:\r\n\t\t\tisPlayerSireD && playerHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: playerHero?.questRewardEntities?.[1]?.cardId ?? playerHero?.questRewards?.[0],\r\n\t\tplayerRewardEntityId:\r\n\t\t\tisPlayerSireD && playerHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: playerHero?.questRewardEntities?.[1]?.entityId,\r\n\t\tplayerRewardData:\r\n\t\t\tisPlayerSireD && playerHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: playerHero?.questRewardEntities?.[0]?.scriptDataNum1 ?? 0,\r\n\t\tplayerTrinkets: playerHero?.trinkets,\r\n\r\n\t\topponentSecrets: (opponentHero?.secrets ?? []).filter((s) => !s.triggered),\r\n\t\topponentCardId: opponentHero?.cardId,\r\n\t\topponentEntityId: opponentHero?.entityId,\r\n\t\topponentHeroPowerCardId:\r\n\t\t\tresolveTrinketHeroPowerCardId(opponentHero?.trinkets) ??\r\n\t\t\t(isOpponentSireD ? opponentHero.questRewardEntities?.[0]?.cardId : null) ??\r\n\t\t\topponentHero?.heroPowers[0]?.cardId ??\r\n\t\t\topponentHero?.heroPowerId,\r\n\t\topponentHeroPowerEntityId: 200000002,\r\n\t\topponentHeroPowerUsed: opponentHero?.heroPowerUsed,\r\n\t\topponentHeroPowers: opponentHero?.heroPowers,\r\n\t\topponentRewardCardId:\r\n\t\t\tisOpponentSireD && opponentHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: opponentHero?.questRewardEntities?.[1]?.cardId ?? opponentHero?.questRewards?.[0],\r\n\t\topponentRewardEntityId:\r\n\t\t\tisOpponentSireD && opponentHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: opponentHero?.questRewardEntities?.[1]?.entityId,\r\n\t\topponentRewardData:\r\n\t\t\tisOpponentSireD && opponentHero?.questRewardEntities?.length < 2\r\n\t\t\t\t? null\r\n\t\t\t\t: opponentHero?.questRewardEntities?.[0]?.scriptDataNum1 ?? 0,\r\n\t\topponentTrinkets: opponentHero?.trinkets,\r\n\t} as GameAction;\r\n\treturn result;\r\n};\r\n"]}
@@ -0,0 +1,2 @@
1
+ import { BoardTrinket } from '../../bgs-player-entity';
2
+ export declare const resolveTrinketHeroPowerCardId: (trinkets: readonly BoardTrinket[] | null | undefined) => string | null;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveTrinketHeroPowerCardId = void 0;
4
+ const reference_data_1 = require("@firestone-hs/reference-data");
5
+ const TRINKET_SLOT_HERO_POWER = 3;
6
+ const resolveTrinketHeroPowerCardId = (trinkets) => {
7
+ var _a;
8
+ if (!(trinkets === null || trinkets === void 0 ? void 0 : trinkets.length)) {
9
+ return null;
10
+ }
11
+ const regularTrinketCardIds = new Set(trinkets
12
+ .filter((trinket) => trinket.scriptDataNum6 !== TRINKET_SLOT_HERO_POWER && !!trinket.cardId)
13
+ .map((trinket) => trinket.cardId));
14
+ const slot3Trinket = trinkets.find((trinket) => trinket.scriptDataNum6 === TRINKET_SLOT_HERO_POWER);
15
+ if (!(slot3Trinket === null || slot3Trinket === void 0 ? void 0 : slot3Trinket.cardId)) {
16
+ return null;
17
+ }
18
+ if (((_a = slot3Trinket.tags) === null || _a === void 0 ? void 0 : _a[reference_data_1.GameTag.ADDITIONAL_HERO_POWER_INDEX]) === 1) {
19
+ return null;
20
+ }
21
+ if (regularTrinketCardIds.has(slot3Trinket.cardId)) {
22
+ return null;
23
+ }
24
+ return slot3Trinket.cardId;
25
+ };
26
+ exports.resolveTrinketHeroPowerCardId = resolveTrinketHeroPowerCardId;
27
+ //# sourceMappingURL=resolve-trinket-hero-power.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-trinket-hero-power.js","sourceRoot":"","sources":["../../../src/simulation/spectator/resolve-trinket-hero-power.ts"],"names":[],"mappings":";;;AAAA,iEAAuD;AAGvD,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAE3B,MAAM,6BAA6B,GAAG,CAC5C,QAAoD,EACpC,EAAE;;IAClB,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA,EAAE;QACtB,OAAO,IAAI,CAAC;KACZ;IAED,MAAM,qBAAqB,GAAG,IAAI,GAAG,CACpC,QAAQ;SACN,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,KAAK,uBAAuB,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;SAC3F,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAClC,CAAC;IACF,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,KAAK,uBAAuB,CAAC,CAAC;IACpG,IAAI,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,CAAA,EAAE;QAC1B,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,CAAA,MAAA,YAAY,CAAC,IAAI,0CAAG,wBAAO,CAAC,2BAA2B,CAAC,MAAK,CAAC,EAAE;QACnE,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,qBAAqB,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QACnD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,YAAY,CAAC,MAAM,CAAC;AAC5B,CAAC,CAAC;AAvBW,QAAA,6BAA6B,iCAuBxC","sourcesContent":["import { GameTag } from '@firestone-hs/reference-data';\r\nimport { BoardTrinket } from '../../bgs-player-entity';\r\n\r\nconst TRINKET_SLOT_HERO_POWER = 3;\r\n\r\nexport const resolveTrinketHeroPowerCardId = (\r\n\ttrinkets: readonly BoardTrinket[] | null | undefined,\r\n): string | null => {\r\n\tif (!trinkets?.length) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst regularTrinketCardIds = new Set(\r\n\t\ttrinkets\r\n\t\t\t.filter((trinket) => trinket.scriptDataNum6 !== TRINKET_SLOT_HERO_POWER && !!trinket.cardId)\r\n\t\t\t.map((trinket) => trinket.cardId),\r\n\t);\r\n\tconst slot3Trinket = trinkets.find((trinket) => trinket.scriptDataNum6 === TRINKET_SLOT_HERO_POWER);\r\n\tif (!slot3Trinket?.cardId) {\r\n\t\treturn null;\r\n\t}\r\n\tif (slot3Trinket.tags?.[GameTag.ADDITIONAL_HERO_POWER_INDEX] === 1) {\r\n\t\treturn null;\r\n\t}\r\n\tif (regularTrinketCardIds.has(slot3Trinket.cardId)) {\r\n\t\treturn null;\r\n\t}\r\n\treturn slot3Trinket.cardId;\r\n};\r\n"]}
@@ -382,6 +382,7 @@ class Spectator {
382
382
  entityId: t.entityId,
383
383
  scriptDataNum1: t.scriptDataNum1,
384
384
  scriptDataNum6: t.scriptDataNum6,
385
+ tags: t.tags,
385
386
  }));
386
387
  return result;
387
388
  }
@@ -1 +1 @@
1
- {"version":3,"file":"spectator.js","sourceRoot":"","sources":["../../../src/simulation/spectator/spectator.ts"],"names":[],"mappings":";;;AAIA,+CAA4D;AAG5D,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,SAAS;IAMrB,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;QAC5C,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,C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AAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;SACP,CAAA,CAClB,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,QAAiC;QACzD,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA,EAAE;YACtB,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,CACL,CAAC;YACA,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,cAAc,EAAE,CAAC,CAAC,cAAc;SACf,CAAA,CACnB,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AAveD,8BAueC","sourcesContent":["import { BgsGameState } from '../../bgs-battle-info';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction, buildGameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tconstructor(private readonly enabled: boolean) {\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(gameState: BgsGameState): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn {\r\n\t\t\t\twon: [],\r\n\t\t\t\tlost: [],\r\n\t\t\t\ttied: [],\r\n\t\t\t};\r\n\t\t}\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle, gameState)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle, gameState)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle, gameState)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample, gameState: BgsGameState): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t\tanomalies: gameState.anomalies,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t\tanomalies: [],\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst action: GameAction = buildGameAction(playerHero, opponentHero, {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTargets(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntities: (BoardEntity | BgsPlayerEntity)[],\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!targetEntities?.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityIds: targetEntities.map((entity) => entity.entityId),\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardTrinket,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity?.entityId) {\r\n\t\t\t// console.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t\tplayerTrinkets: this.sanitizeTrinkets(actions[i].playerTrinkets),\r\n\t\t\t\topponentTrinkets: this.sanitizeTrinkets(actions[i].opponentTrinkets),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction) {\r\n\t\t\t\taction.playerBoard = action.playerBoard ?? lastAction.playerBoard;\r\n\t\t\t\taction.opponentBoard = action.opponentBoard ?? lastAction.opponentBoard;\r\n\t\t\t\taction.playerHand = action.playerHand ?? lastAction.playerHand;\r\n\t\t\t\taction.opponentHand = action.opponentHand ?? lastAction.opponentHand;\r\n\t\t\t\taction.playerSecrets = action.playerSecrets ?? lastAction.playerSecrets;\r\n\t\t\t\taction.opponentSecrets = action.opponentSecrets ?? lastAction.opponentSecrets;\r\n\t\t\t\taction.playerRewardCardId = action.playerRewardCardId ?? lastAction.playerRewardCardId;\r\n\t\t\t\taction.playerRewardEntityId = action.playerRewardEntityId ?? lastAction.playerRewardEntityId;\r\n\t\t\t\taction.playerRewardData = action.playerRewardData ?? lastAction.playerRewardData;\r\n\t\t\t\taction.opponentRewardCardId = action.opponentRewardCardId ?? lastAction.opponentRewardCardId;\r\n\t\t\t\taction.opponentRewardEntityId = action.opponentRewardEntityId ?? lastAction.opponentRewardEntityId;\r\n\t\t\t\taction.opponentRewardData = action.opponentRewardData ?? lastAction.opponentRewardData;\r\n\t\t\t\taction.playerCardId = action.playerCardId ?? lastAction.playerCardId;\r\n\t\t\t\taction.playerEntityId = action.playerEntityId ?? lastAction.playerEntityId;\r\n\t\t\t\taction.playerHeroPowerCardId = action.playerHeroPowerCardId ?? lastAction.playerHeroPowerCardId;\r\n\t\t\t\taction.playerHeroPowerEntityId = action.playerHeroPowerEntityId ?? lastAction.playerHeroPowerEntityId;\r\n\t\t\t\taction.playerHeroPowerUsed = action.playerHeroPowerUsed ?? lastAction.playerHeroPowerUsed;\r\n\t\t\t\taction.opponentCardId = action.opponentCardId ?? lastAction.opponentCardId;\r\n\t\t\t\taction.opponentEntityId = action.opponentEntityId ?? lastAction.opponentEntityId;\r\n\t\t\t\taction.opponentHeroPowerCardId = action.opponentHeroPowerCardId ?? lastAction.opponentHeroPowerCardId;\r\n\t\t\t\taction.opponentHeroPowerEntityId =\r\n\t\t\t\t\taction.opponentHeroPowerEntityId ?? lastAction.opponentHeroPowerEntityId;\r\n\t\t\t\taction.opponentHeroPowerUsed = action.opponentHeroPowerUsed ?? lastAction.opponentHeroPowerUsed;\r\n\t\t\t\taction.playerTrinkets = action.playerTrinkets ?? lastAction.playerTrinkets;\r\n\t\t\t\taction.opponentTrinkets = action.opponentTrinkets ?? lastAction.opponentTrinkets;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n\r\n\tprivate sanitizeTrinkets(trinkets: readonly BoardTrinket[]): readonly BoardTrinket[] {\r\n\t\tif (!trinkets?.length) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tconst result = trinkets.map(\r\n\t\t\t(t) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tcardId: t.cardId,\r\n\t\t\t\t\tentityId: t.entityId,\r\n\t\t\t\t\tscriptDataNum1: t.scriptDataNum1,\r\n\t\t\t\t\tscriptDataNum6: t.scriptDataNum6,\r\n\t\t\t\t} as BoardTrinket),\r\n\t\t);\r\n\t\treturn result;\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"spectator.js","sourceRoot":"","sources":["../../../src/simulation/spectator/spectator.ts"],"names":[],"mappings":";;;AAIA,+CAA4D;AAG5D,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,SAAS;IAMrB,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;QAC5C,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC3D,CAAC;IAEM,mBAAmB,CAAC,SAAuB;;QAKjD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YAClB,OAAO;gBACN,GAAG,EAAE,EAAE;gBACP,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,EAAE;aACR,CAAC;SACF;QACD,OAAO;YACN,GAAG,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI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AC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;SACP,CAAA,CAClB,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,QAAiC;QACzD,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA,EAAE;YACtB,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,CACL,CAAC;YACA,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,IAAI,EAAE,CAAC,CAAC,IAAI;SACK,CAAA,CACnB,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AAxeD,8BAweC","sourcesContent":["import { BgsGameState } from '../../bgs-battle-info';\r\nimport { BgsPlayerEntity, BoardTrinket } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { BoardSecret } from '../../board-secret';\r\nimport { GameAction, buildGameAction } from './game-action';\r\nimport { GameSample } from './game-sample';\r\n\r\nconst MAX_SAMPLES = 1;\r\n\r\nexport class Spectator {\r\n\tprivate actionsForCurrentBattle: GameAction[];\r\n\tprivate wonBattles: GameSample[];\r\n\tprivate tiedBattles: GameSample[];\r\n\tprivate lostBattles: GameSample[];\r\n\r\n\tconstructor(private readonly enabled: boolean) {\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\t\tthis.wonBattles = [];\r\n\t\tthis.tiedBattles = [];\r\n\t\tthis.lostBattles = [];\r\n\t}\r\n\r\n\tpublic prune(): void {\r\n\t\tthis.wonBattles = this.wonBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.lostBattles = this.lostBattles.slice(0, MAX_SAMPLES);\r\n\t\tthis.tiedBattles = this.tiedBattles.slice(0, MAX_SAMPLES);\r\n\t}\r\n\r\n\tpublic buildOutcomeSamples(gameState: BgsGameState): {\r\n\t\twon: readonly GameSample[];\r\n\t\tlost: readonly GameSample[];\r\n\t\ttied: readonly GameSample[];\r\n\t} {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn {\r\n\t\t\t\twon: [],\r\n\t\t\t\tlost: [],\r\n\t\t\t\ttied: [],\r\n\t\t\t};\r\n\t\t}\r\n\t\treturn {\r\n\t\t\twon: this.wonBattles?.map((battle) => this.cleanUpActions(battle, gameState)),\r\n\t\t\tlost: this.lostBattles?.map((battle) => this.cleanUpActions(battle, gameState)),\r\n\t\t\ttied: this.tiedBattles?.map((battle) => this.cleanUpActions(battle, gameState)),\r\n\t\t};\r\n\t}\r\n\r\n\tprivate cleanUpActions(battle: GameSample, gameState: BgsGameState): GameSample {\r\n\t\tconst collapsed = this.collapseActions(battle.actions);\r\n\t\tconst result: GameSample = {\r\n\t\t\t...battle,\r\n\t\t\tactions: collapsed,\r\n\t\t\tanomalies: gameState.anomalies,\r\n\t\t};\r\n\t\treturn result;\r\n\t}\r\n\r\n\tpublic commitBattleResult(result: 'won' | 'lost' | 'tied'): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (\r\n\t\t\tthis.wonBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.lostBattles.length >= MAX_SAMPLES &&\r\n\t\t\tthis.tiedBattles.length >= MAX_SAMPLES\r\n\t\t) {\r\n\t\t\tthis.actionsForCurrentBattle = [];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// const actionsForBattle = this.collapseActions(this.actionsForCurrentBattle);\r\n\t\tconst actionsForBattle = this.actionsForCurrentBattle;\r\n\t\tthis.actionsForCurrentBattle = [];\r\n\r\n\t\tconst battle: GameSample = {\r\n\t\t\tactions: actionsForBattle,\r\n\t\t\tanomalies: [],\r\n\t\t};\r\n\t\tswitch (result) {\r\n\t\t\tcase 'won':\r\n\t\t\t\tthis.wonBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'lost':\r\n\t\t\t\tthis.lostBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'tied':\r\n\t\t\t\tthis.tiedBattles.push(battle);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic registerAttack(\r\n\t\tattackingEntity: BoardEntity,\r\n\t\tdefendingEntity: BoardEntity,\r\n\t\tattackingBoard: readonly BoardEntity[],\r\n\t\tdefendingBoard: readonly BoardEntity[],\r\n\t\tattackingBoardHero: BgsPlayerEntity,\r\n\t\tdefendingBoardHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// console.debug(\r\n\t\t// \t'\\n register attack',\r\n\t\t// \tstringifySimple(attackingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tstringifySimple(defendingBoard),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2441),\r\n\t\t// \t'\\n',\r\n\t\t// \tattackingBoard.find((e) => e.entityId === 2442),\r\n\t\t// );\r\n\t\tconst isAttackerFriendly = attackingBoard.every((entity) => entity.friendly);\r\n\t\tconst playerHero = isAttackerFriendly ? attackingBoardHero : defendingBoardHero;\r\n\t\tconst opponentHero = isAttackerFriendly ? defendingBoardHero : attackingBoardHero;\r\n\t\tconst friendlyBoard = isAttackerFriendly ? attackingBoard : defendingBoard;\r\n\t\tconst opponentBoard = isAttackerFriendly ? defendingBoard : attackingBoard;\r\n\t\tconst action: GameAction = buildGameAction(playerHero, opponentHero, {\r\n\t\t\ttype: 'attack',\r\n\t\t\tsourceEntityId: attackingEntity.entityId,\r\n\t\t\ttargetEntityId: defendingEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\tplayerHand: this.sanitize(playerHero.hand),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerStartOfCombat(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tfriendlyHero: BgsPlayerEntity,\r\n\t\topponentHero: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'start-of-combat',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPlayerAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'player-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerOpponentAttack(\r\n\t\tfriendlyBoard: readonly BoardEntity[],\r\n\t\topponentBoard: readonly BoardEntity[],\r\n\t\tdamage: number,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'opponent-attack',\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tdamage: damage,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDamageDealt(\r\n\t\tdamagingEntity: BoardEntity,\r\n\t\tdamagedEntity: BoardEntity,\r\n\t\tdamageTaken: number,\r\n\t\tdamagedEntityBoard: BoardEntity[],\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!damagingEntity.entityId) {\r\n\t\t\t// console.error('missing damaging entity id', damagingEntity.cardId);\r\n\t\t}\r\n\t\tconst friendlyBoard = damagedEntityBoard.every((entity) => entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst opponentBoard = damagedEntityBoard.every((entity) => !entity.friendly) ? damagedEntityBoard : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'damage',\r\n\t\t\tdamages: [\r\n\t\t\t\t{\r\n\t\t\t\t\tsourceEntityId: damagingEntity.entityId,\r\n\t\t\t\t\ttargetEntityId: damagedEntity.entityId,\r\n\t\t\t\t\tdamage: damageTaken,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTarget(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntity: BoardEntity | BgsPlayerEntity,\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!targetEntity) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityId: targetEntity.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerPowerTargets(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardSecret | BoardTrinket,\r\n\t\ttargetEntities: (BoardEntity | BgsPlayerEntity)[],\r\n\t\ttargetBoard: BoardEntity[],\r\n\t\thero1: BgsPlayerEntity,\r\n\t\thero2: BgsPlayerEntity,\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!targetEntities?.length) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// console.log('registerPowerTarget', stringifySimpleCard(sourceEntity), stringifySimpleCard(targetEntity), new Error().stack);\r\n\t\tconst friendlyBoard = targetBoard?.every((entity) => entity.friendly) ? targetBoard : null;\r\n\t\tconst opponentBoard = targetBoard?.every((entity) => !entity.friendly) ? targetBoard : null;\r\n\t\tconst friendlyHero = hero1?.friendly ? hero1 : hero2?.friendly ? hero2 : null;\r\n\t\tconst opponentHero = hero1?.friendly ? hero2 : hero2?.friendly ? hero1 : null;\r\n\t\tconst action: GameAction = buildGameAction(friendlyHero, opponentHero, {\r\n\t\t\ttype: 'power-target',\r\n\t\t\tsourceEntityId: sourceEntity.entityId,\r\n\t\t\ttargetEntityIds: targetEntities.map((entity) => entity.entityId),\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: this.sanitize(friendlyHero?.hand),\r\n\t\t\topponentHand: this.sanitize(opponentHero?.hand),\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerMinionsSpawn(\r\n\t\tsourceEntity: BoardEntity | BgsPlayerEntity | BoardTrinket,\r\n\t\tboardOnWhichToSpawn: BoardEntity[],\r\n\t\tspawnedEntities: readonly BoardEntity[],\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!spawnedEntities || spawnedEntities.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!sourceEntity?.entityId) {\r\n\t\t\t// console.error('missing spawn source entity id', sourceEntity);\r\n\t\t}\r\n\t\tconst friendlyBoard = boardOnWhichToSpawn.every((entity) => entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst opponentBoard = boardOnWhichToSpawn.every((entity) => !entity.friendly) ? boardOnWhichToSpawn : null;\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'spawn',\r\n\t\t\tspawns: this.sanitize(spawnedEntities),\r\n\t\t\tsourceEntityId: sourceEntity?.entityId,\r\n\t\t\tplayerBoard: this.sanitize(friendlyBoard),\r\n\t\t\topponentBoard: this.sanitize(opponentBoard),\r\n\t\t\tplayerHand: null,\r\n\t\t\topponentHand: null,\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tpublic registerDeadEntities(\r\n\t\tdeadMinionIndexes1: number[],\r\n\t\tdeadEntities1: BoardEntity[],\r\n\t\tboard1: BoardEntity[],\r\n\t\tdeadMinionIndexes2: number[],\r\n\t\tdeadEntities2: BoardEntity[],\r\n\t\tboard2: BoardEntity[],\r\n\t): void {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst deaths = [...(deadEntities1 || []), ...(deadEntities2 || [])];\r\n\t\tif (!deaths || deaths.length === 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst action: GameAction = buildGameAction(null, null, {\r\n\t\t\ttype: 'minion-death',\r\n\t\t\tdeaths: this.sanitize(deaths),\r\n\t\t\tdeadMinionsPositionsOnBoard: [\r\n\t\t\t\t...(deadMinionIndexes1 || []).map((i) => board1.length - i),\r\n\t\t\t\t...(deadMinionIndexes2 || []).map((i) => board2.length - i),\r\n\t\t\t],\r\n\t\t});\r\n\t\tthis.addAction(action);\r\n\t}\r\n\r\n\tprivate addAction(action: GameAction) {\r\n\t\tthis.actionsForCurrentBattle.push(action);\r\n\t}\r\n\r\n\tprivate collapseActions(actions: readonly GameAction[]): readonly GameAction[] {\r\n\t\tif (!this.enabled) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tif (!actions || actions.length === 0) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst result: GameAction[] = [];\r\n\t\tfor (let i = 0; i < actions.length; i++) {\r\n\t\t\tconst action: GameAction = {\r\n\t\t\t\t...actions[i],\r\n\t\t\t\tplayerBoard: this.sanitize(actions[i].playerBoard),\r\n\t\t\t\topponentBoard: this.sanitize(actions[i].opponentBoard),\r\n\t\t\t\tplayerHand: this.sanitize(actions[i].playerHand),\r\n\t\t\t\topponentHand: this.sanitize(actions[i].opponentHand),\r\n\t\t\t\t// spawns: this.sanitize(actions[i].spawns),\r\n\t\t\t\tdeaths: this.sanitize(actions[i].deaths),\r\n\t\t\t\tplayerTrinkets: this.sanitizeTrinkets(actions[i].playerTrinkets),\r\n\t\t\t\topponentTrinkets: this.sanitizeTrinkets(actions[i].opponentTrinkets),\r\n\t\t\t};\r\n\t\t\t// action.playerBoard && console.debug('\\naction playerboard', stringifySimple(action.playerBoard));\r\n\t\t\tconst lastAction = result.length > 0 ? result[result.length - 1] : null;\r\n\r\n\t\t\tif (lastAction) {\r\n\t\t\t\taction.playerBoard = action.playerBoard ?? lastAction.playerBoard;\r\n\t\t\t\taction.opponentBoard = action.opponentBoard ?? lastAction.opponentBoard;\r\n\t\t\t\taction.playerHand = action.playerHand ?? lastAction.playerHand;\r\n\t\t\t\taction.opponentHand = action.opponentHand ?? lastAction.opponentHand;\r\n\t\t\t\taction.playerSecrets = action.playerSecrets ?? lastAction.playerSecrets;\r\n\t\t\t\taction.opponentSecrets = action.opponentSecrets ?? lastAction.opponentSecrets;\r\n\t\t\t\taction.playerRewardCardId = action.playerRewardCardId ?? lastAction.playerRewardCardId;\r\n\t\t\t\taction.playerRewardEntityId = action.playerRewardEntityId ?? lastAction.playerRewardEntityId;\r\n\t\t\t\taction.playerRewardData = action.playerRewardData ?? lastAction.playerRewardData;\r\n\t\t\t\taction.opponentRewardCardId = action.opponentRewardCardId ?? lastAction.opponentRewardCardId;\r\n\t\t\t\taction.opponentRewardEntityId = action.opponentRewardEntityId ?? lastAction.opponentRewardEntityId;\r\n\t\t\t\taction.opponentRewardData = action.opponentRewardData ?? lastAction.opponentRewardData;\r\n\t\t\t\taction.playerCardId = action.playerCardId ?? lastAction.playerCardId;\r\n\t\t\t\taction.playerEntityId = action.playerEntityId ?? lastAction.playerEntityId;\r\n\t\t\t\taction.playerHeroPowerCardId = action.playerHeroPowerCardId ?? lastAction.playerHeroPowerCardId;\r\n\t\t\t\taction.playerHeroPowerEntityId = action.playerHeroPowerEntityId ?? lastAction.playerHeroPowerEntityId;\r\n\t\t\t\taction.playerHeroPowerUsed = action.playerHeroPowerUsed ?? lastAction.playerHeroPowerUsed;\r\n\t\t\t\taction.opponentCardId = action.opponentCardId ?? lastAction.opponentCardId;\r\n\t\t\t\taction.opponentEntityId = action.opponentEntityId ?? lastAction.opponentEntityId;\r\n\t\t\t\taction.opponentHeroPowerCardId = action.opponentHeroPowerCardId ?? lastAction.opponentHeroPowerCardId;\r\n\t\t\t\taction.opponentHeroPowerEntityId =\r\n\t\t\t\t\taction.opponentHeroPowerEntityId ?? lastAction.opponentHeroPowerEntityId;\r\n\t\t\t\taction.opponentHeroPowerUsed = action.opponentHeroPowerUsed ?? lastAction.opponentHeroPowerUsed;\r\n\t\t\t\taction.playerTrinkets = action.playerTrinkets ?? lastAction.playerTrinkets;\r\n\t\t\t\taction.opponentTrinkets = action.opponentTrinkets ?? lastAction.opponentTrinkets;\r\n\t\t\t}\r\n\r\n\t\t\tif (lastAction && action.type === 'damage' && lastAction.type === 'attack') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (lastAction && action.type === 'damage' && lastAction.type === 'damage') {\r\n\t\t\t\tlastAction.damages = lastAction.damages || [];\r\n\t\t\t\tlastAction.damages.push({\r\n\t\t\t\t\tdamage: action.damages[0].damage,\r\n\t\t\t\t\tsourceEntityId: action.damages[0].sourceEntityId,\r\n\t\t\t\t\ttargetEntityId: action.damages[0].targetEntityId,\r\n\t\t\t\t});\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else if (\r\n\t\t\t\tlastAction &&\r\n\t\t\t\taction.type === 'power-target' &&\r\n\t\t\t\tlastAction.type === 'power-target' &&\r\n\t\t\t\taction.sourceEntityId === lastAction.sourceEntityId\r\n\t\t\t) {\r\n\t\t\t\tlastAction.targetEntityIds =\r\n\t\t\t\t\tlastAction.targetEntityIds ?? (lastAction.targetEntityId ? [lastAction.targetEntityId] : []);\r\n\t\t\t\taction.targetEntityIds =\r\n\t\t\t\t\taction.targetEntityIds ?? (action.targetEntityId ? [action.targetEntityId] : []);\r\n\t\t\t\tlastAction.targetEntityIds.push(...action.targetEntityIds);\r\n\t\t\t\t// So that when multiple Leapfroggers enchantments target the same minion,\r\n\t\t\t\t// we can count them in the replay viewer's text\r\n\t\t\t\t// lastAction.targetEntityIds = [...new Set(lastAction.targetEntityIds)];\r\n\t\t\t\tlastAction.playerBoard = action.playerBoard;\r\n\t\t\t\tlastAction.opponentBoard = action.opponentBoard;\r\n\t\t\t\tlastAction.playerHand = action.playerHand;\r\n\t\t\t\tlastAction.opponentHand = action.opponentHand;\r\n\t\t\t\tlastAction.playerSecrets = action.playerSecrets;\r\n\t\t\t\tlastAction.opponentSecrets = action.opponentSecrets;\r\n\t\t\t\tlastAction.playerTrinkets = action.playerTrinkets;\r\n\t\t\t\tlastAction.opponentTrinkets = action.opponentTrinkets;\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(action);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\r\n\t// Calling sanitize every time before we add an action to the list is mandatory, since\r\n\t// the entities and boards are mutable\r\n\tprivate sanitize(board: readonly BoardEntity[]): readonly BoardEntity[] {\r\n\t\tif (!board) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn board.map(\r\n\t\t\t(entity) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tentityId: entity.entityId,\r\n\t\t\t\t\tcardId: entity.cardId,\r\n\t\t\t\t\tfriendly: entity.friendly,\r\n\t\t\t\t\tattack: entity.attack,\r\n\t\t\t\t\thealth: entity.health,\r\n\t\t\t\t\tmaxHealth: entity.maxHealth,\r\n\t\t\t\t\ttaunt: entity.taunt,\r\n\t\t\t\t\tdivineShield: entity.divineShield,\r\n\t\t\t\t\tpoisonous: entity.poisonous,\r\n\t\t\t\t\tvenomous: entity.venomous,\r\n\t\t\t\t\treborn: entity.reborn,\r\n\t\t\t\t\twindfury: entity.windfury,\r\n\t\t\t\t\tstealth: entity.stealth,\r\n\t\t\t\t} as BoardEntity),\r\n\t\t);\r\n\t}\r\n\r\n\tprivate sanitizeTrinkets(trinkets: readonly BoardTrinket[]): readonly BoardTrinket[] {\r\n\t\tif (!trinkets?.length) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tconst result = trinkets.map(\r\n\t\t\t(t) =>\r\n\t\t\t\t({\r\n\t\t\t\t\tcardId: t.cardId,\r\n\t\t\t\t\tentityId: t.entityId,\r\n\t\t\t\t\tscriptDataNum1: t.scriptDataNum1,\r\n\t\t\t\t\tscriptDataNum6: t.scriptDataNum6,\r\n\t\t\t\t\ttags: t.tags,\r\n\t\t\t\t} as BoardTrinket),\r\n\t\t);\r\n\t\treturn result;\r\n\t}\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
- {
2
- "name": "@firestone-hs/simulate-bgs-battle",
3
- "version": "1.1.716",
4
- "description": "",
5
- "scripts": {
6
- "lint": "eslint --color --fix --ext .ts .",
7
- "test-board": "ts-node test/full-game/full-test.ts",
8
- "test:unit": "node -r ts-node/register --test test/unit/hand-minion-priority.test.ts test/unit/tavern-spell-stat-buff.test.ts test/integration/impossible-tie-15248c13.test.ts",
9
- "test-board-ss": "node --stack-size=100 --trace-uncaught -r ts-node/register test/full-game/full-test.ts",
10
- "test-board-prof": "node --inspect-brk -r ts-node/register test/full-game/full-test.ts",
11
- "build": "tsc && webpack --color",
12
- "build-tsc": "rm -rf dist && tsc",
13
- "package": "sam package --template-file template.yaml --s3-bucket com.zerotoheroes.artifact --output-template-file template.packaged.yaml",
14
- "deploy": "sam deploy --template-file template.packaged.yaml --stack-name SimulateBgsBattleStack --capabilities CAPABILITY_IAM",
15
- "full-deploy": "npm run build && npm run package && npm run deploy",
16
- "publish-version": "rm -rf dist && tsc && rm -rf dist/node_modules && npm publish --access public"
17
- },
18
- "repository": {},
19
- "author": "",
20
- "license": "MIT",
21
- "private": false,
22
- "main": "dist/simulate-bgs-battle.js",
23
- "types": "dist/simulate-bgs-battle.d.ts",
24
- "files": [
25
- "dist/**/*"
26
- ],
27
- "dependencies": {
28
- "@firestone-hs/reference-data": "^3.0.196"
29
- },
30
- "devDependencies": {
31
- "@types/aws-lambda": "8.10.31",
32
- "@types/jsonwebtoken": "^9.0.2",
33
- "@types/jszip": "^3.1.7",
34
- "@types/mysql": "^2.15.7",
35
- "@types/node": "^22.1.0",
36
- "@types/pako": "^1.0.1",
37
- "@typescript-eslint/eslint-plugin": "^5.59.1",
38
- "@typescript-eslint/parser": "^5.59.1",
39
- "eslint": "^8.39.0",
40
- "eslint-config-prettier": "^8.8.0",
41
- "eslint-plugin-prettier": "^4.2.1",
42
- "eslint-webpack-plugin": "^4.0.1",
43
- "prettier": "^2.8.8",
44
- "ts-loader": "^9.4.2",
45
- "ts-node": "^10.9.1",
46
- "typescript": "^5.0.4",
47
- "webpack": "^5.80.0",
48
- "webpack-cli": "^5.0.2",
49
- "yaml-cfn": "^0.2.2"
50
- }
51
- }
1
+ {
2
+ "name": "@firestone-hs/simulate-bgs-battle",
3
+ "version": "1.1.718",
4
+ "description": "",
5
+ "scripts": {
6
+ "lint": "eslint --color --fix --ext .ts .",
7
+ "test-board": "ts-node test/full-game/full-test.ts",
8
+ "test:unit": "node -r ts-node/register --test test/unit/hand-minion-priority.test.ts test/unit/tavern-spell-stat-buff.test.ts test/unit/resolve-trinket-hero-power.test.ts test/integration/impossible-tie-15248c13.test.ts",
9
+ "test-board-ss": "node --stack-size=100 --trace-uncaught -r ts-node/register test/full-game/full-test.ts",
10
+ "test-board-prof": "node --inspect-brk -r ts-node/register test/full-game/full-test.ts",
11
+ "build": "tsc && webpack --color",
12
+ "build-tsc": "rm -rf dist && tsc",
13
+ "package": "sam package --template-file template.yaml --s3-bucket com.zerotoheroes.artifact --output-template-file template.packaged.yaml",
14
+ "deploy": "sam deploy --template-file template.packaged.yaml --stack-name SimulateBgsBattleStack --capabilities CAPABILITY_IAM",
15
+ "full-deploy": "npm run build && npm run package && npm run deploy",
16
+ "publish-version": "rm -rf dist && tsc && rm -rf dist/node_modules && npm publish --access public"
17
+ },
18
+ "repository": {},
19
+ "author": "",
20
+ "license": "MIT",
21
+ "private": false,
22
+ "main": "dist/simulate-bgs-battle.js",
23
+ "types": "dist/simulate-bgs-battle.d.ts",
24
+ "files": [
25
+ "dist/**/*"
26
+ ],
27
+ "dependencies": {
28
+ "@firestone-hs/reference-data": "^3.0.196"
29
+ },
30
+ "devDependencies": {
31
+ "@types/aws-lambda": "8.10.31",
32
+ "@types/jsonwebtoken": "^9.0.2",
33
+ "@types/jszip": "^3.1.7",
34
+ "@types/mysql": "^2.15.7",
35
+ "@types/node": "^22.1.0",
36
+ "@types/pako": "^1.0.1",
37
+ "@typescript-eslint/eslint-plugin": "^5.59.1",
38
+ "@typescript-eslint/parser": "^5.59.1",
39
+ "eslint": "^8.39.0",
40
+ "eslint-config-prettier": "^8.8.0",
41
+ "eslint-plugin-prettier": "^4.2.1",
42
+ "eslint-webpack-plugin": "^4.0.1",
43
+ "prettier": "^2.8.8",
44
+ "ts-loader": "^9.4.2",
45
+ "ts-node": "^10.9.1",
46
+ "typescript": "^5.0.4",
47
+ "webpack": "^5.80.0",
48
+ "webpack-cli": "^5.0.2",
49
+ "yaml-cfn": "^0.2.2"
50
+ }
51
+ }
@@ -1,2 +0,0 @@
1
- import { DeathrattleSpawnCard } from '../../card.interface';
2
- export declare const PilotTheShredder: DeathrattleSpawnCard;
@@ -1 +0,0 @@
1
- {"version":3,"file":"pilot-the-shredder.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/pilot-the-shredder.ts"],"names":[],"mappings":";;;AACA,mEAAqE;AAErE,mDAAqD;AAErD,+EAAuE;AAG1D,QAAA,gBAAgB,GAAyB;IACrD,OAAO,EAAE,sCAAiG;IAC1G,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;;QAC3E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,uBAA+C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,MAAM,IAAI,GACT,MAAA,KAAK,CAAC,uBAAuB,CAAC,IAAI;iBAChC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,MAAM,CAAA,CAAC;iBAG1B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAC;YAClC,MAAM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CAAC,EACD,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,EACpB,IAAI,EACJ,KAAK,CAAC,SAAS,CACf,CAAC;oBACF,CAAC,CAAC,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;iBAElD;gBACD,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;aAC1B;SACD;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { updateDivineShield } from '../../../keywords/divine-shield';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { spawnEntities } from '../../../simulation/deathrattle-spawns';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const PilotTheShredder: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.Sneed_SneedsNewShredderToken_BG21_HERO_030t, CardIds.SneedsNewShredder_BG21_HERO_030t_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.SneedsNewShredder_BG21_HERO_030t_G ? 2 : 1;\r\n\t\tconst allSpawns = [];\r\n\t\tfor (let i = 0; i < mult; i++) {\r\n\t\t\tconst hand =\r\n\t\t\t\tinput.boardWithDeadEntityHero.hand\r\n\t\t\t\t\t.filter((e) => !!e?.cardId)\r\n\t\t\t\t\t// 2025-12-04: it can summon a minion that is locked by another way, like Flighty scout\r\n\t\t\t\t\t// BUT: if it was summoned by Bassgill, then it won't work\r\n\t\t\t\t\t.filter((e) => !e.locked) ?? [];\r\n\t\t\tconst highestHealth = Math.max(...hand.filter((c) => c.health).map((c) => c.health));\r\n\t\t\tconst highestHealthMinions = highestHealth ? hand.filter((c) => c.health === highestHealth) : null;\r\n\t\t\tconst spawn = !!highestHealthMinions?.length\r\n\t\t\t\t? pickRandom(highestHealthMinions)\r\n\t\t\t\t: hand.filter((c) => c.cardId).length\r\n\t\t\t\t? pickRandom(hand.filter((c) => c.cardId))\r\n\t\t\t\t: null;\r\n\t\t\tif (spawn) {\r\n\t\t\t\t// 2025-12-04: actually doesn't look like it gets locked\r\n\t\t\t\tspawn.locked = true;\r\n\t\t\t\tconst spawns = spawnEntities(\r\n\t\t\t\t\tspawn.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.otherBoard,\r\n\t\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\tminion.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\t{ ...spawn } as BoardEntity,\r\n\t\t\t\t);\r\n\t\t\t\tfor (const s of spawns) {\r\n\t\t\t\t\tupdateDivineShield(\r\n\t\t\t\t\t\ts,\r\n\t\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\ts.onCanceledSummon = () => (spawn.locked = false);\r\n\t\t\t\t\t// s.backRef = spawn;\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn allSpawns;\r\n\t},\r\n};\r\n"]}