@firestone-hs/simulate-bgs-battle 1.1.692 → 1.1.694

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 (73) hide show
  1. package/dist/bgs-battle-info.d.ts +1 -1
  2. package/dist/bgs-battle-info.js.map +1 -1
  3. package/dist/cards/card.interface.d.ts +5 -1
  4. package/dist/cards/card.interface.js +3 -1
  5. package/dist/cards/card.interface.js.map +1 -1
  6. package/dist/cards/cards-data.d.ts +1 -1
  7. package/dist/cards/cards-data.js +16 -1
  8. package/dist/cards/cards-data.js.map +1 -1
  9. package/dist/cards/impl/_card-mappings.js +4 -0
  10. package/dist/cards/impl/_card-mappings.js.map +1 -1
  11. package/dist/cards/impl/minion/apexis-guardian.js +8 -2
  12. package/dist/cards/impl/minion/apexis-guardian.js.map +1 -1
  13. package/dist/cards/impl/minion/blue-volumizer.js +3 -1
  14. package/dist/cards/impl/minion/blue-volumizer.js.map +1 -1
  15. package/dist/cards/impl/minion/gleaming-trader.js +5 -3
  16. package/dist/cards/impl/minion/gleaming-trader.js.map +1 -1
  17. package/dist/cards/impl/minion/grease-bot.js +4 -2
  18. package/dist/cards/impl/minion/grease-bot.js.map +1 -1
  19. package/dist/cards/impl/minion/green-volumizer.js +3 -1
  20. package/dist/cards/impl/minion/green-volumizer.js.map +1 -1
  21. package/dist/cards/impl/minion/icesnarl-the-mighty.d.ts +2 -0
  22. package/dist/cards/impl/minion/icesnarl-the-mighty.js +15 -0
  23. package/dist/cards/impl/minion/icesnarl-the-mighty.js.map +1 -0
  24. package/dist/cards/impl/minion/polarizing-beatboxer.d.ts +2 -0
  25. package/dist/cards/impl/minion/polarizing-beatboxer.js +18 -0
  26. package/dist/cards/impl/minion/polarizing-beatboxer.js.map +1 -0
  27. package/dist/cards/impl/minion/red-volumizer.js +3 -1
  28. package/dist/cards/impl/minion/red-volumizer.js.map +1 -1
  29. package/dist/cards/impl/minion/stalwart-kodo.d.ts +2 -2
  30. package/dist/cards/impl/minion/stalwart-kodo.js +1 -1
  31. package/dist/cards/impl/minion/stalwart-kodo.js.map +1 -1
  32. package/dist/cards/impl/minion/timewarped-ghoul-acabra.js +1 -1
  33. package/dist/cards/impl/minion/timewarped-ghoul-acabra.js.map +1 -1
  34. package/dist/cards/impl/minion/timewarped-goldrinn.js +2 -2
  35. package/dist/cards/impl/minion/timewarped-goldrinn.js.map +1 -1
  36. package/dist/cards/impl/minion/timewarped-grease-bot.js +4 -2
  37. package/dist/cards/impl/minion/timewarped-grease-bot.js.map +1 -1
  38. package/dist/cards/impl/minion/timewarped-hooktail.js +4 -2
  39. package/dist/cards/impl/minion/timewarped-hooktail.js.map +1 -1
  40. package/dist/cards/impl/minion/timewarped-hyena.js +1 -1
  41. package/dist/cards/impl/minion/timewarped-hyena.js.map +1 -1
  42. package/dist/cards/impl/minion/timewarped-murcules.js +1 -1
  43. package/dist/cards/impl/minion/timewarped-murcules.js.map +1 -1
  44. package/dist/cards/impl/minion/timewarped-primscale.js +1 -1
  45. package/dist/cards/impl/minion/timewarped-primscale.js.map +1 -1
  46. package/dist/cards/impl/minion/timewarped-probius.d.ts +2 -2
  47. package/dist/cards/impl/minion/timewarped-probius.js +1 -1
  48. package/dist/cards/impl/minion/timewarped-probius.js.map +1 -1
  49. package/dist/cards/impl/minion/timewarped-wargear.d.ts +2 -2
  50. package/dist/cards/impl/minion/timewarped-wargear.js +1 -1
  51. package/dist/cards/impl/minion/timewarped-wargear.js.map +1 -1
  52. package/dist/cards/impl/trinket/divine-signet.js +1 -1
  53. package/dist/cards/impl/trinket/divine-signet.js.map +1 -1
  54. package/dist/debug-state.d.ts +2 -0
  55. package/dist/debug-state.js.map +1 -1
  56. package/dist/keywords/divine-shield.js +32 -28
  57. package/dist/keywords/divine-shield.js.map +1 -1
  58. package/dist/services/utils.js +3 -1
  59. package/dist/services/utils.js.map +1 -1
  60. package/dist/simulate-bgs-battle.js +6 -8
  61. package/dist/simulate-bgs-battle.js.map +1 -1
  62. package/dist/simulation/add-minion-to-board.d.ts +2 -2
  63. package/dist/simulation/add-minion-to-board.js +3 -12
  64. package/dist/simulation/add-minion-to-board.js.map +1 -1
  65. package/dist/simulation/attack.js.map +1 -1
  66. package/dist/simulation/deathrattle-effects.js +0 -8
  67. package/dist/simulation/deathrattle-effects.js.map +1 -1
  68. package/dist/simulation/magnetize.d.ts +3 -1
  69. package/dist/simulation/magnetize.js +22 -5
  70. package/dist/simulation/magnetize.js.map +1 -1
  71. package/dist/simulation/spawns.js +2 -1
  72. package/dist/simulation/spawns.js.map +1 -1
  73. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAE/D,2DAAwE;AACxE,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA2C;AAC3C,+CAA4C;AAC5C,yDAAqD;AAIrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;KACP;IAED,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC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ript-eslint/no-use-before-define */\nimport { AllCardsService } from '@firestone-hs/reference-data';\nimport { BgsBattleInfo } from './bgs-battle-info';\nimport { hasDeathrattleSpawnEnchantment } from './cards/card.interface';\nimport { CardsData } from './cards/cards-data';\nimport { cardMappings } from './cards/impl/_card-mappings';\nimport { debugState } from './debug-state';\nimport { cloneInput3 } from './input-clone';\nimport { buildFinalInput } from './input-sanitation';\nimport { CardIds } from './services/card-ids';\nimport { SimulationResult } from './simulation-result';\nimport { FullGameState } from './simulation/internal-game-state';\nimport { SharedState } from './simulation/shared-state';\nimport { Simulator } from './simulation/simulator';\nimport { Spectator } from './simulation/spectator/spectator';\n\nlet globalCards = new AllCardsService();\n\nexport const assignCards = (cards: AllCardsService) => {\n\tglobalCards = cards;\n};\n\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\n// the more traditional callback-style handler.\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\nexport default async (event): Promise<any> => {\n\tif (!event.body?.length) {\n\t\tconsole.warn('missing event body', event);\n\t\treturn;\n\t}\n\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\n\tconst cards = globalCards;\n\tawait cards.initializeCardsDb();\n\tconst cardsData = new CardsData(cards, false);\n\tcardsData.inititialize(\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\n\t\tbattleInput.gameState?.anomalies ?? [],\n\t);\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\n\n\t// Iterate through all intermediate results to reach the final result\n\tlet result = battleIterator.next();\n\twhile (!result.done) {\n\t\tresult = battleIterator.next();\n\t}\n\n\tconst simulationResult = result.value;\n\t// console.debug('simulationResult', simulationResult);\n\n\tconst response = {\n\t\tstatusCode: 200,\n\t\tisBase64Encoded: false,\n\t\tbody: JSON.stringify(simulationResult),\n\t};\n\treturn response;\n};\n\nexport const simulateBattle = function* (\n\tbattleInput: BgsBattleInfo,\n\tcards: AllCardsService,\n\tcardsData: CardsData,\n): Generator<SimulationResult, SimulationResult, void> {\n\tif (!cards?.getCards()?.length) {\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\n\t\treturn null;\n\t}\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\n\tconst start = Date.now();\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\n\tconst hideMaxSimulationDurationWarning = battleInput.options?.hideMaxSimulationDurationWarning ?? false;\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\n\tconst simulationResult: SimulationResult = {\n\t\twonLethal: 0,\n\t\twon: 0,\n\t\ttied: 0,\n\t\tlost: 0,\n\t\tlostLethal: 0,\n\t\tdamageWons: [],\n\t\tdamageWon: 0,\n\t\tdamageWonRange: null,\n\t\tdamageLosts: [],\n\t\tdamageLost: 0,\n\t\tdamageLostRange: null,\n\t\twonLethalPercent: undefined,\n\t\twonPercent: undefined,\n\t\ttiedPercent: undefined,\n\t\tlostPercent: undefined,\n\t\tlostLethalPercent: undefined,\n\t\taverageDamageWon: undefined,\n\t\taverageDamageLost: undefined,\n\t};\n\n\tconst spectator = new Spectator(includeOutcomeSamples);\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\n\n\t// Apply debug state from input when present (e.g. from bug report)\n\tif (battleInput.debugState) {\n\t\tdebugState.active = true;\n\t\tdebugState.forcedCurrentAttacker = battleInput.debugState.forcedCurrentAttacker;\n\t\tdebugState.forcedFaceOffBase = battleInput.debugState.forcedFaceOffBase.map((f) => ({\n\t\t\tattacker: { ...f.attacker },\n\t\t\tdefender: { ...f.defender },\n\t\t}));\n\t\tconst rawPicks =\n\t\t\tbattleInput.debugState.forcedRandomPicks ??\n\t\t\tbattleInput.debugState.forcedTimewarpedWarghoulTargets?.map((target) => ({\n\t\t\t\tsource: { cardId: 'BG34_Giant_331' },\n\t\t\t\ttarget,\n\t\t\t})) ??\n\t\t\t[];\n\t\tdebugState.forcedRandomPicksBase = rawPicks.map((p) => ({\n\t\t\tsource: { ...p.source },\n\t\t\ttarget: { ...p.target },\n\t\t}));\n\t}\n\n\ttry {\n\t\t!battleInput.options?.skipInfoLogs && console.time('simulation');\n\t\tconst outcomes = {};\n\t\tfor (let i = 0; i < numberOfSimulations; i++) {\n\t\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst gameState: FullGameState = {\n\t\t\t\tallCards: cards,\n\t\t\t\tcardsData: cardsData,\n\t\t\t\tspectator: spectator,\n\t\t\t\tsharedState: new SharedState(),\n\t\t\t\tcurrentTurn: input.gameState.currentTurn,\n\t\t\t\tvalidTribes: input.gameState.validTribes,\n\t\t\t\tanomalies: input.gameState.anomalies,\n\t\t\t\tgameState: {\n\t\t\t\t\tplayer: {\n\t\t\t\t\t\tplayer: input.playerBoard.player,\n\t\t\t\t\t\tboard: input.playerBoard.board,\n\t\t\t\t\t\tteammate: input.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponent: {\n\t\t\t\t\t\tplayer: input.opponentBoard.player,\n\t\t\t\t\t\tboard: input.opponentBoard.board,\n\t\t\t\t\t\tteammate: input.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\tplayerInitial: {\n\t\t\t\t\t\tplayer: inputClone.playerBoard.player,\n\t\t\t\t\t\tboard: inputClone.playerBoard.board,\n\t\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponentInitial: {\n\t\t\t\t\t\tplayer: inputClone.opponentBoard.player,\n\t\t\t\t\t\tboard: inputClone.opponentBoard.board,\n\t\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst simulator = new Simulator(gameState);\n\t\t\tconst battleResult = simulator.simulateSingleBattle(gameState.gameState.player, gameState.gameState.opponent);\n\t\t\tif (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {\n\t\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\n\t\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!battleResult) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (battleResult.result === 'won') {\n\t\t\t\tsimulationResult.won++;\n\t\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\n\t\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\n\t\t\t\t\tsimulationResult.wonLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'lost') {\n\t\t\t\tsimulationResult.lost++;\n\t\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\n\t\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\n\t\t\t\tif (\n\t\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\n\t\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\n\t\t\t\t) {\n\t\t\t\t\tsimulationResult.lostLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'tied') {\n\t\t\t\tsimulationResult.tied++;\n\t\t\t}\n\t\t\tspectator.commitBattleResult(battleResult.result);\n\n\t\t\t// Yield intermediate result every 200 iterations\n\t\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\n\t\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t\t\tyield simulationResult;\n\t\t\t}\n\t\t}\n\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\n\t\tspectator.prune();\n\t\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\n\t\t// Avoid sending this verbose data\n\n\t\tsimulationResult.damageWons = [];\n\t\tsimulationResult.damageLosts = [];\n\t\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\n\t\treturn simulationResult;\n\t} finally {\n\t\tif (battleInput.debugState) {\n\t\t\tdebugState.active = false;\n\t\t}\n\t}\n};\n\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\n\tsimulationResult.wonPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\n\t\tsimulationResult.won,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.wonLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\n\t\tsimulationResult.wonLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\n\t\tsimulationResult.lost,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\n\t\tsimulationResult.lostLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.tiedPercent = checkRounding(\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\n\t\tsimulationResult.tied,\n\t\ttotalMatches,\n\t);\n\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\n\n\tif (\n\t\tsimulationResult.averageDamageWon > 0 &&\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage won issue');\n\t}\n\tif (\n\t\tsimulationResult.averageDamageLost > 0 &&\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage lost issue');\n\t}\n};\n\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\n\tif (damageArray.length === 0) {\n\t\treturn { min: 0, max: 0 };\n\t}\n\n\t// Sort the array\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\n\n\t// Calculate the 10th and 90th percentiles\n\tconst percentile = (arr: number[], p: number) => {\n\t\tconst index = Math.floor(p * arr.length);\n\t\treturn arr[index];\n\t};\n\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\n\n\treturn { min: minDamage, max: maxDamage };\n};\n\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\n\tif (roundedValue === 0 && initialValue !== 0) {\n\t\treturn 0.01;\n\t}\n\tif (roundedValue === 100 && initialValue !== totalValue) {\n\t\treturn 99.9;\n\t}\n\treturn roundedValue;\n};\n\n// Used when triggering random deathrattles\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\n\tCardIds.LivingSpores_LivingSporesEnchantment,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\n\tCardIds.Sneed_SneedsReplicator,\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\n\tCardIds.FireRecollectionEnchantment,\n\tCardIds.LightningRecollectionEnchantment,\n\tCardIds.WaterRecollectionEnchantment,\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172e,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172_Ge,\n\tCardIds.TamsinRoame_ImpendingSacrificeEnchantment_BG20_HERO_282e2,\n];\nconst validDeathrattleEnchantmentsFromMapping = [];\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\n\t\treturn true;\n\t}\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\n\t\t\t// Also includes non-enchantments, but since we only match this against the enchants list, it's fine\n\t\t\tif (hasDeathrattleSpawnEnchantment(cardImpl)) {\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\n\t\t\t}\n\t\t}\n\t}\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\n};\n\n// const cleanEnchantmentsForEntity = (\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\n// \tentityIds: readonly number[],\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\n// \treturn enchantments.filter(\n// \t\t(enchant) =>\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\n// \t);\n// };\n"]}
1
+ {"version":3,"file":"simulate-bgs-battle.js","sourceRoot":"","sources":["../src/simulate-bgs-battle.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAE/D,2DAAwE;AACxE,mDAA+C;AAC/C,gEAA2D;AAC3D,+CAA2C;AAC3C,+CAA4C;AAC5C,yDAAqD;AAIrD,4DAAwD;AACxD,sDAAmD;AACnD,gEAA6D;AAE7D,IAAI,WAAW,GAAG,IAAI,gCAAe,EAAE,CAAC;AAEjC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,EAAE;IACrD,WAAW,GAAG,KAAK,CAAC;AACrB,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAKF,kBAAe,KAAK,EAAE,KAAK,EAAgB,EAAE;;IAC5C,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,CAAA,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;KACP;IAED,MAAM,WAAW,GAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,KAAK,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,QAAA,6BAA6B,iCAaxC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { AllCardsService } from '@firestone-hs/reference-data';\nimport { BgsBattleInfo } from './bgs-battle-info';\nimport { hasDeathrattleSpawnEnchantment } from './cards/card.interface';\nimport { CardsData } from './cards/cards-data';\nimport { cardMappings } from './cards/impl/_card-mappings';\nimport { debugState } from './debug-state';\nimport { cloneInput3 } from './input-clone';\nimport { buildFinalInput } from './input-sanitation';\nimport { CardIds } from './services/card-ids';\nimport { SimulationResult } from './simulation-result';\nimport { FullGameState } from './simulation/internal-game-state';\nimport { SharedState } from './simulation/shared-state';\nimport { Simulator } from './simulation/simulator';\nimport { Spectator } from './simulation/spectator/spectator';\n\nlet globalCards = new AllCardsService();\n\nexport const assignCards = (cards: AllCardsService) => {\n\tglobalCards = cards;\n};\n\n// This example demonstrates a NodeJS 8.10 async handler[1], however of course you could use\n// the more traditional callback-style handler.\n// [1]: https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/\nexport default async (event): Promise<any> => {\n\tif (!event.body?.length) {\n\t\tconsole.warn('missing event body', event);\n\t\treturn;\n\t}\n\n\tconst battleInput: BgsBattleInfo = JSON.parse(event.body);\n\tconst cards = globalCards;\n\tawait cards.initializeCardsDb();\n\tconst cardsData = new CardsData(cards, false);\n\tcardsData.inititialize(\n\t\tbattleInput.gameState?.validTribes ?? battleInput.options?.validTribes,\n\t\tbattleInput.gameState?.anomalies ?? [],\n\t);\n\tconst battleIterator = simulateBattle(battleInput, cards, cardsData);\n\n\t// Iterate through all intermediate results to reach the final result\n\tlet result = battleIterator.next();\n\twhile (!result.done) {\n\t\tresult = battleIterator.next();\n\t}\n\n\tconst simulationResult = result.value;\n\t// console.debug('simulationResult', simulationResult);\n\n\tconst response = {\n\t\tstatusCode: 200,\n\t\tisBase64Encoded: false,\n\t\tbody: JSON.stringify(simulationResult),\n\t};\n\treturn response;\n};\n\nexport const simulateBattle = function* (\n\tbattleInput: BgsBattleInfo,\n\tcards: AllCardsService,\n\tcardsData: CardsData,\n): Generator<SimulationResult, SimulationResult, void> {\n\tif (!cards?.getCards()?.length) {\n\t\tconsole.error('[simulate-bgs-battle] reference cards are empty, cannot simulate battle', cards);\n\t\treturn null;\n\t}\n\t// !battleInput.options?.skipInfoLogs && console.time('full-sim');\n\tconst start = Date.now();\n\tconst maxAcceptableDuration = battleInput.options?.maxAcceptableDuration || 8000;\n\tconst hideMaxSimulationDurationWarning = battleInput.options?.hideMaxSimulationDurationWarning ?? false;\n\tconst numberOfSimulations = battleInput.options?.numberOfSimulations || 8000;\n\tconst intermediateSteps = battleInput.options?.intermediateResults ?? 200;\n\tconst damageConfidence = battleInput.options?.damageConfidence ?? 0.9;\n\tconst includeOutcomeSamples = battleInput.options?.includeOutcomeSamples ?? true;\n\tconst simulationResult: SimulationResult = {\n\t\twonLethal: 0,\n\t\twon: 0,\n\t\ttied: 0,\n\t\tlost: 0,\n\t\tlostLethal: 0,\n\t\tdamageWons: [],\n\t\tdamageWon: 0,\n\t\tdamageWonRange: null,\n\t\tdamageLosts: [],\n\t\tdamageLost: 0,\n\t\tdamageLostRange: null,\n\t\twonLethalPercent: undefined,\n\t\twonPercent: undefined,\n\t\ttiedPercent: undefined,\n\t\tlostPercent: undefined,\n\t\tlostLethalPercent: undefined,\n\t\taverageDamageWon: undefined,\n\t\taverageDamageLost: undefined,\n\t};\n\n\tconst spectator = new Spectator(includeOutcomeSamples);\n\tconst inputReady = buildFinalInput(battleInput, cards, cardsData);\n\n\t// Apply debug state from input when present (e.g. from bug report)\n\tif (battleInput.debugState) {\n\t\tdebugState.active = true;\n\t\tdebugState.forcedCurrentAttacker = battleInput.debugState.forcedCurrentAttacker;\n\t\tdebugState.forcedFaceOffBase = battleInput.debugState.forcedFaceOffBase.map((f) => ({\n\t\t\tattacker: { ...f.attacker },\n\t\t\tdefender: { ...f.defender },\n\t\t}));\n\t\tconst rawPicks = battleInput.debugState.forcedRandomPicks ?? [];\n\t\tdebugState.forcedRandomPicksBase = rawPicks.map((p) => ({\n\t\t\tsource: { ...p.source },\n\t\t\ttarget: { ...p.target },\n\t\t\t...(p.chosenCardId && { chosenCardId: p.chosenCardId }),\n\t\t}));\n\t}\n\n\ttry {\n\t\t!battleInput.options?.skipInfoLogs && console.time('simulation');\n\t\tconst outcomes = {};\n\t\tfor (let i = 0; i < numberOfSimulations; i++) {\n\t\t\tconst input: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst inputClone: BgsBattleInfo = cloneInput3(inputReady);\n\t\t\tconst gameState: FullGameState = {\n\t\t\t\tallCards: cards,\n\t\t\t\tcardsData: cardsData,\n\t\t\t\tspectator: spectator,\n\t\t\t\tsharedState: new SharedState(),\n\t\t\t\tcurrentTurn: input.gameState.currentTurn,\n\t\t\t\tvalidTribes: input.gameState.validTribes,\n\t\t\t\tanomalies: input.gameState.anomalies,\n\t\t\t\tgameState: {\n\t\t\t\t\tplayer: {\n\t\t\t\t\t\tplayer: input.playerBoard.player,\n\t\t\t\t\t\tboard: input.playerBoard.board,\n\t\t\t\t\t\tteammate: input.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponent: {\n\t\t\t\t\t\tplayer: input.opponentBoard.player,\n\t\t\t\t\t\tboard: input.opponentBoard.board,\n\t\t\t\t\t\tteammate: input.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\tplayerInitial: {\n\t\t\t\t\t\tplayer: inputClone.playerBoard.player,\n\t\t\t\t\t\tboard: inputClone.playerBoard.board,\n\t\t\t\t\t\tteammate: inputClone.playerTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t\topponentInitial: {\n\t\t\t\t\t\tplayer: inputClone.opponentBoard.player,\n\t\t\t\t\t\tboard: inputClone.opponentBoard.board,\n\t\t\t\t\t\tteammate: inputClone.opponentTeammateBoard,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst simulator = new Simulator(gameState);\n\t\t\tconst battleResult = simulator.simulateSingleBattle(\n\t\t\t\tgameState.gameState.player,\n\t\t\t\tgameState.gameState.opponent,\n\t\t\t);\n\t\t\tif (Date.now() - start > maxAcceptableDuration && !hideMaxSimulationDurationWarning) {\n\t\t\t\t// Can happen in case of inifinite boards, or a bug. Don't hog the user's computer in that case\n\t\t\t\tconsole.warn('Stopping simulation after', i, 'iterations and ', Date.now() - start, 'ms');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!battleResult) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (battleResult.result === 'won') {\n\t\t\t\tsimulationResult.won++;\n\t\t\t\tsimulationResult.damageWon += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageWons.push(battleResult.damageDealt);\n\t\t\t\tif (battleResult.damageDealt >= battleInput.opponentBoard.player.hpLeft) {\n\t\t\t\t\tsimulationResult.wonLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'lost') {\n\t\t\t\tsimulationResult.lost++;\n\t\t\t\tsimulationResult.damageLost += battleResult.damageDealt;\n\t\t\t\tsimulationResult.damageLosts.push(battleResult.damageDealt);\n\t\t\t\toutcomes[battleResult.damageDealt] = (outcomes[battleResult.damageDealt] ?? 0) + 1;\n\t\t\t\tif (\n\t\t\t\t\tbattleInput.playerBoard.player.hpLeft &&\n\t\t\t\t\tbattleResult.damageDealt >= battleInput.playerBoard.player.hpLeft\n\t\t\t\t) {\n\t\t\t\t\tsimulationResult.lostLethal++;\n\t\t\t\t}\n\t\t\t} else if (battleResult.result === 'tied') {\n\t\t\t\tsimulationResult.tied++;\n\t\t\t}\n\t\t\tspectator.commitBattleResult(battleResult.result);\n\n\t\t\t// Yield intermediate result every 200 iterations\n\t\t\tif (!!intermediateSteps && i > 0 && i % intermediateSteps === 0) {\n\t\t\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t\t\tyield simulationResult;\n\t\t\t}\n\t\t}\n\t\tupdateSimulationResult(simulationResult, inputReady, damageConfidence);\n\t\t!battleInput.options?.skipInfoLogs && console.timeEnd('simulation');\n\t\tspectator.prune();\n\t\tsimulationResult.outcomeSamples = spectator.buildOutcomeSamples(battleInput.gameState);\n\t\t// Avoid sending this verbose data\n\n\t\tsimulationResult.damageWons = [];\n\t\tsimulationResult.damageLosts = [];\n\t\t// !battleInput.options?.skipInfoLogs && console.timeEnd('full-sim');\n\t\treturn simulationResult;\n\t} finally {\n\t\tif (battleInput.debugState) {\n\t\t\tdebugState.active = false;\n\t\t}\n\t}\n};\n\nconst updateSimulationResult = (simulationResult: SimulationResult, input: BgsBattleInfo, damageConfidence: number) => {\n\tconst totalMatches = simulationResult.won + simulationResult.tied + simulationResult.lost;\n\tsimulationResult.wonPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.won)) / totalMatches) / 10,\n\t\tsimulationResult.won,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.wonLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10,\n\t\tsimulationResult.wonLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lost)) / totalMatches) / 10,\n\t\tsimulationResult.lost,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.lostLethalPercent = checkRounding(\n\t\tMath.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10,\n\t\tsimulationResult.lostLethal,\n\t\ttotalMatches,\n\t);\n\tsimulationResult.tiedPercent = checkRounding(\n\t\tMath.max(0, 100 - simulationResult.lostPercent - simulationResult.wonPercent),\n\t\tsimulationResult.tied,\n\t\ttotalMatches,\n\t);\n\n\t// simulationResult.wonLethalPercent = Math.round((10 * (100 * simulationResult.wonLethal)) / totalMatches) / 10;\n\t// simulationResult.lostLethalPercent = Math.round((10 * (100 * simulationResult.lostLethal)) / totalMatches) / 10;\n\tconst totalDamageWon = simulationResult.damageWons.reduce((a, b) => a + b, 0);\n\tconst totalDamageLost = simulationResult.damageLosts.reduce((a, b) => a + b, 0);\n\tconst damageWonRange = calculateDamageRange(simulationResult.damageWons, damageConfidence);\n\tconst damageLostRange = calculateDamageRange(simulationResult.damageLosts, damageConfidence);\n\tsimulationResult.averageDamageWon = simulationResult.won ? totalDamageWon / simulationResult.won : 0;\n\tsimulationResult.averageDamageLost = simulationResult.lost ? totalDamageLost / simulationResult.lost : 0;\n\tsimulationResult.damageWonRange = simulationResult.won ? damageWonRange : null;\n\tsimulationResult.damageLostRange = simulationResult.lost ? damageLostRange : null;\n\n\tif (\n\t\tsimulationResult.averageDamageWon > 0 &&\n\t\tsimulationResult.averageDamageWon < input.playerBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage won issue');\n\t}\n\tif (\n\t\tsimulationResult.averageDamageLost > 0 &&\n\t\tsimulationResult.averageDamageLost < input.opponentBoard.player.tavernTier\n\t) {\n\t\tconsole.warn('average damage lost issue');\n\t}\n};\n\nconst calculateDamageRange = (damageArray: number[], damageConfidence: number): { min: number; max: number } => {\n\tif (damageArray.length === 0) {\n\t\treturn { min: 0, max: 0 };\n\t}\n\n\t// Sort the array\n\tconst sortedDamage = [...damageArray].sort((a, b) => a - b);\n\n\t// Calculate the 10th and 90th percentiles\n\tconst percentile = (arr: number[], p: number) => {\n\t\tconst index = Math.floor(p * arr.length);\n\t\treturn arr[index];\n\t};\n\n\tconst minDamage = percentile(sortedDamage, 1 - damageConfidence);\n\tconst maxDamage = percentile(sortedDamage, damageConfidence);\n\n\treturn { min: minDamage, max: maxDamage };\n};\n\nconst checkRounding = (roundedValue: number, initialValue: number, totalValue: number): number => {\n\tif (roundedValue === 0 && initialValue !== 0) {\n\t\treturn 0.01;\n\t}\n\tif (roundedValue === 100 && initialValue !== totalValue) {\n\t\treturn 99.9;\n\t}\n\treturn roundedValue;\n};\n\n// Used when triggering random deathrattles\nconst VALID_DEATHRATTLE_ENCHANTMENTS = [\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_BG_BOT_312e,\n\tCardIds.ReplicatingMenace_ReplicatingMenaceEnchantment_TB_BaconUps_032e,\n\tCardIds.LivingSpores_LivingSporesEnchantment,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\n\tCardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge,\n\tCardIds.Sneed_SneedsReplicator,\n\tCardIds.SneedsReplicator_ReplicateEnchantment,\n\tCardIds.EarthRecollectionEnchantment, // Spirit Raptor\n\tCardIds.FireRecollectionEnchantment,\n\tCardIds.LightningRecollectionEnchantment,\n\tCardIds.WaterRecollectionEnchantment,\n\tCardIds.EarthInvocation_ElementEarthEnchantment, // Summon a 1/1\n\tCardIds.LightningInvocation, // Deal 1 damage to 5 enemy minions\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004e,\n\t// CardIds.SurfNSurf_CrabRidingEnchantment_BG27_004_Ge,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\n\t// CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge,\n\tCardIds.BoonOfBeetles_BeetleSwarmEnchantment_BG28_603e,\n\tCardIds.RustyTrident_TridentsTreasureEnchantment_BG30_MagicItem_917e,\n\tCardIds.HoggyBank_GemInTheBankEnchantment_BG30_MagicItem_411e,\n\tCardIds.JarredFrostling_FrostyGlobeEnchantment_BG30_MagicItem_952e,\n\tCardIds.CaduceusReactor_CaduceusReactorEnchantment_BG31_HERO_801ptee,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172e,\n\tCardIds.AutoAssembler_AutoAssemblerEnchantment_BG32_172_Ge,\n\tCardIds.TamsinRoame_ImpendingSacrificeEnchantment_BG20_HERO_282e2,\n];\nconst validDeathrattleEnchantmentsFromMapping = [];\nexport const isValidDeathrattleEnchantment = (cardId: string): boolean => {\n\tif (VALID_DEATHRATTLE_ENCHANTMENTS.includes(cardId as CardIds)) {\n\t\treturn true;\n\t}\n\tif (validDeathrattleEnchantmentsFromMapping.length === 0) {\n\t\tfor (const cardImpl of Object.values(cardMappings)) {\n\t\t\t// Also includes non-enchantments, but since we only match this against the enchants list, it's fine\n\t\t\tif (hasDeathrattleSpawnEnchantment(cardImpl)) {\n\t\t\t\tvalidDeathrattleEnchantmentsFromMapping.push(...cardImpl.cardIds);\n\t\t\t}\n\t\t}\n\t}\n\treturn validDeathrattleEnchantmentsFromMapping.includes(cardId);\n};\n\n// const cleanEnchantmentsForEntity = (\n// \tenchantments: { cardId: string; originEntityId?: number; timing: number }[],\n// \tentityIds: readonly number[],\n// ): { cardId: string; originEntityId?: number; timing: number }[] => {\n// \treturn enchantments.filter(\n// \t\t(enchant) =>\n// \t\t\tentityIds.indexOf(enchant.originEntityId) !== -1 ||\n// \t\t\tvalidEnchantments.indexOf(enchant.cardId as CardIds) !== -1,\n// \t);\n// };\n"]}
@@ -1,11 +1,11 @@
1
1
  import { BgsPlayerEntity } from '../bgs-player-entity';
2
2
  import { BoardEntity } from '../board-entity';
3
3
  import { FullGameState } from './internal-game-state';
4
- export declare const addMinionsToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherHero: BgsPlayerEntity, index: number, minionsToAdd: readonly BoardEntity[], gameState: FullGameState) => void;
5
- export declare const addMinionToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherHero: BgsPlayerEntity, index: number, minionToAdd: BoardEntity, gameState: FullGameState, performAfterSpawnEffects?: boolean, applySelfAuras?: boolean) => void;
4
+ export declare const addMinionToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherHero: BgsPlayerEntity, index: number, minionToAdd: BoardEntity, gameState: FullGameState, applySelfAuras?: boolean) => void;
6
5
  export declare const handleAddedMinionAuraEffect: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherHero: BgsPlayerEntity, spawned: BoardEntity, gameState: FullGameState, applySelfAuras?: boolean, isActuallySpawned?: boolean) => void;
7
6
  export declare const applyAurasToSelf: (spawned: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
8
7
  export declare const removeAurasFromSelf: (entity: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
8
+ export declare const handleAfterSpawnEffects: (board: BoardEntity[], hero: BgsPlayerEntity, otherBoard: BoardEntity[], otherHero: BgsPlayerEntity, allSpawned: readonly BoardEntity[], gameState: FullGameState) => void;
9
9
  export declare const onMinionSummoned: (hero: BgsPlayerEntity, board: BoardEntity[], gameState: FullGameState) => void;
10
10
  export interface OnSpawnInput {
11
11
  hero: BgsPlayerEntity;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onMinionSummoned = exports.removeAurasFromSelf = exports.applyAurasToSelf = exports.handleAddedMinionAuraEffect = exports.addMinionToBoard = exports.addMinionsToBoard = void 0;
3
+ exports.onMinionSummoned = exports.handleAfterSpawnEffects = exports.removeAurasFromSelf = exports.applyAurasToSelf = exports.handleAddedMinionAuraEffect = exports.addMinionToBoard = void 0;
4
4
  const reference_data_1 = require("@firestone-hs/reference-data");
5
5
  const card_interface_1 = require("../cards/card.interface");
6
6
  const cards_data_1 = require("../cards/cards-data");
@@ -12,21 +12,11 @@ const utils_1 = require("../services/utils");
12
12
  const utils_2 = require("../utils");
13
13
  const quest_1 = require("./quest");
14
14
  const stats_1 = require("./stats");
15
- const addMinionsToBoard = (board, boardHero, otherBoard, otherHero, index, minionsToAdd, gameState) => {
16
- for (const minionToAdd of [...minionsToAdd].reverse()) {
17
- (0, exports.addMinionToBoard)(board, boardHero, otherBoard, otherHero, index, minionToAdd, gameState, false);
18
- }
19
- handleAfterSpawnEffects(board, boardHero, otherBoard, otherHero, minionsToAdd, gameState);
20
- };
21
- exports.addMinionsToBoard = addMinionsToBoard;
22
- const addMinionToBoard = (board, boardHero, otherBoard, otherHero, index, minionToAdd, gameState, performAfterSpawnEffects = true, applySelfAuras = true) => {
15
+ const addMinionToBoard = (board, boardHero, otherBoard, otherHero, index, minionToAdd, gameState, applySelfAuras = true) => {
23
16
  board.splice(index, 0, minionToAdd);
24
17
  (0, exports.handleAddedMinionAuraEffect)(board, boardHero, otherBoard, otherHero, minionToAdd, gameState, applySelfAuras);
25
18
  (0, exports.onMinionSummoned)(boardHero, board, gameState);
26
19
  handleSpawnEffect(board, boardHero, otherBoard, otherHero, minionToAdd, gameState, applySelfAuras);
27
- if (performAfterSpawnEffects) {
28
- handleAfterSpawnEffects(board, boardHero, otherBoard, otherHero, [minionToAdd], gameState);
29
- }
30
20
  };
31
21
  exports.addMinionToBoard = addMinionToBoard;
32
22
  const handleSpawnEffect = (board, boardHero, otherBoard, otherHero, spawned, gameState, applySelfAuras = true) => {
@@ -537,6 +527,7 @@ const handleAfterSpawnEffects = (board, hero, otherBoard, otherHero, allSpawned,
537
527
  handleAfterSpawnEffect(board, hero, otherBoard, otherHero, spawned, gameState);
538
528
  }
539
529
  };
530
+ exports.handleAfterSpawnEffects = handleAfterSpawnEffects;
540
531
  const onMinionSummoned = (hero, board, gameState) => {
541
532
  var _a;
542
533
  const quests = (_a = hero.questEntities) !== null && _a !== void 0 ? _a : [];
@@ -1 +1 @@
1
- {"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,4DAMiC;AACjC,oDAA8C;AAC9C,iEAA4D;AAC5D,6EAAkG;AAClG,6DAA+D;AAC/D,6CAAgD;AAEhD,6CAA+C;AAC/C,oCAA6F;AAE7F,mCAAiD;AACjD,mCAAsD;AAE/C,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,UAAyB,EACzB,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,SAAwB,EACjB,EAAE;IAET,KAAK,MAAM,WAAW,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE;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import { BoardEntity } from '../board-entity';\r\nimport {\r\n\thasAfterOtherSpawned,\r\n\thasOnDespawned,\r\n\thasOnOtherSpawned,\r\n\thasOnOtherAuraSpawned as hasOnOtherSpawnedAura,\r\n\thasOnSpawned,\r\n} from '../cards/card.interface';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { eternalKnightAttack, eternalKnightHealth } from '../cards/impl/trinket/eternal-portrait';\r\nimport { updateDivineShield } from '../keywords/divine-shield';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandom } from '../services/utils';\r\nimport { alreadyHasVolumizerBuff, copyEntity, hasCorrectTribe, isVolumizer } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\nimport { modifyStats, setEntityStats } from './stats';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// board.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherBoard, otherHero, index, minionToAdd, gameState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, boardHero, otherBoard, otherHero, minionsToAdd, gameState);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tgameState: FullGameState,\r\n\tperformAfterSpawnEffects = true,\r\n\tapplySelfAuras = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\t// Update the global \"SummonedThisGame/Combat\" info here\r\n\thandleAddedMinionAuraEffect(board, boardHero, otherBoard, otherHero, minionToAdd, gameState, applySelfAuras);\r\n\t// Important to do this here, so that \"attack immediately\" minions can be taken into account by the quests\r\n\tonMinionSummoned(boardHero, board, gameState);\r\n\thandleSpawnEffect(board, boardHero, otherBoard, otherHero, minionToAdd, gameState, applySelfAuras);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, boardHero, otherBoard, otherHero, [minionToAdd], gameState);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tgameState: FullGameState,\r\n\tapplySelfAuras = true,\r\n): void => {\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => isWhelp(cardId, gameState.allCards))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy_G);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, entity, 2, 2, board, boardHero, gameState);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, entity, 4, 4, board, boardHero, gameState);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\t// The case for Reborns, and these shouldn't proc on themselves\r\n\t\tif (entity.entityId === spawned.entityId) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tconst onOtherSpawnedImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnOtherSpawned(onOtherSpawnedImpl)) {\r\n\t\t\tonOtherSpawnedImpl.onOtherSpawned(entity, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: boardHero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tapplySelfAuras,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, boardHero, otherHero, true, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyStats(entity, entity, 2, 0, board, boardHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.Bigfernal_BGS_204:\r\n\t\t\t// case CardIds.Bigfernal_TB_BaconUps_304:\r\n\t\t\t// \tif (hasCorrectTribe(spawned, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t// \t\tconst statsBonus = entity.cardId === CardIds.Bigfernal_TB_BaconUps_304 ? 2 : 1;\r\n\t\t\t// \t\tmodifyStats(entity, entity, statsBonus, statsBonus, board, boardHero, gameState);\r\n\t\t\t// \t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.MamaBear_BGS_021:\r\n\t\t\tcase CardIds.MamaBear_TB_BaconUps_090:\r\n\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBear_TB_BaconUps_090 ? 12 : 6;\r\n\t\t\t\t\tmodifyStats(spawned, entity, statsBonus, statsBonus, board, boardHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.PapaBear_BG27_509:\r\n\t\t\t// case CardIds.PapaBear_BG27_509_G:\r\n\t\t\t// \tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t// \t\tconst statsBonus = entity.cardId === CardIds.PapaBear_BG27_509_G ? 16 : 8;\r\n\t\t\t// \t\tmodifyStats(spawned, entity, statsBonus, statsBonus, board, boardHero, gameState);\r\n\t\t\t// \t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.PackLeader_BGS_017:\r\n\t\t\tcase CardIds.PackLeader_TB_BaconUps_086:\r\n\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeader_TB_BaconUps_086 ? 4 : 2;\r\n\t\t\t\t\tmodifyStats(spawned, entity, statsBonus, 0, board, boardHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\nexport const handleAddedMinionAuraEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tgameState: FullGameState,\r\n\tapplySelfAuras = true,\r\n\tisActuallySpawned = true,\r\n): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tswitch (heroPower.cardId) {\r\n\t\t\tcase CardIds.SproutItOut:\r\n\t\t\t\tif (isActuallySpawned) {\r\n\t\t\t\t\tupdateTaunt(spawned, true, board, boardHero, otherHero, gameState);\r\n\t\t\t\t\tmodifyStats(spawned, boardHero, 1, 2, board, boardHero, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tif (boardHero.questRewards?.includes(CardIds.TumblingDisaster_BG28_Reward_505)) {\r\n\t\tconst tumblingDisasterBonus =\r\n\t\t\tboardHero.questRewardEntities?.find((e) => e.cardId === CardIds.TumblingDisaster_BG28_Reward_505)\r\n\t\t\t\t?.scriptDataNum1 || 1;\r\n\t\tmodifyStats(spawned, boardHero, tumblingDisasterBonus, tumblingDisasterBonus, board, boardHero, gameState);\r\n\t}\r\n\r\n\tif (isActuallySpawned) {\r\n\t\tfor (const trinket of boardHero.trinkets) {\r\n\t\t\tswitch (trinket.cardId) {\r\n\t\t\t\tcase CardIds.BlingtronsSunglasses_BG30_MagicItem_978:\r\n\t\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\t\tconst target = pickRandom(board.filter((e) => !e.divineShield));\r\n\t\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\t\tupdateDivineShield(target, board, boardHero, otherHero, true, gameState);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TwinSkyLanterns_BG30_MagicItem_822:\r\n\t\t\t\tcase CardIds.TwinSkyLanterns_TwinSkyLanternsToken_BG30_MagicItem_822t2:\r\n\t\t\t\t\tif (!trinket.rememberedMinion) {\r\n\t\t\t\t\t\ttrinket.rememberedMinion = copyEntity(spawned);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ReinforcedShield_BG30_MagicItem_886:\r\n\t\t\t\t\tif (trinket.scriptDataNum1 > 0 && !spawned.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(spawned, board, boardHero, otherHero, true, gameState);\r\n\t\t\t\t\t\ttrinket.scriptDataNum1--;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Apply auras to board\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\thandleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, gameState, isActuallySpawned);\r\n\t}\r\n\r\n\t// When we want to summon an \"exact copy\", we need to make sure we don't apply the aura twice\r\n\tif (applySelfAuras) {\r\n\t\t// The board here already contains the new minion\r\n\t\t// TODO: what if the additional part is a potential target for the aura effect?\r\n\t\t// 2024-08-27: changing the order to first handleMinionAddedAuraEffect so that the automatons get boosted,\r\n\t\t// then apply the aura\r\n\t\tapplyAurasToSelf(spawned, board, boardHero, gameState);\r\n\t}\r\n\r\n\tif (isActuallySpawned) {\r\n\t\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tboardHero.globalInfo.BeastsSummonedThisCombat++;\r\n\t\t\tboardHero.globalInfo.BeastsSummonedThisGame++;\r\n\t\t}\r\n\t\tif (hasCorrectTribe(spawned, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tboardHero.globalInfo.PiratesSummonedThisGame++;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyAurasToSelf = (\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tspawned.attack += boardHero.globalInfo.AdditionalAttack;\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!!boardHero.trinkets?.length) {\r\n\t\tfor (const trinket of boardHero.trinkets) {\r\n\t\t\tswitch (trinket.cardId) {\r\n\t\t\t\tcase CardIds.FeralTalisman_BG30_MagicItem_880:\r\n\t\t\t\t\tspawned.attack += 2;\r\n\t\t\t\t\tspawned.health += 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FeralTalisman_FeralTalismanToken_BG30_MagicItem_880t:\r\n\t\t\t\t\tspawned.attack += 8;\r\n\t\t\t\t\tspawned.health += 5;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.DazzlingDagger_BG32_MagicItem_934:\r\n\t\t\t\t\tspawned.attack += trinket.scriptDataNum1 || 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.HordeKeychainToken_BG30_MagicItem_843t:\r\n\t\t\t\t\tif (gameState.cardsData.getTavernLevel(spawned.cardId) <= 3) {\r\n\t\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\t\tspawned.health += 5;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FlagbearerPortrait_BG30_MagicItem_921:\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tspawned.cardId === CardIds.Scallywag_SkyPirateToken_BGS_061t ||\r\n\t\t\t\t\t\tspawned.cardId === CardIds.Scallywag_SkyPirateToken_TB_BaconUps_141t\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tspawned.attack += 6;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (boardHero.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tmodifyStats(\r\n\t\t\tspawned,\r\n\t\t\tspawned,\r\n\t\t\tboardHero.globalInfo.HauntedCarapaceAttackBonus,\r\n\t\t\t0,\r\n\t\t\tboard,\r\n\t\t\tboardHero,\r\n\t\t\tgameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t}\r\n\tif (boardHero.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tmodifyStats(\r\n\t\t\tspawned,\r\n\t\t\tspawned,\r\n\t\t\t0,\r\n\t\t\tboardHero.globalInfo.HauntedCarapaceHealthBonus,\r\n\t\t\tboard,\r\n\t\t\tboardHero,\r\n\t\t\tgameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t}\r\n\tif (hasCorrectTribe(spawned, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.UndeadAttackBonus,\r\n\t\t\t\t0,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (hasCorrectTribe(spawned, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.PirateAttackBonus > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.PirateAttackBonus,\r\n\t\t\t\t0,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t\tboardHero.globalInfo.GoldrinnBuffHealth,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);\r\n\t\t}\r\n\t}\r\n\tif (isWhelp(spawned.cardId, gameState.allCards)) {\r\n\t\tmodifyStats(\r\n\t\t\tspawned,\r\n\t\t\tspawned,\r\n\t\t\tboardHero.globalInfo.WhelpAttackBuff ?? 0,\r\n\t\t\tboardHero.globalInfo.WhelpHealthBuff ?? 0,\r\n\t\t\tboard,\r\n\t\t\tboardHero,\r\n\t\t\tgameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\tgameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);\r\n\t}\r\n\tif (\r\n\t\tisVolumizer(spawned.cardId, boardHero, gameState.anomalies, gameState.allCards) &&\r\n\t\t// https://replays.firestoneapp.com/?reviewId=75e82ef1-3442-4307-a3c8-4a3b72fcf6af&turn=11&action=2\r\n\t\t!alreadyHasVolumizerBuff(spawned, boardHero, gameState)\r\n\t) {\r\n\t\tif (boardHero.globalInfo.VolumizerAttackBuff > 0 || boardHero.globalInfo.VolumizerHealthBuff > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.VolumizerAttackBuff ?? 0,\r\n\t\t\t\tboardHero.globalInfo.VolumizerHealthBuff ?? 0,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);\r\n\t\t}\r\n\t}\r\n\r\n\t// In case Putricide spawns a stictched minion whose stitched part creates an aura effect\r\n\t// const potentialAuraSources: { cardId: string; entityId: number }[] = [\r\n\t// \t{ cardId: spawned.cardId, entityId: spawned.entityId },\r\n\t// \t...(spawned.additionalCards ?? []).map((cardId) => ({ cardId, entityId: spawned.entityId })),\r\n\t// ];\r\n\r\n\tif (gameState.cardsData.getTavernLevel(spawned.cardId) % 2 === 1) {\r\n\t\tconst atkBuff = boardHero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\t\tconst healthBuff = boardHero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\t\tmodifyStats(spawned, spawned, atkBuff, healthBuff, board, boardHero, gameState, false);\r\n\t}\r\n\tfor (const entity of board) {\r\n\t\tconst onOtherSpawnedImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnOtherSpawnedAura(onOtherSpawnedImpl)) {\r\n\t\t\tonOtherSpawnedImpl.onOtherSpawnedAura(entity, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: boardHero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, boardHero, Race.MURLOC, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.Kathranatir_BG21_039:\r\n\t\t\t// case CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t// \tif (\r\n\t\t\t// \t\thasCorrectTribe(spawned, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t// \t\tentity.entityId !== spawned.entityId\r\n\t\t\t// \t) {\r\n\t\t\t// \t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tspawned.attack += (entity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tconst onSpawnedImpl = cardMappings[spawned.cardId];\r\n\tif (hasOnSpawned(onSpawnedImpl)) {\r\n\t\tonSpawnedImpl.onSpawned(spawned, {\r\n\t\t\thero: boardHero,\r\n\t\t\tboard: board,\r\n\t\t\tgameState: gameState,\r\n\t\t});\r\n\t}\r\n\tswitch (spawned.cardId) {\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tnull,\r\n\t\t\t\teternalKnightAttack * statsBonusKnight,\r\n\t\t\t\teternalKnightHealth * statsBonusKnight,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555:\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555_G:\r\n\t\t\tconst multiplierFungus = spawned.cardId === CardIds.EnsorcelledFungus_BG28_555_G ? 2 : 1;\r\n\t\t\tconst statsBonusFungus = multiplierFungus * boardHero.globalInfo.TavernSpellsCastThisGame;\r\n\t\t\tmodifyStats(spawned, null, statsBonusFungus, 2 * statsBonusFungus, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tnull,\r\n\t\t\t\t2 * statsBonusFrostling,\r\n\t\t\t\tstatsBonusFrostling,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SaltyLooter_BGS_081:\r\n\t\tcase CardIds.SaltyLooter_TB_BaconUps_143:\r\n\t\t\tconst multiplierLooter = spawned.cardId === CardIds.SaltyLooter_TB_BaconUps_143 ? 2 : 1;\r\n\t\t\tconst statsBonusLooter = multiplierLooter * boardHero.globalInfo.PiratesSummonedThisGame;\r\n\t\t\tmodifyStats(spawned, null, 2 * statsBonusLooter, 2 * multiplierLooter, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\tconst multiplierAstral = spawned.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t// Don't count the yourself\r\n\t\t\tconst statsBonusAstral = multiplierAstral * (boardHero.globalInfo.AstralAutomatonsSummonedThisGame - 1);\r\n\t\t\tmodifyStats(spawned, null, 3 * statsBonusAstral, 2 * statsBonusAstral, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * gameState.sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\tmodifyStats(spawned, null, statsBonusGnoll, 0, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n// Introduced for Rapid Reanimation: since we will \"addMinionToBoard\" the minion afterwards, the auras will\r\n// be re-applied then, so we need to remove them first\r\nexport const removeAurasFromSelf = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.attack -= Math.max(0, boardHero.globalInfo.AdditionalAttack);\r\n\r\n\tconst onDespawnedImpl = cardMappings[entity.cardId];\r\n\tif (hasOnDespawned(onDespawnedImpl)) {\r\n\t\tonDespawnedImpl.onDespawned(entity, {\r\n\t\t\thero: boardHero,\r\n\t\t\tboard: board,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 7);\r\n\t\t\t\t\tentity.health = Math.max(1, entity.health - 7);\r\n\t\t\t\t\tentity.enchantments = entity.enchantments.filter(\r\n\t\t\t\t\t\t(e) => e.cardId !== CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 7);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FlagbearerPortrait_BG30_MagicItem_921:\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tentity.cardId === CardIds.SkyPirateFlagbearer_BG30_119 ||\r\n\t\t\t\t\t\tentity.cardId === CardIds.SkyPirateFlagbearer_BG30_119_G\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 8);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!!boardHero.trinkets?.length) {\r\n\t\tfor (const trinket of boardHero.trinkets) {\r\n\t\t\tswitch (trinket.cardId) {\r\n\t\t\t\tcase CardIds.FeralTalisman_BG30_MagicItem_880:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 2);\r\n\t\t\t\t\tentity.health = Math.max(1, entity.health - 1);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FeralTalisman_FeralTalismanToken_BG30_MagicItem_880t:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 8);\r\n\t\t\t\t\tentity.health = Math.max(1, entity.health - 5);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.DazzlingDagger_BG32_MagicItem_934:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - (trinket.scriptDataNum1 || 1));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.HordeKeychainToken_BG30_MagicItem_843t:\r\n\t\t\t\t\tif (gameState.cardsData.getTavernLevel(entity.cardId) <= 3) {\r\n\t\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 7);\r\n\t\t\t\t\t\tentity.health = Math.max(1, entity.health - 5);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (boardHero.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tentity.attack = Math.max(0, entity.attack - boardHero.globalInfo.HauntedCarapaceAttackBonus);\r\n\t}\r\n\tif (boardHero.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tentity.health = Math.max(1, entity.health - boardHero.globalInfo.HauntedCarapaceHealthBonus);\r\n\t}\r\n\tif (hasCorrectTribe(entity, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tentity.attack = Math.max(0, entity.attack - boardHero.globalInfo.UndeadAttackBonus);\r\n\t\t}\r\n\t}\r\n\tif (hasCorrectTribe(entity, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tentity.attack = Math.max(0, entity.attack - boardHero.globalInfo.GoldrinnBuffAtk);\r\n\t\t\tentity.health = Math.max(1, entity.health - boardHero.globalInfo.GoldrinnBuffHealth);\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const boardEntity of board) {\r\n\t\tswitch (boardEntity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(entity, boardHero, Race.MURLOC, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack - (boardEntity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2),\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.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(entity, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack - (boardEntity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tentity.health = Math.max(\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tentity.health - (boardEntity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1),\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.Kathranatir_BG21_039:\r\n\t\t\t// case CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t// \tif (\r\n\t\t\t// \t\thasCorrectTribe(entity, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t// \t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t// \t) {\r\n\t\t\t// \t\tentity.attack = Math.max(\r\n\t\t\t// \t\t\t0,\r\n\t\t\t// \t\t\tentity.attack - (boardEntity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1),\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.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (entity.divineShield) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack - (boardEntity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6),\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.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(entity, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack -\r\n\t\t\t\t\t\t\t(boardEntity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tswitch (entity.cardId) {\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = entity.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - eternalKnightAttack * statsBonusKnight);\r\n\t\t\tentity.health = Math.max(1, entity.health - eternalKnightHealth * statsBonusKnight);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555:\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555_G:\r\n\t\t\tconst multiplierFungus = entity.cardId === CardIds.EnsorcelledFungus_BG28_555_G ? 2 : 1;\r\n\t\t\tconst statsBonusFungus = multiplierFungus * boardHero.globalInfo.TavernSpellsCastThisGame;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - statsBonusFungus);\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * statsBonusFungus);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = entity.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - statsBonusFrostling);\r\n\t\t\tentity.health = Math.max(1, entity.health - statsBonusFrostling);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\tconst multiplierAstral = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t// We remove 1 because the AstralAutomatonsSummonedThisGame also includes the current one\r\n\t\t\t// and ancestral automaton only counts \"other\" automatons\r\n\t\t\tconst statsBonusAstral = multiplierAstral * (boardHero.globalInfo.AstralAutomatonsSummonedThisGame - 1);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 3 * statsBonusAstral);\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * statsBonusAstral);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = entity.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * gameState.sharedState.deaths.filter((e) => e.friendly === entity.friendly).length;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - statsBonusGnoll);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tfor (const enchantment of entity.enchantments) {\r\n\t\tswitch (enchantment?.cardId) {\r\n\t\t\tcase CardIds.TavernLighting_TavernLightsEnchantment:\r\n\t\t\t\tentity.attack = Math.max(0, entity.attack - enchantment.tagScriptDataNum1);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleMinionAddedAuraEffect = (\r\n\tspawnedCardId: string,\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisActuallySpawned = true,\r\n): void => {\r\n\tswitch (spawnedCardId) {\r\n\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards))\r\n\t\t\t\t// Other\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, gameState.anomalies, gameState.allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\t// case CardIds.Kathranatir_BG21_039:\r\n\t\t// case CardIds.Kathranatir_BG21_039_G:\r\n\t\t// \tboard\r\n\t\t// \t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards))\r\n\t\t// \t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t// \t\t.forEach((e) => {\r\n\t\t// \t\t\te.attack += spawned.cardId === CardIds.Kathranatir_BG21_039_G ? 4 : 2;\r\n\t\t// \t\t});\r\n\t\t// \tbreak;\r\n\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\r\n\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += (spawned.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\t// TODO: move this somewhere else\r\n\t\t\tif (isActuallySpawned) {\r\n\t\t\t\tboardHero.globalInfo.AstralAutomatonsSummonedThisGame++;\r\n\t\t\t}\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\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.AstralAutomaton_BG_TTN_401 ||\r\n\t\t\t\t\t\te.cardId === CardIds.AstralAutomaton_BG_TTN_401_G,\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\tconst multiplierAstral = e.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t\t\tmodifyStats(e, e, 3 * multiplierAstral, 2 * multiplierAstral, board, boardHero, gameState, false);\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176:\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176_G:\r\n\t\t\tconst multiplierDrBoom = spawned.cardId === CardIds.DrBoomsMonster_BG31_176_G ? 2 : 1;\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\t2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom,\r\n\t\t\t\t2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallSpawned: readonly BoardEntity[],\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, hero, otherBoard, otherHero, spawned, gameState);\r\n\t}\r\n};\r\n\r\nexport const onMinionSummoned = (hero: BgsPlayerEntity, board: BoardEntity[], gameState: FullGameState): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.AssembleALineup:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// So that spawns don't mess up the loop\r\n\tconst initialBoard = [...board];\r\n\r\n\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\tconst onAfterSpawnedImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasAfterOtherSpawned(onAfterSpawnedImpl)) {\r\n\t\t\tonAfterSpawnedImpl.afterOtherSpawned(trinket, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t\tapplySelfAuras: false,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of initialBoard) {\r\n\t\tif (entity.entityId === spawned.entityId) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tconst onAfterSpawnedImpl = cardMappings[entity.cardId];\r\n\t\tif (hasAfterOtherSpawned(onAfterSpawnedImpl)) {\r\n\t\t\tonAfterSpawnedImpl.afterOtherSpawned(entity, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t\tapplySelfAuras: false,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.XyloBones_BG26_172:\r\n\t\t\tcase CardIds.XyloBones_BG26_172_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBones_BG26_172_G ? 4 : 2;\r\n\t\t\t\t\tmodifyStats(entity, entity, 0, xylobonesBuff, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804:\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGod_BG26_804_G ? 4 : 2;\r\n\t\t\t\t\tentity.scriptDataNum1 = (entity.scriptDataNum1 ?? 0) + octoStats;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802:\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, hero, Race.BEAST, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlamma_BG26_802_G ? 3 : 2;\r\n\t\t\t\t\tsetEntityStats(\r\n\t\t\t\t\t\tspawned,\r\n\t\t\t\t\t\tspawned.attack * bananaStatBuff,\r\n\t\t\t\t\t\tspawned.health * bananaStatBuff,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, spawned, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ObserverOfMyths_BG_TTN_078:\r\n\t\t\t// case CardIds.ObserverOfMyths_BG_TTN_078_G:\r\n\t\t\t// \tif (spawned.attack > entity.attack) {\r\n\t\t\t// \t\tconst observerBuff = entity.cardId === CardIds.ObserverOfMyths_BG_TTN_078_G ? 2 : 1;\r\n\t\t\t// \t\taddStatsToBoard(entity, board, hero, observerBuff, 0, gameState);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.ValithriaDreamwalker_TB_BaconShop_HERO_53_Buddy:\r\n\t\t\tcase CardIds.ValithriaDreamwalker_TB_BaconShop_HERO_53_Buddy_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, hero, Race.DRAGON, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst valithriaBuff =\r\n\t\t\t\t\t\tentity.cardId === CardIds.ValithriaDreamwalker_TB_BaconShop_HERO_53_Buddy_G ? 3 : 2;\r\n\t\t\t\t\tmodifyStats(entity, entity, valithriaBuff, valithriaBuff, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, spawned, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, hero, Race.UNDEAD, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tmodifyStats(spawned, spawned, 1, 0, board, hero, gameState, false);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const trinket of hero.trinkets) {\r\n\t\tswitch (trinket.cardId) {\r\n\t\t\tcase CardIds.SlammaSticker_BG30_MagicItem_540:\r\n\t\t\t\tif (hasCorrectTribe(spawned, hero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tsetEntityStats(spawned, spawned.attack * 2, spawned.health * 2, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(hero, spawned, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnSpawnInput {\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\nexport interface OnOtherSpawnInput {\r\n\tspawned: BoardEntity;\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n\tapplySelfAuras: boolean;\r\n}\r\nexport interface OnOtherSpawnAuraInput {\r\n\tspawned: BoardEntity;\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\nexport interface OnDespawnInput {\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\n"]}
1
+ {"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAAoD;AAGpD,4DAMiC;AACjC,oDAA8C;AAC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C,QAAQ,KAAK,OAAO,CAAC,QAAQ,EACnC;oBACD,IAAA,mBAAW,EAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;oBACnE,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;iBAC3E;gBACD,MAAM;SACP;KACD;IAED,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;QACpC,QAAQ,OAAO,CAAC,MAAM,EAAE;YACvB;gBACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,IAAI,EAAE,qBAAI,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;oBACxF,IAAA,sBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;oBACxF,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;iBAC1E;gBACD,MAAM;SACP;KACD;AACF,CAAC,CAAC","sourcesContent":["import { Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport {\r\n\thasAfterOtherSpawned,\r\n\thasOnDespawned,\r\n\thasOnOtherSpawned,\r\n\thasOnOtherAuraSpawned as hasOnOtherSpawnedAura,\r\n\thasOnSpawned,\r\n} from '../cards/card.interface';\r\nimport { isWhelp } from '../cards/cards-data';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { eternalKnightAttack, eternalKnightHealth } from '../cards/impl/trinket/eternal-portrait';\r\nimport { updateDivineShield } from '../keywords/divine-shield';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { CardIds } from '../services/card-ids';\r\nimport { pickRandom } from '../services/utils';\r\nimport { alreadyHasVolumizerBuff, copyEntity, hasCorrectTribe, isVolumizer } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\nimport { modifyStats, setEntityStats } from './stats';\r\n\r\n// export const addMinionsToBoard = (\r\n// \tboard: BoardEntity[],\r\n// \tboardHero: BgsPlayerEntity,\r\n// \totherBoard: BoardEntity[],\r\n// \totherHero: BgsPlayerEntity,\r\n// \tindex: number,\r\n// \tminionsToAdd: readonly BoardEntity[],\r\n// \tgameState: FullGameState,\r\n// ): void => {\r\n// \t// board.splice(index, 0, ...minionsToAdd);\r\n// \tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n// \t\taddMinionToBoard(board, boardHero, otherBoard, otherHero, index, minionToAdd, gameState, false);\r\n// \t}\r\n// \thandleAfterSpawnEffects(board, boardHero, otherBoard, otherHero, minionsToAdd, gameState);\r\n// };\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tgameState: FullGameState,\r\n\tapplySelfAuras = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\t// Update the global \"SummonedThisGame/Combat\" info here\r\n\thandleAddedMinionAuraEffect(board, boardHero, otherBoard, otherHero, minionToAdd, gameState, applySelfAuras);\r\n\t// Important to do this here, so that \"attack immediately\" minions can be taken into account by the quests\r\n\tonMinionSummoned(boardHero, board, gameState);\r\n\thandleSpawnEffect(board, boardHero, otherBoard, otherHero, minionToAdd, gameState, applySelfAuras);\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tgameState: FullGameState,\r\n\tapplySelfAuras = true,\r\n): void => {\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => isWhelp(cardId, gameState.allCards))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy_G);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, entity, 2, 2, board, boardHero, gameState);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, entity, 4, 4, board, boardHero, gameState);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\t// The case for Reborns, and these shouldn't proc on themselves\r\n\t\tif (entity.entityId === spawned.entityId) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tconst onOtherSpawnedImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnOtherSpawned(onOtherSpawnedImpl)) {\r\n\t\t\tonOtherSpawnedImpl.onOtherSpawned(entity, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: boardHero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\tapplySelfAuras,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, boardHero, otherHero, true, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyStats(entity, entity, 2, 0, board, boardHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.Bigfernal_BGS_204:\r\n\t\t\t// case CardIds.Bigfernal_TB_BaconUps_304:\r\n\t\t\t// \tif (hasCorrectTribe(spawned, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t// \t\tconst statsBonus = entity.cardId === CardIds.Bigfernal_TB_BaconUps_304 ? 2 : 1;\r\n\t\t\t// \t\tmodifyStats(entity, entity, statsBonus, statsBonus, board, boardHero, gameState);\r\n\t\t\t// \t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.MamaBear_BGS_021:\r\n\t\t\tcase CardIds.MamaBear_TB_BaconUps_090:\r\n\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBear_TB_BaconUps_090 ? 12 : 6;\r\n\t\t\t\t\tmodifyStats(spawned, entity, statsBonus, statsBonus, board, boardHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.PapaBear_BG27_509:\r\n\t\t\t// case CardIds.PapaBear_BG27_509_G:\r\n\t\t\t// \tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t// \t\tconst statsBonus = entity.cardId === CardIds.PapaBear_BG27_509_G ? 16 : 8;\r\n\t\t\t// \t\tmodifyStats(spawned, entity, statsBonus, statsBonus, board, boardHero, gameState);\r\n\t\t\t// \t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.PackLeader_BGS_017:\r\n\t\t\tcase CardIds.PackLeader_TB_BaconUps_086:\r\n\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeader_TB_BaconUps_086 ? 4 : 2;\r\n\t\t\t\t\tmodifyStats(spawned, entity, statsBonus, 0, board, boardHero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, boardHero, otherHero);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\nexport const handleAddedMinionAuraEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tgameState: FullGameState,\r\n\tapplySelfAuras = true,\r\n\tisActuallySpawned = true,\r\n): void => {\r\n\tfor (const heroPower of boardHero.heroPowers) {\r\n\t\tswitch (heroPower.cardId) {\r\n\t\t\tcase CardIds.SproutItOut:\r\n\t\t\t\tif (isActuallySpawned) {\r\n\t\t\t\t\tupdateTaunt(spawned, true, board, boardHero, otherHero, gameState);\r\n\t\t\t\t\tmodifyStats(spawned, boardHero, 1, 2, board, boardHero, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tif (boardHero.questRewards?.includes(CardIds.TumblingDisaster_BG28_Reward_505)) {\r\n\t\tconst tumblingDisasterBonus =\r\n\t\t\tboardHero.questRewardEntities?.find((e) => e.cardId === CardIds.TumblingDisaster_BG28_Reward_505)\r\n\t\t\t\t?.scriptDataNum1 || 1;\r\n\t\tmodifyStats(spawned, boardHero, tumblingDisasterBonus, tumblingDisasterBonus, board, boardHero, gameState);\r\n\t}\r\n\r\n\tif (isActuallySpawned) {\r\n\t\tfor (const trinket of boardHero.trinkets) {\r\n\t\t\tswitch (trinket.cardId) {\r\n\t\t\t\tcase CardIds.BlingtronsSunglasses_BG30_MagicItem_978:\r\n\t\t\t\t\tif (hasCorrectTribe(spawned, boardHero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\t\tconst target = pickRandom(board.filter((e) => !e.divineShield));\r\n\t\t\t\t\t\tif (!!target) {\r\n\t\t\t\t\t\t\tupdateDivineShield(target, board, boardHero, otherHero, true, gameState);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TwinSkyLanterns_BG30_MagicItem_822:\r\n\t\t\t\tcase CardIds.TwinSkyLanterns_TwinSkyLanternsToken_BG30_MagicItem_822t2:\r\n\t\t\t\t\tif (!trinket.rememberedMinion) {\r\n\t\t\t\t\t\ttrinket.rememberedMinion = copyEntity(spawned);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.ReinforcedShield_BG30_MagicItem_886:\r\n\t\t\t\t\tif (trinket.scriptDataNum1 > 0 && !spawned.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(spawned, board, boardHero, otherHero, true, gameState);\r\n\t\t\t\t\t\ttrinket.scriptDataNum1--;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Apply auras to board\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\thandleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, gameState, isActuallySpawned);\r\n\t}\r\n\r\n\t// When we want to summon an \"exact copy\", we need to make sure we don't apply the aura twice\r\n\tif (applySelfAuras) {\r\n\t\t// The board here already contains the new minion\r\n\t\t// TODO: what if the additional part is a potential target for the aura effect?\r\n\t\t// 2024-08-27: changing the order to first handleMinionAddedAuraEffect so that the automatons get boosted,\r\n\t\t// then apply the aura\r\n\t\tapplyAurasToSelf(spawned, board, boardHero, gameState);\r\n\t}\r\n\r\n\tif (isActuallySpawned) {\r\n\t\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tboardHero.globalInfo.BeastsSummonedThisCombat++;\r\n\t\t\tboardHero.globalInfo.BeastsSummonedThisGame++;\r\n\t\t}\r\n\t\tif (hasCorrectTribe(spawned, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tboardHero.globalInfo.PiratesSummonedThisGame++;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyAurasToSelf = (\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tspawned.attack += boardHero.globalInfo.AdditionalAttack;\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!!boardHero.trinkets?.length) {\r\n\t\tfor (const trinket of boardHero.trinkets) {\r\n\t\t\tswitch (trinket.cardId) {\r\n\t\t\t\tcase CardIds.FeralTalisman_BG30_MagicItem_880:\r\n\t\t\t\t\tspawned.attack += 2;\r\n\t\t\t\t\tspawned.health += 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FeralTalisman_FeralTalismanToken_BG30_MagicItem_880t:\r\n\t\t\t\t\tspawned.attack += 8;\r\n\t\t\t\t\tspawned.health += 5;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.DazzlingDagger_BG32_MagicItem_934:\r\n\t\t\t\t\tspawned.attack += trinket.scriptDataNum1 || 1;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.HordeKeychainToken_BG30_MagicItem_843t:\r\n\t\t\t\t\tif (gameState.cardsData.getTavernLevel(spawned.cardId) <= 3) {\r\n\t\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\t\tspawned.health += 5;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FlagbearerPortrait_BG30_MagicItem_921:\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tspawned.cardId === CardIds.Scallywag_SkyPirateToken_BGS_061t ||\r\n\t\t\t\t\t\tspawned.cardId === CardIds.Scallywag_SkyPirateToken_TB_BaconUps_141t\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tspawned.attack += 6;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (boardHero.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tmodifyStats(\r\n\t\t\tspawned,\r\n\t\t\tspawned,\r\n\t\t\tboardHero.globalInfo.HauntedCarapaceAttackBonus,\r\n\t\t\t0,\r\n\t\t\tboard,\r\n\t\t\tboardHero,\r\n\t\t\tgameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t}\r\n\tif (boardHero.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tmodifyStats(\r\n\t\t\tspawned,\r\n\t\t\tspawned,\r\n\t\t\t0,\r\n\t\t\tboardHero.globalInfo.HauntedCarapaceHealthBonus,\r\n\t\t\tboard,\r\n\t\t\tboardHero,\r\n\t\t\tgameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t}\r\n\tif (hasCorrectTribe(spawned, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.UndeadAttackBonus,\r\n\t\t\t\t0,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (hasCorrectTribe(spawned, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.PirateAttackBonus > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.PirateAttackBonus,\r\n\t\t\t\t0,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (hasCorrectTribe(spawned, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t\tboardHero.globalInfo.GoldrinnBuffHealth,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);\r\n\t\t}\r\n\t}\r\n\tif (isWhelp(spawned.cardId, gameState.allCards)) {\r\n\t\tmodifyStats(\r\n\t\t\tspawned,\r\n\t\t\tspawned,\r\n\t\t\tboardHero.globalInfo.WhelpAttackBuff ?? 0,\r\n\t\t\tboardHero.globalInfo.WhelpHealthBuff ?? 0,\r\n\t\t\tboard,\r\n\t\t\tboardHero,\r\n\t\t\tgameState,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\tgameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);\r\n\t}\r\n\tif (\r\n\t\tisVolumizer(spawned.cardId, boardHero, gameState.anomalies, gameState.allCards) &&\r\n\t\t// https://replays.firestoneapp.com/?reviewId=75e82ef1-3442-4307-a3c8-4a3b72fcf6af&turn=11&action=2\r\n\t\t!alreadyHasVolumizerBuff(spawned, boardHero, gameState)\r\n\t) {\r\n\t\tif (boardHero.globalInfo.VolumizerAttackBuff > 0 || boardHero.globalInfo.VolumizerHealthBuff > 0) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\tboardHero.globalInfo.VolumizerAttackBuff ?? 0,\r\n\t\t\t\tboardHero.globalInfo.VolumizerHealthBuff ?? 0,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tgameState.spectator.registerPowerTarget(boardHero, spawned, board, null, null);\r\n\t\t}\r\n\t}\r\n\r\n\t// In case Putricide spawns a stictched minion whose stitched part creates an aura effect\r\n\t// const potentialAuraSources: { cardId: string; entityId: number }[] = [\r\n\t// \t{ cardId: spawned.cardId, entityId: spawned.entityId },\r\n\t// \t...(spawned.additionalCards ?? []).map((cardId) => ({ cardId, entityId: spawned.entityId })),\r\n\t// ];\r\n\r\n\tif (gameState.cardsData.getTavernLevel(spawned.cardId) % 2 === 1) {\r\n\t\tconst atkBuff = boardHero.globalInfo.MutatedLasherAttackBuff ?? 0;\r\n\t\tconst healthBuff = boardHero.globalInfo.MutatedLasherHealthBuff ?? 0;\r\n\t\tmodifyStats(spawned, spawned, atkBuff, healthBuff, board, boardHero, gameState, false);\r\n\t}\r\n\tfor (const entity of board) {\r\n\t\tconst onOtherSpawnedImpl = cardMappings[entity.cardId];\r\n\t\tif (hasOnOtherSpawnedAura(onOtherSpawnedImpl)) {\r\n\t\t\tonOtherSpawnedImpl.onOtherSpawnedAura(entity, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: boardHero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\tgameState,\r\n\t\t\t});\r\n\t\t}\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, boardHero, Race.MURLOC, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.Kathranatir_BG21_039:\r\n\t\t\t// case CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t// \tif (\r\n\t\t\t// \t\thasCorrectTribe(spawned, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t// \t\tentity.entityId !== spawned.entityId\r\n\t\t\t// \t) {\r\n\t\t\t// \t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tspawned.attack += (entity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tconst onSpawnedImpl = cardMappings[spawned.cardId];\r\n\tif (hasOnSpawned(onSpawnedImpl)) {\r\n\t\tonSpawnedImpl.onSpawned(spawned, {\r\n\t\t\thero: boardHero,\r\n\t\t\tboard: board,\r\n\t\t\tgameState: gameState,\r\n\t\t});\r\n\t}\r\n\tswitch (spawned.cardId) {\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tnull,\r\n\t\t\t\teternalKnightAttack * statsBonusKnight,\r\n\t\t\t\teternalKnightHealth * statsBonusKnight,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555:\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555_G:\r\n\t\t\tconst multiplierFungus = spawned.cardId === CardIds.EnsorcelledFungus_BG28_555_G ? 2 : 1;\r\n\t\t\tconst statsBonusFungus = multiplierFungus * boardHero.globalInfo.TavernSpellsCastThisGame;\r\n\t\t\tmodifyStats(spawned, null, statsBonusFungus, 2 * statsBonusFungus, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tnull,\r\n\t\t\t\t2 * statsBonusFrostling,\r\n\t\t\t\tstatsBonusFrostling,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SaltyLooter_BGS_081:\r\n\t\tcase CardIds.SaltyLooter_TB_BaconUps_143:\r\n\t\t\tconst multiplierLooter = spawned.cardId === CardIds.SaltyLooter_TB_BaconUps_143 ? 2 : 1;\r\n\t\t\tconst statsBonusLooter = multiplierLooter * boardHero.globalInfo.PiratesSummonedThisGame;\r\n\t\t\tmodifyStats(spawned, null, 2 * statsBonusLooter, 2 * multiplierLooter, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\tconst multiplierAstral = spawned.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t// Don't count the yourself\r\n\t\t\tconst statsBonusAstral = multiplierAstral * (boardHero.globalInfo.AstralAutomatonsSummonedThisGame - 1);\r\n\t\t\tmodifyStats(spawned, null, 3 * statsBonusAstral, 2 * statsBonusAstral, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * gameState.sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\tmodifyStats(spawned, null, statsBonusGnoll, 0, board, boardHero, gameState, false);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\n// Introduced for Rapid Reanimation: since we will \"addMinionToBoard\" the minion afterwards, the auras will\r\n// be re-applied then, so we need to remove them first\r\nexport const removeAurasFromSelf = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.attack -= Math.max(0, boardHero.globalInfo.AdditionalAttack);\r\n\r\n\tconst onDespawnedImpl = cardMappings[entity.cardId];\r\n\tif (hasOnDespawned(onDespawnedImpl)) {\r\n\t\tonDespawnedImpl.onDespawned(entity, {\r\n\t\t\thero: boardHero,\r\n\t\t\tboard: board,\r\n\t\t\tgameState,\r\n\t\t});\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 7);\r\n\t\t\t\t\tentity.health = Math.max(1, entity.health - 7);\r\n\t\t\t\t\tentity.enchantments = entity.enchantments.filter(\r\n\t\t\t\t\t\t(e) => e.cardId !== CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 7);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FlagbearerPortrait_BG30_MagicItem_921:\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\tentity.cardId === CardIds.SkyPirateFlagbearer_BG30_119 ||\r\n\t\t\t\t\t\tentity.cardId === CardIds.SkyPirateFlagbearer_BG30_119_G\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 8);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (!!boardHero.trinkets?.length) {\r\n\t\tfor (const trinket of boardHero.trinkets) {\r\n\t\t\tswitch (trinket.cardId) {\r\n\t\t\t\tcase CardIds.FeralTalisman_BG30_MagicItem_880:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 2);\r\n\t\t\t\t\tentity.health = Math.max(1, entity.health - 1);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.FeralTalisman_FeralTalismanToken_BG30_MagicItem_880t:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 8);\r\n\t\t\t\t\tentity.health = Math.max(1, entity.health - 5);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.DazzlingDagger_BG32_MagicItem_934:\r\n\t\t\t\t\tentity.attack = Math.max(0, entity.attack - (trinket.scriptDataNum1 || 1));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.HordeKeychainToken_BG30_MagicItem_843t:\r\n\t\t\t\t\tif (gameState.cardsData.getTavernLevel(entity.cardId) <= 3) {\r\n\t\t\t\t\t\tentity.attack = Math.max(0, entity.attack - 7);\r\n\t\t\t\t\t\tentity.health = Math.max(1, entity.health - 5);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (boardHero.globalInfo.HauntedCarapaceAttackBonus > 0) {\r\n\t\tentity.attack = Math.max(0, entity.attack - boardHero.globalInfo.HauntedCarapaceAttackBonus);\r\n\t}\r\n\tif (boardHero.globalInfo.HauntedCarapaceHealthBonus > 0) {\r\n\t\tentity.health = Math.max(1, entity.health - boardHero.globalInfo.HauntedCarapaceHealthBonus);\r\n\t}\r\n\tif (hasCorrectTribe(entity, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tentity.attack = Math.max(0, entity.attack - boardHero.globalInfo.UndeadAttackBonus);\r\n\t\t}\r\n\t}\r\n\tif (hasCorrectTribe(entity, boardHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tif (boardHero.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tentity.attack = Math.max(0, entity.attack - boardHero.globalInfo.GoldrinnBuffAtk);\r\n\t\t\tentity.health = Math.max(1, entity.health - boardHero.globalInfo.GoldrinnBuffHealth);\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const boardEntity of board) {\r\n\t\tswitch (boardEntity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(entity, boardHero, Race.MURLOC, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack - (boardEntity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2),\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.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(entity, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack - (boardEntity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1),\r\n\t\t\t\t\t);\r\n\t\t\t\t\tentity.health = Math.max(\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tentity.health - (boardEntity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1),\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.Kathranatir_BG21_039:\r\n\t\t\t// case CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t// \tif (\r\n\t\t\t// \t\thasCorrectTribe(entity, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t// \t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t// \t) {\r\n\t\t\t// \t\tentity.attack = Math.max(\r\n\t\t\t// \t\t\t0,\r\n\t\t\t// \t\t\tentity.attack - (boardEntity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1),\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.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (entity.divineShield) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack - (boardEntity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6),\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.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(entity, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== boardEntity.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tentity.attack = Math.max(\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tentity.attack -\r\n\t\t\t\t\t\t\t(boardEntity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tswitch (entity.cardId) {\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = entity.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - eternalKnightAttack * statsBonusKnight);\r\n\t\t\tentity.health = Math.max(1, entity.health - eternalKnightHealth * statsBonusKnight);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555:\r\n\t\tcase CardIds.EnsorcelledFungus_BG28_555_G:\r\n\t\t\tconst multiplierFungus = entity.cardId === CardIds.EnsorcelledFungus_BG28_555_G ? 2 : 1;\r\n\t\t\tconst statsBonusFungus = multiplierFungus * boardHero.globalInfo.TavernSpellsCastThisGame;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - statsBonusFungus);\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * statsBonusFungus);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = entity.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - statsBonusFrostling);\r\n\t\t\tentity.health = Math.max(1, entity.health - statsBonusFrostling);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\tconst multiplierAstral = entity.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t// We remove 1 because the AstralAutomatonsSummonedThisGame also includes the current one\r\n\t\t\t// and ancestral automaton only counts \"other\" automatons\r\n\t\t\tconst statsBonusAstral = multiplierAstral * (boardHero.globalInfo.AstralAutomatonsSummonedThisGame - 1);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 3 * statsBonusAstral);\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * statsBonusAstral);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = entity.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * gameState.sharedState.deaths.filter((e) => e.friendly === entity.friendly).length;\r\n\t\t\tentity.attack = Math.max(0, entity.attack - statsBonusGnoll);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tfor (const enchantment of entity.enchantments) {\r\n\t\tswitch (enchantment?.cardId) {\r\n\t\t\tcase CardIds.TavernLighting_TavernLightsEnchantment:\r\n\t\t\t\tentity.attack = Math.max(0, entity.attack - enchantment.tagScriptDataNum1);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleMinionAddedAuraEffect = (\r\n\tspawnedCardId: string,\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tisActuallySpawned = true,\r\n): void => {\r\n\tswitch (spawnedCardId) {\r\n\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.PIRATE, gameState.anomalies, gameState.allCards))\r\n\t\t\t\t// Other\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.MURLOC, gameState.anomalies, gameState.allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\t// case CardIds.Kathranatir_BG21_039:\r\n\t\t// case CardIds.Kathranatir_BG21_039_G:\r\n\t\t// \tboard\r\n\t\t// \t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.DEMON, gameState.anomalies, gameState.allCards))\r\n\t\t// \t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t// \t\t.forEach((e) => {\r\n\t\t// \t\t\te.attack += spawned.cardId === CardIds.Kathranatir_BG21_039_G ? 4 : 2;\r\n\t\t// \t\t});\r\n\t\t// \tbreak;\r\n\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\r\n\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, boardHero, Race.UNDEAD, gameState.anomalies, gameState.allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += (spawned.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401:\r\n\t\tcase CardIds.AstralAutomaton_BG_TTN_401_G:\r\n\t\t\t// TODO: move this somewhere else\r\n\t\t\tif (isActuallySpawned) {\r\n\t\t\t\tboardHero.globalInfo.AstralAutomatonsSummonedThisGame++;\r\n\t\t\t}\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\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.AstralAutomaton_BG_TTN_401 ||\r\n\t\t\t\t\t\te.cardId === CardIds.AstralAutomaton_BG_TTN_401_G,\r\n\t\t\t\t)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\tconst multiplierAstral = e.cardId === CardIds.AstralAutomaton_BG_TTN_401_G ? 2 : 1;\r\n\t\t\t\t\tmodifyStats(e, e, 3 * multiplierAstral, 2 * multiplierAstral, board, boardHero, gameState, false);\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176:\r\n\t\tcase CardIds.DrBoomsMonster_BG31_176_G:\r\n\t\t\tconst multiplierDrBoom = spawned.cardId === CardIds.DrBoomsMonster_BG31_176_G ? 2 : 1;\r\n\t\t\tmodifyStats(\r\n\t\t\t\tspawned,\r\n\t\t\t\tspawned,\r\n\t\t\t\t2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom,\r\n\t\t\t\t2 * boardHero.globalInfo.MagnetizedThisGame * multiplierDrBoom,\r\n\t\t\t\tboard,\r\n\t\t\t\tboardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\nexport const handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallSpawned: readonly BoardEntity[],\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, hero, otherBoard, otherHero, spawned, gameState);\r\n\t}\r\n};\r\n\r\nexport const onMinionSummoned = (hero: BgsPlayerEntity, board: BoardEntity[], gameState: FullGameState): void => {\r\n\tconst quests = hero.questEntities ?? [];\r\n\tif (!quests.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tfor (const quest of quests) {\r\n\t\tswitch (quest.CardId) {\r\n\t\t\tcase CardIds.AssembleALineup:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// So that spawns don't mess up the loop\r\n\tconst initialBoard = [...board];\r\n\r\n\tfor (const trinket of hero.trinkets ?? []) {\r\n\t\tconst onAfterSpawnedImpl = cardMappings[trinket.cardId];\r\n\t\tif (hasAfterOtherSpawned(onAfterSpawnedImpl)) {\r\n\t\t\tonAfterSpawnedImpl.afterOtherSpawned(trinket, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t\tapplySelfAuras: false,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of initialBoard) {\r\n\t\tif (entity.entityId === spawned.entityId) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tconst onAfterSpawnedImpl = cardMappings[entity.cardId];\r\n\t\tif (hasAfterOtherSpawned(onAfterSpawnedImpl)) {\r\n\t\t\tonAfterSpawnedImpl.afterOtherSpawned(entity, {\r\n\t\t\t\tspawned: spawned,\r\n\t\t\t\thero: hero,\r\n\t\t\t\tboard: board,\r\n\t\t\t\totherHero: otherHero,\r\n\t\t\t\totherBoard: otherBoard,\r\n\t\t\t\tgameState,\r\n\t\t\t\tapplySelfAuras: false,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.XyloBones_BG26_172:\r\n\t\t\tcase CardIds.XyloBones_BG26_172_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBones_BG26_172_G ? 4 : 2;\r\n\t\t\t\t\tmodifyStats(entity, entity, 0, xylobonesBuff, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804:\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGod_BG26_804_G ? 4 : 2;\r\n\t\t\t\t\tentity.scriptDataNum1 = (entity.scriptDataNum1 ?? 0) + octoStats;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802:\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, hero, Race.BEAST, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlamma_BG26_802_G ? 3 : 2;\r\n\t\t\t\t\tsetEntityStats(\r\n\t\t\t\t\t\tspawned,\r\n\t\t\t\t\t\tspawned.attack * bananaStatBuff,\r\n\t\t\t\t\t\tspawned.health * bananaStatBuff,\r\n\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\thero,\r\n\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, spawned, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// case CardIds.ObserverOfMyths_BG_TTN_078:\r\n\t\t\t// case CardIds.ObserverOfMyths_BG_TTN_078_G:\r\n\t\t\t// \tif (spawned.attack > entity.attack) {\r\n\t\t\t// \t\tconst observerBuff = entity.cardId === CardIds.ObserverOfMyths_BG_TTN_078_G ? 2 : 1;\r\n\t\t\t// \t\taddStatsToBoard(entity, board, hero, observerBuff, 0, gameState);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.ValithriaDreamwalker_TB_BaconShop_HERO_53_Buddy:\r\n\t\t\tcase CardIds.ValithriaDreamwalker_TB_BaconShop_HERO_53_Buddy_G:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, hero, Race.DRAGON, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tconst valithriaBuff =\r\n\t\t\t\t\t\tentity.cardId === CardIds.ValithriaDreamwalker_TB_BaconShop_HERO_53_Buddy_G ? 3 : 2;\r\n\t\t\t\t\tmodifyStats(entity, entity, valithriaBuff, valithriaBuff, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, spawned, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (\r\n\t\t\t\t\thasCorrectTribe(spawned, hero, Race.UNDEAD, gameState.anomalies, gameState.allCards) &&\r\n\t\t\t\t\tentity.entityId !== spawned.entityId\r\n\t\t\t\t) {\r\n\t\t\t\t\tmodifyStats(spawned, spawned, 1, 0, board, hero, gameState, false);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const trinket of hero.trinkets) {\r\n\t\tswitch (trinket.cardId) {\r\n\t\t\tcase CardIds.SlammaSticker_BG30_MagicItem_540:\r\n\t\t\t\tif (hasCorrectTribe(spawned, hero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\t\t\t\tsetEntityStats(spawned, spawned.attack * 2, spawned.health * 2, board, hero, gameState);\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(hero, spawned, board, null, null);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport interface OnSpawnInput {\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\nexport interface OnOtherSpawnInput {\r\n\tspawned: BoardEntity;\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\totherHero: BgsPlayerEntity;\r\n\totherBoard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n\tapplySelfAuras: boolean;\r\n}\r\nexport interface OnOtherSpawnAuraInput {\r\n\tspawned: BoardEntity;\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\nexport interface OnDespawnInput {\r\n\thero: BgsPlayerEntity;\r\n\tboard: BoardEntity[];\r\n\tgameState: FullGameState;\r\n}\r\n"]}