@firestone-hs/simulate-bgs-battle 1.1.235 → 1.1.236
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/simulation/auras.js +3 -3
- package/dist/simulation/auras.js.map +1 -1
- package/dist/utils.js +3 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/simulation/auras.js
CHANGED
|
@@ -49,10 +49,10 @@ const setMissingMinionsAura = (board, allCards) => {
|
|
|
49
49
|
setMissingAura(board.filter((e) => utils_1.hasCorrectTribe(e, reference_data_1.Race.DEMON, allCards)), "BG21_039_G", "BG21_039_Ge", 4, 0);
|
|
50
50
|
setMissingAura(board, "TB_BaconShop_HERO_52_Buddy", "TB_BaconShop_HERO_52_Buddy_e", 3, 0, false);
|
|
51
51
|
setMissingAura(board, "TB_BaconShop_HERO_52_Buddy_G", "TB_BaconShop_HERO_52_Buddy_G_e", 6, 0, false);
|
|
52
|
-
setMissingAura(board.filter((e) => e.divineShield), "BG25_043", "
|
|
53
|
-
setMissingAura(board.filter((e) => e.divineShield), "BG25_043_G", "
|
|
52
|
+
setMissingAura(board.filter((e) => e.divineShield), "BG25_043", "BG25_043e", 10, 0, false);
|
|
53
|
+
setMissingAura(board.filter((e) => e.divineShield), "BG25_043_G", "BG25_043_Ge", 20, 0, false);
|
|
54
54
|
};
|
|
55
|
-
const setMissingAura = (board, minionCardId, enchantmentCardId, attack, health, ignoreSelf = true) => {
|
|
55
|
+
const setMissingAura = (board, minionCardId, enchantmentCardId, attack, health, ignoreSelf = true, allCards = null) => {
|
|
56
56
|
const buffers = board.filter((e) => e.cardId === minionCardId);
|
|
57
57
|
for (const buffer of buffers) {
|
|
58
58
|
board
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAAmE;AAE5D,MAAM,eAAe,GAAG,CAC9B,KA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C,CAAC,CAAC;KAC/C;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,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;QAC1C,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe, normalizeCardIdForSkin } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity): void => {\r\n\tif (boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds || otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t\tconst bonus =\r\n\t\t\t(boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0) +\r\n\t\t\t(otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0);\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.AllWillBurn_AllWillBurnEnchantmentBattlegrounds))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += bonus;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 5;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrLegacyEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacyBattlegrounds,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantmentBattlegrounds,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacyBattlegrounds,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantmentBattlegrounds,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.KathranatirBattlegrounds,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake,\r\n\t\tCardIds.CyborgEnhancementEnchantment_BG25_901e,\r\n\t\t10,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrakeBattlegrounds,\r\n\t\tCardIds.CyborgEnhancementEnchantment_BG25_901e2,\r\n\t\t20,\r\n\t\t0,\r\n\t\tfalse,\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): 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 setImplicitData = (board: BoardEntity[], cardsData: CardsData): void => {\r\n\tfor (const entity of board) {\r\n\t\tentity.cardId = normalizeCardIdForSkin(entity.cardId);\r\n\t\tentity.maxHealth = entity.health;\r\n\t\tconst avengeValue = cardsData.avengeValue(entity.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\tentity.avengeCurrent = avengeValue;\r\n\t\t\tentity.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tentity.immuneWhenAttackCharges = 0;\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\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\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {\r\n\t\t\tEternalKnightsDeadThisGame: 0,\r\n\t\t\tUndeadAttackBonus: 0,\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): 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) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"auras.js","sourceRoot":"","sources":["../../src/simulation/auras.ts"],"names":[],"mappings":";;;AACA,iEAA8E;AAI9E,oCAAmE;AAE5D,MAAM,eAAe,GAAG,CAC9B,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,QAAyB,EAClB,EAAE;IACT,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACvC,+BAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEK,MAAM,uBAAuB,GAAG,CAAC,KAAoB,EAAE,SAA0B,EAAE,SAA0B,EAAQ,EAAE;IAC7H,IAAI,SAAS,CAAC,WAAW,0BAAqC,IAAI,SAAS,CAAC,WAAW,0BAA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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from 'src/bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { hasCorrectTribe, normalizeCardIdForSkin } from '../utils';\r\n\r\nexport const setMissingAuras = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n): void => {\r\n\tsetMissingMinionsAura(board, allCards);\r\n\tsetMissingHeroPowerAura(board, boardHero, otherHero);\r\n};\r\n\r\nexport const setMissingHeroPowerAura = (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity): void => {\r\n\tif (boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds || otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t\tconst bonus =\r\n\t\t\t(boardHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0) +\r\n\t\t\t(otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds ? 3 : 0);\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.AllWillBurn_AllWillBurnEnchantmentBattlegrounds))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += bonus;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.TheSmokingGun) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.TheSmokingGun_ArmedAndStillSmokingEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 5;\r\n\t\t\t});\r\n\t}\r\n\tif (boardHero.heroPowerId === CardIds.VolatileVenom) {\r\n\t\tboard\r\n\t\t\t.filter((e) => !e.enchantments.find((ench) => ench.cardId === CardIds.VolatileVenom_VolatileEnchantment))\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\te.attack += 7;\r\n\t\t\t\te.health += 7;\r\n\t\t\t\te.enchantments.push({\r\n\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\ttiming: 0,\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t}\r\n};\r\n\r\nconst setMissingMinionsAura = (board: BoardEntity[], allCards: AllCardsService): void => {\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacy_BG_NEW1_027,\r\n\t\tCardIds.SouthseaCaptain_YarrrLegacyEnchantment,\r\n\t\t1,\r\n\t\t1,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards)),\r\n\t\tCardIds.SouthseaCaptainLegacyBattlegrounds,\r\n\t\tCardIds.SouthseaCaptain_YarrrEnchantmentBattlegrounds,\r\n\t\t2,\r\n\t\t2,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacy_BG_EX1_507,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglLegacyEnchantment,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)),\r\n\t\tCardIds.MurlocWarleaderLegacyBattlegrounds,\r\n\t\tCardIds.MurlocWarleader_MrgglaarglEnchantmentBattlegrounds,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.Kathranatir_BG21_039,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039e,\r\n\t\t2,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards)),\r\n\t\tCardIds.KathranatirBattlegrounds,\r\n\t\tCardIds.Kathranatir_GraspOfKathranatirEnchantment_BG21_039_Ge,\r\n\t\t4,\r\n\t\t0,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_e,\r\n\t\t3,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard,\r\n\t\tCardIds.LadySinestraBattlegrounds_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\tCardIds.DraconicBlessingEnchantmentBattlegrounds_TB_BaconShop_HERO_52_Buddy_G_e,\r\n\t\t6,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrake,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043e,\r\n\t\t10,\r\n\t\t0,\r\n\t\tfalse,\r\n\t);\r\n\tsetMissingAura(\r\n\t\tboard.filter((e) => e.divineShield),\r\n\t\tCardIds.CyborgDrakeBattlegrounds,\r\n\t\tCardIds.CyborgDrake_CyborgEnhancementEnchantment_BG25_043_Ge,\r\n\t\t20,\r\n\t\t0,\r\n\t\tfalse,\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 setImplicitData = (board: BoardEntity[], cardsData: CardsData): void => {\r\n\tfor (const entity of board) {\r\n\t\tentity.cardId = normalizeCardIdForSkin(entity.cardId);\r\n\t\tentity.maxHealth = entity.health;\r\n\t\tconst avengeValue = cardsData.avengeValue(entity.cardId);\r\n\t\tif (avengeValue > 0) {\r\n\t\t\tentity.avengeCurrent = avengeValue;\r\n\t\t\tentity.avengeDefault = avengeValue;\r\n\t\t}\r\n\t\tentity.immuneWhenAttackCharges = 0;\r\n\t}\r\n};\r\n\r\nexport const setImplicitDataHero = (hero: BgsPlayerEntity, cardsData: CardsData, isPlayer: boolean): void => {\r\n\tconst avengeValue = cardsData.avengeValue(hero.heroPowerId);\r\n\tif (avengeValue > 0) {\r\n\t\thero.avengeCurrent = avengeValue;\r\n\t\thero.avengeDefault = avengeValue;\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\thero.questRewards = [...(hero.questRewards ?? []), hero.heroPowerId].filter((e) => !!e);\r\n\thero.entityId = hero.entityId ?? (isPlayer ? 999_999_998 : 999_999_999);\r\n\tif (!hero.globalInfo) {\r\n\t\thero.globalInfo = {\r\n\t\t\tEternalKnightsDeadThisGame: 0,\r\n\t\t\tUndeadAttackBonus: 0,\r\n\t\t};\r\n\t}\r\n};\r\n\r\nexport const clearStealthIfNeeded = (board: BoardEntity[], otherBoard: BoardEntity[]): 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) => (e.stealth = false));\r\n\t}\r\n\tif (otherBoard.every((entity) => entity.stealth && !entity.attack)) {\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n\tif (board.every((e) => e.stealth) && otherBoard.every((e) => e.stealth)) {\r\n\t\tboard.forEach((e) => (e.stealth = false));\r\n\t\totherBoard.forEach((e) => (e.stealth = false));\r\n\t}\r\n};\r\n"]}
|
package/dist/utils.js
CHANGED
|
@@ -382,7 +382,9 @@ const stringifySimple = (board, allCards = null) => {
|
|
|
382
382
|
exports.stringifySimple = stringifySimple;
|
|
383
383
|
const stringifySimpleCard = (entity, allCards = null) => {
|
|
384
384
|
var _a, _b;
|
|
385
|
-
return entity
|
|
385
|
+
return entity
|
|
386
|
+
? `${entity.cardId}/${(_b = (_a = allCards === null || allCards === void 0 ? void 0 : allCards.getCard(entity.cardId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ''}/atk=${entity.attack}/hp=${entity.health}/ench=${entity.enchantments}`
|
|
387
|
+
: null;
|
|
386
388
|
};
|
|
387
389
|
exports.stringifySimpleCard = stringifySimpleCard;
|
|
388
390
|
const isFish = (entity) => {
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AACA,iEAAoH;AAOpH,MAAM,UAAU,GAAG;;;;;CAKlB,CAAC;AAIF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC;AACF,MAAM,sBAAsB,GAAG;;;;CAI9B,CAAC;AACW,QAAA,iBAAiB,GAAG;;;;;CAKhC,CAAC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OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,YAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,MAAM,CAAC,MAAM,2CAAG,IAAI,mCAAI,EAAE,QAAQ,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACrI,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEK,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAW,EAAE;;IACtD,OAAO,CACN,MAAM,CAAC,MAAM,CAAC,UAAU,wBAAqD;QAC7E,MAAM,CAAC,MAAM,CAAC,UAAU,mBAAkC,WAC1D,MAAM,CAAC,eAAe,0CAAE,QAAQ,eAAoC,CACpE,CAAC;AACH,CAAC,CAAC;AANW,QAAA,MAAM,UAMjB;AAEK,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,QAAyB,EAAW,EAAE;IAC9E,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,wBAAwB,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, ALL_BG_RACES, CardIds, GameTag, Race, ReferenceCard } from '@firestone-hs/reference-data';\r\nimport { SharedState } from 'src/simulation/shared-state';\r\nimport { BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nconst CLEAVE_IDS = [\r\n\tCardIds.CaveHydra_BG_LOOT_078,\r\n\tCardIds.CaveHydraBattlegrounds,\r\n\tCardIds.FoeReaper4000_BG_GVG_113,\r\n\tCardIds.FoeReaper4000Battlegrounds,\r\n];\r\n// Because for some reason, the Taunt keyword is only a referenced tag,\r\n// so we have to know when a taunt minion is spawned (the taunt tag\r\n// is passed in input properly, so it's not an issue there)\r\nconst TAUNT_IDS = [\r\n\tCardIds.YoHoOgre,\r\n\tCardIds.YoHoOgreBattlegrounds,\r\n\tCardIds.SecurityRover_GuardBotToken,\r\n\tCardIds.SecurityRover_GuardBotTokenBattlegrounds,\r\n\tCardIds.MoltenRock,\r\n\tCardIds.MoltenRockBattlegrounds,\r\n\tCardIds.LieutenantGarr,\r\n\tCardIds.LieutenantGarrBattlegrounds,\r\n\tCardIds.GentleDjinni,\r\n\tCardIds.GentleDjinniBattlegrounds,\r\n\tCardIds.AcolyteOfCthun,\r\n\tCardIds.AcolyteOfCthunBattlegrounds,\r\n\tCardIds.RingMatron_BG_DMF_533,\r\n\tCardIds.RingMatronBattlegrounds,\r\n\tCardIds.DynamicDuo,\r\n\tCardIds.DynamicDuoBattlegrounds,\r\n\tCardIds.InsatiableUrzul,\r\n\tCardIds.InsatiableUrzulBattlegrounds,\r\n\tCardIds.MasterOfRealities_BG21_036,\r\n\tCardIds.MasterOfRealitiesBattlegrounds,\r\n\tCardIds.BrannsEpicEggBattlegrounds_TB_BaconShop_HERO_43_Buddy,\r\n\tCardIds.BrannsEpicEggBattlegrounds_TB_BaconShop_HERO_43_Buddy_G,\r\n\tCardIds.KilrekBattlegrounds_TB_BaconShop_HERO_37_Buddy,\r\n\tCardIds.KilrekBattlegrounds_TB_BaconShop_HERO_37_Buddy_G,\r\n\tCardIds.Glowscale,\r\n\tCardIds.GlowscaleBattlegrounds,\r\n\tCardIds.SilverbackPatriarch_BG_CS2_127,\r\n\tCardIds.SilverbackPatriarch_BG_CS2_127_G,\r\n\tCardIds.SparringPartner_BG_AT_069,\r\n\tCardIds.SparringPartnerBattlegrounds,\r\n\tCardIds.TunnelBlaster_BG_DAL_775,\r\n\tCardIds.TunnelBlasterBattlegrounds,\r\n];\r\nconst ATTACK_IMMEDIATELY_IDS = [\r\n\tCardIds.Scallywag_SkyPirateToken,\r\n\tCardIds.Scallywag_SkyPirateTokenBattlegrounds,\r\n\tCardIds.Onyxia_OnyxianWhelpToken,\r\n];\r\nexport const MEGA_WINDFURY_IDS = [\r\n\tCardIds.ZappSlywickBattlegrounds,\r\n\tCardIds.CracklingCycloneBattlegrounds,\r\n\tCardIds.BristlebackKnightBattlegrounds,\r\n\tCardIds.Bonker_BG20_104_G,\r\n];\r\nconst CANT_ATTACK_IDS = [CardIds.ArcaneCannonBattlegrounds];\r\n\r\nexport const buildSingleBoardEntity = (\r\n\tcardId: string,\r\n\tcontrollerHero: BgsPlayerEntity,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tfriendly: boolean,\r\n\tentityId = 1,\r\n\tspawnReborn = false,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tentityToSpawn: BoardEntity,\r\n\toriginalEntity: BoardEntity = null,\r\n): BoardEntity => {\r\n\tconst card = allCards.getCard(cardId);\r\n\tconst megaWindfury = MEGA_WINDFURY_IDS.indexOf(cardId as CardIds) !== -1;\r\n\tconst attackImmediately = ATTACK_IMMEDIATELY_IDS.indexOf(cardId as CardIds) !== -1;\r\n\tconst newEntity = !!entityToSpawn\r\n\t\t? { ...entityToSpawn, entityId: sharedState.currentEntityId++ }\r\n\t\t: addImpliedMechanics({\r\n\t\t\t\tentityId: entityId,\r\n\t\t\t\tattack: card.attack,\r\n\t\t\t\tattacksPerformed: 0,\r\n\t\t\t\tcardId: cardId,\r\n\t\t\t\tdivineShield: hasMechanic(card, 'DIVINE_SHIELD'),\r\n\t\t\t\thealth: card.health,\r\n\t\t\t\tmaxHealth: card.health,\r\n\t\t\t\ttaunt: hasMechanic(card, 'TAUNT') || TAUNT_IDS.includes(cardId as CardIds),\r\n\t\t\t\treborn: hasMechanic(card, 'REBORN'),\r\n\t\t\t\tpoisonous: hasMechanic(card, 'POISONOUS'),\r\n\t\t\t\twindfury: !megaWindfury && (hasMechanic(card, 'WINDFURY') || card.referencedTags?.includes('WINDFURY')),\r\n\t\t\t\tmegaWindfury: megaWindfury,\r\n\t\t\t\tenchantments: [],\r\n\t\t\t\tfriendly: friendly,\r\n\t\t\t\tattackImmediately: attackImmediately,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(cardId),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(cardId),\r\n\t\t } as BoardEntity);\r\n\r\n\tif (spawnReborn && !entityToSpawn) {\r\n\t\tif (cardId === CardIds.BuildAnUndead_PutricidesCreationToken) {\r\n\t\t\tconst stitchedCardId = !!originalEntity.additionalCards?.length ? originalEntity.additionalCards[0] : null;\r\n\t\t\tif (stitchedCardId) {\r\n\t\t\t\tconst stitchedCard = allCards.getCard(stitchedCardId);\r\n\t\t\t\tnewEntity.attack = newEntity.attack + stitchedCard.attack;\r\n\t\t\t\tnewEntity.maxHealth = newEntity.maxHealth + stitchedCard.health;\r\n\t\t\t\tnewEntity.taunt =\r\n\t\t\t\t\tnewEntity.taunt || hasMechanic(stitchedCard, GameTag[GameTag.TAUNT]) || TAUNT_IDS.includes(stitchedCardId as CardIds);\r\n\t\t\t\tnewEntity.divineShield = newEntity.divineShield || hasMechanic(stitchedCard, GameTag[GameTag.DIVINE_SHIELD]);\r\n\t\t\t\tnewEntity.poisonous = newEntity.poisonous || hasMechanic(stitchedCard, GameTag[GameTag.POISONOUS]);\r\n\t\t\t\tnewEntity.windfury = newEntity.windfury || hasMechanic(stitchedCard, GameTag[GameTag.WINDFURY]);\r\n\t\t\t\tnewEntity.avengeCurrent = newEntity.avengeCurrent || cardsData.avengeValue(stitchedCardId);\r\n\t\t\t\tnewEntity.avengeDefault = newEntity.avengeDefault || cardsData.avengeValue(stitchedCardId);\r\n\t\t\t}\r\n\t\t}\r\n\t\tnewEntity.health = 1;\r\n\t\tnewEntity.reborn = false;\r\n\t}\r\n\r\n\treturn newEntity;\r\n};\r\n\r\nexport const modifyAttack = (entity: BoardEntity, amount: number, friendlyBoard: BoardEntity[], allCards: AllCardsService): void => {\r\n\tconst realAmount = entity.cardId === CardIds.TarecgosaBattlegrounds ? 2 * amount : amount;\r\n\tentity.attack = Math.max(0, entity.attack + realAmount);\r\n\tentity.previousAttack = entity.attack;\r\n\tif (isCorrectTribe(allCards.getCard(entity.cardId).races, Race.DRAGON)) {\r\n\t\tconst whelpSmugglers = friendlyBoard.filter((e) => e.cardId === CardIds.WhelpSmuggler);\r\n\t\tconst whelpSmugglersBattlegrounds = friendlyBoard.filter((e) => e.cardId === CardIds.WhelpSmugglerBattlegrounds);\r\n\t\twhelpSmugglers.forEach((smuggler) => {\r\n\t\t\tmodifyHealth(entity, 1, friendlyBoard, allCards);\r\n\t\t});\r\n\t\twhelpSmugglersBattlegrounds.forEach((smuggler) => {\r\n\t\t\tmodifyHealth(entity, 2, friendlyBoard, allCards);\r\n\t\t});\r\n\t}\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamTokenBattlegrounds ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyAttack(\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tallCards,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const modifyHealth = (entity: BoardEntity, amount: number, friendlyBoard: BoardEntity[], allCards: AllCardsService): void => {\r\n\tconst realAmount = entity.cardId === CardIds.TarecgosaBattlegrounds ? 2 * amount : amount;\r\n\tentity.health += realAmount;\r\n\tif (realAmount > 0) {\r\n\t\tentity.maxHealth += realAmount;\r\n\t}\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamTokenBattlegrounds ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyHealth(\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tallCards,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\r\n\tconst titanicGuardians = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TitanicGuardianBattlegrounds_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TitanicGuardianBattlegrounds_TB_BaconShop_HERO_39_Buddy_G,\r\n\t\t);\r\n\ttitanicGuardians.forEach((guardian) => {\r\n\t\tmodifyHealth(\r\n\t\t\tguardian,\r\n\t\t\t(guardian.cardId === CardIds.TitanicGuardianBattlegrounds_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * realAmount,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t});\r\n};\r\n\r\nexport const afterStatsUpdate = (entity: BoardEntity, friendlyBoard: BoardEntity[], allCards: AllCardsService): void => {\r\n\tif (hasCorrectTribe(entity, Race.ELEMENTAL, allCards)) {\r\n\t\tconst masterOfRealities = friendlyBoard.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MasterOfRealities_BG21_036 || e.cardId === CardIds.MasterOfRealitiesBattlegrounds,\r\n\t\t);\r\n\t\tmasterOfRealities.forEach((master) => {\r\n\t\t\tmodifyAttack(master, master.cardId === CardIds.MasterOfRealitiesBattlegrounds ? 2 : 1, friendlyBoard, allCards);\r\n\t\t\tmodifyHealth(master, master.cardId === CardIds.MasterOfRealitiesBattlegrounds ? 2 : 1, friendlyBoard, allCards);\r\n\t\t});\r\n\t}\r\n\tconst tentaclesOfCthun = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy_G,\r\n\t\t);\r\n\ttentaclesOfCthun.forEach((tentacle) => {\r\n\t\tmodifyAttack(\r\n\t\t\ttentacle,\r\n\t\t\ttentacle.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t\tmodifyHealth(\r\n\t\t\ttentacle,\r\n\t\t\ttentacle.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t});\r\n};\r\n\r\nexport const makeMinionGolden = (\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BgsPlayerEntity,\r\n\tsourceBoard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst refCard = allCards.getCard(target.cardId);\r\n\t// Typically, we are already golden\r\n\tif (!refCard.battlegroundsPremiumDbfId) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst goldenCard = allCards.getCardFromDbfId(refCard.battlegroundsPremiumDbfId);\r\n\ttarget.cardId = goldenCard.id;\r\n\t// A minion becoming golden ignore the current death.\r\n\t// This way of handling it is not ideal, since it will still trigger if both avenges trigger at the same time, but\r\n\t// should solve the other cases\r\n\ttarget.avengeCurrent = Math.min(target.avengeDefault, target.avengeCurrent + 1);\r\n\tmodifyAttack(target, refCard.attack, sourceBoard, allCards);\r\n\tmodifyHealth(target, refCard.health, sourceBoard, allCards);\r\n\tafterStatsUpdate(target, sourceBoard, allCards);\r\n\tspectator.registerPowerTarget(source, target, sourceBoard);\r\n};\r\n\r\nexport const grantRandomAttack = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tadditionalAttack: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\texcludeSource = false,\r\n): void => {\r\n\tconst candidateBoard = board\r\n\t\t.filter((e) => !excludeSource || e.entityId !== source.entityId)\r\n\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tif (candidateBoard.length > 0) {\r\n\t\tconst target = candidateBoard[Math.floor(Math.random() * candidateBoard.length)];\r\n\t\tmodifyAttack(target, additionalAttack, candidateBoard, allCards);\r\n\t\tafterStatsUpdate(target, candidateBoard, allCards);\r\n\t\tspectator.registerPowerTarget(source, target, board);\r\n\t}\r\n};\r\n\r\nexport const grantRandomHealth = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thealth: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\texcludeSource = false,\r\n): void => {\r\n\tconst candidateBoard = board\r\n\t\t.filter((e) => !excludeSource || e.entityId !== source.entityId)\r\n\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tif (candidateBoard.length > 0) {\r\n\t\tconst target = candidateBoard[Math.floor(Math.random() * candidateBoard.length)];\r\n\t\tmodifyHealth(target, health, board, allCards);\r\n\t\tafterStatsUpdate(target, board, allCards);\r\n\t\tspectator.registerPowerTarget(source, target, board);\r\n\t}\r\n};\r\n\r\nexport const grantRandomStats = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tattack: number,\r\n\thealth: number,\r\n\trace: Race,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): BoardEntity => {\r\n\tif (board.length > 0) {\r\n\t\tconst validBeast: BoardEntity = getRandomAliveMinion(\r\n\t\t\tboard.filter((e) => e.entityId !== source.entityId),\r\n\t\t\trace,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t\tif (validBeast) {\r\n\t\t\tmodifyAttack(validBeast, attack, board, allCards);\r\n\t\t\tmodifyHealth(validBeast, health, board, allCards);\r\n\t\t\tafterStatsUpdate(validBeast, board, allCards);\r\n\t\t\tspectator.registerPowerTarget(source, validBeast, board);\r\n\t\t\treturn validBeast;\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nexport const addCardsInHand = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tcards: number,\r\n\tboard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tcardAdded: CardIds = null,\r\n): void => {\r\n\tconst sages = board.filter((e) => e.cardId === CardIds.DeathsHeadSage);\r\n\tconst sagesGolden = board.filter((e) => e.cardId === CardIds.DeathsHeadSageBattlegrounds);\r\n\tconst multiplier = 1 + (cardAdded === CardIds.BloodGem ? sages.length + 2 * sagesGolden.length : 0);\r\n\tconst newCardsInHand = Math.min(10, (playerEntity.cardsInHand ?? 0) + multiplier * cards);\r\n\tif (newCardsInHand <= playerEntity.cardsInHand) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tplayerEntity.cardsInHand = newCardsInHand;\r\n\r\n\tconst peggys = board.filter((e) => e.cardId === CardIds.PeggySturdybone || e.cardId === CardIds.PeggySturdyboneBattlegrounds);\r\n\tpeggys.forEach((peggy) => {\r\n\t\tconst pirate = getRandomAliveMinion(\r\n\t\t\tboard.filter((e) => e.entityId !== peggy.entityId),\r\n\t\t\tRace.PIRATE,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t\tif (pirate) {\r\n\t\t\tmodifyAttack(pirate, peggy.cardId === CardIds.PeggySturdyboneBattlegrounds ? 2 : 1, board, allCards);\r\n\t\t\tmodifyHealth(pirate, peggy.cardId === CardIds.PeggySturdyboneBattlegrounds ? 2 : 1, board, allCards);\r\n\t\t\tafterStatsUpdate(pirate, board, allCards);\r\n\t\t\tspectator.registerPowerTarget(peggy, pirate, board);\r\n\t\t}\r\n\t});\r\n\r\n\tconst thornCaptains = board.filter((e) => e.cardId === CardIds.Thorncaptain || e.cardId === CardIds.ThorncaptainBattlegrounds);\r\n\tthornCaptains.forEach((captain) => {\r\n\t\tmodifyHealth(captain, captain.cardId === CardIds.ThorncaptainBattlegrounds ? 2 : 1, board, allCards);\r\n\t\tafterStatsUpdate(captain, board, allCards);\r\n\t\tspectator.registerPowerTarget(captain, captain, board);\r\n\t});\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = elligibleEntities[Math.floor(Math.random() * elligibleEntities.length)];\r\n\t\tupdateDivineShield(chosen, board, true, allCards);\r\n\t\tspectator.registerPowerTarget(source, chosen, board);\r\n\t}\r\n\t// return board;\r\n};\r\n\r\nexport const updateDivineShield = (entity: BoardEntity, board: BoardEntity[], newValue: boolean, allCards: AllCardsService): void => {\r\n\t// if ((entity.divineShield ?? false) === newValue) {\r\n\t// \treturn;\r\n\t// }\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t10 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake).length +\r\n\t\t\t20 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrakeBattlegrounds).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t10 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake).length +\r\n\t\t\t20 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrakeBattlegrounds).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n};\r\n\r\nexport const grantAllDivineShield = (board: BoardEntity[], tribe: string, cards: AllCardsService): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => isCorrectTribe(cards.getCard(entity.cardId).races, getRaceEnum(tribe)));\r\n\tfor (const entity of elligibleEntities) {\r\n\t\tupdateDivineShield(entity, board, true, cards);\r\n\t}\r\n};\r\n\r\nexport const getRandomAliveMinion = (board: BoardEntity[], race: Race, allCards: AllCardsService): BoardEntity => {\r\n\tconst validTribes = board\r\n\t\t.filter((e) => !race || isCorrectTribe(allCards.getCard(e.cardId).races, race))\r\n\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tif (!validTribes.length) {\r\n\t\treturn null;\r\n\t}\r\n\treturn validTribes[Math.floor(Math.random() * validTribes.length)];\r\n};\r\n\r\nexport const getRandomMinionWithHighestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tif (!board.length) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst highestHealth = Math.max(...board.map((e) => e.health));\r\n\tconst validMinions = board.filter((e) => e.health === highestHealth);\r\n\treturn validMinions[Math.floor(Math.random() * validMinions.length)];\r\n};\r\n\r\nexport const addStatsToBoard = (\r\n\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tattack: number,\r\n\thealth: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\ttribe?: string,\r\n): void => {\r\n\tfor (const entity of board) {\r\n\t\tif (!tribe || hasCorrectTribe(entity, Race[tribe], allCards)) {\r\n\t\t\tmodifyAttack(entity, attack, board, allCards);\r\n\t\t\tmodifyHealth(entity, health, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, entity, board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const grantStatsToMinionsOfEachType = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tattack: number,\r\n\thealth: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (board.length > 0) {\r\n\t\tlet boardCopy = [...board];\r\n\t\tfor (const tribe of ALL_BG_RACES) {\r\n\t\t\tconst validMinion: BoardEntity = getRandomAliveMinion(boardCopy, tribe, allCards);\r\n\t\t\tif (validMinion) {\r\n\t\t\t\tmodifyAttack(validMinion, attack, board, allCards);\r\n\t\t\t\tmodifyHealth(validMinion, health, board, allCards);\r\n\t\t\t\tafterStatsUpdate(validMinion, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(source, validMinion, board);\r\n\t\t\t\tboardCopy = boardCopy.filter((e) => e !== validMinion);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const hasMechanic = (card: ReferenceCard, mechanic: string): boolean => {\r\n\treturn card.mechanics?.includes(mechanic);\r\n};\r\n\r\nexport const hasCorrectTribe = (entity: BoardEntity, targetTribe: Race, allCards: AllCardsService): boolean => {\r\n\treturn isCorrectTribe(allCards.getCard(entity.cardId).races, targetTribe);\r\n};\r\n\r\nexport const isCorrectTribe = (cardRaces: readonly string[], targetTribe: Race): boolean => {\r\n\tif (!cardRaces?.length) {\r\n\t\treturn false;\r\n\t}\r\n\treturn cardRaces.map((cardRace) => getRaceEnum(cardRace)).some((raceEnum) => raceEnum === Race.ALL || raceEnum === targetTribe);\r\n};\r\n\r\nexport const getRaceEnum = (race: string): Race => {\r\n\treturn Race[race];\r\n};\r\n\r\nexport const addImpliedMechanics = (entity: BoardEntity): BoardEntity => {\r\n\tconst cleave = CLEAVE_IDS.indexOf(entity.cardId as CardIds) !== -1;\r\n\tconst cantAttack = CANT_ATTACK_IDS.indexOf(entity.cardId as CardIds) !== -1;\r\n\t// Avoid creating a new object if not necessary\r\n\tif (!cleave && !cantAttack) {\r\n\t\treturn entity;\r\n\t}\r\n\treturn {\r\n\t\t...entity,\r\n\t\tcleave: cleave,\r\n\t\tcantAttack: cantAttack,\r\n\t} as BoardEntity;\r\n};\r\n\r\nexport const normalizeCardIdForSkin = (cardId: string): string => {\r\n\tconst skinMatch = cardId.match(/(.*)_SKIN_.*/);\r\n\tif (skinMatch) {\r\n\t\treturn skinMatch[1];\r\n\t}\r\n\treturn cardId;\r\n};\r\n\r\nexport const stringifySimple = (board: readonly BoardEntity[], allCards: AllCardsService = null): string => {\r\n\treturn '[' + board.map((entity) => stringifySimpleCard(entity, allCards)).join(', ') + ']';\r\n};\r\n\r\nexport const stringifySimpleCard = (entity: BoardEntity, allCards: AllCardsService = null): string => {\r\n\treturn entity ? `${entity.cardId}/${allCards?.getCard(entity.cardId)?.name ?? ''}/atk=${entity.attack}/hp=${entity.health}}` : null;\r\n};\r\n\r\nexport const isFish = (entity: BoardEntity): boolean => {\r\n\treturn (\r\n\t\tentity.cardId.startsWith(CardIds.AvatarOfNzoth_FishOfNzothTokenBattlegrounds) ||\r\n\t\tentity.cardId.startsWith(CardIds.FishOfNzothBattlegrounds) ||\r\n\t\tentity.additionalCards?.includes(CardIds.DevourerOfSouls_BG_RLK_538)\r\n\t);\r\n};\r\n\r\nexport const isGolden = (cardId: string, allCards: AllCardsService): boolean => {\r\n\treturn !!allCards.getCard(cardId).battlegroundsNormalDbfId;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AACA,iEAAoH;AAOpH,MAAM,UAAU,GAAG;;;;;CAKlB,CAAC;AAIF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC;AACF,MAAM,sBAAsB,GAAG;;;;CAI9B,CAAC;AACW,QAAA,iBAAiB,GAAG;;;;;CAKhC,CAAC;AACF,MAAM,eAAe,GAAG,mBAAmC,CAAC;AAErD,MAAM,sBAAsB,GAAG,CACrC,MAAc,EACd,cAA+B,EAC/B,aAA4B,EAC5B,QAAyB,EACzB,QAAiB,EACjB,QAAQ,GAAG,CAAC,EACZ,WAAW,GAAG,KAAK,EACnB,SAAoB,EACpB,WAAwB,EACxB,aAA0B,EAC1B,iBAA8B,IAAI,EACpB,EAAE;;IAChB,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,yBAAiB,CAAC,OAAO,CAAC,MAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,OAAO,CAAC,MAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IACnF,MAAM,SAAS,GAAG,CAAC,CAAC,aAAa;QAChC,CAAC,CAAC,EAA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jB;AAEK,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,QAAyB,EAAW,EAAE;IAC9E,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,wBAAwB,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, ALL_BG_RACES, CardIds, GameTag, Race, ReferenceCard } from '@firestone-hs/reference-data';\r\nimport { SharedState } from 'src/simulation/shared-state';\r\nimport { BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { Spectator } from './simulation/spectator/spectator';\r\n\r\nconst CLEAVE_IDS = [\r\n\tCardIds.CaveHydra_BG_LOOT_078,\r\n\tCardIds.CaveHydraBattlegrounds,\r\n\tCardIds.FoeReaper4000_BG_GVG_113,\r\n\tCardIds.FoeReaper4000Battlegrounds,\r\n];\r\n// Because for some reason, the Taunt keyword is only a referenced tag,\r\n// so we have to know when a taunt minion is spawned (the taunt tag\r\n// is passed in input properly, so it's not an issue there)\r\nconst TAUNT_IDS = [\r\n\tCardIds.YoHoOgre,\r\n\tCardIds.YoHoOgreBattlegrounds,\r\n\tCardIds.SecurityRover_GuardBotToken,\r\n\tCardIds.SecurityRover_GuardBotTokenBattlegrounds,\r\n\tCardIds.MoltenRock,\r\n\tCardIds.MoltenRockBattlegrounds,\r\n\tCardIds.LieutenantGarr,\r\n\tCardIds.LieutenantGarrBattlegrounds,\r\n\tCardIds.GentleDjinni,\r\n\tCardIds.GentleDjinniBattlegrounds,\r\n\tCardIds.AcolyteOfCthun,\r\n\tCardIds.AcolyteOfCthunBattlegrounds,\r\n\tCardIds.RingMatron_BG_DMF_533,\r\n\tCardIds.RingMatronBattlegrounds,\r\n\tCardIds.DynamicDuo,\r\n\tCardIds.DynamicDuoBattlegrounds,\r\n\tCardIds.InsatiableUrzul,\r\n\tCardIds.InsatiableUrzulBattlegrounds,\r\n\tCardIds.MasterOfRealities_BG21_036,\r\n\tCardIds.MasterOfRealitiesBattlegrounds,\r\n\tCardIds.BrannsEpicEggBattlegrounds_TB_BaconShop_HERO_43_Buddy,\r\n\tCardIds.BrannsEpicEggBattlegrounds_TB_BaconShop_HERO_43_Buddy_G,\r\n\tCardIds.KilrekBattlegrounds_TB_BaconShop_HERO_37_Buddy,\r\n\tCardIds.KilrekBattlegrounds_TB_BaconShop_HERO_37_Buddy_G,\r\n\tCardIds.Glowscale,\r\n\tCardIds.GlowscaleBattlegrounds,\r\n\tCardIds.SilverbackPatriarch_BG_CS2_127,\r\n\tCardIds.SilverbackPatriarch_BG_CS2_127_G,\r\n\tCardIds.SparringPartner_BG_AT_069,\r\n\tCardIds.SparringPartnerBattlegrounds,\r\n\tCardIds.TunnelBlaster_BG_DAL_775,\r\n\tCardIds.TunnelBlasterBattlegrounds,\r\n];\r\nconst ATTACK_IMMEDIATELY_IDS = [\r\n\tCardIds.Scallywag_SkyPirateToken,\r\n\tCardIds.Scallywag_SkyPirateTokenBattlegrounds,\r\n\tCardIds.Onyxia_OnyxianWhelpToken,\r\n];\r\nexport const MEGA_WINDFURY_IDS = [\r\n\tCardIds.ZappSlywickBattlegrounds,\r\n\tCardIds.CracklingCycloneBattlegrounds,\r\n\tCardIds.BristlebackKnightBattlegrounds,\r\n\tCardIds.Bonker_BG20_104_G,\r\n];\r\nconst CANT_ATTACK_IDS = [CardIds.ArcaneCannonBattlegrounds];\r\n\r\nexport const buildSingleBoardEntity = (\r\n\tcardId: string,\r\n\tcontrollerHero: BgsPlayerEntity,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tfriendly: boolean,\r\n\tentityId = 1,\r\n\tspawnReborn = false,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tentityToSpawn: BoardEntity,\r\n\toriginalEntity: BoardEntity = null,\r\n): BoardEntity => {\r\n\tconst card = allCards.getCard(cardId);\r\n\tconst megaWindfury = MEGA_WINDFURY_IDS.indexOf(cardId as CardIds) !== -1;\r\n\tconst attackImmediately = ATTACK_IMMEDIATELY_IDS.indexOf(cardId as CardIds) !== -1;\r\n\tconst newEntity = !!entityToSpawn\r\n\t\t? { ...entityToSpawn, entityId: sharedState.currentEntityId++ }\r\n\t\t: addImpliedMechanics({\r\n\t\t\t\tentityId: entityId,\r\n\t\t\t\tattack: card.attack,\r\n\t\t\t\tattacksPerformed: 0,\r\n\t\t\t\tcardId: cardId,\r\n\t\t\t\tdivineShield: hasMechanic(card, 'DIVINE_SHIELD'),\r\n\t\t\t\thealth: card.health,\r\n\t\t\t\tmaxHealth: card.health,\r\n\t\t\t\ttaunt: hasMechanic(card, 'TAUNT') || TAUNT_IDS.includes(cardId as CardIds),\r\n\t\t\t\treborn: hasMechanic(card, 'REBORN'),\r\n\t\t\t\tpoisonous: hasMechanic(card, 'POISONOUS'),\r\n\t\t\t\twindfury: !megaWindfury && (hasMechanic(card, 'WINDFURY') || card.referencedTags?.includes('WINDFURY')),\r\n\t\t\t\tmegaWindfury: megaWindfury,\r\n\t\t\t\tenchantments: [],\r\n\t\t\t\tfriendly: friendly,\r\n\t\t\t\tattackImmediately: attackImmediately,\r\n\t\t\t\tavengeCurrent: cardsData.avengeValue(cardId),\r\n\t\t\t\tavengeDefault: cardsData.avengeValue(cardId),\r\n\t\t } as BoardEntity);\r\n\r\n\tif (spawnReborn && !entityToSpawn) {\r\n\t\tif (cardId === CardIds.BuildAnUndead_PutricidesCreationToken) {\r\n\t\t\tconst stitchedCardId = !!originalEntity.additionalCards?.length ? originalEntity.additionalCards[0] : null;\r\n\t\t\tif (stitchedCardId) {\r\n\t\t\t\tconst stitchedCard = allCards.getCard(stitchedCardId);\r\n\t\t\t\tnewEntity.attack = newEntity.attack + stitchedCard.attack;\r\n\t\t\t\tnewEntity.maxHealth = newEntity.maxHealth + stitchedCard.health;\r\n\t\t\t\tnewEntity.taunt =\r\n\t\t\t\t\tnewEntity.taunt || hasMechanic(stitchedCard, GameTag[GameTag.TAUNT]) || TAUNT_IDS.includes(stitchedCardId as CardIds);\r\n\t\t\t\tnewEntity.divineShield = newEntity.divineShield || hasMechanic(stitchedCard, GameTag[GameTag.DIVINE_SHIELD]);\r\n\t\t\t\tnewEntity.poisonous = newEntity.poisonous || hasMechanic(stitchedCard, GameTag[GameTag.POISONOUS]);\r\n\t\t\t\tnewEntity.windfury = newEntity.windfury || hasMechanic(stitchedCard, GameTag[GameTag.WINDFURY]);\r\n\t\t\t\tnewEntity.avengeCurrent = newEntity.avengeCurrent || cardsData.avengeValue(stitchedCardId);\r\n\t\t\t\tnewEntity.avengeDefault = newEntity.avengeDefault || cardsData.avengeValue(stitchedCardId);\r\n\t\t\t}\r\n\t\t}\r\n\t\tnewEntity.health = 1;\r\n\t\tnewEntity.reborn = false;\r\n\t}\r\n\r\n\treturn newEntity;\r\n};\r\n\r\nexport const modifyAttack = (entity: BoardEntity, amount: number, friendlyBoard: BoardEntity[], allCards: AllCardsService): void => {\r\n\tconst realAmount = entity.cardId === CardIds.TarecgosaBattlegrounds ? 2 * amount : amount;\r\n\tentity.attack = Math.max(0, entity.attack + realAmount);\r\n\tentity.previousAttack = entity.attack;\r\n\tif (isCorrectTribe(allCards.getCard(entity.cardId).races, Race.DRAGON)) {\r\n\t\tconst whelpSmugglers = friendlyBoard.filter((e) => e.cardId === CardIds.WhelpSmuggler);\r\n\t\tconst whelpSmugglersBattlegrounds = friendlyBoard.filter((e) => e.cardId === CardIds.WhelpSmugglerBattlegrounds);\r\n\t\twhelpSmugglers.forEach((smuggler) => {\r\n\t\t\tmodifyHealth(entity, 1, friendlyBoard, allCards);\r\n\t\t});\r\n\t\twhelpSmugglersBattlegrounds.forEach((smuggler) => {\r\n\t\t\tmodifyHealth(entity, 2, friendlyBoard, allCards);\r\n\t\t});\r\n\t}\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamTokenBattlegrounds ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyAttack(\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tallCards,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const modifyHealth = (entity: BoardEntity, amount: number, friendlyBoard: BoardEntity[], allCards: AllCardsService): void => {\r\n\tconst realAmount = entity.cardId === CardIds.TarecgosaBattlegrounds ? 2 * amount : amount;\r\n\tentity.health += realAmount;\r\n\tif (realAmount > 0) {\r\n\t\tentity.maxHealth += realAmount;\r\n\t}\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamTokenBattlegrounds ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.CuddlgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgamBattlegrounds_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyHealth(\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.MishmashBattlegrounds_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tallCards,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\r\n\tconst titanicGuardians = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TitanicGuardianBattlegrounds_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TitanicGuardianBattlegrounds_TB_BaconShop_HERO_39_Buddy_G,\r\n\t\t);\r\n\ttitanicGuardians.forEach((guardian) => {\r\n\t\tmodifyHealth(\r\n\t\t\tguardian,\r\n\t\t\t(guardian.cardId === CardIds.TitanicGuardianBattlegrounds_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * realAmount,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t});\r\n};\r\n\r\nexport const afterStatsUpdate = (entity: BoardEntity, friendlyBoard: BoardEntity[], allCards: AllCardsService): void => {\r\n\tif (hasCorrectTribe(entity, Race.ELEMENTAL, allCards)) {\r\n\t\tconst masterOfRealities = friendlyBoard.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MasterOfRealities_BG21_036 || e.cardId === CardIds.MasterOfRealitiesBattlegrounds,\r\n\t\t);\r\n\t\tmasterOfRealities.forEach((master) => {\r\n\t\t\tmodifyAttack(master, master.cardId === CardIds.MasterOfRealitiesBattlegrounds ? 2 : 1, friendlyBoard, allCards);\r\n\t\t\tmodifyHealth(master, master.cardId === CardIds.MasterOfRealitiesBattlegrounds ? 2 : 1, friendlyBoard, allCards);\r\n\t\t});\r\n\t}\r\n\tconst tentaclesOfCthun = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy_G,\r\n\t\t);\r\n\ttentaclesOfCthun.forEach((tentacle) => {\r\n\t\tmodifyAttack(\r\n\t\t\ttentacle,\r\n\t\t\ttentacle.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t\tmodifyHealth(\r\n\t\t\ttentacle,\r\n\t\t\ttentacle.cardId === CardIds.TentacleOfCthunBattlegrounds_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1,\r\n\t\t\tfriendlyBoard,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t});\r\n};\r\n\r\nexport const makeMinionGolden = (\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BgsPlayerEntity,\r\n\tsourceBoard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst refCard = allCards.getCard(target.cardId);\r\n\t// Typically, we are already golden\r\n\tif (!refCard.battlegroundsPremiumDbfId) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst goldenCard = allCards.getCardFromDbfId(refCard.battlegroundsPremiumDbfId);\r\n\ttarget.cardId = goldenCard.id;\r\n\t// A minion becoming golden ignore the current death.\r\n\t// This way of handling it is not ideal, since it will still trigger if both avenges trigger at the same time, but\r\n\t// should solve the other cases\r\n\ttarget.avengeCurrent = Math.min(target.avengeDefault, target.avengeCurrent + 1);\r\n\tmodifyAttack(target, refCard.attack, sourceBoard, allCards);\r\n\tmodifyHealth(target, refCard.health, sourceBoard, allCards);\r\n\tafterStatsUpdate(target, sourceBoard, allCards);\r\n\tspectator.registerPowerTarget(source, target, sourceBoard);\r\n};\r\n\r\nexport const grantRandomAttack = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tadditionalAttack: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\texcludeSource = false,\r\n): void => {\r\n\tconst candidateBoard = board\r\n\t\t.filter((e) => !excludeSource || e.entityId !== source.entityId)\r\n\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tif (candidateBoard.length > 0) {\r\n\t\tconst target = candidateBoard[Math.floor(Math.random() * candidateBoard.length)];\r\n\t\tmodifyAttack(target, additionalAttack, candidateBoard, allCards);\r\n\t\tafterStatsUpdate(target, candidateBoard, allCards);\r\n\t\tspectator.registerPowerTarget(source, target, board);\r\n\t}\r\n};\r\n\r\nexport const grantRandomHealth = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thealth: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\texcludeSource = false,\r\n): void => {\r\n\tconst candidateBoard = board\r\n\t\t.filter((e) => !excludeSource || e.entityId !== source.entityId)\r\n\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tif (candidateBoard.length > 0) {\r\n\t\tconst target = candidateBoard[Math.floor(Math.random() * candidateBoard.length)];\r\n\t\tmodifyHealth(target, health, board, allCards);\r\n\t\tafterStatsUpdate(target, board, allCards);\r\n\t\tspectator.registerPowerTarget(source, target, board);\r\n\t}\r\n};\r\n\r\nexport const grantRandomStats = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tattack: number,\r\n\thealth: number,\r\n\trace: Race,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): BoardEntity => {\r\n\tif (board.length > 0) {\r\n\t\tconst validBeast: BoardEntity = getRandomAliveMinion(\r\n\t\t\tboard.filter((e) => e.entityId !== source.entityId),\r\n\t\t\trace,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t\tif (validBeast) {\r\n\t\t\tmodifyAttack(validBeast, attack, board, allCards);\r\n\t\t\tmodifyHealth(validBeast, health, board, allCards);\r\n\t\t\tafterStatsUpdate(validBeast, board, allCards);\r\n\t\t\tspectator.registerPowerTarget(source, validBeast, board);\r\n\t\t\treturn validBeast;\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nexport const addCardsInHand = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tcards: number,\r\n\tboard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tcardAdded: CardIds = null,\r\n): void => {\r\n\tconst sages = board.filter((e) => e.cardId === CardIds.DeathsHeadSage);\r\n\tconst sagesGolden = board.filter((e) => e.cardId === CardIds.DeathsHeadSageBattlegrounds);\r\n\tconst multiplier = 1 + (cardAdded === CardIds.BloodGem ? sages.length + 2 * sagesGolden.length : 0);\r\n\tconst newCardsInHand = Math.min(10, (playerEntity.cardsInHand ?? 0) + multiplier * cards);\r\n\tif (newCardsInHand <= playerEntity.cardsInHand) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tplayerEntity.cardsInHand = newCardsInHand;\r\n\r\n\tconst peggys = board.filter((e) => e.cardId === CardIds.PeggySturdybone || e.cardId === CardIds.PeggySturdyboneBattlegrounds);\r\n\tpeggys.forEach((peggy) => {\r\n\t\tconst pirate = getRandomAliveMinion(\r\n\t\t\tboard.filter((e) => e.entityId !== peggy.entityId),\r\n\t\t\tRace.PIRATE,\r\n\t\t\tallCards,\r\n\t\t);\r\n\t\tif (pirate) {\r\n\t\t\tmodifyAttack(pirate, peggy.cardId === CardIds.PeggySturdyboneBattlegrounds ? 2 : 1, board, allCards);\r\n\t\t\tmodifyHealth(pirate, peggy.cardId === CardIds.PeggySturdyboneBattlegrounds ? 2 : 1, board, allCards);\r\n\t\t\tafterStatsUpdate(pirate, board, allCards);\r\n\t\t\tspectator.registerPowerTarget(peggy, pirate, board);\r\n\t\t}\r\n\t});\r\n\r\n\tconst thornCaptains = board.filter((e) => e.cardId === CardIds.Thorncaptain || e.cardId === CardIds.ThorncaptainBattlegrounds);\r\n\tthornCaptains.forEach((captain) => {\r\n\t\tmodifyHealth(captain, captain.cardId === CardIds.ThorncaptainBattlegrounds ? 2 : 1, board, allCards);\r\n\t\tafterStatsUpdate(captain, board, allCards);\r\n\t\tspectator.registerPowerTarget(captain, captain, board);\r\n\t});\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = elligibleEntities[Math.floor(Math.random() * elligibleEntities.length)];\r\n\t\tupdateDivineShield(chosen, board, true, allCards);\r\n\t\tspectator.registerPowerTarget(source, chosen, board);\r\n\t}\r\n\t// return board;\r\n};\r\n\r\nexport const updateDivineShield = (entity: BoardEntity, board: BoardEntity[], newValue: boolean, allCards: AllCardsService): void => {\r\n\t// if ((entity.divineShield ?? false) === newValue) {\r\n\t// \treturn;\r\n\t// }\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t10 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake).length +\r\n\t\t\t20 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrakeBattlegrounds).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t10 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake).length +\r\n\t\t\t20 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrakeBattlegrounds).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n};\r\n\r\nexport const grantAllDivineShield = (board: BoardEntity[], tribe: string, cards: AllCardsService): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => isCorrectTribe(cards.getCard(entity.cardId).races, getRaceEnum(tribe)));\r\n\tfor (const entity of elligibleEntities) {\r\n\t\tupdateDivineShield(entity, board, true, cards);\r\n\t}\r\n};\r\n\r\nexport const getRandomAliveMinion = (board: BoardEntity[], race: Race, allCards: AllCardsService): BoardEntity => {\r\n\tconst validTribes = board\r\n\t\t.filter((e) => !race || isCorrectTribe(allCards.getCard(e.cardId).races, race))\r\n\t\t.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\tif (!validTribes.length) {\r\n\t\treturn null;\r\n\t}\r\n\treturn validTribes[Math.floor(Math.random() * validTribes.length)];\r\n};\r\n\r\nexport const getRandomMinionWithHighestHealth = (board: BoardEntity[]): BoardEntity => {\r\n\tif (!board.length) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst highestHealth = Math.max(...board.map((e) => e.health));\r\n\tconst validMinions = board.filter((e) => e.health === highestHealth);\r\n\treturn validMinions[Math.floor(Math.random() * validMinions.length)];\r\n};\r\n\r\nexport const addStatsToBoard = (\r\n\tsourceEntity: BoardEntity | BgsPlayerEntity,\r\n\tboard: BoardEntity[],\r\n\tattack: number,\r\n\thealth: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\ttribe?: string,\r\n): void => {\r\n\tfor (const entity of board) {\r\n\t\tif (!tribe || hasCorrectTribe(entity, Race[tribe], allCards)) {\r\n\t\t\tmodifyAttack(entity, attack, board, allCards);\r\n\t\t\tmodifyHealth(entity, health, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\tspectator.registerPowerTarget(sourceEntity, entity, board);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const grantStatsToMinionsOfEachType = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tattack: number,\r\n\thealth: number,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (board.length > 0) {\r\n\t\tlet boardCopy = [...board];\r\n\t\tfor (const tribe of ALL_BG_RACES) {\r\n\t\t\tconst validMinion: BoardEntity = getRandomAliveMinion(boardCopy, tribe, allCards);\r\n\t\t\tif (validMinion) {\r\n\t\t\t\tmodifyAttack(validMinion, attack, board, allCards);\r\n\t\t\t\tmodifyHealth(validMinion, health, board, allCards);\r\n\t\t\t\tafterStatsUpdate(validMinion, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(source, validMinion, board);\r\n\t\t\t\tboardCopy = boardCopy.filter((e) => e !== validMinion);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const hasMechanic = (card: ReferenceCard, mechanic: string): boolean => {\r\n\treturn card.mechanics?.includes(mechanic);\r\n};\r\n\r\nexport const hasCorrectTribe = (entity: BoardEntity, targetTribe: Race, allCards: AllCardsService): boolean => {\r\n\treturn isCorrectTribe(allCards.getCard(entity.cardId).races, targetTribe);\r\n};\r\n\r\nexport const isCorrectTribe = (cardRaces: readonly string[], targetTribe: Race): boolean => {\r\n\tif (!cardRaces?.length) {\r\n\t\treturn false;\r\n\t}\r\n\treturn cardRaces.map((cardRace) => getRaceEnum(cardRace)).some((raceEnum) => raceEnum === Race.ALL || raceEnum === targetTribe);\r\n};\r\n\r\nexport const getRaceEnum = (race: string): Race => {\r\n\treturn Race[race];\r\n};\r\n\r\nexport const addImpliedMechanics = (entity: BoardEntity): BoardEntity => {\r\n\tconst cleave = CLEAVE_IDS.indexOf(entity.cardId as CardIds) !== -1;\r\n\tconst cantAttack = CANT_ATTACK_IDS.indexOf(entity.cardId as CardIds) !== -1;\r\n\t// Avoid creating a new object if not necessary\r\n\tif (!cleave && !cantAttack) {\r\n\t\treturn entity;\r\n\t}\r\n\treturn {\r\n\t\t...entity,\r\n\t\tcleave: cleave,\r\n\t\tcantAttack: cantAttack,\r\n\t} as BoardEntity;\r\n};\r\n\r\nexport const normalizeCardIdForSkin = (cardId: string): string => {\r\n\tconst skinMatch = cardId.match(/(.*)_SKIN_.*/);\r\n\tif (skinMatch) {\r\n\t\treturn skinMatch[1];\r\n\t}\r\n\treturn cardId;\r\n};\r\n\r\nexport const stringifySimple = (board: readonly BoardEntity[], allCards: AllCardsService = null): string => {\r\n\treturn '[' + board.map((entity) => stringifySimpleCard(entity, allCards)).join(', ') + ']';\r\n};\r\n\r\nexport const stringifySimpleCard = (entity: BoardEntity, allCards: AllCardsService = null): string => {\r\n\treturn entity\r\n\t\t? `${entity.cardId}/${allCards?.getCard(entity.cardId)?.name ?? ''}/atk=${entity.attack}/hp=${entity.health}/ench=${\r\n\t\t\t\tentity.enchantments\r\n\t\t }`\r\n\t\t: null;\r\n};\r\n\r\nexport const isFish = (entity: BoardEntity): boolean => {\r\n\treturn (\r\n\t\tentity.cardId.startsWith(CardIds.AvatarOfNzoth_FishOfNzothTokenBattlegrounds) ||\r\n\t\tentity.cardId.startsWith(CardIds.FishOfNzothBattlegrounds) ||\r\n\t\tentity.additionalCards?.includes(CardIds.DevourerOfSouls_BG_RLK_538)\r\n\t);\r\n};\r\n\r\nexport const isGolden = (cardId: string, allCards: AllCardsService): boolean => {\r\n\treturn !!allCards.getCard(cardId).battlegroundsNormalDbfId;\r\n};\r\n"]}
|