@firestone-hs/simulate-bgs-battle 1.1.732 → 1.1.734

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 (243) hide show
  1. package/dist/cards/card.interface.d.ts +4 -4
  2. package/dist/cards/card.interface.js.map +1 -1
  3. package/dist/cards/impl/_card-mappings.js +2 -0
  4. package/dist/cards/impl/_card-mappings.js.map +1 -1
  5. package/dist/cards/impl/bg-spell/sharing-is-caring.js.map +1 -1
  6. package/dist/cards/impl/bg-spell/toxic-tumbleweed.js.map +1 -1
  7. package/dist/cards/impl/enchantments/offensive-sacrifice.js +4 -2
  8. package/dist/cards/impl/enchantments/offensive-sacrifice.js.map +1 -1
  9. package/dist/cards/impl/enchantments/resistance.js +1 -1
  10. package/dist/cards/impl/enchantments/resistance.js.map +1 -1
  11. package/dist/cards/impl/enchantments/toreths-blessing.js +1 -0
  12. package/dist/cards/impl/enchantments/toreths-blessing.js.map +1 -1
  13. package/dist/cards/impl/hero-power/aim-high.js.map +1 -1
  14. package/dist/cards/impl/hero-power/aim-left.js.map +1 -1
  15. package/dist/cards/impl/hero-power/aim-low.js.map +1 -1
  16. package/dist/cards/impl/hero-power/aim-right.js.map +1 -1
  17. package/dist/cards/impl/hero-power/avatar-of-nzoth.js +2 -13
  18. package/dist/cards/impl/hero-power/avatar-of-nzoth.js.map +1 -1
  19. package/dist/cards/impl/hero-power/earth-invocation.js.map +1 -1
  20. package/dist/cards/impl/hero-power/embrace-your-rage.js.map +1 -1
  21. package/dist/cards/impl/hero-power/fire-invocation.js.map +1 -1
  22. package/dist/cards/impl/hero-power/reborn-rites.js.map +1 -1
  23. package/dist/cards/impl/hero-power/water-invocation.js.map +1 -1
  24. package/dist/cards/impl/minion/all-seeing-elder.js.map +1 -1
  25. package/dist/cards/impl/minion/alleycat.js.map +1 -1
  26. package/dist/cards/impl/minion/amber-guardian.js.map +1 -1
  27. package/dist/cards/impl/minion/amplifying-lightspawn.js.map +1 -1
  28. package/dist/cards/impl/minion/archimonde.js.map +1 -1
  29. package/dist/cards/impl/minion/arid-atrocity.js.map +1 -1
  30. package/dist/cards/impl/minion/ashen-corruptor.js.map +1 -1
  31. package/dist/cards/impl/minion/assistant-guard.js.map +1 -1
  32. package/dist/cards/impl/minion/audacious-anchor.js.map +1 -1
  33. package/dist/cards/impl/minion/auto-assembler.js.map +1 -1
  34. package/dist/cards/impl/minion/avalanche-caller.js.map +1 -1
  35. package/dist/cards/impl/minion/baneling.js.map +1 -1
  36. package/dist/cards/impl/minion/bigwig-bandit.js.map +1 -1
  37. package/dist/cards/impl/minion/bird-buddy.js.map +1 -1
  38. package/dist/cards/impl/minion/blazing-skyfin.js.map +1 -1
  39. package/dist/cards/impl/minion/blue-whelp.js.map +1 -1
  40. package/dist/cards/impl/minion/boar-gamer.js.map +1 -1
  41. package/dist/cards/impl/minion/briarback-bookie.js.map +1 -1
  42. package/dist/cards/impl/minion/bronze-steward.js.map +1 -1
  43. package/dist/cards/impl/minion/bubble-gunner.js.map +1 -1
  44. package/dist/cards/impl/minion/buzzing-vermin.js.map +1 -1
  45. package/dist/cards/impl/minion/cadaver-caretaker.js.map +1 -1
  46. package/dist/cards/impl/minion/captain-bonerender.js.map +1 -1
  47. package/dist/cards/impl/minion/carapace-raiser.js.map +1 -1
  48. package/dist/cards/impl/minion/carbonic-copy.js.map +1 -1
  49. package/dist/cards/impl/minion/coilskar-sapper.js.map +1 -1
  50. package/dist/cards/impl/minion/coldlight-diver.js.map +1 -1
  51. package/dist/cards/impl/minion/crystal-infuser-enchantment.js.map +1 -1
  52. package/dist/cards/impl/minion/cupcake-peddler.js.map +1 -1
  53. package/dist/cards/impl/minion/deadstomper.js.map +1 -1
  54. package/dist/cards/impl/minion/deathly-striker.js.map +1 -1
  55. package/dist/cards/impl/minion/deathstrider.d.ts +2 -2
  56. package/dist/cards/impl/minion/deathstrider.js +1 -1
  57. package/dist/cards/impl/minion/deathstrider.js.map +1 -1
  58. package/dist/cards/impl/minion/deflecto-bot.js.map +1 -1
  59. package/dist/cards/impl/minion/devout-hellcaller.js.map +1 -1
  60. package/dist/cards/impl/minion/drakkari-embalmer.js.map +1 -1
  61. package/dist/cards/impl/minion/electric-synthesizer.js.map +1 -1
  62. package/dist/cards/impl/minion/elite-navigator.js.map +1 -1
  63. package/dist/cards/impl/minion/fairy-gillmother.js.map +1 -1
  64. package/dist/cards/impl/minion/falling-sky-golem.d.ts +1 -1
  65. package/dist/cards/impl/minion/falling-sky-golem.js +11 -7
  66. package/dist/cards/impl/minion/falling-sky-golem.js.map +1 -1
  67. package/dist/cards/impl/minion/firescale-hoarder.js.map +1 -1
  68. package/dist/cards/impl/minion/fireworks-fanatic.js.map +1 -1
  69. package/dist/cards/impl/minion/flotsam-flinger.js.map +1 -1
  70. package/dist/cards/impl/minion/flourishing-frostling.d.ts +2 -0
  71. package/dist/cards/impl/minion/flourishing-frostling.js +45 -0
  72. package/dist/cards/impl/minion/flourishing-frostling.js.map +1 -0
  73. package/dist/cards/impl/minion/fountain-chiller.js.map +1 -1
  74. package/dist/cards/impl/minion/friendly-geist.js.map +1 -1
  75. package/dist/cards/impl/minion/gem-rat.js.map +1 -1
  76. package/dist/cards/impl/minion/general-drakkisath.js.map +1 -1
  77. package/dist/cards/impl/minion/gentle-djinni.js.map +1 -1
  78. package/dist/cards/impl/minion/gentle-stag.js.map +1 -1
  79. package/dist/cards/impl/minion/glowing-cinder.js +2 -1
  80. package/dist/cards/impl/minion/glowing-cinder.js.map +1 -1
  81. package/dist/cards/impl/minion/gormling-gourmet.js.map +1 -1
  82. package/dist/cards/impl/minion/greedy-snaketongue.js.map +1 -1
  83. package/dist/cards/impl/minion/grimscale-elegist.js.map +1 -1
  84. package/dist/cards/impl/minion/gritty-headhunter.js.map +1 -1
  85. package/dist/cards/impl/minion/hackerfin.js.map +1 -1
  86. package/dist/cards/impl/minion/handless-forsaken.js.map +1 -1
  87. package/dist/cards/impl/minion/harmless-bonehead.js.map +1 -1
  88. package/dist/cards/impl/minion/hawkstrider-herald.js.map +1 -1
  89. package/dist/cards/impl/minion/holo-rover.js.map +1 -1
  90. package/dist/cards/impl/minion/humongozz.js.map +1 -1
  91. package/dist/cards/impl/minion/hungry-snapjaw.js.map +1 -1
  92. package/dist/cards/impl/minion/hunter-of-gatherers.js.map +1 -1
  93. package/dist/cards/impl/minion/ignition-specialist.js.map +1 -1
  94. package/dist/cards/impl/minion/immortal.js.map +1 -1
  95. package/dist/cards/impl/minion/implant-subject.js.map +1 -1
  96. package/dist/cards/impl/minion/imposing-percussionist.js.map +1 -1
  97. package/dist/cards/impl/minion/inspiring-underdog.js.map +1 -1
  98. package/dist/cards/impl/minion/interrogator-whitemane.js.map +1 -1
  99. package/dist/cards/impl/minion/kangors-apprentice.js.map +1 -1
  100. package/dist/cards/impl/minion/leeroy-the-reckless.js.map +1 -1
  101. package/dist/cards/impl/minion/lightfang-enforcer.js.map +1 -1
  102. package/dist/cards/impl/minion/lightfeather-screecher.js.map +1 -1
  103. package/dist/cards/impl/minion/living-azerite.js.map +1 -1
  104. package/dist/cards/impl/minion/lokholar-frostforger.js.map +1 -1
  105. package/dist/cards/impl/minion/lovesick-balladist.js.map +1 -1
  106. package/dist/cards/impl/minion/low-flier.js.map +1 -1
  107. package/dist/cards/impl/minion/lurker.js.map +1 -1
  108. package/dist/cards/impl/minion/manasaber.js.map +1 -1
  109. package/dist/cards/impl/minion/mantid-queen.js.map +1 -1
  110. package/dist/cards/impl/minion/marquee-ticker.js.map +1 -1
  111. package/dist/cards/impl/minion/maw-caster.js.map +1 -1
  112. package/dist/cards/impl/minion/mecha-jaraxxus.js.map +1 -1
  113. package/dist/cards/impl/minion/mechanized-gift-horse.js.map +1 -1
  114. package/dist/cards/impl/minion/mechorse.js.map +1 -1
  115. package/dist/cards/impl/minion/menagerie-jug.js.map +1 -1
  116. package/dist/cards/impl/minion/metallic-hunter.js.map +1 -1
  117. package/dist/cards/impl/minion/misfit-dragonling.js.map +1 -1
  118. package/dist/cards/impl/minion/moat-custodian.js +2 -2
  119. package/dist/cards/impl/minion/moat-custodian.js.map +1 -1
  120. package/dist/cards/impl/minion/murkbrine-expeditioner.js.map +1 -1
  121. package/dist/cards/impl/minion/murky.js.map +1 -1
  122. package/dist/cards/impl/minion/mutated-lasher.js.map +1 -1
  123. package/dist/cards/impl/minion/mythrax.js.map +1 -1
  124. package/dist/cards/impl/minion/neon-agent.js.map +1 -1
  125. package/dist/cards/impl/minion/nest-swarmer.js.map +1 -1
  126. package/dist/cards/impl/minion/nether-drake.js.map +1 -1
  127. package/dist/cards/impl/minion/nightmare-par-tea-guest.js.map +1 -1
  128. package/dist/cards/impl/minion/nimble-hatchling.js.map +1 -1
  129. package/dist/cards/impl/minion/operatic-belcher.js.map +1 -1
  130. package/dist/cards/impl/minion/outback-smolderer.js.map +1 -1
  131. package/dist/cards/impl/minion/parched-wanderer.js.map +1 -1
  132. package/dist/cards/impl/minion/polarizing-beatboxer.js +2 -1
  133. package/dist/cards/impl/minion/polarizing-beatboxer.js.map +1 -1
  134. package/dist/cards/impl/minion/primalfin-lookout.js.map +1 -1
  135. package/dist/cards/impl/minion/rapscallion-recruiter.js.map +1 -1
  136. package/dist/cards/impl/minion/razorgore-the-untamed.js.map +1 -1
  137. package/dist/cards/impl/minion/roach.js.map +1 -1
  138. package/dist/cards/impl/minion/roadboar.js.map +1 -1
  139. package/dist/cards/impl/minion/rodeo-performer.js.map +1 -1
  140. package/dist/cards/impl/minion/ruins-renovator.js.map +1 -1
  141. package/dist/cards/impl/minion/rylak-metalhead.js.map +1 -1
  142. package/dist/cards/impl/minion/salty-hog.js.map +1 -1
  143. package/dist/cards/impl/minion/sand-swirler.js +2 -1
  144. package/dist/cards/impl/minion/sand-swirler.js.map +1 -1
  145. package/dist/cards/impl/minion/sandy.js.map +1 -1
  146. package/dist/cards/impl/minion/scourge-harvester.js.map +1 -1
  147. package/dist/cards/impl/minion/selfless-hero.js.map +1 -1
  148. package/dist/cards/impl/minion/shadowdancer.js.map +1 -1
  149. package/dist/cards/impl/minion/sharp-eyed-sabretooth.js.map +1 -1
  150. package/dist/cards/impl/minion/sharptooth-snapper.js.map +1 -1
  151. package/dist/cards/impl/minion/ship-master-eudora.js.map +1 -1
  152. package/dist/cards/impl/minion/shipwrecked-rascal.js.map +1 -1
  153. package/dist/cards/impl/minion/shore-marauder.js +3 -4
  154. package/dist/cards/impl/minion/shore-marauder.js.map +1 -1
  155. package/dist/cards/impl/minion/silver-handed-recruit.js.map +1 -1
  156. package/dist/cards/impl/minion/slumber-sorcerer.js.map +1 -1
  157. package/dist/cards/impl/minion/smolderwing.js.map +1 -1
  158. package/dist/cards/impl/minion/soul-rewinder.js.map +1 -1
  159. package/dist/cards/impl/minion/spacefarer.js.map +1 -1
  160. package/dist/cards/impl/minion/spirited-whimsydrake.js.map +1 -1
  161. package/dist/cards/impl/minion/springy-spriggan.js.map +1 -1
  162. package/dist/cards/impl/minion/stitched-salvager.js.map +1 -1
  163. package/dist/cards/impl/minion/stray-satyr.js.map +1 -1
  164. package/dist/cards/impl/minion/sun-screener.js.map +1 -1
  165. package/dist/cards/impl/minion/surfing-slyvar.js.map +1 -1
  166. package/dist/cards/impl/minion/thorncaller.js.map +1 -1
  167. package/dist/cards/impl/minion/thousandth-paper-drake.js.map +1 -1
  168. package/dist/cards/impl/minion/thundering-abomination.js.map +1 -1
  169. package/dist/cards/impl/minion/timewarped-swirler.js +3 -4
  170. package/dist/cards/impl/minion/timewarped-swirler.js.map +1 -1
  171. package/dist/cards/impl/minion/timewarped-warghoul.js.map +1 -1
  172. package/dist/cards/impl/minion/tunnel-blaster.js.map +1 -1
  173. package/dist/cards/impl/minion/twilight-primordium.js.map +1 -1
  174. package/dist/cards/impl/minion/ultralisk.js.map +1 -1
  175. package/dist/cards/impl/minion/valiant-tiger.js.map +1 -1
  176. package/dist/cards/impl/minion/void-earl.js.map +1 -1
  177. package/dist/cards/impl/minion/vorkai-guardian.js.map +1 -1
  178. package/dist/cards/impl/minion/wandering-wight.js.map +1 -1
  179. package/dist/cards/impl/minion/whelp-smuggler.js.map +1 -1
  180. package/dist/cards/impl/minion/whirring-protector-enchantment.js.map +1 -1
  181. package/dist/cards/impl/minion/wildfire-elemental.js.map +1 -1
  182. package/dist/cards/impl/minion/wisp-in-the-shell.js.map +1 -1
  183. package/dist/cards/impl/minion/yorik-smite.js.map +1 -1
  184. package/dist/cards/impl/minion/yrel.js.map +1 -1
  185. package/dist/cards/impl/minion/yulon-fortune-granter.js.map +1 -1
  186. package/dist/cards/impl/quest-reward/righteous-charge.js.map +1 -1
  187. package/dist/cards/impl/trinket/all-purpose-kibble.js.map +1 -1
  188. package/dist/cards/impl/trinket/arm-of-the-empire.js.map +1 -1
  189. package/dist/cards/impl/trinket/bassgill-portrait.js.map +1 -1
  190. package/dist/cards/impl/trinket/battle-horn.js.map +1 -1
  191. package/dist/cards/impl/trinket/bird-feeder.js.map +1 -1
  192. package/dist/cards/impl/trinket/crocheted-sungill.js.map +1 -1
  193. package/dist/cards/impl/trinket/deathtouch-apple.d.ts +2 -2
  194. package/dist/cards/impl/trinket/deathtouch-apple.js +0 -1
  195. package/dist/cards/impl/trinket/deathtouch-apple.js.map +1 -1
  196. package/dist/cards/impl/trinket/eclectic-shrine.js.map +1 -1
  197. package/dist/cards/impl/trinket/faerie-dragon-scale.js.map +1 -1
  198. package/dist/cards/impl/trinket/fishy-sticker.js.map +1 -1
  199. package/dist/cards/impl/trinket/herald-sticker.js.map +1 -1
  200. package/dist/cards/impl/trinket/karazhan-chess-set.js.map +1 -1
  201. package/dist/cards/impl/trinket/rivendare-portrait.js.map +1 -1
  202. package/dist/cards/impl/trinket/sthara-sticker.js.map +1 -1
  203. package/dist/cards/impl/trinket/valorous-medaillion.js.map +1 -1
  204. package/dist/cards/impl/trinket/vashjir-anemone.js.map +1 -1
  205. package/dist/cards/impl/trinket/yulon-sticker.js.map +1 -1
  206. package/dist/debug-state.js.map +1 -1
  207. package/dist/keywords/venomous.js.map +1 -1
  208. package/dist/mechanics/player-global-effects.d.ts +6 -4
  209. package/dist/mechanics/player-global-effects.js +7 -3
  210. package/dist/mechanics/player-global-effects.js.map +1 -1
  211. package/dist/services/utils.d.ts +1 -1
  212. package/dist/services/utils.js +2 -2
  213. package/dist/services/utils.js.map +1 -1
  214. package/dist/simulation/add-minion-to-board.js +0 -19
  215. package/dist/simulation/add-minion-to-board.js.map +1 -1
  216. package/dist/simulation/after-attack.d.ts +1 -1
  217. package/dist/simulation/after-attack.js +21 -3
  218. package/dist/simulation/after-attack.js.map +1 -1
  219. package/dist/simulation/attack.d.ts +1 -1
  220. package/dist/simulation/attack.js +5 -4
  221. package/dist/simulation/attack.js.map +1 -1
  222. package/dist/simulation/auras.js +9 -6
  223. package/dist/simulation/auras.js.map +1 -1
  224. package/dist/simulation/deathrattle-on-trigger.js.map +1 -1
  225. package/dist/simulation/discover.js.map +1 -1
  226. package/dist/simulation/frenzy.js.map +1 -1
  227. package/dist/simulation/global-info-helpers.d.ts +1 -0
  228. package/dist/simulation/global-info-helpers.js +39 -1
  229. package/dist/simulation/global-info-helpers.js.map +1 -1
  230. package/dist/simulation/magnetize.d.ts +2 -3
  231. package/dist/simulation/magnetize.js +15 -16
  232. package/dist/simulation/magnetize.js.map +1 -1
  233. package/dist/simulation/on-attack.js +1 -5
  234. package/dist/simulation/on-attack.js.map +1 -1
  235. package/dist/simulation/quest.js.map +1 -1
  236. package/dist/simulation/remove-minion-from-board.js.map +1 -1
  237. package/dist/simulation/spectator/spectator.d.ts +2 -2
  238. package/dist/simulation/spectator/spectator.js +2 -1
  239. package/dist/simulation/spectator/spectator.js.map +1 -1
  240. package/dist/simulation/stats.d.ts +2 -2
  241. package/dist/simulation/stats.js +4 -5
  242. package/dist/simulation/stats.js.map +1 -1
  243. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"yulon-sticker.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/yulon-sticker.ts"],"names":[],"mappings":";;;AACA,iEAAoD;AAEpD,mDAAuD;AAEvD,6DAAoE;AACpE,0CAA2D;AAG9C,QAAA,YAAY,GAAsB;IAC9C,OAAO,EAAE,sBAAyC;IAClD,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;QACvD,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAC9C,CAAC,CAAC,EAAE,EAAE,CACL,IAAA,uBAAe,EACd,CAAC,EACD,KAAK,CAAC,YAAY,EAClB,qBAAI,CAAC,MAAM,EACX,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,IAAI,CAAC,IAAA,gBAAQ,EAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CACnD,CAAC;QAEF,MAAM,WAAW,GAAG,IAAA,oBAAY,EAAC,cAAc,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAClC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACR,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CACxG,CAAC;QACF,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC,MAAM,EAAE;YACb,IAAA,yBAAgB,EACf,MAAM,EACN,MAAM,EACN,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;SACF;QACD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,CAAC;IACtE,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { Race } from '@firestone-hs/reference-data';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { shuffleArray } from '../../../services/utils';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { makeMinionGolden } from '../../../simulation/utils/golden';\r\nimport { hasCorrectTribe, isGolden } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const YulonSticker: StartOfCombatCard = {\r\n\tcardIds: [CardIds.YulonSticker_BG32_MagicItem_419],\r\n\tstartOfCombat: (minion: BoardEntity, input: SoCInput) => {\r\n\t\tconst candidateBoard = input.playerBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tRace.DRAGON,\r\n\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t) && !isGolden(e.cardId, input.gameState.allCards),\r\n\t\t);\r\n\t\t// Because we pick one at random from all the ones that have the lowest tier\r\n\t\tconst randomBoard = shuffleArray(candidateBoard);\r\n\t\tconst candidates = randomBoard.sort(\r\n\t\t\t(a, b) =>\r\n\t\t\t\tinput.gameState.cardsData.getTavernLevel(b.cardId) - input.gameState.cardsData.getTavernLevel(a.cardId),\r\n\t\t);\r\n\t\tconst target = candidates[0];\r\n\t\tif (!!target) {\r\n\t\t\tmakeMinionGolden(\r\n\t\t\t\ttarget,\r\n\t\t\t\tminion,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn { hasTriggered: true, shouldRecomputeCurrentAttacker: false };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"yulon-sticker.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/yulon-sticker.ts"],"names":[],"mappings":";;;AACA,iEAAoD;AAEpD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';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { shuffleArray } from '../../../services/utils';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { makeMinionGolden } from '../../../simulation/utils/golden';\r\nimport { hasCorrectTribe, isGolden } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const YulonSticker: StartOfCombatCard = {\r\n\tcardIds: [CardIds.YulonSticker_BG32_MagicItem_419],\r\n\tstartOfCombat: (minion: BoardEntity, input: SoCInput) => {\r\n\t\tconst candidateBoard = input.playerBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tRace.DRAGON,\r\n\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t) && !isGolden(e.cardId, input.gameState.allCards),\r\n\t\t);\r\n\t\t// Because we pick one at random from all the ones that have the lowest tier\r\n\t\tconst randomBoard = shuffleArray(candidateBoard);\r\n\t\tconst candidates = randomBoard.sort(\r\n\t\t\t(a, b) =>\r\n\t\t\t\tinput.gameState.cardsData.getTavernLevel(b.cardId) - input.gameState.cardsData.getTavernLevel(a.cardId),\r\n\t\t);\r\n\t\tconst target = candidates[0];\r\n\t\tif (!!target) {\r\n\t\t\tmakeMinionGolden(\r\n\t\t\t\ttarget,\r\n\t\t\t\tminion,\r\n\t\t\t\tinput.playerBoard,\r\n\t\t\t\tinput.playerEntity,\r\n\t\t\t\tinput.opponentBoard,\r\n\t\t\t\tinput.opponentEntity,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn { hasTriggered: true, shouldRecomputeCurrentAttacker: false };\r\n\t},\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"debug-state.js","sourceRoot":"","sources":["../src/debug-state.ts"],"names":[],"mappings":";;;AAIa,QAAA,UAAU,GAA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,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC","sourcesContent":["import { BoardTrinket } from './bgs-player-entity';\nimport { BoardEntity } from './board-entity';\nimport { BoardSecret } from './board-secret';\n\nexport const debugState = {\n\tactive: false,\n\tforcedCurrentAttacker: null as number | null,\n\tforcedFaceOff: [] as { attacker: ForcedFaceOffEntity; defender: ForcedFaceOffEntity }[],\n\tforcedFaceOffBase: [] as { attacker: ForcedFaceOffEntity; defender: ForcedFaceOffEntity }[],\n\t/** Forced random picks: source -> target. Matched by source entity (like face-offs match by attacker). Optional chosenCardId for card-pool picks (e.g. Apexis Guardian Volumizer). */\n\tforcedRandomPicks: [] as { source: ForcedFaceOffEntity; target: ForcedFaceOffEntity; chosenCardId?: string }[],\n\tisCorrectEntity: (proposedEntity: ForcedFaceOffEntity, actualEntity: BoardEntity | BoardSecret | BoardTrinket): boolean => {\n\t\tif (proposedEntity.entityId) {\n\t\t\treturn proposedEntity.entityId === actualEntity.entityId;\n\t\t}\n\n\t\tif (proposedEntity.cardId) {\n\t\t\tconst cardMatches = proposedEntity.cardId === actualEntity.cardId;\n\t\t\tif (!isBoardEntity(actualEntity)) {\n\t\t\t\treturn cardMatches;\n\t\t\t}\n\t\t\tif (proposedEntity.attack != null && proposedEntity.health != null) {\n\t\t\t\treturn cardMatches && proposedEntity.attack === actualEntity.attack && proposedEntity.health === actualEntity.health;\n\t\t\t}\n\t\t\treturn cardMatches;\n\t\t}\n\t\tif (!isBoardEntity(actualEntity)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tproposedEntity.attack === actualEntity.attack &&\n\t\t\tproposedEntity.health === actualEntity.health\n\t\t);\n\t},\n\tforcedRandomPicksBase: [] as { source: ForcedFaceOffEntity; target: ForcedFaceOffEntity; chosenCardId?: string }[],\n\tonBattleStart: () => {\n\t\tdebugState.forcedFaceOff = [...debugState.forcedFaceOffBase];\n\t\tdebugState.forcedRandomPicks = [...debugState.forcedRandomPicksBase];\n\t},\n};\n\nexport interface ForcedFaceOffEntity {\n\tentityId?: number;\n\tcardId?: string;\n\tattack?: number;\n\thealth?: number;\n}\n\nconst isBoardEntity = (entity: BoardEntity | BoardSecret | BoardTrinket): entity is BoardEntity =>\n\t'attack' in entity && 'health' in entity;\n"]}
1
+ {"version":3,"file":"debug-state.js","sourceRoot":"","sources":["../src/debug-state.ts"],"names":[],"mappings":";;;AAIa,QAAA,UAAU,GAAG;IACzB,MAAM,EAAE,KAAK;IACb,qBAAqB,EAAE,IAAqB;IAC5C,aAAa,EAAE,EAAwE;IACvF,iBAAiB,EAAE,EAAwE;IAE3F,iBAAiB,EAAE,EAA2F;IAC9G,eAAe,EAAE,CAAC,cAAmC,EAAE,YAAsD,EAAW,EAAE;QACzH,IAAI,cAAc,CAAC,QAAQ,EAAE;YAC5B,OAAO,cAAc,CAAC,QAAQ,KAAK,YAAY,CAAC,QAAQ,CAAC;SACzD;QAED,IAAI,cAAc,CAAC,MAAM,EAAE;YAC1B,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,CAAC;YAClE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE;gBACjC,OAAO,WAAW,CAAC;aACnB;YACD,IAAI,cAAc,CAAC,MAAM,IAAI,IAAI,IAAI,cAAc,CAAC,MAAM,IAAI,IAAI,EAAE;gBACnE,OAAO,WAAW,IAAI,cAAc,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,CAAC;aACrH;YACD,OAAO,WAAW,CAAC;SACnB;QACD,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE;YACjC,OAAO,KAAK,CAAC;SACb;QACD,OAAO,CACN,cAAc,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM;YAC7C,cAAc,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,CAC7C,CAAC;IACH,CAAC;IACD,qBAAqB,EAAE,EAA2F;IAClH,aAAa,EAAE,GAAG,EAAE;QACnB,kBAAU,CAAC,aAAa,GAAG,CAAC,GAAG,kBAAU,CAAC,iBAAiB,CAAC,CAAC;QAC7D,kBAAU,CAAC,iBAAiB,GAAG,CAAC,GAAG,kBAAU,CAAC,qBAAqB,CAAC,CAAC;IACtE,CAAC;CACD,CAAC;AASF,MAAM,aAAa,GAAG,CAAC,MAAgD,EAAyB,EAAE,CACjG,QAAQ,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC","sourcesContent":["import { BoardTrinket } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { BoardSecret } from './board-secret';\r\n\r\nexport const debugState = {\r\n\tactive: false,\r\n\tforcedCurrentAttacker: null as number | null,\r\n\tforcedFaceOff: [] as { attacker: ForcedFaceOffEntity; defender: ForcedFaceOffEntity }[],\r\n\tforcedFaceOffBase: [] as { attacker: ForcedFaceOffEntity; defender: ForcedFaceOffEntity }[],\r\n\t/** Forced random picks: source -> target. Matched by source entity (like face-offs match by attacker). Optional chosenCardId for card-pool picks (e.g. Apexis Guardian Volumizer). */\r\n\tforcedRandomPicks: [] as { source: ForcedFaceOffEntity; target: ForcedFaceOffEntity; chosenCardId?: string }[],\r\n\tisCorrectEntity: (proposedEntity: ForcedFaceOffEntity, actualEntity: BoardEntity | BoardSecret | BoardTrinket): boolean => {\r\n\t\tif (proposedEntity.entityId) {\r\n\t\t\treturn proposedEntity.entityId === actualEntity.entityId;\r\n\t\t}\r\n\r\n\t\tif (proposedEntity.cardId) {\r\n\t\t\tconst cardMatches = proposedEntity.cardId === actualEntity.cardId;\r\n\t\t\tif (!isBoardEntity(actualEntity)) {\r\n\t\t\t\treturn cardMatches;\r\n\t\t\t}\r\n\t\t\tif (proposedEntity.attack != null && proposedEntity.health != null) {\r\n\t\t\t\treturn cardMatches && proposedEntity.attack === actualEntity.attack && proposedEntity.health === actualEntity.health;\r\n\t\t\t}\r\n\t\t\treturn cardMatches;\r\n\t\t}\r\n\t\tif (!isBoardEntity(actualEntity)) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn (\r\n\t\t\tproposedEntity.attack === actualEntity.attack &&\r\n\t\t\tproposedEntity.health === actualEntity.health\r\n\t\t);\r\n\t},\r\n\tforcedRandomPicksBase: [] as { source: ForcedFaceOffEntity; target: ForcedFaceOffEntity; chosenCardId?: string }[],\r\n\tonBattleStart: () => {\r\n\t\tdebugState.forcedFaceOff = [...debugState.forcedFaceOffBase];\r\n\t\tdebugState.forcedRandomPicks = [...debugState.forcedRandomPicksBase];\r\n\t},\r\n};\r\n\r\nexport interface ForcedFaceOffEntity {\r\n\tentityId?: number;\r\n\tcardId?: string;\r\n\tattack?: number;\r\n\thealth?: number;\r\n}\r\n\r\nconst isBoardEntity = (entity: BoardEntity | BoardSecret | BoardTrinket): entity is BoardEntity =>\r\n\t'attack' in entity && 'health' in entity;\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"venomous.js","sourceRoot":"","sources":["../../src/keywords/venomous.ts"],"names":[],"mappings":";;;AAGA,4DAA+D;AAC/D,iEAA4D;AAE5D,+CAAkD;AAE3C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,QAAiB,EACjB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;IACT,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC;IACtC,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC;IAClD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,IAAI,YAAY,EAAE;QACjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAC5C,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,yBAA+C;YACvD,CAAC,CAAC,MAAM,0BAAqE,CAC9E,CAAC;QACF,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,0BAAqE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACpG,IAAA,mBAAW,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;YAC3D,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;KACH;IAED,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE;QAChC,MAAM,qBAAqB,GAAG,6BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,IAAA,qCAAoB,EAAC,qBAAqB,CAAC,EAAE;YAChD,qBAAqB,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE;gBAC3E,KAAK,EAAE,KAAK;gBACZ,IAAI,EAAE,IAAI;gBACV,SAAS,EAAE,SAAS;gBACpB,SAAS,EAAE,SAAS;aACpB,CAAC,CAAC;SACH;KACD;AACF,CAAC,CAAC;AAnCW,QAAA,cAAc,kBAmCzB","sourcesContent":["import { CardIds } from '../services/card-ids';\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnVenomousUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\n\r\nexport const updateVenomous = (\r\n\tentity: BoardEntity,\r\n\tnewValue: boolean,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst previousValue = entity.venomous;\r\n\tconst lostVenomous = entity.venomous && !newValue;\r\n\tentity.venomous = newValue;\r\n\tif (lostVenomous) {\r\n\t\tconst belcherPortraits = hero.trinkets.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.BelcherPortrait_BG30_MagicItem_432 ||\r\n\t\t\t\tt.cardId === CardIds.BelcherPortrait_BelcherPortraitToken_BG30_MagicItem_432t,\r\n\t\t);\r\n\t\tbelcherPortraits.forEach((p) => {\r\n\t\t\tconst buff = p.cardId === CardIds.BelcherPortrait_BelcherPortraitToken_BG30_MagicItem_432t ? 14 : 4;\r\n\t\t\tmodifyStats(entity, p, buff, buff, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(p, entity, board, null, null);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const boardEntity of board) {\r\n\t\tconst onVenomousUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\tif (hasOnVenomousUpdated(onVenomousUpdatedImpl)) {\r\n\t\t\tonVenomousUpdatedImpl.onVenomousUpdated(boardEntity, entity, previousValue, {\r\n\t\t\t\tboard: board,\r\n\t\t\t\thero: hero,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnVenomousUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
1
+ {"version":3,"file":"venomous.js","sourceRoot":"","sources":["../../src/keywords/venomous.ts"],"names":[],"mappings":";;;AAGA,4DAA+D;AAC/D,iEAA4D;AAE5D,+CAAkD;AAE3C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,QAAiB,EACjB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;IACT,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC;IACtC,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC;IAClD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,IAAI,YAAY,EAAE;QACjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAC5C,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,yBAA+C;YACvD,CAAC,CAAC,MAAM,0BAAqE,CAC9E,CAAC;QACF,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,0BAAqE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACpG,IAAA,mBAAW,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;YAC3D,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;KACH;IAED,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE;QAChC,MAAM,qBAAqB,GAAG,6BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,IAAA,qCAAoB,EAAC,qBAAqB,CAAC,EAAE;YAChD,qBAAqB,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE;gBAC3E,KAAK,EAAE,KAAK;gBACZ,IAAI,EAAE,IAAI;gBACV,SAAS,EAAE,SAAS;gBACpB,SAAS,EAAE,SAAS;aACpB,CAAC,CAAC;SACH;KACD;AACF,CAAC,CAAC;AAnCW,QAAA,cAAc,kBAmCzB","sourcesContent":["import { CardIds } from '../services/card-ids';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnVenomousUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\n\r\nexport const updateVenomous = (\r\n\tentity: BoardEntity,\r\n\tnewValue: boolean,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst previousValue = entity.venomous;\r\n\tconst lostVenomous = entity.venomous && !newValue;\r\n\tentity.venomous = newValue;\r\n\tif (lostVenomous) {\r\n\t\tconst belcherPortraits = hero.trinkets.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.BelcherPortrait_BG30_MagicItem_432 ||\r\n\t\t\t\tt.cardId === CardIds.BelcherPortrait_BelcherPortraitToken_BG30_MagicItem_432t,\r\n\t\t);\r\n\t\tbelcherPortraits.forEach((p) => {\r\n\t\t\tconst buff = p.cardId === CardIds.BelcherPortrait_BelcherPortraitToken_BG30_MagicItem_432t ? 14 : 4;\r\n\t\t\tmodifyStats(entity, p, buff, buff, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(p, entity, board, null, null);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const boardEntity of board) {\r\n\t\tconst onVenomousUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\tif (hasOnVenomousUpdated(onVenomousUpdatedImpl)) {\r\n\t\t\tonVenomousUpdatedImpl.onVenomousUpdated(boardEntity, entity, previousValue, {\r\n\t\t\t\tboard: board,\r\n\t\t\t\thero: hero,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnVenomousUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
@@ -3,10 +3,12 @@ import { BoardEntity } from '../board-entity';
3
3
  import { FullGameState } from '../simulation/internal-game-state';
4
4
  export declare const updateVolumizerBuffs: (hero: BgsPlayerEntity, board: BoardEntity[], attackBuff: number, healthBuff: number, gameState: FullGameState) => void;
5
5
  export declare const incrementDeathrattlesTriggeredThisGame: (hero: BgsPlayerEntity, board: BoardEntity[], gameState: FullGameState) => void;
6
- export interface OnGlobalInfoUpdatedInput<T extends keyof BgsPlayerGlobalInfo> {
7
- type: T;
8
- oldValue: number;
9
- newValue: number;
6
+ export interface OnGlobalInfoUpdatedInput {
7
+ values: {
8
+ type: keyof BgsPlayerGlobalInfo;
9
+ oldValue: number;
10
+ newValue: number;
11
+ }[];
10
12
  hero: BgsPlayerEntity;
11
13
  board: BoardEntity[];
12
14
  gameState: FullGameState;
@@ -23,9 +23,13 @@ const incrementDeathrattlesTriggeredThisGame = (hero, board, gameState) => {
23
23
  const cardImpl = _card_mappings_1.cardMappings[entity.cardId];
24
24
  if ((0, card_interface_1.hasOnGlobalInfoUpdated)(cardImpl)) {
25
25
  cardImpl.onGlobalInfoUpdated(entity, {
26
- type: 'DeathrattlesTriggeredThisGame',
27
- oldValue: previousValue,
28
- newValue: hero.globalInfo.DeathrattlesTriggeredThisGame,
26
+ values: [
27
+ {
28
+ type: 'DeathrattlesTriggeredThisGame',
29
+ oldValue: previousValue,
30
+ newValue: hero.globalInfo.DeathrattlesTriggeredThisGame,
31
+ },
32
+ ],
29
33
  hero: hero,
30
34
  board: board,
31
35
  gameState: gameState,
@@ -1 +1 @@
1
- {"version":3,"file":"player-global-effects.js","sourceRoot":"","sources":["../../src/mechanics/player-global-effects.ts"],"names":[],"mappings":";;;AAEA,4DAAiE;AACjE,iEAA4D;AAE5D,+CAAkD;AAClD,oCAAuC;AAEhC,MAAM,oBAAoB,GAAG,CACnC,IAAqB,EACrB,KAAoB,EACpB,UAAkB,EAClB,UAAkB,EAClB,SAAwB,EACvB,EAAE;IACH,IAAI,CAAC,UAAU,CAAC,mBAAmB,IAAI,UAAU,CAAC;IAClD,IAAI,CAAC,UAAU,CAAC,mBAAmB,IAAI,UAAU,CAAC;IAClD,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC3B,IAAI,IAAA,mBAAW,EAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;YAC9E,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;SAC1E;KAOD;AACF,CAAC,CAAC;AApBW,QAAA,oBAAoB,wBAoB/B;AAEK,MAAM,sCAAsC,GAAG,CACrD,IAAqB,EACrB,KAAoB,EACpB,SAAwB,EACvB,EAAE;;IACH,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,UAAU,CAAC,6BAA6B,mCAAI,CAAC,CAAC;IACzE,IAAI,CAAC,UAAU,CAAC,6BAA6B,GAAG,aAAa,GAAG,CAAC,CAAC;IAClE,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC3B,MAAM,QAAQ,GAAG,6BAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,IAAA,uCAAsB,EAAC,QAAQ,CAAC,EAAE;YACrC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE;gBACpC,IAAI,EAAE,+BAA+B;gBACrC,QAAQ,EAAE,aAAa;gBACvB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,6BAA6B;gBACvD,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,KAAK;gBACZ,SAAS,EAAE,SAAS;aACpB,CAAC,CAAC;SACH;KACD;AACF,CAAC,CAAC;AApBW,QAAA,sCAAsC,0CAoBjD","sourcesContent":["import { BgsPlayerEntity, BgsPlayerGlobalInfo } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnGlobalInfoUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { isVolumizer } from '../utils';\r\n\r\nexport const updateVolumizerBuffs = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tattackBuff: number,\r\n\thealthBuff: number,\r\n\tgameState: FullGameState,\r\n) => {\r\n\thero.globalInfo.VolumizerAttackBuff += attackBuff;\r\n\thero.globalInfo.VolumizerHealthBuff += healthBuff;\r\n\tfor (const entity of board) {\r\n\t\tif (isVolumizer(entity.cardId, hero, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tmodifyStats(entity, hero, attackBuff, healthBuff, board, hero, gameState);\r\n\t\t}\r\n\t\t// for (const enchantment of entity.enchantments) {\r\n\t\t// \tconst rootDbfId = gameState.allCards.getCard(enchantment.cardId).entityDbfIf;\r\n\t\t// \tif (isVolumizer(rootDbfId, hero, gameState.anomalies, gameState.allCards)) {\r\n\t\t// \t\tmodifyStats(entity, hero, attackBuff, healthBuff, board, hero, gameState);\r\n\t\t// \t}\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const incrementDeathrattlesTriggeredThisGame = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst previousValue = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = previousValue + 1;\r\n\tfor (const entity of board) {\r\n\t\tconst cardImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnGlobalInfoUpdated(cardImpl)) {\r\n\t\t\tcardImpl.onGlobalInfoUpdated(entity, {\r\n\t\t\t\ttype: 'DeathrattlesTriggeredThisGame',\r\n\t\t\t\toldValue: previousValue,\r\n\t\t\t\tnewValue: hero.globalInfo.DeathrattlesTriggeredThisGame,\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnGlobalInfoUpdatedInput<T extends keyof BgsPlayerGlobalInfo> {\r\n\ttype: T;\r\n\toldValue: number;\r\n\tnewValue: number;\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\n"]}
1
+ {"version":3,"file":"player-global-effects.js","sourceRoot":"","sources":["../../src/mechanics/player-global-effects.ts"],"names":[],"mappings":";;;AAEA,4DAAiE;AACjE,iEAA4D;AAE5D,+CAAkD;AAClD,oCAAuC;AAEhC,MAAM,oBAAoB,GAAG,CACnC,IAAqB,EACrB,KAAoB,EACpB,UAAkB,EAClB,UAAkB,EAClB,SAAwB,EACvB,EAAE;IACH,IAAI,CAAC,UAAU,CAAC,mBAAmB,IAAI,UAAU,CAAC;IAClD,IAAI,CAAC,UAAU,CAAC,mBAAmB,IAAI,UAAU,CAAC;IAClD,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC3B,IAAI,IAAA,mBAAW,EAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;YAC9E,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;SAC1E;KAOD;AACF,CAAC,CAAC;AApBW,QAAA,oBAAoB,wBAoB/B;AAEK,MAAM,sCAAsC,GAAG,CACrD,IAAqB,EACrB,KAAoB,EACpB,SAAwB,EACvB,EAAE;;IACH,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,UAAU,CAAC,6BAA6B,mCAAI,CAAC,CAAC;IACzE,IAAI,CAAC,UAAU,CAAC,6BAA6B,GAAG,aAAa,GAAG,CAAC,CAAC;IAClE,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC3B,MAAM,QAAQ,GAAG,6BAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,IAAA,uCAAsB,EAAC,QAAQ,CAAC,EAAE;YACrC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE;gBACpC,MAAM,EAAE;oBACP;wBACC,IAAI,EAAE,+BAA+B;wBACrC,QAAQ,EAAE,aAAa;wBACvB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,6BAA6B;qBACvD;iBACD;gBACD,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,KAAK;gBACZ,SAAS,EAAE,SAAS;aACpB,CAAC,CAAC;SACH;KACD;AACF,CAAC,CAAC;AAxBW,QAAA,sCAAsC,0CAwBjD","sourcesContent":["import { BgsPlayerEntity, BgsPlayerGlobalInfo } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnGlobalInfoUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { isVolumizer } from '../utils';\r\n\r\nexport const updateVolumizerBuffs = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tattackBuff: number,\r\n\thealthBuff: number,\r\n\tgameState: FullGameState,\r\n) => {\r\n\thero.globalInfo.VolumizerAttackBuff += attackBuff;\r\n\thero.globalInfo.VolumizerHealthBuff += healthBuff;\r\n\tfor (const entity of board) {\r\n\t\tif (isVolumizer(entity.cardId, hero, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tmodifyStats(entity, hero, attackBuff, healthBuff, board, hero, gameState);\r\n\t\t}\r\n\t\t// for (const enchantment of entity.enchantments) {\r\n\t\t// \tconst rootDbfId = gameState.allCards.getCard(enchantment.cardId).entityDbfIf;\r\n\t\t// \tif (isVolumizer(rootDbfId, hero, gameState.anomalies, gameState.allCards)) {\r\n\t\t// \t\tmodifyStats(entity, hero, attackBuff, healthBuff, board, hero, gameState);\r\n\t\t// \t}\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const incrementDeathrattlesTriggeredThisGame = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst previousValue = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = previousValue + 1;\r\n\tfor (const entity of board) {\r\n\t\tconst cardImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnGlobalInfoUpdated(cardImpl)) {\r\n\t\t\tcardImpl.onGlobalInfoUpdated(entity, {\r\n\t\t\t\tvalues: [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttype: 'DeathrattlesTriggeredThisGame',\r\n\t\t\t\t\t\toldValue: previousValue,\r\n\t\t\t\t\t\tnewValue: hero.globalInfo.DeathrattlesTriggeredThisGame,\r\n\t\t\t\t\t},\r\n\t\t\t\t],\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnGlobalInfoUpdatedInput {\r\n\tvalues: {\r\n\t\ttype: keyof BgsPlayerGlobalInfo;\r\n\t\toldValue: number;\r\n\t\tnewValue: number;\r\n\t}[];\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\n"]}
@@ -10,7 +10,7 @@ export { partitionArray, sleep };
10
10
  export declare function pickRandom<T>(array: readonly T[]): T;
11
11
  export declare function pickRandom<T extends BoardEntity>(array: readonly T[], sourceEntity: BoardEntity | BoardSecret | BoardTrinket): T;
12
12
  export declare const pickMultipleRandom: <T>(array: readonly T[], quantity: number) => T[];
13
- export declare const pickRandomAlive: (board: BoardEntity[]) => BoardEntity;
13
+ export declare const pickRandomAlive: (board: BoardEntity[], sourceEntity?: BoardEntity | BoardSecret | BoardTrinket) => BoardEntity;
14
14
  export declare const pickMultipleRandomAlive: (board: BoardEntity[], quantity: number) => BoardEntity[];
15
15
  export declare const pickRandomLowestHealth: (board: BoardEntity[]) => BoardEntity;
16
16
  export declare const pickRandomLowestAttack: (board: BoardEntity[]) => BoardEntity;
@@ -62,9 +62,9 @@ const pickMultipleRandom = (array, quantity) => {
62
62
  return picked;
63
63
  };
64
64
  exports.pickMultipleRandom = pickMultipleRandom;
65
- const pickRandomAlive = (board) => {
65
+ const pickRandomAlive = (board, sourceEntity) => {
66
66
  const targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);
67
- const chosenEntity = pickRandom(targetBoard);
67
+ const chosenEntity = pickRandom(targetBoard, sourceEntity);
68
68
  return chosenEntity;
69
69
  };
70
70
  exports.pickRandomAlive = pickRandomAlive;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/services/utils.ts"],"names":[],"mappings":";;;AAGA,gDAA4C;AAC5C,+BAA+B;AAE/B,SAAS,cAAc,CAAI,KAAmB,EAAE,aAAqB;IACpE,MAAM,WAAW,GAAQ,CAAC,GAAG,KAAK,CAAC,CAAC;IACpC,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,OAAO,WAAW,CAAC,MAAM,EAAE;QAC1B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;KAClD;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAkBQ,wCAAc;AAhBvB,KAAK,UAAU,KAAK,CAAC,EAAE;IACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC;AAcwB,sBAAK;AAZvB,MAAM,eAAe,GAC3B,CAAI,YAAyC,EAAE,EAAE,CACjD,CAAC,KAAmB,EAAmC,EAAE;IACxD,OAAO,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,GAAG,EAAE,EAAE;;QACtD,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AE;IAClD,IAAI,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,IAAI,WAAW,GAAG,CAAC,CAAC;IAGpB,OAAO,YAAY,IAAI,CAAC,EAAE;QAEzB,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,YAAM,GAAE,GAAG,YAAY,CAAC,CAAC;QAClD,YAAY,EAAE,CAAC;QAGf,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;KACtF;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB;AAEK,MAAM,QAAQ,GAAG,CACvB,KAAmB,EACnB,SAAkE,EAC9D,EAAE;IACN,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA,EAAE;QACrB,OAAO,IAAI,CAAC;KACZ;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB","sourcesContent":["import { BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { debugState } from '../debug-state';\r\nimport { random } from './rng';\r\n\r\nfunction partitionArray<T>(array: readonly T[], partitionSize: number): readonly T[][] {\r\n\tconst workingCopy: T[] = [...array];\r\n\tconst result: T[][] = [];\r\n\twhile (workingCopy.length) {\r\n\t\tresult.push(workingCopy.splice(0, partitionSize));\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nasync function sleep(ms) {\r\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\r\n}\r\n\r\nexport const groupByFunction =\r\n\t<T>(keyExtractor: (obj: T) => string | number) =>\r\n\t(array: readonly T[]): { [key: string]: readonly T[] } => {\r\n\t\treturn (array ?? []).reduce((objectsByKeyValue, obj) => {\r\n\t\t\tconst value = keyExtractor(obj);\r\n\t\t\tobjectsByKeyValue[value] = objectsByKeyValue[value] ?? [];\r\n\t\t\t// Using push instead of concat is thousands of times faster on big arrays\r\n\t\t\tobjectsByKeyValue[value].push(obj);\r\n\t\t\treturn objectsByKeyValue;\r\n\t\t}, {});\r\n\t};\r\n\r\nexport { partitionArray, sleep };\r\n\r\nexport function pickRandom<T>(array: readonly T[]): T;\r\nexport function pickRandom<T extends BoardEntity>(\r\n\tarray: readonly T[],\r\n\tsourceEntity: BoardEntity | BoardSecret | BoardTrinket,\r\n): T;\r\nexport function pickRandom<T>(array: readonly T[], sourceEntity?: BoardEntity | BoardSecret | BoardTrinket): T {\r\n\tif (!array?.length) {\r\n\t\treturn null;\r\n\t}\r\n\tif (\r\n\t\tsourceEntity &&\r\n\t\tdebugState.active &&\r\n\t\tarray.length > 0 &&\r\n\t\ttypeof array[0] === 'object' &&\r\n\t\tarray[0] != null &&\r\n\t\t'entityId' in array[0]\r\n\t) {\r\n\t\tconst forced = debugState.forcedRandomPicks.find((p) => debugState.isCorrectEntity(p.source, sourceEntity));\r\n\t\tif (forced) {\r\n\t\t\tconst match = (array as unknown as BoardEntity[]).find((c) => debugState.isCorrectEntity(forced.target, c));\r\n\t\t\t// Defer consumption when pick has chosenCardId - getRandomMagneticVolumizer will consume (e.g. Apexis Guardian)\r\n\t\t\tif (!forced.chosenCardId) {\r\n\t\t\t\tdebugState.forcedRandomPicks = debugState.forcedRandomPicks.filter((p) => p !== forced);\r\n\t\t\t}\r\n\t\t\tif (match) {\r\n\t\t\t\treturn match as T;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn array[Math.floor(random() * array.length)];\r\n}\r\n\r\nexport const pickMultipleRandom = <T>(array: readonly T[], quantity: number): T[] => {\r\n\tconst picked: T[] = [];\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tconst target = array.filter((e) => !picked.includes(e));\r\n\t\tconst chosenEntity = pickRandom(target);\r\n\t\tif (!!chosenEntity) {\r\n\t\t\tpicked.push(chosenEntity);\r\n\t\t}\r\n\t}\r\n\treturn picked;\r\n};\r\n\r\nexport const pickRandomAlive = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst chosenEntity = pickRandom(targetBoard);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickMultipleRandomAlive = (board: BoardEntity[], quantity: number): BoardEntity[] => {\r\n\tconst picked: BoardEntity[] = [];\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead).filter((e) => !picked.includes(e));\r\n\t\tconst chosenEntity = pickRandom(targetBoard);\r\n\t\tif (!!chosenEntity) {\r\n\t\t\tpicked.push(chosenEntity);\r\n\t\t}\r\n\t}\r\n\treturn picked;\r\n};\r\n\r\nexport const pickRandomLowestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst lowestHealth = Math.min(...targetBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = targetBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickRandomLowestAttack = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst lowestAttack = Math.min(...targetBoard.map((e) => e.attack));\r\n\tconst entitiesWithLowestAttack = targetBoard.filter((e) => e.attack === lowestAttack);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestAttack);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickRandomHighestAttack = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst highestAttack = Math.max(...targetBoard.map((e) => e.attack));\r\n\tconst entitiesWithHighestAttack = targetBoard.filter((e) => e.attack === highestAttack);\r\n\tconst chosenEntity = pickRandom(entitiesWithHighestAttack);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickRandomHighestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst highestHealth = Math.max(...targetBoard.map((e) => e.health));\r\n\tconst entitiesWithHighestHealth = targetBoard.filter((e) => e.health === highestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithHighestHealth);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const encode = (input: string): string => {\r\n\t// return compressToEncodedURIComponent(input);\r\n\tconst buff = Buffer.from(input, 'utf-8');\r\n\tconst base64 = buff.toString('base64');\r\n\treturn base64;\r\n};\r\n\r\nexport const decode = (base64: string): string => {\r\n\tconst buff = Buffer.from(base64, 'base64');\r\n\tconst str = buff.toString('utf-8');\r\n\treturn str;\r\n};\r\n\r\nexport const pickMultipleRandomDifferent = <T>(list: T[], n: number): T[] => {\r\n\tconst shuffled = shuffleArray([...list]);\r\n\treturn shuffled.slice(0, n);\r\n};\r\n\r\n// https://stackoverflow.com/a/2450976/548701\r\nexport const shuffleArray = <T>(array: T[]): T[] => {\r\n\tlet currentIndex = array.length;\r\n\tlet randomIndex = 0;\r\n\r\n\t// While there remain elements to shuffle...\r\n\twhile (currentIndex != 0) {\r\n\t\t// Pick a remaining element...\r\n\t\trandomIndex = Math.floor(random() * currentIndex);\r\n\t\tcurrentIndex--;\r\n\r\n\t\t// And swap it with the current element.\r\n\t\t[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\r\n\t}\r\n\r\n\treturn array;\r\n};\r\n\r\nexport const findLast = <T>(\r\n\tarray: readonly T[],\r\n\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\r\n): T => {\r\n\tconst filtred = array.filter(predicate);\r\n\tif (!filtred?.length) {\r\n\t\treturn null;\r\n\t}\r\n\tconst last = filtred[filtred.length - 1];\r\n\treturn last;\r\n};\r\n\r\nexport type Mutable<T> = {\r\n\t-readonly [P in keyof T]: T[P];\r\n};\r\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/services/utils.ts"],"names":[],"mappings":";;;AAGA,gDAA4C;AAC5C,+BAA+B;AAE/B,SAAS,cAAc,CAAI,KAAmB,EAAE,aAAqB;IACpE,MAAM,WAAW,GAAQ,CAAC,GAAG,KAAK,CAAC,CAAC;IACpC,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,OAAO,WAAW,CAAC,MAAM,EAAE;QAC1B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;KAClD;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAkBQ,wCAAc;AAhBvB,KAAK,UAAU,KAAK,CAAC,EAAE;IACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC;AAcwB,sBAAK;AAZvB,MAAM,eAAe,GAC3B,CAAI,YAAyC,EAAE,EAAE,CACjD,CAAC,KAAmB,EAAmC,EAAE;IACxD,OAAO,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,GAAG,EAAE,EAAE;;QACtD,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,iBAAiB,CAAC,KAAK,CAAC,GAAG,MAAA,iBAAiB,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAC;QAE1D,iBAAiB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC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GAAE,GAAG,YAAY,CAAC,CAAC;QAClD,YAAY,EAAE,CAAC;QAGf,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;KACtF;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB;AAEK,MAAM,QAAQ,GAAG,CACvB,KAAmB,EACnB,SAAkE,EAC9D,EAAE;IACN,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA,EAAE;QACrB,OAAO,IAAI,CAAC;KACZ;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB","sourcesContent":["import { BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { debugState } from '../debug-state';\r\nimport { random } from './rng';\r\n\r\nfunction partitionArray<T>(array: readonly T[], partitionSize: number): readonly T[][] {\r\n\tconst workingCopy: T[] = [...array];\r\n\tconst result: T[][] = [];\r\n\twhile (workingCopy.length) {\r\n\t\tresult.push(workingCopy.splice(0, partitionSize));\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nasync function sleep(ms) {\r\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\r\n}\r\n\r\nexport const groupByFunction =\r\n\t<T>(keyExtractor: (obj: T) => string | number) =>\r\n\t(array: readonly T[]): { [key: string]: readonly T[] } => {\r\n\t\treturn (array ?? []).reduce((objectsByKeyValue, obj) => {\r\n\t\t\tconst value = keyExtractor(obj);\r\n\t\t\tobjectsByKeyValue[value] = objectsByKeyValue[value] ?? [];\r\n\t\t\t// Using push instead of concat is thousands of times faster on big arrays\r\n\t\t\tobjectsByKeyValue[value].push(obj);\r\n\t\t\treturn objectsByKeyValue;\r\n\t\t}, {});\r\n\t};\r\n\r\nexport { partitionArray, sleep };\r\n\r\nexport function pickRandom<T>(array: readonly T[]): T;\r\nexport function pickRandom<T extends BoardEntity>(\r\n\tarray: readonly T[],\r\n\tsourceEntity: BoardEntity | BoardSecret | BoardTrinket,\r\n): T;\r\nexport function pickRandom<T>(array: readonly T[], sourceEntity?: BoardEntity | BoardSecret | BoardTrinket): T {\r\n\tif (!array?.length) {\r\n\t\treturn null;\r\n\t}\r\n\tif (\r\n\t\tsourceEntity &&\r\n\t\tdebugState.active &&\r\n\t\tarray.length > 0 &&\r\n\t\ttypeof array[0] === 'object' &&\r\n\t\tarray[0] != null &&\r\n\t\t'entityId' in array[0]\r\n\t) {\r\n\t\tconst forced = debugState.forcedRandomPicks.find((p) => debugState.isCorrectEntity(p.source, sourceEntity));\r\n\t\tif (forced) {\r\n\t\t\tconst match = (array as unknown as BoardEntity[]).find((c) => debugState.isCorrectEntity(forced.target, c));\r\n\t\t\t// Defer consumption when pick has chosenCardId - getRandomMagneticVolumizer will consume (e.g. Apexis Guardian)\r\n\t\t\tif (!forced.chosenCardId) {\r\n\t\t\t\tdebugState.forcedRandomPicks = debugState.forcedRandomPicks.filter((p) => p !== forced);\r\n\t\t\t}\r\n\t\t\tif (match) {\r\n\t\t\t\treturn match as T;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn array[Math.floor(random() * array.length)];\r\n}\r\n\r\nexport const pickMultipleRandom = <T>(array: readonly T[], quantity: number): T[] => {\r\n\tconst picked: T[] = [];\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tconst target = array.filter((e) => !picked.includes(e));\r\n\t\tconst chosenEntity = pickRandom(target);\r\n\t\tif (!!chosenEntity) {\r\n\t\t\tpicked.push(chosenEntity);\r\n\t\t}\r\n\t}\r\n\treturn picked;\r\n};\r\n\r\nexport const pickRandomAlive = (\r\n\tboard: BoardEntity[],\r\n\tsourceEntity?: BoardEntity | BoardSecret | BoardTrinket,\r\n): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst chosenEntity = pickRandom(targetBoard, sourceEntity);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickMultipleRandomAlive = (board: BoardEntity[], quantity: number): BoardEntity[] => {\r\n\tconst picked: BoardEntity[] = [];\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead).filter((e) => !picked.includes(e));\r\n\t\tconst chosenEntity = pickRandom(targetBoard);\r\n\t\tif (!!chosenEntity) {\r\n\t\t\tpicked.push(chosenEntity);\r\n\t\t}\r\n\t}\r\n\treturn picked;\r\n};\r\n\r\nexport const pickRandomLowestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst lowestHealth = Math.min(...targetBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = targetBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickRandomLowestAttack = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst lowestAttack = Math.min(...targetBoard.map((e) => e.attack));\r\n\tconst entitiesWithLowestAttack = targetBoard.filter((e) => e.attack === lowestAttack);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestAttack);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickRandomHighestAttack = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst highestAttack = Math.max(...targetBoard.map((e) => e.attack));\r\n\tconst entitiesWithHighestAttack = targetBoard.filter((e) => e.attack === highestAttack);\r\n\tconst chosenEntity = pickRandom(entitiesWithHighestAttack);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickRandomHighestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst highestHealth = Math.max(...targetBoard.map((e) => e.health));\r\n\tconst entitiesWithHighestHealth = targetBoard.filter((e) => e.health === highestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithHighestHealth);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const encode = (input: string): string => {\r\n\t// return compressToEncodedURIComponent(input);\r\n\tconst buff = Buffer.from(input, 'utf-8');\r\n\tconst base64 = buff.toString('base64');\r\n\treturn base64;\r\n};\r\n\r\nexport const decode = (base64: string): string => {\r\n\tconst buff = Buffer.from(base64, 'base64');\r\n\tconst str = buff.toString('utf-8');\r\n\treturn str;\r\n};\r\n\r\nexport const pickMultipleRandomDifferent = <T>(list: T[], n: number): T[] => {\r\n\tconst shuffled = shuffleArray([...list]);\r\n\treturn shuffled.slice(0, n);\r\n};\r\n\r\n// https://stackoverflow.com/a/2450976/548701\r\nexport const shuffleArray = <T>(array: T[]): T[] => {\r\n\tlet currentIndex = array.length;\r\n\tlet randomIndex = 0;\r\n\r\n\t// While there remain elements to shuffle...\r\n\twhile (currentIndex != 0) {\r\n\t\t// Pick a remaining element...\r\n\t\trandomIndex = Math.floor(random() * currentIndex);\r\n\t\tcurrentIndex--;\r\n\r\n\t\t// And swap it with the current element.\r\n\t\t[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\r\n\t}\r\n\r\n\treturn array;\r\n};\r\n\r\nexport const findLast = <T>(\r\n\tarray: readonly T[],\r\n\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\r\n): T => {\r\n\tconst filtred = array.filter(predicate);\r\n\tif (!filtred?.length) {\r\n\t\treturn null;\r\n\t}\r\n\tconst last = filtred[filtred.length - 1];\r\n\treturn last;\r\n};\r\n\r\nexport type Mutable<T> = {\r\n\t-readonly [P in keyof T]: T[P];\r\n};\r\n"]}
@@ -378,12 +378,6 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState, applyAttackAuras
378
378
  const statsBonusFungus = multiplierFungus * boardHero.globalInfo.TavernSpellsCastThisGame;
379
379
  (0, stats_1.modifyStats)(spawned, null, applyAttackAuras ? statsBonusFungus : 0, applyHealthAuras ? 2 * statsBonusFungus : 0, board, boardHero, gameState, false);
380
380
  break;
381
- case "BG26_537":
382
- case "BG26_537_G":
383
- const multiplierFrostling = spawned.cardId === "BG26_537_G" ? 2 : 1;
384
- const statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;
385
- (0, stats_1.modifyStats)(spawned, null, applyAttackAuras ? (2 + boardHero.globalInfo.ElementalAttackBuff) * statsBonusFrostling : 0, applyHealthAuras ? (1 + boardHero.globalInfo.ElementalHealthBuff) * statsBonusFrostling : 0, board, boardHero, gameState, false);
386
- break;
387
381
  case "BGS_081":
388
382
  case "TB_BaconUps_143":
389
383
  const multiplierLooter = spawned.cardId === "TB_BaconUps_143" ? 2 : 1;
@@ -619,19 +613,6 @@ const removeAurasFromSelf = (entity, board, boardHero, gameState, applyAttackAur
619
613
  entity.maxHealth = Math.max(1, entity.maxHealth - 2 * statsBonusFungus);
620
614
  }
621
615
  break;
622
- case "BG26_537":
623
- case "BG26_537_G":
624
- const multiplierFrostling = entity.cardId === "BG26_537_G" ? 2 : 1;
625
- const statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;
626
- if (applyAttackAuras) {
627
- entity.attack = Math.max(0, entity.attack - (2 + boardHero.globalInfo.ElementalAttackBuff) * statsBonusFrostling);
628
- entity.maxAttack = Math.max(0, entity.maxAttack - (2 + boardHero.globalInfo.ElementalAttackBuff) * statsBonusFrostling);
629
- }
630
- if (applyHealthAuras) {
631
- entity.health = Math.max(1, entity.health - (1 + boardHero.globalInfo.ElementalHealthBuff) * statsBonusFrostling);
632
- entity.maxHealth = Math.max(1, entity.maxHealth - (1 + boardHero.globalInfo.ElementalHealthBuff) * statsBonusFrostling);
633
- }
634
- break;
635
616
  case "BG_TTN_401":
636
617
  case "BG_TTN_401_G":
637
618
  const multiplierAstral = entity.cardId === "BG_TTN_401_G" ? 2 : 1;