@firestone-hs/simulate-bgs-battle 1.1.571 → 1.1.573
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/bgs-player-entity.d.ts +1 -0
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/cards/card.interface.d.ts +0 -13
- package/dist/cards/card.interface.js +1 -5
- package/dist/cards/card.interface.js.map +1 -1
- package/dist/cards/impl/_card-mappings.js +2 -0
- package/dist/cards/impl/_card-mappings.js.map +1 -1
- package/dist/cards/impl/enchantments/crystal-infuser-enchantment.d.ts +2 -2
- package/dist/cards/impl/enchantments/crystal-infuser-enchantment.js +2 -1
- package/dist/cards/impl/enchantments/crystal-infuser-enchantment.js.map +1 -1
- package/dist/cards/impl/minion/amber-guardian.js +1 -0
- package/dist/cards/impl/minion/amber-guardian.js.map +1 -1
- package/dist/cards/impl/minion/anubarak-nerubian-king.d.ts +2 -2
- package/dist/cards/impl/minion/anubarak-nerubian-king.js +2 -1
- package/dist/cards/impl/minion/anubarak-nerubian-king.js.map +1 -1
- package/dist/cards/impl/minion/baneling.d.ts +2 -2
- package/dist/cards/impl/minion/baneling.js +2 -1
- package/dist/cards/impl/minion/baneling.js.map +1 -1
- package/dist/cards/impl/minion/battlecruiser.d.ts +2 -2
- package/dist/cards/impl/minion/battlecruiser.js +4 -3
- package/dist/cards/impl/minion/battlecruiser.js.map +1 -1
- package/dist/cards/impl/minion/bronze-steward.d.ts +2 -2
- package/dist/cards/impl/minion/bronze-steward.js +2 -1
- package/dist/cards/impl/minion/bronze-steward.js.map +1 -1
- package/dist/cards/impl/minion/coilskar-sapper.d.ts +2 -2
- package/dist/cards/impl/minion/coilskar-sapper.js +2 -1
- package/dist/cards/impl/minion/coilskar-sapper.js.map +1 -1
- package/dist/cards/impl/minion/cruise-controller.d.ts +2 -2
- package/dist/cards/impl/minion/cruise-controller.js +2 -1
- package/dist/cards/impl/minion/cruise-controller.js.map +1 -1
- package/dist/cards/impl/minion/firescale-hoarder.d.ts +2 -2
- package/dist/cards/impl/minion/firescale-hoarder.js +2 -1
- package/dist/cards/impl/minion/firescale-hoarder.js.map +1 -1
- package/dist/cards/impl/minion/flighty-scout.js +1 -1
- package/dist/cards/impl/minion/flighty-scout.js.map +1 -1
- package/dist/cards/impl/minion/gentle-djinni.d.ts +2 -2
- package/dist/cards/impl/minion/gentle-djinni.js +2 -1
- package/dist/cards/impl/minion/gentle-djinni.js.map +1 -1
- package/dist/cards/impl/minion/glowing-cinder.d.ts +2 -2
- package/dist/cards/impl/minion/glowing-cinder.js +2 -1
- package/dist/cards/impl/minion/glowing-cinder.js.map +1 -1
- package/dist/cards/impl/minion/goldrinn-the-great-wolf.d.ts +2 -2
- package/dist/cards/impl/minion/goldrinn-the-great-wolf.js +2 -1
- package/dist/cards/impl/minion/goldrinn-the-great-wolf.js.map +1 -1
- package/dist/cards/impl/minion/gormling-gourmet.d.ts +2 -2
- package/dist/cards/impl/minion/gormling-gourmet.js +2 -1
- package/dist/cards/impl/minion/gormling-gourmet.js.map +1 -1
- package/dist/cards/impl/minion/impulsive-trickster.d.ts +2 -2
- package/dist/cards/impl/minion/impulsive-trickster.js +2 -1
- package/dist/cards/impl/minion/impulsive-trickster.js.map +1 -1
- package/dist/cards/impl/minion/leeroy-the-reckless.d.ts +2 -2
- package/dist/cards/impl/minion/leeroy-the-reckless.js +2 -1
- package/dist/cards/impl/minion/leeroy-the-reckless.js.map +1 -1
- package/dist/cards/impl/minion/metallic-hunter.d.ts +2 -2
- package/dist/cards/impl/minion/metallic-hunter.js +2 -1
- package/dist/cards/impl/minion/metallic-hunter.js.map +1 -1
- package/dist/cards/impl/minion/mummifier.d.ts +2 -2
- package/dist/cards/impl/minion/mummifier.js +2 -1
- package/dist/cards/impl/minion/mummifier.js.map +1 -1
- package/dist/cards/impl/minion/mutated-lasher.d.ts +2 -2
- package/dist/cards/impl/minion/mutated-lasher.js +2 -1
- package/dist/cards/impl/minion/mutated-lasher.js.map +1 -1
- package/dist/cards/impl/minion/nightmare-par-tea-guest.d.ts +2 -2
- package/dist/cards/impl/minion/nightmare-par-tea-guest.js +2 -1
- package/dist/cards/impl/minion/nightmare-par-tea-guest.js.map +1 -1
- package/dist/cards/impl/minion/operatic-belcher.d.ts +2 -2
- package/dist/cards/impl/minion/operatic-belcher.js +2 -1
- package/dist/cards/impl/minion/operatic-belcher.js.map +1 -1
- package/dist/cards/impl/minion/rylak-metalhead.d.ts +2 -2
- package/dist/cards/impl/minion/rylak-metalhead.js +2 -1
- package/dist/cards/impl/minion/rylak-metalhead.js.map +1 -1
- package/dist/cards/impl/minion/selfless-hero.d.ts +2 -2
- package/dist/cards/impl/minion/selfless-hero.js +2 -1
- package/dist/cards/impl/minion/selfless-hero.js.map +1 -1
- package/dist/cards/impl/minion/shadowdancer.d.ts +2 -2
- package/dist/cards/impl/minion/shadowdancer.js +2 -1
- package/dist/cards/impl/minion/shadowdancer.js.map +1 -1
- package/dist/cards/impl/minion/sharptooth-snapper.d.ts +2 -2
- package/dist/cards/impl/minion/sharptooth-snapper.js +5 -1
- package/dist/cards/impl/minion/sharptooth-snapper.js.map +1 -1
- package/dist/cards/impl/minion/showy-cyclist.d.ts +2 -2
- package/dist/cards/impl/minion/showy-cyclist.js +2 -1
- package/dist/cards/impl/minion/showy-cyclist.js.map +1 -1
- package/dist/cards/impl/minion/silithid-burrower.d.ts +2 -2
- package/dist/cards/impl/minion/silithid-burrower.js +2 -1
- package/dist/cards/impl/minion/silithid-burrower.js.map +1 -1
- package/dist/cards/impl/minion/slumber-sorcerer.d.ts +2 -2
- package/dist/cards/impl/minion/slumber-sorcerer.js +2 -1
- package/dist/cards/impl/minion/slumber-sorcerer.js.map +1 -1
- package/dist/cards/impl/minion/thorncaller.d.ts +2 -2
- package/dist/cards/impl/minion/thorncaller.js +2 -1
- package/dist/cards/impl/minion/thorncaller.js.map +1 -1
- package/dist/cards/impl/minion/thousandth-paper-drake.js +2 -1
- package/dist/cards/impl/minion/thousandth-paper-drake.js.map +1 -1
- package/dist/cards/impl/minion/three-lil-quilboar.d.ts +2 -2
- package/dist/cards/impl/minion/three-lil-quilboar.js +2 -1
- package/dist/cards/impl/minion/three-lil-quilboar.js.map +1 -1
- package/dist/cards/impl/minion/tunnel-blaster.d.ts +2 -2
- package/dist/cards/impl/minion/tunnel-blaster.js +2 -1
- package/dist/cards/impl/minion/tunnel-blaster.js.map +1 -1
- package/dist/cards/impl/minion/turquoise-skitterer.d.ts +2 -2
- package/dist/cards/impl/minion/turquoise-skitterer.js +2 -5
- package/dist/cards/impl/minion/turquoise-skitterer.js.map +1 -1
- package/dist/cards/impl/minion/valiant-tiger.d.ts +2 -2
- package/dist/cards/impl/minion/valiant-tiger.js +2 -1
- package/dist/cards/impl/minion/valiant-tiger.js.map +1 -1
- package/dist/cards/impl/trinket/faerie-dragon-scale.js +2 -1
- package/dist/cards/impl/trinket/faerie-dragon-scale.js.map +1 -1
- package/dist/cards/impl/trinket/vashjir-anemone.js +2 -1
- package/dist/cards/impl/trinket/vashjir-anemone.js.map +1 -1
- package/dist/simulate-bgs-battle.js +1 -1
- package/dist/simulate-bgs-battle.js.map +1 -1
- package/dist/simulation/deathrattle-effects.d.ts +2 -1
- package/dist/simulation/deathrattle-effects.js +3 -481
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-orchestration.js +1 -2
- package/dist/simulation/deathrattle-orchestration.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.d.ts +1 -1
- package/dist/simulation/deathrattle-spawns.js +320 -9
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deathrattle-orchestration.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-orchestration.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAE7D,oCAA2C;AAC3C,qCAA8C;AAC9C,mDAAyD;AACzD,+DAI+B;AAC/B,6DAAkH;AAElH,qCAAiD;AACjD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,UAAU,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAC7E,CAAC;SACF;KACD;IACD,IACC,IAAA,uBAAe,EAAC,UAAU,EAAE,qBAAqB,CAAC,MAAM,EAAE,qBAAI,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,EAC7G;QACD,IAAI,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,GAAG,CAAC,EAAE;YAChE,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAC3B,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAC3E,CAAC;SACF;KACD;AACF,CAAC,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAvengeEffects } from './avenge';\r\nimport { applyAfterDeathEffects } from './death-effects';\r\nimport {\r\n\tapplyWheneverMinionDiesEffect,\r\n\thandleAfterMinionKillsEffect,\r\n\thandleDeathrattleEffects,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle, spawnEntitiesFromEnchantments } from './deathrattle-spawns';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { handleRebornForEntity } from './reborn';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\n// FIXME:\r\n// From Mitchell on Discord:\r\n// - Minions die left to right\r\n// - When a minion dies, it procs natural deathrattle, added deathrattles, and then all avenges progress\r\n// by 1 (and trigger as necessary)\r\n// - Then next minion\r\n// - After ALL deathrattles and avenges are done, Reborn triggers\r\n// - (Ideally after all of that I would want Feathermane to trigger, but that is not what it does right now.\r\n// Right now it triggers at deathrattle speed rather than after Reborn speed)\r\nexport const orchestrateMinionDeathEffects = (\r\n\tdeathrattleInput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n\tprocessReborn = true,\r\n) => {\r\n\t// Icesnarl / Rokara here?\r\n\thandleAfterMinionsKillEffects(deathrattleInput);\r\n\r\n\t// Not sure about this\r\n\thandleWheneverMinionsDieEffects(deathrattleInput);\r\n\r\n\tconst playerBoardBefore = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardBefore = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\r\n\tconst entitiesFromDeathrattles = processDeathrattles(deathrattleInput, processAvenge);\r\n\r\n\t// Hack to try and fix how reborn indices are handled when there are spawns during the deathrattle phase\r\n\t// Ideally, this should probably be rewritten completely to keep the dead entities in the board itself\r\n\t// so we can use that as a source for the spawn index. However this is a big rewrite with lots of\r\n\t// potential side-effects\r\n\tconst playerBoardAfter = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardAfter = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\tconst opponentIndexOfSpawnedEntities = opponentBoardAfter\r\n\t\t.filter((entity) => !opponentBoardBefore.includes(entity))\r\n\t\t.map((entity) => opponentBoardAfter.length - opponentBoardAfter.indexOf(entity) - 1);\r\n\tconst playerIndexOfSpawnedEntities = playerBoardAfter\r\n\t\t.filter((entity) => !playerBoardBefore.includes(entity))\r\n\t\t.map((entity) => playerBoardAfter.length - playerBoardAfter.indexOf(entity) - 1);\r\n\tdeathrattleInput.opponentDeadEntityIndexesFromRight = deathrattleInput.opponentDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\topponentIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\tdeathrattleInput.playerDeadEntityIndexesFromRight = deathrattleInput.playerDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\tplayerIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\r\n\tif (processReborn) {\r\n\t\tprocessReborns(deathrattleInput);\r\n\t}\r\n\r\n\tconst entitiesFromFeathermanes = processFeathermaneEffects(deathrattleInput);\r\n\thandlePostDeathrattleEffects(deathrattleInput, [...entitiesFromDeathrattles, ...entitiesFromFeathermanes]);\r\n};\r\n\r\nconst handleAfterMinionsKillEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\thandleAfterMinionKillsEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleWheneverMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\t// Wildfire Element is applied first, before the DR spawns\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyWheneverMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst processDeathrattles = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\t// Deathrattles are handled left to right\r\n\t// Then for each minion, natural deathrattles are processed first, then enchantments\r\n\t// http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=1\r\n\t// http://replays.firestoneapp.com/?reviewId=f32e734a-d5a2-4fa4-ad10-94019969cdd7&turn=6&action=22\r\n\t// http://replays.firestoneapp.com/?reviewId=ea9503c9-2795-49f0-866b-9ea856cec7df&turn=11&action=3\r\n\t// http://replays.firestoneapp.com/?reviewId=1ff37e17-704c-4a73-8c78-377c52b6cb42&turn=13&action=1 is a trap: the enchantment is on the first\r\n\t// minion, but the DR is on the second one.\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst deadEntityAttack = deadEntity.attack;\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processDeathrattleForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneEffects = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processFeathermaneForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst maxSpawns = 7 - deadEntityPlayerState.board.length;\r\n\tconst allSpawns = [];\r\n\r\n\t// Feathermane\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tconst feathermanes =\r\n\t\t\tdeadEntityPlayerState.player.hand\r\n\t\t\t\t?.filter((e) => !e.locked)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014 ||\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014_G,\r\n\t\t\t\t) ?? [];\r\n\t\tfor (const feathermaneSpawn of feathermanes) {\r\n\t\t\tif (allSpawns.length >= maxSpawns) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfeathermaneSpawn.locked = true;\r\n\t\t\tconst spawns = spawnEntities(\r\n\t\t\t\tfeathermaneSpawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tgameState,\r\n\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{ ...feathermaneSpawn } as BoardEntity,\r\n\t\t\t);\r\n\r\n\t\t\t// So that it can be flagged as \"unspawned\" if it is not spawned in the end\r\n\t\t\tfor (const spawn of spawns) {\r\n\t\t\t\tspawn.onCanceledSummon = () => (feathermaneSpawn.locked = false);\r\n\t\t\t\t// spawn.backRef = feathermaneSpawn;\r\n\t\t\t}\r\n\t\t\tallSpawns.push(...spawns);\r\n\t\t}\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn allSpawns;\r\n};\r\n\r\nexport const processDeathrattleForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst drEntities = handleNaturalDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\tconst enchEntities = handleEnchantmentsDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\t// Avenge trigger before reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=5bb20eb8-e0ca-47ab-adc7-13134716d568&turn=7&action=6\r\n\tif (processAvenge) {\r\n\t\tapplyAvengeEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t\t[...drEntities, ...enchEntities],\r\n\t\t);\r\n\t}\r\n\r\n\t// TODO: Feathermane should be applied after the Reborn effects have all been processed\r\n\t// Secrets should be processed here (\"at Avenge speed\")\r\n\tconst afterDeathEntities = applyAfterDeathEffects(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn [...drEntities, ...enchEntities, ...afterDeathEntities];\r\n};\r\n\r\nconst handleNaturalDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\tconst allSpawns = [];\r\n\tconst spawnsToSpawn = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tdeathrattleRepeats: dr.repeats ?? 1,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t\tenchantments: [],\r\n\t\t\tmemory:\r\n\t\t\t\tdr.memory == null\r\n\t\t\t\t\t? null\r\n\t\t\t\t\t: Array.isArray(dr.memory)\r\n\t\t\t\t\t? dr.memory.map((mem) => ({ ...mem }))\r\n\t\t\t\t\t: { ...dr.memory },\r\n\t\t};\r\n\t\tconst spawns = handleNaturalDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\t// The spawns have already been processed in the \"handleNaturalDeathrattle\" method\r\n\t\t// spawnsToSpawn.push(...spawns);\r\n\t\tallSpawns.push(...spawns);\r\n\t}\r\n\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tdeadEntities,\r\n\t\tgameState,\r\n\t);\r\n\tallSpawns.push(...entitiesFromNativeDeathrattle);\r\n\tspawnsToSpawn.push(...entitiesFromNativeDeathrattle);\r\n\t// Some candidate entities are not spawned, and so are ignored in further processing\r\n\tconst actualSpawns = performEntitySpawns(\r\n\t\tspawnsToSpawn,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\t// In case of leapfrogger, we want to first spawn the minions, then apply the frog effect\r\n\thandleDeathrattleEffects(\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\r\n\treturn actualSpawns;\r\n};\r\n\r\nconst handleEnchantmentsDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tskipSpawns = false,\r\n) => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\tconst result = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\t// So that cards that rely on the tavern tier use the base entity, and not the enchantment / remembered card\r\n\t\t\ttavernTier: gameState.cardsData.getTavernLevel(deadEntity.cardId),\r\n\t\t\tenchantments: [\r\n\t\t\t\t{\r\n\t\t\t\t\tcardId: dr.cardId,\r\n\t\t\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\t\t\trepeats: dr.repeats ?? 1,\r\n\t\t\t\t\ttiming: dr.timing,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t};\r\n\t\tconst spawns = handleEnchantmentsDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t\t// We skip spawns, otherwise it will be added twice\r\n\t\t\ttrue,\r\n\t\t);\r\n\t\tresult.push(...spawns);\r\n\t}\r\n\tconst entitiesFromEnchantments: readonly BoardEntity[] = spawnEntitiesFromEnchantments(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\tresult.push(...entitiesFromEnchantments);\r\n\tif (!skipSpawns) {\r\n\t\tperformEntitySpawns(\r\n\t\t\tresult,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\tdeadEntity,\r\n\t\t\tmodifiedIndexFromRight,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\treturn result;\r\n};\r\n\r\nconst processReborns = (deathrattleInput: DeathrattleInput) => {\r\n\t// const entitiesFromReborn: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\thandleRebornForEntity(\r\n\t\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\totherPlayerState.board,\r\n\t\t\t\t\totherPlayerState.player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handlePostDeathrattleEffects = (deathrattleInput: DeathrattleInput, entitiesFromDeathrattles: BoardEntity[]) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Process from right to left, so that we can set the hasAttacked attribute properly\r\n\t\t\t// If two minions die at the same time, both of which having attacked, but the third in line having not,\r\n\t\t\t// processing them from left to right means the first (leftmost) one will check its right neighbor, which\r\n\t\t\t// is the minion that hasn't attacked\r\n\t\t\tfor (let j = deadEntities.length - 1; j >= 0; j--) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\thandlePostDeathrattleEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t\t\tdeadEntityPlayerState.player.friendly,\r\n\t\t\t\t\tdeathrattleInput,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleDeathrattles = (deathrattleInput: DeathrattleInput) => {\r\n\torchestrateMinionDeathEffects(deathrattleInput, false, false);\r\n};\r\n\r\nconst handlePostDeathrattleEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tspawnedEntities: BoardEntity[],\r\n\tisPlayer: boolean,\r\n\tdeathrattleInput: DeathrattleInput,\r\n) => {\r\n\t// This doesn't work if the entity that was to the right died.\r\n\tconst entityRightToSpawns =\r\n\t\tindexFromRight === 0 ? null : deadEntityPlayerState.board[deadEntityPlayerState.board.length - indexFromRight];\r\n\t// To handle minions attack tokens\r\n\t// See http://replays.firestoneapp.com/?reviewId=0583d6a4-6ed0-4b20-894e-4ceb560894fe&turn=6&action=11\r\n\t// When a minion dies, the spawn are either elligible to attack next turn or not\r\n\t// If the minion right to the spawned minion has already attacked, then the spawned\r\n\t// minion cannot attack\r\n\tspawnedEntities.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? 0;\r\n\t});\r\n\r\n\tif (\r\n\t\tdeadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113) ||\r\n\t\tdeadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113_ALT)\r\n\t) {\r\n\t\tconst ogDeadEntity = gameState.sharedState.deaths.find((entity) => entity.entityId === deadEntity.entityId);\r\n\t\tif (ogDeadEntity) {\r\n\t\t\togDeadEntity.attack += 4;\r\n\t\t\togDeadEntity.health += 4;\r\n\t\t}\r\n\t}\r\n\r\n\t// ISSUE: when we do this, we change the minion's stats before processing deathrattle effects, which can mess\r\n\t// up the simulation in some cases (like Nightbane, Ignited)\r\n\t// FIX: we do it in postDeathrattleEfects, not when removing minions from the board\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.UNDEAD, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.UndeadAttackBonus,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\ninterface DeathrattleInput {\r\n\tgameState: FullGameState;\r\n\tplayerDeadEntities: BoardEntity[];\r\n\tplayerDeadEntityIndexesFromRight: number[];\r\n\topponentDeadEntities: BoardEntity[];\r\n\topponentDeadEntityIndexesFromRight: number[];\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"deathrattle-orchestration.js","sourceRoot":"","sources":["../../src/simulation/deathrattle-orchestration.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAE7D,oCAA2C;AAC3C,qCAA8C;AAC9C,mDAAyD;AACzD,+DAAoG;AACpG,6DAAkH;AAElH,qCAAiD;AACjD,qCAA+C;AAWxC,MAAM,6BAA6B,GAAG,CAC5C,gBAAkC,EAClC,aAAa,GAAG,IAAI,EACpB,aAAa,GAAG,IAAI,EACnB,EAAE;IAEH,6BAA6B,CAAC,gBAAgB,CAAC,CAAC;IAGhD,+BAA+B,CAAC,gBAAgB,CAAC,CAAC;IAElD,MAAM,iBAAiB,GAAG,CAAC,GAAG,gBAAg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AAG,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAC3E,CAAC;SACF;KACD;AACF,CAAC,CAAC","sourcesContent":["import { CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { hasCorrectTribe } from '../utils';\r\nimport { applyAvengeEffects } from './avenge';\r\nimport { applyAfterDeathEffects } from './death-effects';\r\nimport { applyWheneverMinionDiesEffect, handleAfterMinionKillsEffect } from './deathrattle-effects';\r\nimport { spawnEntities, spawnEntitiesFromDeathrattle, spawnEntitiesFromEnchantments } from './deathrattle-spawns';\r\nimport { FullGameState, PlayerState } from './internal-game-state';\r\nimport { handleRebornForEntity } from './reborn';\r\nimport { performEntitySpawns } from './spawns';\r\n\r\n// FIXME:\r\n// From Mitchell on Discord:\r\n// - Minions die left to right\r\n// - When a minion dies, it procs natural deathrattle, added deathrattles, and then all avenges progress\r\n// by 1 (and trigger as necessary)\r\n// - Then next minion\r\n// - After ALL deathrattles and avenges are done, Reborn triggers\r\n// - (Ideally after all of that I would want Feathermane to trigger, but that is not what it does right now.\r\n// Right now it triggers at deathrattle speed rather than after Reborn speed)\r\nexport const orchestrateMinionDeathEffects = (\r\n\tdeathrattleInput: DeathrattleInput,\r\n\tprocessAvenge = true,\r\n\tprocessReborn = true,\r\n) => {\r\n\t// Icesnarl / Rokara here?\r\n\thandleAfterMinionsKillEffects(deathrattleInput);\r\n\r\n\t// Not sure about this\r\n\thandleWheneverMinionsDieEffects(deathrattleInput);\r\n\r\n\tconst playerBoardBefore = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardBefore = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\r\n\tconst entitiesFromDeathrattles = processDeathrattles(deathrattleInput, processAvenge);\r\n\r\n\t// Hack to try and fix how reborn indices are handled when there are spawns during the deathrattle phase\r\n\t// Ideally, this should probably be rewritten completely to keep the dead entities in the board itself\r\n\t// so we can use that as a source for the spawn index. However this is a big rewrite with lots of\r\n\t// potential side-effects\r\n\tconst playerBoardAfter = [...deathrattleInput.gameState.gameState.player.board];\r\n\tconst opponentBoardAfter = [...deathrattleInput.gameState.gameState.opponent.board];\r\n\tconst opponentIndexOfSpawnedEntities = opponentBoardAfter\r\n\t\t.filter((entity) => !opponentBoardBefore.includes(entity))\r\n\t\t.map((entity) => opponentBoardAfter.length - opponentBoardAfter.indexOf(entity) - 1);\r\n\tconst playerIndexOfSpawnedEntities = playerBoardAfter\r\n\t\t.filter((entity) => !playerBoardBefore.includes(entity))\r\n\t\t.map((entity) => playerBoardAfter.length - playerBoardAfter.indexOf(entity) - 1);\r\n\tdeathrattleInput.opponentDeadEntityIndexesFromRight = deathrattleInput.opponentDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\topponentIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\tdeathrattleInput.playerDeadEntityIndexesFromRight = deathrattleInput.playerDeadEntityIndexesFromRight.map(\r\n\t\t(previousIndex) => {\r\n\t\t\tplayerIndexOfSpawnedEntities.forEach((index) => {\r\n\t\t\t\tif (index < previousIndex) {\r\n\t\t\t\t\tpreviousIndex++;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn previousIndex;\r\n\t\t},\r\n\t);\r\n\r\n\tif (processReborn) {\r\n\t\tprocessReborns(deathrattleInput);\r\n\t}\r\n\r\n\tconst entitiesFromFeathermanes = processFeathermaneEffects(deathrattleInput);\r\n\thandlePostDeathrattleEffects(deathrattleInput, [...entitiesFromDeathrattles, ...entitiesFromFeathermanes]);\r\n};\r\n\r\nconst handleAfterMinionsKillEffects = (deathrattleInput: DeathrattleInput) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\thandleAfterMinionKillsEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleWheneverMinionsDieEffects = (deathrattleInput: DeathrattleInput) => {\r\n\t// Wildfire Element is applied first, before the DR spawns\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tapplyWheneverMinionDiesEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tplayerDeadEntityIndexesFromRight[i][j],\r\n\t\t\t\t\tplayerStates[i].board,\r\n\t\t\t\t\tplayerStates[i].player,\r\n\t\t\t\t\tplayerStates[1 - i].board,\r\n\t\t\t\t\tplayerStates[1 - i].player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst processDeathrattles = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\t// Deathrattles are handled left to right\r\n\t// Then for each minion, natural deathrattles are processed first, then enchantments\r\n\t// http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=1\r\n\t// http://replays.firestoneapp.com/?reviewId=f32e734a-d5a2-4fa4-ad10-94019969cdd7&turn=6&action=22\r\n\t// http://replays.firestoneapp.com/?reviewId=ea9503c9-2795-49f0-866b-9ea856cec7df&turn=11&action=3\r\n\t// http://replays.firestoneapp.com/?reviewId=1ff37e17-704c-4a73-8c78-377c52b6cb42&turn=13&action=1 is a trap: the enchantment is on the first\r\n\t// minion, but the DR is on the second one.\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst deadEntityAttack = deadEntity.attack;\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processDeathrattleForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneEffects = (deathrattleInput: DeathrattleInput, processAvenge = true): BoardEntity[] => {\r\n\tconst entitiesFromDeathrattles: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Entities are processed left to right\r\n\t\t\t// TODO: in fact, the processing order is summoning order, so maybe we can just use the entityId\r\n\t\t\t// to determine the order? https://x.com/LoewenMitchell/status/1750792974383173676?s=20\r\n\t\t\t// \"It should be summoned order (which is most cases would be left to right but mid-combat that could change).\"\r\n\t\t\t// This doesn't actually work: http://replays.firestoneapp.com/?reviewId=ec5428bf-a599-4f4c-bea9-8acad5075cb8&turn=11&action=6\r\n\t\t\t// deadEntities.sort((a, b) => a.entityId - b.entityId);\r\n\t\t\t// So we would need to find another proxy for the order\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\tconst spawns = processFeathermaneForMinion(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tprocessAvenge,\r\n\t\t\t\t);\r\n\t\t\t\tentitiesFromDeathrattles.push(...spawns);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn entitiesFromDeathrattles;\r\n};\r\n\r\nconst processFeathermaneForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst maxSpawns = 7 - deadEntityPlayerState.board.length;\r\n\tconst allSpawns = [];\r\n\r\n\t// Feathermane\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tconst feathermanes =\r\n\t\t\tdeadEntityPlayerState.player.hand\r\n\t\t\t\t?.filter((e) => !e.locked)\r\n\t\t\t\t.filter(\r\n\t\t\t\t\t(e) =>\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014 ||\r\n\t\t\t\t\t\te.cardId === CardIds.FreeFlyingFeathermane_BG27_014_G,\r\n\t\t\t\t) ?? [];\r\n\t\tfor (const feathermaneSpawn of feathermanes) {\r\n\t\t\tif (allSpawns.length >= maxSpawns) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfeathermaneSpawn.locked = true;\r\n\t\t\tconst spawns = spawnEntities(\r\n\t\t\t\tfeathermaneSpawn.cardId,\r\n\t\t\t\t1,\r\n\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\totherPlayerState.board,\r\n\t\t\t\totherPlayerState.player,\r\n\t\t\t\tgameState,\r\n\t\t\t\tdeadEntity.friendly,\r\n\t\t\t\tfalse,\r\n\t\t\t\tfalse,\r\n\t\t\t\ttrue,\r\n\t\t\t\t{ ...feathermaneSpawn } as BoardEntity,\r\n\t\t\t);\r\n\r\n\t\t\t// So that it can be flagged as \"unspawned\" if it is not spawned in the end\r\n\t\t\tfor (const spawn of spawns) {\r\n\t\t\t\tspawn.onCanceledSummon = () => (feathermaneSpawn.locked = false);\r\n\t\t\t\t// spawn.backRef = feathermaneSpawn;\r\n\t\t\t}\r\n\t\t\tallSpawns.push(...spawns);\r\n\t\t}\r\n\t}\r\n\r\n\tperformEntitySpawns(\r\n\t\tallSpawns,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn allSpawns;\r\n};\r\n\r\nexport const processDeathrattleForMinion = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tprocessAvenge = true,\r\n) => {\r\n\tconst drEntities = handleNaturalDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\tconst enchEntities = handleEnchantmentsDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntities,\r\n\t\tdeadEntityPlayerState,\r\n\t\totherPlayerState,\r\n\t\tgameState,\r\n\t);\r\n\t// Avenge trigger before reborn\r\n\t// http://replays.firestoneapp.com/?reviewId=5bb20eb8-e0ca-47ab-adc7-13134716d568&turn=7&action=6\r\n\tif (processAvenge) {\r\n\t\tapplyAvengeEffects(\r\n\t\t\tdeadEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t\t[...drEntities, ...enchEntities],\r\n\t\t);\r\n\t}\r\n\r\n\t// TODO: Feathermane should be applied after the Reborn effects have all been processed\r\n\t// Secrets should be processed here (\"at Avenge speed\")\r\n\tconst afterDeathEntities = applyAfterDeathEffects(\r\n\t\tdeadEntity,\r\n\t\tindexFromRight,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\treturn [...drEntities, ...enchEntities, ...afterDeathEntities];\r\n};\r\n\r\nconst handleNaturalDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n): readonly BoardEntity[] => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\tconst allSpawns = [];\r\n\tconst spawnsToSpawn = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tdeathrattleRepeats: dr.repeats ?? 1,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t\tenchantments: [],\r\n\t\t\tmemory:\r\n\t\t\t\tdr.memory == null\r\n\t\t\t\t\t? null\r\n\t\t\t\t\t: Array.isArray(dr.memory)\r\n\t\t\t\t\t? dr.memory.map((mem) => ({ ...mem }))\r\n\t\t\t\t\t: { ...dr.memory },\r\n\t\t};\r\n\t\tconst spawns = handleNaturalDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t\t// The spawns have already been processed in the \"handleNaturalDeathrattle\" method\r\n\t\t// spawnsToSpawn.push(...spawns);\r\n\t\tallSpawns.push(...spawns);\r\n\t}\r\n\r\n\tconst entitiesFromNativeDeathrattle: readonly BoardEntity[] = spawnEntitiesFromDeathrattle(\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tdeadEntities,\r\n\t\tgameState,\r\n\t);\r\n\tallSpawns.push(...entitiesFromNativeDeathrattle);\r\n\tspawnsToSpawn.push(...entitiesFromNativeDeathrattle);\r\n\t// Some candidate entities are not spawned, and so are ignored in further processing\r\n\tconst actualSpawns = performEntitySpawns(\r\n\t\tspawnsToSpawn,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\tdeadEntity,\r\n\t\tmodifiedIndexFromRight,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\t// In case of leapfrogger, we want to first spawn the minions, then apply the frog effect\r\n\t// TODO: revisit this once Leapfroggers are in the game again\r\n\t// handleDeathrattleEffects(\r\n\t// \tdeadEntityPlayerState.board,\r\n\t// \tdeadEntityPlayerState.player,\r\n\t// \tdeadEntity,\r\n\t// \tmodifiedIndexFromRight,\r\n\t// \totherPlayerState.board,\r\n\t// \totherPlayerState.player,\r\n\t// \tgameState,\r\n\t// );\r\n\r\n\treturn actualSpawns;\r\n};\r\n\r\nconst handleEnchantmentsDeathrattle = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tskipSpawns = false,\r\n) => {\r\n\tconst modifiedIndexFromRight = Math.min(deadEntityPlayerState.board.length, indexFromRight);\r\n\tconst result = [];\r\n\tfor (const dr of deadEntity.rememberedDeathrattles ?? []) {\r\n\t\tconst entityToProcess: BoardEntity = {\r\n\t\t\t...deadEntity,\r\n\t\t\trememberedDeathrattles: undefined,\r\n\t\t\tcardId: dr.cardId,\r\n\t\t\t// So that cards that rely on the tavern tier use the base entity, and not the enchantment / remembered card\r\n\t\t\ttavernTier: gameState.cardsData.getTavernLevel(deadEntity.cardId),\r\n\t\t\tenchantments: [\r\n\t\t\t\t{\r\n\t\t\t\t\tcardId: dr.cardId,\r\n\t\t\t\t\toriginEntityId: deadEntity.entityId,\r\n\t\t\t\t\trepeats: dr.repeats ?? 1,\r\n\t\t\t\t\ttiming: dr.timing,\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t\tpendingAttackBuffs: [],\r\n\t\t};\r\n\t\tconst spawns = handleEnchantmentsDeathrattle(\r\n\t\t\tentityToProcess,\r\n\t\t\tindexFromRight,\r\n\t\t\tdeadEntities,\r\n\t\t\tdeadEntityPlayerState,\r\n\t\t\totherPlayerState,\r\n\t\t\tgameState,\r\n\t\t\t// We skip spawns, otherwise it will be added twice\r\n\t\t\ttrue,\r\n\t\t);\r\n\t\tresult.push(...spawns);\r\n\t}\r\n\tconst entitiesFromEnchantments: readonly BoardEntity[] = spawnEntitiesFromEnchantments(\r\n\t\tdeadEntity,\r\n\t\tdeadEntityPlayerState.board,\r\n\t\tdeadEntityPlayerState.player,\r\n\t\totherPlayerState.board,\r\n\t\totherPlayerState.player,\r\n\t\tgameState,\r\n\t);\r\n\tresult.push(...entitiesFromEnchantments);\r\n\tif (!skipSpawns) {\r\n\t\tperformEntitySpawns(\r\n\t\t\tresult,\r\n\t\t\tdeadEntityPlayerState.board,\r\n\t\t\tdeadEntityPlayerState.player,\r\n\t\t\tdeadEntity,\r\n\t\t\tmodifiedIndexFromRight,\r\n\t\t\totherPlayerState.board,\r\n\t\t\totherPlayerState.player,\r\n\t\t\tgameState,\r\n\t\t);\r\n\t}\r\n\treturn result;\r\n};\r\n\r\nconst processReborns = (deathrattleInput: DeathrattleInput) => {\r\n\t// const entitiesFromReborn: BoardEntity[] = [];\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\tfor (let j = 0; j < deadEntities.length; j++) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\t\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\t\t\thandleRebornForEntity(\r\n\t\t\t\t\tdeadEntityPlayerState.board,\r\n\t\t\t\t\tdeadEntityPlayerState.player,\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\totherPlayerState.board,\r\n\t\t\t\t\totherPlayerState.player,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handlePostDeathrattleEffects = (deathrattleInput: DeathrattleInput, entitiesFromDeathrattles: BoardEntity[]) => {\r\n\tconst processPlayerFirst = Math.random() > 0.5;\r\n\tconst playerStates = processPlayerFirst\r\n\t\t? [deathrattleInput.gameState.gameState.player, deathrattleInput.gameState.gameState.opponent]\r\n\t\t: [deathrattleInput.gameState.gameState.opponent, deathrattleInput.gameState.gameState.player];\r\n\tconst playerDeadEntities = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntities, deathrattleInput.opponentDeadEntities]\r\n\t\t: [deathrattleInput.opponentDeadEntities, deathrattleInput.playerDeadEntities];\r\n\tconst playerDeadEntityIndexesFromRight = processPlayerFirst\r\n\t\t? [deathrattleInput.playerDeadEntityIndexesFromRight, deathrattleInput.opponentDeadEntityIndexesFromRight]\r\n\t\t: [deathrattleInput.opponentDeadEntityIndexesFromRight, deathrattleInput.playerDeadEntityIndexesFromRight];\r\n\t// Process one player first, then the other\r\n\tfor (let i = 0; i < 2; i++) {\r\n\t\tconst deadEntities = playerDeadEntities[i];\r\n\t\tconst deadEntityPlayerState = playerStates[i];\r\n\t\tconst otherPlayerState = playerStates[1 - i];\r\n\t\tif (deadEntities.length >= 0) {\r\n\t\t\t// Process from right to left, so that we can set the hasAttacked attribute properly\r\n\t\t\t// If two minions die at the same time, both of which having attacked, but the third in line having not,\r\n\t\t\t// processing them from left to right means the first (leftmost) one will check its right neighbor, which\r\n\t\t\t// is the minion that hasn't attacked\r\n\t\t\tfor (let j = deadEntities.length - 1; j >= 0; j--) {\r\n\t\t\t\tconst deadEntity = deadEntities[j];\r\n\t\t\t\tconst indexFromRight = playerDeadEntityIndexesFromRight[i][j];\r\n\t\t\t\tconst modifiedIndexFromRight = Math.min(playerStates[i].board.length, indexFromRight);\r\n\t\t\t\thandlePostDeathrattleEffect(\r\n\t\t\t\t\tdeadEntity,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdeadEntities,\r\n\t\t\t\t\tdeadEntityPlayerState,\r\n\t\t\t\t\totherPlayerState,\r\n\t\t\t\t\tdeathrattleInput.gameState,\r\n\t\t\t\t\tentitiesFromDeathrattles,\r\n\t\t\t\t\tdeadEntityPlayerState.player.friendly,\r\n\t\t\t\t\tdeathrattleInput,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleDeathrattles = (deathrattleInput: DeathrattleInput) => {\r\n\torchestrateMinionDeathEffects(deathrattleInput, false, false);\r\n};\r\n\r\nconst handlePostDeathrattleEffect = (\r\n\tdeadEntity: BoardEntity,\r\n\tindexFromRight: number,\r\n\tdeadEntities: BoardEntity[],\r\n\tdeadEntityPlayerState: PlayerState,\r\n\totherPlayerState: PlayerState,\r\n\tgameState: FullGameState,\r\n\tspawnedEntities: BoardEntity[],\r\n\tisPlayer: boolean,\r\n\tdeathrattleInput: DeathrattleInput,\r\n) => {\r\n\t// This doesn't work if the entity that was to the right died.\r\n\tconst entityRightToSpawns =\r\n\t\tindexFromRight === 0 ? null : deadEntityPlayerState.board[deadEntityPlayerState.board.length - indexFromRight];\r\n\t// To handle minions attack tokens\r\n\t// See http://replays.firestoneapp.com/?reviewId=0583d6a4-6ed0-4b20-894e-4ceb560894fe&turn=6&action=11\r\n\t// When a minion dies, the spawn are either elligible to attack next turn or not\r\n\t// If the minion right to the spawned minion has already attacked, then the spawned\r\n\t// minion cannot attack\r\n\tspawnedEntities.forEach((entity) => {\r\n\t\tentity.hasAttacked = deadEntity.hasAttacked > 1 ? 1 : entityRightToSpawns?.hasAttacked ?? 0;\r\n\t});\r\n\r\n\tif (\r\n\t\tdeadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113) ||\r\n\t\tdeadEntityPlayerState.player.questRewards?.includes(CardIds.RitualDagger_BG24_Reward_113_ALT)\r\n\t) {\r\n\t\tconst ogDeadEntity = gameState.sharedState.deaths.find((entity) => entity.entityId === deadEntity.entityId);\r\n\t\tif (ogDeadEntity) {\r\n\t\t\togDeadEntity.attack += 4;\r\n\t\t\togDeadEntity.health += 4;\r\n\t\t}\r\n\t}\r\n\r\n\t// ISSUE: when we do this, we change the minion's stats before processing deathrattle effects, which can mess\r\n\t// up the simulation in some cases (like Nightbane, Ignited)\r\n\t// FIX: we do it in postDeathrattleEfects, not when removing minions from the board\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.UNDEAD, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.UndeadAttackBonus,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (\r\n\t\thasCorrectTribe(deadEntity, deadEntityPlayerState.player, Race.BEAST, gameState.anomalies, gameState.allCards)\r\n\t) {\r\n\t\tif (deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk > 0) {\r\n\t\t\tdeadEntity.attack = Math.max(\r\n\t\t\t\t0,\r\n\t\t\t\tdeadEntity.attack - deadEntityPlayerState.player.globalInfo.GoldrinnBuffAtk,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n};\r\n\r\ninterface DeathrattleInput {\r\n\tgameState: FullGameState;\r\n\tplayerDeadEntities: BoardEntity[];\r\n\tplayerDeadEntityIndexesFromRight: number[];\r\n\topponentDeadEntities: BoardEntity[];\r\n\topponentDeadEntityIndexesFromRight: number[];\r\n}\r\n"]}
|
|
@@ -5,5 +5,5 @@ import { FullGameState } from './internal-game-state';
|
|
|
5
5
|
export declare const simplifiedSpawnEntities: (cardId: string, quantity: number, input: DeathrattleTriggeredInput, boardEntityToSpawn?: BoardEntity) => readonly BoardEntity[];
|
|
6
6
|
export declare const simplifiedSpawnEntitiesWithAddToBoard: (cardId: string, quantity: number, input: DeathrattleTriggeredInput, source: BoardEntity, indexFromRight: number, boardEntityToSpawn?: BoardEntity) => void;
|
|
7
7
|
export declare const spawnEntities: (cardId: string, quantity: number, boardToSpawnInto: BoardEntity[], boardToSpawnIntoHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherHero: BgsPlayerEntity, gameState: FullGameState, friendly: boolean, limitSpawns: boolean, spawnReborn?: boolean, useKhadgar?: boolean, boardEntityToSpawn?: BoardEntity, originalEntity?: BoardEntity) => readonly BoardEntity[];
|
|
8
|
-
export declare const spawnEntitiesFromDeathrattle: (deadEntity: BoardEntity, boardWithDeadEntity: BoardEntity[], boardWithDeadEntityHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherBoardHero: BgsPlayerEntity, entitiesDeadThisAttack: readonly BoardEntity[], gameState: FullGameState) => readonly BoardEntity[];
|
|
8
|
+
export declare const spawnEntitiesFromDeathrattle: (deadEntity: BoardEntity, deadEntityIndexFromRight: number, boardWithDeadEntity: BoardEntity[], boardWithDeadEntityHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherBoardHero: BgsPlayerEntity, entitiesDeadThisAttack: readonly BoardEntity[], gameState: FullGameState) => readonly BoardEntity[];
|
|
9
9
|
export declare const spawnEntitiesFromEnchantments: (deadEntity: BoardEntity, boardWithDeadEntity: BoardEntity[], boardWithDeadEntityHero: BgsPlayerEntity, otherBoard: BoardEntity[], otherBoardHero: BgsPlayerEntity, gameState: FullGameState) => readonly BoardEntity[];
|
|
@@ -4,12 +4,18 @@ exports.spawnEntitiesFromEnchantments = exports.spawnEntitiesFromDeathrattle = e
|
|
|
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");
|
|
7
|
+
const divine_shield_1 = require("../keywords/divine-shield");
|
|
8
|
+
const taunt_1 = require("../keywords/taunt");
|
|
9
|
+
const windfury_1 = require("../keywords/windfury");
|
|
7
10
|
const utils_1 = require("../services/utils");
|
|
8
11
|
const utils_2 = require("../utils");
|
|
12
|
+
const attack_1 = require("./attack");
|
|
9
13
|
const cards_in_hand_1 = require("./cards-in-hand");
|
|
10
14
|
const deathrattle_effects_1 = require("./deathrattle-effects");
|
|
11
15
|
const deathrattle_on_trigger_1 = require("./deathrattle-on-trigger");
|
|
12
16
|
const spawns_1 = require("./spawns");
|
|
17
|
+
const stats_1 = require("./stats");
|
|
18
|
+
const golden_1 = require("./utils/golden");
|
|
13
19
|
const simplifiedSpawnEntities = (cardId, quantity, input, boardEntityToSpawn = null) => {
|
|
14
20
|
return (0, exports.spawnEntities)(cardId, quantity, input.boardWithDeadEntity, input.boardWithDeadEntityHero, input.otherBoard, input.otherBoardHero, input.gameState, input.deadEntity.friendly, false, false, false, boardEntityToSpawn);
|
|
15
21
|
};
|
|
@@ -50,8 +56,8 @@ const spawnEntities = (cardId, quantity, boardToSpawnInto, boardToSpawnIntoHero,
|
|
|
50
56
|
return result;
|
|
51
57
|
};
|
|
52
58
|
exports.spawnEntities = spawnEntities;
|
|
53
|
-
const spawnEntitiesFromDeathrattle = (deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, entitiesDeadThisAttack, gameState) => {
|
|
54
|
-
var _a, _b, _c, _d, _e;
|
|
59
|
+
const spawnEntitiesFromDeathrattle = (deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, entitiesDeadThisAttack, gameState) => {
|
|
60
|
+
var _a, _b, _c, _d, _e, _f;
|
|
55
61
|
const multiplier = (0, deathrattle_effects_1.computeDeathrattleMultiplier)([...boardWithDeadEntity], boardWithDeadEntityHero, deadEntity, gameState.sharedState);
|
|
56
62
|
const deathrattleTriggeredInput = {
|
|
57
63
|
boardWithDeadEntity,
|
|
@@ -62,9 +68,12 @@ const spawnEntitiesFromDeathrattle = (deadEntity, boardWithDeadEntity, boardWith
|
|
|
62
68
|
gameState,
|
|
63
69
|
};
|
|
64
70
|
const spawnedEntities = [];
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
const enchantments = [
|
|
72
|
+
...((_a = deadEntity.enchantments) !== null && _a !== void 0 ? _a : []),
|
|
73
|
+
].sort((a, b) => a.timing - b.timing);
|
|
74
|
+
const cardIds = [deadEntity.cardId, ...((_b = deadEntity.additionalCards) !== null && _b !== void 0 ? _b : []), ...enchantments.map((e) => e.cardId)];
|
|
75
|
+
for (const deadEntityCardId of cardIds) {
|
|
76
|
+
for (let i = 0; i < multiplier; i++) {
|
|
68
77
|
let hasTriggered = true;
|
|
69
78
|
const spawnEntityImpl = _card_mappings_1.cardMappings[deadEntityCardId];
|
|
70
79
|
if ((0, card_interface_1.hasDeathrattleSpawn)(spawnEntityImpl)) {
|
|
@@ -268,7 +277,7 @@ const spawnEntitiesFromDeathrattle = (deadEntity, boardWithDeadEntity, boardWith
|
|
|
268
277
|
case "BG26_804":
|
|
269
278
|
case "BG26_804_G":
|
|
270
279
|
const stats = deadEntity.scriptDataNum1 ||
|
|
271
|
-
((
|
|
280
|
+
((_c = gameState.sharedState.deaths.find((e) => e.friendly === deadEntity.friendly && e.cardId === deadEntity.cardId)) === null || _c === void 0 ? void 0 : _c.scriptDataNum1) ||
|
|
272
281
|
0;
|
|
273
282
|
const octosariSpawn = deadEntity.cardId === "BG26_804_G"
|
|
274
283
|
? "BG26_803_Gt"
|
|
@@ -284,7 +293,7 @@ const spawnEntitiesFromDeathrattle = (deadEntity, boardWithDeadEntity, boardWith
|
|
|
284
293
|
case "BG26_350_G":
|
|
285
294
|
const bassgillIterations = deadEntity.cardId === "BG26_350_G" ? 2 : 1;
|
|
286
295
|
for (let i = 0; i < bassgillIterations; i++) {
|
|
287
|
-
const hand = (
|
|
296
|
+
const hand = (_e = (_d = boardWithDeadEntityHero.hand) === null || _d === void 0 ? void 0 : _d.filter((e) => (0, utils_2.hasCorrectTribe)(e, boardWithDeadEntityHero, reference_data_1.Race.MURLOC, gameState.anomalies, gameState.allCards)).filter((e) => !!(e === null || e === void 0 ? void 0 : e.cardId)).filter((e) => !e.locked)) !== null && _e !== void 0 ? _e : [];
|
|
288
297
|
const highestHealth = Math.max(...hand.filter((c) => c.health).map((c) => c.health));
|
|
289
298
|
const highestHealthMinions = highestHealth
|
|
290
299
|
? hand.filter((c) => c.health === highestHealth)
|
|
@@ -327,7 +336,7 @@ const spawnEntitiesFromDeathrattle = (deadEntity, boardWithDeadEntity, boardWith
|
|
|
327
336
|
const magnanimooseCopies = deadEntity.cardId === "BGDUO_105_G" ? 2 : 1;
|
|
328
337
|
for (let i = 0; i < magnanimooseCopies; i++) {
|
|
329
338
|
const teammateState = (0, utils_2.getTeammateInitialState)(gameState.gameState, boardWithDeadEntityHero);
|
|
330
|
-
const teammateBoard = (
|
|
339
|
+
const teammateBoard = (_f = teammateState === null || teammateState === void 0 ? void 0 : teammateState.board) !== null && _f !== void 0 ? _f : [];
|
|
331
340
|
const copied = [];
|
|
332
341
|
const minionToCopy = (0, utils_1.pickRandom)(teammateBoard.filter((e) => !copied.includes(e.entityId)));
|
|
333
342
|
if (minionToCopy) {
|
|
@@ -346,8 +355,310 @@ const spawnEntitiesFromDeathrattle = (deadEntity, boardWithDeadEntity, boardWith
|
|
|
346
355
|
case "BG26_RLK_833":
|
|
347
356
|
spawnedEntities.push(...(0, exports.spawnEntities)("RLK_833t", 1, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState, deadEntity.friendly, false));
|
|
348
357
|
break;
|
|
358
|
+
case "TB_BaconShop_HERO_76_Buddy":
|
|
359
|
+
case "TB_BaconShop_HERO_76_Buddy_G":
|
|
360
|
+
const iterations = deadEntityCardId === "TB_BaconShop_HERO_76_Buddy_G" ? 2 : 1;
|
|
361
|
+
for (let j = 0; j < iterations; j++) {
|
|
362
|
+
let validTargets = boardWithDeadEntity.filter((entity) => !entity.divineShield);
|
|
363
|
+
if (!(validTargets === null || validTargets === void 0 ? void 0 : validTargets.length)) {
|
|
364
|
+
validTargets = boardWithDeadEntity.filter((entity) => !entity.taunt);
|
|
365
|
+
if (!(validTargets === null || validTargets === void 0 ? void 0 : validTargets.length)) {
|
|
366
|
+
validTargets = boardWithDeadEntity.filter((entity) => !entity.windfury);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const target = (0, utils_1.pickRandom)(validTargets);
|
|
370
|
+
if (target) {
|
|
371
|
+
if (!target.divineShield) {
|
|
372
|
+
(0, divine_shield_1.updateDivineShield)(target, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, true, gameState);
|
|
373
|
+
}
|
|
374
|
+
(0, taunt_1.updateTaunt)(target, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);
|
|
375
|
+
(0, windfury_1.updateWindfury)(target, true, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, gameState);
|
|
376
|
+
gameState.spectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
break;
|
|
380
|
+
case "BGS_040":
|
|
381
|
+
case "TB_BaconUps_154":
|
|
382
|
+
const nadinaMultiplier = deadEntityCardId === "TB_BaconUps_154" ? 6 : 3;
|
|
383
|
+
for (let j = 0; j < nadinaMultiplier; j++) {
|
|
384
|
+
const validTargets = boardWithDeadEntity
|
|
385
|
+
.filter((e) => (0, utils_2.hasCorrectTribe)(e, boardWithDeadEntityHero, reference_data_1.Race.DRAGON, gameState.anomalies, gameState.allCards))
|
|
386
|
+
.filter((entity) => !entity.divineShield);
|
|
387
|
+
const target = (0, utils_1.pickRandom)(validTargets);
|
|
388
|
+
if (target) {
|
|
389
|
+
(0, divine_shield_1.updateDivineShield)(target, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, true, gameState);
|
|
390
|
+
gameState.spectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
break;
|
|
394
|
+
case "BG_OG_256":
|
|
395
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, 1, 1, gameState);
|
|
396
|
+
break;
|
|
397
|
+
case "TB_BaconUps_025":
|
|
398
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, 2, 2, gameState);
|
|
399
|
+
break;
|
|
400
|
+
case "YOD_026":
|
|
401
|
+
(0, utils_2.grantRandomAttack)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity.attack, gameState);
|
|
402
|
+
break;
|
|
403
|
+
case "TB_BaconUps_112":
|
|
404
|
+
(0, utils_2.grantRandomAttack)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity.attack, gameState);
|
|
405
|
+
(0, utils_2.grantRandomAttack)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity.attack, gameState);
|
|
406
|
+
break;
|
|
407
|
+
case "BG29_815":
|
|
408
|
+
case "BG29_815_G":
|
|
409
|
+
const nightbaneLoops = deadEntityCardId === "BG29_815_G" ? 2 : 1;
|
|
410
|
+
for (let j = 0; j < nightbaneLoops; j++) {
|
|
411
|
+
const pickedTargetEntityIds = [];
|
|
412
|
+
for (let k = 0; k < 2; k++) {
|
|
413
|
+
const target = (0, utils_1.pickRandomAlive)(boardWithDeadEntity
|
|
414
|
+
.filter((e) => ![
|
|
415
|
+
"BG29_815",
|
|
416
|
+
"BG29_815_G",
|
|
417
|
+
].includes(e.cardId))
|
|
418
|
+
.filter((e) => !pickedTargetEntityIds.includes(e.entityId)));
|
|
419
|
+
if (!!target) {
|
|
420
|
+
pickedTargetEntityIds.push(target.entityId);
|
|
421
|
+
(0, stats_1.modifyStats)(target, deadEntity, deadEntity.attack, 0, boardWithDeadEntity, boardWithDeadEntityHero, gameState);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
break;
|
|
426
|
+
case "BG21_000":
|
|
427
|
+
(0, deathrattle_effects_1.applyLeapFroggerEffect)(boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, false, gameState, deadEntity.deathrattleRepeats);
|
|
428
|
+
break;
|
|
429
|
+
case "BG21_000_G":
|
|
430
|
+
(0, deathrattle_effects_1.applyLeapFroggerEffect)(boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, true, gameState, deadEntity.deathrattleRepeats);
|
|
431
|
+
break;
|
|
432
|
+
case "BG21_001":
|
|
433
|
+
const target = (0, utils_2.grantRandomStats)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, 6, 6, reference_data_1.Race.BEAST, true, gameState);
|
|
434
|
+
if (!!target) {
|
|
435
|
+
gameState.spectator.registerPowerTarget(deadEntity, target, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero);
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
case "BG21_001_G":
|
|
439
|
+
const crocTarget = (0, utils_2.grantRandomStats)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, 12, 12, reference_data_1.Race.BEAST, true, gameState);
|
|
440
|
+
if (!!crocTarget) {
|
|
441
|
+
gameState.spectator.registerPowerTarget(deadEntity, crocTarget, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero);
|
|
442
|
+
}
|
|
443
|
+
break;
|
|
444
|
+
case "BG25_022":
|
|
445
|
+
case "BG25_022_G":
|
|
446
|
+
const scarletMultiplier = deadEntityCardId === "BG25_022_G" ? 2 : 1;
|
|
447
|
+
const scarletTarget = (0, utils_2.grantRandomStats)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, scarletMultiplier * 1, scarletMultiplier * 2, reference_data_1.Race.UNDEAD, false, gameState);
|
|
448
|
+
if (!!scarletTarget) {
|
|
449
|
+
gameState.spectator.registerPowerTarget(deadEntity, scarletTarget, boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero);
|
|
450
|
+
}
|
|
451
|
+
break;
|
|
452
|
+
case "TB_BaconShop_HERO_17_Buddy":
|
|
453
|
+
case "TB_BaconShop_HERO_17_Buddy_G":
|
|
454
|
+
const squirrelDamage = deadEntity.cardId === "TB_BaconShop_HERO_17_Buddy_G" ? 4 : 2;
|
|
455
|
+
const numberOfDeadMechsThisCombat = gameState.sharedState.deaths
|
|
456
|
+
.filter((entity) => entity.friendly === deadEntity.friendly)
|
|
457
|
+
.filter((entity) => (0, utils_2.hasCorrectTribe)(entity, boardWithDeadEntityHero, reference_data_1.Race.MECH, gameState.anomalies, gameState.allCards)).length;
|
|
458
|
+
for (let j = 0; j < numberOfDeadMechsThisCombat; j++) {
|
|
459
|
+
(0, attack_1.dealDamageToRandomEnemy)(otherBoard, otherBoardHero, deadEntity, squirrelDamage, boardWithDeadEntity, boardWithDeadEntityHero, gameState);
|
|
460
|
+
}
|
|
461
|
+
break;
|
|
462
|
+
case "BG_BOT_606":
|
|
463
|
+
case "TB_BaconUps_028":
|
|
464
|
+
const kaboomLoops = deadEntity.cardId === "TB_BaconUps_028" ? 2 : 1;
|
|
465
|
+
const baseDamage = 4 +
|
|
466
|
+
boardWithDeadEntityHero.trinkets.filter((t) => t.cardId === "BG30_MagicItem_803").length *
|
|
467
|
+
10;
|
|
468
|
+
for (let j = 0; j < kaboomLoops; j++) {
|
|
469
|
+
(0, attack_1.dealDamageToRandomEnemy)(otherBoard, otherBoardHero, deadEntity, baseDamage, boardWithDeadEntity, boardWithDeadEntityHero, gameState);
|
|
470
|
+
}
|
|
471
|
+
break;
|
|
472
|
+
case "BG29_843":
|
|
473
|
+
case "BG29_843_G":
|
|
474
|
+
const fireDancerLoops = deadEntity.cardId === "BG29_843_G" ? 2 : 1;
|
|
475
|
+
for (let j = 0; j < fireDancerLoops; j++) {
|
|
476
|
+
const minionsToDamage = [...otherBoard, ...boardWithDeadEntity];
|
|
477
|
+
for (const target of minionsToDamage) {
|
|
478
|
+
const isSameSide = target.friendly === deadEntity.friendly;
|
|
479
|
+
const board = isSameSide ? boardWithDeadEntity : otherBoard;
|
|
480
|
+
const hero = isSameSide ? boardWithDeadEntityHero : otherBoardHero;
|
|
481
|
+
(0, attack_1.dealDamageToMinion)(target, board, hero, deadEntity, 1, isSameSide ? otherBoard : boardWithDeadEntity, isSameSide ? otherBoardHero : boardWithDeadEntityHero, gameState);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
(0, attack_1.processMinionDeath)(boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);
|
|
485
|
+
break;
|
|
486
|
+
case "BG28_968":
|
|
487
|
+
case "BG28_968_G":
|
|
488
|
+
const lighterFighterDamage = deadEntity.cardId === "BG28_968_G" ? 8 : 4;
|
|
489
|
+
for (let j = 0; j < 2; j++) {
|
|
490
|
+
const target = (0, utils_1.pickRandomLowestHealth)(otherBoard);
|
|
491
|
+
gameState.spectator.registerPowerTarget(deadEntity, target, otherBoard, boardWithDeadEntityHero, otherBoardHero);
|
|
492
|
+
(0, attack_1.dealDamageToMinion)(target, otherBoard, otherBoardHero, deadEntity, lighterFighterDamage, boardWithDeadEntity, boardWithDeadEntityHero, gameState);
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
case "BG25_165":
|
|
496
|
+
case "BG25_165_G":
|
|
497
|
+
const boomboxDamage = deadEntity.cardId === "BG25_165_G" ? 14 : 7;
|
|
498
|
+
const targets = (0, attack_1.findNearestEnemies)(boardWithDeadEntity, null, deadEntityIndexFromRight, otherBoard, 2, gameState.allCards);
|
|
499
|
+
targets.forEach((target) => {
|
|
500
|
+
(0, attack_1.dealDamageToMinion)(target, otherBoard, otherBoardHero, deadEntity, boomboxDamage, boardWithDeadEntity, boardWithDeadEntityHero, gameState);
|
|
501
|
+
});
|
|
502
|
+
break;
|
|
503
|
+
case "BG_FP1_024":
|
|
504
|
+
case "TB_BaconUps_118":
|
|
505
|
+
const damage = deadEntityCardId === "TB_BaconUps_118" ? 2 : 1;
|
|
506
|
+
const minionsToDamage = [...otherBoard, ...boardWithDeadEntity];
|
|
507
|
+
for (const target of minionsToDamage) {
|
|
508
|
+
const isSameSide = target.friendly === deadEntity.friendly;
|
|
509
|
+
const board = isSameSide ? boardWithDeadEntity : otherBoard;
|
|
510
|
+
const hero = isSameSide ? boardWithDeadEntityHero : otherBoardHero;
|
|
511
|
+
(0, attack_1.dealDamageToMinion)(target, board, hero, deadEntity, damage, isSameSide ? otherBoard : boardWithDeadEntity, isSameSide ? otherBoardHero : boardWithDeadEntityHero, gameState);
|
|
512
|
+
}
|
|
513
|
+
break;
|
|
514
|
+
case "BG25_399":
|
|
515
|
+
case "BG25_399_G":
|
|
516
|
+
const radioQuantity = deadEntityCardId === "BG25_399_G" ? 2 : 1;
|
|
517
|
+
const radioEntities = Array(radioQuantity).fill(deadEntity.lastAffectedByEntity);
|
|
518
|
+
(0, cards_in_hand_1.addCardsInHand)(boardWithDeadEntityHero, boardWithDeadEntity, radioEntities, gameState);
|
|
519
|
+
break;
|
|
520
|
+
case "BG28_900":
|
|
521
|
+
case "BG28_900_G":
|
|
522
|
+
const loops = deadEntityCardId === "BG28_900_G" ? 2 : 1;
|
|
523
|
+
const cardsToAdd = Array(loops).fill(null);
|
|
524
|
+
(0, cards_in_hand_1.addCardsInHand)(boardWithDeadEntityHero, boardWithDeadEntity, cardsToAdd, gameState);
|
|
525
|
+
break;
|
|
526
|
+
case "TB_BaconShop_HERO_41_Buddy":
|
|
527
|
+
case "TB_BaconShop_HERO_41_Buddy_G":
|
|
528
|
+
const numberToGild = deadEntityCardId === "TB_BaconShop_HERO_41_Buddy_G" ? 2 : 1;
|
|
529
|
+
const targetBoard = boardWithDeadEntity.filter((e) => !e.definitelyDead && e.health > 0);
|
|
530
|
+
for (let i = 0; i < Math.min(numberToGild, boardWithDeadEntity.length); i++) {
|
|
531
|
+
const rightMostMinion = targetBoard[targetBoard.length - 1 - i];
|
|
532
|
+
if (rightMostMinion) {
|
|
533
|
+
(0, golden_1.makeMinionGolden)(rightMostMinion, deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
break;
|
|
537
|
+
case "BG26_360":
|
|
538
|
+
case "BG26_360_G":
|
|
539
|
+
const statsScourfin = deadEntityCardId === "BG26_360_G" ? 10 : 5;
|
|
540
|
+
(0, utils_2.grantRandomStats)(deadEntity, boardWithDeadEntityHero.hand.filter((e) => {
|
|
541
|
+
var _a;
|
|
542
|
+
return ((_a = gameState.allCards.getCard(e.cardId).type) === null || _a === void 0 ? void 0 : _a.toUpperCase()) ===
|
|
543
|
+
reference_data_1.CardType[reference_data_1.CardType.MINION];
|
|
544
|
+
}), boardWithDeadEntityHero, statsScourfin, statsScourfin, null, true, gameState);
|
|
545
|
+
break;
|
|
546
|
+
case "BG23_017":
|
|
547
|
+
case "BG23_017_G":
|
|
548
|
+
const sanguineChampionStats = deadEntityCardId === "BG23_017" ? 1 : 2;
|
|
549
|
+
boardWithDeadEntityHero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;
|
|
550
|
+
boardWithDeadEntityHero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;
|
|
551
|
+
break;
|
|
552
|
+
case "BG26_160":
|
|
553
|
+
case "BG26_160_G":
|
|
554
|
+
const piperBuff = deadEntityCardId === "BG26_160" ? 1 : 2;
|
|
555
|
+
boardWithDeadEntityHero.globalInfo.BloodGemAttackBonus += piperBuff;
|
|
556
|
+
break;
|
|
557
|
+
case "BG_RLK_957":
|
|
558
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, 2, 1, gameState, reference_data_1.Race[reference_data_1.Race.UNDEAD]);
|
|
559
|
+
break;
|
|
560
|
+
case "BG26_GIL_513":
|
|
561
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, 1, 0, gameState, null);
|
|
562
|
+
break;
|
|
563
|
+
case "BG_ICC_099":
|
|
564
|
+
for (const entity of boardWithDeadEntity) {
|
|
565
|
+
(0, attack_1.dealDamageToMinion)(entity, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, 5, otherBoard, otherBoardHero, gameState);
|
|
566
|
+
}
|
|
567
|
+
break;
|
|
568
|
+
case "BG27_006":
|
|
569
|
+
case "BG27_006_G":
|
|
570
|
+
const witheredSpearhideCardsToAdd = Array(deadEntity.cardId === "BG27_006_G" ? 2 : 1).fill("BG20_GEM");
|
|
571
|
+
(0, cards_in_hand_1.addCardsInHand)(boardWithDeadEntityHero, boardWithDeadEntity, witheredSpearhideCardsToAdd, gameState);
|
|
572
|
+
break;
|
|
573
|
+
case "BG26_055":
|
|
574
|
+
case "BG26_055_G":
|
|
575
|
+
(0, deathrattle_effects_1.applyRecurringNightmareDeathrattleEffect)(boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, deadEntityCardId === "BG26_055_G", gameState);
|
|
576
|
+
break;
|
|
577
|
+
case "BG27_080":
|
|
578
|
+
case "BG27_080_G":
|
|
579
|
+
const motleyBuff = deadEntity.cardId === "BG27_080_G" ? 2 : 1;
|
|
580
|
+
(0, utils_2.grantStatsToMinionsOfEachType)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, motleyBuff * 2, motleyBuff * 1, gameState);
|
|
581
|
+
break;
|
|
582
|
+
case "BG28_304":
|
|
583
|
+
case "BG28_304_G":
|
|
584
|
+
const moroesBuffAtk = deadEntity.cardId === "BG28_304_G" ? 6 : 3;
|
|
585
|
+
const moroesBuffHealth = deadEntity.cardId === "BG28_304_G" ? 10 : 5;
|
|
586
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, moroesBuffAtk, moroesBuffHealth, gameState, reference_data_1.Race[reference_data_1.Race.UNDEAD]);
|
|
587
|
+
break;
|
|
588
|
+
case "BG28_306":
|
|
589
|
+
case "BG28_306_G":
|
|
590
|
+
const steadfastSpiritBuff = deadEntity.cardId === "BG28_306_G" ? 2 : 1;
|
|
591
|
+
(0, utils_2.addStatsToBoard)(deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, steadfastSpiritBuff, steadfastSpiritBuff, gameState);
|
|
592
|
+
break;
|
|
593
|
+
case "BG26_148":
|
|
594
|
+
case "BG26_148_G":
|
|
595
|
+
const scraperToAddQuantity = deadEntity.cardId === "BG26_148_G" ? 2 : 1;
|
|
596
|
+
const scraperCardsToAdd = [];
|
|
597
|
+
for (let i = 0; i < scraperToAddQuantity; i++) {
|
|
598
|
+
scraperCardsToAdd.push((0, utils_1.pickRandom)(gameState.cardsData.scrapScraperSpawns));
|
|
599
|
+
}
|
|
600
|
+
(0, cards_in_hand_1.addCardsInHand)(boardWithDeadEntityHero, boardWithDeadEntity, scraperCardsToAdd, gameState);
|
|
601
|
+
break;
|
|
602
|
+
case "BG29_862":
|
|
603
|
+
case "BG29_862_G":
|
|
604
|
+
const conjurerToAddQuantity = deadEntity.cardId === "BG29_862_G" ? 2 : 1;
|
|
605
|
+
const conjurerCardsToAdd = [];
|
|
606
|
+
for (let i = 0; i < conjurerToAddQuantity; i++) {
|
|
607
|
+
conjurerCardsToAdd.push((0, utils_1.pickRandom)(gameState.cardsData.battlecryMinions));
|
|
608
|
+
}
|
|
609
|
+
(0, cards_in_hand_1.addCardsInHand)(boardWithDeadEntityHero, boardWithDeadEntity, conjurerCardsToAdd, gameState);
|
|
610
|
+
break;
|
|
611
|
+
case "BG25_HERO_103_Buddy":
|
|
612
|
+
case "BG25_HERO_103_Buddy_G":
|
|
613
|
+
const shadowyLoops = deadEntity.cardId === "BG25_HERO_103_Buddy_G" ? 2 : 1;
|
|
614
|
+
for (let j = 0; j < shadowyLoops; j++) {
|
|
615
|
+
const atkBuff = deadEntity.attack;
|
|
616
|
+
const healthBuff = deadEntity.maxHealth;
|
|
617
|
+
const target = (0, utils_1.pickRandom)(boardWithDeadEntity.filter((e) => e.entityId !== deadEntity.entityId));
|
|
618
|
+
if (target) {
|
|
619
|
+
(0, stats_1.modifyStats)(target, deadEntity, atkBuff, healthBuff, boardWithDeadEntity, boardWithDeadEntityHero, gameState);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
break;
|
|
623
|
+
case "BG29_808":
|
|
624
|
+
case "BG29_808_G":
|
|
625
|
+
const spikedSaviorLoops = deadEntity.cardId === "BG29_808_G" ? 2 : 1;
|
|
626
|
+
for (let j = 0; j < spikedSaviorLoops; j++) {
|
|
627
|
+
const targetBoard = [...boardWithDeadEntity];
|
|
628
|
+
for (const entity of targetBoard) {
|
|
629
|
+
(0, stats_1.modifyStats)(entity, deadEntity, 0, 1, boardWithDeadEntity, boardWithDeadEntityHero, gameState);
|
|
630
|
+
}
|
|
631
|
+
for (const entity of targetBoard) {
|
|
632
|
+
(0, attack_1.dealDamageToMinion)(entity, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, 1, otherBoard, otherBoardHero, gameState);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
break;
|
|
636
|
+
case "BG30_MagicItem_917e":
|
|
637
|
+
(0, cards_in_hand_1.addCardsInHand)(boardWithDeadEntityHero, boardWithDeadEntity, [null], gameState);
|
|
638
|
+
break;
|
|
639
|
+
case "BG30_MagicItem_411e":
|
|
640
|
+
(0, cards_in_hand_1.addCardsInHand)(boardWithDeadEntityHero, boardWithDeadEntity, ["BG20_GEM"], gameState);
|
|
641
|
+
break;
|
|
642
|
+
case "BG21_000e":
|
|
643
|
+
case "BG21_000_Ge":
|
|
644
|
+
(0, deathrattle_effects_1.applyLeapFroggerEffect)(boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, deadEntityCardId === "BG21_000_Ge", gameState, 1);
|
|
645
|
+
break;
|
|
646
|
+
case "BG22_HERO_001_Buddy_e1":
|
|
647
|
+
(0, deathrattle_effects_1.applyEarthInvocationEnchantment)(boardWithDeadEntity, deadEntity, deadEntity, gameState);
|
|
648
|
+
break;
|
|
649
|
+
case "BG22_HERO_001_Buddy_e2":
|
|
650
|
+
(0, deathrattle_effects_1.applyFireInvocationEnchantment)(boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, deadEntity, gameState);
|
|
651
|
+
break;
|
|
652
|
+
case "BG22_HERO_001_Buddy_e3":
|
|
653
|
+
(0, deathrattle_effects_1.applyWaterInvocationEnchantment)(boardWithDeadEntity, boardWithDeadEntityHero, otherBoardHero, deadEntity, deadEntity, gameState);
|
|
654
|
+
break;
|
|
655
|
+
case "BG22_HERO_001_Buddy_e4":
|
|
656
|
+
(0, deathrattle_effects_1.applyLightningInvocationEnchantment)(boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, otherBoard, otherBoardHero, gameState);
|
|
657
|
+
break;
|
|
349
658
|
default:
|
|
350
|
-
|
|
659
|
+
if (!(0, reference_data_1.hasMechanic)(gameState.allCards.getCard(deadEntityCardId), reference_data_1.GameTag.DEATHRATTLE)) {
|
|
660
|
+
hasTriggered = false;
|
|
661
|
+
}
|
|
351
662
|
break;
|
|
352
663
|
}
|
|
353
664
|
}
|