@firestone-hs/simulate-bgs-battle 1.1.565 → 1.1.567
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-player-entity.d.ts +2 -0
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/cards/card.interface.d.ts +32 -6
- package/dist/cards/card.interface.js +13 -1
- package/dist/cards/card.interface.js.map +1 -1
- package/dist/cards/cards-data.d.ts +1 -0
- package/dist/cards/cards-data.js +8 -0
- package/dist/cards/cards-data.js.map +1 -1
- package/dist/cards/impl/_card-mappings.js +124 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/bg-spell/sharing-is-caring.js +1 -1
- package/dist/cards/impl/bg-spell/sharing-is-caring.js.map +1 -1
- package/dist/cards/impl/hero-power/all-will-burn.js +2 -4
- package/dist/cards/impl/hero-power/all-will-burn.js.map +1 -1
- package/dist/cards/impl/hero-power/fragrant-phylactery.js +1 -2
- package/dist/cards/impl/hero-power/fragrant-phylactery.js.map +1 -1
- package/dist/cards/impl/hero-power/wax-warband.d.ts +3 -0
- package/dist/cards/impl/hero-power/wax-warband.js +4 -4
- package/dist/cards/impl/hero-power/wax-warband.js.map +1 -1
- package/dist/cards/impl/minion/admiral-eliza-goreblade.js +1 -2
- package/dist/cards/impl/minion/admiral-eliza-goreblade.js.map +1 -1
- package/dist/cards/impl/minion/alleycat.d.ts +2 -0
- package/dist/cards/impl/minion/alleycat.js +24 -0
- package/dist/cards/impl/minion/alleycat.js.map +1 -0
- package/dist/cards/impl/minion/amber-guardian.js +1 -2
- package/dist/cards/impl/minion/amber-guardian.js.map +1 -1
- package/dist/cards/impl/minion/amplifying-lightspawn.d.ts +2 -0
- package/dist/cards/impl/minion/amplifying-lightspawn.js +13 -0
- package/dist/cards/impl/minion/amplifying-lightspawn.js.map +1 -0
- package/dist/cards/impl/minion/apprentice-of-sefin.d.ts +6 -0
- package/dist/cards/impl/minion/apprentice-of-sefin.js +78 -0
- package/dist/cards/impl/minion/apprentice-of-sefin.js.map +1 -0
- package/dist/cards/impl/minion/ashen-corruptor.d.ts +2 -0
- package/dist/cards/impl/minion/ashen-corruptor.js +10 -0
- package/dist/cards/impl/minion/ashen-corruptor.js.map +1 -0
- package/dist/cards/impl/minion/assistant-guard.js +2 -1
- package/dist/cards/impl/minion/assistant-guard.js.map +1 -1
- package/dist/cards/impl/minion/auto-assembler-enchantment.d.ts +2 -0
- package/dist/cards/impl/minion/auto-assembler-enchantment.js +17 -0
- package/dist/cards/impl/minion/auto-assembler-enchantment.js.map +1 -0
- package/dist/cards/impl/minion/auto-assembler.d.ts +2 -0
- package/dist/cards/impl/minion/auto-assembler.js +14 -0
- package/dist/cards/impl/minion/auto-assembler.js.map +1 -0
- package/dist/cards/impl/minion/battlecruiser.js +2 -3
- package/dist/cards/impl/minion/battlecruiser.js.map +1 -1
- package/dist/cards/impl/minion/beetle.js +1 -1
- package/dist/cards/impl/minion/beetle.js.map +1 -1
- package/dist/cards/impl/minion/bellowing-tyrant.js +2 -2
- package/dist/cards/impl/minion/bellowing-tyrant.js.map +1 -1
- package/dist/cards/impl/minion/blazing-skyfin.js +1 -1
- package/dist/cards/impl/minion/blazing-skyfin.js.map +1 -1
- package/dist/cards/impl/minion/bonker.d.ts +2 -0
- package/dist/cards/impl/minion/bonker.js +18 -0
- package/dist/cards/impl/minion/bonker.js.map +1 -0
- package/dist/cards/impl/minion/bronze-steward.d.ts +2 -0
- package/dist/cards/impl/minion/bronze-steward.js +29 -0
- package/dist/cards/impl/minion/bronze-steward.js.map +1 -0
- package/dist/cards/impl/minion/bubble-gunner.js +3 -34
- package/dist/cards/impl/minion/bubble-gunner.js.map +1 -1
- package/dist/cards/impl/minion/carrier.js +1 -1
- package/dist/cards/impl/minion/carrier.js.map +1 -1
- package/dist/cards/impl/minion/choral-mrrrglr.js +1 -2
- package/dist/cards/impl/minion/choral-mrrrglr.js.map +1 -1
- package/dist/cards/impl/minion/clunker-junker.js +2 -1
- package/dist/cards/impl/minion/clunker-junker.js.map +1 -1
- package/dist/cards/impl/minion/coilskar-sapper.d.ts +2 -0
- package/dist/cards/impl/minion/coilskar-sapper.js +13 -0
- package/dist/cards/impl/minion/coilskar-sapper.js.map +1 -0
- package/dist/cards/impl/minion/corrupted-bristler.d.ts +2 -0
- package/dist/cards/impl/minion/corrupted-bristler.js +32 -0
- package/dist/cards/impl/minion/corrupted-bristler.js.map +1 -0
- package/dist/cards/impl/minion/corrupted-myrmidon.js +1 -2
- package/dist/cards/impl/minion/corrupted-myrmidon.js.map +1 -1
- package/dist/cards/impl/minion/crabby.js +1 -2
- package/dist/cards/impl/minion/crabby.js.map +1 -1
- package/dist/cards/impl/minion/dastardly-drust.d.ts +2 -0
- package/dist/cards/impl/minion/dastardly-drust.js +20 -0
- package/dist/cards/impl/minion/dastardly-drust.js.map +1 -0
- package/dist/cards/impl/minion/deadstomper.js +1 -2
- package/dist/cards/impl/minion/deadstomper.js.map +1 -1
- package/dist/cards/impl/minion/deflecto-bot.js +1 -2
- package/dist/cards/impl/minion/deflecto-bot.js.map +1 -1
- package/dist/cards/impl/minion/diremuck-forager.js +1 -2
- package/dist/cards/impl/minion/diremuck-forager.js.map +1 -1
- package/dist/cards/impl/minion/dreaming-thornweaver.d.ts +2 -0
- package/dist/cards/impl/minion/dreaming-thornweaver.js +17 -0
- package/dist/cards/impl/minion/dreaming-thornweaver.js.map +1 -0
- package/dist/cards/impl/minion/drustfallen-butcher.d.ts +2 -0
- package/dist/cards/impl/minion/drustfallen-butcher.js +14 -0
- package/dist/cards/impl/minion/drustfallen-butcher.js.map +1 -0
- package/dist/cards/impl/minion/echoing-roar.js +1 -2
- package/dist/cards/impl/minion/echoing-roar.js.map +1 -1
- package/dist/cards/impl/minion/efficient-engineer.js +6 -1
- package/dist/cards/impl/minion/efficient-engineer.js.map +1 -1
- package/dist/cards/impl/minion/elder-taggawag.js +1 -2
- package/dist/cards/impl/minion/elder-taggawag.js.map +1 -1
- package/dist/cards/impl/minion/electric-synthesizer.js +3 -2
- package/dist/cards/impl/minion/electric-synthesizer.js.map +1 -1
- package/dist/cards/impl/minion/elite-navigator.d.ts +2 -0
- package/dist/cards/impl/minion/elite-navigator.js +24 -0
- package/dist/cards/impl/minion/elite-navigator.js.map +1 -0
- package/dist/cards/impl/minion/fauna-whisperer.d.ts +2 -0
- package/dist/cards/impl/minion/fauna-whisperer.js +29 -0
- package/dist/cards/impl/minion/fauna-whisperer.js.map +1 -0
- package/dist/cards/impl/minion/fire-forged-evoker.d.ts +2 -0
- package/dist/cards/impl/minion/fire-forged-evoker.js +14 -0
- package/dist/cards/impl/minion/fire-forged-evoker.js.map +1 -0
- package/dist/cards/impl/minion/firescale-hoarder.d.ts +2 -0
- package/dist/cards/impl/minion/firescale-hoarder.js +19 -0
- package/dist/cards/impl/minion/firescale-hoarder.js.map +1 -0
- package/dist/cards/impl/minion/flighty-scout.d.ts +2 -0
- package/dist/cards/impl/minion/flighty-scout.js +24 -0
- package/dist/cards/impl/minion/flighty-scout.js.map +1 -0
- package/dist/cards/impl/minion/forest-rover.js +2 -1
- package/dist/cards/impl/minion/forest-rover.js.map +1 -1
- package/dist/cards/impl/minion/fountain-chiller.js +2 -2
- package/dist/cards/impl/minion/fountain-chiller.js.map +1 -1
- package/dist/cards/impl/minion/gem-smuggler.js +1 -0
- package/dist/cards/impl/minion/gem-smuggler.js.map +1 -1
- package/dist/cards/impl/minion/general-drakkisath.js +1 -0
- package/dist/cards/impl/minion/general-drakkisath.js.map +1 -1
- package/dist/cards/impl/minion/gentle-djinni.js +1 -0
- package/dist/cards/impl/minion/gentle-djinni.js.map +1 -1
- package/dist/cards/impl/minion/gentle-stag.js +7 -3
- package/dist/cards/impl/minion/gentle-stag.js.map +1 -1
- package/dist/cards/impl/minion/glowgullet-warlord.d.ts +2 -0
- package/dist/cards/impl/minion/glowgullet-warlord.js +15 -0
- package/dist/cards/impl/minion/glowgullet-warlord.js.map +1 -0
- package/dist/cards/impl/minion/glowing-cinder.d.ts +2 -0
- package/dist/cards/impl/minion/glowing-cinder.js +11 -0
- package/dist/cards/impl/minion/glowing-cinder.js.map +1 -0
- package/dist/cards/impl/minion/goldgrubber.d.ts +2 -0
- package/dist/cards/impl/minion/goldgrubber.js +16 -0
- package/dist/cards/impl/minion/goldgrubber.js.map +1 -0
- package/dist/cards/impl/minion/gormling-gourmet.d.ts +2 -0
- package/dist/cards/impl/minion/gormling-gourmet.js +19 -0
- package/dist/cards/impl/minion/gormling-gourmet.js.map +1 -0
- package/dist/cards/impl/minion/grease-bot.js +1 -2
- package/dist/cards/impl/minion/grease-bot.js.map +1 -1
- package/dist/cards/impl/minion/greenskeeper.d.ts +2 -0
- package/dist/cards/impl/minion/greenskeeper.js +18 -0
- package/dist/cards/impl/minion/greenskeeper.js.map +1 -0
- package/dist/cards/impl/minion/grimscale-elegist.d.ts +2 -0
- package/dist/cards/impl/minion/grimscale-elegist.js +20 -0
- package/dist/cards/impl/minion/grimscale-elegist.js.map +1 -0
- package/dist/cards/impl/minion/gritty-headhunter.js +1 -0
- package/dist/cards/impl/minion/gritty-headhunter.js.map +1 -1
- package/dist/cards/impl/minion/hackerfin.js +3 -2
- package/dist/cards/impl/minion/hackerfin.js.map +1 -1
- package/dist/cards/impl/minion/hawkstrider-herald.js +1 -1
- package/dist/cards/impl/minion/hawkstrider-herald.js.map +1 -1
- package/dist/cards/impl/minion/hoarding-hatespawn.js +1 -1
- package/dist/cards/impl/minion/hoarding-hatespawn.js.map +1 -1
- package/dist/cards/impl/minion/hungry-snapjaw.js +1 -1
- package/dist/cards/impl/minion/hungry-snapjaw.js.map +1 -1
- package/dist/cards/impl/minion/hydralisk.js +1 -1
- package/dist/cards/impl/minion/hydralisk.js.map +1 -1
- package/dist/cards/impl/minion/ignition-specialist.d.ts +2 -0
- package/dist/cards/impl/minion/ignition-specialist.js +16 -0
- package/dist/cards/impl/minion/ignition-specialist.js.map +1 -0
- package/dist/cards/impl/minion/immortal.js +1 -2
- package/dist/cards/impl/minion/immortal.js.map +1 -1
- package/dist/cards/impl/minion/implant-subject.js +1 -1
- package/dist/cards/impl/minion/implant-subject.js.map +1 -1
- package/dist/cards/impl/minion/imposing-percussionist.js +1 -0
- package/dist/cards/impl/minion/imposing-percussionist.js.map +1 -1
- package/dist/cards/impl/minion/impulsive-trickster.js +13 -1
- package/dist/cards/impl/minion/impulsive-trickster.js.map +1 -1
- package/dist/cards/impl/minion/inspiring-underdog.js +2 -2
- package/dist/cards/impl/minion/inspiring-underdog.js.map +1 -1
- package/dist/cards/impl/minion/irate-rooster.js +1 -1
- package/dist/cards/impl/minion/irate-rooster.js.map +1 -1
- package/dist/cards/impl/minion/king-bagurgle.js +4 -3
- package/dist/cards/impl/minion/king-bagurgle.js.map +1 -1
- package/dist/cards/impl/minion/lightfang-enforcer.js +1 -1
- package/dist/cards/impl/minion/lightfang-enforcer.js.map +1 -1
- package/dist/cards/impl/minion/lokholar-frostforger.d.ts +2 -0
- package/dist/cards/impl/minion/lokholar-frostforger.js +17 -0
- package/dist/cards/impl/minion/lokholar-frostforger.js.map +1 -0
- package/dist/cards/impl/minion/lovesick-balladist.js +6 -3
- package/dist/cards/impl/minion/lovesick-balladist.js.map +1 -1
- package/dist/cards/impl/minion/low-flier.js +1 -1
- package/dist/cards/impl/minion/low-flier.js.map +1 -1
- package/dist/cards/impl/minion/lurker.js +1 -1
- package/dist/cards/impl/minion/lurker.js.map +1 -1
- package/dist/cards/impl/minion/mantid-queen.js +1 -1
- package/dist/cards/impl/minion/mantid-queen.js.map +1 -1
- package/dist/cards/impl/minion/maw-caster.d.ts +2 -0
- package/dist/cards/impl/minion/maw-caster.js +25 -0
- package/dist/cards/impl/minion/maw-caster.js.map +1 -0
- package/dist/cards/impl/minion/mecha-jaraxxus.js +1 -0
- package/dist/cards/impl/minion/mecha-jaraxxus.js.map +1 -1
- package/dist/cards/impl/minion/mechagnome-interpreter.d.ts +2 -0
- package/dist/cards/impl/minion/mechagnome-interpreter.js +12 -0
- package/dist/cards/impl/minion/mechagnome-interpreter.js.map +1 -0
- package/dist/cards/impl/minion/menagerie-jug.js +1 -0
- package/dist/cards/impl/minion/menagerie-jug.js.map +1 -1
- package/dist/cards/impl/minion/metallic-hunter.d.ts +2 -0
- package/dist/cards/impl/minion/metallic-hunter.js +13 -0
- package/dist/cards/impl/minion/metallic-hunter.js.map +1 -0
- package/dist/cards/impl/minion/misfit-dragonling.js +1 -2
- package/dist/cards/impl/minion/misfit-dragonling.js.map +1 -1
- package/dist/cards/impl/minion/monstrous-macaw.d.ts +2 -0
- package/dist/cards/impl/minion/monstrous-macaw.js +36 -0
- package/dist/cards/impl/minion/monstrous-macaw.js.map +1 -0
- package/dist/cards/impl/minion/murkbrine-expeditioner.d.ts +2 -0
- package/dist/cards/impl/minion/murkbrine-expeditioner.js +18 -0
- package/dist/cards/impl/minion/murkbrine-expeditioner.js.map +1 -0
- package/dist/cards/impl/minion/murky.js +3 -2
- package/dist/cards/impl/minion/murky.js.map +1 -1
- package/dist/cards/impl/minion/mutalisk.js +1 -1
- package/dist/cards/impl/minion/mutalisk.js.map +1 -1
- package/dist/cards/impl/minion/mutated-lasher.js +1 -2
- package/dist/cards/impl/minion/mutated-lasher.js.map +1 -1
- package/dist/cards/impl/minion/mythrax.js +1 -2
- package/dist/cards/impl/minion/mythrax.js.map +1 -1
- package/dist/cards/impl/minion/nerubian-deathswarmer.js +1 -0
- package/dist/cards/impl/minion/nerubian-deathswarmer.js.map +1 -1
- package/dist/cards/impl/minion/nightmare-par-tea-guest.d.ts +2 -0
- package/dist/cards/impl/minion/nightmare-par-tea-guest.js +19 -0
- package/dist/cards/impl/minion/nightmare-par-tea-guest.js.map +1 -0
- package/dist/cards/impl/minion/noisul-of-the-many-faces.d.ts +2 -0
- package/dist/cards/impl/minion/noisul-of-the-many-faces.js +22 -0
- package/dist/cards/impl/minion/noisul-of-the-many-faces.js.map +1 -0
- package/dist/cards/impl/minion/oozeling-gladiator.js +1 -0
- package/dist/cards/impl/minion/oozeling-gladiator.js.map +1 -1
- package/dist/cards/impl/minion/parched-wanderer.js +2 -1
- package/dist/cards/impl/minion/parched-wanderer.js.map +1 -1
- package/dist/cards/impl/minion/peggy-sturdybone.js +1 -2
- package/dist/cards/impl/minion/peggy-sturdybone.js.map +1 -1
- package/dist/cards/impl/minion/primalfin-lookout.js +1 -0
- package/dist/cards/impl/minion/primalfin-lookout.js.map +1 -1
- package/dist/cards/impl/minion/prized-promo-drake.js +1 -2
- package/dist/cards/impl/minion/prized-promo-drake.js.map +1 -1
- package/dist/cards/impl/minion/razorfen-geomancer.js +1 -0
- package/dist/cards/impl/minion/razorfen-geomancer.js.map +1 -1
- package/dist/cards/impl/minion/razorgore-the-untamed.js +1 -2
- package/dist/cards/impl/minion/razorgore-the-untamed.js.map +1 -1
- package/dist/cards/impl/minion/rickety-repairbot.d.ts +2 -0
- package/dist/cards/impl/minion/rickety-repairbot.js +16 -0
- package/dist/cards/impl/minion/rickety-repairbot.js.map +1 -0
- package/dist/cards/impl/minion/ripsnarl-captain.js +1 -2
- package/dist/cards/impl/minion/ripsnarl-captain.js.map +1 -1
- package/dist/cards/impl/minion/roach.js +1 -1
- package/dist/cards/impl/minion/roach.js.map +1 -1
- package/dist/cards/impl/minion/rodeo-performer.js +1 -0
- package/dist/cards/impl/minion/rodeo-performer.js.map +1 -1
- package/dist/cards/impl/minion/runed-progenitor.js +1 -1
- package/dist/cards/impl/minion/runed-progenitor.js.map +1 -1
- package/dist/cards/impl/minion/salty-hog.js +1 -2
- package/dist/cards/impl/minion/salty-hog.js.map +1 -1
- package/dist/cards/impl/minion/sanctum-rester.js +1 -2
- package/dist/cards/impl/minion/sanctum-rester.js.map +1 -1
- package/dist/cards/impl/minion/sand-swirler.d.ts +2 -0
- package/dist/cards/impl/minion/sand-swirler.js +12 -0
- package/dist/cards/impl/minion/sand-swirler.js.map +1 -0
- package/dist/cards/impl/minion/sanlayn-scribe.js +2 -2
- package/dist/cards/impl/minion/sanlayn-scribe.js.map +1 -1
- package/dist/cards/impl/minion/selfless-hero.d.ts +2 -0
- package/dist/cards/impl/minion/selfless-hero.js +25 -0
- package/dist/cards/impl/minion/selfless-hero.js.map +1 -0
- package/dist/cards/impl/minion/shadowdancer.d.ts +2 -0
- package/dist/cards/impl/minion/shadowdancer.js +13 -0
- package/dist/cards/impl/minion/shadowdancer.js.map +1 -0
- package/dist/cards/impl/minion/sharptooth-snapper.d.ts +2 -0
- package/dist/cards/impl/minion/sharptooth-snapper.js +8 -0
- package/dist/cards/impl/minion/sharptooth-snapper.js.map +1 -0
- package/dist/cards/impl/minion/shell-collector.js +1 -0
- package/dist/cards/impl/minion/shell-collector.js.map +1 -1
- package/dist/cards/impl/minion/silithid-burrower.d.ts +2 -0
- package/dist/cards/impl/minion/silithid-burrower.js +18 -0
- package/dist/cards/impl/minion/silithid-burrower.js.map +1 -0
- package/dist/cards/impl/minion/silky-shimmermoth.d.ts +2 -0
- package/dist/cards/impl/minion/silky-shimmermoth.js +20 -0
- package/dist/cards/impl/minion/silky-shimmermoth.js.map +1 -0
- package/dist/cards/impl/minion/silver-handed-recruit.js +2 -1
- package/dist/cards/impl/minion/silver-handed-recruit.js.map +1 -1
- package/dist/cards/impl/minion/skulking-bristlemane.d.ts +2 -0
- package/dist/cards/impl/minion/skulking-bristlemane.js +17 -0
- package/dist/cards/impl/minion/skulking-bristlemane.js.map +1 -0
- package/dist/cards/impl/minion/slumber-sorcerer.d.ts +2 -0
- package/dist/cards/impl/minion/slumber-sorcerer.js +13 -0
- package/dist/cards/impl/minion/slumber-sorcerer.js.map +1 -0
- package/dist/cards/impl/minion/smolderwing.js +2 -1
- package/dist/cards/impl/minion/smolderwing.js.map +1 -1
- package/dist/cards/impl/minion/soul-rewinder.js +5 -1
- package/dist/cards/impl/minion/soul-rewinder.js.map +1 -1
- package/dist/cards/impl/minion/spacefarer.js +1 -1
- package/dist/cards/impl/minion/spacefarer.js.map +1 -1
- package/dist/cards/impl/minion/spirited-whimsydrake.d.ts +2 -0
- package/dist/cards/impl/minion/spirited-whimsydrake.js +19 -0
- package/dist/cards/impl/minion/spirited-whimsydrake.js.map +1 -0
- package/dist/cards/impl/minion/springy-spriggan.d.ts +2 -0
- package/dist/cards/impl/minion/springy-spriggan.js +21 -0
- package/dist/cards/impl/minion/springy-spriggan.js.map +1 -0
- package/dist/cards/impl/minion/surfing-slyvar.d.ts +2 -0
- package/dist/cards/impl/minion/surfing-slyvar.js +18 -0
- package/dist/cards/impl/minion/surfing-slyvar.js.map +1 -0
- package/dist/cards/impl/minion/swampstriker.js +1 -1
- package/dist/cards/impl/minion/swampstriker.js.map +1 -1
- package/dist/cards/impl/minion/thorncaller.d.ts +2 -0
- package/dist/cards/impl/minion/thorncaller.js +19 -0
- package/dist/cards/impl/minion/thorncaller.js.map +1 -0
- package/dist/cards/impl/minion/thousandth-paper-drake.js +1 -2
- package/dist/cards/impl/minion/thousandth-paper-drake.js.map +1 -1
- package/dist/cards/impl/minion/thundering-abomination.js +1 -2
- package/dist/cards/impl/minion/thundering-abomination.js.map +1 -1
- package/dist/cards/impl/minion/turquoise-skitterer.js +1 -1
- package/dist/cards/impl/minion/turquoise-skitterer.js.map +1 -1
- package/dist/cards/impl/minion/twilight-primordium.js +2 -2
- package/dist/cards/impl/minion/twilight-primordium.js.map +1 -1
- package/dist/cards/impl/minion/ultralisk.js +1 -2
- package/dist/cards/impl/minion/ultralisk.js.map +1 -1
- package/dist/cards/impl/minion/ultraviolet-ascendant.js +1 -1
- package/dist/cards/impl/minion/ultraviolet-ascendant.js.map +1 -1
- package/dist/cards/impl/minion/vaelastrasz.js +1 -2
- package/dist/cards/impl/minion/vaelastrasz.js.map +1 -1
- package/dist/cards/impl/minion/valiant-tiger.d.ts +2 -0
- package/dist/cards/impl/minion/valiant-tiger.js +18 -0
- package/dist/cards/impl/minion/valiant-tiger.js.map +1 -0
- package/dist/cards/impl/minion/void-ray.js +2 -2
- package/dist/cards/impl/minion/void-ray.js.map +1 -1
- package/dist/cards/impl/minion/vorkai-guardian.d.ts +2 -0
- package/dist/cards/impl/minion/vorkai-guardian.js +19 -0
- package/dist/cards/impl/minion/vorkai-guardian.js.map +1 -0
- package/dist/cards/impl/minion/wandering-wight.js +1 -2
- package/dist/cards/impl/minion/wandering-wight.js.map +1 -1
- package/dist/cards/impl/minion/whelp-smuggler.js +1 -2
- package/dist/cards/impl/minion/whelp-smuggler.js.map +1 -1
- package/dist/cards/impl/minion/wisp-in-the-shell.js +2 -1
- package/dist/cards/impl/minion/wisp-in-the-shell.js.map +1 -1
- package/dist/cards/impl/quest-reward/staff-of-origination.js +1 -2
- package/dist/cards/impl/quest-reward/staff-of-origination.js.map +1 -1
- package/dist/cards/impl/trinket/all-purpose-kibble.d.ts +2 -0
- package/dist/cards/impl/trinket/all-purpose-kibble.js +14 -0
- package/dist/cards/impl/trinket/all-purpose-kibble.js.map +1 -0
- package/dist/cards/impl/trinket/arm-of-the-empire.js +1 -2
- package/dist/cards/impl/trinket/arm-of-the-empire.js.map +1 -1
- package/dist/cards/impl/trinket/baleful-incense.d.ts +2 -0
- package/dist/cards/impl/trinket/baleful-incense.js +22 -0
- package/dist/cards/impl/trinket/baleful-incense.js.map +1 -0
- package/dist/cards/impl/trinket/bassgill-portrait.d.ts +2 -0
- package/dist/cards/impl/trinket/bassgill-portrait.js +16 -0
- package/dist/cards/impl/trinket/bassgill-portrait.js.map +1 -0
- package/dist/cards/impl/trinket/battle-horn.d.ts +2 -0
- package/dist/cards/impl/trinket/battle-horn.js +20 -0
- package/dist/cards/impl/trinket/battle-horn.js.map +1 -0
- package/dist/cards/impl/trinket/beetle-band.d.ts +2 -0
- package/dist/cards/impl/trinket/beetle-band.js +18 -0
- package/dist/cards/impl/trinket/beetle-band.js.map +1 -0
- package/dist/cards/impl/trinket/bird-feeder.d.ts +2 -0
- package/dist/cards/impl/trinket/bird-feeder.js +13 -0
- package/dist/cards/impl/trinket/bird-feeder.js.map +1 -0
- package/dist/cards/impl/trinket/bronze-timepiece.js +1 -3
- package/dist/cards/impl/trinket/bronze-timepiece.js.map +1 -1
- package/dist/cards/impl/trinket/crocheted-sungill.d.ts +2 -0
- package/dist/cards/impl/trinket/crocheted-sungill.js +31 -0
- package/dist/cards/impl/trinket/crocheted-sungill.js.map +1 -0
- package/dist/cards/impl/trinket/divine-signet.d.ts +2 -0
- package/dist/cards/impl/trinket/divine-signet.js +14 -0
- package/dist/cards/impl/trinket/divine-signet.js.map +1 -0
- package/dist/cards/impl/trinket/eclectic-shrine.d.ts +2 -0
- package/dist/cards/impl/trinket/eclectic-shrine.js +36 -0
- package/dist/cards/impl/trinket/eclectic-shrine.js.map +1 -0
- package/dist/cards/impl/trinket/faerie-dragon-scale.d.ts +2 -0
- package/dist/cards/impl/trinket/faerie-dragon-scale.js +20 -0
- package/dist/cards/impl/trinket/faerie-dragon-scale.js.map +1 -0
- package/dist/cards/impl/trinket/herald-sticker.d.ts +2 -0
- package/dist/cards/impl/trinket/herald-sticker.js +21 -0
- package/dist/cards/impl/trinket/herald-sticker.js.map +1 -0
- package/dist/cards/impl/trinket/hogwash-basin.d.ts +2 -0
- package/dist/cards/impl/trinket/hogwash-basin.js +14 -0
- package/dist/cards/impl/trinket/hogwash-basin.js.map +1 -0
- package/dist/cards/impl/trinket/rivendare-portrait.js +1 -2
- package/dist/cards/impl/trinket/rivendare-portrait.js.map +1 -1
- package/dist/cards/impl/trinket/sthara-sticker.d.ts +2 -0
- package/dist/cards/impl/trinket/sthara-sticker.js +32 -0
- package/dist/cards/impl/trinket/sthara-sticker.js.map +1 -0
- package/dist/cards/impl/trinket/tinyfin-onesie.js +1 -1
- package/dist/cards/impl/trinket/tinyfin-onesie.js.map +1 -1
- package/dist/cards/impl/trinket/unholy-sanctum.d.ts +2 -0
- package/dist/cards/impl/trinket/unholy-sanctum.js +15 -0
- package/dist/cards/impl/trinket/unholy-sanctum.js.map +1 -0
- package/dist/cards/impl/trinket/vashjir-anemone.d.ts +2 -0
- package/dist/cards/impl/trinket/vashjir-anemone.js +13 -0
- package/dist/cards/impl/trinket/vashjir-anemone.js.map +1 -0
- package/dist/cards/impl/trinket/yulon-sticker.d.ts +2 -0
- package/dist/cards/impl/trinket/yulon-sticker.js +20 -0
- package/dist/cards/impl/trinket/yulon-sticker.js.map +1 -0
- package/dist/keywords/divine-shield.js +19 -6
- package/dist/keywords/divine-shield.js.map +1 -1
- package/dist/keywords/venomous.js +1 -1
- package/dist/keywords/venomous.js.map +1 -1
- package/dist/services/utils.d.ts +3 -0
- package/dist/services/utils.js.map +1 -1
- package/dist/simulate-bgs-battle.js +2 -0
- package/dist/simulate-bgs-battle.js.map +1 -1
- package/dist/simulation/add-minion-to-board.js +48 -29
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/after-attack.d.ts +11 -1
- package/dist/simulation/after-attack.js +20 -25
- package/dist/simulation/after-attack.js.map +1 -1
- package/dist/simulation/attack.d.ts +8 -0
- package/dist/simulation/attack.js +16 -3
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/auras.js +14 -12
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/avenge.js +12 -13
- package/dist/simulation/avenge.js.map +1 -1
- package/dist/simulation/battlecries.d.ts +1 -0
- package/dist/simulation/battlecries.js +28 -36
- package/dist/simulation/battlecries.js.map +1 -1
- package/dist/simulation/blood-gems.js +8 -3
- package/dist/simulation/blood-gems.js.map +1 -1
- package/dist/simulation/cards-in-hand.js +1 -2
- package/dist/simulation/cards-in-hand.js.map +1 -1
- package/dist/simulation/damage-effects.js +4 -8
- package/dist/simulation/damage-effects.js.map +1 -1
- package/dist/simulation/death-effects.js +1 -2
- package/dist/simulation/death-effects.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +25 -55
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-on-trigger.js +16 -2
- package/dist/simulation/deathrattle-on-trigger.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.d.ts +1 -0
- package/dist/simulation/deathrattle-spawns.js +7 -1
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/dist/simulation/deathrattle-utils.d.ts +2 -1
- package/dist/simulation/deathrattle-utils.js +7 -3
- package/dist/simulation/deathrattle-utils.js.map +1 -1
- package/dist/simulation/discover.js +1 -1
- package/dist/simulation/discover.js.map +1 -1
- package/dist/simulation/magnetize.d.ts +9 -1
- package/dist/simulation/magnetize.js +17 -3
- package/dist/simulation/magnetize.js.map +1 -1
- package/dist/simulation/minion-death.js +1 -2
- package/dist/simulation/minion-death.js.map +1 -1
- package/dist/simulation/minion-kill.js +3 -3
- package/dist/simulation/minion-kill.js.map +1 -1
- package/dist/simulation/on-attack.js +24 -9
- package/dist/simulation/on-attack.js.map +1 -1
- package/dist/simulation/on-being-attacked.js +5 -10
- package/dist/simulation/on-being-attacked.js.map +1 -1
- package/dist/simulation/reborn.js +2 -4
- package/dist/simulation/reborn.js.map +1 -1
- package/dist/simulation/spawn-fail.js +1 -1
- package/dist/simulation/spawn-fail.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-action-processor.js +0 -4
- package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-illidan-hero-power.js +2 -4
- package/dist/simulation/start-of-combat/soc-illidan-hero-power.js.map +1 -1
- package/dist/simulation/start-of-combat/soc-minion.js +10 -2
- package/dist/simulation/start-of-combat/soc-minion.js.map +1 -1
- package/dist/simulation/start-of-combat/start-of-combat.js +23 -17
- package/dist/simulation/start-of-combat/start-of-combat.js.map +1 -1
- package/dist/simulation/stats.d.ts +3 -3
- package/dist/simulation/stats.js +13 -3
- package/dist/simulation/stats.js.map +1 -1
- package/dist/simulation/summon-when-space.js +13 -0
- package/dist/simulation/summon-when-space.js.map +1 -1
- package/dist/simulation/utils/golden.js +1 -1
- package/dist/simulation/utils/golden.js.map +1 -1
- package/dist/utils.js +11 -16
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/dist/cards/impl/trinket/artisanal-urn.d.ts +0 -5
- package/dist/cards/impl/trinket/artisanal-urn.js +0 -13
- package/dist/cards/impl/trinket/artisanal-urn.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divine-shield.js","sourceRoot":"","sources":["../../src/keywords/divine-shield.ts"],"names":[],"mappings":";;;AAAA,iEAAuE;AAGvE,4DAAmE;AACnE,iEAA4D;AAC5D,6CAA+C;AAC/C,+DAA6D;AAE7D,+CAAkD;AAClD,oCAA6D;AAEtD,MAAM,kBAAkB,GAAG,CACjC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,QAAiB,EACjB,SAAwB,EACjB,EAAE;;IAIT,MAAM,CAAC,eAAe,GAAG,QAAQ,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe,CAAC;IACnF,MAAM,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC/B,IAAI,MAAM,CAAC,YAAY,EAAE;QACxB,MAAM,aAAa,GAAG,KAAK,CAAC;QAC5B,MAAM,UAAU,GACf,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAiC,CAAC,CAAC,MAAM;YACjF,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,iBAAmC,CAAC,CAAC,MAAM,CAAC;QAEtF,MAAM,CAAC,MAAM,IAAI,UAAU,CAAC;KAC5B;SAAM;QAEN,MAAM,aAAa,GAAG,KAAK,CAAC;QAC5B,MAAM,UAAU,GACf,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAiC,CAAC,CAAC,MAAM;YACjF,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,iBAAmC,CAAC,CAAC,MAAM,CAAC;QACtF,MAAM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I,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACtE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7E;AACF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import { CardIds, CardType, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnDivineShieldUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { pickRandom } from '../services/utils';\r\nimport { addCardsInHand } from '../simulation/cards-in-hand';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { grantRandomStats, hasCorrectTribe } from '../utils';\r\n\r\nexport const updateDivineShield = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tnewValue: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// if ((entity.divineShield ?? false) === newValue) {\r\n\t// \treturn;\r\n\t// }\r\n\tentity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n\r\n\t// Lost divine shield\r\n\tif (entity.hadDivineShield && !entity.divineShield) {\r\n\t\tconst adapter = hero.trinkets\r\n\t\t\t.filter((t) => t.cardId === CardIds.MechagonAdapter_BG30_MagicItem_910)\r\n\t\t\t.filter((t) => t.scriptDataNum1 > 0)[0];\r\n\t\tif (!!adapter && hasCorrectTribe(entity, hero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\tadapter.scriptDataNum1--;\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < board.length; i++) {\r\n\t\t\tif (board[i].cardId === CardIds.BolvarFireblood_ICC_858) {\r\n\t\t\t\tmodifyStats(board[i], 2, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.BolvarFireblood_TB_BaconUps_047) {\r\n\t\t\t\tmodifyStats(board[i], 4, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_BGS_067) {\r\n\t\t\t\tmodifyStats(board[i], 2, 2, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_TB_BaconUps_117) {\r\n\t\t\t\tmodifyStats(board[i], 4, 4, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].entityId !== entity.entityId &&\r\n\t\t\t\t(board[i].cardId === CardIds.HolyMecherel_BG20_401 ||\r\n\t\t\t\t\tboard[i].cardId === CardIds.HolyMecherel_BG20_401_G)\r\n\t\t\t) {\r\n\t\t\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem], gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037_G) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem, CardIds.BloodGem], gameState);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008 ||\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008_G\r\n\t\t\t) {\r\n\t\t\t\t// When it's the opponent, the game state already contains all the buffs\r\n\t\t\t\tif (board[i]?.friendly) {\r\n\t\t\t\t\tconst buff = board[i].cardId === CardIds.CogworkCopter_BG24_008_G ? 2 : 1;\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tboard[i],\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = pickRandom(elligibleEntities);\r\n\t\tupdateDivineShield(chosen, board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, chosen, board, null, null);\r\n\t}\r\n};\r\n\r\nexport const grantDivineShieldToLeftmostMinions = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tquantity: number,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < Math.min(quantity, board.length); i++) {\r\n\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, board[i], board, null, null);\r\n\t}\r\n};\r\n\r\nexport interface OnDivineShieldUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n\ttarget: BoardEntity;\r\n\tpreviousValue: boolean;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"divine-shield.js","sourceRoot":"","sources":["../../src/keywords/divine-shield.ts"],"names":[],"mappings":";;;AAAA,iEAAuE;AAGvE,4DAAmE;AACnE,iEAA4D;AAC5D,6CAA+C;AAC/C,+DAA6D;A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CACjD,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,QAAgB,EAChB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;IACT,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1D,IAAA,0BAAkB,EAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACtE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7E;AACF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import { CardIds, CardType, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnDivineShieldUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { pickRandom } from '../services/utils';\r\nimport { addCardsInHand } from '../simulation/cards-in-hand';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { grantRandomStats, hasCorrectTribe } from '../utils';\r\n\r\nexport const updateDivineShield = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tnewValue: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n\r\n\t// Lost divine shield\r\n\tif (entity.hadDivineShield && !entity.divineShield) {\r\n\t\tconst adapter = hero.trinkets\r\n\t\t\t.filter((t) => t.cardId === CardIds.MechagonAdapter_BG30_MagicItem_910)\r\n\t\t\t.filter((t) => t.scriptDataNum1 > 0)[0];\r\n\t\tif (!!adapter && hasCorrectTribe(entity, hero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\tadapter.scriptDataNum1--;\r\n\t\t}\r\n\r\n\t\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[trinket.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(trinket, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < board.length; i++) {\r\n\t\t\tif (board[i].cardId === CardIds.BolvarFireblood_ICC_858) {\r\n\t\t\t\tmodifyStats(board[i], board[i], 2, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.BolvarFireblood_TB_BaconUps_047) {\r\n\t\t\t\tmodifyStats(board[i], board[i], 4, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_BGS_067) {\r\n\t\t\t\tmodifyStats(board[i], board[i], 2, 2, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (board[i].cardId === CardIds.DrakonidEnforcer_TB_BaconUps_117) {\r\n\t\t\t\tmodifyStats(board[i], board[i], 4, 4, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].entityId !== entity.entityId &&\r\n\t\t\t\t(board[i].cardId === CardIds.HolyMecherel_BG20_401 ||\r\n\t\t\t\t\tboard[i].cardId === CardIds.HolyMecherel_BG20_401_G)\r\n\t\t\t) {\r\n\t\t\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem], gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037_G) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem, CardIds.BloodGem], gameState);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008 ||\r\n\t\t\t\tboard[i].cardId === CardIds.CogworkCopter_BG24_008_G\r\n\t\t\t) {\r\n\t\t\t\t// When it's the opponent, the game state already contains all the buffs\r\n\t\t\t\tif (board[i]?.friendly) {\r\n\t\t\t\t\tconst buff = board[i].cardId === CardIds.CogworkCopter_BG24_008_G ? 2 : 1;\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tboard[i],\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = pickRandom(elligibleEntities);\r\n\t\tupdateDivineShield(chosen, board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, chosen, board, null, null);\r\n\t}\r\n};\r\n\r\nexport const grantDivineShieldToLeftmostMinions = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tquantity: number,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < Math.min(quantity, board.length); i++) {\r\n\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, board[i], board, null, null);\r\n\t}\r\n};\r\n\r\nexport interface OnDivineShieldUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n\ttarget: BoardEntity;\r\n\tpreviousValue: boolean;\r\n}\r\n"]}
|
|
@@ -13,7 +13,7 @@ const updateVenomous = (entity, newValue, board, hero, otherHero, gameState) =>
|
|
|
13
13
|
t.cardId === "BG30_MagicItem_432t");
|
|
14
14
|
belcherPortraits.forEach((p) => {
|
|
15
15
|
const buff = p.cardId === "BG30_MagicItem_432t" ? 14 : 4;
|
|
16
|
-
(0, stats_1.modifyStats)(entity, buff, buff, board, hero, gameState);
|
|
16
|
+
(0, stats_1.modifyStats)(entity, p, buff, buff, board, hero, gameState);
|
|
17
17
|
gameState.spectator.registerPowerTarget(p, entity, board, null, null);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"venomous.js","sourceRoot":"","sources":["../../src/keywords/venomous.ts"],"names":[],"mappings":";;;AAGA,4DAA+D;AAC/D,iEAA4D;AAE5D,+CAAkD;AAE3C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,QAAiB,EACjB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;IACT,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC;IACtC,MAAM,YAAY,GAAG,MAAM,CAAC,QA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AAqE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACpG,IAAA,mBAAW,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;YAC3D,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;KACH;IAED,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE;QAChC,MAAM,qBAAqB,GAAG,6BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,IAAA,qCAAoB,EAAC,qBAAqB,CAAC,EAAE;YAChD,qBAAqB,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE;gBAC3E,KAAK,EAAE,KAAK;gBACZ,IAAI,EAAE,IAAI;gBACV,SAAS,EAAE,SAAS;gBACpB,SAAS,EAAE,SAAS;aACpB,CAAC,CAAC;SACH;KACD;AACF,CAAC,CAAC;AAnCW,QAAA,cAAc,kBAmCzB","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnVenomousUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\n\r\nexport const updateVenomous = (\r\n\tentity: BoardEntity,\r\n\tnewValue: boolean,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst previousValue = entity.venomous;\r\n\tconst lostVenomous = entity.venomous && !newValue;\r\n\tentity.venomous = newValue;\r\n\tif (lostVenomous) {\r\n\t\tconst belcherPortraits = hero.trinkets.filter(\r\n\t\t\t(t) =>\r\n\t\t\t\tt.cardId === CardIds.BelcherPortrait_BG30_MagicItem_432 ||\r\n\t\t\t\tt.cardId === CardIds.BelcherPortrait_BelcherPortraitToken_BG30_MagicItem_432t,\r\n\t\t);\r\n\t\tbelcherPortraits.forEach((p) => {\r\n\t\t\tconst buff = p.cardId === CardIds.BelcherPortrait_BelcherPortraitToken_BG30_MagicItem_432t ? 14 : 4;\r\n\t\t\tmodifyStats(entity, p, buff, buff, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(p, entity, board, null, null);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const boardEntity of board) {\r\n\t\tconst onVenomousUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\tif (hasOnVenomousUpdated(onVenomousUpdatedImpl)) {\r\n\t\t\tonVenomousUpdatedImpl.onVenomousUpdated(boardEntity, entity, previousValue, {\r\n\t\t\t\tboard: board,\r\n\t\t\t\thero: hero,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tgameState: gameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnVenomousUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -13,3 +13,6 @@ export declare const encode: (input: string) => string;
|
|
|
13
13
|
export declare const decode: (base64: string) => string;
|
|
14
14
|
export declare const pickMultipleRandomDifferent: <T>(list: T[], n: number) => T[];
|
|
15
15
|
export declare const shuffleArray: <T>(array: T[]) => T[];
|
|
16
|
+
export type Mutable<T> = {
|
|
17
|
+
-readonly [P in keyof T]: T[P];
|
|
18
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/services/utils.ts"],"names":[],"mappings":";;;AAEA,SAAS,cAAc,CAAI,K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C;AAGK,MAAM,YAAY,GAAG,CAAI,KAAU,EAAO,EAAE;IAClD,IAAI,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,IAAI,WAAW,GAAG,CAAC,CAAC;IAGpB,OAAO,YAAY,IAAI,CAAC,EAAE;QAEzB,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAC;QACvD,YAAY,EAAE,CAAC;QAGf,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;KACtF;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB","sourcesContent":["import { BoardEntity } from '../board-entity';\r\n\r\nfunction partitionArray<T>(array: readonly T[], partitionSize: number): readonly T[][] {\r\n\tconst workingCopy: T[] = [...array];\r\n\tconst result: T[][] = [];\r\n\twhile (workingCopy.length) {\r\n\t\tresult.push(workingCopy.splice(0, partitionSize));\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nasync function sleep(ms) {\r\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\r\n}\r\n\r\nexport const groupByFunction =\r\n\t<T>(keyExtractor: (obj: T) => string | number) =>\r\n\t(array: readonly T[]): { [key: string]: readonly T[] } => {\r\n\t\treturn (array ?? []).reduce((objectsByKeyValue, obj) => {\r\n\t\t\tconst value = keyExtractor(obj);\r\n\t\t\tobjectsByKeyValue[value] = objectsByKeyValue[value] ?? [];\r\n\t\t\t// Using push instead of concat is thousands of times faster on big arrays\r\n\t\t\tobjectsByKeyValue[value].push(obj);\r\n\t\t\treturn objectsByKeyValue;\r\n\t\t}, {});\r\n\t};\r\n\r\nexport { partitionArray, sleep };\r\n\r\nexport const pickRandom = <T>(array: readonly T[]): T => {\r\n\tif (!array?.length) {\r\n\t\treturn null;\r\n\t}\r\n\treturn array[Math.floor(Math.random() * array.length)];\r\n};\r\n\r\nexport const pickRandomAlive = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst chosenEntity = pickRandom(targetBoard);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickMultipleRandomAlive = (board: BoardEntity[], quantity: number): BoardEntity[] => {\r\n\tconst picked: BoardEntity[] = [];\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead).filter((e) => !picked.includes(e));\r\n\t\tconst chosenEntity = pickRandom(targetBoard);\r\n\t\tif (!!chosenEntity) {\r\n\t\t\tpicked.push(chosenEntity);\r\n\t\t}\r\n\t}\r\n\treturn picked;\r\n};\r\n\r\nexport const pickRandomLowestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst lowestHealth = Math.min(...targetBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = targetBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const encode = (input: string): string => {\r\n\t// return compressToEncodedURIComponent(input);\r\n\tconst buff = Buffer.from(input, 'utf-8');\r\n\tconst base64 = buff.toString('base64');\r\n\treturn base64;\r\n};\r\n\r\nexport const decode = (base64: string): string => {\r\n\tconst buff = Buffer.from(base64, 'base64');\r\n\tconst str = buff.toString('utf-8');\r\n\treturn str;\r\n};\r\n\r\nexport const pickMultipleRandomDifferent = <T>(list: T[], n: number): T[] => {\r\n\tconst shuffled = shuffleArray([...list]);\r\n\treturn shuffled.slice(0, n);\r\n};\r\n\r\n// https://stackoverflow.com/a/2450976/548701\r\nexport const shuffleArray = <T>(array: T[]): T[] => {\r\n\tlet currentIndex = array.length;\r\n\tlet randomIndex = 0;\r\n\r\n\t// While there remain elements to shuffle...\r\n\twhile (currentIndex != 0) {\r\n\t\t// Pick a remaining element...\r\n\t\trandomIndex = Math.floor(Math.random() * currentIndex);\r\n\t\tcurrentIndex--;\r\n\r\n\t\t// And swap it with the current element.\r\n\t\t[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\r\n\t}\r\n\r\n\treturn array;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/services/utils.ts"],"names":[],"mappings":";;;AAEA,SAAS,cAAc,CAAI,KAAmB,EAAE,aAAqB;IACpE,MAAM,WAAW,GAAQ,CAAC,GAAG,KAAK,CAAC,CAAC;IACpC,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,OAAO,WAAW,CAAC,MAAM,EAAE;QAC1B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;KAClD;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAkBQ,wCAAc;AAhBvB,KAAK,UAAU,KAAK,CAAC,EAAE;IACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC;AAcwB,sBAAK;AAZvB,MAAM,eAAe,GAC3B,CAAI,YAAyC,EAAE,EAAE,CACjD,CAAC,KAAmB,EAAmC,EAAE;IACxD,OAAO,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,GAAG,EAAE,EAAE;;QACtD,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,iBAAiB,CAAC,KAAK,CAAC,GAAG,MAAA,iBAAiB,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAC;QAE1D,iBAAiB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAA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,OAAO,CAAC,CAAC;IACnC,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAJW,QAAA,MAAM,UAIjB;AAEK,MAAM,2BAA2B,GAAG,CAAI,IAAS,EAAE,CAAS,EAAO,EAAE;IAC3E,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7B,CAAC,CAAC;AAHW,QAAA,2BAA2B,+BAGtC;AAGK,MAAM,YAAY,GAAG,CAAI,KAAU,EAAO,EAAE;IAClD,IAAI,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,IAAI,WAAW,GAAG,CAAC,CAAC;IAGpB,OAAO,YAAY,IAAI,CAAC,EAAE;QAEzB,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAC;QACvD,YAAY,EAAE,CAAC;QAGf,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;KACtF;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB","sourcesContent":["import { BoardEntity } from '../board-entity';\r\n\r\nfunction partitionArray<T>(array: readonly T[], partitionSize: number): readonly T[][] {\r\n\tconst workingCopy: T[] = [...array];\r\n\tconst result: T[][] = [];\r\n\twhile (workingCopy.length) {\r\n\t\tresult.push(workingCopy.splice(0, partitionSize));\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nasync function sleep(ms) {\r\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\r\n}\r\n\r\nexport const groupByFunction =\r\n\t<T>(keyExtractor: (obj: T) => string | number) =>\r\n\t(array: readonly T[]): { [key: string]: readonly T[] } => {\r\n\t\treturn (array ?? []).reduce((objectsByKeyValue, obj) => {\r\n\t\t\tconst value = keyExtractor(obj);\r\n\t\t\tobjectsByKeyValue[value] = objectsByKeyValue[value] ?? [];\r\n\t\t\t// Using push instead of concat is thousands of times faster on big arrays\r\n\t\t\tobjectsByKeyValue[value].push(obj);\r\n\t\t\treturn objectsByKeyValue;\r\n\t\t}, {});\r\n\t};\r\n\r\nexport { partitionArray, sleep };\r\n\r\nexport const pickRandom = <T>(array: readonly T[]): T => {\r\n\tif (!array?.length) {\r\n\t\treturn null;\r\n\t}\r\n\treturn array[Math.floor(Math.random() * array.length)];\r\n};\r\n\r\nexport const pickRandomAlive = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst chosenEntity = pickRandom(targetBoard);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const pickMultipleRandomAlive = (board: BoardEntity[], quantity: number): BoardEntity[] => {\r\n\tconst picked: BoardEntity[] = [];\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead).filter((e) => !picked.includes(e));\r\n\t\tconst chosenEntity = pickRandom(targetBoard);\r\n\t\tif (!!chosenEntity) {\r\n\t\t\tpicked.push(chosenEntity);\r\n\t\t}\r\n\t}\r\n\treturn picked;\r\n};\r\n\r\nexport const pickRandomLowestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tconst targetBoard = board.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tconst lowestHealth = Math.min(...targetBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = targetBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\treturn chosenEntity;\r\n};\r\n\r\nexport const encode = (input: string): string => {\r\n\t// return compressToEncodedURIComponent(input);\r\n\tconst buff = Buffer.from(input, 'utf-8');\r\n\tconst base64 = buff.toString('base64');\r\n\treturn base64;\r\n};\r\n\r\nexport const decode = (base64: string): string => {\r\n\tconst buff = Buffer.from(base64, 'base64');\r\n\tconst str = buff.toString('utf-8');\r\n\treturn str;\r\n};\r\n\r\nexport const pickMultipleRandomDifferent = <T>(list: T[], n: number): T[] => {\r\n\tconst shuffled = shuffleArray([...list]);\r\n\treturn shuffled.slice(0, n);\r\n};\r\n\r\n// https://stackoverflow.com/a/2450976/548701\r\nexport const shuffleArray = <T>(array: T[]): T[] => {\r\n\tlet currentIndex = array.length;\r\n\tlet randomIndex = 0;\r\n\r\n\t// While there remain elements to shuffle...\r\n\twhile (currentIndex != 0) {\r\n\t\t// Pick a remaining element...\r\n\t\trandomIndex = Math.floor(Math.random() * currentIndex);\r\n\t\tcurrentIndex--;\r\n\r\n\t\t// And swap it with the current element.\r\n\t\t[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\r\n\t}\r\n\r\n\treturn array;\r\n};\r\n\r\nexport type Mutable<T> = {\r\n\t-readonly [P in keyof T]: T[P];\r\n};\r\n"]}
|
|
@@ -223,6 +223,8 @@ const VALID_DEATHRATTLE_ENCHANTMENTS = [
|
|
|
223
223
|
"BG30_MagicItem_411e",
|
|
224
224
|
"BG30_MagicItem_952e",
|
|
225
225
|
"BG31_HERO_801ptee",
|
|
226
|
+
"BG32_172e",
|
|
227
|
+
"BG32_172_Ge",
|
|
226
228
|
];
|
|
227
229
|
const validDeathrattleEnchantmentsFromMapping = [];
|
|
228
230
|
const isValidDeathrattleEnchantment = (cardId) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAExE,2DAAyG;AACzG,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA4C;AAC5C,yDAAqD;AAGrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,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AAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBtC,CAAC;AACF,MAAM,uCAAuC,GAAG,EAAE,CAAC;AAC5C,MAAM,6BAA6B,GAAG,CAAC,MAAc,EAAW,EAAE;IACxE,IAAI,8BAA8B,CAAC,QAAQ,CAAC,MAAiB,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,uCAAuC,CAAC,MAAM,KAAK,CAAC,EAAE;QACzD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE;YACnD,IAAI,IAAA,gDAA+B,EAAC,QAAQ,CAAC,IAAI,IAAA,+CAA8B,EAAC,QAAQ,CAAC,EAAE;gBAC1F,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAZW,QAAA,6BAA6B,iCAYxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleEnchantmentEffect, hasDeathrattleSpawnEnchantment } from './cards/card.interface';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cardMappings } from './cards/impl/_card-mappings';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWons: [],\r\n\t\tdamageWon: 0,\r\n\t\tdamageWonRange: null,\r\n\t\tdamageLosts: [],\r\n\t\tdamageLost: 0,\r\n\t\tdamageLostRange: null,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t// Avoid sending this verbose data\r\n\r\n\tsimulationResult.damageWons = [];\r\n\tsimulationResult.damageLosts = [];\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\r\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\r\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\r\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\r\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\r\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\r\n\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\r\n\tif (damageArray.length === 0) {\r\n\t\treturn { min: 0, max: 0 };\r\n\t}\r\n\r\n\t// Sort the array\r\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\r\n\r\n\t// Calculate the 10th and 90th percentiles\r\n\tconst percentile = (arr: number[], p: number) => {\r\n\t\tconst index = Math.floor(p * arr.length);\r\n\t\treturn arr[index];\r\n\t};\r\n\r\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\r\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\r\n\r\n\treturn { min: minDamage, max: maxDamage };\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\tif (hasDeathrattleEnchantmentEffect(cardImpl) || hasDeathrattleSpawnEnchantment(cardImpl)) {\r\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
|
|
1
|
+
{"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAExE,2DAAyG;AACzG,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA4C;AAC5C,yDAAqD;AAGrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,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,GAAG,EAAE,CAAC;AAC5C,MAAM,6BAA6B,GAAG,CAAC,MAAc,EAAW,EAAE;IACxE,IAAI,8BAA8B,CAAC,QAAQ,CAAC,MAAiB,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,uCAAuC,CAAC,MAAM,KAAK,CAAC,EAAE;QACzD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE;YACnD,IAAI,IAAA,gDAA+B,EAAC,QAAQ,CAAC,IAAI,IAAA,+CAA8B,EAAC,QAAQ,CAAC,EAAE;gBAC1F,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAZW,QAAA,6BAA6B,iCAYxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleEnchantmentEffect, hasDeathrattleSpawnEnchantment } from './cards/card.interface';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cardMappings } from './cards/impl/_card-mappings';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\tif (!cards?.getCards()?.length) {\r\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\r\n\t\treturn null;\r\n\t}\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\r\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWons: [],\r\n\t\tdamageWon: 0,\r\n\t\tdamageWonRange: null,\r\n\t\tdamageLosts: [],\r\n\t\tdamageLost: 0,\r\n\t\tdamageLostRange: null,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator(includeOutcomeSamples);\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\r\n\t// Avoid sending this verbose data\r\n\r\n\tsimulationResult.damageWons = [];\r\n\tsimulationResult.damageLosts = [];\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\r\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\r\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\r\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\r\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\r\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\r\n\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\r\n\tif (damageArray.length === 0) {\r\n\t\treturn { min: 0, max: 0 };\r\n\t}\r\n\r\n\t// Sort the array\r\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\r\n\r\n\t// Calculate the 10th and 90th percentiles\r\n\tconst percentile = (arr: number[], p: number) => {\r\n\t\tconst index = Math.floor(p * arr.length);\r\n\t\treturn arr[index];\r\n\t};\r\n\r\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\r\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\r\n\r\n\treturn { min: minDamage, max: maxDamage };\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\r\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172e,\r\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172_Ge,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\tif (hasDeathrattleEnchantmentEffect(cardImpl) || hasDeathrattleSpawnEnchantment(cardImpl)) {\r\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
|
|
@@ -36,10 +36,10 @@ const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gam
|
|
|
36
36
|
const manyWhelps = board.filter((entity) => entity.cardId === "BG22_HERO_305_Buddy");
|
|
37
37
|
const goldenManyWhelps = board.filter((entity) => entity.cardId === "BG22_HERO_305_Buddy_G");
|
|
38
38
|
manyWhelps.forEach((entity) => {
|
|
39
|
-
(0, stats_1.modifyStats)(entity, 2, 2, board, boardHero, gameState);
|
|
39
|
+
(0, stats_1.modifyStats)(entity, entity, 2, 2, board, boardHero, gameState);
|
|
40
40
|
});
|
|
41
41
|
goldenManyWhelps.forEach((entity) => {
|
|
42
|
-
(0, stats_1.modifyStats)(entity, 4, 4, board, boardHero, gameState);
|
|
42
|
+
(0, stats_1.modifyStats)(entity, entity, 4, 4, board, boardHero, gameState);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
for (const entity of board) {
|
|
@@ -62,7 +62,7 @@ const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gam
|
|
|
62
62
|
case "TB_BaconShop_HERO_92_Buddy_G":
|
|
63
63
|
if (gameState.allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {
|
|
64
64
|
const statsBonus = entity.cardId === "TB_BaconShop_HERO_92_Buddy_G" ? 8 : 4;
|
|
65
|
-
(0, stats_1.modifyStats)(spawned, statsBonus, statsBonus, board, boardHero, gameState);
|
|
65
|
+
(0, stats_1.modifyStats)(spawned, entity, statsBonus, statsBonus, board, boardHero, gameState);
|
|
66
66
|
}
|
|
67
67
|
break;
|
|
68
68
|
case "GVG_062":
|
|
@@ -70,7 +70,7 @@ const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gam
|
|
|
70
70
|
if (!entity.divineShield) {
|
|
71
71
|
(0, divine_shield_1.updateDivineShield)(entity, board, boardHero, otherHero, true, gameState);
|
|
72
72
|
}
|
|
73
|
-
(0, stats_1.modifyStats)(entity, 2, 0, board, boardHero, gameState);
|
|
73
|
+
(0, stats_1.modifyStats)(entity, entity, 2, 0, board, boardHero, gameState);
|
|
74
74
|
gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
|
|
75
75
|
}
|
|
76
76
|
break;
|
|
@@ -78,7 +78,7 @@ const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gam
|
|
|
78
78
|
case "TB_BaconUps_304":
|
|
79
79
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.DEMON, gameState.anomalies, gameState.allCards)) {
|
|
80
80
|
const statsBonus = entity.cardId === "TB_BaconUps_304" ? 2 : 1;
|
|
81
|
-
(0, stats_1.modifyStats)(entity, statsBonus, statsBonus, board, boardHero, gameState);
|
|
81
|
+
(0, stats_1.modifyStats)(entity, entity, statsBonus, statsBonus, board, boardHero, gameState);
|
|
82
82
|
gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
|
|
83
83
|
}
|
|
84
84
|
break;
|
|
@@ -86,7 +86,7 @@ const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gam
|
|
|
86
86
|
case "TB_BaconUps_090":
|
|
87
87
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.anomalies, gameState.allCards)) {
|
|
88
88
|
const statsBonus = entity.cardId === "TB_BaconUps_090" ? 8 : 4;
|
|
89
|
-
(0, stats_1.modifyStats)(spawned, statsBonus, statsBonus, board, boardHero, gameState);
|
|
89
|
+
(0, stats_1.modifyStats)(spawned, entity, statsBonus, statsBonus, board, boardHero, gameState);
|
|
90
90
|
gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
|
|
91
91
|
}
|
|
92
92
|
break;
|
|
@@ -94,7 +94,7 @@ const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gam
|
|
|
94
94
|
case "BG27_509_G":
|
|
95
95
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.anomalies, gameState.allCards)) {
|
|
96
96
|
const statsBonus = entity.cardId === "BG27_509_G" ? 16 : 8;
|
|
97
|
-
(0, stats_1.modifyStats)(spawned, statsBonus, statsBonus, board, boardHero, gameState);
|
|
97
|
+
(0, stats_1.modifyStats)(spawned, entity, statsBonus, statsBonus, board, boardHero, gameState);
|
|
98
98
|
gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
@@ -102,7 +102,7 @@ const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gam
|
|
|
102
102
|
case "TB_BaconUps_086":
|
|
103
103
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.anomalies, gameState.allCards)) {
|
|
104
104
|
const statsBonus = entity.cardId === "TB_BaconUps_086" ? 4 : 2;
|
|
105
|
-
(0, stats_1.modifyStats)(spawned, statsBonus, 0, board, boardHero, gameState);
|
|
105
|
+
(0, stats_1.modifyStats)(spawned, entity, statsBonus, 0, board, boardHero, gameState);
|
|
106
106
|
gameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);
|
|
107
107
|
}
|
|
108
108
|
break;
|
|
@@ -116,16 +116,16 @@ const handleAddedMinionAuraEffect = (board, boardHero, otherBoard, otherHero, sp
|
|
|
116
116
|
case "TB_BaconShop_HP_107":
|
|
117
117
|
if (isActuallySpawned) {
|
|
118
118
|
(0, taunt_1.updateTaunt)(spawned, true, board, boardHero, otherHero, gameState);
|
|
119
|
-
(0, stats_1.modifyStats)(spawned, 1, 2, board, boardHero, gameState);
|
|
119
|
+
(0, stats_1.modifyStats)(spawned, boardHero, 1, 2, board, boardHero, gameState);
|
|
120
120
|
}
|
|
121
121
|
break;
|
|
122
122
|
case "BG20_HERO_280p3":
|
|
123
|
-
(0, stats_1.modifyStats)(spawned, 2, 2, board, boardHero, gameState);
|
|
123
|
+
(0, stats_1.modifyStats)(spawned, boardHero, 2, 2, board, boardHero, gameState);
|
|
124
124
|
break;
|
|
125
125
|
case "TB_BaconShop_HP_015":
|
|
126
126
|
if (isActuallySpawned) {
|
|
127
127
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MECH, gameState.anomalies, gameState.allCards)) {
|
|
128
|
-
(0, stats_1.modifyStats)(spawned, 3, 0, board, boardHero, gameState);
|
|
128
|
+
(0, stats_1.modifyStats)(spawned, boardHero, 3, 0, board, boardHero, gameState);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
break;
|
|
@@ -133,7 +133,7 @@ const handleAddedMinionAuraEffect = (board, boardHero, otherBoard, otherHero, sp
|
|
|
133
133
|
}
|
|
134
134
|
if ((_a = boardHero.questRewards) === null || _a === void 0 ? void 0 : _a.includes("BG28_Reward_505")) {
|
|
135
135
|
const tumblingDisasterBonus = ((_c = (_b = boardHero.questRewardEntities) === null || _b === void 0 ? void 0 : _b.find((e) => e.cardId === "BG28_Reward_505")) === null || _c === void 0 ? void 0 : _c.scriptDataNum1) || 1;
|
|
136
|
-
(0, stats_1.modifyStats)(spawned, tumblingDisasterBonus, tumblingDisasterBonus, board, boardHero, gameState);
|
|
136
|
+
(0, stats_1.modifyStats)(spawned, boardHero, tumblingDisasterBonus, tumblingDisasterBonus, board, boardHero, gameState);
|
|
137
137
|
}
|
|
138
138
|
if (isActuallySpawned) {
|
|
139
139
|
for (const trinket of boardHero.trinkets) {
|
|
@@ -201,6 +201,9 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
|
|
|
201
201
|
spawned.attack += 6;
|
|
202
202
|
spawned.health += 4;
|
|
203
203
|
break;
|
|
204
|
+
case "BG32_MagicItem_934":
|
|
205
|
+
spawned.attack += trinket.scriptDataNum1 || 1;
|
|
206
|
+
break;
|
|
204
207
|
case "BG30_MagicItem_843t":
|
|
205
208
|
if (gameState.cardsData.getTavernLevel(spawned.cardId) <= 3) {
|
|
206
209
|
spawned.attack += 7;
|
|
@@ -218,24 +221,24 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
|
|
|
218
221
|
}
|
|
219
222
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.UNDEAD, gameState.anomalies, gameState.allCards)) {
|
|
220
223
|
if (boardHero.globalInfo.UndeadAttackBonus > 0) {
|
|
221
|
-
(0, stats_1.modifyStats)(spawned, boardHero.globalInfo.UndeadAttackBonus, 0, board, boardHero, gameState);
|
|
224
|
+
(0, stats_1.modifyStats)(spawned, spawned, boardHero.globalInfo.UndeadAttackBonus, 0, board, boardHero, gameState, false);
|
|
222
225
|
}
|
|
223
226
|
}
|
|
224
227
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.PIRATE, gameState.anomalies, gameState.allCards)) {
|
|
225
228
|
if (boardHero.globalInfo.PirateAttackBonus > 0) {
|
|
226
|
-
(0, stats_1.modifyStats)(spawned, boardHero.globalInfo.PirateAttackBonus, 0, board, boardHero, gameState);
|
|
229
|
+
(0, stats_1.modifyStats)(spawned, spawned, boardHero.globalInfo.PirateAttackBonus, 0, board, boardHero, gameState, false);
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
232
|
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.BEAST, gameState.anomalies, gameState.allCards)) {
|
|
230
233
|
if (boardHero.globalInfo.GoldrinnBuffAtk > 0) {
|
|
231
|
-
(0, stats_1.modifyStats)(spawned, boardHero.globalInfo.GoldrinnBuffAtk, boardHero.globalInfo.GoldrinnBuffHealth, board, boardHero, gameState);
|
|
234
|
+
(0, stats_1.modifyStats)(spawned, spawned, boardHero.globalInfo.GoldrinnBuffAtk, boardHero.globalInfo.GoldrinnBuffHealth, board, boardHero, gameState, false);
|
|
232
235
|
gameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);
|
|
233
236
|
}
|
|
234
237
|
}
|
|
235
238
|
if (gameState.cardsData.getTavernLevel(spawned.cardId) % 2 === 1) {
|
|
236
239
|
const atkBuff = (_c = boardHero.globalInfo.MutatedLasherAttackBuff) !== null && _c !== void 0 ? _c : 0;
|
|
237
240
|
const healthBuff = (_d = boardHero.globalInfo.MutatedLasherHealthBuff) !== null && _d !== void 0 ? _d : 0;
|
|
238
|
-
(0, stats_1.modifyStats)(spawned, atkBuff, healthBuff, board, boardHero, gameState);
|
|
241
|
+
(0, stats_1.modifyStats)(spawned, spawned, atkBuff, healthBuff, board, boardHero, gameState, false);
|
|
239
242
|
}
|
|
240
243
|
for (const entity of board) {
|
|
241
244
|
const onOtherSpawnedImpl = _card_mappings_1.cardMappings[entity.cardId];
|
|
@@ -298,37 +301,37 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
|
|
|
298
301
|
case "BG25_008_G":
|
|
299
302
|
const multiplierKnight = spawned.cardId === "BG25_008_G" ? 2 : 1;
|
|
300
303
|
const statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;
|
|
301
|
-
(0, stats_1.modifyStats)(spawned, statsBonusKnight, statsBonusKnight, board, boardHero, gameState);
|
|
304
|
+
(0, stats_1.modifyStats)(spawned, null, statsBonusKnight, statsBonusKnight, board, boardHero, gameState, false);
|
|
302
305
|
break;
|
|
303
306
|
case "BG28_555":
|
|
304
307
|
case "BG28_555_G":
|
|
305
308
|
const multiplierFungus = spawned.cardId === "BG28_555_G" ? 2 : 1;
|
|
306
309
|
const statsBonusFungus = multiplierFungus * boardHero.globalInfo.TavernSpellsCastThisGame;
|
|
307
|
-
(0, stats_1.modifyStats)(spawned, statsBonusFungus, 2 * statsBonusFungus, board, boardHero, gameState);
|
|
310
|
+
(0, stats_1.modifyStats)(spawned, null, statsBonusFungus, 2 * statsBonusFungus, board, boardHero, gameState, false);
|
|
308
311
|
break;
|
|
309
312
|
case "BG26_537":
|
|
310
313
|
case "BG26_537_G":
|
|
311
314
|
const multiplierFrostling = spawned.cardId === "BG26_537_G" ? 2 : 1;
|
|
312
315
|
const statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;
|
|
313
|
-
(0, stats_1.modifyStats)(spawned, 2 * statsBonusFrostling, statsBonusFrostling, board, boardHero, gameState);
|
|
316
|
+
(0, stats_1.modifyStats)(spawned, null, 2 * statsBonusFrostling, statsBonusFrostling, board, boardHero, gameState, false);
|
|
314
317
|
break;
|
|
315
318
|
case "BGS_081":
|
|
316
319
|
case "TB_BaconUps_143":
|
|
317
320
|
const multiplierLooter = spawned.cardId === "TB_BaconUps_143" ? 2 : 1;
|
|
318
321
|
const statsBonusLooter = multiplierLooter * boardHero.globalInfo.PiratesSummonedThisGame;
|
|
319
|
-
(0, stats_1.modifyStats)(spawned, 2 * statsBonusLooter, 2 * multiplierLooter, board, boardHero, gameState);
|
|
322
|
+
(0, stats_1.modifyStats)(spawned, null, 2 * statsBonusLooter, 2 * multiplierLooter, board, boardHero, gameState, false);
|
|
320
323
|
break;
|
|
321
324
|
case "BG_TTN_401":
|
|
322
325
|
case "BG_TTN_401_G":
|
|
323
326
|
const multiplierAstral = spawned.cardId === "BG_TTN_401_G" ? 2 : 1;
|
|
324
327
|
const statsBonusAstral = multiplierAstral * (boardHero.globalInfo.AstralAutomatonsSummonedThisGame - 1);
|
|
325
|
-
(0, stats_1.modifyStats)(spawned, 2 * statsBonusAstral, 2 * statsBonusAstral, board, boardHero, gameState);
|
|
328
|
+
(0, stats_1.modifyStats)(spawned, null, 2 * statsBonusAstral, 2 * statsBonusAstral, board, boardHero, gameState, false);
|
|
326
329
|
break;
|
|
327
330
|
case "BG25_013":
|
|
328
331
|
case "BG25_013_G":
|
|
329
332
|
const multiplierGnoll = spawned.cardId === "BG25_013_G" ? 2 : 1;
|
|
330
333
|
const statsBonusGnoll = multiplierGnoll * gameState.sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;
|
|
331
|
-
(0, stats_1.modifyStats)(spawned, statsBonusGnoll, 0, board, boardHero, gameState);
|
|
334
|
+
(0, stats_1.modifyStats)(spawned, null, statsBonusGnoll, 0, board, boardHero, gameState, false);
|
|
332
335
|
break;
|
|
333
336
|
}
|
|
334
337
|
};
|
|
@@ -366,6 +369,9 @@ const removeAurasFromSelf = (entity, board, boardHero, gameState) => {
|
|
|
366
369
|
entity.attack = Math.max(0, entity.attack - 6);
|
|
367
370
|
entity.health = Math.max(1, entity.health - 4);
|
|
368
371
|
break;
|
|
372
|
+
case "BG32_MagicItem_934":
|
|
373
|
+
entity.attack = Math.max(0, entity.attack - (trinket.scriptDataNum1 || 1));
|
|
374
|
+
break;
|
|
369
375
|
case "BG30_MagicItem_843t":
|
|
370
376
|
if (gameState.cardsData.getTavernLevel(entity.cardId) <= 3) {
|
|
371
377
|
entity.attack = Math.max(0, entity.attack - 7);
|
|
@@ -537,13 +543,13 @@ const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, g
|
|
|
537
543
|
e.cardId === "BG_TTN_401_G")
|
|
538
544
|
.forEach((e) => {
|
|
539
545
|
const multiplierAstral = e.cardId === "BG_TTN_401_G" ? 2 : 1;
|
|
540
|
-
(0, stats_1.modifyStats)(e, 2 * multiplierAstral, 2 * multiplierAstral, board, boardHero, gameState);
|
|
546
|
+
(0, stats_1.modifyStats)(e, e, 2 * multiplierAstral, 2 * multiplierAstral, board, boardHero, gameState, false);
|
|
541
547
|
});
|
|
542
548
|
break;
|
|
543
549
|
case "BG31_176":
|
|
544
550
|
case "BG31_176_G":
|
|
545
551
|
const multiplierDrBoom = spawned.cardId === "BG31_176_G" ? 2 : 1;
|
|
546
|
-
(0, stats_1.modifyStats)(spawned, 2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom, 2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom, board, boardHero, gameState);
|
|
552
|
+
(0, stats_1.modifyStats)(spawned, spawned, 2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom, 2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom, board, boardHero, gameState, false);
|
|
547
553
|
break;
|
|
548
554
|
}
|
|
549
555
|
};
|
|
@@ -569,8 +575,21 @@ const onMinionSummoned = (hero, board, gameState) => {
|
|
|
569
575
|
};
|
|
570
576
|
exports.onMinionSummoned = onMinionSummoned;
|
|
571
577
|
const handleAfterSpawnEffect = (board, hero, otherBoard, otherHero, spawned, gameState) => {
|
|
572
|
-
var _a;
|
|
578
|
+
var _a, _b;
|
|
573
579
|
const initialBoard = [...board];
|
|
580
|
+
for (const trinket of (_a = hero.trinkets) !== null && _a !== void 0 ? _a : []) {
|
|
581
|
+
const onAfterSpawnedImpl = _card_mappings_1.cardMappings[trinket.cardId];
|
|
582
|
+
if ((0, card_interface_1.hasAfterOtherSpawned)(onAfterSpawnedImpl)) {
|
|
583
|
+
onAfterSpawnedImpl.afterOtherSpawned(trinket, {
|
|
584
|
+
spawned: spawned,
|
|
585
|
+
hero: hero,
|
|
586
|
+
board: board,
|
|
587
|
+
otherHero: otherHero,
|
|
588
|
+
otherBoard: otherBoard,
|
|
589
|
+
gameState,
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}
|
|
574
593
|
for (const entity of initialBoard) {
|
|
575
594
|
const onAfterSpawnedImpl = _card_mappings_1.cardMappings[entity.cardId];
|
|
576
595
|
if ((0, card_interface_1.hasAfterOtherSpawned)(onAfterSpawnedImpl)) {
|
|
@@ -588,7 +607,7 @@ const handleAfterSpawnEffect = (board, hero, otherBoard, otherHero, spawned, gam
|
|
|
588
607
|
case "BG26_172_G":
|
|
589
608
|
if (entity.entityId !== spawned.entityId) {
|
|
590
609
|
const xylobonesBuff = entity.cardId === "BG26_172_G" ? 4 : 2;
|
|
591
|
-
(0, stats_1.modifyStats)(entity, 0, xylobonesBuff, board, hero, gameState);
|
|
610
|
+
(0, stats_1.modifyStats)(entity, entity, 0, xylobonesBuff, board, hero, gameState);
|
|
592
611
|
gameState.spectator.registerPowerTarget(entity, entity, board, null, null);
|
|
593
612
|
}
|
|
594
613
|
break;
|
|
@@ -596,7 +615,7 @@ const handleAfterSpawnEffect = (board, hero, otherBoard, otherHero, spawned, gam
|
|
|
596
615
|
case "BG26_804_G":
|
|
597
616
|
if (entity.entityId !== spawned.entityId) {
|
|
598
617
|
const octoStats = entity.cardId === "BG26_804_G" ? 4 : 2;
|
|
599
|
-
entity.scriptDataNum1 = ((
|
|
618
|
+
entity.scriptDataNum1 = ((_b = entity.scriptDataNum1) !== null && _b !== void 0 ? _b : 0) + octoStats;
|
|
600
619
|
}
|
|
601
620
|
break;
|
|
602
621
|
case "BG26_802":
|
|
@@ -620,14 +639,14 @@ const handleAfterSpawnEffect = (board, hero, otherBoard, otherHero, spawned, gam
|
|
|
620
639
|
if ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.DRAGON, gameState.anomalies, gameState.allCards) &&
|
|
621
640
|
entity.entityId !== spawned.entityId) {
|
|
622
641
|
const valithriaBuff = entity.cardId === "TB_BaconShop_HERO_53_Buddy_G" ? 3 : 2;
|
|
623
|
-
(0, stats_1.modifyStats)(entity, valithriaBuff, valithriaBuff, board, hero, gameState);
|
|
642
|
+
(0, stats_1.modifyStats)(entity, entity, valithriaBuff, valithriaBuff, board, hero, gameState);
|
|
624
643
|
gameState.spectator.registerPowerTarget(entity, spawned, board, null, null);
|
|
625
644
|
}
|
|
626
645
|
break;
|
|
627
646
|
case "BG26_RLK_824":
|
|
628
647
|
if ((0, utils_2.hasCorrectTribe)(spawned, hero, reference_data_1.Race.UNDEAD, gameState.anomalies, gameState.allCards) &&
|
|
629
648
|
entity.entityId !== spawned.entityId) {
|
|
630
|
-
(0, stats_1.modifyStats)(spawned, 1, 0, board, hero, gameState);
|
|
649
|
+
(0, stats_1.modifyStats)(spawned, spawned, 1, 0, board, hero, gameState, false);
|
|
631
650
|
gameState.spectator.registerPowerTarget(entity, entity, board, null, null);
|
|
632
651
|
}
|
|
633
652
|
break;
|