@firestone-hs/simulate-bgs-battle 1.1.513 → 1.1.515
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/cards/impl/_card-mappings.js +2 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/bg-spell/upper-hand.js +2 -2
- package/dist/cards/impl/bg-spell/upper-hand.js.map +1 -1
- package/dist/cards/impl/minion/imposing-percussionist.d.ts +2 -0
- package/dist/cards/impl/minion/imposing-percussionist.js +15 -0
- package/dist/cards/impl/minion/imposing-percussionist.js.map +1 -0
- package/dist/cards/impl/minion/mutated-lasher.d.ts +2 -2
- package/dist/cards/impl/minion/mutated-lasher.js +0 -7
- package/dist/cards/impl/minion/mutated-lasher.js.map +1 -1
- package/dist/cards/impl/minion/rylak-metalhead.js +1 -0
- package/dist/cards/impl/minion/rylak-metalhead.js.map +1 -1
- package/dist/cards/impl/minion/ultraviolet-ascendant.js +7 -3
- package/dist/cards/impl/minion/ultraviolet-ascendant.js.map +1 -1
- package/dist/input-sanitation.js +1 -0
- package/dist/input-sanitation.js.map +1 -1
- package/dist/simulate-bgs-battle.js +1 -1
- package/dist/simulate-bgs-battle.js.map +1 -1
- package/dist/simulation/add-minion-to-board.d.ts +1 -1
- package/dist/simulation/add-minion-to-board.js +35 -26
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/minion-death.js +6 -2
- package/dist/simulation/minion-death.js.map +1 -1
- package/dist/simulation/simulator.js +11 -8
- package/dist/simulation/simulator.js.map +1 -1
- package/dist/simulation/stats.js +1 -0
- package/dist/simulation/stats.js.map +1 -1
- package/dist/simulation/summon-when-space.js +6 -6
- package/dist/simulation/summon-when-space.js.map +1 -1
- package/dist/simulation/utils/golden.js +9 -3
- package/dist/simulation/utils/golden.js.map +1 -1
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ const humming_bird_1 = require("./minion/humming-bird");
|
|
|
44
44
|
const hungry_snapjaw_1 = require("./minion/hungry-snapjaw");
|
|
45
45
|
const hunter_of_gatherers_1 = require("./minion/hunter-of-gatherers");
|
|
46
46
|
const implant_subject_1 = require("./minion/implant-subject");
|
|
47
|
+
const imposing_percussionist_1 = require("./minion/imposing-percussionist");
|
|
47
48
|
const impulsive_trickster_1 = require("./minion/impulsive-trickster");
|
|
48
49
|
const indomitable_mount_1 = require("./minion/indomitable-mount");
|
|
49
50
|
const inspiring_underdog_1 = require("./minion/inspiring-underdog");
|
|
@@ -213,6 +214,7 @@ const cards = [
|
|
|
213
214
|
thundering_abomination_1.ThunderingAbomination,
|
|
214
215
|
prized_promo_drake_1.PrizedPromoDrake,
|
|
215
216
|
transmuted_bramblewitch_1.TransmutedBramblewitch,
|
|
217
|
+
imposing_percussionist_1.ImposingPercussionist,
|
|
216
218
|
];
|
|
217
219
|
exports.cardMappings = {};
|
|
218
220
|
for (const card of cards) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_card-mappings.js","sourceRoot":"","sources":["../../../src/cards/impl/_card-mappings.ts"],"names":[],"mappings":";;;;AACA,4FAAuF;AACvF,8EAAyE;AACzE,4EAAuE;AACvE,gEAA4D;AAC5D,0DAAsD;AACtD,8DAA0D;AAC1D,oDAAiD;AACjD,4CAAyC;AACzC,oDAAgD;AAChD,4DAAwD;AACxD,oDAAgD;AAChD,wDAAoD;AACpD,0DAAsD;AACtD,4DAAwD;AACxD,kEAA8D;AAC9D,4EAAsE;AACtE,8CAA2C;AAC3C,4DAAwD;AACxD,kEAA8D;AAC9D,8DAA0D;AAC1D,oEAAgE;AAChE,wDAAoD;AACpD,oEAAgE;AAChE,wEAAoE;AACpE,gEAA4D;AAC5D,wDAAoD;AACpD,gEAA4D;AAC5D,8CAA0C;AAC1C,wDAAoD;AACpD,oEAAgE;AAChE,0DAAsD;AACtD,8EAAwE;AACxE,oDAAgD;AAChD,kEAA8D;AAC9D,kDAA+C;AAC/C,kEAA8D;AAC9D,kEAA8D;AAC9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C3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;IACzB,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC;IACnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC7B,oBAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;KAC5B;CACD","sourcesContent":["import { Card } from '../card.interface';\r\nimport { CrystalInfuserEnchantment } from './enchantments/crystal-infuser-enchantment';\r\nimport { AdmiralElizaGoreblade } from './minion/admiral-eliza-goreblade';\r\nimport { AnubarakNerubianKing } from './minion/anubarak-nerubian-king';\r\nimport { ArcaneCannoneer } from './minion/arcane-cannoneer';\r\nimport { AridAtrocity } from './minion/arid-atrocity';\r\nimport { AssistantGuard } from './minion/assistant-guard';\r\nimport { Bannerboar } from './minion/bannerboar';\r\nimport { Beetle } from './minion/beetle';\r\nimport { BirdBuddy } from './minion/bird-buddy';\r\nimport { BlazingSkyfin } from './minion/blazing-skyfin';\r\nimport { BoarGamer } from './minion/boar-gamer';\r\nimport { BongoBopper } from './minion/bongo-bopper';\r\nimport { BubbleGunner } from './minion/bubble-gunner';\r\nimport { BuzzingVermin } from './minion/buzzing-vermin';\r\nimport { CadaverCaretaker } from './minion/cadaver-caretaker';\r\nimport { ChampionOfThePrimus } from './minion/champion-of-the-primus';\r\nimport { Charlga } from './minion/charlga';\r\nimport { ClunkerJunker } from './minion/clunker-junker';\r\nimport { CruiseController } from './minion/cruise-controller';\r\nimport { DeathlyStriker } from './minion/deathly-striker';\r\nimport { DefiantShipwright } from './minion/defiant-shipwright';\r\nimport { DeflectoBot } from './minion/deflecto-bot';\r\nimport { EfficientEngineer } from './minion/efficient-engineer';\r\nimport { ElectricSynthesizer } from './minion/electric-synthesizer';\r\nimport { FairyGillmother } from './minion/fairy-gillmother';\r\nimport { ForestRover } from './minion/forest-rover';\r\nimport { FountainChiller } from './minion/fountain-chiller';\r\nimport { GemRat } from './minion/gem-rat';\r\nimport { GemSmuggler } from './minion/gem-smuggler';\r\nimport { GeneralDrakkisath } from './minion/general-drakkisath';\r\nimport { GentleDjinni } from './minion/gentle-djinni';\r\nimport { GoldrinnTheGreatWolf } from './minion/goldrinn-the-great-wolf';\r\nimport { GreaseBot } from './minion/grease-bot';\r\nimport { GrittyHeadhunter } from './minion/gritty-headhunter';\r\nimport { Hackerfin } from './minion/hackerfin';\r\nimport { HandlessForsaken } from './minion/handless-forsaken';\r\nimport { HarmlessBonehead } from './minion/harmless-bonehead';\r\nimport { HoloRover } from './minion/holo-rover';\r\nimport { HummingBird } from './minion/humming-bird';\r\nimport { HungrySnapjaw } from './minion/hungry-snapjaw';\r\nimport { HunterOfGatherers } from './minion/hunter-of-gatherers';\r\nimport { ImplantSubject } from './minion/implant-subject';\r\nimport { ImpulsiveTrickster } from './minion/impulsive-trickster';\r\nimport { IndomitableMount } from './minion/indomitable-mount';\r\nimport { InspiringUnderdog } from './minion/inspiring-underdog';\r\nimport { InterrogatorWhitemane } from './minion/interrogator-whitemane';\r\nimport { KalecgosArcaneAspect } from './minion/kalecgos-arcane-aspect';\r\nimport { KangorsApprentice } from './minion/kangors-apprentice';\r\nimport { KarmicChameleon } from './minion/karmic-chameleon';\r\nimport { KingBagurgle } from './minion/king-bagurgle';\r\nimport { LeeroyTheReckless } from './minion/leeroy-the-reckless';\r\nimport { LightfangEnforcer } from './minion/lightfang-enforcer';\r\nimport { LovesickBalladist } from './minion/lovesick-balladist';\r\nimport { Manasaber } from './minion/manasaber';\r\nimport { MarqueeTicker } from './minion/marquee-ticker';\r\nimport { MechaJaraxxus } from './minion/mecha-jaraxxus';\r\nimport { MechanizedGiftHorse } from './minion/mechanized-gift-horse';\r\nimport { Mechorse } from './minion/mechorse';\r\nimport { MisfitDragonling } from './minion/misfit-dragonling';\r\nimport { MoonsteelJuggernaut } from './minion/moonsteel-juggernaut';\r\nimport { Mummifier } from './minion/mummifier';\r\nimport { Murky } from './minion/murky';\r\nimport { MutatedLasher } from './minion/mutated-lasher';\r\nimport { NeonAgent } from './minion/neon-agent';\r\nimport { NerubianDeathswarmer } from './minion/nerubian-deathswarmer';\r\nimport { NestSwarmer } from './minion/nest-swarmer';\r\nimport { NetherDrake } from './minion/nether-drake';\r\nimport { Niuzao } from './minion/niuzao';\r\nimport { OozelingGladiator } from './minion/oozeling-gladiator';\r\nimport { OperaticBelcher } from './minion/operatic-belcher';\r\nimport { OutbackSmolderer } from './minion/outback-smolderer';\r\nimport { ParchedWanderer } from './minion/parched-wanderer';\r\nimport { PeggySturdybone } from './minion/peggy-sturdybone';\r\nimport { PrimalfinLookout } from './minion/primalfin-lookout';\r\nimport { PrizedPromoDrake } from './minion/prized-promo-drake';\r\nimport { RapscallionRecruiter } from './minion/rapscallion-recruiter';\r\nimport { RazorfenGeomancer } from './minion/razorfen-geomancer';\r\nimport { RazorgoreTheUntamed } from './minion/razorgore-the-untamed';\r\nimport { RecklessCliffdiver } from './minion/reckless-cliffdiver';\r\nimport { RipsnarlCaptain } from './minion/ripsnarl-captain';\r\nimport { RodeoPerformer } from './minion/rodeo-performer';\r\nimport { RunedProgenitor } from './minion/runed-progenitor';\r\nimport { RylakMetalhead } from './minion/rylak-metalhead';\r\nimport { SaltyHog } from './minion/salty-hog';\r\nimport { Scallywag } from './minion/scallywag';\r\nimport { ShellCollector } from './minion/shell-collector';\r\nimport { ShowyCyclist } from './minion/showy-cyclist';\r\nimport { SilverHandedRecruit } from './minion/silver-handed-recruit';\r\nimport { SindoreiStraightShot } from './minion/sinodorei-straight-shot';\r\nimport { SkyPirateFlagbearer } from './minion/sky-pirate-flagbearer';\r\nimport { SkyPirateFlagbearerEnchantment } from './minion/sky-pirate-flagbearer-enchantment';\r\nimport { SlyRaptor } from './minion/sly-raptor';\r\nimport { Smolderwing } from './minion/smolderwing';\r\nimport { Spacefarer } from './minion/spacefarer';\r\nimport { Swampstriker } from './minion/swampstriker';\r\nimport { ThreeLilQuilboar } from './minion/three-lil-quilboar';\r\nimport { ThunderingAbomination } from './minion/thundering-abomination';\r\nimport { TransmutedBramblewitch } from './minion/transmuted-bramblewitch';\r\nimport { TunnelBlaster } from './minion/tunnel-blaster';\r\nimport { TurquoiseSkitterer } from './minion/turquoise-skitterer';\r\nimport { TwilightPrimordium } from './minion/twilight-primordium';\r\nimport { UltravioletAscendant } from './minion/ultraviolet-ascendant';\r\nimport { WanderingWight } from './minion/wandering-wight';\r\nimport { WhelpSmuggler } from './minion/whelp-smuggler';\r\nimport { WispInTheShell } from './minion/wisp-in-the-shell';\r\n\r\nconst cards = [\r\n\tHoloRover,\r\n\tForestRover,\r\n\tBeetle,\r\n\tBuzzingVermin,\r\n\tGemRat,\r\n\tNestSwarmer,\r\n\tRunedProgenitor,\r\n\tTurquoiseSkitterer,\r\n\tEfficientEngineer,\r\n\tNetherDrake,\r\n\tElectricSynthesizer,\r\n\tOutbackSmolderer,\r\n\tRazorgoreTheUntamed,\r\n\tUltravioletAscendant,\r\n\tTwilightPrimordium,\r\n\tGentleDjinni,\r\n\tMoonsteelJuggernaut,\r\n\tMarqueeTicker,\r\n\tRecklessCliffdiver,\r\n\tFountainChiller,\r\n\tNeonAgent,\r\n\tImplantSubject,\r\n\tHackerfin,\r\n\tBubbleGunner,\r\n\tFairyGillmother,\r\n\tShowyCyclist,\r\n\tArcaneCannoneer,\r\n\tMutatedLasher,\r\n\tSilverHandedRecruit,\r\n\tSaltyHog,\r\n\tSpacefarer,\r\n\tGrittyHeadhunter,\r\n\tCrystalInfuserEnchantment,\r\n\tBoarGamer,\r\n\tBannerboar,\r\n\tWanderingWight,\r\n\tDeathlyStriker,\r\n\tWispInTheShell,\r\n\tHandlessForsaken,\r\n\tHarmlessBonehead,\r\n\tCadaverCaretaker,\r\n\tHungrySnapjaw,\r\n\tNiuzao,\r\n\tBirdBuddy,\r\n\tSlyRaptor,\r\n\tManasaber,\r\n\tRylakMetalhead,\r\n\tHummingBird,\r\n\tMechanizedGiftHorse,\r\n\tMechorse,\r\n\tIndomitableMount,\r\n\tKarmicChameleon,\r\n\tGoldrinnTheGreatWolf,\r\n\tImpulsiveTrickster,\r\n\tMechaJaraxxus,\r\n\tWhelpSmuggler,\r\n\tHunterOfGatherers,\r\n\tBlazingSkyfin,\r\n\tGeneralDrakkisath,\r\n\tSmolderwing,\r\n\tMisfitDragonling,\r\n\tKalecgosArcaneAspect,\r\n\tGreaseBot,\r\n\tClunkerJunker,\r\n\tKangorsApprentice,\r\n\tDeflectoBot,\r\n\tSwampstriker,\r\n\tMurky,\r\n\tOperaticBelcher,\r\n\tParchedWanderer,\r\n\tPrimalfinLookout,\r\n\tKingBagurgle,\r\n\tShellCollector,\r\n\tTunnelBlaster,\r\n\tLeeroyTheReckless,\r\n\tInterrogatorWhitemane,\r\n\tOozelingGladiator,\r\n\tRodeoPerformer,\r\n\tAssistantGuard,\r\n\tAridAtrocity,\r\n\tInspiringUnderdog,\r\n\tLightfangEnforcer,\r\n\tDefiantShipwright,\r\n\tPeggySturdybone,\r\n\tRapscallionRecruiter,\r\n\tLovesickBalladist,\r\n\tAdmiralElizaGoreblade,\r\n\tSkyPirateFlagbearer,\r\n\tSkyPirateFlagbearerEnchantment,\r\n\tCruiseController,\r\n\tRipsnarlCaptain,\r\n\tScallywag,\r\n\tRazorfenGeomancer,\r\n\tCharlga,\r\n\tGemSmuggler,\r\n\tBongoBopper,\r\n\tThreeLilQuilboar,\r\n\tAnubarakNerubianKing,\r\n\tNerubianDeathswarmer,\r\n\tSindoreiStraightShot,\r\n\tChampionOfThePrimus,\r\n\tMummifier,\r\n\tThunderingAbomination,\r\n\tPrizedPromoDrake,\r\n\tTransmutedBramblewitch,\r\n];\r\n\r\nexport const cardMappings: { [cardId: string]: Card } = {};\r\nfor (const card of cards) {\r\n\tconst cardIds = card.cardIds ?? [];\r\n\tfor (const cardId of cardIds) {\r\n\t\tcardMappings[cardId] = card;\r\n\t}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"_card-mappings.js","sourceRoot":"","sources":["../../../src/cards/impl/_card-mappings.ts"],"names":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AW;IACX,2BAAY;IACZ,aAAK;IACL,kCAAe;IACf,kCAAe;IACf,oCAAgB;IAChB,4BAAY;IACZ,gCAAc;IACd,8BAAa;IACb,uCAAiB;IACjB,8CAAqB;IACrB,sCAAiB;IACjB,gCAAc;IACd,gCAAc;IACd,4BAAY;IACZ,sCAAiB;IACjB,sCAAiB;IACjB,sCAAiB;IACjB,kCAAe;IACf,4CAAoB;IACpB,sCAAiB;IACjB,+CAAqB;IACrB,2CAAmB;IACnB,kEAA8B;IAC9B,oCAAgB;IAChB,kCAAe;IACf,qBAAS;IACT,sCAAiB;IACjB,iBAAO;IACP,0BAAW;IACX,0BAAW;IACX,qCAAgB;IAChB,6CAAoB;IACpB,4CAAoB;IACpB,8CAAoB;IACpB,4CAAmB;IACnB,qBAAS;IACT,8CAAqB;IACrB,qCAAgB;IAChB,gDAAsB;IACtB,8CAAqB;CACrB,CAAC;AAEW,QAAA,YAAY,GAA+B,EAAE,CAAC;AAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;IACzB,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC;IACnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC7B,oBAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;KAC5B;CACD","sourcesContent":["import { Card } from '../card.interface';\r\nimport { CrystalInfuserEnchantment } from './enchantments/crystal-infuser-enchantment';\r\nimport { AdmiralElizaGoreblade } from './minion/admiral-eliza-goreblade';\r\nimport { AnubarakNerubianKing } from './minion/anubarak-nerubian-king';\r\nimport { ArcaneCannoneer } from './minion/arcane-cannoneer';\r\nimport { AridAtrocity } from './minion/arid-atrocity';\r\nimport { AssistantGuard } from './minion/assistant-guard';\r\nimport { Bannerboar } from './minion/bannerboar';\r\nimport { Beetle } from './minion/beetle';\r\nimport { BirdBuddy } from './minion/bird-buddy';\r\nimport { BlazingSkyfin } from './minion/blazing-skyfin';\r\nimport { BoarGamer } from './minion/boar-gamer';\r\nimport { BongoBopper } from './minion/bongo-bopper';\r\nimport { BubbleGunner } from './minion/bubble-gunner';\r\nimport { BuzzingVermin } from './minion/buzzing-vermin';\r\nimport { CadaverCaretaker } from './minion/cadaver-caretaker';\r\nimport { ChampionOfThePrimus } from './minion/champion-of-the-primus';\r\nimport { Charlga } from './minion/charlga';\r\nimport { ClunkerJunker } from './minion/clunker-junker';\r\nimport { CruiseController } from './minion/cruise-controller';\r\nimport { DeathlyStriker } from './minion/deathly-striker';\r\nimport { DefiantShipwright } from './minion/defiant-shipwright';\r\nimport { DeflectoBot } from './minion/deflecto-bot';\r\nimport { EfficientEngineer } from './minion/efficient-engineer';\r\nimport { ElectricSynthesizer } from './minion/electric-synthesizer';\r\nimport { FairyGillmother } from './minion/fairy-gillmother';\r\nimport { ForestRover } from './minion/forest-rover';\r\nimport { FountainChiller } from './minion/fountain-chiller';\r\nimport { GemRat } from './minion/gem-rat';\r\nimport { GemSmuggler } from './minion/gem-smuggler';\r\nimport { GeneralDrakkisath } from './minion/general-drakkisath';\r\nimport { GentleDjinni } from './minion/gentle-djinni';\r\nimport { GoldrinnTheGreatWolf } from './minion/goldrinn-the-great-wolf';\r\nimport { GreaseBot } from './minion/grease-bot';\r\nimport { GrittyHeadhunter } from './minion/gritty-headhunter';\r\nimport { Hackerfin } from './minion/hackerfin';\r\nimport { HandlessForsaken } from './minion/handless-forsaken';\r\nimport { HarmlessBonehead } from './minion/harmless-bonehead';\r\nimport { HoloRover } from './minion/holo-rover';\r\nimport { HummingBird } from './minion/humming-bird';\r\nimport { HungrySnapjaw } from './minion/hungry-snapjaw';\r\nimport { HunterOfGatherers } from './minion/hunter-of-gatherers';\r\nimport { ImplantSubject } from './minion/implant-subject';\r\nimport { ImposingPercussionist } from './minion/imposing-percussionist';\r\nimport { ImpulsiveTrickster } from './minion/impulsive-trickster';\r\nimport { IndomitableMount } from './minion/indomitable-mount';\r\nimport { InspiringUnderdog } from './minion/inspiring-underdog';\r\nimport { InterrogatorWhitemane } from './minion/interrogator-whitemane';\r\nimport { KalecgosArcaneAspect } from './minion/kalecgos-arcane-aspect';\r\nimport { KangorsApprentice } from './minion/kangors-apprentice';\r\nimport { KarmicChameleon } from './minion/karmic-chameleon';\r\nimport { KingBagurgle } from './minion/king-bagurgle';\r\nimport { LeeroyTheReckless } from './minion/leeroy-the-reckless';\r\nimport { LightfangEnforcer } from './minion/lightfang-enforcer';\r\nimport { LovesickBalladist } from './minion/lovesick-balladist';\r\nimport { Manasaber } from './minion/manasaber';\r\nimport { MarqueeTicker } from './minion/marquee-ticker';\r\nimport { MechaJaraxxus } from './minion/mecha-jaraxxus';\r\nimport { MechanizedGiftHorse } from './minion/mechanized-gift-horse';\r\nimport { Mechorse } from './minion/mechorse';\r\nimport { MisfitDragonling } from './minion/misfit-dragonling';\r\nimport { MoonsteelJuggernaut } from './minion/moonsteel-juggernaut';\r\nimport { Mummifier } from './minion/mummifier';\r\nimport { Murky } from './minion/murky';\r\nimport { MutatedLasher } from './minion/mutated-lasher';\r\nimport { NeonAgent } from './minion/neon-agent';\r\nimport { NerubianDeathswarmer } from './minion/nerubian-deathswarmer';\r\nimport { NestSwarmer } from './minion/nest-swarmer';\r\nimport { NetherDrake } from './minion/nether-drake';\r\nimport { Niuzao } from './minion/niuzao';\r\nimport { OozelingGladiator } from './minion/oozeling-gladiator';\r\nimport { OperaticBelcher } from './minion/operatic-belcher';\r\nimport { OutbackSmolderer } from './minion/outback-smolderer';\r\nimport { ParchedWanderer } from './minion/parched-wanderer';\r\nimport { PeggySturdybone } from './minion/peggy-sturdybone';\r\nimport { PrimalfinLookout } from './minion/primalfin-lookout';\r\nimport { PrizedPromoDrake } from './minion/prized-promo-drake';\r\nimport { RapscallionRecruiter } from './minion/rapscallion-recruiter';\r\nimport { RazorfenGeomancer } from './minion/razorfen-geomancer';\r\nimport { RazorgoreTheUntamed } from './minion/razorgore-the-untamed';\r\nimport { RecklessCliffdiver } from './minion/reckless-cliffdiver';\r\nimport { RipsnarlCaptain } from './minion/ripsnarl-captain';\r\nimport { RodeoPerformer } from './minion/rodeo-performer';\r\nimport { RunedProgenitor } from './minion/runed-progenitor';\r\nimport { RylakMetalhead } from './minion/rylak-metalhead';\r\nimport { SaltyHog } from './minion/salty-hog';\r\nimport { Scallywag } from './minion/scallywag';\r\nimport { ShellCollector } from './minion/shell-collector';\r\nimport { ShowyCyclist } from './minion/showy-cyclist';\r\nimport { SilverHandedRecruit } from './minion/silver-handed-recruit';\r\nimport { SindoreiStraightShot } from './minion/sinodorei-straight-shot';\r\nimport { SkyPirateFlagbearer } from './minion/sky-pirate-flagbearer';\r\nimport { SkyPirateFlagbearerEnchantment } from './minion/sky-pirate-flagbearer-enchantment';\r\nimport { SlyRaptor } from './minion/sly-raptor';\r\nimport { Smolderwing } from './minion/smolderwing';\r\nimport { Spacefarer } from './minion/spacefarer';\r\nimport { Swampstriker } from './minion/swampstriker';\r\nimport { ThreeLilQuilboar } from './minion/three-lil-quilboar';\r\nimport { ThunderingAbomination } from './minion/thundering-abomination';\r\nimport { TransmutedBramblewitch } from './minion/transmuted-bramblewitch';\r\nimport { TunnelBlaster } from './minion/tunnel-blaster';\r\nimport { TurquoiseSkitterer } from './minion/turquoise-skitterer';\r\nimport { TwilightPrimordium } from './minion/twilight-primordium';\r\nimport { UltravioletAscendant } from './minion/ultraviolet-ascendant';\r\nimport { WanderingWight } from './minion/wandering-wight';\r\nimport { WhelpSmuggler } from './minion/whelp-smuggler';\r\nimport { WispInTheShell } from './minion/wisp-in-the-shell';\r\n\r\nconst cards = [\r\n\tHoloRover,\r\n\tForestRover,\r\n\tBeetle,\r\n\tBuzzingVermin,\r\n\tGemRat,\r\n\tNestSwarmer,\r\n\tRunedProgenitor,\r\n\tTurquoiseSkitterer,\r\n\tEfficientEngineer,\r\n\tNetherDrake,\r\n\tElectricSynthesizer,\r\n\tOutbackSmolderer,\r\n\tRazorgoreTheUntamed,\r\n\tUltravioletAscendant,\r\n\tTwilightPrimordium,\r\n\tGentleDjinni,\r\n\tMoonsteelJuggernaut,\r\n\tMarqueeTicker,\r\n\tRecklessCliffdiver,\r\n\tFountainChiller,\r\n\tNeonAgent,\r\n\tImplantSubject,\r\n\tHackerfin,\r\n\tBubbleGunner,\r\n\tFairyGillmother,\r\n\tShowyCyclist,\r\n\tArcaneCannoneer,\r\n\tMutatedLasher,\r\n\tSilverHandedRecruit,\r\n\tSaltyHog,\r\n\tSpacefarer,\r\n\tGrittyHeadhunter,\r\n\tCrystalInfuserEnchantment,\r\n\tBoarGamer,\r\n\tBannerboar,\r\n\tWanderingWight,\r\n\tDeathlyStriker,\r\n\tWispInTheShell,\r\n\tHandlessForsaken,\r\n\tHarmlessBonehead,\r\n\tCadaverCaretaker,\r\n\tHungrySnapjaw,\r\n\tNiuzao,\r\n\tBirdBuddy,\r\n\tSlyRaptor,\r\n\tManasaber,\r\n\tRylakMetalhead,\r\n\tHummingBird,\r\n\tMechanizedGiftHorse,\r\n\tMechorse,\r\n\tIndomitableMount,\r\n\tKarmicChameleon,\r\n\tGoldrinnTheGreatWolf,\r\n\tImpulsiveTrickster,\r\n\tMechaJaraxxus,\r\n\tWhelpSmuggler,\r\n\tHunterOfGatherers,\r\n\tBlazingSkyfin,\r\n\tGeneralDrakkisath,\r\n\tSmolderwing,\r\n\tMisfitDragonling,\r\n\tKalecgosArcaneAspect,\r\n\tGreaseBot,\r\n\tClunkerJunker,\r\n\tKangorsApprentice,\r\n\tDeflectoBot,\r\n\tSwampstriker,\r\n\tMurky,\r\n\tOperaticBelcher,\r\n\tParchedWanderer,\r\n\tPrimalfinLookout,\r\n\tKingBagurgle,\r\n\tShellCollector,\r\n\tTunnelBlaster,\r\n\tLeeroyTheReckless,\r\n\tInterrogatorWhitemane,\r\n\tOozelingGladiator,\r\n\tRodeoPerformer,\r\n\tAssistantGuard,\r\n\tAridAtrocity,\r\n\tInspiringUnderdog,\r\n\tLightfangEnforcer,\r\n\tDefiantShipwright,\r\n\tPeggySturdybone,\r\n\tRapscallionRecruiter,\r\n\tLovesickBalladist,\r\n\tAdmiralElizaGoreblade,\r\n\tSkyPirateFlagbearer,\r\n\tSkyPirateFlagbearerEnchantment,\r\n\tCruiseController,\r\n\tRipsnarlCaptain,\r\n\tScallywag,\r\n\tRazorfenGeomancer,\r\n\tCharlga,\r\n\tGemSmuggler,\r\n\tBongoBopper,\r\n\tThreeLilQuilboar,\r\n\tAnubarakNerubianKing,\r\n\tNerubianDeathswarmer,\r\n\tSindoreiStraightShot,\r\n\tChampionOfThePrimus,\r\n\tMummifier,\r\n\tThunderingAbomination,\r\n\tPrizedPromoDrake,\r\n\tTransmutedBramblewitch,\r\n\tImposingPercussionist,\r\n];\r\n\r\nexport const cardMappings: { [cardId: string]: Card } = {};\r\nfor (const card of cards) {\r\n\tconst cardIds = card.cardIds ?? [];\r\n\tfor (const cardId of cardIds) {\r\n\t\tcardMappings[cardId] = card;\r\n\t}\r\n}\r\n"]}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpperHand = void 0;
|
|
4
4
|
const utils_1 = require("../../../services/utils");
|
|
5
|
+
const stats_1 = require("../../../simulation/stats");
|
|
5
6
|
exports.UpperHand = {
|
|
6
7
|
startOfCombat: (trinket, input) => {
|
|
7
8
|
if (!!input.opponentBoard.length) {
|
|
8
9
|
const target = (0, utils_1.pickRandom)(input.opponentBoard);
|
|
9
|
-
target.
|
|
10
|
-
target.maxHealth = 1;
|
|
10
|
+
(0, stats_1.setEntityStats)(target, target.attack, 1, input.opponentBoard, input.opponentEntity, input.gameState);
|
|
11
11
|
input.gameState.spectator.registerPowerTarget(input.playerEntity, target, input.opponentBoard, null, null);
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upper-hand.js","sourceRoot":"","sources":["../../../../src/cards/impl/bg-spell/upper-hand.ts"],"names":[],"mappings":";;;AACA,mDAAqD;
|
|
1
|
+
{"version":3,"file":"upper-hand.js","sourceRoot":"","sources":["../../../../src/cards/impl/bg-spell/upper-hand.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AAErD,qDAA2D;AAE9C,QAAA,SAAS,GAAG;IACxB,aAAa,EAAE,CAAC,OAAoB,EAAE,KAAe,EAAE,EAAE;QACxD,IAAI,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE;YACjC,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC/C,IAAA,sBAAc,EAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YACrG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC3G,OAAO,IAAI,CAAC;SACZ;IACF,CAAC;CACD,CAAC","sourcesContent":["import { BoardSecret } from '../../../board-secret';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { setEntityStats } from '../../../simulation/stats';\r\n\r\nexport const UpperHand = {\r\n\tstartOfCombat: (trinket: BoardSecret, input: SoCInput) => {\r\n\t\tif (!!input.opponentBoard.length) {\r\n\t\t\tconst target = pickRandom(input.opponentBoard);\r\n\t\t\tsetEntityStats(target, target.attack, 1, input.opponentBoard, input.opponentEntity, input.gameState);\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(input.playerEntity, target, input.opponentBoard, null, null);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t},\r\n};\r\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImposingPercussionist = void 0;
|
|
4
|
+
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
|
+
const cards_in_hand_1 = require("../../../simulation/cards-in-hand");
|
|
6
|
+
const damage_to_hero_1 = require("../../../simulation/damage-to-hero");
|
|
7
|
+
exports.ImposingPercussionist = {
|
|
8
|
+
cardIds: ["BG26_525", "BG26_525_G"],
|
|
9
|
+
battlecry: (minion, input) => {
|
|
10
|
+
const discover = input.gameState.cardsData.getRandomMinionForTribe(reference_data_1.Race.DEMON, input.hero.tavernTier);
|
|
11
|
+
(0, cards_in_hand_1.addCardsInHand)(input.hero, input.board, [discover], input.gameState);
|
|
12
|
+
(0, damage_to_hero_1.dealDamageToHero)(minion, input.hero, input.board, input.gameState.cardsData.getTavernLevel(discover), input.gameState);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=imposing-percussionist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imposing-percussionist.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/imposing-percussionist.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,qEAAmE;AACnE,uEAAsE;AAGzD,QAAA,qBAAqB,GAAkB;IACnD,OAAO,EAAE,0BAAkF;IAC3F,SAAS,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;QACzD,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,uBAAuB,CAAC,qBAAI,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtG,IAAA,8BAAc,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACrE,IAAA,iCAAgB,EACf,MAAM,EACN,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,EAClD,KAAK,CAAC,SAAS,CACf,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { BattlecryInput } from '../../../simulation/battlecries';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { dealDamageToHero } from '../../../simulation/damage-to-hero';\r\nimport { BattlecryCard } from '../../card.interface';\r\n\r\nexport const ImposingPercussionist: BattlecryCard = {\r\n\tcardIds: [CardIds.ImposingPercussionist_BG26_525, CardIds.ImposingPercussionist_BG26_525_G],\r\n\tbattlecry: (minion: BoardEntity, input: BattlecryInput) => {\r\n\t\tconst discover = input.gameState.cardsData.getRandomMinionForTribe(Race.DEMON, input.hero.tavernTier);\r\n\t\taddCardsInHand(input.hero, input.board, [discover], input.gameState);\r\n\t\tdealDamageToHero(\r\n\t\t\tminion,\r\n\t\t\tinput.hero,\r\n\t\t\tinput.board,\r\n\t\t\tinput.gameState.cardsData.getTavernLevel(discover),\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t},\r\n};\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DeathrattleEffectCard
|
|
2
|
-
export declare const MutatedLasher: DeathrattleEffectCard
|
|
1
|
+
import { DeathrattleEffectCard } from '../../card.interface';
|
|
2
|
+
export declare const MutatedLasher: DeathrattleEffectCard;
|
|
@@ -15,12 +15,5 @@ exports.MutatedLasher = {
|
|
|
15
15
|
input.gameState.spectator.registerPowerTarget(minion, e, input.boardWithDeadEntity, input.boardWithDeadEntityHero, input.otherBoardHero);
|
|
16
16
|
});
|
|
17
17
|
},
|
|
18
|
-
onOtherSpawnedAura: (minion, input) => {
|
|
19
|
-
const mult = minion.cardId === "BG31_852_G" ? 2 : 1;
|
|
20
|
-
if (input.gameState.cardsData.getTavernLevel(input.spawned.cardId) % 2 === 1) {
|
|
21
|
-
(0, stats_1.modifyStats)(input.spawned, 2 * mult, 3 * mult, input.board, input.hero, input.gameState);
|
|
22
|
-
input.gameState.spectator.registerPowerTarget(minion, input.spawned, input.board, input.hero, null);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
18
|
};
|
|
26
19
|
//# sourceMappingURL=mutated-lasher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutated-lasher.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/mutated-lasher.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"mutated-lasher.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/mutated-lasher.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,aAAa,GAA0B;IACnD,OAAO,EAAE,0BAAkE;IAC3E,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC5E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAqC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,uBAAuB,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,uBAAuB,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7E,KAAK,CAAC,mBAAmB;aACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aAC3E,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,IAAA,mBAAW,EACV,CAAC,EACD,CAAC,GAAG,IAAI,EACR,CAAC,GAAG,IAAI,EACR,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,SAAS,CACf,CAAC;YACF,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,MAAM,EACN,CAAC,EACD,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,CACpB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { DeathrattleEffectCard } from '../../card.interface';\r\n\r\nexport const MutatedLasher: DeathrattleEffectCard = {\r\n\tcardIds: [CardIds.MutatedLasher_BG31_852, CardIds.MutatedLasher_BG31_852_G],\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.MutatedLasher_BG31_852_G ? 2 : 1;\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.MutatedLasherAttackBuff += 2 * mult;\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.MutatedLasherHealthBuff += 3 * mult;\r\n\t\tinput.boardWithDeadEntity\r\n\t\t\t.filter((e) => input.gameState.cardsData.getTavernLevel(e.cardId) % 2 === 1)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\te,\r\n\t\t\t\t\t2 * mult,\r\n\t\t\t\t\t3 * mult,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t},\r\n};\r\n"]}
|
|
@@ -9,6 +9,7 @@ const utils_2 = require("../../../utils");
|
|
|
9
9
|
exports.RylakMetalhead = {
|
|
10
10
|
cardIds: ["BG26_801", "BG26_801_G"],
|
|
11
11
|
deathrattleEffect: (minion, input) => {
|
|
12
|
+
const debug = (0, attack_1.getNeighbours)(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight).map((e) => input.gameState.allCards.getCard(e.cardId).name);
|
|
12
13
|
const allNeighbours = (0, attack_1.getNeighbours)(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight).filter((e) => (0, utils_2.hasMechanic)(input.gameState.allCards.getCard(e.cardId), reference_data_1.GameTag[reference_data_1.GameTag.BATTLECRY]));
|
|
13
14
|
const neighbours = minion.cardId === "BG26_801_G"
|
|
14
15
|
? allNeighbours
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rylak-metalhead.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/rylak-metalhead.ts"],"names":[],"mappings":";;;AAAA,iEAAgE;AAEhE,mDAAqD;AACrD,uDAA2D;AAC3D,iEAAmE;AAEnE,0CAA6C;AAGhC,QAAA,cAAc,GAA0B;IACpD,OAAO,EAAE,0BAAoE;IAC7E,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC5E,MAAM,aAAa,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAC5G,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,wBAAO,CAAC,wBAAO,CAAC,SAAS,CAAC,CAAC,CAC1F,CAAC;QACF,MAAM,UAAU,GACf,MAAM,CAAC,MAAM,iBAAsC;YAClD,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YACnC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,MAAM,EACN,SAAS,EACT,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,CACpB,CAAC;YACF,IAAA,8BAAgB,EACf,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,SAAS,EACT,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;SACF;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, GameTag } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { getNeighbours } from '../../../simulation/attack';\r\nimport { triggerBattlecry } from '../../../simulation/battlecries';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { hasMechanic } from '../../../utils';\r\nimport { DeathrattleEffectCard } from '../../card.interface';\r\n\r\nexport const RylakMetalhead: DeathrattleEffectCard = {\r\n\tcardIds: [CardIds.RylakMetalhead_BG26_801, CardIds.RylakMetalhead_BG26_801_G],\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst allNeighbours = getNeighbours(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight).filter(\r\n\t\t\t(e) => hasMechanic(input.gameState.allCards.getCard(e.cardId), GameTag[GameTag.BATTLECRY]),\r\n\t\t);\r\n\t\tconst neighbours =\r\n\t\t\tminion.cardId === CardIds.RylakMetalhead_BG26_801_G\r\n\t\t\t\t? allNeighbours\r\n\t\t\t\t: [pickRandom(allNeighbours)].filter((e) => !!e);\r\n\t\tfor (const neighbour of neighbours) {\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\tminion,\r\n\t\t\t\tneighbour,\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tinput.otherBoardHero,\r\n\t\t\t);\r\n\t\t\ttriggerBattlecry(\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tneighbour,\r\n\t\t\t\tinput.otherBoard,\r\n\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"rylak-metalhead.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/rylak-metalhead.ts"],"names":[],"mappings":";;;AAAA,iEAAgE;AAEhE,mDAAqD;AACrD,uDAA2D;AAC3D,iEAAmE;AAEnE,0CAA6C;AAGhC,QAAA,cAAc,GAA0B;IACpD,OAAO,EAAE,0BAAoE;IAC7E,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC5E,MAAM,KAAK,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,GAAG,CACjG,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CACtD,CAAC;QACF,MAAM,aAAa,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAC5G,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,wBAAO,CAAC,wBAAO,CAAC,SAAS,CAAC,CAAC,CAC1F,CAAC;QACF,MAAM,UAAU,GACf,MAAM,CAAC,MAAM,iBAAsC;YAClD,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YACnC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAC5C,MAAM,EACN,SAAS,EACT,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,cAAc,CACpB,CAAC;YACF,IAAA,8BAAgB,EACf,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,SAAS,EACT,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,SAAS,CACf,CAAC;SACF;IACF,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, GameTag } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { getNeighbours } from '../../../simulation/attack';\r\nimport { triggerBattlecry } from '../../../simulation/battlecries';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { hasMechanic } from '../../../utils';\r\nimport { DeathrattleEffectCard } from '../../card.interface';\r\n\r\nexport const RylakMetalhead: DeathrattleEffectCard = {\r\n\tcardIds: [CardIds.RylakMetalhead_BG26_801, CardIds.RylakMetalhead_BG26_801_G],\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst debug = getNeighbours(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight).map(\r\n\t\t\t(e) => input.gameState.allCards.getCard(e.cardId).name,\r\n\t\t);\r\n\t\tconst allNeighbours = getNeighbours(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight).filter(\r\n\t\t\t(e) => hasMechanic(input.gameState.allCards.getCard(e.cardId), GameTag[GameTag.BATTLECRY]),\r\n\t\t);\r\n\t\tconst neighbours =\r\n\t\t\tminion.cardId === CardIds.RylakMetalhead_BG26_801_G\r\n\t\t\t\t? allNeighbours\r\n\t\t\t\t: [pickRandom(allNeighbours)].filter((e) => !!e);\r\n\t\tfor (const neighbour of neighbours) {\r\n\t\t\tinput.gameState.spectator.registerPowerTarget(\r\n\t\t\t\tminion,\r\n\t\t\t\tneighbour,\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tinput.otherBoardHero,\r\n\t\t\t);\r\n\t\t\ttriggerBattlecry(\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tneighbour,\r\n\t\t\t\tinput.otherBoard,\r\n\t\t\t\tinput.otherBoardHero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UltravioletAscendant = void 0;
|
|
4
|
+
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
|
+
const stats_1 = require("../../../simulation/stats");
|
|
4
6
|
const utils_1 = require("../../../utils");
|
|
5
7
|
exports.UltravioletAscendant = {
|
|
6
8
|
cardIds: ["BG31_810", "BG31_810_G"],
|
|
7
9
|
startOfCombat: (minion, input) => {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
(0, utils_1.
|
|
10
|
+
const attackBuff = minion.scriptDataNum1;
|
|
11
|
+
const healthBuff = minion.scriptDataNum2;
|
|
12
|
+
for (const target of input.playerBoard.filter((e) => (0, utils_1.hasCorrectTribe)(e, input.playerEntity, reference_data_1.Race.ELEMENTAL, input.gameState.allCards))) {
|
|
13
|
+
(0, stats_1.modifyStats)(target, attackBuff, healthBuff, input.playerBoard, input.playerEntity, input.gameState);
|
|
14
|
+
}
|
|
11
15
|
return true;
|
|
12
16
|
},
|
|
13
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ultraviolet-ascendant.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/ultraviolet-ascendant.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ultraviolet-ascendant.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/ultraviolet-ascendant.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,qDAAwD;AACxD,0CAAiD;AAGpC,QAAA,oBAAoB,GAAsB;IACtD,OAAO,EAAE,0BAAgF;IACzF,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;QACvD,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC;QACzC,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC;QAGzC,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACnD,IAAA,uBAAe,EAAC,CAAC,EAAE,KAAK,CAAC,YAAY,EAAE,qBAAI,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAChF,EAAE;YACF,IAAA,mBAAW,EAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SACpG;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { StartOfCombatCard } from '../../card.interface';\r\n\r\nexport const UltravioletAscendant: StartOfCombatCard = {\r\n\tcardIds: [CardIds.UltravioletAscendant_BG31_810, CardIds.UltravioletAscendant_BG31_810_G],\r\n\tstartOfCombat: (minion: BoardEntity, input: SoCInput) => {\r\n\t\tconst attackBuff = minion.scriptDataNum1;\r\n\t\tconst healthBuff = minion.scriptDataNum2;\r\n\t\t// Integrated in scriptDataNum1 already\r\n\t\t// const mult = minion.cardId === CardIds.UltravioletAscendant_BG31_810_G ? 2 : 1;\r\n\t\tfor (const target of input.playerBoard.filter((e) =>\r\n\t\t\thasCorrectTribe(e, input.playerEntity, Race.ELEMENTAL, input.gameState.allCards),\r\n\t\t)) {\r\n\t\t\tmodifyStats(target, attackBuff, healthBuff, input.playerBoard, input.playerEntity, input.gameState);\r\n\t\t}\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
|
package/dist/input-sanitation.js
CHANGED
|
@@ -67,6 +67,7 @@ const buildFinalInputForPlayer = (playerInfo, isPlayer, cards, cardsData, entity
|
|
|
67
67
|
? (_m = (_l = playerInfo.player.questRewardEntities) === null || _l === void 0 ? void 0 : _l[0]) === null || _m === void 0 ? void 0 : _m.cardId
|
|
68
68
|
: null)) !== null && _o !== void 0 ? _o : playerInfo.player.heroPowerId;
|
|
69
69
|
playerInfo.player.cardId = isGhost ? "TB_BaconShop_HERO_KelThuzad" : playerInfo.player.cardId;
|
|
70
|
+
playerInfo.player.hpLeft = Math.max(1, playerInfo.player.hpLeft);
|
|
70
71
|
(0, auras_1.setMissingAuras)(board, playerInfo.player, cards);
|
|
71
72
|
(0, auras_1.setImplicitDataHero)(playerInfo.player, cardsData, isPlayer, entityIdContainer);
|
|
72
73
|
return { board, hand, player: playerInfo.player };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-sanitation.js","sourceRoot":"","sources":["../src/input-sanitation.ts"],"names":[],"mappings":";;;AAAA,iEAA6F;AAM7F,8CAA0E;AA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CAAC,mCAAI,EAAE,CAAC;IAE7G,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, normalizeHeroCardId } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { fixEnchantments } from './simulation/enchantments';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nexport const buildFinalInput = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): BgsBattleInfo => {\r\n\tconst entityIdContainer = { entityId: 999_999_999 };\r\n\r\n\tconst {\r\n\t\tboard: playerBoard,\r\n\t\thand: playerHand,\r\n\t\tplayer: playerEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.playerBoard, true, cards, cardsData, entityIdContainer);\r\n\tconst {\r\n\t\tboard: playerTeammateBoard,\r\n\t\thand: playerTeammateHand,\r\n\t\tplayer: playerTeammateEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.playerTeammateBoard, true, cards, cardsData, entityIdContainer);\r\n\r\n\tconst {\r\n\t\tboard: opponentBoard,\r\n\t\thand: opponentHand,\r\n\t\tplayer: opponentEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.opponentBoard, false, cards, cardsData, entityIdContainer);\r\n\tconst {\r\n\t\tboard: opponentTeammateBoard,\r\n\t\thand: opponentTeammateHand,\r\n\t\tplayer: opponentTeammateEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.opponentTeammateBoard, false, cards, cardsData, entityIdContainer);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerEntity,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tplayerTeammateBoard: !!playerTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: playerTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...playerTeammateEntity,\r\n\t\t\t\t\t\thand: playerTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentEntity,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentTeammateBoard: !!opponentTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: opponentTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...opponentTeammateEntity,\r\n\t\t\t\t\t\thand: opponentTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\tgameState: battleInput.gameState,\r\n\t} as BgsBattleInfo;\r\n\treturn inputReady;\r\n};\r\n\r\nconst buildFinalInputForPlayer = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tentityIdContainer: { entityId: number },\r\n): { board: BoardEntity[]; hand: BoardEntity[]; player: BgsPlayerEntity } => {\r\n\tif (!playerInfo) {\r\n\t\treturn { board: [], hand: [], player: null };\r\n\t}\r\n\r\n\tconst { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);\r\n\tconst isGhost = playerInfo.player?.hpLeft != null && playerInfo.player.hpLeft <= 0;\r\n\tplayerInfo.player.secrets = (playerInfo.player.secrets ?? playerInfo.secrets)?.filter((e) => !!e?.cardId) ?? [];\r\n\t// Add the scriptDataNum1 only on the start of combat phase, so that it doesn't trigger too soon\r\n\tplayerInfo.player.secrets.forEach((secret) => (secret.scriptDataNum1 = 0));\r\n\t// Trinkets don't seem to trigger when facing the ghost\r\n\t// http://replays.firestoneapp.com/?reviewId=4ad32e03-2620-4fb1-8b43-cad55afd30fc&turn=27&action=2\r\n\t// One of the trinkets is Blood Golem Sticker, and no Blood Golem is summoned\r\n\t// Looks like that's not always the case:\r\n\t// http://replays.firestoneapp.com/?reviewId=9958e8d3-4388-4e6f-9b36-35f3a08be2f6&turn=25&action=4\r\n\t// playerInfo.player.trinkets = isGhost ? [] : playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? [];\r\n\tplayerInfo.player.trinkets = (playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? []).sort(\r\n\t\t(a, b) => a.entityId - b.entityId,\r\n\t);\r\n\tplayerInfo.player.friendly = isPlayer;\r\n\tplayerInfo.player.globalInfo = playerInfo.player.globalInfo ?? {};\r\n\tplayerInfo.player.globalInfo.PirateAttackBonus = playerInfo.player.globalInfo.PirateAttackBonus ?? 0;\r\n\tplayerInfo.player.heroPowerId =\r\n\t\tplayerInfo.player.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t\t(normalizeHeroCardId(playerInfo.player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t\t\t? playerInfo.player.questRewardEntities?.[0]?.cardId\r\n\t\t\t: null) ??\r\n\t\tplayerInfo.player.heroPowerId;\r\n\tplayerInfo.player.cardId = isGhost ? CardIds.Kelthuzad_TB_BaconShop_HERO_KelThuzad : playerInfo.player.cardId;\r\n\t// When using the simulator, the aura is not applied when receiving the board state.\r\n\tsetMissingAuras(board, playerInfo.player, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, isPlayer, entityIdContainer);\r\n\treturn { board, hand, player: playerInfo.player };\r\n};\r\n\r\nconst buildFinalInputBoard = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n): { board: BoardEntity[]; hand: BoardEntity[] } => {\r\n\tconst board = playerInfo.board\r\n\t\t.map((entity) => fixEnchantments(entity, cards))\r\n\t\t.map((entity) => ({ ...entity, inInitialState: true }))\r\n\t\t.map((entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: isPlayer } as BoardEntity));\r\n\tconst hand =\r\n\t\tplayerInfo.player.hand\r\n\t\t\t?.map((entity) => ({ ...entity, inInitialState: true }))\r\n\t\t\t.map((entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: isPlayer } as BoardEntity)) ?? [];\r\n\r\n\treturn { board, hand };\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"input-sanitation.js","sourceRoot":"","sources":["../src/input-sanitation.ts"],"names":[],"mappings":";;;AAAA,iEAA6F;AAM7F,8CAA0E;AAC1E,4DAA4D;AAC5D,mCAA8C;AAEvC,MAAM,eAAe,GAAG,CAC9B,WAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACJ,EAAE;IAClB,MAAM,iBAAiB,GAAG,EAAE,QAAQ,EAAE,SAAW,EAAE,CAAC;IAEpD,MAAM,EACL,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GACpB,GAAG,wBAAwB,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IACjG,MAAM,EACL,KAAK,EAAE,mBAAmB,EAC1B,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,oBAAoB,GAC5B,GAAG,wBAAwB,CAAC,WAAW,CAAC,mBAAmB,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAEzG,MAAM,EACL,KAA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,KAAsB,EAC0B,EAAE;;IAClD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK;SAC5B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,8BAAe,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SAC/C,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;SACtD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAA,2BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAkB,CAAA,CAAC,CAAC;IACtG,MAAM,IAAI,GACT,MAAA,MAAA,UAAU,CAAC,MAAM,CAAC,IAAI,0CACnB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EACtD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAA,2BAAmB,EAAC,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAkB,CAAA,CAAC,mCAAI,EAAE,CAAC;IAE7G,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, normalizeHeroCardId } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { fixEnchantments } from './simulation/enchantments';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nexport const buildFinalInput = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): BgsBattleInfo => {\r\n\tconst entityIdContainer = { entityId: 999_999_999 };\r\n\r\n\tconst {\r\n\t\tboard: playerBoard,\r\n\t\thand: playerHand,\r\n\t\tplayer: playerEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.playerBoard, true, cards, cardsData, entityIdContainer);\r\n\tconst {\r\n\t\tboard: playerTeammateBoard,\r\n\t\thand: playerTeammateHand,\r\n\t\tplayer: playerTeammateEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.playerTeammateBoard, true, cards, cardsData, entityIdContainer);\r\n\r\n\tconst {\r\n\t\tboard: opponentBoard,\r\n\t\thand: opponentHand,\r\n\t\tplayer: opponentEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.opponentBoard, false, cards, cardsData, entityIdContainer);\r\n\tconst {\r\n\t\tboard: opponentTeammateBoard,\r\n\t\thand: opponentTeammateHand,\r\n\t\tplayer: opponentTeammateEntity,\r\n\t} = buildFinalInputForPlayer(battleInput.opponentTeammateBoard, false, cards, cardsData, entityIdContainer);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerEntity,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tplayerTeammateBoard: !!playerTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: playerTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...playerTeammateEntity,\r\n\t\t\t\t\t\thand: playerTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentEntity,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentTeammateBoard: !!opponentTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: opponentTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...opponentTeammateEntity,\r\n\t\t\t\t\t\thand: opponentTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\tgameState: battleInput.gameState,\r\n\t} as BgsBattleInfo;\r\n\treturn inputReady;\r\n};\r\n\r\nconst buildFinalInputForPlayer = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tentityIdContainer: { entityId: number },\r\n): { board: BoardEntity[]; hand: BoardEntity[]; player: BgsPlayerEntity } => {\r\n\tif (!playerInfo) {\r\n\t\treturn { board: [], hand: [], player: null };\r\n\t}\r\n\r\n\tconst { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);\r\n\tconst isGhost = playerInfo.player?.hpLeft != null && playerInfo.player.hpLeft <= 0;\r\n\tplayerInfo.player.secrets = (playerInfo.player.secrets ?? playerInfo.secrets)?.filter((e) => !!e?.cardId) ?? [];\r\n\t// Add the scriptDataNum1 only on the start of combat phase, so that it doesn't trigger too soon\r\n\tplayerInfo.player.secrets.forEach((secret) => (secret.scriptDataNum1 = 0));\r\n\t// Trinkets don't seem to trigger when facing the ghost\r\n\t// http://replays.firestoneapp.com/?reviewId=4ad32e03-2620-4fb1-8b43-cad55afd30fc&turn=27&action=2\r\n\t// One of the trinkets is Blood Golem Sticker, and no Blood Golem is summoned\r\n\t// Looks like that's not always the case:\r\n\t// http://replays.firestoneapp.com/?reviewId=9958e8d3-4388-4e6f-9b36-35f3a08be2f6&turn=25&action=4\r\n\t// playerInfo.player.trinkets = isGhost ? [] : playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? [];\r\n\tplayerInfo.player.trinkets = (playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? []).sort(\r\n\t\t(a, b) => a.entityId - b.entityId,\r\n\t);\r\n\tplayerInfo.player.friendly = isPlayer;\r\n\tplayerInfo.player.globalInfo = playerInfo.player.globalInfo ?? {};\r\n\tplayerInfo.player.globalInfo.PirateAttackBonus = playerInfo.player.globalInfo.PirateAttackBonus ?? 0;\r\n\tplayerInfo.player.heroPowerId =\r\n\t\tplayerInfo.player.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t\t(normalizeHeroCardId(playerInfo.player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t\t\t? playerInfo.player.questRewardEntities?.[0]?.cardId\r\n\t\t\t: null) ??\r\n\t\tplayerInfo.player.heroPowerId;\r\n\tplayerInfo.player.cardId = isGhost ? CardIds.Kelthuzad_TB_BaconShop_HERO_KelThuzad : playerInfo.player.cardId;\r\n\tplayerInfo.player.hpLeft = Math.max(1, playerInfo.player.hpLeft);\r\n\t// When using the simulator, the aura is not applied when receiving the board state.\r\n\tsetMissingAuras(board, playerInfo.player, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, cardsData, isPlayer, entityIdContainer);\r\n\treturn { board, hand, player: playerInfo.player };\r\n};\r\n\r\nconst buildFinalInputBoard = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n): { board: BoardEntity[]; hand: BoardEntity[] } => {\r\n\tconst board = playerInfo.board\r\n\t\t.map((entity) => fixEnchantments(entity, cards))\r\n\t\t.map((entity) => ({ ...entity, inInitialState: true }))\r\n\t\t.map((entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: isPlayer } as BoardEntity));\r\n\tconst hand =\r\n\t\tplayerInfo.player.hand\r\n\t\t\t?.map((entity) => ({ ...entity, inInitialState: true }))\r\n\t\t\t.map((entity) => ({ ...addImpliedMechanics(entity, cardsData), friendly: isPlayer } as BoardEntity)) ?? [];\r\n\r\n\treturn { board, hand };\r\n};\r\n"]}
|
|
@@ -199,7 +199,7 @@ const isValidDeathrattleEnchantment = (cardId) => {
|
|
|
199
199
|
}
|
|
200
200
|
if (validDeathrattleEnchantmentsFromMapping.length === 0) {
|
|
201
201
|
for (const cardImpl of Object.values(_card_mappings_1.cardMappings)) {
|
|
202
|
-
if ((0, card_interface_1.hasDeathrattleEnchantmentEffect)(cardImpl)) {
|
|
202
|
+
if ((0, card_interface_1.hasDeathrattleEnchantmentEffect)(cardImpl) || (0, card_interface_1.hasDeathrattleSpawnEnchantment)(cardImpl)) {
|
|
203
203
|
validDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AAExE,2DAAyE;AACzE,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA4C;AAC5C,yDAAqD;AAGrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;KACP;IAED,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IA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iB,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,uCAAuC,CAAC,MAAM,KAAK,CAAC,EAAE;QACzD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,6BAAY,CAAC,EAAE;YACnD,IAAI,IAAA,gDAA+B,EAAC,QAAQ,CAAC,EAAE;gBAC9C,uCAAuC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClE;SACD;KACD;IACD,OAAO,uCAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAZW,QAAA,6BAA6B,iCAYxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { hasDeathrattleEnchantmentEffect } from './cards/card.interface';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { cardMappings } from './cards/impl/_card-mappings';\r\nimport { cloneInput3 } from './input-clone';\r\nimport { buildFinalInput } from './input-sanitation';\r\nimport { SimulationResult } from './simulation-result';\r\nimport { FullGameState } from './simulation/internal-game-state';\r\nimport { SharedState } from './simulation/shared-state';\r\nimport { Simulator } from './simulation/simulator';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nlet globalCards = new AllCardsService();\r\n\r\nexport const assignCards = (cards: AllCardsService) => {\r\n\tglobalCards = cards;\r\n};\r\n\r\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\r\n// the more traditional callback-style handler.\r\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\r\nexport default async (event): Promise<any> => {\r\n\tif (!event.body?.length) {\r\n\t\tconsole.warn('missing event body', event);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\r\n\tconst cards = globalCards;\r\n\tawait cards.initializeCardsDb();\r\n\tconst cardsData = new CardsData(cards, false);\r\n\tcardsData.inititialize(\r\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\r\n\t\tbattleInput.gameState?.anomalies ?? [],\r\n\t);\r\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\r\n\r\n\t// Iterate through all intermediate results to reach the final result\r\n\tlet result = battleIterator.next();\r\n\twhile (!result.done) {\r\n\t\tresult = battleIterator.next();\r\n\t}\r\n\r\n\tconst simulationResult = result.value;\r\n\t// console.debug('simulationResult', simulationResult);\r\n\r\n\tconst response = {\r\n\t\tstatusCode: 200,\r\n\t\tisBase64Encoded: false,\r\n\t\tbody: JSON.stringify(simulationResult),\r\n\t};\r\n\treturn response;\r\n};\r\n\r\nexport const simulateBattle = function* (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): Generator<SimulationResult, SimulationResult, void> {\r\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator();\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\tif (hasDeathrattleEnchantmentEffect(cardImpl)) {\r\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\r\n};\r\n\r\n// const cleanEnchantmentsForEntity = (\r\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\r\n// \tentityIds: readonly number[],\r\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\r\n// \treturn enchantments.filter(\r\n// \t\t(enchant) =>\r\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\r\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\r\n// \t);\r\n// };\r\n"]}
|
|
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,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;KACP;IAED,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK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A8B,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\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\r\n\tconst start = Date.now();\r\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\r\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\r\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\r\n\tconst simulationResult: SimulationResult = {\r\n\t\twonLethal: 0,\r\n\t\twon: 0,\r\n\t\ttied: 0,\r\n\t\tlost: 0,\r\n\t\tlostLethal: 0,\r\n\t\tdamageWon: 0,\r\n\t\tdamageLost: 0,\r\n\t\twonLethalPercent: undefined,\r\n\t\twonPercent: undefined,\r\n\t\ttiedPercent: undefined,\r\n\t\tlostPercent: undefined,\r\n\t\tlostLethalPercent: undefined,\r\n\t\taverageDamageWon: undefined,\r\n\t\taverageDamageLost: undefined,\r\n\t};\r\n\r\n\tconst spectator = new Spectator();\r\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\r\n\t!battleInput.options?.skipInfoLogs && console.time('simulation');\r\n\tconst outcomes = {};\r\n\tfor (let i = 0; i < numberOfSimulations; i++) {\r\n\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\r\n\t\tconst gameState: FullGameState = {\r\n\t\t\tallCards: cards,\r\n\t\t\tcardsData: cardsData,\r\n\t\t\tspectator: spectator,\r\n\t\t\tsharedState: new SharedState(),\r\n\t\t\tcurrentTurn: input.gameState.currentTurn,\r\n\t\t\tvalidTribes: input.gameState.validTribes,\r\n\t\t\tanomalies: input.gameState.anomalies,\r\n\t\t\tgameState: {\r\n\t\t\t\tplayer: {\r\n\t\t\t\t\tplayer: input.playerBoard.player,\r\n\t\t\t\t\tboard: input.playerBoard.board,\r\n\t\t\t\t\tteammate: input.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponent: {\r\n\t\t\t\t\tplayer: input.opponentBoard.player,\r\n\t\t\t\t\tboard: input.opponentBoard.board,\r\n\t\t\t\t\tteammate: input.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\tplayerInitial: {\r\n\t\t\t\t\tplayer: inputClone.playerBoard.player,\r\n\t\t\t\t\tboard: inputClone.playerBoard.board,\r\n\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t\topponentInitial: {\r\n\t\t\t\t\tplayer: inputClone.opponentBoard.player,\r\n\t\t\t\t\tboard: inputClone.opponentBoard.board,\r\n\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t};\r\n\t\tconst simulator = new Simulator(gameState);\r\n\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\r\n\t\tif (Date.now() - start > maxAcceptableDuration) {\r\n\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\r\n\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (!battleResult) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tif (battleResult.result === 'won') {\r\n\t\t\tsimulationResult.won++;\r\n\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\r\n\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\r\n\t\t\t\tsimulationResult.wonLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'lost') {\r\n\t\t\tsimulationResult.lost++;\r\n\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\r\n\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\r\n\t\t\tif (\r\n\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\r\n\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\r\n\t\t\t) {\r\n\t\t\t\tsimulationResult.lostLethal++;\r\n\t\t\t}\r\n\t\t} else if (battleResult.result === 'tied') {\r\n\t\t\tsimulationResult.tied++;\r\n\t\t}\r\n\t\tspectator.commitBattleResult(battleResult.result);\r\n\r\n\t\t// Yield intermediate result every 200 iterations\r\n\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\r\n\t\t\tupdateSimulationResult(simulationResult, inputReady);\r\n\t\t\tyield simulationResult;\r\n\t\t}\r\n\t}\r\n\tupdateSimulationResult(simulationResult, inputReady);\r\n\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\r\n\tspectator.prune();\r\n\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples();\r\n\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\r\n\treturn simulationResult;\r\n};\r\n\r\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo) => {\r\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\r\n\tsimulationResult.wonPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\r\n\t\tsimulationResult.won,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.wonLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.wonLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\r\n\t\tsimulationResult.lost,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.lostLethalPercent = checkRounding(\r\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\r\n\t\tsimulationResult.lostLethal,\r\n\t\ttotalMatches,\r\n\t);\r\n\tsimulationResult.tiedPercent = checkRounding(\r\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\r\n\t\tsimulationResult.tied,\r\n\t\ttotalMatches,\r\n\t);\r\n\r\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\r\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\r\n\tsimulationResult.averageDamageWon = simulationResult.won ? simulationResult.damageWon / simulationResult.won : 0;\r\n\tsimulationResult.averageDamageLost = simulationResult.lost\r\n\t\t? simulationResult.damageLost / simulationResult.lost\r\n\t\t: 0;\r\n\tif (\r\n\t\tsimulationResult.averageDamageWon > 0 &&\r\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage won issue');\r\n\t}\r\n\tif (\r\n\t\tsimulationResult.averageDamageLost > 0 &&\r\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\r\n\t) {\r\n\t\tconsole.warn('average damage lost issue');\r\n\t}\r\n};\r\n\r\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\r\n\tif (roundedValue === 0 && initialValue !== 0) {\r\n\t\treturn 0.01;\r\n\t}\r\n\tif (roundedValue === 100 && initialValue !== totalValue) {\r\n\t\treturn 99.9;\r\n\t}\r\n\treturn roundedValue;\r\n};\r\n\r\n// Used when triggering random deathrattles\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\r\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\r\n\tCardIds.LivingSpores_LivingSporesEnchantment,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\r\n\tCardIds.Sneed_SneedsReplicator,\r\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\r\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\r\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\r\n\tCardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\tCardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\r\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\r\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\r\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\r\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\r\n];\r\nconst validDeathrattleEnchantmentsFromMapping = [];\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\tif (hasDeathrattleEnchantmentEffect(cardImpl) || 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"]}
|
|
@@ -3,7 +3,7 @@ import { BoardEntity } from '../board-entity';
|
|
|
3
3
|
import { FullGameState } from './internal-game-state';
|
|
4
4
|
export declare const addMinionsToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, index: number, minionsToAdd: readonly BoardEntity[], gameState: FullGameState) => void;
|
|
5
5
|
export declare const addMinionToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, index: number, minionToAdd: BoardEntity, gameState: FullGameState, performAfterSpawnEffects?: boolean, applySelfAuras?: boolean) => void;
|
|
6
|
-
export declare const handleAddedMinionAuraEffect: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, spawned: BoardEntity, gameState: FullGameState, applySelfAuras?: boolean) => void;
|
|
6
|
+
export declare const handleAddedMinionAuraEffect: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, spawned: BoardEntity, gameState: FullGameState, applySelfAuras?: boolean, isActuallySpawned?: boolean) => void;
|
|
7
7
|
export declare const applyAurasToSelf: (spawned: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
8
8
|
export declare const removeAurasFromSelf: (entity: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
9
9
|
export declare const onMinionSummoned: (hero: BgsPlayerEntity, board: BoardEntity[], gameState: FullGameState) => void;
|
|
@@ -108,7 +108,7 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, gameState) => {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
const handleAddedMinionAuraEffect = (board, boardHero, otherHero, spawned, gameState, applySelfAuras = true) => {
|
|
111
|
+
const handleAddedMinionAuraEffect = (board, boardHero, otherHero, spawned, gameState, applySelfAuras = true, isActuallySpawned = true) => {
|
|
112
112
|
var _a, _b, _c, _d;
|
|
113
113
|
switch (boardHero.heroPowerId) {
|
|
114
114
|
case "TB_BaconShop_HP_107":
|
|
@@ -128,33 +128,35 @@ const handleAddedMinionAuraEffect = (board, boardHero, otherHero, spawned, gameS
|
|
|
128
128
|
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;
|
|
129
129
|
(0, stats_1.modifyStats)(spawned, tumblingDisasterBonus, tumblingDisasterBonus, board, boardHero, gameState);
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
if (isActuallySpawned) {
|
|
132
|
+
for (const trinket of boardHero.trinkets) {
|
|
133
|
+
switch (trinket.cardId) {
|
|
134
|
+
case "BG30_MagicItem_978":
|
|
135
|
+
if ((0, utils_2.hasCorrectTribe)(spawned, boardHero, reference_data_1.Race.MECH, gameState.allCards)) {
|
|
136
|
+
const target = (0, utils_1.pickRandom)(board.filter((e) => !e.divineShield));
|
|
137
|
+
if (!!target) {
|
|
138
|
+
(0, divine_shield_1.updateDivineShield)(target, board, boardHero, otherHero, true, gameState);
|
|
139
|
+
}
|
|
138
140
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
141
|
+
break;
|
|
142
|
+
case "BG30_MagicItem_822":
|
|
143
|
+
case "BG30_MagicItem_822t2":
|
|
144
|
+
if (!trinket.rememberedMinion) {
|
|
145
|
+
trinket.rememberedMinion = (0, utils_2.copyEntity)(spawned);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
case "BG30_MagicItem_886":
|
|
149
|
+
if (trinket.scriptDataNum1 > 0 && !spawned.divineShield) {
|
|
150
|
+
(0, divine_shield_1.updateDivineShield)(spawned, board, boardHero, otherHero, true, gameState);
|
|
151
|
+
trinket.scriptDataNum1--;
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
const cardIds = [spawned.cardId, ...((_d = spawned.additionalCards) !== null && _d !== void 0 ? _d : [])];
|
|
156
158
|
for (const spawnedCardId of cardIds) {
|
|
157
|
-
handleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, gameState);
|
|
159
|
+
handleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, gameState, isActuallySpawned);
|
|
158
160
|
}
|
|
159
161
|
if (applySelfAuras) {
|
|
160
162
|
(0, exports.applyAurasToSelf)(spawned, board, boardHero, gameState);
|
|
@@ -162,7 +164,7 @@ const handleAddedMinionAuraEffect = (board, boardHero, otherHero, spawned, gameS
|
|
|
162
164
|
};
|
|
163
165
|
exports.handleAddedMinionAuraEffect = handleAddedMinionAuraEffect;
|
|
164
166
|
const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
|
|
165
|
-
var _a, _b;
|
|
167
|
+
var _a, _b, _c, _d;
|
|
166
168
|
if (!!((_a = boardHero.questRewards) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
167
169
|
for (const quest of boardHero.questRewards) {
|
|
168
170
|
switch (quest) {
|
|
@@ -223,6 +225,11 @@ const applyAurasToSelf = (spawned, board, boardHero, gameState) => {
|
|
|
223
225
|
gameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);
|
|
224
226
|
}
|
|
225
227
|
}
|
|
228
|
+
if (gameState.cardsData.getTavernLevel(spawned.cardId) % 2 === 1) {
|
|
229
|
+
const atkBuff = (_c = boardHero.globalInfo.MutatedLasherAttackBuff) !== null && _c !== void 0 ? _c : 0;
|
|
230
|
+
const healthBuff = (_d = boardHero.globalInfo.MutatedLasherHealthBuff) !== null && _d !== void 0 ? _d : 0;
|
|
231
|
+
(0, stats_1.modifyStats)(spawned, atkBuff, healthBuff, board, boardHero, gameState);
|
|
232
|
+
}
|
|
226
233
|
for (const entity of board) {
|
|
227
234
|
const onOtherSpawnedImpl = _card_mappings_1.cardMappings[entity.cardId];
|
|
228
235
|
if ((0, card_interface_1.hasOnOtherAuraSpawned)(onOtherSpawnedImpl)) {
|
|
@@ -465,7 +472,7 @@ const removeAurasFromSelf = (entity, board, boardHero, gameState) => {
|
|
|
465
472
|
}
|
|
466
473
|
};
|
|
467
474
|
exports.removeAurasFromSelf = removeAurasFromSelf;
|
|
468
|
-
const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, gameState) => {
|
|
475
|
+
const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, gameState, isActuallySpawned = true) => {
|
|
469
476
|
switch (spawnedCardId) {
|
|
470
477
|
case "BG_NEW1_027":
|
|
471
478
|
case "TB_BaconUps_136":
|
|
@@ -514,7 +521,9 @@ const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, g
|
|
|
514
521
|
break;
|
|
515
522
|
case "BG_TTN_401":
|
|
516
523
|
case "BG_TTN_401_G":
|
|
517
|
-
|
|
524
|
+
if (isActuallySpawned) {
|
|
525
|
+
boardHero.globalInfo.AstralAutomatonsSummonedThisGame++;
|
|
526
|
+
}
|
|
518
527
|
board
|
|
519
528
|
.filter((e) => e.entityId !== spawned.entityId)
|
|
520
529
|
.filter((e) => e.cardId === "BG_TTN_401" ||
|