@firestone-hs/simulate-bgs-battle 1.1.622 → 1.1.623

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.
Files changed (111) hide show
  1. package/dist/board-entity.d.ts +1 -0
  2. package/dist/board-entity.js.map +1 -1
  3. package/dist/cards/cards-data.d.ts +1 -0
  4. package/dist/cards/cards-data.js +8 -0
  5. package/dist/cards/cards-data.js.map +1 -1
  6. package/dist/cards/impl/_card-mappings.js +40 -0
  7. package/dist/cards/impl/_card-mappings.js.map +1 -1
  8. package/dist/cards/impl/bg-spell/murkys-fish.d.ts +2 -0
  9. package/dist/cards/impl/bg-spell/murkys-fish.js +21 -0
  10. package/dist/cards/impl/bg-spell/murkys-fish.js.map +1 -0
  11. package/dist/cards/impl/hero-power/fragrant-phylactery-enchantment.d.ts +2 -0
  12. package/dist/cards/impl/hero-power/fragrant-phylactery-enchantment.js +15 -0
  13. package/dist/cards/impl/hero-power/fragrant-phylactery-enchantment.js.map +1 -0
  14. package/dist/cards/impl/hero-power/fragrant-phylactery.js +8 -17
  15. package/dist/cards/impl/hero-power/fragrant-phylactery.js.map +1 -1
  16. package/dist/cards/impl/hero-power/wax-warband.js +1 -1
  17. package/dist/cards/impl/hero-power/wax-warband.js.map +1 -1
  18. package/dist/cards/impl/minion/azsharan-cutlassier.d.ts +2 -0
  19. package/dist/cards/impl/minion/azsharan-cutlassier.js +12 -0
  20. package/dist/cards/impl/minion/azsharan-cutlassier.js.map +1 -0
  21. package/dist/cards/impl/minion/divine-sparkbot.d.ts +2 -0
  22. package/dist/cards/impl/minion/divine-sparkbot.js +14 -0
  23. package/dist/cards/impl/minion/divine-sparkbot.js.map +1 -0
  24. package/dist/cards/impl/minion/expert-technician.d.ts +2 -0
  25. package/dist/cards/impl/minion/expert-technician.js +26 -0
  26. package/dist/cards/impl/minion/expert-technician.js.map +1 -0
  27. package/dist/cards/impl/minion/friendly-bouncer.d.ts +2 -0
  28. package/dist/cards/impl/minion/friendly-bouncer.js +25 -0
  29. package/dist/cards/impl/minion/friendly-bouncer.js.map +1 -0
  30. package/dist/cards/impl/minion/frostwolf-lieutenant.d.ts +2 -0
  31. package/dist/cards/impl/minion/frostwolf-lieutenant.js +13 -0
  32. package/dist/cards/impl/minion/frostwolf-lieutenant.js.map +1 -0
  33. package/dist/cards/impl/minion/master-gadrin.d.ts +2 -0
  34. package/dist/cards/impl/minion/master-gadrin.js +20 -0
  35. package/dist/cards/impl/minion/master-gadrin.js.map +1 -0
  36. package/dist/cards/impl/minion/monstrosity.d.ts +2 -0
  37. package/dist/cards/impl/minion/monstrosity.js +13 -0
  38. package/dist/cards/impl/minion/monstrosity.js.map +1 -0
  39. package/dist/cards/impl/minion/murky-spash-fisher.d.ts +2 -0
  40. package/dist/cards/impl/minion/murky-spash-fisher.js +14 -0
  41. package/dist/cards/impl/minion/murky-spash-fisher.js.map +1 -0
  42. package/dist/cards/impl/minion/pilot-the-shredder.d.ts +2 -0
  43. package/dist/cards/impl/minion/pilot-the-shredder.js +33 -0
  44. package/dist/cards/impl/minion/pilot-the-shredder.js.map +1 -0
  45. package/dist/cards/impl/minion/piloted-whirl-o-tron.d.ts +2 -5
  46. package/dist/cards/impl/minion/piloted-whirl-o-tron.js +12 -3
  47. package/dist/cards/impl/minion/piloted-whirl-o-tron.js.map +1 -1
  48. package/dist/cards/impl/minion/shadowy-construct.d.ts +2 -0
  49. package/dist/cards/impl/minion/shadowy-construct.js +17 -0
  50. package/dist/cards/impl/minion/shadowy-construct.js.map +1 -0
  51. package/dist/cards/impl/minion/sly-raptor.js +1 -1
  52. package/dist/cards/impl/minion/sly-raptor.js.map +1 -1
  53. package/dist/cards/impl/minion/snack-vendor.d.ts +2 -0
  54. package/dist/cards/impl/minion/snack-vendor.js +20 -0
  55. package/dist/cards/impl/minion/snack-vendor.js.map +1 -0
  56. package/dist/cards/impl/minion/stoneshell-guardian.d.ts +2 -0
  57. package/dist/cards/impl/minion/stoneshell-guardian.js +35 -0
  58. package/dist/cards/impl/minion/stoneshell-guardian.js.map +1 -0
  59. package/dist/cards/impl/minion/stormpike-lieutenant.d.ts +2 -0
  60. package/dist/cards/impl/minion/stormpike-lieutenant.js +13 -0
  61. package/dist/cards/impl/minion/stormpike-lieutenant.js.map +1 -0
  62. package/dist/cards/impl/minion/super-constructor.d.ts +2 -0
  63. package/dist/cards/impl/minion/super-constructor.js +13 -0
  64. package/dist/cards/impl/minion/super-constructor.js.map +1 -0
  65. package/dist/cards/impl/minion/tamuzo.d.ts +2 -0
  66. package/dist/cards/impl/minion/tamuzo.js +12 -0
  67. package/dist/cards/impl/minion/tamuzo.js.map +1 -0
  68. package/dist/cards/impl/minion/vaelastrasz.d.ts +2 -5
  69. package/dist/cards/impl/minion/vaelastrasz.js +11 -9
  70. package/dist/cards/impl/minion/vaelastrasz.js.map +1 -1
  71. package/dist/cards/impl/minion/weebomination.d.ts +2 -0
  72. package/dist/cards/impl/minion/weebomination.js +22 -0
  73. package/dist/cards/impl/minion/weebomination.js.map +1 -0
  74. package/dist/keywords/divine-shield.js +8 -3
  75. package/dist/keywords/divine-shield.js.map +1 -1
  76. package/dist/services/card-ids.d.ts +213 -53
  77. package/dist/services/card-ids.js.map +1 -1
  78. package/dist/services/utils.d.ts +3 -0
  79. package/dist/services/utils.js +25 -1
  80. package/dist/services/utils.js.map +1 -1
  81. package/dist/simulation/add-minion-to-board.js +0 -14
  82. package/dist/simulation/add-minion-to-board.js.map +1 -1
  83. package/dist/simulation/attack.js +0 -8
  84. package/dist/simulation/attack.js.map +1 -1
  85. package/dist/simulation/avenge.d.ts +1 -0
  86. package/dist/simulation/avenge.js +9 -1
  87. package/dist/simulation/avenge.js.map +1 -1
  88. package/dist/simulation/battlecries.js +5 -36
  89. package/dist/simulation/battlecries.js.map +1 -1
  90. package/dist/simulation/death-effects.js +12 -0
  91. package/dist/simulation/death-effects.js.map +1 -1
  92. package/dist/simulation/deathrattle-effects.d.ts +0 -1
  93. package/dist/simulation/deathrattle-effects.js +3 -10
  94. package/dist/simulation/deathrattle-effects.js.map +1 -1
  95. package/dist/simulation/deathrattle-spawns.js +3 -14
  96. package/dist/simulation/deathrattle-spawns.js.map +1 -1
  97. package/dist/simulation/on-being-attacked.js +14 -2
  98. package/dist/simulation/on-being-attacked.js.map +1 -1
  99. package/dist/simulation/secrets.d.ts +2 -2
  100. package/dist/simulation/secrets.js +6 -3
  101. package/dist/simulation/secrets.js.map +1 -1
  102. package/dist/simulation/spawn-fail.js +1 -2
  103. package/dist/simulation/spawn-fail.js.map +1 -1
  104. package/dist/simulation/start-of-combat/soc-action-processor.js +0 -15
  105. package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
  106. package/dist/simulation/summon-when-space.js +47 -20
  107. package/dist/simulation/summon-when-space.js.map +1 -1
  108. package/package.json +1 -1
  109. package/dist/cards/impl/minion/crabby.d.ts +0 -5
  110. package/dist/cards/impl/minion/crabby.js +0 -17
  111. package/dist/cards/impl/minion/crabby.js.map +0 -1
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tamuzo = void 0;
4
+ const stats_1 = require("../../../simulation/stats");
5
+ exports.Tamuzo = {
6
+ cardIds: ["BG23_HERO_201_Buddy", "BG23_HERO_201_Buddy_G"],
7
+ onOtherSpawned: (minion, input) => {
8
+ const mult = minion.cardId === "BG23_HERO_201_Buddy_G" ? 2 : 1;
9
+ (0, stats_1.modifyStats)(input.spawned, minion, input.spawned.attack * mult, input.spawned.maxHealth * mult, input.board, input.hero, input.gameState);
10
+ },
11
+ };
12
+ //# sourceMappingURL=tamuzo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tamuzo.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tamuzo.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAG3C,QAAA,MAAM,GAAuB;IACzC,OAAO,EAAE,gDAA0E;IACnF,cAAc,EAAE,CAAC,MAAmB,EAAE,KAAwB,EAAE,EAAE;QACjE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,4BAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,IAAA,mBAAW,EACV,KAAK,CAAC,OAAO,EACb,MAAM,EACN,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,EAC3B,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,EAC9B,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,SAAS,CACf,CAAC;IACH,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnOtherSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { OnOtherSpawnedCard } from '../../card.interface';\r\n\r\nexport const Tamuzo: OnOtherSpawnedCard = {\r\n\tcardIds: [CardIds.Tamuzo_BG23_HERO_201_Buddy, CardIds.Tamuzo_BG23_HERO_201_Buddy_G],\r\n\tonOtherSpawned: (minion: BoardEntity, input: OnOtherSpawnInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.Tamuzo_BG23_HERO_201_Buddy_G ? 2 : 1;\r\n\t\tmodifyStats(\r\n\t\t\tinput.spawned,\r\n\t\t\tminion,\r\n\t\t\tinput.spawned.attack * mult,\r\n\t\t\tinput.spawned.maxHealth * mult,\r\n\t\t\tinput.board,\r\n\t\t\tinput.hero,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t},\r\n};\r\n"]}
@@ -1,5 +1,2 @@
1
- import { BoardEntity } from '../../../board-entity';
2
- import { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';
3
- export declare const Vaelastrasz: {
4
- startOfCombat: (minion: BoardEntity, input: SoCInput) => boolean;
5
- };
1
+ import { RallyCard } from '../../card.interface';
2
+ export declare const Vaelastrasz: RallyCard;
@@ -1,16 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Vaelastrasz = void 0;
4
- const stats_1 = require("../../../simulation/stats");
4
+ const reference_data_1 = require("@firestone-hs/reference-data");
5
+ const cards_in_hand_1 = require("../../../simulation/cards-in-hand");
5
6
  exports.Vaelastrasz = {
6
- startOfCombat: (minion, input) => {
7
- const vaelastraszBonus = minion.cardId === "TB_BaconShop_HERO_56_Buddy_G" ? 6 : 3;
8
- input.playerBoard
9
- .filter((e) => e.entityId !== minion.entityId)
10
- .forEach((e) => {
11
- (0, stats_1.modifyStats)(e, minion, vaelastraszBonus, vaelastraszBonus, input.playerBoard, input.playerEntity, input.gameState);
12
- });
13
- return true;
7
+ cardIds: ["TB_BaconShop_HERO_56_Buddy", "TB_BaconShop_HERO_56_Buddy_G"],
8
+ rally: (minion, input) => {
9
+ const mult = minion.cardId === "TB_BaconShop_HERO_56_Buddy_G" ? 2 : 1;
10
+ const addedCards = [];
11
+ for (let i = 0; i < mult; i++) {
12
+ addedCards.push(input.gameState.cardsData.getRandomMinionForTribe(reference_data_1.Race.DRAGON, 6));
13
+ }
14
+ (0, cards_in_hand_1.addCardsInHand)(input.attackingHero, input.attackingBoard, addedCards, input.gameState);
15
+ return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
14
16
  },
15
17
  };
16
18
  //# sourceMappingURL=vaelastrasz.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vaelastrasz.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/vaelastrasz.ts"],"names":[],"mappings":";;;AAGA,qDAAwD;AAE3C,QAAA,WAAW,GAAG;IAC1B,aAAa,EAAE,CAAC,MAAmB,EAAE,KAAe,EAAE,EAAE;QACvD,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,mCAAqD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpG,KAAK,CAAC,WAAW;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;aAC7C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,IAAA,mBAAW,EACV,CAAC,EACD,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,SAAS,CACf,CAAC;QACH,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC","sourcesContent":["import { CardIds } from '../../../services/card-ids';\nimport { BoardEntity } from '../../../board-entity';\r\nimport { SoCInput } from '../../../simulation/start-of-combat/start-of-combat-input';\r\nimport { modifyStats } from '../../../simulation/stats';\r\n\r\nexport const Vaelastrasz = {\r\n\tstartOfCombat: (minion: BoardEntity, input: SoCInput) => {\r\n\t\tconst vaelastraszBonus = minion.cardId === CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_G ? 6 : 3;\r\n\t\tinput.playerBoard\r\n\t\t\t.filter((e) => e.entityId !== minion.entityId)\r\n\t\t\t.forEach((e) => {\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tminion,\r\n\t\t\t\t\tvaelastraszBonus,\r\n\t\t\t\t\tvaelastraszBonus,\r\n\t\t\t\t\tinput.playerBoard,\r\n\t\t\t\t\tinput.playerEntity,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\treturn true;\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"vaelastrasz.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/vaelastrasz.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,qEAAmE;AAItD,QAAA,WAAW,GAAc;IACrC,OAAO,EAAE,8DAAkG;IAC3G,KAAK,EAAE,CAAC,MAAmB,EAAE,KAAoB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,mCAAqD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxF,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,uBAAuB,CAAC,qBAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;SACnF;QACD,IAAA,8BAAc,EAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACvF,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvD,CAAC;CACD,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { addCardsInHand } from '../../../simulation/cards-in-hand';\r\nimport { OnAttackInput } from '../../../simulation/on-attack';\r\nimport { RallyCard } from '../../card.interface';\r\n\r\nexport const Vaelastrasz: RallyCard = {\r\n\tcardIds: [CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy, CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_G],\r\n\trally: (minion: BoardEntity, input: OnAttackInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.Vaelastrasz_TB_BaconShop_HERO_56_Buddy_G ? 2 : 1;\r\n\t\tconst addedCards: string[] = [];\r\n\t\tfor (let i = 0; i < mult; i++) {\r\n\t\t\taddedCards.push(input.gameState.cardsData.getRandomMinionForTribe(Race.DRAGON, 6));\r\n\t\t}\r\n\t\taddCardsInHand(input.attackingHero, input.attackingBoard, addedCards, input.gameState);\r\n\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
@@ -0,0 +1,2 @@
1
+ import { EndOfTurnCard } from '../../card.interface';
2
+ export declare const Weebomination: EndOfTurnCard;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Weebomination = void 0;
4
+ const attack_1 = require("../../../simulation/attack");
5
+ const stats_1 = require("../../../simulation/stats");
6
+ exports.Weebomination = {
7
+ cardIds: ["TB_BaconShop_HERO_34_Buddy", "TB_BaconShop_HERO_34_Buddy_G"],
8
+ endOfTurn: (minion, input) => {
9
+ var _a;
10
+ const maxHealth = (_a = input.gameState.allCards.getCard("TB_BaconShop_HERO_34").health) !== null && _a !== void 0 ? _a : 30;
11
+ const missingHealth = maxHealth - input.hero.hpLeft;
12
+ const index = input.board.findIndex((e) => e === minion);
13
+ const leftNeighbor = index - 1 >= 0 ? input.board[index - 1] : null;
14
+ const neighbors = minion.cardId === "TB_BaconShop_HERO_34_Buddy_G"
15
+ ? (0, attack_1.getNeighbours)(input.board, minion)
16
+ : [leftNeighbor];
17
+ for (const neighbor of neighbors) {
18
+ (0, stats_1.modifyStats)(neighbor, minion, 0, missingHealth, input.board, input.hero, input.gameState);
19
+ }
20
+ },
21
+ };
22
+ //# sourceMappingURL=weebomination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weebomination.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/weebomination.ts"],"names":[],"mappings":";;;AAEA,uDAA2D;AAC3D,qDAAwD;AAG3C,QAAA,aAAa,GAAkB;IAC3C,OAAO,EAAE,8DAAsG;IAC/G,SAAS,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACzD,MAAM,SAAS,GAAG,MAAA,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,wBAAwC,CAAC,MAAM,mCAAI,EAAE,CAAC;QACxG,MAAM,aAAa,GAAG,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QACpD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;QACzD,MAAM,YAAY,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACpE,MAAM,SAAS,GACd,MAAM,CAAC,MAAM,mCAAuD;YACnE,CAAC,CAAC,IAAA,sBAAa,EAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;YACpC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QACnB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;YACjC,IAAA,mBAAW,EAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SAC1F;IACF,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { getNeighbours } from '../../../simulation/attack';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { EndOfTurnCard, EndOfTurnInput } from '../../card.interface';\r\n\r\nexport const Weebomination: EndOfTurnCard = {\r\n\tcardIds: [CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy, CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy_G],\r\n\tendOfTurn: (minion: BoardEntity, input: EndOfTurnInput) => {\r\n\t\tconst maxHealth = input.gameState.allCards.getCard(CardIds.Patchwerk_TB_BaconShop_HERO_34).health ?? 30;\r\n\t\tconst missingHealth = maxHealth - input.hero.hpLeft;\r\n\t\tconst index = input.board.findIndex((e) => e === minion);\r\n\t\tconst leftNeighbor = index - 1 >= 0 ? input.board[index - 1] : null;\r\n\t\tconst neighbors =\r\n\t\t\tminion.cardId === CardIds.Weebomination_TB_BaconShop_HERO_34_Buddy_G\r\n\t\t\t\t? getNeighbours(input.board, minion)\r\n\t\t\t\t: [leftNeighbor];\r\n\t\tfor (const neighbor of neighbors) {\r\n\t\t\tmodifyStats(neighbor, minion, 0, missingHealth, input.board, input.hero, input.gameState);\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -11,14 +11,19 @@ const utils_2 = require("../utils");
11
11
  const updateDivineShield = (entity, board, hero, otherHero, newValue, gameState) => {
12
12
  var _a, _b;
13
13
  entity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;
14
- entity.divineShield = newValue;
15
- if (entity.divineShield) {
14
+ if (entity.strongDivineShield && newValue === false) {
15
+ entity.strongDivineShield = false;
16
+ }
17
+ else {
18
+ entity.divineShield = newValue;
19
+ }
20
+ if (entity.divineShield && newValue) {
16
21
  const boardForDrake = board;
17
22
  const statsBonus = 6 * boardForDrake.filter((e) => e.cardId === "BG25_043").length +
18
23
  12 * boardForDrake.filter((e) => e.cardId === "BG25_043_G").length;
19
24
  entity.attack += statsBonus;
20
25
  }
21
- else {
26
+ else if (!entity.divineShield) {
22
27
  const boardForDrake = board;
23
28
  const statsBonus = 6 * boardForDrake.filter((e) => e.cardId === "BG25_043").length +
24
29
  12 * boardForDrake.filter((e) => e.cardId === "BG25_043_G").length;
@@ -1 +1 @@
1
- {"version":3,"file":"divine-shield.js","sourceRoot":"","sources":["../../src/keywords/divine-shield.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAG9D,4DAAmE;AACnE,iEAA4D;AAC5D,6CAA+C;AAC/C,+DAA6D;AAE7D,+CAAkD;AAClD,oCAA6D;AAEtD,MAAM,kBAAkB,GAAG,CACjC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,QAAiB,EACjB,SAAwB,EACjB,EAAE;;IACT,MAAM,CAAC,eAAe,GAAG,QAAQ,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe,CAAC;IACnF,MAAM,CAAC,YAAY,GAAG,QAAQ,CAA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AC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7E;AACF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import { CardIds } from '../services/card-ids';\nimport { CardType, Race } from '@firestone-hs/reference-data';\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnDivineShieldUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { pickRandom } from '../services/utils';\r\nimport { addCardsInHand } from '../simulation/cards-in-hand';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { grantRandomStats, hasCorrectTribe } from '../utils';\r\n\r\nexport const updateDivineShield = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tnewValue: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;\r\n\tentity.divineShield = newValue;\r\n\tif (entity.divineShield) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n\r\n\t// Lost divine shield\r\n\tif (entity.hadDivineShield && !entity.divineShield) {\r\n\t\tconst adapter = hero.trinkets\r\n\t\t\t.filter((t) => t.cardId === CardIds.MechagonAdapter_BG30_MagicItem_910)\r\n\t\t\t.filter((t) => t.scriptDataNum1 > 0)[0];\r\n\t\tif (!!adapter && hasCorrectTribe(entity, hero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\tadapter.scriptDataNum1--;\r\n\t\t}\r\n\r\n\t\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[trinket.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(trinket, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < board.length; i++) {\r\n\t\t\tif (board[i].cardId === CardIds.BolvarFireblood_ICC_858) {\r\n\t\t\t\tmodifyStats(board[i], board[i], 2, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t\t// } else if (board[i].cardId === CardIds.BolvarFireblood_TB_BaconUps_047) {\r\n\t\t\t\t// \tmodifyStats(board[i], board[i], 4, 0, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t\t// } else if (board[i].cardId === CardIds.DrakonidEnforcer_BGS_067) {\r\n\t\t\t\t// \tmodifyStats(board[i], board[i], 2, 2, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t\t// } else if (board[i].cardId === CardIds.DrakonidEnforcer_TB_BaconUps_117) {\r\n\t\t\t\t// \tmodifyStats(board[i], board[i], 4, 4, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].entityId !== entity.entityId &&\r\n\t\t\t\t(board[i].cardId === CardIds.HolyMecherel_BG20_401 ||\r\n\t\t\t\t\tboard[i].cardId === CardIds.HolyMecherel_BG20_401_G)\r\n\t\t\t) {\r\n\t\t\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem], gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037_G) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem, CardIds.BloodGem], gameState);\r\n\t\t\t\t// } else if (\r\n\t\t\t\t// \tboard[i].cardId === CardIds.CogworkCopter_BG24_008 ||\r\n\t\t\t\t// \tboard[i].cardId === CardIds.CogworkCopter_BG24_008_G\r\n\t\t\t\t// ) {\r\n\t\t\t\t// When it's the opponent, the game state already contains all the buffs\r\n\t\t\t\tif (board[i]?.friendly) {\r\n\t\t\t\t\tconst buff = 1; //board[i].cardId === CardIds.CogworkCopter_BG24_008_G ? 2 : 1;\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tboard[i],\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = pickRandom(elligibleEntities);\r\n\t\tupdateDivineShield(chosen, board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, chosen, board, null, null);\r\n\t}\r\n};\r\n\r\nexport const grantDivineShieldToLeftmostMinions = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tquantity: number,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < Math.min(quantity, board.length); i++) {\r\n\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, board[i], board, null, null);\r\n\t}\r\n};\r\n\r\nexport interface OnDivineShieldUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n\ttarget: BoardEntity;\r\n\tpreviousValue: boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"divine-shield.js","sourceRoot":"","sources":["../../src/keywords/divine-shield.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAG9D,4DAAmE;AACnE,iEAA4D;AAE5D,6CAA+C;AAC/C,+DAA6D;AAE7D,+CAAkD;AAClD,oCAA6D;AAEtD,MAAM,kBAAkB,GAAG,CACjC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAA0B,EAC1B,QAAiB,EACjB,SAAwB,EACjB,EAAE;;IACT,MAAM,CAAC,eAAe,GAAG,QAAQ,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe,CAAC;IACnF,IAAI,MAAM,CAAC,kBAAkB,IAAI,QAAQ,KAAK,KAAK,EAAE;QACpD,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAC;KAClC;SAAM;QACN,MAAM,CAAC,YAAY,GAAG,QAAQ,CAAC;KAC/B;IACD,IAAI,MAAM,CAAC,YAAY,IAAI,QAAQ,EAAE;QACpC,MAAM,aAAa,GAAG,KAAK,CAAC;QAC5B,MAAM,UAAU,GACf,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,eAAiC,CAAC,CAAC,MAAM;YACjF,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,iBAAmC,CAAC,CAAC,MAAM,CAAC;QAEtF,MAAM,CAAC,MAAM,IAAI,UAAU,CAAC;KAC5B;SAAM,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;QAEhC,MAAM,aAAa,GAAG,KAA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,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAClE,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,iBAAiB,CAAC,CAAC;QAC7C,IAAA,0BAAkB,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACpE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC3E;AACF,CAAC,CAAC;AAfW,QAAA,uBAAuB,2BAelC;AAEK,MAAM,kCAAkC,GAAG,CACjD,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,QAAgB,EAChB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;IACT,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1D,IAAA,0BAAkB,EAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACtE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7E;AACF,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C","sourcesContent":["import { CardType, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnDivineShieldUpdated } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandom } from '../services/utils';\r\nimport { addCardsInHand } from '../simulation/cards-in-hand';\r\nimport { FullGameState } from '../simulation/internal-game-state';\r\nimport { modifyStats } from '../simulation/stats';\r\nimport { grantRandomStats, hasCorrectTribe } from '../utils';\r\n\r\nexport const updateDivineShield = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tnewValue: boolean,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.hadDivineShield = newValue || entity.divineShield || entity.hadDivineShield;\r\n\tif (entity.strongDivineShield && newValue === false) {\r\n\t\tentity.strongDivineShield = false;\r\n\t} else {\r\n\t\tentity.divineShield = newValue;\r\n\t}\r\n\tif (entity.divineShield && newValue) {\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\t// Don't trigger all \"on attack changed\" effects, since it's an aura\r\n\t\tentity.attack += statsBonus;\r\n\t} else if (!entity.divineShield) {\r\n\t\t// Also consider itself\r\n\t\tconst boardForDrake = board;\r\n\t\tconst statsBonus =\r\n\t\t\t6 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043).length +\r\n\t\t\t12 * boardForDrake.filter((e) => e.cardId === CardIds.CyborgDrake_BG25_043_G).length;\r\n\t\tentity.attack -= statsBonus;\r\n\t}\r\n\r\n\t// Lost divine shield\r\n\tif (entity.hadDivineShield && !entity.divineShield) {\r\n\t\tconst adapter = hero.trinkets\r\n\t\t\t.filter((t) => t.cardId === CardIds.MechagonAdapter_BG30_MagicItem_910)\r\n\t\t\t.filter((t) => t.scriptDataNum1 > 0)[0];\r\n\t\tif (!!adapter && hasCorrectTribe(entity, hero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tupdateDivineShield(entity, board, hero, otherHero, true, gameState);\r\n\t\t\tadapter.scriptDataNum1--;\r\n\t\t}\r\n\r\n\t\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[trinket.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(trinket, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst onDivineShieldUpdatedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnDivineShieldUpdated(onDivineShieldUpdatedImpl)) {\r\n\t\t\t\tonDivineShieldUpdatedImpl.onDivineShieldUpdated(boardEntity, {\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tpreviousValue: entity.hadDivineShield,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < board.length; i++) {\r\n\t\t\tif (board[i].cardId === CardIds.BolvarFireblood_ICC_858) {\r\n\t\t\t\tmodifyStats(board[i], board[i], 2, 0, board, hero, gameState);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t\t// } else if (board[i].cardId === CardIds.BolvarFireblood_TB_BaconUps_047) {\r\n\t\t\t\t// \tmodifyStats(board[i], board[i], 4, 0, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t\t// } else if (board[i].cardId === CardIds.DrakonidEnforcer_BGS_067) {\r\n\t\t\t\t// \tmodifyStats(board[i], board[i], 2, 2, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t\t// } else if (board[i].cardId === CardIds.DrakonidEnforcer_TB_BaconUps_117) {\r\n\t\t\t\t// \tmodifyStats(board[i], board[i], 4, 4, board, hero, gameState);\r\n\t\t\t\t// \tgameState.spectator.registerPowerTarget(board[i], board[i], board, hero, otherHero);\r\n\t\t\t} else if (\r\n\t\t\t\tboard[i].entityId !== entity.entityId &&\r\n\t\t\t\t(board[i].cardId === CardIds.HolyMecherel_BG20_401 ||\r\n\t\t\t\t\tboard[i].cardId === CardIds.HolyMecherel_BG20_401_G)\r\n\t\t\t) {\r\n\t\t\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem], gameState);\r\n\t\t\t} else if (board[i].cardId === CardIds.Gemsplitter_BG21_037_G) {\r\n\t\t\t\taddCardsInHand(hero, board, [CardIds.BloodGem, CardIds.BloodGem], gameState);\r\n\t\t\t\t// } else if (\r\n\t\t\t\t// \tboard[i].cardId === CardIds.CogworkCopter_BG24_008 ||\r\n\t\t\t\t// \tboard[i].cardId === CardIds.CogworkCopter_BG24_008_G\r\n\t\t\t\t// ) {\r\n\t\t\t\t// When it's the opponent, the game state already contains all the buffs\r\n\t\t\t\tif (board[i]?.friendly) {\r\n\t\t\t\t\tconst buff = 1; //board[i].cardId === CardIds.CogworkCopter_BG24_008_G ? 2 : 1;\r\n\t\t\t\t\tgrantRandomStats(\r\n\t\t\t\t\t\tboard[i],\r\n\t\t\t\t\t\thero.hand.filter(\r\n\t\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\t\tgameState.allCards.getCard(e.cardId).type?.toUpperCase() === CardType[CardType.MINION],\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tbuff,\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const grantRandomDivineShield = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst elligibleEntities = board\r\n\t\t.filter((entity) => !entity.divineShield)\r\n\t\t.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\tif (elligibleEntities.length > 0) {\r\n\t\tconst chosen = pickRandom(elligibleEntities);\r\n\t\tupdateDivineShield(chosen, board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, chosen, board, null, null);\r\n\t}\r\n};\r\n\r\nexport const grantDivineShieldToLeftmostMinions = (\r\n\tsource: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tquantity: number,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < Math.min(quantity, board.length); i++) {\r\n\t\tupdateDivineShield(board[i], board, hero, otherHero, true, gameState);\r\n\t\tgameState.spectator.registerPowerTarget(source, board[i], board, null, null);\r\n\t}\r\n};\r\n\r\nexport interface OnDivineShieldUpdatedInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n\ttarget: BoardEntity;\r\n\tpreviousValue: boolean;\r\n}\r\n"]}