@firestone-hs/simulate-bgs-battle 1.1.713 → 1.1.714

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 (59) hide show
  1. package/dist/bgs-player-entity.d.ts +1 -0
  2. package/dist/bgs-player-entity.js.map +1 -1
  3. package/dist/cards/impl/_card-mappings.js +2 -2
  4. package/dist/cards/impl/_card-mappings.js.map +1 -1
  5. package/dist/cards/impl/bg-spell/butchering.js +3 -1
  6. package/dist/cards/impl/bg-spell/butchering.js.map +1 -1
  7. package/dist/cards/impl/bg-spell/healthy-bounty.js +1 -1
  8. package/dist/cards/impl/bg-spell/healthy-bounty.js.map +1 -1
  9. package/dist/cards/impl/bg-spell/hostile-bounty.js +1 -1
  10. package/dist/cards/impl/bg-spell/hostile-bounty.js.map +1 -1
  11. package/dist/cards/impl/bg-spell/queens-command.js +1 -1
  12. package/dist/cards/impl/bg-spell/queens-command.js.map +1 -1
  13. package/dist/cards/impl/minion/brazen-buccaneer.js +3 -1
  14. package/dist/cards/impl/minion/brazen-buccaneer.js.map +1 -1
  15. package/dist/cards/impl/minion/charging-czarina.js +3 -2
  16. package/dist/cards/impl/minion/charging-czarina.js.map +1 -1
  17. package/dist/cards/impl/minion/dastardly-drust.js +2 -2
  18. package/dist/cards/impl/minion/dastardly-drust.js.map +1 -1
  19. package/dist/cards/impl/minion/dreaming-thornweaver.js +2 -7
  20. package/dist/cards/impl/minion/dreaming-thornweaver.js.map +1 -1
  21. package/dist/cards/impl/minion/drustfallen-butcher.js +1 -1
  22. package/dist/cards/impl/minion/drustfallen-butcher.js.map +1 -1
  23. package/dist/cards/impl/minion/king-bagurgle.js +2 -2
  24. package/dist/cards/impl/minion/king-bagurgle.js.map +1 -1
  25. package/dist/cards/impl/minion/nalaa-the-redeemer.js +1 -1
  26. package/dist/cards/impl/minion/nalaa-the-redeemer.js.map +1 -1
  27. package/dist/cards/impl/minion/poultron.js +1 -1
  28. package/dist/cards/impl/minion/poultron.js.map +1 -1
  29. package/dist/cards/impl/minion/stomping-stegodon.d.ts +1 -1
  30. package/dist/cards/impl/minion/stomping-stegodon.js +1 -1
  31. package/dist/cards/impl/minion/stomping-stegodon.js.map +1 -1
  32. package/dist/cards/impl/trinket/blood-golem-sticker.js +1 -1
  33. package/dist/cards/impl/trinket/blood-golem-sticker.js.map +1 -1
  34. package/dist/cards/impl/trinket/bluegill-flippers.js +15 -5
  35. package/dist/cards/impl/trinket/bluegill-flippers.js.map +1 -1
  36. package/dist/cards/impl/trinket/copper-coil.js +9 -6
  37. package/dist/cards/impl/trinket/copper-coil.js.map +1 -1
  38. package/dist/cards/impl/trinket/lorewalker-scroll.js +2 -2
  39. package/dist/cards/impl/trinket/lorewalker-scroll.js.map +1 -1
  40. package/dist/cards/impl/trinket/lucky-tabby.js +2 -2
  41. package/dist/cards/impl/trinket/lucky-tabby.js.map +1 -1
  42. package/dist/cards/impl/trinket/powder-keg.js +1 -1
  43. package/dist/cards/impl/trinket/powder-keg.js.map +1 -1
  44. package/dist/cards/impl/trinket/{tiger-carving-token.js → tiger-carving.js} +2 -2
  45. package/dist/cards/impl/trinket/tiger-carving.js.map +1 -0
  46. package/dist/simulation/add-minion-to-board.js +11 -0
  47. package/dist/simulation/add-minion-to-board.js.map +1 -1
  48. package/dist/simulation/auras.js +22 -21
  49. package/dist/simulation/auras.js.map +1 -1
  50. package/dist/simulation/blood-gems.js +2 -1
  51. package/dist/simulation/blood-gems.js.map +1 -1
  52. package/dist/simulation/deathrattle-orchestration.js +3 -0
  53. package/dist/simulation/deathrattle-orchestration.js.map +1 -1
  54. package/dist/simulation/global-info-helpers.d.ts +1 -0
  55. package/dist/simulation/global-info-helpers.js +7 -1
  56. package/dist/simulation/global-info-helpers.js.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/cards/impl/trinket/tiger-carving-token.js.map +0 -1
  59. /package/dist/cards/impl/trinket/{tiger-carving-token.d.ts → tiger-carving.d.ts} +0 -0
@@ -1 +1 @@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vBW,QAAA,wBAAwB,4BAuBnC;AAEK,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE;IAC5C,OAAO,CACN,MAAM,eAAqB;QAC3B,MAAM,sBAAqC;QAC3C,MAAM,wBAAuC;QAC7C,MAAM,qBAAyC;QAC/C,MAAM,uBAA2C;QACjD,MAAM,4BAA2C;QACjD,MAAM,8BAA6C,CACnD,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB","sourcesContent":["import { BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasPlayedBloodGemsOnAny, hasPlayedBloodGemsOnMe } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { updateDivineShield } from '../keywords/divine-shield';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { findLast, pickRandom } from '../services/utils';\r\nimport { getMinionsOfDifferentTypes } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const playBloodGemsOn = (\r\n\tsource: BoardEntity | BoardTrinket | BgsPlayerEntity,\r\n\ttarget: BoardEntity,\r\n\tquantity: number,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterTarget = true,\r\n) => {\r\n\tif (registerTarget) {\r\n\t\tgameState.spectator.registerPowerTarget(source, target, board, null, null);\r\n\t}\r\n\r\n\tconst bloodGemBaseAttack =\r\n\t\t1 +\r\n\t\t(hero.globalInfo?.BloodGemAttackBonus ?? 0) +\r\n\t\thero.trinkets.filter((t) => t.cardId === CardIds.GreatBoarSticker_BG30_MagicItem_988).length * 4 +\r\n\t\thero.trinkets.filter((t) => t.cardId === CardIds.GreatBoarSticker_GreatBoarStickerToken_BG30_MagicItem_988t)\r\n\t\t\t.length *\r\n\t\t\t3;\r\n\tconst bloodGemBaseHealth =\r\n\t\t1 +\r\n\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) +\r\n\t\thero.trinkets.filter((t) => t.cardId === CardIds.GreatBoarSticker_GreatBoarStickerToken_BG30_MagicItem_988t)\r\n\t\t\t.length *\r\n\t\t\t3;\r\n\r\n\tconst crones = board.filter((e) => e.cardId === CardIds.NeedlingCrone_BG32_432).length;\r\n\tconst goldenCrones = board.filter((e) => e.cardId === CardIds.NeedlingCrone_BG32_432_G).length;\r\n\tconst cronesMult = goldenCrones > 0 ? 3 : crones > 0 ? 2 : 1;\r\n\tconst bloodGemAttack = bloodGemBaseAttack * cronesMult;\r\n\tconst bloodGemHealth = bloodGemBaseHealth * cronesMult;\r\n\r\n\tapplyBloodGemEnchantment(\r\n\t\tCardIds.BloodGem_BloodGemEnchantment,\r\n\t\ttarget,\r\n\t\tsource,\r\n\t\tquantity,\r\n\t\tbloodGemAttack,\r\n\t\tbloodGemHealth,\r\n\t);\r\n\tapplyBloodGemEnchantment(\r\n\t\tCardIds.BloodGem_BloodGemsEnchantment,\r\n\t\ttarget,\r\n\t\tsource,\r\n\t\tquantity,\r\n\t\tbloodGemAttack,\r\n\t\tbloodGemHealth,\r\n\t);\r\n\r\n\t// This seems to be a single \"modifyStats\" call\r\n\t// 33.6 https://replays.firestoneapp.com/?reviewId=51f93537-182d-4fb8-bf41-1b4429341e01&turn=19&action=3\r\n\tmodifyStats(target, null, quantity * bloodGemAttack, quantity * bloodGemHealth, board, hero, gameState, false);\r\n\t// for (let i = 0; i < quantity; i++) {\r\n\t// }\r\n\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tswitch (target.cardId) {\r\n\t\t\tcase CardIds.ToughTusk_BG20_102:\r\n\t\t\tcase CardIds.ToughTusk_BG20_102_G:\r\n\t\t\t\tif (!target.divineShield) {\r\n\t\t\t\t\tupdateDivineShield(target, board, hero, null, true, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(target, target, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeomagusRoogug_BG28_583:\r\n\t\t\tcase CardIds.GeomagusRoogug_BG28_583_G:\r\n\t\t\t\tconst roogugTargets = board.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId !== CardIds.GeomagusRoogug_BG28_583 && e.cardId !== CardIds.GeomagusRoogug_BG28_583_G,\r\n\t\t\t\t);\r\n\t\t\t\tconst roogugTarget = pickRandom(roogugTargets);\r\n\t\t\t\tif (roogugTarget) {\r\n\t\t\t\t\tconst roogugBuff = target.cardId === CardIds.GeomagusRoogug_BG28_583_G ? 2 : 1;\r\n\t\t\t\t\tplayBloodGemsOn(\r\n\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\troogugTarget,\r\n\t\t\t\t\t\troogugBuff,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AggemThorncurse_BG20_302:\r\n\t\t\tcase CardIds.AggemThorncurse_BG20_302_G:\r\n\t\t\t\t// console.debug('playing blood gem on Aggem Thorncurse', target.cardId);\r\n\t\t\t\tconst aggemGemsToPlay = target.cardId === CardIds.AggemThorncurse_BG20_302_G ? 2 : 1;\r\n\t\t\t\tconst candidates = getMinionsOfDifferentTypes(\r\n\t\t\t\t\tboard.filter(\r\n\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\te.cardId !== CardIds.AggemThorncurse_BG20_302 &&\r\n\t\t\t\t\t\t\te.cardId !== CardIds.AggemThorncurse_BG20_302_G,\r\n\t\t\t\t\t),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tfor (const candidate of candidates) {\r\n\t\t\t\t\tplayBloodGemsOn(\r\n\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\tcandidate,\r\n\t\t\t\t\t\taggemGemsToPlay,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tconst playedBloodGemsOnMeImpl = cardMappings[target.cardId];\r\n\t\t\t\tif (hasPlayedBloodGemsOnMe(playedBloodGemsOnMeImpl)) {\r\n\t\t\t\t\tplayedBloodGemsOnMeImpl.playedBloodGemsOnMe(target, {\r\n\t\t\t\t\t\tboard: board,\r\n\t\t\t\t\t\thero: hero,\r\n\t\t\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst playedBloodGemsOnAnyImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasPlayedBloodGemsOnAny(playedBloodGemsOnAnyImpl)) {\r\n\t\t\t\tplayedBloodGemsOnAnyImpl.playedBloodGemsOnAny(boardEntity, {\r\n\t\t\t\t\tsource: source,\r\n\t\t\t\t\ttarget: target,\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyBloodGemEnchantment = (\r\n\tenchantmentCardId: string,\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BoardTrinket | BgsPlayerEntity,\r\n\tquantity: number,\r\n\tbloodGemAttack: number,\r\n\tbloodGemHealth: number,\r\n) => {\r\n\tlet enchantment = findLast(target.enchantments, (e) => e.cardId === enchantmentCardId);\r\n\tif (!enchantment) {\r\n\t\tenchantment = {\r\n\t\t\tcardId: enchantmentCardId,\r\n\t\t\toriginEntityId: source.entityId,\r\n\t\t\ttiming: 0,\r\n\t\t\ttagScriptDataNum1: 0,\r\n\t\t\ttagScriptDataNum2: 0,\r\n\t\t};\r\n\t\ttarget.enchantments.push(enchantment);\r\n\t}\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tenchantment.tagScriptDataNum1 += bloodGemAttack;\r\n\t\tenchantment.tagScriptDataNum2 += bloodGemHealth;\r\n\t}\r\n};\r\n\r\nexport const isBloodGem = (cardId: string) => {\r\n\treturn (\r\n\t\tcardId === CardIds.BloodGem ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_Reborn ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_Reborn_G ||\r\n\t\tcardId === CardIds.BloodGemToken_BG20_GEM_Taunt ||\r\n\t\tcardId === CardIds.BloodGemToken_BG20_GEM_Taunt_G ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_DivineShield ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_DivineShield_G\r\n\t);\r\n};\r\n\r\nexport interface PlayedBloodGemsOnMeInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n\r\nexport interface PlayedBloodGemsOnAnyInput {\r\n\tsource: BoardEntity | BoardTrinket | BgsPlayerEntity;\r\n\ttarget: BoardEntity;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
1
+ {"version":3,"file":"blood-gems.js","sourceRoot":"","sources":["../../src/simulation/blood-gems.ts"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ChD,WAAW,CAAC,iBAAiB,IAAI,cAAc,CAAC;KAChD;AACF,CAAC,CAAC;AAvBW,QAAA,wBAAwB,4BAuBnC;AAEK,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE;IAC5C,OAAO,CACN,MAAM,eAAqB;QAC3B,MAAM,sBAAqC;QAC3C,MAAM,wBAAuC;QAC7C,MAAM,qBAAyC;QAC/C,MAAM,uBAA2C;QACjD,MAAM,4BAA2C;QACjD,MAAM,8BAA6C,CACnD,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB","sourcesContent":["import { BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasPlayedBloodGemsOnAny, hasPlayedBloodGemsOnMe } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { updateDivineShield } from '../keywords/divine-shield';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { findLast, pickRandom } from '../services/utils';\r\nimport { getMinionsOfDifferentTypes } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const playBloodGemsOn = (\r\n\tsource: BoardEntity | BoardTrinket | BgsPlayerEntity,\r\n\ttarget: BoardEntity,\r\n\tquantity: number,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterTarget = true,\r\n) => {\r\n\tif (registerTarget) {\r\n\t\tgameState.spectator.registerPowerTarget(source, target, board, null, null);\r\n\t}\r\n\r\n\tconst bloodGemBaseAttack =\r\n\t\t1 +\r\n\t\t(hero.globalInfo?.BloodGemAttackBonus ?? 0) +\r\n\t\thero.trinkets.filter((t) => t.cardId === CardIds.GreatBoarSticker_BG30_MagicItem_988).length * 2 +\r\n\t\thero.trinkets.filter((t) => t.cardId === CardIds.GreatBoarSticker_GreatBoarStickerToken_BG30_MagicItem_988t)\r\n\t\t\t.length *\r\n\t\t\t3;\r\n\tconst bloodGemBaseHealth =\r\n\t\t1 +\r\n\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) +\r\n\t\thero.trinkets.filter((t) => t.cardId === CardIds.GreatBoarSticker_BG30_MagicItem_988).length * 1 +\r\n\t\thero.trinkets.filter((t) => t.cardId === CardIds.GreatBoarSticker_GreatBoarStickerToken_BG30_MagicItem_988t)\r\n\t\t\t.length *\r\n\t\t\t3;\r\n\r\n\tconst crones = board.filter((e) => e.cardId === CardIds.NeedlingCrone_BG32_432).length;\r\n\tconst goldenCrones = board.filter((e) => e.cardId === CardIds.NeedlingCrone_BG32_432_G).length;\r\n\tconst cronesMult = goldenCrones > 0 ? 3 : crones > 0 ? 2 : 1;\r\n\tconst bloodGemAttack = bloodGemBaseAttack * cronesMult;\r\n\tconst bloodGemHealth = bloodGemBaseHealth * cronesMult;\r\n\r\n\tapplyBloodGemEnchantment(\r\n\t\tCardIds.BloodGem_BloodGemEnchantment,\r\n\t\ttarget,\r\n\t\tsource,\r\n\t\tquantity,\r\n\t\tbloodGemAttack,\r\n\t\tbloodGemHealth,\r\n\t);\r\n\tapplyBloodGemEnchantment(\r\n\t\tCardIds.BloodGem_BloodGemsEnchantment,\r\n\t\ttarget,\r\n\t\tsource,\r\n\t\tquantity,\r\n\t\tbloodGemAttack,\r\n\t\tbloodGemHealth,\r\n\t);\r\n\r\n\t// This seems to be a single \"modifyStats\" call\r\n\t// 33.6 https://replays.firestoneapp.com/?reviewId=51f93537-182d-4fb8-bf41-1b4429341e01&turn=19&action=3\r\n\tmodifyStats(target, null, quantity * bloodGemAttack, quantity * bloodGemHealth, board, hero, gameState, false);\r\n\t// for (let i = 0; i < quantity; i++) {\r\n\t// }\r\n\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tswitch (target.cardId) {\r\n\t\t\tcase CardIds.ToughTusk_BG20_102:\r\n\t\t\tcase CardIds.ToughTusk_BG20_102_G:\r\n\t\t\t\tif (!target.divineShield) {\r\n\t\t\t\t\tupdateDivineShield(target, board, hero, null, true, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(target, target, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeomagusRoogug_BG28_583:\r\n\t\t\tcase CardIds.GeomagusRoogug_BG28_583_G:\r\n\t\t\t\tconst roogugTargets = board.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId !== CardIds.GeomagusRoogug_BG28_583 && e.cardId !== CardIds.GeomagusRoogug_BG28_583_G,\r\n\t\t\t\t);\r\n\t\t\t\tconst roogugTarget = pickRandom(roogugTargets);\r\n\t\t\t\tif (roogugTarget) {\r\n\t\t\t\t\tconst roogugBuff = target.cardId === CardIds.GeomagusRoogug_BG28_583_G ? 2 : 1;\r\n\t\t\t\t\tplayBloodGemsOn(\r\n\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\troogugTarget,\r\n\t\t\t\t\t\troogugBuff,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AggemThorncurse_BG20_302:\r\n\t\t\tcase CardIds.AggemThorncurse_BG20_302_G:\r\n\t\t\t\t// console.debug('playing blood gem on Aggem Thorncurse', target.cardId);\r\n\t\t\t\tconst aggemGemsToPlay = target.cardId === CardIds.AggemThorncurse_BG20_302_G ? 2 : 1;\r\n\t\t\t\tconst candidates = getMinionsOfDifferentTypes(\r\n\t\t\t\t\tboard.filter(\r\n\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\te.cardId !== CardIds.AggemThorncurse_BG20_302 &&\r\n\t\t\t\t\t\t\te.cardId !== CardIds.AggemThorncurse_BG20_302_G,\r\n\t\t\t\t\t),\r\n\t\t\t\t\thero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t\tfor (const candidate of candidates) {\r\n\t\t\t\t\tplayBloodGemsOn(\r\n\t\t\t\t\t\ttarget,\r\n\t\t\t\t\t\tcandidate,\r\n\t\t\t\t\t\taggemGemsToPlay,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\totherBoard,\r\n\t\t\t\t\t\totherHero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tconst playedBloodGemsOnMeImpl = cardMappings[target.cardId];\r\n\t\t\t\tif (hasPlayedBloodGemsOnMe(playedBloodGemsOnMeImpl)) {\r\n\t\t\t\t\tplayedBloodGemsOnMeImpl.playedBloodGemsOnMe(target, {\r\n\t\t\t\t\t\tboard: board,\r\n\t\t\t\t\t\thero: hero,\r\n\t\t\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const boardEntity of board) {\r\n\t\t\tconst playedBloodGemsOnAnyImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasPlayedBloodGemsOnAny(playedBloodGemsOnAnyImpl)) {\r\n\t\t\t\tplayedBloodGemsOnAnyImpl.playedBloodGemsOnAny(boardEntity, {\r\n\t\t\t\t\tsource: source,\r\n\t\t\t\t\ttarget: target,\r\n\t\t\t\t\tboard: board,\r\n\t\t\t\t\thero: hero,\r\n\t\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyBloodGemEnchantment = (\r\n\tenchantmentCardId: string,\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BoardTrinket | BgsPlayerEntity,\r\n\tquantity: number,\r\n\tbloodGemAttack: number,\r\n\tbloodGemHealth: number,\r\n) => {\r\n\tlet enchantment = findLast(target.enchantments, (e) => e.cardId === enchantmentCardId);\r\n\tif (!enchantment) {\r\n\t\tenchantment = {\r\n\t\t\tcardId: enchantmentCardId,\r\n\t\t\toriginEntityId: source.entityId,\r\n\t\t\ttiming: 0,\r\n\t\t\ttagScriptDataNum1: 0,\r\n\t\t\ttagScriptDataNum2: 0,\r\n\t\t};\r\n\t\ttarget.enchantments.push(enchantment);\r\n\t}\r\n\tfor (let i = 0; i < quantity; i++) {\r\n\t\tenchantment.tagScriptDataNum1 += bloodGemAttack;\r\n\t\tenchantment.tagScriptDataNum2 += bloodGemHealth;\r\n\t}\r\n};\r\n\r\nexport const isBloodGem = (cardId: string) => {\r\n\treturn (\r\n\t\tcardId === CardIds.BloodGem ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_Reborn ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_Reborn_G ||\r\n\t\tcardId === CardIds.BloodGemToken_BG20_GEM_Taunt ||\r\n\t\tcardId === CardIds.BloodGemToken_BG20_GEM_Taunt_G ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_DivineShield ||\r\n\t\tcardId === CardIds.BloodGem_BG20_GEM_DivineShield_G\r\n\t);\r\n};\r\n\r\nexport interface PlayedBloodGemsOnMeInput {\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n\r\nexport interface PlayedBloodGemsOnAnyInput {\r\n\tsource: BoardEntity | BoardTrinket | BgsPlayerEntity;\r\n\ttarget: BoardEntity;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
@@ -333,6 +333,9 @@ const handlePostDeathrattleEffect = (deadEntity, indexFromRight, deadEntities, d
333
333
  if (deadEntityPlayerState.player.globalInfo.UndeadAttackBonus > 0) {
334
334
  deadEntity.attack = Math.max(0, deadEntity.attack - deadEntityPlayerState.player.globalInfo.UndeadAttackBonus);
335
335
  }
336
+ if (deadEntityPlayerState.player.globalInfo.UndeadHealthBonus > 0) {
337
+ deadEntity.health = Math.max(1, deadEntity.health - deadEntityPlayerState.player.globalInfo.UndeadHealthBonus);
338
+ }
336
339
  }
337
340
  if ((0, utils_1.hasCorrectTribe)(deadEntity, deadEntityPlayerState.player, reference_data_1.Race.BEAST, gameState.anomalies, gameState.allCards)) {
338
341
  if (deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"deathrattle-orchestration.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-orchestration.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAEpD,oDAA8C;AAE9C,oCAA2C;AAC3C,qCAA8C;AAC9C,mDAAyD;AACzD,+DAI+B;AAC/B,6DAAmF;AAEnF,qCAAiD;AACjD,qCAA+C;AAW/C,IAAI,kBAAkB,GAAG,CAAC,CAAC;AAEpB,MAAM,6BAA6B,GAAG,CAC5C,gBAAkC,EAClC,aAAa,GAAG,IAAI,EACpB,aAAa,GAAG,IAAI,EACnB,EAAE;IACH,kBAAkB,EAAE,CAAC;IACrB,IAAI,kBAAkB,GAAG,GAAG,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,kBAAkB,CAAC,CAAC;QAC1E,OAAO,CAAC,KAAK,CACZ,uBAAuB,EACvB,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CACxD,CAAC;QACF,OA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eAAe,CAC3E,CAAC;SACF;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAvengeEffects } from './avenge';\r\nimport { applyAfterDeathEffects } from './death-effects';\r\nimport {\r\n\tapplyAfterMinionDiesEffect,\r\n\tapplyWheneverMinionDiesEffect,\r\n\thandleAfterMinionKillsEffect,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle } from './deathrattle-spawns';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { handleRebornForEntity } from './reborn';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\n// FIXME:\r\n// From Mitchell on Discord:\r\n// - Minions die left to right\r\n// - When a minion dies, it procs natural deathrattle, added deathrattles, and then all avenges progress\r\n// by 1 (and trigger as necessary)\r\n// - Then next minion\r\n// - After ALL deathrattles and avenges are done, Reborn triggers\r\n// - (Ideally after all of that I would want Feathermane to trigger, but that is not what it does right now.\r\n// Right now it triggers at deathrattle speed rather than after Reborn speed)\r\nlet _deathEffectsDepth = 0;\r\n\r\nexport const orchestrateMinionDeathEffects = (\r\n\tdeathrattleInput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n\tprocessReborn = true,\r\n) => {\r\n\t_deathEffectsDepth++;\r\n\tif (_deathEffectsDepth > 100) {\r\n\t\tconsole.error('Infinite recursion detected at depth', _deathEffectsDepth);\r\n\t\tconsole.error(\r\n\t\t\t'Player dead entities:',\r\n\t\t\tdeathrattleInput.playerDeadEntities.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Opponent dead entities:',\r\n\t\t\tdeathrattleInput.opponentDeadEntities.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Player board:',\r\n\t\t\tdeathrattleInput.gameState.gameState.player.board.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Opponent board:',\r\n\t\t\tdeathrattleInput.gameState.gameState.opponent.board.map((e) => e.cardId),\r\n\t\t);\r\n\t\t_deathEffectsDepth--;\r\n\t\treturn;\r\n\t}\r\n\r\n\thandleAfterMinionsKillEffects(deathrattleInput);\r\n\r\n\t// Not sure about this\r\n\thandleWheneverMinionsDieEffects(deathrattleInput);\r\n\r\n\tconst playerBoardBefore = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardBefore = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\r\n\tconst entitiesFromDeathrattles = processDeathrattles(deathrattleInput, processAvenge);\r\n\r\n\t// When a Silent Enforcer dies, it deals damage to other minions, then Soul Juggler damages the minions\r\n\t// **before** they completely die and spawn their own deathrattles\r\n\thandleAfterMinionsDieEffects(deathrattleInput);\r\n\r\n\t// Hack to try and fix how reborn indices are handled when there are spawns during the deathrattle phase\r\n\t// Ideally, this should probably be rewritten completely to keep the dead entities in the board itself\r\n\t// so we can use that as a source for the spawn index. However this is a big rewrite with lots of\r\n\t// potential side-effects\r\n\tconst playerBoardAfter = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardAfter = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\tconst opponentIndexOfSpawnedEntities = opponentBoardAfter\r\n\t\t.filter((entity) => !opponentBoardBefore.includes(entity))\r\n\t\t.map((entity) => opponentBoardAfter.length - opponentBoardAfter.indexOf(entity) - 1);\r\n\tconst playerIndexOfSpawnedEntities = playerBoardAfter\r\n\t\t.filter((entity) => !playerBoardBefore.includes(entity))\r\n\t\t.map((entity) => playerBoardAfter.length - playerBoardAfter.indexOf(entity) - 1);\r\n\tdeathrattleInput.opponentDeadEntityIndexesFromRight = deathrattleInput.opponentDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\topponentIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\tdeathrattleInput.playerDeadEntityIndexesFromRight = deathrattleInput.playerDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\tplayerIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\r\n\tif (processReborn) {\r\n\t\tprocessReborns(deathrattleInput);\r\n\t}\r\n\r\n\tconst entitiesFromFeathermanes = processFeathermaneEffects(deathrattleInput);\r\n\thandlePostDeathrattleEffects(deathrattleInput, [...entitiesFromDeathrattles, ...entitiesFromFeathermanes]);\r\n\r\n\t_deathEffectsDepth--;\r\n};\r\n\r\nconst handleAfterMinionsKillEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\thandleAfterMinionKillsEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleWheneverMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\t// Wildfire Element is applied first, before the DR spawns\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyWheneverMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyAfterMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst processDeathrattles = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\t// Deathrattles are handled left to right\r\n\t// Then for each minion, natural deathrattles are processed first, then enchantments\r\n\t// http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=1\r\n\t// http://replays.firestoneapp.com/?reviewId=f32e734a-d5a2-4fa4-ad10-94019969cdd7&turn=6&action=22\r\n\t// http://replays.firestoneapp.com/?reviewId=ea9503c9-2795-49f0-866b-9ea856cec7df&turn=11&action=3\r\n\t// http://replays.firestoneapp.com/?reviewId=1ff37e17-704c-4a73-8c78-377c52b6cb42&turn=13&action=1 is a trap: the enchantment is on the first\r\n\t// minion, but the DR is on the second one.\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\t// Issue: we should process all deathrattles first, then all avenge. If multiple minions die at the same time,\r\n\t\t// the current implementation processes the first minion completely (DR + avenge), then the second one\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tconst spawns = processDeathrattleForMinions(\r\n\t\t\t\tdeadEntities,\r\n\t\t\t\tplayerDeadEntityIndexesFromRight[i],\r\n\t\t\t\tplayerStates[i],\r\n\t\t\t\tplayerStates[1 - i],\r\n\t\t\t\tdeathrattleInput,\r\n\t\t\t\tprocessAvenge,\r\n\t\t\t);\r\n\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// for (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t// \tconst deadEntity = deadEntities[j];\r\n\t\t\t// \tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t// \tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t// \tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t// \tconst spawns = processDeathrattleForMinion(\r\n\t\t\t// \t\tdeadEntity,\r\n\t\t\t// \t\tindexFromRight,\r\n\t\t\t// \t\tdeadEntities,\r\n\t\t\t// \t\tdeadEntityPlayerState,\r\n\t\t\t// \t\totherPlayerState,\r\n\t\t\t// \t\tdeathrattleInput.gameState,\r\n\t\t\t// \t\tprocessAvenge,\r\n\t\t\t// \t);\r\n\t\t\t// \tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// }\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneEffects = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processFeathermaneForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst maxSpawns = 7 - deadEntityPlayerState.board.length;\r\n\tconst allSpawns = [];\r\n\r\n\t// Feathermane\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tconst feathermanes =\r\n\t\t\tdeadEntityPlayerState.player.hand\r\n\t\t\t\t?.filter((e) => !e.locked)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014 ||\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014_G,\r\n\t\t\t\t) ?? [];\r\n\t\tfor (const feathermaneSpawn of feathermanes) {\r\n\t\t\tif (allSpawns.length >= maxSpawns) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfeathermaneSpawn.locked = true;\r\n\t\t\tconst spawns = spawnEntities(\r\n\t\t\t\tfeathermaneSpawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tgameState,\r\n\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{ ...feathermaneSpawn } as BoardEntity,\r\n\t\t\t);\r\n\r\n\t\t\t// So that it can be flagged as \"unspawned\" if it is not spawned in the end\r\n\t\t\tfor (const spawn of spawns) {\r\n\t\t\t\tspawn.onCanceledSummon = () => (feathermaneSpawn.locked = false);\r\n\t\t\t\t// spawn.backRef = feathermaneSpawn;\r\n\t\t\t}\r\n\t\t\tallSpawns.push(...spawns);\r\n\t\t}\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn allSpawns;\r\n};\r\n\r\nconst processDeathrattleForMinions = (\r\n\tdeadEntities: BoardEntity[],\r\n\tplayerDeadEntityIndexesFromRight: number[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tinput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\r\n\t// Natural deathrattles & enchantments\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst drEntities = handleNaturalDeathrattle(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\r\n\t\tentitiesFromDeathrattles.push(...drEntities);\r\n\t}\r\n\r\n\t// Avenge\r\n\tlet avengeEntities = [];\r\n\tif (processAvenge) {\r\n\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\tconst allAfterDeathEntities = [];\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst afterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t\tallAfterDeathEntities.push(...afterDeathEntities);\r\n\t}\r\n\r\n\treturn [...entitiesFromDeathrattles, ...avengeEntities, ...allAfterDeathEntities];\r\n};\r\n\r\nexport const processDeathrattleForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst drEntities = handleNaturalDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\t// Avenge trigger before reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=5bb20eb8-e0ca-47ab-adc7-13134716d568&turn=7&action=6\r\n\tlet avengeEntities = [];\r\n\tlet afterDeathEntities = [];\r\n\tif (processAvenge) {\r\n\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t\t[...drEntities],\r\n\t\t);\r\n\r\n\t\t// TODO: Feathermane should be applied after the Reborn effects have all been processed\r\n\t\t// Secrets should be processed here (\"at Avenge speed\")\r\n\t\tafterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\treturn [...drEntities, ...avengeEntities, ...afterDeathEntities];\r\n};\r\n\r\nconst handleNaturalDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\t// const allSpawns = [];\r\n\t// const spawnsToSpawn = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\toriginalCardId: deadEntity.cardId,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tdeathrattleRepeats: dr.repeats ?? 1,\r\n\t\t\tscriptDataNum1: dr.tagScriptDataNum1,\r\n\t\t\tscriptDataNum2: dr.tagScriptDataNum2,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t\t// For Corrupted Bristler\r\n\t\t\tenchantments: deadEntity.enchantments.filter((e) => e.cardId?.startsWith(CardIds.BloodGem)),\r\n\t\t\tmemory:\r\n\t\t\t\tdr.memory == null\r\n\t\t\t\t\t? null\r\n\t\t\t\t\t: Array.isArray(dr.memory)\r\n\t\t\t\t\t? dr.memory.map((mem) => ({ ...mem }))\r\n\t\t\t\t\t: { ...dr.memory },\r\n\t\t};\r\n\t\tconst spawns = handleNaturalDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\t// The spawns have already been processed in the \"handleNaturalDeathrattle\" method\r\n\t\t// spawnsToSpawn.push(...spawns);\r\n\t\t// allSpawns.push(...spawns);\r\n\t}\r\n\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tdeadEntities,\r\n\t\tgameState,\r\n\t);\r\n\r\n\treturn entitiesFromNativeDeathrattle;\r\n};\r\n\r\nconst processReborns = (deathrattleInput: DeathrattleInput) => {\r\n\t// const entitiesFromReborn: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\thandleRebornForEntity(\r\n\t\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\totherPlayerState.board,\r\n\t\t\t\t\totherPlayerState.player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handlePostDeathrattleEffects = (deathrattleInput: DeathrattleInput, entitiesFromDeathrattles: BoardEntity[]) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Process from right to left, so that we can set the hasAttacked attribute properly\r\n\t\t\t// If two minions die at the same time, both of which having attacked, but the third in line having not,\r\n\t\t\t// processing them from left to right means the first (leftmost) one will check its right neighbor, which\r\n\t\t\t// is the minion that hasn't attacked\r\n\t\t\tfor (let j = deadEntities.length - 1; j >= 0; j--) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\thandlePostDeathrattleEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t\t\tdeadEntityPlayerState.player.friendly,\r\n\t\t\t\t\tdeathrattleInput,\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 handleDeathrattles = (deathrattleInput: DeathrattleInput) => {\r\n\torchestrateMinionDeathEffects(deathrattleInput, false, false);\r\n};\r\n\r\nconst handlePostDeathrattleEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tspawnedEntities: BoardEntity[],\r\n\tisPlayer: boolean,\r\n\tdeathrattleInput: DeathrattleInput,\r\n) => {\r\n\t// This doesn't work if the entity that was to the right died.\r\n\tconst entityRightToSpawns =\r\n\t\tindexFromRight === 0 ? null : deadEntityPlayerState.board[deadEntityPlayerState.board.length - indexFromRight];\r\n\t// To handle minions attack tokens\r\n\t// See http://replays.firestoneapp.com/?reviewId=0583d6a4-6ed0-4b20-894e-4ceb560894fe&turn=6&action=11\r\n\t// When a minion dies, the spawn are either elligible to attack next turn or not\r\n\t// If the minion right to the spawned minion has already attacked, then the spawned\r\n\t// minion cannot attack\r\n\tspawnedEntities.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tif (deadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113)) {\r\n\t\tconst ogDeadEntity = gameState.sharedState.deaths.find((entity) => entity.entityId === deadEntity.entityId);\r\n\t\tif (ogDeadEntity) {\r\n\t\t\togDeadEntity.attack += 4;\r\n\t\t\togDeadEntity.health += 4;\r\n\t\t}\r\n\t}\r\n\r\n\t// ISSUE: when we do this, we change the minion's stats before processing deathrattle effects, which can mess\r\n\t// up the simulation in some cases (like Nightbane, Ignited)\r\n\t// FIX: we do it in postDeathrattleEfects, not when removing minions from the board\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tdeadEntity.attack = Math.max(\r\n\t\t\t0,\r\n\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus,\r\n\t\t);\r\n\t}\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tdeadEntity.health = Math.max(\r\n\t\t\t1,\r\n\t\t\tdeadEntity.health - deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus,\r\n\t\t);\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.UNDEAD, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.UndeadAttackBonus,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (isWhelp(deadEntity.cardId, gameState.allCards)) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.WhelpAttackBuff > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.WhelpAttackBuff,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\ninterface DeathrattleInput {\r\n\tgameState: FullGameState;\r\n\tplayerDeadEntities: BoardEntity[];\r\n\tplayerDeadEntityIndexesFromRight: number[];\r\n\topponentDeadEntities: BoardEntity[];\r\n\topponentDeadEntityIndexesFromRight: number[];\r\n}\r\n"]}
1
+ {"version":3,"file":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AM,CAAC,UAAU,CAAC,iBAAiB,GAAG,CAAC,EAAE;YAClE,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAC3B,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAC7E,CAAC;SACF;KACD;IACD,IACC,IAAA,uBAAe,EAAC,UAAU,EAAE,qBAAqB,CAAC,MAAM,EAAE,qBAAI,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAC7G;QACD,IAAI,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,EAAE;YAChE,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAC3B,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAC3E,CAAC;SACF;KACD;IACD,IAAI,IAAA,oBAAO,EAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QACnD,IAAI,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,EAAE;YAChE,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAC3B,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAC3E,CAAC;SACF;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAvengeEffects } from './avenge';\r\nimport { applyAfterDeathEffects } from './death-effects';\r\nimport {\r\n\tapplyAfterMinionDiesEffect,\r\n\tapplyWheneverMinionDiesEffect,\r\n\thandleAfterMinionKillsEffect,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle } from './deathrattle-spawns';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { handleRebornForEntity } from './reborn';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\n// FIXME:\r\n// From Mitchell on Discord:\r\n// - Minions die left to right\r\n// - When a minion dies, it procs natural deathrattle, added deathrattles, and then all avenges progress\r\n// by 1 (and trigger as necessary)\r\n// - Then next minion\r\n// - After ALL deathrattles and avenges are done, Reborn triggers\r\n// - (Ideally after all of that I would want Feathermane to trigger, but that is not what it does right now.\r\n// Right now it triggers at deathrattle speed rather than after Reborn speed)\r\nlet _deathEffectsDepth = 0;\r\n\r\nexport const orchestrateMinionDeathEffects = (\r\n\tdeathrattleInput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n\tprocessReborn = true,\r\n) => {\r\n\t_deathEffectsDepth++;\r\n\tif (_deathEffectsDepth > 100) {\r\n\t\tconsole.error('Infinite recursion detected at depth', _deathEffectsDepth);\r\n\t\tconsole.error(\r\n\t\t\t'Player dead entities:',\r\n\t\t\tdeathrattleInput.playerDeadEntities.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Opponent dead entities:',\r\n\t\t\tdeathrattleInput.opponentDeadEntities.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Player board:',\r\n\t\t\tdeathrattleInput.gameState.gameState.player.board.map((e) => e.cardId),\r\n\t\t);\r\n\t\tconsole.error(\r\n\t\t\t'Opponent board:',\r\n\t\t\tdeathrattleInput.gameState.gameState.opponent.board.map((e) => e.cardId),\r\n\t\t);\r\n\t\t_deathEffectsDepth--;\r\n\t\treturn;\r\n\t}\r\n\r\n\thandleAfterMinionsKillEffects(deathrattleInput);\r\n\r\n\t// Not sure about this\r\n\thandleWheneverMinionsDieEffects(deathrattleInput);\r\n\r\n\tconst playerBoardBefore = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardBefore = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\r\n\tconst entitiesFromDeathrattles = processDeathrattles(deathrattleInput, processAvenge);\r\n\r\n\t// When a Silent Enforcer dies, it deals damage to other minions, then Soul Juggler damages the minions\r\n\t// **before** they completely die and spawn their own deathrattles\r\n\thandleAfterMinionsDieEffects(deathrattleInput);\r\n\r\n\t// Hack to try and fix how reborn indices are handled when there are spawns during the deathrattle phase\r\n\t// Ideally, this should probably be rewritten completely to keep the dead entities in the board itself\r\n\t// so we can use that as a source for the spawn index. However this is a big rewrite with lots of\r\n\t// potential side-effects\r\n\tconst playerBoardAfter = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardAfter = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\tconst opponentIndexOfSpawnedEntities = opponentBoardAfter\r\n\t\t.filter((entity) => !opponentBoardBefore.includes(entity))\r\n\t\t.map((entity) => opponentBoardAfter.length - opponentBoardAfter.indexOf(entity) - 1);\r\n\tconst playerIndexOfSpawnedEntities = playerBoardAfter\r\n\t\t.filter((entity) => !playerBoardBefore.includes(entity))\r\n\t\t.map((entity) => playerBoardAfter.length - playerBoardAfter.indexOf(entity) - 1);\r\n\tdeathrattleInput.opponentDeadEntityIndexesFromRight = deathrattleInput.opponentDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\topponentIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\tdeathrattleInput.playerDeadEntityIndexesFromRight = deathrattleInput.playerDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\tplayerIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\r\n\tif (processReborn) {\r\n\t\tprocessReborns(deathrattleInput);\r\n\t}\r\n\r\n\tconst entitiesFromFeathermanes = processFeathermaneEffects(deathrattleInput);\r\n\thandlePostDeathrattleEffects(deathrattleInput, [...entitiesFromDeathrattles, ...entitiesFromFeathermanes]);\r\n\r\n\t_deathEffectsDepth--;\r\n};\r\n\r\nconst handleAfterMinionsKillEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\thandleAfterMinionKillsEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleWheneverMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\t// Wildfire Element is applied first, before the DR spawns\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyWheneverMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyAfterMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst processDeathrattles = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\t// Deathrattles are handled left to right\r\n\t// Then for each minion, natural deathrattles are processed first, then enchantments\r\n\t// http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=1\r\n\t// http://replays.firestoneapp.com/?reviewId=f32e734a-d5a2-4fa4-ad10-94019969cdd7&turn=6&action=22\r\n\t// http://replays.firestoneapp.com/?reviewId=ea9503c9-2795-49f0-866b-9ea856cec7df&turn=11&action=3\r\n\t// http://replays.firestoneapp.com/?reviewId=1ff37e17-704c-4a73-8c78-377c52b6cb42&turn=13&action=1 is a trap: the enchantment is on the first\r\n\t// minion, but the DR is on the second one.\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\t// Issue: we should process all deathrattles first, then all avenge. If multiple minions die at the same time,\r\n\t\t// the current implementation processes the first minion completely (DR + avenge), then the second one\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tconst spawns = processDeathrattleForMinions(\r\n\t\t\t\tdeadEntities,\r\n\t\t\t\tplayerDeadEntityIndexesFromRight[i],\r\n\t\t\t\tplayerStates[i],\r\n\t\t\t\tplayerStates[1 - i],\r\n\t\t\t\tdeathrattleInput,\r\n\t\t\t\tprocessAvenge,\r\n\t\t\t);\r\n\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// for (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t// \tconst deadEntity = deadEntities[j];\r\n\t\t\t// \tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t// \tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t// \tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t// \tconst spawns = processDeathrattleForMinion(\r\n\t\t\t// \t\tdeadEntity,\r\n\t\t\t// \t\tindexFromRight,\r\n\t\t\t// \t\tdeadEntities,\r\n\t\t\t// \t\tdeadEntityPlayerState,\r\n\t\t\t// \t\totherPlayerState,\r\n\t\t\t// \t\tdeathrattleInput.gameState,\r\n\t\t\t// \t\tprocessAvenge,\r\n\t\t\t// \t);\r\n\t\t\t// \tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t// }\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneEffects = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processFeathermaneForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst maxSpawns = 7 - deadEntityPlayerState.board.length;\r\n\tconst allSpawns = [];\r\n\r\n\t// Feathermane\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tconst feathermanes =\r\n\t\t\tdeadEntityPlayerState.player.hand\r\n\t\t\t\t?.filter((e) => !e.locked)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014 ||\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014_G,\r\n\t\t\t\t) ?? [];\r\n\t\tfor (const feathermaneSpawn of feathermanes) {\r\n\t\t\tif (allSpawns.length >= maxSpawns) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfeathermaneSpawn.locked = true;\r\n\t\t\tconst spawns = spawnEntities(\r\n\t\t\t\tfeathermaneSpawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tgameState,\r\n\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{ ...feathermaneSpawn } as BoardEntity,\r\n\t\t\t);\r\n\r\n\t\t\t// So that it can be flagged as \"unspawned\" if it is not spawned in the end\r\n\t\t\tfor (const spawn of spawns) {\r\n\t\t\t\tspawn.onCanceledSummon = () => (feathermaneSpawn.locked = false);\r\n\t\t\t\t// spawn.backRef = feathermaneSpawn;\r\n\t\t\t}\r\n\t\t\tallSpawns.push(...spawns);\r\n\t\t}\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn allSpawns;\r\n};\r\n\r\nconst processDeathrattleForMinions = (\r\n\tdeadEntities: BoardEntity[],\r\n\tplayerDeadEntityIndexesFromRight: number[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tinput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\r\n\t// Natural deathrattles & enchantments\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst drEntities = handleNaturalDeathrattle(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\r\n\t\tentitiesFromDeathrattles.push(...drEntities);\r\n\t}\r\n\r\n\t// Avenge\r\n\tlet avengeEntities = [];\r\n\tif (processAvenge) {\r\n\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\tindexFromRight,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tinput.gameState,\r\n\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\tconst allAfterDeathEntities = [];\r\n\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\tconst deadEntity = deadEntities[j];\r\n\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[j];\r\n\t\tconst afterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tinput.gameState,\r\n\t\t);\r\n\t\tallAfterDeathEntities.push(...afterDeathEntities);\r\n\t}\r\n\r\n\treturn [...entitiesFromDeathrattles, ...avengeEntities, ...allAfterDeathEntities];\r\n};\r\n\r\nexport const processDeathrattleForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst drEntities = handleNaturalDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\t// Avenge trigger before reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=5bb20eb8-e0ca-47ab-adc7-13134716d568&turn=7&action=6\r\n\tlet avengeEntities = [];\r\n\tlet afterDeathEntities = [];\r\n\tif (processAvenge) {\r\n\t\tavengeEntities = applyAvengeEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t\t[...drEntities],\r\n\t\t);\r\n\r\n\t\t// TODO: Feathermane should be applied after the Reborn effects have all been processed\r\n\t\t// Secrets should be processed here (\"at Avenge speed\")\r\n\t\tafterDeathEntities = applyAfterDeathEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\treturn [...drEntities, ...avengeEntities, ...afterDeathEntities];\r\n};\r\n\r\nconst handleNaturalDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\t// const allSpawns = [];\r\n\t// const spawnsToSpawn = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\toriginalCardId: deadEntity.cardId,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tdeathrattleRepeats: dr.repeats ?? 1,\r\n\t\t\tscriptDataNum1: dr.tagScriptDataNum1,\r\n\t\t\tscriptDataNum2: dr.tagScriptDataNum2,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t\t// For Corrupted Bristler\r\n\t\t\tenchantments: deadEntity.enchantments.filter((e) => e.cardId?.startsWith(CardIds.BloodGem)),\r\n\t\t\tmemory:\r\n\t\t\t\tdr.memory == null\r\n\t\t\t\t\t? null\r\n\t\t\t\t\t: Array.isArray(dr.memory)\r\n\t\t\t\t\t? dr.memory.map((mem) => ({ ...mem }))\r\n\t\t\t\t\t: { ...dr.memory },\r\n\t\t};\r\n\t\tconst spawns = handleNaturalDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\t// The spawns have already been processed in the \"handleNaturalDeathrattle\" method\r\n\t\t// spawnsToSpawn.push(...spawns);\r\n\t\t// allSpawns.push(...spawns);\r\n\t}\r\n\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tdeadEntities,\r\n\t\tgameState,\r\n\t);\r\n\r\n\treturn entitiesFromNativeDeathrattle;\r\n};\r\n\r\nconst processReborns = (deathrattleInput: DeathrattleInput) => {\r\n\t// const entitiesFromReborn: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\thandleRebornForEntity(\r\n\t\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\totherPlayerState.board,\r\n\t\t\t\t\totherPlayerState.player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handlePostDeathrattleEffects = (deathrattleInput: DeathrattleInput, entitiesFromDeathrattles: BoardEntity[]) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Process from right to left, so that we can set the hasAttacked attribute properly\r\n\t\t\t// If two minions die at the same time, both of which having attacked, but the third in line having not,\r\n\t\t\t// processing them from left to right means the first (leftmost) one will check its right neighbor, which\r\n\t\t\t// is the minion that hasn't attacked\r\n\t\t\tfor (let j = deadEntities.length - 1; j >= 0; j--) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\thandlePostDeathrattleEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t\t\tdeadEntityPlayerState.player.friendly,\r\n\t\t\t\t\tdeathrattleInput,\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 handleDeathrattles = (deathrattleInput: DeathrattleInput) => {\r\n\torchestrateMinionDeathEffects(deathrattleInput, false, false);\r\n};\r\n\r\nconst handlePostDeathrattleEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tspawnedEntities: BoardEntity[],\r\n\tisPlayer: boolean,\r\n\tdeathrattleInput: DeathrattleInput,\r\n) => {\r\n\t// This doesn't work if the entity that was to the right died.\r\n\tconst entityRightToSpawns =\r\n\t\tindexFromRight === 0 ? null : deadEntityPlayerState.board[deadEntityPlayerState.board.length - indexFromRight];\r\n\t// To handle minions attack tokens\r\n\t// See http://replays.firestoneapp.com/?reviewId=0583d6a4-6ed0-4b20-894e-4ceb560894fe&turn=6&action=11\r\n\t// When a minion dies, the spawn are either elligible to attack next turn or not\r\n\t// If the minion right to the spawned minion has already attacked, then the spawned\r\n\t// minion cannot attack\r\n\tspawnedEntities.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? undefined;\r\n\t});\r\n\r\n\tif (deadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113)) {\r\n\t\tconst ogDeadEntity = gameState.sharedState.deaths.find((entity) => entity.entityId === deadEntity.entityId);\r\n\t\tif (ogDeadEntity) {\r\n\t\t\togDeadEntity.attack += 4;\r\n\t\t\togDeadEntity.health += 4;\r\n\t\t}\r\n\t}\r\n\r\n\t// ISSUE: when we do this, we change the minion's stats before processing deathrattle effects, which can mess\r\n\t// up the simulation in some cases (like Nightbane, Ignited)\r\n\t// FIX: we do it in postDeathrattleEfects, not when removing minions from the board\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tdeadEntity.attack = Math.max(\r\n\t\t\t0,\r\n\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.HauntedCarapaceAttackBonus,\r\n\t\t);\r\n\t}\r\n\tif (deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tdeadEntity.health = Math.max(\r\n\t\t\t1,\r\n\t\t\tdeadEntity.health - deadEntityPlayerState.player.globalInfo.HauntedCarapaceHealthBonus,\r\n\t\t);\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.UNDEAD, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.UndeadAttackBonus,\r\n\t\t\t);\r\n\t\t}\r\n\t\tif (deadEntityPlayerState.player.globalInfo.UndeadHealthBonus > 0) {\r\n\t\t\tdeadEntity.health = Math.max(\r\n\t\t\t\t1,\r\n\t\t\t\tdeadEntity.health - deadEntityPlayerState.player.globalInfo.UndeadHealthBonus,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (isWhelp(deadEntity.cardId, gameState.allCards)) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.WhelpAttackBuff > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.WhelpAttackBuff,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\ninterface DeathrattleInput {\r\n\tgameState: FullGameState;\r\n\tplayerDeadEntities: BoardEntity[];\r\n\tplayerDeadEntityIndexesFromRight: number[];\r\n\topponentDeadEntities: BoardEntity[];\r\n\topponentDeadEntityIndexesFromRight: number[];\r\n}\r\n"]}
@@ -3,6 +3,7 @@ import { BoardEntity } from '../board-entity';
3
3
  import { BoardSecret } from '../board-secret';
4
4
  import { FullGameState } from './internal-game-state';
5
5
  export declare const increaseUndeadAttackBonus: (source: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, amount: number, gameState: FullGameState, countsAsStatsGain?: boolean) => void;
6
+ export declare const increaseUndeadHealthBonus: (source: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, amount: number, gameState: FullGameState) => void;
6
7
  export declare const increasePirateAttackBonus: (source: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, amount: number, gameState: FullGameState) => void;
7
8
  export declare const increaseGoldrinnBuff: (source: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, attack: number, health: number, gameState: FullGameState) => void;
8
9
  export declare const increaseWhelpBuff: (source: BoardEntity | BgsPlayerEntity | BoardSecret, board: BoardEntity[], hero: BgsPlayerEntity, attack: number, health: number, gameState: FullGameState) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.increaseWhelpBuff = exports.increaseGoldrinnBuff = exports.increasePirateAttackBonus = exports.increaseUndeadAttackBonus = void 0;
3
+ exports.increaseWhelpBuff = exports.increaseGoldrinnBuff = exports.increasePirateAttackBonus = exports.increaseUndeadHealthBonus = exports.increaseUndeadAttackBonus = void 0;
4
4
  const reference_data_1 = require("@firestone-hs/reference-data");
5
5
  const cards_data_1 = require("../cards/cards-data");
6
6
  const utils_1 = require("../utils");
@@ -11,6 +11,12 @@ const increaseUndeadAttackBonus = (source, board, hero, amount, gameState, count
11
11
  (0, utils_1.addStatsToBoard)(source, board, hero, amount, 0, gameState, reference_data_1.Race[reference_data_1.Race.UNDEAD], countsAsStatsGain);
12
12
  };
13
13
  exports.increaseUndeadAttackBonus = increaseUndeadAttackBonus;
14
+ const increaseUndeadHealthBonus = (source, board, hero, amount, gameState) => {
15
+ var _a;
16
+ hero.globalInfo.UndeadHealthBonus = ((_a = hero.globalInfo.UndeadHealthBonus) !== null && _a !== void 0 ? _a : 0) + amount;
17
+ (0, utils_1.addStatsToBoard)(source, board, hero, 0, amount, gameState, reference_data_1.Race[reference_data_1.Race.UNDEAD], false);
18
+ };
19
+ exports.increaseUndeadHealthBonus = increaseUndeadHealthBonus;
14
20
  const increasePirateAttackBonus = (source, board, hero, amount, gameState) => {
15
21
  var _a;
16
22
  hero.globalInfo.PirateAttackBonus = ((_a = hero.globalInfo.PirateAttackBonus) !== null && _a !== void 0 ? _a : 0) + amount;
@@ -1 +1 @@
1
- {"version":3,"file":"global-info-helpers.js","sourceRoot":"","sources":["../../src/simulation/global-info-helpers.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,oDAA8C;AAC9C,oCAA2C;AAE3C,mCAAsC;AAE/B,MAAM,yBAAyB,GAAG,CACxC,MAAmD,EACnD,KAAoB,EACpB,IAAqB,EACrB,MAAc,EACd,SAAwB,EAGxB,iBAAiB,GAAG,IAAI,EACjB,EAAE;;IACT,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IACtF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,qBAAI,CAAC,qBAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAClG,CAAC,CAAC;AAZW,QAAA,yBAAyB,6BAYpC;AAEK,MAAM,yBAAyB,GAAG,CACxC,MAAmD,EACnD,KAAoB,EACpB,IAAqB,EACrB,MAAc,EACd,SAAwB,EACjB,EAAE;;IACT,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IACtF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,qBAAI,CAAC,qBAAI,CAAC,MAAM,CAAC,EAAE,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EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const increaseUndeadAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n\t// 2026-04-25 Amalgam getting buffed also boosts Mishmash\r\n\t// https://replays.firestoneapp.com/?reviewId=845efb54-f37d-4cb7-9947-cc72fc12d800&turn=19&action=3\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\thero.globalInfo.UndeadAttackBonus = (hero.globalInfo.UndeadAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.UNDEAD], countsAsStatsGain);\r\n};\r\n\r\nexport const increasePirateAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.PirateAttackBonus = (hero.globalInfo.PirateAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.PIRATE], false);\r\n};\r\n\r\nexport const increaseGoldrinnBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.GoldrinnBuffAtk = (hero.globalInfo.GoldrinnBuffAtk ?? 0) + attack;\r\n\thero.globalInfo.GoldrinnBuffHealth = (hero.globalInfo.GoldrinnBuffHealth ?? 0) + health;\r\n\taddStatsToBoard(source, board, hero, attack, health, gameState, Race[Race.BEAST]);\r\n};\r\n\r\nexport const increaseWhelpBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.WhelpAttackBuff = (hero.globalInfo.WhelpAttackBuff ?? 0) + attack;\r\n\thero.globalInfo.WhelpHealthBuff = (hero.globalInfo.WhelpHealthBuff ?? 0) + health;\r\n\tconst targets = board.filter((entity) => isWhelp(entity.cardId, gameState.allCards));\r\n\ttargets.forEach((target) => {\r\n\t\tmodifyStats(target, target, attack, health, board, hero, gameState, false);\r\n\t});\r\n};\r\n"]}
1
+ {"version":3,"file":"global-info-helpers.js","sourceRoot":"","sources":["../../src/simulation/global-info-helpers.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAIpD,oDAA8C;AAC9C,oCAA2C;AAE3C,mCAAsC;AAE/B,MAAM,yBAAyB,GAAG,CACxC,MAAmD,EACnD,KAAoB,EACpB,IAAqB,EACrB,MAAc,EACd,SAAwB,EAGxB,iBAAiB,GAAG,IAAI,EACjB,EAAE;;IACT,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,iBAAiB,mCAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IACtF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,qBAAI,CAAC,qBAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,CAAC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AAkB,mCAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IACxF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAI,CAAC,qBAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACnF,CAAC,CAAC;AAXW,QAAA,oBAAoB,wBAW/B;AAEK,MAAM,iBAAiB,GAAG,CAChC,MAAmD,EACnD,KAAoB,EACpB,IAAqB,EACrB,MAAc,EACd,MAAc,EACd,SAAwB,EACjB,EAAE;;IACT,IAAI,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,eAAe,mCAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IAClF,IAAI,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,eAAe,mCAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IAClF,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,oBAAO,EAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrF,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC1B,IAAA,mBAAW,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { addStatsToBoard } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const increaseUndeadAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n\t// 2026-04-25 Amalgam getting buffed also boosts Mishmash\r\n\t// https://replays.firestoneapp.com/?reviewId=845efb54-f37d-4cb7-9947-cc72fc12d800&turn=19&action=3\r\n\tcountsAsStatsGain = true,\r\n): void => {\r\n\thero.globalInfo.UndeadAttackBonus = (hero.globalInfo.UndeadAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.UNDEAD], countsAsStatsGain);\r\n};\r\n\r\nexport const increaseUndeadHealthBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.UndeadHealthBonus = (hero.globalInfo.UndeadHealthBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, 0, amount, gameState, Race[Race.UNDEAD], false);\r\n};\r\n\r\nexport const increasePirateAttackBonus = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tamount: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.PirateAttackBonus = (hero.globalInfo.PirateAttackBonus ?? 0) + amount;\r\n\taddStatsToBoard(source, board, hero, amount, 0, gameState, Race[Race.PIRATE], false);\r\n};\r\n\r\nexport const increaseGoldrinnBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.GoldrinnBuffAtk = (hero.globalInfo.GoldrinnBuffAtk ?? 0) + attack;\r\n\thero.globalInfo.GoldrinnBuffHealth = (hero.globalInfo.GoldrinnBuffHealth ?? 0) + health;\r\n\taddStatsToBoard(source, board, hero, attack, health, gameState, Race[Race.BEAST]);\r\n};\r\n\r\nexport const increaseWhelpBuff = (\r\n\tsource: BoardEntity | BgsPlayerEntity | BoardSecret,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tattack: number,\r\n\thealth: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thero.globalInfo.WhelpAttackBuff = (hero.globalInfo.WhelpAttackBuff ?? 0) + attack;\r\n\thero.globalInfo.WhelpHealthBuff = (hero.globalInfo.WhelpHealthBuff ?? 0) + health;\r\n\tconst targets = board.filter((entity) => isWhelp(entity.cardId, gameState.allCards));\r\n\ttargets.forEach((target) => {\r\n\t\tmodifyStats(target, target, attack, health, board, hero, gameState, false);\r\n\t});\r\n};\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestone-hs/simulate-bgs-battle",
3
- "version": "1.1.713",
3
+ "version": "1.1.714",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "lint": "eslint --color --fix --ext .ts .",
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiger-carving-token.js","sourceRoot":"","sources":["../../../../src/cards/impl/trinket/tiger-carving-token.ts"],"names":[],"mappings":";;;AAEA,mDAA0D;AAC1D,qDAAwD;AAG3C,QAAA,YAAY,GAA0C;IAClE,OAAO,EAAE,6CAAqG;IAC9G,0BAA0B,EAAE,CAAC,OAAqB,EAAE,KAAK,EAAE,EAAE;QAC5D,MAAM,MAAM,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,MAAM,EAAE;YACX,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,0BAA+D,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnG,IAAA,mBAAW,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SAChF;IACF,CAAC;CACD,CAAC","sourcesContent":["import { BoardTrinket } from '../../../bgs-player-entity';\r\nimport { CardIds } from '../../../services/card-ids';\r\nimport { pickRandomAlive } from '../../../services/utils';\r\nimport { modifyStats } from '../../../simulation/stats';\r\nimport { AfterFriendlyMinionDamagedTrinketCard } from '../../card.interface';\r\n\r\nexport const TigerCarving: AfterFriendlyMinionDamagedTrinketCard = {\r\n\tcardIds: [CardIds.TigerCarving_BG30_MagicItem_427, CardIds.TigerCarving_TigerCarvingToken_BG30_MagicItem_427t],\r\n\tafterFriendlyMinionDamaged: (trinket: BoardTrinket, input) => {\r\n\t\tconst target = pickRandomAlive(input.board);\r\n\t\tif (target) {\r\n\t\t\tconst buff = trinket.cardId === CardIds.TigerCarving_TigerCarvingToken_BG30_MagicItem_427t ? 4 : 2;\r\n\t\t\tmodifyStats(target, trinket, buff, 0, input.board, input.hero, input.gameState);\r\n\t\t}\r\n\t},\r\n};\r\n"]}