@firestone-hs/simulate-bgs-battle 1.1.759 → 1.1.762

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 (58) 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 +5 -0
  5. package/dist/cards/cards-data.js.map +1 -1
  6. package/dist/cards/impl/bg-spell/brood-of-nozdormu.js +1 -1
  7. package/dist/cards/impl/bg-spell/brood-of-nozdormu.js.map +1 -1
  8. package/dist/cards/impl/enchantments/deaths-embrace.js +1 -3
  9. package/dist/cards/impl/enchantments/deaths-embrace.js.map +1 -1
  10. package/dist/cards/impl/enchantments/doppelganger.js +1 -1
  11. package/dist/cards/impl/enchantments/doppelganger.js.map +1 -1
  12. package/dist/cards/impl/enchantments/spell-siphon.d.ts +2 -2
  13. package/dist/cards/impl/enchantments/spell-siphon.js +46 -5
  14. package/dist/cards/impl/enchantments/spell-siphon.js.map +1 -1
  15. package/dist/cards/impl/minion/bramble-tunneler.js +1 -1
  16. package/dist/cards/impl/minion/bramble-tunneler.js.map +1 -1
  17. package/dist/cards/impl/minion/drustfallen-butcher.js +1 -1
  18. package/dist/cards/impl/minion/drustfallen-butcher.js.map +1 -1
  19. package/dist/cards/impl/minion/faceless-converter.js +4 -2
  20. package/dist/cards/impl/minion/faceless-converter.js.map +1 -1
  21. package/dist/cards/impl/minion/joyous.js +2 -3
  22. package/dist/cards/impl/minion/joyous.js.map +1 -1
  23. package/dist/cards/impl/minion/lurking-leviathan.js +2 -1
  24. package/dist/cards/impl/minion/lurking-leviathan.js.map +1 -1
  25. package/dist/cards/impl/minion/relentless-deflector.js +3 -0
  26. package/dist/cards/impl/minion/relentless-deflector.js.map +1 -1
  27. package/dist/cards/impl/minion/sinrunner-blanchy.js +1 -0
  28. package/dist/cards/impl/minion/sinrunner-blanchy.js.map +1 -1
  29. package/dist/cards/impl/minion/tasty-lobster.js +3 -1
  30. package/dist/cards/impl/minion/tasty-lobster.js.map +1 -1
  31. package/dist/cards/impl/minion/the-shadow-of-doubt.js +3 -2
  32. package/dist/cards/impl/minion/the-shadow-of-doubt.js.map +1 -1
  33. package/dist/cards/impl/minion/underrot-spawn.js +1 -1
  34. package/dist/cards/impl/minion/underrot-spawn.js.map +1 -1
  35. package/dist/cards/impl/minion/vicious-mindslasher.js +3 -2
  36. package/dist/cards/impl/minion/vicious-mindslasher.js.map +1 -1
  37. package/dist/cards/impl/minion/wildfire-elemental.js +2 -1
  38. package/dist/cards/impl/minion/wildfire-elemental.js.map +1 -1
  39. package/dist/cards/impl/trinket/hammer-of-twilight.js +10 -3
  40. package/dist/cards/impl/trinket/hammer-of-twilight.js.map +1 -1
  41. package/dist/input-sanitation.js +1 -0
  42. package/dist/input-sanitation.js.map +1 -1
  43. package/dist/simulation/death-effects.js +3 -0
  44. package/dist/simulation/death-effects.js.map +1 -1
  45. package/dist/simulation/deathrattle-orchestration.js +2 -1
  46. package/dist/simulation/deathrattle-orchestration.js.map +1 -1
  47. package/dist/simulation/minion-death.js +5 -1
  48. package/dist/simulation/minion-death.js.map +1 -1
  49. package/dist/simulation/simulator.js +5 -11
  50. package/dist/simulation/simulator.js.map +1 -1
  51. package/dist/simulation/start-of-combat/soc-action-processor.d.ts +1 -1
  52. package/dist/simulation/start-of-combat/soc-action-processor.js +10 -8
  53. package/dist/simulation/start-of-combat/soc-action-processor.js.map +1 -1
  54. package/dist/simulation/start-of-combat/soc-minion.js +3 -12
  55. package/dist/simulation/start-of-combat/soc-minion.js.map +1 -1
  56. package/dist/simulation/summon-when-space.js +1 -0
  57. package/dist/simulation/summon-when-space.js.map +1 -1
  58. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"tasty-lobster.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tasty-lobster.ts"],"names":[],"mappings":";;;AAQA,iEAAoD;AAGpD,mDAAkE;AAElE,q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C,uBAAuB,CAAC,UAAU,CAAC,iBAAiB;YACzD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IACtF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Tasty Lobster (Tier 3, 1/1)\r\n * Deathrattle: Give a random friendly Beast +1/+1. Improve your future Tasty Lobsters.\r\n *\r\n * Golden Tasty Lobster (Tier 3, 2/2)\r\n * Deathrattle: Give a random friendly Beast +2/+2. Improve your future Tasty Lobsters.\r\n *\r\n */\r\nimport { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickMultipleRandomAlive } from '../../../services/utils';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { DeathrattleEffectCard } from '../../card.interface';\r\n\r\nconst numberOfTargets = 1;\r\n\r\nexport const lobsterBaseAttackBuff = 2;\r\nexport const lobsterBaseHealthBuff = 1;\r\n\r\nexport const TastyLobster: DeathrattleEffectCard = {\r\n\tcardIds: [CardIds.TastyLobster_BG36_202, CardIds.TastyLobster_BG36_202_G],\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst base = minion.cardId === CardIds.TastyLobster_BG36_202_G ? 2 : 1;\r\n\t\t// Don't use a fallback to the scriptDataNum1, as it's too cumbersome to manage\r\n\t\t// If for some reason the globalInfo is not set, understand why!\r\n\t\tconst atkBuff = base * lobsterBaseAttackBuff * (1 + input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff);\r\n\t\tconst healthBuff =\r\n\t\t\tbase * lobsterBaseHealthBuff * (1 + input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff);\r\n\t\tconst candidates = input.boardWithDeadEntity.filter((e) =>\r\n\t\t\thasCorrectTribe(\r\n\t\t\t\te,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tRace.BEAST,\r\n\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\tinput.gameState.allCards,\r\n\t\t\t),\r\n\t\t);\r\n\t\tconst targets = pickMultipleRandomAlive(candidates, numberOfTargets);\r\n\t\tfor (const target of targets) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tminion,\r\n\t\t\t\tatkBuff,\r\n\t\t\t\thealthBuff,\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\tconst priorBuff = input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff;\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff =\r\n\t\t\tMath.max(input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff, priorBuff) + 1;\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"tasty-lobster.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/tasty-lobster.ts"],"names":[],"mappings":";;;AAQA,iEAAoD;AAGpD,mDAAkE;AAElE,qDAAwD;AACxD,0CAAiD;AAGjD,MAAM,eAAe,GAAG,CAAC,CAAC;AAEb,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAC1B,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAE1B,QAAA,YAAY,GAA0B;IAClD,OAAO,EAAE,0BAAgE;IACzE,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC5E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAoC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAGvE,MAAM,OAAO,GAAG,IAAI,GAAG,6BAAqB,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAChH,MAAM,UAAU,GACf,IAAI,GAAG,6BAAqB,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QACjG,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAClD,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,GAAG,CAAC;YACZ,CAAC,CAAC,CAAC,cAAc;YACjB,IAAA,uBAAe,EACd,CAAC,EACD,KAAK,CAAC,uBAAuB,EAC7B,qBAAI,CAAC,KAAK,EACV,KAAK,CAAC,SAAS,CAAC,SAAS,EACzB,KAAK,CAAC,SAAS,CAAC,QAAQ,CACxB,CACF,CAAC;QACF,MAAM,OAAO,GAAG,IAAA,+BAAuB,EAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QACrE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC7B,IAAA,mBAAW,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,UAAU,EACV,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,SAAS,CACf,CAAC;SACF;QACD,MAAM,SAAS,GAAG,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,iBAAiB,CAAC;QAC7E,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,iBAAiB;YACzD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IACtF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Tasty Lobster (Tier 3, 1/1)\r\n * Deathrattle: Give a random friendly Beast +1/+1. Improve your future Tasty Lobsters.\r\n *\r\n * Golden Tasty Lobster (Tier 3, 2/2)\r\n * Deathrattle: Give a random friendly Beast +2/+2. Improve your future Tasty Lobsters.\r\n *\r\n */\r\nimport { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickMultipleRandomAlive } from '../../../services/utils';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { hasCorrectTribe } from '../../../utils';\r\nimport { DeathrattleEffectCard } from '../../card.interface';\r\n\r\nconst numberOfTargets = 1;\r\n\r\nexport const lobsterBaseAttackBuff = 2;\r\nexport const lobsterBaseHealthBuff = 1;\r\n\r\nexport const TastyLobster: DeathrattleEffectCard = {\r\n\tcardIds: [CardIds.TastyLobster_BG36_202, CardIds.TastyLobster_BG36_202_G],\r\n\tdeathrattleEffect: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst base = minion.cardId === CardIds.TastyLobster_BG36_202_G ? 2 : 1;\r\n\t\t// Don't use a fallback to the scriptDataNum1, as it's too cumbersome to manage\r\n\t\t// If for some reason the globalInfo is not set, understand why!\r\n\t\tconst atkBuff = base * lobsterBaseAttackBuff * (1 + input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff);\r\n\t\tconst healthBuff =\r\n\t\t\tbase * lobsterBaseHealthBuff * (1 + input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff);\r\n\t\tconst candidates = input.boardWithDeadEntity.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.health > 0 &&\r\n\t\t\t\t!e.definitelyDead &&\r\n\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\te,\r\n\t\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\t\tRace.BEAST,\r\n\t\t\t\t\tinput.gameState.anomalies,\r\n\t\t\t\t\tinput.gameState.allCards,\r\n\t\t\t\t),\r\n\t\t);\r\n\t\tconst targets = pickMultipleRandomAlive(candidates, numberOfTargets);\r\n\t\tfor (const target of targets) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tminion,\r\n\t\t\t\tatkBuff,\r\n\t\t\t\thealthBuff,\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\tconst priorBuff = input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff;\r\n\t\tinput.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff =\r\n\t\t\tMath.max(input.boardWithDeadEntityHero.globalInfo.TastyLobstersBuff, priorBuff) + 1;\r\n\t},\r\n};\r\n"]}
@@ -5,8 +5,9 @@ const deity_1 = require("../../../simulation/deity");
5
5
  exports.TheShadowOfDoubt = {
6
6
  cardIds: ["BG36_109", "BG36_109_G"],
7
7
  onCardAddedToHand: (minion, input) => {
8
- const atk = minion.scriptDataNum1 || (minion.cardId === "BG36_109_G" ? 10 : 5);
9
- const hp = minion.scriptDataNum2 || (minion.cardId === "BG36_109_G" ? 10 : 5);
8
+ const mult = minion.cardId === "BG36_109_G" ? 2 : 1;
9
+ const atk = 4 * mult;
10
+ const hp = 5 * mult;
10
11
  (0, deity_1.buffYourDeity)(input.hero, input.board, minion, atk, hp, input.gameState);
11
12
  },
12
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"the-shadow-of-doubt.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/the-shadow-of-doubt.ts"],"names":[],"mappings":";;;AAUA,qDAA0D;AAG7C,QAAA,gBAAgB,GAA0B;IACtD,OAAO,EAAE,0BAAwE;IACjF,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAA6B,EAAE,EAAE;QACzE,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,MAAM,iBAAwC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtG,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,MAAM,iBAAwC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrG,IAAA,qBAAa,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1E,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * The Shadow of Doubt (Tier 6, 6/8)\r\n * Whenever a card is added to your hand, give your Deity +3/+4.\r\n *\r\n * Golden The Shadow of Doubt (Tier 6, 12/16)\r\n * Whenever a card is added to your hand, give your Deity +6/+8.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnCardAddedToHandInput } from '../../../simulation/cards-in-hand';\r\nimport { buffYourDeity } from '../../../simulation/deity';\r\nimport { OnCardAddedToHandCard } from '../../card.interface';\r\n\r\nexport const TheShadowOfDoubt: OnCardAddedToHandCard = {\r\n\tcardIds: [CardIds.TheShadowOfDoubt_BG36_109, CardIds.TheShadowOfDoubt_BG36_109_G],\r\n\tonCardAddedToHand: (minion: BoardEntity, input: OnCardAddedToHandInput) => {\r\n\t\tconst atk = minion.scriptDataNum1 || (minion.cardId === CardIds.TheShadowOfDoubt_BG36_109_G ? 10 : 5);\r\n\t\tconst hp = minion.scriptDataNum2 || (minion.cardId === CardIds.TheShadowOfDoubt_BG36_109_G ? 10 : 5);\r\n\t\tbuffYourDeity(input.hero, input.board, minion, atk, hp, input.gameState);\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"the-shadow-of-doubt.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/the-shadow-of-doubt.ts"],"names":[],"mappings":";;;AAUA,qDAA0D;AAG7C,QAAA,gBAAgB,GAA0B;IACtD,OAAO,EAAE,0BAAwE;IACjF,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAA6B,EAAE,EAAE;QACzE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAAwC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;QACrB,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;QACpB,IAAA,qBAAa,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1E,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * The Shadow of Doubt (Tier 6, 6/8)\r\n * Whenever a card is added to your hand, give your Deity +3/+4.\r\n *\r\n * Golden The Shadow of Doubt (Tier 6, 12/16)\r\n * Whenever a card is added to your hand, give your Deity +6/+8.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnCardAddedToHandInput } from '../../../simulation/cards-in-hand';\r\nimport { buffYourDeity } from '../../../simulation/deity';\r\nimport { OnCardAddedToHandCard } from '../../card.interface';\r\n\r\nexport const TheShadowOfDoubt: OnCardAddedToHandCard = {\r\n\tcardIds: [CardIds.TheShadowOfDoubt_BG36_109, CardIds.TheShadowOfDoubt_BG36_109_G],\r\n\tonCardAddedToHand: (minion: BoardEntity, input: OnCardAddedToHandInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.TheShadowOfDoubt_BG36_109_G ? 2 : 1;\r\n\t\tconst atk = 4 * mult;\r\n\t\tconst hp = 5 * mult;\r\n\t\tbuffYourDeity(input.hero, input.board, minion, atk, hp, input.gameState);\r\n\t},\r\n};\r\n"]}
@@ -7,7 +7,7 @@ exports.UnderrotSpawn = {
7
7
  cardIds: ["BG36_116", "BG36_116_G"],
8
8
  deathrattleSpawn: (minion, input) => {
9
9
  const quantity = minion.cardId === "BG36_116_G" ? 2 : 1;
10
- const atk = minion.scriptDataNum1 || quantity;
10
+ const atk = quantity;
11
11
  const tentacleId = "BGFYM_002t";
12
12
  (0, deathrattle_spawns_1.simplifiedSpawnEntitiesWithAddToBoard)(tentacleId, quantity, input, minion, input.deadEntityIndexFromRight);
13
13
  for (const target of input.boardWithDeadEntity) {
@@ -1 +1 @@
1
- {"version":3,"file":"underrot-spawn.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/underrot-spawn.ts"],"names":[],"mappings":";;;AAUA,+EAA+F;AAC/F,qDAAwD;AAG3C,QAAA,aAAa,GAAyB;IAClD,OAAO,EAAE,0BAAkE;IAC3E,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,iBAAqC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,IAAI,QAAQ,CAAC;QAC9C,MAAM,UAAU,eAA2C,CAAC;QAC5D,IAAA,0DAAqC,EAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAE3G,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE;YAC/C,IAAA,mBAAW,EACV,MAAM,EACN,MAAM,EACN,GAAG,EACH,CAAC,EACD,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,SAAS,CACf,CAAC;SACF;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Underrot Spawn (Tier 2, 2/2)\r\n * Deathrattle: Summon a 0/2 Tentacle with Taunt. Give your minions +1 Attack.\r\n *\r\n * Golden Underrot Spawn (Tier 2, 4/4)\r\n * Deathrattle: Summon two 0/2 Tentacles with Taunt. Give your minions +2 Attack.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntitiesWithAddToBoard } from '../../../simulation/deathrattle-spawns';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const UnderrotSpawn: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.UnderrotSpawn_BG36_116, CardIds.UnderrotSpawn_BG36_116_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst quantity = minion.cardId === CardIds.UnderrotSpawn_BG36_116_G ? 2 : 1;\r\n\t\tconst atk = minion.scriptDataNum1 || quantity;\r\n\t\tconst tentacleId = CardIds.AberrantTentacleToken_BGFYM_002t;\r\n\t\tsimplifiedSpawnEntitiesWithAddToBoard(tentacleId, quantity, input, minion, input.deadEntityIndexFromRight);\r\n\r\n\t\tfor (const target of input.boardWithDeadEntity) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tminion,\r\n\t\t\t\tatk,\r\n\t\t\t\t0,\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn [];\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"underrot-spawn.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/underrot-spawn.ts"],"names":[],"mappings":";;;AAUA,+EAA+F;AAC/F,qDAAwD;AAG3C,QAAA,aAAa,GAAyB;IAClD,OAAO,EAAE,0BAAkE;IAC3E,gBAAgB,EAAE,CAAC,MAAmB,EAAE,KAAgC,EAAE,EAAE;QAC3E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,iBAAqC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,QAAQ,CAAC;QACrB,MAAM,UAAU,eAA2C,CAAC;QAC5D,IAAA,0DAAqC,EAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAE3G,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE;YAC/C,IAAA,mBAAW,EACV,MAAM,EACN,MAAM,EACN,GAAG,EACH,CAAC,EACD,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,SAAS,CACf,CAAC;SACF;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Underrot Spawn (Tier 2, 2/2)\r\n * Deathrattle: Summon a 0/2 Tentacle with Taunt. Give your minions +1 Attack.\r\n *\r\n * Golden Underrot Spawn (Tier 2, 4/4)\r\n * Deathrattle: Summon two 0/2 Tentacles with Taunt. Give your minions +2 Attack.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { DeathrattleTriggeredInput } from '../../../simulation/deathrattle-on-trigger';\r\nimport { simplifiedSpawnEntitiesWithAddToBoard } from '../../../simulation/deathrattle-spawns';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { DeathrattleSpawnCard } from '../../card.interface';\r\n\r\nexport const UnderrotSpawn: DeathrattleSpawnCard = {\r\n\tcardIds: [CardIds.UnderrotSpawn_BG36_116, CardIds.UnderrotSpawn_BG36_116_G],\r\n\tdeathrattleSpawn: (minion: BoardEntity, input: DeathrattleTriggeredInput) => {\r\n\t\tconst quantity = minion.cardId === CardIds.UnderrotSpawn_BG36_116_G ? 2 : 1;\r\n\t\tconst atk = quantity;\r\n\t\tconst tentacleId = CardIds.AberrantTentacleToken_BGFYM_002t;\r\n\t\tsimplifiedSpawnEntitiesWithAddToBoard(tentacleId, quantity, input, minion, input.deadEntityIndexFromRight);\r\n\r\n\t\tfor (const target of input.boardWithDeadEntity) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tminion,\r\n\t\t\t\tatk,\r\n\t\t\t\t0,\r\n\t\t\t\tinput.boardWithDeadEntity,\r\n\t\t\t\tinput.boardWithDeadEntityHero,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn [];\r\n\t},\r\n};\r\n"]}
@@ -8,8 +8,9 @@ exports.ViciousMindslasher = {
8
8
  cardIds: ["BG36_108", "BG36_108_G"],
9
9
  onTavernSpellCast: (minion, input) => {
10
10
  var _a;
11
- const atk = minion.scriptDataNum1 || (minion.cardId === "BG36_108_G" ? 2 : 1);
12
- const hp = minion.scriptDataNum2 || (minion.cardId === "BG36_108_G" ? 6 : 3);
11
+ const mult = minion.cardId === "BG36_108_G" ? 2 : 1;
12
+ const atk = 1 * mult;
13
+ const hp = 2 * mult;
13
14
  (0, stats_1.modifyStats)(minion, minion, atk, hp, input.board, input.hero, input.gameState);
14
15
  (0, deity_1.buffYourDeity)(input.hero, input.board, minion, atk, hp, input.gameState);
15
16
  if ((_a = input.hero.trinkets) === null || _a === void 0 ? void 0 : _a.some((t) => t.cardId === "BG36_MagicItem_402")) {
@@ -1 +1 @@
1
- {"version":3,"file":"vicious-mindslasher.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/vicious-mindslasher.ts"],"names":[],"mappings":";;;AAWA,uDAA2D;AAC3D,qDAA0D;AAC1D,qDAAwD;AAG3C,QAAA,kBAAkB,GAA0B;IACxD,OAAO,EAAE,0BAA4E;IACrF,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACjE,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvG,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC,MAAM,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtG,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/E,IAAA,qBAAa,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACzE,IAAI,MAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAmD,CAAC,EAAE;YAClG,KAAK,MAAM,SAAS,IAAI,IAAA,sBAAa,EAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;gBAC3D,IAAA,mBAAW,EAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;aAClF;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Vicious Mindslasher (Tier 3, 3/1)\r\n * Whenever you cast a Tavern spell, give this and your Deity +1/+3.\r\n *\r\n * Golden Vicious Mindslasher (Tier 3, 6/2)\r\n * Whenever you cast a Tavern spell, give this and your Deity +2/+6.\r\n *\r\n * Mindslasher Portrait: also give the stats to adjacent minions.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { getNeighbours } from '../../../simulation/attack';\r\nimport { buffYourDeity } from '../../../simulation/deity';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { CastSpellInput, OnTavernSpellCastCard } from '../../card.interface';\r\n\r\nexport const ViciousMindslasher: OnTavernSpellCastCard = {\r\n\tcardIds: [CardIds.ViciousMindslasher_BG36_108, CardIds.ViciousMindslasher_BG36_108_G],\r\n\tonTavernSpellCast: (minion: BoardEntity, input: CastSpellInput) => {\r\n\t\tconst atk = minion.scriptDataNum1 || (minion.cardId === CardIds.ViciousMindslasher_BG36_108_G ? 2 : 1);\r\n\t\tconst hp = minion.scriptDataNum2 || (minion.cardId === CardIds.ViciousMindslasher_BG36_108_G ? 6 : 3);\r\n\t\tmodifyStats(minion, minion, atk, hp, input.board, input.hero, input.gameState);\r\n\t\tbuffYourDeity(input.hero, input.board, minion, atk, hp, input.gameState);\r\n\t\tif (input.hero.trinkets?.some((t) => t.cardId === CardIds.MindslasherPortrait_BG36_MagicItem_402)) {\r\n\t\t\tfor (const neighbour of getNeighbours(input.board, minion)) {\r\n\t\t\t\tmodifyStats(neighbour, minion, atk, hp, input.board, input.hero, input.gameState);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"vicious-mindslasher.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/vicious-mindslasher.ts"],"names":[],"mappings":";;;AAWA,uDAA2D;AAC3D,qDAA0D;AAC1D,qDAAwD;AAG3C,QAAA,kBAAkB,GAA0B;IACxD,OAAO,EAAE,0BAA4E;IACrF,iBAAiB,EAAE,CAAC,MAAmB,EAAE,KAAqB,EAAE,EAAE;;QACjE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,iBAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;QACrB,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;QACpB,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/E,IAAA,qBAAa,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACzE,IAAI,MAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,yBAAmD,CAAC,EAAE;YAClG,KAAK,MAAM,SAAS,IAAI,IAAA,sBAAa,EAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;gBAC3D,IAAA,mBAAW,EAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;aAClF;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Vicious Mindslasher (Tier 3, 3/1)\r\n * Whenever you cast a Tavern spell, give this and your Deity +1/+3.\r\n *\r\n * Golden Vicious Mindslasher (Tier 3, 6/2)\r\n * Whenever you cast a Tavern spell, give this and your Deity +2/+6.\r\n *\r\n * Mindslasher Portrait: also give the stats to adjacent minions.\r\n */\r\nimport { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { getNeighbours } from '../../../simulation/attack';\r\nimport { buffYourDeity } from '../../../simulation/deity';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { CastSpellInput, OnTavernSpellCastCard } from '../../card.interface';\r\n\r\nexport const ViciousMindslasher: OnTavernSpellCastCard = {\r\n\tcardIds: [CardIds.ViciousMindslasher_BG36_108, CardIds.ViciousMindslasher_BG36_108_G],\r\n\tonTavernSpellCast: (minion: BoardEntity, input: CastSpellInput) => {\r\n\t\tconst mult = minion.cardId === CardIds.ViciousMindslasher_BG36_108_G ? 2 : 1;\r\n\t\tconst atk = 1 * mult;\r\n\t\tconst hp = 2 * mult;\r\n\t\tmodifyStats(minion, minion, atk, hp, input.board, input.hero, input.gameState);\r\n\t\tbuffYourDeity(input.hero, input.board, minion, atk, hp, input.gameState);\r\n\t\tif (input.hero.trinkets?.some((t) => t.cardId === CardIds.MindslasherPortrait_BG36_MagicItem_402)) {\r\n\t\t\tfor (const neighbour of getNeighbours(input.board, minion)) {\r\n\t\t\t\tmodifyStats(neighbour, minion, atk, hp, input.board, input.hero, input.gameState);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WildfireElemental = void 0;
4
+ const utils_1 = require("../../../services/utils");
4
5
  const attack_1 = require("../../../simulation/attack");
5
6
  exports.WildfireElemental = {
6
7
  cardIds: ["BGS_126", "TB_BaconUps_166"],
@@ -13,7 +14,7 @@ exports.WildfireElemental = {
13
14
  let damageDoneByAttacker = 0;
14
15
  if (input.defenderNeighbours.length > 0) {
15
16
  if (minion.cardId === "BGS_126") {
16
- const randomTarget = input.defenderNeighbours[Math.floor(Math.random() * input.defenderNeighbours.length)];
17
+ const randomTarget = (0, utils_1.pickRandom)(input.defenderNeighbours, minion);
17
18
  input.minionKilled.lastAffectedByEntity.venomous = hadVenomous;
18
19
  damageDoneByAttacker += (0, attack_1.dealDamageToMinion)(randomTarget, input.defendingBoard, input.defendingHero, input.minionKilled.lastAffectedByEntity, excessDamage, input.attackingBoard, input.attackingHero, input.gameState);
19
20
  input.minionKilled.lastAffectedByEntity.venomous = false;
@@ -1 +1 @@
1
- {"version":3,"file":"wildfire-elemental.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wildfire-elemental.ts"],"names":[],"mappings":";;;AAEA,uDAAqF;AAGxE,QAAA,iBAAiB,GAAuB;IACpD,OAAO,EAAE,8BAA8E;IACvF,cAAc,EAAE,CACf,MAAmB,EACnB,KAA0B,EACiC,EAAE;QAC7D,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE;YACxD,OAAO,EAAE,iBAAiB,EAAE,CAAC,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oBAAoB,CAAC,QAAQ,GAAG,KAAK,CAAC;iBACzD;aACD;SACD;QACD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IAC1E,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { dealDamageToMinion, OnMinionKilledInput } from '../../../simulation/attack';\r\nimport { OnMinionKilledCard } from '../../card.interface';\r\n\r\nexport const WildfireElemental: OnMinionKilledCard = {\r\n\tcardIds: [CardIds.WildfireElemental_BGS_126, CardIds.WildfireElemental_TB_BaconUps_166],\r\n\tonMinionKilled: (\r\n\t\tminion: BoardEntity,\r\n\t\tinput: OnMinionKilledInput,\r\n\t): { dmgDoneByAttacker: number; dmgDoneByDefender: number } => {\r\n\t\tif (input.killer !== minion || !input.killerIsAttacking) {\r\n\t\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t\t}\r\n\r\n\t\tconst hadVenomous = input.hadVenomous;\r\n\t\tconst excessDamage = -input.minionKilled.health;\r\n\t\tlet damageDoneByAttacker = 0;\r\n\t\t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\tif (input.defenderNeighbours.length > 0) {\r\n\t\t\tif (minion.cardId === CardIds.WildfireElemental_BGS_126) {\r\n\t\t\t\tconst randomTarget =\r\n\t\t\t\t\tinput.defenderNeighbours[Math.floor(Math.random() * input.defenderNeighbours.length)];\r\n\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = hadVenomous;\r\n\t\t\t\tdamageDoneByAttacker += dealDamageToMinion(\r\n\t\t\t\t\trandomTarget,\r\n\t\t\t\t\tinput.defendingBoard,\r\n\t\t\t\t\tinput.defendingHero,\r\n\t\t\t\t\tinput.minionKilled.lastAffectedByEntity,\r\n\t\t\t\t\texcessDamage,\r\n\t\t\t\t\tinput.attackingBoard,\r\n\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = false;\r\n\t\t\t} else {\r\n\t\t\t\tfor (const neighbour of input.defenderNeighbours) {\r\n\t\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = hadVenomous;\r\n\t\t\t\t\tdamageDoneByAttacker += dealDamageToMinion(\r\n\t\t\t\t\t\tneighbour,\r\n\t\t\t\t\t\tinput.defendingBoard,\r\n\t\t\t\t\t\tinput.defendingHero,\r\n\t\t\t\t\t\tinput.minionKilled.lastAffectedByEntity,\r\n\t\t\t\t\t\texcessDamage,\r\n\t\t\t\t\t\tinput.attackingBoard,\r\n\t\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: damageDoneByAttacker, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"wildfire-elemental.js","sourceRoot":"","sources":["../../../../src/cards/impl/minion/wildfire-elemental.ts"],"names":[],"mappings":";;;AAEA,mDAAqD;AACrD,uDAAqF;AAGxE,QAAA,iBAAiB,GAAuB;IACpD,OAAO,EAAE,8BAA8E;IACvF,cAAc,EAAE,CACf,MAAmB,EACnB,KAA0B,EACiC,EAAE;QAC7D,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE;YACxD,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;SACtD;QAED,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACtC,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;QAChD,IAAI,oBAAoB,GAAG,CAAC,CAAC;QAE7B,IAAI,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;YACxC,IAAI,MAAM,CAAC,MAAM,cAAsC,EAAE;gBACxD,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,KAAK,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;gBAClE,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,QAAQ,GAAG,WAAW,CAAC;gBAC/D,oBAAoB,IAAI,IAAA,2BAAkB,EACzC,YAAY,EACZ,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,YAAY,CAAC,oBAAoB,EACvC,YAAY,EACZ,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;gBACF,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,QAAQ,GAAG,KAAK,CAAC;aACzD;iBAAM;gBACN,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,kBAAkB,EAAE;oBACjD,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,QAAQ,GAAG,WAAW,CAAC;oBAC/D,oBAAoB,IAAI,IAAA,2BAAkB,EACzC,SAAS,EACT,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,YAAY,CAAC,oBAAoB,EACvC,YAAY,EACZ,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,SAAS,CACf,CAAC;oBACF,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,QAAQ,GAAG,KAAK,CAAC;iBACzD;aACD;SACD;QACD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IAC1E,CAAC;CACD,CAAC","sourcesContent":["import { BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandom } from '../../../services/utils';\r\nimport { dealDamageToMinion, OnMinionKilledInput } from '../../../simulation/attack';\r\nimport { OnMinionKilledCard } from '../../card.interface';\r\n\r\nexport const WildfireElemental: OnMinionKilledCard = {\r\n\tcardIds: [CardIds.WildfireElemental_BGS_126, CardIds.WildfireElemental_TB_BaconUps_166],\r\n\tonMinionKilled: (\r\n\t\tminion: BoardEntity,\r\n\t\tinput: OnMinionKilledInput,\r\n\t): { dmgDoneByAttacker: number; dmgDoneByDefender: number } => {\r\n\t\tif (input.killer !== minion || !input.killerIsAttacking) {\r\n\t\t\treturn { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };\r\n\t\t}\r\n\r\n\t\tconst hadVenomous = input.hadVenomous;\r\n\t\tconst excessDamage = -input.minionKilled.health;\r\n\t\tlet damageDoneByAttacker = 0;\r\n\t\t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\tif (input.defenderNeighbours.length > 0) {\r\n\t\t\tif (minion.cardId === CardIds.WildfireElemental_BGS_126) {\r\n\t\t\t\tconst randomTarget = pickRandom(input.defenderNeighbours, minion);\r\n\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = hadVenomous;\r\n\t\t\t\tdamageDoneByAttacker += dealDamageToMinion(\r\n\t\t\t\t\trandomTarget,\r\n\t\t\t\t\tinput.defendingBoard,\r\n\t\t\t\t\tinput.defendingHero,\r\n\t\t\t\t\tinput.minionKilled.lastAffectedByEntity,\r\n\t\t\t\t\texcessDamage,\r\n\t\t\t\t\tinput.attackingBoard,\r\n\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\tinput.gameState,\r\n\t\t\t\t);\r\n\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = false;\r\n\t\t\t} else {\r\n\t\t\t\tfor (const neighbour of input.defenderNeighbours) {\r\n\t\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = hadVenomous;\r\n\t\t\t\t\tdamageDoneByAttacker += dealDamageToMinion(\r\n\t\t\t\t\t\tneighbour,\r\n\t\t\t\t\t\tinput.defendingBoard,\r\n\t\t\t\t\t\tinput.defendingHero,\r\n\t\t\t\t\t\tinput.minionKilled.lastAffectedByEntity,\r\n\t\t\t\t\t\texcessDamage,\r\n\t\t\t\t\t\tinput.attackingBoard,\r\n\t\t\t\t\t\tinput.attackingHero,\r\n\t\t\t\t\t\tinput.gameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tinput.minionKilled.lastAffectedByEntity.venomous = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { dmgDoneByAttacker: damageDoneByAttacker, dmgDoneByDefender: 0 };\r\n\t},\r\n};\r\n"]}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HammerOfTwilight = exports.TwilightOfLife = void 0;
4
4
  const stats_1 = require("../../../simulation/stats");
5
5
  const ENCHANTMENT_ID = "BG36_MagicItem_403e";
6
+ const isHammer = (cardId) => cardId === "BG36_MagicItem_403" ||
7
+ cardId === "BG36_MagicItem_403t";
6
8
  const isGreater = (cardId) => cardId === "BG36_MagicItem_403t";
7
9
  const printedAura = (cardId) => {
8
10
  return isGreater(cardId) ? { attack: 2, health: 1 } : { attack: 1, health: 0 };
@@ -39,15 +41,20 @@ exports.HammerOfTwilight = {
39
41
  "BG36_MagicItem_403t",
40
42
  ],
41
43
  onOtherSpawned: (trinket, input) => {
42
- var _a, _b;
44
+ var _a, _b, _c;
43
45
  if (!input.applySelfAuras) {
44
46
  return;
45
47
  }
46
- if ((_a = input.spawned.enchantments) === null || _a === void 0 ? void 0 : _a.some((e) => e.cardId === ENCHANTMENT_ID)) {
48
+ const twilightEnchantments = ((_a = input.spawned.enchantments) !== null && _a !== void 0 ? _a : []).filter((e) => e.cardId === ENCHANTMENT_ID);
49
+ if (twilightEnchantments.some((e) => e.originEntityId === trinket.entityId)) {
50
+ return;
51
+ }
52
+ const hammerEntityIds = new Set(((_b = input.hero.trinkets) !== null && _b !== void 0 ? _b : []).filter((t) => isHammer(t.cardId)).map((t) => t.entityId));
53
+ if (twilightEnchantments.some((e) => !hammerEntityIds.has(e.originEntityId))) {
47
54
  return;
48
55
  }
49
56
  const { attack, health } = currentAura(trinket);
50
- input.spawned.enchantments = (_b = input.spawned.enchantments) !== null && _b !== void 0 ? _b : [];
57
+ input.spawned.enchantments = (_c = input.spawned.enchantments) !== null && _c !== void 0 ? _c : [];
51
58
  input.spawned.enchantments.push({
52
59
  cardId: ENCHANTMENT_ID,
53
60
  originEntityId: trinket.entityId,
@@ -1 +1 @@
1
- {"version":3,"file":"hammer-of-twilight.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/hammer-of-twilight.ts"],"names":[],"mappings":";;;AAWA,qDAAwD;AASxD,MAAM,cAAc,wBAAyE,CAAC;AAE9F,MAAM,SAAS,GAAG,CAAC,MAAc,EAAW,EAAE,CAC7C,MAAM,0BAAuE,CAAC;AAE/E,MAAM,WAAW,GAAG,CAAC,MAAc,EAAsC,EAAE;IAC1E,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAChF,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,OAAqB,EAAsC,EAAE;;IACjF,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO;QACN,MAAM,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,OAAO,CAAC,MAAM;QAChD,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,cAAc,mCAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAChF,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,cAAc,GAA0D;IACpF,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,oBAAoB,EAAE,CAAC,MAAmB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AAC;SACzF;QACD,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE;YACjC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,EAAE;gBAChD,SAAS;aACT;YACD,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YAC3G,MAAM,WAAW,GAAG,MAAA,MAAM,CAAC,YAAY,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,CAAC;YAClF,IAAI,WAAW,EAAE;gBAChB,WAAW,CAAC,iBAAiB,GAAG,CAAC,MAAA,WAAW,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;gBACxF,WAAW,CAAC,iBAAiB,GAAG,CAAC,MAAA,WAAW,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;aACxF;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Hammer of Twilight (lesser): Your minions have +1 Attack. (Improved by each card you've discarded this game!)\r\n * Hammer of Twilight (greater): Your minions have +2/+1. (Improved by each card you've discarded this game!)\r\n *\r\n * Starting-board stats already include the current aura. Combat summons get it here, and combat\r\n * discards improve the aura and the board.\r\n */\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { BoardEnchantment, BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnDespawnInput, OnOtherSpawnInput, OnSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport {\r\n\tDiscardInput,\r\n\tOnDespawnedEnchantmentCard,\r\n\tOnDiscardCard,\r\n\tOnOtherSpawnedCard,\r\n\tOnSpawnedEnchantmentCard,\r\n} from '../../card.interface';\r\n\r\nconst ENCHANTMENT_ID = CardIds.HammerOfTwilight_TwilightOfLifeEnchantment_BG36_MagicItem_403e;\r\n\r\nconst isGreater = (cardId: string): boolean =>\r\n\tcardId === CardIds.HammerOfTwilight_HammerOfTwilightToken_BG36_MagicItem_403t;\r\n\r\nconst printedAura = (cardId: string): { attack: number; health: number } => {\r\n\treturn isGreater(cardId) ? { attack: 2, health: 1 } : { attack: 1, health: 0 };\r\n};\r\n\r\nconst currentAura = (trinket: BoardTrinket): { attack: number; health: number } => {\r\n\tconst printed = printedAura(trinket.cardId);\r\n\treturn {\r\n\t\tattack: trinket.scriptDataNum1 ?? printed.attack,\r\n\t\thealth: isGreater(trinket.cardId) ? trinket.scriptDataNum2 ?? printed.health : 0,\r\n\t};\r\n};\r\n\r\nexport const TwilightOfLife: OnSpawnedEnchantmentCard & OnDespawnedEnchantmentCard = {\r\n\tcardIds: [ENCHANTMENT_ID],\r\n\tonSpawnedEnchantment: (minion: BoardEntity, enchantment: BoardEnchantment, input: OnSpawnInput) => {\r\n\t\tmodifyStats(\r\n\t\t\tminion,\r\n\t\t\tnull,\r\n\t\t\tinput.applyAttackAuras ? enchantment.tagScriptDataNum1 ?? 0 : 0,\r\n\t\t\tinput.applyHealthAuras ? enchantment.tagScriptDataNum2 ?? 0 : 0,\r\n\t\t\tinput.board,\r\n\t\t\tinput.hero,\r\n\t\t\tinput.gameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t},\r\n\tonDespawnedEnchantment: (minion: BoardEntity, enchantment: BoardEnchantment, input: OnDespawnInput) => {\r\n\t\tconst attack = enchantment.tagScriptDataNum1 ?? 0;\r\n\t\tconst health = enchantment.tagScriptDataNum2 ?? 0;\r\n\t\tif (input.applyAttackAuras) {\r\n\t\t\tminion.attack = Math.max(0, minion.attack - attack);\r\n\t\t\t// minion.maxAttack = Math.max(0, minion.maxAttack - attack);\r\n\t\t}\r\n\t\tif (input.applyHealthAuras) {\r\n\t\t\tminion.health = Math.max(Math.min(minion.health, 1), minion.health - health);\r\n\t\t\t// minion.maxHealth = Math.max(1, minion.maxHealth - health);\r\n\t\t}\r\n\t},\r\n};\r\n\r\nexport const HammerOfTwilight: OnOtherSpawnedCard & OnDiscardCard = {\r\n\tcardIds: [\r\n\t\tCardIds.HammerOfTwilight_BG36_MagicItem_403,\r\n\t\tCardIds.HammerOfTwilight_HammerOfTwilightToken_BG36_MagicItem_403t,\r\n\t],\r\n\tonOtherSpawned: (trinket: BoardTrinket, input: OnOtherSpawnInput) => {\r\n\t\tif (!input.applySelfAuras) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (input.spawned.enchantments?.some((e) => e.cardId === ENCHANTMENT_ID)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst { attack, health } = currentAura(trinket);\r\n\t\tinput.spawned.enchantments = input.spawned.enchantments ?? [];\r\n\t\tinput.spawned.enchantments.push({\r\n\t\t\tcardId: ENCHANTMENT_ID,\r\n\t\t\toriginEntityId: trinket.entityId,\r\n\t\t\ttagScriptDataNum1: attack,\r\n\t\t\ttagScriptDataNum2: health,\r\n\t\t\ttiming: input.gameState.sharedState.currentEntityId++,\r\n\t\t});\r\n\t\tmodifyStats(\r\n\t\t\tinput.spawned,\r\n\t\t\ttrinket,\r\n\t\t\tinput.applyAttackAuras ? attack : 0,\r\n\t\t\tinput.applyHealthAuras ? health : 0,\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\tonDiscard: (trinket: BoardTrinket, input: DiscardInput) => {\r\n\t\tconst increment = printedAura(trinket.cardId);\r\n\t\ttrinket.scriptDataNum1 = (trinket.scriptDataNum1 ?? increment.attack) + increment.attack;\r\n\t\tif (isGreater(trinket.cardId)) {\r\n\t\t\ttrinket.scriptDataNum2 = (trinket.scriptDataNum2 ?? increment.health) + increment.health;\r\n\t\t}\r\n\t\tfor (const minion of input.board) {\r\n\t\t\tif (minion.health <= 0 || minion.definitelyDead) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tmodifyStats(minion, trinket, increment.attack, increment.health, input.board, input.hero, input.gameState);\r\n\t\t\tconst enchantment = minion.enchantments?.find((e) => e.cardId === ENCHANTMENT_ID);\r\n\t\t\tif (enchantment) {\r\n\t\t\t\tenchantment.tagScriptDataNum1 = (enchantment.tagScriptDataNum1 ?? 0) + increment.attack;\r\n\t\t\t\tenchantment.tagScriptDataNum2 = (enchantment.tagScriptDataNum2 ?? 0) + increment.health;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"hammer-of-twilight.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/hammer-of-twilight.ts"],"names":[],"mappings":";;;AAWA,qDAAwD;AASxD,MAAM,cAAc,wBAAyE,CAAC;AAE9F,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAW,EAAE,CAC5C,MAAM,yBAAgD;IACtD,MAAM,0BAAuE,CAAC;AAE/E,MAAM,SAAS,GAAG,CAAC,MAAc,EAAW,EAAE,CAC7C,MAAM,0BAAuE,CAAC;AAE/E,MAAM,WAAW,GAAG,CAAC,MAAc,EAAsC,EAAE;IAC1E,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAChF,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,OAAqB,EAAsC,EAAE;;IACjF,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO;QACN,MAAM,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,OAAO,CAAC,MAAM;QAChD,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,MA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AAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,CAAC;YAClF,IAAI,WAAW,EAAE;gBAChB,WAAW,CAAC,iBAAiB,GAAG,CAAC,MAAA,WAAW,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;gBACxF,WAAW,CAAC,iBAAiB,GAAG,CAAC,MAAA,WAAW,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;aACxF;SACD;IACF,CAAC;CACD,CAAC","sourcesContent":["/**\r\n * Hammer of Twilight (lesser): Your minions have +1 Attack. (Improved by each card you've discarded this game!)\r\n * Hammer of Twilight (greater): Your minions have +2/+1. (Improved by each card you've discarded this game!)\r\n *\r\n * Starting-board stats already include the current aura. Combat summons get it here, and combat\r\n * discards improve the aura and the board.\r\n */\r\nimport { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { BoardEnchantment, BoardEntity } from '../../../board-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { OnDespawnInput, OnOtherSpawnInput, OnSpawnInput } from '../../../simulation/add-minion-to-board';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport {\r\n\tDiscardInput,\r\n\tOnDespawnedEnchantmentCard,\r\n\tOnDiscardCard,\r\n\tOnOtherSpawnedCard,\r\n\tOnSpawnedEnchantmentCard,\r\n} from '../../card.interface';\r\n\r\nconst ENCHANTMENT_ID = CardIds.HammerOfTwilight_TwilightOfLifeEnchantment_BG36_MagicItem_403e;\r\n\r\nconst isHammer = (cardId: string): boolean =>\r\n\tcardId === CardIds.HammerOfTwilight_BG36_MagicItem_403 ||\r\n\tcardId === CardIds.HammerOfTwilight_HammerOfTwilightToken_BG36_MagicItem_403t;\r\n\r\nconst isGreater = (cardId: string): boolean =>\r\n\tcardId === CardIds.HammerOfTwilight_HammerOfTwilightToken_BG36_MagicItem_403t;\r\n\r\nconst printedAura = (cardId: string): { attack: number; health: number } => {\r\n\treturn isGreater(cardId) ? { attack: 2, health: 1 } : { attack: 1, health: 0 };\r\n};\r\n\r\nconst currentAura = (trinket: BoardTrinket): { attack: number; health: number } => {\r\n\tconst printed = printedAura(trinket.cardId);\r\n\treturn {\r\n\t\tattack: trinket.scriptDataNum1 ?? printed.attack,\r\n\t\thealth: isGreater(trinket.cardId) ? trinket.scriptDataNum2 ?? printed.health : 0,\r\n\t};\r\n};\r\n\r\nexport const TwilightOfLife: OnSpawnedEnchantmentCard & OnDespawnedEnchantmentCard = {\r\n\tcardIds: [ENCHANTMENT_ID],\r\n\tonSpawnedEnchantment: (minion: BoardEntity, enchantment: BoardEnchantment, input: OnSpawnInput) => {\r\n\t\tmodifyStats(\r\n\t\t\tminion,\r\n\t\t\tnull,\r\n\t\t\tinput.applyAttackAuras ? enchantment.tagScriptDataNum1 ?? 0 : 0,\r\n\t\t\tinput.applyHealthAuras ? enchantment.tagScriptDataNum2 ?? 0 : 0,\r\n\t\t\tinput.board,\r\n\t\t\tinput.hero,\r\n\t\t\tinput.gameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t},\r\n\tonDespawnedEnchantment: (minion: BoardEntity, enchantment: BoardEnchantment, input: OnDespawnInput) => {\r\n\t\tconst attack = enchantment.tagScriptDataNum1 ?? 0;\r\n\t\tconst health = enchantment.tagScriptDataNum2 ?? 0;\r\n\t\tif (input.applyAttackAuras) {\r\n\t\t\tminion.attack = Math.max(0, minion.attack - attack);\r\n\t\t\t// minion.maxAttack = Math.max(0, minion.maxAttack - attack);\r\n\t\t}\r\n\t\tif (input.applyHealthAuras) {\r\n\t\t\tminion.health = Math.max(Math.min(minion.health, 1), minion.health - health);\r\n\t\t\t// minion.maxHealth = Math.max(1, minion.maxHealth - health);\r\n\t\t}\r\n\t},\r\n};\r\n\r\nexport const HammerOfTwilight: OnOtherSpawnedCard & OnDiscardCard = {\r\n\tcardIds: [\r\n\t\tCardIds.HammerOfTwilight_BG36_MagicItem_403,\r\n\t\tCardIds.HammerOfTwilight_HammerOfTwilightToken_BG36_MagicItem_403t,\r\n\t],\r\n\tonOtherSpawned: (trinket: BoardTrinket, input: OnOtherSpawnInput) => {\r\n\t\tif (!input.applySelfAuras) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// Each Hammer is its own aura. Another copy's Twilight of Life must not block this one.\r\n\t\t// Enchantments already on a copied minion use the enchantment entity as origin, not the trinket,\r\n\t\t// and onSpawnedEnchantment reapplies those stats.\r\n\t\tconst twilightEnchantments = (input.spawned.enchantments ?? []).filter((e) => e.cardId === ENCHANTMENT_ID);\r\n\t\tif (twilightEnchantments.some((e) => e.originEntityId === trinket.entityId)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst hammerEntityIds = new Set(\r\n\t\t\t(input.hero.trinkets ?? []).filter((t) => isHammer(t.cardId)).map((t) => t.entityId),\r\n\t\t);\r\n\t\tif (twilightEnchantments.some((e) => !hammerEntityIds.has(e.originEntityId))) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst { attack, health } = currentAura(trinket);\r\n\t\tinput.spawned.enchantments = input.spawned.enchantments ?? [];\r\n\t\tinput.spawned.enchantments.push({\r\n\t\t\tcardId: ENCHANTMENT_ID,\r\n\t\t\toriginEntityId: trinket.entityId,\r\n\t\t\ttagScriptDataNum1: attack,\r\n\t\t\ttagScriptDataNum2: health,\r\n\t\t\ttiming: input.gameState.sharedState.currentEntityId++,\r\n\t\t});\r\n\t\tmodifyStats(\r\n\t\t\tinput.spawned,\r\n\t\t\ttrinket,\r\n\t\t\tinput.applyAttackAuras ? attack : 0,\r\n\t\t\tinput.applyHealthAuras ? health : 0,\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\tonDiscard: (trinket: BoardTrinket, input: DiscardInput) => {\r\n\t\tconst increment = printedAura(trinket.cardId);\r\n\t\ttrinket.scriptDataNum1 = (trinket.scriptDataNum1 ?? increment.attack) + increment.attack;\r\n\t\tif (isGreater(trinket.cardId)) {\r\n\t\t\ttrinket.scriptDataNum2 = (trinket.scriptDataNum2 ?? increment.health) + increment.health;\r\n\t\t}\r\n\t\tfor (const minion of input.board) {\r\n\t\t\tif (minion.health <= 0 || minion.definitelyDead) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tmodifyStats(minion, trinket, increment.attack, increment.health, input.board, input.hero, input.gameState);\r\n\t\t\tconst enchantment = minion.enchantments?.find((e) => e.cardId === ENCHANTMENT_ID);\r\n\t\t\tif (enchantment) {\r\n\t\t\t\tenchantment.tagScriptDataNum1 = (enchantment.tagScriptDataNum1 ?? 0) + increment.attack;\r\n\t\t\t\tenchantment.tagScriptDataNum2 = (enchantment.tagScriptDataNum2 ?? 0) + increment.health;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"]}
@@ -96,6 +96,7 @@ const sanitizeEntity = (entity, isPlayer, cardsData, cards, applyDefaultScriptDa
96
96
  (0, utils_1.addImpliedMechanics)(fixed, cardsData);
97
97
  fixed.friendly = isPlayer;
98
98
  fixed.hadVenomous = fixed.venomous;
99
+ fixed.hadStealth = fixed.stealth;
99
100
  return fixed;
100
101
  };
101
102
  const buildFinalInputBoard = (playerInfo, isPlayer, cardsData, cards) => {
@@ -1 +1 @@
1
- {"version":3,"file":"input-sanitation.js","sourceRoot":"","sources":["../src/input-sanitation.ts"],"names":[],"mappings":";;;AAOA,8CAA0E;AAC1E,4DAA4D;AAC5D,mCAA8C;AAEvC,MAAM,eAAe,GAAG,CAC9B,WAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACJ,EAAE;;IAClB,MAAM,iBAAiB,GAAG,EAAE,QAAQ,EAAE,SAAW,EAAE,CAAC;IAEpD,MAAM,EACL,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GACpB,GAAG,wBAAwB,CAC3B,WAAW,CAAC,WAAW,EACvB,IAAI,EACJ,WAAW,CAAC,SAAS,CAAC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AC;AAEF,MAAM,oBAAoB,GAAG,CAC5B,UAAwB,EACxB,QAAiB,EACjB,SAAoB,EACpB,KAAsB,EAC0B,EAAE;;IAClD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACzG,MAAM,IAAI,GACT,MAAA,MAAA,UAAU,CAAC,MAAM,CAAC,IAAI,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,mCAAI,EAAE,CAAC;IAC1G,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BgsHeroPower, BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { CardIds } from './services/card-ids';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { fixEnchantments } from './simulation/enchantments';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nexport const buildFinalInput = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): BgsBattleInfo => {\r\n\tconst entityIdContainer = { entityId: 999_999_999 };\r\n\r\n\tconst {\r\n\t\tboard: playerBoard,\r\n\t\thand: playerHand,\r\n\t\tplayer: playerEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: playerTeammateBoard,\r\n\t\thand: playerTeammateHand,\r\n\t\tplayer: playerTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerTeammateBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\tconst {\r\n\t\tboard: opponentBoard,\r\n\t\thand: opponentHand,\r\n\t\tplayer: opponentEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: opponentTeammateBoard,\r\n\t\thand: opponentTeammateHand,\r\n\t\tplayer: opponentTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentTeammateBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerEntity,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tplayerTeammateBoard: !!playerTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: playerTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...playerTeammateEntity,\r\n\t\t\t\t\t\thand: playerTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentEntity,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentTeammateBoard: !!opponentTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: opponentTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...opponentTeammateEntity,\r\n\t\t\t\t\t\thand: opponentTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\tgameState: {\r\n\t\t\t...battleInput.gameState,\r\n\t\t\tanomalies: battleInput.gameState.anomalies?.filter((a) => !!a) ?? ([] as readonly string[]),\r\n\t\t},\r\n\t\t// Combat-affecting options (e.g. applyDamageCap) must survive into runSingleBattle;\r\n\t\t// Monte Carlo knobs are still read from the original battleInput before cloning.\r\n\t\toptions: battleInput.options,\r\n\t\theroHasDied: battleInput.heroHasDied,\r\n\t\tdebugState: battleInput.debugState,\r\n\t} as BgsBattleInfo;\r\n\treturn inputReady;\r\n};\r\n\r\nconst buildFinalInputForPlayer = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tanomalies: readonly string[],\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tentityIdContainer: { entityId: number },\r\n): { board: BoardEntity[]; hand: BoardEntity[]; player: BgsPlayerEntity } => {\r\n\tif (!playerInfo) {\r\n\t\treturn { board: [], hand: [], player: null };\r\n\t}\r\n\r\n\tconst { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);\r\n\tconst isGhost = playerInfo.player?.hpLeft != null && playerInfo.player.hpLeft <= 0;\r\n\tplayerInfo.player.secrets = (playerInfo.player.secrets ?? playerInfo.secrets)?.filter((e) => !!e?.cardId) ?? [];\r\n\t// Add the scriptDataNum1 only on the start of combat phase, so that it doesn't trigger too soon\r\n\t// Don't do this, as secrets like Fleeting Vigor use this info to tell how much buff it will apply\r\n\t// playerInfo.player.secrets.forEach((secret) => (secret.scriptDataNum1 = 0));\r\n\t// Trinkets don't seem to trigger when facing the ghost\r\n\t// http://replays.firestoneapp.com/?reviewId=4ad32e03-2620-4fb1-8b43-cad55afd30fc&turn=27&action=2\r\n\t// One of the trinkets is Blood Golem Sticker, and no Blood Golem is summoned\r\n\t// Looks like that's not always the case:\r\n\t// http://replays.firestoneapp.com/?reviewId=9958e8d3-4388-4e6f-9b36-35f3a08be2f6&turn=25&action=4\r\n\t// playerInfo.player.trinkets = isGhost ? [] : playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? [];\r\n\tconst fixedTrinkets = playerInfo.player.trinkets?.filter((e) => !!e?.cardId);\r\n\tplayerInfo.player.trinkets = (fixedTrinkets ?? []).sort((a, b) => a.entityId - b.entityId);\r\n\tplayerInfo.player.friendly = isPlayer;\r\n\tplayerInfo.player.globalInfo = playerInfo.player.globalInfo ?? {};\r\n\tplayerInfo.player.heroPowers = playerInfo.player.heroPowers?.length\r\n\t\t? playerInfo.player.heroPowers.map((hp, index) => sanitizeHeroPower(hp, index, playerInfo.player, cards))\r\n\t\t: [\r\n\t\t\t\t{\r\n\t\t\t\t\tcardId: playerInfo.player.heroPowerId,\r\n\t\t\t\t\tentityId: playerInfo.player.heroPowerEntityId,\r\n\t\t\t\t\tused: playerInfo.player.heroPowerUsed,\r\n\t\t\t\t\tinfo: playerInfo.player.heroPowerInfo,\r\n\t\t\t\t\tinfo2: playerInfo.player.heroPowerInfo2,\r\n\t\t\t\t} as BgsHeroPower,\r\n\t\t ];\r\n\t// playerInfo.player.heroPowerId =\r\n\t// \tplayerInfo.player.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(playerInfo.player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? playerInfo.player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \tplayerInfo.player.heroPowerId;\r\n\tplayerInfo.player.cardId = isGhost ? CardIds.Kelthuzad_TB_BaconShop_HERO_KelThuzad : playerInfo.player.cardId;\r\n\tplayerInfo.player.hpLeft = Math.max(1, playerInfo.player.hpLeft);\r\n\t// When using the simulator, the aura is not applied when receiving the board state.\r\n\tsetMissingAuras(board, playerInfo.player, anomalies, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, board, cardsData, isPlayer, entityIdContainer);\r\n\treturn { board, hand, player: playerInfo.player };\r\n};\r\n\r\nconst sanitizeHeroPower = (\r\n\thp: BgsHeroPower,\r\n\tindex: number,\r\n\tplayer: BgsPlayerEntity,\r\n\tcards: AllCardsService,\r\n): BgsHeroPower => {\r\n\treturn hp;\r\n\t// FIXME: fix this when the situation presents itself. At the moment, we already have trinkets / hero powers / quest rewards\r\n\t// handled separately, so maybe there is no need to map a quest reward to one of Sire D.'s hero power\r\n\t// if (index !== 0) {\r\n\t// \treturn hp;\r\n\t// }\r\n\r\n\t// hp.cardId =\r\n\t// \tplayer.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \thp.cardId;\r\n\t// return hp;\r\n};\r\n\r\nconst sanitizeEntity = (\r\n\tentity: BoardEntity,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n\tapplyDefaultScriptData: boolean,\r\n): BoardEntity => {\r\n\tconst fixed = fixEnchantments(entity, cards);\r\n\tfixed.inInitialState = true;\r\n\tif (applyDefaultScriptData) {\r\n\t\tfixed.scriptDataNum1 = cardsData.defaultScriptDataNum(fixed.cardId) || fixed.scriptDataNum1;\r\n\t}\r\n\taddImpliedMechanics(fixed, cardsData);\r\n\tfixed.friendly = isPlayer;\r\n\t// Used for Persisting Horror\r\n\tfixed.hadVenomous = fixed.venomous;\r\n\treturn fixed;\r\n};\r\n\r\nconst buildFinalInputBoard = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n): { board: BoardEntity[]; hand: BoardEntity[] } => {\r\n\tconst board = playerInfo.board.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, true));\r\n\tconst hand =\r\n\t\tplayerInfo.player.hand?.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, false)) ?? [];\r\n\treturn { board, hand };\r\n};\r\n"]}
1
+ {"version":3,"file":"input-sanitation.js","sourceRoot":"","sources":["../src/input-sanitation.ts"],"names":[],"mappings":";;;AAOA,8CAA0E;AAC1E,4DAA4D;AAC5D,mCAA8C;AAEvC,MAAM,eAAe,GAAG,CAC9B,WAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACJ,EAAE;;IAClB,MAAM,iBAAiB,GAAG,EAAE,QAAQ,EAAE,SAAW,EAAE,CAAC;IAEpD,MAAM,EACL,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GACpB,GAAG,wBAAwB,CAC3B,WAAW,CAAC,WAAW,EACvB,IAAI,EACJ,WAAW,CAAC,SAAS,CAAC,SAAS,EAC/B,KAAK,EACL,SAAS,EACT,iBAAiB,CACjB,CAAC;IACF,MAAM,EACL,KAAK,EAAE,mBAAmB,EAC1B,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,oBAAoB,GAC5B,GAAG,wBAAwB,CAC3B,WAAW,CAAC,mBAAmB,EAC/B,IAAI,EACJ,WAAW,CAAC,SAAS,CAAC,SAAS,EAC/B,KAAK,EACL,SAAS,EACT,iBAAiB,CACjB,CAAC;IAEF,MAAM,EACL,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,GACtB,GAAG,wBAAwB,CA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GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,mCAAI,EAAE,CAAC;IAC1G,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import { AllCardsService } from '@firestone-hs/reference-data';\r\nimport { BgsBattleInfo } from './bgs-battle-info';\r\nimport { BgsBoardInfo } from './bgs-board-info';\r\nimport { BgsHeroPower, BgsPlayerEntity } from './bgs-player-entity';\r\nimport { BoardEntity } from './board-entity';\r\nimport { CardsData } from './cards/cards-data';\r\nimport { CardIds } from './services/card-ids';\r\nimport { setImplicitDataHero, setMissingAuras } from './simulation/auras';\r\nimport { fixEnchantments } from './simulation/enchantments';\r\nimport { addImpliedMechanics } from './utils';\r\n\r\nexport const buildFinalInput = (\r\n\tbattleInput: BgsBattleInfo,\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n): BgsBattleInfo => {\r\n\tconst entityIdContainer = { entityId: 999_999_999 };\r\n\r\n\tconst {\r\n\t\tboard: playerBoard,\r\n\t\thand: playerHand,\r\n\t\tplayer: playerEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: playerTeammateBoard,\r\n\t\thand: playerTeammateHand,\r\n\t\tplayer: playerTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.playerTeammateBoard,\r\n\t\ttrue,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\tconst {\r\n\t\tboard: opponentBoard,\r\n\t\thand: opponentHand,\r\n\t\tplayer: opponentEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\tconst {\r\n\t\tboard: opponentTeammateBoard,\r\n\t\thand: opponentTeammateHand,\r\n\t\tplayer: opponentTeammateEntity,\r\n\t} = buildFinalInputForPlayer(\r\n\t\tbattleInput.opponentTeammateBoard,\r\n\t\tfalse,\r\n\t\tbattleInput.gameState.anomalies,\r\n\t\tcards,\r\n\t\tcardsData,\r\n\t\tentityIdContainer,\r\n\t);\r\n\r\n\t// We do this so that we can have mutated objects inside the simulation and still\r\n\t// be able to start from a fresh copy for each simulation\r\n\tconst inputReady: BgsBattleInfo = {\r\n\t\tplayerBoard: {\r\n\t\t\tboard: playerBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...playerEntity,\r\n\t\t\t\thand: playerHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\tplayerTeammateBoard: !!playerTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: playerTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...playerTeammateEntity,\r\n\t\t\t\t\t\thand: playerTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\topponentBoard: {\r\n\t\t\tboard: opponentBoard,\r\n\t\t\tplayer: {\r\n\t\t\t\t...opponentEntity,\r\n\t\t\t\thand: opponentHand,\r\n\t\t\t},\r\n\t\t},\r\n\t\topponentTeammateBoard: !!opponentTeammateEntity\r\n\t\t\t? {\r\n\t\t\t\t\tboard: opponentTeammateBoard,\r\n\t\t\t\t\tplayer: {\r\n\t\t\t\t\t\t...opponentTeammateEntity,\r\n\t\t\t\t\t\thand: opponentTeammateHand,\r\n\t\t\t\t\t},\r\n\t\t\t }\r\n\t\t\t: null,\r\n\t\tgameState: {\r\n\t\t\t...battleInput.gameState,\r\n\t\t\tanomalies: battleInput.gameState.anomalies?.filter((a) => !!a) ?? ([] as readonly string[]),\r\n\t\t},\r\n\t\t// Combat-affecting options (e.g. applyDamageCap) must survive into runSingleBattle;\r\n\t\t// Monte Carlo knobs are still read from the original battleInput before cloning.\r\n\t\toptions: battleInput.options,\r\n\t\theroHasDied: battleInput.heroHasDied,\r\n\t\tdebugState: battleInput.debugState,\r\n\t} as BgsBattleInfo;\r\n\treturn inputReady;\r\n};\r\n\r\nconst buildFinalInputForPlayer = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tanomalies: readonly string[],\r\n\tcards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tentityIdContainer: { entityId: number },\r\n): { board: BoardEntity[]; hand: BoardEntity[]; player: BgsPlayerEntity } => {\r\n\tif (!playerInfo) {\r\n\t\treturn { board: [], hand: [], player: null };\r\n\t}\r\n\r\n\tconst { board, hand } = buildFinalInputBoard(playerInfo, isPlayer, cardsData, cards);\r\n\tconst isGhost = playerInfo.player?.hpLeft != null && playerInfo.player.hpLeft <= 0;\r\n\tplayerInfo.player.secrets = (playerInfo.player.secrets ?? playerInfo.secrets)?.filter((e) => !!e?.cardId) ?? [];\r\n\t// Add the scriptDataNum1 only on the start of combat phase, so that it doesn't trigger too soon\r\n\t// Don't do this, as secrets like Fleeting Vigor use this info to tell how much buff it will apply\r\n\t// playerInfo.player.secrets.forEach((secret) => (secret.scriptDataNum1 = 0));\r\n\t// Trinkets don't seem to trigger when facing the ghost\r\n\t// http://replays.firestoneapp.com/?reviewId=4ad32e03-2620-4fb1-8b43-cad55afd30fc&turn=27&action=2\r\n\t// One of the trinkets is Blood Golem Sticker, and no Blood Golem is summoned\r\n\t// Looks like that's not always the case:\r\n\t// http://replays.firestoneapp.com/?reviewId=9958e8d3-4388-4e6f-9b36-35f3a08be2f6&turn=25&action=4\r\n\t// playerInfo.player.trinkets = isGhost ? [] : playerInfo.player.trinkets?.filter((e) => !!e?.cardId) ?? [];\r\n\tconst fixedTrinkets = playerInfo.player.trinkets?.filter((e) => !!e?.cardId);\r\n\tplayerInfo.player.trinkets = (fixedTrinkets ?? []).sort((a, b) => a.entityId - b.entityId);\r\n\tplayerInfo.player.friendly = isPlayer;\r\n\tplayerInfo.player.globalInfo = playerInfo.player.globalInfo ?? {};\r\n\tplayerInfo.player.heroPowers = playerInfo.player.heroPowers?.length\r\n\t\t? playerInfo.player.heroPowers.map((hp, index) => sanitizeHeroPower(hp, index, playerInfo.player, cards))\r\n\t\t: [\r\n\t\t\t\t{\r\n\t\t\t\t\tcardId: playerInfo.player.heroPowerId,\r\n\t\t\t\t\tentityId: playerInfo.player.heroPowerEntityId,\r\n\t\t\t\t\tused: playerInfo.player.heroPowerUsed,\r\n\t\t\t\t\tinfo: playerInfo.player.heroPowerInfo,\r\n\t\t\t\t\tinfo2: playerInfo.player.heroPowerInfo2,\r\n\t\t\t\t} as BgsHeroPower,\r\n\t\t ];\r\n\t// playerInfo.player.heroPowerId =\r\n\t// \tplayerInfo.player.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(playerInfo.player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? playerInfo.player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \tplayerInfo.player.heroPowerId;\r\n\tplayerInfo.player.cardId = isGhost ? CardIds.Kelthuzad_TB_BaconShop_HERO_KelThuzad : playerInfo.player.cardId;\r\n\tplayerInfo.player.hpLeft = Math.max(1, playerInfo.player.hpLeft);\r\n\t// When using the simulator, the aura is not applied when receiving the board state.\r\n\tsetMissingAuras(board, playerInfo.player, anomalies, cards);\r\n\t// Avenge, maxHealth, etc.\r\n\t// setImplicitData(playerBoard, cardsData);\r\n\t// setImplicitData(opponentBoard, cardsData);\r\n\t// Avenge, globalInfo\r\n\tsetImplicitDataHero(playerInfo.player, board, cardsData, isPlayer, entityIdContainer);\r\n\treturn { board, hand, player: playerInfo.player };\r\n};\r\n\r\nconst sanitizeHeroPower = (\r\n\thp: BgsHeroPower,\r\n\tindex: number,\r\n\tplayer: BgsPlayerEntity,\r\n\tcards: AllCardsService,\r\n): BgsHeroPower => {\r\n\treturn hp;\r\n\t// FIXME: fix this when the situation presents itself. At the moment, we already have trinkets / hero powers / quest rewards\r\n\t// handled separately, so maybe there is no need to map a quest reward to one of Sire D.'s hero power\r\n\t// if (index !== 0) {\r\n\t// \treturn hp;\r\n\t// }\r\n\r\n\t// hp.cardId =\r\n\t// \tplayer.trinkets.find((t) => t.scriptDataNum6 === 3)?.cardId ??\r\n\t// \t(normalizeHeroCardId(player.cardId, cards) === CardIds.SireDenathrius_BG24_HERO_100\r\n\t// \t\t? player.questRewardEntities?.[0]?.cardId\r\n\t// \t\t: null) ??\r\n\t// \thp.cardId;\r\n\t// return hp;\r\n};\r\n\r\nconst sanitizeEntity = (\r\n\tentity: BoardEntity,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n\tapplyDefaultScriptData: boolean,\r\n): BoardEntity => {\r\n\tconst fixed = fixEnchantments(entity, cards);\r\n\tfixed.inInitialState = true;\r\n\tif (applyDefaultScriptData) {\r\n\t\tfixed.scriptDataNum1 = cardsData.defaultScriptDataNum(fixed.cardId) || fixed.scriptDataNum1;\r\n\t}\r\n\taddImpliedMechanics(fixed, cardsData);\r\n\tfixed.friendly = isPlayer;\r\n\t// Used for Persisting Horror\r\n\tfixed.hadVenomous = fixed.venomous;\r\n\tfixed.hadStealth = fixed.stealth;\r\n\treturn fixed;\r\n};\r\n\r\nconst buildFinalInputBoard = (\r\n\tplayerInfo: BgsBoardInfo,\r\n\tisPlayer: boolean,\r\n\tcardsData: CardsData,\r\n\tcards: AllCardsService,\r\n): { board: BoardEntity[]; hand: BoardEntity[] } => {\r\n\tconst board = playerInfo.board.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, true));\r\n\tconst hand =\r\n\t\tplayerInfo.player.hand?.map((entity) => sanitizeEntity(entity, isPlayer, cardsData, cards, false)) ?? [];\r\n\treturn { board, hand };\r\n};\r\n"]}
@@ -10,16 +10,19 @@ const spawns_1 = require("./spawns");
10
10
  const stats_1 = require("./stats");
11
11
  const entity_utils_1 = require("./utils/entity-utils");
12
12
  const applyAfterDeathEffects = (deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState) => {
13
+ var _a;
13
14
  const allSpawns = [];
14
15
  const spawnsFromSecrets = handleAfterMinionDeathEffects(deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);
15
16
  allSpawns.push(...spawnsFromSecrets);
16
17
  (0, spawns_1.performEntitySpawns)(allSpawns, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, deadEntityIndexFromRight, otherBoard, otherBoardHero, gameState);
17
18
  const deitySpawns = (0, deity_1.onFriendlyAberrationDied)(deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);
18
19
  if (deitySpawns.length > 0) {
20
+ const previousHasAttacked = (_a = boardWithDeadEntity[boardWithDeadEntity.length - 1]) === null || _a === void 0 ? void 0 : _a.hasAttacked;
19
21
  const spawned = (0, spawns_1.performEntitySpawns)(deitySpawns, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, 0, otherBoard, otherBoardHero, gameState);
20
22
  if (spawned.length > 0) {
21
23
  (0, deity_1.markDeitySecretTriggered)(boardWithDeadEntityHero);
22
24
  allSpawns.push(...spawned);
25
+ spawned.forEach((s) => (s.hasAttacked = previousHasAttacked));
23
26
  }
24
27
  else {
25
28
  (0, deity_1.retryDeityAwakenOnNextAberrationDeath)(boardWithDeadEntityHero);
@@ -1 +1 @@
1
- {"version":3,"file":"death-effects.js","sourceRoot":"","sources":["../../src/simulation/death-effects.ts"],"names":[],"mappings":";;;AAEA,4DAAwG;AACxG,iEAA4D;AAE5D,6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T,CAAC,EACD,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,CAAC,QAAQ,EACnB,KAAK,EACL,KAAK,EACL,IAAI,CACJ,CAAC;gBACF,SAAS,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;gBAChC,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAClG,MAAM;SACP;KACD;IACD,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAClC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACvB,EAAE;IAEH,OAAO,EAAE,CAAC;AACX,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnAfterFriendlyMinionDeath, hasRebornSelfAttributeTransfer } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandomAlive } from '../services/utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport {\r\n\tmarkDeitySecretTriggered,\r\n\tonFriendlyAberrationDied,\r\n\tretryDeityAwakenOnNextAberrationDeath,\r\n} from './deity';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\nimport { copyAttribute } from './utils/entity-utils';\r\n\r\nexport const applyAfterDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\tconst spawnsFromSecrets = handleAfterMinionDeathEffects(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tallSpawns.push(...spawnsFromSecrets);\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\r\n\tconst deitySpawns = onFriendlyAberrationDied(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tif (deitySpawns.length > 0) {\r\n\t\tconst spawned = performEntitySpawns(\r\n\t\t\tdeitySpawns,\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\tdeadEntity,\r\n\t\t\t0,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tif (spawned.length > 0) {\r\n\t\t\tmarkDeitySecretTriggered(boardWithDeadEntityHero);\r\n\t\t\tallSpawns.push(...spawned);\r\n\t\t} else {\r\n\t\t\tretryDeityAwakenOnNextAberrationDeath(boardWithDeadEntityHero);\r\n\t\t}\r\n\t}\r\n\r\n\treturn allSpawns;\r\n};\r\n\r\nconst handleAfterMinionDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\t// TODO: move this to an \"after minion dies\" phase, instead of \"whenever minion dies\"\r\n\tconst boardBeforeProcs = [...boardWithDeadEntity];\r\n\tfor (const entity of boardWithDeadEntity) {\r\n\t\tconst impl = cardMappings[entity.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(impl)) {\r\n\t\t\timpl.onAfterFriendlyMinionDeath(entity, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const trinket of boardWithDeadEntityHero.trinkets ?? []) {\r\n\t\tconst trinketImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(trinketImpl)) {\r\n\t\t\ttrinketImpl.onAfterFriendlyMinionDeath(trinket, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const secret of (boardWithDeadEntityHero.secrets ?? []).filter((s) => !s.triggered)) {\r\n\t\tswitch (secret.cardId) {\r\n\t\t\tcase CardIds.Avenge_TB_Bacon_Secrets_08:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst avengeTarget = pickRandomAlive(boardWithDeadEntity);\r\n\t\t\t\tmodifyStats(avengeTarget, secret, 3, 2, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_TB_Bacon_Secrets_10:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst redemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\t// { ...newSpawn } as BoardEntity,\r\n\t\t\t\t);\r\n\t\t\t\tredemptionSpawns[0].health = 1;\r\n\t\t\t\t// I don't like duplicating this logic\r\n\t\t\t\tconst rebornImpl = cardMappings[redemptionSpawns[0].cardId];\r\n\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\tcopyAttribute(redemptionSpawns[0], deadEntity, attribute);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...redemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, redemptionSpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_BetterRedemption_TB_Bacon_Secrets_10b:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst betterRedemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tfor (const spawn of betterRedemptionSpawns) {\r\n\t\t\t\t\tspawn.health = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.maxHealth = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.attack = deadEntity.attack;\r\n\t\t\t\t\tspawn.maxAttack = deadEntity.maxAttack;\r\n\t\t\t\t\tspawn.enchantments = deadEntity.enchantments;\r\n\t\t\t\t\tspawn.divineShield = deadEntity.hadDivineShield;\r\n\t\t\t\t\tconst rebornImpl = cardMappings[spawn.cardId];\r\n\t\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\t\tcopyAttribute(spawn, deadEntity, attribute);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...betterRedemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsecret,\r\n\t\t\t\t\tbetterRedemptionSpawns[0],\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Effigy_TB_Bacon_Secrets_05:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(deadEntity.cardId);\r\n\t\t\t\tconst newMinion = gameState.cardsData.getRandomMinionForTavernTier(minionTier);\r\n\t\t\t\tconst effigySpawns = spawnEntities(\r\n\t\t\t\t\tnewMinion,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tallSpawns.push(...effigySpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, effigySpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn allSpawns;\r\n};\r\n\r\nexport const applyOnDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\t// Nothing yet\r\n\treturn [];\r\n};\r\n"]}
1
+ {"version":3,"file":"death-effects.js","sourceRoot":"","sources":["../../src/simulation/death-effects.ts"],"names":[],"mappings":";;;AAEA,4DAAwG;AACxG,iEAA4D;AAE5D,6CAAoD;AACpD,6DAAqD;AACrD,mCAAoH;AAEpH,qCAA+C;AAC/C,mCAAsC;AACtC,uDAAqD;AAE9C,MAAM,sBAAsB,GAAG,CACrC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACR,EAAE;;IAClB,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,MAAM,iBAAiB,GAAG,6BAA6B,CACtD,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,SAAS,CACT,CAAC;IACF,SAAS,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC;IACrC,IAAA,4BAAmB,EAClB,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EAC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E,IAAI,EAAE,IAAI,CAAC,CAAC;gBAClG,MAAM;SACP;KACD;IACD,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAClC,UAAuB,EACvB,wBAAgC,EAChC,mBAAkC,EAClC,uBAAwC,EACxC,UAAyB,EACzB,cAA+B,EAC/B,SAAwB,EACvB,EAAE;IAEH,OAAO,EAAE,CAAC;AACX,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B","sourcesContent":["import { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasOnAfterFriendlyMinionDeath, hasRebornSelfAttributeTransfer } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandomAlive } from '../services/utils';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { markDeitySecretTriggered, onFriendlyAberrationDied, retryDeityAwakenOnNextAberrationDeath } from './deity';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { performEntitySpawns } from './spawns';\r\nimport { modifyStats } from './stats';\r\nimport { copyAttribute } from './utils/entity-utils';\r\n\r\nexport const applyAfterDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\tconst spawnsFromSecrets = handleAfterMinionDeathEffects(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tallSpawns.push(...spawnsFromSecrets);\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\r\n\tconst deitySpawns = onFriendlyAberrationDied(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityIndexFromRight,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\totherBoard,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n\tif (deitySpawns.length > 0) {\r\n\t\tconst previousHasAttacked = boardWithDeadEntity[boardWithDeadEntity.length - 1]?.hasAttacked;\r\n\t\tconst spawned = performEntitySpawns(\r\n\t\t\tdeitySpawns,\r\n\t\t\tboardWithDeadEntity,\r\n\t\t\tboardWithDeadEntityHero,\r\n\t\t\tdeadEntity,\r\n\t\t\t0,\r\n\t\t\totherBoard,\r\n\t\t\totherBoardHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tif (spawned.length > 0) {\r\n\t\t\tmarkDeitySecretTriggered(boardWithDeadEntityHero);\r\n\t\t\tallSpawns.push(...spawned);\r\n\t\t\t// Not sure exactly why it's working like that, but it looks like the spawned deity often skips their attack turn\r\n\t\t\t// https://replays.firestoneapp.com/?reviewId=676564cc-da9e-4cc1-ac4b-ac81354fb628&turn=9&action=23\r\n\t\t\tspawned.forEach((s) => (s.hasAttacked = previousHasAttacked));\r\n\t\t} else {\r\n\t\t\tretryDeityAwakenOnNextAberrationDeath(boardWithDeadEntityHero);\r\n\t\t}\r\n\t}\r\n\r\n\treturn allSpawns;\r\n};\r\n\r\nconst handleAfterMinionDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): BoardEntity[] => {\r\n\tconst allSpawns = [];\r\n\r\n\t// TODO: move this to an \"after minion dies\" phase, instead of \"whenever minion dies\"\r\n\tconst boardBeforeProcs = [...boardWithDeadEntity];\r\n\tfor (const entity of boardWithDeadEntity) {\r\n\t\tconst impl = cardMappings[entity.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(impl)) {\r\n\t\t\timpl.onAfterFriendlyMinionDeath(entity, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const trinket of boardWithDeadEntityHero.trinkets ?? []) {\r\n\t\tconst trinketImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasOnAfterFriendlyMinionDeath(trinketImpl)) {\r\n\t\t\ttrinketImpl.onAfterFriendlyMinionDeath(trinket, {\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tboard: boardWithDeadEntity,\r\n\t\t\t\tboardBeforeProcs,\r\n\t\t\t\thero: boardWithDeadEntityHero,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherHero: otherBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const secret of (boardWithDeadEntityHero.secrets ?? []).filter((s) => !s.triggered)) {\r\n\t\tswitch (secret.cardId) {\r\n\t\t\tcase CardIds.Avenge_TB_Bacon_Secrets_08:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst avengeTarget = pickRandomAlive(boardWithDeadEntity);\r\n\t\t\t\tmodifyStats(avengeTarget, secret, 3, 2, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_TB_Bacon_Secrets_10:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst redemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\t// { ...newSpawn } as BoardEntity,\r\n\t\t\t\t);\r\n\t\t\t\tredemptionSpawns[0].health = 1;\r\n\t\t\t\t// I don't like duplicating this logic\r\n\t\t\t\tconst rebornImpl = cardMappings[redemptionSpawns[0].cardId];\r\n\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\tcopyAttribute(redemptionSpawns[0], deadEntity, attribute);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...redemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, redemptionSpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Redemption_BetterRedemption_TB_Bacon_Secrets_10b:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst betterRedemptionSpawns = spawnEntities(\r\n\t\t\t\t\tdeadEntity.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tfor (const spawn of betterRedemptionSpawns) {\r\n\t\t\t\t\tspawn.health = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.maxHealth = deadEntity.maxHealth;\r\n\t\t\t\t\tspawn.attack = deadEntity.attack;\r\n\t\t\t\t\tspawn.maxAttack = deadEntity.maxAttack;\r\n\t\t\t\t\tspawn.enchantments = deadEntity.enchantments;\r\n\t\t\t\t\tspawn.divineShield = deadEntity.hadDivineShield;\r\n\t\t\t\t\tconst rebornImpl = cardMappings[spawn.cardId];\r\n\t\t\t\t\tif (hasRebornSelfAttributeTransfer(rebornImpl)) {\r\n\t\t\t\t\t\trebornImpl.rebornSelfAttributeTransfer.forEach((attribute: keyof BoardEntity) => {\r\n\t\t\t\t\t\t\tcopyAttribute(spawn, deadEntity, attribute);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tallSpawns.push(...betterRedemptionSpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsecret,\r\n\t\t\t\t\tbetterRedemptionSpawns[0],\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t\tnull,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Effigy_TB_Bacon_Secrets_05:\r\n\t\t\t\tsecret.triggered = true;\r\n\t\t\t\tconst minionTier = gameState.cardsData.getTavernLevel(deadEntity.cardId);\r\n\t\t\t\tconst newMinion = gameState.cardsData.getRandomMinionForTavernTier(minionTier);\r\n\t\t\t\tconst effigySpawns = spawnEntities(\r\n\t\t\t\t\tnewMinion,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t);\r\n\t\t\t\tallSpawns.push(...effigySpawns);\r\n\t\t\t\tgameState.spectator.registerPowerTarget(secret, effigySpawns[0], boardWithDeadEntity, null, null);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn allSpawns;\r\n};\r\n\r\nexport const applyOnDeathEffects = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\t// Nothing yet\r\n\treturn [];\r\n};\r\n"]}
@@ -314,7 +314,8 @@ const handlePostDeathrattleEffect = (deadEntity, indexFromRight, deadEntities, d
314
314
  const entityRightToSpawns = indexFromRight === 0 ? null : deadEntityPlayerState.board[deadEntityPlayerState.board.length - indexFromRight];
315
315
  spawnedEntities.forEach((entity) => {
316
316
  var _a;
317
- entity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : (_a = entityRightToSpawns === null || entityRightToSpawns === void 0 ? void 0 : entityRightToSpawns.hasAttacked) !== null && _a !== void 0 ? _a : undefined;
317
+ entity.hasAttacked =
318
+ entity.hasAttacked || (deadEntity.hasAttacked > 1 ? 1 : (_a = entityRightToSpawns === null || entityRightToSpawns === void 0 ? void 0 : entityRightToSpawns.hasAttacked) !== null && _a !== void 0 ? _a : undefined);
318
319
  });
319
320
  if ((_a = deadEntityPlayerState.player.questRewards) === null || _a === void 0 ? void 0 : _a.includes("BG24_Reward_113")) {
320
321
  const ogDeadEntity = gameState.sharedState.deaths.find((entity) => entity.entityId === deadEntity.entityId);