@firestone-hs/simulate-bgs-battle 1.1.582 → 1.1.584
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cards/cards-data.js +4 -4
- package/dist/cards/cards-data.js.map +1 -1
- package/dist/cards/impl/hero-power/rapid-reanimation.js +1 -3
- package/dist/cards/impl/hero-power/rapid-reanimation.js.map +1 -1
- package/dist/cards/impl/minion/amplifying-lightspawn.js +6 -2
- package/dist/cards/impl/minion/amplifying-lightspawn.js.map +1 -1
- package/dist/cards/impl/minion/apprentice-of-sefin.d.ts +2 -2
- package/dist/cards/impl/minion/apprentice-of-sefin.js +5 -9
- package/dist/cards/impl/minion/apprentice-of-sefin.js.map +1 -1
- package/dist/cards/impl/minion/bronze-steward.js +2 -2
- package/dist/cards/impl/minion/bronze-steward.js.map +1 -1
- package/dist/cards/impl/minion/dastardly-drust.js +7 -3
- package/dist/cards/impl/minion/dastardly-drust.js.map +1 -1
- package/dist/cards/impl/minion/drustfallen-butcher.js +1 -1
- package/dist/cards/impl/minion/drustfallen-butcher.js.map +1 -1
- package/dist/cards/impl/minion/fire-forged-evoker.js +1 -1
- package/dist/cards/impl/minion/fire-forged-evoker.js.map +1 -1
- package/dist/cards/impl/minion/fireworks-fanatic.js +1 -1
- package/dist/cards/impl/minion/fireworks-fanatic.js.map +1 -1
- package/dist/cards/impl/minion/gentle-stag.js +1 -1
- package/dist/cards/impl/minion/gentle-stag.js.map +1 -1
- package/dist/cards/impl/minion/goldgrubber.js +1 -1
- package/dist/cards/impl/minion/goldgrubber.js.map +1 -1
- package/dist/cards/impl/minion/hackerfin.js +10 -6
- package/dist/cards/impl/minion/hackerfin.js.map +1 -1
- package/dist/cards/impl/minion/lokholar-frostforger.js +1 -1
- package/dist/cards/impl/minion/lokholar-frostforger.js.map +1 -1
- package/dist/cards/impl/minion/noisul-of-the-many-faces.js +4 -6
- package/dist/cards/impl/minion/noisul-of-the-many-faces.js.map +1 -1
- package/dist/cards/impl/minion/silithid-burrower.js +1 -1
- package/dist/cards/impl/minion/silithid-burrower.js.map +1 -1
- package/dist/cards/impl/minion/valiant-tiger.js +1 -1
- package/dist/cards/impl/minion/valiant-tiger.js.map +1 -1
- package/dist/cards/impl/trinket/battle-horn.js +1 -1
- package/dist/cards/impl/trinket/battle-horn.js.map +1 -1
- package/dist/cards/impl/trinket/eclectic-shrine.js +5 -3
- package/dist/cards/impl/trinket/eclectic-shrine.js.map +1 -1
- package/dist/cards/impl/trinket/hogwash-basin.js +1 -1
- package/dist/cards/impl/trinket/hogwash-basin.js.map +1 -1
- package/dist/cards/impl/trinket/unholy-sanctum.js +1 -1
- package/dist/cards/impl/trinket/unholy-sanctum.js.map +1 -1
- package/dist/simulation/add-minion-to-board.js +7 -7
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/deathrattle-effects.js +1 -1
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/spawn-fail.js +3 -2
- package/dist/simulation/spawn-fail.js.map +1 -1
- package/dist/simulation/stats.d.ts +1 -1
- package/dist/simulation/stats.js +4 -3
- package/dist/simulation/stats.js.map +1 -1
- package/dist/simulation/utils/golden.js +2 -2
- package/dist/simulation/utils/golden.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +5 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deathrattle-effects.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-effects.ts"],"names":[],"mappings":";;;AACA,iEAAuF;AAIvF,6CAAgD;AAChD,6CAA4E;AAC5E,gEAAuE;AACvE,oCAA+E;AAC/E,qCAAsF;AACtF,mDAAiD;AACjD,6DAAqD;AAErD,qEAAwE;AAExE,mCAAsC;AAEtC,MAAM,2BAA2B,GAAG,0BAAwE,CAAC;AAEtG,MAAM,4BAA4B,GAAG,CAC3C,KAAoB,EACpB,SAA0B,EAC1B,UAAuB,E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H,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACjC,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { pickMultipleRandomDifferent, pickRandom } from '../services/utils';\r\nimport { isValidDeathrattleEnchantment } from '../simulate-bgs-battle';\r\nimport { grantRandomStats, hasCorrectTribe, isFish, isGolden } from '../utils';\r\nimport { dealDamageToMinion, dealDamageToRandomEnemy, getNeighbours } from './attack';\r\nimport { addCardsInHand } from './cards-in-hand';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { groupLeapfroggerDeathrattles } from './remembered-deathrattle';\r\nimport { SharedState } from './shared-state';\r\nimport { modifyStats } from './stats';\r\n\r\nconst DEATHRATTLES_REQUIRE_MEMORY = [CardIds.StitchedSalvager_BG31_999, CardIds.StitchedSalvager_BG31_999_G];\r\n\r\nexport const computeDeathrattleMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst rivendare =\r\n\t\t!!board.find(\r\n\t\t\t(entity) =>\r\n\t\t\t\tentity.cardId === CardIds.BaronRivendare_BG_FP1_031 ||\r\n\t\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t\t) || boardHero.secrets?.some((e) => e.cardId === CardIds.TitusTribute_BG28_843);\r\n\tconst goldenRivendare = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BaronRivendare_TB_BaconUps_055 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst titus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354).length;\r\n\tconst goldenTitus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354_G).length;\r\n\tconst deathlyPhylacteries = boardHero.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.DeathlyPhylactery_BG30_MagicItem_700 && t.scriptDataNum1 > 0,\r\n\t).length;\r\n\tconst tombs =\r\n\t\tboardHero.questRewardEntities?.filter((entity) => entity.cardId === CardIds.TurbulentTombs)?.length ?? 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\tconst scourgeMultiplier = deadEntity.additionalCards?.includes(CardIds.ScourgeTroll) ? 2 : 1;\r\n\r\n\tconst multiplier =\r\n\t\tscourgeMultiplier *\r\n\t\t((goldenRivendare ? 3 : rivendare ? 2 : 1) +\r\n\t\t\tdeathlyPhylacteries +\r\n\t\t\ttitus +\r\n\t\t\t2 * goldenTitus +\r\n\t\t\ttombs +\r\n\t\t\techoesOfArgus);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const applyLightningInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Because the golden version doubles all the remembered effects\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst targets = pickMultipleRandomDifferent(otherBoard, 5);\r\n\t\tfor (const target of targets) {\r\n\t\t\tdealDamageToMinion(\r\n\t\t\t\ttarget,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\t1,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyWaterInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity, // Can be null when trinket is used\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst validBoard = boardWithDeadEntity.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\t\tconst target: BoardEntity = validBoard[validBoard.length - 1];\r\n\t\tif (!!target) {\r\n\t\t\tupdateTaunt(target, true, boardWithDeadEntity, boardWithDeadEntityHero, otherHero, gameState);\r\n\t\t\tmodifyStats(target, sourceEntity, 0, 3, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyFireInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity.filter((e) => e.health > 0 && !e.definitelyDead)[0];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tsourceEntity,\r\n\t\t\t\ttarget.attack,\r\n\t\t\t\t0,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyEarthInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst minionsGrantedDeathrattle: BoardEntity[] = pickMultipleRandomDifferent(boardWithDeadEntity, 4);\r\n\t\tminionsGrantedDeathrattle.forEach((minion) => {\r\n\t\t\tminion.enchantments.push({\r\n\t\t\t\tcardId: CardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\toriginEntityId: deadEntity?.entityId,\r\n\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t\tgameState.spectator.registerPowerTarget(sourceEntity, minion, boardWithDeadEntity, null, null);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const applyLeapFroggerEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tgameState: FullGameState,\r\n\tmultiplier: number,\r\n): void => {\r\n\tmultiplier = multiplier ?? deadEntity.deathrattleRepeats ?? 1;\r\n\t// console.debug('applying leapfrogger effect', deadEntity.entityId, multiplier);\r\n\tconst buffed = grantRandomStats(\r\n\t\tdeadEntity,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tRace.BEAST,\r\n\t\tfalse,\r\n\t\tgameState,\r\n\t);\r\n\tif (buffed) {\r\n\t\tbuffed.enchantments = buffed.enchantments ?? [];\r\n\t\tbuffed.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge\r\n\t\t\t\t: CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const applyRecurringNightmareDeathrattleEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tgameState: FullGameState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst target = pickRandom(\r\n\t\tboardWithDeadEntity\r\n\t\t\t.filter((e) =>\r\n\t\t\t\thasCorrectTribe(e, boardWithDeadEntityHero, Race.UNDEAD, gameState.anomalies, gameState.allCards),\r\n\t\t\t)\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055 &&\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055_G,\r\n\t\t\t),\r\n\t);\r\n\tif (target) {\r\n\t\ttarget.enchantments = target.enchantments ?? [];\r\n\t\ttarget.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge\r\n\t\t\t\t: CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t});\r\n\t\tgameState.spectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity, null, null);\r\n\t}\r\n};\r\n\r\n// Some minions like Icesnarl can revive themselves when killing a minion, so it needs to be handled before\r\n// we actually make the minion die\r\nexport const handleWheneverMinionsKillEffect = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thandleWheneverMinionsKillEffectForBoard(board, hero, otherBoard, otherHero, gameState);\r\n\t// It's called once for each board already, so don't duplicate it here\r\n\t// handleWheneverMinionsKillEffectForBoard(otherBoard, otherHero, board, hero, gameState);\r\n};\r\n\r\nconst handleWheneverMinionsKillEffectForBoard = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].health <= 0 || board[i].definitelyDead) {\r\n\t\t\tconst futureDeadEntity = board[i];\r\n\t\t\tconst killer = futureDeadEntity.lastAffectedByEntity;\r\n\t\t\tif (!killer) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Killed an enemy minion\r\n\t\t\tif (killer.friendly !== futureDeadEntity.friendly) {\r\n\t\t\t\tfor (const heroPower of otherHero.heroPowers) {\r\n\t\t\t\t\tif (heroPower.cardId === CardIds.Rokara_GloryOfCombat) {\r\n\t\t\t\t\t\tmodifyStats(killer, otherHero, 1, 0, otherBoard, otherHero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Icesnarl the Mighty\r\n\t\t\t\totherBoard\r\n\t\t\t\t\t.filter(\r\n\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\te.cardId === CardIds.IcesnarlTheMighty_BG20_HERO_100_Buddy ||\r\n\t\t\t\t\t\t\te.cardId === CardIds.IcesnarlTheMighty_BG20_HERO_100_Buddy_G,\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.forEach((icesnarl) => {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\ticesnarl,\r\n\t\t\t\t\t\t\ticesnarl,\r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\ticesnarl.cardId === CardIds.IcesnarlTheMighty_BG20_HERO_100_Buddy_G ? 2 : 1,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleAfterMinionKillsEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Moved to \"whenever kills\", as these can revive the minion that kills\r\n\t// const killer = deadEntity.lastAffectedByEntity;\r\n\t// if (!killer) {\r\n\t// \treturn;\r\n\t// }\r\n\t// // Killed an enemy minion\r\n\t// if (killer.friendly !== deadEntity.friendly) {\r\n\t// }\r\n};\r\n\r\nexport const applyWheneverMinionDiesEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// console.log('applying minion death effect', stringifySimpleCard(deadEntity, allCards));\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplyScavengingHyenaEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.DEMON, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplySoulJugglerEffect(boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplyJunkbotEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.MURLOC, gameState.anomalies, gameState.allCards)) {\r\n\t\tremoveOldMurkEyeAttack(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\tremoveOldMurkEyeAttack(otherBoard, otherBoardHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplyMossOfTheSchlossEffect(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\r\n\tif (deadEntity.taunt) {\r\n\t\tapplyBristlemaneScrapsmithEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\tapplyQirajiHarbringerEffect(boardWithDeadEntity, boardWithDeadEntityHero, deadEntityIndexFromRight, gameState);\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008_G\r\n\t) {\r\n\t\tapplyEternalKnightEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\r\n\t// Putricide-only\r\n\tboardWithDeadEntity\r\n\t\t.filter((e) => e.additionalCards?.includes(CardIds.FlesheatingGhoulLegacy_BG26_tt_004))\r\n\t\t.forEach((e) => {\r\n\t\t\tmodifyStats(e, null, 1, 0, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t});\r\n\r\n\tapplyRotHideGnollEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\r\n\t// Overkill\r\n\tif (\r\n\t\tdeadEntity.health < 0 &&\r\n\t\tgameState.sharedState.currentAttackerEntityId != null &&\r\n\t\tgameState.sharedState.currentAttackerEntityId === deadEntity.lastAffectedByEntity?.entityId\r\n\t) {\r\n\t\tif (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_BGS_032) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToMinion(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t3,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_TB_BaconUps_103) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToMinion(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t6,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental && deadEntity.lastAffectedByEntity.attacking) {\r\n\t\t// \t// } else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental) {\r\n\t\t// \t// console.log('applying WildfireElemental effect', stringifySimple(boardWithDeadEntity, allCards));\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \t// Prevent propagation of the effect\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\t// \tif (neighbours.length > 0) {\r\n\t\t// \t\tconst randomTarget = neighbours[Math.floor(Math.random() * neighbours.length)];\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\trandomTarget,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t);\r\n\t\t// \t}\r\n\t\t// } else if (\r\n\t\t// \tdeadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElementalBattlegrounds &&\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking\r\n\t\t// ) {\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \tneighbours.forEach((neighbour) =>\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\tneighbour,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t),\r\n\t\t// \t);\r\n\t\t// }\r\n\t\telse if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TRL_232) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TRL_232t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TB_BaconUps_051) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TB_BaconUps_051t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_BGS_080) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) =>\r\n\t\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tRace.PIRATE,\r\n\t\t\t\t\t\tgameState.anomalies,\r\n\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\tpirate,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t2,\r\n\t\t\t\t\t2,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_TB_BaconUps_142) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) =>\r\n\t\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tRace.PIRATE,\r\n\t\t\t\t\t\tgameState.anomalies,\r\n\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\tpirate,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t4,\r\n\t\t\t\t\t4,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/** @deprecated */\r\nexport const dealDamageToAllMinions = (\r\n\tboard1: BoardEntity[],\r\n\tboard1Hero: BgsPlayerEntity,\r\n\tboard2: BoardEntity[],\r\n\tboard2Hero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity,\r\n\tdamageDealt: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (board1.length === 0 && board2.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\tfor (let i = 0; i < board1.length; i++) {\r\n\t\tdealDamageToMinion(board1[i], board1, board1Hero, damageSource, damageDealt, board2, board2Hero, gameState);\r\n\t}\r\n\tfor (let i = 0; i < board2.length; i++) {\r\n\t\tdealDamageToMinion(board2[i], board2, board2Hero, damageSource, damageDealt, board1, board1Hero, gameState);\r\n\t}\r\n};\r\n\r\nconst applySoulJugglerEffect = (\r\n\tboardWithJugglers: BoardEntity[],\r\n\tboardWithJugglersHero: BgsPlayerEntity,\r\n\tboardToAttack: BoardEntity[],\r\n\tboardToAttackHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (boardWithJugglers.length === 0 && boardToAttack.length === 0) {\r\n\t\treturn;\r\n\t\t// return [boardWithJugglers, boardToAttack];\r\n\t}\r\n\tconst jugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_BGS_002);\r\n\tfor (const juggler of jugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\tconst goldenJugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_TB_BaconUps_075);\r\n\tfor (const juggler of goldenJugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\t// processMinionDeath(\r\n\t// \tboardWithJugglers,\r\n\t// \tboardWithJugglersHero,\r\n\t// \tboardToAttack,\r\n\t// \tboardToAttackHero,\r\n\t// \tallCards,\r\n\t// \tcardsData,\r\n\t// \tsharedState,\r\n\t// \tspectator,\r\n\t// );\r\n};\r\n\r\nconst applyScavengingHyenaEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// const copy = [...board];\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.ScavengingHyenaLegacy_BG_EX1_531) {\r\n\t\t\tmodifyStats(board[i], null, 2, 1, board, boardWithDeadEntityHero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t} else if (board[i].cardId === CardIds.ScavengingHyenaLegacy_TB_BaconUps_043) {\r\n\t\t\tmodifyStats(board[i], null, 4, 2, board, boardWithDeadEntityHero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyEternalKnightEffect = (board: BoardEntity[], hero: BgsPlayerEntity, gameState: FullGameState): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008_G\r\n\t\t) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tmodifyStats(board[i], null, multiplier * 1, multiplier * 1, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyRotHideGnollEffect = (board: BoardEntity[], hero: BgsPlayerEntity, gameState: FullGameState): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.RotHideGnoll_BG25_013 || board[i].cardId === CardIds.RotHideGnoll_BG25_013_G) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tmodifyStats(board[i], null, multiplier * 1, 0, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyBristlemaneScrapsmithEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardPlayerEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707 ||\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707_G\r\n\t\t) {\r\n\t\t\tconst cardsToAdd = Array(CardIds.BristlemaneScrapsmith_BG24_707_G ? 2 : 1).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardPlayerEntity, board, cardsToAdd, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, boardPlayerEntity, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyMossOfTheSchlossEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tboard\r\n\t\t.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MossOfTheSchloss_BG30_111 || e.cardId === CardIds.MossOfTheSchloss_BG30_111_G,\r\n\t\t)\r\n\t\t.filter((e) => e.abiityChargesLeft > 0)\r\n\t\t.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, null, deadEntity.maxAttack, deadEntity.maxHealth, board, hero, gameState);\r\n\t\t\tentity.abiityChargesLeft--;\r\n\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, null, null);\r\n\t\t});\r\n};\r\n\r\nconst applyJunkbotEffect = (board: BoardEntity[], hero: BgsPlayerEntity, gameState: FullGameState): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.Junkbot_GVG_106) {\r\n\t\t\tmodifyStats(board[i], board[i], 2, 2, board, hero, gameState);\r\n\t\t} else if (board[i].cardId === CardIds.Junkbot_TB_BaconUps_046) {\r\n\t\t\tmodifyStats(board[i], board[i], 4, 4, board, hero, gameState);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyQirajiHarbringerEffect = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst qiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_BGS_112);\r\n\tconst goldenQiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_TB_BaconUps_303);\r\n\r\n\t// TODO: if reactivated, properly apply buffs one by one, instead of all together\r\n\tif (qiraji.length + goldenQiraji.length > 0) {\r\n\t\tconst neighbours = getNeighbours(board, null, deadEntityIndexFromRight);\r\n\t\tconst buff = 2 * qiraji.length + 4 * goldenQiraji.length;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, null, buff, buff, board, hero, gameState);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const applyMonstrosity = (\r\n\tmonstrosity: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tboardWithDeadEntities: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (const deadEntity of deadEntities) {\r\n\t\tmodifyStats(monstrosity, null, deadEntity.attack, 0, boardWithDeadEntities, boardWithDeadEntityHero, gameState);\r\n\t\tif (monstrosity.cardId === CardIds.Monstrosity_BG20_HERO_282_Buddy_G) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmonstrosity,\r\n\t\t\t\tnull,\r\n\t\t\t\tdeadEntity.attack,\r\n\t\t\t\t0,\r\n\t\t\t\tboardWithDeadEntities,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const rememberDeathrattles = (\r\n\tfish: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tif (!deadEntities?.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Some infinite loops going on?\r\n\tif (fish.rememberedDeathrattles?.length > 100) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst validDeathrattles = deadEntities\r\n\t\t.filter(\r\n\t\t\t(entity) =>\r\n\t\t\t\tallCards.getCard(entity.cardId).mechanics?.includes(GameTag[GameTag.DEATHRATTLE]) &&\r\n\t\t\t\t// Fish are handled via remembered deathrattles\r\n\t\t\t\t!isFish(entity),\r\n\t\t)\r\n\t\t.filter((e) => !DEATHRATTLES_REQUIRE_MEMORY.includes(e.cardId as CardIds) || e.memory)\r\n\t\t.map((entity) => ({\r\n\t\t\tcardId: entity.cardId,\r\n\t\t\trepeats: 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\tmemory: entity.memory,\r\n\t\t}));\r\n\tconst validEnchantments = deadEntities\r\n\t\t.filter((entity) => entity.enchantments?.length)\r\n\t\t.map((entity) => entity.enchantments)\r\n\t\t.reduce((a, b) => a.concat(b), [])\r\n\t\t.flatMap((enchantment) => ({\r\n\t\t\tcardId: enchantment.cardId,\r\n\t\t\trepeats: enchantment.repeats ?? 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t}))\r\n\t\t.filter((enchantment) => isValidDeathrattleEnchantment(enchantment.cardId));\r\n\t// Multiple fish\r\n\tconst deadEntityRememberedDeathrattles =\r\n\t\tdeadEntities\r\n\t\t\t.filter((e) => !!e.rememberedDeathrattles?.length)\r\n\t\t\t// If the fish has reborn, it will inherit its own Deathrattles, and we don't want that\r\n\t\t\t.filter((e) => e.entityId !== fish.rebornFromEntityId)\r\n\t\t\t.filter((e) => !DEATHRATTLES_REQUIRE_MEMORY.includes(e.cardId as CardIds) || e.memory)\r\n\t\t\t.flatMap((e) => e.rememberedDeathrattles) ?? [];\r\n\tconst newDeathrattles = [...validDeathrattles, ...validEnchantments, ...deadEntityRememberedDeathrattles];\r\n\r\n\tif (newDeathrattles.length > 0) {\r\n\t\t// Order is important - the DR are triggered in the order d the minions have died\r\n\t\tif (isGolden(fish.cardId, allCards)) {\r\n\t\t\t// https://stackoverflow.com/questions/33305152/how-to-duplicate-elements-in-a-js-array\r\n\t\t\tconst doubleDr = newDeathrattles.reduce((res, current) => res.concat([current, current]), []);\r\n\t\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...doubleDr];\r\n\t\t} else {\r\n\t\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...newDeathrattles];\r\n\t\t}\r\n\r\n\t\tif (newDeathrattles.some((d) => d.cardId?.startsWith(CardIds.Leapfrogger_BG21_000))) {\r\n\t\t\t// Not sure exactly why, but if a leapfrogger dies first, then a manasaber,\r\n\t\t\t// when the fish dies, the manasaber's effect (spawning tokens) is triggered first\r\n\t\t\t// https://replays.firestoneapp.com/?reviewId=521733fb-8ba1-4663-9a87-3da58e8a09c8&turn=21&action=3\r\n\t\t\t// HACK: So I will hardcode a rule for now to put leapfrogger effects last\r\n\t\t\tconst leapfroggerDeathrattles = groupLeapfroggerDeathrattles(fish.rememberedDeathrattles);\r\n\t\t\tfish.rememberedDeathrattles = [\r\n\t\t\t\t...fish.rememberedDeathrattles.filter((d) => !d.cardId?.startsWith(CardIds.Leapfrogger_BG21_000)),\r\n\t\t\t\t...leapfroggerDeathrattles,\r\n\t\t\t];\r\n\t\t}\r\n\t}\r\n\t// console.debug(\r\n\t// \t'remembered',\r\n\t// \tfish.cardId,\r\n\t// \tfish.entityId,\r\n\t// \tfish.rememberedDeathrattles.map((d) => ({\r\n\t// \t\tcardId: d.cardId,\r\n\t// \t\tname: allCards.getCard(d.cardId)?.name,\r\n\t// \t\t// repeats: d.repeats,\r\n\t// \t\t// timing: d.timing,\r\n\t// \t})),\r\n\t// );\r\n};\r\n\r\nconst removeOldMurkEyeAttack = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst murkeyes = boardWithDeadEntity.filter(\r\n\t\t(entity) => entity.cardId === CardIds.OldMurkEyeLegacy || entity.cardId === CardIds.OldMurkEyeVanilla,\r\n\t);\r\n\tconst goldenMurkeyes = boardWithDeadEntity.filter((entity) => entity.cardId === CardIds.OldMurkEye);\r\n\tmurkeyes.forEach((entity) => {\r\n\t\tmodifyStats(entity, null, -1, 0, boardWithDeadEntity, hero, gameState);\r\n\t});\r\n\tgoldenMurkeyes.forEach((entity) => {\r\n\t\tmodifyStats(entity, null, -2, 0, boardWithDeadEntity, hero, gameState);\r\n\t});\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"deathrattle-effects.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-effects.ts"],"names":[],"mappings":";;;AACA,iEAAuF;AAIvF,6CAAgD;AAChD,6CAA4E;AAC5E,gEAAuE;AACvE,oCAAuF;AACvF,qCAAsF;AACtF,mDAAiD;AACjD,6DAA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OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC3B,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACjC,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { AllCardsService, CardIds, GameTag, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData } from '../cards/cards-data';\r\nimport { updateTaunt } from '../keywords/taunt';\r\nimport { pickMultipleRandomDifferent, pickRandom } from '../services/utils';\r\nimport { isValidDeathrattleEnchantment } from '../simulate-bgs-battle';\r\nimport { grantRandomStats, hasCorrectTribe, isDead, isFish, isGolden } from '../utils';\r\nimport { dealDamageToMinion, dealDamageToRandomEnemy, getNeighbours } from './attack';\r\nimport { addCardsInHand } from './cards-in-hand';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { groupLeapfroggerDeathrattles } from './remembered-deathrattle';\r\nimport { SharedState } from './shared-state';\r\nimport { modifyStats } from './stats';\r\n\r\nconst DEATHRATTLES_REQUIRE_MEMORY = [CardIds.StitchedSalvager_BG31_999, CardIds.StitchedSalvager_BG31_999_G];\r\n\r\nexport const computeDeathrattleMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst rivendare =\r\n\t\t!!board.find(\r\n\t\t\t(entity) =>\r\n\t\t\t\tentity.cardId === CardIds.BaronRivendare_BG_FP1_031 ||\r\n\t\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t\t) || boardHero.secrets?.some((e) => e.cardId === CardIds.TitusTribute_BG28_843);\r\n\tconst goldenRivendare = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BaronRivendare_TB_BaconUps_055 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst titus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354).length;\r\n\tconst goldenTitus = board.filter((entity) => entity.cardId === CardIds.TitusRivendare_BG25_354_G).length;\r\n\tconst deathlyPhylacteries = boardHero.trinkets.filter(\r\n\t\t(t) => t.cardId === CardIds.DeathlyPhylactery_BG30_MagicItem_700 && t.scriptDataNum1 > 0,\r\n\t).length;\r\n\tconst tombs =\r\n\t\tboardHero.questRewardEntities?.filter((entity) => entity.cardId === CardIds.TurbulentTombs)?.length ?? 0;\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\tconst scourgeMultiplier = deadEntity.additionalCards?.includes(CardIds.ScourgeTroll) ? 2 : 1;\r\n\r\n\tconst multiplier =\r\n\t\tscourgeMultiplier *\r\n\t\t((goldenRivendare ? 3 : rivendare ? 2 : 1) +\r\n\t\t\tdeathlyPhylacteries +\r\n\t\t\ttitus +\r\n\t\t\t2 * goldenTitus +\r\n\t\t\ttombs +\r\n\t\t\techoesOfArgus);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const applyLightningInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Because the golden version doubles all the remembered effects\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst targets = pickMultipleRandomDifferent(otherBoard, 5);\r\n\t\tfor (const target of targets) {\r\n\t\t\tdealDamageToMinion(\r\n\t\t\t\ttarget,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tdeadEntity,\r\n\t\t\t\t1,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyWaterInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity, // Can be null when trinket is used\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst validBoard = boardWithDeadEntity.filter((e) => e.health > 0 && !e.definitelyDead);\r\n\t\tconst target: BoardEntity = validBoard[validBoard.length - 1];\r\n\t\tif (!!target) {\r\n\t\t\tupdateTaunt(target, true, boardWithDeadEntity, boardWithDeadEntityHero, otherHero, gameState);\r\n\t\t\tmodifyStats(target, sourceEntity, 0, 3, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyFireInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst target: BoardEntity = boardWithDeadEntity.filter((e) => e.health > 0 && !e.definitelyDead)[0];\r\n\t\tif (!!target) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\ttarget,\r\n\t\t\t\tsourceEntity,\r\n\t\t\t\ttarget.attack,\r\n\t\t\t\t0,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const applyEarthInvocationEnchantment = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tdeadEntity: BoardEntity,\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst multiplier = deadEntity?.cardId === CardIds.SpiritRaptor_BG22_HERO_001_Buddy_G ? 2 : 1;\r\n\tfor (let i = 0; i < multiplier; i++) {\r\n\t\tconst minionsGrantedDeathrattle: BoardEntity[] = pickMultipleRandomDifferent(boardWithDeadEntity, 4);\r\n\t\tminionsGrantedDeathrattle.forEach((minion) => {\r\n\t\t\tminion.enchantments.push({\r\n\t\t\t\tcardId: CardIds.EarthInvocation_ElementEarthEnchantment,\r\n\t\t\t\toriginEntityId: deadEntity?.entityId,\r\n\t\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t\t});\r\n\t\t\tgameState.spectator.registerPowerTarget(sourceEntity, minion, boardWithDeadEntity, null, null);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const applyLeapFroggerEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tgameState: FullGameState,\r\n\tmultiplier: number,\r\n): void => {\r\n\tmultiplier = multiplier ?? deadEntity.deathrattleRepeats ?? 1;\r\n\t// console.debug('applying leapfrogger effect', deadEntity.entityId, multiplier);\r\n\tconst buffed = grantRandomStats(\r\n\t\tdeadEntity,\r\n\t\tboardWithDeadEntity,\r\n\t\tboardWithDeadEntityHero,\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tmultiplier * (isPremium ? 2 : 1),\r\n\t\tRace.BEAST,\r\n\t\tfalse,\r\n\t\tgameState,\r\n\t);\r\n\tif (buffed) {\r\n\t\tbuffed.enchantments = buffed.enchantments ?? [];\r\n\t\tbuffed.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000_Ge\r\n\t\t\t\t: CardIds.Leapfrogger_LeapfrogginEnchantment_BG21_000e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const applyRecurringNightmareDeathrattleEffect = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tdeadEntity: BoardEntity,\r\n\tisPremium: boolean,\r\n\tgameState: FullGameState,\r\n\tmultiplier = 1,\r\n): void => {\r\n\tmultiplier = multiplier || 1;\r\n\tconst target = pickRandom(\r\n\t\tboardWithDeadEntity\r\n\t\t\t.filter((e) =>\r\n\t\t\t\thasCorrectTribe(e, boardWithDeadEntityHero, Race.UNDEAD, gameState.anomalies, gameState.allCards),\r\n\t\t\t)\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055 &&\r\n\t\t\t\t\te.cardId !== CardIds.RecurringNightmare_BG26_055_G,\r\n\t\t\t),\r\n\t);\r\n\tif (target) {\r\n\t\ttarget.enchantments = target.enchantments ?? [];\r\n\t\ttarget.enchantments.push({\r\n\t\t\tcardId: isPremium\r\n\t\t\t\t? CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055_Ge\r\n\t\t\t\t: CardIds.RecurringNightmare_NightmareInsideEnchantment_BG26_055e,\r\n\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\trepeats: multiplier > 1 ? multiplier : 1,\r\n\t\t\ttiming: gameState.sharedState.currentEntityId++,\r\n\t\t});\r\n\t\tgameState.spectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity, null, null);\r\n\t}\r\n};\r\n\r\n// Some minions like Icesnarl can revive themselves when killing a minion, so it needs to be handled before\r\n// we actually make the minion die\r\nexport const handleWheneverMinionsKillEffect = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\thandleWheneverMinionsKillEffectForBoard(board, hero, otherBoard, otherHero, gameState);\r\n\t// It's called once for each board already, so don't duplicate it here\r\n\t// handleWheneverMinionsKillEffectForBoard(otherBoard, otherHero, board, hero, gameState);\r\n};\r\n\r\nconst handleWheneverMinionsKillEffectForBoard = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].health <= 0 || board[i].definitelyDead) {\r\n\t\t\tconst futureDeadEntity = board[i];\r\n\t\t\tconst killer = futureDeadEntity.lastAffectedByEntity;\r\n\t\t\tif (!killer) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Killed an enemy minion\r\n\t\t\tif (killer.friendly !== futureDeadEntity.friendly) {\r\n\t\t\t\tfor (const heroPower of otherHero.heroPowers) {\r\n\t\t\t\t\t// Can't be used to resurrect a dead minion\r\n\t\t\t\t\t// https://replays.firestoneapp.com/?reviewId=d1fffee8-0bc3-40f5-9a59-85eef8367095&turn=11&action=4\r\n\t\t\t\t\tif (heroPower.cardId === CardIds.Rokara_GloryOfCombat && !isDead(killer)) {\r\n\t\t\t\t\t\tmodifyStats(killer, otherHero, 1, 0, otherBoard, otherHero, gameState);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Icesnarl the Mighty\r\n\t\t\t\totherBoard\r\n\t\t\t\t\t.filter(\r\n\t\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\t\te.cardId === CardIds.IcesnarlTheMighty_BG20_HERO_100_Buddy ||\r\n\t\t\t\t\t\t\te.cardId === CardIds.IcesnarlTheMighty_BG20_HERO_100_Buddy_G,\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.forEach((icesnarl) => {\r\n\t\t\t\t\t\tmodifyStats(\r\n\t\t\t\t\t\t\ticesnarl,\r\n\t\t\t\t\t\t\ticesnarl,\r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\ticesnarl.cardId === CardIds.IcesnarlTheMighty_BG20_HERO_100_Buddy_G ? 2 : 1,\r\n\t\t\t\t\t\t\tboard,\r\n\t\t\t\t\t\t\thero,\r\n\t\t\t\t\t\t\tgameState,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleAfterMinionKillsEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Moved to \"whenever kills\", as these can revive the minion that kills\r\n\t// const killer = deadEntity.lastAffectedByEntity;\r\n\t// if (!killer) {\r\n\t// \treturn;\r\n\t// }\r\n\t// // Killed an enemy minion\r\n\t// if (killer.friendly !== deadEntity.friendly) {\r\n\t// }\r\n};\r\n\r\nexport const applyWheneverMinionDiesEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// console.log('applying minion death effect', stringifySimpleCard(deadEntity, allCards));\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.BEAST, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplyScavengingHyenaEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.DEMON, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplySoulJugglerEffect(boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.MECH, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplyJunkbotEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.MURLOC, gameState.anomalies, gameState.allCards)) {\r\n\t\tremoveOldMurkEyeAttack(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\tremoveOldMurkEyeAttack(otherBoard, otherBoardHero, gameState);\r\n\t}\r\n\tif (hasCorrectTribe(deadEntity, boardWithDeadEntityHero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards)) {\r\n\t\tapplyMossOfTheSchlossEffect(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\r\n\tif (deadEntity.taunt) {\r\n\t\tapplyBristlemaneScrapsmithEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\tapplyQirajiHarbringerEffect(boardWithDeadEntity, boardWithDeadEntityHero, deadEntityIndexFromRight, gameState);\r\n\t}\r\n\r\n\tif (\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\tdeadEntity.cardId === CardIds.EternalKnight_BG25_008_G\r\n\t) {\r\n\t\tapplyEternalKnightEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t}\r\n\r\n\t// Putricide-only\r\n\tboardWithDeadEntity\r\n\t\t.filter((e) => e.additionalCards?.includes(CardIds.FlesheatingGhoulLegacy_BG26_tt_004))\r\n\t\t.forEach((e) => {\r\n\t\t\tmodifyStats(e, null, 1, 0, boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\t\t});\r\n\r\n\tapplyRotHideGnollEffect(boardWithDeadEntity, boardWithDeadEntityHero, gameState);\r\n\r\n\t// Overkill\r\n\tif (\r\n\t\tdeadEntity.health < 0 &&\r\n\t\tgameState.sharedState.currentAttackerEntityId != null &&\r\n\t\tgameState.sharedState.currentAttackerEntityId === deadEntity.lastAffectedByEntity?.entityId\r\n\t) {\r\n\t\tif (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_BGS_032) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToMinion(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t3,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.HeraldOfFlame_TB_BaconUps_103) {\r\n\t\t\tconst targets = boardWithDeadEntity.filter((entity) => entity.health > 0 && !entity.definitelyDead);\r\n\t\t\tif (targets.length > 0) {\r\n\t\t\t\tconst target = targets[0];\r\n\t\t\t\tdealDamageToMinion(\r\n\t\t\t\t\ttarget,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t6,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental && deadEntity.lastAffectedByEntity.attacking) {\r\n\t\t// \t// } else if (deadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElemental) {\r\n\t\t// \t// console.log('applying WildfireElemental effect', stringifySimple(boardWithDeadEntity, allCards));\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \t// Prevent propagation of the effect\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \t// console.log('neighbours', stringifySimple(neighbours, allCards));\r\n\t\t// \tif (neighbours.length > 0) {\r\n\t\t// \t\tconst randomTarget = neighbours[Math.floor(Math.random() * neighbours.length)];\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\trandomTarget,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t);\r\n\t\t// \t}\r\n\t\t// } else if (\r\n\t\t// \tdeadEntity.lastAffectedByEntity.cardId === CardIds.WildfireElementalBattlegrounds &&\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking\r\n\t\t// ) {\r\n\t\t// \tconst excessDamage = -deadEntity.health;\r\n\t\t// \tdeadEntity.lastAffectedByEntity.attacking = false;\r\n\t\t// \tconst neighbours = getNeighbours(boardWithDeadEntity, null, boardWithDeadEntity.length - deadEntityIndexFromRight);\r\n\t\t// \tneighbours.forEach((neighbour) =>\r\n\t\t// \t\tdealDamageToEnemy(\r\n\t\t// \t\t\tneighbour,\r\n\t\t// \t\t\tboardWithDeadEntity,\r\n\t\t// \t\t\tboardWithDeadEntityHero,\r\n\t\t// \t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t// \t\t\texcessDamage,\r\n\t\t// \t\t\totherBoard,\r\n\t\t// \t\t\totherBoardHero,\r\n\t\t// \t\t\tallCards,\r\n\t\t// \t\t\tcardsData,\r\n\t\t// \t\t\tsharedState,\r\n\t\t// \t\t\tspectator,\r\n\t\t// \t\t),\r\n\t\t// \t);\r\n\t\t// }\r\n\t\telse if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TRL_232) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TRL_232t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.IronhideDirehorn_TB_BaconUps_051) {\r\n\t\t\tconst newEntities = spawnEntities(\r\n\t\t\t\tCardIds.IronhideDirehorn_IronhideRuntToken_TB_BaconUps_051t,\r\n\t\t\t\t1,\r\n\t\t\t\totherBoard,\r\n\t\t\t\totherBoardHero,\r\n\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t\t!deadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t\totherBoard.splice(otherBoard.length - deadEntityIndexFromRight, 0, ...newEntities);\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_BGS_080) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) =>\r\n\t\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tRace.PIRATE,\r\n\t\t\t\t\t\tgameState.anomalies,\r\n\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\tpirate,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t2,\r\n\t\t\t\t\t2,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t} else if (deadEntity.lastAffectedByEntity.cardId === CardIds.SeabreakerGoliath_TB_BaconUps_142) {\r\n\t\t\tconst otherPirates = otherBoard\r\n\t\t\t\t.filter((entity) =>\r\n\t\t\t\t\thasCorrectTribe(\r\n\t\t\t\t\t\tentity,\r\n\t\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\t\tRace.PIRATE,\r\n\t\t\t\t\t\tgameState.anomalies,\r\n\t\t\t\t\t\tgameState.allCards,\r\n\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.filter((entity) => entity.entityId !== deadEntity.lastAffectedByEntity.entityId);\r\n\t\t\totherPirates.forEach((pirate) => {\r\n\t\t\t\tmodifyStats(\r\n\t\t\t\t\tpirate,\r\n\t\t\t\t\tdeadEntity.lastAffectedByEntity,\r\n\t\t\t\t\t4,\r\n\t\t\t\t\t4,\r\n\t\t\t\t\tboardWithDeadEntity,\r\n\t\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\t\tgameState,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/** @deprecated */\r\nexport const dealDamageToAllMinions = (\r\n\tboard1: BoardEntity[],\r\n\tboard1Hero: BgsPlayerEntity,\r\n\tboard2: BoardEntity[],\r\n\tboard2Hero: BgsPlayerEntity,\r\n\tdamageSource: BoardEntity,\r\n\tdamageDealt: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (board1.length === 0 && board2.length === 0) {\r\n\t\treturn;\r\n\t}\r\n\tfor (let i = 0; i < board1.length; i++) {\r\n\t\tdealDamageToMinion(board1[i], board1, board1Hero, damageSource, damageDealt, board2, board2Hero, gameState);\r\n\t}\r\n\tfor (let i = 0; i < board2.length; i++) {\r\n\t\tdealDamageToMinion(board2[i], board2, board2Hero, damageSource, damageDealt, board1, board1Hero, gameState);\r\n\t}\r\n};\r\n\r\nconst applySoulJugglerEffect = (\r\n\tboardWithJugglers: BoardEntity[],\r\n\tboardWithJugglersHero: BgsPlayerEntity,\r\n\tboardToAttack: BoardEntity[],\r\n\tboardToAttackHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (boardWithJugglers.length === 0 && boardToAttack.length === 0) {\r\n\t\treturn;\r\n\t\t// return [boardWithJugglers, boardToAttack];\r\n\t}\r\n\tconst jugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_BGS_002);\r\n\tfor (const juggler of jugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\tconst goldenJugglers = boardWithJugglers.filter((entity) => entity.cardId === CardIds.SoulJuggler_TB_BaconUps_075);\r\n\tfor (const juggler of goldenJugglers) {\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tboardToAttack,\r\n\t\t\tboardToAttackHero,\r\n\t\t\tjuggler,\r\n\t\t\t3,\r\n\t\t\tboardWithJugglers,\r\n\t\t\tboardWithJugglersHero,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\t// processMinionDeath(\r\n\t// \tboardWithJugglers,\r\n\t// \tboardWithJugglersHero,\r\n\t// \tboardToAttack,\r\n\t// \tboardToAttackHero,\r\n\t// \tallCards,\r\n\t// \tcardsData,\r\n\t// \tsharedState,\r\n\t// \tspectator,\r\n\t// );\r\n};\r\n\r\nconst applyScavengingHyenaEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// const copy = [...board];\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.ScavengingHyenaLegacy_BG_EX1_531) {\r\n\t\t\tmodifyStats(board[i], null, 2, 1, board, boardWithDeadEntityHero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t} else if (board[i].cardId === CardIds.ScavengingHyenaLegacy_TB_BaconUps_043) {\r\n\t\t\tmodifyStats(board[i], null, 4, 2, board, boardWithDeadEntityHero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyEternalKnightEffect = (board: BoardEntity[], hero: BgsPlayerEntity, gameState: FullGameState): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008 ||\r\n\t\t\tboard[i].cardId === CardIds.EternalKnight_BG25_008_G\r\n\t\t) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tmodifyStats(board[i], null, multiplier * 1, multiplier * 1, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyRotHideGnollEffect = (board: BoardEntity[], hero: BgsPlayerEntity, gameState: FullGameState): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.RotHideGnoll_BG25_013 || board[i].cardId === CardIds.RotHideGnoll_BG25_013_G) {\r\n\t\t\tconst multiplier = board[i].cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tmodifyStats(board[i], null, multiplier * 1, 0, board, hero, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, null, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyBristlemaneScrapsmithEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardPlayerEntity: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707 ||\r\n\t\t\tboard[i].cardId === CardIds.BristlemaneScrapsmith_BG24_707_G\r\n\t\t) {\r\n\t\t\tconst cardsToAdd = Array(CardIds.BristlemaneScrapsmith_BG24_707_G ? 2 : 1).fill(CardIds.BloodGem);\r\n\t\t\taddCardsInHand(boardPlayerEntity, board, cardsToAdd, gameState);\r\n\t\t\tgameState.spectator.registerPowerTarget(board[i], board[i], board, boardPlayerEntity, null);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyMossOfTheSchlossEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tboard\r\n\t\t.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MossOfTheSchloss_BG30_111 || e.cardId === CardIds.MossOfTheSchloss_BG30_111_G,\r\n\t\t)\r\n\t\t.filter((e) => e.abiityChargesLeft > 0)\r\n\t\t.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, null, deadEntity.maxAttack, deadEntity.maxHealth, board, hero, gameState);\r\n\t\t\tentity.abiityChargesLeft--;\r\n\t\t\tgameState.spectator.registerPowerTarget(entity, entity, board, null, null);\r\n\t\t});\r\n};\r\n\r\nconst applyJunkbotEffect = (board: BoardEntity[], hero: BgsPlayerEntity, gameState: FullGameState): void => {\r\n\tfor (let i = 0; i < board.length; i++) {\r\n\t\tif (board[i].cardId === CardIds.Junkbot_GVG_106) {\r\n\t\t\tmodifyStats(board[i], board[i], 2, 2, board, hero, gameState);\r\n\t\t} else if (board[i].cardId === CardIds.Junkbot_TB_BaconUps_046) {\r\n\t\t\tmodifyStats(board[i], board[i], 4, 4, board, hero, gameState);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyQirajiHarbringerEffect = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tdeadEntityIndexFromRight: number,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tconst qiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_BGS_112);\r\n\tconst goldenQiraji = board.filter((entity) => entity.cardId === CardIds.QirajiHarbinger_TB_BaconUps_303);\r\n\r\n\t// TODO: if reactivated, properly apply buffs one by one, instead of all together\r\n\tif (qiraji.length + goldenQiraji.length > 0) {\r\n\t\tconst neighbours = getNeighbours(board, null, deadEntityIndexFromRight);\r\n\t\tconst buff = 2 * qiraji.length + 4 * goldenQiraji.length;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyStats(entity, null, buff, buff, board, hero, gameState);\r\n\t\t});\r\n\t}\r\n};\r\n\r\nexport const applyMonstrosity = (\r\n\tmonstrosity: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tboardWithDeadEntities: BoardEntity[],\r\n\tboardWithDeadEntityHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tfor (const deadEntity of deadEntities) {\r\n\t\tmodifyStats(monstrosity, null, deadEntity.attack, 0, boardWithDeadEntities, boardWithDeadEntityHero, gameState);\r\n\t\tif (monstrosity.cardId === CardIds.Monstrosity_BG20_HERO_282_Buddy_G) {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmonstrosity,\r\n\t\t\t\tnull,\r\n\t\t\t\tdeadEntity.attack,\r\n\t\t\t\t0,\r\n\t\t\t\tboardWithDeadEntities,\r\n\t\t\t\tboardWithDeadEntityHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const rememberDeathrattles = (\r\n\tfish: BoardEntity,\r\n\tdeadEntities: readonly BoardEntity[],\r\n\tcardsData: CardsData,\r\n\tallCards: AllCardsService,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tif (!deadEntities?.length) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Some infinite loops going on?\r\n\tif (fish.rememberedDeathrattles?.length > 100) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst validDeathrattles = deadEntities\r\n\t\t.filter(\r\n\t\t\t(entity) =>\r\n\t\t\t\tallCards.getCard(entity.cardId).mechanics?.includes(GameTag[GameTag.DEATHRATTLE]) &&\r\n\t\t\t\t// Fish are handled via remembered deathrattles\r\n\t\t\t\t!isFish(entity),\r\n\t\t)\r\n\t\t.filter((e) => !DEATHRATTLES_REQUIRE_MEMORY.includes(e.cardId as CardIds) || e.memory)\r\n\t\t.map((entity) => ({\r\n\t\t\tcardId: entity.cardId,\r\n\t\t\trepeats: 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\tmemory: entity.memory,\r\n\t\t}));\r\n\tconst validEnchantments = deadEntities\r\n\t\t.filter((entity) => entity.enchantments?.length)\r\n\t\t.map((entity) => entity.enchantments)\r\n\t\t.reduce((a, b) => a.concat(b), [])\r\n\t\t.flatMap((enchantment) => ({\r\n\t\t\tcardId: enchantment.cardId,\r\n\t\t\trepeats: enchantment.repeats ?? 1,\r\n\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t}))\r\n\t\t.filter((enchantment) => isValidDeathrattleEnchantment(enchantment.cardId));\r\n\t// Multiple fish\r\n\tconst deadEntityRememberedDeathrattles =\r\n\t\tdeadEntities\r\n\t\t\t.filter((e) => !!e.rememberedDeathrattles?.length)\r\n\t\t\t// If the fish has reborn, it will inherit its own Deathrattles, and we don't want that\r\n\t\t\t.filter((e) => e.entityId !== fish.rebornFromEntityId)\r\n\t\t\t.filter((e) => !DEATHRATTLES_REQUIRE_MEMORY.includes(e.cardId as CardIds) || e.memory)\r\n\t\t\t.flatMap((e) => e.rememberedDeathrattles) ?? [];\r\n\tconst newDeathrattles = [...validDeathrattles, ...validEnchantments, ...deadEntityRememberedDeathrattles];\r\n\r\n\tif (newDeathrattles.length > 0) {\r\n\t\t// Order is important - the DR are triggered in the order d the minions have died\r\n\t\tif (isGolden(fish.cardId, allCards)) {\r\n\t\t\t// https://stackoverflow.com/questions/33305152/how-to-duplicate-elements-in-a-js-array\r\n\t\t\tconst doubleDr = newDeathrattles.reduce((res, current) => res.concat([current, current]), []);\r\n\t\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...doubleDr];\r\n\t\t} else {\r\n\t\t\tfish.rememberedDeathrattles = [...(fish.rememberedDeathrattles || []), ...newDeathrattles];\r\n\t\t}\r\n\r\n\t\tif (newDeathrattles.some((d) => d.cardId?.startsWith(CardIds.Leapfrogger_BG21_000))) {\r\n\t\t\t// Not sure exactly why, but if a leapfrogger dies first, then a manasaber,\r\n\t\t\t// when the fish dies, the manasaber's effect (spawning tokens) is triggered first\r\n\t\t\t// https://replays.firestoneapp.com/?reviewId=521733fb-8ba1-4663-9a87-3da58e8a09c8&turn=21&action=3\r\n\t\t\t// HACK: So I will hardcode a rule for now to put leapfrogger effects last\r\n\t\t\tconst leapfroggerDeathrattles = groupLeapfroggerDeathrattles(fish.rememberedDeathrattles);\r\n\t\t\tfish.rememberedDeathrattles = [\r\n\t\t\t\t...fish.rememberedDeathrattles.filter((d) => !d.cardId?.startsWith(CardIds.Leapfrogger_BG21_000)),\r\n\t\t\t\t...leapfroggerDeathrattles,\r\n\t\t\t];\r\n\t\t}\r\n\t}\r\n\t// console.debug(\r\n\t// \t'remembered',\r\n\t// \tfish.cardId,\r\n\t// \tfish.entityId,\r\n\t// \tfish.rememberedDeathrattles.map((d) => ({\r\n\t// \t\tcardId: d.cardId,\r\n\t// \t\tname: allCards.getCard(d.cardId)?.name,\r\n\t// \t\t// repeats: d.repeats,\r\n\t// \t\t// timing: d.timing,\r\n\t// \t})),\r\n\t// );\r\n};\r\n\r\nconst removeOldMurkEyeAttack = (\r\n\tboardWithDeadEntity: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tconst murkeyes = boardWithDeadEntity.filter(\r\n\t\t(entity) => entity.cardId === CardIds.OldMurkEyeLegacy || entity.cardId === CardIds.OldMurkEyeVanilla,\r\n\t);\r\n\tconst goldenMurkeyes = boardWithDeadEntity.filter((entity) => entity.cardId === CardIds.OldMurkEye);\r\n\tmurkeyes.forEach((entity) => {\r\n\t\tmodifyStats(entity, null, -1, 0, boardWithDeadEntity, hero, gameState);\r\n\t});\r\n\tgoldenMurkeyes.forEach((entity) => {\r\n\t\tmodifyStats(entity, null, -2, 0, boardWithDeadEntity, hero, gameState);\r\n\t});\r\n};\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onMinionFailedToSpawn = void 0;
|
|
4
|
+
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
4
5
|
const utils_1 = require("../utils");
|
|
5
6
|
const stats_1 = require("./stats");
|
|
6
7
|
const onMinionFailedToSpawn = (entity, board, hero, gameState) => {
|
|
@@ -20,8 +21,8 @@ const onMinionFailedToSpawn = (entity, board, hero, gameState) => {
|
|
|
20
21
|
board
|
|
21
22
|
.filter((e) => e.cardId === "BG30_129" || e.cardId === "BG30_129_G")
|
|
22
23
|
.forEach((crasher) => {
|
|
23
|
-
const
|
|
24
|
-
(0, utils_1.addStatsToAliveBoard)(crasher, board, hero,
|
|
24
|
+
const mult = crasher.cardId === "BG30_129" ? 1 : 2;
|
|
25
|
+
(0, utils_1.addStatsToAliveBoard)(crasher, board, hero, 2 * mult, 2 * mult, gameState, reference_data_1.Race[reference_data_1.Race.UNDEAD]);
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
28
|
exports.onMinionFailedToSpawn = onMinionFailedToSpawn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn-fail.js","sourceRoot":"","sources":["../../src/simulation/spawn-fail.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"spawn-fail.js","sourceRoot":"","sources":["../../src/simulation/spawn-fail.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAG7D,oCAAiE;AAEjE,mCAAsC;AAE/B,MAAM,qBAAqB,GAAG,CACpC,MAAmB,EACnB,KAAoB,EACpB,IAAqB,EACrB,SAAwB,EACvB,EAAE;IACH,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBA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AAC;AA9BW,QAAA,qBAAqB,yBA8BhC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { addStatsToAliveBoard, addStatsToBoard } from '../utils';\r\nimport { FullGameState } from './internal-game-state';\r\nimport { modifyStats } from './stats';\r\n\r\nexport const onMinionFailedToSpawn = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n) => {\r\n\tif (entity?.onCanceledSummon) {\r\n\t\tentity.onCanceledSummon();\r\n\t}\r\n\r\n\thero.trinkets\r\n\t\t.filter((t) => t.cardId === CardIds.MugOfTheSireToken_BG30_MagicItem_438t)\r\n\t\t.forEach((t) => addStatsToBoard(t, board, hero, 5, 0, gameState));\r\n\r\n\tboard\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.ThunderingAbomination_BG30_124 ||\r\n\t\t\t\te.cardId === CardIds.ThunderingAbomination_BG30_124_G,\r\n\t\t)\r\n\t\t.forEach((abom) => {\r\n\t\t\tconst abomStatsMultiplier = abom.cardId === CardIds.ThunderingAbomination_BG30_124_G ? 2 : 1;\r\n\t\t\tmodifyStats(abom, abom, abomStatsMultiplier * 3, abomStatsMultiplier * 3, board, hero, gameState);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.CatacombCrasher_BG30_129 || e.cardId === CardIds.CatacombCrasher_BG30_129_G)\r\n\t\t.forEach((crasher) => {\r\n\t\t\tconst mult = crasher.cardId === CardIds.CatacombCrasher_BG30_129 ? 1 : 2;\r\n\t\t\taddStatsToAliveBoard(crasher, board, hero, 2 * mult, 2 * mult, gameState, Race[Race.UNDEAD]);\r\n\t\t});\r\n};\r\n"]}
|
|
@@ -3,7 +3,7 @@ import { BoardEntity } from '../board-entity';
|
|
|
3
3
|
import { BoardSecret } from '../board-secret';
|
|
4
4
|
import { FullGameState } from './internal-game-state';
|
|
5
5
|
export declare const setEntityStats: (entity: BoardEntity, attack: number | null, health: number | null, board: BoardEntity[], boardHero: BgsPlayerEntity, gameState: FullGameState) => void;
|
|
6
|
-
export declare const modifyStats: (entity: BoardEntity, source: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower, attackAmount: number, healthAmount: number, friendlyBoard: BoardEntity[], friendlyBoardHero: BgsPlayerEntity, gameState: FullGameState, registerSpectator?: boolean) => void;
|
|
6
|
+
export declare const modifyStats: (entity: BoardEntity, source: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower, attackAmount: number, healthAmount: number, friendlyBoard: BoardEntity[], friendlyBoardHero: BgsPlayerEntity, gameState: FullGameState, registerSpectator?: boolean, isEnchantment?: boolean) => void;
|
|
7
7
|
export declare const applyAfterStatsUpdate: (gameState: FullGameState) => void;
|
|
8
8
|
export interface OnStatsChangedInput {
|
|
9
9
|
target: BoardEntity;
|
package/dist/simulation/stats.js
CHANGED
|
@@ -21,7 +21,7 @@ const setEntityStats = (entity, attack, health, board, boardHero, gameState) =>
|
|
|
21
21
|
(0, add_minion_to_board_1.applyAurasToSelf)(entity, board, boardHero, gameState);
|
|
22
22
|
};
|
|
23
23
|
exports.setEntityStats = setEntityStats;
|
|
24
|
-
const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard, friendlyBoardHero, gameState, registerSpectator = true) => {
|
|
24
|
+
const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard, friendlyBoardHero, gameState, registerSpectator = true, isEnchantment = true) => {
|
|
25
25
|
if (attackAmount === 0 && healthAmount === 0) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
@@ -41,10 +41,11 @@ const modifyStats = (entity, source, attackAmount, healthAmount, friendlyBoard,
|
|
|
41
41
|
? gameState.gameState.opponent.player
|
|
42
42
|
: gameState.gameState.player.player;
|
|
43
43
|
const neighbours = (0, attack_1.getNeighbours)(friendlyBoard, entity);
|
|
44
|
-
const poetMultipliers =
|
|
44
|
+
const poetMultipliers = isEnchantment &&
|
|
45
|
+
(0, utils_1.hasCorrectTribe)(entity, friendlyBoardHero, reference_data_1.Race.DRAGON, gameState.anomalies, gameState.allCards)
|
|
45
46
|
? neighbours.filter((e) => e.cardId === "BG29_813_G").length * 2 || 1
|
|
46
47
|
: 1;
|
|
47
|
-
const tarecgosaMultiplier = entity.cardId === "BG21_015_G" ? 2 : 1;
|
|
48
|
+
const tarecgosaMultiplier = isEnchantment && entity.cardId === "BG21_015_G" ? 2 : 1;
|
|
48
49
|
const realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;
|
|
49
50
|
const realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;
|
|
50
51
|
entity.attack = Math.max(0, entity.attack + realAttackAmount);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/simulation/stats.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAI7D,4DAA4D;AAC5D,iEAA4D;AAC5D,oCAA2C;AAC3C,+DAA8E;AAC9E,qCAAyC;AAEzC,mCAAiD;AAE1C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,MAAqB,EACrB,MAAqB,EACrB,KAAoB,EACpB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;IACT,IAAA,yCAAmB,EAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACzD,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;KAC1B;IACD,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;KAC1B;IACD,IAAA,sCAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,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,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,mCAAyD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { getNeighbours } from './attack';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n): void => {\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tif (\r\n\t\tentity?.entityId !== source?.entityId &&\r\n\t\thasCorrectTribe(\r\n\t\t\tsource as BoardEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tRace.ELEMENTAL,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t) &&\r\n\t\t// Safeguard\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0\r\n\t) {\r\n\t\tattackAmount += friendlyBoardHero.globalInfo.ElementalAttackBuff;\r\n\t\thealthAmount += friendlyBoardHero.globalInfo.ElementalHealthBuff;\r\n\t}\r\n\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst neighbours = getNeighbours(friendlyBoard, entity);\r\n\tconst poetMultipliers = hasCorrectTribe(\r\n\t\tentity,\r\n\t\tfriendlyBoardHero,\r\n\t\tRace.DRAGON,\r\n\t\tgameState.anomalies,\r\n\t\tgameState.allCards,\r\n\t)\r\n\t\t? neighbours.filter((e) => e.cardId === CardIds.PersistentPoet_BG29_813_G).length * 2 || 1\r\n\t\t: 1;\r\n\tconst tarecgosaMultiplier = entity.cardId === CardIds.Tarecgosa_BG21_015_G ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + realAttackAmount);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(realAttackAmount);\r\n\tentity.health += realHealthAmount;\r\n\r\n\tif (realAttackAmount > 0) {\r\n\t\tentity.maxAttack += realAttackAmount;\r\n\r\n\t\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.DRAGON, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tif (entity.cardId !== CardIds.Stormbringer_BG26_966 && entity.cardId !== CardIds.Stormbringer_BG26_966_G) {\r\n\t\t\t\tconst stormbringers = friendlyBoard.filter(\r\n\t\t\t\t\t(e) => e.cardId === CardIds.Stormbringer_BG26_966 || e.cardId === CardIds.Stormbringer_BG26_966_G,\r\n\t\t\t\t);\r\n\t\t\t\tstormbringers.forEach((stormbringer) => {\r\n\t\t\t\t\tconst multiplier = stormbringer.cardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tstormbringer.attack += multiplier * realAttackAmount;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Sinestra\r\n\t\tfriendlyBoard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\t\t)\r\n\t\t\t.forEach((sinestra) => {\r\n\t\t\t\tconst buff = sinestra.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 2 : 1;\r\n\t\t\t\tentity.health += buff;\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsinestra,\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n\r\n\tif (realHealthAmount > 0) {\r\n\t\tentity.maxHealth += realHealthAmount;\r\n\t\tconst titanicGuardians = friendlyBoard\r\n\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G,\r\n\t\t\t);\r\n\t\ttitanicGuardians.forEach((guardian) => {\r\n\t\t\tconst buff =\r\n\t\t\t\t(guardian.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * realHealthAmount;\r\n\t\t\tif (buff > 0) {\r\n\t\t\t\tguardian.health += buff;\r\n\t\t\t\tguardian.maxHealth += buff;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamToken ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmishmash,\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAttackAmount,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realHealthAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\r\n\tonStatsUpdate(\r\n\t\tentity,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyBoardHero,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tonStatUpdateMinions(entity, realAttackAmount, realHealthAmount, friendlyBoard, friendlyHero, otherHero, gameState);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): 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.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards)) {\r\n\t\tconst masterOfRealities = friendlyBoard.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MasterOfRealities_BG21_036 || e.cardId === CardIds.MasterOfRealities_BG21_036_G,\r\n\t\t);\r\n\t\tmasterOfRealities.forEach((master) => {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmaster,\r\n\t\t\t\tmaster,\r\n\t\t\t\tmaster.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1,\r\n\t\t\t\tmaster.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\tconst tentaclesOfCthun = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G,\r\n\t\t);\r\n\ttentaclesOfCthun.forEach((tentacle) => {\r\n\t\ttentacle.attack += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\ttentacle.health += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t});\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/simulation/stats.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAI7D,4DAA4D;AAC5D,iEAA4D;AAC5D,oCAA2C;AAC3C,+DAA8E;AAC9E,qCAAyC;AAEzC,mCAAiD;AAE1C,MAAM,cAAc,GAAG,CAC7B,MAAmB,EACnB,MAAqB,EACrB,MAAqB,EACrB,KAAoB,EACpB,SAA0B,EAC1B,SAAwB,EACjB,EAAE;IACT,IAAA,yCAAmB,EAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACzD,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;KAC1B;IACD,IAAI,MAAM,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC;KAC1B;IACD,IAAA,sCAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC,CAAC;AAlBW,QAAA,cAAc,kBAkBzB;AAEK,MAAM,WAAW,GAAG,CAC1B,MAAmB,EACnB,MAAiF,EACjF,YAAoB,EACpB,YAAoB,EACpB,aAA4B,EAC5B,iBAAkC,EAClC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CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsHeroPower, BgsPlayerEntity, BoardTrinket } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { BoardSecret } from '../board-secret';\r\nimport { hasOnStatsChanged } from '../cards/card.interface';\r\nimport { cardMappings } from '../cards/impl/_card-mappings';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAurasToSelf, removeAurasFromSelf } from './add-minion-to-board';\r\nimport { getNeighbours } from './attack';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { onQuestProgressUpdated } from './quest';\r\n\r\nexport const setEntityStats = (\r\n\tentity: BoardEntity,\r\n\tattack: number | null,\r\n\thealth: number | null,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tremoveAurasFromSelf(entity, board, boardHero, gameState);\r\n\tif (attack !== null) {\r\n\t\tentity.attack = attack;\r\n\t\tentity.maxAttack = attack;\r\n\t}\r\n\tif (health !== null) {\r\n\t\tentity.health = health;\r\n\t\tentity.maxHealth = health;\r\n\t}\r\n\tapplyAurasToSelf(entity, board, boardHero, gameState);\r\n};\r\n\r\nexport const modifyStats = (\r\n\tentity: BoardEntity,\r\n\tsource: BoardEntity | BoardSecret | BoardTrinket | BgsPlayerEntity | BgsHeroPower,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n\tregisterSpectator = true,\r\n\t// All stat modifications become enchantments, excepted the ones coming from gilding a minion\r\n\tisEnchantment = true,\r\n): void => {\r\n\tif (attackAmount === 0 && healthAmount === 0) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (entity.cardId === CardIds.LocPrince_BG29_889 || entity.cardId === CardIds.LocPrince_BG29_889_G) {\r\n\t\tconst buff = entity.cardId === CardIds.LocPrince_BG29_889_G ? 2 : 1;\r\n\t\tattackAmount += 2 * buff;\r\n\t\thealthAmount += 1 * buff;\r\n\t}\r\n\r\n\tif (\r\n\t\tentity?.entityId !== source?.entityId &&\r\n\t\thasCorrectTribe(\r\n\t\t\tsource as BoardEntity,\r\n\t\t\tfriendlyBoardHero,\r\n\t\t\tRace.ELEMENTAL,\r\n\t\t\tgameState.anomalies,\r\n\t\t\tgameState.allCards,\r\n\t\t) &&\r\n\t\t// Safeguard\r\n\t\tattackAmount >= 0 &&\r\n\t\thealthAmount >= 0\r\n\t) {\r\n\t\tattackAmount += friendlyBoardHero.globalInfo.ElementalAttackBuff;\r\n\t\thealthAmount += friendlyBoardHero.globalInfo.ElementalHealthBuff;\r\n\t}\r\n\r\n\t// The only spell for now that grants stats is the Fleeting Vigor secret, and the stats it grants\r\n\t// are in scriptDataNum1 and 2\r\n\t// if (\r\n\t// \tentity?.entityId !== source?.entityId &&\r\n\t// \tgameState.allCards.getCard(source?.cardId).type?.toUpperCase() === CardType[CardType.BATTLEGROUND_SPELL] &&\r\n\t// \t// Safeguard\r\n\t// \tattackAmount >= 0 &&\r\n\t// \thealthAmount >= 0\r\n\t// ) {\r\n\t// \tattackAmount += friendlyBoardHero.globalInfo.TavernSpellAttackBuff;\r\n\t// \thealthAmount += friendlyBoardHero.globalInfo.TavernSpellHealthBuff;\r\n\t// }\r\n\r\n\tconst otherBoardHero: BgsPlayerEntity =\r\n\t\tgameState.gameState.player.player === friendlyBoardHero\r\n\t\t\t? gameState.gameState.opponent.player\r\n\t\t\t: gameState.gameState.player.player;\r\n\r\n\tconst neighbours = getNeighbours(friendlyBoard, entity);\r\n\tconst poetMultipliers =\r\n\t\tisEnchantment &&\r\n\t\thasCorrectTribe(entity, friendlyBoardHero, Race.DRAGON, gameState.anomalies, gameState.allCards)\r\n\t\t\t? neighbours.filter((e) => e.cardId === CardIds.PersistentPoet_BG29_813_G).length * 2 || 1\r\n\t\t\t: 1;\r\n\tconst tarecgosaMultiplier = isEnchantment && entity.cardId === CardIds.Tarecgosa_BG21_015_G ? 2 : 1;\r\n\r\n\tconst realAttackAmount = attackAmount * poetMultipliers * tarecgosaMultiplier;\r\n\tconst realHealthAmount = healthAmount * poetMultipliers * tarecgosaMultiplier;\r\n\r\n\tentity.attack = Math.max(0, entity.attack + realAttackAmount);\r\n\tentity.previousAttack = entity.attack;\r\n\tentity.pendingAttackBuffs = entity.pendingAttackBuffs || [];\r\n\tentity.pendingAttackBuffs.push(realAttackAmount);\r\n\tentity.health += realHealthAmount;\r\n\r\n\tif (realAttackAmount > 0) {\r\n\t\tentity.maxAttack += realAttackAmount;\r\n\r\n\t\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.DRAGON, gameState.anomalies, gameState.allCards)) {\r\n\t\t\tif (entity.cardId !== CardIds.Stormbringer_BG26_966 && entity.cardId !== CardIds.Stormbringer_BG26_966_G) {\r\n\t\t\t\tconst stormbringers = friendlyBoard.filter(\r\n\t\t\t\t\t(e) => e.cardId === CardIds.Stormbringer_BG26_966 || e.cardId === CardIds.Stormbringer_BG26_966_G,\r\n\t\t\t\t);\r\n\t\t\t\tstormbringers.forEach((stormbringer) => {\r\n\t\t\t\t\tconst multiplier = stormbringer.cardId === CardIds.Stormbringer_BG26_966_G ? 2 : 1;\r\n\t\t\t\t\tstormbringer.attack += multiplier * realAttackAmount;\r\n\t\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tstormbringer,\r\n\t\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\t\totherBoardHero,\r\n\t\t\t\t\t);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Sinestra\r\n\t\tfriendlyBoard\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G,\r\n\t\t\t)\r\n\t\t\t.forEach((sinestra) => {\r\n\t\t\t\tconst buff = sinestra.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 2 : 1;\r\n\t\t\t\tentity.health += buff;\r\n\t\t\t\tgameState.spectator.registerPowerTarget(\r\n\t\t\t\t\tsinestra,\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tfriendlyBoard,\r\n\t\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\t\totherBoardHero,\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t}\r\n\r\n\tif (realHealthAmount > 0) {\r\n\t\tentity.maxHealth += realHealthAmount;\r\n\t\tconst titanicGuardians = friendlyBoard\r\n\t\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t\t.filter(\r\n\t\t\t\t(e) =>\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy ||\r\n\t\t\t\t\te.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G,\r\n\t\t\t);\r\n\t\ttitanicGuardians.forEach((guardian) => {\r\n\t\t\tconst buff =\r\n\t\t\t\t(guardian.cardId === CardIds.TitanicGuardian_TB_BaconShop_HERO_39_Buddy_G ? 2 : 1) * realHealthAmount;\r\n\t\t\tif (buff > 0) {\r\n\t\t\t\tguardian.health += buff;\r\n\t\t\t\tguardian.maxHealth += buff;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tif (registerSpectator && !!source) {\r\n\t\tgameState.spectator.registerPowerTarget(source, entity, friendlyBoard, friendlyBoardHero, otherBoardHero);\r\n\t}\r\n\r\n\tif (\r\n\t\tentity.cardId === CardIds.Menagerist_AmalgamToken ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A ||\r\n\t\tentity.cardId === CardIds.Cuddlgam_TB_BaconShop_HP_033t_SKIN_A_G ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D ||\r\n\t\tentity.cardId === CardIds.AbominableAmalgam_TB_BaconShop_HP_033t_SKIN_D_G\r\n\t) {\r\n\t\tconst mishmashes = friendlyBoard.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy ||\r\n\t\t\t\te.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G,\r\n\t\t);\r\n\t\tmishmashes.forEach((mishmash) => {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmishmash,\r\n\t\t\t\tmishmash,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realAttackAmount,\r\n\t\t\t\t(mishmash.cardId === CardIds.Mishmash_TB_BaconShop_HERO_33_Buddy_G ? 2 : 1) * realHealthAmount,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\r\n\tonStatsUpdate(\r\n\t\tentity,\r\n\t\trealAttackAmount,\r\n\t\trealHealthAmount,\r\n\t\tfriendlyBoard,\r\n\t\tfriendlyBoardHero,\r\n\t\totherBoardHero,\r\n\t\tgameState,\r\n\t);\r\n};\r\n\r\nconst onStatsUpdate = (\r\n\tentity: BoardEntity,\r\n\trealAttackAmount: number,\r\n\trealHealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tonStatUpdateMinions(entity, realAttackAmount, realHealthAmount, friendlyBoard, friendlyHero, otherHero, gameState);\r\n\tonStatUpdateQuests(entity, friendlyBoard, friendlyHero, gameState);\r\n};\r\n\r\nexport const applyAfterStatsUpdate = (gameState: FullGameState) => {\r\n\tfor (const entity of gameState.gameState.player.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.player, gameState.gameState.opponent, gameState);\r\n\t}\r\n\tfor (const entity of gameState.gameState.opponent.board) {\r\n\t\tapplyAfterStatsUpdateForEntity(entity, gameState.gameState.opponent, gameState.gameState.player, gameState);\r\n\t}\r\n};\r\n\r\nconst applyAfterStatsUpdateForEntity = (\r\n\tentity: BoardEntity,\r\n\tplayerState: PlayerState,\r\n\topponentState: PlayerState,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tentity.pendingAttackBuffs = [];\r\n};\r\n\r\nconst onStatUpdateQuests = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): 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.FindTheMurderWeapon:\r\n\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PressureTheAuthorities:\r\n\t\t\t\tconst totalAttack = board.map((e) => e.attack).reduce((a, b) => a + b, 0);\r\n\t\t\t\tif (totalAttack >= 35) {\r\n\t\t\t\t\tonQuestProgressUpdated(hero, quest, board, gameState);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst onStatUpdateMinions = (\r\n\tentity: BoardEntity,\r\n\tattackAmount: number,\r\n\thealthAmount: number,\r\n\tfriendlyBoard: BoardEntity[],\r\n\tfriendlyBoardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\tif (attackAmount > 0 || healthAmount > 0) {\r\n\t\tfor (const boardEntity of friendlyBoard) {\r\n\t\t\tconst onStatsChangedImpl = cardMappings[boardEntity.cardId];\r\n\t\t\tif (hasOnStatsChanged(onStatsChangedImpl)) {\r\n\t\t\t\tonStatsChangedImpl.onStatsChanged(boardEntity, {\r\n\t\t\t\t\ttarget: entity,\r\n\t\t\t\t\tattackAmount: attackAmount,\r\n\t\t\t\t\thealthAmount: healthAmount,\r\n\t\t\t\t\tboard: friendlyBoard,\r\n\t\t\t\t\thero: friendlyBoardHero,\r\n\t\t\t\t\totherHero: otherHero,\r\n\t\t\t\t\tgameState: gameState,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (hasCorrectTribe(entity, friendlyBoardHero, Race.ELEMENTAL, gameState.anomalies, gameState.allCards)) {\r\n\t\tconst masterOfRealities = friendlyBoard.filter(\r\n\t\t\t(e) => e.cardId === CardIds.MasterOfRealities_BG21_036 || e.cardId === CardIds.MasterOfRealities_BG21_036_G,\r\n\t\t);\r\n\t\tmasterOfRealities.forEach((master) => {\r\n\t\t\tmodifyStats(\r\n\t\t\t\tmaster,\r\n\t\t\t\tmaster,\r\n\t\t\t\tmaster.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1,\r\n\t\t\t\tmaster.cardId === CardIds.MasterOfRealities_BG21_036_G ? 2 : 1,\r\n\t\t\t\tfriendlyBoard,\r\n\t\t\t\tfriendlyBoardHero,\r\n\t\t\t\tgameState,\r\n\t\t\t);\r\n\t\t});\r\n\t}\r\n\tconst tentaclesOfCthun = friendlyBoard\r\n\t\t.filter((e) => e.entityId !== entity.entityId)\r\n\t\t.filter(\r\n\t\t\t(e) =>\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy ||\r\n\t\t\t\te.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G,\r\n\t\t);\r\n\ttentaclesOfCthun.forEach((tentacle) => {\r\n\t\ttentacle.attack += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t\ttentacle.health += tentacle.cardId === CardIds.TentacleOfCthun_TB_BaconShop_HERO_29_Buddy_G ? 2 : 1;\r\n\t});\r\n};\r\n\r\nexport interface OnStatsChangedInput {\r\n\ttarget: BoardEntity;\r\n\tattackAmount: number;\r\n\thealthAmount: number;\r\n\tboard: BoardEntity[];\r\n\thero: BgsPlayerEntity;\r\n\totherHero: BgsPlayerEntity;\r\n\tgameState: FullGameState;\r\n}\r\n"]}
|
|
@@ -20,7 +20,7 @@ const makeMinionGolden = (target, source, targetBoard, targetBoardHero, otherBoa
|
|
|
20
20
|
goldenCard = refCard;
|
|
21
21
|
}
|
|
22
22
|
target.cardId = goldenCard.id;
|
|
23
|
-
(0, stats_1.modifyStats)(target, null, refCard.attack, refCard.health, targetBoard, targetBoardHero, gameState);
|
|
23
|
+
(0, stats_1.modifyStats)(target, null, refCard.attack, refCard.health, targetBoard, targetBoardHero, gameState, true, false);
|
|
24
24
|
(0, add_minion_to_board_1.handleAddedMinionAuraEffect)(targetBoard, targetBoardHero, otherBoard, otherHero, target, gameState, true, false);
|
|
25
25
|
const hasDivineShield = target.divineShield;
|
|
26
26
|
const hasReborn = target.reborn;
|
|
@@ -56,7 +56,7 @@ const removeMinionAuraEffectsForGolden = (entity, hero) => {
|
|
|
56
56
|
case "BG_TTN_401_G":
|
|
57
57
|
const multiplierAstral = entity.cardId === "BG_TTN_401_G" ? 2 : 1;
|
|
58
58
|
const statsBonusAstralToRemove = hero.globalInfo.AstralAutomatonsSummonedThisGame - 1;
|
|
59
|
-
entity.health = Math.max(1, entity.health -
|
|
59
|
+
entity.health = Math.max(1, entity.health - 3 * multiplierAstral * statsBonusAstralToRemove);
|
|
60
60
|
entity.attack = Math.max(0, entity.attack - 2 * multiplierAstral * statsBonusAstralToRemove);
|
|
61
61
|
break;
|
|
62
62
|
case "BG31_176":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"golden.js","sourceRoot":"","sources":["../../../src/simulation/utils/golden.ts"],"names":[],"mappings":";;;AAAA,iEAA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M,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,CAAC;YACvG,MAAM;KACP;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, GameTag } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { addImpliedMechanics } from '../../utils';\r\nimport { handleAddedMinionAuraEffect } from '../add-minion-to-board';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleMinionRemovedAuraEffect } from '../remove-minion-from-board';\r\nimport { modifyStats } from '../stats';\r\n\r\nexport const makeMinionGolden = (\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BgsPlayerEntity,\r\n\ttargetBoard: BoardEntity[],\r\n\ttargetBoardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Typically, we are already golden\r\n\tif (isMinionGolden(target, gameState.allCards)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tgameState.spectator.registerPowerTarget(source, target, targetBoard, null, null);\r\n\r\n\t// console.log('before transforming minion', stringifySimple(targetBoard, allCards));\r\n\thandleMinionRemovedAuraEffect(targetBoard, target, targetBoardHero, gameState);\r\n\t// Specific for making a minion golden\r\n\t// This is not handled in handleMinionRemovedAuraEffect, though I'm not entirely sure why. Maybe because it's a self-effect only?\r\n\t// Also, because of how I implemented auras and such, it's probably good to have something specific for golden\r\n\tremoveMinionAuraEffectsForGolden(target, targetBoardHero);\r\n\t// console.log('after removed effect', stringifySimple(targetBoard, allCards));\r\n\tconst refCard = gameState.allCards.getCard(target.cardId);\r\n\tlet goldenCard = gameState.allCards.getCardFromDbfId(refCard.battlegroundsPremiumDbfId);\r\n\t// Happens when there is no dedicated golden card, like for the Bettle token from Boon of Beetles\r\n\tif (!goldenCard?.id) {\r\n\t\tgoldenCard = refCard;\r\n\t}\r\n\r\n\t// A minion becoming golden ignore the current death.\r\n\t// This way of handling it is not ideal, since it will still trigger if both avenges trigger at the same time, but\r\n\t// should solve the other cases\r\n\t// Update 2024-06-21: I'm not sure what this is about exactly. See\r\n\t// http://replays.firestoneapp.com/?reviewId=5d94ebeb-3691-4509-88de-5d5418b20597&turn=11&action=2\r\n\t// The Sr. Tomb Diver dies, thus gilding the Phaerix. Two other deaths later, the avenge procs\r\n\t// This means the death of the diver counted normally\r\n\t// target.avengeCurrent = Math.min(target.avengeDefault, target.avengeCurrent + 1);\r\n\r\n\t// Only change the card ID after modifying the stats, so that some effects (like Tarecgosa) won't trigger\r\n\t// too early\r\n\t// TODO: add a replay with Tarec to illustrate the difference with Defiant Shipwright, and\r\n\t// check if there is something different with Tarec\r\n\ttarget.cardId = goldenCard.id;\r\n\r\n\t// The rule for golden minions is to add the base stats\r\n\t// TO CHECK: not sure that this is what actually happens (i.e. do minions that trigger on stats modifications\r\n\t// trigger?)\r\n\t// UPDATE 2024-06-20: Defiant Shipwright (2/5) going golden (4/10) actually ends up at 4/12 because\r\n\t// of the +2 health bonus\r\n\t// http://replays.firestoneapp.com/?reviewId=283dc44c-5fc8-40fb-af89-7d752a39f9b9&turn=7&action=1\r\n\tmodifyStats(target, null, refCard.attack, refCard.health, targetBoard, targetBoardHero, gameState);\r\n\r\n\t// console.log('before adding new effect', stringifySimple(targetBoard, allCards));\r\n\thandleAddedMinionAuraEffect(targetBoard, targetBoardHero, otherBoard, otherHero, target, gameState, true, false);\r\n\tconst hasDivineShield = target.divineShield;\r\n\tconst hasReborn = target.reborn;\r\n\tconst avengeCurrent = target.avengeCurrent;\r\n\taddImpliedMechanics(target, gameState.cardsData);\r\n\r\n\t// addImpliedMechanics grants divine shield if the card has divine shield, or if the entity had\r\n\t// it at some point. That means that when we gild Zilliax: Defense Module (with Divine Shield) into\r\n\t// Zilliaw: Assembled, we restore the divine shield, while we shouldn't\r\n\ttarget.divineShield = hasDivineShield;\r\n\t// Update 2024-06-19: Hat tested on one of their build, and gilding a zilliax module should NOT\r\n\t// remove its divine shield / reborn status\r\n\t// Gilding a reborn Risen Rider results into a golden Risen Rider with reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=c553c3e7-01e2-494d-80f8-69f33c08fb39&turn=7&action=4\r\n\ttarget.reborn = hasReborn || goldenCard.mechanics?.includes(GameTag[GameTag.REBORN]);\r\n\t// target.windfury = refGoldenCard.mechanics?.includes(GameTag[GameTag.WINDFURY]);\r\n\t// target.taunt = refGoldenCard.mechanics?.includes(GameTag[GameTag.TAUNT]);\r\n\t// target.stealth = refGoldenCard.mechanics?.includes(GameTag[GameTag.STEALTH]);\r\n\ttarget.avengeCurrent = avengeCurrent;\r\n\r\n\t// console.log('after adding new effect', stringifySimple(targetBoard, allCards));\r\n};\r\n\r\nexport const isMinionGolden = (entity: BoardEntity, allCards: AllCardsService): boolean => {\r\n\tconst ref = allCards.getCard(entity.cardId);\r\n\t// Some cards (like the Bettle token from Boon of Beetles) don't have a premium dbf id. However, we can still\r\n\t// gild it\r\n\treturn ref.premium;\r\n};\r\n\r\n// This feels wrong, and is probably an indicator that auras are not applied at the right time\r\nconst removeMinionAuraEffectsForGolden = (entity: BoardEntity, hero: BgsPlayerEntity) => {\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 eternalKnightBuffToRemove = hero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tconst eternalKnighMultiplier = entity.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208:\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208_G:\r\n\t\t\tconst sanlaynBuffToRemove = hero.globalInfo.SanlaynScribesDeadThisGame;\r\n\t\t\tconst sanlaynMultiplier = entity.cardId === CardIds.SanlaynScribe_BGDUO31_208_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - sanlaynMultiplier * sanlaynBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - sanlaynMultiplier * sanlaynBuffToRemove);\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// Doesn't count self\r\n\t\t\tconst statsBonusAstralToRemove = hero.globalInfo.AstralAutomatonsSummonedThisGame - 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * multiplierAstral * statsBonusAstralToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * multiplierAstral * statsBonusAstralToRemove);\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 = entity.cardId === CardIds.DrBoomsMonster_BG31_176_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"golden.js","sourceRoot":"","sources":["../../../src/simulation/utils/golden.ts"],"names":[],"mappings":";;;AAAA,iEAAiF;AAGjF,uCAAkD;AAClD,gEAAqE;AAErE,0EAA4E;AAC5E,oCAAuC;AAEhC,MAAM,gBAAg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M,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,CAAC;YACvG,MAAM;KACP;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, GameTag } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../../bgs-player-entity';\r\nimport { BoardEntity } from '../../board-entity';\r\nimport { addImpliedMechanics } from '../../utils';\r\nimport { handleAddedMinionAuraEffect } from '../add-minion-to-board';\r\nimport { FullGameState } from '../internal-game-state';\r\nimport { handleMinionRemovedAuraEffect } from '../remove-minion-from-board';\r\nimport { modifyStats } from '../stats';\r\n\r\nexport const makeMinionGolden = (\r\n\ttarget: BoardEntity,\r\n\tsource: BoardEntity | BgsPlayerEntity,\r\n\ttargetBoard: BoardEntity[],\r\n\ttargetBoardHero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tgameState: FullGameState,\r\n): void => {\r\n\t// Typically, we are already golden\r\n\tif (isMinionGolden(target, gameState.allCards)) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tgameState.spectator.registerPowerTarget(source, target, targetBoard, null, null);\r\n\r\n\t// console.log('before transforming minion', stringifySimple(targetBoard, allCards));\r\n\thandleMinionRemovedAuraEffect(targetBoard, target, targetBoardHero, gameState);\r\n\t// Specific for making a minion golden\r\n\t// This is not handled in handleMinionRemovedAuraEffect, though I'm not entirely sure why. Maybe because it's a self-effect only?\r\n\t// Also, because of how I implemented auras and such, it's probably good to have something specific for golden\r\n\tremoveMinionAuraEffectsForGolden(target, targetBoardHero);\r\n\t// console.log('after removed effect', stringifySimple(targetBoard, allCards));\r\n\tconst refCard = gameState.allCards.getCard(target.cardId);\r\n\tlet goldenCard = gameState.allCards.getCardFromDbfId(refCard.battlegroundsPremiumDbfId);\r\n\t// Happens when there is no dedicated golden card, like for the Bettle token from Boon of Beetles\r\n\tif (!goldenCard?.id) {\r\n\t\tgoldenCard = refCard;\r\n\t}\r\n\r\n\t// A minion becoming golden ignore the current death.\r\n\t// This way of handling it is not ideal, since it will still trigger if both avenges trigger at the same time, but\r\n\t// should solve the other cases\r\n\t// Update 2024-06-21: I'm not sure what this is about exactly. See\r\n\t// http://replays.firestoneapp.com/?reviewId=5d94ebeb-3691-4509-88de-5d5418b20597&turn=11&action=2\r\n\t// The Sr. Tomb Diver dies, thus gilding the Phaerix. Two other deaths later, the avenge procs\r\n\t// This means the death of the diver counted normally\r\n\t// target.avengeCurrent = Math.min(target.avengeDefault, target.avengeCurrent + 1);\r\n\r\n\t// Only change the card ID after modifying the stats, so that some effects (like Tarecgosa) won't trigger\r\n\t// too early\r\n\t// TODO: add a replay with Tarec to illustrate the difference with Defiant Shipwright, and\r\n\t// check if there is something different with Tarec\r\n\ttarget.cardId = goldenCard.id;\r\n\r\n\t// The rule for golden minions is to add the base stats\r\n\t// TO CHECK: not sure that this is what actually happens (i.e. do minions that trigger on stats modifications\r\n\t// trigger?)\r\n\t// UPDATE 2024-06-20: Defiant Shipwright (2/5) going golden (4/10) actually ends up at 4/12 because\r\n\t// of the +2 health bonus\r\n\t// http://replays.firestoneapp.com/?reviewId=283dc44c-5fc8-40fb-af89-7d752a39f9b9&turn=7&action=1\r\n\t// BUT (2025-05-10) Tarecgosa going golden just becomes a 10/10, it doesn't get the x2 from the buff\r\n\t// Maybe that's because it's not an enchantment, so let's just hard-code this here\r\n\t// (bug: it won't work with Poets)\r\n\tmodifyStats(target, null, refCard.attack, refCard.health, targetBoard, targetBoardHero, gameState, true, false);\r\n\r\n\t// console.log('before adding new effect', stringifySimple(targetBoard, allCards));\r\n\thandleAddedMinionAuraEffect(targetBoard, targetBoardHero, otherBoard, otherHero, target, gameState, true, false);\r\n\tconst hasDivineShield = target.divineShield;\r\n\tconst hasReborn = target.reborn;\r\n\tconst avengeCurrent = target.avengeCurrent;\r\n\taddImpliedMechanics(target, gameState.cardsData);\r\n\r\n\t// addImpliedMechanics grants divine shield if the card has divine shield, or if the entity had\r\n\t// it at some point. That means that when we gild Zilliax: Defense Module (with Divine Shield) into\r\n\t// Zilliaw: Assembled, we restore the divine shield, while we shouldn't\r\n\ttarget.divineShield = hasDivineShield;\r\n\t// Update 2024-06-19: Hat tested on one of their build, and gilding a zilliax module should NOT\r\n\t// remove its divine shield / reborn status\r\n\t// Gilding a reborn Risen Rider results into a golden Risen Rider with reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=c553c3e7-01e2-494d-80f8-69f33c08fb39&turn=7&action=4\r\n\ttarget.reborn = hasReborn || goldenCard.mechanics?.includes(GameTag[GameTag.REBORN]);\r\n\t// target.windfury = refGoldenCard.mechanics?.includes(GameTag[GameTag.WINDFURY]);\r\n\t// target.taunt = refGoldenCard.mechanics?.includes(GameTag[GameTag.TAUNT]);\r\n\t// target.stealth = refGoldenCard.mechanics?.includes(GameTag[GameTag.STEALTH]);\r\n\ttarget.avengeCurrent = avengeCurrent;\r\n\r\n\t// console.log('after adding new effect', stringifySimple(targetBoard, allCards));\r\n};\r\n\r\nexport const isMinionGolden = (entity: BoardEntity, allCards: AllCardsService): boolean => {\r\n\tconst ref = allCards.getCard(entity.cardId);\r\n\t// Some cards (like the Bettle token from Boon of Beetles) don't have a premium dbf id. However, we can still\r\n\t// gild it\r\n\treturn ref.premium;\r\n};\r\n\r\n// This feels wrong, and is probably an indicator that auras are not applied at the right time\r\nconst removeMinionAuraEffectsForGolden = (entity: BoardEntity, hero: BgsPlayerEntity) => {\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 eternalKnightBuffToRemove = hero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tconst eternalKnighMultiplier = entity.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - eternalKnighMultiplier * eternalKnightBuffToRemove);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208:\r\n\t\tcase CardIds.SanlaynScribe_BGDUO31_208_G:\r\n\t\t\tconst sanlaynBuffToRemove = hero.globalInfo.SanlaynScribesDeadThisGame;\r\n\t\t\tconst sanlaynMultiplier = entity.cardId === CardIds.SanlaynScribe_BGDUO31_208_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - sanlaynMultiplier * sanlaynBuffToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - sanlaynMultiplier * sanlaynBuffToRemove);\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// Doesn't count self\r\n\t\t\tconst statsBonusAstralToRemove = hero.globalInfo.AstralAutomatonsSummonedThisGame - 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 3 * multiplierAstral * statsBonusAstralToRemove);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * multiplierAstral * statsBonusAstralToRemove);\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 = entity.cardId === CardIds.DrBoomsMonster_BG31_176_G ? 2 : 1;\r\n\t\t\tentity.health = Math.max(1, entity.health - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tentity.attack = Math.max(0, entity.attack - 2 * hero.globalInfo.MagnetizedThisGame * multiplierDrBoom);\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -33,3 +33,4 @@ export declare const getPlayerState: (gameState: GameState, hero: BgsPlayerEntit
|
|
|
33
33
|
export declare const getTeammateInitialState: (gameState: GameState, hero: BgsPlayerEntity) => PlayerState;
|
|
34
34
|
export declare const getTeamInitialStates: (gameState: GameState, hero: BgsPlayerEntity) => PlayerState[];
|
|
35
35
|
export declare const copyEntity: (entity: BoardEntity) => BoardEntity;
|
|
36
|
+
export declare const isDead: (entity: BoardEntity) => boolean;
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyEntity = exports.getTeamInitialStates = exports.getTeammateInitialState = exports.getPlayerState = exports.isGolden = exports.isPilotedWhirlOTron = exports.isFish = exports.stringifySimpleCard = exports.stringifySimple = exports.normalizeCardIdForSkin = exports.addImpliedMechanics = exports.getRaceEnum = exports.isCorrectTribe = exports.getEffectiveTribesForEntity = exports.hasCorrectTribe = exports.hasMechanic = exports.getMinionsOfDifferentTypes = exports.grantStatsToMinionsOfEachType = exports.addStatsToAliveBoard = exports.addStatsToBoard = exports.getRandomMinionWithHighestHealth = exports.getRandomRevivableMinion = exports.getRandomAliveMinion = exports.grantRandomStats = exports.grantRandomHealth = exports.grantRandomAttack = exports.buildRandomUndeadCreation = exports.buildSingleBoardEntity = void 0;
|
|
3
|
+
exports.isDead = exports.copyEntity = exports.getTeamInitialStates = exports.getTeammateInitialState = exports.getPlayerState = exports.isGolden = exports.isPilotedWhirlOTron = exports.isFish = exports.stringifySimpleCard = exports.stringifySimple = exports.normalizeCardIdForSkin = exports.addImpliedMechanics = exports.getRaceEnum = exports.isCorrectTribe = exports.getEffectiveTribesForEntity = exports.hasCorrectTribe = exports.hasMechanic = exports.getMinionsOfDifferentTypes = exports.grantStatsToMinionsOfEachType = exports.addStatsToAliveBoard = exports.addStatsToBoard = exports.getRandomMinionWithHighestHealth = exports.getRandomRevivableMinion = exports.getRandomAliveMinion = exports.grantRandomStats = exports.grantRandomHealth = exports.grantRandomAttack = exports.buildRandomUndeadCreation = exports.buildSingleBoardEntity = 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 _card_mappings_1 = require("./cards/impl/_card-mappings");
|
|
@@ -456,4 +456,8 @@ const copyEntity = (entity) => {
|
|
|
456
456
|
return copy;
|
|
457
457
|
};
|
|
458
458
|
exports.copyEntity = copyEntity;
|
|
459
|
+
const isDead = (entity) => {
|
|
460
|
+
return entity.health <= 0 || entity.definitelyDead;
|
|
461
|
+
};
|
|
462
|
+
exports.isDead = isDead;
|
|
459
463
|
//# sourceMappingURL=utils.js.map
|