@firestone-hs/simulate-bgs-battle 1.1.729 → 1.1.731
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bgs-battle-options.d.ts +1 -0
- package/dist/bgs-battle-options.js.map +1 -1
- package/dist/bgs-player-entity.d.ts +1 -0
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/cards/impl/_card-mappings.js +82 -74
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/bg-spell/sharing-is-caring.js.map +1 -1
- package/dist/cards/impl/bg-spell/toxic-tumbleweed.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-high.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-left.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-low.js.map +1 -1
- package/dist/cards/impl/hero-power/aim-right.js.map +1 -1
- package/dist/cards/impl/hero-power/avatar-of-nzoth.d.ts +2 -0
- package/dist/cards/impl/hero-power/avatar-of-nzoth.js +22 -0
- package/dist/cards/impl/hero-power/avatar-of-nzoth.js.map +1 -0
- package/dist/cards/impl/hero-power/earth-invocation.js.map +1 -1
- package/dist/cards/impl/hero-power/embrace-your-rage.js.map +1 -1
- package/dist/cards/impl/hero-power/fire-invocation.js.map +1 -1
- package/dist/cards/impl/hero-power/reborn-rites.js.map +1 -1
- package/dist/cards/impl/hero-power/water-invocation.js.map +1 -1
- package/dist/cards/impl/minion/all-seeing-elder.js.map +1 -1
- package/dist/cards/impl/minion/alleycat.js.map +1 -1
- package/dist/cards/impl/minion/amber-guardian.js.map +1 -1
- package/dist/cards/impl/minion/archimonde.js.map +1 -1
- package/dist/cards/impl/minion/arid-atrocity.js.map +1 -1
- package/dist/cards/impl/minion/ashen-corruptor.js.map +1 -1
- package/dist/cards/impl/minion/assistant-guard.js.map +1 -1
- package/dist/cards/impl/minion/audacious-anchor.js.map +1 -1
- package/dist/cards/impl/minion/auto-assembler-enchantment.js +1 -6
- package/dist/cards/impl/minion/auto-assembler-enchantment.js.map +1 -1
- package/dist/cards/impl/minion/auto-assembler.js.map +1 -1
- package/dist/cards/impl/minion/avalanche-caller.js.map +1 -1
- package/dist/cards/impl/minion/baneling.js.map +1 -1
- package/dist/cards/impl/minion/bigwig-bandit.js.map +1 -1
- package/dist/cards/impl/minion/bird-buddy.js.map +1 -1
- package/dist/cards/impl/minion/blazing-skyfin.js.map +1 -1
- package/dist/cards/impl/minion/blue-whelp.js.map +1 -1
- package/dist/cards/impl/minion/boar-gamer.js.map +1 -1
- package/dist/cards/impl/minion/briarback-bookie.js.map +1 -1
- package/dist/cards/impl/minion/bronze-steward.js.map +1 -1
- package/dist/cards/impl/minion/bubble-gunner.js.map +1 -1
- package/dist/cards/impl/minion/buzzing-vermin.js.map +1 -1
- package/dist/cards/impl/minion/cadaver-caretaker.js.map +1 -1
- package/dist/cards/impl/minion/captain-bonerender.js.map +1 -1
- package/dist/cards/impl/minion/carapace-raiser.js.map +1 -1
- package/dist/cards/impl/minion/carbonic-copy.js.map +1 -1
- package/dist/cards/impl/minion/choral-mrrrglr.js +1 -1
- package/dist/cards/impl/minion/choral-mrrrglr.js.map +1 -1
- package/dist/cards/impl/minion/coilskar-sapper.js.map +1 -1
- package/dist/cards/impl/minion/coldlight-diver.js.map +1 -1
- package/dist/cards/impl/minion/crystal-infuser-enchantment.js.map +1 -1
- package/dist/cards/impl/minion/cupcake-peddler.js.map +1 -1
- package/dist/cards/impl/minion/deadstomper.js.map +1 -1
- package/dist/cards/impl/minion/deathly-striker.js.map +1 -1
- package/dist/cards/impl/minion/deflecto-bot.js.map +1 -1
- package/dist/cards/impl/minion/devout-hellcaller.js.map +1 -1
- package/dist/cards/impl/minion/drakkari-embalmer.js.map +1 -1
- package/dist/cards/impl/minion/electric-synthesizer.js.map +1 -1
- package/dist/cards/impl/minion/elite-navigator.js.map +1 -1
- package/dist/cards/impl/minion/fairy-gillmother.js.map +1 -1
- package/dist/cards/impl/minion/firescale-hoarder.js.map +1 -1
- package/dist/cards/impl/minion/fireworks-fanatic.js.map +1 -1
- package/dist/cards/impl/minion/flotsam-flinger.js.map +1 -1
- package/dist/cards/impl/minion/fountain-chiller.js.map +1 -1
- package/dist/cards/impl/minion/friendly-geist.js.map +1 -1
- package/dist/cards/impl/minion/gem-rat.js.map +1 -1
- package/dist/cards/impl/minion/general-drakkisath.js.map +1 -1
- package/dist/cards/impl/minion/gentle-djinni.js.map +1 -1
- package/dist/cards/impl/minion/gentle-stag.js.map +1 -1
- package/dist/cards/impl/minion/glim-guardian.d.ts +2 -0
- package/dist/cards/impl/minion/glim-guardian.js +13 -0
- package/dist/cards/impl/minion/glim-guardian.js.map +1 -0
- package/dist/cards/impl/minion/gormling-gourmet.js.map +1 -1
- package/dist/cards/impl/minion/greedy-snaketongue.js.map +1 -1
- package/dist/cards/impl/minion/grimscale-elegist.js.map +1 -1
- package/dist/cards/impl/minion/gritty-headhunter.js.map +1 -1
- package/dist/cards/impl/minion/hackerfin.js.map +1 -1
- package/dist/cards/impl/minion/handless-forsaken.js.map +1 -1
- package/dist/cards/impl/minion/harmless-bonehead.js.map +1 -1
- package/dist/cards/impl/minion/hawkstrider-herald.js.map +1 -1
- package/dist/cards/impl/minion/holo-rover.js.map +1 -1
- package/dist/cards/impl/minion/humongozz.js.map +1 -1
- package/dist/cards/impl/minion/hungry-snapjaw.js.map +1 -1
- package/dist/cards/impl/minion/hunter-of-gatherers.js.map +1 -1
- package/dist/cards/impl/minion/ignition-specialist.js.map +1 -1
- package/dist/cards/impl/minion/immortal.js.map +1 -1
- package/dist/cards/impl/minion/implant-subject.js.map +1 -1
- package/dist/cards/impl/minion/imposing-percussionist.js.map +1 -1
- package/dist/cards/impl/minion/inspiring-underdog.js.map +1 -1
- package/dist/cards/impl/minion/interrogator-whitemane.js.map +1 -1
- package/dist/cards/impl/minion/kangors-apprentice.js.map +1 -1
- package/dist/cards/impl/minion/leeroy-the-reckless.js.map +1 -1
- package/dist/cards/impl/minion/lightfang-enforcer.js.map +1 -1
- package/dist/cards/impl/minion/lightfeather-screecher.js.map +1 -1
- package/dist/cards/impl/minion/living-azerite.js.map +1 -1
- package/dist/cards/impl/minion/lokholar-frostforger.js.map +1 -1
- package/dist/cards/impl/minion/lovesick-balladist.js.map +1 -1
- package/dist/cards/impl/minion/low-flier.js.map +1 -1
- package/dist/cards/impl/minion/lurker.js.map +1 -1
- package/dist/cards/impl/minion/manasaber.js.map +1 -1
- package/dist/cards/impl/minion/mantid-queen.js.map +1 -1
- package/dist/cards/impl/minion/maritime-extortionist.d.ts +2 -0
- package/dist/cards/impl/minion/maritime-extortionist.js +33 -0
- package/dist/cards/impl/minion/maritime-extortionist.js.map +1 -0
- package/dist/cards/impl/minion/marquee-ticker.js.map +1 -1
- package/dist/cards/impl/minion/maw-caster.js.map +1 -1
- package/dist/cards/impl/minion/mecha-jaraxxus.js.map +1 -1
- package/dist/cards/impl/minion/mechanized-gift-horse.js.map +1 -1
- package/dist/cards/impl/minion/mechorse.js.map +1 -1
- package/dist/cards/impl/minion/menagerie-jug.js.map +1 -1
- package/dist/cards/impl/minion/metallic-hunter.js.map +1 -1
- package/dist/cards/impl/minion/misfit-dragonling.js.map +1 -1
- package/dist/cards/impl/minion/murkbrine-expeditioner.js.map +1 -1
- package/dist/cards/impl/minion/murky.js.map +1 -1
- package/dist/cards/impl/minion/mutated-lasher.js.map +1 -1
- package/dist/cards/impl/minion/mythrax.js.map +1 -1
- package/dist/cards/impl/minion/neon-agent.js.map +1 -1
- package/dist/cards/impl/minion/nest-swarmer.js.map +1 -1
- package/dist/cards/impl/minion/nether-drake.js.map +1 -1
- package/dist/cards/impl/minion/nightmare-par-tea-guest.js.map +1 -1
- package/dist/cards/impl/minion/nimble-hatchling.js.map +1 -1
- package/dist/cards/impl/minion/operatic-belcher.js.map +1 -1
- package/dist/cards/impl/minion/outback-smolderer.js.map +1 -1
- package/dist/cards/impl/minion/parched-wanderer.js.map +1 -1
- package/dist/cards/impl/minion/primalfin-lookout.js.map +1 -1
- package/dist/cards/impl/minion/prodigious-tusker.js +2 -6
- package/dist/cards/impl/minion/prodigious-tusker.js.map +1 -1
- package/dist/cards/impl/minion/rapscallion-recruiter.js.map +1 -1
- package/dist/cards/impl/minion/razorgore-the-untamed.js.map +1 -1
- package/dist/cards/impl/minion/roach.js.map +1 -1
- package/dist/cards/impl/minion/roadboar.js.map +1 -1
- package/dist/cards/impl/minion/rodeo-performer.js.map +1 -1
- package/dist/cards/impl/minion/ruins-renovator.js.map +1 -1
- package/dist/cards/impl/minion/rylak-metalhead.js.map +1 -1
- package/dist/cards/impl/minion/salty-hog.js.map +1 -1
- package/dist/cards/impl/minion/sand-swirler.js.map +1 -1
- package/dist/cards/impl/minion/sandy.js.map +1 -1
- package/dist/cards/impl/minion/scourge-harvester.js.map +1 -1
- package/dist/cards/impl/minion/selfless-hero.js.map +1 -1
- package/dist/cards/impl/minion/shadowdancer.js.map +1 -1
- package/dist/cards/impl/minion/sharp-eyed-sabretooth.js.map +1 -1
- package/dist/cards/impl/minion/sharptooth-snapper.js.map +1 -1
- package/dist/cards/impl/minion/ship-master-eudora.js.map +1 -1
- package/dist/cards/impl/minion/shipwrecked-rascal.js.map +1 -1
- package/dist/cards/impl/minion/silver-handed-recruit.js.map +1 -1
- package/dist/cards/impl/minion/slumber-sorcerer.js.map +1 -1
- package/dist/cards/impl/minion/smolderwing.js.map +1 -1
- package/dist/cards/impl/minion/soul-rewinder.js.map +1 -1
- package/dist/cards/impl/minion/spacefarer.js.map +1 -1
- package/dist/cards/impl/minion/spirited-whimsydrake.js.map +1 -1
- package/dist/cards/impl/minion/springy-spriggan.js.map +1 -1
- package/dist/cards/impl/minion/stitched-salvager.js.map +1 -1
- package/dist/cards/impl/minion/stray-satyr.js.map +1 -1
- package/dist/cards/impl/minion/sun-screener.js.map +1 -1
- package/dist/cards/impl/minion/surfing-slyvar.js.map +1 -1
- package/dist/cards/impl/minion/tasty-lobster.js +29 -3
- package/dist/cards/impl/minion/tasty-lobster.js.map +1 -1
- package/dist/cards/impl/minion/thorncaller.js.map +1 -1
- package/dist/cards/impl/minion/thousandth-paper-drake.js.map +1 -1
- package/dist/cards/impl/minion/thundering-abomination.js.map +1 -1
- package/dist/cards/impl/minion/timewarped-mrrrglr.js +1 -1
- package/dist/cards/impl/minion/timewarped-mrrrglr.js.map +1 -1
- package/dist/cards/impl/minion/timewarped-warghoul.js.map +1 -1
- package/dist/cards/impl/minion/tunnel-blaster.js.map +1 -1
- package/dist/cards/impl/minion/twilight-primordium.js.map +1 -1
- package/dist/cards/impl/minion/ultralisk.js.map +1 -1
- package/dist/cards/impl/minion/valiant-tiger.js.map +1 -1
- package/dist/cards/impl/minion/void-earl.js.map +1 -1
- package/dist/cards/impl/minion/vorkai-guardian.js.map +1 -1
- package/dist/cards/impl/minion/wandering-wight.js.map +1 -1
- package/dist/cards/impl/minion/whelp-smuggler.js.map +1 -1
- package/dist/cards/impl/minion/whirring-protector-enchantment.js.map +1 -1
- package/dist/cards/impl/minion/wildfire-elemental.js.map +1 -1
- package/dist/cards/impl/minion/wisp-in-the-shell.js.map +1 -1
- package/dist/cards/impl/minion/yorik-smite.js.map +1 -1
- package/dist/cards/impl/minion/yrel.js.map +1 -1
- package/dist/cards/impl/minion/yulon-fortune-granter.js.map +1 -1
- package/dist/cards/impl/quest-reward/righteous-charge.js.map +1 -1
- package/dist/cards/impl/secret/ice-block.d.ts +2 -0
- package/dist/cards/impl/secret/ice-block.js +7 -0
- package/dist/cards/impl/secret/ice-block.js.map +1 -0
- package/dist/cards/impl/trinket/all-purpose-kibble.js.map +1 -1
- package/dist/cards/impl/trinket/arm-of-the-empire.js.map +1 -1
- package/dist/cards/impl/trinket/bassgill-portrait.js.map +1 -1
- package/dist/cards/impl/trinket/battle-horn.js.map +1 -1
- package/dist/cards/impl/trinket/bird-feeder.js.map +1 -1
- package/dist/cards/impl/trinket/crocheted-sungill.js.map +1 -1
- package/dist/cards/impl/trinket/eclectic-shrine.js.map +1 -1
- package/dist/cards/impl/trinket/faerie-dragon-scale.js.map +1 -1
- package/dist/cards/impl/trinket/fishy-sticker.js.map +1 -1
- package/dist/cards/impl/trinket/herald-sticker.js.map +1 -1
- package/dist/cards/impl/trinket/karazhan-chess-set.js.map +1 -1
- package/dist/cards/impl/trinket/rivendare-portrait.js.map +1 -1
- package/dist/cards/impl/trinket/sthara-sticker.js.map +1 -1
- package/dist/cards/impl/trinket/valorous-medaillion.js.map +1 -1
- package/dist/cards/impl/trinket/vashjir-anemone.js.map +1 -1
- package/dist/cards/impl/trinket/yulon-sticker.js.map +1 -1
- package/dist/debug-state.js.map +1 -1
- package/dist/input-clone.js +6 -3
- package/dist/input-clone.js.map +1 -1
- package/dist/keywords/venomous.js.map +1 -1
- package/dist/simulate-bgs-battle.js +2 -1
- package/dist/simulate-bgs-battle.js.map +1 -1
- package/dist/simulation/auras.js +7 -6
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/deathrattle-on-trigger.js.map +1 -1
- package/dist/simulation/discover.js.map +1 -1
- package/dist/simulation/frenzy.js.map +1 -1
- package/dist/simulation/internal-game-state.d.ts +1 -0
- package/dist/simulation/internal-game-state.js.map +1 -1
- package/dist/simulation/quest.js.map +1 -1
- package/dist/simulation/secrets.d.ts +1 -0
- package/dist/simulation/secrets.js +14 -1
- package/dist/simulation/secrets.js.map +1 -1
- package/dist/simulation/simulator.js +25 -9
- package/dist/simulation/simulator.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-action-processor.js +3 -0
- package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
- package/dist/simulation/summon-when-space.js +1 -1
- package/dist/simulation/summon-when-space.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAE/D,mDAA+C;AAC/C,+CAA2C;AAC3C,+CAAiE;AACjE,yDAAqD;AACrD,wCAA2E;AAI3E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AAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAG5D,MAAM,UAAU,GAAG,CAAC,GAAa,EAAE,CAAS,EAAE,EAAE;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAE7D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAE,YAAoB,EAAE,UAAkB,EAAU,EAAE;IAChG,IAAI,YAAY,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,YAAY,KAAK,GAAG,IAAI,YAAY,KAAK,UAAU,EAAE;QACxD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { debugState } from './debug-state';\r\nimport { buildTemplateCloner, cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { createSeededRng, defaultRng, Rng, withRng } from './services/rng';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { SingleSimulationResult } from './single-simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nexport { isValidDeathrattleEnchantment } from './simulation/deathrattle-utils';\r\nexport { createSeededRng, defaultRng, getActiveRng, random, withRng } from './services/rng';\r\nexport type { Rng } from './services/rng';\r\n\r\n// Cap for the post-hoc outcome sample capture phase: rare outcomes (e.g. a 0.1% tie\r\n// chance) might never show up again when re-simulating, so we stop hunting after this\r\n// many extra battles\r\nconst MAX_SAMPLE_RESIMS = 500;\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\nexport interface SimulateSingleCombatOptions {\r\n\t/** If set, creates a Mulberry32 RNG from this seed. Ignored when `rng` is provided. */\r\n\treadonly seed?: number;\r\n\t/** Explicit RNG instance. Takes precedence over `seed`. */\r\n\treadonly rng?: Rng;\r\n\t/** When true, records spectator actions (slower). Default false. */\r\n\treadonly includeSpectator?: boolean;\r\n}\r\n\r\n/**\r\n * Run exactly one combat with a deterministic (or default) RNG.\r\n * Intended for the full-game / self-play env — not for Firestone win% Monte Carlo.\r\n */\r\nexport const simulateSingleCombat = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\toptions: SimulateSingleCombatOptions = {},\r\n): SingleSimulationResult => {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate combat', cards);\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst rng = options.rng ?? (options.seed !== undefined ? createSeededRng(options.seed) : defaultRng);\r\n\tconst includeSpectator = options.includeSpectator ?? false;\r\n\r\n\tapplyDebugStateFromInput(battleInput);\r\n\ttry {\r\n\t\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t\tconst cloneTemplate = buildTemplateCloner(cloneInput3(inputReady));\r\n\t\tconst spectator = new Spectator(includeSpectator);\r\n\t\tif (includeSpectator) {\r\n\t\t\tspectator.startRecording();\r\n\t\t}\r\n\t\treturn withRng(rng, () => runSingleBattle(cloneTemplate, cards, cardsData, spectator, rng));\r\n\t} finally {\r\n\t\tclearDebugStateFromInput(battleInput);\r\n\t}\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst hideMaxSimulationDurationWarning = battleInput.options?.hideMaxSimulationDurationWarning ?? false;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWons: [],\r\n\t\tdamageWon: 0,\r\n\t\tdamageWonRange: null,\r\n\t\tdamageLosts: [],\r\n\t\tdamageLost: 0,\r\n\t\tdamageLostRange: null,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\r\n\tapplyDebugStateFromInput(battleInput);\r\n\r\n\t// cloneInput3 normalizes the input (sorted secrets, reset pendingAttackBuffs, etc.).\r\n\t// The compiled cloner re-materializes that normalized shape as an object literal, which is\r\n\t// faster than JSON.parse of a template string (~0.02ms vs ~0.12ms per clone on a 7v7\r\n\t// board), which was itself faster than generic recursive cloners (~0.19-0.23ms) and\r\n\t// structuredClone (~0.46ms)\r\n\tconst cloneTemplate = buildTemplateCloner(cloneInput3(inputReady));\r\n\r\n\tconst runOne = () => runSingleBattle(cloneTemplate, cards, cardsData, spectator, defaultRng);\r\n\r\n\ttry {\r\n\t\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\t\tconst outcomes = {};\r\n\t\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\t\tconst battleResult = runOne();\r\n\t\t\tif (!battleResult) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (battleResult.result === 'won') {\r\n\t\t\t\tsimulationResult.won++;\r\n\t\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\r\n\t\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t\t}\r\n\t\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\t\tsimulationResult.lost++;\r\n\t\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\r\n\t\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\t\tif (\r\n\t\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t\t) {\r\n\t\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t\t}\r\n\t\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\t\tsimulationResult.tied++;\r\n\t\t\t}\r\n\r\n\t\t\tif (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {\r\n\t\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// Yield intermediate result every 200 iterations\r\n\t\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t\t\tyield simulationResult;\r\n\t\t\t}\r\n\t\t}\r\n\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\r\n\t\t// Capture outcome samples post-hoc: re-run a few battles with action recording turned\r\n\t\t// on, until each outcome that actually occurred has a sample. This is much cheaper\r\n\t\t// than recording during the main loop, where almost all recorded actions get discarded.\r\n\t\t// This phase intentionally ignores maxAcceptableDuration: when the main loop was cut\r\n\t\t// short by the time budget, we would otherwise end up with no samples at all.\r\n\t\tif (includeOutcomeSamples) {\r\n\t\t\tconst neededOutcomes: ('won' | 'lost' | 'tied')[] = [];\r\n\t\t\tsimulationResult.won > 0 && neededOutcomes.push('won');\r\n\t\t\tsimulationResult.lost > 0 && neededOutcomes.push('lost');\r\n\t\t\tsimulationResult.tied > 0 && neededOutcomes.push('tied');\r\n\t\t\tconst missingOutcomes = new Set(neededOutcomes);\r\n\t\t\tif (missingOutcomes.size > 0) {\r\n\t\t\t\tspectator.startRecording();\r\n\t\t\t\tfor (let i = 0; i < MAX_SAMPLE_RESIMS && missingOutcomes.size > 0; i++) {\r\n\t\t\t\t\tconst battleResult = runOne();\r\n\t\t\t\t\tif (!battleResult?.result) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tspectator.commitBattleResult(battleResult.result);\r\n\t\t\t\t\tif (spectator.hasSampleFor(battleResult.result)) {\r\n\t\t\t\t\t\tmissingOutcomes.delete(battleResult.result);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tspectator.stopRecording();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tspectator.prune();\r\n\t\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t\t// Avoid sending this verbose data\r\n\r\n\t\tsimulationResult.damageWons = [];\r\n\t\tsimulationResult.damageLosts = [];\r\n\t\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\t\treturn simulationResult;\r\n\t} finally {\r\n\t\tclearDebugStateFromInput(battleInput);\r\n\t}\r\n};\r\n\r\ntype CloneTemplate = () => BgsBattleInfo;\r\n\r\nconst runSingleBattle = (\r\n\tcloneTemplate: CloneTemplate,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tspectator: Spectator,\r\n\trng: Rng,\r\n): SingleSimulationResult => {\r\n\tconst input: BgsBattleInfo = cloneTemplate();\r\n\t// The \"initial\" states are only read by a handful of cards (and mutated by some, like\r\n\t// San'layn Scribe), so we only pay for the second clone when they are actually accessed\r\n\tlet playerInitialState = null;\r\n\tlet opponentInitialState = null;\r\n\tconst buildInitialStates = () => {\r\n\t\tconst inputClone: BgsBattleInfo = cloneTemplate();\r\n\t\tplayerInitialState = {\r\n\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t};\r\n\t\topponentInitialState = {\r\n\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t};\r\n\t};\r\n\tconst gameState: FullGameState = {\r\n\t\tallCards: cards,\r\n\t\tcardsData: cardsData,\r\n\t\tspectator: spectator,\r\n\t\tsharedState: new SharedState(rng),\r\n\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\tnumberOfPlayersAlive: input.gameState.numberOfPlayersAlive,\r\n\t\tapplyDamageCap: input.options?.applyDamageCap === true,\r\n\t\tvalidTribes: input.gameState.validTribes,\r\n\t\tanomalies: input.gameState.anomalies,\r\n\t\tgameState: {\r\n\t\t\tplayer: {\r\n\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t},\r\n\t\t\topponent: {\r\n\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t},\r\n\t\t\tget playerInitial() {\r\n\t\t\t\tif (!playerInitialState) {\r\n\t\t\t\t\tbuildInitialStates();\r\n\t\t\t\t}\r\n\t\t\t\treturn playerInitialState;\r\n\t\t\t},\r\n\t\t\tget opponentInitial() {\r\n\t\t\t\tif (!opponentInitialState) {\r\n\t\t\t\t\tbuildInitialStates();\r\n\t\t\t\t}\r\n\t\t\t\treturn opponentInitialState;\r\n\t\t\t},\r\n\t\t},\r\n\t};\r\n\tconst simulator = new Simulator(gameState);\r\n\treturn simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n};\r\n\r\nconst applyDebugStateFromInput = (battleInput: BgsBattleInfo) => {\r\n\tif (!battleInput.debugState) {\r\n\t\treturn;\r\n\t}\r\n\tdebugState.active = true;\r\n\tdebugState.forcedCurrentAttacker = battleInput.debugState.forcedCurrentAttacker;\r\n\tdebugState.forcedFaceOffBase = battleInput.debugState.forcedFaceOffBase.map((f) => ({\r\n\t\tattacker: { ...f.attacker },\r\n\t\tdefender: { ...f.defender },\r\n\t}));\r\n\tconst rawPicks = battleInput.debugState.forcedRandomPicks ?? [];\r\n\tdebugState.forcedRandomPicksBase = rawPicks.map((p) => ({\r\n\t\tsource: { ...p.source },\r\n\t\ttarget: { ...p.target },\r\n\t\t...(p.chosenCardId && { chosenCardId: p.chosenCardId }),\r\n\t}));\r\n};\r\n\r\nconst clearDebugStateFromInput = (battleInput: BgsBattleInfo) => {\r\n\tif (battleInput.debugState) {\r\n\t\tdebugState.active = false;\r\n\t}\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\r\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\r\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\r\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\r\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\r\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\r\n\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\r\n\tif (damageArray.length === 0) {\r\n\t\treturn { min: 0, max: 0 };\r\n\t}\r\n\r\n\t// Sort the array\r\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\r\n\r\n\t// Calculate the 10th and 90th percentiles\r\n\tconst percentile = (arr: number[], p: number) => {\r\n\t\tconst index = Math.floor(p * arr.length);\r\n\t\treturn arr[index];\r\n\t};\r\n\r\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\r\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\r\n\r\n\treturn { min: minDamage, max: maxDamage };\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
|
|
1
|
+
{"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAE/D,mDAA+C;AAC/C,+CAA2C;AAC3C,+CAAiE;AACjE,yDAAqD;AACrD,wCAA2E;AAI3E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AAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;KAC1B;IAGD,MAAM,YAAY,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAG5D,MAAM,UAAU,GAAG,CAAC,GAAa,EAAE,CAAS,EAAE,EAAE;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAE7D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAE,YAAoB,EAAE,UAAkB,EAAU,EAAE;IAChG,IAAI,YAAY,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,EAAE;QAC7C,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,YAAY,KAAK,GAAG,IAAI,YAAY,KAAK,UAAU,EAAE;QACxD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { debugState } from './debug-state';\r\nimport { buildTemplateCloner, cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { createSeededRng, defaultRng, Rng, withRng } from './services/rng';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { SingleSimulationResult } from './single-simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nexport { isValidDeathrattleEnchantment } from './simulation/deathrattle-utils';\r\nexport { createSeededRng, defaultRng, getActiveRng, random, withRng } from './services/rng';\r\nexport type { Rng } from './services/rng';\r\n\r\n// Cap for the post-hoc outcome sample capture phase: rare outcomes (e.g. a 0.1% tie\r\n// chance) might never show up again when re-simulating, so we stop hunting after this\r\n// many extra battles\r\nconst MAX_SAMPLE_RESIMS = 500;\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\nexport interface SimulateSingleCombatOptions {\r\n\t/** If set, creates a Mulberry32 RNG from this seed. Ignored when `rng` is provided. */\r\n\treadonly seed?: number;\r\n\t/** Explicit RNG instance. Takes precedence over `seed`. */\r\n\treadonly rng?: Rng;\r\n\t/** When true, records spectator actions (slower). Default false. */\r\n\treadonly includeSpectator?: boolean;\r\n}\r\n\r\n/**\r\n * Run exactly one combat with a deterministic (or default) RNG.\r\n * Intended for the full-game / self-play env — not for Firestone win% Monte Carlo.\r\n */\r\nexport const simulateSingleCombat = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\toptions: SimulateSingleCombatOptions = {},\r\n): SingleSimulationResult => {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate combat', cards);\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst rng = options.rng ?? (options.seed !== undefined ? createSeededRng(options.seed) : defaultRng);\r\n\tconst includeSpectator = options.includeSpectator ?? false;\r\n\r\n\tapplyDebugStateFromInput(battleInput);\r\n\ttry {\r\n\t\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t\tconst cloneTemplate = buildTemplateCloner(cloneInput3(inputReady));\r\n\t\tconst spectator = new Spectator(includeSpectator);\r\n\t\tif (includeSpectator) {\r\n\t\t\tspectator.startRecording();\r\n\t\t}\r\n\t\treturn withRng(rng, () => runSingleBattle(cloneTemplate, cards, cardsData, spectator, rng));\r\n\t} finally {\r\n\t\tclearDebugStateFromInput(battleInput);\r\n\t}\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst hideMaxSimulationDurationWarning = battleInput.options?.hideMaxSimulationDurationWarning ?? false;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWons: [],\r\n\t\tdamageWon: 0,\r\n\t\tdamageWonRange: null,\r\n\t\tdamageLosts: [],\r\n\t\tdamageLost: 0,\r\n\t\tdamageLostRange: null,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\r\n\tapplyDebugStateFromInput(battleInput);\r\n\r\n\t// cloneInput3 normalizes the input (sorted secrets, reset pendingAttackBuffs, etc.).\r\n\t// The compiled cloner re-materializes that normalized shape as an object literal, which is\r\n\t// faster than JSON.parse of a template string (~0.02ms vs ~0.12ms per clone on a 7v7\r\n\t// board), which was itself faster than generic recursive cloners (~0.19-0.23ms) and\r\n\t// structuredClone (~0.46ms)\r\n\tconst cloneTemplate = buildTemplateCloner(cloneInput3(inputReady));\r\n\r\n\tconst runOne = () => runSingleBattle(cloneTemplate, cards, cardsData, spectator, defaultRng);\r\n\r\n\ttry {\r\n\t\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\t\tconst outcomes = {};\r\n\t\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\t\tconst battleResult = runOne();\r\n\t\t\tif (!battleResult) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (battleResult.result === 'won') {\r\n\t\t\t\tsimulationResult.won++;\r\n\t\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\r\n\t\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t\t}\r\n\t\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\t\tsimulationResult.lost++;\r\n\t\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\r\n\t\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\t\tif (\r\n\t\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t\t) {\r\n\t\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t\t}\r\n\t\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\t\tsimulationResult.tied++;\r\n\t\t\t}\r\n\r\n\t\t\tif (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {\r\n\t\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// Yield intermediate result every 200 iterations\r\n\t\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t\t\tyield simulationResult;\r\n\t\t\t}\r\n\t\t}\r\n\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\r\n\t\t// Capture outcome samples post-hoc: re-run a few battles with action recording turned\r\n\t\t// on, until each outcome that actually occurred has a sample. This is much cheaper\r\n\t\t// than recording during the main loop, where almost all recorded actions get discarded.\r\n\t\t// This phase intentionally ignores maxAcceptableDuration: when the main loop was cut\r\n\t\t// short by the time budget, we would otherwise end up with no samples at all.\r\n\t\tif (includeOutcomeSamples) {\r\n\t\t\tconst neededOutcomes: ('won' | 'lost' | 'tied')[] = [];\r\n\t\t\tsimulationResult.won > 0 && neededOutcomes.push('won');\r\n\t\t\tsimulationResult.lost > 0 && neededOutcomes.push('lost');\r\n\t\t\tsimulationResult.tied > 0 && neededOutcomes.push('tied');\r\n\t\t\tconst missingOutcomes = new Set(neededOutcomes);\r\n\t\t\tif (missingOutcomes.size > 0) {\r\n\t\t\t\tspectator.startRecording();\r\n\t\t\t\tfor (let i = 0; i < MAX_SAMPLE_RESIMS && missingOutcomes.size > 0; i++) {\r\n\t\t\t\t\tconst battleResult = runOne();\r\n\t\t\t\t\tif (!battleResult?.result) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tspectator.commitBattleResult(battleResult.result);\r\n\t\t\t\t\tif (spectator.hasSampleFor(battleResult.result)) {\r\n\t\t\t\t\t\tmissingOutcomes.delete(battleResult.result);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tspectator.stopRecording();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tspectator.prune();\r\n\t\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t\t// Avoid sending this verbose data\r\n\r\n\t\tsimulationResult.damageWons = [];\r\n\t\tsimulationResult.damageLosts = [];\r\n\t\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\t\treturn simulationResult;\r\n\t} finally {\r\n\t\tclearDebugStateFromInput(battleInput);\r\n\t}\r\n};\r\n\r\ntype CloneTemplate = () => BgsBattleInfo;\r\n\r\nconst runSingleBattle = (\r\n\tcloneTemplate: CloneTemplate,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tspectator: Spectator,\r\n\trng: Rng,\r\n): SingleSimulationResult => {\r\n\tconst input: BgsBattleInfo = cloneTemplate();\r\n\t// The \"initial\" states are only read by a handful of cards (and mutated by some, like\r\n\t// San'layn Scribe), so we only pay for the second clone when they are actually accessed\r\n\tlet playerInitialState = null;\r\n\tlet opponentInitialState = null;\r\n\tconst buildInitialStates = () => {\r\n\t\tconst inputClone: BgsBattleInfo = cloneTemplate();\r\n\t\tplayerInitialState = {\r\n\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t};\r\n\t\topponentInitialState = {\r\n\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t};\r\n\t};\r\n\tconst gameState: FullGameState = {\r\n\t\tallCards: cards,\r\n\t\tcardsData: cardsData,\r\n\t\tspectator: spectator,\r\n\t\tsharedState: new SharedState(rng),\r\n\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\tnumberOfPlayersAlive: input.gameState.numberOfPlayersAlive,\r\n\t\tapplyDamageCap: input.options?.applyDamageCap === true,\r\n\t\tapplyIceBlock: input.options?.applyIceBlock === true,\r\n\t\tvalidTribes: input.gameState.validTribes,\r\n\t\tanomalies: input.gameState.anomalies,\r\n\t\tgameState: {\r\n\t\t\tplayer: {\r\n\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t},\r\n\t\t\topponent: {\r\n\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t},\r\n\t\t\tget playerInitial() {\r\n\t\t\t\tif (!playerInitialState) {\r\n\t\t\t\t\tbuildInitialStates();\r\n\t\t\t\t}\r\n\t\t\t\treturn playerInitialState;\r\n\t\t\t},\r\n\t\t\tget opponentInitial() {\r\n\t\t\t\tif (!opponentInitialState) {\r\n\t\t\t\t\tbuildInitialStates();\r\n\t\t\t\t}\r\n\t\t\t\treturn opponentInitialState;\r\n\t\t\t},\r\n\t\t},\r\n\t};\r\n\tconst simulator = new Simulator(gameState);\r\n\treturn simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n};\r\n\r\nconst applyDebugStateFromInput = (battleInput: BgsBattleInfo) => {\r\n\tif (!battleInput.debugState) {\r\n\t\treturn;\r\n\t}\r\n\tdebugState.active = true;\r\n\tdebugState.forcedCurrentAttacker = battleInput.debugState.forcedCurrentAttacker;\r\n\tdebugState.forcedFaceOffBase = battleInput.debugState.forcedFaceOffBase.map((f) => ({\r\n\t\tattacker: { ...f.attacker },\r\n\t\tdefender: { ...f.defender },\r\n\t}));\r\n\tconst rawPicks = battleInput.debugState.forcedRandomPicks ?? [];\r\n\tdebugState.forcedRandomPicksBase = rawPicks.map((p) => ({\r\n\t\tsource: { ...p.source },\r\n\t\ttarget: { ...p.target },\r\n\t\t...(p.chosenCardId && { chosenCardId: p.chosenCardId }),\r\n\t}));\r\n};\r\n\r\nconst clearDebugStateFromInput = (battleInput: BgsBattleInfo) => {\r\n\tif (battleInput.debugState) {\r\n\t\tdebugState.active = false;\r\n\t}\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\r\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\r\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\r\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\r\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\r\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\r\n\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\r\n\tif (damageArray.length === 0) {\r\n\t\treturn { min: 0, max: 0 };\r\n\t}\r\n\r\n\t// Sort the array\r\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\r\n\r\n\t// Calculate the 10th and 90th percentiles\r\n\tconst percentile = (arr: number[], p: number) => {\r\n\t\tconst index = Math.floor(p * arr.length);\r\n\t\treturn arr[index];\r\n\t};\r\n\r\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\r\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\r\n\r\n\treturn { min: minDamage, max: maxDamage };\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
|
package/dist/simulation/auras.js
CHANGED
|
@@ -62,7 +62,7 @@ const setMissingAura = (board, minionCardId, enchantmentCardId, attack, health,
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
|
|
65
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35;
|
|
66
66
|
for (const heroPower of hero.heroPowers) {
|
|
67
67
|
const avengeValue = cardsData.avengeValue(heroPower.cardId);
|
|
68
68
|
if (avengeValue > 0) {
|
|
@@ -157,11 +157,12 @@ const setImplicitDataHero = (hero, cardsData, isPlayer, entityIdContainer) => {
|
|
|
157
157
|
hero.globalInfo.VolumizerHealthBuff = (_27 = hero.globalInfo.VolumizerHealthBuff) !== null && _27 !== void 0 ? _27 : 0;
|
|
158
158
|
hero.globalInfo.DeepBluesPlayed = (_28 = hero.globalInfo.DeepBluesPlayed) !== null && _28 !== void 0 ? _28 : 0;
|
|
159
159
|
hero.globalInfo.TastyLobstersBuff = (_29 = hero.globalInfo.TastyLobstersBuff) !== null && _29 !== void 0 ? _29 : 0;
|
|
160
|
-
hero.globalInfo.
|
|
161
|
-
hero.globalInfo.
|
|
162
|
-
hero.globalInfo.
|
|
163
|
-
hero.globalInfo.
|
|
164
|
-
hero.globalInfo.
|
|
160
|
+
hero.globalInfo.GoldenMinionsPlayedThisGame = (_30 = hero.globalInfo.GoldenMinionsPlayedThisGame) !== null && _30 !== void 0 ? _30 : 0;
|
|
161
|
+
hero.globalInfo.DeathrattlesTriggeredThisGame = (_31 = hero.globalInfo.DeathrattlesTriggeredThisGame) !== null && _31 !== void 0 ? _31 : 0;
|
|
162
|
+
hero.globalInfo.BackToBackCastThisGame = (_32 = hero.globalInfo.BackToBackCastThisGame) !== null && _32 !== void 0 ? _32 : 0;
|
|
163
|
+
hero.globalInfo.TavernSpellsCastThisTurn = (_33 = hero.globalInfo.TavernSpellsCastThisTurn) !== null && _33 !== void 0 ? _33 : 0;
|
|
164
|
+
hero.globalInfo.CardsPlayedThisTurn = (_34 = hero.globalInfo.CardsPlayedThisTurn) !== null && _34 !== void 0 ? _34 : 0;
|
|
165
|
+
hero.globalInfo.MrrgltonsPlayedThisGame = (_35 = hero.globalInfo.MrrgltonsPlayedThisGame) !== null && _35 !== void 0 ? _35 : 0;
|
|
165
166
|
};
|
|
166
167
|
exports.setImplicitDataHero = setImplicitDataHero;
|
|
167
168
|
const clearStealthIfNeeded = (board, hero, otherBoard, otherHero, gameState) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAAqE;AAIrE,iDAAoD;AAEpD,oCAAgE;AAGzD,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA4B,EAC5B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,6BAAqB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;;IAC/F,KAAK,MAAM,OAAO,IAAI,MAAA,SAAS,CAAC,Q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AAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t// \tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t// \tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t// \t2,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039_G,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => e.divineShield),\r\n\t// \tCardIds.CyborgDrake_BG25_043_G,\r\n\t// \tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t// \t12,\r\n\t// \t0,\r\n\t// \tfalse,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? [])\r\n\t\t.map((trinket) => ({\r\n\t\t\t...trinket,\r\n\t\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\t\tscriptDataNum1: trinket.scriptDataNum1 || cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t\t}))\r\n\t\t.sort((a, b) => a.entityId - b.entityId);\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.EternalKnightAttackBuff = hero.globalInfo.EternalKnightAttackBuff ?? 0;\r\n\thero.globalInfo.EternalKnightHealthBuff = hero.globalInfo.EternalKnightHealthBuff ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.AstralAutomatonsSummonedThisGame = hero.globalInfo.AstralAutomatonsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.TastyLobstersBuff = hero.globalInfo.TastyLobstersBuff ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAAqE;AAIrE,iDAAoD;AAEpD,oCAAgE;AAGzD,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA4B,EAC5B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,6BAAqB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAAoB,EAAE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IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)),\r\n\t// \tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t// \tCardIds.MurlocWarleader_MrgglaarglEnchantment,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t// \t2,\r\n\t// \t0,\r\n\t// );\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, anomalies, allCards)),\r\n\t// \tCardIds.Kathranatir_BG21_039_G,\r\n\t// \tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t// \t4,\r\n\t// \t0,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\t// setMissingAura(\r\n\t// \tboard.filter((e) => e.divineShield),\r\n\t// \tCardIds.CyborgDrake_BG25_043_G,\r\n\t// \tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t// \t12,\r\n\t// \t0,\r\n\t// \tfalse,\r\n\t// );\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)),\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? [])\r\n\t\t.map((trinket) => ({\r\n\t\t\t...trinket,\r\n\t\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\t\tscriptDataNum1: trinket.scriptDataNum1 || cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t\t}))\r\n\t\t.sort((a, b) => a.entityId - b.entityId);\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.EternalKnightAttackBuff = hero.globalInfo.EternalKnightAttackBuff ?? 0;\r\n\thero.globalInfo.EternalKnightHealthBuff = hero.globalInfo.EternalKnightHealthBuff ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.AstralAutomatonsSummonedThisGame = hero.globalInfo.AstralAutomatonsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.TastyLobstersBuff = hero.globalInfo.TastyLobstersBuff ?? 0;\r\n\thero.globalInfo.GoldenMinionsPlayedThisGame = hero.globalInfo.GoldenMinionsPlayedThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deathrattle-on-trigger.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-on-trigger.ts"],"names":[],"mappings":";;;AAGA,4DAAoE;AACpE,iEAA4D;AAE5D,mCAAiD;AAY1C,MAAM,sBAAsB,GAAG,CAAC,KAAgC,EAAE,EAAE;;IAC1E,KAAK,MAAM,WAAW,IAAI,KAAK,CAAC,mBAAmB,EAAE;QACpD,MAAM,sBAAsB,GAAG,6BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAChE,IAAI,IAAA,0CAAyB,EAAC,sBAAsB,CAAC,EAAE;YACtD,sBAAsB,CAAC,sBAAsB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;SAClE;KACD;IACD,KAAK,MAAM,OAAO,IAAI,MAAA,KAAK,CAAC,uBAAuB,CAAC,QAAQ,mCAAI,EAAE,EAAE;QACnE,MAAM,sBAAsB,GAAG,6BAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAI,IAAA,0CAAyB,EAAC,sBAAsB,CAAC,EAAE;YACtD,sBAAsB,CAAC,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC9D;KACD;IAED,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,uBAAuB,CAAC,aAAa,mCAAI,EAAE,CAAC;IACjE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC3B,QAAQ,KAAK,CAAC,MAAM,EAAE;YACrB;gBACC,IAAA,8BAAsB,EACrB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,EACL,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,MAAM;SACP;KACD;IAED,KAAK,CAAC,uBAAuB,CAAC,QAAQ;SACpC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAiD,CAAC;SACxE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACd,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAjCW,QAAA,sBAAsB,0BAiCjC","sourcesContent":["import { CardIds } from '../services/card-ids';\
|
|
1
|
+
{"version":3,"file":"deathrattle-on-trigger.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-on-trigger.ts"],"names":[],"m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C","sourcesContent":["import { CardIds } from '../services/card-ids';\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnDeathrattleTriggered } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport interface DeathrattleTriggeredInput {\r\n\treadonly boardWithDeadEntity: BoardEntity[];\r\n\treadonly boardWithDeadEntityHero: BgsPlayerEntity;\r\n\treadonly deadEntity: BoardEntity;\r\n\treadonly otherBoard: BoardEntity[];\r\n\treadonly otherBoardHero: BgsPlayerEntity;\r\n\treadonly deadEntityIndexFromRight?: number;\r\n\treadonly gameState: FullGameState;\r\n}\r\n\r\nexport const onDeathrattleTriggered = (input: DeathrattleTriggeredInput) => {\r\n\tfor (const boardEntity of input.boardWithDeadEntity) {\r\n\t\tconst onDeathrattleTriggered = cardMappings[boardEntity.cardId];\r\n\t\tif (hasOnDeathrattleTriggered(onDeathrattleTriggered)) {\r\n\t\t\tonDeathrattleTriggered.onDeathrattleTriggered(boardEntity, input);\r\n\t\t}\r\n\t}\r\n\tfor (const trinket of input.boardWithDeadEntityHero.trinkets ?? []) {\r\n\t\tconst onDeathrattleTriggered = cardMappings[trinket.cardId];\r\n\t\tif (hasOnDeathrattleTriggered(onDeathrattleTriggered)) {\r\n\t\t\tonDeathrattleTriggered.onDeathrattleTriggered(trinket, input);\r\n\t\t}\r\n\t}\r\n\r\n\tconst quests = input.boardWithDeadEntityHero.questEntities ?? [];\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.ExhumeTheBones:\r\n\t\t\t\tonQuestProgressUpdated(\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tquest,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tinput.boardWithDeadEntityHero.trinkets\r\n\t\t.filter((t) => t.cardId === CardIds.DeathlyPhylactery_BG30_MagicItem_700)\r\n\t\t.forEach((t) => {\r\n\t\t\tt.scriptDataNum1 = 0;\r\n\t\t});\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../src/simulation/discover.ts"],"names":[],"mappings":";;;AAGA,mDAAiD;AAEjD,mCAAsC;AAE/B,MAAM,aAAa,GAAG,CAC5B,IAAqB,EACrB,KAAoB,EACpB,MAAc,EACd,OAAiB,EACjB,SAAwB,EACvB,EAAE;IACH,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA,EAAE;QACrB,OAAO;KACP;IAED,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC3B,QAAQ,MAAM,CAAC,MAAM,EAAE;YACtB,gBAAqC;YACrC;gBACC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,eAAoC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnF,MAAM,eAAe,GAAG,OAAO;qBAC7B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;qBAC1D,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC7B,MAAM,eAAe,GAAG,OAAO;qBAC7B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;qBAC1D,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC7B,IAAA,mBAAW,EACV,MAAM,EACN,MAAM,EACN,eAAe,GAAG,gBAAgB,EAClC,eAAe,GAAG,gBAAgB,EAClC,KAAK,EACL,IAAI,EACJ,SAAS,CACT,CAAC;gBACF,MAAM;SACP;KACD;IAED,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAC9C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAiD,CAChE,CAAC,MAAM,CAAC;IACT,IAAI,CAAC,CAAC,kBAAkB,EAAE;QACzB,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAA,8BAAc,EAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;KACnD;AACF,CAAC,CAAC;AA1CW,QAAA,aAAa,iBA0CxB","sourcesContent":["import { CardIds } from '../services/card-ids';\
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../src/simulation/discover.ts"],"names":[],"mappings":";;;AAGA,mDAAiD;AAEjD,mCAAsC;AAE/B,MAAM,aAAa,GAAG,CAC5B,IAAqB,EACrB,KAAoB,EACpB,MAAc,EACd,OAAiB,EACjB,SAAwB,EACvB,EAAE;IACH,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA,EAAE;QACrB,OAAO;KACP;IAED,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC3B,QAAQ,MAAM,CAAC,MAAM,EAAE;YACtB,gBAAqC;YACrC;gBACC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,eAAoC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnF,MAAM,eAAe,GAAG,OAAO;qBAC7B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;qBAC1D,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC7B,MAAM,eAAe,GAAG,OAAO;qBAC7B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;qBAC1D,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC7B,IAAA,mBAAW,EACV,MAAM,EACN,MAAM,EACN,eAAe,GAAG,gBAAgB,EAClC,eAAe,GAAG,gBAAgB,EAClC,KAAK,EACL,IAAI,EACJ,SAAS,CACT,CAAC;gBACF,MAAM;SACP;KACD;IAED,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAC9C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAiD,CAChE,CAAC,MAAM,CAAC;IACT,IAAI,CAAC,CAAC,kBAAkB,EAAE;QACzB,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAA,8BAAc,EAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;KACnD;AACF,CAAC,CAAC;AA1CW,QAAA,aAAa,iBA0CxB","sourcesContent":["import { CardIds } from '../services/card-ids';\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { addCardsInHand } from './cards-in-hand';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const afterDiscover = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tpicked: string,\r\n\tignored: string[],\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (!ignored?.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.DepravedFelfin_BG30_115:\r\n\t\t\tcase CardIds.DepravedFelfin_BG30_115_G:\r\n\t\t\t\tconst felfinMultiplier = entity.cardId === CardIds.DepravedFelfin_BG30_115 ? 1 : 2;\r\n\t\t\t\tconst baseTotalAttack = ignored\r\n\t\t\t\t\t.map((cardId) => gameState.allCards.getCard(cardId).attack)\r\n\t\t\t\t\t.reduce((a, b) => a + b, 0);\r\n\t\t\t\tconst baseTotalHealth = ignored\r\n\t\t\t\t\t.map((cardId) => gameState.allCards.getCard(cardId).health)\r\n\t\t\t\t\t.reduce((a, b) => a + b, 0);\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tbaseTotalAttack * felfinMultiplier,\r\n\t\t\t\t\tbaseTotalHealth * felfinMultiplier,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tconst primalfinPortraits = hero.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.PrimalfinPortrait_BG30_MagicItem_702,\r\n\t).length;\r\n\tif (!!primalfinPortraits) {\r\n\t\tconst cardsToAdd = new Array(primalfinPortraits).fill(null);\r\n\t\taddCardsInHand(hero, board, cardsToAdd, gameState);\r\n\t}\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frenzy.js","sourceRoot":"","sources":["../../src/simulation/frenzy.ts"],"names":[],"mappings":";;;AAIA,6DAA+D;AAGxD,MAAM,WAAW,GAAG,CAC1B,gBAA6B,EAC7B,qBAAoC,EACpC,yBAA0C,EAC1C,SAAwB,EACjB,EAAE;IACT,IACC,gBAAgB,CAAC,MAAM,eAAuC;QAC9D,gBAAgB,CAAC,MAAM,iBAAyC,EAC/D;QACD,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE;YACnC,IAAA,kCAAkB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,IAAI,EACJ,IAAI,EACJ,SAAS,CACT,CAAC;SACF;KACD;AACF,CAAC,CAAC;AArBW,QAAA,WAAW,eAqBtB","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { CardIds } from '../services/card-ids';\
|
|
1
|
+
{"version":3,"file":"frenzy.js","sourceRoot":"","sources":["../../src/simulation/frenzy.ts"],"names":[],"mappings":";;;AAIA,6DAA+D;AAGxD,MAAM,WAAW,GAAG,CAC1B,gBAA6B,EAC7B,qBAAoC,EACpC,yBAA0C,EAC1C,SAAwB,EACjB,EAAE;IACT,IACC,gBAAgB,CAAC,MAAM,eAAuC;QAC9D,gBAAgB,CAAC,MAAM,iBAAyC,EAC/D;QACD,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE;YACnC,IAAA,kCAAkB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,IAAI,EACJ,IAAI,EACJ,SAAS,CACT,CAAC;SACF;KACD;AACF,CAAC,CAAC;AArBW,QAAA,WAAW,eAqBtB","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { CardIds } from '../services/card-ids';\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { updateDivineShield } from '../keywords/divine-shield';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const applyFrenzy = (\r\n\tentityWithFrenzy: BoardEntity,\r\n\tentityWithFrenzyBoard: BoardEntity[],\r\n\tentityWithFrenzyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (\r\n\t\tentityWithFrenzy.cardId === CardIds.BristlebackKnight_BG20_204 ||\r\n\t\tentityWithFrenzy.cardId === CardIds.BristlebackKnight_BG20_204_G\r\n\t) {\r\n\t\tif (!entityWithFrenzy.divineShield) {\r\n\t\t\tupdateDivineShield(\r\n\t\t\t\tentityWithFrenzy,\r\n\t\t\t\tentityWithFrenzyBoard,\r\n\t\t\t\tentityWithFrenzyBoardHero,\r\n\t\t\t\tnull,\r\n\t\t\t\ttrue,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-game-state.js","sourceRoot":"","sources":["../../src/simulation/internal-game-state.ts"],"names":[],"mappings":"","sourcesContent":["import { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport interface FullGameState {\r\n\tallCards: AllCardsService;\r\n\tcardsData: CardsData;\r\n\tspectator: Spectator;\r\n\tsharedState: SharedState;\r\n\tcurrentTurn: number;\r\n\t/** Heroes still alive in the lobby; used when applyDamageCap is set. */\r\n\tnumberOfPlayersAlive?: number;\r\n\t/** When true, apply the Battlegrounds lobby damage cap. Default off. */\r\n\tapplyDamageCap?: boolean;\r\n\tvalidTribes: readonly Race[];\r\n\tanomalies: readonly string[];\r\n\tgameState: GameState;\r\n}\r\n\r\nexport interface GameState {\r\n\tplayer: PlayerState;\r\n\topponent: PlayerState;\r\n\tplayerInitial: PlayerState;\r\n\topponentInitial: PlayerState;\r\n}\r\n\r\nexport interface PlayerState {\r\n\tboard: BoardEntity[];\r\n\tplayer: BgsPlayerEntity;\r\n\tteammate?: PlayerState;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"internal-game-state.js","sourceRoot":"","sources":["../../src/simulation/internal-game-state.ts"],"names":[],"mappings":"","sourcesContent":["import { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport interface FullGameState {\r\n\tallCards: AllCardsService;\r\n\tcardsData: CardsData;\r\n\tspectator: Spectator;\r\n\tsharedState: SharedState;\r\n\tcurrentTurn: number;\r\n\t/** Heroes still alive in the lobby; used when applyDamageCap is set. */\r\n\tnumberOfPlayersAlive?: number;\r\n\t/** When true, apply the Battlegrounds lobby damage cap. Default off. */\r\n\tapplyDamageCap?: boolean;\r\n\t/** When true, Ice Block can prevent end-of-combat face damage. Default off. */\r\n\tapplyIceBlock?: boolean;\r\n\tvalidTribes: readonly Race[];\r\n\tanomalies: readonly string[];\r\n\tgameState: GameState;\r\n}\r\n\r\nexport interface GameState {\r\n\tplayer: PlayerState;\r\n\topponent: PlayerState;\r\n\tplayerInitial: PlayerState;\r\n\topponentInitial: PlayerState;\r\n}\r\n\r\nexport interface PlayerState {\r\n\tboard: BoardEntity[];\r\n\tplayer: BgsPlayerEntity;\r\n\tteammate?: PlayerState;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quest.js","sourceRoot":"","sources":["../../src/simulation/quest.ts"],"names":[],"mappings":";;;AAKO,MAAM,sBAAsB,GAAG,CACrC,YAA6B,EAC7B,KAAqB,EACrB,KAAoB,EACpB,SAAwB,EACvB,EAAE;IACH,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,IAAI,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE;QAChD,OAAO;KACP;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;IACtE,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC;QACrC,MAAM,EAAE,YAAY;QACpB,QAAQ,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;QACjD,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC5D,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC5D,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC,YAAY,CAAC;KACtE,CAAC,CAAC;IAGH,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC;IAEjG,4BAA4B,CAAC,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC,CAAC;AAzBW,QAAA,sBAAsB,0BAyBjC;AAEF,MAAM,4BAA4B,GAAG,CACpC,YAAoB,EACpB,KAAoB,EACpB,YAA6B,EAC7B,SAAwB,EACvB,EAAE;IACH,QAAQ,YAAY,EAAE;QACrB;YACC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACnB,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;YACf,CAAC,CAAC,CAAC;YACH,MAAM;QACP;YACC,MAAM;KACP;AACF,CAAC,CAAC","sourcesContent":["import { CardIds } from '../services/card-ids';\
|
|
1
|
+
{"version":3,"file":"quest.js","sourceRoot":"","sources":["../../src/simulation/quest.ts"],"names":[],"mappings":";;;AAKO,MAAM,sBAAsB,GAAG,CACrC,YAA6B,EAC7B,KAAqB,EACrB,KAAoB,EACpB,SAAwB,EACvB,EAAE;IACH,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,IAAI,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE;QAChD,OAAO;KACP;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;IACtE,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC;QACrC,MAAM,EAAE,YAAY;QACpB,QAAQ,EAAE,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE;QACjD,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC5D,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC5D,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC,YAAY,CAAC;KACtE,CAAC,CAAC;IAGH,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC;IAEjG,4BAA4B,CAAC,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC,CAAC;AAzBW,QAAA,sBAAsB,0BAyBjC;AAEF,MAAM,4BAA4B,GAAG,CACpC,YAAoB,EACpB,KAAoB,EACpB,YAA6B,EAC7B,SAAwB,EACvB,EAAE;IACH,QAAQ,YAAY,EAAE;QACrB;YACC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACnB,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;YACf,CAAC,CAAC,CAAC;YACH,MAAM;QACP;YACC,MAAM;KACP;AACF,CAAC,CAAC","sourcesContent":["import { CardIds } from '../services/card-ids';\nimport { BgsPlayerEntity, BgsQuestEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const onQuestProgressUpdated = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tquest: BgsQuestEntity,\r\n\tboard: BoardEntity[],\r\n\tgameState: FullGameState,\r\n) => {\r\n\tquest.ProgressCurrent++;\r\n\tif (quest.ProgressCurrent < quest.ProgressTotal) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst rewardCardId = gameState.allCards.getCard(quest.RewardDbfId).id;\r\n\tplayerEntity.questRewards.push(rewardCardId);\r\n\tplayerEntity.questRewardEntities.push({\r\n\t\tcardId: rewardCardId,\r\n\t\tentityId: gameState.sharedState.currentEntityId++,\r\n\t\tavengeDefault: gameState.cardsData.avengeValue(rewardCardId),\r\n\t\tavengeCurrent: gameState.cardsData.avengeValue(rewardCardId),\r\n\t\tscriptDataNum1: gameState.cardsData.defaultScriptDataNum(rewardCardId),\r\n\t});\r\n\r\n\t// Remove the quest from the list of quests\r\n\tplayerEntity.questEntities = playerEntity.questEntities.filter((q) => q.CardId !== quest.CardId);\r\n\r\n\tupdateStateAfterQuestCreated(rewardCardId, board, playerEntity, gameState);\r\n};\r\n\r\nconst updateStateAfterQuestCreated = (\r\n\trewardCardId: string,\r\n\tboard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tswitch (rewardCardId) {\r\n\t\tcase CardIds.TheSmokingGun:\r\n\t\t\tboard.forEach((e) => {\r\n\t\t\t\te.attack += 4;\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BgsPlayerEntity } from '../bgs-player-entity';
|
|
2
2
|
import { BoardEntity } from '../board-entity';
|
|
3
3
|
import { FullGameState } from './internal-game-state';
|
|
4
|
+
export declare const tryPreventCombatDamageWithIceBlock: (hero: BgsPlayerEntity | null | undefined) => boolean;
|
|
4
5
|
export declare const handleSplittingImage: (defendingEntity: BoardEntity, defendingBoard: BoardEntity[], defendingPlayerEntity: BgsPlayerEntity, attackerBoard: BoardEntity[], attackerHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
5
6
|
export declare const handlePackTactics: (defendingEntity: BoardEntity, defendingBoard: BoardEntity[], defendingPlayerEntity: BgsPlayerEntity, attackerBoard: BoardEntity[], attackerHero: BgsPlayerEntity, gameState: FullGameState, secretCardId: string) => void;
|
|
6
7
|
export declare const handleSnakeTrap: (defendingEntity: BoardEntity, defendingBoard: BoardEntity[], defendingPlayerEntity: BgsPlayerEntity, attackerBoard: BoardEntity[], attackerHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleVenomstrikeTrap = exports.handleSnakeTrap = exports.handlePackTactics = exports.handleSplittingImage = void 0;
|
|
3
|
+
exports.handleVenomstrikeTrap = exports.handleSnakeTrap = exports.handlePackTactics = exports.handleSplittingImage = exports.tryPreventCombatDamageWithIceBlock = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const add_minion_to_board_1 = require("./add-minion-to-board");
|
|
6
6
|
const deathrattle_spawns_1 = require("./deathrattle-spawns");
|
|
7
7
|
const spawns_1 = require("./spawns");
|
|
8
|
+
const tryPreventCombatDamageWithIceBlock = (hero) => {
|
|
9
|
+
var _a;
|
|
10
|
+
if (!hero) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const secret = ((_a = hero.secrets) !== null && _a !== void 0 ? _a : []).find((s) => s.cardId === "TB_Bacon_Secrets_12" && !s.triggered);
|
|
14
|
+
if (!secret) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
secret.triggered = true;
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
exports.tryPreventCombatDamageWithIceBlock = tryPreventCombatDamageWithIceBlock;
|
|
8
21
|
const handleSplittingImage = (defendingEntity, defendingBoard, defendingPlayerEntity, attackerBoard, attackerHero, gameState) => {
|
|
9
22
|
const copy = {
|
|
10
23
|
...defendingEntity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/simulation/secrets.ts"],"names":[],"mappings":";;;AAGA,oCAAsC;AACtC,+DAA4D;AAC5D,6DAAqD;AAErD,qCAA+C;
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/simulation/secrets.ts"],"names":[],"mappings":";;;AAGA,oCAAsC;AACtC,+DAA4D;AAC5D,6DAAqD;AAErD,qCAA+C;AAQxC,MAAM,kCAAkC,GAAG,CAAC,IAAwC,EAAW,EAAE;;IACvG,IAAI,CAAC,IAAI,EAAE;QACV,OAAO,KAAK,CAAC;KACb;IACD,MAAM,MAAM,GAAG,CAAC,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,IAAI,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,0BAAqB,IAAI,CAAC,CAAC,CAAC,SAAS,CACpD,CAAC;IACF,IAAI,CAAC,MAAM,EAAE;QACZ,OAAO,KAAK,CAAC;KACb;IACD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C;AAEK,MAAM,oBAAoB,GAAG,CACnC,eAA4B,EAC5B,cAA6B,EAC7B,qBAAsC,EACtC,aAA4B,EAC5B,YAA6B,EAC7B,SAAwB,EACjB,EAAE;IACT,MAAM,IAAI,GAAgB;QACzB,GAAG,eAAe;QAClB,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,CAAC;KACZ,CAAC;IACF,MAAM,iBAAiB,GAAG,IAAA,kCAAa,EACtC,eAAe,CAAC,MAAM,EACtB,CAAC,EACD,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,CAAC,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ACF,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AA9BW,QAAA,qBAAqB,yBA8BhC","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { copyEntity } from '../utils';\r\nimport { removeAurasFromSelf } from './add-minion-to-board';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\n/**\r\n * Ice Block (TB_Bacon_Secrets_12): the first time your hero would take damage, prevent it.\r\n * Combat face damage is applied once at end of fight — consume the secret then.\r\n * Callers must gate this behind `options.applyIceBlock` (full-game / Layer C only);\r\n * Firestone battle sims leave damage uncapped for odds.\r\n */\r\nexport const tryPreventCombatDamageWithIceBlock = (hero: BgsPlayerEntity | null | undefined): boolean => {\r\n\tif (!hero) {\r\n\t\treturn false;\r\n\t}\r\n\tconst secret = (hero.secrets ?? []).find(\r\n\t\t(s) => s.cardId === CardIds.IceBlock && !s.triggered,\r\n\t);\r\n\tif (!secret) {\r\n\t\treturn false;\r\n\t}\r\n\tsecret.triggered = true;\r\n\treturn true;\r\n};\r\n\r\nexport const handleSplittingImage = (\r\n\tdefendingEntity: BoardEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingPlayerEntity: BgsPlayerEntity,\r\n\tattackerBoard: BoardEntity[],\r\n\tattackerHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst copy: BoardEntity = {\r\n\t\t...defendingEntity,\r\n\t\tattack: 3,\r\n\t\thealth: 3,\r\n\t\tmaxHealth: 3,\r\n\t};\r\n\tconst candidateEntities = spawnEntities(\r\n\t\tdefendingEntity.cardId,\r\n\t\t1,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t\tdefendingEntity.friendly,\r\n\t\tfalse,\r\n\t\tfalse,\r\n\t\ttrue,\r\n\t\tcopy,\r\n\t);\r\n\tconst indexFromRight = defendingBoard.length - (defendingBoard.indexOf(defendingEntity) + 1);\r\n\tperformEntitySpawns(\r\n\t\tcandidateEntities,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tdefendingEntity,\r\n\t\tindexFromRight,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t);\r\n};\r\n\r\nexport const handlePackTactics = (\r\n\tdefendingEntity: BoardEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingPlayerEntity: BgsPlayerEntity,\r\n\tattackerBoard: BoardEntity[],\r\n\tattackerHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tsecretCardId: string,\r\n): void => {\r\n\tconst copy: BoardEntity = copyEntity(defendingEntity);\r\n\tremoveAurasFromSelf(copy, defendingBoard, defendingPlayerEntity, gameState);\r\n\tconst candidateEntities = spawnEntities(\r\n\t\tcopy.cardId,\r\n\t\t1,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t\tdefendingEntity.friendly,\r\n\t\tfalse,\r\n\t\tfalse,\r\n\t\ttrue,\r\n\t\tcopy,\r\n\t);\r\n\tif (secretCardId === CardIds.PackTactics_TB_Bacon_Secrets_15) {\r\n\t\t// Don't use setEntityStats, because it will be applied when adding the minion to the board\r\n\t\tcandidateEntities.forEach((e) => {\r\n\t\t\te.health = 3;\r\n\t\t\te.maxHealth = 3;\r\n\t\t\te.attack = 3;\r\n\t\t\te.maxAttack = 3;\r\n\t\t});\r\n\t\t//setEntityStats(e, 3, 3, defendingBoard, defendingPlayerEntity, gameState));\r\n\t}\r\n\tconst indexFromRight = defendingBoard.length - (defendingBoard.indexOf(defendingEntity) + 1);\r\n\tconst spawned = performEntitySpawns(\r\n\t\tcandidateEntities,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tdefendingEntity,\r\n\t\tindexFromRight,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t);\r\n\tspawned.forEach((e) => {\r\n\t\t// Might be a HS bug\r\n\t\t// 33.6.2 https://replays.firestoneapp.com/?reviewId=06e89a29-8f63-4c55-bdac-d908ed6e5857&turn=9&action=1\r\n\t\te.hasAttacked = defendingEntity.hasAttacked;\r\n\t});\r\n};\r\n\r\nexport const handleSnakeTrap = (\r\n\tdefendingEntity: BoardEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingPlayerEntity: BgsPlayerEntity,\r\n\tattackerBoard: BoardEntity[],\r\n\tattackerHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst candidateEntities: readonly BoardEntity[] = spawnEntities(\r\n\t\tCardIds.SnakeTrap_SnakeLegacyToken,\r\n\t\t3,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t\tdefendingEntity.friendly,\r\n\t\tfalse,\r\n\t);\r\n\tperformEntitySpawns(\r\n\t\tcandidateEntities,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tdefendingEntity,\r\n\t\t0,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t);\r\n};\r\n\r\nexport const handleVenomstrikeTrap = (\r\n\tdefendingEntity: BoardEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingPlayerEntity: BgsPlayerEntity,\r\n\tattackerBoard: BoardEntity[],\r\n\tattackerHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst candidateEntities: readonly BoardEntity[] = spawnEntities(\r\n\t\tCardIds.EmperorCobraLegacy_BG_EX1_170,\r\n\t\t1,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t\tdefendingEntity.friendly,\r\n\t\tfalse,\r\n\t);\r\n\tconst spawns = performEntitySpawns(\r\n\t\tcandidateEntities,\r\n\t\tdefendingBoard,\r\n\t\tdefendingPlayerEntity,\r\n\t\tdefendingEntity,\r\n\t\t0,\r\n\t\tattackerBoard,\r\n\t\tattackerHero,\r\n\t\tgameState,\r\n\t);\r\n\treturn spawns;\r\n};\r\n"]}
|
|
@@ -8,6 +8,7 @@ const attack_1 = require("./attack");
|
|
|
8
8
|
const auras_1 = require("./auras");
|
|
9
9
|
const damage_cap_1 = require("./damage-cap");
|
|
10
10
|
const pending_effects_1 = require("./pending-effects");
|
|
11
|
+
const secrets_1 = require("./secrets");
|
|
11
12
|
const start_of_combat_1 = require("./start-of-combat/start-of-combat");
|
|
12
13
|
const summon_when_space_1 = require("./summon-when-space");
|
|
13
14
|
class Simulator {
|
|
@@ -17,7 +18,7 @@ class Simulator {
|
|
|
17
18
|
this.hasShowShortCircuitWarning = false;
|
|
18
19
|
}
|
|
19
20
|
simulateSingleBattle(playerState, opponentState) {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21
22
|
let playerBoard = playerState.board;
|
|
22
23
|
let playerEntity = playerState.player;
|
|
23
24
|
let opponentBoard = opponentState.board;
|
|
@@ -74,7 +75,7 @@ class Simulator {
|
|
|
74
75
|
opponentBoard = opponentState.board;
|
|
75
76
|
opponentEntity = opponentState.player;
|
|
76
77
|
}
|
|
77
|
-
if (isPlayerDefeated) {
|
|
78
|
+
if (isPlayerDefeated && playerEntity) {
|
|
78
79
|
this.gameState.sharedState.deaths = this.gameState.sharedState.deaths.filter((e) => e.friendly !== this.gameState.gameState.player.player.friendly);
|
|
79
80
|
this.gameState.gameState.player.teammate = {
|
|
80
81
|
board: this.gameState.gameState.player.board,
|
|
@@ -83,7 +84,7 @@ class Simulator {
|
|
|
83
84
|
this.gameState.gameState.player.player = playerEntity;
|
|
84
85
|
this.gameState.gameState.player.board = playerBoard;
|
|
85
86
|
}
|
|
86
|
-
if (isOpponentDefeated) {
|
|
87
|
+
if (isOpponentDefeated && opponentEntity) {
|
|
87
88
|
this.gameState.sharedState.deaths = this.gameState.sharedState.deaths.filter((e) => e.friendly !== this.gameState.gameState.opponent.player.friendly);
|
|
88
89
|
this.gameState.gameState.opponent.teammate = {
|
|
89
90
|
board: this.gameState.gameState.opponent.board,
|
|
@@ -102,17 +103,31 @@ class Simulator {
|
|
|
102
103
|
result: 'tied',
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
|
-
if (!(playerBoard === null || playerBoard === void 0 ? void 0 : playerBoard.length) || playerEntity.hpLeft <= 0) {
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
if (!(playerBoard === null || playerBoard === void 0 ? void 0 : playerBoard.length) || (playerEntity === null || playerEntity === void 0 ? void 0 : playerEntity.hpLeft) <= 0) {
|
|
107
|
+
const winningHero = opponentEntity !== null && opponentEntity !== void 0 ? opponentEntity : opponentState.player;
|
|
108
|
+
const losingHero = playerEntity !== null && playerEntity !== void 0 ? playerEntity : playerState.player;
|
|
109
|
+
let damage = this.capDamage(this.buildBoardTotalDamage(opponentBoard, (_g = (_f = this.gameState.gameState.opponent) === null || _f === void 0 ? void 0 : _f.teammate) === null || _g === void 0 ? void 0 : _g.board) +
|
|
110
|
+
((_h = winningHero === null || winningHero === void 0 ? void 0 : winningHero.tavernTier) !== null && _h !== void 0 ? _h : 1));
|
|
111
|
+
if (this.gameState.applyIceBlock &&
|
|
112
|
+
damage > 0 &&
|
|
113
|
+
(0, secrets_1.tryPreventCombatDamageWithIceBlock)(losingHero)) {
|
|
114
|
+
damage = 0;
|
|
115
|
+
}
|
|
108
116
|
this.gameState.spectator.registerOpponentAttack(playerBoard, opponentBoard, damage);
|
|
109
117
|
return {
|
|
110
118
|
result: 'lost',
|
|
111
119
|
damageDealt: damage,
|
|
112
120
|
};
|
|
113
121
|
}
|
|
114
|
-
const
|
|
115
|
-
|
|
122
|
+
const winningHero = playerEntity !== null && playerEntity !== void 0 ? playerEntity : playerState.player;
|
|
123
|
+
const losingHero = opponentEntity !== null && opponentEntity !== void 0 ? opponentEntity : opponentState.player;
|
|
124
|
+
let damage = this.capDamage(this.buildBoardTotalDamage(playerBoard, (_k = (_j = this.gameState.gameState.player) === null || _j === void 0 ? void 0 : _j.teammate) === null || _k === void 0 ? void 0 : _k.board) +
|
|
125
|
+
((_l = winningHero === null || winningHero === void 0 ? void 0 : winningHero.tavernTier) !== null && _l !== void 0 ? _l : 1));
|
|
126
|
+
if (this.gameState.applyIceBlock &&
|
|
127
|
+
damage > 0 &&
|
|
128
|
+
(0, secrets_1.tryPreventCombatDamageWithIceBlock)(losingHero)) {
|
|
129
|
+
damage = 0;
|
|
130
|
+
}
|
|
116
131
|
this.gameState.spectator.registerPlayerAttack(playerBoard, opponentBoard, damage);
|
|
117
132
|
return {
|
|
118
133
|
result: 'won',
|
|
@@ -204,7 +219,8 @@ class Simulator {
|
|
|
204
219
|
if (!this.gameState.applyDamageCap) {
|
|
205
220
|
return damage;
|
|
206
221
|
}
|
|
207
|
-
const isDuos = !!((_a = this.gameState.gameState.
|
|
222
|
+
const isDuos = !!((_a = this.gameState.gameState.playerInitial) === null || _a === void 0 ? void 0 : _a.teammate) ||
|
|
223
|
+
!!((_b = this.gameState.gameState.opponentInitial) === null || _b === void 0 ? void 0 : _b.teammate);
|
|
208
224
|
return (0, damage_cap_1.applyCombatDamageCap)(damage, this.gameState.currentTurn, this.gameState.numberOfPlayersAlive, isDuos);
|
|
209
225
|
}
|
|
210
226
|
buildBoardTotalDamage(playerBoard, teammateBoard) {
|