@firestone-hs/simulate-bgs-battle 1.1.740 → 1.1.742
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 +4 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/bg-spell/mighty-dragonbreath.js +1 -1
- package/dist/cards/impl/bg-spell/mighty-dragonbreath.js.map +1 -1
- package/dist/cards/impl/bg-spell/misplaced-tea-set.js +1 -1
- package/dist/cards/impl/bg-spell/misplaced-tea-set.js.map +1 -1
- package/dist/cards/impl/enchantments/admiration.js +1 -1
- package/dist/cards/impl/enchantments/admiration.js.map +1 -1
- package/dist/cards/impl/minion/boom-in-a-box.js.map +1 -1
- package/dist/cards/impl/minion/drustfallen-butcher.js +1 -1
- package/dist/cards/impl/minion/drustfallen-butcher.js.map +1 -1
- package/dist/cards/impl/minion/dustbone-devastator.js +1 -1
- package/dist/cards/impl/minion/dustbone-devastator.js.map +1 -1
- package/dist/cards/impl/minion/eredar-escapist.d.ts +2 -0
- package/dist/cards/impl/minion/eredar-escapist.js +38 -0
- package/dist/cards/impl/minion/eredar-escapist.js.map +1 -0
- package/dist/cards/impl/minion/gentle-djinni.js.map +1 -1
- package/dist/cards/impl/minion/glambot.js +1 -1
- package/dist/cards/impl/minion/glambot.js.map +1 -1
- package/dist/cards/impl/minion/imp-lusionist.js +1 -1
- package/dist/cards/impl/minion/imp-lusionist.js.map +1 -1
- package/dist/cards/impl/minion/mama-mrrglton.js +1 -1
- package/dist/cards/impl/minion/mama-mrrglton.js.map +1 -1
- package/dist/cards/impl/minion/maritime-extortionist.js +7 -4
- package/dist/cards/impl/minion/maritime-extortionist.js.map +1 -1
- package/dist/cards/impl/minion/moat-custodian.js +1 -1
- package/dist/cards/impl/minion/moat-custodian.js.map +1 -1
- package/dist/cards/impl/minion/motley-phalanx.js +1 -1
- package/dist/cards/impl/minion/motley-phalanx.js.map +1 -1
- package/dist/cards/impl/minion/papa-mrrglton.js +1 -1
- package/dist/cards/impl/minion/papa-mrrglton.js.map +1 -1
- package/dist/cards/impl/minion/ravaging-scorpid.js +1 -1
- package/dist/cards/impl/minion/ravaging-scorpid.js.map +1 -1
- package/dist/cards/impl/minion/runic-arcanist.js +1 -1
- package/dist/cards/impl/minion/runic-arcanist.js.map +1 -1
- package/dist/cards/impl/minion/sand-swirler.js +2 -2
- package/dist/cards/impl/minion/sand-swirler.js.map +1 -1
- package/dist/cards/impl/minion/showy-cyclist.js +11 -7
- package/dist/cards/impl/minion/showy-cyclist.js.map +1 -1
- package/dist/cards/impl/minion/tasty-lobster.js +1 -1
- package/dist/cards/impl/minion/tasty-lobster.js.map +1 -1
- package/dist/cards/impl/minion/the-last-one-standing.js +1 -1
- package/dist/cards/impl/minion/the-last-one-standing.js.map +1 -1
- package/dist/cards/impl/minion/tichondrius.js +1 -1
- package/dist/cards/impl/minion/tichondrius.js.map +1 -1
- package/dist/cards/impl/minion/torrential-ruiner.js +3 -2
- package/dist/cards/impl/minion/torrential-ruiner.js.map +1 -1
- package/dist/cards/impl/minion/treasure-parrot.d.ts +2 -0
- package/dist/cards/impl/minion/treasure-parrot.js +24 -0
- package/dist/cards/impl/minion/treasure-parrot.js.map +1 -0
- package/dist/cards/impl/minion/twilight-tidehunter.js +1 -1
- package/dist/cards/impl/minion/twilight-tidehunter.js.map +1 -1
- package/dist/cards/impl/minion/wolf-pup.js +1 -1
- package/dist/cards/impl/minion/wolf-pup.js.map +1 -1
- package/dist/cards/impl/spellcraft/thaumaturgy.js +1 -1
- package/dist/cards/impl/spellcraft/thaumaturgy.js.map +1 -1
- package/dist/cards/impl/trinket/dragon-skull.js +1 -1
- package/dist/cards/impl/trinket/dragon-skull.js.map +1 -1
- package/dist/cards/impl/trinket/mama-bear-sticker.js +1 -1
- package/dist/cards/impl/trinket/mama-bear-sticker.js.map +1 -1
- package/dist/input-sanitation.js +3 -5
- package/dist/input-sanitation.js.map +1 -1
- package/dist/simulation/attack.js +3 -0
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/auras.d.ts +1 -1
- package/dist/simulation/auras.js +66 -53
- package/dist/simulation/auras.js.map +1 -1
- package/dist/simulation/deathrattle-utils.js +6 -3
- package/dist/simulation/deathrattle-utils.js.map +1 -1
- package/dist/simulation/stats.js +3 -2
- package/dist/simulation/stats.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +5 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAAqE;AAIrE,iDAAoD;AAEpD,oCAAgE;AAGzD,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA4B,EAC5B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,IAAA,+BAAuB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,6BAAqB,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,qBAAqB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;;IAC/F,KAAK,MAAM,OAAO,IAAI,MAAA,SAAS,CAAC,QAAQ,mCAAI,EAAE,EAAE;KAoB/C;AACF,CAAC,CAAC;AAtBW,QAAA,qBAAqB,yBAsBhC;AAEK,MAAM,uBAAuB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAQ,EAAE;IACjG,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,UAAU,EAAE;QAC7C,IAAI,SAAS,CAAC,MAAM,sBAA0B,EAAE;YAC/C,KAAK;iBACH,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,CAAC,YAAY,C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OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;KACjF;IACD,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACnE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tconst pirates: BoardEntity[] = [];\r\n\tconst murlocs: BoardEntity[] = [];\r\n\tconst undead: BoardEntity[] = [];\r\n\tconst divineShielded: BoardEntity[] = [];\r\n\tfor (const e of board) {\r\n\t\tif (e.divineShield) {\r\n\t\t\tdivineShielded.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)) {\r\n\t\t\tpirates.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)) {\r\n\t\t\tmurlocs.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)) {\r\n\t\t\tundead.push(e);\r\n\t\t}\r\n\t}\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tmurlocs,\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tdivineShielded,\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? [])\r\n\t\t.map((trinket) => ({\r\n\t\t\t...trinket,\r\n\t\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\t\t// We don't want to use the default value is the value from the game state is 0\r\n\t\t\t// In that case, we probably want to use the ChargesLeft mechanism\r\n\t\t\tscriptDataNum1: trinket.scriptDataNum1 ?? cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t\t}))\r\n\t\t.sort((a, b) => a.entityId - b.entityId);\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.EternalKnightAttackBuff = hero.globalInfo.EternalKnightAttackBuff ?? 0;\r\n\thero.globalInfo.EternalKnightHealthBuff = hero.globalInfo.EternalKnightHealthBuff ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.AstralAutomatonsSummonedThisGame = hero.globalInfo.AstralAutomatonsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.TastyLobstersBuff = hero.globalInfo.TastyLobstersBuff ?? 0;\r\n\thero.globalInfo.GoldenMinionsPlayedThisGame = hero.globalInfo.GoldenMinionsPlayedThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, other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OAAO,CAAC,EAAE;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;QACjF,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;KAC3F;AACF,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateStealth } from '../keywords/stealth';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { addImpliedMechanics, hasCorrectTribe } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, boardHero, anomalies, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero);\r\n\tsetMissingTrinketAura(board, boardHero);\r\n};\r\n\r\nexport const setMissingTrinketAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const trinket of boardHero.trinkets ?? []) {\r\n\t\t// switch (trinket.cardId) {\r\n\t\t// \tcase CardIds.WindrunnerNecklace_BG30_MagicItem_997:\r\n\t\t// \tcase CardIds.WindrunnerNecklace_WindrunnerNecklaceToken_BG30_MagicItem_997t:\r\n\t\t// \t\tconst enchantment =\r\n\t\t// \t\t\ttrinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997\r\n\t\t// \t\t\t\t? CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e\r\n\t\t// \t\t\t\t: CardIds.WindrunnerNecklace_RunningLikeTheWindEnchantment_BG30_MagicItem_997e2;\r\n\t\t// \t\tconst buff = trinket.cardId === CardIds.WindrunnerNecklace_BG30_MagicItem_997 ? 8 : 20;\r\n\t\t// \t\tconst target = board[0];\r\n\t\t// \t\tif (!!target && !target.enchantments?.find((e) => e.cardId === enchantment)) {\r\n\t\t// \t\t\ttarget.attack += buff;\r\n\t\t// \t\t\ttarget.enchantments.push({\r\n\t\t// \t\t\t\tcardId: enchantment,\r\n\t\t// \t\t\t\toriginEntityId: trinket.entityId,\r\n\t\t// \t\t\t\ttiming: 0,\r\n\t\t// \t\t\t});\r\n\t\t// \t\t}\r\n\t\t// \t\tbreak;\r\n\t\t// }\r\n\t}\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tif (heroPower.cardId === CardIds.TheSmokingGun) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t!e.enchantments.find(\r\n\t\t\t\t\t\t\t(ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 4;\r\n\t\t\t\t});\r\n\t\t}\r\n\t\tif (heroPower.cardId === CardIds.VolatileVenom) {\r\n\t\t\tboard\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment),\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += 7;\r\n\t\t\t\t\te.health += 7;\r\n\t\t\t\t\te.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tanomalies: readonly string[],\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tconst pirates: BoardEntity[] = [];\r\n\tconst murlocs: BoardEntity[] = [];\r\n\tconst undead: BoardEntity[] = [];\r\n\tconst divineShielded: BoardEntity[] = [];\r\n\tfor (const e of board) {\r\n\t\tif (e.divineShield) {\r\n\t\t\tdivineShielded.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.PIRATE, anomalies, allCards)) {\r\n\t\t\tpirates.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.MURLOC, anomalies, allCards)) {\r\n\t\t\tmurlocs.push(e);\r\n\t\t}\r\n\t\tif (hasCorrectTribe(e, boardHero, Race.UNDEAD, anomalies, allCards)) {\r\n\t\t\tundead.push(e);\r\n\t\t}\r\n\t}\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrVanillaEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tpirates,\r\n\t\tCardIds.SouthseaCaptainLegacy_TB_BaconUps_136,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantment,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tmurlocs,\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tdivineShielded,\r\n\t\tCardIds.CyborgDrake_BG25_043,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\tboardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tundead,\r\n\t\tCardIds.SoreLoser_BG27_030_G,\r\n\t\tCardIds.SoreLoser_NoImWinningEnchantment_BG27_030e,\r\n\t\t2 * boardHero.tavernTier,\r\n\t\t0,\r\n\t);\r\n};\r\n\r\nconst setMissingAura = (\r\n\tboard: BoardEntity[],\r\n\tminionCardId: string,\r\n\tenchantmentCardId: string,\r\n\tattack: number,\r\n\thealth: number,\r\n\tignoreSelf = true,\r\n\tallCards: AllCardsService = null,\r\n): void => {\r\n\tconst buffers = board.filter((e) => e.cardId === minionCardId);\r\n\tfor (const buffer of buffers) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === enchantmentCardId))\r\n\t\t\t.filter((e) => (ignoreSelf ? e.entityId !== buffer.entityId : true))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += attack;\r\n\t\t\t\te.health += health;\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (\r\n\thero: BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tisPlayer: boolean,\r\n\tentityIdContainer: { entityId: number },\r\n): void => {\r\n\tfor (const heroPower of hero.heroPowers) {\r\n\t\tconst avengeValue = cardsData.avengeValue(heroPower.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\theroPower.avengeCurrent = avengeValue - (heroPower.scoreValue2 ?? 0);\r\n\t\t\theroPower.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tif ((heroPower.info as BoardEntity)?.health) {\r\n\t\t\taddImpliedMechanics(heroPower.info as BoardEntity, cardsData);\r\n\t\t}\r\n\t}\r\n\t// Backward compatibility\r\n\tif (!!hero.questRewards?.length && !Array.isArray(hero.questRewards)) {\r\n\t\thero.questRewards = [hero.questRewards as any];\r\n\t}\r\n\r\n\t// Because Denathrius can send a quest reward as its hero power (I think)\r\n\t// For now deactivating this, until I have a scenario where this matters. It feels like\r\n\t// this should be a display issue only, as quest rewards are also handled in the code\r\n\tconst heroPowerAsReward = null; // hero.cardId === CardIds.SireDenathrius_BG24_HERO_100 ? hero.heroPowers[0]?.cardId : null;\r\n\thero.questRewards = [...(hero.questRewards ?? []), heroPowerAsReward].filter((e) => !!e);\r\n\thero.questRewardEntities = hero.questRewardEntities\r\n\t\t? hero.questRewardEntities.map((reward: any) => ({\r\n\t\t\t\tcardId: reward.CardId,\r\n\t\t\t\tscriptDataNum1: reward.ScriptDataNum1 ?? 0,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward.CardId),\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward.CardId),\r\n\t\t }))\r\n\t\t: hero.questRewards.map((reward) => ({\r\n\t\t\t\tcardId: reward,\r\n\t\t\t\tentityId: entityIdContainer.entityId--,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(reward),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(reward),\r\n\t\t\t\tscriptDataNum1: cardsData.defaultScriptDataNum(reward),\r\n\t\t }));\r\n\thero.trinkets = (hero.trinkets ?? [])\r\n\t\t.map((trinket) => ({\r\n\t\t\t...trinket,\r\n\t\t\tavengeDefault: cardsData.avengeValue(trinket.cardId),\r\n\t\t\tavengeCurrent: cardsData.avengeValue(trinket.cardId),\r\n\t\t\t// Use scriptDataNum1 to keep the info from the input\r\n\t\t\t// We don't want to use the default value is the value from the game state is 0\r\n\t\t\t// In that case, we probably want to use the ChargesLeft mechanism\r\n\t\t\tscriptDataNum1: trinket.scriptDataNum1 ?? cardsData.defaultScriptDataNum(trinket.cardId),\r\n\t\t}))\r\n\t\t.sort((a, b) => a.entityId - b.entityId);\r\n\t// 0 is not a valid entityId\r\n\thero.entityId = hero.entityId || entityIdContainer.entityId--;\r\n\thero.hand = hero.hand ?? [];\r\n\thero.enchantments = hero.enchantments ?? [];\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {};\r\n\t}\r\n\r\n\thero.globalInfo.PirateAttackBonus = hero.globalInfo.PirateAttackBonus ?? 0;\r\n\thero.globalInfo.MechAttackBonus = hero.globalInfo.MechAttackBonus ?? 0;\r\n\thero.globalInfo.EternalKnightsDeadThisGame = hero.globalInfo.EternalKnightsDeadThisGame ?? 0;\r\n\thero.globalInfo.EternalKnightAttackBuff = hero.globalInfo.EternalKnightAttackBuff ?? 0;\r\n\thero.globalInfo.EternalKnightHealthBuff = hero.globalInfo.EternalKnightHealthBuff ?? 0;\r\n\thero.globalInfo.SanlaynScribesDeadThisGame = hero.globalInfo.SanlaynScribesDeadThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisGame = hero.globalInfo.BeastsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BeastsSummonedThisCombat = hero.globalInfo.BeastsSummonedThisCombat ?? 0;\r\n\thero.globalInfo.MagnetizedThisGame = hero.globalInfo.MagnetizedThisGame ?? 0;\r\n\thero.globalInfo.PiratesSummonedThisGame = hero.globalInfo.PiratesSummonedThisGame ?? 0;\r\n\thero.globalInfo.AstralAutomatonsSummonedThisGame = hero.globalInfo.AstralAutomatonsSummonedThisGame ?? 0;\r\n\thero.globalInfo.BattlecriesTriggeredThisGame = hero.globalInfo.BattlecriesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BeetleAttackBuff = hero.globalInfo.BeetleAttackBuff ?? 0;\r\n\thero.globalInfo.BeetleHealthBuff = hero.globalInfo.BeetleHealthBuff ?? 0;\r\n\thero.globalInfo.ElementalAttackBuff = hero.globalInfo.ElementalAttackBuff ?? 0;\r\n\thero.globalInfo.ElementalHealthBuff = hero.globalInfo.ElementalHealthBuff ?? 0;\r\n\thero.globalInfo.PirateAttackBuff = hero.globalInfo.PirateAttackBuff ?? 0;\r\n\thero.globalInfo.PirateHealthBuff = hero.globalInfo.PirateHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellAttackBuff = hero.globalInfo.TavernSpellAttackBuff ?? 0;\r\n\thero.globalInfo.TavernSpellHealthBuff = hero.globalInfo.TavernSpellHealthBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherAttackBuff = hero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\thero.globalInfo.MutatedLasherHealthBuff = hero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisGame = hero.globalInfo.TavernSpellsCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.AdditionalAttack = hero.globalInfo.AdditionalAttack ?? 0;\r\n\thero.globalInfo.SpellsCastThisGame = hero.globalInfo.SpellsCastThisGame ?? 0;\r\n\thero.globalInfo.UndeadAttackBonus = hero.globalInfo.UndeadAttackBonus ?? 0;\r\n\thero.globalInfo.UndeadHealthBonus = hero.globalInfo.UndeadHealthBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceAttackBonus = hero.globalInfo.HauntedCarapaceAttackBonus ?? 0;\r\n\thero.globalInfo.HauntedCarapaceHealthBonus = hero.globalInfo.HauntedCarapaceHealthBonus ?? 0;\r\n\thero.globalInfo.FrostlingBonus = hero.globalInfo.FrostlingBonus ?? 0;\r\n\thero.globalInfo.BloodGemAttackBonus =\r\n\t\t(hero.globalInfo.BloodGemAttackBonus ?? 0) +\r\n\t\t// Not sure why, but this isn't reflected in the player enchant\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t(hero.globalInfo.BloodGemHealthBonus ?? 0) +\r\n\t\t(hero.questRewardEntities?.filter((e) => e.cardId === CardIds.EndlessBloodMoon).length ?? 0);\r\n\thero.globalInfo.GoldrinnBuffAtk = hero.globalInfo.GoldrinnBuffAtk ?? 0;\r\n\thero.globalInfo.GoldrinnBuffHealth = hero.globalInfo.GoldrinnBuffHealth ?? 0;\r\n\thero.globalInfo.WhelpAttackBuff = hero.globalInfo.WhelpAttackBuff ?? 0;\r\n\thero.globalInfo.WhelpHealthBuff = hero.globalInfo.WhelpHealthBuff ?? 0;\r\n\thero.globalInfo.GoldSpentThisGame = hero.globalInfo.GoldSpentThisGame ?? 0;\r\n\thero.globalInfo.VolumizerAttackBuff = hero.globalInfo.VolumizerAttackBuff ?? 0;\r\n\thero.globalInfo.VolumizerHealthBuff = hero.globalInfo.VolumizerHealthBuff ?? 0;\r\n\thero.globalInfo.DeepBluesPlayed = hero.globalInfo.DeepBluesPlayed ?? 0;\r\n\thero.globalInfo.GoldenMinionsPlayedThisGame = hero.globalInfo.GoldenMinionsPlayedThisGame ?? 0;\r\n\thero.globalInfo.DeathrattlesTriggeredThisGame = hero.globalInfo.DeathrattlesTriggeredThisGame ?? 0;\r\n\thero.globalInfo.BackToBackCastThisGame = hero.globalInfo.BackToBackCastThisGame ?? 0;\r\n\thero.globalInfo.TavernSpellsCastThisTurn = hero.globalInfo.TavernSpellsCastThisTurn ?? 0;\r\n\thero.globalInfo.CardsPlayedThisTurn = hero.globalInfo.CardsPlayedThisTurn ?? 0;\r\n\thero.globalInfo.MrrgltonsPlayedThisGame = hero.globalInfo.MrrgltonsPlayedThisGame ?? 0;\r\n\thero.globalInfo.TastyLobstersBuff = hero.globalInfo.TastyLobstersBuff ?? 0;\r\n\t// For some reason the info was not transmitted correctly, so we take the highest value\r\n\t// from the board entities\r\n\t// Won't be totally exact if the value is odd, but should be close enough for a fallback\r\n\tif (hero.globalInfo.TastyLobstersBuff === 0) {\r\n\t\thero.globalInfo.TastyLobstersBuff = board\r\n\t\t\t.filter((e) => e.cardId === CardIds.TastyLobster_BG36_202 || e.cardId === CardIds.TastyLobster_BG36_202_G)\r\n\t\t\t.map((e) => {\r\n\t\t\t\tconst rawScript = e.scriptDataNum1 ?? 0;\r\n\t\t\t\tconst baseValue = e.cardId === CardIds.TastyLobster_BG36_202 ? rawScript : rawScript / 2;\r\n\t\t\t\treturn baseValue;\r\n\t\t\t})\r\n\t\t\t.reduce((max, value) => Math.max(max, value), 0);\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// https://twitter.com/DCalkosz/status/1562194944688660481?s=20&t=100I8IVZmBKgYQWkdK8nIA\r\n\tif (board.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => updateStealth(e, false, board, hero, otherHero, gameState));\r\n\t\totherBoard.forEach((e) => updateStealth(e, false, otherBoard, otherHero, hero, gameState));\r\n\t}\r\n};\r\n"]}
|
|
@@ -51,15 +51,18 @@ const getValidDeathrattles = (board, hero, gameState) => {
|
|
|
51
51
|
};
|
|
52
52
|
exports.getValidDeathrattles = getValidDeathrattles;
|
|
53
53
|
const hasValidDeathrattle = (entity, hero, gameState) => {
|
|
54
|
-
var _a, _b;
|
|
54
|
+
var _a, _b, _c;
|
|
55
55
|
if ((0, utils_1.hasEntityMechanic)(entity, reference_data_1.GameTag.DEATHRATTLE, gameState.allCards)) {
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
|
-
if ((
|
|
58
|
+
if ((_a = entity.rememberedDeathrattles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
if (((_b = hero.trinkets) === null || _b === void 0 ? void 0 : _b.some((t) => t.cardId === "BG32_MagicItem_830")) &&
|
|
59
62
|
(entity.cardId === "BG25_041" || entity.cardId === "BG25_041_G")) {
|
|
60
63
|
return true;
|
|
61
64
|
}
|
|
62
|
-
if ((
|
|
65
|
+
if ((_c = entity.rememberedDeathrattles) === null || _c === void 0 ? void 0 : _c.length) {
|
|
63
66
|
return true;
|
|
64
67
|
}
|
|
65
68
|
if (entity.enchantments &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deathrattle-utils.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-utils.ts"],"names":[],"mappings":";;;AAAA,iEAAuD;AAGvD,4DAAyE;AACzE,iEAA4D;AAE5D,oCAA6C;AAG7C,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAS;;;;;;;;;;;;;;;;;;;;;;CAsBtD,CAAC,CAAC;AACH,IAAI,6BAA0C,CAAC;AAExC,MAAM,6BAA6B,GAAG,CAAC,MAAc,EAAW,EAAE;IACxE,IAAI,8BAA8B,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC/C,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,CAAC,6BAA6B,EAAE;QACnC,6BAA6B,GAAG,IAAI,GAAG,EAAU,CAAC;QAClD,KAAK,MAAM,QAAQ,I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M,mBAAmB,GAAG,CAAC,MAAmB,EAAE,IAAqB,EAAE,SAAwB,EAAW,EAAE;;IACpH,IAAI,IAAA,yBAAiB,EAAC,MAAM,EAAE,wBAAO,CAAC,WAAW,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QACvE,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,MAAA,MAAM,CAAC,sBAAsB,0CAAE,MAAM,EAAE;QAC1C,OAAO,IAAI,CAAC;KACZ;IACD,IACC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAkD,CAAC;QACtF,CAAC,MAAM,CAAC,MAAM,eAAgC,IAAI,MAAM,CAAC,MAAM,iBAAkC,CAAC,EACjG;QACD,OAAO,IAAI,CAAC;KACZ;IACD,IAAI,MAAA,MAAM,CAAC,sBAAsB,0CAAE,MAAM,EAAE;QAC1C,OAAO,IAAI,CAAC;KACZ;IACD,IACC,MAAM,CAAC,YAAY;QACnB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,qCAA6B,EAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAC3F;QACD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAvBW,QAAA,mBAAmB,uBAuB9B","sourcesContent":["import { GameTag } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasDeathrattleSpawnEnchantment } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { hasEntityMechanic } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\n\r\nconst VALID_DEATHRATTLE_ENCHANTMENTS = new Set<string>([\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,\r\n\tCardIds.FireRecollectionEnchantment,\r\n\tCardIds.LightningRecollectionEnchantment,\r\n\tCardIds.WaterRecollectionEnchantment,\r\n\tCardIds.EarthInvocation_ElementEarthEnchantment,\r\n\tCardIds.LightningInvocation,\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\tCardIds.TamsinRoame_ImpendingSacrificeEnchantment_BG20_HERO_282e2,\r\n]);\r\nlet mappedDeathrattleEnchantments: Set<string>;\r\n\r\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\r\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.has(cardId)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (!mappedDeathrattleEnchantments) {\r\n\t\tmappedDeathrattleEnchantments = new Set<string>();\r\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\r\n\t\t\tif (hasDeathrattleSpawnEnchantment(cardImpl)) {\r\n\t\t\t\tfor (const mappedCardId of cardImpl.cardIds) {\r\n\t\t\t\t\tmappedDeathrattleEnchantments.add(mappedCardId);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn mappedDeathrattleEnchantments.has(cardId);\r\n};\r\n\r\nexport const getValidDeathrattles = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\treturn board.filter((entity) => hasValidDeathrattle(entity, hero, gameState));\r\n};\r\n\r\nexport const hasValidDeathrattle = (entity: BoardEntity, hero: BgsPlayerEntity, gameState: FullGameState): boolean => {\r\n\tif (hasEntityMechanic(entity, GameTag.DEATHRATTLE, gameState.allCards)) {\r\n\t\treturn true;\r\n\t}\r\n\tif (entity.rememberedDeathrattles?.length) {\r\n\t\treturn true;\r\n\t}\r\n\tif (\r\n\t\thero.trinkets?.some((t) => t.cardId === CardIds.FelementalPortrait_BG32_MagicItem_830) &&\r\n\t\t(entity.cardId === CardIds.Felemental_BG25_041 || entity.cardId === CardIds.Felemental_BG25_041_G)\r\n\t) {\r\n\t\treturn true;\r\n\t}\r\n\tif (entity.rememberedDeathrattles?.length) {\r\n\t\treturn true;\r\n\t}\r\n\tif (\r\n\t\tentity.enchantments &&\r\n\t\tentity.enchantments.some((enchantment) => isValidDeathrattleEnchantment(enchantment.cardId))\r\n\t) {\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n};\r\n"]}
|
package/dist/simulation/stats.js
CHANGED
|
@@ -26,7 +26,7 @@ const multiplyStats = (entity, multiplier, board, hero, gameState) => {
|
|
|
26
26
|
};
|
|
27
27
|
exports.multiplyStats = multiplyStats;
|
|
28
28
|
const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard, friendlyBoardHero, gameState, registerSpectator = true, isEnchantment = true, countsAsStatsGain = true) => {
|
|
29
|
-
var _a, _b;
|
|
29
|
+
var _a, _b, _c;
|
|
30
30
|
if (!(entity === null || entity === void 0 ? void 0 : entity.maxHealth)) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -105,7 +105,8 @@ const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard,
|
|
|
105
105
|
}
|
|
106
106
|
poetMultipliers = poetCount * 2 + timewarpedPoetCount * 2 || 1;
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const hasTarecgosasBlessing = (_c = entity.enchantments) === null || _c === void 0 ? void 0 : _c.some((e) => e.cardId === "BG36_MidGameEffect_000t50e");
|
|
109
|
+
const tarecgosaMultiplier = (isEnchantment && entity.cardId === "BG21_015_G") || hasTarecgosasBlessing ? 2 : 1;
|
|
109
110
|
const realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;
|
|
110
111
|
const realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;
|
|
111
112
|
if (!Number.isFinite(realAttackAmount) && !Number.isFinite(realHealthAmount)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/simulation/stats.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,4DAA4D;AAC5D,iEAA4D;AAE5D,oCAAuD;AACvD,+DAA8E;AAE9E,mCAAiD;AAE1C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,MAAqB,EACrB,MAAqB,EACrB,KAAoB,EACpB,SAA0B,EAC1B,SAAwB,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,GAAG,IAAI,EAChB,EAAE;IACT,IAAA,yCAAmB,EAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IAC7F,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;KAC1B;IACD,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,SAAS,G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aAAa,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;SACzG;QACD,IACC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;YAClC,CAAC,KAAK,CAAC,MAAM,iCAAuD;gBACnE,KAAK,CAAC,MAAM,mCAAyD,CAAC,EACtE;YACD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;YACrB,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;SACrB;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEnchantment, BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { getEffectiveTribesForEntity } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tapplyAttackAuras = true,\r\n\tapplyHealthAuras = true,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n};\r\n\r\nexport const multiplyStats = (\r\n\tentity: BoardEntity,\r\n\tmultiplier: number | null,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tmodifyStats(\r\n\t\tentity,\r\n\t\tentity,\r\n\t\t(multiplier - 1) * entity.maxAttack,\r\n\t\t(multiplier - 1) * entity.maxHealth,\r\n\t\tboard,\r\n\t\thero,\r\n\t\tgameState,\r\n\t);\r\n\tapplyAurasToSelf(entity, board, hero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n\t// All stat modifications become enchantments, excepted the ones coming from gilding a minion\r\n\tisEnchantment = true,\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\t// Not a minion - can happen when buffing the whole hand, so we don't have to filter first\r\n\tif (!entity?.maxHealth) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!Number.isFinite(attackAmount)) {\r\n\t\tattackAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(healthAmount)) {\r\n\t\thealthAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.attack)) {\r\n\t\tentity.attack = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.health)) {\r\n\t\tentity.health = 1;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxAttack as number)) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxHealth as number)) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tconst sourceEntity = source as BoardEntity;\r\n\tconst globalInfo = friendlyBoardHero.globalInfo;\r\n\tif (\r\n\t\tentity.entityId !== sourceEntity?.entityId &&\r\n\t\tsourceEntity?.maxHealth &&\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0 &&\r\n\t\t// Resolving the source's tribes is only useful when one of these global buffs is\r\n\t\t// active, and this is one of the hottest paths of the simulation\r\n\t\t(globalInfo.ElementalAttackBuff ||\r\n\t\t\tglobalInfo.ElementalHealthBuff ||\r\n\t\t\tglobalInfo.PirateAttackBuff ||\r\n\t\t\tglobalInfo.PirateHealthBuff)\r\n\t) {\r\n\t\tconst sourceTribes = getEffectiveTribesForEntity(\r\n\t\t\tsourceEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t);\r\n\t\tconst sourceIsAllTribes = sourceTribes.includes(Race.ALL);\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.ELEMENTAL)) {\r\n\t\t\tattackAmount += globalInfo.ElementalAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.ElementalHealthBuff || 0;\r\n\t\t}\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.PIRATE)) {\r\n\t\t\tattackAmount += globalInfo.PirateAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.PirateHealthBuff || 0;\r\n\t\t}\r\n\t}\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst effectiveTribes = getEffectiveTribesForEntity(\r\n\t\tentity,\r\n\t\tfriendlyBoardHero,\r\n\t\tgameState.anomalies,\r\n\t\tgameState.allCards,\r\n\t);\r\n\tconst isAllTribes = effectiveTribes.includes(Race.ALL);\r\n\tconst isDragon = isAllTribes || effectiveTribes.includes(Race.DRAGON);\r\n\tconst isElemental = isAllTribes || effectiveTribes.includes(Race.ELEMENTAL);\r\n\tlet poetMultipliers = 1;\r\n\tif (isEnchantment && isDragon) {\r\n\t\tlet entityIndex = -1;\r\n\t\tlet timewarpedPoetCount = 0;\r\n\t\tfor (let i = 0; i < friendlyBoard.length; i++) {\r\n\t\t\tif (friendlyBoard[i].entityId === entity.entityId) {\r\n\t\t\t\tentityIndex = i;\r\n\t\t\t}\r\n\t\t\tif (friendlyBoard[i].cardId === CardIds.TimewarpedPoet_BG34_Giant_314_G) {\r\n\t\t\t\ttimewarpedPoetCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet poetCount = 0;\r\n\t\tif (friendlyBoard[entityIndex - 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tif (friendlyBoard[entityIndex + 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tpoetMultipliers = poetCount * 2 + timewarpedPoetCount * 2 || 1;\r\n\t}\r\n\tconst tarecgosaMultiplier = isEnchantment && entity.cardId === CardIds.Tarecgosa_BG21_015_G ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tif (!Number.isFinite(realAttackAmount) && !Number.isFinite(realHealthAmount)) {\r\n\t\treturn;\r\n\t}\r\n\tconst safeAtk = Number.isFinite(realAttackAmount) ? realAttackAmount : 0;\r\n\tconst safeHp = Number.isFinite(realHealthAmount) ? realHealthAmount : 0;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + safeAtk);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(safeAtk);\r\n\tentity.health += safeHp;\r\n\r\n\tif (safeAtk > 0) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (safeHp > 0) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\tif (safeAtk > 0 || safeHp > 0) {\r\n\t\t// Single pass over the board for all the \"when a minion gains stats\" watchers\r\n\t\t// (Stormbringer, Titanic Guardian). Their effects are independent of\r\n\t\t// each other, so interleaving them per board position is equivalent to the\r\n\t\t// previous one-loop-per-effect version, and much cheaper on this hot path\r\n\t\tconst checkStormbringer =\r\n\t\t\tsafeAtk > 0 &&\r\n\t\t\tisDragon &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966 &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966_G;\r\n\t\tfor (const other of friendlyBoard) {\r\n\t\t\tconst otherCardId = other.cardId;\r\n\t\t\tif (safeAtk > 0) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tcheckStormbringer &&\r\n\t\t\t\t\t(otherCardId === CardIds.Stormbringer_BG26_966 || otherCardId === CardIds.Stormbringer_BG26_966_G)\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst multiplier = otherCardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tother.attack += multiplier * safeAtk;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (\r\n\t\t\t\tsafeHp > 0 &&\r\n\t\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t\t(otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\totherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G)\r\n\t\t\t) {\r\n\t\t\t\tconst buff = (otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * safeHp;\r\n\t\t\t\tother.health += buff;\r\n\t\t\t\tother.maxHealth += buff;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (countsAsStatsGain) {\r\n\t\tonStatsUpdate(\r\n\t\t\tentity,\r\n\t\t\tsource,\r\n\t\t\tsafeAtk,\r\n\t\t\tsafeHp,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t\tisElemental,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tonStatUpdateMinions(\r\n\t\tentity,\r\n\t\tsource,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\totherHero,\r\n\t\tgameState,\r\n\t\tisElemental,\r\n\t);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tsource: source as BoardEntity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Single pass for Master of Realities and Tentacle of C'Thun (their effects are\r\n\t// independent, so interleaving them is equivalent to separate loops)\r\n\tfor (const other of friendlyBoard) {\r\n\t\tif (\r\n\t\t\tisElemental &&\r\n\t\t\t(other.cardId === CardIds.MasterOfRealities_BG21_036 ||\r\n\t\t\t\tother.cardId === CardIds.MasterOfRealities_BG21_036_G)\r\n\t\t) {\r\n\t\t\tconst baseBuff = 2;\r\n\t\t\tconst mult = other.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1;\r\n\t\t\tmodifyStats(other, other, baseBuff * mult, baseBuff * mult, friendlyBoard, friendlyBoardHero, gameState);\r\n\t\t}\r\n\t\tif (\r\n\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t(other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\tother.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G)\r\n\t\t) {\r\n\t\t\tconst buff = other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\t\tother.attack += buff;\r\n\t\t\tother.health += buff;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/simulation/stats.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,4DAA4D;AAC5D,iEAA4D;AAE5D,oCAAuD;AACvD,+DAA8E;AAE9E,mCAAiD;AAE1C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,MAAqB,EACrB,MAAqB,EACrB,KAAoB,EACpB,SAA0B,EAC1B,SAAwB,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,GAAG,IAAI,EAChB,EAAE;IACT,IAAA,yCAAmB,EAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IAC7F,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;KAC1B;IACD,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,C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CAAC,CAAC;YACnB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,iBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,IAAA,mBAAW,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;SACzG;QACD,IACC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ;YAClC,CAAC,KAAK,CAAC,MAAM,iCAAuD;gBACnE,KAAK,CAAC,MAAM,mCAAyD,CAAC,EACtE;YACD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;YACrB,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;SACrB;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEnchantment, BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { getEffectiveTribesForEntity } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tapplyAttackAuras = true,\r\n\tapplyHealthAuras = true,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState, applyAttackAuras, applyHealthAuras);\r\n};\r\n\r\nexport const multiplyStats = (\r\n\tentity: BoardEntity,\r\n\tmultiplier: number | null,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tmodifyStats(\r\n\t\tentity,\r\n\t\tentity,\r\n\t\t(multiplier - 1) * entity.maxAttack,\r\n\t\t(multiplier - 1) * entity.maxHealth,\r\n\t\tboard,\r\n\t\thero,\r\n\t\tgameState,\r\n\t);\r\n\tapplyAurasToSelf(entity, board, hero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n\t// All stat modifications become enchantments, excepted the ones coming from gilding a minion\r\n\tisEnchantment = true,\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\t// Not a minion - can happen when buffing the whole hand, so we don't have to filter first\r\n\tif (!entity?.maxHealth) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (!Number.isFinite(attackAmount)) {\r\n\t\tattackAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(healthAmount)) {\r\n\t\thealthAmount = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.attack)) {\r\n\t\tentity.attack = 0;\r\n\t}\r\n\tif (!Number.isFinite(entity.health)) {\r\n\t\tentity.health = 1;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxAttack as number)) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (!Number.isFinite(entity.maxHealth as number)) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tconst sourceEntity = source as BoardEntity;\r\n\tconst globalInfo = friendlyBoardHero.globalInfo;\r\n\tif (\r\n\t\tentity.entityId !== sourceEntity?.entityId &&\r\n\t\tsourceEntity?.maxHealth &&\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0 &&\r\n\t\t// Resolving the source's tribes is only useful when one of these global buffs is\r\n\t\t// active, and this is one of the hottest paths of the simulation\r\n\t\t(globalInfo.ElementalAttackBuff ||\r\n\t\t\tglobalInfo.ElementalHealthBuff ||\r\n\t\t\tglobalInfo.PirateAttackBuff ||\r\n\t\t\tglobalInfo.PirateHealthBuff)\r\n\t) {\r\n\t\tconst sourceTribes = getEffectiveTribesForEntity(\r\n\t\t\tsourceEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t);\r\n\t\tconst sourceIsAllTribes = sourceTribes.includes(Race.ALL);\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.ELEMENTAL)) {\r\n\t\t\tattackAmount += globalInfo.ElementalAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.ElementalHealthBuff || 0;\r\n\t\t}\r\n\t\tif (sourceIsAllTribes || sourceTribes.includes(Race.PIRATE)) {\r\n\t\t\tattackAmount += globalInfo.PirateAttackBuff || 0;\r\n\t\t\thealthAmount += globalInfo.PirateHealthBuff || 0;\r\n\t\t}\r\n\t}\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst effectiveTribes = getEffectiveTribesForEntity(\r\n\t\tentity,\r\n\t\tfriendlyBoardHero,\r\n\t\tgameState.anomalies,\r\n\t\tgameState.allCards,\r\n\t);\r\n\tconst isAllTribes = effectiveTribes.includes(Race.ALL);\r\n\tconst isDragon = isAllTribes || effectiveTribes.includes(Race.DRAGON);\r\n\tconst isElemental = isAllTribes || effectiveTribes.includes(Race.ELEMENTAL);\r\n\tlet poetMultipliers = 1;\r\n\tif (isEnchantment && isDragon) {\r\n\t\tlet entityIndex = -1;\r\n\t\tlet timewarpedPoetCount = 0;\r\n\t\tfor (let i = 0; i < friendlyBoard.length; i++) {\r\n\t\t\tif (friendlyBoard[i].entityId === entity.entityId) {\r\n\t\t\t\tentityIndex = i;\r\n\t\t\t}\r\n\t\t\tif (friendlyBoard[i].cardId === CardIds.TimewarpedPoet_BG34_Giant_314_G) {\r\n\t\t\t\ttimewarpedPoetCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet poetCount = 0;\r\n\t\tif (friendlyBoard[entityIndex - 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tif (friendlyBoard[entityIndex + 1]?.cardId === CardIds.PersistentPoet_BG29_813_G) {\r\n\t\t\tpoetCount++;\r\n\t\t}\r\n\t\tpoetMultipliers = poetCount * 2 + timewarpedPoetCount * 2 || 1;\r\n\t}\r\n\tconst hasTarecgosasBlessing = entity.enchantments?.some(\r\n\t\t(e) => e.cardId === CardIds.TarecgosasBlessing_TarecgosasBlessingEnchantment_BG36_MidGameEffect_000t50e,\r\n\t);\r\n\tconst tarecgosaMultiplier =\r\n\t\t(isEnchantment && entity.cardId === CardIds.Tarecgosa_BG21_015_G) || hasTarecgosasBlessing ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tif (!Number.isFinite(realAttackAmount) && !Number.isFinite(realHealthAmount)) {\r\n\t\treturn;\r\n\t}\r\n\tconst safeAtk = Number.isFinite(realAttackAmount) ? realAttackAmount : 0;\r\n\tconst safeHp = Number.isFinite(realHealthAmount) ? realHealthAmount : 0;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + safeAtk);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(safeAtk);\r\n\tentity.health += safeHp;\r\n\r\n\tif (safeAtk > 0) {\r\n\t\tentity.maxAttack = entity.attack;\r\n\t}\r\n\tif (safeHp > 0) {\r\n\t\tentity.maxHealth = entity.health;\r\n\t}\r\n\tif (safeAtk > 0 || safeHp > 0) {\r\n\t\t// Single pass over the board for all the \"when a minion gains stats\" watchers\r\n\t\t// (Stormbringer, Titanic Guardian). Their effects are independent of\r\n\t\t// each other, so interleaving them per board position is equivalent to the\r\n\t\t// previous one-loop-per-effect version, and much cheaper on this hot path\r\n\t\tconst checkStormbringer =\r\n\t\t\tsafeAtk > 0 &&\r\n\t\t\tisDragon &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966 &&\r\n\t\t\tentity.cardId !== CardIds.Stormbringer_BG26_966_G;\r\n\t\tfor (const other of friendlyBoard) {\r\n\t\t\tconst otherCardId = other.cardId;\r\n\t\t\tif (safeAtk > 0) {\r\n\t\t\t\tif (\r\n\t\t\t\t\tcheckStormbringer &&\r\n\t\t\t\t\t(otherCardId === CardIds.Stormbringer_BG26_966 || otherCardId === CardIds.Stormbringer_BG26_966_G)\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst multiplier = otherCardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tother.attack += multiplier * safeAtk;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tother,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (\r\n\t\t\t\tsafeHp > 0 &&\r\n\t\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t\t(otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\totherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G)\r\n\t\t\t) {\r\n\t\t\t\tconst buff = (otherCardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * safeHp;\r\n\t\t\t\tother.health += buff;\r\n\t\t\t\tother.maxHealth += buff;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (countsAsStatsGain) {\r\n\t\tonStatsUpdate(\r\n\t\t\tentity,\r\n\t\t\tsource,\r\n\t\t\tsafeAtk,\r\n\t\t\tsafeHp,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t\tisElemental,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tonStatUpdateMinions(\r\n\t\tentity,\r\n\t\tsource,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyHero,\r\n\t\totherHero,\r\n\t\tgameState,\r\n\t\tisElemental,\r\n\t);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower | BoardEnchantment,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisElemental: boolean,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tsource: source as BoardEntity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Single pass for Master of Realities and Tentacle of C'Thun (their effects are\r\n\t// independent, so interleaving them is equivalent to separate loops)\r\n\tfor (const other of friendlyBoard) {\r\n\t\tif (\r\n\t\t\tisElemental &&\r\n\t\t\t(other.cardId === CardIds.MasterOfRealities_BG21_036 ||\r\n\t\t\t\tother.cardId === CardIds.MasterOfRealities_BG21_036_G)\r\n\t\t) {\r\n\t\t\tconst baseBuff = 2;\r\n\t\t\tconst mult = other.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1;\r\n\t\t\tmodifyStats(other, other, baseBuff * mult, baseBuff * mult, friendlyBoard, friendlyBoardHero, gameState);\r\n\t\t}\r\n\t\tif (\r\n\t\t\tother.entityId !== entity.entityId &&\r\n\t\t\t(other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\tother.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G)\r\n\t\t) {\r\n\t\t\tconst buff = other.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\t\tother.attack += buff;\r\n\t\t\tother.health += buff;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare const stringifySimpleCard: (entity: BoardEntity, allCards?: AllCa
|
|
|
38
38
|
export declare const isFish: (entity: BoardEntity) => boolean;
|
|
39
39
|
export declare const isPilotedWhirlOTron: (entity: BoardEntity) => boolean;
|
|
40
40
|
export declare const isGolden: (cardId: string, allCards: AllCardsService) => boolean;
|
|
41
|
-
export declare const isBoardEntity: (entity: BoardEntity | BoardTrinket) => entity is BoardEntity;
|
|
41
|
+
export declare const isBoardEntity: (entity: BoardEntity | BoardTrinket | BgsPlayerEntity) => entity is BoardEntity;
|
|
42
42
|
export declare const getPlayerState: (gameState: GameState, hero: BgsPlayerEntity) => PlayerState;
|
|
43
43
|
export declare const getTeammateInitialState: (gameState: GameState, hero: BgsPlayerEntity) => PlayerState;
|
|
44
44
|
export declare const getTeamInitialStates: (gameState: GameState, hero: BgsPlayerEntity) => PlayerState[];
|
package/dist/utils.js
CHANGED
|
@@ -465,7 +465,11 @@ const addImpliedMechanics = (entity, cardsData) => {
|
|
|
465
465
|
entity.abiityChargesLeft = defaultChargesImpl.defaultCharges(entity);
|
|
466
466
|
}
|
|
467
467
|
else {
|
|
468
|
-
entity.abiityChargesLeft = THREE_CHARGES_IDS.has(entity.cardId)
|
|
468
|
+
entity.abiityChargesLeft = THREE_CHARGES_IDS.has(entity.cardId)
|
|
469
|
+
? 3
|
|
470
|
+
: TWO_CHARGES_IDS.has(entity.cardId)
|
|
471
|
+
? 2
|
|
472
|
+
: 1;
|
|
469
473
|
}
|
|
470
474
|
return setImplicitDataForEntity(entity, cardsData);
|
|
471
475
|
};
|